@coldsmirk/inkstone-react 0.15.0 → 0.17.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/README.md
CHANGED
|
@@ -28,7 +28,7 @@ import { MonacoEditor } from "@coldsmirk/inkstone-react/monaco";
|
|
|
28
28
|
/>;
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
One component brings: the local `monaco-editor` instance (no CDN), bundled offline workers, Shiki catppuccin highlighting registered before first paint,
|
|
31
|
+
One component brings: the local `monaco-editor` instance (no CDN), bundled offline workers, Shiki catppuccin highlighting registered before first paint, light/dark switching via `dark`, and VS Code's auto-closing JSX tags on TypeScript/JavaScript models whose `path` ends in `.tsx` / `.jsx` (parser-backed via the bundled TS worker).
|
|
32
32
|
|
|
33
33
|
- **Locale** — chrome speaks stock English; `locale="zh-cn"` switches to Monaco's official Simplified-Chinese catalog. Page-global and locked by the first editor to mount, so give every editor the same value.
|
|
34
34
|
- **Type & metrics** — `fontSize` defaults to 14, `lineHeight` to 1.6 (Monaco's convention: values below 8 multiply the font size); `DEFAULT_MONACO_OPTIONS` is exported for hosts that need the same baseline.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as codeMirrorLanguages, c as CodeMirrorEditor, d as CodeMirrorDiffEditorProps, i as SqlSchema, l as CodeMirrorEditorProps, n as EditorContext, o as normalizeContext, r as MergeView, s as searchPhrasesZhCn, t as CodeMirrorLanguage, u as CodeMirrorDiffEditor } from "./codemirror-BW_zSOVE.js";
|
|
2
|
-
import { a as MonacoEditorProps, i as MonacoEditor, n as MonacoLanguage, o as MonacoDiffEditor, r as monacoLanguages, s as MonacoDiffEditorProps, t as DEFAULT_MONACO_OPTIONS } from "./monaco-
|
|
2
|
+
import { a as MonacoEditorProps, i as MonacoEditor, n as MonacoLanguage, o as MonacoDiffEditor, r as monacoLanguages, s as MonacoDiffEditorProps, t as DEFAULT_MONACO_OPTIONS } from "./monaco-DZj8pXIv.js";
|
|
3
3
|
import { n as useShikiHighlighter, t as ShikiState } from "./shiki-Ds-uZ7XH.js";
|
|
4
4
|
export { CodeMirrorDiffEditor, type CodeMirrorDiffEditorProps, CodeMirrorEditor, type CodeMirrorEditorProps, type CodeMirrorLanguage, DEFAULT_MONACO_OPTIONS, type EditorContext, type MergeView, MonacoDiffEditor, type MonacoDiffEditorProps, MonacoEditor, type MonacoEditorProps, type MonacoLanguage, type ShikiState, type SqlSchema, codeMirrorLanguages, monacoLanguages, normalizeContext, searchPhrasesZhCn, useShikiHighlighter };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as CodeMirrorDiffEditor, i as CodeMirrorEditor, n as normalizeContext, r as searchPhrasesZhCn, t as codeMirrorLanguages } from "./codemirror-bROXidfr.js";
|
|
2
|
-
import { i as MonacoDiffEditor, n as monacoLanguages, r as MonacoEditor, t as DEFAULT_MONACO_OPTIONS } from "./monaco-
|
|
2
|
+
import { i as MonacoDiffEditor, n as monacoLanguages, r as MonacoEditor, t as DEFAULT_MONACO_OPTIONS } from "./monaco-DD8hJaMr.js";
|
|
3
3
|
import { t as useShikiHighlighter } from "./use-shiki-highlighter-CzSQcX2f.js";
|
|
4
4
|
import "./shiki.js";
|
|
5
5
|
export { CodeMirrorDiffEditor, CodeMirrorEditor, DEFAULT_MONACO_OPTIONS, MonacoDiffEditor, MonacoEditor, codeMirrorLanguages, monacoLanguages, normalizeContext, searchPhrasesZhCn, useShikiHighlighter };
|
|
@@ -3,7 +3,7 @@ import { t as useShikiHighlighter } from "./use-shiki-highlighter-CzSQcX2f.js";
|
|
|
3
3
|
import { useCallback, useEffect, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { shikiThemeId } from "@coldsmirk/inkstone-core";
|
|
6
|
-
import { DEFAULT_MONACO_OPTIONS, DEFAULT_MONACO_OPTIONS as DEFAULT_MONACO_OPTIONS$1, disabledKeybindings, ensureMonacoHost, installDisabledKeybindings, modelValueMatches, monacoLanguages, reconcileModelValue, registerShikiHighlighting } from "@coldsmirk/inkstone-monaco";
|
|
6
|
+
import { DEFAULT_MONACO_OPTIONS, DEFAULT_MONACO_OPTIONS as DEFAULT_MONACO_OPTIONS$1, disabledKeybindings, ensureMonacoHost, installDisabledKeybindings, 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
|
|
9
9
|
const FACE_STYLE = {
|
|
@@ -292,6 +292,7 @@ function MonacoEditor({ value, onChange, language = "javascript", dark = false,
|
|
|
292
292
|
monacoRef.current = monaco;
|
|
293
293
|
reconcileModel(monaco, editorInstance, valueRef.current, languageRef.current, reconcilingRef);
|
|
294
294
|
installDisabledKeybindings(monaco, editorInstance, disabledKeybindings(monaco, disableFind, disableCommandPalette));
|
|
295
|
+
installJsxTagClosing(monaco, editorInstance);
|
|
295
296
|
editorInstance.onDidFocusEditorText(() => onFocusRef.current?.());
|
|
296
297
|
editorInstance.onDidBlurEditorText(() => onBlurRef.current?.());
|
|
297
298
|
onMountRef.current?.(editorInstance, monaco);
|
|
@@ -289,6 +289,8 @@ interface MonacoEditorProps {
|
|
|
289
289
|
* highlighting with light/dark switching, and sensible document defaults — drop it in with
|
|
290
290
|
* `value` / `onChange` and everything else is wired. The UI speaks Monaco's stock English;
|
|
291
291
|
* pass `hostOptions={{ locale: "zh-cn" }}` for the official Simplified-Chinese chrome.
|
|
292
|
+
* TypeScript / JavaScript models whose `path` ends in `.tsx` / `.jsx` also get VS Code's
|
|
293
|
+
* auto-closing JSX tags (`installJsxTagClosing`), served by the bundled TS worker.
|
|
292
294
|
*
|
|
293
295
|
* Mounting is gated on the Monaco host and the Shiki highlighter so the first paint already
|
|
294
296
|
* has the right theme; if the highlighter fails to load, the editor falls back to Monaco's
|
package/dist/monaco.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MonacoEditorProps, i as MonacoEditor, n as MonacoLanguage, o as MonacoDiffEditor, r as monacoLanguages, s as MonacoDiffEditorProps, t as DEFAULT_MONACO_OPTIONS } from "./monaco-
|
|
1
|
+
import { a as MonacoEditorProps, i as MonacoEditor, n as MonacoLanguage, o as MonacoDiffEditor, r as monacoLanguages, s as MonacoDiffEditorProps, t as DEFAULT_MONACO_OPTIONS } from "./monaco-DZj8pXIv.js";
|
|
2
2
|
export { DEFAULT_MONACO_OPTIONS, MonacoDiffEditor, type MonacoDiffEditorProps, MonacoEditor, type MonacoEditorProps, type MonacoLanguage, monacoLanguages };
|
package/dist/monaco.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as MonacoDiffEditor, n as monacoLanguages, r as MonacoEditor, t as DEFAULT_MONACO_OPTIONS } from "./monaco-
|
|
1
|
+
import { i as MonacoDiffEditor, n as monacoLanguages, r as MonacoEditor, t as DEFAULT_MONACO_OPTIONS } from "./monaco-DD8hJaMr.js";
|
|
2
2
|
export { DEFAULT_MONACO_OPTIONS, MonacoDiffEditor, MonacoEditor, monacoLanguages };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coldsmirk/inkstone-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
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-codemirror": "^0.
|
|
52
|
-
"@coldsmirk/inkstone-core": "^0.
|
|
53
|
-
"@coldsmirk/inkstone-monaco": "^0.
|
|
51
|
+
"@coldsmirk/inkstone-codemirror": "^0.17.0",
|
|
52
|
+
"@coldsmirk/inkstone-core": "^0.17.0",
|
|
53
|
+
"@coldsmirk/inkstone-monaco": "^0.17.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@codemirror/autocomplete": "^6.20.3",
|