@webx-ui/core 0.44.0 → 0.45.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/dist/{CodeEditor-gPYUUsSB.js → CodeEditor-MaAGoziu.js} +2 -2
- package/dist/{CodeEditor-gPYUUsSB.js.map → CodeEditor-MaAGoziu.js.map} +1 -1
- package/dist/RichText-CoaDjyK5.js +845 -0
- package/dist/RichText-CoaDjyK5.js.map +1 -0
- package/dist/components/Action/Action.d.ts +4 -1
- package/dist/components/Action/types.d.ts +9 -0
- package/dist/components/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Cascader/Cascader.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/DropdownItem/DropdownItem.d.ts +1 -1
- package/dist/components/FileCard/FileCard.d.ts +6 -6
- package/dist/components/IconPicker/IconPicker.d.ts +1 -1
- package/dist/components/ImageEditor/ImageEditor.d.ts +2 -2
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/InputNumber/InputNumber.d.ts +1 -1
- package/dist/components/Popconfirm/Popconfirm.d.ts +9 -5
- package/dist/components/Rate/Rate.d.ts +1 -1
- package/dist/components/RichText/RichText.d.ts +4 -1
- package/dist/components/RichText/index.d.ts +11 -3
- package/dist/components/RichText/types.d.ts +10 -1
- package/dist/components/Segmented/Segmented.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/TagsInput/TagsInput.d.ts +1 -1
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/TimePicker/TimePicker.d.ts +1 -1
- package/dist/{index-OwTgLBpg.js → index-Ba5vX487.js} +4205 -4158
- package/dist/index-Ba5vX487.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/internal/ConfirmDialog.d.ts +2 -2
- package/dist/internal/ImageEditorDialog.d.ts +3 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/RichText-Dmaf7-UT.js +0 -805
- package/dist/RichText-Dmaf7-UT.js.map +0 -1
- package/dist/index-OwTgLBpg.js.map +0 -1
|
@@ -6,7 +6,7 @@ import { defaultKeymap as De, historyKeymap as Fe, indentWithTab as Ke, history
|
|
|
6
6
|
import { autocompletion as te, CompletionContext as Ge, closeBracketsKeymap as Pe, closeBrackets as $e, snippet as Ue } from "@codemirror/autocomplete";
|
|
7
7
|
import { searchKeymap as Je, highlightSelectionMatches as Re } from "@codemirror/search";
|
|
8
8
|
import { linter as qe } from "@codemirror/lint";
|
|
9
|
-
import { m as Y, u as Qe, a as Xe, L as Ye, _ as Ze } from "./index-
|
|
9
|
+
import { m as Y, u as Qe, a as Xe, L as Ye, _ as Ze } from "./index-Ba5vX487.js";
|
|
10
10
|
import { jsonParseLinter as et, json as tt } from "@codemirror/lang-json";
|
|
11
11
|
import { javascript as Z, javascriptLanguage as nt, scopeCompletionSource as ot } from "@codemirror/lang-javascript";
|
|
12
12
|
import { html as H, htmlLanguage as ne, htmlCompletionSource as oe } from "@codemirror/lang-html";
|
|
@@ -425,4 +425,4 @@ const pt = Te.define([
|
|
|
425
425
|
export {
|
|
426
426
|
Ht as default
|
|
427
427
|
};
|
|
428
|
-
//# sourceMappingURL=CodeEditor-
|
|
428
|
+
//# sourceMappingURL=CodeEditor-MaAGoziu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor-gPYUUsSB.js","sources":["../src/components/CodeEditor/languages.ts","../src/components/CodeEditor/languageCompletions.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 { EditorSelection, EditorState, type Extension } from '@codemirror/state'\nimport { EditorView } from '@codemirror/view'\nimport { syntaxTree } from '@codemirror/language'\nimport {\n autocompletion,\n CompletionContext,\n type CompletionResult,\n type CompletionSource,\n} from '@codemirror/autocomplete'\nimport { html, htmlCompletionSource, htmlLanguage } from '@codemirror/lang-html'\nimport { javascriptLanguage, scopeCompletionSource } from '@codemirror/lang-javascript'\n\ntype SyntaxNode = ReturnType<ReturnType<typeof syntaxTree>['resolve']>\n\n/*\n * The trouble this file works around: an open `<script`, `<style` or `<textarea` at the very end\n * of the document — the usual case, typing into an empty editor — is parsed with an empty script\n * behind it. CodeMirror then takes the place for JavaScript: the list offers globals instead of\n * `src`, `async`, `defer`, and `>` closes nothing, since HTML's own auto-closing only runs where\n * HTML is the language. In an open tag it is always HTML's turn, whatever is mounted after it.\n */\n\n/** The open tag the place is in, read from the HTML tree itself rather than the nested one. */\nfunction openTagAt(state: EditorState, pos: number): SyntaxNode | null {\n for (let node: SyntaxNode | null = syntaxTree(state).resolve(pos, -1); node; node = node.parent) {\n if (node.name === 'OpenTag' || node.name === 'SelfClosingTag') return node\n if (node.name === 'Element' || node.name === 'Document') return null\n }\n\n return null\n}\n\n/*\n * `override` is a list fixed up front, while the sources of a place depend on the language there:\n * each slot asks for the n-th of them. JavaScript has the most, three — its keywords and snippets,\n * the names of the code itself and the globals added below — so four slots leave one to spare.\n */\nconst SLOTS = 4\n\nfunction slot(index: number): CompletionSource {\n return (context: CompletionContext) => {\n const inTag = openTagAt(context.state, context.pos) !== null\n const sources: readonly CompletionSource[] =\n inTag && !htmlLanguage.isActiveAt(context.state, context.pos, -1)\n ? [htmlCompletionSource]\n : context.state.languageDataAt<CompletionSource>('autocomplete', context.pos)\n const result = sources[index]?.(context) ?? null\n\n return inTag ? Promise.resolve(result).then(ownFirst) : result\n }\n}\n\nlet shared: Set<string> | null = null\n\n/**\n * The attributes every element takes, asked of HTML's own source at a tag it knows nothing about:\n * what it offers there is the global list and nothing else.\n */\nfunction globalAttributes(): Set<string> {\n if (shared === null) {\n const state = EditorState.create({ doc: '<x-any ', extensions: html() })\n const result = htmlCompletionSource(\n new CompletionContext(state, 7, true),\n ) as CompletionResult | null\n shared = new Set(result?.options.map((option) => option.label) ?? [])\n }\n\n return shared\n}\n\n/*\n * HTML offers a tag's own attributes and then some ninety global ones, sorted together by name:\n * `<script ` would open on `accesskey` and the `aria-*`, with `src` far below. Its own come first.\n */\nfunction ownFirst(result: CompletionResult | null): CompletionResult | null {\n if (result === null) return null\n\n const global = globalAttributes()\n\n return {\n ...result,\n options: result.options.map((option) =>\n option.type === 'property' && !global.has(option.label) ? { ...option, boost: 1 } : option,\n ),\n }\n}\n\n/**\n * `>` typed at the end of an open script, style or textarea writes its closing tag, as HTML's\n * auto-closing does everywhere else.\n */\nconst closeAtTheEnd = EditorView.inputHandler.of((view, from, to, text) => {\n if (text !== '>' || from !== to || view.state.readOnly) return false\n if (htmlLanguage.isActiveAt(view.state, from, -1)) return false\n\n const tag = openTagAt(view.state, from)\n const name = tag?.getChild('TagName')\n if (!tag || !name || tag.name !== 'OpenTag' || tag.getChild('EndTag')) return false\n\n const close = `</${view.state.sliceDoc(name.from, name.to)}>`\n view.dispatch({\n changes: { from, insert: '>' + close },\n selection: EditorSelection.cursor(from + 1),\n userEvent: 'input.type',\n })\n\n return true\n})\n\n/**\n * What the language itself suggests: HTML tags, attributes and their values with the tag closed on\n * `>`, and the JavaScript and CSS nested in it. Each language ships its own source; this switches\n * the list on, adds the globals of the page after a dot — the same `window`, `document` and\n * `console` the code meets on the site — and mends the end of the document.\n */\nexport function languageCompletions(): Extension {\n return [\n autocompletion({\n override: Array.from({ length: SLOTS }, (_, index) => slot(index)),\n icons: false,\n }),\n javascriptLanguage.data.of({ autocomplete: scopeCompletionSource(globalThis) }),\n closeAtTheEnd,\n ]\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, Prec, 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 { languageCompletions } from './languageCompletions'\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 languageCompletions: false,\n localized: false,\n singleLine: 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 keys: new Compartment(),\n line: 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 props.languageCompletions ? languageCompletions() : []\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\n/*\n * Tab indents a document; in a one-line field it moves on to the next field, as in any input.\n */\nfunction keysExtension(): Extension {\n return keymap.of([\n ...closeBracketsKeymap,\n ...defaultKeymap,\n ...searchKeymap,\n ...historyKeymap,\n ...foldKeymap,\n ...(props.singleLine ? [] : [indentWithTab]),\n ])\n}\n\n/**\n * One line, like an input: Enter takes a suggestion when the list is open (its keys come first)\n * and does nothing otherwise, and a line break typed, pasted or dropped in becomes a space.\n */\nfunction lineExtension(): Extension {\n if (!props.singleLine) return []\n\n const nothing = () => true\n\n return [\n Prec.high(\n keymap.of([\n { key: 'Enter', run: nothing },\n { key: 'Shift-Enter', run: nothing },\n { key: 'Mod-Enter', run: nothing },\n ]),\n ),\n EditorState.transactionFilter.of((transaction) => {\n if (!transaction.docChanged || transaction.newDoc.lines === 1) return transaction\n\n const changes: { from: number; to: number; insert: string }[] = []\n\n transaction.changes.iterChanges((from, to, _fromB, _toB, inserted) => {\n changes.push({ from, to, insert: inserted.toString().replace(/\\n/g, ' ') })\n })\n\n // A line break is one character, as is the space: the selection stays where it was.\n return {\n changes,\n selection: transaction.selection,\n effects: transaction.effects,\n scrollIntoView: transaction.scrollIntoView,\n }\n }),\n ]\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 compartments.keys.of(keysExtension()),\n compartments.line.of(lineExtension()),\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([() => props.completions, () => props.languageCompletions], () =>\n reconfigure(compartments.completion, completionExtension()),\n)\nwatch(\n () => props.singleLine,\n () => {\n reconfigure(compartments.keys, keysExtension())\n reconfigure(compartments.line, lineExtension())\n },\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 'is-single-line': props.singleLine,\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/*\n * One line: as tall as an input of the same size, the line in the middle, a long one scrolled\n * sideways under the caret rather than wrapped.\n */\n.wx-code-editor.is-single-line {\n --wx-locale-picker-height: 24px;\n --wx-locale-picker-top: 50%;\n --wx-locale-picker-shift: calc(-1 * (var(--wx-locale-picker-height) / 2 + 3px));\n}\n\n.wx-code-editor.is-single-line :deep(.cm-editor) {\n min-height: 0;\n height: calc(var(--wx-size-control-md) - 2px);\n}\n\n.wx-code-editor--sm.is-single-line :deep(.cm-editor) {\n height: calc(var(--wx-size-control-sm) - 2px);\n}\n\n.wx-code-editor--lg.is-single-line :deep(.cm-editor) {\n height: calc(var(--wx-size-control-lg) - 2px);\n}\n\n.wx-code-editor.is-single-line :deep(.cm-scroller) {\n overflow-y: hidden;\n scrollbar-width: none;\n}\n\n/* CodeMirror pins the scroller's children to the top with !important; the line centres itself. */\n.wx-code-editor.is-single-line :deep(.cm-content) {\n align-self: center;\n min-height: 0;\n padding: 0;\n}\n\n.wx-code-editor.is-single-line :deep(.cm-activeLine) {\n background: transparent;\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","openTagAt","state","pos","node","syntaxTree","SLOTS","slot","index","context","inTag","result","htmlLanguage","htmlCompletionSource","ownFirst","shared","globalAttributes","EditorState","CompletionContext","option","global","closeAtTheEnd","EditorView","view","from","to","text","tag","name","close","EditorSelection","languageCompletions","autocompletion","_","javascriptLanguage","scopeCompletionSource","highlightStyle","HighlightStyle","t","props","__props","emit","__emit","model","_useModel","field","useFormField","locales","useLocalized","editing","computed","current","host","ref","shallowRef","focused","editable","compartments","Compartment","languageExtension","lintExtension","source","run","linter","instance","found","diagnostic","widen","toDiagnostic","line","toCompletion","extra","given","write","snippet","completion","end","toResult","completionExtension","word","keysExtension","keymap","closeBracketsKeymap","defaultKeymap","searchKeymap","historyKeymap","foldKeymap","indentWithTab","lineExtension","nothing","Prec","transaction","changes","_fromB","_toB","inserted","editableExtension","enabled","gutterExtension","lineNumbers","highlightActiveLineGutter","foldGutter","wrappingExtension","indentExtension","indentUnit","placeholderExtensionFor","placeholderExtension","attributesExtension","attributes","buildState","doc","highlightSpecialChars","history","bracketMatching","closeBrackets","indentOnInput","highlightActiveLine","highlightSelectionMatches","syntaxHighlighting","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,KAAyD;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;A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OAAO,MAAA;AAAA,IACd;AAEA,WAAAoH,EAAa;AAAA,MACX,MAAApH;AAAA,MACA,OAAO,MAAMA,EAAK,OAAO,MAAA;AAAA,MACzB,QAAA8G;AAAA,IAAA,CACD,mBAICO,GASM,OAAA;AAAA,MATA,UAAOL,GAAA,KAAO;AAAA,MAAG,UAAOC,GAAA,KAAK;AAAA,IAAA;MACjCK,GAA+C,OAAA;AAAA,iBAAtC;AAAA,QAAJ,KAAIzF;AAAA,QAAO,OAAM;AAAA,MAAA;MAGd0F,EAAA/F,CAAA,EAAQ,GAAG,cADnBgG,GAKEC,IAAA;AAAA;QAHC,SAASF,EAAA/F,CAAA,EAAQ,KAAK;AAAA,QACtB,QAAQ+F,EAAA/F,CAAA,EAAQ,OAAO;AAAA,QACvB,UAAQ0F;AAAA,MAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"CodeEditor-MaAGoziu.js","sources":["../src/components/CodeEditor/languages.ts","../src/components/CodeEditor/languageCompletions.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 { EditorSelection, EditorState, type Extension } from '@codemirror/state'\nimport { EditorView } from '@codemirror/view'\nimport { syntaxTree } from '@codemirror/language'\nimport {\n autocompletion,\n CompletionContext,\n type CompletionResult,\n type CompletionSource,\n} from '@codemirror/autocomplete'\nimport { html, htmlCompletionSource, htmlLanguage } from '@codemirror/lang-html'\nimport { javascriptLanguage, scopeCompletionSource } from '@codemirror/lang-javascript'\n\ntype SyntaxNode = ReturnType<ReturnType<typeof syntaxTree>['resolve']>\n\n/*\n * The trouble this file works around: an open `<script`, `<style` or `<textarea` at the very end\n * of the document — the usual case, typing into an empty editor — is parsed with an empty script\n * behind it. CodeMirror then takes the place for JavaScript: the list offers globals instead of\n * `src`, `async`, `defer`, and `>` closes nothing, since HTML's own auto-closing only runs where\n * HTML is the language. In an open tag it is always HTML's turn, whatever is mounted after it.\n */\n\n/** The open tag the place is in, read from the HTML tree itself rather than the nested one. */\nfunction openTagAt(state: EditorState, pos: number): SyntaxNode | null {\n for (let node: SyntaxNode | null = syntaxTree(state).resolve(pos, -1); node; node = node.parent) {\n if (node.name === 'OpenTag' || node.name === 'SelfClosingTag') return node\n if (node.name === 'Element' || node.name === 'Document') return null\n }\n\n return null\n}\n\n/*\n * `override` is a list fixed up front, while the sources of a place depend on the language there:\n * each slot asks for the n-th of them. JavaScript has the most, three — its keywords and snippets,\n * the names of the code itself and the globals added below — so four slots leave one to spare.\n */\nconst SLOTS = 4\n\nfunction slot(index: number): CompletionSource {\n return (context: CompletionContext) => {\n const inTag = openTagAt(context.state, context.pos) !== null\n const sources: readonly CompletionSource[] =\n inTag && !htmlLanguage.isActiveAt(context.state, context.pos, -1)\n ? [htmlCompletionSource]\n : context.state.languageDataAt<CompletionSource>('autocomplete', context.pos)\n const result = sources[index]?.(context) ?? null\n\n return inTag ? Promise.resolve(result).then(ownFirst) : result\n }\n}\n\nlet shared: Set<string> | null = null\n\n/**\n * The attributes every element takes, asked of HTML's own source at a tag it knows nothing about:\n * what it offers there is the global list and nothing else.\n */\nfunction globalAttributes(): Set<string> {\n if (shared === null) {\n const state = EditorState.create({ doc: '<x-any ', extensions: html() })\n const result = htmlCompletionSource(\n new CompletionContext(state, 7, true),\n ) as CompletionResult | null\n shared = new Set(result?.options.map((option) => option.label) ?? [])\n }\n\n return shared\n}\n\n/*\n * HTML offers a tag's own attributes and then some ninety global ones, sorted together by name:\n * `<script ` would open on `accesskey` and the `aria-*`, with `src` far below. Its own come first.\n */\nfunction ownFirst(result: CompletionResult | null): CompletionResult | null {\n if (result === null) return null\n\n const global = globalAttributes()\n\n return {\n ...result,\n options: result.options.map((option) =>\n option.type === 'property' && !global.has(option.label) ? { ...option, boost: 1 } : option,\n ),\n }\n}\n\n/**\n * `>` typed at the end of an open script, style or textarea writes its closing tag, as HTML's\n * auto-closing does everywhere else.\n */\nconst closeAtTheEnd = EditorView.inputHandler.of((view, from, to, text) => {\n if (text !== '>' || from !== to || view.state.readOnly) return false\n if (htmlLanguage.isActiveAt(view.state, from, -1)) return false\n\n const tag = openTagAt(view.state, from)\n const name = tag?.getChild('TagName')\n if (!tag || !name || tag.name !== 'OpenTag' || tag.getChild('EndTag')) return false\n\n const close = `</${view.state.sliceDoc(name.from, name.to)}>`\n view.dispatch({\n changes: { from, insert: '>' + close },\n selection: EditorSelection.cursor(from + 1),\n userEvent: 'input.type',\n })\n\n return true\n})\n\n/**\n * What the language itself suggests: HTML tags, attributes and their values with the tag closed on\n * `>`, and the JavaScript and CSS nested in it. Each language ships its own source; this switches\n * the list on, adds the globals of the page after a dot — the same `window`, `document` and\n * `console` the code meets on the site — and mends the end of the document.\n */\nexport function languageCompletions(): Extension {\n return [\n autocompletion({\n override: Array.from({ length: SLOTS }, (_, index) => slot(index)),\n icons: false,\n }),\n javascriptLanguage.data.of({ autocomplete: scopeCompletionSource(globalThis) }),\n closeAtTheEnd,\n ]\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, Prec, 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 { languageCompletions } from './languageCompletions'\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 languageCompletions: false,\n localized: false,\n singleLine: 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 keys: new Compartment(),\n line: 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 props.languageCompletions ? languageCompletions() : []\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\n/*\n * Tab indents a document; in a one-line field it moves on to the next field, as in any input.\n */\nfunction keysExtension(): Extension {\n return keymap.of([\n ...closeBracketsKeymap,\n ...defaultKeymap,\n ...searchKeymap,\n ...historyKeymap,\n ...foldKeymap,\n ...(props.singleLine ? [] : [indentWithTab]),\n ])\n}\n\n/**\n * One line, like an input: Enter takes a suggestion when the list is open (its keys come first)\n * and does nothing otherwise, and a line break typed, pasted or dropped in becomes a space.\n */\nfunction lineExtension(): Extension {\n if (!props.singleLine) return []\n\n const nothing = () => true\n\n return [\n Prec.high(\n keymap.of([\n { key: 'Enter', run: nothing },\n { key: 'Shift-Enter', run: nothing },\n { key: 'Mod-Enter', run: nothing },\n ]),\n ),\n EditorState.transactionFilter.of((transaction) => {\n if (!transaction.docChanged || transaction.newDoc.lines === 1) return transaction\n\n const changes: { from: number; to: number; insert: string }[] = []\n\n transaction.changes.iterChanges((from, to, _fromB, _toB, inserted) => {\n changes.push({ from, to, insert: inserted.toString().replace(/\\n/g, ' ') })\n })\n\n // A line break is one character, as is the space: the selection stays where it was.\n return {\n changes,\n selection: transaction.selection,\n effects: transaction.effects,\n scrollIntoView: transaction.scrollIntoView,\n }\n }),\n ]\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 compartments.keys.of(keysExtension()),\n compartments.line.of(lineExtension()),\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([() => props.completions, () => props.languageCompletions], () =>\n reconfigure(compartments.completion, completionExtension()),\n)\nwatch(\n () => props.singleLine,\n () => {\n reconfigure(compartments.keys, keysExtension())\n reconfigure(compartments.line, lineExtension())\n },\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 'is-single-line': props.singleLine,\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/*\n * One line: as tall as an input of the same size, the line in the middle, a long one scrolled\n * sideways under the caret rather than wrapped.\n */\n.wx-code-editor.is-single-line {\n --wx-locale-picker-height: 24px;\n --wx-locale-picker-top: 50%;\n --wx-locale-picker-shift: calc(-1 * (var(--wx-locale-picker-height) / 2 + 3px));\n}\n\n.wx-code-editor.is-single-line :deep(.cm-editor) {\n min-height: 0;\n height: calc(var(--wx-size-control-md) - 2px);\n}\n\n.wx-code-editor--sm.is-single-line :deep(.cm-editor) {\n height: calc(var(--wx-size-control-sm) - 2px);\n}\n\n.wx-code-editor--lg.is-single-line :deep(.cm-editor) {\n height: calc(var(--wx-size-control-lg) - 2px);\n}\n\n.wx-code-editor.is-single-line :deep(.cm-scroller) {\n overflow-y: hidden;\n scrollbar-width: none;\n}\n\n/* CodeMirror pins the scroller's children to the top with !important; the line centres itself. */\n.wx-code-editor.is-single-line :deep(.cm-content) {\n align-self: center;\n min-height: 0;\n padding: 0;\n}\n\n.wx-code-editor.is-single-line :deep(.cm-activeLine) {\n background: transparent;\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","openTagAt","state","pos","node","syntaxTree","SLOTS","slot","index","context","inTag","result","htmlLanguage","htmlCompletionSource","ownFirst","shared","globalAttributes","EditorState","CompletionContext","option","global","closeAtTheEnd","EditorView","view","from","to","text","tag","name","close","EditorSelection","languageCompletions","autocompletion","_","javascriptLanguage","scopeCompletionSource","highlightStyle","HighlightStyle","t","props","__props","emit","__emit","model","_useModel","field","useFormField","locales","useLocalized","editing","computed","current","host","ref","shallowRef","focused","editable","compartments","Compartment","languageExtension","lintExtension","source","run","linter","instance","found","diagnostic","widen","toDiagnostic","line","toCompletion","extra","given","write","snippet","completion","end","toResult","completionExtension","word","keysExtension","keymap","closeBracketsKeymap","defaultKeymap","searchKeymap","historyKeymap","foldKeymap","indentWithTab","lineExtension","nothing","Prec","transaction","changes","_fromB","_toB","inserted","editableExtension","enabled","gutterExtension","lineNumbers","highlightActiveLineGutter","foldGutter","wrappingExtension","indentExtension","indentUnit","placeholderExtensionFor","placeholderExtension","attributesExtension","attributes","buildState","doc","highlightSpecialChars","history","bracketMatching","closeBrackets","indentOnInput","highlightActiveLine","highlightSelectionMatches","syntaxHighlighting","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,KAAyD;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,OAAO,EAAE,WAAW,MAAM,CAAA,EAAC;AAC7B;ACXA,SAASC,GAAUC,GAAoBC,GAAgC;AACrE,WAASC,IAA0BC,GAAWH,CAAK,EAAE,QAAQC,GAAK,EAAE,GAAGC,GAAMA,IAAOA,EAAK,QAAQ;AAC/F,QAAIA,EAAK,SAAS,aAAaA,EAAK,SAAS,iBAAkB,QAAOA;AACtE,QAAIA,EAAK,SAAS,aAAaA,EAAK,SAAS,WAAY,QAAO;AAAA,EAClE;AAEA,SAAO;AACT;AAOA,MAAME,KAAQ;AAEd,SAASC,GAAKC,GAAiC;AA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