2021-01-31 14:15:03 +01:00
|
|
|
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
2021-04-27 23:08:47 +02:00
|
|
|
load("//ts/svelte:svelte.bzl", "compile_svelte", "svelte_check")
|
2021-01-31 14:15:03 +01:00
|
|
|
load("//ts:prettier.bzl", "prettier_test")
|
|
|
|
load("//ts:eslint.bzl", "eslint_test")
|
2021-03-20 05:02:19 +01:00
|
|
|
load("//ts:esbuild.bzl", "esbuild")
|
2021-04-20 02:07:15 +02:00
|
|
|
load("//ts:vendor.bzl", "copy_bootstrap_icons", "copy_mdi_icons")
|
2021-04-13 18:17:32 +02:00
|
|
|
load("//ts:compile_sass.bzl", "compile_sass")
|
2021-01-31 19:03:40 +01:00
|
|
|
|
2021-04-27 23:08:47 +02:00
|
|
|
svelte_files = glob(["*.svelte"])
|
|
|
|
|
|
|
|
svelte_names = [f.replace(".svelte", "") for f in svelte_files]
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "svelte_components",
|
|
|
|
srcs = svelte_names,
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
compile_svelte(
|
|
|
|
name = "svelte",
|
|
|
|
srcs = svelte_files,
|
2021-05-19 03:45:02 +02:00
|
|
|
visibility = ["//visibility:public"],
|
2021-04-28 13:09:25 +02:00
|
|
|
deps = [
|
|
|
|
"//ts/components",
|
|
|
|
],
|
2021-04-27 23:08:47 +02:00
|
|
|
)
|
|
|
|
|
2021-04-13 18:17:32 +02:00
|
|
|
compile_sass(
|
2021-04-12 06:18:30 +02:00
|
|
|
srcs = [
|
|
|
|
"editable.scss",
|
2021-04-19 23:51:09 +02:00
|
|
|
],
|
|
|
|
group = "editable_scss",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
|
|
|
"//ts/sass:scrollbar_lib",
|
2021-07-05 12:45:44 +02:00
|
|
|
"//ts/sass/codemirror",
|
2021-04-19 23:51:09 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
compile_sass(
|
|
|
|
srcs = [
|
2021-05-19 03:45:02 +02:00
|
|
|
"fields.scss",
|
2021-04-12 06:18:30 +02:00
|
|
|
],
|
2021-04-13 18:17:32 +02:00
|
|
|
group = "base_css",
|
2021-04-12 06:18:30 +02:00
|
|
|
visibility = ["//visibility:public"],
|
2021-04-13 18:17:32 +02:00
|
|
|
deps = [
|
|
|
|
"//ts/sass:base_lib",
|
|
|
|
"//ts/sass:buttons_lib",
|
|
|
|
"//ts/sass:scrollbar_lib",
|
|
|
|
],
|
2021-01-31 19:03:40 +01:00
|
|
|
)
|
2021-01-31 14:15:03 +01:00
|
|
|
|
2021-04-27 23:08:47 +02:00
|
|
|
compile_sass(
|
|
|
|
srcs = [
|
|
|
|
"bootstrap.scss",
|
|
|
|
"legacy.scss",
|
|
|
|
],
|
|
|
|
group = "local_css",
|
2021-05-19 03:45:02 +02:00
|
|
|
visibility = ["//visibility:public"],
|
2021-04-27 23:08:47 +02:00
|
|
|
deps = [
|
|
|
|
"//ts/sass:button_mixins_lib",
|
|
|
|
"//ts/sass/bootstrap",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-01-31 14:15:03 +01:00
|
|
|
ts_library(
|
|
|
|
name = "editor_ts",
|
|
|
|
srcs = glob(["*.ts"]),
|
2021-03-26 04:58:03 +01:00
|
|
|
tsconfig = "//ts:tsconfig.json",
|
2021-01-31 14:15:03 +01:00
|
|
|
deps = [
|
2021-04-20 02:07:15 +02:00
|
|
|
"//ts/lib",
|
|
|
|
"//ts/sveltelib",
|
2021-04-27 23:08:47 +02:00
|
|
|
"//ts/components",
|
2021-03-25 00:43:01 +01:00
|
|
|
"//ts/html-filter",
|
2021-04-28 13:09:25 +02:00
|
|
|
"//ts:image_module_support",
|
2021-04-20 02:07:15 +02:00
|
|
|
"@npm//svelte",
|
2021-06-17 14:44:03 +02:00
|
|
|
"@npm//@types/codemirror",
|
|
|
|
"@npm//codemirror",
|
2021-05-06 23:04:38 +02:00
|
|
|
] + svelte_names,
|
2021-01-31 14:15:03 +01:00
|
|
|
)
|
|
|
|
|
2021-03-28 18:47:06 +02:00
|
|
|
copy_bootstrap_icons(
|
2021-03-26 04:18:16 +01:00
|
|
|
name = "bootstrap-icons",
|
2021-04-20 02:07:15 +02:00
|
|
|
icons = [
|
|
|
|
"pin-angle.svg",
|
|
|
|
|
|
|
|
# inline formatting
|
|
|
|
"type-bold.svg",
|
|
|
|
"type-italic.svg",
|
|
|
|
"type-underline.svg",
|
|
|
|
"eraser.svg",
|
|
|
|
"square-fill.svg",
|
|
|
|
"paperclip.svg",
|
|
|
|
"mic.svg",
|
|
|
|
|
|
|
|
# block formatting
|
|
|
|
"list-ul.svg",
|
|
|
|
"list-ol.svg",
|
|
|
|
"text-paragraph.svg",
|
|
|
|
"justify.svg",
|
|
|
|
"text-left.svg",
|
|
|
|
"text-right.svg",
|
|
|
|
"text-center.svg",
|
|
|
|
"text-indent-left.svg",
|
|
|
|
"text-indent-right.svg",
|
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
copy_mdi_icons(
|
|
|
|
name = "mdi-icons",
|
|
|
|
icons = [
|
|
|
|
"format-superscript.svg",
|
|
|
|
"format-subscript.svg",
|
|
|
|
"function-variant.svg",
|
2021-07-01 11:46:39 +02:00
|
|
|
"contain.svg",
|
2021-04-20 02:07:15 +02:00
|
|
|
"xml.svg",
|
2021-05-30 20:09:09 +02:00
|
|
|
"format-color-text.svg",
|
|
|
|
"format-color-highlight.svg",
|
|
|
|
"color-helper.svg",
|
2021-07-21 03:18:33 +02:00
|
|
|
|
|
|
|
# image handle
|
2021-07-21 14:13:56 +02:00
|
|
|
"format-float-none.svg",
|
2021-07-21 03:18:33 +02:00
|
|
|
"format-float-left.svg",
|
|
|
|
"format-float-right.svg",
|
2021-07-21 14:13:56 +02:00
|
|
|
|
|
|
|
"image-size-select-large.svg",
|
|
|
|
"image-size-select-actual.svg",
|
2021-04-20 02:07:15 +02:00
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
2021-03-26 04:18:16 +01:00
|
|
|
)
|
|
|
|
|
2021-03-20 05:02:19 +01:00
|
|
|
esbuild(
|
2021-01-31 14:15:03 +01:00
|
|
|
name = "editor",
|
2021-03-29 09:59:06 +02:00
|
|
|
args = [
|
|
|
|
"--loader:.svg=text",
|
2021-04-07 06:53:53 +02:00
|
|
|
"--resolve-extensions=.mjs,.js",
|
|
|
|
"--log-level=warning",
|
2021-03-29 09:59:06 +02:00
|
|
|
],
|
2021-05-19 03:45:02 +02:00
|
|
|
entry_point = "index_wrapper.ts",
|
|
|
|
output_css = "editor.css",
|
2021-01-31 14:15:03 +01:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [
|
2021-04-19 23:51:09 +02:00
|
|
|
"editor_ts",
|
2021-07-13 00:14:01 +02:00
|
|
|
"base_css",
|
2021-04-27 23:08:47 +02:00
|
|
|
"local_css",
|
2021-07-13 00:14:01 +02:00
|
|
|
"bootstrap-icons",
|
2021-05-19 03:45:02 +02:00
|
|
|
"mdi-icons",
|
2021-04-27 23:08:47 +02:00
|
|
|
"svelte_components",
|
2021-04-28 13:32:25 +02:00
|
|
|
"//ts/components",
|
2021-04-27 23:08:47 +02:00
|
|
|
"//ts/components:svelte_components",
|
2021-07-10 06:59:23 +02:00
|
|
|
"@npm//protobufjs",
|
2021-01-31 14:15:03 +01:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Tests
|
|
|
|
################
|
|
|
|
|
|
|
|
prettier_test(
|
|
|
|
name = "format_check",
|
|
|
|
srcs = glob([
|
|
|
|
"*.ts",
|
2021-05-18 14:13:11 +02:00
|
|
|
"*.svelte",
|
2021-01-31 14:15:03 +01:00
|
|
|
]),
|
|
|
|
)
|
|
|
|
|
2021-05-06 23:33:28 +02:00
|
|
|
eslint_test(
|
|
|
|
name = "eslint",
|
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"*.ts",
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
2021-04-27 23:08:47 +02:00
|
|
|
|
|
|
|
svelte_check(
|
|
|
|
name = "svelte_check",
|
|
|
|
srcs = glob([
|
|
|
|
"*.ts",
|
|
|
|
"*.svelte",
|
|
|
|
]) + [
|
|
|
|
"//ts/sass:button_mixins_lib",
|
|
|
|
"//ts/sass/bootstrap",
|
2021-05-06 23:04:38 +02:00
|
|
|
"@npm//@types/bootstrap",
|
2021-06-18 03:12:02 +02:00
|
|
|
"//ts/components",
|
2021-04-27 23:08:47 +02:00
|
|
|
],
|
|
|
|
)
|