@coldsmirk/inkstone-codemirror 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +21 -21
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -65,32 +65,32 @@ type EditorContext = {
|
|
|
65
65
|
* editor that installs {@link minijinjaContextField} in its static extensions (as
|
|
66
66
|
* `@coldsmirk/inkstone-react`'s components do) accepts this effect before the grammar resolves.
|
|
67
67
|
*/
|
|
68
|
-
declare const setMinijinjaContext: import("@codemirror/state").StateEffectType<IrSchema | null>;
|
|
68
|
+
export declare const setMinijinjaContext: import("@codemirror/state").StateEffectType<IrSchema | null>;
|
|
69
69
|
/**
|
|
70
70
|
* Holds the normalized render-context schema that variable / member completion reads. Seed it with
|
|
71
71
|
* `minijinja({ context })`, or drive it at runtime with {@link setMinijinjaContext}. `null` (the
|
|
72
72
|
* default) means no context — variable completion stays off and only tags / filters / tests /
|
|
73
73
|
* globals are offered.
|
|
74
74
|
*/
|
|
75
|
-
declare const minijinjaContextField: StateField<IrSchema | null>;
|
|
75
|
+
export declare const minijinjaContextField: StateField<IrSchema | null>;
|
|
76
76
|
/**
|
|
77
77
|
* Normalize either input form to the internal {@link IrSchema}.
|
|
78
78
|
*/
|
|
79
|
-
declare function normalizeContext(input: EditorContext): IrSchema;
|
|
79
|
+
export declare function normalizeContext(input: EditorContext): IrSchema;
|
|
80
80
|
/**
|
|
81
81
|
* Members reachable at `path` — `[]` yields the top-level context variables (plus any `scope`
|
|
82
82
|
* bindings), a non-empty path walks member access (`["user", "address"]` → the fields of
|
|
83
83
|
* `user.address`). The first segment may resolve against a `scope` binding (a `{% for %}` target,
|
|
84
84
|
* macro parameter, …) before falling back to the root.
|
|
85
85
|
*/
|
|
86
|
-
declare function resolveMembers(ir: IrSchema, path: readonly string[], scope?: ReadonlyMap<string, IrType>): Member[];
|
|
86
|
+
export declare function resolveMembers(ir: IrSchema, path: readonly string[], scope?: ReadonlyMap<string, IrType>): Member[];
|
|
87
87
|
/**
|
|
88
88
|
* The type at a declared property path, or null if the path leaves the walkable shape. As in
|
|
89
89
|
* {@link resolveMembers}, the first segment may resolve against a `scope` binding before falling
|
|
90
90
|
* back to the root — so a nested `{% for child in parent.children %}` can walk the `parent` its
|
|
91
91
|
* enclosing loop bound.
|
|
92
92
|
*/
|
|
93
|
-
declare function typeAtPath(ir: IrSchema, path: readonly string[], scope?: ReadonlyMap<string, IrType>): IrType | null;
|
|
93
|
+
export declare function typeAtPath(ir: IrSchema, path: readonly string[], scope?: ReadonlyMap<string, IrType>): IrType | null;
|
|
94
94
|
//#endregion
|
|
95
95
|
//#region src/controlled-host.d.ts
|
|
96
96
|
interface ControlledEditorOptions {
|
|
@@ -136,7 +136,7 @@ interface ControlledEditorOptions {
|
|
|
136
136
|
* `sqlSchemaField` in its static `extensions` (they accept a dispatch before the lazy grammar
|
|
137
137
|
* that reads them resolves).
|
|
138
138
|
*/
|
|
139
|
-
declare class ControlledEditorHost {
|
|
139
|
+
export declare class ControlledEditorHost {
|
|
140
140
|
private readonly compartment;
|
|
141
141
|
private silent;
|
|
142
142
|
readonly view: EditorView;
|
|
@@ -202,7 +202,7 @@ interface DocumentExtensionsOptions {
|
|
|
202
202
|
* completion UI, and the merged default keymap. This is the assembly every hand-built
|
|
203
203
|
* CodeMirror host repeats; language support and theming stay with the caller.
|
|
204
204
|
*/
|
|
205
|
-
declare function documentExtensions({ placeholder, lineWrapping, showLineNumbers, folding, spellcheck, search }?: DocumentExtensionsOptions): Extension[];
|
|
205
|
+
export declare function documentExtensions({ placeholder, lineWrapping, showLineNumbers, folding, spellcheck, search }?: DocumentExtensionsOptions): Extension[];
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/languages.d.ts
|
|
208
208
|
/**
|
|
@@ -533,13 +533,13 @@ type CodeMirrorLanguage = keyof typeof loaders;
|
|
|
533
533
|
/**
|
|
534
534
|
* Every supported language id, sorted.
|
|
535
535
|
*/
|
|
536
|
-
declare const codeMirrorLanguages: readonly CodeMirrorLanguage[];
|
|
536
|
+
export declare const codeMirrorLanguages: readonly CodeMirrorLanguage[];
|
|
537
537
|
/**
|
|
538
538
|
* Lazily resolve a supported language id to a CodeMirror language {@link Extension}. Each
|
|
539
539
|
* language is a separate dynamic import, so the consumer's bundler code-splits it and only
|
|
540
540
|
* the requested grammar is fetched — the whole catalog is never loaded at once.
|
|
541
541
|
*/
|
|
542
|
-
declare function loadLanguage(language: CodeMirrorLanguage): Promise<Extension>;
|
|
542
|
+
export declare function loadLanguage(language: CodeMirrorLanguage): Promise<Extension>;
|
|
543
543
|
//#endregion
|
|
544
544
|
//#region src/locale.d.ts
|
|
545
545
|
/**
|
|
@@ -547,7 +547,7 @@ declare function loadLanguage(language: CodeMirrorLanguage): Promise<Extension>;
|
|
|
547
547
|
* inkstone's defaults are English, so pass this through `extensions` to localize the panel
|
|
548
548
|
* (`search` must be on for the panel to exist at all).
|
|
549
549
|
*/
|
|
550
|
-
declare const searchPhrasesZhCn: Extension;
|
|
550
|
+
export declare const searchPhrasesZhCn: Extension;
|
|
551
551
|
//#endregion
|
|
552
552
|
//#region src/merge-chrome.d.ts
|
|
553
553
|
/**
|
|
@@ -559,14 +559,14 @@ declare const searchPhrasesZhCn: Extension;
|
|
|
559
559
|
* package's baseTheme by CodeMirror's theme-over-base contract, and a caller theme layered
|
|
560
560
|
* after it still overrides it.
|
|
561
561
|
*/
|
|
562
|
-
declare function mergeTheme(dark: boolean): Extension;
|
|
562
|
+
export declare function mergeTheme(dark: boolean): Extension;
|
|
563
563
|
/**
|
|
564
564
|
* The foreground the injected diff chrome inherits: set it as the diff container's `color` so
|
|
565
565
|
* the revert buttons between the editors — which sit outside both editors' theme scopes —
|
|
566
566
|
* follow the chrome's muted text (a host's, else the flavor's) and flip with `dark`. The
|
|
567
567
|
* editors paint their own colors over it.
|
|
568
568
|
*/
|
|
569
|
-
declare function diffChromeColor(dark: boolean): string;
|
|
569
|
+
export declare function diffChromeColor(dark: boolean): string;
|
|
570
570
|
/**
|
|
571
571
|
* The two merge-view surfaces an editor theme cannot reach, styled through one injected rule
|
|
572
572
|
* set per document/shadow root (the same pattern as the monaco host's hover-geometry fix),
|
|
@@ -578,12 +578,12 @@ declare function diffChromeColor(dark: boolean): string;
|
|
|
578
578
|
* the container's `color` (set from {@link diffChromeColor}, so dark flips reach them) and
|
|
579
579
|
* get a hover tint mixed from that same currentColor — no per-flavor rules needed.
|
|
580
580
|
*/
|
|
581
|
-
declare function installDiffChrome(root: Document | ShadowRoot): void;
|
|
581
|
+
export declare function installDiffChrome(root: Document | ShadowRoot): void;
|
|
582
582
|
/**
|
|
583
583
|
* The document or shadow root a container mounts its editors into — what
|
|
584
584
|
* {@link installDiffChrome} takes, and what `ControlledMergeOptions.root` expects.
|
|
585
585
|
*/
|
|
586
|
-
declare function editorRoot(container: HTMLElement): Document | ShadowRoot;
|
|
586
|
+
export declare function editorRoot(container: HTMLElement): Document | ShadowRoot;
|
|
587
587
|
/**
|
|
588
588
|
* Keyboard access for the merge view's mouse-only controls, wired on the diff container:
|
|
589
589
|
* collapsed-lines bars become focusable buttons, revert buttons get an explicit `type` and a
|
|
@@ -591,7 +591,7 @@ declare function editorRoot(container: HTMLElement): Document | ShadowRoot;
|
|
|
591
591
|
* MutationObserver keeps late-rendered controls covered; the returned function tears
|
|
592
592
|
* everything down.
|
|
593
593
|
*/
|
|
594
|
-
declare function installDiffControlKeyboardSupport(container: HTMLElement): () => void;
|
|
594
|
+
export declare function installDiffControlKeyboardSupport(container: HTMLElement): () => void;
|
|
595
595
|
//#endregion
|
|
596
596
|
//#region src/merge-host.d.ts
|
|
597
597
|
interface ControlledMergeOptions extends MergeConfig$1 {
|
|
@@ -664,7 +664,7 @@ interface ControlledMergeOptions extends MergeConfig$1 {
|
|
|
664
664
|
* in the shared `extensions` (same rule as `ControlledEditorHost`).
|
|
665
665
|
* Framework-agnostic, same as `ControlledEditorHost`.
|
|
666
666
|
*/
|
|
667
|
-
declare class ControlledMergeHost {
|
|
667
|
+
export declare class ControlledMergeHost {
|
|
668
668
|
private readonly originalCompartment;
|
|
669
669
|
private readonly modifiedCompartment;
|
|
670
670
|
private silent;
|
|
@@ -713,22 +713,22 @@ interface SqlSchema {
|
|
|
713
713
|
* live editor without recreating it, matching the create-once discipline used throughout the
|
|
714
714
|
* toolkit.
|
|
715
715
|
*/
|
|
716
|
-
declare const setSqlSchema: import("@codemirror/state").StateEffectType<SqlSchema | null>;
|
|
716
|
+
export declare const setSqlSchema: import("@codemirror/state").StateEffectType<SqlSchema | null>;
|
|
717
717
|
/**
|
|
718
718
|
* Holds the schema that SQL table/column completion reads. `@coldsmirk/inkstone-react`'s
|
|
719
719
|
* components install it eagerly; the `sql`-family language supports also include it for
|
|
720
720
|
* hand-built editors. `null` (the default) means no schema — keyword completion still works,
|
|
721
721
|
* table/column completion stays off.
|
|
722
722
|
*/
|
|
723
|
-
declare const sqlSchemaField: StateField<SqlSchema | null>;
|
|
723
|
+
export declare const sqlSchemaField: StateField<SqlSchema | null>;
|
|
724
724
|
//#endregion
|
|
725
725
|
//#region src/theme.d.ts
|
|
726
|
-
declare function toCssSize(value: string | number | undefined): string | undefined;
|
|
726
|
+
export declare function toCssSize(value: string | number | undefined): string | undefined;
|
|
727
727
|
/**
|
|
728
728
|
* inkstone's default dynamic theme layer: the catppuccin flavor picked by `dark`, plus
|
|
729
729
|
* optional height/width sizing. The catppuccin theme is injected at low precedence so a
|
|
730
730
|
* caller's own theme (layered after it, e.g. through a dynamic-extensions slot) overrides it.
|
|
731
731
|
*/
|
|
732
|
-
declare function defaultThemeExtensions(dark: boolean, height?: string | number, width?: string | number, fontSize?: number, lineHeight?: number): Extension[];
|
|
732
|
+
export declare function defaultThemeExtensions(dark: boolean, height?: string | number, width?: string | number, fontSize?: number, lineHeight?: number): Extension[];
|
|
733
733
|
//#endregion
|
|
734
|
-
export {
|
|
734
|
+
export type { CodeMirrorLanguage, ControlledEditorOptions, ControlledMergeOptions, DocumentExtensionsOptions, EditorContext, IrField, IrSchema, IrType, Member, MergeConfig, MergeView, SqlSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coldsmirk/inkstone-codemirror",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Framework-agnostic CodeMirror 6 plumbing: a controlled editor host (create-once, external-value reconcile, in-place theme swap), the standard document extension bundle, and the editors' catppuccin theming.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemirror",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@catppuccin/codemirror": "^1.0.
|
|
37
|
+
"@catppuccin/codemirror": "^1.0.3",
|
|
38
38
|
"@catppuccin/palette": "^1.8.0",
|
|
39
39
|
"@codemirror/lang-angular": "^0.1.4",
|
|
40
40
|
"@codemirror/lang-cpp": "^6.0.3",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@codemirror/lang-json": "^6.0.2",
|
|
48
48
|
"@codemirror/lang-less": "^6.0.2",
|
|
49
49
|
"@codemirror/lang-lezer": "^6.0.2",
|
|
50
|
-
"@codemirror/lang-liquid": "^6.3.
|
|
50
|
+
"@codemirror/lang-liquid": "^6.3.3",
|
|
51
51
|
"@codemirror/lang-markdown": "^6.5.2",
|
|
52
52
|
"@codemirror/lang-php": "^6.0.2",
|
|
53
53
|
"@codemirror/lang-python": "^6.2.1",
|
|
@@ -58,19 +58,19 @@
|
|
|
58
58
|
"@codemirror/lang-wast": "^6.0.2",
|
|
59
59
|
"@codemirror/lang-xml": "^6.1.0",
|
|
60
60
|
"@codemirror/lang-yaml": "^6.1.3",
|
|
61
|
-
"@codemirror/legacy-modes": "^6.5.
|
|
61
|
+
"@codemirror/legacy-modes": "^6.5.5",
|
|
62
62
|
"@codemirror/lint": "^6.9.7",
|
|
63
63
|
"@codemirror/merge": "^6.12.2",
|
|
64
|
-
"@lezer/common": "^1.5.
|
|
65
|
-
"@coldsmirk/inkstone-core": "^0.
|
|
64
|
+
"@lezer/common": "^1.5.3",
|
|
65
|
+
"@coldsmirk/inkstone-core": "^0.31.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@codemirror/autocomplete": "^6.20.3",
|
|
69
|
-
"@codemirror/commands": "^6.
|
|
70
|
-
"@codemirror/language": "^6.
|
|
71
|
-
"@codemirror/search": "^6.
|
|
72
|
-
"@codemirror/state": "^6.6
|
|
73
|
-
"@codemirror/view": "^6.43.
|
|
69
|
+
"@codemirror/commands": "^6.11.1",
|
|
70
|
+
"@codemirror/language": "^6.13.1",
|
|
71
|
+
"@codemirror/search": "^6.7.2",
|
|
72
|
+
"@codemirror/state": "^6.7.6",
|
|
73
|
+
"@codemirror/view": "^6.43.14"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@codemirror/autocomplete": "^6.20.3",
|