@nice2dev/ui 1.2.2 → 1.3.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +474 -0
  2. package/dist/NiceButton-CnAIqCbd.js +101 -0
  3. package/dist/NiceButton-DzCqkG5a.cjs +1 -0
  4. package/dist/NiceCodeEditor-CK6B54mu.js +1215 -0
  5. package/dist/NiceCodeEditor-bJReZPDO.cjs +268 -0
  6. package/dist/NiceColorPicker-BV3olE3M.cjs +1 -0
  7. package/dist/NiceColorPicker-CyY-4q89.js +552 -0
  8. package/dist/NiceDataGrid-BQIqitMM.cjs +10 -0
  9. package/dist/NiceDataGrid-C1eI6Pso.js +2267 -0
  10. package/dist/NiceDataGrid-Cs4vOOTE.js +2267 -0
  11. package/dist/NiceDataGrid-jZvzaCv3.cjs +10 -0
  12. package/dist/NiceForm-CfAPcXdX.cjs +1 -0
  13. package/dist/NiceForm-DYcrWaN1.js +5017 -0
  14. package/dist/NiceForm-DfKYNQti.js +5017 -0
  15. package/dist/NiceForm-ZzfYumoR.cjs +1 -0
  16. package/dist/NiceGantt-TEXbAELi.js +333 -0
  17. package/dist/NiceGantt-s2cgt5zD.cjs +1 -0
  18. package/dist/NiceHtmlEditor-CDZeF_zG.cjs +10 -0
  19. package/dist/NiceHtmlEditor-CdWgddg3.js +901 -0
  20. package/dist/NiceLoginForm-DRPldHXa.js +808 -0
  21. package/dist/NiceLoginForm-IGLUCQUE.cjs +1 -0
  22. package/dist/NiceMention-CgDp0sl9.cjs +430 -0
  23. package/dist/NiceMention-DBvFvx71.js +11653 -0
  24. package/dist/NiceMention-VhH0Dllr.cjs +430 -0
  25. package/dist/NiceMention-cOqXnI0M.js +11653 -0
  26. package/dist/NiceMention.css +1 -1
  27. package/dist/NiceModal-BlYhFDhP.js +80 -0
  28. package/dist/NiceModal-DmWz2PDM.cjs +1 -0
  29. package/dist/NiceModuleLifecyclePanel-BWUYyWfY.cjs +1 -0
  30. package/dist/NiceModuleLifecyclePanel-BdcJATGF.js +7190 -0
  31. package/dist/NiceModuleLifecyclePanel-D8EoXqBy.cjs +1 -0
  32. package/dist/NiceModuleLifecyclePanel-SN6G7t64.js +7189 -0
  33. package/dist/NiceModuleLifecyclePanel.css +1 -1
  34. package/dist/NicePagination-BJS65foT.js +200 -0
  35. package/dist/NicePagination-D_3GfWp5.cjs +1 -0
  36. package/dist/NicePivotGrid-D_kRF1Dt.js +1180 -0
  37. package/dist/NicePivotGrid-DqluEkCI.cjs +152 -0
  38. package/dist/NiceSavedQueryPanel-C2Tn1cMW.js +5311 -0
  39. package/dist/NiceSavedQueryPanel-Cs_dypgU.js +5311 -0
  40. package/dist/NiceSavedQueryPanel-DDKtL1AA.cjs +586 -0
  41. package/dist/NiceSavedQueryPanel-DTSOHW2v.cjs +586 -0
  42. package/dist/NiceScheduler-BmHcJLBe.cjs +5 -0
  43. package/dist/NiceScheduler-DI2sg3Rr.js +1710 -0
  44. package/dist/NiceScheduler-GJLvkXJ3.cjs +5 -0
  45. package/dist/NiceScheduler-UT49u2Vq.js +1710 -0
  46. package/dist/NiceSelect-CdUHd8rj.cjs +1 -0
  47. package/dist/NiceSelect-fOelG_QB.js +495 -0
  48. package/dist/NiceWindow-CqSsTjrS.cjs +1 -0
  49. package/dist/NiceWindow-DZLPhXbR.js +2223 -0
  50. package/dist/charts-BYQwl_GS.js +4789 -0
  51. package/dist/charts-C6iOu0H6.cjs +768 -0
  52. package/dist/charts.cjs +1 -1
  53. package/dist/charts.d.ts +1 -1
  54. package/dist/charts.mjs +1 -1
  55. package/dist/core-lazy-B_laOXNf.cjs +1 -0
  56. package/dist/core-lazy-BpbIO1EN.cjs +1 -0
  57. package/dist/core-lazy-L7MVTPp1.js +351 -0
  58. package/dist/core-lazy-VQEjdz0L.js +351 -0
  59. package/dist/data-branching-7rpktFJ-.cjs +1 -0
  60. package/dist/data-branching-BS0aFUMu.js +6428 -0
  61. package/dist/data-branching.cjs +1 -1
  62. package/dist/data-branching.mjs +1 -1
  63. package/dist/data.cjs +1 -1
  64. package/dist/data.mjs +3 -3
  65. package/dist/devops-CFytAJQr.cjs +18 -0
  66. package/dist/devops-CW8YY_zA.js +9122 -0
  67. package/dist/devops.cjs +1 -1
  68. package/dist/devops.css +1 -0
  69. package/dist/devops.mjs +5 -5
  70. package/dist/editors.cjs +1 -1
  71. package/dist/editors.mjs +8 -8
  72. package/dist/feedback.cjs +1 -1
  73. package/dist/feedback.d.ts +21 -16
  74. package/dist/feedback.mjs +3 -3
  75. package/dist/index.cjs +262 -257
  76. package/dist/index.css +1 -1
  77. package/dist/index.d.ts +402 -27
  78. package/dist/index.mjs +21437 -20148
  79. package/dist/lazy.cjs +1 -1
  80. package/dist/lazy.mjs +24 -24
  81. package/dist/navigation.cjs +1 -1
  82. package/dist/navigation.d.ts +50 -7
  83. package/dist/navigation.mjs +404 -354
  84. package/dist/no-code-BaAI_sJR.js +8318 -0
  85. package/dist/no-code-oQTeAtnW.cjs +331 -0
  86. package/dist/no-code.cjs +1 -1
  87. package/dist/no-code.mjs +1 -1
  88. package/dist/overlays.cjs +1 -1
  89. package/dist/overlays.d.ts +5 -0
  90. package/dist/overlays.mjs +1 -1
  91. package/dist/pickerCommons-BQi6IEAt.js +661 -0
  92. package/dist/pickerCommons-CUGHOWyc.cjs +1 -0
  93. package/dist/pickerCommons-D-dwdCBZ.js +659 -0
  94. package/dist/pickerCommons-DvQptSPX.cjs +1 -0
  95. package/dist/pickerCommons.css +1 -1
  96. package/dist/style.css +8 -5
  97. package/package.json +4 -3
