@harnessio/yaml-editor 0.14.0 → 0.16.0-react18.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
var ue = Object.defineProperty;
|
|
2
|
+
var de = (e, t, n) => t in e ? ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var J = (e, t, n) => (de(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
+
import me, { useState as L, useEffect as $, useRef as w, useMemo as _, useCallback as q, createContext as fe, useContext as pe } from "react";
|
|
5
|
+
import Z, { loader as A, useMonaco as B, DiffEditor as he } from "@monaco-editor/react";
|
|
6
6
|
import * as D from "monaco-editor";
|
|
7
|
-
import { languages as
|
|
8
|
-
import { yamlDefaults as
|
|
9
|
-
var
|
|
7
|
+
import { languages as H, Uri as ge } from "monaco-editor";
|
|
8
|
+
import { yamlDefaults as ye } from "monaco-yaml";
|
|
9
|
+
var te = { exports: {} }, U = {};
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
14
|
*/
|
|
15
|
-
var
|
|
16
|
-
function
|
|
15
|
+
var Q = Object.getOwnPropertySymbols, be = Object.prototype.hasOwnProperty, ve = Object.prototype.propertyIsEnumerable;
|
|
16
|
+
function Se(e) {
|
|
17
17
|
if (e == null)
|
|
18
18
|
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
19
19
|
return Object(e);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function xe() {
|
|
22
22
|
try {
|
|
23
23
|
if (!Object.assign)
|
|
24
24
|
return !1;
|
|
@@ -40,7 +40,7 @@ function Oe() {
|
|
|
40
40
|
return !1;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
xe();
|
|
44
44
|
/** @license React v17.0.2
|
|
45
45
|
* react-jsx-runtime.production.min.js
|
|
46
46
|
*
|
|
@@ -49,28 +49,28 @@ Oe();
|
|
|
49
49
|
* This source code is licensed under the MIT license found in the
|
|
50
50
|
* LICENSE file in the root directory of this source tree.
|
|
51
51
|
*/
|
|
52
|
-
var
|
|
53
|
-
|
|
52
|
+
var Ee = me, ne = 60103;
|
|
53
|
+
U.Fragment = 60107;
|
|
54
54
|
if (typeof Symbol == "function" && Symbol.for) {
|
|
55
|
-
var
|
|
56
|
-
|
|
55
|
+
var X = Symbol.for;
|
|
56
|
+
ne = X("react.element"), U.Fragment = X("react.fragment");
|
|
57
57
|
}
|
|
58
|
-
var
|
|
59
|
-
function
|
|
58
|
+
var Me = Ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Oe = Object.prototype.hasOwnProperty, Ce = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
59
|
+
function re(e, t, n) {
|
|
60
60
|
var r, a = {}, o = null, s = null;
|
|
61
61
|
n !== void 0 && (o = "" + n), t.key !== void 0 && (o = "" + t.key), t.ref !== void 0 && (s = t.ref);
|
|
62
62
|
for (r in t)
|
|
63
|
-
|
|
63
|
+
Oe.call(t, r) && !Ce.hasOwnProperty(r) && (a[r] = t[r]);
|
|
64
64
|
if (e && e.defaultProps)
|
|
65
65
|
for (r in t = e.defaultProps, t)
|
|
66
66
|
a[r] === void 0 && (a[r] = t[r]);
|
|
67
|
-
return { $$typeof:
|
|
67
|
+
return { $$typeof: ne, type: e, key: o, ref: s, props: a, _owner: Me.current };
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var
|
|
73
|
-
const
|
|
69
|
+
U.jsx = re;
|
|
70
|
+
U.jsxs = re;
|
|
71
|
+
te.exports = U;
|
|
72
|
+
var P = te.exports;
|
|
73
|
+
const F = {
|
|
74
74
|
selectOnLineNumbers: !0,
|
|
75
75
|
scrollBeyondLastLine: !1,
|
|
76
76
|
padding: {
|
|
@@ -78,7 +78,7 @@ const H = {
|
|
|
78
78
|
bottom: 16
|
|
79
79
|
},
|
|
80
80
|
minimap: { enabled: !1 },
|
|
81
|
-
fontSize:
|
|
81
|
+
fontSize: 13,
|
|
82
82
|
fontFamily: '"JetBrains Mono", "monospace"',
|
|
83
83
|
lineHeight: 20,
|
|
84
84
|
scrollbar: {
|
|
@@ -86,29 +86,32 @@ const H = {
|
|
|
86
86
|
horizontalScrollbarSize: 14,
|
|
87
87
|
verticalSliderSize: 6,
|
|
88
88
|
horizontalSliderSize: 6
|
|
89
|
-
}
|
|
90
|
-
|
|
89
|
+
},
|
|
90
|
+
overviewRulerBorder: !1,
|
|
91
|
+
overviewRulerLanes: 0,
|
|
92
|
+
renderLineHighlight: "none"
|
|
93
|
+
}, z = (e) => {
|
|
91
94
|
const { themeConfig: t, editor: n, theme: r } = e, { defaultTheme: a } = t ?? {}, [o, s] = L(r ?? a ?? "vs-dark");
|
|
92
|
-
return
|
|
95
|
+
return $(() => {
|
|
93
96
|
var c;
|
|
94
|
-
(c = t == null ? void 0 : t.themes) == null || c.forEach((
|
|
95
|
-
D.editor.defineTheme(
|
|
97
|
+
(c = t == null ? void 0 : t.themes) == null || c.forEach((h) => {
|
|
98
|
+
D.editor.defineTheme(h.themeName, h.themeData);
|
|
96
99
|
});
|
|
97
|
-
}, [D]),
|
|
100
|
+
}, [D]), $(() => {
|
|
98
101
|
D.editor && r && (D.editor.setTheme(r), s(r));
|
|
99
102
|
}, [n, r]), { theme: o };
|
|
100
103
|
};
|
|
101
|
-
function
|
|
104
|
+
function we(e) {
|
|
102
105
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
103
106
|
let n = "";
|
|
104
107
|
for (let r = 0; r < e; r++)
|
|
105
108
|
n += t.charAt(Math.floor(Math.random() * t.length));
|
|
106
109
|
return n;
|
|
107
110
|
}
|
|
108
|
-
function
|
|
111
|
+
function Pe(e) {
|
|
109
112
|
return e.replace("'", "'");
|
|
110
113
|
}
|
|
111
|
-
function
|
|
114
|
+
function $e({
|
|
112
115
|
instanceId: e,
|
|
113
116
|
lineNumbersPosition: t
|
|
114
117
|
}) {
|
|
@@ -141,7 +144,7 @@ function ke({
|
|
|
141
144
|
color: var(--canary-foreground-01);
|
|
142
145
|
}`, n;
|
|
143
146
|
}
|
|
144
|
-
function
|
|
147
|
+
function je({
|
|
145
148
|
instanceId: e,
|
|
146
149
|
blameData: t,
|
|
147
150
|
dateWidth: n,
|
|
@@ -149,19 +152,19 @@ function De({
|
|
|
149
152
|
}) {
|
|
150
153
|
let a = "";
|
|
151
154
|
return t.forEach((o) => {
|
|
152
|
-
var u,
|
|
153
|
-
const s = (
|
|
154
|
-
for (let
|
|
155
|
-
|
|
156
|
-
.monaco-editor-${e} .view-line .blame-editor-commit-${
|
|
157
|
-
content: '${
|
|
155
|
+
var u, d, i, b, E, l, v, m;
|
|
156
|
+
const s = (d = (u = o == null ? void 0 : o.commitInfo) == null ? void 0 : u.author) == null ? void 0 : d.avatarUrl, c = (b = (i = o == null ? void 0 : o.commitInfo) == null ? void 0 : i.author) == null ? void 0 : b.initials, h = s ? `background: url('${(l = (E = o == null ? void 0 : o.commitInfo) == null ? void 0 : E.author) == null ? void 0 : l.avatarUrl}');` : "";
|
|
157
|
+
for (let p = o.fromLineNumber; p <= o.toLineNumber; p++)
|
|
158
|
+
p === o.fromLineNumber ? a += `
|
|
159
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${p}:before {
|
|
160
|
+
content: '${Pe(((m = (v = o == null ? void 0 : o.commitInfo) == null ? void 0 : v.author) == null ? void 0 : m.when) || "")}';
|
|
158
161
|
position: absolute;
|
|
159
162
|
left: 10px;
|
|
160
163
|
top: 0px;
|
|
161
164
|
color: hsl(var(--canary-foreground-03));
|
|
162
165
|
}
|
|
163
166
|
|
|
164
|
-
.monaco-editor-${e} .view-line .blame-editor-commit-${
|
|
167
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${p}:after {
|
|
165
168
|
content: '${c ?? " "}';
|
|
166
169
|
position: absolute;
|
|
167
170
|
border-radius: 50%;
|
|
@@ -174,10 +177,10 @@ function De({
|
|
|
174
177
|
color: hsl(var(--canary-foreground-03));
|
|
175
178
|
width: ${r}px;
|
|
176
179
|
height: ${r}px;
|
|
177
|
-
${
|
|
180
|
+
${h}
|
|
178
181
|
background-size: 100% 100%;
|
|
179
182
|
}` : a += `
|
|
180
|
-
.monaco-editor-${e} .view-line .blame-editor-commit-${
|
|
183
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${p}:before {
|
|
181
184
|
content: ' ';
|
|
182
185
|
left: 10px;
|
|
183
186
|
top: 0px;
|
|
@@ -185,13 +188,13 @@ function De({
|
|
|
185
188
|
}`;
|
|
186
189
|
}), a;
|
|
187
190
|
}
|
|
188
|
-
function
|
|
191
|
+
function Ne(e, t) {
|
|
189
192
|
let n = "";
|
|
190
193
|
return e.length > t ? n = e.slice(0, t - 3) + "..." : e.length < t ? n = e + " ".repeat(t - e.length) : n = e, " ".repeat(25) + n + " ".repeat(10);
|
|
191
194
|
}
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
...
|
|
195
|
+
A.config({ monaco: D });
|
|
196
|
+
const Y = 450, ke = 30, De = 140, Le = 24, _e = {
|
|
197
|
+
...F,
|
|
195
198
|
readOnly: !0,
|
|
196
199
|
matchBrackets: "never",
|
|
197
200
|
renderValidationDecorations: "off",
|
|
@@ -201,7 +204,7 @@ const W = 450, _e = 30, Te = 140, Ie = 24, Ve = {
|
|
|
201
204
|
renderWhitespace: "none",
|
|
202
205
|
renderLineHighlight: "none"
|
|
203
206
|
};
|
|
204
|
-
function
|
|
207
|
+
function Qe({
|
|
205
208
|
code: e,
|
|
206
209
|
language: t,
|
|
207
210
|
themeConfig: n,
|
|
@@ -209,135 +212,142 @@ function et({
|
|
|
209
212
|
blameData: a,
|
|
210
213
|
showSeparators: o = !0,
|
|
211
214
|
theme: s,
|
|
212
|
-
height: c = "75vh"
|
|
215
|
+
height: c = "75vh",
|
|
216
|
+
options: h
|
|
213
217
|
}) {
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
const [
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
const u = w(a), d = w(we(5));
|
|
219
|
+
B();
|
|
220
|
+
const [i, b] = L(), [E, l] = L(0), v = w(null), m = w(null);
|
|
221
|
+
$(() => {
|
|
222
|
+
u.current = a;
|
|
219
223
|
}, [a]);
|
|
220
|
-
function
|
|
221
|
-
const
|
|
222
|
-
if (!
|
|
224
|
+
function p() {
|
|
225
|
+
const f = m.current, g = v.current;
|
|
226
|
+
if (!f || !g)
|
|
223
227
|
return;
|
|
224
|
-
o &&
|
|
225
|
-
|
|
228
|
+
o && f.changeViewZones(function(y) {
|
|
229
|
+
y.addZone({
|
|
226
230
|
afterLineNumber: 0,
|
|
227
231
|
heightInPx: 10,
|
|
228
232
|
domNode: document.createElement("div")
|
|
229
|
-
}),
|
|
230
|
-
if (
|
|
233
|
+
}), u.current.forEach((j, M) => {
|
|
234
|
+
if (M !== u.current.length - 1) {
|
|
231
235
|
const x = document.createElement("div");
|
|
232
|
-
x.style.borderTop = "1px solid hsl(var(--canary-border-01))", x.style.marginTop = "9px", x.className = "blame-editor-separator",
|
|
233
|
-
afterLineNumber:
|
|
236
|
+
x.style.borderTop = "1px solid hsl(var(--canary-border-01))", x.style.marginTop = "9px", x.className = "blame-editor-separator", y.addZone({
|
|
237
|
+
afterLineNumber: j.toLineNumber,
|
|
234
238
|
heightInPx: 20,
|
|
235
239
|
domNode: x
|
|
236
240
|
});
|
|
237
241
|
}
|
|
238
242
|
});
|
|
239
243
|
});
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
var
|
|
243
|
-
for (let
|
|
244
|
-
|
|
245
|
-
range: new
|
|
244
|
+
const C = [];
|
|
245
|
+
u.current.forEach((y) => {
|
|
246
|
+
var j;
|
|
247
|
+
for (let M = y.fromLineNumber; M <= y.toLineNumber; M++)
|
|
248
|
+
C.push({
|
|
249
|
+
range: new g.Range(M, 0, M + 1, 0),
|
|
246
250
|
options: {
|
|
247
251
|
before: {
|
|
248
|
-
content:
|
|
249
|
-
|
|
250
|
-
|
|
252
|
+
content: Ne(
|
|
253
|
+
M === y.fromLineNumber && ((j = y == null ? void 0 : y.commitInfo) == null ? void 0 : j.title) || "",
|
|
254
|
+
ke
|
|
251
255
|
),
|
|
252
|
-
cursorStops:
|
|
253
|
-
inlineClassName: `blame-editor-commit blame-editor-commit-${
|
|
256
|
+
cursorStops: g.editor.InjectedTextCursorStops.None,
|
|
257
|
+
inlineClassName: `blame-editor-commit blame-editor-commit-${M}`
|
|
254
258
|
}
|
|
255
259
|
}
|
|
256
260
|
});
|
|
257
|
-
}),
|
|
261
|
+
}), f.createDecorationsCollection(C);
|
|
258
262
|
}
|
|
259
|
-
function
|
|
260
|
-
var
|
|
261
|
-
|
|
263
|
+
function O(f, g) {
|
|
264
|
+
var C, y, j, M, x, I;
|
|
265
|
+
m.current = f, v.current = g, f.setValue(e), b(f), (j = (y = (C = g.languages.typescript) == null ? void 0 : C.typescriptDefaults) == null ? void 0 : y.setDiagnosticsOptions) == null || j.call(y, {
|
|
262
266
|
noSuggestionDiagnostics: !0,
|
|
263
267
|
noSyntaxValidation: !0,
|
|
264
268
|
noSemanticValidation: !0
|
|
265
|
-
}), (I = (x = (
|
|
269
|
+
}), (I = (x = (M = g.languages.typescript) == null ? void 0 : M.javascriptDefaults) == null ? void 0 : x.setDiagnosticsOptions) == null || I.call(x, {
|
|
266
270
|
noSuggestionDiagnostics: !0,
|
|
267
271
|
noSyntaxValidation: !0,
|
|
268
272
|
noSemanticValidation: !0
|
|
269
|
-
}),
|
|
273
|
+
}), p();
|
|
270
274
|
}
|
|
271
|
-
|
|
272
|
-
|
|
275
|
+
$(() => {
|
|
276
|
+
i == null || i.setValue(e);
|
|
273
277
|
}, [e]);
|
|
274
|
-
const { theme:
|
|
275
|
-
() =>
|
|
276
|
-
instanceId:
|
|
278
|
+
const { theme: S } = z({ monacoRef: v, themeConfig: n, editor: i, theme: s }), N = _(
|
|
279
|
+
() => $e({
|
|
280
|
+
instanceId: d.current,
|
|
277
281
|
lineNumbersPosition: r
|
|
278
282
|
}),
|
|
279
283
|
[a]
|
|
280
|
-
),
|
|
281
|
-
() =>
|
|
282
|
-
instanceId:
|
|
284
|
+
), k = _(
|
|
285
|
+
() => je({
|
|
286
|
+
instanceId: d.current,
|
|
283
287
|
blameData: a,
|
|
284
|
-
avatarSize:
|
|
285
|
-
dateWidth:
|
|
288
|
+
avatarSize: Le,
|
|
289
|
+
dateWidth: De
|
|
286
290
|
}),
|
|
287
291
|
[a]
|
|
288
292
|
);
|
|
289
|
-
|
|
293
|
+
$(() => {
|
|
290
294
|
if (r === "center") {
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
293
|
-
const
|
|
294
|
-
for (const
|
|
295
|
-
const x = parseInt(getComputedStyle(
|
|
296
|
-
|
|
295
|
+
const f = document.getElementsByClassName("lines-content")[0];
|
|
296
|
+
if (f) {
|
|
297
|
+
const g = { attributes: !0 }, C = (j) => {
|
|
298
|
+
for (const M of j) {
|
|
299
|
+
const x = parseInt(getComputedStyle(f).left);
|
|
300
|
+
l(x);
|
|
297
301
|
}
|
|
298
|
-
},
|
|
299
|
-
return
|
|
300
|
-
|
|
302
|
+
}, y = new MutationObserver(C);
|
|
303
|
+
return y.observe(f, g), () => {
|
|
304
|
+
y.disconnect();
|
|
301
305
|
};
|
|
302
306
|
}
|
|
303
307
|
}
|
|
304
308
|
});
|
|
305
|
-
const
|
|
306
|
-
.monaco-editor-${
|
|
307
|
-
left: ${
|
|
309
|
+
const T = _(() => `
|
|
310
|
+
.monaco-editor-${d.current} .margin {
|
|
311
|
+
left: ${Y + 16 + E}px !important;
|
|
308
312
|
pointer-events: none;
|
|
309
|
-
}`, [
|
|
310
|
-
.monaco-editor-${
|
|
311
|
-
clip-path: polygon(${
|
|
313
|
+
}`, [E]), R = `
|
|
314
|
+
.monaco-editor-${d.current} .view-overlays {
|
|
315
|
+
clip-path: polygon(${Y + 16}px 0, 100% 0%, 100% 100%, ${Y + 16}px 100%);
|
|
312
316
|
height:100% !important;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
317
|
+
}`, W = _(
|
|
318
|
+
() => ({
|
|
319
|
+
..._e,
|
|
320
|
+
...h
|
|
321
|
+
}),
|
|
322
|
+
[h]
|
|
323
|
+
);
|
|
324
|
+
return /* @__PURE__ */ P.jsxs(P.Fragment, { children: [
|
|
325
|
+
/* @__PURE__ */ P.jsx(
|
|
316
326
|
"style",
|
|
317
327
|
{
|
|
318
328
|
dangerouslySetInnerHTML: {
|
|
319
|
-
__html: `${
|
|
329
|
+
__html: `${N} ${k} ${T} ${R}`
|
|
320
330
|
}
|
|
321
331
|
}
|
|
322
332
|
),
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
|
|
333
|
+
/* @__PURE__ */ P.jsx(
|
|
334
|
+
Z,
|
|
325
335
|
{
|
|
326
|
-
className: `monaco-editor-${
|
|
336
|
+
className: `monaco-editor-${d.current} overflow-hidden rounded-b-md border-x border-b`,
|
|
327
337
|
height: c,
|
|
328
338
|
language: t,
|
|
329
|
-
theme:
|
|
330
|
-
options:
|
|
331
|
-
onMount:
|
|
339
|
+
theme: S,
|
|
340
|
+
options: W,
|
|
341
|
+
onMount: O
|
|
332
342
|
}
|
|
333
343
|
)
|
|
334
344
|
] });
|
|
335
345
|
}
|
|
336
|
-
|
|
337
|
-
const
|
|
338
|
-
...
|
|
346
|
+
A.config({ monaco: D });
|
|
347
|
+
const Te = {
|
|
348
|
+
...F
|
|
339
349
|
};
|
|
340
|
-
function
|
|
350
|
+
function Xe({
|
|
341
351
|
codeRevision: e,
|
|
342
352
|
onCodeRevisionChange: t,
|
|
343
353
|
language: n,
|
|
@@ -346,15 +356,15 @@ function tt({
|
|
|
346
356
|
theme: o,
|
|
347
357
|
height: s = "75vh"
|
|
348
358
|
}) {
|
|
349
|
-
|
|
350
|
-
const [c,
|
|
351
|
-
(
|
|
352
|
-
var
|
|
353
|
-
|
|
359
|
+
B();
|
|
360
|
+
const [c, h] = L(), u = w(), d = w({ code: "", revisionId: 0 }), i = w(null), b = q(
|
|
361
|
+
(v, m) => {
|
|
362
|
+
var p, O, S, N, k, T;
|
|
363
|
+
i.current = v, u.current = m, v.setValue(e.code), h(v), (S = (O = (p = m.languages.typescript) == null ? void 0 : p.typescriptDefaults) == null ? void 0 : O.setDiagnosticsOptions) == null || S.call(O, {
|
|
354
364
|
noSuggestionDiagnostics: !0,
|
|
355
365
|
noSyntaxValidation: !0,
|
|
356
366
|
noSemanticValidation: !0
|
|
357
|
-
}), (
|
|
367
|
+
}), (T = (k = (N = m.languages.typescript) == null ? void 0 : N.javascriptDefaults) == null ? void 0 : k.setDiagnosticsOptions) == null || T.call(k, {
|
|
358
368
|
noSuggestionDiagnostics: !0,
|
|
359
369
|
noSyntaxValidation: !0,
|
|
360
370
|
noSemanticValidation: !0
|
|
@@ -362,38 +372,37 @@ function tt({
|
|
|
362
372
|
},
|
|
363
373
|
[e.code]
|
|
364
374
|
);
|
|
365
|
-
|
|
366
|
-
var
|
|
367
|
-
if (
|
|
368
|
-
const
|
|
369
|
-
|
|
375
|
+
$(() => {
|
|
376
|
+
var v, m;
|
|
377
|
+
if (i.current && (!e.revisionId || e.revisionId > Number((v = d.current) == null ? void 0 : v.revisionId))) {
|
|
378
|
+
const p = i.current.getModel();
|
|
379
|
+
p && (a != null && a.readOnly ? (m = i.current) == null || m.setValue(e.code) : (i.current.pushUndoStop(), i.current.executeEdits("edit", [
|
|
370
380
|
{
|
|
371
|
-
range:
|
|
381
|
+
range: p.getFullModelRange(),
|
|
372
382
|
text: e.code
|
|
373
383
|
}
|
|
374
|
-
]),
|
|
384
|
+
]), i.current.pushUndoStop()));
|
|
375
385
|
}
|
|
376
|
-
}, [e,
|
|
377
|
-
const { theme: E } =
|
|
378
|
-
return /* @__PURE__ */
|
|
379
|
-
|
|
386
|
+
}, [e, i.current]);
|
|
387
|
+
const { theme: E } = z({ monacoRef: u, themeConfig: r, editor: c, theme: o }), l = _(() => ({ ...Te, ...a || {} }), [a]);
|
|
388
|
+
return /* @__PURE__ */ P.jsx(P.Fragment, { children: /* @__PURE__ */ P.jsx(
|
|
389
|
+
Z,
|
|
380
390
|
{
|
|
381
391
|
className: "overflow-hidden rounded-b-md border-x border-b",
|
|
382
392
|
height: s,
|
|
383
|
-
onChange: (
|
|
384
|
-
|
|
393
|
+
onChange: (v, m) => {
|
|
394
|
+
d.current = { code: v ?? "", revisionId: m.versionId }, t({ ...d.current }, m);
|
|
385
395
|
},
|
|
386
396
|
language: n,
|
|
387
397
|
theme: E,
|
|
388
|
-
options:
|
|
389
|
-
onMount:
|
|
398
|
+
options: l,
|
|
399
|
+
onMount: b
|
|
390
400
|
}
|
|
391
401
|
) });
|
|
392
402
|
}
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
...
|
|
396
|
-
minimap: { enabled: !1 },
|
|
403
|
+
A.config({ monaco: D });
|
|
404
|
+
const Ie = {
|
|
405
|
+
...F,
|
|
397
406
|
codeLens: !1,
|
|
398
407
|
smartSelect: {
|
|
399
408
|
selectLeadingAndTrailingWhitespace: !0
|
|
@@ -401,7 +410,7 @@ const Ae = {
|
|
|
401
410
|
originalEditable: !1,
|
|
402
411
|
overviewRulerBorder: !1
|
|
403
412
|
};
|
|
404
|
-
function
|
|
413
|
+
function et({
|
|
405
414
|
original: e,
|
|
406
415
|
modified: t,
|
|
407
416
|
language: n,
|
|
@@ -410,55 +419,55 @@ function nt({
|
|
|
410
419
|
theme: o,
|
|
411
420
|
height: s = "75vh"
|
|
412
421
|
}) {
|
|
413
|
-
|
|
414
|
-
const [c,
|
|
415
|
-
return /* @__PURE__ */
|
|
416
|
-
|
|
422
|
+
B();
|
|
423
|
+
const [c, h] = L(), u = w(), { theme: d } = z({ monacoRef: u, themeConfig: r, editor: c, theme: o }), i = _(() => ({ ...Ie, ...a || {} }), [a]);
|
|
424
|
+
return /* @__PURE__ */ P.jsx(P.Fragment, { children: /* @__PURE__ */ P.jsx(
|
|
425
|
+
he,
|
|
417
426
|
{
|
|
418
427
|
className: "overflow-hidden rounded-b-md border-x border-b",
|
|
419
428
|
language: n,
|
|
420
|
-
theme:
|
|
429
|
+
theme: d,
|
|
421
430
|
original: e,
|
|
422
431
|
modified: t,
|
|
423
432
|
height: s,
|
|
424
|
-
options:
|
|
425
|
-
onMount:
|
|
433
|
+
options: i,
|
|
434
|
+
onMount: h
|
|
426
435
|
}
|
|
427
436
|
) });
|
|
428
437
|
}
|
|
429
|
-
var
|
|
430
|
-
function
|
|
438
|
+
var oe = /* @__PURE__ */ ((e) => (e.ContainsPath = "ContainsPath", e))(oe || {});
|
|
439
|
+
function Ve(e) {
|
|
431
440
|
const { pathSymbolMap: t, inlineActions: n = [], commandId: r } = e, a = Object.fromEntries(t.entries()), o = [];
|
|
432
441
|
return n == null || n.forEach((s) => {
|
|
433
442
|
const c = s.actions;
|
|
434
443
|
s.selectors.forEach((u) => {
|
|
435
444
|
switch (u.type) {
|
|
436
|
-
case
|
|
437
|
-
u.paths.forEach((
|
|
438
|
-
let
|
|
439
|
-
fullPath:
|
|
440
|
-
path:
|
|
441
|
-
symbol: a[
|
|
442
|
-
})).filter((
|
|
443
|
-
|
|
444
|
-
...
|
|
445
|
-
path:
|
|
446
|
-
})),
|
|
447
|
-
const
|
|
448
|
-
c.forEach((
|
|
449
|
-
const
|
|
450
|
-
range:
|
|
451
|
-
symbols: [
|
|
452
|
-
onClick:
|
|
453
|
-
data:
|
|
454
|
-
path:
|
|
445
|
+
case oe.ContainsPath: {
|
|
446
|
+
u.paths.forEach((d) => {
|
|
447
|
+
let b = Object.keys(a).map((l) => ({
|
|
448
|
+
fullPath: l,
|
|
449
|
+
path: l,
|
|
450
|
+
symbol: a[l]
|
|
451
|
+
})).filter((l) => l.path.startsWith(u.basePath));
|
|
452
|
+
b = b.map((l) => ({
|
|
453
|
+
...l,
|
|
454
|
+
path: l.path.substring(u.basePath.length)
|
|
455
|
+
})), b.filter((l) => d.test(l.path)).forEach((l) => {
|
|
456
|
+
const v = l.fullPath, m = l.symbol, p = m.range;
|
|
457
|
+
c.forEach((O) => {
|
|
458
|
+
const S = {
|
|
459
|
+
range: p,
|
|
460
|
+
symbols: [m],
|
|
461
|
+
onClick: O.onClick,
|
|
462
|
+
data: O.data,
|
|
463
|
+
path: v
|
|
455
464
|
};
|
|
456
465
|
o.push({
|
|
457
|
-
range:
|
|
466
|
+
range: p,
|
|
458
467
|
command: {
|
|
459
468
|
id: r,
|
|
460
|
-
title:
|
|
461
|
-
arguments: [
|
|
469
|
+
title: O.title,
|
|
470
|
+
arguments: [S]
|
|
462
471
|
}
|
|
463
472
|
});
|
|
464
473
|
});
|
|
@@ -470,48 +479,48 @@ function Fe(e) {
|
|
|
470
479
|
});
|
|
471
480
|
}), o;
|
|
472
481
|
}
|
|
473
|
-
const
|
|
482
|
+
const V = class V {
|
|
474
483
|
static set(t) {
|
|
475
|
-
|
|
484
|
+
V.data = t;
|
|
476
485
|
}
|
|
477
486
|
static get() {
|
|
478
|
-
return
|
|
487
|
+
return V.data;
|
|
479
488
|
}
|
|
480
489
|
};
|
|
481
|
-
|
|
482
|
-
let K =
|
|
483
|
-
async function
|
|
490
|
+
J(V, "data", {});
|
|
491
|
+
let K = V;
|
|
492
|
+
async function ae(e) {
|
|
484
493
|
const t = K.get(), { documentSymbolProvider: n } = t.StandaloneServices.get(t.ILanguageFeaturesService);
|
|
485
494
|
return await t.OutlineModel.create(n, e);
|
|
486
495
|
}
|
|
487
|
-
function
|
|
496
|
+
function se(e) {
|
|
488
497
|
const t = /* @__PURE__ */ new Map();
|
|
489
|
-
return
|
|
498
|
+
return G({
|
|
490
499
|
pathSymbolMap: t,
|
|
491
500
|
parentPath: "",
|
|
492
501
|
children: e.children,
|
|
493
|
-
parentKind:
|
|
502
|
+
parentKind: H.SymbolKind.Module
|
|
494
503
|
}), t;
|
|
495
504
|
}
|
|
496
|
-
function
|
|
505
|
+
function G(e) {
|
|
497
506
|
switch (e.parentKind) {
|
|
498
|
-
case
|
|
499
|
-
|
|
507
|
+
case H.SymbolKind.Module: {
|
|
508
|
+
Ue(e);
|
|
500
509
|
break;
|
|
501
510
|
}
|
|
502
|
-
case
|
|
503
|
-
|
|
511
|
+
case H.SymbolKind.Array: {
|
|
512
|
+
Ae(e);
|
|
504
513
|
break;
|
|
505
514
|
}
|
|
506
515
|
default:
|
|
507
|
-
|
|
516
|
+
Be(e);
|
|
508
517
|
}
|
|
509
518
|
}
|
|
510
|
-
function
|
|
519
|
+
function Ue(e) {
|
|
511
520
|
e.children.forEach((t) => {
|
|
512
521
|
var r;
|
|
513
522
|
let n = e.parentPath;
|
|
514
|
-
t.symbol && (n = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(n, t.symbol)),
|
|
523
|
+
t.symbol && (n = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(n, t.symbol)), G({
|
|
515
524
|
pathSymbolMap: e.pathSymbolMap,
|
|
516
525
|
parentPath: n,
|
|
517
526
|
children: t.children,
|
|
@@ -519,11 +528,11 @@ function ze(e) {
|
|
|
519
528
|
});
|
|
520
529
|
});
|
|
521
530
|
}
|
|
522
|
-
function
|
|
531
|
+
function Ae(e) {
|
|
523
532
|
let t = 0;
|
|
524
533
|
e.children.forEach((n) => {
|
|
525
534
|
const r = e.parentPath ? `${e.parentPath}.${t}` : `${t}`;
|
|
526
|
-
e.pathSymbolMap.set(r, n.symbol), t += 1,
|
|
535
|
+
e.pathSymbolMap.set(r, n.symbol), t += 1, G({
|
|
527
536
|
pathSymbolMap: e.pathSymbolMap,
|
|
528
537
|
parentPath: r,
|
|
529
538
|
children: n.children,
|
|
@@ -531,44 +540,44 @@ function Be(e) {
|
|
|
531
540
|
});
|
|
532
541
|
});
|
|
533
542
|
}
|
|
534
|
-
function
|
|
543
|
+
function Be(e) {
|
|
535
544
|
const t = e.children.get("0");
|
|
536
545
|
if (t) {
|
|
537
546
|
const n = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t == null ? void 0 : t.symbol.name;
|
|
538
547
|
e.pathSymbolMap.set(n, t.symbol);
|
|
539
548
|
}
|
|
540
549
|
}
|
|
541
|
-
function
|
|
550
|
+
function Fe({
|
|
542
551
|
editorRef: e,
|
|
543
552
|
inlineActions: t
|
|
544
553
|
}) {
|
|
545
|
-
|
|
554
|
+
$(() => D.languages.registerCodeLensProvider("yaml", {
|
|
546
555
|
provideCodeLenses: async (r) => {
|
|
547
|
-
var
|
|
548
|
-
const a = await
|
|
549
|
-
|
|
556
|
+
var h;
|
|
557
|
+
const a = await ae(r), o = se(a), s = (h = e == null ? void 0 : e.current) == null ? void 0 : h.addCommand(0, (u, { onClick: d, path: i, range: b, data: E }) => {
|
|
558
|
+
d({ path: i, range: b, data: E });
|
|
550
559
|
});
|
|
551
560
|
return s ? {
|
|
552
|
-
lenses:
|
|
561
|
+
lenses: Ve({ pathSymbolMap: o, inlineActions: t, commandId: s }),
|
|
553
562
|
dispose: () => {
|
|
554
563
|
}
|
|
555
564
|
} : void 0;
|
|
556
565
|
}
|
|
557
566
|
}).dispose, [t, e]);
|
|
558
567
|
}
|
|
559
|
-
const
|
|
560
|
-
const [n, r] = L(), a =
|
|
568
|
+
const ze = ({ editorRef: e, selection: t }) => {
|
|
569
|
+
const [n, r] = L(), a = _(
|
|
561
570
|
() => async (o, s, c) => {
|
|
562
|
-
var
|
|
563
|
-
const
|
|
564
|
-
if (!
|
|
571
|
+
var b, E, l;
|
|
572
|
+
const h = (b = e == null ? void 0 : e.current) == null ? void 0 : b.getModel();
|
|
573
|
+
if (!h || !s)
|
|
565
574
|
return r(void 0);
|
|
566
|
-
const u = await
|
|
567
|
-
|
|
575
|
+
const u = await ae(h), i = (E = se(u).get(s)) == null ? void 0 : E.range;
|
|
576
|
+
i && (r(i), c && ((l = e == null ? void 0 : e.current) == null || l.revealLineInCenter(i.startLineNumber)));
|
|
568
577
|
},
|
|
569
578
|
[]
|
|
570
579
|
);
|
|
571
|
-
|
|
580
|
+
$(() => {
|
|
572
581
|
if ("requestIdleCallback" in window) {
|
|
573
582
|
const o = requestIdleCallback(() => {
|
|
574
583
|
a(e, t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter);
|
|
@@ -580,7 +589,7 @@ const Ke = ({ editorRef: e, selection: t }) => {
|
|
|
580
589
|
}, 100);
|
|
581
590
|
return () => clearTimeout(o);
|
|
582
591
|
}
|
|
583
|
-
}, [t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter, e, a]),
|
|
592
|
+
}, [t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter, e, a]), $(() => {
|
|
584
593
|
var s;
|
|
585
594
|
if (!n)
|
|
586
595
|
return;
|
|
@@ -596,7 +605,7 @@ const Ke = ({ editorRef: e, selection: t }) => {
|
|
|
596
605
|
]);
|
|
597
606
|
return () => o == null ? void 0 : o.clear();
|
|
598
607
|
}, [n, e, t == null ? void 0 : t.className]);
|
|
599
|
-
},
|
|
608
|
+
}, ie = fe({
|
|
600
609
|
markers: [],
|
|
601
610
|
setMarkers: () => {
|
|
602
611
|
},
|
|
@@ -606,17 +615,17 @@ const Ke = ({ editorRef: e, selection: t }) => {
|
|
|
606
615
|
updateCursorPosition: (e) => {
|
|
607
616
|
}
|
|
608
617
|
});
|
|
609
|
-
function
|
|
618
|
+
function tt({
|
|
610
619
|
children: e
|
|
611
620
|
}) {
|
|
612
|
-
const [t, n] = L([]), [r, a] = L(null), o =
|
|
621
|
+
const [t, n] = L([]), [r, a] = L(null), o = q(
|
|
613
622
|
(s) => {
|
|
614
623
|
r == null || r.setPosition(s), r == null || r.focus();
|
|
615
624
|
},
|
|
616
625
|
[r]
|
|
617
626
|
);
|
|
618
|
-
return /* @__PURE__ */
|
|
619
|
-
|
|
627
|
+
return /* @__PURE__ */ P.jsx(
|
|
628
|
+
ie.Provider,
|
|
620
629
|
{
|
|
621
630
|
value: {
|
|
622
631
|
markers: t,
|
|
@@ -629,12 +638,12 @@ function rt({
|
|
|
629
638
|
}
|
|
630
639
|
);
|
|
631
640
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
641
|
+
function ce() {
|
|
642
|
+
return pe(ie);
|
|
634
643
|
}
|
|
635
644
|
const Re = ({ monacoRef: e }) => {
|
|
636
|
-
const { setMarkers: t } =
|
|
637
|
-
|
|
645
|
+
const { setMarkers: t } = ce();
|
|
646
|
+
$(() => {
|
|
638
647
|
let n;
|
|
639
648
|
const r = setTimeout(() => {
|
|
640
649
|
var o;
|
|
@@ -649,9 +658,9 @@ const Re = ({ monacoRef: e }) => {
|
|
|
649
658
|
};
|
|
650
659
|
}, [e]);
|
|
651
660
|
};
|
|
652
|
-
let
|
|
653
|
-
function
|
|
654
|
-
if (
|
|
661
|
+
let ee = !1;
|
|
662
|
+
function We(e) {
|
|
663
|
+
if (ee)
|
|
655
664
|
return;
|
|
656
665
|
const t = {
|
|
657
666
|
hover: !0,
|
|
@@ -660,26 +669,23 @@ function qe(e) {
|
|
|
660
669
|
validate: !0,
|
|
661
670
|
schemas: [e]
|
|
662
671
|
};
|
|
663
|
-
|
|
672
|
+
ee = !0, ye.setDiagnosticsOptions({ ...t });
|
|
664
673
|
}
|
|
665
|
-
const
|
|
674
|
+
const le = (e) => ge.parse(`file://${e}`).toString(), Ye = (e) => {
|
|
666
675
|
const { schemaConfig: t, instanceId: n } = e;
|
|
667
|
-
|
|
668
|
-
t != null && t.schema &&
|
|
676
|
+
$(() => {
|
|
677
|
+
t != null && t.schema && We({
|
|
669
678
|
// If YAML file is opened matching this glob
|
|
670
|
-
fileMatch: [
|
|
679
|
+
fileMatch: [le(n.toString())],
|
|
671
680
|
...t
|
|
672
681
|
});
|
|
673
682
|
}, [t == null ? void 0 : t.schema, n]);
|
|
674
683
|
};
|
|
675
|
-
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
minimap: {
|
|
679
|
-
enabled: !0
|
|
680
|
-
},
|
|
684
|
+
A.config({ monaco: D });
|
|
685
|
+
const He = {
|
|
686
|
+
...F,
|
|
681
687
|
folding: !0
|
|
682
|
-
},
|
|
688
|
+
}, nt = function(t) {
|
|
683
689
|
const {
|
|
684
690
|
yamlRevision: n,
|
|
685
691
|
schemaConfig: r,
|
|
@@ -687,89 +693,85 @@ const re = {
|
|
|
687
693
|
themeConfig: o,
|
|
688
694
|
onYamlRevisionChange: s,
|
|
689
695
|
selection: c,
|
|
690
|
-
theme:
|
|
696
|
+
theme: h,
|
|
691
697
|
options: u,
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
(G = S.current) == null || G.pushUndoStop(), x.setValue("");
|
|
703
|
-
let V = 0;
|
|
698
|
+
animateOnUpdate: d = !1,
|
|
699
|
+
onAnimateEnd: i
|
|
700
|
+
} = t, b = B(), [E] = L("yaml"), { editor: l, setEditor: v } = ce(), m = w(null), p = w(), O = w({ yaml: "", revisionId: 0 }), S = w(null), N = w(null), k = q(
|
|
701
|
+
(f) => {
|
|
702
|
+
var y, j, M;
|
|
703
|
+
const g = f.split(`
|
|
704
|
+
`), C = (y = S.current) == null ? void 0 : y.getModel();
|
|
705
|
+
if (C) {
|
|
706
|
+
(j = S.current) == null || j.pushUndoStop(), C.setValue("");
|
|
707
|
+
let x = 0;
|
|
704
708
|
N.current = window.setInterval(() => {
|
|
705
|
-
var
|
|
706
|
-
|
|
709
|
+
var I;
|
|
710
|
+
x < g.length ? (b && ((I = S.current) == null || I.executeEdits("addLine", [
|
|
707
711
|
{
|
|
708
|
-
range: new
|
|
709
|
-
text:
|
|
712
|
+
range: new b.Range(x + 1, 1, x + 1, 1),
|
|
713
|
+
text: g[x] + `
|
|
710
714
|
`
|
|
711
715
|
}
|
|
712
|
-
])),
|
|
713
|
-
}, 100), (
|
|
716
|
+
])), x++) : N.current && (clearInterval(N.current), i == null || i());
|
|
717
|
+
}, 100), (M = S.current) == null || M.pushUndoStop();
|
|
714
718
|
}
|
|
715
719
|
},
|
|
716
|
-
[
|
|
720
|
+
[b]
|
|
717
721
|
);
|
|
718
|
-
|
|
722
|
+
$(() => () => {
|
|
719
723
|
N.current && clearInterval(N.current);
|
|
720
724
|
}, []);
|
|
721
|
-
function
|
|
722
|
-
S.current =
|
|
723
|
-
var
|
|
724
|
-
(
|
|
725
|
+
function T(f, g) {
|
|
726
|
+
S.current = f, p.current = g, f.setValue(n.yaml), v(f), setTimeout(() => {
|
|
727
|
+
var C;
|
|
728
|
+
(C = m.current) != null && C.style && (m.current.style.opacity = "1");
|
|
725
729
|
}, 50);
|
|
726
730
|
}
|
|
727
|
-
|
|
728
|
-
var
|
|
729
|
-
if (S.current && (!n.revisionId || n.revisionId > Number((
|
|
730
|
-
const
|
|
731
|
-
|
|
731
|
+
$(() => {
|
|
732
|
+
var f;
|
|
733
|
+
if (S.current && (!n.revisionId || n.revisionId > Number((f = O.current) == null ? void 0 : f.revisionId))) {
|
|
734
|
+
const g = S.current.getModel();
|
|
735
|
+
g && (S.current.executeEdits("edit", [
|
|
732
736
|
{
|
|
733
|
-
range:
|
|
734
|
-
text:
|
|
737
|
+
range: g.getFullModelRange(),
|
|
738
|
+
text: d ? "" : n.yaml
|
|
735
739
|
}
|
|
736
|
-
]),
|
|
740
|
+
]), d && k(n.yaml));
|
|
737
741
|
}
|
|
738
|
-
}, [
|
|
739
|
-
const { theme:
|
|
740
|
-
Re({ monacoRef:
|
|
741
|
-
const
|
|
742
|
+
}, [k, n, d]), Ye({ schemaConfig: r, instanceId: E }), Fe({ editorRef: S, inlineActions: a });
|
|
743
|
+
const { theme: R } = z({ monacoRef: p, themeConfig: o, editor: l, theme: h });
|
|
744
|
+
Re({ monacoRef: p }), ze({ editorRef: S, selection: c });
|
|
745
|
+
const W = _(
|
|
742
746
|
() => ({
|
|
743
|
-
...
|
|
744
|
-
folding: l,
|
|
745
|
-
minimap: { ...re.minimap, enabled: f },
|
|
747
|
+
...He,
|
|
746
748
|
...u
|
|
747
749
|
}),
|
|
748
|
-
[
|
|
750
|
+
[u]
|
|
749
751
|
);
|
|
750
|
-
return /* @__PURE__ */
|
|
751
|
-
|
|
752
|
+
return /* @__PURE__ */ P.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref: m, children: /* @__PURE__ */ P.jsx(
|
|
753
|
+
Z,
|
|
752
754
|
{
|
|
753
|
-
onChange: (
|
|
754
|
-
|
|
755
|
+
onChange: (f, g) => {
|
|
756
|
+
O.current = { yaml: f ?? "", revisionId: g.versionId }, s({ ...O.current }, g);
|
|
755
757
|
},
|
|
756
758
|
language: "yaml",
|
|
757
|
-
theme:
|
|
758
|
-
options:
|
|
759
|
-
path:
|
|
760
|
-
onMount:
|
|
759
|
+
theme: R,
|
|
760
|
+
options: W,
|
|
761
|
+
path: le(E),
|
|
762
|
+
onMount: T
|
|
761
763
|
}
|
|
762
764
|
) });
|
|
763
765
|
};
|
|
764
766
|
export {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
767
|
+
Qe as BlameEditor,
|
|
768
|
+
et as CodeDiffEditor,
|
|
769
|
+
Xe as CodeEditor,
|
|
768
770
|
K as MonacoGlobals,
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
771
|
+
oe as SelectorType,
|
|
772
|
+
nt as YamlEditor,
|
|
773
|
+
ie as YamlEditorContext,
|
|
774
|
+
tt as YamlEditorContextProvider,
|
|
775
|
+
ce as useYamlEditorContext
|
|
774
776
|
};
|
|
775
777
|
//# sourceMappingURL=index.js.map
|