@nice2dev/ui 1.4.1 → 1.4.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/NiceCodeEditor-DhdjnDLV.cjs +289 -0
  3. package/dist/{NiceDataGrid-BT6iCUgP.cjs → NiceDataGrid-CrKDzMM1.cjs} +1 -1
  4. package/dist/{NiceForm-Bysp66Ef.cjs → NiceForm-CT9hEXpc.cjs} +1 -1
  5. package/dist/NiceLoginForm-C2-WgRn0.cjs +1 -0
  6. package/dist/NiceMention-BZEHqPrf.cjs +432 -0
  7. package/dist/NiceModuleLifecyclePanel-DKlqKPy2.cjs +1 -0
  8. package/dist/{NiceSavedQueryPanel-BbznsXFd.cjs → NiceSavedQueryPanel-C5Ab_NWx.cjs} +1 -1
  9. package/dist/NiceScheduler-BZQAKEVF.cjs +5 -0
  10. package/dist/{NiceWindow-pgR4c-kQ.cjs → NiceWindow-BklnkBpu.cjs} +1 -1
  11. package/dist/charts/NiceLinearGauge.mjs +96 -83
  12. package/dist/charts/NicePolarChart.mjs +47 -47
  13. package/dist/charts-BzlvCCg9.cjs +768 -0
  14. package/dist/charts.cjs +1 -1
  15. package/dist/{core-lazy-CL4ZIxF-.cjs → core-lazy-VTd5zfoZ.cjs} +1 -1
  16. package/dist/data.cjs +1 -1
  17. package/dist/display/NiceAvatar.mjs +40 -24
  18. package/dist/editors/pickers/NiceDateRangeBox.mjs +92 -92
  19. package/dist/editors/pickers/NiceDateTimePicker.mjs +173 -173
  20. package/dist/editors/rich/NiceCodeEditor.mjs +645 -584
  21. package/dist/editors/rich/NiceDocumentEditor.mjs +277 -254
  22. package/dist/editors.cjs +1 -1
  23. package/dist/feedback/NiceDrawer.mjs +15 -15
  24. package/dist/feedback.cjs +1 -1
  25. package/dist/index.cjs +202 -202
  26. package/dist/index.d.ts +18 -0
  27. package/dist/lazy.cjs +1 -1
  28. package/dist/navigation/NiceNavShell.mjs +646 -593
  29. package/dist/navigation/NiceSidebarNav.mjs +844 -823
  30. package/dist/navigation.cjs +1 -1
  31. package/dist/overlays/NiceWindow.mjs +91 -91
  32. package/dist/overlays.cjs +1 -1
  33. package/dist/planning/NiceScheduler.mjs +170 -169
  34. package/dist/planning/NiceSchedulerViews.mjs +242 -233
  35. package/dist/style.css +2 -2
  36. package/dist/utility/intlNames.mjs +26 -16
  37. package/package.json +4 -4
  38. package/dist/NiceCodeEditor-D0QZW88r.cjs +0 -268
  39. package/dist/NiceLoginForm-FGf32sro.cjs +0 -1
  40. package/dist/NiceMention-sc8W-DwH.cjs +0 -430
  41. package/dist/NiceModuleLifecyclePanel-DBQPCa_V.cjs +0 -1
  42. package/dist/NiceScheduler-3Ez0zSQJ.cjs +0 -5
  43. package/dist/charts-B0tHOpJ7.cjs +0 -768
