@nice2dev/ui 1.3.6 → 1.3.8

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 (59) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/NiceCodeEditor-B5YtKZOe.js +1222 -0
  3. package/dist/NiceCodeEditor-D0QZW88r.cjs +268 -0
  4. package/dist/NiceColorPicker-Bzvei7D6.cjs +1 -0
  5. package/dist/NiceColorPicker-DzzJhSXT.js +552 -0
  6. package/dist/NiceDataGrid-BSaBBoNr.js +2267 -0
  7. package/dist/NiceDataGrid-C_E6zIGS.cjs +10 -0
  8. package/dist/NiceForm-D2P6XuaT.cjs +1 -0
  9. package/dist/NiceForm-_kaB4Ikt.js +5017 -0
  10. package/dist/NiceHtmlEditor-CBCJdjmy.cjs +10 -0
  11. package/dist/NiceHtmlEditor-DfkdSxL3.js +901 -0
  12. package/dist/NiceLoginForm-BFvbroGJ.js +820 -0
  13. package/dist/NiceLoginForm-FGf32sro.cjs +1 -0
  14. package/dist/NiceMention-CctjYriS.cjs +430 -0
  15. package/dist/NiceMention-umOghLCf.js +11653 -0
  16. package/dist/NiceModal-BRVzjuUN.cjs +1 -0
  17. package/dist/NiceModal-CU9FqzIH.js +83 -0
  18. package/dist/NiceModuleLifecyclePanel-DQT_forg.js +7404 -0
  19. package/dist/NiceModuleLifecyclePanel-DtOlPChV.cjs +1 -0
  20. package/dist/NicePagination-CK4ZJgu4.cjs +1 -0
  21. package/dist/NicePagination-flHgG-FT.js +200 -0
  22. package/dist/NicePivotGrid-99ZeQ9j6.js +1180 -0
  23. package/dist/NicePivotGrid-CpsBxUhq.cjs +152 -0
  24. package/dist/NiceSavedQueryPanel-Br1LQR7u.js +5311 -0
  25. package/dist/NiceSavedQueryPanel-C4SU6W22.cjs +586 -0
  26. package/dist/NiceScheduler-CeYqH0Ux.cjs +5 -0
  27. package/dist/NiceScheduler-yTpVRxfe.js +1710 -0
  28. package/dist/NiceSelect-C3NqDYwR.js +495 -0
  29. package/dist/NiceSelect-CTwSAb8G.cjs +1 -0
  30. package/dist/charts-B0tHOpJ7.cjs +768 -0
  31. package/dist/charts-C3u-VyJj.js +5019 -0
  32. package/dist/charts.cjs +1 -1
  33. package/dist/charts.mjs +1 -1
  34. package/dist/core-lazy-Bglo0hFt.cjs +1 -0
  35. package/dist/core-lazy-CRBgQkQl.js +351 -0
  36. package/dist/data.cjs +1 -1
  37. package/dist/data.mjs +3 -3
  38. package/dist/devops-Bzp3ZqZ3.cjs +18 -0
  39. package/dist/devops-fLElpPvD.js +9128 -0
  40. package/dist/devops.cjs +1 -1
  41. package/dist/devops.mjs +1 -1
  42. package/dist/editors.cjs +1 -1
  43. package/dist/editors.d.ts +5 -0
  44. package/dist/editors.mjs +7 -7
  45. package/dist/feedback.cjs +1 -1
  46. package/dist/feedback.mjs +3 -3
  47. package/dist/index.cjs +251 -251
  48. package/dist/index.d.ts +76 -9
  49. package/dist/index.mjs +15550 -15248
  50. package/dist/lazy.cjs +1 -1
  51. package/dist/lazy.mjs +18 -18
  52. package/dist/navigation.cjs +1 -1
  53. package/dist/navigation.d.ts +42 -3
  54. package/dist/navigation.mjs +2 -2
  55. package/dist/no-code-Bt7SWzsN.js +8318 -0
  56. package/dist/no-code-DnT061qn.cjs +331 -0
  57. package/dist/no-code.cjs +1 -1
  58. package/dist/no-code.mjs +1 -1
  59. package/package.json +4 -4