@@ -0,0 +1,1215 @@
1
+ import { jsxs as A, jsx as t } from "react/jsx-runtime";
2
+ import { useNiceTranslation as fe, useControllableState as ae, NiceTutorialButton as Ze, resolveTutorial as Ge, NiceIcon as L, createTabEscape as Pe } from "@nice2dev/ui-core";
3
+ import { forwardRef as Xe, useRef as y, useState as D, useMemo as Me, useEffect as N, useImperativeHandle as et, useId as tt, useCallback as Le } from "react";
4
+ import { i as he } from "./injectStyleOnce-BzC_BCs_.js";
5
+ const nt = [
6
+ {
7
+ target: ".nice-code-editor-wrap",
8
+ titleKey: "tutorial.codeEditor.intro.title",
9
+ title: "Code editor",
10
+ contentKey: "tutorial.codeEditor.intro.content",
11
+ content: "Edit code with syntax highlighting, IntelliSense and the toolbar. Ctrl+S saves; the status bar shows the cursor position and any problems.",
12
+ placement: "auto"
13
+ }
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)
20
+ return;
21
+ const d = `self.MonacoEnvironment={baseUrl:'${Ie}/'};importScripts('${pe}/base/worker/workerMain.js');`, m = URL.createObjectURL(new Blob([d], { type: "text/javascript" }));
22
+ a.MonacoEnvironment = {
23
+ getWorkerUrl: () => m
24
+ };
25
+ }
26
+ function ne(a) {
27
+ if (a !== "auto")
28
+ return a;
29
+ if (typeof document > "u")
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";
33
+ }
34
+ function ot(a) {
35
+ if (!a)
36
+ return "";
37
+ try {
38
+ return JSON.stringify([a.url, a.language, a.initOptions ?? null]);
39
+ } catch {
40
+ return JSON.stringify([a.url, a.language]);
41
+ }
42
+ }
43
+ function Ae() {
44
+ return ie ? Promise.resolve(ie) : te || (te = new Promise((a, d) => {
45
+ if (window.monaco) {
46
+ Te(), ie = window.monaco, a(ie);
47
+ return;
48
+ }
49
+ let m = !1;
50
+ const r = window.setTimeout(() => {
51
+ m || (m = !0, te = null, d(new Error(`Monaco editor failed to load within ${Oe}ms`)));
52
+ }, Oe), C = document.createElement("script");
53
+ C.src = `${pe}/loader.min.js`, C.async = !0, C.onload = () => {
54
+ const $ = window.require;
55
+ $.config({ paths: { vs: pe } }), Te(), $(["vs/editor/editor.main"], (z) => {
56
+ m || (m = !0, window.clearTimeout(r), ie = z, a(z));
57
+ });
58
+ }, C.onerror = () => {
59
+ m || (m = !0, window.clearTimeout(r), te = null, d(new Error("Failed to load Monaco Editor loader script")));
60
+ }, document.head.appendChild(C);
61
+ }), te);
62
+ }
63
+ function De(a) {
64
+ N(() => {
65
+ const d = a.current;
66
+ if (!d)
67
+ return;
68
+ const m = Pe(), r = (C) => {
69
+ m(C) && C.stopPropagation();
70
+ };
71
+ return d.addEventListener("keydown", r, !0), () => d.removeEventListener("keydown", r, !0);
72
+ }, [a]);
73
+ }
74
+ const ut = /* @__PURE__ */ Xe(
75
+ function(d, m) {
76
+ const { t: r } = fe();
77
+ he(be, ve);
78
+ const {
79
+ value: C,
80
+ defaultValue: $,
81
+ onChange: z,
82
+ language: g = "plaintext",
83
+ theme: _ = "auto",
84
+ options: c = {},
85
+ height: re = 400,
86
+ width: U = "100%",
87
+ markers: W = [],
88
+ decorations: B = [],
89
+ completionProvider: f,
90
+ onMount: V,
91
+ onCursorPositionChange: j,
92
+ onSelectionChange: O,
93
+ onSave: q,
94
+ loading: T,
95
+ disabled: F = !1,
96
+ showToolbar: X = !1,
97
+ showStatusBar: E = !1,
98
+ editorSize: Y = "standard",
99
+ className: J,
100
+ "data-testid": H,
101
+ lsp: R,
102
+ extraLibs: S,
103
+ tutorial: Q
104
+ } = d, [x, p, u] = ae({
105
+ value: C,
106
+ defaultValue: $,
107
+ fallbackValue: "",
108
+ onChange: z,
109
+ componentName: "NiceCodeEditor"
110
+ }), w = y(p);
111
+ w.current = p;
112
+ const M = y(x);
113
+ M.current = x;
114
+ const h = y(!1), v = y(null);
115
+ De(v);
116
+ const o = y(null), k = y(null), Z = y([]), P = y(null), [ee, ke] = D(!0), [de, ze] = D(null), [ye, We] = D({
117
+ lineNumber: 1,
118
+ column: 1
119
+ }), [Ce, Ve] = D(""), [le, je] = D(c.wordWrap === "on"), ce = Me(() => ({
120
+ automaticLayout: !0,
121
+ readOnly: F || 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 ?? {
144
+ bracketPairs: !0,
145
+ indentation: !0,
146
+ highlightActiveIndentation: !0
147
+ },
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, F]), oe = y({ onCursorPositionChange: j, onSelectionChange: O, onSave: q, onMount: V });
154
+ oe.current = { onCursorPositionChange: j, onSelectionChange: O, onSave: q, onMount: V };
155
+ const we = y({ language: g, theme: _, editorOptions: ce });
156
+ we.current = { language: g, theme: _, editorOptions: ce };
157
+ const _e = y(R);
158
+ _e.current = R;
159
+ const Fe = ot(R), xe = y(r);
160
+ xe.current = r, N(() => {
161
+ if (!v.current)
162
+ return;
163
+ let e = !0;
164
+ const i = _e.current;
165
+ return Ae().then(async (n) => {
166
+ if (!e || !v.current)
167
+ return;
168
+ k.current = n;
169
+ const l = we.current, b = n.editor.create(v.current, {
170
+ value: M.current,
171
+ language: l.language,
172
+ theme: ne(l.theme),
173
+ ...l.editorOptions
174
+ });
175
+ if (o.current = b, ke(!1), b.onDidChangeModelContent(() => {
176
+ h.current || w.current(b.getValue());
177
+ }), b.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
182
+ });
183
+ }
184
+ ), b.onDidChangeCursorSelection(
185
+ (s) => {
186
+ const I = s.selection, G = b.getModel()?.getValueInRange(I) ?? "";
187
+ Ve(G), oe.current.onSelectionChange?.({
188
+ startLineNumber: I.startLineNumber,
189
+ startColumn: I.startColumn,
190
+ endLineNumber: I.endLineNumber,
191
+ endColumn: I.endColumn
192
+ });
193
+ }
194
+ ), b.addCommand(n.KeyMod.CtrlCmd | n.KeyCode.KeyS, () => {
195
+ oe.current.onSave?.(b.getValue());
196
+ }), i && typeof window < "u")
197
+ try {
198
+ await se(
199
+ "https://cdn.jsdelivr.net/npm/vscode-ws-jsonrpc@1.0.2/lib/browser/index.min.js"
200
+ ), await se(
201
+ "https://cdn.jsdelivr.net/npm/monaco-languageclient@0.15.0/lib/monaco-languageclient.min.js"
202
+ );
203
+ const s = window, I = s.ReconnectingWebSocket, { MonacoLanguageClient: G, CloseAction: Be, ErrorAction: He, createConnection: Ne } = s.monacoLanguageClient || {};
204
+ if (G && Ne) {
205
+ const Ke = i.url, qe = i.language, Ee = new I(Ke), Ye = new s.VSCodeWebSocketMessageReader(Ee), Je = new s.VSCodeWebSocketMessageWriter(Ee), Qe = Ne(Ye, Je), Se = new G({
206
+ name: "LSP Client",
207
+ clientOptions: {
208
+ documentSelector: [qe],
209
+ initializationOptions: i.initOptions,
210
+ errorHandler: {
211
+ error: () => He.Continue,
212
+ closed: () => Be.Restart
213
+ }
214
+ },
215
+ connectionProvider: {
216
+ get: () => Promise.resolve(Qe)
217
+ }
218
+ });
219
+ Se.start(), o.current.__lspClient = Se;
220
+ }
221
+ } catch (s) {
222
+ console.warn("LSP bridge failed to load:", s);
223
+ }
224
+ oe.current.onMount?.(b, n);
225
+ }).catch((n) => {
226
+ e && (ze(
227
+ n.message ?? xe.current("codeEditor.failedToLoadEditor", "Failed to load editor")
228
+ ), ke(!1));
229
+ }), () => {
230
+ if (e = !1, o.current?.dispose(), P.current?.dispose(), o.current && o.current.__lspClient)
231
+ try {
232
+ o.current.__lspClient.stop();
233
+ } catch {
234
+ }
235
+ };
236
+ }, [Fe]), N(() => {
237
+ const e = o.current;
238
+ if (!u || !e || x === e.getValue())
239
+ return;
240
+ const i = e.getPosition();
241
+ h.current = !0;
242
+ try {
243
+ e.setValue(x);
244
+ } finally {
245
+ h.current = !1;
246
+ }
247
+ i && e.setPosition(i);
248
+ }, [x, u]), N(() => {
249
+ const e = o.current, i = k.current;
250
+ if (e && i) {
251
+ const n = e.getModel();
252
+ n && i.editor.setModelLanguage(n, g);
253
+ }
254
+ }, [g]), N(() => {
255
+ const e = k.current;
256
+ if (!e || ee || !S || S.length === 0 || g !== "javascript" && g !== "typescript")
257
+ return;
258
+ const i = e.languages?.typescript;
259
+ if (!i)
260
+ return;
261
+ const n = [];
262
+ try {
263
+ S.forEach((l, b) => {
264
+ const s = l.filePath ?? `inmemory://model/nice-extralib-${b}.d.ts`, I = i.typescriptDefaults?.addExtraLib(l.content, s);
265
+ I && n.push(I);
266
+ const G = i.javascriptDefaults?.addExtraLib(l.content, s);
267
+ G && n.push(G);
268
+ });
269
+ } catch (l) {
270
+ console.warn("Failed to register extraLibs:", l);
271
+ }
272
+ return () => {
273
+ n.forEach((l) => {
274
+ try {
275
+ l.dispose();
276
+ } catch {
277
+ }
278
+ });
279
+ };
280
+ }, [S, g, ee]), N(() => {
281
+ const e = k.current;
282
+ if (!e || (e.editor.setTheme(ne(_)), _ !== "auto" || typeof document > "u"))
283
+ return;
284
+ const i = () => {
285
+ k.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 l = window.matchMedia?.("(prefers-color-scheme: dark)");
292
+ return l?.addEventListener?.("change", i), () => {
293
+ n.disconnect(), l?.removeEventListener?.("change", i);
294
+ };
295
+ }, [_]), N(() => {
296
+ const e = o.current;
297
+ e && e.updateOptions(ce);
298
+ }, [ce]), N(() => {
299
+ const e = o.current, i = k.current;
300
+ if (e && i) {
301
+ const n = e.getModel();
302
+ if (n) {
303
+ const l = W.map((b) => ({
304
+ startLineNumber: b.startLineNumber,
305
+ startColumn: b.startColumn,
306
+ endLineNumber: b.endLineNumber,
307
+ endColumn: b.endColumn,
308
+ message: b.message,
309
+ severity: b.severity
310
+ }));
311
+ i.editor.setModelMarkers(n, "owner", l);
312
+ }
313
+ }
314
+ }, [W]), N(() => {
315
+ const e = o.current;
316
+ if (e && B.length > 0) {
317
+ const i = B.map((n) => ({
318
+ range: {
319
+ startLineNumber: n.range.startLineNumber,
320
+ startColumn: n.range.startColumn,
321
+ endLineNumber: n.range.endLineNumber,
322
+ endColumn: n.range.endColumn
323
+ },
324
+ options: {
325
+ className: n.className,
326
+ glyphMarginClassName: n.glyphMarginClassName,
327
+ hoverMessage: n.hoverMessage ? { value: n.hoverMessage } : void 0,
328
+ isWholeLine: n.isWholeLine
329
+ }
330
+ }));
331
+ Z.current = e.deltaDecorations(
332
+ Z.current,
333
+ i
334
+ );
335
+ }
336
+ }, [B]), N(() => {
337
+ const e = k.current;
338
+ if (!e || !f)
339
+ return;
340
+ P.current?.dispose();
341
+ const i = {
342
+ text: 0,
343
+ method: 1,
344
+ function: 2,
345
+ constructor: 3,
346
+ field: 4,
347
+ variable: 5,
348
+ class: 6,
349
+ interface: 7,
350
+ module: 8,
351
+ property: 9,
352
+ keyword: 13,
353
+ snippet: 14,
354
+ color: 15,
355
+ file: 16,
356
+ reference: 17,
357
+ folder: 18
358
+ };
359
+ return P.current = e.languages.registerCompletionItemProvider(g, {
360
+ provideCompletionItems: async (n, l) => ({
361
+ suggestions: (await f(n, l)).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,
368
+ range: {
369
+ startLineNumber: l.lineNumber,
370
+ startColumn: l.column,
371
+ endLineNumber: l.lineNumber,
372
+ endColumn: l.column
373
+ }
374
+ }))
375
+ })
376
+ }), () => {
377
+ P.current?.dispose();
378
+ };
379
+ }, [g, f]), et(
380
+ m,
381
+ () => ({
382
+ getEditor: () => o.current,
383
+ getMonaco: () => k.current,
384
+ focus: () => o.current?.focus(),
385
+ getValue: () => o.current?.getValue() ?? "",
386
+ setValue: (e) => o.current?.setValue(e),
387
+ getSelection: () => {
388
+ const e = o.current;
389
+ if (!e)
390
+ return "";
391
+ const i = e.getSelection();
392
+ return i ? e.getModel()?.getValueInRange(i) ?? "" : "";
393
+ },
394
+ insertText: (e) => {
395
+ const i = o.current;
396
+ if (!i)
397
+ return;
398
+ const n = i.getSelection();
399
+ n && i.executeEdits("", [{ range: n, text: e }]);
400
+ },
401
+ formatDocument: () => {
402
+ o.current?.getAction("editor.action.formatDocument")?.run();
403
+ },
404
+ goToLine: (e, i = 1) => {
405
+ const n = o.current;
406
+ n && (n.setPosition({ lineNumber: e, column: i }), n.revealLineInCenter(e), n.focus());
407
+ },
408
+ findReplace: () => {
409
+ o.current?.getAction("editor.action.startFindReplaceAction")?.run();
410
+ },
411
+ undo: () => {
412
+ o.current?.trigger("keyboard", "undo", null);
413
+ },
414
+ redo: () => {
415
+ o.current?.trigger("keyboard", "redo", null);
416
+ },
417
+ getCursorPosition: () => {
418
+ const e = o.current?.getPosition();
419
+ return { lineNumber: e?.lineNumber ?? 1, column: e?.column ?? 1 };
420
+ },
421
+ setMarkers: (e) => {
422
+ const i = o.current, n = k.current;
423
+ if (i && n) {
424
+ const l = i.getModel();
425
+ if (l) {
426
+ const b = 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
433
+ }));
434
+ n.editor.setModelMarkers(l, "owner", b);
435
+ }
436
+ }
437
+ }
438
+ }),
439
+ []
440
+ );
441
+ const K = Me(
442
+ () => ({
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(),
447
+ toggleWordWrap: () => {
448
+ const e = !le;
449
+ je(e), o.current?.updateOptions({ wordWrap: e ? "on" : "off" });
450
+ },
451
+ toggleMinimap: () => {
452
+ const e = o.current?.getOption?.(
453
+ k.current?.editor?.EditorOption?.minimap
454
+ );
455
+ o.current?.updateOptions({ minimap: { enabled: !e?.enabled } });
456
+ },
457
+ foldAll: () => o.current?.getAction("editor.foldAll")?.run(),
458
+ unfoldAll: () => o.current?.getAction("editor.unfoldAll")?.run()
459
+ }),
460
+ [le]
461
+ ), $e = x.split(`
462
+ `).length, Ue = x.length;
463
+ return /* @__PURE__ */ A(
464
+ "div",
465
+ {
466
+ className: `nice-code-editor-wrap nice-editor--${Y} ${J ?? ""}`,
467
+ style: { height: re, width: U, display: "flex", flexDirection: "column", position: "relative" },
468
+ "data-testid": H,
469
+ children: [
470
+ /* @__PURE__ */ t("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 20 }, children: /* @__PURE__ */ t(Ze, { steps: Ge(Q, nt) }) }),
471
+ de && /* @__PURE__ */ A(
472
+ "div",
473
+ {
474
+ className: "nice-code-editor__error",
475
+ style: {
476
+ position: "absolute",
477
+ inset: 0,
478
+ zIndex: 2,
479
+ background: "var(--nice-bg-primary, #fff)"
480
+ },
481
+ children: [
482
+ /* @__PURE__ */ A("span", { children: [
483
+ /* @__PURE__ */ t(L, { name: "warning", size: 16 }),
484
+ " ",
485
+ de
486
+ ] }),
487
+ /* @__PURE__ */ t(
488
+ "textarea",
489
+ {
490
+ value: x,
491
+ onChange: (e) => p(e.target.value),
492
+ readOnly: F || c.readOnly,
493
+ style: { width: "100%", height: "100%", fontFamily: "monospace" }
494
+ }
495
+ )
496
+ ]
497
+ }
498
+ ),
499
+ ee && !de && /* @__PURE__ */ t(
500
+ "div",
501
+ {
502
+ className: "nice-code-editor__loader-overlay",
503
+ style: {
504
+ position: "absolute",
505
+ inset: 0,
506
+ zIndex: 2,
507
+ display: "flex",
508
+ alignItems: "center",
509
+ justifyContent: "center",
510
+ background: "var(--nice-bg-primary, #fff)"
511
+ },
512
+ children: T ?? /* @__PURE__ */ t("div", { className: "nice-code-editor__loader", children: r("codeEditor.loadingEditor", "Loading editor...") })
513
+ }
514
+ ),
515
+ X && /* @__PURE__ */ A("div", { className: "nice-code-editor__toolbar", children: [
516
+ /* @__PURE__ */ t(
517
+ "button",
518
+ {
519
+ className: "nice-code-editor__toolbar-btn",
520
+ onClick: K.undo,
521
+ title: r("codeEditor.undoCtrlZ", "Undo (Ctrl+Z)"),
522
+ "aria-label": r("codeEditor.undo", "Undo"),
523
+ children: /* @__PURE__ */ t(L, { name: "reply", size: 16 })
524
+ }
525
+ ),
526
+ /* @__PURE__ */ t(
527
+ "button",
528
+ {
529
+ className: "nice-code-editor__toolbar-btn",
530
+ onClick: K.redo,
531
+ title: r("codeEditor.redoCtrlY", "Redo (Ctrl+Y)"),
532
+ "aria-label": r("codeEditor.redo", "Redo"),
533
+ children: /* @__PURE__ */ t(L, { name: "forward", size: 16 })
534
+ }
535
+ ),
536
+ /* @__PURE__ */ t("span", { className: "nice-code-editor__toolbar-sep" }),
537
+ /* @__PURE__ */ t(
538
+ "button",
539
+ {
540
+ className: "nice-code-editor__toolbar-btn",
541
+ onClick: K.format,
542
+ title: r("codeEditor.formatShiftAltF", "Format (Shift+Alt+F)"),
543
+ "aria-label": r("codeEditor.format", "Format"),
544
+ children: /* @__PURE__ */ t(L, { name: "type", size: 16 })
545
+ }
546
+ ),
547
+ /* @__PURE__ */ t(
548
+ "button",
549
+ {
550
+ className: "nice-code-editor__toolbar-btn",
551
+ onClick: K.find,
552
+ title: r("codeEditor.findReplaceCtrlH", "Find & Replace (Ctrl+H)"),
553
+ "aria-label": r("codeEditor.findReplace", "Find & Replace"),
554
+ children: /* @__PURE__ */ t(L, { name: "search", size: 16 })
555
+ }
556
+ ),
557
+ /* @__PURE__ */ t("span", { className: "nice-code-editor__toolbar-sep" }),
558
+ /* @__PURE__ */ t(
559
+ "button",
560
+ {
561
+ className: `nice-code-editor__toolbar-btn${le ? " nice-code-editor__toolbar-btn--active" : ""}`,
562
+ onClick: K.toggleWordWrap,
563
+ title: r("codeEditor.toggleWordWrap", "Toggle Word Wrap"),
564
+ "aria-label": r("codeEditor.toggleWordWrap", "Toggle Word Wrap"),
565
+ children: /* @__PURE__ */ t(L, { name: "align-left", size: 16 })
566
+ }
567
+ ),
568
+ /* @__PURE__ */ t(
569
+ "button",
570
+ {
571
+ className: "nice-code-editor__toolbar-btn",
572
+ onClick: K.toggleMinimap,
573
+ title: r("codeEditor.toggleMinimap", "Toggle Minimap"),
574
+ "aria-label": r("codeEditor.toggleMinimap", "Toggle Minimap"),
575
+ children: /* @__PURE__ */ t(L, { name: "columns", size: 16 })
576
+ }
577
+ ),
578
+ /* @__PURE__ */ t("span", { className: "nice-code-editor__toolbar-sep" }),
579
+ /* @__PURE__ */ t(
580
+ "button",
581
+ {
582
+ className: "nice-code-editor__toolbar-btn",
583
+ onClick: K.foldAll,
584
+ title: r("codeEditor.foldAll", "Fold All"),
585
+ "aria-label": r("codeEditor.foldAll", "Fold All"),
586
+ children: /* @__PURE__ */ t(L, { name: "collapse", size: 16 })
587
+ }
588
+ ),
589
+ /* @__PURE__ */ t(
590
+ "button",
591
+ {
592
+ className: "nice-code-editor__toolbar-btn",
593
+ onClick: K.unfoldAll,
594
+ title: r("codeEditor.unfoldAll", "Unfold All"),
595
+ "aria-label": r("codeEditor.unfoldAll", "Unfold All"),
596
+ children: /* @__PURE__ */ t(L, { name: "expand", size: 16 })
597
+ }
598
+ )
599
+ ] }),
600
+ /* @__PURE__ */ t("div", { ref: v, className: "nice-code-editor", style: { flex: 1, minHeight: 0 } }),
601
+ E && /* @__PURE__ */ A("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(
604
+ "{selectionText}",
605
+ String(Ce.length)
606
+ ) }),
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(Ue)) }),
609
+ /* @__PURE__ */ t("span", { className: "nice-code-editor__statusbar-lang", children: g }),
610
+ W.length > 0 && /* @__PURE__ */ A("span", { className: "nice-code-editor__statusbar-markers", children: [
611
+ /* @__PURE__ */ t(L, { name: "warning", size: 14 }),
612
+ " ",
613
+ W.length
614
+ ] })
615
+ ] })
616
+ ]
617
+ }
618
+ );
619
+ }
620
+ );
621
+ function mt(a) {
622
+ const { t: d } = fe();
623
+ he(be, ve);
624
+ const {
625
+ original: m,
626
+ defaultOriginal: r,
627
+ modified: C,
628
+ defaultModified: $,
629
+ language: z = "plaintext",
630
+ theme: g = "auto",
631
+ height: _ = 400,
632
+ width: c = "100%",
633
+ inline: re = !1,
634
+ renderSideBySide: U = !0,
635
+ originalEditable: W = !1,
636
+ modifiedEditable: B = !1,
637
+ onOriginalChange: f,
638
+ onModifiedChange: V,
639
+ loading: j,
640
+ className: O,
641
+ "data-testid": q
642
+ } = a, [T, F, X] = ae({
643
+ value: m,
644
+ defaultValue: r,
645
+ fallbackValue: "",
646
+ onChange: f,
647
+ componentName: "NiceCodeDiffEditor.original"
648
+ }), [E, Y, J] = ae({
649
+ value: C,
650
+ defaultValue: $,
651
+ fallbackValue: "",
652
+ onChange: V,
653
+ componentName: "NiceCodeDiffEditor.modified"
654
+ }), H = y({ currentOriginal: T, currentModified: E, setOriginal: F, setModified: Y });
655
+ H.current = { currentOriginal: T, currentModified: E, setOriginal: F, setModified: Y };
656
+ const R = y(!1), S = y(null);
657
+ De(S);
658
+ const Q = y(null), x = y(null), [p, u] = D(!0), [w, M] = D(null);
659
+ return N(() => {
660
+ if (!S.current)
661
+ return;
662
+ let h = !0;
663
+ return Ae().then((v) => {
664
+ if (!h || !S.current)
665
+ return;
666
+ x.current = v;
667
+ const { currentOriginal: o, currentModified: k } = H.current, Z = v.editor.createModel(o, z), P = v.editor.createModel(k, z), ee = v.editor.createDiffEditor(S.current, {
668
+ automaticLayout: !0,
669
+ theme: ne(g),
670
+ renderSideBySide: !re && U,
671
+ originalEditable: W,
672
+ readOnly: !B
673
+ });
674
+ ee.setModel({
675
+ original: Z,
676
+ modified: P
677
+ }), Q.current = ee, u(!1), W && Z.onDidChangeContent(() => {
678
+ R.current || H.current.setOriginal(Z.getValue());
679
+ }), B && P.onDidChangeContent(() => {
680
+ R.current || H.current.setModified(P.getValue());
681
+ });
682
+ }).catch((v) => {
683
+ h && (M(
684
+ v.message ?? d("codeEditor.failedToLoadDiffEditor", "Failed to load diff editor")
685
+ ), u(!1));
686
+ }), () => {
687
+ h = !1, Q.current?.dispose();
688
+ };
689
+ }, [d]), N(() => {
690
+ const h = Q.current?.getModel();
691
+ if (h) {
692
+ R.current = !0;
693
+ try {
694
+ X && h.original.getValue() !== T && h.original.setValue(T), J && h.modified.getValue() !== E && h.modified.setValue(E);
695
+ } finally {
696
+ R.current = !1;
697
+ }
698
+ }
699
+ }, [T, E, X, J]), N(() => {
700
+ const h = x.current;
701
+ if (!h || (h.editor.setTheme(ne(g)), g !== "auto" || typeof document > "u"))
702
+ return;
703
+ const v = () => {
704
+ x.current?.editor.setTheme(ne("auto"));
705
+ }, o = new MutationObserver(v);
706
+ o.observe(document.documentElement, {
707
+ attributes: !0,
708
+ attributeFilter: ["data-theme", "class"]
709
+ });
710
+ const k = window.matchMedia?.("(prefers-color-scheme: dark)");
711
+ return k?.addEventListener?.("change", v), () => {
712
+ o.disconnect(), k?.removeEventListener?.("change", v);
713
+ };
714
+ }, [g, p]), w ? /* @__PURE__ */ t(
715
+ "div",
716
+ {
717
+ className: `nice-code-diff-editor nice-code-diff-editor--error ${O ?? ""}`,
718
+ style: { height: _, width: c },
719
+ "data-testid": q,
720
+ children: /* @__PURE__ */ t("div", { className: "nice-code-editor__error", children: /* @__PURE__ */ A("span", { children: [
721
+ /* @__PURE__ */ t(L, { name: "warning", size: 16 }),
722
+ " ",
723
+ w
724
+ ] }) })
725
+ }
726
+ ) : /* @__PURE__ */ A(
727
+ "div",
728
+ {
729
+ className: `nice-code-diff-editor ${O ?? ""}`,
730
+ style: { height: _, width: c, position: "relative" },
731
+ "data-testid": q,
732
+ children: [
733
+ /* @__PURE__ */ t("div", { ref: S, style: { position: "absolute", inset: 0 } }),
734
+ p && /* @__PURE__ */ t(
735
+ "div",
736
+ {
737
+ style: {
738
+ position: "absolute",
739
+ inset: 0,
740
+ display: "flex",
741
+ alignItems: "center",
742
+ justifyContent: "center",
743
+ background: "var(--nice-bg-primary, #fff)",
744
+ zIndex: 2
745
+ },
746
+ children: j ?? /* @__PURE__ */ t("div", { className: "nice-code-editor__loader", children: d("codeEditor.loadingDiffEditor", "Loading diff editor...") })
747
+ }
748
+ )
749
+ ]
750
+ }
751
+ );
752
+ }
753
+ const it = "1.29.0", Re = `https://cdn.jsdelivr.net/npm/prismjs@${it}`;
754
+ let ue = null;
755
+ const ge = {
756
+ javascript: "javascript",
757
+ typescript: "typescript",
758
+ json: "json",
759
+ html: "markup",
760
+ css: "css",
761
+ scss: "scss",
762
+ less: "less",
763
+ markdown: "markdown",
764
+ xml: "markup",
765
+ yaml: "yaml",
766
+ sql: "sql",
767
+ python: "python",
768
+ csharp: "csharp",
769
+ java: "java",
770
+ cpp: "cpp",
771
+ c: "c",
772
+ go: "go",
773
+ rust: "rust",
774
+ php: "php",
775
+ ruby: "ruby",
776
+ shell: "bash",
777
+ powershell: "powershell",
778
+ plaintext: "plain"
779
+ };
780
+ function se(a) {
781
+ return new Promise((d, m) => {
782
+ if (document.querySelector(`script[data-prism-src="${a}"]`)) {
783
+ d();
784
+ return;
785
+ }
786
+ const r = document.createElement("script");
787
+ r.src = a, r.async = !0, r.dataset.prismSrc = a, r.onload = () => d(), r.onerror = () => m(new Error(`Failed to load ${a}`)), document.head.appendChild(r);
788
+ });
789
+ }
790
+ function ct(a) {
791
+ if (typeof window > "u")
792
+ return Promise.resolve(null);
793
+ const d = window, m = ge[a] ?? "plain", r = async () => {
794
+ if (m !== "plain" && !d.Prism?.languages?.[m])
795
+ try {
796
+ await se(`${Re}/components/prism-${m}.min.js`);
797
+ } catch {
798
+ }
799
+ };
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)));
801
+ }
802
+ function me(a) {
803
+ return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
804
+ }
805
+ function pt(a) {
806
+ he(be, ve);
807
+ const {
808
+ value: d,
809
+ defaultValue: m,
810
+ onChange: r,
811
+ language: C = "plaintext",
812
+ height: $ = 300,
813
+ width: z = "100%",
814
+ readOnly: g = !1,
815
+ tabSize: _ = 2,
816
+ lineNumbers: c = !0,
817
+ placeholder: re,
818
+ theme: U = "auto",
819
+ className: W,
820
+ "data-testid": B
821
+ } = a, [f, V] = ae({
822
+ value: d,
823
+ defaultValue: m,
824
+ fallbackValue: "",
825
+ onChange: r,
826
+ componentName: "NiceSimpleCodeEditor"
827
+ }), j = y(null), O = y(null), { t: q } = fe(), T = tt(), [F] = D(Pe), [X, E] = D(() => me(f)), [Y, J] = D("light");
828
+ N(() => {
829
+ const p = () => {
830
+ if (U !== "auto")
831
+ return U;
832
+ if (typeof document > "u")
833
+ return "light";
834
+ const h = document.documentElement.dataset.theme;
835
+ return h === "dark" ? "dark" : h === "light" ? "light" : window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
836
+ };
837
+ if (J(p()), U !== "auto" || typeof document > "u")
838
+ return;
839
+ const u = () => J(p()), w = new MutationObserver(u);
840
+ w.observe(document.documentElement, {
841
+ attributes: !0,
842
+ attributeFilter: ["data-theme", "class"]
843
+ });
844
+ const M = window.matchMedia?.("(prefers-color-scheme: dark)");
845
+ return M?.addEventListener?.("change", u), () => {
846
+ w.disconnect(), M?.removeEventListener?.("change", u);
847
+ };
848
+ }, [U]), N(() => {
849
+ let p = !0;
850
+ return ct(C).then((u) => {
851
+ if (!p)
852
+ return;
853
+ const w = ge[C] ?? "plain";
854
+ if (u?.languages?.[w])
855
+ try {
856
+ const M = u.highlight(f, u.languages[w], w);
857
+ E(M);
858
+ return;
859
+ } catch {
860
+ }
861
+ E(me(f));
862
+ }).catch(() => {
863
+ p && E(me(f));
864
+ }), () => {
865
+ p = !1;
866
+ };
867
+ }, [f, C]);
868
+ const H = Le(() => {
869
+ !O.current || !j.current || (O.current.scrollTop = j.current.scrollTop, O.current.scrollLeft = j.current.scrollLeft);
870
+ }, []), R = Le(
871
+ (p) => {
872
+ if (!F(p) && p.key === "Tab" && !g) {
873
+ p.preventDefault();
874
+ const u = p.currentTarget, w = u.selectionStart, M = u.selectionEnd, h = " ".repeat(_);
875
+ if (p.shiftKey) {
876
+ const k = f.substring(0, w).lastIndexOf(`
877
+ `) + 1;
878
+ if ((f.substring(k, w).match(/^(\s*)/)?.[1] ?? "").length >= _) {
879
+ const P = f.substring(0, k) + f.substring(k + _);
880
+ V(P), setTimeout(() => {
881
+ u.selectionStart = u.selectionEnd = w - _;
882
+ }, 0);
883
+ }
884
+ } else {
885
+ const v = f.substring(0, w) + h + f.substring(M);
886
+ V(v), setTimeout(() => {
887
+ u.selectionStart = u.selectionEnd = w + _;
888
+ }, 0);
889
+ }
890
+ }
891
+ },
892
+ [f, V, _, F, g]
893
+ ), Q = f.split(`
894
+ `).length, x = ge[C] ?? "plain";
895
+ return /* @__PURE__ */ A(
896
+ "div",
897
+ {
898
+ className: `nice-simple-code-editor nice-simple-code-editor--${Y} ${W ?? ""}`,
899
+ style: { height: $, width: z },
900
+ "data-testid": B,
901
+ "data-language": C,
902
+ "data-theme": Y,
903
+ children: [
904
+ c && /* @__PURE__ */ t("div", { className: "nice-simple-code-editor__line-numbers", children: Array.from({ length: Q }, (p, u) => /* @__PURE__ */ t("div", { className: "nice-simple-code-editor__line-number", children: u + 1 }, u)) }),
905
+ /* @__PURE__ */ A("div", { className: "nice-simple-code-editor__editor-area", children: [
906
+ /* @__PURE__ */ t(
907
+ "pre",
908
+ {
909
+ ref: O,
910
+ "aria-hidden": "true",
911
+ className: `nice-simple-code-editor__highlight language-${x}`,
912
+ children: /* @__PURE__ */ t(
913
+ "code",
914
+ {
915
+ className: `language-${x}`,
916
+ dangerouslySetInnerHTML: {
917
+ __html: X + (f.endsWith(`
918
+ `) ? `
919
+ ` : "")
920
+ }
921
+ }
922
+ )
923
+ }
924
+ ),
925
+ /* @__PURE__ */ t(
926
+ "textarea",
927
+ {
928
+ ref: j,
929
+ className: "nice-simple-code-editor__textarea",
930
+ value: f,
931
+ onChange: (p) => V(p.target.value),
932
+ onKeyDown: R,
933
+ onScroll: H,
934
+ readOnly: g,
935
+ placeholder: re,
936
+ spellCheck: !1,
937
+ autoCapitalize: "off",
938
+ autoCorrect: "off",
939
+ "aria-describedby": g ? void 0 : T
940
+ }
941
+ ),
942
+ !g && /* @__PURE__ */ t("span", { id: T, className: "nice-sr-only", children: q("input.tabEscapeHint", "Tab indents. To leave the editor, press Escape, then Tab.") })
943
+ ] })
944
+ ]
945
+ }
946
+ );
947
+ }
948
+ const be = "nice-code-editor-styles", ve = `
949
+ .nice-code-editor,
950
+ .nice-code-diff-editor {
951
+ border: 1px solid var(--nice-border, #e0e0e0);
952
+ border-radius: var(--nice-radius-sm, 4px);
953
+ overflow: hidden;
954
+ }
955
+
956
+ .nice-code-editor--loading,
957
+ .nice-code-editor--error,
958
+ .nice-code-diff-editor--loading {
959
+ display: flex;
960
+ align-items: center;
961
+ justify-content: center;
962
+ background: var(--nice-bg-tertiary, #f5f5f5);
963
+ }
964
+
965
+ .nice-code-editor__loader {
966
+ color: var(--nice-text-secondary, #666);
967
+ font-size: 14px;
968
+ }
969
+
970
+ .nice-code-editor__error {
971
+ display: flex;
972
+ flex-direction: column;
973
+ width: 100%;
974
+ height: 100%;
975
+ padding: var(--nice-space-2, 8px);
976
+ gap: var(--nice-space-2, 8px);
977
+ }
978
+
979
+ .nice-code-editor__error span {
980
+ color: var(--nice-error, #d32f2f);
981
+ }
982
+
983
+ /* Simple code editor */
984
+ .nice-simple-code-editor {
985
+ display: flex;
986
+ border: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
987
+ border-radius: var(--nice-radius-sm, 4px);
988
+ overflow: hidden;
989
+ font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
990
+ font-size: 14px;
991
+ line-height: 1.5;
992
+ background: var(--nice-bg-primary, var(--nice-bg-surface, #fff));
993
+ color: var(--nice-text-primary, var(--nice-text-primary, #333));
994
+ }
995
+ .nice-simple-code-editor--dark {
996
+ background: var(--nice-bg, #1e1e1e);
997
+ color: var(--nice-text, #d4d4d4);
998
+ }
999
+
1000
+ .nice-simple-code-editor__line-numbers {
1001
+ padding: var(--nice-space-2, 8px) 0;
1002
+ background: var(--nice-bg-secondary, var(--nice-bg-tertiary, #f5f5f5));
1003
+ border-right: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
1004
+ user-select: none;
1005
+ text-align: right;
1006
+ color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
1007
+ overflow: hidden;
1008
+ }
1009
+ .nice-simple-code-editor--dark .nice-simple-code-editor__line-numbers {
1010
+ background: var(--nice-bg-secondary, #252526);
1011
+ border-right-color: var(--nice-border, #3c3c3c);
1012
+ color: var(--nice-text-muted, #858585);
1013
+ }
1014
+
1015
+ .nice-simple-code-editor__line-number {
1016
+ padding: 0 var(--nice-space-3, 12px);
1017
+ min-width: 40px;
1018
+ }
1019
+
1020
+ .nice-simple-code-editor__editor-area {
1021
+ position: relative;
1022
+ flex: 1;
1023
+ overflow: hidden;
1024
+ }
1025
+
1026
+ .nice-simple-code-editor__highlight,
1027
+ .nice-simple-code-editor__textarea {
1028
+ position: absolute;
1029
+ inset: 0;
1030
+ margin: 0;
1031
+ padding: var(--nice-space-2, 8px) var(--nice-space-3, 12px);
1032
+ border: 0;
1033
+ font: inherit;
1034
+ line-height: inherit;
1035
+ white-space: pre;
1036
+ overflow: auto;
1037
+ tab-size: 2;
1038
+ }
1039
+
1040
+ .nice-simple-code-editor__highlight {
1041
+ pointer-events: none;
1042
+ background: transparent;
1043
+ color: inherit;
1044
+ }
1045
+ .nice-simple-code-editor__highlight code {
1046
+ font: inherit;
1047
+ background: transparent;
1048
+ }
1049
+
1050
+ .nice-simple-code-editor__textarea {
1051
+ background: transparent;
1052
+ color: transparent;
1053
+ caret-color: var(--nice-text-primary, var(--nice-text-primary, #333));
1054
+ resize: none;
1055
+ outline: none;
1056
+ -webkit-text-fill-color: transparent;
1057
+ }
1058
+ .nice-simple-code-editor--dark .nice-simple-code-editor__textarea {
1059
+ caret-color: var(--nice-text, #d4d4d4);
1060
+ }
1061
+
1062
+ .nice-simple-code-editor__textarea::placeholder {
1063
+ color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
1064
+ -webkit-text-fill-color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
1065
+ }
1066
+ .nice-simple-code-editor--dark .nice-simple-code-editor__textarea::placeholder {
1067
+ color: var(--nice-text-muted, #858585);
1068
+ -webkit-text-fill-color: var(--nice-text-muted, #858585);
1069
+ }
1070
+
1071
+ /* Prism token colors — light */
1072
+ .nice-simple-code-editor .token.comment,
1073
+ .nice-simple-code-editor .token.prolog,
1074
+ .nice-simple-code-editor .token.doctype,
1075
+ .nice-simple-code-editor .token.cdata { color: #6a737d; font-style: italic; }
1076
+ .nice-simple-code-editor .token.punctuation { color: #586069; }
1077
+ .nice-simple-code-editor .token.property,
1078
+ .nice-simple-code-editor .token.tag,
1079
+ .nice-simple-code-editor .token.boolean,
1080
+ .nice-simple-code-editor .token.number,
1081
+ .nice-simple-code-editor .token.constant,
1082
+ .nice-simple-code-editor .token.symbol,
1083
+ .nice-simple-code-editor .token.deleted { color: #005cc5; }
1084
+ .nice-simple-code-editor .token.selector,
1085
+ .nice-simple-code-editor .token.attr-name,
1086
+ .nice-simple-code-editor .token.string,
1087
+ .nice-simple-code-editor .token.char,
1088
+ .nice-simple-code-editor .token.builtin,
1089
+ .nice-simple-code-editor .token.inserted { color: #032f62; }
1090
+ .nice-simple-code-editor .token.operator,
1091
+ .nice-simple-code-editor .token.entity,
1092
+ .nice-simple-code-editor .token.url,
1093
+ .nice-simple-code-editor .token.variable { color: var(--nice-danger, #d73a49); }
1094
+ .nice-simple-code-editor .token.atrule,
1095
+ .nice-simple-code-editor .token.attr-value,
1096
+ .nice-simple-code-editor .token.keyword { color: var(--nice-danger, #d73a49); font-weight: 600; }
1097
+ .nice-simple-code-editor .token.function,
1098
+ .nice-simple-code-editor .token.class-name { color: #6f42c1; }
1099
+ .nice-simple-code-editor .token.regex,
1100
+ .nice-simple-code-editor .token.important { color: #e36209; }
1101
+
1102
+ /* Prism token colors — dark */
1103
+ .nice-simple-code-editor--dark .token.comment,
1104
+ .nice-simple-code-editor--dark .token.prolog,
1105
+ .nice-simple-code-editor--dark .token.doctype,
1106
+ .nice-simple-code-editor--dark .token.cdata { color: var(--nice-success, #6a9955); font-style: italic; }
1107
+ .nice-simple-code-editor--dark .token.punctuation { color: var(--nice-text, #d4d4d4); }
1108
+ .nice-simple-code-editor--dark .token.property,
1109
+ .nice-simple-code-editor--dark .token.tag,
1110
+ .nice-simple-code-editor--dark .token.boolean,
1111
+ .nice-simple-code-editor--dark .token.number,
1112
+ .nice-simple-code-editor--dark .token.constant,
1113
+ .nice-simple-code-editor--dark .token.symbol,
1114
+ .nice-simple-code-editor--dark .token.deleted { color: var(--nice-success-light, #b5cea8); }
1115
+ .nice-simple-code-editor--dark .token.selector,
1116
+ .nice-simple-code-editor--dark .token.attr-name,
1117
+ .nice-simple-code-editor--dark .token.string,
1118
+ .nice-simple-code-editor--dark .token.char,
1119
+ .nice-simple-code-editor--dark .token.builtin,
1120
+ .nice-simple-code-editor--dark .token.inserted { color: var(--nice-warning, #ce9178); }
1121
+ .nice-simple-code-editor--dark .token.operator,
1122
+ .nice-simple-code-editor--dark .token.entity,
1123
+ .nice-simple-code-editor--dark .token.url,
1124
+ .nice-simple-code-editor--dark .token.variable { color: var(--nice-primary, #569cd6); }
1125
+ .nice-simple-code-editor--dark .token.atrule,
1126
+ .nice-simple-code-editor--dark .token.attr-value,
1127
+ .nice-simple-code-editor--dark .token.keyword { color: #c586c0; font-weight: 600; }
1128
+ .nice-simple-code-editor--dark .token.function,
1129
+ .nice-simple-code-editor--dark .token.class-name { color: #dcdcaa; }
1130
+ .nice-simple-code-editor--dark .token.regex,
1131
+ .nice-simple-code-editor--dark .token.important { color: #d7ba7d; }
1132
+
1133
+ /* Toolbar */
1134
+ .nice-code-editor-wrap {
1135
+ border: 1px solid var(--nice-border, #e0e0e0);
1136
+ border-radius: var(--nice-radius-sm, 4px);
1137
+ overflow: hidden;
1138
+ }
1139
+ .nice-code-editor-wrap .nice-code-editor {
1140
+ border: none;
1141
+ border-radius: 0;
1142
+ }
1143
+ /* The editing surface draws no outline: while it has focus, the frame shows the ring
1144
+ (TODO_1.3.0 I4). */
1145
+ .nice-code-editor-wrap:has(.nice-code-editor:focus-within),
1146
+ .nice-code-diff-editor:focus-within,
1147
+ .nice-simple-code-editor:focus-within {
1148
+ border-color: var(--nice-color-primary, #3b82f6);
1149
+ box-shadow: var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6));
1150
+ }
1151
+ .nice-code-editor__toolbar {
1152
+ display: flex;
1153
+ align-items: center;
1154
+ gap: var(--nice-space-0-5, 2px);
1155
+ padding: var(--nice-space-0-75, 3px) var(--nice-space-1-5, 6px);
1156
+ background: var(--nice-bg-tertiary, #f5f5f5);
1157
+ border-bottom: 1px solid var(--nice-border, #e0e0e0);
1158
+ }
1159
+ .nice-code-editor__toolbar-btn {
1160
+ display: inline-flex;
1161
+ align-items: center;
1162
+ justify-content: center;
1163
+ width: 26px;
1164
+ height: 26px;
1165
+ border: none;
1166
+ border-radius: var(--nice-radius-sm, 3px);
1167
+ background: transparent;
1168
+ color: var(--nice-text-secondary, #666);
1169
+ cursor: pointer;
1170
+ font-size: 14px;
1171
+ transition: background 0.15s, color 0.15s;
1172
+ }
1173
+ .nice-code-editor__toolbar-btn:hover {
1174
+ background: var(--nice-hover-bg, #e0e0e0);
1175
+ color: var(--nice-text-primary, #333);
1176
+ }
1177
+ .nice-code-editor__toolbar-btn--active {
1178
+ background: var(--nice-accent, #1976d2);
1179
+ color: var(--nice-text-on-primary, #FFF);
1180
+ }
1181
+ .nice-code-editor__toolbar-sep {
1182
+ width: 1px;
1183
+ height: 18px;
1184
+ background: var(--nice-border, #e0e0e0);
1185
+ margin: 0 var(--nice-space-1, 4px);
1186
+ }
1187
+
1188
+ /* Status bar */
1189
+ .nice-code-editor__statusbar {
1190
+ display: flex;
1191
+ align-items: center;
1192
+ gap: var(--nice-space-3, 12px);
1193
+ padding: var(--nice-space-0-5, 2px) var(--nice-space-2-5, 10px);
1194
+ background: var(--nice-bg-tertiary, #f5f5f5);
1195
+ border-top: 1px solid var(--nice-border, #e0e0e0);
1196
+ font-size: 12px;
1197
+ color: var(--nice-text-secondary, #666);
1198
+ user-select: none;
1199
+ }
1200
+ .nice-code-editor__statusbar-spacer { flex: 1; }
1201
+ .nice-code-editor__statusbar-lang {
1202
+ text-transform: uppercase;
1203
+ font-weight: 600;
1204
+ font-size: 11px;
1205
+ }
1206
+ .nice-code-editor__statusbar-markers {
1207
+ color: var(--nice-warning, #f39c12);
1208
+ font-weight: 600;
1209
+ }
1210
+ `;
1211
+ export {
1212
+ mt as NiceCodeDiffEditor,
1213
+ ut as NiceCodeEditor,
1214
+ pt as NiceSimpleCodeEditor
1215
+ };