@nice2dev/ui 1.1.9 → 1.2.0

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