@@ -1,8 +1,8 @@
1
- import { jsxs as P, jsx as t } from "react/jsx-runtime";
2
- import { useNiceTranslation as fe, useControllableState as ae, NiceTutorialButton as Ze, resolveTutorial as Ge, NiceIcon as M, createTabEscape as Pe } from "@nice2dev/ui-core";
3
- import { forwardRef as Xe, useRef as k, useState as I, useMemo as Me, useEffect as _, useImperativeHandle as et, useId as tt, useCallback as Le } from "react";
4
- import { injectStyleOnce as he } from "../../utility/injectStyleOnce.mjs";
5
- const nt = [
1
+ import { jsxs as W, jsx as o } from "react/jsx-runtime";
2
+ import { useNiceTranslation as ke, useControllableState as de, NiceTutorialButton as tt, resolveTutorial as rt, NiceIcon as O, createTabEscape as We, useThemeIsDark as ot } from "@nice2dev/ui-core";
3
+ import { forwardRef as nt, useRef as v, useState as D, useMemo as Te, useEffect as S, useImperativeHandle as it, useId as ct, useCallback as Oe } from "react";
4
+ import { injectStyleOnce as ye } from "../../utility/injectStyleOnce.mjs";
5
+ const at = [
6
6
  {
7
7
  target: ".nice-code-editor-wrap",
8
8
  titleKey: "tutorial.codeEditor.intro.title",
@@ -12,333 +12,396 @@ const nt = [
12
12
  placement: "auto"
13
13
  }
14
14
  ];
15
- let te = null, ie = null;
16
- const rt = "0.45.0", Ie = `https://cdn.jsdelivr.net/npm/monaco-editor@${rt}/min`, pe = `${Ie}/vs`, Oe = 15e3;
17
- function Te() {
18
- const a = window;
19
- if (a.MonacoEnvironment?.getWorkerUrl)
15
+ let re = null, ce = null;
16
+ const dt = "0.45.0", De = `https://cdn.jsdelivr.net/npm/monaco-editor@${dt}/min`, be = `${De}/vs`, Re = 15e3;
17
+ function Ie() {
18
+ const r = window;
19
+ if (r.MonacoEnvironment?.getWorkerUrl)
20
20
  return;
21
- const d = `self.MonacoEnvironment={baseUrl:'${Ie}/'};importScripts('${pe}/base/worker/workerMain.js');`, g = URL.createObjectURL(new Blob([d], { type: "text/javascript" }));
22
- a.MonacoEnvironment = {
23
- getWorkerUrl: () => g
21
+ const i = `self.MonacoEnvironment={baseUrl:'${De}/'};importScripts('${be}/base/worker/workerMain.js');`, d = URL.createObjectURL(new Blob([i], { type: "text/javascript" }));
22
+ r.MonacoEnvironment = {
23
+ getWorkerUrl: () => d
24
24
  };
25
25
  }
26
- function ne(a) {
27
- if (a !== "auto")
28
- return a;
26
+ function se(r) {
27
+ if (r !== "auto")
28
+ return r;
29
29
  if (typeof document > "u")
30
30
  return "vs";
31
- const d = document.documentElement.dataset.theme;
32
- return d === "dark" ? "vs-dark" : d === "light" ? "vs" : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "vs-dark" : "vs";
31
+ const i = document.documentElement.dataset.theme;
32
+ return i === "dark" ? "vs-dark" : i === "light" ? "vs" : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "vs-dark" : "vs";
33
33
  }
34
- function ot(a) {
35
- if (!a)
34
+ const Pe = "nice-auto";
35
+ let oe;
36
+ function st(r) {
37
+ if (!r || typeof document > "u" || (oe === void 0 && (oe = document.createElement("canvas").getContext("2d")), !oe))
38
+ return null;
39
+ const i = "#010203";
40
+ oe.fillStyle = i, oe.fillStyle = r;
41
+ const d = String(oe.fillStyle);
42
+ if (d === i && r.trim().toLowerCase() !== i)
43
+ return null;
44
+ if (d.startsWith("#"))
45
+ return d;
46
+ const t = d.match(/rgba?\(([^)]+)\)/);
47
+ if (!t)
48
+ return null;
49
+ const [u, C, x, p = 1] = t[1].split(",").map((n) => parseFloat(n)), b = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
50
+ return `#${b(u)}${b(C)}${b(x)}${p < 1 ? b(p * 255) : ""}`;
51
+ }
52
+ function lt(r) {
53
+ const i = parseInt(r.slice(1, 3), 16), d = parseInt(r.slice(3, 5), 16), t = parseInt(r.slice(5, 7), 16);
54
+ return (0.299 * i + 0.587 * d + 0.114 * t) / 255;
55
+ }
56
+ function le(r, i, d) {
57
+ if (i !== "auto" || !d || typeof getComputedStyle > "u")
58
+ return se(i);
59
+ const t = getComputedStyle(d), u = (...L) => {
60
+ for (const R of L) {
61
+ const f = st(t.getPropertyValue(R).trim());
62
+ if (f)
63
+ return f;
64
+ }
65
+ return null;
66
+ }, C = u("--nice-bg-primary", "--bg-primary"), x = u("--nice-text-primary", "--text-primary");
67
+ if (!C || !x)
68
+ return se(i);
69
+ const p = u("--nice-bg-secondary", "--bg-secondary") ?? C, b = u("--nice-text-secondary", "--text-secondary") ?? x, n = u("--nice-color-primary", "--primary") ?? x, B = u("--nice-border-color", "--border-color") ?? b, M = n.slice(0, 7);
70
+ return r.editor.defineTheme(Pe, {
71
+ base: lt(C) < 0.5 ? "vs-dark" : "vs",
72
+ inherit: !0,
73
+ rules: [],
74
+ colors: {
75
+ "editor.background": C,
76
+ "editor.foreground": x,
77
+ "editorLineNumber.foreground": b,
78
+ "editorLineNumber.activeForeground": x,
79
+ "editorCursor.foreground": M,
80
+ "editor.selectionBackground": `${M}40`,
81
+ "editor.inactiveSelectionBackground": `${M}26`,
82
+ "editor.lineHighlightBackground": p,
83
+ "editor.lineHighlightBorder": p,
84
+ "editorWidget.background": p,
85
+ "editorWidget.border": B,
86
+ "editorSuggestWidget.background": p,
87
+ "editorSuggestWidget.border": B,
88
+ "minimap.background": C
89
+ }
90
+ }), Pe;
91
+ }
92
+ function ze(r, i) {
93
+ const d = new MutationObserver(i), t = {
94
+ attributes: !0,
95
+ attributeFilter: ["data-theme", "class", "style"]
96
+ };
97
+ d.observe(document.documentElement, t);
98
+ const u = r?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");
99
+ u && u !== document.documentElement && d.observe(u, t);
100
+ const C = window.matchMedia?.("(prefers-color-scheme: dark)");
101
+ return C?.addEventListener?.("change", i), () => {
102
+ d.disconnect(), C?.removeEventListener?.("change", i);
103
+ };
104
+ }
105
+ function ut(r) {
106
+ if (!r)
36
107
  return "";
37
108
  try {
38
- return JSON.stringify([a.url, a.language, a.initOptions ?? null]);
109
+ return JSON.stringify([r.url, r.language, r.initOptions ?? null]);
39
110
  } catch {
40
- return JSON.stringify([a.url, a.language]);
111
+ return JSON.stringify([r.url, r.language]);
41
112
  }
42
113
  }
43
- function Ae() {
44
- return ie ? Promise.resolve(ie) : te || (te = new Promise((a, d) => {
114
+ function Ve() {
115
+ return ce ? Promise.resolve(ce) : re || (re = new Promise((r, i) => {
45
116
  if (window.monaco) {
46
- Te(), ie = window.monaco, a(ie);
117
+ Ie(), ce = window.monaco, r(ce);
47
118
  return;
48
119
  }
49
- let g = !1;
50
- const r = window.setTimeout(() => {
51
- g || (g = !0, te = null, d(new Error(`Monaco editor failed to load within ${Oe}ms`)));
52
- }, Oe), y = document.createElement("script");
53
- y.src = `${pe}/loader.min.js`, y.async = !0, y.onload = () => {
54
- const B = window.require;
55
- B.config({ paths: { vs: pe } }), Te(), B(["vs/editor/editor.main"], (A) => {
56
- g || (g = !0, window.clearTimeout(r), ie = A, a(A));
120
+ let d = !1;
121
+ const t = window.setTimeout(() => {
122
+ d || (d = !0, re = null, i(new Error(`Monaco editor failed to load within ${Re}ms`)));
123
+ }, Re), u = document.createElement("script");
124
+ u.src = `${be}/loader.min.js`, u.async = !0, u.onload = () => {
125
+ const C = window.require;
126
+ C.config({ paths: { vs: be } }), Ie(), C(["vs/editor/editor.main"], (x) => {
127
+ d || (d = !0, window.clearTimeout(t), ce = x, r(x));
57
128
  });
58
- }, y.onerror = () => {
59
- g || (g = !0, window.clearTimeout(r), te = null, d(new Error("Failed to load Monaco Editor loader script")));
60
- }, document.head.appendChild(y);
61
- }), te);
129
+ }, u.onerror = () => {
130
+ d || (d = !0, window.clearTimeout(t), re = null, i(new Error("Failed to load Monaco Editor loader script")));
131
+ }, document.head.appendChild(u);
132
+ }), re);
62
133
  }
63
- function De(a) {
64
- _(() => {
65
- const d = a.current;
66
- if (!d)
134
+ function $e(r) {
135
+ S(() => {
136
+ const i = r.current;
137
+ if (!i)
67
138
  return;
68
- const g = Pe(), r = (y) => {
69
- g(y) && y.stopPropagation();
139
+ const d = We(), t = (u) => {
140
+ d(u) && u.stopPropagation();
70
141
  };
71
- return d.addEventListener("keydown", r, !0), () => d.removeEventListener("keydown", r, !0);
72
- }, [a]);
142
+ return i.addEventListener("keydown", t, !0), () => i.removeEventListener("keydown", t, !0);
143
+ }, [r]);
73
144
  }
74
- const ut = /* @__PURE__ */ Xe(
75
- function(d, g) {
76
- const { t: r } = fe();
77
- he(be, ve);
145
+ const kt = /* @__PURE__ */ nt(
146
+ function(i, d) {
147
+ const { t } = ke();
148
+ ye(ve, Ce);
78
149
  const {
79
- value: y,
80
- defaultValue: B,
81
- onChange: A,
82
- language: f = "plaintext",
83
- theme: x = "auto",
84
- options: c = {},
85
- height: re = 400,
86
- width: U = "100%",
87
- markers: D = [],
88
- decorations: K = [],
89
- completionProvider: h,
150
+ value: u,
151
+ defaultValue: C,
152
+ onChange: x,
153
+ language: p = "plaintext",
154
+ theme: b = "auto",
155
+ options: n = {},
156
+ height: B = 400,
157
+ width: M = "100%",
158
+ markers: L = [],
159
+ decorations: R = [],
160
+ completionProvider: f,
90
161
  onMount: z,
91
162
  onCursorPositionChange: E,
92
- onSelectionChange: L,
93
- onSave: q,
94
- loading: W,
95
- disabled: V = !1,
96
- showToolbar: Z = !1,
163
+ onSelectionChange: I,
164
+ onSave: U,
165
+ loading: V,
166
+ disabled: $ = !1,
167
+ showToolbar: Q = !1,
97
168
  showStatusBar: j = !1,
98
- editorSize: Y = "standard",
99
- className: G,
100
- "data-testid": F,
101
- lsp: O,
102
- extraLibs: S,
103
- tutorial: ee
104
- } = d, [N, $, l] = ae({
105
- value: y,
106
- defaultValue: B,
169
+ editorSize: K = "standard",
170
+ className: Z,
171
+ "data-testid": q,
172
+ lsp: P,
173
+ extraLibs: w,
174
+ tutorial: G
175
+ } = i, [_, X, ee] = de({
176
+ value: u,
177
+ defaultValue: C,
107
178
  fallbackValue: "",
108
- onChange: A,
179
+ onChange: x,
109
180
  componentName: "NiceCodeEditor"
110
- }), u = k($);
111
- u.current = $;
112
- const C = k(N);
113
- C.current = N;
114
- const p = k(!1), b = k(null);
115
- De(b);
116
- const o = k(null), w = k(null), T = k([]), H = k(null), [J, ke] = I(!0), [de, ze] = I(null), [ye, We] = I({
181
+ }), Y = v(X);
182
+ Y.current = X;
183
+ const k = v(_);
184
+ k.current = _;
185
+ const l = v(!1), g = v(null);
186
+ $e(g);
187
+ const a = v(null), N = v(null), F = v([]), H = v(null), [T, me] = D(!0), [ne, je] = D(null), [xe, Fe] = D({
117
188
  lineNumber: 1,
118
189
  column: 1
119
- }), [Ce, Ve] = I(""), [le, je] = I(c.wordWrap === "on"), ce = Me(() => ({
190
+ }), [we, He] = D(""), [pe, Be] = D(n.wordWrap === "on"), ae = Te(() => ({
120
191
  automaticLayout: !0,
121
- readOnly: V || c.readOnly,
122
- minimap: { enabled: c.minimap ?? !0 },
123
- lineNumbers: c.lineNumbers ?? "on",
124
- wordWrap: c.wordWrap ?? "off",
125
- tabSize: c.tabSize ?? 2,
126
- insertSpaces: c.insertSpaces ?? !0,
127
- fontSize: c.fontSize ?? 14,
128
- fontFamily: c.fontFamily ?? "'Fira Code', 'Consolas', 'Monaco', monospace",
129
- fontLigatures: c.fontLigatures ?? !0,
130
- cursorStyle: c.cursorStyle ?? "line",
131
- cursorBlinking: c.cursorBlinking ?? "blink",
132
- autoClosingBrackets: c.autoClosingBrackets ?? "languageDefined",
133
- autoClosingQuotes: c.autoClosingQuotes ?? "languageDefined",
134
- formatOnPaste: c.formatOnPaste ?? !1,
135
- formatOnType: c.formatOnType ?? !1,
136
- renderWhitespace: c.renderWhitespace ?? "selection",
137
- renderControlCharacters: c.renderControlCharacters ?? !1,
138
- scrollBeyondLastLine: c.scrollBeyondLastLine ?? !0,
139
- smoothScrolling: c.smoothScrolling ?? !0,
140
- folding: c.folding ?? !0,
141
- showFoldingControls: c.showFoldingControls ?? "mouseover",
142
- "bracketPairColorization.enabled": c.bracketPairColorization ?? !0,
143
- guides: c.guides ?? {
192
+ readOnly: $ || n.readOnly,
193
+ minimap: { enabled: n.minimap ?? !0 },
194
+ lineNumbers: n.lineNumbers ?? "on",
195
+ wordWrap: n.wordWrap ?? "off",
196
+ tabSize: n.tabSize ?? 2,
197
+ insertSpaces: n.insertSpaces ?? !0,
198
+ fontSize: n.fontSize ?? 14,
199
+ fontFamily: n.fontFamily ?? "'Fira Code', 'Consolas', 'Monaco', monospace",
200
+ fontLigatures: n.fontLigatures ?? !0,
201
+ cursorStyle: n.cursorStyle ?? "line",
202
+ cursorBlinking: n.cursorBlinking ?? "blink",
203
+ autoClosingBrackets: n.autoClosingBrackets ?? "languageDefined",
204
+ autoClosingQuotes: n.autoClosingQuotes ?? "languageDefined",
205
+ formatOnPaste: n.formatOnPaste ?? !1,
206
+ formatOnType: n.formatOnType ?? !1,
207
+ renderWhitespace: n.renderWhitespace ?? "selection",
208
+ renderControlCharacters: n.renderControlCharacters ?? !1,
209
+ scrollBeyondLastLine: n.scrollBeyondLastLine ?? !0,
210
+ smoothScrolling: n.smoothScrolling ?? !0,
211
+ folding: n.folding ?? !0,
212
+ showFoldingControls: n.showFoldingControls ?? "mouseover",
213
+ "bracketPairColorization.enabled": n.bracketPairColorization ?? !0,
214
+ guides: n.guides ?? {
144
215
  bracketPairs: !0,
145
216
  indentation: !0,
146
217
  highlightActiveIndentation: !0
147
218
  },
148
- stickyScroll: { enabled: c.stickyScroll ?? !1 },
149
- quickSuggestions: c.quickSuggestions ?? !0,
150
- suggestOnTriggerCharacters: c.suggestOnTriggerCharacters ?? !0,
151
- acceptSuggestionOnEnter: c.acceptSuggestionOnEnter ?? "on",
152
- inlayHints: { enabled: c.inlayHints ? "on" : "off" }
153
- }), [c, V]), oe = k({ onCursorPositionChange: E, onSelectionChange: L, onSave: q, onMount: z });
154
- oe.current = { onCursorPositionChange: E, onSelectionChange: L, onSave: q, onMount: z };
155
- const we = k({ language: f, theme: x, editorOptions: ce });
156
- we.current = { language: f, theme: x, editorOptions: ce };
157
- const xe = k(O);
158
- xe.current = O;
159
- const Fe = ot(O), _e = k(r);
160
- _e.current = r, _(() => {
161
- if (!b.current)
219
+ stickyScroll: { enabled: n.stickyScroll ?? !1 },
220
+ quickSuggestions: n.quickSuggestions ?? !0,
221
+ suggestOnTriggerCharacters: n.suggestOnTriggerCharacters ?? !0,
222
+ acceptSuggestionOnEnter: n.acceptSuggestionOnEnter ?? "on",
223
+ inlayHints: { enabled: n.inlayHints ? "on" : "off" }
224
+ }), [n, $]), ie = v({ onCursorPositionChange: E, onSelectionChange: I, onSave: U, onMount: z });
225
+ ie.current = { onCursorPositionChange: E, onSelectionChange: I, onSave: U, onMount: z };
226
+ const _e = v({ language: p, theme: b, editorOptions: ae });
227
+ _e.current = { language: p, theme: b, editorOptions: ae };
228
+ const Ne = v(P);
229
+ Ne.current = P;
230
+ const Ue = ut(P), Se = v(t);
231
+ Se.current = t, S(() => {
232
+ if (!g.current)
162
233
  return;
163
234
  let e = !0;
164
- const i = xe.current;
165
- return Ae().then(async (n) => {
166
- if (!e || !b.current)
235
+ const s = Ne.current;
236
+ return Ve().then(async (c) => {
237
+ if (!e || !g.current)
167
238
  return;
168
- w.current = n;
169
- const m = we.current, v = n.editor.create(b.current, {
170
- value: C.current,
171
- language: m.language,
172
- theme: ne(m.theme),
173
- ...m.editorOptions
239
+ N.current = c;
240
+ const h = _e.current, y = c.editor.create(g.current, {
241
+ value: k.current,
242
+ language: h.language,
243
+ theme: se(h.theme),
244
+ ...h.editorOptions
174
245
  });
175
- if (o.current = v, ke(!1), v.onDidChangeModelContent(() => {
176
- p.current || u.current(v.getValue());
177
- }), v.onDidChangeCursorPosition(
178
- (s) => {
179
- We({ lineNumber: s.position.lineNumber, column: s.position.column }), oe.current.onCursorPositionChange?.({
180
- lineNumber: s.position.lineNumber,
181
- column: s.position.column
246
+ if (a.current = y, me(!1), y.onDidChangeModelContent(() => {
247
+ l.current || Y.current(y.getValue());
248
+ }), y.onDidChangeCursorPosition(
249
+ (m) => {
250
+ Fe({ lineNumber: m.position.lineNumber, column: m.position.column }), ie.current.onCursorPositionChange?.({
251
+ lineNumber: m.position.lineNumber,
252
+ column: m.position.column
182
253
  });
183
254
  }
184
- ), v.onDidChangeCursorSelection(
185
- (s) => {
186
- const R = s.selection, X = v.getModel()?.getValueInRange(R) ?? "";
187
- Ve(X), oe.current.onSelectionChange?.({
188
- startLineNumber: R.startLineNumber,
189
- startColumn: R.startColumn,
190
- endLineNumber: R.endLineNumber,
191
- endColumn: R.endColumn
255
+ ), y.onDidChangeCursorSelection(
256
+ (m) => {
257
+ const A = m.selection, te = y.getModel()?.getValueInRange(A) ?? "";
258
+ He(te), ie.current.onSelectionChange?.({
259
+ startLineNumber: A.startLineNumber,
260
+ startColumn: A.startColumn,
261
+ endLineNumber: A.endLineNumber,
262
+ endColumn: A.endColumn
192
263
  });
193
264
  }
194
- ), v.addCommand(n.KeyMod.CtrlCmd | n.KeyCode.KeyS, () => {
195
- oe.current.onSave?.(v.getValue());
196
- }), i && typeof window < "u")
265
+ ), y.addCommand(c.KeyMod.CtrlCmd | c.KeyCode.KeyS, () => {
266
+ ie.current.onSave?.(y.getValue());
267
+ }), s && typeof window < "u")
197
268
  try {
198
- await se(
269
+ await ue(
199
270
  "https://cdn.jsdelivr.net/npm/vscode-ws-jsonrpc@1.0.2/lib/browser/index.min.js"
200
- ), await se(
271
+ ), await ue(
201
272
  "https://cdn.jsdelivr.net/npm/monaco-languageclient@0.15.0/lib/monaco-languageclient.min.js"
202
273
  );
203
- const s = window, R = s.ReconnectingWebSocket, { MonacoLanguageClient: X, CloseAction: Be, ErrorAction: Ue, createConnection: Ne } = s.monacoLanguageClient || {};
204
- if (X && Ne) {
205
- const Ke = i.url, qe = i.language, Ee = new R(Ke), Ye = new s.VSCodeWebSocketMessageReader(Ee), Je = new s.VSCodeWebSocketMessageWriter(Ee), Qe = Ne(Ye, Je), Se = new X({
274
+ const m = window, A = m.ReconnectingWebSocket, { MonacoLanguageClient: te, CloseAction: Ye, ErrorAction: Je, createConnection: Ee } = m.monacoLanguageClient || {};
275
+ if (te && Ee) {
276
+ const Qe = s.url, Ze = s.language, Me = new A(Qe), Ge = new m.VSCodeWebSocketMessageReader(Me), Xe = new m.VSCodeWebSocketMessageWriter(Me), et = Ee(Ge, Xe), Le = new te({
206
277
  name: "LSP Client",
207
278
  clientOptions: {
208
- documentSelector: [qe],
209
- initializationOptions: i.initOptions,
279
+ documentSelector: [Ze],
280
+ initializationOptions: s.initOptions,
210
281
  errorHandler: {
211
- error: () => Ue.Continue,
212
- closed: () => Be.Restart
282
+ error: () => Je.Continue,
283
+ closed: () => Ye.Restart
213
284
  }
214
285
  },
215
286
  connectionProvider: {
216
- get: () => Promise.resolve(Qe)
287
+ get: () => Promise.resolve(et)
217
288
  }
218
289
  });
219
- Se.start(), o.current.__lspClient = Se;
290
+ Le.start(), a.current.__lspClient = Le;
220
291
  }
221
- } catch (s) {
222
- console.warn("LSP bridge failed to load:", s);
292
+ } catch (m) {
293
+ console.warn("LSP bridge failed to load:", m);
223
294
  }
224
- oe.current.onMount?.(v, n);
225
- }).catch((n) => {
226
- e && (ze(
227
- n.message ?? _e.current("codeEditor.failedToLoadEditor", "Failed to load editor")
228
- ), ke(!1));
295
+ ie.current.onMount?.(y, c);
296
+ }).catch((c) => {
297
+ e && (je(
298
+ c.message ?? Se.current("codeEditor.failedToLoadEditor", "Failed to load editor")
299
+ ), me(!1));
229
300
  }), () => {
230
- if (e = !1, o.current?.dispose(), H.current?.dispose(), o.current && o.current.__lspClient)
301
+ if (e = !1, a.current?.dispose(), H.current?.dispose(), a.current && a.current.__lspClient)
231
302
  try {
232
- o.current.__lspClient.stop();
303
+ a.current.__lspClient.stop();
233
304
  } catch {
234
305
  }
235
306
  };
236
- }, [Fe]), _(() => {
237
- const e = o.current;
238
- if (!l || !e || N === e.getValue())
307
+ }, [Ue]), S(() => {
308
+ const e = a.current;
309
+ if (!ee || !e || _ === e.getValue())
239
310
  return;
240
- const i = e.getPosition();
241
- p.current = !0;
311
+ const s = e.getPosition();
312
+ l.current = !0;
242
313
  try {
243
- e.setValue(N);
314
+ e.setValue(_);
244
315
  } finally {
245
- p.current = !1;
316
+ l.current = !1;
246
317
  }
247
- i && e.setPosition(i);
248
- }, [N, l]), _(() => {
249
- const e = o.current, i = w.current;
250
- if (e && i) {
251
- const n = e.getModel();
252
- n && i.editor.setModelLanguage(n, f);
318
+ s && e.setPosition(s);
319
+ }, [_, ee]), S(() => {
320
+ const e = a.current, s = N.current;
321
+ if (e && s) {
322
+ const c = e.getModel();
323
+ c && s.editor.setModelLanguage(c, p);
253
324
  }
254
- }, [f]), _(() => {
255
- const e = w.current;
256
- if (!e || J || !S || S.length === 0 || f !== "javascript" && f !== "typescript")
325
+ }, [p]), S(() => {
326
+ const e = N.current;
327
+ if (!e || T || !w || w.length === 0 || p !== "javascript" && p !== "typescript")
257
328
  return;
258
- const i = e.languages?.typescript;
259
- if (!i)
329
+ const s = e.languages?.typescript;
330
+ if (!s)
260
331
  return;
261
- const n = [];
332
+ const c = [];
262
333
  try {
263
- S.forEach((m, v) => {
264
- const s = m.filePath ?? `inmemory://model/nice-extralib-${v}.d.ts`, R = i.typescriptDefaults?.addExtraLib(m.content, s);
265
- R && n.push(R);
266
- const X = i.javascriptDefaults?.addExtraLib(m.content, s);
267
- X && n.push(X);
334
+ w.forEach((h, y) => {
335
+ const m = h.filePath ?? `inmemory://model/nice-extralib-${y}.d.ts`, A = s.typescriptDefaults?.addExtraLib(h.content, m);
336
+ A && c.push(A);
337
+ const te = s.javascriptDefaults?.addExtraLib(h.content, m);
338
+ te && c.push(te);
268
339
  });
269
- } catch (m) {
270
- console.warn("Failed to register extraLibs:", m);
340
+ } catch (h) {
341
+ console.warn("Failed to register extraLibs:", h);
271
342
  }
272
343
  return () => {
273
- n.forEach((m) => {
344
+ c.forEach((h) => {
274
345
  try {
275
- m.dispose();
346
+ h.dispose();
276
347
  } catch {
277
348
  }
278
349
  });
279
350
  };
280
- }, [S, f, J]), _(() => {
281
- const e = w.current;
282
- if (!e || (e.editor.setTheme(ne(x)), x !== "auto" || typeof document > "u"))
283
- return;
284
- const i = () => {
285
- w.current?.editor.setTheme(ne("auto"));
286
- }, n = new MutationObserver(i);
287
- n.observe(document.documentElement, {
288
- attributes: !0,
289
- attributeFilter: ["data-theme", "class"]
290
- });
291
- const m = window.matchMedia?.("(prefers-color-scheme: dark)");
292
- return m?.addEventListener?.("change", i), () => {
293
- n.disconnect(), m?.removeEventListener?.("change", i);
294
- };
295
- }, [x]), _(() => {
296
- const e = o.current;
297
- e && e.updateOptions(ce);
298
- }, [ce]), _(() => {
299
- const e = o.current, i = w.current;
300
- if (e && i) {
301
- const n = e.getModel();
302
- if (n) {
303
- const m = D.map((v) => ({
304
- startLineNumber: v.startLineNumber,
305
- startColumn: v.startColumn,
306
- endLineNumber: v.endLineNumber,
307
- endColumn: v.endColumn,
308
- message: v.message,
309
- severity: v.severity
351
+ }, [w, p, T]), S(() => {
352
+ const e = N.current;
353
+ if (e && (e.editor.setTheme(le(e, b, g.current)), !(b !== "auto" || typeof document > "u")))
354
+ return ze(g.current, () => {
355
+ const s = N.current;
356
+ s?.editor.setTheme(le(s, "auto", g.current));
357
+ });
358
+ }, [b, T]), S(() => {
359
+ const e = a.current;
360
+ e && e.updateOptions(ae);
361
+ }, [ae]), S(() => {
362
+ const e = a.current, s = N.current;
363
+ if (e && s) {
364
+ const c = e.getModel();
365
+ if (c) {
366
+ const h = L.map((y) => ({
367
+ startLineNumber: y.startLineNumber,
368
+ startColumn: y.startColumn,
369
+ endLineNumber: y.endLineNumber,
370
+ endColumn: y.endColumn,
371
+ message: y.message,
372
+ severity: y.severity
310
373
  }));
311
- i.editor.setModelMarkers(n, "owner", m);
374
+ s.editor.setModelMarkers(c, "owner", h);
312
375
  }
313
376
  }
314
- }, [D]), _(() => {
315
- const e = o.current;
316
- if (e && K.length > 0) {
317
- const i = K.map((n) => ({
377
+ }, [L]), S(() => {
378
+ const e = a.current;
379
+ if (e && R.length > 0) {
380
+ const s = R.map((c) => ({
318
381
  range: {
319
- startLineNumber: n.range.startLineNumber,
320
- startColumn: n.range.startColumn,
321
- endLineNumber: n.range.endLineNumber,
322
- endColumn: n.range.endColumn
382
+ startLineNumber: c.range.startLineNumber,
383
+ startColumn: c.range.startColumn,
384
+ endLineNumber: c.range.endLineNumber,
385
+ endColumn: c.range.endColumn
323
386
  },
324
387
  options: {
325
- className: n.className,
326
- glyphMarginClassName: n.glyphMarginClassName,
327
- hoverMessage: n.hoverMessage ? { value: n.hoverMessage } : void 0,
328
- isWholeLine: n.isWholeLine
388
+ className: c.className,
389
+ glyphMarginClassName: c.glyphMarginClassName,
390
+ hoverMessage: c.hoverMessage ? { value: c.hoverMessage } : void 0,
391
+ isWholeLine: c.isWholeLine
329
392
  }
330
393
  }));
331
- T.current = e.deltaDecorations(
332
- T.current,
333
- i
394
+ F.current = e.deltaDecorations(
395
+ F.current,
396
+ s
334
397
  );
335
398
  }
336
- }, [K]), _(() => {
337
- const e = w.current;
338
- if (!e || !h)
399
+ }, [R]), S(() => {
400
+ const e = N.current;
401
+ if (!e || !f)
339
402
  return;
340
403
  H.current?.dispose();
341
- const i = {
404
+ const s = {
342
405
  text: 0,
343
406
  method: 1,
344
407
  function: 2,
@@ -356,119 +419,119 @@ const ut = /* @__PURE__ */ Xe(
356
419
  reference: 17,
357
420
  folder: 18
358
421
  };
359
- return H.current = e.languages.registerCompletionItemProvider(f, {
360
- provideCompletionItems: async (n, m) => ({
361
- suggestions: (await h(n, m)).map((s) => ({
362
- label: s.label,
363
- kind: i[s.kind] ?? 0,
364
- insertText: s.insertText,
365
- insertTextRules: s.insertTextRules === "insertAsSnippet" ? 4 : void 0,
366
- documentation: s.documentation,
367
- detail: s.detail,
422
+ return H.current = e.languages.registerCompletionItemProvider(p, {
423
+ provideCompletionItems: async (c, h) => ({
424
+ suggestions: (await f(c, h)).map((m) => ({
425
+ label: m.label,
426
+ kind: s[m.kind] ?? 0,
427
+ insertText: m.insertText,
428
+ insertTextRules: m.insertTextRules === "insertAsSnippet" ? 4 : void 0,
429
+ documentation: m.documentation,
430
+ detail: m.detail,
368
431
  range: {
369
- startLineNumber: m.lineNumber,
370
- startColumn: m.column,
371
- endLineNumber: m.lineNumber,
372
- endColumn: m.column
432
+ startLineNumber: h.lineNumber,
433
+ startColumn: h.column,
434
+ endLineNumber: h.lineNumber,
435
+ endColumn: h.column
373
436
  }
374
437
  }))
375
438
  })
376
439
  }), () => {
377
440
  H.current?.dispose();
378
441
  };
379
- }, [f, h]), et(
380
- g,
442
+ }, [p, f]), it(
443
+ d,
381
444
  () => ({
382
- getEditor: () => o.current,
383
- getMonaco: () => w.current,
384
- focus: () => o.current?.focus(),
385
- getValue: () => o.current?.getValue() ?? "",
386
- setValue: (e) => o.current?.setValue(e),
445
+ getEditor: () => a.current,
446
+ getMonaco: () => N.current,
447
+ focus: () => a.current?.focus(),
448
+ getValue: () => a.current?.getValue() ?? "",
449
+ setValue: (e) => a.current?.setValue(e),
387
450
  getSelection: () => {
388
- const e = o.current;
451
+ const e = a.current;
389
452
  if (!e)
390
453
  return "";
391
- const i = e.getSelection();
392
- return i ? e.getModel()?.getValueInRange(i) ?? "" : "";
454
+ const s = e.getSelection();
455
+ return s ? e.getModel()?.getValueInRange(s) ?? "" : "";
393
456
  },
394
457
  insertText: (e) => {
395
- const i = o.current;
396
- if (!i)
458
+ const s = a.current;
459
+ if (!s)
397
460
  return;
398
- const n = i.getSelection();
399
- n && i.executeEdits("", [{ range: n, text: e }]);
461
+ const c = s.getSelection();
462
+ c && s.executeEdits("", [{ range: c, text: e }]);
400
463
  },
401
464
  formatDocument: () => {
402
- o.current?.getAction("editor.action.formatDocument")?.run();
465
+ a.current?.getAction("editor.action.formatDocument")?.run();
403
466
  },
404
- goToLine: (e, i = 1) => {
405
- const n = o.current;
406
- n && (n.setPosition({ lineNumber: e, column: i }), n.revealLineInCenter(e), n.focus());
467
+ goToLine: (e, s = 1) => {
468
+ const c = a.current;
469
+ c && (c.setPosition({ lineNumber: e, column: s }), c.revealLineInCenter(e), c.focus());
407
470
  },
408
471
  findReplace: () => {
409
- o.current?.getAction("editor.action.startFindReplaceAction")?.run();
472
+ a.current?.getAction("editor.action.startFindReplaceAction")?.run();
410
473
  },
411
474
  undo: () => {
412
- o.current?.trigger("keyboard", "undo", null);
475
+ a.current?.trigger("keyboard", "undo", null);
413
476
  },
414
477
  redo: () => {
415
- o.current?.trigger("keyboard", "redo", null);
478
+ a.current?.trigger("keyboard", "redo", null);
416
479
  },
417
480
  getCursorPosition: () => {
418
- const e = o.current?.getPosition();
481
+ const e = a.current?.getPosition();
419
482
  return { lineNumber: e?.lineNumber ?? 1, column: e?.column ?? 1 };
420
483
  },
421
484
  setMarkers: (e) => {
422
- const i = o.current, n = w.current;
423
- if (i && n) {
424
- const m = i.getModel();
425
- if (m) {
426
- const v = e.map((s) => ({
427
- startLineNumber: s.startLineNumber,
428
- startColumn: s.startColumn,
429
- endLineNumber: s.endLineNumber,
430
- endColumn: s.endColumn,
431
- message: s.message,
432
- severity: s.severity
485
+ const s = a.current, c = N.current;
486
+ if (s && c) {
487
+ const h = s.getModel();
488
+ if (h) {
489
+ const y = e.map((m) => ({
490
+ startLineNumber: m.startLineNumber,
491
+ startColumn: m.startColumn,
492
+ endLineNumber: m.endLineNumber,
493
+ endColumn: m.endColumn,
494
+ message: m.message,
495
+ severity: m.severity
433
496
  }));
434
- n.editor.setModelMarkers(m, "owner", v);
497
+ c.editor.setModelMarkers(h, "owner", y);
435
498
  }
436
499
  }
437
500
  }
438
501
  }),
439
502
  []
440
503
  );
441
- const Q = Me(
504
+ const J = Te(
442
505
  () => ({
443
- format: () => o.current?.getAction("editor.action.formatDocument")?.run(),
444
- undo: () => o.current?.trigger("keyboard", "undo", null),
445
- redo: () => o.current?.trigger("keyboard", "redo", null),
446
- find: () => o.current?.getAction("editor.action.startFindReplaceAction")?.run(),
506
+ format: () => a.current?.getAction("editor.action.formatDocument")?.run(),
507
+ undo: () => a.current?.trigger("keyboard", "undo", null),
508
+ redo: () => a.current?.trigger("keyboard", "redo", null),
509
+ find: () => a.current?.getAction("editor.action.startFindReplaceAction")?.run(),
447
510
  toggleWordWrap: () => {
448
- const e = !le;
449
- je(e), o.current?.updateOptions({ wordWrap: e ? "on" : "off" });
511
+ const e = !pe;
512
+ Be(e), a.current?.updateOptions({ wordWrap: e ? "on" : "off" });
450
513
  },
451
514
  toggleMinimap: () => {
452
- const e = o.current?.getOption?.(
453
- w.current?.editor?.EditorOption?.minimap
515
+ const e = a.current?.getOption?.(
516
+ N.current?.editor?.EditorOption?.minimap
454
517
  );
455
- o.current?.updateOptions({ minimap: { enabled: !e?.enabled } });
518
+ a.current?.updateOptions({ minimap: { enabled: !e?.enabled } });
456
519
  },
457
- foldAll: () => o.current?.getAction("editor.foldAll")?.run(),
458
- unfoldAll: () => o.current?.getAction("editor.unfoldAll")?.run()
520
+ foldAll: () => a.current?.getAction("editor.foldAll")?.run(),
521
+ unfoldAll: () => a.current?.getAction("editor.unfoldAll")?.run()
459
522
  }),
460
- [le]
461
- ), $e = N.split(`
462
- `).length, He = N.length;
463
- return /* @__PURE__ */ P(
523
+ [pe]
524
+ ), Ke = _.split(`
525
+ `).length, qe = _.length;
526
+ return /* @__PURE__ */ W(
464
527
  "div",
465
528
  {
466
- className: `nice-code-editor-wrap nice-editor--${Y} ${G ?? ""}`,
467
- style: { height: re, width: U, display: "flex", flexDirection: "column", position: "relative" },
468
- "data-testid": F,
529
+ className: `nice-code-editor-wrap nice-editor--${K} ${Z ?? ""}`,
530
+ style: { height: B, width: M, display: "flex", flexDirection: "column", position: "relative" },
531
+ "data-testid": q,
469
532
  children: [
470
- /* @__PURE__ */ t("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 20 }, children: /* @__PURE__ */ t(Ze, { steps: Ge(ee, nt) }) }),
471
- de && /* @__PURE__ */ P(
533
+ /* @__PURE__ */ o("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 20 }, children: /* @__PURE__ */ o(tt, { steps: rt(G, at) }) }),
534
+ ne && /* @__PURE__ */ W(
472
535
  "div",
473
536
  {
474
537
  className: "nice-code-editor__error",
@@ -479,24 +542,24 @@ const ut = /* @__PURE__ */ Xe(
479
542
  background: "var(--nice-bg-primary, #fff)"
480
543
  },
481
544
  children: [
482
- /* @__PURE__ */ P("span", { children: [
483
- /* @__PURE__ */ t(M, { name: "warning", size: 16 }),
545
+ /* @__PURE__ */ W("span", { children: [
546
+ /* @__PURE__ */ o(O, { name: "warning", size: 16 }),
484
547
  " ",
485
- de
548
+ ne
486
549
  ] }),
487
- /* @__PURE__ */ t(
550
+ /* @__PURE__ */ o(
488
551
  "textarea",
489
552
  {
490
- value: N,
491
- onChange: (e) => $(e.target.value),
492
- readOnly: V || c.readOnly,
553
+ value: _,
554
+ onChange: (e) => X(e.target.value),
555
+ readOnly: $ || n.readOnly,
493
556
  style: { width: "100%", height: "100%", fontFamily: "monospace" }
494
557
  }
495
558
  )
496
559
  ]
497
560
  }
498
561
  ),
499
- J && !de && /* @__PURE__ */ t(
562
+ T && !ne && /* @__PURE__ */ o(
500
563
  "div",
501
564
  {
502
565
  className: "nice-code-editor__loader-overlay",
@@ -509,108 +572,108 @@ const ut = /* @__PURE__ */ Xe(
509
572
  justifyContent: "center",
510
573
  background: "var(--nice-bg-primary, #fff)"
511
574
  },
512
- children: W ?? /* @__PURE__ */ t("div", { className: "nice-code-editor__loader", children: r("codeEditor.loadingEditor", "Loading editor...") })
575
+ children: V ?? /* @__PURE__ */ o("div", { className: "nice-code-editor__loader", children: t("codeEditor.loadingEditor", "Loading editor...") })
513
576
  }
514
577
  ),
515
- Z && /* @__PURE__ */ P("div", { className: "nice-code-editor__toolbar", children: [
516
- /* @__PURE__ */ t(
578
+ Q && /* @__PURE__ */ W("div", { className: "nice-code-editor__toolbar", children: [
579
+ /* @__PURE__ */ o(
517
580
  "button",
518
581
  {
519
582
  className: "nice-code-editor__toolbar-btn",
520
- onClick: Q.undo,
521
- title: r("codeEditor.undoCtrlZ", "Undo (Ctrl+Z)"),
522
- "aria-label": r("codeEditor.undo", "Undo"),
523
- children: /* @__PURE__ */ t(M, { name: "reply", size: 16 })
583
+ onClick: J.undo,
584
+ title: t("codeEditor.undoCtrlZ", "Undo (Ctrl+Z)"),
585
+ "aria-label": t("codeEditor.undo", "Undo"),
586
+ children: /* @__PURE__ */ o(O, { name: "reply", size: 16 })
524
587
  }
525
588
  ),
526
- /* @__PURE__ */ t(
589
+ /* @__PURE__ */ o(
527
590
  "button",
528
591
  {
529
592
  className: "nice-code-editor__toolbar-btn",
530
- onClick: Q.redo,
531
- title: r("codeEditor.redoCtrlY", "Redo (Ctrl+Y)"),
532
- "aria-label": r("codeEditor.redo", "Redo"),
533
- children: /* @__PURE__ */ t(M, { name: "forward", size: 16 })
593
+ onClick: J.redo,
594
+ title: t("codeEditor.redoCtrlY", "Redo (Ctrl+Y)"),
595
+ "aria-label": t("codeEditor.redo", "Redo"),
596
+ children: /* @__PURE__ */ o(O, { name: "forward", size: 16 })
534
597
  }
535
598
  ),
536
- /* @__PURE__ */ t("span", { className: "nice-code-editor__toolbar-sep" }),
537
- /* @__PURE__ */ t(
599
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__toolbar-sep" }),
600
+ /* @__PURE__ */ o(
538
601
  "button",
539
602
  {
540
603
  className: "nice-code-editor__toolbar-btn",
541
- onClick: Q.format,
542
- title: r("codeEditor.formatShiftAltF", "Format (Shift+Alt+F)"),
543
- "aria-label": r("codeEditor.format", "Format"),
544
- children: /* @__PURE__ */ t(M, { name: "type", size: 16 })
604
+ onClick: J.format,
605
+ title: t("codeEditor.formatShiftAltF", "Format (Shift+Alt+F)"),
606
+ "aria-label": t("codeEditor.format", "Format"),
607
+ children: /* @__PURE__ */ o(O, { name: "type", size: 16 })
545
608
  }
546
609
  ),
547
- /* @__PURE__ */ t(
610
+ /* @__PURE__ */ o(
548
611
  "button",
549
612
  {
550
613
  className: "nice-code-editor__toolbar-btn",
551
- onClick: Q.find,
552
- title: r("codeEditor.findReplaceCtrlH", "Find & Replace (Ctrl+H)"),
553
- "aria-label": r("codeEditor.findReplace", "Find & Replace"),
554
- children: /* @__PURE__ */ t(M, { name: "search", size: 16 })
614
+ onClick: J.find,
615
+ title: t("codeEditor.findReplaceCtrlH", "Find & Replace (Ctrl+H)"),
616
+ "aria-label": t("codeEditor.findReplace", "Find & Replace"),
617
+ children: /* @__PURE__ */ o(O, { name: "search", size: 16 })
555
618
  }
556
619
  ),
557
- /* @__PURE__ */ t("span", { className: "nice-code-editor__toolbar-sep" }),
558
- /* @__PURE__ */ t(
620
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__toolbar-sep" }),
621
+ /* @__PURE__ */ o(
559
622
  "button",
560
623
  {
561
- className: `nice-code-editor__toolbar-btn${le ? " nice-code-editor__toolbar-btn--active" : ""}`,
562
- onClick: Q.toggleWordWrap,
563
- title: r("codeEditor.toggleWordWrap", "Toggle Word Wrap"),
564
- "aria-label": r("codeEditor.toggleWordWrap", "Toggle Word Wrap"),
565
- children: /* @__PURE__ */ t(M, { name: "align-left", size: 16 })
624
+ className: `nice-code-editor__toolbar-btn${pe ? " nice-code-editor__toolbar-btn--active" : ""}`,
625
+ onClick: J.toggleWordWrap,
626
+ title: t("codeEditor.toggleWordWrap", "Toggle Word Wrap"),
627
+ "aria-label": t("codeEditor.toggleWordWrap", "Toggle Word Wrap"),
628
+ children: /* @__PURE__ */ o(O, { name: "align-left", size: 16 })
566
629
  }
567
630
  ),
568
- /* @__PURE__ */ t(
631
+ /* @__PURE__ */ o(
569
632
  "button",
570
633
  {
571
634
  className: "nice-code-editor__toolbar-btn",
572
- onClick: Q.toggleMinimap,
573
- title: r("codeEditor.toggleMinimap", "Toggle Minimap"),
574
- "aria-label": r("codeEditor.toggleMinimap", "Toggle Minimap"),
575
- children: /* @__PURE__ */ t(M, { name: "columns", size: 16 })
635
+ onClick: J.toggleMinimap,
636
+ title: t("codeEditor.toggleMinimap", "Toggle Minimap"),
637
+ "aria-label": t("codeEditor.toggleMinimap", "Toggle Minimap"),
638
+ children: /* @__PURE__ */ o(O, { name: "columns", size: 16 })
576
639
  }
577
640
  ),
578
- /* @__PURE__ */ t("span", { className: "nice-code-editor__toolbar-sep" }),
579
- /* @__PURE__ */ t(
641
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__toolbar-sep" }),
642
+ /* @__PURE__ */ o(
580
643
  "button",
581
644
  {
582
645
  className: "nice-code-editor__toolbar-btn",
583
- onClick: Q.foldAll,
584
- title: r("codeEditor.foldAll", "Fold All"),
585
- "aria-label": r("codeEditor.foldAll", "Fold All"),
586
- children: /* @__PURE__ */ t(M, { name: "collapse", size: 16 })
646
+ onClick: J.foldAll,
647
+ title: t("codeEditor.foldAll", "Fold All"),
648
+ "aria-label": t("codeEditor.foldAll", "Fold All"),
649
+ children: /* @__PURE__ */ o(O, { name: "collapse", size: 16 })
587
650
  }
588
651
  ),
589
- /* @__PURE__ */ t(
652
+ /* @__PURE__ */ o(
590
653
  "button",
591
654
  {
592
655
  className: "nice-code-editor__toolbar-btn",
593
- onClick: Q.unfoldAll,
594
- title: r("codeEditor.unfoldAll", "Unfold All"),
595
- "aria-label": r("codeEditor.unfoldAll", "Unfold All"),
596
- children: /* @__PURE__ */ t(M, { name: "expand", size: 16 })
656
+ onClick: J.unfoldAll,
657
+ title: t("codeEditor.unfoldAll", "Unfold All"),
658
+ "aria-label": t("codeEditor.unfoldAll", "Unfold All"),
659
+ children: /* @__PURE__ */ o(O, { name: "expand", size: 16 })
597
660
  }
598
661
  )
599
662
  ] }),
600
- /* @__PURE__ */ t("div", { ref: b, className: "nice-code-editor", style: { flex: 1, minHeight: 0 } }),
601
- j && /* @__PURE__ */ P("div", { className: "nice-code-editor__statusbar", children: [
602
- /* @__PURE__ */ t("span", { children: r("codeEditor.lnCol", "Ln {lineNumber}, Col {column}").replace("{lineNumber}", String(ye.lineNumber)).replace("{column}", String(ye.column)) }),
603
- Ce.length > 0 && /* @__PURE__ */ t("span", { children: r("codeEditor.selected", "({selectionText} selected)").replace(
663
+ /* @__PURE__ */ o("div", { ref: g, className: "nice-code-editor", style: { flex: 1, minHeight: 0 } }),
664
+ j && /* @__PURE__ */ W("div", { className: "nice-code-editor__statusbar", children: [
665
+ /* @__PURE__ */ o("span", { children: t("codeEditor.lnCol", "Ln {lineNumber}, Col {column}").replace("{lineNumber}", String(xe.lineNumber)).replace("{column}", String(xe.column)) }),
666
+ we.length > 0 && /* @__PURE__ */ o("span", { children: t("codeEditor.selected", "({selectionText} selected)").replace(
604
667
  "{selectionText}",
605
- String(Ce.length)
668
+ String(we.length)
606
669
  ) }),
607
- /* @__PURE__ */ t("span", { className: "nice-code-editor__statusbar-spacer" }),
608
- /* @__PURE__ */ t("span", { children: r("codeEditor.linesChars", "{lineCount} lines · {charCount} chars").replace("{lineCount}", String($e)).replace("{charCount}", String(He)) }),
609
- /* @__PURE__ */ t("span", { className: "nice-code-editor__statusbar-lang", children: f }),
610
- D.length > 0 && /* @__PURE__ */ P("span", { className: "nice-code-editor__statusbar-markers", children: [
611
- /* @__PURE__ */ t(M, { name: "warning", size: 14 }),
670
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__statusbar-spacer" }),
671
+ /* @__PURE__ */ o("span", { children: t("codeEditor.linesChars", "{lineCount} lines · {charCount} chars").replace("{lineCount}", String(Ke)).replace("{charCount}", String(qe)) }),
672
+ /* @__PURE__ */ o("span", { className: "nice-code-editor__statusbar-lang", children: p }),
673
+ L.length > 0 && /* @__PURE__ */ W("span", { className: "nice-code-editor__statusbar-markers", children: [
674
+ /* @__PURE__ */ o(O, { name: "warning", size: 14 }),
612
675
  " ",
613
- D.length
676
+ L.length
614
677
  ] })
615
678
  ] })
616
679
  ]
@@ -618,120 +681,112 @@ const ut = /* @__PURE__ */ Xe(
618
681
  );
619
682
  }
620
683
  );
621
- function mt(a) {
622
- const { t: d } = fe();
623
- he(be, ve);
684
+ function yt(r) {
685
+ const { t: i } = ke();
686
+ ye(ve, Ce);
624
687
  const {
625
- original: g,
626
- defaultOriginal: r,
627
- modified: y,
628
- defaultModified: B,
629
- language: A = "plaintext",
630
- theme: f = "auto",
631
- height: x = 400,
632
- width: c = "100%",
633
- inline: re = !1,
634
- renderSideBySide: U = !0,
635
- originalEditable: D = !1,
636
- modifiedEditable: K = !1,
637
- onOriginalChange: h,
688
+ original: d,
689
+ defaultOriginal: t,
690
+ modified: u,
691
+ defaultModified: C,
692
+ language: x = "plaintext",
693
+ theme: p = "auto",
694
+ height: b = 400,
695
+ width: n = "100%",
696
+ inline: B = !1,
697
+ renderSideBySide: M = !0,
698
+ originalEditable: L = !1,
699
+ modifiedEditable: R = !1,
700
+ onOriginalChange: f,
638
701
  onModifiedChange: z,
639
702
  loading: E,
640
- className: L,
641
- "data-testid": q
642
- } = a, [W, V, Z] = ae({
643
- value: g,
644
- defaultValue: r,
703
+ className: I,
704
+ "data-testid": U
705
+ } = r, [V, $, Q] = de({
706
+ value: d,
707
+ defaultValue: t,
645
708
  fallbackValue: "",
646
- onChange: h,
709
+ onChange: f,
647
710
  componentName: "NiceCodeDiffEditor.original"
648
- }), [j, Y, G] = ae({
649
- value: y,
650
- defaultValue: B,
711
+ }), [j, K, Z] = de({
712
+ value: u,
713
+ defaultValue: C,
651
714
  fallbackValue: "",
652
715
  onChange: z,
653
716
  componentName: "NiceCodeDiffEditor.modified"
654
- }), F = k({ currentOriginal: W, currentModified: j, setOriginal: V, setModified: Y });
655
- F.current = { currentOriginal: W, currentModified: j, setOriginal: V, setModified: Y };
656
- const O = k(!1), S = k(null);
657
- De(S);
658
- const ee = k(null), N = k(null), [$, l] = I(!0), [u, C] = I(null);
659
- return _(() => {
660
- if (!S.current)
717
+ }), q = v({ currentOriginal: V, currentModified: j, setOriginal: $, setModified: K });
718
+ q.current = { currentOriginal: V, currentModified: j, setOriginal: $, setModified: K };
719
+ const P = v(!1), w = v(null);
720
+ $e(w);
721
+ const G = v(null), _ = v(null), [X, ee] = D(!0), [Y, k] = D(null);
722
+ return S(() => {
723
+ if (!w.current)
661
724
  return;
662
- let p = !0;
663
- return Ae().then((b) => {
664
- if (!p || !S.current)
725
+ let l = !0;
726
+ return Ve().then((g) => {
727
+ if (!l || !w.current)
665
728
  return;
666
- N.current = b;
667
- const { currentOriginal: o, currentModified: w } = F.current, T = b.editor.createModel(o, A), H = b.editor.createModel(w, A), J = b.editor.createDiffEditor(S.current, {
729
+ _.current = g;
730
+ const { currentOriginal: a, currentModified: N } = q.current, F = g.editor.createModel(a, x), H = g.editor.createModel(N, x), T = g.editor.createDiffEditor(w.current, {
668
731
  automaticLayout: !0,
669
- theme: ne(f),
670
- renderSideBySide: !re && U,
671
- originalEditable: D,
672
- readOnly: !K
732
+ theme: se(p),
733
+ renderSideBySide: !B && M,
734
+ originalEditable: L,
735
+ readOnly: !R
673
736
  });
674
- J.setModel({
675
- original: T,
737
+ T.setModel({
738
+ original: F,
676
739
  modified: H
677
- }), ee.current = J, l(!1), D && T.onDidChangeContent(() => {
678
- O.current || F.current.setOriginal(T.getValue());
679
- }), K && H.onDidChangeContent(() => {
680
- O.current || F.current.setModified(H.getValue());
740
+ }), G.current = T, ee(!1), L && F.onDidChangeContent(() => {
741
+ P.current || q.current.setOriginal(F.getValue());
742
+ }), R && H.onDidChangeContent(() => {
743
+ P.current || q.current.setModified(H.getValue());
681
744
  });
682
- }).catch((b) => {
683
- p && (C(
684
- b.message ?? d("codeEditor.failedToLoadDiffEditor", "Failed to load diff editor")
685
- ), l(!1));
745
+ }).catch((g) => {
746
+ l && (k(
747
+ g.message ?? i("codeEditor.failedToLoadDiffEditor", "Failed to load diff editor")
748
+ ), ee(!1));
686
749
  }), () => {
687
- p = !1, ee.current?.dispose();
750
+ l = !1, G.current?.dispose();
688
751
  };
689
- }, [d]), _(() => {
690
- const p = ee.current?.getModel();
691
- if (p) {
692
- O.current = !0;
752
+ }, [i]), S(() => {
753
+ const l = G.current?.getModel();
754
+ if (l) {
755
+ P.current = !0;
693
756
  try {
694
- Z && p.original.getValue() !== W && p.original.setValue(W), G && p.modified.getValue() !== j && p.modified.setValue(j);
757
+ Q && l.original.getValue() !== V && l.original.setValue(V), Z && l.modified.getValue() !== j && l.modified.setValue(j);
695
758
  } finally {
696
- O.current = !1;
759
+ P.current = !1;
697
760
  }
698
761
  }
699
- }, [W, j, Z, G]), _(() => {
700
- const p = N.current;
701
- if (!p || (p.editor.setTheme(ne(f)), f !== "auto" || typeof document > "u"))
702
- return;
703
- const b = () => {
704
- N.current?.editor.setTheme(ne("auto"));
705
- }, o = new MutationObserver(b);
706
- o.observe(document.documentElement, {
707
- attributes: !0,
708
- attributeFilter: ["data-theme", "class"]
709
- });
710
- const w = window.matchMedia?.("(prefers-color-scheme: dark)");
711
- return w?.addEventListener?.("change", b), () => {
712
- o.disconnect(), w?.removeEventListener?.("change", b);
713
- };
714
- }, [f, $]), u ? /* @__PURE__ */ t(
762
+ }, [V, j, Q, Z]), S(() => {
763
+ const l = _.current;
764
+ if (l && (l.editor.setTheme(le(l, p, w.current)), !(p !== "auto" || typeof document > "u")))
765
+ return ze(w.current, () => {
766
+ const g = _.current;
767
+ g?.editor.setTheme(le(g, "auto", w.current));
768
+ });
769
+ }, [p, X]), Y ? /* @__PURE__ */ o(
715
770
  "div",
716
771
  {
717
- className: `nice-code-diff-editor nice-code-diff-editor--error ${L ?? ""}`,
718
- style: { height: x, width: c },
719
- "data-testid": q,
720
- children: /* @__PURE__ */ t("div", { className: "nice-code-editor__error", children: /* @__PURE__ */ P("span", { children: [
721
- /* @__PURE__ */ t(M, { name: "warning", size: 16 }),
772
+ className: `nice-code-diff-editor nice-code-diff-editor--error ${I ?? ""}`,
773
+ style: { height: b, width: n },
774
+ "data-testid": U,
775
+ children: /* @__PURE__ */ o("div", { className: "nice-code-editor__error", children: /* @__PURE__ */ W("span", { children: [
776
+ /* @__PURE__ */ o(O, { name: "warning", size: 16 }),
722
777
  " ",
723
- u
778
+ Y
724
779
  ] }) })
725
780
  }
726
- ) : /* @__PURE__ */ P(
781
+ ) : /* @__PURE__ */ W(
727
782
  "div",
728
783
  {
729
- className: `nice-code-diff-editor ${L ?? ""}`,
730
- style: { height: x, width: c, position: "relative" },
731
- "data-testid": q,
784
+ className: `nice-code-diff-editor ${I ?? ""}`,
785
+ style: { height: b, width: n, position: "relative" },
786
+ "data-testid": U,
732
787
  children: [
733
- /* @__PURE__ */ t("div", { ref: S, style: { position: "absolute", inset: 0 } }),
734
- $ && /* @__PURE__ */ t(
788
+ /* @__PURE__ */ o("div", { ref: w, style: { position: "absolute", inset: 0 } }),
789
+ X && /* @__PURE__ */ o(
735
790
  "div",
736
791
  {
737
792
  style: {
@@ -743,16 +798,16 @@ function mt(a) {
743
798
  background: "var(--nice-bg-primary, #fff)",
744
799
  zIndex: 2
745
800
  },
746
- children: E ?? /* @__PURE__ */ t("div", { className: "nice-code-editor__loader", children: d("codeEditor.loadingDiffEditor", "Loading diff editor...") })
801
+ children: E ?? /* @__PURE__ */ o("div", { className: "nice-code-editor__loader", children: i("codeEditor.loadingDiffEditor", "Loading diff editor...") })
747
802
  }
748
803
  )
749
804
  ]
750
805
  }
751
806
  );
752
807
  }
753
- const it = "1.29.0", Re = `https://cdn.jsdelivr.net/npm/prismjs@${it}`;
754
- let ue = null;
755
- const ge = {
808
+ const mt = "1.29.0", Ae = `https://cdn.jsdelivr.net/npm/prismjs@${mt}`;
809
+ let ge = null;
810
+ const he = {
756
811
  javascript: "javascript",
757
812
  typescript: "typescript",
758
813
  json: "json",
@@ -777,151 +832,136 @@ const ge = {
777
832
  powershell: "powershell",
778
833
  plaintext: "plain"
779
834
  };
780
- function se(a) {
781
- return new Promise((d, g) => {
782
- if (document.querySelector(`script[data-prism-src="${a}"]`)) {
783
- d();
835
+ function ue(r) {
836
+ return new Promise((i, d) => {
837
+ if (document.querySelector(`script[data-prism-src="${r}"]`)) {
838
+ i();
784
839
  return;
785
840
  }
786
- const r = document.createElement("script");
787
- r.src = a, r.async = !0, r.dataset.prismSrc = a, r.onload = () => d(), r.onerror = () => g(new Error(`Failed to load ${a}`)), document.head.appendChild(r);
841
+ const t = document.createElement("script");
842
+ t.src = r, t.async = !0, t.dataset.prismSrc = r, t.onload = () => i(), t.onerror = () => d(new Error(`Failed to load ${r}`)), document.head.appendChild(t);
788
843
  });
789
844
  }
790
- function ct(a) {
845
+ function pt(r) {
791
846
  if (typeof window > "u")
792
847
  return Promise.resolve(null);
793
- const d = window, g = ge[a] ?? "plain", r = async () => {
794
- if (g !== "plain" && !d.Prism?.languages?.[g])
848
+ const i = window, d = he[r] ?? "plain", t = async () => {
849
+ if (d !== "plain" && !i.Prism?.languages?.[d])
795
850
  try {
796
- await se(`${Re}/components/prism-${g}.min.js`);
851
+ await ue(`${Ae}/components/prism-${d}.min.js`);
797
852
  } catch {
798
853
  }
799
854
  };
800
- return d.Prism?.languages ? r().then(() => d.Prism) : (ue || (ue = (async () => (window.Prism = { manual: !0 }, await se(`${Re}/prism.min.js`), window.Prism))()), ue.then(async () => (await r(), window.Prism)));
855
+ return i.Prism?.languages ? t().then(() => i.Prism) : (ge || (ge = (async () => (window.Prism = { manual: !0 }, await ue(`${Ae}/prism.min.js`), window.Prism))()), ge.then(async () => (await t(), window.Prism)));
801
856
  }
802
- function me(a) {
803
- return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
857
+ function fe(r) {
858
+ return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
804
859
  }
805
- function pt(a) {
806
- he(be, ve);
860
+ function vt(r) {
861
+ ye(ve, Ce);
807
862
  const {
808
- value: d,
809
- defaultValue: g,
810
- onChange: r,
811
- language: y = "plaintext",
812
- height: B = 300,
813
- width: A = "100%",
814
- readOnly: f = !1,
815
- tabSize: x = 2,
816
- lineNumbers: c = !0,
817
- placeholder: re,
818
- theme: U = "auto",
819
- className: D,
820
- "data-testid": K
821
- } = a, [h, z] = ae({
822
- value: d,
823
- defaultValue: g,
863
+ value: i,
864
+ defaultValue: d,
865
+ onChange: t,
866
+ language: u = "plaintext",
867
+ height: C = 300,
868
+ width: x = "100%",
869
+ readOnly: p = !1,
870
+ tabSize: b = 2,
871
+ lineNumbers: n = !0,
872
+ placeholder: B,
873
+ theme: M = "auto",
874
+ className: L,
875
+ "data-testid": R
876
+ } = r, [f, z] = de({
877
+ value: i,
878
+ defaultValue: d,
824
879
  fallbackValue: "",
825
- onChange: r,
880
+ onChange: t,
826
881
  componentName: "NiceSimpleCodeEditor"
827
- }), E = k(null), L = k(null), q = k(null), { t: W } = fe(), V = tt(), [Z] = I(Pe), [j, Y] = I(() => me(h)), [G, F] = I("light");
828
- _(() => {
829
- const l = () => {
830
- if (U !== "auto")
831
- return U;
832
- if (typeof document > "u")
833
- return "light";
834
- const b = document.documentElement.dataset.theme;
835
- return b === "dark" ? "dark" : b === "light" ? "light" : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
836
- };
837
- if (F(l()), U !== "auto" || typeof document > "u")
838
- return;
839
- const u = () => F(l()), C = new MutationObserver(u);
840
- C.observe(document.documentElement, {
841
- attributes: !0,
842
- attributeFilter: ["data-theme", "class"]
843
- });
844
- const p = window.matchMedia?.("(prefers-color-scheme: dark)");
845
- return p?.addEventListener?.("change", u), () => {
846
- C.disconnect(), p?.removeEventListener?.("change", u);
847
- };
848
- }, [U]), _(() => {
849
- let l = !0;
850
- return ct(y).then((u) => {
851
- if (!l)
882
+ }), E = v(null), I = v(null), U = v(null), { t: V } = ke(), $ = ct(), [Q] = D(We), [j, K] = D(() => fe(f)), Z = v(null), [q] = D(() => ({
883
+ get current() {
884
+ return Z.current?.parentElement ?? null;
885
+ }
886
+ })), P = ot(q), w = M === "auto" ? P ? "dark" : "light" : M;
887
+ S(() => {
888
+ let k = !0;
889
+ return pt(u).then((l) => {
890
+ if (!k)
852
891
  return;
853
- const C = ge[y] ?? "plain";
854
- if (u?.languages?.[C])
892
+ const g = he[u] ?? "plain";
893
+ if (l?.languages?.[g])
855
894
  try {
856
- const p = u.highlight(h, u.languages[C], C);
857
- Y(p);
895
+ const a = l.highlight(f, l.languages[g], g);
896
+ K(a);
858
897
  return;
859
898
  } catch {
860
899
  }
861
- Y(me(h));
900
+ K(fe(f));
862
901
  }).catch(() => {
863
- l && Y(me(h));
902
+ k && K(fe(f));
864
903
  }), () => {
865
- l = !1;
904
+ k = !1;
866
905
  };
867
- }, [h, y]);
868
- const O = Le(() => {
869
- if (!L.current || !E.current)
906
+ }, [f, u]);
907
+ const G = Oe(() => {
908
+ if (!I.current || !E.current)
870
909
  return;
871
- L.current.scrollTop = E.current.scrollTop, L.current.scrollLeft = E.current.scrollLeft;
872
- const l = q.current;
873
- if (l) {
874
- const u = E.current.offsetHeight - E.current.clientHeight;
875
- l.style.paddingBottom = `calc(var(--nice-space-2, 8px) + ${u}px)`, l.scrollTop = E.current.scrollTop;
910
+ I.current.scrollTop = E.current.scrollTop, I.current.scrollLeft = E.current.scrollLeft;
911
+ const k = U.current;
912
+ if (k) {
913
+ const l = E.current.offsetHeight - E.current.clientHeight;
914
+ k.style.paddingBottom = `calc(var(--nice-space-2, 8px) + ${l}px)`, k.scrollTop = E.current.scrollTop;
876
915
  }
877
- }, []), S = Le(
878
- (l) => {
879
- if (!Z(l) && l.key === "Tab" && !f) {
880
- l.preventDefault();
881
- const u = l.currentTarget, C = u.selectionStart, p = u.selectionEnd, b = " ".repeat(x);
882
- if (l.shiftKey) {
883
- const T = h.substring(0, C).lastIndexOf(`
916
+ }, []), _ = Oe(
917
+ (k) => {
918
+ if (!Q(k) && k.key === "Tab" && !p) {
919
+ k.preventDefault();
920
+ const l = k.currentTarget, g = l.selectionStart, a = l.selectionEnd, N = " ".repeat(b);
921
+ if (k.shiftKey) {
922
+ const T = f.substring(0, g).lastIndexOf(`
884
923
  `) + 1;
885
- if ((h.substring(T, C).match(/^(\s*)/)?.[1] ?? "").length >= x) {
886
- const J = h.substring(0, T) + h.substring(T + x);
887
- z(J), setTimeout(() => {
888
- u.selectionStart = u.selectionEnd = C - x;
924
+ if ((f.substring(T, g).match(/^(\s*)/)?.[1] ?? "").length >= b) {
925
+ const ne = f.substring(0, T) + f.substring(T + b);
926
+ z(ne), setTimeout(() => {
927
+ l.selectionStart = l.selectionEnd = g - b;
889
928
  }, 0);
890
929
  }
891
930
  } else {
892
- const o = h.substring(0, C) + b + h.substring(p);
893
- z(o), setTimeout(() => {
894
- u.selectionStart = u.selectionEnd = C + x;
931
+ const F = f.substring(0, g) + N + f.substring(a);
932
+ z(F), setTimeout(() => {
933
+ l.selectionStart = l.selectionEnd = g + b;
895
934
  }, 0);
896
935
  }
897
936
  }
898
937
  },
899
- [h, z, x, Z, f]
900
- ), N = h.split(`
901
- `).length, $ = ge[y] ?? "plain";
902
- return /* @__PURE__ */ P(
938
+ [f, z, b, Q, p]
939
+ ), ee = f.split(`
940
+ `).length, Y = he[u] ?? "plain";
941
+ return /* @__PURE__ */ W(
903
942
  "div",
904
943
  {
905
- className: `nice-simple-code-editor nice-simple-code-editor--${G} ${D ?? ""}`,
906
- style: { height: B, width: A },
907
- "data-testid": K,
908
- "data-language": y,
909
- "data-theme": G,
944
+ ref: Z,
945
+ className: `nice-simple-code-editor nice-simple-code-editor--${w}${M === "auto" ? " nice-simple-code-editor--auto" : ""} ${L ?? ""}`,
946
+ style: { height: C, width: x },
947
+ "data-testid": R,
948
+ "data-language": u,
949
+ "data-theme": w,
910
950
  children: [
911
- c && /* @__PURE__ */ t("div", { ref: q, className: "nice-simple-code-editor__line-numbers", children: Array.from({ length: N }, (l, u) => /* @__PURE__ */ t("div", { className: "nice-simple-code-editor__line-number", children: u + 1 }, u)) }),
912
- /* @__PURE__ */ P("div", { className: "nice-simple-code-editor__editor-area", children: [
913
- /* @__PURE__ */ t(
951
+ n && /* @__PURE__ */ o("div", { ref: U, className: "nice-simple-code-editor__line-numbers", children: Array.from({ length: ee }, (k, l) => /* @__PURE__ */ o("div", { className: "nice-simple-code-editor__line-number", children: l + 1 }, l)) }),
952
+ /* @__PURE__ */ W("div", { className: "nice-simple-code-editor__editor-area", children: [
953
+ /* @__PURE__ */ o(
914
954
  "pre",
915
955
  {
916
- ref: L,
956
+ ref: I,
917
957
  "aria-hidden": "true",
918
- className: `nice-simple-code-editor__highlight language-${$}`,
919
- children: /* @__PURE__ */ t(
958
+ className: `nice-simple-code-editor__highlight language-${Y}`,
959
+ children: /* @__PURE__ */ o(
920
960
  "code",
921
961
  {
922
- className: `language-${$}`,
962
+ className: `language-${Y}`,
923
963
  dangerouslySetInnerHTML: {
924
- __html: j + (h.endsWith(`
964
+ __html: j + (f.endsWith(`
925
965
  `) ? `
926
966
  ` : "")
927
967
  }
@@ -929,30 +969,30 @@ function pt(a) {
929
969
  )
930
970
  }
931
971
  ),
932
- /* @__PURE__ */ t(
972
+ /* @__PURE__ */ o(
933
973
  "textarea",
934
974
  {
935
975
  ref: E,
936
976
  className: "nice-simple-code-editor__textarea",
937
- value: h,
938
- onChange: (l) => z(l.target.value),
939
- onKeyDown: S,
940
- onScroll: O,
941
- readOnly: f,
942
- placeholder: re,
977
+ value: f,
978
+ onChange: (k) => z(k.target.value),
979
+ onKeyDown: _,
980
+ onScroll: G,
981
+ readOnly: p,
982
+ placeholder: B,
943
983
  spellCheck: !1,
944
984
  autoCapitalize: "off",
945
985
  autoCorrect: "off",
946
- "aria-describedby": f ? void 0 : V
986
+ "aria-describedby": p ? void 0 : $
947
987
  }
948
988
  ),
949
- !f && /* @__PURE__ */ t("span", { id: V, className: "nice-sr-only", children: W("input.tabEscapeHint", "Tab indents. To leave the editor, press Escape, then Tab.") })
989
+ !p && /* @__PURE__ */ o("span", { id: $, className: "nice-sr-only", children: V("input.tabEscapeHint", "Tab indents. To leave the editor, press Escape, then Tab.") })
950
990
  ] })
951
991
  ]
952
992
  }
953
993
  );
954
994
  }
955
- const be = "nice-code-editor-styles", ve = `
995
+ const ve = "nice-code-editor-styles", Ce = `
956
996
  .nice-code-editor,
957
997
  .nice-code-diff-editor {
958
998
  border: 1px solid var(--nice-border, #e0e0e0);
@@ -1074,6 +1114,27 @@ const be = "nice-code-editor-styles", ve = `
1074
1114
  color: var(--nice-text-muted, #858585);
1075
1115
  -webkit-text-fill-color: var(--nice-text-muted, #858585);
1076
1116
  }
1117
+ /* theme="auto": the page's theme colours in both light and dark (R43) — the --dark rules above
1118
+ are for an explicit theme="dark" on a light page */
1119
+ .nice-simple-code-editor--auto.nice-simple-code-editor--dark {
1120
+ background: var(--nice-bg-primary);
1121
+ color: var(--nice-text-primary);
1122
+ }
1123
+ .nice-simple-code-editor--auto.nice-simple-code-editor--dark .nice-simple-code-editor__line-numbers {
1124
+ background: var(--nice-bg-secondary);
1125
+ border-right-color: var(--nice-border-color);
1126
+ color: var(--nice-text-secondary);
1127
+ }
1128
+ .nice-simple-code-editor--auto.nice-simple-code-editor--dark .nice-simple-code-editor__textarea {
1129
+ caret-color: var(--nice-text-primary);
1130
+ }
1131
+ .nice-simple-code-editor--auto.nice-simple-code-editor--dark .nice-simple-code-editor__textarea::placeholder {
1132
+ color: var(--nice-text-secondary);
1133
+ -webkit-text-fill-color: var(--nice-text-secondary);
1134
+ }
1135
+ .nice-simple-code-editor--auto.nice-simple-code-editor--dark .token.punctuation {
1136
+ color: var(--nice-text-primary);
1137
+ }
1077
1138
 
1078
1139
  /* Prism token colors — light */
1079
1140
  .nice-simple-code-editor .token.comment,
@@ -1216,7 +1277,7 @@ const be = "nice-code-editor-styles", ve = `
1216
1277
  }
1217
1278
  `;
1218
1279
  export {
1219
- mt as NiceCodeDiffEditor,
1220
- ut as NiceCodeEditor,
1221
- pt as NiceSimpleCodeEditor
1280
+ yt as NiceCodeDiffEditor,
1281
+ kt as NiceCodeEditor,
1282
+ vt as NiceSimpleCodeEditor
1222
1283
  };