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