@nonoun/native-codemirror 0.2.1 → 0.2.3

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.
@@ -18,7 +18,6 @@ import type { Extension } from '@codemirror/state';
18
18
  * - Active line + gutter highlighting
19
19
  * - Selection drawing and special character highlighting
20
20
  * - Indent on input
21
- * - Line wrapping
22
21
  */
23
22
  export declare const NBaseExtensions: Extension;
24
23
  //# sourceMappingURL=base-extensions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-extensions.d.ts","sourceRoot":"","sources":["../src/base-extensions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAwBnD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,EAAE,SAmC7B,CAAC"}
1
+ {"version":3,"file":"base-extensions.d.ts","sourceRoot":"","sources":["../src/base-extensions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAuBnD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,EAAE,SAgC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,WAAW,EACtB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,UAAU,CAuBZ"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,WAAW,EACtB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,UAAU,CA4BZ"}
@@ -20,21 +20,31 @@
20
20
  --n-cm-scrollbar-hover: #5e6167;
21
21
  --n-cm-match-bg: #314050;
22
22
 
23
- border-radius: var(--n-radius, 8px);
23
+ /*border-radius: var(--n-radius, 8px);*/
24
24
  overflow: hidden;
25
25
  font-variant-ligatures: contextual;
26
26
  line-height: 1.6;
27
27
  }
28
28
 
29
+ :where(.cm-content):focus-visible,
29
30
  :where(.cm-editor.cm-focused) {
30
31
  outline: none;
31
32
  }
32
33
 
33
34
  /* -----------------------------------------------------------------------
34
- * Scroller
35
+ * Scroller — structural fallbacks
36
+ *
37
+ * WHY: CodeMirror's base theme injects display: flex !important on
38
+ * .cm-scroller via a JS <style> tag (unlayered). In @layer ui,
39
+ * !important declarations beat unlayered !important (reverse layer
40
+ * order), so these serve as authoritative structural rules that
41
+ * ensure the horizontal gutter+content layout works even if the
42
+ * base theme's <style> tag fails to inject or gets removed by HMR.
35
43
  * --------------------------------------------------------------------- */
36
44
 
37
45
  :where(.cm-scroller) {
46
+ display: flex !important;
47
+ align-items: flex-start !important;
38
48
  overflow: auto;
39
49
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code',
40
50
  ui-monospace, SFMono-Regular, Menlo, monospace;
@@ -140,6 +150,17 @@
140
150
 
141
151
  :where(.cm-content) {
142
152
  padding: 8px 0;
153
+ /* WHY: UA stylesheets may set color on [contenteditable] based on the
154
+ inherited color-scheme (e.g. CanvasText → black in light mode).
155
+ Explicit `color: inherit` as an author rule overrides the UA color,
156
+ preserving the theme's color set on .cm-editor. */
157
+ color: inherit;
158
+ /* Structural fallback — matches CM base theme */
159
+ flex-grow: 2;
160
+ flex-shrink: 0;
161
+ white-space: pre;
162
+ word-wrap: normal;
163
+ min-height: 100%;
143
164
  }
144
165
 
145
166
  :where(.cm-line) {
@@ -1,5 +1,5 @@
1
- import { Decoration as e, EditorView as t, EditorView as n, ViewPlugin as r, WidgetType as i, drawSelection as a, drawSelection as o, highlightActiveLine as s, highlightActiveLine as ee, highlightActiveLineGutter as te, highlightActiveLineGutter as c, highlightSpecialChars as ne, keymap as re, keymap as ie, lineNumbers as ae, lineNumbers as oe } from "@codemirror/view";
2
- import { HighlightStyle as l, HighlightStyle as u, bracketMatching as d, bracketMatching as f, foldGutter as p, foldGutter as m, foldKeymap as se, indentOnInput as ce, indentOnInput as le, syntaxHighlighting as ue, syntaxHighlighting as de, syntaxTree as fe } from "@codemirror/language";
1
+ import { Decoration as e, EditorView as t, EditorView as n, ViewPlugin as r, WidgetType as i, drawSelection as a, drawSelection as o, highlightActiveLine as s, highlightActiveLine as c, highlightActiveLineGutter as ee, highlightActiveLineGutter as te, highlightSpecialChars as ne, keymap as l, keymap as re, lineNumbers as ie, lineNumbers as ae } from "@codemirror/view";
2
+ import { HighlightStyle as oe, HighlightStyle as u, bracketMatching as d, bracketMatching as f, foldGutter as p, foldGutter as m, foldKeymap as se, indentOnInput as ce, indentOnInput as le, syntaxHighlighting as ue, syntaxHighlighting as de, syntaxTree as fe } from "@codemirror/language";
3
3
  import { tags as h, tags as g } from "@lezer/highlight";
4
4
  import { defaultKeymap as _, defaultKeymap as v, history as y, history as b, historyKeymap as x, historyKeymap as S, redo as C, undo as w } from "@codemirror/commands";
5
5
  import { autocompletion as T, autocompletion as E, closeBrackets as D, closeBrackets as O, closeBracketsKeymap as k, closeBracketsKeymap as A, completionKeymap as j, completionKeymap as M } from "@codemirror/autocomplete";
@@ -11,7 +11,7 @@ import { Compartment as N, EditorState as pe, EditorState as P, StateEffect as F
11
11
  * @nonoun/native-ui OKLCH design system. Uses EditorView.theme()
12
12
  * with { dark: true } and HighlightStyle.define() for syntax tokens.
13
13
  */
14
- var L = "#282c34", R = "#21252b", z = "#abb2bf", B = "#7d8799", V = "#528bff", H = "#3E4451", U = "#c678dd", W = "#98c379", G = "#61afef", K = "#e06c75", q = "#e5c07b", J = "#56b6c2", Y = "#d19a66";
14
+ var L = "var(--n-code-bg, #282c34)", R = "var(--n-code-bg-dark, #21252b)", z = "var(--n-code-text, #abb2bf)", B = "var(--n-code-text-muted, #7d8799)", V = "#528bff", H = "#3E4451", U = "#c678dd", W = "#98c379", G = "#61afef", K = "#e06c75", q = "#e5c07b", J = "#56b6c2", Y = "#d19a66";
15
15
  const X = n.theme({
16
16
  "&": {
17
17
  color: z,
@@ -360,12 +360,11 @@ const X = n.theme({
360
360
  f(),
361
361
  O(),
362
362
  E(),
363
- oe(),
363
+ ae(),
364
364
  m(),
365
- ee(),
366
365
  c(),
367
- n.lineWrapping,
368
- ie.of([
366
+ te(),
367
+ re.of([
369
368
  ...A,
370
369
  ...v,
371
370
  ...S,
@@ -412,7 +411,8 @@ function me(e, t) {
412
411
  doc: r,
413
412
  extensions: o
414
413
  }),
415
- parent: e
414
+ parent: e,
415
+ root: e.ownerDocument
416
416
  });
417
417
  }
418
- export { N as Compartment, e as Decoration, pe as EditorState, t as EditorView, l as HighlightStyle, $ as NBaseExtensions, Z as NHighlightStyle, Q as NSyntaxHighlighting, X as NTheme, F as StateEffect, I as StateField, r as ViewPlugin, i as WidgetType, T as autocompletion, d as bracketMatching, D as closeBrackets, k as closeBracketsKeymap, j as completionKeymap, me as createEditorView, _ as defaultKeymap, a as drawSelection, p as foldGutter, s as highlightActiveLine, te as highlightActiveLineGutter, y as history, x as historyKeymap, ce as indentOnInput, re as keymap, ae as lineNumbers, C as redo, ue as syntaxHighlighting, fe as syntaxTree, h as tags, w as undo };
418
+ export { N as Compartment, e as Decoration, pe as EditorState, t as EditorView, oe as HighlightStyle, $ as NBaseExtensions, Z as NHighlightStyle, Q as NSyntaxHighlighting, X as NTheme, F as StateEffect, I as StateField, r as ViewPlugin, i as WidgetType, T as autocompletion, d as bracketMatching, D as closeBrackets, k as closeBracketsKeymap, j as completionKeymap, me as createEditorView, _ as defaultKeymap, a as drawSelection, p as foldGutter, s as highlightActiveLine, ee as highlightActiveLineGutter, y as history, x as historyKeymap, ce as indentOnInput, l as keymap, ie as lineNumbers, C as redo, ue as syntaxHighlighting, fe as syntaxTree, h as tags, w as undo };
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAsB,MAAM,sBAAsB,CAAC;AA0B1E,eAAO,MAAM,MAAM,uCAqKlB,CAAC;AAMF,eAAO,MAAM,eAAe,gBAoF1B,CAAC;AAEH,eAAO,MAAM,mBAAmB,uCAAsC,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAsB,MAAM,sBAAsB,CAAC;AA8B1E,eAAO,MAAM,MAAM,uCAqKlB,CAAC;AAMF,eAAO,MAAM,eAAe,gBAoF1B,CAAC;AAEH,eAAO,MAAM,mBAAmB,uCAAsC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nonoun/native-codemirror",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Shared CodeMirror 6 integration layer for @nonoun/native-ui ecosystem",
5
5
  "license": "MIT",
6
6
  "type": "module",