@arcgis/coding-components
Version:
Contains components for editing code in different languages. The currently supported languages are html, css, json, TypeScript, JavaScript, and Arcade.
88 lines (87 loc) • 2.75 kB
JavaScript
import { i as d } from "./monaco-importer.js";
import { languages as a } from "monaco-editor";
import "monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js";
import "monaco-editor/esm/vs/editor/standalone/common/standaloneTheme.js";
import "monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js";
import { b as t } from "./arcade-defaults.js";
import { g as c } from "./arcade-service-accessors.js";
import { a as n } from "./sql-expr-defaults.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
v4.33.14 */
const s = /* @__PURE__ */ new Set();
function g(e, o) {
return () => {
s.has(e) || s.add(e), o();
};
}
async function D(e) {
if (s.has(e))
return;
(await d()).createModel("", e).dispose();
}
const u = {
"light-theme": { comment: "#606060", constant: "#9809C8", date: "#296389", identifier: "#0000B3", keyword: "#BF4900", number: "#136D3D", string: "#A31515", operator: "#9809C8", predefined: "#0000B3" },
"dark-theme": { comment: "#BFBFBF", constant: "#CDBAEA", date: "#97A6CE", identifier: "#9FD4F3", keyword: "#EEAA5A", number: "#AAD04B", string: "#F2877B", operator: "#CDBAEA", predefined: "#9FD4F3" }
};
m();
function m() {
d().then((e) => {
["light", "dark"].forEach((o) => {
const i = o === "light" ? "vs" : "vs-dark", r = u[`${o}-theme`];
e.defineTheme(i, {
base: i,
inherit: !0,
rules: [
{ token: "comment.arcgis", foreground: r.comment },
{ token: "constant.arcgis", foreground: r.constant },
{ token: "keyword.arcgis", foreground: r.keyword },
{ token: "identifier.arcgis", foreground: r.identifier },
{ token: "number.arcgis", foreground: r.number },
{ token: "string.arcgis", foreground: r.string },
{ token: "operator.arcgis", foreground: r.operator },
{ token: "predefined.arcgis", foreground: r.predefined }
],
colors: {}
});
});
});
}
a.register({
id: t.languageId,
aliases: ["Arcade", "arcade"],
extensions: [".arc"],
mimetypes: ["application/arcade"]
});
a.onLanguage(
t.languageId,
g(t.languageId, () => {
c().then((e) => {
e.setupMode(t);
}).catch((e) => {
throw e;
});
})
);
async function p() {
return await import("./sql-expr-mode.js");
}
a.register({
id: n.languageId,
aliases: ["EsiSqlExpression", "sql-expression"],
extensions: [".sql-expression"],
mimetypes: ["application/sql-expression"]
});
a.onLanguage(
n.languageId,
g(n.languageId, () => {
p().then((e) => {
e.setupMode(n);
}).catch((e) => {
throw e;
});
})
);
export {
D as s
};