@actualwave/react-native-codeditor 1.2.0 → 1.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.2
4
+
5
+ ### Fixed
6
+ - A `content` change that arrives while the WebView is still booting is now applied on initialization instead of being dropped.
7
+ - `resetValue()` and `historyClear()` now really empty the undo history (they rebuild the editor
8
+ state, keeping the live extensions). Before, they only dispatched an unrecorded transaction, so
9
+ earlier undo steps survived and were applied on top of the new document.
10
+
11
+ ### Added
12
+ - `saveState()` / `restoreState(snapshot)`: JSON snapshot of document, selection, undo/redo history
13
+ and scroll offset, so a document can leave and re-enter an editor without losing its history.
14
+ `restoreState` keeps the live extensions (language, theme, shortcuts, completions) and fires the
15
+ content / history-size callbacks. Exports the `EditorStateSnapshot` type.
16
+ If a snapshot's undo history does not match its document (undo/redo would throw "Applying change
17
+ set to a document with the wrong length"), `restoreState` logs a warning and restores the text,
18
+ selection and scroll only, with an empty history.
19
+
20
+ ## 1.2.1
21
+
22
+ ### Changed
23
+ - Updated bundled `@actualwave/codemirror-package` assets to 0.1.5, which adds the
24
+ `@actualwave/codemirror-lang-js-completion` language package for JavaScript completion.
25
+ - `js-completion` is added to the example app's `supportExtensions`.
26
+ - Static completions set via `setCompletions()` are now registered as language data instead of
27
+ `autocompletion({ override })`, so they merge with the language's own completion sources
28
+ (including embedded-language ones such as `sql`/`sksl` tagged templates, Tailwind, React Native)
29
+ and are suppressed inside embedded languages.
30
+
3
31
  ## 1.2.0
4
32
 
5
33
  ### Added
