@coldsmirk/inkstone-monaco 0.19.0 → 0.19.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/README.md CHANGED
@@ -16,7 +16,7 @@ Part of [inkstone](https://github.com/coldsmirk/inkstone). For a drop-in React c
16
16
  - **`StreamingEditorController`** — stream generated text into an editor without routing every token through app state: `begin()` / `append(chunk)` / `end()` / `discard()`, `attach(editor)` / `detach(editor)` with buffered replay for late-mounting editors (and for a model swapped onto the attached editor mid-stream, including after the final chunk), and `isStreaming()` for the onChange guard. The stream locks every editor it touches read-only and `end()` / `discard()` restore each one's own setting — by handle, so an editor detached mid-stream is restored too; `discard()` puts every displaced document back into the model it came from, and `end()` does the same for every model except the one keeping the streamed text. Full-buffer writes and restorations preserve each model's UTF-8 BOM. Editors and models the app disposed mid-stream are skipped, never touched — teardown can race the stream without wedging it.
17
17
  - **`replaceInEditor(editor, old, new, all)`** — exact find-and-replace on an editor handle via `executeEdits`, preserving undo/cursor/folds; returns whether the edit landed (`false` = no editor / empty search / no match / a read-only editor refused it — e.g. one locked by a stream in progress), so a tool-call handler knows to fall back to a state write.
18
18
  - **`registerShikiHighlighting(monaco, highlighter)`** — wire `@coldsmirk/inkstone-core`'s shared Shiki highlighter onto a monaco module, once per distinct module: registers the canonical grammar names as Monaco languages, applies `@shikijs/monaco`'s tokenizer/themes, and repairs its `setTheme` patch so non-Shiki theme ids (vs/vs-dark, caller-defined) keep Monaco's original path. A failed registration is restored and retried on the next call.
19
- - **`installDesignTokens()`** — defines the VS Code design tokens monaco-editor 0.56's chrome reads and the standalone editor never does ([microsoft/monaco-editor#5408](https://github.com/microsoft/monaco-editor/issues/5408)): `--vscode-cornerRadius-{small,medium,large,xLarge}` and `--vscode-shadow-{md,lg,xl}`, on `.monaco-editor` (the context menu's shadow root and a host's `overflowWidgetsDomNode` inherit them). Without them the context menu, completion, hover, and find widgets ship square and shadowless. Each resolves through the host's `--inkstone-radius-*` / `--inkstone-shadow-*` token first (see `@coldsmirk/inkstone-core`), then a fallback scale in the spirit of 0.55's look. `ensureMonacoHost` installs it; idempotent.
19
+ - **`installDesignTokens()`** — defines the VS Code design tokens monaco-editor 0.56's chrome reads and the standalone editor never does ([microsoft/monaco-editor#5408](https://github.com/microsoft/monaco-editor/issues/5408)): `--vscode-cornerRadius-{small,medium,large,xLarge}` and `--vscode-shadow-{md,lg,xl}`, on `.monaco-editor` (the context menu's shadow root and a host's `overflowWidgetsDomNode` inherit them). Without them the context menu, completion, hover, and find widgets ship square and shadowless. Each resolves through the host's `--inkstone-radius-*` / `--inkstone-shadow-*` token first (see `@coldsmirk/inkstone-core`), then a fallback scale in the spirit of 0.55's look. It also keeps an input box's focus ring single: the standalone editor outlines both the `.monaco-inputbox` container (its `synthetic-focus` ring, which follows the box's radius) and the inner `<input>` (square, 1px inside), and the inner ring's corners poke out as soon as the box has corners — the container's ring is the one ring. `ensureMonacoHost` installs it; idempotent.
20
20
  - **`DEFAULT_MONACO_OPTIONS`** — the inkstone construction-option baseline (no minimap, 14px/1.6 type on the shared `--inkstone-font-family-code` token, embedded-friendly find widget, tuned completion, thin scrollbars). Spread it to extend: `{ ...DEFAULT_MONACO_OPTIONS, wordWrap: "on" }`.
21
21
  - **`reconcileModelValue` / `modelValueMatches`** — the controlled-value reconcile: diff an external value against a live model (normalized to the model's EOL) and apply one minimal `applyEdits` replace that never lands on the undo stack or moves a caret outside the changed region.
22
22
 
package/dist/index.d.ts CHANGED
@@ -79,8 +79,10 @@ declare function installAutoImportCompletions(monaco: MonacoModule, options: Aut
79
79
  /**
80
80
  * Define the VS Code design tokens Monaco's chrome reads but the standalone editor lacks —
81
81
  * corner radii and widget shadows — on `.monaco-editor`, resolved through the host's
82
- * `--inkstone-radius-*` / `--inkstone-shadow-*` tokens with inkstone's fallbacks. Installed by
83
- * `ensureMonacoHost`; idempotent, so a host that brings monaco up on its own can call it too.
82
+ * `--inkstone-radius-*` / `--inkstone-shadow-*` tokens with inkstone's fallbacks, and keep an
83
+ * input box's focus ring single now that the box has corners (see `INPUTBOX_FOCUS_RULE`).
84
+ * Installed by `ensureMonacoHost`; idempotent, so a host that brings monaco up on its own can
85
+ * call it too.
84
86
  */
85
87
  declare function installDesignTokens(): void;
86
88
  //#endregion
package/dist/index.js CHANGED
@@ -134,11 +134,12 @@ const DESIGN_TOKENS = [
134
134
  `--vscode-shadow-lg: ${inkstoneShadow("large", "0 2px 8px var(--vscode-widget-shadow)")}`,
135
135
  `--vscode-shadow-xl: ${inkstoneShadow("xlarge", "0 4px 16px var(--vscode-widget-shadow)")}`
136
136
  ];
137
+ const INPUTBOX_FOCUS_RULE = ".monaco-editor .monaco-inputbox > .ibwrapper > .input:focus { outline: none; }";
137
138
  function installDesignTokens() {
138
139
  if (document.querySelector(DESIGN_TOKENS_STYLE_SELECTOR)) return;
139
140
  const style = document.createElement("style");
140
141
  style.dataset.inkstone = "monaco-design-tokens";
141
- style.textContent = `.monaco-editor { ${DESIGN_TOKENS.join("; ")}; }`;
142
+ style.textContent = `.monaco-editor { ${DESIGN_TOKENS.join("; ")}; }\n${INPUTBOX_FOCUS_RULE}`;
142
143
  document.head.append(style);
143
144
  }
144
145
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coldsmirk/inkstone-monaco",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
4
4
  "description": "Framework-agnostic Monaco assembly: lazy offline host (all language workers bundled, no CDN), opt-in Simplified-Chinese UI via monaco's official NLS catalog, a streaming editor controller for AI-typed content, and the shared Shiki highlighting bridge.",
5
5
  "keywords": [
6
6
  "monaco",
@@ -40,7 +40,7 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@shikijs/monaco": "^4.4.3",
43
- "@coldsmirk/inkstone-core": "^0.19.0"
43
+ "@coldsmirk/inkstone-core": "^0.19.2"
44
44
  },
45
45
  "devDependencies": {
46
46
  "monaco-editor": "^0.56.0",