@coldsmirk/inkstone-react 0.35.0 → 0.36.1
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/README.md +1 -1
- package/dist/{codemirror-bROXidfr.js → codemirror-DDDvCyd7.js} +11 -3
- package/dist/{codemirror-BW_zSOVE.d.ts → codemirror-Jo2ah5JL.d.ts} +11 -1
- package/dist/codemirror.d.ts +2 -2
- package/dist/codemirror.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/monaco.js +1 -1
- package/package.json +4 -4
- package/dist/{monaco-CLTgQmhk.js → monaco-DhFTnmPx.js} +1 -1
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ A controlled CM6 editor: create-once view, external value changes reconcile with
|
|
|
63
63
|
- **Metrics & layout** — `fontSize` 14 and `lineHeight` 1.6 by default; `height` / `width` size the editor; `lineWrapping`, `showLineNumbers`, `folding` are opt-in.
|
|
64
64
|
- **Accessibility** — the textbox defaults to `ariaLabel="Editor content"`; pass a workflow-specific `ariaLabel` when needed. Focus presentation belongs to the surrounding application chrome.
|
|
65
65
|
- **Extensions** — `extensions` is create-once; `dynamicExtensions` reconfigures live. The catppuccin theme sits at low precedence, so a caller theme in `dynamicExtensions` overrides it.
|
|
66
|
-
- **Editor colors & tokens** — to paint both editors' chrome in your design language, configure `@coldsmirk/inkstone-core`'s `configureEditorColors`
|
|
66
|
+
- **Editor colors & tokens** — to paint both editors' chrome in your design language, configure `@coldsmirk/inkstone-core`'s `configureEditorColors` before the first editor mounts (per-scheme colors for background, current line, line numbers, caret, selection, scrollbars, floating widgets and their text, the accent, diagnostics), and again whenever they move — every editor mounted repaints in place, and `useEditorColors(dark)` (on the CodeMirror entry) reads them, as they move, for what a component of your own draws in them — and declare `--inkstone-radius-*` / `--inkstone-shadow-*` on your root; the syntax palette stays catppuccin's.
|
|
67
67
|
|
|
68
68
|
`useShikiHighlighter` is exported from `@coldsmirk/inkstone-react/shiki`; `codeMirrorLanguages` / `normalizeContext` / `searchPhrasesZhCn` live on the CodeMirror entry, and `monacoLanguages` lives on the Monaco entry. The aggregate root re-exports them for compatibility.
|
|
69
69
|
|
|
@@ -2,9 +2,16 @@ import { n as useControlledReconcileSignal, t as useLatest } from "./use-latest-
|
|
|
2
2
|
import { EditorState } from "@codemirror/state";
|
|
3
3
|
import { EditorView, lineNumbers } from "@codemirror/view";
|
|
4
4
|
import { ControlledEditorHost, ControlledMergeHost, codeMirrorLanguages, defaultThemeExtensions, diffChromeColor, documentExtensions, editorRoot, installDiffChrome, installDiffControlKeyboardSupport, loadLanguage, mergeTheme, minijinjaContextField, normalizeContext, normalizeContext as normalizeContext$1, searchPhrasesZhCn, searchPhrasesZhCn as searchPhrasesZhCn$1, setMinijinjaContext, setSqlSchema, sqlSchemaField, toCssSize } from "@coldsmirk/inkstone-codemirror";
|
|
5
|
-
import { useEffect, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { useCallback, useEffect, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
6
|
+
import { getEditorColors, subscribeEditorColors } from "@coldsmirk/inkstone-core";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import { indentUnit } from "@codemirror/language";
|
|
9
|
+
//#region src/use-editor-colors.ts
|
|
10
|
+
function useEditorColors(dark) {
|
|
11
|
+
const read = useCallback(() => getEditorColors(dark), [dark]);
|
|
12
|
+
return useSyncExternalStore(subscribeEditorColors, read, read);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
8
15
|
//#region src/codemirror-diff-editor.tsx
|
|
9
16
|
function CodeMirrorDiffEditor({ original, modified, onChange, language, readOnly = false, revertControls = false, collapseUnchanged = false, lineWrapping = false, showLineNumbers = true, extensions, dynamicExtensions, dark = false, height, width, fontSize = 14, lineHeight = 1.6, className, originalAriaLabel = "Original content", modifiedAriaLabel = "Modified content", onMount }) {
|
|
10
17
|
const containerRef = useRef(null);
|
|
@@ -113,6 +120,7 @@ function CodeMirrorDiffEditor({ original, modified, onChange, language, readOnly
|
|
|
113
120
|
collapseUnchanged: collapseUnchanged ? {} : void 0
|
|
114
121
|
});
|
|
115
122
|
}, [activeRevertControls, collapseUnchanged]);
|
|
123
|
+
const editorColors = useEditorColors(dark);
|
|
116
124
|
return /* @__PURE__ */ jsx("div", {
|
|
117
125
|
ref: containerRef,
|
|
118
126
|
className,
|
|
@@ -120,7 +128,7 @@ function CodeMirrorDiffEditor({ original, modified, onChange, language, readOnly
|
|
|
120
128
|
style: {
|
|
121
129
|
height: toCssSize(height),
|
|
122
130
|
width: toCssSize(width),
|
|
123
|
-
color: diffChromeColor(dark)
|
|
131
|
+
color: diffChromeColor(dark, editorColors)
|
|
124
132
|
}
|
|
125
133
|
});
|
|
126
134
|
}
|
|
@@ -260,4 +268,4 @@ function CodeMirrorEditor({ value, onChange, language, context, sqlSchema, place
|
|
|
260
268
|
});
|
|
261
269
|
}
|
|
262
270
|
//#endregion
|
|
263
|
-
export { CodeMirrorDiffEditor as a, CodeMirrorEditor as i, normalizeContext$1 as n, searchPhrasesZhCn$1 as r, codeMirrorLanguages as t };
|
|
271
|
+
export { CodeMirrorDiffEditor as a, CodeMirrorEditor as i, normalizeContext$1 as n, useEditorColors as o, searchPhrasesZhCn$1 as r, codeMirrorLanguages as t };
|
|
@@ -2,6 +2,7 @@ import { Extension } from "@codemirror/state";
|
|
|
2
2
|
import { EditorView } from "@codemirror/view";
|
|
3
3
|
import { CodeMirrorLanguage, CodeMirrorLanguage as CodeMirrorLanguage$1, EditorContext, EditorContext as EditorContext$1, MergeView, MergeView as MergeView$1, SqlSchema, SqlSchema as SqlSchema$1, codeMirrorLanguages, normalizeContext as normalizeContext$1, searchPhrasesZhCn as searchPhrasesZhCn$1 } from "@coldsmirk/inkstone-codemirror";
|
|
4
4
|
import { ReactNode } from "react";
|
|
5
|
+
import { EditorColors } from "@coldsmirk/inkstone-core";
|
|
5
6
|
//#region src/codemirror-diff-editor.d.ts
|
|
6
7
|
interface CodeMirrorDiffEditorProps {
|
|
7
8
|
/**
|
|
@@ -297,4 +298,13 @@ interface CodeMirrorEditorProps {
|
|
|
297
298
|
*/
|
|
298
299
|
declare function CodeMirrorEditor({ value, onChange, language, context, sqlSchema, placeholder, lineWrapping, showLineNumbers, folding, spellcheck, search, extensions, dynamicExtensions, dark, locale, height, width, fontSize, lineHeight, tabSize, className, onMount, onFocus, onBlur, ariaLabel }: CodeMirrorEditorProps): ReactNode;
|
|
299
300
|
//#endregion
|
|
300
|
-
|
|
301
|
+
//#region src/use-editor-colors.d.ts
|
|
302
|
+
/**
|
|
303
|
+
* The host's editor colors for a scheme (`configureEditorColors`), read again as they move: for
|
|
304
|
+
* what a component draws in them beside an editor — the diff container's color, which the revert
|
|
305
|
+
* buttons between its sides inherit. The editors themselves repaint without it: CodeMirror's
|
|
306
|
+
* chrome reconfigures itself, Monaco's themes are defined again by the Shiki bridge.
|
|
307
|
+
*/
|
|
308
|
+
declare function useEditorColors(dark: boolean): EditorColors | undefined;
|
|
309
|
+
//#endregion
|
|
310
|
+
export { codeMirrorLanguages as a, useEditorColors as c, CodeMirrorDiffEditor as d, CodeMirrorDiffEditorProps as f, SqlSchema$1 as i, CodeMirrorEditor as l, EditorContext$1 as n, normalizeContext$1 as o, MergeView$1 as r, searchPhrasesZhCn$1 as s, CodeMirrorLanguage$1 as t, CodeMirrorEditorProps as u };
|
package/dist/codemirror.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as codeMirrorLanguages, c as
|
|
2
|
-
export { CodeMirrorDiffEditor, type CodeMirrorDiffEditorProps, CodeMirrorEditor, type CodeMirrorEditorProps, type CodeMirrorLanguage, type EditorContext, type MergeView, type SqlSchema, codeMirrorLanguages, normalizeContext, searchPhrasesZhCn };
|
|
1
|
+
import { a as codeMirrorLanguages, c as useEditorColors, d as CodeMirrorDiffEditor, f as CodeMirrorDiffEditorProps, i as SqlSchema, l as CodeMirrorEditor, n as EditorContext, o as normalizeContext, r as MergeView, s as searchPhrasesZhCn, t as CodeMirrorLanguage, u as CodeMirrorEditorProps } from "./codemirror-Jo2ah5JL.js";
|
|
2
|
+
export { CodeMirrorDiffEditor, type CodeMirrorDiffEditorProps, CodeMirrorEditor, type CodeMirrorEditorProps, type CodeMirrorLanguage, type EditorContext, type MergeView, type SqlSchema, codeMirrorLanguages, normalizeContext, searchPhrasesZhCn, useEditorColors };
|
package/dist/codemirror.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as CodeMirrorDiffEditor, i as CodeMirrorEditor, t as codeMirrorLanguages, n as normalizeContext, r as searchPhrasesZhCn } from "./codemirror-
|
|
1
|
+
export { a as CodeMirrorDiffEditor, i as CodeMirrorEditor, t as codeMirrorLanguages, n as normalizeContext, r as searchPhrasesZhCn, o as useEditorColors } from "./codemirror-DDDvCyd7.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as codeMirrorLanguages, c as
|
|
1
|
+
import { a as codeMirrorLanguages, c as useEditorColors, d as CodeMirrorDiffEditor, f as CodeMirrorDiffEditorProps, i as SqlSchema, l as CodeMirrorEditor, n as EditorContext, o as normalizeContext, r as MergeView, s as searchPhrasesZhCn, t as CodeMirrorLanguage, u as CodeMirrorEditorProps } from "./codemirror-Jo2ah5JL.js";
|
|
2
2
|
import { a as MonacoEditorProps, c as ConsoleCaret, d as ConsoleRegistration, f as MonacoConsoleEditor, i as MonacoEditor, l as ConsoleEditorHandle, n as MonacoLanguage, o as MonacoDiffEditor, p as MonacoConsoleEditorProps, r as monacoLanguages, s as MonacoDiffEditorProps, t as DEFAULT_MONACO_OPTIONS, u as ConsoleEditorProps } from "./monaco-DTLlEEfk.js";
|
|
3
3
|
import { n as useShikiHighlighter, t as ShikiState } from "./shiki-Ds-uZ7XH.js";
|
|
4
|
-
export { CodeMirrorDiffEditor, type CodeMirrorDiffEditorProps, CodeMirrorEditor, type CodeMirrorEditorProps, type CodeMirrorLanguage, type ConsoleCaret, type ConsoleEditorHandle, type ConsoleEditorProps, type ConsoleRegistration, DEFAULT_MONACO_OPTIONS, type EditorContext, type MergeView, MonacoConsoleEditor, type MonacoConsoleEditorProps, MonacoDiffEditor, type MonacoDiffEditorProps, MonacoEditor, type MonacoEditorProps, type MonacoLanguage, type ShikiState, type SqlSchema, codeMirrorLanguages, monacoLanguages, normalizeContext, searchPhrasesZhCn, useShikiHighlighter };
|
|
4
|
+
export { CodeMirrorDiffEditor, type CodeMirrorDiffEditorProps, CodeMirrorEditor, type CodeMirrorEditorProps, type CodeMirrorLanguage, type ConsoleCaret, type ConsoleEditorHandle, type ConsoleEditorProps, type ConsoleRegistration, DEFAULT_MONACO_OPTIONS, type EditorContext, type MergeView, MonacoConsoleEditor, type MonacoConsoleEditorProps, MonacoDiffEditor, type MonacoDiffEditorProps, MonacoEditor, type MonacoEditorProps, type MonacoLanguage, type ShikiState, type SqlSchema, codeMirrorLanguages, monacoLanguages, normalizeContext, searchPhrasesZhCn, useEditorColors, useShikiHighlighter };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CodeMirrorDiffEditor, i as CodeMirrorEditor, n as normalizeContext, r as searchPhrasesZhCn, t as codeMirrorLanguages } from "./codemirror-
|
|
2
|
-
import { a as MonacoEditor, i as MonacoConsoleEditor, n as monacoLanguages, r as MonacoDiffEditor, t as DEFAULT_MONACO_OPTIONS } from "./monaco-
|
|
1
|
+
import { a as CodeMirrorDiffEditor, i as CodeMirrorEditor, n as normalizeContext, o as useEditorColors, r as searchPhrasesZhCn, t as codeMirrorLanguages } from "./codemirror-DDDvCyd7.js";
|
|
2
|
+
import { a as MonacoEditor, i as MonacoConsoleEditor, n as monacoLanguages, r as MonacoDiffEditor, t as DEFAULT_MONACO_OPTIONS } from "./monaco-DhFTnmPx.js";
|
|
3
3
|
import { t as useShikiHighlighter } from "./use-shiki-highlighter-CzSQcX2f.js";
|
|
4
4
|
import "./shiki.js";
|
|
5
|
-
export { CodeMirrorDiffEditor, CodeMirrorEditor, DEFAULT_MONACO_OPTIONS, MonacoConsoleEditor, MonacoDiffEditor, MonacoEditor, codeMirrorLanguages, monacoLanguages, normalizeContext, searchPhrasesZhCn, useShikiHighlighter };
|
|
5
|
+
export { CodeMirrorDiffEditor, CodeMirrorEditor, DEFAULT_MONACO_OPTIONS, MonacoConsoleEditor, MonacoDiffEditor, MonacoEditor, codeMirrorLanguages, monacoLanguages, normalizeContext, searchPhrasesZhCn, useEditorColors, useShikiHighlighter };
|
package/dist/monaco.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as DEFAULT_MONACO_OPTIONS, i as MonacoConsoleEditor, r as MonacoDiffEditor, a as MonacoEditor, n as monacoLanguages } from "./monaco-
|
|
1
|
+
export { t as DEFAULT_MONACO_OPTIONS, i as MonacoConsoleEditor, r as MonacoDiffEditor, a as MonacoEditor, n as monacoLanguages } from "./monaco-DhFTnmPx.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coldsmirk/inkstone-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.1",
|
|
4
4
|
"description": "Drop-in React code editors: a preconfigured Monaco <MonacoEditor> (offline workers, Shiki catppuccin themes, dark switching, opt-in zh-CN UI) and a controlled CodeMirror 6 <CodeMirrorEditor> (catppuccin themes, dark switching, sizing).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@monaco-editor/react": "^4.7.0",
|
|
51
|
-
"@coldsmirk/inkstone-core": "^0.
|
|
52
|
-
"@coldsmirk/inkstone-monaco": "^0.
|
|
53
|
-
"@coldsmirk/inkstone-codemirror": "^0.
|
|
51
|
+
"@coldsmirk/inkstone-core": "^0.36.1",
|
|
52
|
+
"@coldsmirk/inkstone-monaco": "^0.36.1",
|
|
53
|
+
"@coldsmirk/inkstone-codemirror": "^0.36.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@codemirror/autocomplete": "^6.20.3",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as useControlledReconcileSignal, t as useLatest } from "./use-latest-BxJHbqOv.js";
|
|
2
2
|
import { t as useShikiHighlighter } from "./use-shiki-highlighter-CzSQcX2f.js";
|
|
3
3
|
import { useCallback, useEffect, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
import { shikiThemeId } from "@coldsmirk/inkstone-core";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { DEFAULT_MONACO_OPTIONS, DEFAULT_MONACO_OPTIONS as DEFAULT_MONACO_OPTIONS$1, disabledKeybindings, ensureMonacoHost, installDisabledKeybindings, installHoverDeadBandFix, installJsxTagClosing, modelValueMatches, monacoLanguages, reconcileModelValue, registerShikiHighlighting } from "@coldsmirk/inkstone-monaco";
|
|
7
7
|
import { DiffEditor, Editor, loader } from "@monaco-editor/react";
|
|
8
8
|
//#region src/editor-face.tsx
|