@@ -0,0 +1,1222 @@
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 { 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');`, g = URL.createObjectURL(new Blob([d], { type: "text/javascript" }));
22
+ a.MonacoEnvironment = {
23
+ getWorkerUrl: () => g
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 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));
57
+ });
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);
62
+ }
63
+ function De(a) {
64
+ _(() => {
65
+ const d = a.current;
66
+ if (!d)
67
+ return;
68
+ const g = Pe(), r = (y) => {
69
+ g(y) && y.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, g) {
76
+ const { t: r } = fe();
77
+ he(be, ve);
78
+ 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,
90
+ onMount: z,
91
+ onCursorPositionChange: E,
92
+ onSelectionChange: L,
93
+ onSave: q,
94
+ loading: W,
95
+ disabled: V = !1,
96
+ showToolbar: Z = !1,
97
+ 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,
107
+ fallbackValue: "",
108
+ onChange: A,
109
+ 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({
117
+ lineNumber: 1,
118
+ column: 1
119
+ }), [Ce, Ve] = I(""), [le, je] = I(c.wordWrap === "on"), ce = Me(() => ({
120
+ 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 ?? {
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, 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)
162
+ return;
163
+ let e = !0;
164
+ const i = xe.current;
165
+ return Ae().then(async (n) => {
166
+ if (!e || !b.current)
167
+ 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
174
+ });
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
182
+ });
183
+ }
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
192
+ });
193
+ }
194
+ ), v.addCommand(n.KeyMod.CtrlCmd | n.KeyCode.KeyS, () => {
195
+ oe.current.onSave?.(v.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, 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({
206
+ name: "LSP Client",
207
+ clientOptions: {
208
+ documentSelector: [qe],
209
+ initializationOptions: i.initOptions,
210
+ errorHandler: {
211
+ error: () => Ue.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?.(v, n);
225
+ }).catch((n) => {
226
+ e && (ze(
227
+ n.message ?? _e.current("codeEditor.failedToLoadEditor", "Failed to load editor")
228
+ ), ke(!1));
229
+ }), () => {
230
+ if (e = !1, o.current?.dispose(), H.current?.dispose(), o.current && o.current.__lspClient)
231
+ try {
232
+ o.current.__lspClient.stop();
233
+ } catch {
234
+ }
235
+ };
236
+ }, [Fe]), _(() => {
237
+ const e = o.current;
238
+ if (!l || !e || N === e.getValue())
239
+ return;
240
+ const i = e.getPosition();
241
+ p.current = !0;
242
+ try {
243
+ e.setValue(N);
244
+ } finally {
245
+ p.current = !1;
246
+ }
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);
253
+ }
254
+ }, [f]), _(() => {
255
+ const e = w.current;
256
+ if (!e || J || !S || S.length === 0 || f !== "javascript" && f !== "typescript")
257
+ return;
258
+ const i = e.languages?.typescript;
259
+ if (!i)
260
+ return;
261
+ const n = [];
262
+ 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);
268
+ });
269
+ } catch (m) {
270
+ console.warn("Failed to register extraLibs:", m);
271
+ }
272
+ return () => {
273
+ n.forEach((m) => {
274
+ try {
275
+ m.dispose();
276
+ } catch {
277
+ }
278
+ });
279
+ };
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
310
+ }));
311
+ i.editor.setModelMarkers(n, "owner", m);
312
+ }
313
+ }
314
+ }, [D]), _(() => {
315
+ const e = o.current;
316
+ if (e && K.length > 0) {
317
+ const i = K.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
+ T.current = e.deltaDecorations(
332
+ T.current,
333
+ i
334
+ );
335
+ }
336
+ }, [K]), _(() => {
337
+ const e = w.current;
338
+ if (!e || !h)
339
+ return;
340
+ H.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 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,
368
+ range: {
369
+ startLineNumber: m.lineNumber,
370
+ startColumn: m.column,
371
+ endLineNumber: m.lineNumber,
372
+ endColumn: m.column
373
+ }
374
+ }))
375
+ })
376
+ }), () => {
377
+ H.current?.dispose();
378
+ };
379
+ }, [f, h]), et(
380
+ g,
381
+ () => ({
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),
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 = 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
433
+ }));
434
+ n.editor.setModelMarkers(m, "owner", v);
435
+ }
436
+ }
437
+ }
438
+ }),
439
+ []
440
+ );
441
+ const Q = 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
+ w.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 = N.split(`
462
+ `).length, He = N.length;
463
+ return /* @__PURE__ */ P(
464
+ "div",
465
+ {
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,
469
+ 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(
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__ */ P("span", { children: [
483
+ /* @__PURE__ */ t(M, { name: "warning", size: 16 }),
484
+ " ",
485
+ de
486
+ ] }),
487
+ /* @__PURE__ */ t(
488
+ "textarea",
489
+ {
490
+ value: N,
491
+ onChange: (e) => $(e.target.value),
492
+ readOnly: V || c.readOnly,
493
+ style: { width: "100%", height: "100%", fontFamily: "monospace" }
494
+ }
495
+ )
496
+ ]
497
+ }
498
+ ),
499
+ J && !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: W ?? /* @__PURE__ */ t("div", { className: "nice-code-editor__loader", children: r("codeEditor.loadingEditor", "Loading editor...") })
513
+ }
514
+ ),
515
+ Z && /* @__PURE__ */ P("div", { className: "nice-code-editor__toolbar", children: [
516
+ /* @__PURE__ */ t(
517
+ "button",
518
+ {
519
+ 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 })
524
+ }
525
+ ),
526
+ /* @__PURE__ */ t(
527
+ "button",
528
+ {
529
+ 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 })
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: 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 })
545
+ }
546
+ ),
547
+ /* @__PURE__ */ t(
548
+ "button",
549
+ {
550
+ 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 })
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: 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 })
566
+ }
567
+ ),
568
+ /* @__PURE__ */ t(
569
+ "button",
570
+ {
571
+ 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 })
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: 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 })
587
+ }
588
+ ),
589
+ /* @__PURE__ */ t(
590
+ "button",
591
+ {
592
+ 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 })
597
+ }
598
+ )
599
+ ] }),
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(
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(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 }),
612
+ " ",
613
+ D.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: 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,
638
+ onModifiedChange: z,
639
+ loading: E,
640
+ className: L,
641
+ "data-testid": q
642
+ } = a, [W, V, Z] = ae({
643
+ value: g,
644
+ defaultValue: r,
645
+ fallbackValue: "",
646
+ onChange: h,
647
+ componentName: "NiceCodeDiffEditor.original"
648
+ }), [j, Y, G] = ae({
649
+ value: y,
650
+ defaultValue: B,
651
+ fallbackValue: "",
652
+ onChange: z,
653
+ 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)
661
+ return;
662
+ let p = !0;
663
+ return Ae().then((b) => {
664
+ if (!p || !S.current)
665
+ 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, {
668
+ automaticLayout: !0,
669
+ theme: ne(f),
670
+ renderSideBySide: !re && U,
671
+ originalEditable: D,
672
+ readOnly: !K
673
+ });
674
+ J.setModel({
675
+ original: T,
676
+ 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());
681
+ });
682
+ }).catch((b) => {
683
+ p && (C(
684
+ b.message ?? d("codeEditor.failedToLoadDiffEditor", "Failed to load diff editor")
685
+ ), l(!1));
686
+ }), () => {
687
+ p = !1, ee.current?.dispose();
688
+ };
689
+ }, [d]), _(() => {
690
+ const p = ee.current?.getModel();
691
+ if (p) {
692
+ O.current = !0;
693
+ try {
694
+ Z && p.original.getValue() !== W && p.original.setValue(W), G && p.modified.getValue() !== j && p.modified.setValue(j);
695
+ } finally {
696
+ O.current = !1;
697
+ }
698
+ }
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(
715
+ "div",
716
+ {
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 }),
722
+ " ",
723
+ u
724
+ ] }) })
725
+ }
726
+ ) : /* @__PURE__ */ P(
727
+ "div",
728
+ {
729
+ className: `nice-code-diff-editor ${L ?? ""}`,
730
+ style: { height: x, width: c, position: "relative" },
731
+ "data-testid": q,
732
+ children: [
733
+ /* @__PURE__ */ t("div", { ref: S, style: { position: "absolute", inset: 0 } }),
734
+ $ && /* @__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: E ?? /* @__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, g) => {
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 = () => g(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, g = ge[a] ?? "plain", r = async () => {
794
+ if (g !== "plain" && !d.Prism?.languages?.[g])
795
+ try {
796
+ await se(`${Re}/components/prism-${g}.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: 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,
824
+ fallbackValue: "",
825
+ onChange: r,
826
+ 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)
852
+ return;
853
+ const C = ge[y] ?? "plain";
854
+ if (u?.languages?.[C])
855
+ try {
856
+ const p = u.highlight(h, u.languages[C], C);
857
+ Y(p);
858
+ return;
859
+ } catch {
860
+ }
861
+ Y(me(h));
862
+ }).catch(() => {
863
+ l && Y(me(h));
864
+ }), () => {
865
+ l = !1;
866
+ };
867
+ }, [h, y]);
868
+ const O = Le(() => {
869
+ if (!L.current || !E.current)
870
+ 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;
876
+ }
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(`
884
+ `) + 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;
889
+ }, 0);
890
+ }
891
+ } else {
892
+ const o = h.substring(0, C) + b + h.substring(p);
893
+ z(o), setTimeout(() => {
894
+ u.selectionStart = u.selectionEnd = C + x;
895
+ }, 0);
896
+ }
897
+ }
898
+ },
899
+ [h, z, x, Z, f]
900
+ ), N = h.split(`
901
+ `).length, $ = ge[y] ?? "plain";
902
+ return /* @__PURE__ */ P(
903
+ "div",
904
+ {
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,
910
+ 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(
914
+ "pre",
915
+ {
916
+ ref: L,
917
+ "aria-hidden": "true",
918
+ className: `nice-simple-code-editor__highlight language-${$}`,
919
+ children: /* @__PURE__ */ t(
920
+ "code",
921
+ {
922
+ className: `language-${$}`,
923
+ dangerouslySetInnerHTML: {
924
+ __html: j + (h.endsWith(`
925
+ `) ? `
926
+ ` : "")
927
+ }
928
+ }
929
+ )
930
+ }
931
+ ),
932
+ /* @__PURE__ */ t(
933
+ "textarea",
934
+ {
935
+ ref: E,
936
+ 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,
943
+ spellCheck: !1,
944
+ autoCapitalize: "off",
945
+ autoCorrect: "off",
946
+ "aria-describedby": f ? void 0 : V
947
+ }
948
+ ),
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.") })
950
+ ] })
951
+ ]
952
+ }
953
+ );
954
+ }
955
+ const be = "nice-code-editor-styles", ve = `
956
+ .nice-code-editor,
957
+ .nice-code-diff-editor {
958
+ border: 1px solid var(--nice-border, #e0e0e0);
959
+ border-radius: var(--nice-radius-sm, 4px);
960
+ overflow: hidden;
961
+ }
962
+
963
+ .nice-code-editor--loading,
964
+ .nice-code-editor--error,
965
+ .nice-code-diff-editor--loading {
966
+ display: flex;
967
+ align-items: center;
968
+ justify-content: center;
969
+ background: var(--nice-bg-tertiary, #f5f5f5);
970
+ }
971
+
972
+ .nice-code-editor__loader {
973
+ color: var(--nice-text-secondary, #666);
974
+ font-size: 14px;
975
+ }
976
+
977
+ .nice-code-editor__error {
978
+ display: flex;
979
+ flex-direction: column;
980
+ width: 100%;
981
+ height: 100%;
982
+ padding: var(--nice-space-2, 8px);
983
+ gap: var(--nice-space-2, 8px);
984
+ }
985
+
986
+ .nice-code-editor__error span {
987
+ color: var(--nice-error, #d32f2f);
988
+ }
989
+
990
+ /* Simple code editor */
991
+ .nice-simple-code-editor {
992
+ display: flex;
993
+ border: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
994
+ border-radius: var(--nice-radius-sm, 4px);
995
+ overflow: hidden;
996
+ font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
997
+ font-size: 14px;
998
+ line-height: 1.5;
999
+ background: var(--nice-bg-primary, var(--nice-bg-surface, #fff));
1000
+ color: var(--nice-text-primary, var(--nice-text-primary, #333));
1001
+ }
1002
+ .nice-simple-code-editor--dark {
1003
+ background: var(--nice-bg, #1e1e1e);
1004
+ color: var(--nice-text, #d4d4d4);
1005
+ }
1006
+
1007
+ .nice-simple-code-editor__line-numbers {
1008
+ padding: var(--nice-space-2, 8px) 0;
1009
+ background: var(--nice-bg-secondary, var(--nice-bg-tertiary, #f5f5f5));
1010
+ border-right: 1px solid var(--nice-border-color, var(--nice-border, #e0e0e0));
1011
+ user-select: none;
1012
+ text-align: right;
1013
+ color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
1014
+ overflow: hidden;
1015
+ }
1016
+ .nice-simple-code-editor--dark .nice-simple-code-editor__line-numbers {
1017
+ background: var(--nice-bg-secondary, #252526);
1018
+ border-right-color: var(--nice-border, #3c3c3c);
1019
+ color: var(--nice-text-muted, #858585);
1020
+ }
1021
+
1022
+ .nice-simple-code-editor__line-number {
1023
+ padding: 0 var(--nice-space-3, 12px);
1024
+ min-width: 40px;
1025
+ }
1026
+
1027
+ .nice-simple-code-editor__editor-area {
1028
+ position: relative;
1029
+ flex: 1;
1030
+ overflow: hidden;
1031
+ }
1032
+
1033
+ .nice-simple-code-editor__highlight,
1034
+ .nice-simple-code-editor__textarea {
1035
+ position: absolute;
1036
+ inset: 0;
1037
+ margin: 0;
1038
+ padding: var(--nice-space-2, 8px) var(--nice-space-3, 12px);
1039
+ border: 0;
1040
+ font: inherit;
1041
+ line-height: inherit;
1042
+ white-space: pre;
1043
+ overflow: auto;
1044
+ tab-size: 2;
1045
+ }
1046
+
1047
+ .nice-simple-code-editor__highlight {
1048
+ pointer-events: none;
1049
+ background: transparent;
1050
+ color: inherit;
1051
+ }
1052
+ .nice-simple-code-editor__highlight code {
1053
+ font: inherit;
1054
+ background: transparent;
1055
+ }
1056
+
1057
+ .nice-simple-code-editor__textarea {
1058
+ background: transparent;
1059
+ color: transparent;
1060
+ caret-color: var(--nice-text-primary, var(--nice-text-primary, #333));
1061
+ resize: none;
1062
+ outline: none;
1063
+ -webkit-text-fill-color: transparent;
1064
+ }
1065
+ .nice-simple-code-editor--dark .nice-simple-code-editor__textarea {
1066
+ caret-color: var(--nice-text, #d4d4d4);
1067
+ }
1068
+
1069
+ .nice-simple-code-editor__textarea::placeholder {
1070
+ color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
1071
+ -webkit-text-fill-color: var(--nice-text-secondary, var(--nice-text-secondary, #999));
1072
+ }
1073
+ .nice-simple-code-editor--dark .nice-simple-code-editor__textarea::placeholder {
1074
+ color: var(--nice-text-muted, #858585);
1075
+ -webkit-text-fill-color: var(--nice-text-muted, #858585);
1076
+ }
1077
+
1078
+ /* Prism token colors — light */
1079
+ .nice-simple-code-editor .token.comment,
1080
+ .nice-simple-code-editor .token.prolog,
1081
+ .nice-simple-code-editor .token.doctype,
1082
+ .nice-simple-code-editor .token.cdata { color: #6a737d; font-style: italic; }
1083
+ .nice-simple-code-editor .token.punctuation { color: #586069; }
1084
+ .nice-simple-code-editor .token.property,
1085
+ .nice-simple-code-editor .token.tag,
1086
+ .nice-simple-code-editor .token.boolean,
1087
+ .nice-simple-code-editor .token.number,
1088
+ .nice-simple-code-editor .token.constant,
1089
+ .nice-simple-code-editor .token.symbol,
1090
+ .nice-simple-code-editor .token.deleted { color: #005cc5; }
1091
+ .nice-simple-code-editor .token.selector,
1092
+ .nice-simple-code-editor .token.attr-name,
1093
+ .nice-simple-code-editor .token.string,
1094
+ .nice-simple-code-editor .token.char,
1095
+ .nice-simple-code-editor .token.builtin,
1096
+ .nice-simple-code-editor .token.inserted { color: #032f62; }
1097
+ .nice-simple-code-editor .token.operator,
1098
+ .nice-simple-code-editor .token.entity,
1099
+ .nice-simple-code-editor .token.url,
1100
+ .nice-simple-code-editor .token.variable { color: var(--nice-danger, #d73a49); }
1101
+ .nice-simple-code-editor .token.atrule,
1102
+ .nice-simple-code-editor .token.attr-value,
1103
+ .nice-simple-code-editor .token.keyword { color: var(--nice-danger, #d73a49); font-weight: 600; }
1104
+ .nice-simple-code-editor .token.function,
1105
+ .nice-simple-code-editor .token.class-name { color: #6f42c1; }
1106
+ .nice-simple-code-editor .token.regex,
1107
+ .nice-simple-code-editor .token.important { color: #e36209; }
1108
+
1109
+ /* Prism token colors — dark */
1110
+ .nice-simple-code-editor--dark .token.comment,
1111
+ .nice-simple-code-editor--dark .token.prolog,
1112
+ .nice-simple-code-editor--dark .token.doctype,
1113
+ .nice-simple-code-editor--dark .token.cdata { color: var(--nice-success, #6a9955); font-style: italic; }
1114
+ .nice-simple-code-editor--dark .token.punctuation { color: var(--nice-text, #d4d4d4); }
1115
+ .nice-simple-code-editor--dark .token.property,
1116
+ .nice-simple-code-editor--dark .token.tag,
1117
+ .nice-simple-code-editor--dark .token.boolean,
1118
+ .nice-simple-code-editor--dark .token.number,
1119
+ .nice-simple-code-editor--dark .token.constant,
1120
+ .nice-simple-code-editor--dark .token.symbol,
1121
+ .nice-simple-code-editor--dark .token.deleted { color: var(--nice-success-light, #b5cea8); }
1122
+ .nice-simple-code-editor--dark .token.selector,
1123
+ .nice-simple-code-editor--dark .token.attr-name,
1124
+ .nice-simple-code-editor--dark .token.string,
1125
+ .nice-simple-code-editor--dark .token.char,
1126
+ .nice-simple-code-editor--dark .token.builtin,
1127
+ .nice-simple-code-editor--dark .token.inserted { color: var(--nice-warning, #ce9178); }
1128
+ .nice-simple-code-editor--dark .token.operator,
1129
+ .nice-simple-code-editor--dark .token.entity,
1130
+ .nice-simple-code-editor--dark .token.url,
1131
+ .nice-simple-code-editor--dark .token.variable { color: var(--nice-primary, #569cd6); }
1132
+ .nice-simple-code-editor--dark .token.atrule,
1133
+ .nice-simple-code-editor--dark .token.attr-value,
1134
+ .nice-simple-code-editor--dark .token.keyword { color: #c586c0; font-weight: 600; }
1135
+ .nice-simple-code-editor--dark .token.function,
1136
+ .nice-simple-code-editor--dark .token.class-name { color: #dcdcaa; }
1137
+ .nice-simple-code-editor--dark .token.regex,
1138
+ .nice-simple-code-editor--dark .token.important { color: #d7ba7d; }
1139
+
1140
+ /* Toolbar */
1141
+ .nice-code-editor-wrap {
1142
+ border: 1px solid var(--nice-border, #e0e0e0);
1143
+ border-radius: var(--nice-radius-sm, 4px);
1144
+ overflow: hidden;
1145
+ }
1146
+ .nice-code-editor-wrap .nice-code-editor {
1147
+ border: none;
1148
+ border-radius: 0;
1149
+ }
1150
+ /* The editing surface draws no outline: while it has focus, the frame shows the ring
1151
+ (TODO_1.3.0 I4). */
1152
+ .nice-code-editor-wrap:has(.nice-code-editor:focus-within),
1153
+ .nice-code-diff-editor:focus-within,
1154
+ .nice-simple-code-editor:focus-within {
1155
+ border-color: var(--nice-color-primary, #3b82f6);
1156
+ box-shadow: var(--nice-focus-ring, 0 0 0 2px var(--nice-color-primary, #3b82f6));
1157
+ }
1158
+ .nice-code-editor__toolbar {
1159
+ display: flex;
1160
+ align-items: center;
1161
+ gap: var(--nice-space-0-5, 2px);
1162
+ padding: var(--nice-space-0-75, 3px) var(--nice-space-1-5, 6px);
1163
+ background: var(--nice-bg-tertiary, #f5f5f5);
1164
+ border-bottom: 1px solid var(--nice-border, #e0e0e0);
1165
+ }
1166
+ .nice-code-editor__toolbar-btn {
1167
+ display: inline-flex;
1168
+ align-items: center;
1169
+ justify-content: center;
1170
+ width: 26px;
1171
+ height: 26px;
1172
+ border: none;
1173
+ border-radius: var(--nice-radius-sm, 3px);
1174
+ background: transparent;
1175
+ color: var(--nice-text-secondary, #666);
1176
+ cursor: pointer;
1177
+ font-size: 14px;
1178
+ transition: background 0.15s, color 0.15s;
1179
+ }
1180
+ .nice-code-editor__toolbar-btn:hover {
1181
+ background: var(--nice-hover-bg, #e0e0e0);
1182
+ color: var(--nice-text-primary, #333);
1183
+ }
1184
+ .nice-code-editor__toolbar-btn--active {
1185
+ background: var(--nice-accent, #1976d2);
1186
+ color: var(--nice-text-on-primary, #FFF);
1187
+ }
1188
+ .nice-code-editor__toolbar-sep {
1189
+ width: 1px;
1190
+ height: 18px;
1191
+ background: var(--nice-border, #e0e0e0);
1192
+ margin: 0 var(--nice-space-1, 4px);
1193
+ }
1194
+
1195
+ /* Status bar */
1196
+ .nice-code-editor__statusbar {
1197
+ display: flex;
1198
+ align-items: center;
1199
+ gap: var(--nice-space-3, 12px);
1200
+ padding: var(--nice-space-0-5, 2px) var(--nice-space-2-5, 10px);
1201
+ background: var(--nice-bg-tertiary, #f5f5f5);
1202
+ border-top: 1px solid var(--nice-border, #e0e0e0);
1203
+ font-size: 12px;
1204
+ color: var(--nice-text-secondary, #666);
1205
+ user-select: none;
1206
+ }
1207
+ .nice-code-editor__statusbar-spacer { flex: 1; }
1208
+ .nice-code-editor__statusbar-lang {
1209
+ text-transform: uppercase;
1210
+ font-weight: 600;
1211
+ font-size: 11px;
1212
+ }
1213
+ .nice-code-editor__statusbar-markers {
1214
+ color: var(--nice-warning, #f39c12);
1215
+ font-weight: 600;
1216
+ }
1217
+ `;
1218
+ export {
1219
+ mt as NiceCodeDiffEditor,
1220
+ ut as NiceCodeEditor,
1221
+ pt as NiceSimpleCodeEditor
1222
+ };