@coldsmirk/inkstone-codemirror 0.8.2

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.
@@ -0,0 +1,362 @@
1
+ import { Extension, StateField } from "@codemirror/state";
2
+ import { EditorView } from "@codemirror/view";
3
+
4
+ //#region src/context.d.ts
5
+ /**
6
+ * A node in the context shape. `ref` is a lazy pointer into {@link IrSchema.defs} (deref at use).
7
+ */
8
+ type IrType = {
9
+ readonly kind: "object";
10
+ readonly fields: Readonly<Record<string, IrField>>;
11
+ } | {
12
+ readonly kind: "array";
13
+ readonly element: IrType;
14
+ } | {
15
+ readonly kind: "enum";
16
+ readonly values: ReadonlyArray<string | number | boolean>;
17
+ } | {
18
+ readonly kind: "string" | "number" | "boolean" | "null" | "any";
19
+ } | {
20
+ readonly kind: "ref";
21
+ readonly name: string;
22
+ };
23
+ /**
24
+ * A named member of an object type. `nullable` / `required` are display metadata, not gates.
25
+ */
26
+ interface IrField {
27
+ readonly type: IrType;
28
+ readonly required: boolean;
29
+ readonly nullable: boolean;
30
+ readonly doc?: string;
31
+ }
32
+ /**
33
+ * A normalized context: a root shape plus a definition table backing `ref` nodes (and cycles).
34
+ */
35
+ interface IrSchema {
36
+ readonly root: IrType;
37
+ readonly defs: Readonly<Record<string, IrType>>;
38
+ }
39
+ /**
40
+ * A resolved member, offered as one completion.
41
+ */
42
+ interface Member {
43
+ readonly name: string;
44
+ readonly type: IrType;
45
+ readonly required: boolean;
46
+ readonly nullable: boolean;
47
+ readonly doc?: string;
48
+ }
49
+ /**
50
+ * How a caller hands inkstone a context: a JSON Schema, or a representative sample value to infer
51
+ * the shape from. Pass a *stable* reference (memoize/hoist it) — in React a new identity each
52
+ * render re-normalizes and re-dispatches.
53
+ */
54
+ type EditorContext = {
55
+ readonly schema: unknown;
56
+ } | {
57
+ readonly sample: unknown;
58
+ };
59
+ /**
60
+ * Reactively set (or clear) the render-context schema an editor completes against. Dispatch this
61
+ * effect — `setMinijinjaContext.of(normalizeContext(...))`, or `.of(null)` to turn it off — to
62
+ * update completion without recreating the editor, matching the create-once discipline used
63
+ * throughout the toolkit. Defined here (not with the MiniJinja grammar) so it and the field stay
64
+ * in the always-loaded chunk, leaving the grammar lazily code-split.
65
+ */
66
+ declare const setMinijinjaContext: import("@codemirror/state").StateEffectType<IrSchema | null>;
67
+ /**
68
+ * Holds the normalized render-context schema that variable / member completion reads. Seed it with
69
+ * `minijinja({ context })`, or drive it at runtime with {@link setMinijinjaContext}. `null` (the
70
+ * default) means no context — variable completion stays off and only tags / filters / tests /
71
+ * globals are offered.
72
+ */
73
+ declare const minijinjaContextField: StateField<IrSchema | null>;
74
+ /**
75
+ * Normalize either input form to the internal {@link IrSchema}.
76
+ */
77
+ declare function normalizeContext(input: EditorContext): IrSchema;
78
+ /**
79
+ * Members reachable at `path` — `[]` yields the top-level context variables (plus any `scope`
80
+ * bindings), a non-empty path walks member access (`["user", "address"]` → the fields of
81
+ * `user.address`). The first segment may resolve against a `scope` binding (a `{% for %}` target,
82
+ * macro parameter, …) before falling back to the root.
83
+ */
84
+ declare function resolveMembers(ir: IrSchema, path: readonly string[], scope?: ReadonlyMap<string, IrType>): Member[];
85
+ /**
86
+ * The type at a declared property path, or null if the path leaves the walkable shape.
87
+ */
88
+ declare function typeAtPath(ir: IrSchema, path: readonly string[]): IrType | null;
89
+ //#endregion
90
+ //#region src/controlled-host.d.ts
91
+ interface ControlledEditorOptions {
92
+ /**
93
+ * The element the editor mounts into.
94
+ */
95
+ parent: HTMLElement;
96
+ /**
97
+ * Initial document text.
98
+ */
99
+ doc: string;
100
+ /**
101
+ * Called with the full document after every user edit. Not called for
102
+ * {@link ControlledEditorHost.setValue} reconciliations.
103
+ */
104
+ onChange: (value: string) => void;
105
+ /**
106
+ * Static extensions, fixed for the editor's lifetime.
107
+ */
108
+ extensions?: Extension[];
109
+ /**
110
+ * Extensions that change at runtime (theme, language config …), swapped in place via
111
+ * {@link ControlledEditorHost.reconfigure} without rebuilding the editor.
112
+ */
113
+ dynamicExtensions?: Extension[];
114
+ }
115
+ /**
116
+ * A controlled CodeMirror 6 host — the create-once plumbing every framework wrapper repeats:
117
+ *
118
+ * - **External value reconcile.** {@link setValue} diffs the incoming value against the live
119
+ * document and dispatches a minimal replace, so a store-driven update never resets the caret
120
+ * and never echoes back through `onChange`.
121
+ * - **In-place reconfiguration.** `dynamicExtensions` live in a {@link Compartment};
122
+ * {@link reconfigure} swaps them (light/dark theme, language options) without rebuilding
123
+ * the editor and losing its state.
124
+ *
125
+ * Framework-agnostic: a React wrapper calls `setValue` from a value effect and `reconfigure`
126
+ * from a theme effect (see `@coldsmirk/inkstone-react`); any other framework does the same
127
+ * from its own reactivity.
128
+ */
129
+ declare class ControlledEditorHost {
130
+ private readonly compartment;
131
+ private silent;
132
+ readonly view: EditorView;
133
+ constructor({
134
+ parent,
135
+ doc,
136
+ onChange,
137
+ extensions,
138
+ dynamicExtensions
139
+ }: ControlledEditorOptions);
140
+ /**
141
+ * Reconcile an externally-changed value into the live document without resetting the caret.
142
+ * No-op when the document already matches; the write never re-enters `onChange`.
143
+ */
144
+ setValue(value: string): void;
145
+ /**
146
+ * Swap the dynamic extensions (theme, language configuration) in place.
147
+ */
148
+ reconfigure(dynamicExtensions: Extension[]): void;
149
+ destroy(): void;
150
+ }
151
+ //#endregion
152
+ //#region src/extensions.d.ts
153
+ /**
154
+ * Simplified-Chinese strings for the search / goto-line panels, as an opt-in extension —
155
+ * inkstone's defaults are English, so pass this through `extensions` to localize the panel
156
+ * (`search` must be on for the panel to exist at all).
157
+ */
158
+ declare const searchPhrasesZhCn: Extension;
159
+ interface DocumentExtensionsOptions {
160
+ /**
161
+ * Placeholder text shown while the document is empty.
162
+ */
163
+ placeholder?: string;
164
+ /**
165
+ * Soft-wrap long lines instead of scrolling horizontally.
166
+ *
167
+ * @default false
168
+ */
169
+ lineWrapping?: boolean;
170
+ /**
171
+ * Show the line-number gutter.
172
+ *
173
+ * @default false
174
+ */
175
+ showLineNumbers?: boolean;
176
+ /**
177
+ * Enable code folding — adds the fold gutter and fold keymap. Fold points come from the
178
+ * language, so this stays inert until a language is set.
179
+ *
180
+ * @default false
181
+ */
182
+ folding?: boolean;
183
+ /**
184
+ * Turn native browser spell-check on. CodeMirror itself keeps it off (`spellcheck="false"`
185
+ * on the content element), which is right for code — red squiggles under identifiers help
186
+ * nobody. Enable it for prose-grade documents (prompt templates, messages).
187
+ *
188
+ * @default false
189
+ */
190
+ spellcheck?: boolean;
191
+ /**
192
+ * Enable in-editor search: the standard search keymap (Ctrl/Cmd-F opens the panel, F3 /
193
+ * Ctrl/Cmd-G cycle matches, Ctrl/Cmd-D selects the next occurrence, Alt-G jumps to a line)
194
+ * plus selection-match highlighting. The panel speaks CodeMirror's stock English; add
195
+ * {@link searchPhrasesZhCn} to `extensions` for Simplified Chinese.
196
+ *
197
+ * @default false
198
+ */
199
+ search?: boolean;
200
+ }
201
+ /**
202
+ * The standard extension bundle for a document-grade editor — line numbers, history,
203
+ * selection drawing, active-line highlight, auto-indent, bracket matching/closing,
204
+ * completion UI, and the merged default keymap. This is the assembly every hand-built
205
+ * CodeMirror host repeats; language support and theming stay with the caller.
206
+ */
207
+ declare function documentExtensions({
208
+ placeholder,
209
+ lineWrapping,
210
+ showLineNumbers,
211
+ folding,
212
+ spellcheck,
213
+ search
214
+ }?: DocumentExtensionsOptions): Extension[];
215
+ //#endregion
216
+ //#region src/languages.d.ts
217
+ /**
218
+ * Language id → lazy loader, backed by the official `@codemirror/lang-*` (Lezer) parsers.
219
+ * Ids follow Monaco's spelling where they overlap, but the two editors expose independent
220
+ * language types — {@link CodeMirrorLanguage} is exactly this set.
221
+ */
222
+ declare const loaders: {
223
+ javascript: () => Promise<{
224
+ extension: Extension;
225
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
226
+ typescript: () => Promise<{
227
+ extension: Extension;
228
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
229
+ jsx: () => Promise<{
230
+ extension: Extension;
231
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
232
+ tsx: () => Promise<{
233
+ extension: Extension;
234
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
235
+ json: () => Promise<{
236
+ extension: Extension;
237
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
238
+ html: () => Promise<{
239
+ extension: Extension;
240
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
241
+ css: () => Promise<{
242
+ extension: Extension;
243
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
244
+ scss: () => Promise<{
245
+ extension: Extension;
246
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
247
+ sass: () => Promise<{
248
+ extension: Extension;
249
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
250
+ less: () => Promise<{
251
+ extension: Extension;
252
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
253
+ python: () => Promise<{
254
+ extension: Extension;
255
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
256
+ java: () => Promise<{
257
+ extension: Extension;
258
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
259
+ markdown: () => Promise<{
260
+ extension: Extension;
261
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
262
+ xml: () => Promise<{
263
+ extension: Extension;
264
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
265
+ rust: () => Promise<{
266
+ extension: Extension;
267
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
268
+ php: () => Promise<{
269
+ extension: Extension;
270
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
271
+ yaml: () => Promise<{
272
+ extension: Extension;
273
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
274
+ go: () => Promise<{
275
+ extension: Extension;
276
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
277
+ cpp: () => Promise<{
278
+ extension: Extension;
279
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
280
+ c: () => Promise<{
281
+ extension: Extension;
282
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
283
+ vue: () => Promise<{
284
+ extension: Extension;
285
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
286
+ liquid: () => Promise<{
287
+ extension: Extension;
288
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
289
+ wast: () => Promise<{
290
+ extension: Extension;
291
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
292
+ sql: () => Promise<{
293
+ extension: Extension;
294
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
295
+ mysql: () => Promise<{
296
+ extension: Extension;
297
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
298
+ pgsql: () => Promise<{
299
+ extension: Extension;
300
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
301
+ sqlite: () => Promise<{
302
+ extension: Extension;
303
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
304
+ minijinja: () => Promise<{
305
+ extension: Extension;
306
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
307
+ "minijinja-html": () => Promise<{
308
+ extension: Extension;
309
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
310
+ "minijinja-xml": () => Promise<{
311
+ extension: Extension;
312
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
313
+ "minijinja-json": () => Promise<{
314
+ extension: Extension;
315
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
316
+ "minijinja-yaml": () => Promise<{
317
+ extension: Extension;
318
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
319
+ "minijinja-css": () => Promise<{
320
+ extension: Extension;
321
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
322
+ "minijinja-scss": () => Promise<{
323
+ extension: Extension;
324
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
325
+ "minijinja-sass": () => Promise<{
326
+ extension: Extension;
327
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
328
+ "minijinja-less": () => Promise<{
329
+ extension: Extension;
330
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
331
+ "minijinja-markdown": () => Promise<{
332
+ extension: Extension;
333
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
334
+ "minijinja-sql": () => Promise<{
335
+ extension: Extension;
336
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
337
+ "minijinja-mysql": () => Promise<{
338
+ extension: Extension;
339
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
340
+ "minijinja-pgsql": () => Promise<{
341
+ extension: Extension;
342
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
343
+ "minijinja-sqlite": () => Promise<{
344
+ extension: Extension;
345
+ } | readonly Extension[] | import("@codemirror/language").LanguageSupport>;
346
+ };
347
+ /**
348
+ * The language ids `<CodeMirrorEditor>` supports — exactly the keys of the loader registry.
349
+ */
350
+ type CodeMirrorLanguage = keyof typeof loaders;
351
+ /**
352
+ * Every supported language id, sorted.
353
+ */
354
+ declare const codeMirrorLanguages: readonly CodeMirrorLanguage[];
355
+ /**
356
+ * Lazily resolve a supported language id to a CodeMirror language {@link Extension}. Each
357
+ * language is a separate dynamic import, so the consumer's bundler code-splits it and only
358
+ * the requested grammar is fetched — the whole catalog is never loaded at once.
359
+ */
360
+ declare function loadLanguage(language: CodeMirrorLanguage): Promise<Extension>;
361
+ //#endregion
362
+ export { type CodeMirrorLanguage, ControlledEditorHost, type ControlledEditorOptions, type DocumentExtensionsOptions, type EditorContext, type IrField, type IrSchema, type IrType, type Member, codeMirrorLanguages, documentExtensions, loadLanguage, minijinjaContextField, normalizeContext, resolveMembers, searchPhrasesZhCn, setMinijinjaContext, typeAtPath };
package/dist/index.js ADDED
@@ -0,0 +1,156 @@
1
+ import { a as setMinijinjaContext, i as resolveMembers, n as minijinjaContextField, o as typeAtPath, r as normalizeContext } from "./context-Dx6bPnKq.js";
2
+ import { Compartment, EditorState } from "@codemirror/state";
3
+ import { EditorView, drawSelection, highlightActiveLine, keymap, lineNumbers, placeholder } from "@codemirror/view";
4
+ import { autocompletion, closeBrackets, closeBracketsKeymap, completionKeymap } from "@codemirror/autocomplete";
5
+ import { defaultKeymap, history, historyKeymap, indentWithTab } from "@codemirror/commands";
6
+ import { bracketMatching, codeFolding, foldGutter, foldKeymap, indentOnInput } from "@codemirror/language";
7
+ import { highlightSelectionMatches, searchKeymap } from "@codemirror/search";
8
+ //#region src/controlled-host.ts
9
+ var ControlledEditorHost = class {
10
+ compartment = new Compartment();
11
+ silent = false;
12
+ view;
13
+ constructor({ parent, doc, onChange, extensions = [], dynamicExtensions = [] }) {
14
+ this.view = new EditorView({
15
+ parent,
16
+ state: EditorState.create({
17
+ doc,
18
+ extensions: [
19
+ ...extensions,
20
+ this.compartment.of(dynamicExtensions),
21
+ EditorView.updateListener.of((update) => {
22
+ if (update.docChanged && !this.silent) onChange(update.state.doc.toString());
23
+ })
24
+ ]
25
+ })
26
+ });
27
+ }
28
+ setValue(value) {
29
+ const current = this.view.state.doc.toString();
30
+ if (value === current) return;
31
+ const shorter = Math.min(current.length, value.length);
32
+ let from = 0;
33
+ while (from < shorter && current.codePointAt(from) === value.codePointAt(from)) from += 1;
34
+ let currentEnd = current.length;
35
+ let valueEnd = value.length;
36
+ while (currentEnd > from && valueEnd > from && current.codePointAt(currentEnd - 1) === value.codePointAt(valueEnd - 1)) {
37
+ currentEnd -= 1;
38
+ valueEnd -= 1;
39
+ }
40
+ this.silent = true;
41
+ try {
42
+ this.view.dispatch({ changes: {
43
+ from,
44
+ to: currentEnd,
45
+ insert: value.slice(from, valueEnd)
46
+ } });
47
+ } finally {
48
+ this.silent = false;
49
+ }
50
+ }
51
+ reconfigure(dynamicExtensions) {
52
+ this.view.dispatch({ effects: this.compartment.reconfigure(dynamicExtensions) });
53
+ }
54
+ destroy() {
55
+ this.view.destroy();
56
+ }
57
+ };
58
+ const searchPhrasesZhCn = EditorState.phrases.of({
59
+ Find: "查找",
60
+ Replace: "替换",
61
+ next: "下一个",
62
+ previous: "上一个",
63
+ all: "全部",
64
+ "match case": "区分大小写",
65
+ regexp: "正则表达式",
66
+ "by word": "全字匹配",
67
+ replace: "替换",
68
+ "replace all": "全部替换",
69
+ close: "关闭",
70
+ "current match": "当前匹配",
71
+ "on line": "所在行",
72
+ "Go to line": "跳转到行",
73
+ go: "跳转"
74
+ });
75
+ function documentExtensions({ placeholder: placeholder$1, lineWrapping = false, showLineNumbers = false, folding = false, spellcheck = false, search = false } = {}) {
76
+ return [
77
+ ...showLineNumbers ? [lineNumbers()] : [],
78
+ ...folding ? [
79
+ codeFolding(),
80
+ foldGutter(),
81
+ keymap.of(foldKeymap)
82
+ ] : [],
83
+ history(),
84
+ drawSelection(),
85
+ highlightActiveLine(),
86
+ indentOnInput(),
87
+ bracketMatching(),
88
+ closeBrackets(),
89
+ autocompletion(),
90
+ ...lineWrapping ? [EditorView.lineWrapping] : [],
91
+ ...search ? [highlightSelectionMatches(), keymap.of(searchKeymap)] : [],
92
+ keymap.of([
93
+ ...closeBracketsKeymap,
94
+ ...defaultKeymap,
95
+ ...historyKeymap,
96
+ ...completionKeymap,
97
+ indentWithTab
98
+ ]),
99
+ placeholder(placeholder$1 ?? ""),
100
+ ...spellcheck ? [EditorView.contentAttributes.of({ spellcheck: "true" })] : []
101
+ ];
102
+ }
103
+ //#endregion
104
+ //#region src/languages.ts
105
+ const loaders = {
106
+ javascript: () => import("@codemirror/lang-javascript").then((mod) => mod.javascript()),
107
+ typescript: () => import("@codemirror/lang-javascript").then((mod) => mod.javascript({ typescript: true })),
108
+ jsx: () => import("@codemirror/lang-javascript").then((mod) => mod.javascript({ jsx: true })),
109
+ tsx: () => import("@codemirror/lang-javascript").then((mod) => mod.javascript({
110
+ jsx: true,
111
+ typescript: true
112
+ })),
113
+ json: () => import("@codemirror/lang-json").then((mod) => mod.json()),
114
+ html: () => import("@codemirror/lang-html").then((mod) => mod.html()),
115
+ css: () => import("@codemirror/lang-css").then((mod) => mod.css()),
116
+ scss: () => import("@codemirror/lang-sass").then((mod) => mod.sass()),
117
+ sass: () => import("@codemirror/lang-sass").then((mod) => mod.sass({ indented: true })),
118
+ less: () => import("@codemirror/lang-less").then((mod) => mod.less()),
119
+ python: () => import("@codemirror/lang-python").then((mod) => mod.python()),
120
+ java: () => import("@codemirror/lang-java").then((mod) => mod.java()),
121
+ markdown: () => import("@codemirror/lang-markdown").then((mod) => mod.markdown()),
122
+ xml: () => import("@codemirror/lang-xml").then((mod) => mod.xml()),
123
+ rust: () => import("@codemirror/lang-rust").then((mod) => mod.rust()),
124
+ php: () => import("@codemirror/lang-php").then((mod) => mod.php()),
125
+ yaml: () => import("@codemirror/lang-yaml").then((mod) => mod.yaml()),
126
+ go: () => import("@codemirror/lang-go").then((mod) => mod.go()),
127
+ cpp: () => import("@codemirror/lang-cpp").then((mod) => mod.cpp()),
128
+ c: () => import("@codemirror/lang-cpp").then((mod) => mod.cpp()),
129
+ vue: () => import("@codemirror/lang-vue").then((mod) => mod.vue()),
130
+ liquid: () => import("@codemirror/lang-liquid").then((mod) => mod.liquid()),
131
+ wast: () => import("@codemirror/lang-wast").then((mod) => mod.wast()),
132
+ sql: () => import("@codemirror/lang-sql").then((mod) => mod.sql()),
133
+ mysql: () => import("@codemirror/lang-sql").then((mod) => mod.sql({ dialect: mod.MySQL })),
134
+ pgsql: () => import("@codemirror/lang-sql").then((mod) => mod.sql({ dialect: mod.PostgreSQL })),
135
+ sqlite: () => import("@codemirror/lang-sql").then((mod) => mod.sql({ dialect: mod.SQLite })),
136
+ minijinja: () => import("./minijinja-HpehSBbW.js").then((mod) => mod.minijinja()),
137
+ "minijinja-html": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-html")]).then(([mj, mod]) => mj.minijinja({ base: mod.html() })),
138
+ "minijinja-xml": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-xml")]).then(([mj, mod]) => mj.minijinja({ base: mod.xml() })),
139
+ "minijinja-json": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-json")]).then(([mj, mod]) => mj.minijinja({ base: mod.json() })),
140
+ "minijinja-yaml": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-yaml")]).then(([mj, mod]) => mj.minijinja({ base: mod.yaml() })),
141
+ "minijinja-css": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-css")]).then(([mj, mod]) => mj.minijinja({ base: mod.css() })),
142
+ "minijinja-scss": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-sass")]).then(([mj, mod]) => mj.minijinja({ base: mod.sass() })),
143
+ "minijinja-sass": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-sass")]).then(([mj, mod]) => mj.minijinja({ base: mod.sass({ indented: true }) })),
144
+ "minijinja-less": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-less")]).then(([mj, mod]) => mj.minijinja({ base: mod.less() })),
145
+ "minijinja-markdown": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-markdown")]).then(([mj, mod]) => mj.minijinja({ base: mod.markdown() })),
146
+ "minijinja-sql": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-sql")]).then(([mj, mod]) => mj.minijinja({ base: mod.sql() })),
147
+ "minijinja-mysql": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-sql")]).then(([mj, mod]) => mj.minijinja({ base: mod.sql({ dialect: mod.MySQL }) })),
148
+ "minijinja-pgsql": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-sql")]).then(([mj, mod]) => mj.minijinja({ base: mod.sql({ dialect: mod.PostgreSQL }) })),
149
+ "minijinja-sqlite": () => Promise.all([import("./minijinja-HpehSBbW.js"), import("@codemirror/lang-sql")]).then(([mj, mod]) => mj.minijinja({ base: mod.sql({ dialect: mod.SQLite }) }))
150
+ };
151
+ const codeMirrorLanguages = Object.keys(loaders).toSorted();
152
+ function loadLanguage(language) {
153
+ return loaders[language]();
154
+ }
155
+ //#endregion
156
+ export { ControlledEditorHost, codeMirrorLanguages, documentExtensions, loadLanguage, minijinjaContextField, normalizeContext, resolveMembers, searchPhrasesZhCn, setMinijinjaContext, typeAtPath };