@harnessio/yaml-editor 0.22.0 → 0.24.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/dist/components/CodeEditor.d.ts +3 -2
- package/dist/components/YamlEditor.d.ts +1 -0
- package/dist/index.cjs +21 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +428 -425
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var tt = Object.defineProperty;
|
|
2
2
|
var rt = (e, t, r) => t in e ? tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var
|
|
4
|
-
import Y, { memo as Me, useState as R, useRef as v, useCallback as J, useEffect as N, useMemo as
|
|
3
|
+
var Ce = (e, t, r) => (rt(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import Y, { memo as Me, useState as R, useRef as v, useCallback as J, useEffect as N, useMemo as V, useLayoutEffect as Ve, createContext as nt, useContext as ot } from "react";
|
|
5
5
|
import * as F from "monaco-editor";
|
|
6
|
-
import { languages as
|
|
6
|
+
import { languages as we, Uri as it } from "monaco-editor";
|
|
7
7
|
import { render as at } from "react-dom";
|
|
8
|
-
import { yamlDefaults as
|
|
9
|
-
var
|
|
8
|
+
import { yamlDefaults as Se } from "monaco-yaml";
|
|
9
|
+
var Ae = { exports: {} }, ne = {};
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
14
|
*/
|
|
15
|
-
var
|
|
15
|
+
var $e = Object.getOwnPropertySymbols, ct = Object.prototype.hasOwnProperty, st = Object.prototype.propertyIsEnumerable;
|
|
16
16
|
function ut(e) {
|
|
17
17
|
if (e == null)
|
|
18
18
|
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
@@ -49,14 +49,14 @@ lt();
|
|
|
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 dt = Y,
|
|
52
|
+
var dt = Y, He = 60103;
|
|
53
53
|
ne.Fragment = 60107;
|
|
54
54
|
if (typeof Symbol == "function" && Symbol.for) {
|
|
55
|
-
var
|
|
56
|
-
|
|
55
|
+
var Ie = Symbol.for;
|
|
56
|
+
He = Ie("react.element"), ne.Fragment = Ie("react.fragment");
|
|
57
57
|
}
|
|
58
58
|
var ft = dt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, pt = Object.prototype.hasOwnProperty, mt = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
59
|
-
function
|
|
59
|
+
function Re(e, t, r) {
|
|
60
60
|
var n, o = {}, i = null, a = null;
|
|
61
61
|
r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (a = t.ref);
|
|
62
62
|
for (n in t)
|
|
@@ -64,12 +64,12 @@ function He(e, t, r) {
|
|
|
64
64
|
if (e && e.defaultProps)
|
|
65
65
|
for (n in t = e.defaultProps, t)
|
|
66
66
|
o[n] === void 0 && (o[n] = t[n]);
|
|
67
|
-
return { $$typeof:
|
|
67
|
+
return { $$typeof: He, type: e, key: i, ref: a, props: o, _owner: ft.current };
|
|
68
68
|
}
|
|
69
|
-
ne.jsx =
|
|
70
|
-
ne.jsxs =
|
|
71
|
-
|
|
72
|
-
var A =
|
|
69
|
+
ne.jsx = Re;
|
|
70
|
+
ne.jsxs = Re;
|
|
71
|
+
Ae.exports = ne;
|
|
72
|
+
var A = Ae.exports;
|
|
73
73
|
function gt(e, t, r) {
|
|
74
74
|
return t in e ? Object.defineProperty(e, t, {
|
|
75
75
|
value: r,
|
|
@@ -78,7 +78,7 @@ function gt(e, t, r) {
|
|
|
78
78
|
writable: !0
|
|
79
79
|
}) : e[t] = r, e;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Ne(e, t) {
|
|
82
82
|
var r = Object.keys(e);
|
|
83
83
|
if (Object.getOwnPropertySymbols) {
|
|
84
84
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -88,12 +88,12 @@ function Ie(e, t) {
|
|
|
88
88
|
}
|
|
89
89
|
return r;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Le(e) {
|
|
92
92
|
for (var t = 1; t < arguments.length; t++) {
|
|
93
93
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
94
|
-
t % 2 ?
|
|
94
|
+
t % 2 ? Ne(Object(r), !0).forEach(function(n) {
|
|
95
95
|
gt(e, n, r[n]);
|
|
96
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
96
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Ne(Object(r)).forEach(function(n) {
|
|
97
97
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
98
98
|
});
|
|
99
99
|
}
|
|
@@ -119,7 +119,7 @@ function vt(e, t) {
|
|
|
119
119
|
return r;
|
|
120
120
|
}
|
|
121
121
|
function yt(e, t) {
|
|
122
|
-
return bt(e) || wt(e, t) ||
|
|
122
|
+
return bt(e) || wt(e, t) || Ot(e, t) || Mt();
|
|
123
123
|
}
|
|
124
124
|
function bt(e) {
|
|
125
125
|
if (Array.isArray(e))
|
|
@@ -144,24 +144,24 @@ function wt(e, t) {
|
|
|
144
144
|
return r;
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Ot(e, t) {
|
|
148
148
|
if (e) {
|
|
149
149
|
if (typeof e == "string")
|
|
150
|
-
return
|
|
150
|
+
return Te(e, t);
|
|
151
151
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
152
152
|
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
|
|
153
153
|
return Array.from(e);
|
|
154
154
|
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
|
|
155
|
-
return
|
|
155
|
+
return Te(e, t);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function Te(e, t) {
|
|
159
159
|
(t == null || t > e.length) && (t = e.length);
|
|
160
160
|
for (var r = 0, n = new Array(t); r < t; r++)
|
|
161
161
|
n[r] = e[r];
|
|
162
162
|
return n;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Mt() {
|
|
165
165
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
166
166
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
167
167
|
}
|
|
@@ -173,7 +173,7 @@ function St(e, t, r) {
|
|
|
173
173
|
writable: !0
|
|
174
174
|
}) : e[t] = r, e;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function De(e, t) {
|
|
177
177
|
var r = Object.keys(e);
|
|
178
178
|
if (Object.getOwnPropertySymbols) {
|
|
179
179
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -183,12 +183,12 @@ function Te(e, t) {
|
|
|
183
183
|
}
|
|
184
184
|
return r;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function _e(e) {
|
|
187
187
|
for (var t = 1; t < arguments.length; t++) {
|
|
188
188
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
189
|
-
t % 2 ?
|
|
189
|
+
t % 2 ? De(Object(r), !0).forEach(function(n) {
|
|
190
190
|
St(e, n, r[n]);
|
|
191
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
191
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : De(Object(r)).forEach(function(n) {
|
|
192
192
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
193
193
|
});
|
|
194
194
|
}
|
|
@@ -214,7 +214,7 @@ function X(e) {
|
|
|
214
214
|
};
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function de(e) {
|
|
218
218
|
return {}.toString.call(e).includes("Object");
|
|
219
219
|
}
|
|
220
220
|
function xt(e) {
|
|
@@ -227,7 +227,7 @@ function jt(e, t) {
|
|
|
227
227
|
return Object.prototype.hasOwnProperty.call(e, t);
|
|
228
228
|
}
|
|
229
229
|
function Pt(e, t) {
|
|
230
|
-
return
|
|
230
|
+
return de(t) || K("changeType"), Object.keys(t).some(function(r) {
|
|
231
231
|
return !jt(e, r);
|
|
232
232
|
}) && K("changeField"), t;
|
|
233
233
|
}
|
|
@@ -235,12 +235,12 @@ function Ct(e) {
|
|
|
235
235
|
re(e) || K("selectorType");
|
|
236
236
|
}
|
|
237
237
|
function $t(e) {
|
|
238
|
-
re(e) ||
|
|
238
|
+
re(e) || de(e) || K("handlerType"), de(e) && Object.values(e).some(function(t) {
|
|
239
239
|
return !re(t);
|
|
240
240
|
}) && K("handlersType");
|
|
241
241
|
}
|
|
242
242
|
function It(e) {
|
|
243
|
-
e || K("initialIsRequired"),
|
|
243
|
+
e || K("initialIsRequired"), de(e) || K("initialType"), xt(e) && K("initialContent");
|
|
244
244
|
}
|
|
245
245
|
function Nt(e, t) {
|
|
246
246
|
throw new Error(e[t] || e.default);
|
|
@@ -255,7 +255,7 @@ var Lt = {
|
|
|
255
255
|
changeType: "provided value of changes should be an object",
|
|
256
256
|
changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
|
|
257
257
|
default: "an unknown error accured in `state-local` package"
|
|
258
|
-
}, K = X(Nt)(Lt),
|
|
258
|
+
}, K = X(Nt)(Lt), ue = {
|
|
259
259
|
changes: Pt,
|
|
260
260
|
selector: Ct,
|
|
261
261
|
handler: $t,
|
|
@@ -263,15 +263,15 @@ var Lt = {
|
|
|
263
263
|
};
|
|
264
264
|
function Tt(e) {
|
|
265
265
|
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
266
|
-
|
|
266
|
+
ue.initial(e), ue.handler(t);
|
|
267
267
|
var r = {
|
|
268
268
|
current: e
|
|
269
|
-
}, n = X(
|
|
269
|
+
}, n = X(kt)(r, t), o = X(_t)(r), i = X(ue.changes)(e), a = X(Dt)(r);
|
|
270
270
|
function u() {
|
|
271
|
-
var d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(
|
|
272
|
-
return
|
|
271
|
+
var d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(g) {
|
|
272
|
+
return g;
|
|
273
273
|
};
|
|
274
|
-
return
|
|
274
|
+
return ue.selector(d), d(r.current);
|
|
275
275
|
}
|
|
276
276
|
function l(d) {
|
|
277
277
|
Et(n, o, i, a)(d);
|
|
@@ -282,15 +282,15 @@ function Dt(e, t) {
|
|
|
282
282
|
return re(t) ? t(e.current) : t;
|
|
283
283
|
}
|
|
284
284
|
function _t(e, t) {
|
|
285
|
-
return e.current =
|
|
285
|
+
return e.current = _e(_e({}, e.current), t), t;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function kt(e, t, r) {
|
|
288
288
|
return re(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
|
|
289
289
|
var o;
|
|
290
290
|
return (o = t[n]) === null || o === void 0 ? void 0 : o.call(t, e.current[n]);
|
|
291
291
|
}), r;
|
|
292
292
|
}
|
|
293
|
-
var
|
|
293
|
+
var Vt = {
|
|
294
294
|
create: Tt
|
|
295
295
|
}, At = {
|
|
296
296
|
paths: {
|
|
@@ -312,19 +312,19 @@ function Rt(e) {
|
|
|
312
312
|
return {}.toString.call(e).includes("Object");
|
|
313
313
|
}
|
|
314
314
|
function Ut(e) {
|
|
315
|
-
return e ||
|
|
315
|
+
return e || ke("configIsRequired"), Rt(e) || ke("configType"), e.urls ? (zt(), {
|
|
316
316
|
paths: {
|
|
317
317
|
vs: e.urls.monacoBase
|
|
318
318
|
}
|
|
319
319
|
}) : e;
|
|
320
320
|
}
|
|
321
321
|
function zt() {
|
|
322
|
-
console.warn(
|
|
322
|
+
console.warn(Ue.deprecation);
|
|
323
323
|
}
|
|
324
324
|
function Ft(e, t) {
|
|
325
325
|
throw new Error(e[t] || e.default);
|
|
326
326
|
}
|
|
327
|
-
var
|
|
327
|
+
var Ue = {
|
|
328
328
|
configIsRequired: "the configuration object is required",
|
|
329
329
|
configType: "the configuration object should be an object",
|
|
330
330
|
default: "an unknown error accured in `@monaco-editor/loader` package",
|
|
@@ -338,7 +338,7 @@ var Re = {
|
|
|
338
338
|
|
|
339
339
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
340
340
|
`
|
|
341
|
-
},
|
|
341
|
+
}, ke = Ht(Ft)(Ue), Wt = {
|
|
342
342
|
config: Ut
|
|
343
343
|
}, qt = function() {
|
|
344
344
|
for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
|
|
@@ -349,16 +349,16 @@ var Re = {
|
|
|
349
349
|
}, o);
|
|
350
350
|
};
|
|
351
351
|
};
|
|
352
|
-
function
|
|
352
|
+
function ze(e, t) {
|
|
353
353
|
return Object.keys(t).forEach(function(r) {
|
|
354
|
-
t[r] instanceof Object && e[r] && Object.assign(t[r],
|
|
355
|
-
}),
|
|
354
|
+
t[r] instanceof Object && e[r] && Object.assign(t[r], ze(e[r], t[r]));
|
|
355
|
+
}), Le(Le({}, e), t);
|
|
356
356
|
}
|
|
357
357
|
var Bt = {
|
|
358
358
|
type: "cancelation",
|
|
359
359
|
msg: "operation is manually canceled"
|
|
360
360
|
};
|
|
361
|
-
function
|
|
361
|
+
function me(e) {
|
|
362
362
|
var t = !1, r = new Promise(function(n, o) {
|
|
363
363
|
e.then(function(i) {
|
|
364
364
|
return t ? o(Bt) : n(i);
|
|
@@ -368,18 +368,18 @@ function pe(e) {
|
|
|
368
368
|
return t = !0;
|
|
369
369
|
}, r;
|
|
370
370
|
}
|
|
371
|
-
var Kt =
|
|
371
|
+
var Kt = Vt.create({
|
|
372
372
|
config: At,
|
|
373
373
|
isInitialized: !1,
|
|
374
374
|
resolve: null,
|
|
375
375
|
reject: null,
|
|
376
376
|
monaco: null
|
|
377
|
-
}),
|
|
377
|
+
}), Fe = yt(Kt, 2), oe = Fe[0], fe = Fe[1];
|
|
378
378
|
function Yt(e) {
|
|
379
379
|
var t = Wt.config(e), r = t.monaco, n = vt(t, ["monaco"]);
|
|
380
|
-
|
|
380
|
+
fe(function(o) {
|
|
381
381
|
return {
|
|
382
|
-
config:
|
|
382
|
+
config: ze(o.config, n),
|
|
383
383
|
monaco: r
|
|
384
384
|
};
|
|
385
385
|
});
|
|
@@ -394,15 +394,15 @@ function Gt() {
|
|
|
394
394
|
};
|
|
395
395
|
});
|
|
396
396
|
if (!e.isInitialized) {
|
|
397
|
-
if (
|
|
397
|
+
if (fe({
|
|
398
398
|
isInitialized: !0
|
|
399
399
|
}), e.monaco)
|
|
400
|
-
return e.resolve(e.monaco),
|
|
400
|
+
return e.resolve(e.monaco), me(ge);
|
|
401
401
|
if (window.monaco && window.monaco.editor)
|
|
402
|
-
return
|
|
402
|
+
return We(window.monaco), e.resolve(window.monaco), me(ge);
|
|
403
403
|
qt(Zt, Qt)(Xt);
|
|
404
404
|
}
|
|
405
|
-
return
|
|
405
|
+
return me(ge);
|
|
406
406
|
}
|
|
407
407
|
function Zt(e) {
|
|
408
408
|
return document.body.appendChild(e);
|
|
@@ -433,13 +433,13 @@ function Xt() {
|
|
|
433
433
|
};
|
|
434
434
|
}), t = window.require;
|
|
435
435
|
t.config(e.config), t(["vs/editor/editor.main"], function(r) {
|
|
436
|
-
|
|
436
|
+
We(r), e.resolve(r);
|
|
437
437
|
}, function(r) {
|
|
438
438
|
e.reject(r);
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
|
-
function
|
|
442
|
-
oe().monaco ||
|
|
441
|
+
function We(e) {
|
|
442
|
+
oe().monaco || fe({
|
|
443
443
|
monaco: e
|
|
444
444
|
});
|
|
445
445
|
}
|
|
@@ -449,28 +449,28 @@ function er() {
|
|
|
449
449
|
return t;
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
|
-
var
|
|
453
|
-
return
|
|
452
|
+
var ge = new Promise(function(e, t) {
|
|
453
|
+
return fe({
|
|
454
454
|
resolve: e,
|
|
455
455
|
reject: t
|
|
456
456
|
});
|
|
457
|
-
}),
|
|
457
|
+
}), B = {
|
|
458
458
|
config: Yt,
|
|
459
459
|
init: Gt,
|
|
460
460
|
__getMonacoInstance: er
|
|
461
|
-
}, tr = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } },
|
|
461
|
+
}, tr = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, he = tr, rr = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, nr = rr;
|
|
462
462
|
function or({ children: e }) {
|
|
463
463
|
return Y.createElement("div", { style: nr.container }, e);
|
|
464
464
|
}
|
|
465
465
|
var ir = or, ar = ir;
|
|
466
466
|
function cr({ width: e, height: t, isEditorReady: r, loading: n, _ref: o, className: i, wrapperProps: a }) {
|
|
467
|
-
return Y.createElement("section", { style: { ...
|
|
467
|
+
return Y.createElement("section", { style: { ...he.wrapper, width: e, height: t }, ...a }, !r && Y.createElement(ar, null, n), Y.createElement("div", { ref: o, style: { ...he.fullWidth, ...!r && he.hide }, className: i }));
|
|
468
468
|
}
|
|
469
|
-
var sr = cr,
|
|
469
|
+
var sr = cr, qe = Me(sr);
|
|
470
470
|
function ur(e) {
|
|
471
471
|
N(e, []);
|
|
472
472
|
}
|
|
473
|
-
var
|
|
473
|
+
var Ee = ur;
|
|
474
474
|
function lr(e, t, r = !0) {
|
|
475
475
|
let n = v(!0);
|
|
476
476
|
N(n.current || !r ? () => {
|
|
@@ -484,74 +484,74 @@ function Z(e, t, r, n) {
|
|
|
484
484
|
return dr(e, n) || fr(e, t, r, n);
|
|
485
485
|
}
|
|
486
486
|
function dr(e, t) {
|
|
487
|
-
return e.editor.getModel(
|
|
487
|
+
return e.editor.getModel(Be(e, t));
|
|
488
488
|
}
|
|
489
489
|
function fr(e, t, r, n) {
|
|
490
|
-
return e.editor.createModel(t, r, n ?
|
|
490
|
+
return e.editor.createModel(t, r, n ? Be(e, n) : void 0);
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function Be(e, t) {
|
|
493
493
|
return e.Uri.parse(t);
|
|
494
494
|
}
|
|
495
|
-
function pr({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: o, originalModelPath: i, modifiedModelPath: a, keepCurrentOriginalModel: u = !1, keepCurrentModifiedModel: l = !1, theme: d = "light", loading:
|
|
496
|
-
let [
|
|
497
|
-
|
|
498
|
-
let c =
|
|
499
|
-
return c.then((
|
|
495
|
+
function pr({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: o, originalModelPath: i, modifiedModelPath: a, keepCurrentOriginalModel: u = !1, keepCurrentModifiedModel: l = !1, theme: d = "light", loading: g = "Loading...", options: f = {}, height: y = "100%", width: j = "100%", className: b, wrapperProps: $ = {}, beforeMount: T = ee, onMount: L = ee }) {
|
|
496
|
+
let [I, D] = R(!1), [k, C] = R(!0), M = v(null), E = v(null), x = v(null), h = v(L), s = v(T), w = v(!1);
|
|
497
|
+
Ee(() => {
|
|
498
|
+
let c = B.init();
|
|
499
|
+
return c.then((O) => (E.current = O) && C(!1)).catch((O) => (O == null ? void 0 : O.type) !== "cancelation" && console.error("Monaco initialization: error:", O)), () => M.current ? m() : c.cancel();
|
|
500
500
|
}), z(() => {
|
|
501
|
-
if (
|
|
502
|
-
let c =
|
|
503
|
-
|
|
501
|
+
if (M.current && E.current) {
|
|
502
|
+
let c = M.current.getOriginalEditor(), O = Z(E.current, e || "", n || r || "text", i || "");
|
|
503
|
+
O !== c.getModel() && c.setModel(O);
|
|
504
504
|
}
|
|
505
|
-
}, [i],
|
|
506
|
-
if (
|
|
507
|
-
let c =
|
|
508
|
-
|
|
505
|
+
}, [i], I), z(() => {
|
|
506
|
+
if (M.current && E.current) {
|
|
507
|
+
let c = M.current.getModifiedEditor(), O = Z(E.current, t || "", o || r || "text", a || "");
|
|
508
|
+
O !== c.getModel() && c.setModel(O);
|
|
509
509
|
}
|
|
510
|
-
}, [a],
|
|
511
|
-
let c =
|
|
512
|
-
c.getOption(
|
|
513
|
-
}, [t],
|
|
514
|
-
var c,
|
|
515
|
-
(
|
|
516
|
-
}, [e],
|
|
517
|
-
let { original: c, modified:
|
|
518
|
-
|
|
519
|
-
}, [r, n, o],
|
|
510
|
+
}, [a], I), z(() => {
|
|
511
|
+
let c = M.current.getModifiedEditor();
|
|
512
|
+
c.getOption(E.current.editor.EditorOption.readOnly) ? c.setValue(t || "") : t !== c.getValue() && (c.executeEdits("", [{ range: c.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), c.pushUndoStop());
|
|
513
|
+
}, [t], I), z(() => {
|
|
514
|
+
var c, O;
|
|
515
|
+
(O = (c = M.current) == null ? void 0 : c.getModel()) == null || O.original.setValue(e || "");
|
|
516
|
+
}, [e], I), z(() => {
|
|
517
|
+
let { original: c, modified: O } = M.current.getModel();
|
|
518
|
+
E.current.editor.setModelLanguage(c, n || r || "text"), E.current.editor.setModelLanguage(O, o || r || "text");
|
|
519
|
+
}, [r, n, o], I), z(() => {
|
|
520
520
|
var c;
|
|
521
|
-
(c =
|
|
522
|
-
}, [d],
|
|
521
|
+
(c = E.current) == null || c.editor.setTheme(d);
|
|
522
|
+
}, [d], I), z(() => {
|
|
523
523
|
var c;
|
|
524
|
-
(c =
|
|
525
|
-
}, [f],
|
|
526
|
-
let
|
|
524
|
+
(c = M.current) == null || c.updateOptions(f);
|
|
525
|
+
}, [f], I);
|
|
526
|
+
let S = J(() => {
|
|
527
527
|
var H;
|
|
528
|
-
if (!
|
|
528
|
+
if (!E.current)
|
|
529
529
|
return;
|
|
530
|
-
s.current(
|
|
531
|
-
let c = Z(
|
|
532
|
-
(H =
|
|
530
|
+
s.current(E.current);
|
|
531
|
+
let c = Z(E.current, e || "", n || r || "text", i || ""), O = Z(E.current, t || "", o || r || "text", a || "");
|
|
532
|
+
(H = M.current) == null || H.setModel({ original: c, modified: O });
|
|
533
533
|
}, [r, t, o, e, n, i, a]), p = J(() => {
|
|
534
534
|
var c;
|
|
535
|
-
!
|
|
536
|
-
}, [f, d,
|
|
535
|
+
!w.current && x.current && (M.current = E.current.editor.createDiffEditor(x.current, { automaticLayout: !0, ...f }), S(), (c = E.current) == null || c.editor.setTheme(d), D(!0), w.current = !0);
|
|
536
|
+
}, [f, d, S]);
|
|
537
537
|
N(() => {
|
|
538
|
-
|
|
539
|
-
}, [
|
|
540
|
-
!
|
|
541
|
-
}, [
|
|
542
|
-
function
|
|
543
|
-
var
|
|
544
|
-
let c = (
|
|
545
|
-
u || ((H = c == null ? void 0 : c.original) == null || H.dispose()), l || ((
|
|
538
|
+
I && h.current(M.current, E.current);
|
|
539
|
+
}, [I]), N(() => {
|
|
540
|
+
!k && !I && p();
|
|
541
|
+
}, [k, I, p]);
|
|
542
|
+
function m() {
|
|
543
|
+
var O, H, q, W;
|
|
544
|
+
let c = (O = M.current) == null ? void 0 : O.getModel();
|
|
545
|
+
u || ((H = c == null ? void 0 : c.original) == null || H.dispose()), l || ((q = c == null ? void 0 : c.modified) == null || q.dispose()), (W = M.current) == null || W.dispose();
|
|
546
546
|
}
|
|
547
|
-
return Y.createElement(
|
|
547
|
+
return Y.createElement(qe, { width: j, height: y, isEditorReady: I, loading: g, _ref: x, className: b, wrapperProps: $ });
|
|
548
548
|
}
|
|
549
549
|
var mr = pr, gr = Me(mr);
|
|
550
550
|
function hr() {
|
|
551
|
-
let [e, t] = R(
|
|
552
|
-
return
|
|
551
|
+
let [e, t] = R(B.__getMonacoInstance());
|
|
552
|
+
return Ee(() => {
|
|
553
553
|
let r;
|
|
554
|
-
return e || (r =
|
|
554
|
+
return e || (r = B.init(), r.then((n) => {
|
|
555
555
|
t(n);
|
|
556
556
|
})), () => r == null ? void 0 : r.cancel();
|
|
557
557
|
}), e;
|
|
@@ -563,57 +563,57 @@ function vr(e) {
|
|
|
563
563
|
t.current = e;
|
|
564
564
|
}, [e]), t.current;
|
|
565
565
|
}
|
|
566
|
-
var yr = vr,
|
|
567
|
-
function br({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: o, path: i, theme: a = "light", line: u, loading: l = "Loading...", options: d = {}, overrideServices:
|
|
568
|
-
let [
|
|
569
|
-
|
|
570
|
-
let P =
|
|
571
|
-
return P.then((
|
|
566
|
+
var yr = vr, le = /* @__PURE__ */ new Map();
|
|
567
|
+
function br({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: o, path: i, theme: a = "light", line: u, loading: l = "Loading...", options: d = {}, overrideServices: g = {}, saveViewState: f = !0, keepCurrentModel: y = !1, width: j = "100%", height: b = "100%", className: $, wrapperProps: T = {}, beforeMount: L = ee, onMount: I = ee, onChange: D, onValidate: k = ee }) {
|
|
568
|
+
let [C, M] = R(!1), [E, x] = R(!0), h = v(null), s = v(null), w = v(null), S = v(I), p = v(L), m = v(), c = v(n), O = yr(i), H = v(!1), q = v(!1);
|
|
569
|
+
Ee(() => {
|
|
570
|
+
let P = B.init();
|
|
571
|
+
return P.then((_) => (h.current = _) && x(!1)).catch((_) => (_ == null ? void 0 : _.type) !== "cancelation" && console.error("Monaco initialization: error:", _)), () => s.current ? se() : P.cancel();
|
|
572
572
|
}), z(() => {
|
|
573
|
-
var
|
|
574
|
-
let P = Z(
|
|
575
|
-
P !== ((
|
|
576
|
-
}, [i],
|
|
573
|
+
var _, U, Q, G;
|
|
574
|
+
let P = Z(h.current, e || n || "", t || o || "", i || r || "");
|
|
575
|
+
P !== ((_ = s.current) == null ? void 0 : _.getModel()) && (f && le.set(O, (U = s.current) == null ? void 0 : U.saveViewState()), (Q = s.current) == null || Q.setModel(P), f && ((G = s.current) == null || G.restoreViewState(le.get(i))));
|
|
576
|
+
}, [i], C), z(() => {
|
|
577
577
|
var P;
|
|
578
578
|
(P = s.current) == null || P.updateOptions(d);
|
|
579
|
-
}, [d],
|
|
580
|
-
!s.current || n === void 0 || (s.current.getOption(
|
|
581
|
-
}, [n],
|
|
582
|
-
var
|
|
583
|
-
let P = (
|
|
584
|
-
P && o && ((U =
|
|
585
|
-
}, [o],
|
|
579
|
+
}, [d], C), z(() => {
|
|
580
|
+
!s.current || n === void 0 || (s.current.getOption(h.current.editor.EditorOption.readOnly) ? s.current.setValue(n) : n !== s.current.getValue() && (q.current = !0, s.current.executeEdits("", [{ range: s.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), s.current.pushUndoStop(), q.current = !1));
|
|
581
|
+
}, [n], C), z(() => {
|
|
582
|
+
var _, U;
|
|
583
|
+
let P = (_ = s.current) == null ? void 0 : _.getModel();
|
|
584
|
+
P && o && ((U = h.current) == null || U.editor.setModelLanguage(P, o));
|
|
585
|
+
}, [o], C), z(() => {
|
|
586
586
|
var P;
|
|
587
587
|
u !== void 0 && ((P = s.current) == null || P.revealLine(u));
|
|
588
|
-
}, [u],
|
|
588
|
+
}, [u], C), z(() => {
|
|
589
589
|
var P;
|
|
590
|
-
(P =
|
|
591
|
-
}, [a],
|
|
592
|
-
let
|
|
590
|
+
(P = h.current) == null || P.editor.setTheme(a);
|
|
591
|
+
}, [a], C);
|
|
592
|
+
let W = J(() => {
|
|
593
593
|
var P;
|
|
594
|
-
if (!(!
|
|
595
|
-
p.current(
|
|
596
|
-
let
|
|
597
|
-
s.current = (P =
|
|
594
|
+
if (!(!w.current || !h.current) && !H.current) {
|
|
595
|
+
p.current(h.current);
|
|
596
|
+
let _ = i || r, U = Z(h.current, n || e || "", t || o || "", _ || "");
|
|
597
|
+
s.current = (P = h.current) == null ? void 0 : P.editor.create(w.current, { model: U, automaticLayout: !0, ...d }, g), f && s.current.restoreViewState(le.get(_)), h.current.editor.setTheme(a), u !== void 0 && s.current.revealLine(u), M(!0), H.current = !0;
|
|
598
598
|
}
|
|
599
|
-
}, [e, t, r, n, o, i, d,
|
|
599
|
+
}, [e, t, r, n, o, i, d, g, f, a, u]);
|
|
600
600
|
N(() => {
|
|
601
|
-
|
|
602
|
-
}, [
|
|
603
|
-
!
|
|
604
|
-
}, [
|
|
605
|
-
var P,
|
|
606
|
-
|
|
607
|
-
|
|
601
|
+
C && S.current(s.current, h.current);
|
|
602
|
+
}, [C]), N(() => {
|
|
603
|
+
!E && !C && W();
|
|
604
|
+
}, [E, C, W]), c.current = n, N(() => {
|
|
605
|
+
var P, _;
|
|
606
|
+
C && D && ((P = m.current) == null || P.dispose(), m.current = (_ = s.current) == null ? void 0 : _.onDidChangeModelContent((U) => {
|
|
607
|
+
q.current || D(s.current.getValue(), U);
|
|
608
608
|
}));
|
|
609
|
-
}, [
|
|
610
|
-
if (
|
|
611
|
-
let P =
|
|
609
|
+
}, [C, D]), N(() => {
|
|
610
|
+
if (C) {
|
|
611
|
+
let P = h.current.editor.onDidChangeMarkers((_) => {
|
|
612
612
|
var Q;
|
|
613
613
|
let U = (Q = s.current.getModel()) == null ? void 0 : Q.uri;
|
|
614
|
-
if (U &&
|
|
615
|
-
let G =
|
|
616
|
-
|
|
614
|
+
if (U && _.find((G) => G.path === U.path)) {
|
|
615
|
+
let G = h.current.editor.getModelMarkers({ resource: U });
|
|
616
|
+
k == null || k(G);
|
|
617
617
|
}
|
|
618
618
|
});
|
|
619
619
|
return () => {
|
|
@@ -622,14 +622,14 @@ function br({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, lan
|
|
|
622
622
|
}
|
|
623
623
|
return () => {
|
|
624
624
|
};
|
|
625
|
-
}, [
|
|
626
|
-
function
|
|
627
|
-
var P,
|
|
628
|
-
(P =
|
|
625
|
+
}, [C, k]);
|
|
626
|
+
function se() {
|
|
627
|
+
var P, _;
|
|
628
|
+
(P = m.current) == null || P.dispose(), y ? f && le.set(i, s.current.saveViewState()) : (_ = s.current.getModel()) == null || _.dispose(), s.current.dispose();
|
|
629
629
|
}
|
|
630
|
-
return Y.createElement(
|
|
630
|
+
return Y.createElement(qe, { width: j, height: b, isEditorReady: C, loading: l, _ref: w, className: $, wrapperProps: T });
|
|
631
631
|
}
|
|
632
|
-
var wr = br,
|
|
632
|
+
var wr = br, Or = Me(wr), pe = Or;
|
|
633
633
|
const ae = {
|
|
634
634
|
selectOnLineNumbers: !0,
|
|
635
635
|
scrollBeyondLastLine: !1,
|
|
@@ -662,14 +662,14 @@ const ae = {
|
|
|
662
662
|
F.editor && n && (F.editor.setTheme(n), a(n));
|
|
663
663
|
}, [r, n]), { theme: i };
|
|
664
664
|
};
|
|
665
|
-
function
|
|
665
|
+
function xe(e) {
|
|
666
666
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
667
667
|
let r = "";
|
|
668
668
|
for (let n = 0; n < e; n++)
|
|
669
669
|
r += t.charAt(Math.floor(Math.random() * t.length));
|
|
670
670
|
return r;
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function Mr(e) {
|
|
673
673
|
return e.replace("'", "'");
|
|
674
674
|
}
|
|
675
675
|
const Sr = (e) => {
|
|
@@ -694,7 +694,7 @@ const Sr = (e) => {
|
|
|
694
694
|
const t = new Date(e), n = Math.floor(((/* @__PURE__ */ new Date()).getTime() - t.getTime()) / 1e3), o = Math.abs(n);
|
|
695
695
|
return Sr(o);
|
|
696
696
|
};
|
|
697
|
-
function
|
|
697
|
+
function Ke({
|
|
698
698
|
instanceId: e,
|
|
699
699
|
lineNumbersPosition: t
|
|
700
700
|
}) {
|
|
@@ -735,19 +735,19 @@ function xr({
|
|
|
735
735
|
}) {
|
|
736
736
|
let o = "";
|
|
737
737
|
return t.forEach((i) => {
|
|
738
|
-
var d,
|
|
739
|
-
const a = (
|
|
740
|
-
for (let
|
|
741
|
-
|
|
742
|
-
.monaco-editor-${e} .view-line .blame-editor-commit-${
|
|
743
|
-
content: '${
|
|
738
|
+
var d, g, f, y, j, b, $, T;
|
|
739
|
+
const a = (g = (d = i == null ? void 0 : i.commitInfo) == null ? void 0 : d.author) == null ? void 0 : g.avatarUrl, u = (y = (f = i == null ? void 0 : i.commitInfo) == null ? void 0 : f.author) == null ? void 0 : y.initials, l = a ? `background: url('${(b = (j = i == null ? void 0 : i.commitInfo) == null ? void 0 : j.author) == null ? void 0 : b.avatarUrl}');` : "";
|
|
740
|
+
for (let L = i.fromLineNumber; L <= i.toLineNumber; L++)
|
|
741
|
+
L === i.fromLineNumber ? o += `
|
|
742
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${L}:before {
|
|
743
|
+
content: '${Mr(Er(((T = ($ = i == null ? void 0 : i.commitInfo) == null ? void 0 : $.author) == null ? void 0 : T.when) || ""))}';
|
|
744
744
|
position: absolute;
|
|
745
745
|
left: 10px;
|
|
746
746
|
top: 0px;
|
|
747
747
|
color: var(--cn-text-3);
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
-
.monaco-editor-${e} .view-line .blame-editor-commit-${
|
|
750
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${L}:after {
|
|
751
751
|
content: '${u ?? " "}';
|
|
752
752
|
position: absolute;
|
|
753
753
|
border-radius: 50%;
|
|
@@ -767,7 +767,7 @@ function xr({
|
|
|
767
767
|
${l}
|
|
768
768
|
background-size: 100% 100%;
|
|
769
769
|
}` : o += `
|
|
770
|
-
.monaco-editor-${e} .view-line .blame-editor-commit-${
|
|
770
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${L}:before {
|
|
771
771
|
content: ' ';
|
|
772
772
|
left: 10px;
|
|
773
773
|
top: 0px;
|
|
@@ -775,12 +775,12 @@ function xr({
|
|
|
775
775
|
}`;
|
|
776
776
|
}), o;
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function Ye(e, t) {
|
|
779
779
|
let r = "";
|
|
780
780
|
return e.length > t ? r = e.slice(0, t - 3) + "..." : e.length < t ? r = e + " ".repeat(t - e.length) : r = e, " ".repeat(25) + r + " ".repeat(10);
|
|
781
781
|
}
|
|
782
|
-
|
|
783
|
-
const
|
|
782
|
+
B.config({ monaco: F });
|
|
783
|
+
const ve = 450, jr = 30, Pr = 140, Cr = 24, $r = {
|
|
784
784
|
...ae,
|
|
785
785
|
readOnly: !0,
|
|
786
786
|
matchBrackets: "never",
|
|
@@ -803,73 +803,73 @@ function tn({
|
|
|
803
803
|
options: l,
|
|
804
804
|
className: d
|
|
805
805
|
}) {
|
|
806
|
-
const
|
|
806
|
+
const g = v(o), f = v(null), y = v(xe(5));
|
|
807
807
|
ie();
|
|
808
|
-
const [
|
|
808
|
+
const [j, b] = R(), $ = v(null), T = v(null);
|
|
809
809
|
N(() => {
|
|
810
|
-
|
|
810
|
+
g.current = o;
|
|
811
811
|
}, [o]);
|
|
812
|
-
function
|
|
813
|
-
const s = T.current,
|
|
814
|
-
if (!s || !
|
|
812
|
+
function L() {
|
|
813
|
+
const s = T.current, w = $.current;
|
|
814
|
+
if (!s || !w)
|
|
815
815
|
return;
|
|
816
816
|
i && s.changeViewZones(function(p) {
|
|
817
817
|
p.addZone({
|
|
818
818
|
afterLineNumber: 0,
|
|
819
819
|
heightInPx: 10,
|
|
820
820
|
domNode: document.createElement("div")
|
|
821
|
-
}),
|
|
822
|
-
if (c !==
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
afterLineNumber:
|
|
821
|
+
}), g.current.forEach((m, c) => {
|
|
822
|
+
if (c !== g.current.length - 1) {
|
|
823
|
+
const O = document.createElement("div");
|
|
824
|
+
O.style.borderTop = "1px solid var(--cn-border-2)", O.style.marginTop = "9px", O.className = "blame-editor-separator", p.addZone({
|
|
825
|
+
afterLineNumber: m.toLineNumber,
|
|
826
826
|
heightInPx: 20,
|
|
827
|
-
domNode:
|
|
827
|
+
domNode: O
|
|
828
828
|
});
|
|
829
829
|
}
|
|
830
830
|
});
|
|
831
831
|
});
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
var
|
|
832
|
+
const S = [];
|
|
833
|
+
g.current.forEach((p) => {
|
|
834
|
+
var m;
|
|
835
835
|
for (let c = p.fromLineNumber; c <= p.toLineNumber; c++)
|
|
836
|
-
|
|
837
|
-
range: new
|
|
836
|
+
S.push({
|
|
837
|
+
range: new w.Range(c, 0, c + 1, 0),
|
|
838
838
|
options: {
|
|
839
839
|
before: {
|
|
840
|
-
content:
|
|
841
|
-
c === p.fromLineNumber && ((
|
|
840
|
+
content: Ye(
|
|
841
|
+
c === p.fromLineNumber && ((m = p == null ? void 0 : p.commitInfo) == null ? void 0 : m.title) || "",
|
|
842
842
|
jr
|
|
843
843
|
),
|
|
844
|
-
cursorStops:
|
|
844
|
+
cursorStops: w.editor.InjectedTextCursorStops.None,
|
|
845
845
|
inlineClassName: `blame-editor-commit blame-editor-commit-${c}`
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
848
|
});
|
|
849
|
-
}), s.createDecorationsCollection(
|
|
849
|
+
}), s.createDecorationsCollection(S);
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
var
|
|
853
|
-
T.current = s,
|
|
851
|
+
function I(s, w) {
|
|
852
|
+
var S, p, m, c, O, H;
|
|
853
|
+
T.current = s, $.current = w, s.setValue(e), b(s), (m = (p = (S = w.languages.typescript) == null ? void 0 : S.typescriptDefaults) == null ? void 0 : p.setDiagnosticsOptions) == null || m.call(p, {
|
|
854
854
|
noSuggestionDiagnostics: !0,
|
|
855
855
|
noSyntaxValidation: !0,
|
|
856
856
|
noSemanticValidation: !0
|
|
857
|
-
}), (H = (
|
|
857
|
+
}), (H = (O = (c = w.languages.typescript) == null ? void 0 : c.javascriptDefaults) == null ? void 0 : O.setDiagnosticsOptions) == null || H.call(O, {
|
|
858
858
|
noSuggestionDiagnostics: !0,
|
|
859
859
|
noSyntaxValidation: !0,
|
|
860
860
|
noSemanticValidation: !0
|
|
861
|
-
}),
|
|
861
|
+
}), L();
|
|
862
862
|
}
|
|
863
863
|
N(() => {
|
|
864
|
-
|
|
864
|
+
j == null || j.setValue(e);
|
|
865
865
|
}, [e]);
|
|
866
|
-
const { theme:
|
|
867
|
-
() =>
|
|
866
|
+
const { theme: D } = ce({ monacoRef: $, themeConfig: r, editor: j, theme: a }), k = V(
|
|
867
|
+
() => Ke({
|
|
868
868
|
instanceId: y.current,
|
|
869
869
|
lineNumbersPosition: n
|
|
870
870
|
}),
|
|
871
871
|
[o]
|
|
872
|
-
),
|
|
872
|
+
), C = V(
|
|
873
873
|
() => xr({
|
|
874
874
|
instanceId: y.current,
|
|
875
875
|
blameData: o,
|
|
@@ -884,55 +884,55 @@ function tn({
|
|
|
884
884
|
if (n === "center" && f.current) {
|
|
885
885
|
const s = f.current.getElementsByClassName("lines-content")[0];
|
|
886
886
|
if (s) {
|
|
887
|
-
const
|
|
888
|
-
const
|
|
889
|
-
f.current && (f.current.style.setProperty("--line-number-offset", `${
|
|
890
|
-
}, p = new MutationObserver(
|
|
891
|
-
return p.observe(s,
|
|
887
|
+
const w = { attributes: !0 }, S = () => {
|
|
888
|
+
const m = parseInt(getComputedStyle(s).left);
|
|
889
|
+
f.current && (f.current.style.setProperty("--line-number-offset", `${ve + 16 + m}px`), f.current.style.setProperty("--line-number-display", "block"));
|
|
890
|
+
}, p = new MutationObserver(S);
|
|
891
|
+
return p.observe(s, w), S(), () => {
|
|
892
892
|
p.disconnect();
|
|
893
893
|
};
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
896
|
});
|
|
897
|
-
const
|
|
897
|
+
const M = V(() => `
|
|
898
898
|
.monaco-editor-${y.current} .margin {
|
|
899
899
|
display: var(--line-number-display);
|
|
900
900
|
left: var(--line-number-offset);
|
|
901
901
|
pointer-events: none;
|
|
902
|
-
}`, []),
|
|
903
|
-
clip-path: polygon(${
|
|
902
|
+
}`, []), E = V(() => `.monaco-editor-${y.current} .view-overlays {
|
|
903
|
+
clip-path: polygon(${ve + 16}px 0, 100% 0%, 100% 100%, ${ve + 16}px 100%);
|
|
904
904
|
height:100% !important;
|
|
905
|
-
}`, []),
|
|
905
|
+
}`, []), x = V(
|
|
906
906
|
() => ({
|
|
907
907
|
...$r,
|
|
908
908
|
...l
|
|
909
909
|
}),
|
|
910
910
|
[l]
|
|
911
|
-
),
|
|
911
|
+
), h = V(() => /* @__PURE__ */ A.jsx(
|
|
912
912
|
"style",
|
|
913
913
|
{
|
|
914
914
|
dangerouslySetInnerHTML: {
|
|
915
|
-
__html: `${
|
|
915
|
+
__html: `${k} ${C} ${M} ${E}`
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
|
-
), [
|
|
918
|
+
), [k, C, E, M]);
|
|
919
919
|
return /* @__PURE__ */ A.jsxs("div", { className: d, ref: f, children: [
|
|
920
|
-
|
|
920
|
+
h,
|
|
921
921
|
/* @__PURE__ */ A.jsx(
|
|
922
|
-
|
|
922
|
+
pe,
|
|
923
923
|
{
|
|
924
924
|
className: `monaco-editor-${y.current} overflow-hidden rounded-b-cn-3`,
|
|
925
925
|
height: u,
|
|
926
926
|
language: t,
|
|
927
|
-
theme:
|
|
928
|
-
options:
|
|
929
|
-
onMount:
|
|
927
|
+
theme: D,
|
|
928
|
+
options: x,
|
|
929
|
+
onMount: I
|
|
930
930
|
}
|
|
931
931
|
)
|
|
932
932
|
] });
|
|
933
933
|
}
|
|
934
|
-
|
|
935
|
-
const
|
|
934
|
+
B.config({ monaco: F });
|
|
935
|
+
const ye = 450, Ir = 30, Nr = {
|
|
936
936
|
...ae,
|
|
937
937
|
readOnly: !0,
|
|
938
938
|
matchBrackets: "never",
|
|
@@ -954,60 +954,60 @@ function rn({
|
|
|
954
954
|
options: u,
|
|
955
955
|
className: l
|
|
956
956
|
}) {
|
|
957
|
-
const d = v(o),
|
|
957
|
+
const d = v(o), g = v(null), f = v(xe(5));
|
|
958
958
|
ie();
|
|
959
|
-
const [y,
|
|
959
|
+
const [y, j] = R(), b = v(null), $ = v(null);
|
|
960
960
|
N(() => {
|
|
961
961
|
d.current = o;
|
|
962
962
|
}, [o]);
|
|
963
963
|
function T() {
|
|
964
|
-
const
|
|
965
|
-
if (!
|
|
964
|
+
const x = $.current, h = b.current;
|
|
965
|
+
if (!x || !h)
|
|
966
966
|
return;
|
|
967
|
-
|
|
968
|
-
|
|
967
|
+
x.changeViewZones(function(w) {
|
|
968
|
+
w.addZone({
|
|
969
969
|
afterLineNumber: 0,
|
|
970
970
|
heightInPx: 1,
|
|
971
971
|
domNode: document.createElement("div")
|
|
972
|
-
}), d.current.forEach((
|
|
973
|
-
if (
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
afterLineNumber:
|
|
972
|
+
}), d.current.forEach((S) => {
|
|
973
|
+
if (S.infoContent) {
|
|
974
|
+
const m = document.createElement("div");
|
|
975
|
+
m.className = "blame-editor-info-holder", m.style.position = "relative", m.style.zIndex = "100", m.style.overflow = "visible", Lr(m, S.infoContent), w.addZone({
|
|
976
|
+
afterLineNumber: S.fromLineNumber - 1,
|
|
977
977
|
heightInPx: 0,
|
|
978
|
-
domNode:
|
|
978
|
+
domNode: m
|
|
979
979
|
});
|
|
980
980
|
}
|
|
981
981
|
const p = document.createElement("div");
|
|
982
|
-
p.style.borderTop = "1px solid var(--cn-border-2)", p.style.marginTop = "9px", p.className = "blame-editor-separator",
|
|
983
|
-
afterLineNumber:
|
|
982
|
+
p.style.borderTop = "1px solid var(--cn-border-2)", p.style.marginTop = "9px", p.className = "blame-editor-separator", w.addZone({
|
|
983
|
+
afterLineNumber: S.toLineNumber,
|
|
984
984
|
heightInPx: 20,
|
|
985
985
|
domNode: p
|
|
986
986
|
});
|
|
987
987
|
});
|
|
988
988
|
});
|
|
989
989
|
const s = [];
|
|
990
|
-
d.current.forEach((
|
|
991
|
-
for (let
|
|
990
|
+
d.current.forEach((w) => {
|
|
991
|
+
for (let S = w.fromLineNumber; S <= w.toLineNumber; S++)
|
|
992
992
|
s.push({
|
|
993
|
-
range: new
|
|
993
|
+
range: new h.Range(S, 0, S + 1, 0),
|
|
994
994
|
options: {
|
|
995
995
|
before: {
|
|
996
|
-
content:
|
|
997
|
-
cursorStops:
|
|
998
|
-
inlineClassName: `blame-editor-commit blame-editor-commit-${
|
|
996
|
+
content: Ye("", Ir),
|
|
997
|
+
cursorStops: h.editor.InjectedTextCursorStops.None,
|
|
998
|
+
inlineClassName: `blame-editor-commit blame-editor-commit-${S}`
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
1001
|
});
|
|
1002
|
-
}),
|
|
1002
|
+
}), x.createDecorationsCollection(s);
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1005
|
-
var s,
|
|
1006
|
-
|
|
1004
|
+
function L(x, h) {
|
|
1005
|
+
var s, w, S, p, m, c;
|
|
1006
|
+
$.current = x, b.current = h, x.setValue(e), j(x), (S = (w = (s = h.languages.typescript) == null ? void 0 : s.typescriptDefaults) == null ? void 0 : w.setDiagnosticsOptions) == null || S.call(w, {
|
|
1007
1007
|
noSuggestionDiagnostics: !0,
|
|
1008
1008
|
noSyntaxValidation: !0,
|
|
1009
1009
|
noSemanticValidation: !0
|
|
1010
|
-
}), (c = (
|
|
1010
|
+
}), (c = (m = (p = h.languages.typescript) == null ? void 0 : p.javascriptDefaults) == null ? void 0 : m.setDiagnosticsOptions) == null || c.call(m, {
|
|
1011
1011
|
noSuggestionDiagnostics: !0,
|
|
1012
1012
|
noSyntaxValidation: !0,
|
|
1013
1013
|
noSemanticValidation: !0
|
|
@@ -1016,62 +1016,62 @@ function rn({
|
|
|
1016
1016
|
N(() => {
|
|
1017
1017
|
y == null || y.setValue(e);
|
|
1018
1018
|
}, [e]);
|
|
1019
|
-
const { theme:
|
|
1020
|
-
() =>
|
|
1019
|
+
const { theme: I } = ce({ monacoRef: b, themeConfig: r, editor: y, theme: i }), D = V(
|
|
1020
|
+
() => Ke({
|
|
1021
1021
|
instanceId: f.current,
|
|
1022
1022
|
lineNumbersPosition: n
|
|
1023
1023
|
}),
|
|
1024
1024
|
[o]
|
|
1025
1025
|
);
|
|
1026
1026
|
Ve(() => {
|
|
1027
|
-
|
|
1027
|
+
g.current && g.current.style.setProperty("--line-number-display", "none");
|
|
1028
1028
|
}, []), N(() => {
|
|
1029
|
-
if (n === "center" &&
|
|
1030
|
-
const
|
|
1031
|
-
if (
|
|
1032
|
-
const
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
},
|
|
1036
|
-
return
|
|
1037
|
-
|
|
1029
|
+
if (n === "center" && g.current) {
|
|
1030
|
+
const x = g.current.getElementsByClassName("lines-content")[0];
|
|
1031
|
+
if (x) {
|
|
1032
|
+
const h = { attributes: !0 }, s = () => {
|
|
1033
|
+
const S = parseInt(getComputedStyle(x).left);
|
|
1034
|
+
g.current && (g.current.style.setProperty("--line-number-offset", `${ye + 16 + S}px`), g.current.style.setProperty("--line-number-display", "block"));
|
|
1035
|
+
}, w = new MutationObserver(s);
|
|
1036
|
+
return w.observe(x, h), s(), () => {
|
|
1037
|
+
w.disconnect();
|
|
1038
1038
|
};
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
1041
|
});
|
|
1042
|
-
const
|
|
1042
|
+
const k = V(() => `
|
|
1043
1043
|
.monaco-editor-${f.current} .margin {
|
|
1044
1044
|
display: var(--line-number-display);
|
|
1045
1045
|
left: var(--line-number-offset);
|
|
1046
1046
|
pointer-events: none;
|
|
1047
|
-
}`, []),
|
|
1048
|
-
clip-path: polygon(${
|
|
1047
|
+
}`, []), C = V(() => `.monaco-editor-${f.current} .view-overlays {
|
|
1048
|
+
clip-path: polygon(${ye + 16}px 0, 100% 0%, 100% 100%, ${ye + 16}px 100%);
|
|
1049
1049
|
height:100% !important;
|
|
1050
|
-
}`, []),
|
|
1050
|
+
}`, []), M = V(
|
|
1051
1051
|
() => ({
|
|
1052
1052
|
...Nr,
|
|
1053
1053
|
...u
|
|
1054
1054
|
}),
|
|
1055
1055
|
[u]
|
|
1056
|
-
),
|
|
1056
|
+
), E = V(() => /* @__PURE__ */ A.jsx(
|
|
1057
1057
|
"style",
|
|
1058
1058
|
{
|
|
1059
1059
|
dangerouslySetInnerHTML: {
|
|
1060
|
-
__html: `${
|
|
1060
|
+
__html: `${D} ${k} ${C}`
|
|
1061
1061
|
}
|
|
1062
1062
|
}
|
|
1063
|
-
), [
|
|
1064
|
-
return /* @__PURE__ */ A.jsxs("div", { className: l, ref:
|
|
1065
|
-
|
|
1063
|
+
), [D, C, k]);
|
|
1064
|
+
return /* @__PURE__ */ A.jsxs("div", { className: l, ref: g, children: [
|
|
1065
|
+
E,
|
|
1066
1066
|
/* @__PURE__ */ A.jsx(
|
|
1067
|
-
|
|
1067
|
+
pe,
|
|
1068
1068
|
{
|
|
1069
1069
|
className: `monaco-editor-${f.current} overflow-hidden rounded-b-cn-3`,
|
|
1070
1070
|
height: a,
|
|
1071
1071
|
language: t,
|
|
1072
|
-
theme:
|
|
1073
|
-
options:
|
|
1074
|
-
onMount:
|
|
1072
|
+
theme: I,
|
|
1073
|
+
options: M,
|
|
1074
|
+
onMount: L
|
|
1075
1075
|
}
|
|
1076
1076
|
)
|
|
1077
1077
|
] });
|
|
@@ -1117,32 +1117,32 @@ function Dr(e) {
|
|
|
1117
1117
|
const { enable: t, editor: r, onSelectedLineChange: n, selectedLine: o, onSelectedLineButtonClick: i } = e, a = v(null), u = v(!1), l = v(null);
|
|
1118
1118
|
l.current = l.current ?? (r == null ? void 0 : r.createDecorationsCollection([])) ?? null, N(() => {
|
|
1119
1119
|
let d;
|
|
1120
|
-
const
|
|
1120
|
+
const g = setTimeout(() => {
|
|
1121
1121
|
if (!t || !r)
|
|
1122
1122
|
return;
|
|
1123
1123
|
const f = (y) => {
|
|
1124
|
-
var
|
|
1125
|
-
if ((
|
|
1124
|
+
var b, $, T, L;
|
|
1125
|
+
if (($ = (b = y.target) == null ? void 0 : b.element) != null && $.classList.contains("CodeEditor_HighlightedGlyphMargin")) {
|
|
1126
1126
|
i == null || i((T = y.target) == null ? void 0 : T.element);
|
|
1127
1127
|
return;
|
|
1128
1128
|
}
|
|
1129
|
-
const
|
|
1130
|
-
if (
|
|
1131
|
-
n == null || n(void 0), i == null || i(void 0),
|
|
1129
|
+
const j = _r((L = y.target) == null ? void 0 : L.element);
|
|
1130
|
+
if (!j) {
|
|
1131
|
+
n == null || n(void 0), i == null || i(void 0), be(r, l.current, void 0);
|
|
1132
1132
|
return;
|
|
1133
1133
|
}
|
|
1134
|
-
u.current = !0, a.current =
|
|
1134
|
+
u.current = !0, a.current = j, n == null || n(j), be(r, l.current, j, !1), i == null || i(void 0);
|
|
1135
1135
|
};
|
|
1136
1136
|
d = r.onMouseDown(f);
|
|
1137
1137
|
}, 100);
|
|
1138
1138
|
return () => {
|
|
1139
|
-
clearTimeout(
|
|
1139
|
+
clearTimeout(g), d == null || d.dispose();
|
|
1140
1140
|
};
|
|
1141
1141
|
}, [u, o, n, t, r, i, l]), N(() => {
|
|
1142
|
-
r && a.current !== o &&
|
|
1142
|
+
r && a.current !== o && be(r, l.current, o, !0);
|
|
1143
1143
|
}, [r, o, l]);
|
|
1144
1144
|
}
|
|
1145
|
-
function
|
|
1145
|
+
function be(e, t, r, n) {
|
|
1146
1146
|
if (!r) {
|
|
1147
1147
|
t == null || t.set([]);
|
|
1148
1148
|
return;
|
|
@@ -1167,7 +1167,7 @@ function _r(e) {
|
|
|
1167
1167
|
if (!isNaN(r))
|
|
1168
1168
|
return r;
|
|
1169
1169
|
}
|
|
1170
|
-
const
|
|
1170
|
+
const kr = `.CodeEditor_HighlightedLine {
|
|
1171
1171
|
opacity: 0.1;
|
|
1172
1172
|
background-color: var(--cn-yellow-300, orange) !important;
|
|
1173
1173
|
}
|
|
@@ -1191,8 +1191,8 @@ const Vr = `.CodeEditor_HighlightedLine {
|
|
|
1191
1191
|
padding: 7px 3px;
|
|
1192
1192
|
}
|
|
1193
1193
|
`;
|
|
1194
|
-
|
|
1195
|
-
const
|
|
1194
|
+
B.config({ monaco: F });
|
|
1195
|
+
const Vr = {
|
|
1196
1196
|
...ae
|
|
1197
1197
|
};
|
|
1198
1198
|
function nn({
|
|
@@ -1206,72 +1206,73 @@ function nn({
|
|
|
1206
1206
|
selectedLine: u,
|
|
1207
1207
|
onSelectedLineChange: l,
|
|
1208
1208
|
onSelectedLineButtonClick: d,
|
|
1209
|
-
highlightKeyword:
|
|
1209
|
+
highlightKeyword: g,
|
|
1210
1210
|
height: f = "75vh",
|
|
1211
|
-
className: y
|
|
1211
|
+
className: y,
|
|
1212
|
+
onMount: j
|
|
1212
1213
|
}) {
|
|
1213
|
-
const
|
|
1214
|
+
const b = v(xe(5));
|
|
1214
1215
|
ie();
|
|
1215
|
-
const [
|
|
1216
|
-
(
|
|
1217
|
-
var
|
|
1218
|
-
|
|
1216
|
+
const [$, T] = R(), L = v(), I = v({ code: "", revisionId: 0 }), D = v(null), k = J(
|
|
1217
|
+
(x, h) => {
|
|
1218
|
+
var s, w, S, p, m, c;
|
|
1219
|
+
D.current = x, L.current = h, x.setValue(e.code), T(x), (S = (w = (s = h.languages.typescript) == null ? void 0 : s.typescriptDefaults) == null ? void 0 : w.setDiagnosticsOptions) == null || S.call(w, {
|
|
1219
1220
|
noSuggestionDiagnostics: !0,
|
|
1220
1221
|
noSyntaxValidation: !0,
|
|
1221
1222
|
noSemanticValidation: !0
|
|
1222
|
-
}), (
|
|
1223
|
+
}), (c = (m = (p = h.languages.typescript) == null ? void 0 : p.javascriptDefaults) == null ? void 0 : m.setDiagnosticsOptions) == null || c.call(m, {
|
|
1223
1224
|
noSuggestionDiagnostics: !0,
|
|
1224
1225
|
noSyntaxValidation: !0,
|
|
1225
1226
|
noSemanticValidation: !0
|
|
1226
|
-
});
|
|
1227
|
+
}), j == null || j(x, h);
|
|
1227
1228
|
},
|
|
1228
|
-
[e.code]
|
|
1229
|
+
[e.code, j]
|
|
1229
1230
|
);
|
|
1230
1231
|
N(() => {
|
|
1231
|
-
var
|
|
1232
|
-
if (
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1232
|
+
var x, h;
|
|
1233
|
+
if (D.current && (!e.revisionId || e.revisionId > Number((x = I.current) == null ? void 0 : x.revisionId))) {
|
|
1234
|
+
const s = D.current.getModel();
|
|
1235
|
+
s && (o != null && o.readOnly ? (h = D.current) == null || h.setValue(e.code) : (D.current.pushUndoStop(), D.current.executeEdits("edit", [
|
|
1235
1236
|
{
|
|
1236
|
-
range:
|
|
1237
|
+
range: s.getFullModelRange(),
|
|
1237
1238
|
text: e.code
|
|
1238
1239
|
}
|
|
1239
|
-
]),
|
|
1240
|
+
]), D.current.pushUndoStop()));
|
|
1240
1241
|
}
|
|
1241
|
-
}, [e, o == null ? void 0 : o.readOnly,
|
|
1242
|
-
const { theme:
|
|
1242
|
+
}, [e, o == null ? void 0 : o.readOnly, D]);
|
|
1243
|
+
const { theme: C } = ce({ monacoRef: L, themeConfig: n, editor: $, theme: i });
|
|
1243
1244
|
Dr({
|
|
1244
1245
|
enable: a,
|
|
1245
|
-
editor:
|
|
1246
|
+
editor: $,
|
|
1246
1247
|
selectedLine: u,
|
|
1247
1248
|
onSelectedLineChange: l,
|
|
1248
1249
|
onSelectedLineButtonClick: d
|
|
1249
|
-
}), Tr({ editor:
|
|
1250
|
-
const
|
|
1251
|
-
...
|
|
1250
|
+
}), Tr({ editor: $, keyword: g });
|
|
1251
|
+
const M = V(() => ({
|
|
1252
|
+
...Vr,
|
|
1252
1253
|
...o || {}
|
|
1253
1254
|
// TODO: this will be used in the future
|
|
1254
1255
|
// ...(enableLinesSelection ? { glyphMargin: true } : {})
|
|
1255
|
-
}), [o]),
|
|
1256
|
+
}), [o]), E = V(() => `.monaco-editor-${b.current} .margin-view-overlays .line-numbers { cursor: pointer !important; } ${kr}`, []);
|
|
1256
1257
|
return /* @__PURE__ */ A.jsxs(A.Fragment, { children: [
|
|
1257
|
-
a && /* @__PURE__ */ A.jsx("style", { dangerouslySetInnerHTML: { __html:
|
|
1258
|
+
a && /* @__PURE__ */ A.jsx("style", { dangerouslySetInnerHTML: { __html: E } }),
|
|
1258
1259
|
/* @__PURE__ */ A.jsx(
|
|
1259
|
-
|
|
1260
|
+
pe,
|
|
1260
1261
|
{
|
|
1261
|
-
className: `monaco-editor-${
|
|
1262
|
+
className: `monaco-editor-${b.current} ${y}`,
|
|
1262
1263
|
height: f,
|
|
1263
|
-
onChange: (
|
|
1264
|
-
I.current = { code:
|
|
1264
|
+
onChange: (x, h) => {
|
|
1265
|
+
I.current = { code: x ?? "", revisionId: h.versionId }, t == null || t({ ...I.current }, h);
|
|
1265
1266
|
},
|
|
1266
1267
|
language: r,
|
|
1267
|
-
theme:
|
|
1268
|
-
options:
|
|
1269
|
-
onMount:
|
|
1268
|
+
theme: C,
|
|
1269
|
+
options: M,
|
|
1270
|
+
onMount: k
|
|
1270
1271
|
}
|
|
1271
1272
|
)
|
|
1272
1273
|
] });
|
|
1273
1274
|
}
|
|
1274
|
-
|
|
1275
|
+
B.config({ monaco: F });
|
|
1275
1276
|
const Ar = {
|
|
1276
1277
|
...ae,
|
|
1277
1278
|
codeLens: !1,
|
|
@@ -1291,13 +1292,13 @@ function on({
|
|
|
1291
1292
|
height: a = "75vh"
|
|
1292
1293
|
}) {
|
|
1293
1294
|
ie();
|
|
1294
|
-
const [u, l] = R(), d = v(), { theme:
|
|
1295
|
+
const [u, l] = R(), d = v(), { theme: g } = ce({ monacoRef: d, themeConfig: n, editor: u, theme: i }), f = V(() => ({ ...Ar, ...o || {} }), [o]);
|
|
1295
1296
|
return /* @__PURE__ */ A.jsx(A.Fragment, { children: /* @__PURE__ */ A.jsx(
|
|
1296
1297
|
gr,
|
|
1297
1298
|
{
|
|
1298
1299
|
className: "overflow-hidden rounded-b-cn-3 border-x border-b",
|
|
1299
1300
|
language: r,
|
|
1300
|
-
theme:
|
|
1301
|
+
theme: g,
|
|
1301
1302
|
original: e,
|
|
1302
1303
|
modified: t,
|
|
1303
1304
|
height: a,
|
|
@@ -1306,39 +1307,39 @@ function on({
|
|
|
1306
1307
|
}
|
|
1307
1308
|
) });
|
|
1308
1309
|
}
|
|
1309
|
-
var
|
|
1310
|
+
var Ge = /* @__PURE__ */ ((e) => (e.ContainsPath = "ContainsPath", e))(Ge || {});
|
|
1310
1311
|
function Hr(e) {
|
|
1311
1312
|
const { pathSymbolMap: t, inlineActions: r = [], commandId: n } = e, o = Object.fromEntries(t.entries()), i = [];
|
|
1312
1313
|
return r == null || r.forEach((a) => {
|
|
1313
1314
|
const u = a.actions;
|
|
1314
1315
|
a.selectors.forEach((d) => {
|
|
1315
1316
|
switch (d.type) {
|
|
1316
|
-
case
|
|
1317
|
-
d.paths.forEach((
|
|
1318
|
-
let y = Object.keys(o).map((
|
|
1319
|
-
fullPath:
|
|
1320
|
-
path:
|
|
1321
|
-
symbol: o[
|
|
1322
|
-
})).filter((
|
|
1323
|
-
y = y.map((
|
|
1324
|
-
...
|
|
1325
|
-
path:
|
|
1326
|
-
})), y.filter((
|
|
1327
|
-
const
|
|
1328
|
-
u.forEach((
|
|
1329
|
-
const
|
|
1330
|
-
range:
|
|
1317
|
+
case Ge.ContainsPath: {
|
|
1318
|
+
d.paths.forEach((g) => {
|
|
1319
|
+
let y = Object.keys(o).map((b) => ({
|
|
1320
|
+
fullPath: b,
|
|
1321
|
+
path: b,
|
|
1322
|
+
symbol: o[b]
|
|
1323
|
+
})).filter((b) => b.path.startsWith(d.basePath));
|
|
1324
|
+
y = y.map((b) => ({
|
|
1325
|
+
...b,
|
|
1326
|
+
path: b.path.substring(d.basePath.length)
|
|
1327
|
+
})), y.filter((b) => g.test(b.path)).forEach((b) => {
|
|
1328
|
+
const $ = b.fullPath, T = b.symbol, L = T.range;
|
|
1329
|
+
u.forEach((I) => {
|
|
1330
|
+
const D = {
|
|
1331
|
+
range: L,
|
|
1331
1332
|
symbols: [T],
|
|
1332
|
-
onClick:
|
|
1333
|
-
data:
|
|
1334
|
-
path:
|
|
1333
|
+
onClick: I.onClick,
|
|
1334
|
+
data: I.data,
|
|
1335
|
+
path: $
|
|
1335
1336
|
};
|
|
1336
1337
|
i.push({
|
|
1337
|
-
range:
|
|
1338
|
+
range: L,
|
|
1338
1339
|
command: {
|
|
1339
1340
|
id: n,
|
|
1340
|
-
title:
|
|
1341
|
-
arguments: [
|
|
1341
|
+
title: I.title,
|
|
1342
|
+
arguments: [D]
|
|
1342
1343
|
}
|
|
1343
1344
|
});
|
|
1344
1345
|
});
|
|
@@ -1358,28 +1359,28 @@ const te = class te {
|
|
|
1358
1359
|
return te.data;
|
|
1359
1360
|
}
|
|
1360
1361
|
};
|
|
1361
|
-
|
|
1362
|
-
let
|
|
1363
|
-
async function
|
|
1364
|
-
const t =
|
|
1362
|
+
Ce(te, "data", {});
|
|
1363
|
+
let Oe = te;
|
|
1364
|
+
async function Ze(e) {
|
|
1365
|
+
const t = Oe.get(), { documentSymbolProvider: r } = t.StandaloneServices.get(t.ILanguageFeaturesService);
|
|
1365
1366
|
return await t.OutlineModel.create(r, e);
|
|
1366
1367
|
}
|
|
1367
|
-
function
|
|
1368
|
+
function Je(e) {
|
|
1368
1369
|
const t = /* @__PURE__ */ new Map();
|
|
1369
|
-
return
|
|
1370
|
+
return je({
|
|
1370
1371
|
pathSymbolMap: t,
|
|
1371
1372
|
parentPath: "",
|
|
1372
1373
|
children: e.children,
|
|
1373
|
-
parentKind:
|
|
1374
|
+
parentKind: we.SymbolKind.Module
|
|
1374
1375
|
}), t;
|
|
1375
1376
|
}
|
|
1376
|
-
function
|
|
1377
|
+
function je(e) {
|
|
1377
1378
|
switch (e.parentKind) {
|
|
1378
|
-
case
|
|
1379
|
+
case we.SymbolKind.Module: {
|
|
1379
1380
|
Rr(e);
|
|
1380
1381
|
break;
|
|
1381
1382
|
}
|
|
1382
|
-
case
|
|
1383
|
+
case we.SymbolKind.Array: {
|
|
1383
1384
|
Ur(e);
|
|
1384
1385
|
break;
|
|
1385
1386
|
}
|
|
@@ -1391,7 +1392,7 @@ function Rr(e) {
|
|
|
1391
1392
|
e.children.forEach((t) => {
|
|
1392
1393
|
var n;
|
|
1393
1394
|
let r = e.parentPath;
|
|
1394
|
-
t.symbol && (r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(r, t.symbol)),
|
|
1395
|
+
t.symbol && (r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(r, t.symbol)), je({
|
|
1395
1396
|
pathSymbolMap: e.pathSymbolMap,
|
|
1396
1397
|
parentPath: r,
|
|
1397
1398
|
children: t.children,
|
|
@@ -1403,7 +1404,7 @@ function Ur(e) {
|
|
|
1403
1404
|
let t = 0;
|
|
1404
1405
|
e.children.forEach((r) => {
|
|
1405
1406
|
const n = e.parentPath ? `${e.parentPath}.${t}` : `${t}`;
|
|
1406
|
-
e.pathSymbolMap.set(n, r.symbol), t += 1,
|
|
1407
|
+
e.pathSymbolMap.set(n, r.symbol), t += 1, je({
|
|
1407
1408
|
pathSymbolMap: e.pathSymbolMap,
|
|
1408
1409
|
parentPath: n,
|
|
1409
1410
|
children: r.children,
|
|
@@ -1424,12 +1425,12 @@ function Fr({
|
|
|
1424
1425
|
}) {
|
|
1425
1426
|
N(() => F.languages.registerCodeLensProvider("yaml", {
|
|
1426
1427
|
provideCodeLenses: async (n) => {
|
|
1427
|
-
var l, d,
|
|
1428
|
-
if (((l = n == null ? void 0 : n.uri) == null ? void 0 : l.toString()) !== ((f = (
|
|
1428
|
+
var l, d, g, f, y;
|
|
1429
|
+
if (((l = n == null ? void 0 : n.uri) == null ? void 0 : l.toString()) !== ((f = (g = (d = e.current) == null ? void 0 : d.getModel()) == null ? void 0 : g.uri) == null ? void 0 : f.toString()))
|
|
1429
1430
|
return { lenses: [], dispose: () => {
|
|
1430
1431
|
} };
|
|
1431
|
-
const o = await
|
|
1432
|
-
|
|
1432
|
+
const o = await Ze(n), i = Je(o), a = (y = e == null ? void 0 : e.current) == null ? void 0 : y.addCommand(0, (j, { onClick: b, path: $, range: T, data: L }) => {
|
|
1433
|
+
b({ path: $, range: T, data: L });
|
|
1433
1434
|
});
|
|
1434
1435
|
return a ? {
|
|
1435
1436
|
lenses: Hr({ pathSymbolMap: i, inlineActions: t, commandId: a }),
|
|
@@ -1440,14 +1441,14 @@ function Fr({
|
|
|
1440
1441
|
}).dispose, [t, e]);
|
|
1441
1442
|
}
|
|
1442
1443
|
const Wr = ({ editorRef: e, selection: t }) => {
|
|
1443
|
-
const [r, n] = R(), o =
|
|
1444
|
+
const [r, n] = R(), o = V(
|
|
1444
1445
|
() => async (i, a, u) => {
|
|
1445
|
-
var y,
|
|
1446
|
+
var y, j, b;
|
|
1446
1447
|
const l = (y = e == null ? void 0 : e.current) == null ? void 0 : y.getModel();
|
|
1447
1448
|
if (!l || !a)
|
|
1448
1449
|
return n(void 0);
|
|
1449
|
-
const d = await
|
|
1450
|
-
f && (n(f), u && ((
|
|
1450
|
+
const d = await Ze(l), f = (j = Je(d).get(a)) == null ? void 0 : j.range;
|
|
1451
|
+
f && (n(f), u && ((b = e == null ? void 0 : e.current) == null || b.revealLineInCenter(f.startLineNumber)));
|
|
1451
1452
|
},
|
|
1452
1453
|
[]
|
|
1453
1454
|
);
|
|
@@ -1479,7 +1480,7 @@ const Wr = ({ editorRef: e, selection: t }) => {
|
|
|
1479
1480
|
]);
|
|
1480
1481
|
return () => i == null ? void 0 : i.clear();
|
|
1481
1482
|
}, [r, e, t == null ? void 0 : t.className]);
|
|
1482
|
-
},
|
|
1483
|
+
}, Qe = nt({
|
|
1483
1484
|
markers: [],
|
|
1484
1485
|
setMarkers: () => {
|
|
1485
1486
|
},
|
|
@@ -1499,7 +1500,7 @@ function an({
|
|
|
1499
1500
|
[n]
|
|
1500
1501
|
);
|
|
1501
1502
|
return /* @__PURE__ */ A.jsx(
|
|
1502
|
-
|
|
1503
|
+
Qe.Provider,
|
|
1503
1504
|
{
|
|
1504
1505
|
value: {
|
|
1505
1506
|
markers: t,
|
|
@@ -1512,11 +1513,11 @@ function an({
|
|
|
1512
1513
|
}
|
|
1513
1514
|
);
|
|
1514
1515
|
}
|
|
1515
|
-
function
|
|
1516
|
-
return ot(
|
|
1516
|
+
function Xe() {
|
|
1517
|
+
return ot(Qe);
|
|
1517
1518
|
}
|
|
1518
1519
|
const qr = ({ monacoRef: e, editorRef: t, instanceId: r }) => {
|
|
1519
|
-
const { setMarkers: n } =
|
|
1520
|
+
const { setMarkers: n } = Xe();
|
|
1520
1521
|
N(() => {
|
|
1521
1522
|
let o;
|
|
1522
1523
|
const i = setTimeout(() => {
|
|
@@ -1527,8 +1528,8 @@ const qr = ({ monacoRef: e, editorRef: t, instanceId: r }) => {
|
|
|
1527
1528
|
const d = (f = t.current) == null ? void 0 : f.getModel();
|
|
1528
1529
|
if (!d)
|
|
1529
1530
|
return;
|
|
1530
|
-
const
|
|
1531
|
-
if (l.some((y) => y.toString() ===
|
|
1531
|
+
const g = d.uri.toString();
|
|
1532
|
+
if (l.some((y) => y.toString() === g)) {
|
|
1532
1533
|
const y = F.editor.getModelMarkers({ resource: d.uri });
|
|
1533
1534
|
n(y);
|
|
1534
1535
|
}
|
|
@@ -1541,15 +1542,15 @@ const qr = ({ monacoRef: e, editorRef: t, instanceId: r }) => {
|
|
|
1541
1542
|
};
|
|
1542
1543
|
function Br(e) {
|
|
1543
1544
|
var n, o;
|
|
1544
|
-
const t = ((o = (n =
|
|
1545
|
-
r !== -1 ? t[r] = e : t.push(e),
|
|
1545
|
+
const t = ((o = (n = Se) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? [], r = t.findIndex((i) => i.fileMatch[0] === e.fileMatch[0]);
|
|
1546
|
+
r !== -1 ? t[r] = e : t.push(e), et(t);
|
|
1546
1547
|
}
|
|
1547
1548
|
function Kr(e) {
|
|
1548
1549
|
var n, o;
|
|
1549
|
-
const r = (((o = (n =
|
|
1550
|
-
|
|
1550
|
+
const r = (((o = (n = Se) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? []).filter((i) => i.fileMatch[0] !== Pe(e));
|
|
1551
|
+
et(r);
|
|
1551
1552
|
}
|
|
1552
|
-
function
|
|
1553
|
+
function et(e) {
|
|
1553
1554
|
const t = {
|
|
1554
1555
|
hover: !0,
|
|
1555
1556
|
completion: !0,
|
|
@@ -1557,21 +1558,21 @@ function Xe(e) {
|
|
|
1557
1558
|
validate: !0,
|
|
1558
1559
|
schemas: e
|
|
1559
1560
|
};
|
|
1560
|
-
|
|
1561
|
+
Se.setDiagnosticsOptions({ ...t });
|
|
1561
1562
|
}
|
|
1562
|
-
const
|
|
1563
|
+
const Pe = (e) => it.parse(`file://${e}`).toString(), Yr = (e) => {
|
|
1563
1564
|
const { schemaConfig: t, instanceId: r } = e;
|
|
1564
1565
|
N(() => {
|
|
1565
1566
|
if (t != null && t.schema)
|
|
1566
1567
|
return Br({
|
|
1567
|
-
fileMatch: [
|
|
1568
|
+
fileMatch: [Pe(r.toString())],
|
|
1568
1569
|
...t
|
|
1569
1570
|
}), () => {
|
|
1570
1571
|
Kr(r);
|
|
1571
1572
|
};
|
|
1572
1573
|
}, [t == null ? void 0 : t.schema, r]);
|
|
1573
1574
|
};
|
|
1574
|
-
|
|
1575
|
+
B.config({ monaco: F });
|
|
1575
1576
|
const Gr = {
|
|
1576
1577
|
...ae,
|
|
1577
1578
|
folding: !0
|
|
@@ -1585,74 +1586,76 @@ const Gr = {
|
|
|
1585
1586
|
selection: u,
|
|
1586
1587
|
theme: l,
|
|
1587
1588
|
options: d,
|
|
1588
|
-
animateOnUpdate:
|
|
1589
|
+
animateOnUpdate: g = !1,
|
|
1589
1590
|
onAnimateEnd: f,
|
|
1590
1591
|
instanceId: y,
|
|
1591
|
-
height:
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1592
|
+
height: j,
|
|
1593
|
+
className: b
|
|
1594
|
+
} = t, $ = ie(), [T] = R(y ?? `yaml-editor-${Math.random()}`), { editor: L, setEditor: I } = Xe(), D = v(null), k = v(), C = v({ yaml: "", revisionId: 0 }), M = v(null), E = v(null), x = J(
|
|
1595
|
+
(p) => {
|
|
1596
|
+
var O, H, q;
|
|
1597
|
+
const m = p.split(`
|
|
1598
|
+
`), c = (O = M.current) == null ? void 0 : O.getModel();
|
|
1599
|
+
if (c) {
|
|
1600
|
+
(H = M.current) == null || H.pushUndoStop(), c.setValue("");
|
|
1599
1601
|
let W = 0;
|
|
1600
|
-
|
|
1601
|
-
var
|
|
1602
|
-
W <
|
|
1602
|
+
E.current = window.setInterval(() => {
|
|
1603
|
+
var se;
|
|
1604
|
+
W < m.length ? ($ && ((se = M.current) == null || se.executeEdits("addLine", [
|
|
1603
1605
|
{
|
|
1604
|
-
range: new
|
|
1605
|
-
text:
|
|
1606
|
+
range: new $.Range(W + 1, 1, W + 1, 1),
|
|
1607
|
+
text: m[W] + `
|
|
1606
1608
|
`
|
|
1607
1609
|
}
|
|
1608
|
-
])), W++) :
|
|
1609
|
-
}, 100), (
|
|
1610
|
+
])), W++) : E.current && (clearInterval(E.current), f == null || f());
|
|
1611
|
+
}, 100), (q = M.current) == null || q.pushUndoStop();
|
|
1610
1612
|
}
|
|
1611
1613
|
},
|
|
1612
|
-
[
|
|
1614
|
+
[$]
|
|
1613
1615
|
);
|
|
1614
1616
|
N(() => () => {
|
|
1615
|
-
|
|
1617
|
+
E.current && clearInterval(E.current);
|
|
1616
1618
|
}, []);
|
|
1617
|
-
function
|
|
1618
|
-
|
|
1619
|
-
var
|
|
1620
|
-
(
|
|
1619
|
+
function h(p, m) {
|
|
1620
|
+
M.current = p, k.current = m, p.setValue(r.yaml), I(p), setTimeout(() => {
|
|
1621
|
+
var c;
|
|
1622
|
+
(c = D.current) != null && c.style && (D.current.style.opacity = "1");
|
|
1621
1623
|
}, 50);
|
|
1622
1624
|
}
|
|
1623
1625
|
N(() => {
|
|
1624
|
-
var
|
|
1625
|
-
if (
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1626
|
+
var p;
|
|
1627
|
+
if (M.current && (!r.revisionId || r.revisionId > Number((p = C.current) == null ? void 0 : p.revisionId))) {
|
|
1628
|
+
const m = M.current.getModel();
|
|
1629
|
+
m && (M.current.executeEdits("edit", [
|
|
1628
1630
|
{
|
|
1629
|
-
range:
|
|
1630
|
-
text:
|
|
1631
|
+
range: m.getFullModelRange(),
|
|
1632
|
+
text: g ? "" : r.yaml
|
|
1631
1633
|
}
|
|
1632
|
-
]),
|
|
1634
|
+
]), g && x(r.yaml));
|
|
1633
1635
|
}
|
|
1634
|
-
}, [
|
|
1635
|
-
const { theme:
|
|
1636
|
-
qr({ monacoRef:
|
|
1637
|
-
const
|
|
1636
|
+
}, [x, r, g]), Yr({ schemaConfig: n, instanceId: T }), Fr({ editorRef: M, inlineActions: o });
|
|
1637
|
+
const { theme: s } = ce({ monacoRef: k, themeConfig: i, editor: L, theme: l });
|
|
1638
|
+
qr({ monacoRef: k, editorRef: M, instanceId: T }), Wr({ editorRef: M, selection: u });
|
|
1639
|
+
const w = V(() => Pe(T), []), S = V(
|
|
1638
1640
|
() => ({
|
|
1639
1641
|
...Gr,
|
|
1640
1642
|
...d
|
|
1641
1643
|
}),
|
|
1642
1644
|
[d]
|
|
1643
1645
|
);
|
|
1644
|
-
return /* @__PURE__ */ A.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref:
|
|
1645
|
-
|
|
1646
|
+
return /* @__PURE__ */ A.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref: D, children: /* @__PURE__ */ A.jsx(
|
|
1647
|
+
pe,
|
|
1646
1648
|
{
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
+
className: b,
|
|
1650
|
+
onChange: (p, m) => {
|
|
1651
|
+
C.current = { yaml: p ?? "", revisionId: m.versionId }, a({ ...C.current }, m);
|
|
1649
1652
|
},
|
|
1650
1653
|
language: "yaml",
|
|
1651
|
-
theme:
|
|
1652
|
-
options:
|
|
1653
|
-
path:
|
|
1654
|
-
onMount:
|
|
1655
|
-
height:
|
|
1654
|
+
theme: s,
|
|
1655
|
+
options: S,
|
|
1656
|
+
path: w,
|
|
1657
|
+
onMount: h,
|
|
1658
|
+
height: j
|
|
1656
1659
|
}
|
|
1657
1660
|
) });
|
|
1658
1661
|
};
|
|
@@ -1661,11 +1664,11 @@ export {
|
|
|
1661
1664
|
rn as BlameEditorV2,
|
|
1662
1665
|
on as CodeDiffEditor,
|
|
1663
1666
|
nn as CodeEditor,
|
|
1664
|
-
|
|
1665
|
-
|
|
1667
|
+
Oe as MonacoGlobals,
|
|
1668
|
+
Ge as SelectorType,
|
|
1666
1669
|
cn as YamlEditor,
|
|
1667
|
-
|
|
1670
|
+
Qe as YamlEditorContext,
|
|
1668
1671
|
an as YamlEditorContextProvider,
|
|
1669
|
-
|
|
1672
|
+
Xe as useYamlEditorContext
|
|
1670
1673
|
};
|
|
1671
1674
|
//# sourceMappingURL=index.js.map
|