package/README.md CHANGED
@@ -224,6 +224,8 @@ export default function EditorScreen() {
224
224
  |---|---|---|---|
225
225
  | `content` | `string` | `''` | Initial document content (see [Content model](#content-model) below). |
226
226
  | `language` | `string` | `undefined` | Syntax language, e.g. `'javascript'`, `'python'`, `'sql'`. The language module is loaded from the bundled assets on first use. |
227
+ | `languageConfig` | `Record<string, unknown>` | `undefined` | Options passed to the language factory, e.g. `{ jsx: true, typescript: true }` for `'javascript'`. Must be plain serializable data. |
228
+ | `embeds` | `EmbedsConfig` | `undefined` | DSLs embedded in `'javascript'` — highlighting and suggestions for tagged templates (`sql`, `gql`, `css`…) and support extensions (Tailwind, React Native). See [Embedded DSLs](#embedded-dsls-in-javascript). Changing it re-resolves the current language. |
227
229
  | `languages` | `Record<string, string>` | `undefined` | Custom language packages as `{ name: packageName }`, for languages that don't follow the `@codemirror/lang-{name}` convention, e.g. `{ sksl: '@actualwave/codemirror-lang-sksl' }`. Registered before the initial `language` is resolved. The package must be bundled in the WebView assets. |
228
230
  | `extensions` | `ExtensionSpec[]` | `[]` | Additional CodeMirror 6 extension specs. See [Extension specs](#extension-specs). |
229
231
  | `theme` | `string` | `undefined` | Theme name. See [Themes](#themes). |
@@ -311,9 +313,17 @@ api.editor.resetValue(value?: string): Promise<void>
311
313
  ### Language, extensions, theme
312
314
 
313
315
  ```ts
314
- api.editor.setLanguage(name: string): Promise<void>
316
+ api.editor.setLanguage(name: string, config?: object, embeds?: EmbedsConfig): Promise<void>
315
317
  // Switches syntax language. Loads the language module on demand.
318
+ // `config` goes to the language factory; `embeds` applies to 'javascript' only.
316
319
  // e.g. await api.editor.setLanguage('python')
320
+ // await api.editor.setLanguage('javascript', { jsx: true }, { taggedTemplates: [...] })
321
+
322
+ api.editor.registerTaggedTemplate(packageName: string): Promise<void>
323
+ api.editor.registerSupportExtension(packageName: string, config?: object): Promise<void>
324
+ // Register an embed globally for the page. Call before the language is set to
325
+ // 'javascript', or follow with setLanguage('javascript', ...) to re-resolve.
326
+ // Alternative to the `embeds` prop — see "Embedded DSLs".
317
327
 
318
328
  api.editor.registerLanguage(name: string, packageName: string): Promise<void>
319
329
  // Maps a language name to a package that doesn't follow @codemirror/lang-{name}.
@@ -374,6 +384,8 @@ api.editor.historyClear(): Promise<void>
374
384
  // Clears the undo/redo history without changing the document.
375
385
 
376
386
  api.editor.historySize(): Promise<HistorySize>
387
+ api.editor.saveState(): Promise<EditorStateSnapshot> // doc + selection + undo/redo history + scroll (plain JSON)
388
+ api.editor.restoreState(snapshot): Promise<void> // keeps live language/theme/shortcuts; set language/theme first
377
389
  // Returns the current { undo, redo } depth.
378
390
  // Note: history size is also reported automatically via onHistorySizeUpdate.
379
391
  ```
@@ -566,6 +578,46 @@ await api.editor.setTheme(undefined); // remove theme, use CM6 default
566
578
 
567
579
  ---
568
580
 
581
+ ## Embedded DSLs in `javascript`
582
+
583
+ The `embeds` prop (or `setLanguage(name, config, embeds)`) mixes extra syntax into the
584
+ `'javascript'` language: highlighting **and** autocomplete suggestions. Packages are bundled
585
+ in the WebView assets; embeds only take effect for `language="javascript"`.
586
+
587
+ ```tsx
588
+ <CodeEditor
589
+ language="javascript"
590
+ languageConfig={{ jsx: true, typescript: true }}
591
+ embeds={{
592
+ taggedTemplates: [
593
+ '@actualwave/codemirror-lang-embed-css',
594
+ '@actualwave/codemirror-lang-embed-sql',
595
+ '@actualwave/codemirror-lang-embed-graphql',
596
+ ],
597
+ supportExtensions: [
598
+ '@actualwave/codemirror-lang-embed-react-native',
599
+ '@actualwave/codemirror-lang-js-completion',
600
+ ['@actualwave/codemirror-lang-embed-tailwind', {}], // [name, config]
601
+ ],
602
+ }}
603
+ {...otherProps}
604
+ />
605
+ ```
606
+
607
+ A package must be in the list matching what it exports, otherwise it silently fails to load:
608
+
609
+ | List | Packages | Provides |
610
+ |---|---|---|
611
+ | `taggedTemplates` | `embed-css`, `embed-sql`, `embed-glsl`, `embed-sksl`, `embed-icu-messageformat`, `embed-graphql` | Nested language highlighting + its suggestions (`embed-graphql`: highlighting only) |
612
+ | `supportExtensions` | `embed-tailwind`, `embed-react-native`, `js-completion` | Suggestions (and Tailwind class coloring) on the JS language; no nested language |
613
+
614
+ Tags are matched by name: `css`/`styled`/`styled.X`/`styled(X)` → CSS, `sql`, `gql`, `glsl`,
615
+ `sksl`, `t` → ICU MessageFormat, `tw` → Tailwind. `embed-react-native` needs no tag (JSX, imports,
616
+ `StyleSheet.create`). Only `supportExtensions` accept a config. Pass a stable (memoized/module-level)
617
+ `embeds` object — a new reference re-resolves the language.
618
+
619
+ ---
620
+
569
621
  ## Supported languages
570
622
 
571
623
  Pass any of these to the `language` prop or `api.editor.setLanguage()`:
package/SKILL.md CHANGED
@@ -199,7 +199,7 @@ apiRef.current?.editor.historyUndo();
199
199
  | `language` | `string` | — | Syntax language, e.g. `'javascript'`, `'python'`. Loaded on demand. |
200
200
  | `languageConfig` | `Record<string, unknown>` | — | Options passed to the language factory, e.g. `{ jsx: true, typescript: true }` for `'javascript'`. |
201
201
  | `languages` | `Record<string, string>` | — | Custom language packages `{ name: packageName }` for names that don't follow `@codemirror/lang-{name}`, e.g. `{ sksl: '@actualwave/codemirror-lang-sksl' }`. Registered before the initial `language` is resolved. |
202
- | `embeds` | `EmbedsConfig` | — | Tagged-template DSL embeddings and support extensions mixed into `'javascript'`: `{ taggedTemplates?: string[], supportExtensions?: (string \| [string, object])[] }`. |
202
+ | `embeds` | `EmbedsConfig` | — | DSL highlighting + suggestions mixed into `'javascript'`: `{ taggedTemplates?: string[], supportExtensions?: (string \| [string, object])[] }`. See [Embedded DSLs](#embedded-dsls-in-javascript). Changing it re-resolves the current language — pass a stable object. |
203
203
  | `extensions` | `ExtensionSpec[]` | `[]` | CM6 extension specs. |
204
204
  | `theme` | `string` | — | Theme name, e.g. `'darcula'`, `'monokai'`. |
205
205
  | `viewport` | `ViewportSettings` | — | `<meta name="viewport">` options. |
@@ -266,6 +266,8 @@ api.editor.historyUndo(): Promise<boolean>
266
266
  api.editor.historyRedo(): Promise<boolean>
267
267
  api.editor.historyClear(): Promise<void>
268
268
  api.editor.historySize(): Promise<HistorySize> // { undo, redo }
269
+ api.editor.saveState(): Promise<EditorStateSnapshot> // doc + selection + undo/redo history + scroll (plain JSON)
270
+ api.editor.restoreState(snapshot): Promise<void> // keeps live language/theme/shortcuts; set language/theme first
269
271
  ```
270
272
 
271
273
  ### Editing commands
@@ -448,6 +450,39 @@ Call `api.focus()` inside `onInitialized` to trigger the Android soft keyboard i
448
450
 
449
451
  ---
450
452
 
453
+ ## Embedded DSLs in `javascript`
454
+
455
+ `embeds` (prop, or 3rd arg of `setLanguage`) adds highlighting **and** autocomplete suggestions for DSLs inside `'javascript'`. Only applies when the language is `'javascript'`; merged with anything registered via `registerTaggedTemplate` / `registerSupportExtension`. Must be plain serializable data (package names + configs).
456
+
457
+ ```tsx
458
+ <CodeEditor
459
+ language="javascript"
460
+ languageConfig={{ jsx: true, typescript: true }}
461
+ embeds={{
462
+ taggedTemplates: [
463
+ '@actualwave/codemirror-lang-embed-css',
464
+ '@actualwave/codemirror-lang-embed-sql',
465
+ '@actualwave/codemirror-lang-embed-graphql',
466
+ ],
467
+ supportExtensions: [
468
+ '@actualwave/codemirror-lang-embed-react-native',
469
+ '@actualwave/codemirror-lang-embed-tailwind',
470
+ ],
471
+ }}
472
+ />
473
+ ```
474
+
475
+ A package must be in the list matching what it exports, else it fails to load:
476
+
477
+ | List | Packages | Provides |
478
+ |---|---|---|
479
+ | `taggedTemplates` | `embed-css`, `embed-sql`, `embed-glsl`, `embed-sksl`, `embed-icu-messageformat`, `embed-graphql` | Nested language highlighting + its suggestions (`embed-graphql`: highlighting only) |
480
+ | `supportExtensions` | `embed-tailwind`, `embed-react-native`, `js-completion` | Suggestions (and Tailwind class coloring) on the JS language; no nested language |
481
+
482
+ Tags match by name only: `css`/`styled`/`styled.X`/`styled(X)` → CSS, `sql`, `gql` (not `graphql`), `glsl`, `sksl`, `t` → ICU MessageFormat, `tw` → Tailwind. `embed-react-native` needs no tag (JSX, imports, `StyleSheet.create`). Only `supportExtensions` accept a config: `['pkg', config]`. No extra setup is needed for suggestions.
483
+
484
+ ---
485
+
451
486
  ## Common pitfalls
452
487
 
453
488
  **DDA calls not dispatched** — forgetting `await` silently does nothing. Every `api.editor.*` must be awaited.
@@ -458,6 +493,8 @@ Call `api.focus()` inside `onInitialized` to trigger the Android soft keyboard i
458
493
 
459
494
  **`setLanguage` rejects for unregistered names** — custom packages like `sksl` must be registered via the `languages` prop or `registerLanguage()` first.
460
495
 
496
+ **Embeds silently do nothing** — a package in the wrong list, a typo, or a missing module is skipped with no error, and embeds are ignored unless `language` is `'javascript'`. Tags are exact (`gql`, not `graphql`).
497
+
461
498
  **Android assets not copied** — if the WebView shows "Error loading page", the `src/assets/` files haven't been copied to `android/app/src/main/assets/codeditor/`. Re-run the copy command.
462
499
 
463
500
  **iOS URI** — the default `editorUri` is Android-only. iOS requires `new File(Paths.bundle, 'assets/codeditor/editor.html').uri` from `expo-file-system` (SDK 54+ API; on older SDKs use `FileSystem.bundleDirectory`).
@@ -108,6 +108,13 @@ const CodeEditor = ({
108
108
  onInitialized: api => {
109
109
  initializedRef.current = true;
110
110
  setInitialized(true);
111
+ // `content` may have changed while the WebView was still booting (the content effect
112
+ // skips pushing then), so the editor would keep the stale initial document.
113
+ const latest = propsRef.current.content;
114
+ if (latest !== currentContentRef.current) {
115
+ currentContentRef.current = latest;
116
+ void api.editor.setValue(latest);
117
+ }
111
118
  callbacksRef.current.onInitialized(api);
112
119
  },
113
120
  onContentUpdate: value => {
@@ -44,6 +44,12 @@ export interface EmbedsConfig {
44
44
  taggedTemplates?: string[];
45
45
  supportExtensions?: Array<string | [string, Record<string, unknown>]>;
46
46
  }
47
+ /** Opaque, JSON-serializable snapshot produced by `saveState()`. */
48
+ export interface EditorStateSnapshot {
49
+ state: unknown;
50
+ scrollTop: number;
51
+ scrollLeft: number;
52
+ }
47
53
  export interface EditorAPI {
48
54
  getValue(): Promise<string>;
49
55
  setValue(value: string): Promise<void>;
@@ -72,6 +78,17 @@ export interface EditorAPI {
72
78
  historyRedo(): Promise<boolean>;
73
79
  historyClear(): Promise<void>;
74
80
  historySize(): Promise<HistorySize>;
81
+ /**
82
+ * Snapshot of document, selection, undo/redo history and scroll offset. Plain JSON, so it
83
+ * can be kept in memory or persisted. Restore with `restoreState()`.
84
+ */
85
+ saveState(): Promise<EditorStateSnapshot>;
86
+ /**
87
+ * Replaces the editor state with a `saveState()` snapshot, keeping the live extensions
88
+ * (language, theme, shortcuts, completions). Set language/theme first. The content and
89
+ * history-size callbacks fire afterwards.
90
+ */
91
+ restoreState(snapshot: EditorStateSnapshot): Promise<void>;
75
92
  scrollToCursor(margin?: number): Promise<void>;
76
93
  startCompletion(): Promise<void>;
77
94
  setCompletions(items: CompletionItem[]): Promise<void>;
@@ -3,5 +3,5 @@ export { default as CodeEditor } from './CodeEditor';
3
3
  export type { CodeEditorProps } from './CodeEditor';
4
4
  export { default as WebViewAPI } from './WebViewAPI';
5
5
  export type { WebViewAPIHandlers, WebViewRef, InitialConfig } from './WebViewAPI';
6
- export type { EditorAPI, ExtensionSpec, ViewportSettings, CursorPosition, HistorySize, CompletionItem, EmbedsConfig, } from './EditorAPI';
6
+ export type { EditorAPI, ExtensionSpec, ViewportSettings, CursorPosition, HistorySize, EditorStateSnapshot, CompletionItem, EmbedsConfig, } from './EditorAPI';
7
7
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actualwave/react-native-codeditor",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "CodeMirror 6 code editor for React Native, embedded in a WebView with a full bidirectional RPC bridge. Offline, no CDN required.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -61,7 +61,7 @@
61
61
  "registry": "https://registry.npmjs.org/"
62
62
  },
63
63
  "devDependencies": {
64
- "@actualwave/codemirror-package": "^0.1.4",
64
+ "@actualwave/codemirror-package": "^0.1.5",
65
65
  "@react-native/assets-registry": "^0.85.3",
66
66
  "@react-native/babel-preset": "0.85.0",
67
67
  "@react-native/js-polyfills": "^0.85.3",
@@ -0,0 +1,72 @@
1
+ async function moduleInitFunction(requireAsyncModule,exports={}){function requireTypes(){function invert(byType){const out={};for(const[type,names]of Object.entries(byType))for(const name of names)out[name]=type;return out}// type -> { methodName: returnType }
2
+ // Date has dozens of accessors that follow a naming pattern.
3
+ function dateMethodReturn(name){return /^(get|set)/.test(name)||"valueOf"===name?"Number":/^to.*String$|^toJSON$/.test(name)?"String":null}// type -> { propertyName: type } for non-method members.
4
+ if(hasRequiredTypes)return types;hasRequiredTypes=1;// Static knowledge the inference pass needs and that runtime reflection
5
+ // can't provide: what a method *returns*. Member *names* are never listed
6
+ // here — they come from reflecting the real prototype (see members.js), so they
7
+ // always match the JS engine the editor runs in.
8
+ //
9
+ // Return values are type names, i.e. the name of a global constructor
10
+ // ('String', 'Array', ...), or the marker '@this' (returns the receiver's own
11
+ // type) / '@arg0' (returns the type of the first argument).
12
+ const STRING_RETURNS={String:["at","charAt","concat","normalize","padEnd","padStart","repeat","replace","replaceAll","slice","substr","substring","toLocaleLowerCase","toLocaleUpperCase","toLowerCase","toString","toUpperCase","toWellFormed","trim","trimEnd","trimLeft","trimRight","trimStart","valueOf"],Number:["charCodeAt","codePointAt","indexOf","lastIndexOf","localeCompare","search"],Boolean:["endsWith","includes","isWellFormed","startsWith"],Array:["match","split"]},ARRAY_RETURNS={Array:["concat","copyWithin","fill","filter","flat","flatMap","map","reverse","slice","sort","splice","toReversed","toSorted","toSpliced","with"],String:["join","toLocaleString","toString"],Number:["findIndex","findLastIndex","indexOf","lastIndexOf","push","unshift"],Boolean:["every","includes","some"]},METHOD_RETURNS={String:invert(STRING_RETURNS),Array:invert(ARRAY_RETURNS),Number:invert({String:["toExponential","toFixed","toLocaleString","toPrecision","toString"],Number:["valueOf"]}),BigInt:invert({String:["toLocaleString","toString"],BigInt:["valueOf"]}),Boolean:invert({String:["toString"],Boolean:["valueOf"]}),Map:invert({Map:["set"],Boolean:["delete","has"]}),Set:invert({Set:["add"],Boolean:["delete","has"]}),WeakMap:invert({WeakMap:["set"],Boolean:["delete","has"]}),WeakSet:invert({WeakSet:["add"],Boolean:["delete","has"]}),RegExp:invert({Boolean:["test"],Array:["exec"],String:["toString"]}),Promise:invert({Promise:["catch","finally","then"]}),Function:invert({Function:["bind"],String:["toString"]}),Error:invert({String:["toString"]}),URL:invert({String:["toJSON","toString"]}),URLSearchParams:invert({Boolean:["has"],String:["get","toString"],Array:["getAll"]}),Object:invert({Boolean:["hasOwnProperty","isPrototypeOf","propertyIsEnumerable"],String:["toLocaleString","toString"]})},PROPERTY_TYPES={String:{length:"Number"},Array:{length:"Number"},Function:{length:"Number",name:"String"},Map:{size:"Number"},Set:{size:"Number"},RegExp:{source:"String",flags:"String",lastIndex:"Number",global:"Boolean",ignoreCase:"Boolean",multiline:"Boolean",sticky:"Boolean"},Error:{message:"String",name:"String",stack:"String"},URL:{hash:"String",host:"String",hostname:"String",href:"String",origin:"String",password:"String",pathname:"String",port:"String",protocol:"String",search:"String",searchParams:"URLSearchParams",username:"String"}},STATIC_RETURNS={Array:{from:"Array",of:"Array",isArray:"Boolean"},Object:{assign:"@arg0",create:"Object",entries:"Array",freeze:"@arg0",fromEntries:"Object",getOwnPropertyNames:"Array",getOwnPropertySymbols:"Array",hasOwn:"Boolean",is:"Boolean",isExtensible:"Boolean",isFrozen:"Boolean",isSealed:"Boolean",keys:"Array",preventExtensions:"@arg0",seal:"@arg0",values:"Array"},JSON:{stringify:"String"},Math:{"*":"Number"},Number:{isFinite:"Boolean",isInteger:"Boolean",isNaN:"Boolean",isSafeInteger:"Boolean","*":"Number"},String:{fromCharCode:"String",fromCodePoint:"String",raw:"String"},Date:{now:"Number",parse:"Number",UTC:"Number"},Promise:{all:"Promise",allSettled:"Promise",any:"Promise",race:"Promise",reject:"Promise",resolve:"Promise",withResolvers:"Object"},BigInt:{asIntN:"BigInt",asUintN:"BigInt"}},GLOBAL_CALL_RETURNS={Array:"Array",BigInt:"BigInt",Boolean:"Boolean",Number:"Number",Object:"Object",String:"String",decodeURI:"String",decodeURIComponent:"String",encodeURI:"String",encodeURIComponent:"String",fetch:"Promise",isFinite:"Boolean",isNaN:"Boolean",parseFloat:"Number",parseInt:"Number"},TS_KEYWORD_TYPES={bigint:"BigInt",boolean:"Boolean",number:"Number",object:"Object",string:"String"},HIDDEN_MEMBERS=new Set(["constructor","caller","callee","arguments","toSource","unwatch","watch"]),HIDDEN_STATICS=new Set(["prototype","length","name","caller","arguments"]),DEFAULT_GLOBALS=["Object","Array","String","Number","Boolean","Symbol","BigInt","Math","JSON","Date","RegExp","Map","Set","WeakMap","WeakSet","Promise","Proxy","Reflect","Intl","Error","TypeError","RangeError","SyntaxError","ReferenceError","parseInt","parseFloat","isNaN","isFinite","NaN","Infinity","undefined","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","setTimeout","clearTimeout","setInterval","clearInterval","queueMicrotask","structuredClone","console","fetch","URL","URLSearchParams"];// Same lookup for members of global namespaces/constructors (`Math.`, `Object.`).
13
+ // A '*' key is the fallback for every other member.
14
+ // Global functions called without `new`.
15
+ // TypeScript keyword types -> runtime type names (for annotations).
16
+ // Members that exist on prototypes for historical reasons and are noise.
17
+ // Own properties of a constructor that aren't useful as `Ctor.` suggestions.
18
+ // Globals suggested (and usable as `Math.`-style receivers) by default.
19
+ // Deliberately excludes `window`, `document` and the rest of the browser's
20
+ // global surface; pass `globals` to the source to change this.
21
+ return types={METHOD_RETURNS,PROPERTY_TYPES,STATIC_RETURNS,GLOBAL_CALL_RETURNS,TS_KEYWORD_TYPES,HIDDEN_MEMBERS,HIDDEN_STATICS,DEFAULT_GLOBALS,dateMethodReturn},types}function requireInfer(){function createContext(state,scope){return{scope:scope||{},read:node=>state.sliceDoc(node.from,node.to),depth:0,active:new Set}}function instance(type){return type?{kind:"instance",type}:null}// `Map`, `Date`, `Promise`... — a built-in that can be both annotated and constructed.
22
+ function isBuiltinType(name){if(!/^[A-Z]/.test(name))return!1;const ctor=globalThis[name];return"function"==typeof ctor&&null!=ctor.prototype}function hasOwn(object,key){return Object.prototype.hasOwnProperty.call(object,key)}function childNamed(node,name){for(let child=node.firstChild;child;child=child.nextSibling)if(child.name===name)return child;return null}// The expression inside `( ... )`.
23
+ function innerOf(parenthesized){for(let child=parenthesized.firstChild;child;child=child.nextSibling)if("("!==child.name&&")"!==child.name)return child;return null}function propertyNameOf(memberExpression,ctx){const last=memberExpression.lastChild;return last&&"PropertyName"===last.name?ctx.read(last):null}function firstArgument(callExpression){const args=childNamed(callExpression,"ArgList");if(!args)return null;for(let child=args.firstChild;child;child=child.nextSibling)if("("!==child.name&&")"!==child.name&&","!==child.name)return child;return null}// ---- declarations -----------------------------------------------------------
24
+ // Reads `name [: Type] [= init]` starting at a VariableDefinition.
25
+ function readDefinition(definition){let next=definition.nextSibling,annotation=null,init=null;return next&&"TypeAnnotation"===next.name&&(annotation=next,next=next.nextSibling),next&&"Equals"===next.name&&(init=next.nextSibling),{kind:"variable",annotation,init,at:definition.from}}function collectDefinitions(parent,name,ctx,found){for(let child=parent.firstChild;child;child=child.nextSibling)"VariableDefinition"===child.name&&ctx.read(child)===name&&found.push(readDefinition(child))}function collectDeclarations(container,name,ctx,found){for(let child=container.firstChild;child;child=child.nextSibling)switch(child.name){case"VariableDeclaration":collectDefinitions(child,name,ctx,found);break;case"ExportDeclaration":case"ForSpec":collectDeclarations(child,name,ctx,found);break;case"FunctionDeclaration":case"ClassDeclaration":{const id=childNamed(child,"VariableDefinition");id&&ctx.read(id)===name&&found.push({kind:"FunctionDeclaration"===child.name?"function":"class",node:child,at:child.from});break}case"ParamList":collectDefinitions(child,name,ctx,found);break;case"ForInSpec":case"ForOfSpec":{const before=found.length;collectDefinitions(child,name,ctx,found),found.length>before&&(found[found.length-1]={kind:"ForInSpec"===child.name?"forIn":"unknown",at:child.from});break}case"VariableDefinition":"CatchClause"===container.name&&ctx.read(child)===name&&found.push({kind:"catch",at:child.from})}}// Finds the nearest enclosing declaration of `name` visible from `fromNode`.
26
+ function findDeclaration(name,fromNode,ctx){for(let container=fromNode.parent;container;container=container.parent){const found=[];if(collectDeclarations(container,name,ctx,found),!found.length)continue;// Prefer the closest declaration written before the usage (handles redeclared `var`s).
27
+ let best=null;for(const candidate of found)candidate.at<=fromNode.from&&(!best||candidate.at>best.at)&&(best=candidate);return best||found[0]}return null}// ---- TypeScript annotations ---------------------------------------------------
28
+ function typeNodeToDescriptor(typeNode,ctx){if(!typeNode)return null;switch(typeNode.name){case"TypeName":{const text=ctx.read(typeNode);if(hasOwn(TS_KEYWORD_TYPES,text))return instance(TS_KEYWORD_TYPES[text]);const declaration=findDeclaration(text,typeNode,ctx);return declaration?"class"===declaration.kind?{kind:"class",node:declaration.node}:null:isBuiltinType(text)?instance(text):null}case"ArrayType":return instance("Array");case"ParameterizedType":return typeNodeToDescriptor(typeNode.firstChild,ctx);default:return null}}function annotationToDescriptor(annotation,ctx){return annotation?typeNodeToDescriptor(annotation.lastChild,ctx):null}// ---- values -------------------------------------------------------------------
29
+ function descriptorFromValue(value,globalName){switch(typeof value){case"string":return instance("String");case"number":return instance("Number");case"boolean":return instance("Boolean");case"bigint":return instance("BigInt");case"symbol":return instance("Symbol");case"function":return{kind:"value",value,globalName};case"object":return null===value?null:Array.isArray(value)?instance("Array"):{kind:"value",value,globalName};default:return null}}function descriptorFromDeclaration(declaration,ctx){switch(declaration.kind){case"variable":return annotationToDescriptor(declaration.annotation,ctx)||(declaration.init?inferNode(declaration.init,ctx):null);case"function":return instance("Function");case"class":return{kind:"classStatic",node:declaration.node};case"forIn":return instance("String");case"catch":return instance("Error");default:return null}}// ---- expressions ----------------------------------------------------------------
30
+ function inferVariable(node,ctx){const name=ctx.read(node),declaration=findDeclaration(name,node,ctx);return declaration?descriptorFromDeclaration(declaration,ctx):hasOwn(ctx.scope,name)?descriptorFromValue(ctx.scope[name],name):null}function inferThis(node){let member=null;for(let current=node.parent;current;current=current.parent)if("MethodDeclaration"===current.name||"PropertyDeclaration"===current.name)member=current;else{if("ClassBody"===current.name){const isStatic=member&&childNamed(member,"static");return{kind:isStatic?"classStatic":"class",node:current.parent}}if("ObjectExpression"===current.name)return{kind:"object",node:current}}return null}function inferNew(node,ctx){const callee=childNamed(node,"VariableName");if(!callee)return null;const name=ctx.read(callee),declaration=findDeclaration(name,callee,ctx);return declaration?"class"===declaration.kind?{kind:"class",node:declaration.node}:null:hasOwn(ctx.scope,name)&&isBuiltinType(name)?instance(name):null}function inferCall(node,ctx){const callee=node.firstChild;if(!callee)return null;if("VariableName"===callee.name){const name=ctx.read(callee),declaration=findDeclaration(name,callee,ctx);return declaration?"function"===declaration.kind?annotationToDescriptor(childNamed(declaration.node,"TypeAnnotation"),ctx):null:hasOwn(ctx.scope,name)&&hasOwn(GLOBAL_CALL_RETURNS,name)?instance(GLOBAL_CALL_RETURNS[name]):null}if("MemberExpression"!==callee.name||!callee.firstChild)return null;const property=propertyNameOf(callee,ctx);if(!property)return null;const receiver=inferNode(callee.firstChild,ctx);if(!receiver)return null;if("instance"===receiver.kind){const{type}=receiver,returns="Date"===type?dateMethodReturn(property):METHOD_RETURNS[type]&&METHOD_RETURNS[type][property]||METHOD_RETURNS.Object&&METHOD_RETURNS.Object[property];return instance(returns)}if("value"===receiver.kind&&receiver.globalName&&hasOwn(STATIC_RETURNS,receiver.globalName)){const table=STATIC_RETURNS[receiver.globalName],returns=hasOwn(table,property)?table[property]:table["*"];if("@arg0"===returns){const argument=firstArgument(node);return argument?inferNode(argument,ctx):null}return instance(returns)}return null}function inferObjectKey(objectNode,key,ctx){for(let property=objectNode.firstChild;property;property=property.nextSibling){if("Property"!==property.name)continue;const id=property.firstChild;if(!id||"PropertyDefinition"!==id.name||ctx.read(id)!==key)continue;if(childNamed(property,"ParamList"))return instance("Function");const colon=id.nextSibling;if(colon&&":"===colon.name)return inferNode(colon.nextSibling,ctx);// shorthand `{ key }` refers to the variable of the same name
31
+ const declaration=findDeclaration(key,id,ctx);return declaration?descriptorFromDeclaration(declaration,ctx):null}return null}function inferClassField(classNode,key,wantStatic,ctx){const body=childNamed(classNode,"ClassBody");if(!body)return null;for(let member=body.firstChild;member;member=member.nextSibling){if("PropertyDeclaration"!==member.name&&"MethodDeclaration"!==member.name)continue;if(!!childNamed(member,"static")!==wantStatic)continue;const id=childNamed(member,"PropertyDefinition");if(!id||ctx.read(id)!==key)continue;if("MethodDeclaration"===member.name)return instance("Function");const field=readDefinition(id);return annotationToDescriptor(field.annotation,ctx)||(field.init?inferNode(field.init,ctx):null)}return null}function inferMember(node,ctx){const property=propertyNameOf(node,ctx);if(!property||!node.firstChild)return null;const receiver=inferNode(node.firstChild,ctx);if(!receiver)return null;switch(receiver.kind){case"instance":return instance(PROPERTY_TYPES[receiver.type]&&PROPERTY_TYPES[receiver.type][property]);case"object":return inferObjectKey(receiver.node,property,ctx);case"class":return inferClassField(receiver.node,property,!1,ctx);case"classStatic":return inferClassField(receiver.node,property,!0,ctx);case"value":{const descriptor=Object.getOwnPropertyDescriptor(receiver.value,property);return descriptor&&"value"in descriptor?descriptorFromValue(descriptor.value):null}default:return null}}function infer(node,ctx){switch(node.name){case"String":case"TemplateString":return instance("String");case"Number":return instance("Number");case"BooleanLiteral":return instance("Boolean");case"RegExp":return instance("RegExp");case"ArrayExpression":return instance("Array");case"ArrowFunction":case"FunctionExpression":return instance("Function");case"ObjectExpression":return{kind:"object",node};case"ParenthesizedExpression":return inferNode(innerOf(node),ctx);case"UnaryExpression":return node.firstChild&&"typeof"===node.firstChild.name?instance("String"):null;case"AwaitExpression":{const awaited=inferNode(node.lastChild,ctx);// The resolved type of a Promise isn't tracked.
32
+ return awaited&&"instance"===awaited.kind&&"Promise"===awaited.type?null:awaited}case"this":return inferThis(node);case"VariableName":return inferVariable(node,ctx);case"NewExpression":return inferNew(node,ctx);case"CallExpression":return inferCall(node,ctx);case"MemberExpression":return inferMember(node,ctx);default:return null}}// Guards against runaway recursion and self-referencing declarations
33
+ // (`const a = a.b`).
34
+ function inferNode(node,ctx){if(!node||ctx.depth>=MAX_DEPTH)return null;const key=`${node.name}:${node.from}:${node.to}`;if(ctx.active.has(key))return null;ctx.active.add(key),ctx.depth+=1;try{return infer(node,ctx)}finally{ctx.active.delete(key),ctx.depth-=1}}if(hasRequiredInfer)return infer_1;hasRequiredInfer=1;const{METHOD_RETURNS,PROPERTY_TYPES,STATIC_RETURNS,GLOBAL_CALL_RETURNS,TS_KEYWORD_TYPES,dateMethodReturn}=requireTypes(),MAX_DEPTH=16;// A deliberately small, heuristic type inference over the Lezer JS syntax tree.
35
+ // It answers one question: "what is the thing to the left of this `.`?" — and
36
+ // answers it only when that is cheap and certain (literals, constructors,
37
+ // simple declarations, annotated TS types, a table of well-known method return
38
+ // types). Anything else resolves to null and produces no suggestions, so a
39
+ // wrong guess never reaches the user.
40
+ //
41
+ // Results are descriptors:
42
+ // { kind: 'instance', type } an instance of a built-in ('String', 'Map', ...)
43
+ // { kind: 'object', node } an object literal (its keys are suggested)
44
+ // { kind: 'class', node } an instance of a class declared in this file
45
+ // { kind: 'classStatic', node } that class itself (`Foo.`)
46
+ // { kind: 'value', value, globalName? } a live value from the globals scope (`Math`, `console`, ...)
47
+ return infer_1={createContext,inferNode,findDeclaration,isBuiltinType,childNamed},infer_1}function requireMembers(){function propertyKind(object,name){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(object,name)}catch(_){return null}return descriptor?"function"==typeof descriptor.value?"method":"property":null;// Accessors are never invoked (`Map.prototype.size` throws off an instance).
48
+ }// Every member of `new Type()`, found by walking the real prototype chain, so the
49
+ // list always matches the engine the editor runs in. Members of deeper prototypes
50
+ // (Object.prototype's) rank lower.
51
+ function instanceOptions(type){if(instanceCache.has(type))return instanceCache.get(type);const options=[],ctor=globalThis[type];if("function"==typeof ctor&&ctor.prototype){const seen=new Set;let depth=0;for(let object=ctor.prototype;object;object=Object.getPrototypeOf(object)){for(const name of Object.getOwnPropertyNames(object)){if(seen.has(name)||!IDENT.test(name)||name.startsWith("__")||HIDDEN_MEMBERS.has(name))continue;const kind=propertyKind(object,name);kind&&(seen.add(name),options.push({label:name,type:kind,boost:-depth}))}depth+=1}}return instanceCache.set(type,options),options}// Own members of a namespace/constructor/custom API object (`Math.`, `Object.`).
52
+ function staticOptions(value){if(staticCache.has(value))return staticCache.get(value);const isFunction="function"==typeof value,options=[];for(const name of Object.getOwnPropertyNames(value)){if(!IDENT.test(name)||isFunction&&HIDDEN_STATICS.has(name))continue;const kind=propertyKind(value,name);kind&&options.push({label:name,type:"method"===kind&&/^[A-Z]/.test(name)?"class":kind})}return staticCache.set(value,options),options}function literalOptions(objectNode,ctx){const options=[];for(let property=objectNode.firstChild;property;property=property.nextSibling){if("Property"!==property.name)continue;const id=property.firstChild;if(!id||"PropertyDefinition"!==id.name)continue;const colon=id.nextSibling,value=colon&&":"===colon.name?colon.nextSibling:null,isMethod=!!childNamed(property,"ParamList")||!!(value&&("ArrowFunction"===value.name||"FunctionExpression"===value.name));options.push({label:ctx.read(id),type:isMethod?"method":"property",boost:2})}return options}function classOptions(classNode,ctx,wantStatic,visited){if(visited.has(classNode.from))return[];visited.add(classNode.from);const options=[],body=childNamed(classNode,"ClassBody");if(body)for(let member=body.firstChild;member;member=member.nextSibling){if("PropertyDeclaration"!==member.name&&"MethodDeclaration"!==member.name)continue;if(!!childNamed(member,"static")!==wantStatic)continue;const id=childNamed(member,"PropertyDefinition");if(!id)continue;const label=ctx.read(id);if("constructor"===label)continue;const accessor=childNamed(member,"get")||childNamed(member,"set");options.push({label,type:"MethodDeclaration"!==member.name||accessor?"property":"method",boost:2})}if(!wantStatic){let parent=null;for(let child=classNode.firstChild;child;child=child.nextSibling)"extends"===child.name&&(parent=child.nextSibling);if(parent&&"VariableName"===parent.name){const name=ctx.read(parent),declaration=findDeclaration(name,parent,ctx);declaration&&"class"===declaration.kind?options.push(...classOptions(declaration.node,ctx,!1,visited).map(option=>({...option,boost:1}))):!declaration&&isBuiltinType(name)&&options.push(...instanceOptions(name))}}return options}function dedupe(options){const seen=new Set;return options.filter(option=>!seen.has(option.label)&&(seen.add(option.label),!0))}// Turns an inference descriptor into completion options.
53
+ function membersOf(descriptor,ctx){switch(descriptor.kind){case"instance":return instanceOptions(descriptor.type);case"object":return dedupe([...literalOptions(descriptor.node,ctx),...instanceOptions("Object")]);case"class":return dedupe([...classOptions(descriptor.node,ctx,!1,new Set),...instanceOptions("Object")]);case"classStatic":return dedupe(classOptions(descriptor.node,ctx,!0,new Set));case"value":return staticOptions(descriptor.value);default:return[]}}if(hasRequiredMembers)return members;hasRequiredMembers=1;const{HIDDEN_MEMBERS,HIDDEN_STATICS}=requireTypes(),{findDeclaration,isBuiltinType,childNamed}=requireInfer(),IDENT=/^[A-Za-z_$][\w$]*$/,instanceCache=new Map,staticCache=new WeakMap;return members={membersOf,instanceOptions,staticOptions},members}function requireCompletion(){// `globals` is either a list of global names to expose (read off globalThis, absent
54
+ // ones are skipped) or a ready-made scope object ({ name: value }).
55
+ function resolveScope(globals){const source=null==globals?DEFAULT_GLOBALS:globals;if(!Array.isArray(source))return source;const scope={};for(const name of source)name in globalThis&&(scope[name]=globalThis[name]);return scope}function globalOptions(scope){return Object.keys(scope).map(label=>{const value=scope[label];let type="variable";return"function"==typeof value&&(type=/^[A-Z]/.test(label)?"class":"function"),{label,type}})}// Finds the MemberExpression whose property is being typed, and where the typed
56
+ // name starts. Handles `a.|`, `a.b|`, and `a?.b|`.
57
+ function memberContext(inner,pos){return"PropertyName"===inner.name&&inner.parent&&"MemberExpression"===inner.parent.name?{member:inner.parent,from:inner.from}:("."===inner.name||"?."===inner.name)&&inner.parent&&"MemberExpression"===inner.parent.name?{member:inner.parent,from:pos}:"MemberExpression"===inner.name?{member:inner,from:pos}:null}/**
58
+ * A `CompletionSource` for plain JavaScript that suggests:
59
+ * - after a `.`, the members of whatever the receiver is inferred to be
60
+ * (strings, arrays, numbers, Map/Set/Date/Promise/..., object literals, classes
61
+ * declared in the file, `this`, `Math`/`JSON`/`Object`/... and custom globals);
62
+ * - elsewhere, the configured globals (`setTimeout`, `Math`, `fetch`, ...).
63
+ * It declines (returns null) whenever the receiver's type isn't known.
64
+ *
65
+ * @param {{ globals?: string[] | object }} [config]
66
+ */function jsCompletionSource(config={}){const scope=resolveScope(config.globals),globals=globalOptions(scope);return context=>{const{state,pos}=context,inner=syntaxTree(state).resolveInner(pos,-1),access=memberContext(inner,pos);if(access){const receiver=access.member.firstChild;if(!receiver||receiver===inner)return null;const descriptor=inferNode(receiver,createContext(state,scope));if(!descriptor)return null;const options=membersOf(descriptor,createContext(state,scope));return options.length?{from:access.from,options,validFor:IDENT}:null}if(DONT_COMPLETE.has(inner.name))return null;const isWord="VariableName"===inner.name||20>inner.to-inner.from&&IDENT.test(state.sliceDoc(inner.from,inner.to));return isWord||context.explicit?{from:isWord?inner.from:pos,options:globals,validFor:IDENT}:null}}if(hasRequiredCompletion)return completion;hasRequiredCompletion=1;const{syntaxTree}=require$$0,{DEFAULT_GLOBALS}=requireTypes(),{createContext,inferNode}=requireInfer(),{membersOf}=requireMembers(),IDENT=/^[\w$\xa1-￿][\w$\d\xa1-￿]*$/,DONT_COMPLETE=new Set(["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."]);// Nodes in which neither names nor members are completed. Mirrors the list
67
+ // @codemirror/lang-javascript uses for its own sources.
68
+ return completion={jsCompletionSource,resolveScope},completion}function requireCodemirrorLangJsCompletion(){// Like embed-tailwind and embed-react-native, there is no grammar here: the
69
+ // completions are layered on the existing JS parser. The source is attached to
70
+ // `jsLanguageSupport.language`, so pass the same support whose `language` the
71
+ // editor uses (the one returned by embedTaggedTemplates, when embedding).
72
+ function createSupportExtension(jsLanguageSupport,config){return jsLanguageSupport.language.data.of({autocomplete:jsCompletionSource(config)})}if(hasRequiredCodemirrorLangJsCompletion)return codemirrorLangJsCompletion;hasRequiredCodemirrorLangJsCompletion=1;const{jsCompletionSource,resolveScope}=requireCompletion(),{DEFAULT_GLOBALS}=requireTypes();return codemirrorLangJsCompletion={createSupportExtension,jsCompletionSource,resolveScope,DEFAULT_GLOBALS},codemirrorLangJsCompletion}const module={exports:exports};var types,hasRequiredTypes,infer_1,hasRequiredInfer,members,hasRequiredMembers,completion,hasRequiredCompletion,codemirrorLangJsCompletion,hasRequiredCodemirrorLangJsCompletion,require$$0=await requireAsyncModule("@codemirror/language"),codemirrorLangJsCompletionExports=requireCodemirrorLangJsCompletion(),index=/*@__PURE__*/function getDefaultExportFromCjs(x){return x}(codemirrorLangJsCompletionExports);return module.exports=index,module.exports}
@@ -5,7 +5,7 @@
5
5
  (function (global) {
6
6
  'use strict';
7
7
  // Injected during build with the full module map: { [packageName]: { file, core?, bundle? } }
8
- const modules = {"crelt":{"file":"crelt","core":true,"bundle":"_core"},"style-mod":{"file":"style-mod","core":true,"bundle":"_core"},"w3c-keyname":{"file":"w3c-keyname","core":true,"bundle":"_core"},"@marijn/find-cluster-break":{"file":"@marijn_find-cluster-break","core":true,"bundle":"_core"},"@lezer/common":{"file":"@lezer_common","core":true,"bundle":"_core"},"@lezer/highlight":{"file":"@lezer_highlight","core":true,"bundle":"_core"},"@lezer/lr":{"file":"@lezer_lr","core":true,"bundle":"_core"},"@codemirror/state":{"file":"@codemirror_state","core":true,"bundle":"_core"},"@codemirror/view":{"file":"@codemirror_view","core":true,"bundle":"_core"},"@codemirror/language":{"file":"@codemirror_language","core":true,"bundle":"_core"},"@codemirror/commands":{"file":"@codemirror_commands","core":true,"bundle":"_core"},"@codemirror/autocomplete":{"file":"@codemirror_autocomplete","core":true,"bundle":"_core"},"@codemirror/search":{"file":"@codemirror_search","core":true,"bundle":"_core"},"@codemirror/lint":{"file":"@codemirror_lint","core":true,"bundle":"_core"},"codemirror":{"file":"codemirror"},"@codemirror/collab":{"file":"@codemirror_collab"},"@codemirror/language-data":{"file":"@codemirror_language-data"},"@codemirror/merge":{"file":"@codemirror_merge"},"@codemirror/theme-one-dark":{"file":"@codemirror_theme-one-dark"},"@uiw/codemirror-themes":{"file":"@uiw_codemirror-themes"},"@uiw/codemirror-theme-androidstudio":{"file":"@uiw_codemirror-theme-androidstudio"},"@uiw/codemirror-theme-andromeda":{"file":"@uiw_codemirror-theme-andromeda"},"@uiw/codemirror-theme-atomone":{"file":"@uiw_codemirror-theme-atomone"},"@uiw/codemirror-theme-aura":{"file":"@uiw_codemirror-theme-aura"},"@uiw/codemirror-theme-basic":{"file":"@uiw_codemirror-theme-basic"},"@uiw/codemirror-theme-bbedit":{"file":"@uiw_codemirror-theme-bbedit"},"@uiw/codemirror-theme-copilot":{"file":"@uiw_codemirror-theme-copilot"},"@uiw/codemirror-theme-darcula":{"file":"@uiw_codemirror-theme-darcula"},"@uiw/codemirror-theme-dracula":{"file":"@uiw_codemirror-theme-dracula"},"@uiw/codemirror-theme-duotone":{"file":"@uiw_codemirror-theme-duotone"},"@uiw/codemirror-theme-eclipse":{"file":"@uiw_codemirror-theme-eclipse"},"@uiw/codemirror-theme-github":{"file":"@uiw_codemirror-theme-github"},"@uiw/codemirror-theme-material":{"file":"@uiw_codemirror-theme-material"},"@uiw/codemirror-theme-monokai":{"file":"@uiw_codemirror-theme-monokai"},"@uiw/codemirror-theme-nord":{"file":"@uiw_codemirror-theme-nord"},"@uiw/codemirror-theme-okaidia":{"file":"@uiw_codemirror-theme-okaidia"},"@uiw/codemirror-theme-solarized":{"file":"@uiw_codemirror-theme-solarized"},"@uiw/codemirror-theme-sublime":{"file":"@uiw_codemirror-theme-sublime"},"@uiw/codemirror-theme-tokyo-night":{"file":"@uiw_codemirror-theme-tokyo-night"},"@uiw/codemirror-theme-vscode":{"file":"@uiw_codemirror-theme-vscode"},"@uiw/codemirror-theme-xcode":{"file":"@uiw_codemirror-theme-xcode"},"@lezer/css":{"file":"@lezer_css"},"@lezer/go":{"file":"@lezer_go"},"@lezer/html":{"file":"@lezer_html"},"@lezer/java":{"file":"@lezer_java"},"@lezer/javascript":{"file":"@lezer_javascript"},"@lezer/json":{"file":"@lezer_json"},"@lezer/cpp":{"file":"@lezer_cpp"},"@lezer/lezer":{"file":"@lezer_lezer"},"@lezer/markdown":{"file":"@lezer_markdown"},"@lezer/php":{"file":"@lezer_php"},"@lezer/python":{"file":"@lezer_python"},"@lezer/rust":{"file":"@lezer_rust"},"@lezer/sass":{"file":"@lezer_sass"},"@lezer/xml":{"file":"@lezer_xml"},"@lezer/yaml":{"file":"@lezer_yaml"},"@codemirror/lang-angular":{"file":"@codemirror_lang-angular"},"@codemirror/lang-cpp":{"file":"@codemirror_lang-cpp"},"@codemirror/lang-css":{"file":"@codemirror_lang-css"},"@codemirror/lang-go":{"file":"@codemirror_lang-go"},"@codemirror/lang-html":{"file":"@codemirror_lang-html"},"@codemirror/lang-java":{"file":"@codemirror_lang-java"},"@codemirror/lang-javascript":{"file":"@codemirror_lang-javascript"},"@codemirror/lang-jinja":{"file":"@codemirror_lang-jinja"},"@codemirror/lang-json":{"file":"@codemirror_lang-json"},"@codemirror/lang-less":{"file":"@codemirror_lang-less"},"@codemirror/lang-lezer":{"file":"@codemirror_lang-lezer"},"@codemirror/lang-liquid":{"file":"@codemirror_lang-liquid"},"@codemirror/lang-markdown":{"file":"@codemirror_lang-markdown"},"@codemirror/lang-php":{"file":"@codemirror_lang-php"},"@codemirror/lang-python":{"file":"@codemirror_lang-python"},"@codemirror/lang-rust":{"file":"@codemirror_lang-rust"},"@codemirror/lang-sass":{"file":"@codemirror_lang-sass"},"@codemirror/lang-sql":{"file":"@codemirror_lang-sql"},"@codemirror/lang-vue":{"file":"@codemirror_lang-vue"},"@codemirror/lang-wast":{"file":"@codemirror_lang-wast"},"@codemirror/lang-xml":{"file":"@codemirror_lang-xml"},"@codemirror/lang-yaml":{"file":"@codemirror_lang-yaml"},"@actualwave/codemirror-lang-sksl":{"file":"@actualwave_codemirror-lang-sksl"},"@actualwave/codemirror-lang-glsl":{"file":"@actualwave_codemirror-lang-glsl"},"@actualwave/codemirror-lang-icu-messageformat":{"file":"@actualwave_codemirror-lang-icu-messageformat"},"@actualwave/codemirror-lang-react-native":{"file":"@actualwave_codemirror-lang-react-native"},"@actualwave/codemirror-lang-embed-core":{"file":"@actualwave_codemirror-lang-embed-core"},"@actualwave/codemirror-lang-embed-sql":{"file":"@actualwave_codemirror-lang-embed-sql"},"@actualwave/codemirror-lang-embed-graphql":{"file":"@actualwave_codemirror-lang-embed-graphql"},"@actualwave/codemirror-lang-embed-css":{"file":"@actualwave_codemirror-lang-embed-css"},"@actualwave/codemirror-lang-embed-sksl":{"file":"@actualwave_codemirror-lang-embed-sksl"},"@actualwave/codemirror-lang-embed-glsl":{"file":"@actualwave_codemirror-lang-embed-glsl"},"@actualwave/codemirror-lang-embed-icu-messageformat":{"file":"@actualwave_codemirror-lang-embed-icu-messageformat"},"@actualwave/codemirror-lang-embed-tailwind":{"file":"@actualwave_codemirror-lang-embed-tailwind"},"@actualwave/codemirror-lang-embed-react-native":{"file":"@actualwave_codemirror-lang-embed-react-native"},"@codemirror/legacy-modes/mode/apl":{"file":"@codemirror_legacy-modes_mode_apl"},"@codemirror/legacy-modes/mode/asciiarmor":{"file":"@codemirror_legacy-modes_mode_asciiarmor"},"@codemirror/legacy-modes/mode/asn1":{"file":"@codemirror_legacy-modes_mode_asn1"},"@codemirror/legacy-modes/mode/asterisk":{"file":"@codemirror_legacy-modes_mode_asterisk"},"@codemirror/legacy-modes/mode/brainfuck":{"file":"@codemirror_legacy-modes_mode_brainfuck"},"@codemirror/legacy-modes/mode/clike":{"file":"@codemirror_legacy-modes_mode_clike"},"@codemirror/legacy-modes/mode/clojure":{"file":"@codemirror_legacy-modes_mode_clojure"},"@codemirror/legacy-modes/mode/cmake":{"file":"@codemirror_legacy-modes_mode_cmake"},"@codemirror/legacy-modes/mode/cobol":{"file":"@codemirror_legacy-modes_mode_cobol"},"@codemirror/legacy-modes/mode/coffeescript":{"file":"@codemirror_legacy-modes_mode_coffeescript"},"@codemirror/legacy-modes/mode/commonlisp":{"file":"@codemirror_legacy-modes_mode_commonlisp"},"@codemirror/legacy-modes/mode/crystal":{"file":"@codemirror_legacy-modes_mode_crystal"},"@codemirror/legacy-modes/mode/css":{"file":"@codemirror_legacy-modes_mode_css"},"@codemirror/legacy-modes/mode/cypher":{"file":"@codemirror_legacy-modes_mode_cypher"},"@codemirror/legacy-modes/mode/d":{"file":"@codemirror_legacy-modes_mode_d"},"@codemirror/legacy-modes/mode/diff":{"file":"@codemirror_legacy-modes_mode_diff"},"@codemirror/legacy-modes/mode/dockerfile":{"file":"@codemirror_legacy-modes_mode_dockerfile"},"@codemirror/legacy-modes/mode/dtd":{"file":"@codemirror_legacy-modes_mode_dtd"},"@codemirror/legacy-modes/mode/dylan":{"file":"@codemirror_legacy-modes_mode_dylan"},"@codemirror/legacy-modes/mode/ebnf":{"file":"@codemirror_legacy-modes_mode_ebnf"},"@codemirror/legacy-modes/mode/ecl":{"file":"@codemirror_legacy-modes_mode_ecl"},"@codemirror/legacy-modes/mode/eiffel":{"file":"@codemirror_legacy-modes_mode_eiffel"},"@codemirror/legacy-modes/mode/elm":{"file":"@codemirror_legacy-modes_mode_elm"},"@codemirror/legacy-modes/mode/erlang":{"file":"@codemirror_legacy-modes_mode_erlang"},"@codemirror/legacy-modes/mode/factor":{"file":"@codemirror_legacy-modes_mode_factor"},"@codemirror/legacy-modes/mode/fcl":{"file":"@codemirror_legacy-modes_mode_fcl"},"@codemirror/legacy-modes/mode/forth":{"file":"@codemirror_legacy-modes_mode_forth"},"@codemirror/legacy-modes/mode/fortran":{"file":"@codemirror_legacy-modes_mode_fortran"},"@codemirror/legacy-modes/mode/gas":{"file":"@codemirror_legacy-modes_mode_gas"},"@codemirror/legacy-modes/mode/gherkin":{"file":"@codemirror_legacy-modes_mode_gherkin"},"@codemirror/legacy-modes/mode/go":{"file":"@codemirror_legacy-modes_mode_go"},"@codemirror/legacy-modes/mode/groovy":{"file":"@codemirror_legacy-modes_mode_groovy"},"@codemirror/legacy-modes/mode/haskell":{"file":"@codemirror_legacy-modes_mode_haskell"},"@codemirror/legacy-modes/mode/haxe":{"file":"@codemirror_legacy-modes_mode_haxe"},"@codemirror/legacy-modes/mode/http":{"file":"@codemirror_legacy-modes_mode_http"},"@codemirror/legacy-modes/mode/idl":{"file":"@codemirror_legacy-modes_mode_idl"},"@codemirror/legacy-modes/mode/javascript":{"file":"@codemirror_legacy-modes_mode_javascript"},"@codemirror/legacy-modes/mode/jinja2":{"file":"@codemirror_legacy-modes_mode_jinja2"},"@codemirror/legacy-modes/mode/julia":{"file":"@codemirror_legacy-modes_mode_julia"},"@codemirror/legacy-modes/mode/livescript":{"file":"@codemirror_legacy-modes_mode_livescript"},"@codemirror/legacy-modes/mode/lua":{"file":"@codemirror_legacy-modes_mode_lua"},"@codemirror/legacy-modes/mode/mathematica":{"file":"@codemirror_legacy-modes_mode_mathematica"},"@codemirror/legacy-modes/mode/mbox":{"file":"@codemirror_legacy-modes_mode_mbox"},"@codemirror/legacy-modes/mode/mirc":{"file":"@codemirror_legacy-modes_mode_mirc"},"@codemirror/legacy-modes/mode/mllike":{"file":"@codemirror_legacy-modes_mode_mllike"},"@codemirror/legacy-modes/mode/modelica":{"file":"@codemirror_legacy-modes_mode_modelica"},"@codemirror/legacy-modes/mode/mscgen":{"file":"@codemirror_legacy-modes_mode_mscgen"},"@codemirror/legacy-modes/mode/mumps":{"file":"@codemirror_legacy-modes_mode_mumps"},"@codemirror/legacy-modes/mode/nginx":{"file":"@codemirror_legacy-modes_mode_nginx"},"@codemirror/legacy-modes/mode/nsis":{"file":"@codemirror_legacy-modes_mode_nsis"},"@codemirror/legacy-modes/mode/ntriples":{"file":"@codemirror_legacy-modes_mode_ntriples"},"@codemirror/legacy-modes/mode/octave":{"file":"@codemirror_legacy-modes_mode_octave"},"@codemirror/legacy-modes/mode/oz":{"file":"@codemirror_legacy-modes_mode_oz"},"@codemirror/legacy-modes/mode/pascal":{"file":"@codemirror_legacy-modes_mode_pascal"},"@codemirror/legacy-modes/mode/pegjs":{"file":"@codemirror_legacy-modes_mode_pegjs"},"@codemirror/legacy-modes/mode/perl":{"file":"@codemirror_legacy-modes_mode_perl"},"@codemirror/legacy-modes/mode/pig":{"file":"@codemirror_legacy-modes_mode_pig"},"@codemirror/legacy-modes/mode/powershell":{"file":"@codemirror_legacy-modes_mode_powershell"},"@codemirror/legacy-modes/mode/properties":{"file":"@codemirror_legacy-modes_mode_properties"},"@codemirror/legacy-modes/mode/protobuf":{"file":"@codemirror_legacy-modes_mode_protobuf"},"@codemirror/legacy-modes/mode/pug":{"file":"@codemirror_legacy-modes_mode_pug"},"@codemirror/legacy-modes/mode/puppet":{"file":"@codemirror_legacy-modes_mode_puppet"},"@codemirror/legacy-modes/mode/python":{"file":"@codemirror_legacy-modes_mode_python"},"@codemirror/legacy-modes/mode/q":{"file":"@codemirror_legacy-modes_mode_q"},"@codemirror/legacy-modes/mode/r":{"file":"@codemirror_legacy-modes_mode_r"},"@codemirror/legacy-modes/mode/rpm":{"file":"@codemirror_legacy-modes_mode_rpm"},"@codemirror/legacy-modes/mode/ruby":{"file":"@codemirror_legacy-modes_mode_ruby"},"@codemirror/legacy-modes/mode/rust":{"file":"@codemirror_legacy-modes_mode_rust"},"@codemirror/legacy-modes/mode/sas":{"file":"@codemirror_legacy-modes_mode_sas"},"@codemirror/legacy-modes/mode/sass":{"file":"@codemirror_legacy-modes_mode_sass"},"@codemirror/legacy-modes/mode/scheme":{"file":"@codemirror_legacy-modes_mode_scheme"},"@codemirror/legacy-modes/mode/shell":{"file":"@codemirror_legacy-modes_mode_shell"},"@codemirror/legacy-modes/mode/sieve":{"file":"@codemirror_legacy-modes_mode_sieve"},"@codemirror/legacy-modes/mode/simple-mode":{"file":"@codemirror_legacy-modes_mode_simple-mode"},"@codemirror/legacy-modes/mode/smalltalk":{"file":"@codemirror_legacy-modes_mode_smalltalk"},"@codemirror/legacy-modes/mode/solr":{"file":"@codemirror_legacy-modes_mode_solr"},"@codemirror/legacy-modes/mode/sparql":{"file":"@codemirror_legacy-modes_mode_sparql"},"@codemirror/legacy-modes/mode/spreadsheet":{"file":"@codemirror_legacy-modes_mode_spreadsheet"},"@codemirror/legacy-modes/mode/sql":{"file":"@codemirror_legacy-modes_mode_sql"},"@codemirror/legacy-modes/mode/stex":{"file":"@codemirror_legacy-modes_mode_stex"},"@codemirror/legacy-modes/mode/stylus":{"file":"@codemirror_legacy-modes_mode_stylus"},"@codemirror/legacy-modes/mode/swift":{"file":"@codemirror_legacy-modes_mode_swift"},"@codemirror/legacy-modes/mode/tcl":{"file":"@codemirror_legacy-modes_mode_tcl"},"@codemirror/legacy-modes/mode/textile":{"file":"@codemirror_legacy-modes_mode_textile"},"@codemirror/legacy-modes/mode/tiddlywiki":{"file":"@codemirror_legacy-modes_mode_tiddlywiki"},"@codemirror/legacy-modes/mode/tiki":{"file":"@codemirror_legacy-modes_mode_tiki"},"@codemirror/legacy-modes/mode/toml":{"file":"@codemirror_legacy-modes_mode_toml"},"@codemirror/legacy-modes/mode/troff":{"file":"@codemirror_legacy-modes_mode_troff"},"@codemirror/legacy-modes/mode/ttcn-cfg":{"file":"@codemirror_legacy-modes_mode_ttcn-cfg"},"@codemirror/legacy-modes/mode/ttcn":{"file":"@codemirror_legacy-modes_mode_ttcn"},"@codemirror/legacy-modes/mode/turtle":{"file":"@codemirror_legacy-modes_mode_turtle"},"@codemirror/legacy-modes/mode/vb":{"file":"@codemirror_legacy-modes_mode_vb"},"@codemirror/legacy-modes/mode/vbscript":{"file":"@codemirror_legacy-modes_mode_vbscript"},"@codemirror/legacy-modes/mode/velocity":{"file":"@codemirror_legacy-modes_mode_velocity"},"@codemirror/legacy-modes/mode/verilog":{"file":"@codemirror_legacy-modes_mode_verilog"},"@codemirror/legacy-modes/mode/vhdl":{"file":"@codemirror_legacy-modes_mode_vhdl"},"@codemirror/legacy-modes/mode/wast":{"file":"@codemirror_legacy-modes_mode_wast"},"@codemirror/legacy-modes/mode/webidl":{"file":"@codemirror_legacy-modes_mode_webidl"},"@codemirror/legacy-modes/mode/xml":{"file":"@codemirror_legacy-modes_mode_xml"},"@codemirror/legacy-modes/mode/xquery":{"file":"@codemirror_legacy-modes_mode_xquery"},"@codemirror/legacy-modes/mode/yacas":{"file":"@codemirror_legacy-modes_mode_yacas"},"@codemirror/legacy-modes/mode/yaml":{"file":"@codemirror_legacy-modes_mode_yaml"},"@codemirror/legacy-modes/mode/z80":{"file":"@codemirror_legacy-modes_mode_z80"},"@babel/runtime/helpers/interopRequireDefault":{"file":"@babel_runtime_helpers_interopRequireDefault"},"@babel/runtime/helpers/objectSpread2":{"file":"@babel_runtime_helpers_objectSpread2"},"@babel/runtime/helpers/toConsumableArray":{"file":"@babel_runtime_helpers_toConsumableArray"}};
8
+ const modules = {"crelt":{"file":"crelt","core":true,"bundle":"_core"},"style-mod":{"file":"style-mod","core":true,"bundle":"_core"},"w3c-keyname":{"file":"w3c-keyname","core":true,"bundle":"_core"},"@marijn/find-cluster-break":{"file":"@marijn_find-cluster-break","core":true,"bundle":"_core"},"@lezer/common":{"file":"@lezer_common","core":true,"bundle":"_core"},"@lezer/highlight":{"file":"@lezer_highlight","core":true,"bundle":"_core"},"@lezer/lr":{"file":"@lezer_lr","core":true,"bundle":"_core"},"@codemirror/state":{"file":"@codemirror_state","core":true,"bundle":"_core"},"@codemirror/view":{"file":"@codemirror_view","core":true,"bundle":"_core"},"@codemirror/language":{"file":"@codemirror_language","core":true,"bundle":"_core"},"@codemirror/commands":{"file":"@codemirror_commands","core":true,"bundle":"_core"},"@codemirror/autocomplete":{"file":"@codemirror_autocomplete","core":true,"bundle":"_core"},"@codemirror/search":{"file":"@codemirror_search","core":true,"bundle":"_core"},"@codemirror/lint":{"file":"@codemirror_lint","core":true,"bundle":"_core"},"codemirror":{"file":"codemirror"},"@codemirror/collab":{"file":"@codemirror_collab"},"@codemirror/language-data":{"file":"@codemirror_language-data"},"@codemirror/merge":{"file":"@codemirror_merge"},"@codemirror/theme-one-dark":{"file":"@codemirror_theme-one-dark"},"@uiw/codemirror-themes":{"file":"@uiw_codemirror-themes"},"@uiw/codemirror-theme-androidstudio":{"file":"@uiw_codemirror-theme-androidstudio"},"@uiw/codemirror-theme-andromeda":{"file":"@uiw_codemirror-theme-andromeda"},"@uiw/codemirror-theme-atomone":{"file":"@uiw_codemirror-theme-atomone"},"@uiw/codemirror-theme-aura":{"file":"@uiw_codemirror-theme-aura"},"@uiw/codemirror-theme-basic":{"file":"@uiw_codemirror-theme-basic"},"@uiw/codemirror-theme-bbedit":{"file":"@uiw_codemirror-theme-bbedit"},"@uiw/codemirror-theme-copilot":{"file":"@uiw_codemirror-theme-copilot"},"@uiw/codemirror-theme-darcula":{"file":"@uiw_codemirror-theme-darcula"},"@uiw/codemirror-theme-dracula":{"file":"@uiw_codemirror-theme-dracula"},"@uiw/codemirror-theme-duotone":{"file":"@uiw_codemirror-theme-duotone"},"@uiw/codemirror-theme-eclipse":{"file":"@uiw_codemirror-theme-eclipse"},"@uiw/codemirror-theme-github":{"file":"@uiw_codemirror-theme-github"},"@uiw/codemirror-theme-material":{"file":"@uiw_codemirror-theme-material"},"@uiw/codemirror-theme-monokai":{"file":"@uiw_codemirror-theme-monokai"},"@uiw/codemirror-theme-nord":{"file":"@uiw_codemirror-theme-nord"},"@uiw/codemirror-theme-okaidia":{"file":"@uiw_codemirror-theme-okaidia"},"@uiw/codemirror-theme-solarized":{"file":"@uiw_codemirror-theme-solarized"},"@uiw/codemirror-theme-sublime":{"file":"@uiw_codemirror-theme-sublime"},"@uiw/codemirror-theme-tokyo-night":{"file":"@uiw_codemirror-theme-tokyo-night"},"@uiw/codemirror-theme-vscode":{"file":"@uiw_codemirror-theme-vscode"},"@uiw/codemirror-theme-xcode":{"file":"@uiw_codemirror-theme-xcode"},"@lezer/css":{"file":"@lezer_css"},"@lezer/go":{"file":"@lezer_go"},"@lezer/html":{"file":"@lezer_html"},"@lezer/java":{"file":"@lezer_java"},"@lezer/javascript":{"file":"@lezer_javascript"},"@lezer/json":{"file":"@lezer_json"},"@lezer/cpp":{"file":"@lezer_cpp"},"@lezer/lezer":{"file":"@lezer_lezer"},"@lezer/markdown":{"file":"@lezer_markdown"},"@lezer/php":{"file":"@lezer_php"},"@lezer/python":{"file":"@lezer_python"},"@lezer/rust":{"file":"@lezer_rust"},"@lezer/sass":{"file":"@lezer_sass"},"@lezer/xml":{"file":"@lezer_xml"},"@lezer/yaml":{"file":"@lezer_yaml"},"@codemirror/lang-angular":{"file":"@codemirror_lang-angular"},"@codemirror/lang-cpp":{"file":"@codemirror_lang-cpp"},"@codemirror/lang-css":{"file":"@codemirror_lang-css"},"@codemirror/lang-go":{"file":"@codemirror_lang-go"},"@codemirror/lang-html":{"file":"@codemirror_lang-html"},"@codemirror/lang-java":{"file":"@codemirror_lang-java"},"@codemirror/lang-javascript":{"file":"@codemirror_lang-javascript"},"@codemirror/lang-jinja":{"file":"@codemirror_lang-jinja"},"@codemirror/lang-json":{"file":"@codemirror_lang-json"},"@codemirror/lang-less":{"file":"@codemirror_lang-less"},"@codemirror/lang-lezer":{"file":"@codemirror_lang-lezer"},"@codemirror/lang-liquid":{"file":"@codemirror_lang-liquid"},"@codemirror/lang-markdown":{"file":"@codemirror_lang-markdown"},"@codemirror/lang-php":{"file":"@codemirror_lang-php"},"@codemirror/lang-python":{"file":"@codemirror_lang-python"},"@codemirror/lang-rust":{"file":"@codemirror_lang-rust"},"@codemirror/lang-sass":{"file":"@codemirror_lang-sass"},"@codemirror/lang-sql":{"file":"@codemirror_lang-sql"},"@codemirror/lang-vue":{"file":"@codemirror_lang-vue"},"@codemirror/lang-wast":{"file":"@codemirror_lang-wast"},"@codemirror/lang-xml":{"file":"@codemirror_lang-xml"},"@codemirror/lang-yaml":{"file":"@codemirror_lang-yaml"},"@actualwave/codemirror-lang-sksl":{"file":"@actualwave_codemirror-lang-sksl"},"@actualwave/codemirror-lang-glsl":{"file":"@actualwave_codemirror-lang-glsl"},"@actualwave/codemirror-lang-icu-messageformat":{"file":"@actualwave_codemirror-lang-icu-messageformat"},"@actualwave/codemirror-lang-react-native":{"file":"@actualwave_codemirror-lang-react-native"},"@actualwave/codemirror-lang-embed-core":{"file":"@actualwave_codemirror-lang-embed-core"},"@actualwave/codemirror-lang-embed-sql":{"file":"@actualwave_codemirror-lang-embed-sql"},"@actualwave/codemirror-lang-embed-graphql":{"file":"@actualwave_codemirror-lang-embed-graphql"},"@actualwave/codemirror-lang-embed-css":{"file":"@actualwave_codemirror-lang-embed-css"},"@actualwave/codemirror-lang-embed-sksl":{"file":"@actualwave_codemirror-lang-embed-sksl"},"@actualwave/codemirror-lang-embed-glsl":{"file":"@actualwave_codemirror-lang-embed-glsl"},"@actualwave/codemirror-lang-embed-icu-messageformat":{"file":"@actualwave_codemirror-lang-embed-icu-messageformat"},"@actualwave/codemirror-lang-embed-tailwind":{"file":"@actualwave_codemirror-lang-embed-tailwind"},"@actualwave/codemirror-lang-embed-react-native":{"file":"@actualwave_codemirror-lang-embed-react-native"},"@actualwave/codemirror-lang-js-completion":{"file":"@actualwave_codemirror-lang-js-completion"},"@codemirror/legacy-modes/mode/apl":{"file":"@codemirror_legacy-modes_mode_apl"},"@codemirror/legacy-modes/mode/asciiarmor":{"file":"@codemirror_legacy-modes_mode_asciiarmor"},"@codemirror/legacy-modes/mode/asn1":{"file":"@codemirror_legacy-modes_mode_asn1"},"@codemirror/legacy-modes/mode/asterisk":{"file":"@codemirror_legacy-modes_mode_asterisk"},"@codemirror/legacy-modes/mode/brainfuck":{"file":"@codemirror_legacy-modes_mode_brainfuck"},"@codemirror/legacy-modes/mode/clike":{"file":"@codemirror_legacy-modes_mode_clike"},"@codemirror/legacy-modes/mode/clojure":{"file":"@codemirror_legacy-modes_mode_clojure"},"@codemirror/legacy-modes/mode/cmake":{"file":"@codemirror_legacy-modes_mode_cmake"},"@codemirror/legacy-modes/mode/cobol":{"file":"@codemirror_legacy-modes_mode_cobol"},"@codemirror/legacy-modes/mode/coffeescript":{"file":"@codemirror_legacy-modes_mode_coffeescript"},"@codemirror/legacy-modes/mode/commonlisp":{"file":"@codemirror_legacy-modes_mode_commonlisp"},"@codemirror/legacy-modes/mode/crystal":{"file":"@codemirror_legacy-modes_mode_crystal"},"@codemirror/legacy-modes/mode/css":{"file":"@codemirror_legacy-modes_mode_css"},"@codemirror/legacy-modes/mode/cypher":{"file":"@codemirror_legacy-modes_mode_cypher"},"@codemirror/legacy-modes/mode/d":{"file":"@codemirror_legacy-modes_mode_d"},"@codemirror/legacy-modes/mode/diff":{"file":"@codemirror_legacy-modes_mode_diff"},"@codemirror/legacy-modes/mode/dockerfile":{"file":"@codemirror_legacy-modes_mode_dockerfile"},"@codemirror/legacy-modes/mode/dtd":{"file":"@codemirror_legacy-modes_mode_dtd"},"@codemirror/legacy-modes/mode/dylan":{"file":"@codemirror_legacy-modes_mode_dylan"},"@codemirror/legacy-modes/mode/ebnf":{"file":"@codemirror_legacy-modes_mode_ebnf"},"@codemirror/legacy-modes/mode/ecl":{"file":"@codemirror_legacy-modes_mode_ecl"},"@codemirror/legacy-modes/mode/eiffel":{"file":"@codemirror_legacy-modes_mode_eiffel"},"@codemirror/legacy-modes/mode/elm":{"file":"@codemirror_legacy-modes_mode_elm"},"@codemirror/legacy-modes/mode/erlang":{"file":"@codemirror_legacy-modes_mode_erlang"},"@codemirror/legacy-modes/mode/factor":{"file":"@codemirror_legacy-modes_mode_factor"},"@codemirror/legacy-modes/mode/fcl":{"file":"@codemirror_legacy-modes_mode_fcl"},"@codemirror/legacy-modes/mode/forth":{"file":"@codemirror_legacy-modes_mode_forth"},"@codemirror/legacy-modes/mode/fortran":{"file":"@codemirror_legacy-modes_mode_fortran"},"@codemirror/legacy-modes/mode/gas":{"file":"@codemirror_legacy-modes_mode_gas"},"@codemirror/legacy-modes/mode/gherkin":{"file":"@codemirror_legacy-modes_mode_gherkin"},"@codemirror/legacy-modes/mode/go":{"file":"@codemirror_legacy-modes_mode_go"},"@codemirror/legacy-modes/mode/groovy":{"file":"@codemirror_legacy-modes_mode_groovy"},"@codemirror/legacy-modes/mode/haskell":{"file":"@codemirror_legacy-modes_mode_haskell"},"@codemirror/legacy-modes/mode/haxe":{"file":"@codemirror_legacy-modes_mode_haxe"},"@codemirror/legacy-modes/mode/http":{"file":"@codemirror_legacy-modes_mode_http"},"@codemirror/legacy-modes/mode/idl":{"file":"@codemirror_legacy-modes_mode_idl"},"@codemirror/legacy-modes/mode/javascript":{"file":"@codemirror_legacy-modes_mode_javascript"},"@codemirror/legacy-modes/mode/jinja2":{"file":"@codemirror_legacy-modes_mode_jinja2"},"@codemirror/legacy-modes/mode/julia":{"file":"@codemirror_legacy-modes_mode_julia"},"@codemirror/legacy-modes/mode/livescript":{"file":"@codemirror_legacy-modes_mode_livescript"},"@codemirror/legacy-modes/mode/lua":{"file":"@codemirror_legacy-modes_mode_lua"},"@codemirror/legacy-modes/mode/mathematica":{"file":"@codemirror_legacy-modes_mode_mathematica"},"@codemirror/legacy-modes/mode/mbox":{"file":"@codemirror_legacy-modes_mode_mbox"},"@codemirror/legacy-modes/mode/mirc":{"file":"@codemirror_legacy-modes_mode_mirc"},"@codemirror/legacy-modes/mode/mllike":{"file":"@codemirror_legacy-modes_mode_mllike"},"@codemirror/legacy-modes/mode/modelica":{"file":"@codemirror_legacy-modes_mode_modelica"},"@codemirror/legacy-modes/mode/mscgen":{"file":"@codemirror_legacy-modes_mode_mscgen"},"@codemirror/legacy-modes/mode/mumps":{"file":"@codemirror_legacy-modes_mode_mumps"},"@codemirror/legacy-modes/mode/nginx":{"file":"@codemirror_legacy-modes_mode_nginx"},"@codemirror/legacy-modes/mode/nsis":{"file":"@codemirror_legacy-modes_mode_nsis"},"@codemirror/legacy-modes/mode/ntriples":{"file":"@codemirror_legacy-modes_mode_ntriples"},"@codemirror/legacy-modes/mode/octave":{"file":"@codemirror_legacy-modes_mode_octave"},"@codemirror/legacy-modes/mode/oz":{"file":"@codemirror_legacy-modes_mode_oz"},"@codemirror/legacy-modes/mode/pascal":{"file":"@codemirror_legacy-modes_mode_pascal"},"@codemirror/legacy-modes/mode/pegjs":{"file":"@codemirror_legacy-modes_mode_pegjs"},"@codemirror/legacy-modes/mode/perl":{"file":"@codemirror_legacy-modes_mode_perl"},"@codemirror/legacy-modes/mode/pig":{"file":"@codemirror_legacy-modes_mode_pig"},"@codemirror/legacy-modes/mode/powershell":{"file":"@codemirror_legacy-modes_mode_powershell"},"@codemirror/legacy-modes/mode/properties":{"file":"@codemirror_legacy-modes_mode_properties"},"@codemirror/legacy-modes/mode/protobuf":{"file":"@codemirror_legacy-modes_mode_protobuf"},"@codemirror/legacy-modes/mode/pug":{"file":"@codemirror_legacy-modes_mode_pug"},"@codemirror/legacy-modes/mode/puppet":{"file":"@codemirror_legacy-modes_mode_puppet"},"@codemirror/legacy-modes/mode/python":{"file":"@codemirror_legacy-modes_mode_python"},"@codemirror/legacy-modes/mode/q":{"file":"@codemirror_legacy-modes_mode_q"},"@codemirror/legacy-modes/mode/r":{"file":"@codemirror_legacy-modes_mode_r"},"@codemirror/legacy-modes/mode/rpm":{"file":"@codemirror_legacy-modes_mode_rpm"},"@codemirror/legacy-modes/mode/ruby":{"file":"@codemirror_legacy-modes_mode_ruby"},"@codemirror/legacy-modes/mode/rust":{"file":"@codemirror_legacy-modes_mode_rust"},"@codemirror/legacy-modes/mode/sas":{"file":"@codemirror_legacy-modes_mode_sas"},"@codemirror/legacy-modes/mode/sass":{"file":"@codemirror_legacy-modes_mode_sass"},"@codemirror/legacy-modes/mode/scheme":{"file":"@codemirror_legacy-modes_mode_scheme"},"@codemirror/legacy-modes/mode/shell":{"file":"@codemirror_legacy-modes_mode_shell"},"@codemirror/legacy-modes/mode/sieve":{"file":"@codemirror_legacy-modes_mode_sieve"},"@codemirror/legacy-modes/mode/simple-mode":{"file":"@codemirror_legacy-modes_mode_simple-mode"},"@codemirror/legacy-modes/mode/smalltalk":{"file":"@codemirror_legacy-modes_mode_smalltalk"},"@codemirror/legacy-modes/mode/solr":{"file":"@codemirror_legacy-modes_mode_solr"},"@codemirror/legacy-modes/mode/sparql":{"file":"@codemirror_legacy-modes_mode_sparql"},"@codemirror/legacy-modes/mode/spreadsheet":{"file":"@codemirror_legacy-modes_mode_spreadsheet"},"@codemirror/legacy-modes/mode/sql":{"file":"@codemirror_legacy-modes_mode_sql"},"@codemirror/legacy-modes/mode/stex":{"file":"@codemirror_legacy-modes_mode_stex"},"@codemirror/legacy-modes/mode/stylus":{"file":"@codemirror_legacy-modes_mode_stylus"},"@codemirror/legacy-modes/mode/swift":{"file":"@codemirror_legacy-modes_mode_swift"},"@codemirror/legacy-modes/mode/tcl":{"file":"@codemirror_legacy-modes_mode_tcl"},"@codemirror/legacy-modes/mode/textile":{"file":"@codemirror_legacy-modes_mode_textile"},"@codemirror/legacy-modes/mode/tiddlywiki":{"file":"@codemirror_legacy-modes_mode_tiddlywiki"},"@codemirror/legacy-modes/mode/tiki":{"file":"@codemirror_legacy-modes_mode_tiki"},"@codemirror/legacy-modes/mode/toml":{"file":"@codemirror_legacy-modes_mode_toml"},"@codemirror/legacy-modes/mode/troff":{"file":"@codemirror_legacy-modes_mode_troff"},"@codemirror/legacy-modes/mode/ttcn-cfg":{"file":"@codemirror_legacy-modes_mode_ttcn-cfg"},"@codemirror/legacy-modes/mode/ttcn":{"file":"@codemirror_legacy-modes_mode_ttcn"},"@codemirror/legacy-modes/mode/turtle":{"file":"@codemirror_legacy-modes_mode_turtle"},"@codemirror/legacy-modes/mode/vb":{"file":"@codemirror_legacy-modes_mode_vb"},"@codemirror/legacy-modes/mode/vbscript":{"file":"@codemirror_legacy-modes_mode_vbscript"},"@codemirror/legacy-modes/mode/velocity":{"file":"@codemirror_legacy-modes_mode_velocity"},"@codemirror/legacy-modes/mode/verilog":{"file":"@codemirror_legacy-modes_mode_verilog"},"@codemirror/legacy-modes/mode/vhdl":{"file":"@codemirror_legacy-modes_mode_vhdl"},"@codemirror/legacy-modes/mode/wast":{"file":"@codemirror_legacy-modes_mode_wast"},"@codemirror/legacy-modes/mode/webidl":{"file":"@codemirror_legacy-modes_mode_webidl"},"@codemirror/legacy-modes/mode/xml":{"file":"@codemirror_legacy-modes_mode_xml"},"@codemirror/legacy-modes/mode/xquery":{"file":"@codemirror_legacy-modes_mode_xquery"},"@codemirror/legacy-modes/mode/yacas":{"file":"@codemirror_legacy-modes_mode_yacas"},"@codemirror/legacy-modes/mode/yaml":{"file":"@codemirror_legacy-modes_mode_yaml"},"@codemirror/legacy-modes/mode/z80":{"file":"@codemirror_legacy-modes_mode_z80"},"@babel/runtime/helpers/interopRequireDefault":{"file":"@babel_runtime_helpers_interopRequireDefault"},"@babel/runtime/helpers/objectSpread2":{"file":"@babel_runtime_helpers_objectSpread2"},"@babel/runtime/helpers/toConsumableArray":{"file":"@babel_runtime_helpers_toConsumableArray"}};
9
9
 
10
10
  // Base URL prepended to every module file fetch. Override via configure() before first load.
11
11
  let _baseUrl = './codemirror/';
@@ -183,10 +183,20 @@
183
183
  } = await requireAsyncModule('@codemirror/autocomplete');
184
184
  const { keymap } = await requireAsyncModule('@codemirror/view');
185
185
 
186
+ const { EditorState } = await requireAsyncModule('@codemirror/state');
187
+ const { language: languageFacet } = await requireAsyncModule('@codemirror/language');
188
+
186
189
  let _customCompletions = [];
187
190
 
191
+ // Static list set via setCompletions(). Registered as language data (not as
192
+ // autocompletion({ override })) so it is merged with the language's own sources —
193
+ // including nested-language ones (tagged-template embeds, Tailwind, React Native).
194
+ // An `override` would replace every one of those and make embedded DSLs unsuggestable.
188
195
  const _customCompletionSource = (context) => {
189
196
  if (!_customCompletions.length) return null;
197
+ // Inside an embedded language (sql`...`, sksl`...`) the static JS list is noise.
198
+ const lang = context.state.facet(languageFacet);
199
+ if (lang && !lang.isActiveAt(context.state, context.pos, -1)) return null;
190
200
  const word = context.matchBefore(/\w+/);
191
201
  if (!word || (word.from === word.to && !context.explicit)) return null;
192
202
  return { from: word.from, options: _customCompletions, validFor: /^\w*$/ };
@@ -195,7 +205,8 @@
195
205
  editor.view.dispatch({
196
206
  effects: StateEffect.appendConfig.of([
197
207
  closeBrackets(),
198
- autocompletion({ override: [_customCompletionSource], activateOnTyping: true }),
208
+ autocompletion({ activateOnTyping: true }),
209
+ EditorState.languageData.of(() => [{ autocomplete: _customCompletionSource }]),
199
210
  keymap.of([...closeBracketsKeymap, ...completionKeymap]),
200
211
  ]),
201
212
  });
@@ -217,6 +228,40 @@
217
228
  // setExtensions, loadExtension, destroy — then add methods not in EditorController.
218
229
  const { getValue, setValue, setLanguage, setExtensions, loadExtension, destroy } = editor;
219
230
 
231
+ // Rebuilds the editor state around `doc` with an empty undo history (an unrecorded transaction
232
+ // only hides a change from the history — earlier entries stay and get mapped over it, so Undo
233
+ // would still walk back into the previous document). The live extension set is kept: the new
234
+ // state is built from the current config and the compartments' contents are re-applied.
235
+ const _replaceStateFresh = (doc, selection) => {
236
+ const view = editor.view;
237
+ const old = view.state;
238
+ view.setState(EditorState.create({ doc, selection, extensions: old.config.base }));
239
+ const effects = [];
240
+ old.config.compartments.forEach((ext, comp) => effects.push(comp.reconfigure(ext)));
241
+ if (effects.length) view.dispatch({ effects });
242
+ const state = view.state;
243
+ _rnPost('__contentChange__', {
244
+ value: state.doc.toString(),
245
+ undo: undoDepth(state),
246
+ redo: redoDepth(state),
247
+ });
248
+ };
249
+
250
+ // Dry-runs every undo and redo step on a throw-away copy of `state`. A history that does not
251
+ // match its document makes CodeMirror throw "Applying change set to a document with the wrong
252
+ // length" on the user's first Undo; catching that here keeps it from ever reaching the user.
253
+ const _historyConsistent = (state) => {
254
+ try {
255
+ let s = state;
256
+ const step = (tr) => { s = tr.state; };
257
+ for (let i = 0; i < 1000 && undo({ state: s, dispatch: step }); i++);
258
+ for (let i = 0; i < 1000 && redo({ state: s, dispatch: step }); i++);
259
+ return s.doc.eq(state.doc);
260
+ } catch (e) {
261
+ return false;
262
+ }
263
+ };
264
+
220
265
  Object.assign(editorTarget, {
221
266
  getValue,
222
267
  setValue: (value) => {
@@ -234,6 +279,51 @@
234
279
  loadExtension,
235
280
  destroy,
236
281
 
282
+ // Serializable snapshot of the whole editor state: document, selection, undo/redo
283
+ // history and scroll offset. Pair with restoreState() to move a document in and out
284
+ // of this editor without losing its history.
285
+ saveState: async () => {
286
+ const { historyField } = await requireAsyncModule('@codemirror/commands');
287
+ return {
288
+ state: editor.view.state.toJSON({ history: historyField }),
289
+ scrollTop: editor.view.scrollDOM.scrollTop,
290
+ scrollLeft: editor.view.scrollDOM.scrollLeft,
291
+ };
292
+ },
293
+
294
+ // Replaces the editor's state with a snapshot from saveState(). The live extension set
295
+ // (language, theme, shortcuts, completions...) is kept: the new state is built from the
296
+ // current config and the compartments' current contents are re-applied. Set the desired
297
+ // language/theme BEFORE calling this. Notifies the host like a regular content change.
298
+ restoreState: async (snapshot) => {
299
+ const { historyField } = await requireAsyncModule('@codemirror/commands');
300
+ const old = editor.view.state;
301
+ const next = EditorState.fromJSON(
302
+ snapshot.state,
303
+ { extensions: old.config.base },
304
+ { history: historyField }
305
+ );
306
+ if (!_historyConsistent(next)) {
307
+ console.warn('restoreState: snapshot history does not match its document, restoring text only');
308
+ _replaceStateFresh(next.doc, next.selection);
309
+ editor.view.scrollDOM.scrollTop = snapshot.scrollTop ?? 0;
310
+ editor.view.scrollDOM.scrollLeft = snapshot.scrollLeft ?? 0;
311
+ return;
312
+ }
313
+ editor.view.setState(next);
314
+ const effects = [];
315
+ old.config.compartments.forEach((ext, comp) => effects.push(comp.reconfigure(ext)));
316
+ if (effects.length) editor.view.dispatch({ effects });
317
+ editor.view.scrollDOM.scrollTop = snapshot.scrollTop ?? 0;
318
+ editor.view.scrollDOM.scrollLeft = snapshot.scrollLeft ?? 0;
319
+ const state = editor.view.state;
320
+ _rnPost('__contentChange__', {
321
+ value: state.doc.toString(),
322
+ undo: undoDepth(state),
323
+ redo: redoDepth(state),
324
+ });
325
+ },
326
+
237
327
  // Maps a language name to a package that doesn't follow the
238
328
  // @codemirror/lang-{name} convention. Takes effect on the next setLanguage().
239
329
  registerLanguage: (name, packageName) => registerLanguage(name, packageName),
@@ -247,13 +337,8 @@
247
337
  registerSupportExtension: (packageName, supportConfig) =>
248
338
  registerSupportExtension(packageName, supportConfig),
249
339
 
250
- resetValue: (value) => {
251
- const view = editor.view;
252
- view.dispatch({
253
- changes: { from: 0, to: view.state.doc.length, insert: value ?? '' },
254
- annotations: Transaction.addToHistory.of(false),
255
- });
256
- },
340
+ // Replaces the document AND empties the undo history.
341
+ resetValue: (value) => _replaceStateFresh(value ?? ''),
257
342
 
258
343
  setTheme: (themeName) => _applyTheme(themeName),
259
344
 
@@ -347,11 +432,10 @@
347
432
 
348
433
  historyRedo: () => redo(editor.view),
349
434
 
435
+ // Empties the undo/redo history, keeping the document and selection.
350
436
  historyClear: () => {
351
- // clearHistory StateEffect was removed from @codemirror/commands 6.7+.
352
- // Dispatch a no-doc-change transaction marked as not-in-history so
353
- // callers don't crash, though the undo stack is not actually emptied.
354
- editor.view.dispatch({ annotations: Transaction.addToHistory.of(false) });
437
+ const { doc, selection } = editor.view.state;
438
+ _replaceStateFresh(doc, selection);
355
439
  },
356
440
 
357
441
  startCompletion: () => startCompletion(editor.view),