@webx-ui/core 0.43.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webx-ui/core",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "description": "Vue 3 UI components for admin panels, styled entirely with WebX UI design tokens.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -82,7 +82,7 @@
82
82
  "vue-tsc": "^3.1.3"
83
83
  },
84
84
  "scripts": {
85
- "build": "vite build",
85
+ "build": "vite build && node scripts/server-styles.mjs",
86
86
  "dev": "vite build --watch",
87
87
  "typecheck": "vue-tsc -p tsconfig.json --noEmit"
88
88
  }
@@ -1,333 +0,0 @@
1
- import { defineComponent as re, useModel as ie, computed as g, ref as G, shallowRef as le, onMounted as se, onBeforeUnmount as ue, watch as s, openBlock as O, createElementBlock as ce, normalizeStyle as de, normalizeClass as fe, createElementVNode as me, unref as N, createBlock as pe, createCommentVNode as ge, mergeModels as D } from "vue";
2
- import { Compartment as c, EditorState as B } from "@codemirror/state";
3
- import { EditorView as p, lineNumbers as he, highlightActiveLineGutter as ve, placeholder as xe, highlightSpecialChars as be, highlightActiveLine as ye, keymap as we } from "@codemirror/view";
4
- import { HighlightStyle as Se, foldGutter as Ee, indentUnit as ke, bracketMatching as Ne, indentOnInput as Be, syntaxHighlighting as Ce, foldKeymap as ze } from "@codemirror/language";
5
- import { history as Le, defaultKeymap as _e, historyKeymap as Ae, indentWithTab as He } from "@codemirror/commands";
6
- import { autocompletion as Me, closeBrackets as We, closeBracketsKeymap as Ve, snippet as je } from "@codemirror/autocomplete";
7
- import { highlightSelectionMatches as Ke, searchKeymap as Fe } from "@codemirror/search";
8
- import { linter as Ge } from "@codemirror/lint";
9
- import { m as I, u as Oe, a as De, L as Ie, _ as Ue } from "./index-CUqx8iDY.js";
10
- import { jsonParseLinter as $e, json as Je } from "@codemirror/lang-json";
11
- import { javascript as U } from "@codemirror/lang-javascript";
12
- import { html as $ } from "@codemirror/lang-html";
13
- import { css as Pe } from "@codemirror/lang-css";
14
- import { markdown as Re } from "@codemirror/lang-markdown";
15
- import { yaml as Te } from "@codemirror/lang-yaml";
16
- import { php as qe } from "@codemirror/lang-php";
17
- import { tags as t } from "@lezer/highlight";
18
- const J = {
19
- json: { extension: () => Je(), linter: () => $e() },
20
- javascript: { extension: () => U() },
21
- typescript: { extension: () => U({ typescript: !0 }) },
22
- html: { extension: () => $() },
23
- css: { extension: () => Pe() },
24
- markdown: { extension: () => Re() },
25
- yaml: { extension: () => Te() },
26
- php: { extension: () => qe() },
27
- mustache: { extension: () => I() },
28
- "mustache-html": { extension: () => [$(), I()] },
29
- plain: { extension: () => [] }
30
- }, Qe = Se.define([
31
- { tag: [t.keyword, t.modifier, t.operatorKeyword], color: "var(--wx-color-primary-active)" },
32
- {
33
- tag: [t.string, t.special(t.string), t.attributeValue],
34
- color: "var(--wx-color-success-active)"
35
- },
36
- { tag: [t.number, t.bool, t.null, t.atom, t.literal], color: "var(--wx-color-warning-active)" },
37
- {
38
- tag: [t.propertyName, t.attributeName, t.definition(t.variableName), t.labelName],
39
- color: "var(--wx-text-strong)"
40
- },
41
- { tag: [t.typeName, t.className, t.namespace, t.tagName], color: "var(--wx-color-primary)" },
42
- { tag: [t.function(t.variableName), t.function(t.propertyName)], color: "var(--wx-text-strong)" },
43
- {
44
- tag: [t.comment, t.lineComment, t.blockComment, t.meta, t.processingInstruction, t.docComment],
45
- color: "var(--wx-text-muted)",
46
- fontStyle: "italic"
47
- },
48
- { tag: [t.punctuation, t.operator, t.separator, t.bracket], color: "var(--wx-text-default)" },
49
- { tag: t.invalid, color: "var(--wx-color-danger)" },
50
- // Markdown
51
- { tag: t.heading, color: "var(--wx-text-strong)", fontWeight: "600" },
52
- { tag: t.strong, fontWeight: "600" },
53
- { tag: t.emphasis, fontStyle: "italic" },
54
- { tag: t.strikethrough, textDecoration: "line-through" },
55
- { tag: [t.link, t.url], color: "var(--wx-text-link)", textDecoration: "underline" },
56
- { tag: t.monospace, color: "var(--wx-color-success-active)" }
57
- ]), Xe = /* @__PURE__ */ re({
58
- name: "WxCodeEditor",
59
- inheritAttrs: !1,
60
- __name: "CodeEditor",
61
- props: /* @__PURE__ */ D({
62
- language: { default: "plain" },
63
- placeholder: { default: void 0 },
64
- disabled: { type: Boolean, default: void 0 },
65
- readonly: { type: Boolean, default: !1 },
66
- size: { default: void 0 },
67
- status: { default: void 0 },
68
- id: { default: void 0 },
69
- ariaLabel: { default: void 0 },
70
- minHeight: { default: "160px" },
71
- maxHeight: { default: void 0 },
72
- lineNumbers: { type: Boolean, default: !0 },
73
- lineWrapping: { type: Boolean, default: !1 },
74
- tabSize: { default: 2 },
75
- lint: { type: Boolean, default: !0 },
76
- completions: { type: [Array, Function], default: void 0 },
77
- localized: { type: Boolean, default: !1 },
78
- extensions: { default: () => [] }
79
- }, {
80
- modelValue: { default: "" },
81
- modelModifiers: {}
82
- }),
83
- emits: /* @__PURE__ */ D(["change", "focus", "blur", "lint"], ["update:modelValue"]),
84
- setup(C, { expose: P, emit: R }) {
85
- const n = C, h = R, T = ie(C, "modelValue"), l = Oe(n), d = De(n, T), v = g(() => d.on.value ? d.active.value : void 0), x = g(() => d.read(v.value)), b = G(null), f = le(null), y = G(!1), w = g(() => !l.disabled.value && !n.readonly), r = {
86
- language: new c(),
87
- lint: new c(),
88
- editable: new c(),
89
- gutter: new c(),
90
- wrapping: new c(),
91
- indent: new c(),
92
- placeholder: new c(),
93
- attributes: new c(),
94
- completion: new c(),
95
- extra: new c()
96
- };
97
- function z() {
98
- return J[n.language].extension();
99
- }
100
- function S() {
101
- const e = J[n.language].linter;
102
- if (!n.lint || !e) return [];
103
- const a = e();
104
- return Ge(
105
- async (o) => {
106
- const i = (await a(o)).map((m) => q(m, o.state));
107
- return h("lint", i.map(Q)), i;
108
- },
109
- { delay: 300 }
110
- );
111
- }
112
- function q(e, a) {
113
- if (e.from !== e.to) return e;
114
- const o = a.doc.lineAt(e.from);
115
- return e.from < o.to ? { ...e, to: o.to } : e.from > o.from ? { ...e, from: o.from } : e;
116
- }
117
- function Q(e) {
118
- return {
119
- from: e.from,
120
- to: e.to,
121
- severity: e.severity,
122
- message: e.message
123
- };
124
- }
125
- function X(e, a) {
126
- const o = e.apply ?? e.label, i = o.includes("${") ? je(o) : null;
127
- return {
128
- label: e.label,
129
- detail: e.detail,
130
- info: e.info,
131
- type: e.type,
132
- boost: e.boost,
133
- apply: a === 0 && i === null ? e.apply : (m, ne, k, ae) => {
134
- const F = Math.min(m.state.doc.length, ae + a);
135
- if (i !== null) {
136
- i(m, ne, k, F);
137
- return;
138
- }
139
- m.dispatch({
140
- changes: { from: k, to: F, insert: o },
141
- selection: { anchor: k + o.length },
142
- userEvent: "input.complete"
143
- });
144
- }
145
- };
146
- }
147
- function L(e, a) {
148
- const o = Math.max(0, (e.to ?? a) - a);
149
- return { from: e.from, options: e.options.map((i) => X(i, o)) };
150
- }
151
- function _() {
152
- const e = n.completions;
153
- return e === void 0 ? [] : Me({ override: [(o) => {
154
- if (typeof e == "function") {
155
- const m = e({
156
- text: o.state.doc.toString(),
157
- pos: o.pos,
158
- explicit: o.explicit
159
- });
160
- return m === null ? null : L(m, o.pos);
161
- }
162
- const i = o.matchBefore(/[\w.]*/);
163
- return i === null || i.from === i.to && !o.explicit ? null : L({ from: i.from, options: e }, o.pos);
164
- }], icons: !1 });
165
- }
166
- function A() {
167
- const e = w.value;
168
- return [B.readOnly.of(!e), p.editable.of(e)];
169
- }
170
- function H() {
171
- return n.lineNumbers ? [he(), ve(), Ee()] : [];
172
- }
173
- function M() {
174
- return n.lineWrapping ? p.lineWrapping : [];
175
- }
176
- function W() {
177
- return [B.tabSize.of(n.tabSize), ke.of(" ".repeat(n.tabSize))];
178
- }
179
- function V() {
180
- return n.placeholder ? xe(n.placeholder) : [];
181
- }
182
- function j() {
183
- const e = { id: l.id.value };
184
- return n.ariaLabel && (e["aria-label"] = n.ariaLabel), l.describedBy.value && (e["aria-describedby"] = l.describedBy.value), l.status.value === "error" && (e["aria-invalid"] = "true"), l.disabled.value && (e.tabindex = "-1", e["aria-disabled"] = "true"), p.contentAttributes.of(e);
185
- }
186
- function Y(e) {
187
- return B.create({
188
- doc: e,
189
- extensions: [
190
- be(),
191
- Le(),
192
- Ne(),
193
- We(),
194
- Be(),
195
- ye(),
196
- Ke(),
197
- Ce(Qe),
198
- we.of([
199
- ...Ve,
200
- ..._e,
201
- ...Fe,
202
- ...Ae,
203
- ...ze,
204
- He
205
- ]),
206
- r.language.of(z()),
207
- r.lint.of(S()),
208
- r.editable.of(A()),
209
- r.gutter.of(H()),
210
- r.wrapping.of(M()),
211
- r.indent.of(W()),
212
- r.placeholder.of(V()),
213
- r.attributes.of(j()),
214
- r.completion.of(_()),
215
- r.extra.of(n.extensions),
216
- p.updateListener.of((a) => {
217
- if (!a.docChanged || E) return;
218
- const o = a.state.doc.toString();
219
- d.write(v.value, o), h("change", o);
220
- }),
221
- p.domEventHandlers({
222
- focus: () => {
223
- y.value = !0, h("focus");
224
- },
225
- blur: () => {
226
- y.value = !1, h("blur");
227
- }
228
- })
229
- ]
230
- });
231
- }
232
- se(() => {
233
- b.value && (f.value = new p({ state: Y(x.value), parent: b.value }));
234
- }), ue(() => {
235
- f.value?.destroy(), f.value = null;
236
- });
237
- let E = !1;
238
- function K(e, a) {
239
- const o = f.value;
240
- if (!o) return;
241
- const i = o.state.doc.toString();
242
- e !== i && (E = a, o.dispatch({ changes: { from: 0, to: i.length, insert: e } }), E = !1);
243
- }
244
- s(x, (e) => K(e, !1)), s(v, () => K(x.value, !0));
245
- function u(e, a) {
246
- f.value?.dispatch({ effects: e.reconfigure(a) });
247
- }
248
- s(
249
- () => n.language,
250
- () => {
251
- u(r.language, z()), u(r.lint, S());
252
- }
253
- ), s(
254
- () => n.lint,
255
- () => u(r.lint, S())
256
- ), s(w, () => u(r.editable, A())), s(
257
- () => n.lineNumbers,
258
- () => u(r.gutter, H())
259
- ), s(
260
- () => n.lineWrapping,
261
- () => u(r.wrapping, M())
262
- ), s(
263
- () => n.tabSize,
264
- () => u(r.indent, W())
265
- ), s(
266
- () => n.placeholder,
267
- () => u(r.placeholder, V())
268
- ), s(
269
- [() => n.ariaLabel, l.id, l.describedBy, l.status, l.disabled],
270
- () => u(r.attributes, j())
271
- ), s(
272
- () => n.completions,
273
- () => u(r.completion, _())
274
- ), s(
275
- () => n.extensions,
276
- (e) => u(r.extra, e)
277
- );
278
- function Z() {
279
- const e = f.value;
280
- if (!e || n.language !== "json" || !w.value) return !1;
281
- const a = e.state.doc.toString();
282
- let o;
283
- try {
284
- o = JSON.parse(a);
285
- } catch {
286
- return !1;
287
- }
288
- const i = JSON.stringify(o, null, n.tabSize);
289
- return i !== a && e.dispatch({ changes: { from: 0, to: a.length, insert: i } }), !0;
290
- }
291
- const ee = g(() => [
292
- "wx-code-editor",
293
- `wx-code-editor--${l.size.value}`,
294
- {
295
- [`wx-code-editor--${l.status.value}`]: l.status.value !== "default",
296
- "is-focused": y.value,
297
- "is-disabled": l.disabled.value,
298
- "is-readonly": n.readonly,
299
- "is-localized": d.on.value
300
- }
301
- ]), te = g(() => ({
302
- "--wx-code-editor-min-height": n.minHeight,
303
- "--wx-code-editor-max-height": n.maxHeight ?? "none"
304
- }));
305
- function oe(e) {
306
- d.active.value = e, f.value?.focus();
307
- }
308
- return P({
309
- view: f,
310
- focus: () => f.value?.focus(),
311
- format: Z
312
- }), (e, a) => (O(), ce("div", {
313
- class: fe(ee.value),
314
- style: de(te.value)
315
- }, [
316
- me("div", {
317
- ref_key: "host",
318
- ref: b,
319
- class: "wx-code-editor__host"
320
- }, null, 512),
321
- N(d).on.value ? (O(), pe(Ie, {
322
- key: 0,
323
- locales: N(d).list.value,
324
- active: N(d).active.value,
325
- onChoose: oe
326
- }, null, 8, ["locales", "active"])) : ge("", !0)
327
- ], 6));
328
- }
329
- }), gt = /* @__PURE__ */ Ue(Xe, [["__scopeId", "data-v-008b78c9"]]);
330
- export {
331
- gt as default
332
- };
333
- //# sourceMappingURL=CodeEditor-pJLpkTNW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CodeEditor-pJLpkTNW.js","sources":["../src/components/CodeEditor/languages.ts","../src/components/CodeEditor/highlight.ts","../src/components/CodeEditor/CodeEditor.vue"],"sourcesContent":["import type { Extension } from '@codemirror/state'\nimport { json, jsonParseLinter } from '@codemirror/lang-json'\nimport { javascript } from '@codemirror/lang-javascript'\nimport { html } from '@codemirror/lang-html'\nimport { css } from '@codemirror/lang-css'\nimport { markdown } from '@codemirror/lang-markdown'\nimport { yaml } from '@codemirror/lang-yaml'\nimport { php } from '@codemirror/lang-php'\nimport type { LintSource } from '@codemirror/lint'\nimport { mustacheHighlighting } from './mustache'\nimport type { CodeEditorLanguage } from './types'\n\ninterface LanguageSupport {\n extension: () => Extension\n /** Only JSON has a parser cheap enough to run on every keystroke. */\n linter?: () => LintSource\n}\n\n/**\n * Each entry is a factory rather than an instance: language support carries\n * state fields, and CodeMirror expects a fresh one per editor.\n */\nexport const LANGUAGES: Record<CodeEditorLanguage, LanguageSupport> = {\n json: { extension: () => json(), linter: () => jsonParseLinter() },\n javascript: { extension: () => javascript() },\n typescript: { extension: () => javascript({ typescript: true }) },\n html: { extension: () => html() },\n css: { extension: () => css() },\n markdown: { extension: () => markdown() },\n yaml: { extension: () => yaml() },\n php: { extension: () => php() },\n mustache: { extension: () => mustacheHighlighting() },\n 'mustache-html': { extension: () => [html(), mustacheHighlighting()] },\n plain: { extension: () => [] },\n}\n","import { HighlightStyle } from '@codemirror/language'\nimport { tags as t } from '@lezer/highlight'\n\n/**\n * Syntax colours come from the semantic tokens, so both themes are covered by the\n * same style and a project that re-tints its primary colour re-tints its code too.\n * The palette is deliberately small: five roles, not a rainbow.\n */\nexport const highlightStyle = HighlightStyle.define([\n { tag: [t.keyword, t.modifier, t.operatorKeyword], color: 'var(--wx-color-primary-active)' },\n {\n tag: [t.string, t.special(t.string), t.attributeValue],\n color: 'var(--wx-color-success-active)',\n },\n { tag: [t.number, t.bool, t.null, t.atom, t.literal], color: 'var(--wx-color-warning-active)' },\n {\n tag: [t.propertyName, t.attributeName, t.definition(t.variableName), t.labelName],\n color: 'var(--wx-text-strong)',\n },\n { tag: [t.typeName, t.className, t.namespace, t.tagName], color: 'var(--wx-color-primary)' },\n { tag: [t.function(t.variableName), t.function(t.propertyName)], color: 'var(--wx-text-strong)' },\n {\n tag: [t.comment, t.lineComment, t.blockComment, t.meta, t.processingInstruction, t.docComment],\n color: 'var(--wx-text-muted)',\n fontStyle: 'italic',\n },\n { tag: [t.punctuation, t.operator, t.separator, t.bracket], color: 'var(--wx-text-default)' },\n { tag: t.invalid, color: 'var(--wx-color-danger)' },\n // Markdown\n { tag: t.heading, color: 'var(--wx-text-strong)', fontWeight: '600' },\n { tag: t.strong, fontWeight: '600' },\n { tag: t.emphasis, fontStyle: 'italic' },\n { tag: t.strikethrough, textDecoration: 'line-through' },\n { tag: [t.link, t.url], color: 'var(--wx-text-link)', textDecoration: 'underline' },\n { tag: t.monospace, color: 'var(--wx-color-success-active)' },\n])\n","<script setup lang=\"ts\" generic=\"T extends CodeEditorModelValue = string\">\nimport { computed, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue'\nimport { Compartment, EditorState, type Extension } from '@codemirror/state'\nimport {\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n highlightSpecialChars,\n keymap,\n lineNumbers,\n placeholder as placeholderExtension,\n} from '@codemirror/view'\nimport {\n bracketMatching,\n foldGutter,\n foldKeymap,\n indentOnInput,\n indentUnit,\n syntaxHighlighting,\n} from '@codemirror/language'\nimport { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands'\nimport {\n autocompletion,\n closeBrackets,\n closeBracketsKeymap,\n snippet,\n type Completion,\n type CompletionContext,\n type CompletionResult,\n} from '@codemirror/autocomplete'\nimport { highlightSelectionMatches, searchKeymap } from '@codemirror/search'\nimport { linter, type Diagnostic } from '@codemirror/lint'\nimport { useFormField } from '../../composables/useFormField'\nimport { useLocalized } from '../../composables/useLocalized'\nimport LocalePicker from '../Locales/LocalePicker.vue'\nimport { LANGUAGES } from './languages'\nimport { highlightStyle } from './highlight'\nimport type {\n CodeEditorCompletion,\n CodeEditorCompletionResult,\n CodeEditorDiagnostic,\n CodeEditorEmits,\n CodeEditorModelValue,\n CodeEditorProps,\n} from './types'\n\ndefineOptions({ name: 'WxCodeEditor', inheritAttrs: false })\n\nconst props = withDefaults(defineProps<CodeEditorProps>(), {\n language: 'plain',\n placeholder: undefined,\n disabled: undefined,\n readonly: false,\n size: undefined,\n status: undefined,\n id: undefined,\n ariaLabel: undefined,\n minHeight: '160px',\n maxHeight: undefined,\n lineNumbers: true,\n lineWrapping: false,\n tabSize: 2,\n lint: true,\n completions: undefined,\n localized: false,\n extensions: () => [],\n})\n\nconst emit = defineEmits<CodeEditorEmits>()\n\n/*\n * Generic so that a plain editor stays a `string` to whoever binds it, and a localized one is the\n * map of languages it edits.\n */\nconst model = defineModel<T>({ default: '' as never })\n\nconst field = useFormField(props)\nconst locales = useLocalized(props, model)\n\n/** The language on screen, or nothing at all when the field is plain. */\nconst editing = computed(() => (locales.on.value ? locales.active.value : undefined))\n\n/** The text of the language on screen: what the editor holds. */\nconst current = computed(() => locales.read(editing.value))\nconst host = ref<HTMLElement | null>(null)\nconst view = shallowRef<EditorView | null>(null)\nconst focused = ref(false)\n\nconst editable = computed(() => !field.disabled.value && !props.readonly)\n\n/**\n * Everything that can change after mount lives in a compartment, so a prop change\n * is a reconfigure of that slot rather than a rebuild of the whole editor.\n */\nconst compartments = {\n language: new Compartment(),\n lint: new Compartment(),\n editable: new Compartment(),\n gutter: new Compartment(),\n wrapping: new Compartment(),\n indent: new Compartment(),\n placeholder: new Compartment(),\n attributes: new Compartment(),\n completion: new Compartment(),\n extra: new Compartment(),\n}\n\nfunction languageExtension(): Extension {\n return LANGUAGES[props.language].extension()\n}\n\nfunction lintExtension(): Extension {\n const source = LANGUAGES[props.language].linter\n if (!props.lint || !source) return []\n const run = source()\n // Wrapping the source is the only hook for reporting results outward: the\n // diagnostics themselves stay inside the editor's own state.\n return linter(\n async (instance) => {\n const found = (await run(instance)).map((diagnostic) => widen(diagnostic, instance.state))\n emit('lint', found.map(toDiagnostic))\n return found\n },\n { delay: 300 },\n )\n}\n\n/**\n * A parser reports \"unexpected token at 23\" as an empty range, which CodeMirror\n * draws as a dot nobody notices. Underline from there to the end of the line instead.\n */\nfunction widen(diagnostic: Diagnostic, state: EditorState): Diagnostic {\n if (diagnostic.from !== diagnostic.to) return diagnostic\n const line = state.doc.lineAt(diagnostic.from)\n if (diagnostic.from < line.to) return { ...diagnostic, to: line.to }\n if (diagnostic.from > line.from) return { ...diagnostic, from: line.from }\n return diagnostic\n}\n\nfunction toDiagnostic(diagnostic: Diagnostic): CodeEditorDiagnostic {\n return {\n from: diagnostic.from,\n to: diagnostic.to,\n severity: diagnostic.severity,\n message: diagnostic.message,\n }\n}\n\n/**\n * A suggestion as CodeMirror takes it: an `apply` with `${}` in it is a snippet. `extra` is how\n * much past the caret it replaces — the `}}` closing brackets typed after it.\n */\nfunction toCompletion(option: CodeEditorCompletion, extra: number): Completion {\n const given = option.apply ?? option.label\n const write = given.includes('${') ? snippet(given) : null\n\n return {\n label: option.label,\n detail: option.detail,\n info: option.info,\n type: option.type,\n boost: option.boost,\n apply:\n extra === 0 && write === null\n ? option.apply\n : (view, completion, from, to) => {\n const end = Math.min(view.state.doc.length, to + extra)\n\n if (write !== null) {\n write(view, completion, from, end)\n\n return\n }\n\n view.dispatch({\n changes: { from, to: end, insert: given },\n selection: { anchor: from + given.length },\n userEvent: 'input.complete',\n })\n },\n }\n}\n\n/*\n * CodeMirror matches what was typed against the text from `from` to `to`, so a result that\n * reaches past the caret would be matched against that tail and offer nothing. It is told only\n * where the word starts; the tail is replaced when a suggestion is taken.\n */\nfunction toResult(result: CodeEditorCompletionResult, pos: number): CompletionResult {\n const extra = Math.max(0, (result.to ?? pos) - pos)\n\n return { from: result.from, options: result.options.map((option) => toCompletion(option, extra)) }\n}\n\n/**\n * The completions prop on CodeMirror's own completion: a list completes the word before the\n * caret, a function is asked about every place and says where its suggestions belong.\n */\nfunction completionExtension(): Extension {\n const given = props.completions\n\n if (given === undefined) return []\n\n const source = (context: CompletionContext): CompletionResult | null => {\n if (typeof given === 'function') {\n const result = given({\n text: context.state.doc.toString(),\n pos: context.pos,\n explicit: context.explicit,\n })\n\n return result === null ? null : toResult(result, context.pos)\n }\n\n const word = context.matchBefore(/[\\w.]*/)\n\n if (word === null || (word.from === word.to && !context.explicit)) return null\n\n return toResult({ from: word.from, options: given }, context.pos)\n }\n\n return autocompletion({ override: [source], icons: false })\n}\n\nfunction editableExtension(): Extension {\n const enabled = editable.value\n return [EditorState.readOnly.of(!enabled), EditorView.editable.of(enabled)]\n}\n\nfunction gutterExtension(): Extension {\n if (!props.lineNumbers) return []\n return [lineNumbers(), highlightActiveLineGutter(), foldGutter()]\n}\n\nfunction wrappingExtension(): Extension {\n return props.lineWrapping ? EditorView.lineWrapping : []\n}\n\nfunction indentExtension(): Extension {\n return [EditorState.tabSize.of(props.tabSize), indentUnit.of(' '.repeat(props.tabSize))]\n}\n\nfunction placeholderExtensionFor(): Extension {\n return props.placeholder ? placeholderExtension(props.placeholder) : []\n}\n\nfunction attributesExtension(): Extension {\n const attributes: Record<string, string> = { id: field.id.value }\n if (props.ariaLabel) attributes['aria-label'] = props.ariaLabel\n if (field.describedBy.value) attributes['aria-describedby'] = field.describedBy.value\n if (field.status.value === 'error') attributes['aria-invalid'] = 'true'\n // A disabled editor is skipped by Tab; a read-only one can still be scrolled into.\n if (field.disabled.value) {\n attributes.tabindex = '-1'\n attributes['aria-disabled'] = 'true'\n }\n return EditorView.contentAttributes.of(attributes)\n}\n\nfunction buildState(doc: string): EditorState {\n return EditorState.create({\n doc,\n extensions: [\n highlightSpecialChars(),\n history(),\n bracketMatching(),\n closeBrackets(),\n indentOnInput(),\n highlightActiveLine(),\n highlightSelectionMatches(),\n syntaxHighlighting(highlightStyle),\n keymap.of([\n ...closeBracketsKeymap,\n ...defaultKeymap,\n ...searchKeymap,\n ...historyKeymap,\n ...foldKeymap,\n indentWithTab,\n ]),\n compartments.language.of(languageExtension()),\n compartments.lint.of(lintExtension()),\n compartments.editable.of(editableExtension()),\n compartments.gutter.of(gutterExtension()),\n compartments.wrapping.of(wrappingExtension()),\n compartments.indent.of(indentExtension()),\n compartments.placeholder.of(placeholderExtensionFor()),\n compartments.attributes.of(attributesExtension()),\n compartments.completion.of(completionExtension()),\n compartments.extra.of(props.extensions),\n EditorView.updateListener.of((update) => {\n if (!update.docChanged || replacing) return\n const value = update.state.doc.toString()\n locales.write(editing.value, value)\n emit('change', value)\n }),\n EditorView.domEventHandlers({\n focus: () => {\n focused.value = true\n emit('focus')\n },\n blur: () => {\n focused.value = false\n emit('blur')\n },\n }),\n ],\n })\n}\n\nonMounted(() => {\n if (!host.value) return\n view.value = new EditorView({ state: buildState(current.value), parent: host.value })\n})\n\nonBeforeUnmount(() => {\n view.value?.destroy()\n view.value = null\n})\n\n/*\n * Set while the document is swapped for another language's: that is not an edit of this one, and\n * written back it would copy one language's text into the other.\n */\nlet replacing = false\n\n/** Replaces the document only when the value really differs, or the caret jumps. */\nfunction follow(next: string, language: boolean): void {\n const instance = view.value\n if (!instance) return\n const shown = instance.state.doc.toString()\n if (next === shown) return\n replacing = language\n instance.dispatch({ changes: { from: 0, to: shown.length, insert: next } })\n replacing = false\n}\n\nwatch(current, (next) => follow(next, false))\nwatch(editing, () => follow(current.value, true))\n\nfunction reconfigure(compartment: Compartment, extension: Extension) {\n view.value?.dispatch({ effects: compartment.reconfigure(extension) })\n}\n\nwatch(\n () => props.language,\n () => {\n reconfigure(compartments.language, languageExtension())\n reconfigure(compartments.lint, lintExtension())\n },\n)\nwatch(\n () => props.lint,\n () => reconfigure(compartments.lint, lintExtension()),\n)\nwatch(editable, () => reconfigure(compartments.editable, editableExtension()))\nwatch(\n () => props.lineNumbers,\n () => reconfigure(compartments.gutter, gutterExtension()),\n)\nwatch(\n () => props.lineWrapping,\n () => reconfigure(compartments.wrapping, wrappingExtension()),\n)\nwatch(\n () => props.tabSize,\n () => reconfigure(compartments.indent, indentExtension()),\n)\nwatch(\n () => props.placeholder,\n () => reconfigure(compartments.placeholder, placeholderExtensionFor()),\n)\nwatch([() => props.ariaLabel, field.id, field.describedBy, field.status, field.disabled], () =>\n reconfigure(compartments.attributes, attributesExtension()),\n)\nwatch(\n () => props.completions,\n () => reconfigure(compartments.completion, completionExtension()),\n)\nwatch(\n () => props.extensions,\n (extensions) => reconfigure(compartments.extra, extensions),\n)\n\nfunction format(): boolean {\n const instance = view.value\n if (!instance || props.language !== 'json' || !editable.value) return false\n const current = instance.state.doc.toString()\n let parsed: unknown\n try {\n parsed = JSON.parse(current)\n } catch {\n return false\n }\n const next = JSON.stringify(parsed, null, props.tabSize)\n if (next !== current) {\n instance.dispatch({ changes: { from: 0, to: current.length, insert: next } })\n }\n return true\n}\n\nconst classes = computed(() => [\n 'wx-code-editor',\n `wx-code-editor--${field.size.value}`,\n {\n [`wx-code-editor--${field.status.value}`]: field.status.value !== 'default',\n 'is-focused': focused.value,\n 'is-disabled': field.disabled.value,\n 'is-readonly': props.readonly,\n 'is-localized': locales.on.value,\n },\n])\n\nconst style = computed(() => ({\n '--wx-code-editor-min-height': props.minHeight,\n '--wx-code-editor-max-height': props.maxHeight ?? 'none',\n}))\n\n/** Same as the other text fields: the caret follows the language into this one. */\nfunction choose(code: string): void {\n locales.active.value = code\n view.value?.focus()\n}\n\ndefineExpose({\n view,\n focus: () => view.value?.focus(),\n format,\n})\n</script>\n\n<template>\n <div :class=\"classes\" :style=\"style\">\n <div ref=\"host\" class=\"wx-code-editor__host\" />\n\n <locale-picker\n v-if=\"locales.on.value\"\n :locales=\"locales.list.value\"\n :active=\"locales.active.value\"\n @choose=\"choose\"\n />\n </div>\n</template>\n\n<style scoped>\n.wx-code-editor {\n /* Tall like a textarea: the chip is pinned near the top, a size smaller. */\n --wx-locale-picker-height: 20px;\n --wx-locale-picker-top: var(--wx-space-6);\n --wx-locale-picker-shift: 0;\n\n position: relative;\n display: block;\n box-sizing: border-box;\n width: 100%;\n background: var(--wx-bg-surface);\n border: 1px solid var(--wx-border-default);\n border-radius: var(--wx-radius-control);\n color: var(--wx-text-default);\n transition:\n border-color var(--wx-duration-normal) var(--wx-easing-standard),\n background-color var(--wx-duration-normal) var(--wx-easing-standard);\n}\n\n.wx-code-editor:hover:not(.is-disabled) {\n border-color: var(--wx-border-strong);\n}\n\n.wx-code-editor.is-focused {\n border-color: var(--wx-border-focus);\n}\n\n.wx-code-editor--error,\n.wx-code-editor--error.is-focused {\n border-color: var(--wx-color-danger);\n}\n\n.wx-code-editor--success,\n.wx-code-editor--success.is-focused {\n border-color: var(--wx-color-success);\n}\n\n.wx-code-editor--warning,\n.wx-code-editor--warning.is-focused {\n border-color: var(--wx-color-warning);\n}\n\n.wx-code-editor.is-disabled {\n background: var(--wx-bg-disabled);\n color: var(--wx-text-disabled);\n}\n\n.wx-code-editor--sm {\n font-size: var(--wx-font-size-control-sm);\n}\n\n.wx-code-editor--md {\n font-size: var(--wx-font-size-control-md);\n}\n\n.wx-code-editor--lg {\n font-size: var(--wx-font-size-control-lg);\n}\n\n/*\n * CodeMirror mounts its own tree under the host, so everything below reaches it\n * through :deep(). The editor's base theme is left in place for layout and\n * overridden only where it paints a colour.\n */\n.wx-code-editor :deep(.cm-editor) {\n min-height: var(--wx-code-editor-min-height);\n max-height: var(--wx-code-editor-max-height);\n border-radius: inherit;\n color: inherit;\n}\n\n.wx-code-editor :deep(.cm-editor.cm-focused) {\n outline: none;\n}\n\n.wx-code-editor :deep(.cm-scroller) {\n font-family: var(--wx-font-family-mono);\n font-size: inherit;\n line-height: var(--wx-font-line-height-normal);\n border-radius: inherit;\n}\n\n.wx-code-editor :deep(.cm-content) {\n padding: var(--wx-space-8) 0;\n caret-color: var(--wx-text-default);\n}\n\n.wx-code-editor :deep(.cm-line) {\n padding: 0 var(--wx-space-12);\n}\n\n/* Room for the language chip, so the end of a long line is never under it. */\n.wx-code-editor.is-localized :deep(.cm-content) {\n padding-right: var(--wx-space-48);\n}\n\n/*\n * Mustache tags (`language=\"mustache\"`): marks over the language underneath, in the palette of\n * the rest of the code — a value in the primary colour, a section bold, a comment muted.\n */\n.wx-code-editor :deep(.wx-cm-mustache) {\n color: var(--wx-color-primary-active);\n}\n\n.wx-code-editor :deep(.wx-cm-mustache--section) {\n color: var(--wx-color-warning-active);\n font-weight: 600;\n}\n\n.wx-code-editor :deep(.wx-cm-mustache--comment) {\n color: var(--wx-text-muted);\n font-style: italic;\n}\n\n.wx-code-editor :deep(.wx-cm-mustache--invalid) {\n color: var(--wx-color-danger);\n text-decoration: underline wavy var(--wx-color-danger);\n text-underline-offset: 3px;\n}\n\n/* A mark inside a mark keeps the tag's colour over the HTML highlighter's. */\n.wx-code-editor :deep(.wx-cm-mustache span) {\n color: inherit;\n}\n\n.wx-code-editor :deep(.cm-cursor) {\n border-left-color: var(--wx-text-default);\n}\n\n.wx-code-editor :deep(.cm-placeholder) {\n color: var(--wx-text-placeholder);\n}\n\n.wx-code-editor :deep(.cm-gutters) {\n background: var(--wx-bg-subtle);\n border-right: 1px solid var(--wx-border-muted);\n color: var(--wx-text-muted);\n}\n\n.wx-code-editor :deep(.cm-lineNumbers .cm-gutterElement) {\n padding: 0 var(--wx-space-8) 0 var(--wx-space-12);\n min-width: 0;\n}\n\n.wx-code-editor :deep(.cm-foldGutter .cm-gutterElement) {\n padding: 0 var(--wx-space-4);\n cursor: pointer;\n}\n\n.wx-code-editor :deep(.cm-activeLine) {\n background: var(--wx-bg-muted);\n}\n\n.wx-code-editor :deep(.cm-activeLineGutter) {\n background: var(--wx-bg-muted);\n color: var(--wx-text-default);\n}\n\n.wx-code-editor.is-disabled :deep(.cm-activeLine),\n.wx-code-editor.is-disabled :deep(.cm-activeLineGutter) {\n background: transparent;\n}\n\n.wx-code-editor :deep(.cm-selectionMatch) {\n background: var(--wx-color-primary-soft);\n}\n\n.wx-code-editor :deep(.cm-matchingBracket),\n.wx-code-editor :deep(.cm-focused .cm-matchingBracket) {\n background: var(--wx-color-primary-soft);\n outline: 1px solid var(--wx-color-primary-disabled);\n}\n\n.wx-code-editor :deep(.cm-nonmatchingBracket),\n.wx-code-editor :deep(.cm-focused .cm-nonmatchingBracket) {\n background: var(--wx-color-danger-soft);\n outline: 1px solid var(--wx-color-danger);\n}\n\n.wx-code-editor :deep(.cm-foldPlaceholder) {\n margin: 0 var(--wx-space-2);\n padding: 0 var(--wx-space-4);\n background: var(--wx-bg-fill);\n border: none;\n border-radius: var(--wx-radius-xs);\n color: var(--wx-text-muted);\n}\n\n.wx-code-editor :deep(.cm-lintRange-error) {\n background-image: none;\n text-decoration: underline wavy var(--wx-color-danger);\n text-underline-offset: 3px;\n}\n\n.wx-code-editor :deep(.cm-lintRange-warning) {\n background-image: none;\n text-decoration: underline wavy var(--wx-color-warning);\n text-underline-offset: 3px;\n}\n\n/* Tooltips and the search panel are portalled inside the editor, so they inherit tokens. */\n.wx-code-editor :deep(.cm-tooltip) {\n /* The surface a popover stands on; `--wx-bg-overlay` is the dimming behind a dialog. */\n background: var(--wx-bg-surface);\n border: 1px solid var(--wx-border-default);\n border-radius: var(--wx-radius-sm);\n box-shadow: var(--wx-shadow-md);\n color: var(--wx-text-default);\n font-family: var(--wx-font-family-sans);\n font-size: var(--wx-font-size-sm);\n}\n\n.wx-code-editor :deep(.cm-tooltip-lint) {\n padding: var(--wx-space-4) 0;\n}\n\n/* The list an `autocompletion()` passed through `extensions` opens. */\n.wx-code-editor :deep(.cm-tooltip-autocomplete > ul) {\n max-height: 16em;\n padding: var(--wx-space-4) 0;\n font-family: var(--wx-font-family-mono);\n}\n\n.wx-code-editor :deep(.cm-tooltip-autocomplete > ul > li) {\n display: flex;\n gap: var(--wx-space-12);\n align-items: baseline;\n padding: var(--wx-space-2) var(--wx-space-8);\n}\n\n.wx-code-editor :deep(.cm-tooltip-autocomplete > ul > li[aria-selected]) {\n background: var(--wx-color-primary-soft);\n color: var(--wx-text-default);\n}\n\n.wx-code-editor :deep(.cm-completionMatchedText) {\n text-decoration: none;\n font-weight: 600;\n}\n\n.wx-code-editor :deep(.cm-completionDetail) {\n margin-left: auto;\n font-style: normal;\n font-family: var(--wx-font-family-sans);\n color: var(--wx-text-muted);\n}\n\n.wx-code-editor :deep(.cm-completionInfo) {\n padding: var(--wx-space-6) var(--wx-space-8);\n max-width: 320px;\n}\n\n.wx-code-editor :deep(.cm-diagnostic) {\n padding: var(--wx-space-2) var(--wx-space-8);\n border-left-width: 3px;\n}\n\n.wx-code-editor :deep(.cm-diagnostic-error) {\n border-left-color: var(--wx-color-danger);\n}\n\n.wx-code-editor :deep(.cm-diagnostic-warning) {\n border-left-color: var(--wx-color-warning);\n}\n\n.wx-code-editor :deep(.cm-panels) {\n background: var(--wx-bg-subtle);\n border-color: var(--wx-border-muted);\n color: var(--wx-text-default);\n font-family: var(--wx-font-family-sans);\n font-size: var(--wx-font-size-sm);\n}\n\n.wx-code-editor :deep(.cm-panel.cm-search) {\n padding: var(--wx-space-6) var(--wx-space-8);\n}\n\n.wx-code-editor :deep(.cm-panel.cm-search input),\n.wx-code-editor :deep(.cm-panel.cm-search button) {\n margin: 0 var(--wx-space-4) var(--wx-space-2) 0;\n padding: var(--wx-space-2) var(--wx-space-6);\n background: var(--wx-bg-surface);\n border: 1px solid var(--wx-border-default);\n border-radius: var(--wx-radius-xs);\n color: inherit;\n font: inherit;\n}\n\n.wx-code-editor :deep(.cm-panel.cm-search button) {\n background-image: none;\n cursor: pointer;\n}\n\n.wx-code-editor :deep(.cm-searchMatch) {\n background: var(--wx-color-warning-soft);\n}\n\n.wx-code-editor :deep(.cm-searchMatch.cm-searchMatch-selected) {\n background: var(--wx-color-warning-disabled);\n}\n</style>\n"],"names":["LANGUAGES","json","jsonParseLinter","javascript","html","css","markdown","yaml","php","mustacheHighlighting","highlightStyle","HighlightStyle","t","props","__props","emit","__emit","model","_useModel","field","useFormField","locales","useLocalized","editing","computed","current","host","ref","view","shallowRef","focused","editable","compartments","Compartment","languageExtension","lintExtension","source","run","linter","instance","found","diagnostic","widen","toDiagnostic","state","line","toCompletion","option","extra","given","write","snippet","completion","from","to","end","toResult","result","pos","completionExtension","autocompletion","context","word","editableExtension","enabled","EditorState","EditorView","gutterExtension","lineNumbers","highlightActiveLineGutter","foldGutter","wrappingExtension","indentExtension","indentUnit","placeholderExtensionFor","placeholderExtension","attributesExtension","attributes","buildState","doc","highlightSpecialChars","history","bracketMatching","closeBrackets","indentOnInput","highlightActiveLine","highlightSelectionMatches","syntaxHighlighting","keymap","closeBracketsKeymap","defaultKeymap","searchKeymap","historyKeymap","foldKeymap","indentWithTab","update","replacing","value","onMounted","onBeforeUnmount","follow","next","language","shown","watch","reconfigure","compartment","extension","extensions","format","parsed","classes","style","choose","code","__expose","_createElementBlock","_createElementVNode","_unref","_createBlock","LocalePicker"],"mappings":";;;;;;;;;;;;;;;;;AAsBO,MAAMA,IAAyD;AAAA,EACpE,MAAM,EAAE,WAAW,MAAMC,MAAQ,QAAQ,MAAMC,KAAgB;AAAA,EAC/D,YAAY,EAAE,WAAW,MAAMC,IAAW;AAAA,EAC1C,YAAY,EAAE,WAAW,MAAMA,EAAW,EAAE,YAAY,GAAA,CAAM,EAAA;AAAA,EAC9D,MAAM,EAAE,WAAW,MAAMC,IAAK;AAAA,EAC9B,KAAK,EAAE,WAAW,MAAMC,KAAI;AAAA,EAC5B,UAAU,EAAE,WAAW,MAAMC,KAAS;AAAA,EACtC,MAAM,EAAE,WAAW,MAAMC,KAAK;AAAA,EAC9B,KAAK,EAAE,WAAW,MAAMC,KAAI;AAAA,EAC5B,UAAU,EAAE,WAAW,MAAMC,IAAqB;AAAA,EAClD,iBAAiB,EAAE,WAAW,MAAM,CAACL,EAAA,GAAQK,EAAA,CAAsB,EAAA;AAAA,EACnE,OAA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