@salilvnair/dui 1.0.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.
- package/LICENSE +21 -0
- package/README.md +185 -0
- package/dist/chunks/EditorView.shell-BGH2VhWM.js +460 -0
- package/dist/chunks/EditorView.shell-BGH2VhWM.js.map +1 -0
- package/dist/chunks/daakia-icons-DxWnX_IQ.js +1726 -0
- package/dist/chunks/daakia-icons-DxWnX_IQ.js.map +1 -0
- package/dist/icons/daakia-icons.d.ts +304 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +17032 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/components/button/AIButtonView.d.ts +20 -0
- package/dist/lib/components/button/ButtonView.d.ts +28 -0
- package/dist/lib/components/button/DropDownButtonView.d.ts +19 -0
- package/dist/lib/components/button/IconButtonView.d.ts +22 -0
- package/dist/lib/components/button/SegmentedView.d.ts +17 -0
- package/dist/lib/components/button/SplitButtonView.d.ts +23 -0
- package/dist/lib/components/chips/ChipView.d.ts +21 -0
- package/dist/lib/components/display/CodeBlockView.d.ts +11 -0
- package/dist/lib/components/display/ColoredTextView.d.ts +18 -0
- package/dist/lib/components/display/CopyButtonView.d.ts +11 -0
- package/dist/lib/components/display/DataTableView.d.ts +27 -0
- package/dist/lib/components/display/DottedCardView.d.ts +10 -0
- package/dist/lib/components/display/EmptyStateView.d.ts +14 -0
- package/dist/lib/components/display/ExpandableLogEntryView.d.ts +14 -0
- package/dist/lib/components/display/FeatureCategoryView.d.ts +18 -0
- package/dist/lib/components/display/HudView.d.ts +25 -0
- package/dist/lib/components/display/JsonTreeView.d.ts +11 -0
- package/dist/lib/components/display/LiveColorCustomizer.d.ts +21 -0
- package/dist/lib/components/display/LoaderView.d.ts +12 -0
- package/dist/lib/components/display/MarkdownView.d.ts +19 -0
- package/dist/lib/components/display/PromptCardView.d.ts +33 -0
- package/dist/lib/components/display/PromptLibraryEditorView.d.ts +32 -0
- package/dist/lib/components/display/PromptLibraryListView.d.ts +30 -0
- package/dist/lib/components/display/StageView.d.ts +26 -0
- package/dist/lib/components/display/StatsCardView.d.ts +15 -0
- package/dist/lib/components/display/StatusIndicatorView.d.ts +14 -0
- package/dist/lib/components/display/ToastView.d.ts +19 -0
- package/dist/lib/components/display/YamlKeyChip.d.ts +15 -0
- package/dist/lib/components/input/CheckboxView.d.ts +15 -0
- package/dist/lib/components/input/DebugEditorView.d.ts +26 -0
- package/dist/lib/components/input/DiffEditorView.d.ts +18 -0
- package/dist/lib/components/input/DiffEditorView.fallback.d.ts +2 -0
- package/dist/lib/components/input/DiffEditorView.monaco.d.ts +2 -0
- package/dist/lib/components/input/DurationInputView.d.ts +15 -0
- package/dist/lib/components/input/EditorView.d.ts +222 -0
- package/dist/lib/components/input/EditorView.fallback.d.ts +10 -0
- package/dist/lib/components/input/EditorView.monaco.d.ts +2 -0
- package/dist/lib/components/input/EditorView.shell.d.ts +13 -0
- package/dist/lib/components/input/FormDataTableView.d.ts +22 -0
- package/dist/lib/components/input/HiddenKeyValueItemView.d.ts +22 -0
- package/dist/lib/components/input/HighlightedInputView.d.ts +26 -0
- package/dist/lib/components/input/KeyValueTableRowView.d.ts +31 -0
- package/dist/lib/components/input/KeyValueTableView.d.ts +59 -0
- package/dist/lib/components/input/MergedInputView.d.ts +43 -0
- package/dist/lib/components/input/MultilineInputView.d.ts +15 -0
- package/dist/lib/components/input/SearchInputView.d.ts +17 -0
- package/dist/lib/components/input/SegmentedControlView.d.ts +23 -0
- package/dist/lib/components/input/SelectInputView.d.ts +31 -0
- package/dist/lib/components/input/SelectTextInputView.d.ts +44 -0
- package/dist/lib/components/input/SliderView.d.ts +15 -0
- package/dist/lib/components/input/TabView.d.ts +28 -0
- package/dist/lib/components/input/TagInputView.d.ts +10 -0
- package/dist/lib/components/input/TextInputView.d.ts +36 -0
- package/dist/lib/components/input/ThemeCardSelectorView.d.ts +18 -0
- package/dist/lib/components/input/ToggleSwitchView.d.ts +19 -0
- package/dist/lib/components/layout/BottomPanelView.d.ts +16 -0
- package/dist/lib/components/layout/CollapsibleSectionView.d.ts +14 -0
- package/dist/lib/components/layout/DebugView.d.ts +63 -0
- package/dist/lib/components/layout/FolderView.d.ts +85 -0
- package/dist/lib/components/layout/ResizablePanelView.d.ts +10 -0
- package/dist/lib/components/layout/SettingsNavView.d.ts +29 -0
- package/dist/lib/components/layout/SideNavView.d.ts +39 -0
- package/dist/lib/components/layout/SpacerView.d.ts +7 -0
- package/dist/lib/components/layout/SplitPanelView.d.ts +33 -0
- package/dist/lib/components/modal/ContextMenuView.d.ts +28 -0
- package/dist/lib/components/modal/InfoPopupView.d.ts +17 -0
- package/dist/lib/components/modal/ModalView.d.ts +41 -0
- package/dist/lib/components/rearrange/RearrangeView.d.ts +34 -0
- package/dist/lib/components/tabs/PilledTabView.d.ts +19 -0
- package/dist/lib/components/tabs/TabBarView.d.ts +28 -0
- package/dist/lib/components/tabs/TabView.d.ts +34 -0
- package/dist/lib/core/ButtonBase.d.ts +28 -0
- package/dist/lib/core/CardBase.d.ts +21 -0
- package/dist/lib/core/ChipBase.d.ts +21 -0
- package/dist/lib/core/DisplayBase.d.ts +21 -0
- package/dist/lib/core/DuiContext.d.ts +53 -0
- package/dist/lib/core/DuiTokens.d.ts +115 -0
- package/dist/lib/core/DuiTypes.d.ts +29 -0
- package/dist/lib/core/EditorBase.d.ts +13 -0
- package/dist/lib/core/InputBase.d.ts +25 -0
- package/dist/lib/core/MenuBase.d.ts +23 -0
- package/dist/lib/core/NavBase.d.ts +26 -0
- package/dist/lib/core/OverlayBase.d.ts +20 -0
- package/dist/lib/core/SelectBase.d.ts +22 -0
- package/dist/lib/core/TabBase.d.ts +25 -0
- package/dist/lib/core/TableBase.d.ts +19 -0
- package/dist/lib/core/ToggleBase.d.ts +19 -0
- package/dist/lib/core/index.d.ts +25 -0
- package/dist/lib/index.d.ts +159 -0
- package/dist/lib/monaco-runtime.d.ts +29 -0
- package/dist/lib/theme/core.d.ts +8 -0
- package/dist/lib/theme/editor.d.ts +11 -0
- package/dist/lib/theme/utils.d.ts +6 -0
- package/dist/monaco-setup.d.ts +4 -0
- package/dist/monaco-setup.js +883 -0
- package/dist/monaco-setup.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/style.js +2 -0
- package/dist/style.js.map +1 -0
- package/dist/theme/core.js +191 -0
- package/dist/theme/core.js.map +1 -0
- package/dist/theme/editor.js +104 -0
- package/dist/theme/editor.js.map +1 -0
- package/dist/theme/utils.js +67 -0
- package/dist/theme/utils.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,883 @@
|
|
|
1
|
+
import $, { DiffEditor as ie, loader as ae } from "@monaco-editor/react";
|
|
2
|
+
import * as B from "monaco-editor";
|
|
3
|
+
import { k as K, E as V, v as se, w as le, x as ue } from "./chunks/EditorView.shell-BGH2VhWM.js";
|
|
4
|
+
import { jsx as L } from "react/jsx-runtime";
|
|
5
|
+
import { useState as de, useEffect as R, useRef as D, useCallback as G, useMemo as U } from "react";
|
|
6
|
+
import ge from "monaco-editor/esm/vs/editor/editor.worker?worker&inline";
|
|
7
|
+
import ce from "monaco-editor/esm/vs/language/json/json.worker?worker&inline";
|
|
8
|
+
import fe from "monaco-editor/esm/vs/language/html/html.worker?worker&inline";
|
|
9
|
+
import pe from "monaco-editor/esm/vs/language/typescript/ts.worker?worker&inline";
|
|
10
|
+
import { javascriptDefaults as P, JsxEmit as J, ModuleResolutionKind as Z, ModuleKind as Y, ScriptTarget as X, typescriptDefaults as Q } from "monaco-editor/esm/vs/language/typescript/monaco.contribution";
|
|
11
|
+
function H() {
|
|
12
|
+
var e;
|
|
13
|
+
const r = ((e = document.body) == null ? void 0 : e.getAttribute("data-vscode-theme-kind")) || document.documentElement.getAttribute("data-vscode-theme-kind");
|
|
14
|
+
return r ? r === "vscode-light" ? "light" : "dark" : document.documentElement.getAttribute("data-theme") || "dark";
|
|
15
|
+
}
|
|
16
|
+
function q() {
|
|
17
|
+
const [r, e] = de(H);
|
|
18
|
+
return R(() => {
|
|
19
|
+
const l = () => e(H()), g = new MutationObserver(l);
|
|
20
|
+
g.observe(document.documentElement, { attributes: !0, attributeFilter: ["data-theme", "data-vscode-theme-kind"] });
|
|
21
|
+
const c = new MutationObserver(l);
|
|
22
|
+
return document.body && c.observe(document.body, { attributes: !0, attributeFilter: ["data-vscode-theme-kind"] }), () => {
|
|
23
|
+
g.disconnect(), c.disconnect();
|
|
24
|
+
};
|
|
25
|
+
}, []), r;
|
|
26
|
+
}
|
|
27
|
+
const me = "";
|
|
28
|
+
function ke(r, e, l) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
function he(r) {
|
|
32
|
+
const {
|
|
33
|
+
breakpoints: e,
|
|
34
|
+
disabledBreakpoints: l,
|
|
35
|
+
conditionalBreakpointLines: g,
|
|
36
|
+
pausedLine: c,
|
|
37
|
+
onToggleBreakpoint: f,
|
|
38
|
+
onGlyphContextMenu: t
|
|
39
|
+
} = r, b = D(null), T = D(null), k = D([]), w = D([]), C = D([]), v = D([]), o = G((n) => {
|
|
40
|
+
const i = b.current;
|
|
41
|
+
if (!i) return !0;
|
|
42
|
+
const u = i.getModel();
|
|
43
|
+
return !u || n > u.getLineCount() ? !1 : !!u.getLineContent(n).trim();
|
|
44
|
+
}, []);
|
|
45
|
+
return R(() => {
|
|
46
|
+
const n = b.current, i = T.current;
|
|
47
|
+
if (!n || !i) return;
|
|
48
|
+
const u = [];
|
|
49
|
+
if (e)
|
|
50
|
+
for (const a of e) {
|
|
51
|
+
if (c && a === c) continue;
|
|
52
|
+
const m = l == null ? void 0 : l.includes(a), p = g == null ? void 0 : g.includes(a);
|
|
53
|
+
let d = "daakia-bp-glyph";
|
|
54
|
+
m ? d = "daakia-bp-glyph--disabled" : p && (d = "daakia-bp-glyph--conditional"), u.push({
|
|
55
|
+
range: new i.Range(a, 1, a, 1),
|
|
56
|
+
options: {
|
|
57
|
+
isWholeLine: !0,
|
|
58
|
+
className: m ? "" : "daakia-bp-line",
|
|
59
|
+
stickiness: i.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
|
60
|
+
glyphMarginClassName: d,
|
|
61
|
+
glyphMarginHoverMessage: {
|
|
62
|
+
value: p ? "Conditional Breakpoint" : m ? "Disabled Breakpoint" : "Breakpoint"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
k.current = n.deltaDecorations(k.current, u);
|
|
68
|
+
}, [e, l, g, c]), R(() => {
|
|
69
|
+
const n = b.current, i = T.current;
|
|
70
|
+
if (!(!n || !i))
|
|
71
|
+
if (c) {
|
|
72
|
+
const a = (e == null ? void 0 : e.includes(c)) ? "daakia-paused-line__arrow daakia-paused-line__arrow--with-bp" : "daakia-paused-line__arrow";
|
|
73
|
+
w.current = n.deltaDecorations(w.current, [{
|
|
74
|
+
range: new i.Range(c, 1, c, 1),
|
|
75
|
+
options: {
|
|
76
|
+
isWholeLine: !0,
|
|
77
|
+
className: "daakia-paused-line",
|
|
78
|
+
glyphMarginClassName: a,
|
|
79
|
+
stickiness: i.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges
|
|
80
|
+
}
|
|
81
|
+
}]), n.revealLineInCenter(c);
|
|
82
|
+
} else
|
|
83
|
+
w.current = n.deltaDecorations(w.current, []);
|
|
84
|
+
}, [c, e]), R(() => () => {
|
|
85
|
+
v.current.forEach((n) => {
|
|
86
|
+
var i;
|
|
87
|
+
return (i = n == null ? void 0 : n.dispose) == null ? void 0 : i.call(n);
|
|
88
|
+
}), v.current = [];
|
|
89
|
+
}, []), { attach: G((n, i) => {
|
|
90
|
+
b.current = n, T.current = i;
|
|
91
|
+
const u = n.getDomNode();
|
|
92
|
+
if (u) {
|
|
93
|
+
const a = u.querySelector(".margin");
|
|
94
|
+
a && a.setAttribute("data-daakia-bp-gutter", "");
|
|
95
|
+
}
|
|
96
|
+
if (f) {
|
|
97
|
+
const a = n.onMouseDown((m) => {
|
|
98
|
+
var p;
|
|
99
|
+
if (m.event.leftButton && m.target.type === i.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {
|
|
100
|
+
const d = (p = m.target.position) == null ? void 0 : p.lineNumber;
|
|
101
|
+
d && o(d) && f(d);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
v.current.push(a);
|
|
105
|
+
}
|
|
106
|
+
if (t) {
|
|
107
|
+
let a = null;
|
|
108
|
+
const m = n.onMouseDown((d) => {
|
|
109
|
+
var h;
|
|
110
|
+
if (d.event.rightButton && (d.target.type === i.editor.MouseTargetType.GUTTER_GLYPH_MARGIN || d.target.type === i.editor.MouseTargetType.GUTTER_LINE_NUMBERS || d.target.type === i.editor.MouseTargetType.GUTTER_LINE_DECORATIONS)) {
|
|
111
|
+
const x = (h = d.target.position) == null ? void 0 : h.lineNumber;
|
|
112
|
+
x && o(x) && (a = { line: x, x: d.event.posx, y: d.event.posy });
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
v.current.push(m);
|
|
116
|
+
const p = n.getDomNode();
|
|
117
|
+
if (p) {
|
|
118
|
+
const d = (h) => {
|
|
119
|
+
a ? (h.preventDefault(), h.stopPropagation(), t(a.line, { x: a.x, y: a.y }), a = null) : h.target.closest("[data-daakia-bp-gutter]") && (h.preventDefault(), h.stopPropagation());
|
|
120
|
+
};
|
|
121
|
+
p.addEventListener("contextmenu", d, !0), v.current.push({ dispose: () => p.removeEventListener("contextmenu", d, !0) });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (f) {
|
|
125
|
+
const a = n.onMouseMove((p) => {
|
|
126
|
+
var d;
|
|
127
|
+
if (p.target.type === i.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {
|
|
128
|
+
const h = (d = p.target.position) == null ? void 0 : d.lineNumber;
|
|
129
|
+
if (h && o(h)) {
|
|
130
|
+
const x = n.getModel();
|
|
131
|
+
if (x) {
|
|
132
|
+
const M = x.getLineDecorations(h);
|
|
133
|
+
if (!(M == null ? void 0 : M.some(
|
|
134
|
+
(E) => {
|
|
135
|
+
var y, I, A, F;
|
|
136
|
+
return ((I = (y = E.options) == null ? void 0 : y.glyphMarginClassName) == null ? void 0 : I.startsWith("daakia-bp-glyph")) && !((F = (A = E.options) == null ? void 0 : A.glyphMarginClassName) != null && F.includes("hover"));
|
|
137
|
+
}
|
|
138
|
+
))) {
|
|
139
|
+
C.current = n.deltaDecorations(C.current, [{
|
|
140
|
+
range: new i.Range(h, 1, h, 1),
|
|
141
|
+
options: {
|
|
142
|
+
isWholeLine: !1,
|
|
143
|
+
stickiness: i.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
|
144
|
+
glyphMarginClassName: "daakia-bp-glyph--hover",
|
|
145
|
+
glyphMarginHoverMessage: { value: "Left-click to add a breakpoint" }
|
|
146
|
+
}
|
|
147
|
+
}]);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
C.current.length && (C.current = n.deltaDecorations(C.current, []));
|
|
154
|
+
});
|
|
155
|
+
v.current.push(a);
|
|
156
|
+
const m = n.onMouseLeave(() => {
|
|
157
|
+
C.current.length && (C.current = n.deltaDecorations(C.current, []));
|
|
158
|
+
});
|
|
159
|
+
v.current.push(m);
|
|
160
|
+
}
|
|
161
|
+
if (e) {
|
|
162
|
+
const a = [];
|
|
163
|
+
for (const m of e) {
|
|
164
|
+
const p = l == null ? void 0 : l.includes(m), d = g == null ? void 0 : g.includes(m);
|
|
165
|
+
let h = "daakia-bp-glyph";
|
|
166
|
+
p ? h = "daakia-bp-glyph--disabled" : d && (h = "daakia-bp-glyph--conditional"), a.push({
|
|
167
|
+
range: new i.Range(m, 1, m, 1),
|
|
168
|
+
options: {
|
|
169
|
+
isWholeLine: !0,
|
|
170
|
+
className: p ? "" : "daakia-bp-line",
|
|
171
|
+
stickiness: i.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
|
172
|
+
glyphMarginClassName: h,
|
|
173
|
+
glyphMarginHoverMessage: {
|
|
174
|
+
value: d ? "Conditional Breakpoint" : p ? "Disabled Breakpoint" : "Breakpoint"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
k.current = n.deltaDecorations(k.current, a);
|
|
180
|
+
}
|
|
181
|
+
}, [f, t, o, e, l, g]) };
|
|
182
|
+
}
|
|
183
|
+
const ee = {
|
|
184
|
+
navigateLine: null,
|
|
185
|
+
setNavigateLine: () => {
|
|
186
|
+
},
|
|
187
|
+
active: !1,
|
|
188
|
+
status: "idle",
|
|
189
|
+
variables: []
|
|
190
|
+
};
|
|
191
|
+
function _(r) {
|
|
192
|
+
return r(ee);
|
|
193
|
+
}
|
|
194
|
+
_.getState = () => ee;
|
|
195
|
+
let z = !1;
|
|
196
|
+
const te = {
|
|
197
|
+
javascript: ".js",
|
|
198
|
+
typescript: ".ts",
|
|
199
|
+
json: ".json",
|
|
200
|
+
xml: ".xml",
|
|
201
|
+
html: ".html",
|
|
202
|
+
css: ".css",
|
|
203
|
+
graphql: ".graphql",
|
|
204
|
+
python: ".py",
|
|
205
|
+
yaml: ".yaml",
|
|
206
|
+
sql: ".sql",
|
|
207
|
+
markdown: ".md",
|
|
208
|
+
plaintext: ".txt"
|
|
209
|
+
};
|
|
210
|
+
function be(r) {
|
|
211
|
+
let l = 0, g = "";
|
|
212
|
+
const c = r.replace(/>\s*</g, "><").split(new RegExp("(?<=>)(?=<)"));
|
|
213
|
+
for (const f of c) {
|
|
214
|
+
const t = /^<\//.test(f), b = /\/>$/.test(f) || /^<!/.test(f) || /^<\?/.test(f);
|
|
215
|
+
t && (l = Math.max(0, l - 1)), g += " ".repeat(l) + f.trim() + `
|
|
216
|
+
`, !t && !b && /^<[^/!?]/.test(f) && l++;
|
|
217
|
+
}
|
|
218
|
+
return g.trimEnd();
|
|
219
|
+
}
|
|
220
|
+
function ye(r) {
|
|
221
|
+
return r.split(`
|
|
222
|
+
`).map((e) => e.trimEnd()).join(`
|
|
223
|
+
`).replace(/\n{3,}/g, `
|
|
224
|
+
|
|
225
|
+
`).trim();
|
|
226
|
+
}
|
|
227
|
+
function Ce(r) {
|
|
228
|
+
const e = /\b(SELECT|DISTINCT|FROM|WHERE|INNER JOIN|LEFT JOIN|RIGHT JOIN|FULL OUTER JOIN|FULL JOIN|CROSS JOIN|JOIN|ON|AND|OR|NOT|ORDER BY|GROUP BY|HAVING|LIMIT|OFFSET|UNION ALL|UNION|INTERSECT|EXCEPT|INSERT INTO|VALUES|UPDATE|SET|DELETE FROM|CREATE TABLE|DROP TABLE|ALTER TABLE|WITH)\b/gi;
|
|
229
|
+
return r.replace(/\s+/g, " ").replace(e, `
|
|
230
|
+
$1`).split(`
|
|
231
|
+
`).map((l) => l.trim()).filter((l) => l.length > 0).join(`
|
|
232
|
+
`);
|
|
233
|
+
}
|
|
234
|
+
function Ee({
|
|
235
|
+
value: r,
|
|
236
|
+
onChange: e,
|
|
237
|
+
language: l = "json",
|
|
238
|
+
height: g = "200px",
|
|
239
|
+
minHeight: c,
|
|
240
|
+
readOnly: f = !1,
|
|
241
|
+
placeholder: t,
|
|
242
|
+
wordWrap: b = !0,
|
|
243
|
+
size: T,
|
|
244
|
+
fontSize: k,
|
|
245
|
+
className: w = "",
|
|
246
|
+
bordered: C = !1,
|
|
247
|
+
onEditorMount: v,
|
|
248
|
+
contextMenuMode: o = "native",
|
|
249
|
+
contextMenuItems: s,
|
|
250
|
+
editorOptions: n,
|
|
251
|
+
accentColor: i
|
|
252
|
+
}) {
|
|
253
|
+
const u = K(T), a = k ?? u.fontSize, m = q(), p = D(null), d = D([]), h = U(
|
|
254
|
+
() => `inmemory://daakia/${crypto.randomUUID()}${te[l] || ".txt"}`,
|
|
255
|
+
[l]
|
|
256
|
+
), x = typeof g == "number" ? `${g}px` : g, M = c ? `max(${x}, ${c}px)` : x;
|
|
257
|
+
return R(() => () => {
|
|
258
|
+
d.current.forEach((y) => {
|
|
259
|
+
var I;
|
|
260
|
+
return (I = y == null ? void 0 : y.dispose) == null ? void 0 : I.call(y);
|
|
261
|
+
}), d.current = [];
|
|
262
|
+
const E = p.current;
|
|
263
|
+
if (E) {
|
|
264
|
+
const y = E.getModel();
|
|
265
|
+
y && y.dispose();
|
|
266
|
+
}
|
|
267
|
+
}, []), R(() => {
|
|
268
|
+
if (!f) return;
|
|
269
|
+
const E = p.current;
|
|
270
|
+
if (!E) return;
|
|
271
|
+
const y = E.getModel();
|
|
272
|
+
!y || y.getValue() === r || y.setValue(r);
|
|
273
|
+
}, [r, f]), /* @__PURE__ */ L(V, { bordered: C, containerHeight: M, contextMenuMode: o, contextMenuItems: s, accentColor: i, children: /* @__PURE__ */ L(
|
|
274
|
+
$,
|
|
275
|
+
{
|
|
276
|
+
height: "100%",
|
|
277
|
+
language: l,
|
|
278
|
+
path: h,
|
|
279
|
+
value: r,
|
|
280
|
+
theme: m === "light" ? "daakia-light" : "daakia-dark",
|
|
281
|
+
onChange: (E) => e == null ? void 0 : e(E ?? ""),
|
|
282
|
+
onMount: (E, y) => {
|
|
283
|
+
p.current = E, d.current = [], oe(E, y, { language: l, value: r, placeholder: t, onEditorMount: v, contextMenuMode: o });
|
|
284
|
+
},
|
|
285
|
+
options: ne({ readOnly: f, fontSize: a, wordWrap: b, glyphMargin: !1, contextMenuMode: o, editorOptions: n })
|
|
286
|
+
}
|
|
287
|
+
) });
|
|
288
|
+
}
|
|
289
|
+
function ve({
|
|
290
|
+
value: r,
|
|
291
|
+
onChange: e,
|
|
292
|
+
language: l = "json",
|
|
293
|
+
height: g = "200px",
|
|
294
|
+
minHeight: c,
|
|
295
|
+
readOnly: f = !1,
|
|
296
|
+
placeholder: t,
|
|
297
|
+
wordWrap: b = !0,
|
|
298
|
+
size: T,
|
|
299
|
+
fontSize: k,
|
|
300
|
+
className: w = "",
|
|
301
|
+
bordered: C = !1,
|
|
302
|
+
breakpoints: v,
|
|
303
|
+
disabledBreakpoints: o,
|
|
304
|
+
conditionalBreakpointLines: s,
|
|
305
|
+
pausedLine: n,
|
|
306
|
+
onToggleBreakpoint: i,
|
|
307
|
+
onGlyphContextMenu: u,
|
|
308
|
+
onEditorMount: a,
|
|
309
|
+
contextMenuMode: m = "native",
|
|
310
|
+
contextMenuItems: p,
|
|
311
|
+
editorOptions: d,
|
|
312
|
+
accentColor: h
|
|
313
|
+
}) {
|
|
314
|
+
const x = K(T), M = k ?? x.fontSize, W = q(), E = D(null), y = D([]), I = U(
|
|
315
|
+
() => `inmemory://daakia/${crypto.randomUUID()}${te[l] || ".txt"}`,
|
|
316
|
+
[l]
|
|
317
|
+
), A = typeof g == "number" ? `${g}px` : g, F = c ? `max(${A}, ${c}px)` : A, { attach: re } = he({
|
|
318
|
+
breakpoints: v,
|
|
319
|
+
disabledBreakpoints: o,
|
|
320
|
+
conditionalBreakpointLines: s,
|
|
321
|
+
pausedLine: n,
|
|
322
|
+
onToggleBreakpoint: i,
|
|
323
|
+
onGlyphContextMenu: u
|
|
324
|
+
}), O = _((S) => S.navigateLine);
|
|
325
|
+
return R(() => () => {
|
|
326
|
+
y.current.forEach((N) => {
|
|
327
|
+
var j;
|
|
328
|
+
return (j = N == null ? void 0 : N.dispose) == null ? void 0 : j.call(N);
|
|
329
|
+
}), y.current = [];
|
|
330
|
+
const S = E.current;
|
|
331
|
+
if (S) {
|
|
332
|
+
const N = S.getModel();
|
|
333
|
+
N && N.dispose();
|
|
334
|
+
}
|
|
335
|
+
}, []), R(() => {
|
|
336
|
+
if (!f) return;
|
|
337
|
+
const S = E.current;
|
|
338
|
+
if (!S) return;
|
|
339
|
+
const N = S.getModel();
|
|
340
|
+
!N || N.getValue() === r || N.setValue(r);
|
|
341
|
+
}, [r, f]), R(() => {
|
|
342
|
+
!O || !E.current || !v || (E.current.revealLineInCenter(O), E.current.setPosition({ lineNumber: O, column: 1 }), _.getState().setNavigateLine(null));
|
|
343
|
+
}, [O, v]), /* @__PURE__ */ L(V, { bordered: C, containerHeight: F, contextMenuMode: m, contextMenuItems: p, accentColor: h, children: /* @__PURE__ */ L(
|
|
344
|
+
$,
|
|
345
|
+
{
|
|
346
|
+
height: "100%",
|
|
347
|
+
language: l,
|
|
348
|
+
path: I,
|
|
349
|
+
value: r,
|
|
350
|
+
theme: W === "light" ? "daakia-light" : "daakia-dark",
|
|
351
|
+
onChange: (S) => e == null ? void 0 : e(S ?? ""),
|
|
352
|
+
onMount: (S, N) => {
|
|
353
|
+
E.current = S, y.current = [], re(S, N), oe(S, N, { language: l, value: r, placeholder: t, onEditorMount: a, contextMenuMode: m });
|
|
354
|
+
},
|
|
355
|
+
options: ne({ readOnly: f, fontSize: M, wordWrap: b, glyphMargin: !!i, contextMenuMode: m, editorOptions: d })
|
|
356
|
+
}
|
|
357
|
+
) });
|
|
358
|
+
}
|
|
359
|
+
function we({ debugSupported: r = !1, className: e = "", ...l }) {
|
|
360
|
+
return r ? /* @__PURE__ */ L(ve, { className: e, ...l }) : /* @__PURE__ */ L(Ee, { className: e, ...l });
|
|
361
|
+
}
|
|
362
|
+
function ne({ readOnly: r, fontSize: e, wordWrap: l, glyphMargin: g, contextMenuMode: c = "native", editorOptions: f }) {
|
|
363
|
+
var b, T, k, w, C, v, o, s, n, i, u;
|
|
364
|
+
const t = f ?? {};
|
|
365
|
+
return {
|
|
366
|
+
// ── Consumer-overridable defaults ────────────────────────────────────────
|
|
367
|
+
lineNumbers: t.lineNumbers ?? "on",
|
|
368
|
+
minimap: { enabled: t.minimap ?? !1 },
|
|
369
|
+
scrollBeyondLastLine: t.scrollBeyondLastLine ?? !1,
|
|
370
|
+
smoothScrolling: t.smoothScrolling ?? !1,
|
|
371
|
+
mouseWheelZoom: t.mouseWheelZoom ?? !1,
|
|
372
|
+
folding: t.folding ?? !0,
|
|
373
|
+
showFoldingControls: t.showFoldingControls ?? "mouseover",
|
|
374
|
+
tabSize: t.tabSize ?? 2,
|
|
375
|
+
formatOnPaste: t.formatOnPaste ?? !0,
|
|
376
|
+
formatOnType: t.formatOnType ?? !0,
|
|
377
|
+
autoIndent: t.autoIndent ?? "full",
|
|
378
|
+
renderWhitespace: t.renderWhitespace ?? "selection",
|
|
379
|
+
matchBrackets: t.matchBrackets ?? "always",
|
|
380
|
+
bracketPairColorization: { enabled: t.bracketPairColorization ?? !0 },
|
|
381
|
+
colorDecorators: t.colorDecorators ?? !0,
|
|
382
|
+
linkedEditing: t.linkedEditing ?? !0,
|
|
383
|
+
copyWithSyntaxHighlighting: t.copyWithSyntaxHighlighting ?? !0,
|
|
384
|
+
quickSuggestions: t.quickSuggestions ?? !0,
|
|
385
|
+
suggestOnTriggerCharacters: t.suggestOnTriggerCharacters ?? !0,
|
|
386
|
+
acceptSuggestionOnEnter: t.acceptSuggestionOnEnter ?? "on",
|
|
387
|
+
hover: { enabled: t.hover ?? !0 },
|
|
388
|
+
parameterHints: { enabled: t.parameterHints ?? !0 },
|
|
389
|
+
codeLens: t.codeLens ?? !1,
|
|
390
|
+
inlayHints: { enabled: t.inlayHints ?? !1 ? "on" : "off" },
|
|
391
|
+
padding: { top: ((b = t.padding) == null ? void 0 : b.top) ?? 8, bottom: ((T = t.padding) == null ? void 0 : T.bottom) ?? 8 },
|
|
392
|
+
...t.cursorStyle && { cursorStyle: t.cursorStyle },
|
|
393
|
+
...t.cursorBlinking && { cursorBlinking: t.cursorBlinking },
|
|
394
|
+
...t.lineHeight && { lineHeight: t.lineHeight },
|
|
395
|
+
...t.letterSpacing && { letterSpacing: t.letterSpacing },
|
|
396
|
+
...t.rulers && { rulers: t.rulers },
|
|
397
|
+
...t.lineDecorationsWidth !== void 0 && { lineDecorationsWidth: t.lineDecorationsWidth },
|
|
398
|
+
...t.lineNumbersMinChars !== void 0 && { lineNumbersMinChars: t.lineNumbersMinChars },
|
|
399
|
+
// ── Prop-level overrides (top-level EditorView props win over editorOptions) ─
|
|
400
|
+
readOnly: r,
|
|
401
|
+
fontSize: e,
|
|
402
|
+
wordWrap: t.wordWrap ?? (l ? "on" : "off"),
|
|
403
|
+
// ── DUI structural — never overridable ──────────────────────────────────
|
|
404
|
+
automaticLayout: !0,
|
|
405
|
+
glyphMargin: g,
|
|
406
|
+
renderLineHighlight: t.renderLineHighlight ?? (g ? "line" : "none"),
|
|
407
|
+
fixedOverflowWidgets: !0,
|
|
408
|
+
contextmenu: c === "native",
|
|
409
|
+
overviewRulerLanes: 0,
|
|
410
|
+
hideCursorInOverviewRuler: !0,
|
|
411
|
+
overviewRulerBorder: !1,
|
|
412
|
+
scrollbar: {
|
|
413
|
+
vertical: ((k = t.scrollbar) == null ? void 0 : k.vertical) ?? "auto",
|
|
414
|
+
horizontal: ((w = t.scrollbar) == null ? void 0 : w.horizontal) ?? "auto",
|
|
415
|
+
verticalScrollbarSize: ((C = t.scrollbar) == null ? void 0 : C.verticalScrollbarSize) ?? 6,
|
|
416
|
+
horizontalScrollbarSize: ((v = t.scrollbar) == null ? void 0 : v.horizontalScrollbarSize) ?? 6
|
|
417
|
+
},
|
|
418
|
+
fontFamily: t.fontFamily ?? 'Menlo, Monaco, "Courier New", monospace',
|
|
419
|
+
autoClosingBrackets: "always",
|
|
420
|
+
autoClosingQuotes: "always",
|
|
421
|
+
autoClosingDelete: "always",
|
|
422
|
+
autoSurround: "languageDefined",
|
|
423
|
+
guides: { bracketPairs: !0, indentation: !0 },
|
|
424
|
+
suggest: {
|
|
425
|
+
showKeywords: ((o = t.suggest) == null ? void 0 : o.showKeywords) ?? !0,
|
|
426
|
+
showSnippets: ((s = t.suggest) == null ? void 0 : s.showSnippets) ?? !0,
|
|
427
|
+
showValues: ((n = t.suggest) == null ? void 0 : n.showValues) ?? !0,
|
|
428
|
+
showProperties: ((i = t.suggest) == null ? void 0 : i.showProperties) ?? !0,
|
|
429
|
+
...((u = t.suggest) == null ? void 0 : u.showIcons) !== void 0 && { showIcons: t.suggest.showIcons }
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function oe(r, e, { language: l, value: g, placeholder: c, onEditorMount: f, contextMenuMode: t = "native" }) {
|
|
434
|
+
const b = () => r.layout();
|
|
435
|
+
b(), requestAnimationFrame(b), setTimeout(b, 50), setTimeout(b, 200);
|
|
436
|
+
const T = r.getContainerDomNode().parentElement;
|
|
437
|
+
if (T) {
|
|
438
|
+
const o = new ResizeObserver(b);
|
|
439
|
+
o.observe(T), r.onDidDispose(() => o.disconnect());
|
|
440
|
+
}
|
|
441
|
+
r.updateOptions({
|
|
442
|
+
autoClosingBrackets: "always",
|
|
443
|
+
autoClosingQuotes: "always",
|
|
444
|
+
autoClosingDelete: "always",
|
|
445
|
+
autoSurround: "languageDefined",
|
|
446
|
+
autoIndent: "full"
|
|
447
|
+
});
|
|
448
|
+
const k = e.KeyMod, w = e.KeyCode;
|
|
449
|
+
r.addAction({
|
|
450
|
+
id: "daakia.clipboard.copy",
|
|
451
|
+
label: "Copy",
|
|
452
|
+
keybindings: [k.CtrlCmd | w.KeyC],
|
|
453
|
+
run: (o) => {
|
|
454
|
+
var n, i;
|
|
455
|
+
const s = o.getSelection();
|
|
456
|
+
if (s && !s.isEmpty())
|
|
457
|
+
navigator.clipboard.writeText(((n = o.getModel()) == null ? void 0 : n.getValueInRange(s)) || "");
|
|
458
|
+
else {
|
|
459
|
+
const u = o.getPosition();
|
|
460
|
+
u && navigator.clipboard.writeText((((i = o.getModel()) == null ? void 0 : i.getLineContent(u.lineNumber)) || "") + `
|
|
461
|
+
`);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}), r.addAction({
|
|
465
|
+
id: "daakia.clipboard.cut",
|
|
466
|
+
label: "Cut",
|
|
467
|
+
keybindings: [k.CtrlCmd | w.KeyX],
|
|
468
|
+
run: (o) => {
|
|
469
|
+
var n;
|
|
470
|
+
const s = o.getSelection();
|
|
471
|
+
if (s && !s.isEmpty())
|
|
472
|
+
navigator.clipboard.writeText(((n = o.getModel()) == null ? void 0 : n.getValueInRange(s)) || ""), o.executeEdits("cut", [{ range: s, text: "" }]);
|
|
473
|
+
else {
|
|
474
|
+
const i = o.getPosition();
|
|
475
|
+
if (i) {
|
|
476
|
+
const u = o.getModel();
|
|
477
|
+
u && (navigator.clipboard.writeText(u.getLineContent(i.lineNumber) + `
|
|
478
|
+
`), o.executeEdits("cut", [{ range: new e.Range(i.lineNumber, 1, i.lineNumber + 1, 1), text: "" }]));
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}), r.addAction({
|
|
483
|
+
id: "daakia.clipboard.paste",
|
|
484
|
+
label: "Paste",
|
|
485
|
+
keybindings: [k.CtrlCmd | w.KeyV],
|
|
486
|
+
run: async (o) => {
|
|
487
|
+
try {
|
|
488
|
+
const s = await navigator.clipboard.readText();
|
|
489
|
+
if (s) {
|
|
490
|
+
const n = o.getSelection();
|
|
491
|
+
n && o.executeEdits("paste", [{ range: n, text: s, forceMoveMarkers: !0 }]);
|
|
492
|
+
}
|
|
493
|
+
} catch {
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}), r.addAction({
|
|
497
|
+
id: "daakia.clipboard.selectAll",
|
|
498
|
+
label: "Select All",
|
|
499
|
+
keybindings: [k.CtrlCmd | w.KeyA],
|
|
500
|
+
run: (o) => {
|
|
501
|
+
const s = o.getModel();
|
|
502
|
+
s && o.setSelection(s.getFullModelRange());
|
|
503
|
+
}
|
|
504
|
+
}), r.addAction({
|
|
505
|
+
id: "daakia.format.document",
|
|
506
|
+
label: "Format Document",
|
|
507
|
+
keybindings: [k.Shift | k.Alt | w.KeyF],
|
|
508
|
+
contextMenuGroupId: "modification",
|
|
509
|
+
contextMenuOrder: 1.5,
|
|
510
|
+
run: async (o) => {
|
|
511
|
+
var i;
|
|
512
|
+
const s = o.getModel();
|
|
513
|
+
if (!s) return;
|
|
514
|
+
const n = s.getLanguageId();
|
|
515
|
+
if (n === "xml" || n === "html")
|
|
516
|
+
try {
|
|
517
|
+
const u = s.getValue(), a = be(u);
|
|
518
|
+
a !== u && o.executeEdits("daakia.format", [{ range: s.getFullModelRange(), text: a }]);
|
|
519
|
+
} catch {
|
|
520
|
+
}
|
|
521
|
+
else if (n === "yaml")
|
|
522
|
+
try {
|
|
523
|
+
const u = s.getValue(), a = ye(u);
|
|
524
|
+
a !== u && o.executeEdits("daakia.format", [{ range: s.getFullModelRange(), text: a }]);
|
|
525
|
+
} catch {
|
|
526
|
+
}
|
|
527
|
+
else if (n === "sql")
|
|
528
|
+
try {
|
|
529
|
+
const u = s.getValue(), a = Ce(u);
|
|
530
|
+
a !== u && o.executeEdits("daakia.format", [{ range: s.getFullModelRange(), text: a }]);
|
|
531
|
+
} catch {
|
|
532
|
+
}
|
|
533
|
+
else
|
|
534
|
+
await ((i = o.getAction("editor.action.formatDocument")) == null ? void 0 : i.run());
|
|
535
|
+
}
|
|
536
|
+
}), r.addAction({
|
|
537
|
+
id: "daakia.findAndReplace",
|
|
538
|
+
label: "Find and Replace",
|
|
539
|
+
keybindings: [k.CtrlCmd | k.Shift | w.KeyH],
|
|
540
|
+
contextMenuGroupId: "navigation",
|
|
541
|
+
contextMenuOrder: 1.5,
|
|
542
|
+
run: () => {
|
|
543
|
+
var o;
|
|
544
|
+
return (o = r.getAction("editor.action.startFindReplaceAction")) == null ? void 0 : o.run();
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
const C = r.getModel();
|
|
548
|
+
if (C) {
|
|
549
|
+
const o = C.getLanguageId();
|
|
550
|
+
o === "xml" || o === "html" ? (e.languages.setLanguageConfiguration(o, {
|
|
551
|
+
autoClosingPairs: [
|
|
552
|
+
{ open: "{", close: "}" },
|
|
553
|
+
{ open: "[", close: "]" },
|
|
554
|
+
{ open: "(", close: ")" },
|
|
555
|
+
{ open: '"', close: '"', notIn: ["string"] },
|
|
556
|
+
{ open: "'", close: "'", notIn: ["string", "comment"] },
|
|
557
|
+
{ open: "<", close: ">", notIn: ["string"] }
|
|
558
|
+
],
|
|
559
|
+
brackets: [["{", "}"], ["[", "]"], ["(", ")"], ["<", ">"]],
|
|
560
|
+
surroundingPairs: [
|
|
561
|
+
{ open: "{", close: "}" },
|
|
562
|
+
{ open: "[", close: "]" },
|
|
563
|
+
{ open: "(", close: ")" },
|
|
564
|
+
{ open: '"', close: '"' },
|
|
565
|
+
{ open: "'", close: "'" },
|
|
566
|
+
{ open: "<", close: ">" }
|
|
567
|
+
],
|
|
568
|
+
onEnterRules: [
|
|
569
|
+
{
|
|
570
|
+
beforeText: /<([_:\w][_:\w\-.\d]*)([^/>]*(?!\/)>)\s*$/i,
|
|
571
|
+
afterText: /^<\/([_:\w][_:\w\-.\d]*)\s*>$/i,
|
|
572
|
+
action: { indentAction: e.languages.IndentAction.IndentOutdent }
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
beforeText: /<([_:\w][_:\w\-.\d]*)([^/>]*(?!\/)>)\s*$/i,
|
|
576
|
+
action: { indentAction: e.languages.IndentAction.Indent }
|
|
577
|
+
}
|
|
578
|
+
],
|
|
579
|
+
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g
|
|
580
|
+
}), e.languages.registerCompletionItemProvider(o, {
|
|
581
|
+
triggerCharacters: ["/"],
|
|
582
|
+
provideCompletionItems: (s, n) => {
|
|
583
|
+
const i = s.getValueInRange({
|
|
584
|
+
startLineNumber: 1,
|
|
585
|
+
startColumn: 1,
|
|
586
|
+
endLineNumber: n.lineNumber,
|
|
587
|
+
endColumn: n.column
|
|
588
|
+
});
|
|
589
|
+
if (i.match(/<\/\s*$/)) {
|
|
590
|
+
const a = [], m = /<\/?([_:\w][_:\w\-.\d]*)[^>]*\/?>/g;
|
|
591
|
+
let p;
|
|
592
|
+
for (; (p = m.exec(i.slice(0, -2))) !== null; )
|
|
593
|
+
p[0].startsWith("</") ? a.pop() : p[0].endsWith("/>") || a.push(p[1]);
|
|
594
|
+
const d = a[a.length - 1];
|
|
595
|
+
if (d)
|
|
596
|
+
return {
|
|
597
|
+
suggestions: [{
|
|
598
|
+
label: `/${d}>`,
|
|
599
|
+
kind: e.languages.CompletionItemKind.Keyword,
|
|
600
|
+
insertText: `${d}>`,
|
|
601
|
+
range: {
|
|
602
|
+
startLineNumber: n.lineNumber,
|
|
603
|
+
startColumn: n.column,
|
|
604
|
+
endLineNumber: n.lineNumber,
|
|
605
|
+
endColumn: n.column
|
|
606
|
+
}
|
|
607
|
+
}]
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
return { suggestions: [] };
|
|
611
|
+
}
|
|
612
|
+
})) : e.languages.setLanguageConfiguration(o, {
|
|
613
|
+
autoClosingPairs: [
|
|
614
|
+
{ open: "{", close: "}" },
|
|
615
|
+
{ open: "[", close: "]" },
|
|
616
|
+
{ open: "(", close: ")" },
|
|
617
|
+
{ open: '"', close: '"', notIn: ["string"] },
|
|
618
|
+
{ open: "'", close: "'", notIn: ["string", "comment"] }
|
|
619
|
+
],
|
|
620
|
+
brackets: [["{", "}"], ["[", "]"], ["(", ")"]],
|
|
621
|
+
surroundingPairs: [
|
|
622
|
+
{ open: "{", close: "}" },
|
|
623
|
+
{ open: "[", close: "]" },
|
|
624
|
+
{ open: "(", close: ")" },
|
|
625
|
+
{ open: '"', close: '"' },
|
|
626
|
+
{ open: "'", close: "'" }
|
|
627
|
+
]
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
e.languages.getLanguages().some((o) => o.id === "graphql") || (e.languages.register({ id: "graphql" }), e.languages.setMonarchTokensProvider("graphql", {
|
|
631
|
+
keywords: ["type", "input", "enum", "union", "interface", "scalar", "schema", "query", "mutation", "subscription", "fragment", "on", "extend", "implements", "directive", "repeatable"],
|
|
632
|
+
typeKeywords: ["String", "Int", "Float", "Boolean", "ID"],
|
|
633
|
+
operators: ["!", "=", "|", "&", "..."],
|
|
634
|
+
symbols: /[=!|&]+/,
|
|
635
|
+
tokenizer: {
|
|
636
|
+
root: [
|
|
637
|
+
[/#.*$/, "comment"],
|
|
638
|
+
[/"([^"\\]|\\.)*"/, "string"],
|
|
639
|
+
[/"""[\s\S]*?"""/, "string"],
|
|
640
|
+
[/\b(type|input|enum|union|interface|scalar|schema|extend|implements|directive|repeatable)\b/, "keyword"],
|
|
641
|
+
[/\b(query|mutation|subscription|fragment|on)\b/, "keyword.control"],
|
|
642
|
+
[/\b(String|Int|Float|Boolean|ID)\b/, "type.identifier"],
|
|
643
|
+
[/\b[A-Z][a-zA-Z0-9_]*\b/, "type.identifier"],
|
|
644
|
+
[/\b[a-z_][a-zA-Z0-9_]*(?=\s*[:(])/, "variable"],
|
|
645
|
+
[/\b[a-z_][a-zA-Z0-9_]*\b/, "identifier"],
|
|
646
|
+
[/[{}()\[\]]/, "@brackets"],
|
|
647
|
+
[/[!:=|&]/, "operator"],
|
|
648
|
+
[/\$[a-zA-Z_]\w*/, "variable"],
|
|
649
|
+
[/@[a-zA-Z_]\w*/, "annotation"]
|
|
650
|
+
]
|
|
651
|
+
}
|
|
652
|
+
})), l === "javascript" && (z || (e.languages.typescript.javascriptDefaults.addExtraLib(me, "dk-globals.d.ts"), z = !0), e.languages.registerCompletionItemProvider("javascript", {
|
|
653
|
+
triggerCharacters: ["."],
|
|
654
|
+
provideCompletionItems: (o, s) => {
|
|
655
|
+
const n = o.getValueInRange({
|
|
656
|
+
startLineNumber: s.lineNumber,
|
|
657
|
+
startColumn: 1,
|
|
658
|
+
endLineNumber: s.lineNumber,
|
|
659
|
+
endColumn: s.column
|
|
660
|
+
}), i = ke();
|
|
661
|
+
if (i.length > 0) return { suggestions: i };
|
|
662
|
+
const u = { startLineNumber: s.lineNumber, endLineNumber: s.lineNumber, startColumn: s.column, endColumn: s.column };
|
|
663
|
+
return /\bconsole\.\s*$/.test(n) ? {
|
|
664
|
+
suggestions: [
|
|
665
|
+
{ label: "log", kind: e.languages.CompletionItemKind.Function, insertText: "log(${1})", insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: "Log output", range: u },
|
|
666
|
+
{ label: "info", kind: e.languages.CompletionItemKind.Function, insertText: "info(${1})", insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: "Info output", range: u },
|
|
667
|
+
{ label: "warn", kind: e.languages.CompletionItemKind.Function, insertText: "warn(${1})", insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: "Warning output", range: u },
|
|
668
|
+
{ label: "error", kind: e.languages.CompletionItemKind.Function, insertText: "error(${1})", insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: "Error output", range: u },
|
|
669
|
+
{ label: "debug", kind: e.languages.CompletionItemKind.Function, insertText: "debug(${1})", insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet, detail: "Debug output", range: u }
|
|
670
|
+
]
|
|
671
|
+
} : { suggestions: [] };
|
|
672
|
+
}
|
|
673
|
+
})), !g && c && r.updateOptions({ placeholder: c }), f == null || f(r, e), r.updateOptions({ contextmenu: t === "native" });
|
|
674
|
+
}
|
|
675
|
+
function Te({
|
|
676
|
+
original: r,
|
|
677
|
+
modified: e,
|
|
678
|
+
language: l = "sql",
|
|
679
|
+
height: g = 300,
|
|
680
|
+
readOnly: c = !0,
|
|
681
|
+
renderSideBySide: f = !0,
|
|
682
|
+
wordWrap: t = !1,
|
|
683
|
+
fontSize: b = 12,
|
|
684
|
+
theme: T,
|
|
685
|
+
onMount: k
|
|
686
|
+
}) {
|
|
687
|
+
const w = q(), C = T ?? (w === "light" ? "vs" : "vs-dark"), v = typeof g == "number" ? `${g}px` : g;
|
|
688
|
+
return /* @__PURE__ */ L(
|
|
689
|
+
ie,
|
|
690
|
+
{
|
|
691
|
+
height: v,
|
|
692
|
+
language: l,
|
|
693
|
+
theme: C,
|
|
694
|
+
original: r,
|
|
695
|
+
modified: e,
|
|
696
|
+
onMount: k,
|
|
697
|
+
options: {
|
|
698
|
+
readOnly: c,
|
|
699
|
+
renderSideBySide: f,
|
|
700
|
+
wordWrap: t ? "on" : "off",
|
|
701
|
+
fontSize: b,
|
|
702
|
+
automaticLayout: !0,
|
|
703
|
+
minimap: { enabled: !1 },
|
|
704
|
+
scrollBeyondLastLine: !1,
|
|
705
|
+
lineNumbers: "on",
|
|
706
|
+
folding: !0,
|
|
707
|
+
ignoreTrimWhitespace: !1
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
window.MonacoEnvironment = {
|
|
713
|
+
getWorker(r, e) {
|
|
714
|
+
return e === "json" ? new ce() : e === "html" || e === "handlebars" || e === "razor" ? new fe() : e === "typescript" || e === "javascript" ? new pe() : new ge();
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
B.editor.defineTheme("daakia-dark", {
|
|
718
|
+
base: "vs-dark",
|
|
719
|
+
inherit: !0,
|
|
720
|
+
rules: [
|
|
721
|
+
// JSON
|
|
722
|
+
{ token: "string.key.json", foreground: "9CDCFE" },
|
|
723
|
+
{ token: "string.value.json", foreground: "CE9178" },
|
|
724
|
+
{ token: "number", foreground: "B5CEA8" },
|
|
725
|
+
{ token: "keyword.json", foreground: "569CD6" },
|
|
726
|
+
// true/false/null
|
|
727
|
+
// General
|
|
728
|
+
{ token: "string", foreground: "CE9178" },
|
|
729
|
+
{ token: "keyword", foreground: "569CD6" },
|
|
730
|
+
{ token: "comment", foreground: "6A9955" },
|
|
731
|
+
{ token: "type", foreground: "4EC9B0" },
|
|
732
|
+
{ token: "identifier", foreground: "9CDCFE" },
|
|
733
|
+
{ token: "variable", foreground: "9CDCFE" },
|
|
734
|
+
{ token: "constant", foreground: "4FC1FF" },
|
|
735
|
+
// JS/TS
|
|
736
|
+
{ token: "keyword.js", foreground: "C586C0" },
|
|
737
|
+
{ token: "keyword.ts", foreground: "C586C0" },
|
|
738
|
+
{ token: "string.js", foreground: "CE9178" },
|
|
739
|
+
{ token: "string.ts", foreground: "CE9178" },
|
|
740
|
+
{ token: "number.js", foreground: "B5CEA8" },
|
|
741
|
+
{ token: "number.ts", foreground: "B5CEA8" },
|
|
742
|
+
{ token: "regexp", foreground: "D16969" },
|
|
743
|
+
{ token: "delimiter", foreground: "D4D4D4" },
|
|
744
|
+
{ token: "delimiter.bracket", foreground: "FFD700" },
|
|
745
|
+
// XML/HTML
|
|
746
|
+
{ token: "tag", foreground: "569CD6" },
|
|
747
|
+
{ token: "attribute.name", foreground: "9CDCFE" },
|
|
748
|
+
{ token: "attribute.value", foreground: "CE9178" },
|
|
749
|
+
// GraphQL
|
|
750
|
+
{ token: "keyword.graphql", foreground: "C586C0" },
|
|
751
|
+
{ token: "keyword.control.graphql", foreground: "C586C0" },
|
|
752
|
+
{ token: "type.identifier.graphql", foreground: "E5C07B" },
|
|
753
|
+
{ token: "variable.graphql", foreground: "9CDCFE" },
|
|
754
|
+
{ token: "string.graphql", foreground: "CE9178" },
|
|
755
|
+
{ token: "comment.graphql", foreground: "6A9955" },
|
|
756
|
+
{ token: "annotation.graphql", foreground: "DCDCAA" },
|
|
757
|
+
{ token: "operator.graphql", foreground: "D4D4D4" },
|
|
758
|
+
{ token: "identifier.graphql", foreground: "D4D4D4" }
|
|
759
|
+
],
|
|
760
|
+
colors: {
|
|
761
|
+
"editor.background": "#1e1e1e",
|
|
762
|
+
"editor.foreground": "#D4D4D4",
|
|
763
|
+
"editor.lineHighlightBackground": "#2a2a2a",
|
|
764
|
+
"editor.selectionBackground": "#264f78",
|
|
765
|
+
"editor.inactiveSelectionBackground": "#3a3d41",
|
|
766
|
+
"editorLineNumber.foreground": "#858585",
|
|
767
|
+
"editorLineNumber.activeForeground": "#C6C6C6",
|
|
768
|
+
"editorCursor.foreground": "#AEAFAD",
|
|
769
|
+
"editor.selectionHighlightBackground": "#ADD6FF26",
|
|
770
|
+
"editorIndentGuide.background": "#404040",
|
|
771
|
+
"editorIndentGuide.activeBackground": "#707070",
|
|
772
|
+
"editorBracketMatch.background": "#0064001a",
|
|
773
|
+
"editorBracketMatch.border": "#888888",
|
|
774
|
+
"editorGutter.background": "#1e1e1e",
|
|
775
|
+
"editorWidget.background": "#252526",
|
|
776
|
+
"editorSuggestWidget.background": "#252526",
|
|
777
|
+
"editorSuggestWidget.border": "#454545",
|
|
778
|
+
"editorSuggestWidget.selectedBackground": "#04395e",
|
|
779
|
+
"list.hoverBackground": "#2a2d2e",
|
|
780
|
+
"input.background": "#3c3c3c",
|
|
781
|
+
focusBorder: "#6366f1"
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
P.setCompilerOptions({
|
|
785
|
+
target: X.ESNext,
|
|
786
|
+
module: Y.ESNext,
|
|
787
|
+
allowNonTsExtensions: !0,
|
|
788
|
+
allowJs: !0,
|
|
789
|
+
checkJs: !0,
|
|
790
|
+
strict: !1,
|
|
791
|
+
noEmit: !0,
|
|
792
|
+
esModuleInterop: !0,
|
|
793
|
+
moduleResolution: Z.NodeJs,
|
|
794
|
+
jsx: J.React
|
|
795
|
+
});
|
|
796
|
+
P.setDiagnosticsOptions({
|
|
797
|
+
noSemanticValidation: !1,
|
|
798
|
+
noSyntaxValidation: !1
|
|
799
|
+
});
|
|
800
|
+
P.setEagerModelSync(!0);
|
|
801
|
+
Q.setEagerModelSync(!0);
|
|
802
|
+
Q.setCompilerOptions({
|
|
803
|
+
target: X.ESNext,
|
|
804
|
+
module: Y.ESNext,
|
|
805
|
+
allowNonTsExtensions: !0,
|
|
806
|
+
allowJs: !0,
|
|
807
|
+
strict: !1,
|
|
808
|
+
noEmit: !0,
|
|
809
|
+
esModuleInterop: !0,
|
|
810
|
+
moduleResolution: Z.NodeJs,
|
|
811
|
+
jsx: J.React
|
|
812
|
+
});
|
|
813
|
+
B.editor.defineTheme("daakia-light", {
|
|
814
|
+
base: "vs",
|
|
815
|
+
inherit: !0,
|
|
816
|
+
rules: [
|
|
817
|
+
{ token: "string.key.json", foreground: "0451a5" },
|
|
818
|
+
{ token: "string.value.json", foreground: "a31515" },
|
|
819
|
+
{ token: "number", foreground: "09885a" },
|
|
820
|
+
{ token: "keyword.json", foreground: "0000ff" },
|
|
821
|
+
{ token: "string", foreground: "a31515" },
|
|
822
|
+
{ token: "keyword", foreground: "0000ff" },
|
|
823
|
+
{ token: "comment", foreground: "008000" },
|
|
824
|
+
{ token: "type", foreground: "267f99" },
|
|
825
|
+
{ token: "identifier", foreground: "001080" },
|
|
826
|
+
{ token: "variable", foreground: "001080" },
|
|
827
|
+
{ token: "constant", foreground: "0070c1" },
|
|
828
|
+
{ token: "keyword.js", foreground: "af00db" },
|
|
829
|
+
{ token: "keyword.ts", foreground: "af00db" },
|
|
830
|
+
{ token: "string.js", foreground: "a31515" },
|
|
831
|
+
{ token: "string.ts", foreground: "a31515" },
|
|
832
|
+
{ token: "number.js", foreground: "09885a" },
|
|
833
|
+
{ token: "number.ts", foreground: "09885a" },
|
|
834
|
+
{ token: "regexp", foreground: "c41a16" },
|
|
835
|
+
{ token: "delimiter", foreground: "000000" },
|
|
836
|
+
{ token: "delimiter.bracket", foreground: "000000" },
|
|
837
|
+
{ token: "tag", foreground: "800000" },
|
|
838
|
+
{ token: "attribute.name", foreground: "ff0000" },
|
|
839
|
+
{ token: "attribute.value", foreground: "0451a5" },
|
|
840
|
+
{ token: "keyword.graphql", foreground: "af00db" },
|
|
841
|
+
{ token: "type.identifier.graphql", foreground: "267f99" },
|
|
842
|
+
{ token: "variable.graphql", foreground: "001080" },
|
|
843
|
+
{ token: "string.graphql", foreground: "a31515" },
|
|
844
|
+
{ token: "comment.graphql", foreground: "008000" },
|
|
845
|
+
{ token: "operator.graphql", foreground: "000000" },
|
|
846
|
+
{ token: "identifier.graphql", foreground: "000000" }
|
|
847
|
+
],
|
|
848
|
+
colors: {
|
|
849
|
+
"editor.background": "#ffffff",
|
|
850
|
+
"editor.foreground": "#000000",
|
|
851
|
+
"editor.lineHighlightBackground": "#f5f5f5",
|
|
852
|
+
"editor.selectionBackground": "#add6ff",
|
|
853
|
+
"editor.inactiveSelectionBackground": "#e5ebf1",
|
|
854
|
+
"editorLineNumber.foreground": "#237893",
|
|
855
|
+
"editorLineNumber.activeForeground": "#0b216f",
|
|
856
|
+
"editorCursor.foreground": "#000000",
|
|
857
|
+
"editor.selectionHighlightBackground": "#add6ff4d",
|
|
858
|
+
"editorIndentGuide.background1": "#d3d3d3",
|
|
859
|
+
"editorIndentGuide.activeBackground1": "#939393",
|
|
860
|
+
"editorGutter.background": "#ffffff",
|
|
861
|
+
"editorWidget.background": "#f3f3f3",
|
|
862
|
+
"editorSuggestWidget.background": "#f3f3f3",
|
|
863
|
+
"editorSuggestWidget.border": "#c8c8c8",
|
|
864
|
+
"editorSuggestWidget.selectedBackground": "#0060c0",
|
|
865
|
+
"list.hoverBackground": "#f0f0f0",
|
|
866
|
+
"input.background": "#ffffff",
|
|
867
|
+
"input.border": "#d1d5db",
|
|
868
|
+
focusBorder: "#6366f1"
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
ae.config({ monaco: B });
|
|
872
|
+
window.monaco = B;
|
|
873
|
+
le(we);
|
|
874
|
+
ue(Te);
|
|
875
|
+
se();
|
|
876
|
+
function Fe(r) {
|
|
877
|
+
B.editor.setTheme(r === "dark" ? "daakia-dark" : "daakia-light");
|
|
878
|
+
}
|
|
879
|
+
export {
|
|
880
|
+
Fe as applyMonacoTheme,
|
|
881
|
+
B as monaco
|
|
882
|
+
};
|
|
883
|
+
//# sourceMappingURL=monaco-setup.js.map
|