@coldsmirk/inkstone-core 0.19.2 → 0.20.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 CHANGED
@@ -7,7 +7,7 @@ Part of [inkstone](https://github.com/coldsmirk/inkstone). The editor layers ([`
7
7
  ## What you get
8
8
 
9
9
  - **`getHighlighter()`** — the process-wide `HighlighterCore` promise. JavaScript / TypeScript / JSON / SQL grammars and the catppuccin theme pair load by default.
10
- - **`configureHighlighter(config)`** — extend or replace the default grammar / theme set, once, before any editor mounts. `DEFAULT_HIGHLIGHTER_LANGS` is exported so extension is additive.
10
+ - **`configureHighlighter(config)`** — extend or replace the default grammar / theme set, and choose the regex engine (`engine`: the strict JavaScript engine by default; `createJavaScriptRegexEngine({ forgiving: true })` for grammars the strict one refuses, or the Oniguruma WASM engine), once, before any editor mounts. `DEFAULT_HIGHLIGHTER_LANGS` is exported so extension is additive.
11
11
  - **`shikiThemeId(dark)`** plus the `INKSTONE_LIGHT_THEME` / `INKSTONE_DARK_THEME` constants — the theme names to pass wherever a Shiki theme id is expected.
12
12
  - **`configureEditorSurface(surfaces)`** — re-light the editors' own surfaces in your design language, once, before any editor mounts: per-scheme CSS color literals for `background` (content and gutter), `lineHighlight`, `lineNumber`, `widget` (completion, hover, parameter hints, the find widget and search panels), `widgetBorder`, and `widgetSelection`. The catppuccin pair keeps its syntax palette and gets these baked into its theme colors — Monaco, static rendering, and CodeMirror's chrome all read the same values — so an editor sits inside the app instead of bringing a second dark. A role or scheme left out keeps the flavor's own color, a later call replaces the schemes it names, and values must be hex colors (`#rrggbb`, `#rrggbbaa`) — Monaco parses theme colors as hex and paints red for anything else, so a `var()` reference or an `rgb(…)` is refused up front. Keep `lineHighlight` translucent: CodeMirror draws selections behind the content, so an opaque active line would hide them. `getEditorSurface(dark)` reads what was configured.
13
13
  - **`CODE_FONT_FAMILY`** — the shared code font stack both editor engines render with: the page's `--inkstone-font-family-code` CSS token when defined, else the platform's native monospace.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HighlighterCore, HighlighterCore as HighlighterCore$1, LanguageInput, ThemeInput, ThemeRegistration } from "shiki/core";
1
+ import { HighlighterCore, HighlighterCore as HighlighterCore$1, LanguageInput, RegexEngine, ThemeInput, ThemeRegistration } from "shiki/core";
2
2
  //#region src/code-font.d.ts
3
3
  /**
4
4
  * The code font stack every inkstone editor host renders with: the page's
@@ -109,6 +109,13 @@ interface HighlighterConfig {
109
109
  * the editor components select it by id).
110
110
  */
111
111
  themes?: ThemeInput[];
112
+ /**
113
+ * The regex engine the highlighter tokenizes with, replacing the default JavaScript engine
114
+ * in its strict form — for an app that loads grammars the strict engine refuses
115
+ * (`createJavaScriptRegexEngine({ forgiving: true })`), or one that ships the Oniguruma
116
+ * WASM and wants every grammar exact.
117
+ */
118
+ engine?: RegexEngine;
112
119
  }
113
120
  /**
114
121
  * Configure the shared highlighter before its first use. The highlighter is a process-wide
package/dist/index.js CHANGED
@@ -129,7 +129,7 @@ function getHighlighter() {
129
129
  ...registry.config.themes ?? []
130
130
  ],
131
131
  langs: registry.config.langs ?? [...DEFAULT_HIGHLIGHTER_LANGS],
132
- engine: createJavaScriptRegexEngine()
132
+ engine: registry.config.engine ?? createJavaScriptRegexEngine()
133
133
  });
134
134
  registry.promise = attempt;
135
135
  attempt.catch(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coldsmirk/inkstone-core",
3
- "version": "0.19.2",
3
+ "version": "0.20.1",
4
4
  "description": "Shared Shiki highlighter service for the inkstone editor toolkit: one fine-grained singleton (catppuccin themes, JS regex engine) reused by Monaco, static rendering, and markdown surfaces.",
5
5
  "keywords": [
6
6
  "shiki",