@harnessio/yaml-editor 0.22.0 → 0.22.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/components/CodeEditor.d.ts +3 -2
- package/dist/index.cjs +23 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +303 -302
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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
3
|
var Pe = (e, t, r) => (rt(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
-
import Y, { memo as
|
|
4
|
+
import Y, { memo as Oe, useState as R, useRef as y, useCallback as J, useEffect as N, useMemo as V, useLayoutEffect as ke, createContext as nt, useContext as ot } from "react";
|
|
5
5
|
import * as F from "monaco-editor";
|
|
6
6
|
import { languages as be, 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 Me } from "monaco-yaml";
|
|
9
|
+
var Ve = { exports: {} }, ne = {};
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
@@ -68,8 +68,8 @@ function He(e, t, r) {
|
|
|
68
68
|
}
|
|
69
69
|
ne.jsx = He;
|
|
70
70
|
ne.jsxs = He;
|
|
71
|
-
|
|
72
|
-
var A =
|
|
71
|
+
Ve.exports = ne;
|
|
72
|
+
var A = Ve.exports;
|
|
73
73
|
function gt(e, t, r) {
|
|
74
74
|
return t in e ? Object.defineProperty(e, t, {
|
|
75
75
|
value: r,
|
|
@@ -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,7 +144,7 @@ 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
150
|
return Le(e, t);
|
|
@@ -161,7 +161,7 @@ function Le(e, t) {
|
|
|
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
|
}
|
|
@@ -266,10 +266,10 @@ function Tt(e) {
|
|
|
266
266
|
se.initial(e), se.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(se.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
274
|
return se.selector(d), d(r.current);
|
|
275
275
|
}
|
|
@@ -284,13 +284,13 @@ function Dt(e, t) {
|
|
|
284
284
|
function _t(e, t) {
|
|
285
285
|
return e.current = De(De({}, 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: {
|
|
@@ -368,7 +368,7 @@ 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,
|
|
@@ -466,13 +466,13 @@ var ir = or, ar = ir;
|
|
|
466
466
|
function cr({ width: e, height: t, isEditorReady: r, loading: n, _ref: o, className: i, wrapperProps: a }) {
|
|
467
467
|
return Y.createElement("section", { style: { ...ge.wrapper, width: e, height: t }, ...a }, !r && Y.createElement(ar, null, n), Y.createElement("div", { ref: o, style: { ...ge.fullWidth, ...!r && ge.hide }, className: i }));
|
|
468
468
|
}
|
|
469
|
-
var sr = cr, We =
|
|
469
|
+
var sr = cr, We = Oe(sr);
|
|
470
470
|
function ur(e) {
|
|
471
471
|
N(e, []);
|
|
472
472
|
}
|
|
473
473
|
var Se = ur;
|
|
474
474
|
function lr(e, t, r = !0) {
|
|
475
|
-
let n =
|
|
475
|
+
let n = y(!0);
|
|
476
476
|
N(n.current || !r ? () => {
|
|
477
477
|
n.current = !1;
|
|
478
478
|
} : e, t);
|
|
@@ -492,61 +492,61 @@ function fr(e, t, r, n) {
|
|
|
492
492
|
function qe(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 [
|
|
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: b = "100%", width: x = "100%", className: h, wrapperProps: I = {}, beforeMount: D = ee, onMount: L = ee }) {
|
|
496
|
+
let [j, T] = R(!1), [k, M] = R(!0), C = y(null), $ = y(null), E = y(null), v = y(L), s = y(D), w = y(!1);
|
|
497
497
|
Se(() => {
|
|
498
498
|
let c = q.init();
|
|
499
|
-
return c.then((
|
|
499
|
+
return c.then((S) => ($.current = S) && M(!1)).catch((S) => (S == null ? void 0 : S.type) !== "cancelation" && console.error("Monaco initialization: error:", S)), () => C.current ? O() : c.cancel();
|
|
500
500
|
}), z(() => {
|
|
501
|
-
if (C.current &&
|
|
502
|
-
let c = C.current.getOriginalEditor(),
|
|
503
|
-
|
|
501
|
+
if (C.current && $.current) {
|
|
502
|
+
let c = C.current.getOriginalEditor(), S = Z($.current, e || "", n || r || "text", i || "");
|
|
503
|
+
S !== c.getModel() && c.setModel(S);
|
|
504
504
|
}
|
|
505
|
-
}, [i],
|
|
506
|
-
if (C.current &&
|
|
507
|
-
let c = C.current.getModifiedEditor(),
|
|
508
|
-
|
|
505
|
+
}, [i], j), z(() => {
|
|
506
|
+
if (C.current && $.current) {
|
|
507
|
+
let c = C.current.getModifiedEditor(), S = Z($.current, t || "", o || r || "text", a || "");
|
|
508
|
+
S !== c.getModel() && c.setModel(S);
|
|
509
509
|
}
|
|
510
|
-
}, [a],
|
|
510
|
+
}, [a], j), z(() => {
|
|
511
511
|
let c = C.current.getModifiedEditor();
|
|
512
|
-
c.getOption(
|
|
513
|
-
}, [t],
|
|
514
|
-
var c,
|
|
515
|
-
(
|
|
516
|
-
}, [e],
|
|
517
|
-
let { original: c, modified:
|
|
518
|
-
|
|
519
|
-
}, [r, n, o],
|
|
512
|
+
c.getOption($.current.editor.EditorOption.readOnly) ? c.setValue(t || "") : t !== c.getValue() && (c.executeEdits("", [{ range: c.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), c.pushUndoStop());
|
|
513
|
+
}, [t], j), z(() => {
|
|
514
|
+
var c, S;
|
|
515
|
+
(S = (c = C.current) == null ? void 0 : c.getModel()) == null || S.original.setValue(e || "");
|
|
516
|
+
}, [e], j), z(() => {
|
|
517
|
+
let { original: c, modified: S } = C.current.getModel();
|
|
518
|
+
$.current.editor.setModelLanguage(c, n || r || "text"), $.current.editor.setModelLanguage(S, o || r || "text");
|
|
519
|
+
}, [r, n, o], j), z(() => {
|
|
520
520
|
var c;
|
|
521
|
-
(c =
|
|
522
|
-
}, [d],
|
|
521
|
+
(c = $.current) == null || c.editor.setTheme(d);
|
|
522
|
+
}, [d], j), z(() => {
|
|
523
523
|
var c;
|
|
524
524
|
(c = C.current) == null || c.updateOptions(f);
|
|
525
|
-
}, [f],
|
|
525
|
+
}, [f], j);
|
|
526
526
|
let m = J(() => {
|
|
527
527
|
var H;
|
|
528
|
-
if (
|
|
528
|
+
if (!$.current)
|
|
529
529
|
return;
|
|
530
|
-
s.current(
|
|
531
|
-
let c = Z(
|
|
532
|
-
(H = C.current) == null || H.setModel({ original: c, modified:
|
|
530
|
+
s.current($.current);
|
|
531
|
+
let c = Z($.current, e || "", n || r || "text", i || ""), S = Z($.current, t || "", o || r || "text", a || "");
|
|
532
|
+
(H = C.current) == null || H.setModel({ original: c, modified: S });
|
|
533
533
|
}, [r, t, o, e, n, i, a]), p = J(() => {
|
|
534
534
|
var c;
|
|
535
|
-
!
|
|
535
|
+
!w.current && E.current && (C.current = $.current.editor.createDiffEditor(E.current, { automaticLayout: !0, ...f }), m(), (c = $.current) == null || c.editor.setTheme(d), T(!0), w.current = !0);
|
|
536
536
|
}, [f, d, m]);
|
|
537
537
|
N(() => {
|
|
538
|
-
|
|
539
|
-
}, [
|
|
540
|
-
!
|
|
541
|
-
}, [
|
|
542
|
-
function
|
|
543
|
-
var
|
|
544
|
-
let c = (
|
|
538
|
+
j && v.current(C.current, $.current);
|
|
539
|
+
}, [j]), N(() => {
|
|
540
|
+
!k && !j && p();
|
|
541
|
+
}, [k, j, p]);
|
|
542
|
+
function O() {
|
|
543
|
+
var S, H, W, B;
|
|
544
|
+
let c = (S = C.current) == null ? void 0 : S.getModel();
|
|
545
545
|
u || ((H = c == null ? void 0 : c.original) == null || H.dispose()), l || ((W = c == null ? void 0 : c.modified) == null || W.dispose()), (B = C.current) == null || B.dispose();
|
|
546
546
|
}
|
|
547
|
-
return Y.createElement(We, { width:
|
|
547
|
+
return Y.createElement(We, { width: x, height: b, isEditorReady: j, loading: g, _ref: E, className: h, wrapperProps: I });
|
|
548
548
|
}
|
|
549
|
-
var mr = pr, gr =
|
|
549
|
+
var mr = pr, gr = Oe(mr);
|
|
550
550
|
function hr() {
|
|
551
551
|
let [e, t] = R(q.__getMonacoInstance());
|
|
552
552
|
return Se(() => {
|
|
@@ -558,62 +558,62 @@ function hr() {
|
|
|
558
558
|
}
|
|
559
559
|
var ie = hr;
|
|
560
560
|
function vr(e) {
|
|
561
|
-
let t =
|
|
561
|
+
let t = y();
|
|
562
562
|
return N(() => {
|
|
563
563
|
t.current = e;
|
|
564
564
|
}, [e]), t.current;
|
|
565
565
|
}
|
|
566
566
|
var yr = vr, ue = /* @__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:
|
|
568
|
-
let [
|
|
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: b = !1, width: x = "100%", height: h = "100%", className: I, wrapperProps: D = {}, beforeMount: L = ee, onMount: j = ee, onChange: T, onValidate: k = ee }) {
|
|
568
|
+
let [M, C] = R(!1), [$, E] = R(!0), v = y(null), s = y(null), w = y(null), m = y(j), p = y(L), O = y(), c = y(n), S = yr(i), H = y(!1), W = y(!1);
|
|
569
569
|
Se(() => {
|
|
570
570
|
let P = q.init();
|
|
571
|
-
return P.then((
|
|
571
|
+
return P.then((_) => (v.current = _) && E(!1)).catch((_) => (_ == null ? void 0 : _.type) !== "cancelation" && console.error("Monaco initialization: error:", _)), () => s.current ? et() : P.cancel();
|
|
572
572
|
}), z(() => {
|
|
573
|
-
var
|
|
574
|
-
let P = Z(
|
|
575
|
-
P !== ((
|
|
576
|
-
}, [i],
|
|
573
|
+
var _, U, Q, G;
|
|
574
|
+
let P = Z(v.current, e || n || "", t || o || "", i || r || "");
|
|
575
|
+
P !== ((_ = s.current) == null ? void 0 : _.getModel()) && (f && ue.set(S, (U = s.current) == null ? void 0 : U.saveViewState()), (Q = s.current) == null || Q.setModel(P), f && ((G = s.current) == null || G.restoreViewState(ue.get(i))));
|
|
576
|
+
}, [i], M), 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], M), z(() => {
|
|
580
|
+
!s.current || n === void 0 || (s.current.getOption(v.current.editor.EditorOption.readOnly) ? s.current.setValue(n) : n !== s.current.getValue() && (W.current = !0, s.current.executeEdits("", [{ range: s.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), s.current.pushUndoStop(), W.current = !1));
|
|
581
|
+
}, [n], M), z(() => {
|
|
582
|
+
var _, U;
|
|
583
|
+
let P = (_ = s.current) == null ? void 0 : _.getModel();
|
|
584
|
+
P && o && ((U = v.current) == null || U.editor.setModelLanguage(P, o));
|
|
585
|
+
}, [o], M), z(() => {
|
|
586
586
|
var P;
|
|
587
587
|
u !== void 0 && ((P = s.current) == null || P.revealLine(u));
|
|
588
|
-
}, [u],
|
|
588
|
+
}, [u], M), z(() => {
|
|
589
589
|
var P;
|
|
590
|
-
(P =
|
|
591
|
-
}, [a],
|
|
590
|
+
(P = v.current) == null || P.editor.setTheme(a);
|
|
591
|
+
}, [a], M);
|
|
592
592
|
let B = J(() => {
|
|
593
593
|
var P;
|
|
594
|
-
if (!(!
|
|
595
|
-
p.current(
|
|
596
|
-
let
|
|
597
|
-
s.current = (P =
|
|
594
|
+
if (!(!w.current || !v.current) && !H.current) {
|
|
595
|
+
p.current(v.current);
|
|
596
|
+
let _ = i || r, U = Z(v.current, n || e || "", t || o || "", _ || "");
|
|
597
|
+
s.current = (P = v.current) == null ? void 0 : P.editor.create(w.current, { model: U, automaticLayout: !0, ...d }, g), f && s.current.restoreViewState(ue.get(_)), v.current.editor.setTheme(a), u !== void 0 && s.current.revealLine(u), C(!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
|
-
}, [M,
|
|
605
|
-
var P,
|
|
606
|
-
|
|
607
|
-
W.current ||
|
|
601
|
+
M && m.current(s.current, v.current);
|
|
602
|
+
}, [M]), N(() => {
|
|
603
|
+
!$ && !M && B();
|
|
604
|
+
}, [$, M, B]), c.current = n, N(() => {
|
|
605
|
+
var P, _;
|
|
606
|
+
M && T && ((P = O.current) == null || P.dispose(), O.current = (_ = s.current) == null ? void 0 : _.onDidChangeModelContent((U) => {
|
|
607
|
+
W.current || T(s.current.getValue(), U);
|
|
608
608
|
}));
|
|
609
|
-
}, [
|
|
610
|
-
if (
|
|
611
|
-
let P =
|
|
609
|
+
}, [M, T]), N(() => {
|
|
610
|
+
if (M) {
|
|
611
|
+
let P = v.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 = v.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
|
-
}, [
|
|
625
|
+
}, [M, k]);
|
|
626
626
|
function et() {
|
|
627
|
-
var P,
|
|
628
|
-
(P =
|
|
627
|
+
var P, _;
|
|
628
|
+
(P = O.current) == null || P.dispose(), b ? f && ue.set(i, s.current.saveViewState()) : (_ = s.current.getModel()) == null || _.dispose(), s.current.dispose();
|
|
629
629
|
}
|
|
630
|
-
return Y.createElement(We, { width:
|
|
630
|
+
return Y.createElement(We, { width: x, height: h, isEditorReady: M, loading: l, _ref: w, className: I, wrapperProps: D });
|
|
631
631
|
}
|
|
632
|
-
var wr = br,
|
|
632
|
+
var wr = br, Or = Oe(wr), fe = Or;
|
|
633
633
|
const ae = {
|
|
634
634
|
selectOnLineNumbers: !0,
|
|
635
635
|
scrollBeyondLastLine: !1,
|
|
@@ -669,7 +669,7 @@ function Ee(e) {
|
|
|
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) => {
|
|
@@ -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, b, x, h, I, D;
|
|
739
|
+
const a = (g = (d = i == null ? void 0 : i.commitInfo) == null ? void 0 : d.author) == null ? void 0 : g.avatarUrl, u = (b = (f = i == null ? void 0 : i.commitInfo) == null ? void 0 : f.author) == null ? void 0 : b.initials, l = a ? `background: url('${(h = (x = i == null ? void 0 : i.commitInfo) == null ? void 0 : x.author) == null ? void 0 : h.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(((D = (I = i == null ? void 0 : i.commitInfo) == null ? void 0 : I.author) == null ? void 0 : D.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;
|
|
@@ -803,130 +803,130 @@ function tn({
|
|
|
803
803
|
options: l,
|
|
804
804
|
className: d
|
|
805
805
|
}) {
|
|
806
|
-
const
|
|
806
|
+
const g = y(o), f = y(null), b = y(Ee(5));
|
|
807
807
|
ie();
|
|
808
|
-
const [
|
|
808
|
+
const [x, h] = R(), I = y(null), D = y(null);
|
|
809
809
|
N(() => {
|
|
810
|
-
|
|
810
|
+
g.current = o;
|
|
811
811
|
}, [o]);
|
|
812
|
-
function
|
|
813
|
-
const s =
|
|
814
|
-
if (!s || !
|
|
812
|
+
function L() {
|
|
813
|
+
const s = D.current, w = I.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((O, c) => {
|
|
822
|
+
if (c !== g.current.length - 1) {
|
|
823
|
+
const S = document.createElement("div");
|
|
824
|
+
S.style.borderTop = "1px solid var(--cn-border-2)", S.style.marginTop = "9px", S.className = "blame-editor-separator", p.addZone({
|
|
825
|
+
afterLineNumber: O.toLineNumber,
|
|
826
826
|
heightInPx: 20,
|
|
827
|
-
domNode:
|
|
827
|
+
domNode: S
|
|
828
828
|
});
|
|
829
829
|
}
|
|
830
830
|
});
|
|
831
831
|
});
|
|
832
832
|
const m = [];
|
|
833
|
-
|
|
834
|
-
var
|
|
833
|
+
g.current.forEach((p) => {
|
|
834
|
+
var O;
|
|
835
835
|
for (let c = p.fromLineNumber; c <= p.toLineNumber; c++)
|
|
836
836
|
m.push({
|
|
837
|
-
range: new
|
|
837
|
+
range: new w.Range(c, 0, c + 1, 0),
|
|
838
838
|
options: {
|
|
839
839
|
before: {
|
|
840
840
|
content: Ke(
|
|
841
|
-
c === p.fromLineNumber && ((
|
|
841
|
+
c === p.fromLineNumber && ((O = p == null ? void 0 : p.commitInfo) == null ? void 0 : O.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
849
|
}), s.createDecorationsCollection(m);
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
var m, p,
|
|
853
|
-
|
|
851
|
+
function j(s, w) {
|
|
852
|
+
var m, p, O, c, S, H;
|
|
853
|
+
D.current = s, I.current = w, s.setValue(e), h(s), (O = (p = (m = w.languages.typescript) == null ? void 0 : m.typescriptDefaults) == null ? void 0 : p.setDiagnosticsOptions) == null || O.call(p, {
|
|
854
854
|
noSuggestionDiagnostics: !0,
|
|
855
855
|
noSyntaxValidation: !0,
|
|
856
856
|
noSemanticValidation: !0
|
|
857
|
-
}), (H = (
|
|
857
|
+
}), (H = (S = (c = w.languages.typescript) == null ? void 0 : c.javascriptDefaults) == null ? void 0 : S.setDiagnosticsOptions) == null || H.call(S, {
|
|
858
858
|
noSuggestionDiagnostics: !0,
|
|
859
859
|
noSyntaxValidation: !0,
|
|
860
860
|
noSemanticValidation: !0
|
|
861
|
-
}),
|
|
861
|
+
}), L();
|
|
862
862
|
}
|
|
863
863
|
N(() => {
|
|
864
|
-
|
|
864
|
+
x == null || x.setValue(e);
|
|
865
865
|
}, [e]);
|
|
866
|
-
const { theme:
|
|
866
|
+
const { theme: T } = ce({ monacoRef: I, themeConfig: r, editor: x, theme: a }), k = V(
|
|
867
867
|
() => Be({
|
|
868
|
-
instanceId:
|
|
868
|
+
instanceId: b.current,
|
|
869
869
|
lineNumbersPosition: n
|
|
870
870
|
}),
|
|
871
871
|
[o]
|
|
872
|
-
),
|
|
872
|
+
), M = V(
|
|
873
873
|
() => xr({
|
|
874
|
-
instanceId:
|
|
874
|
+
instanceId: b.current,
|
|
875
875
|
blameData: o,
|
|
876
876
|
avatarSize: Cr,
|
|
877
877
|
dateWidth: Pr
|
|
878
878
|
}),
|
|
879
879
|
[o]
|
|
880
880
|
);
|
|
881
|
-
|
|
881
|
+
ke(() => {
|
|
882
882
|
f.current && f.current.style.setProperty("--line-number-display", "none");
|
|
883
883
|
}, []), N(() => {
|
|
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", `${he + 16 +
|
|
887
|
+
const w = { attributes: !0 }, m = () => {
|
|
888
|
+
const O = parseInt(getComputedStyle(s).left);
|
|
889
|
+
f.current && (f.current.style.setProperty("--line-number-offset", `${he + 16 + O}px`), f.current.style.setProperty("--line-number-display", "block"));
|
|
890
890
|
}, p = new MutationObserver(m);
|
|
891
|
-
return p.observe(s,
|
|
891
|
+
return p.observe(s, w), m(), () => {
|
|
892
892
|
p.disconnect();
|
|
893
893
|
};
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
896
|
});
|
|
897
|
-
const C =
|
|
898
|
-
.monaco-editor-${
|
|
897
|
+
const C = V(() => `
|
|
898
|
+
.monaco-editor-${b.current} .margin {
|
|
899
899
|
display: var(--line-number-display);
|
|
900
900
|
left: var(--line-number-offset);
|
|
901
901
|
pointer-events: none;
|
|
902
|
-
}`, []),
|
|
902
|
+
}`, []), $ = V(() => `.monaco-editor-${b.current} .view-overlays {
|
|
903
903
|
clip-path: polygon(${he + 16}px 0, 100% 0%, 100% 100%, ${he + 16}px 100%);
|
|
904
904
|
height:100% !important;
|
|
905
|
-
}`, []),
|
|
905
|
+
}`, []), E = V(
|
|
906
906
|
() => ({
|
|
907
907
|
...$r,
|
|
908
908
|
...l
|
|
909
909
|
}),
|
|
910
910
|
[l]
|
|
911
|
-
),
|
|
911
|
+
), v = V(() => /* @__PURE__ */ A.jsx(
|
|
912
912
|
"style",
|
|
913
913
|
{
|
|
914
914
|
dangerouslySetInnerHTML: {
|
|
915
|
-
__html: `${
|
|
915
|
+
__html: `${k} ${M} ${C} ${$}`
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
|
-
), [
|
|
918
|
+
), [k, M, $, C]);
|
|
919
919
|
return /* @__PURE__ */ A.jsxs("div", { className: d, ref: f, children: [
|
|
920
|
-
|
|
920
|
+
v,
|
|
921
921
|
/* @__PURE__ */ A.jsx(
|
|
922
922
|
fe,
|
|
923
923
|
{
|
|
924
|
-
className: `monaco-editor-${
|
|
924
|
+
className: `monaco-editor-${b.current} overflow-hidden rounded-b-cn-3`,
|
|
925
925
|
height: u,
|
|
926
926
|
language: t,
|
|
927
|
-
theme:
|
|
928
|
-
options:
|
|
929
|
-
onMount:
|
|
927
|
+
theme: T,
|
|
928
|
+
options: E,
|
|
929
|
+
onMount: j
|
|
930
930
|
}
|
|
931
931
|
)
|
|
932
932
|
] });
|
|
@@ -954,32 +954,32 @@ function rn({
|
|
|
954
954
|
options: u,
|
|
955
955
|
className: l
|
|
956
956
|
}) {
|
|
957
|
-
const d =
|
|
957
|
+
const d = y(o), g = y(null), f = y(Ee(5));
|
|
958
958
|
ie();
|
|
959
|
-
const [
|
|
959
|
+
const [b, x] = R(), h = y(null), I = y(null);
|
|
960
960
|
N(() => {
|
|
961
961
|
d.current = o;
|
|
962
962
|
}, [o]);
|
|
963
|
-
function
|
|
964
|
-
const
|
|
965
|
-
if (!
|
|
963
|
+
function D() {
|
|
964
|
+
const E = I.current, v = h.current;
|
|
965
|
+
if (!E || !v)
|
|
966
966
|
return;
|
|
967
|
-
|
|
968
|
-
|
|
967
|
+
E.changeViewZones(function(w) {
|
|
968
|
+
w.addZone({
|
|
969
969
|
afterLineNumber: 0,
|
|
970
970
|
heightInPx: 1,
|
|
971
971
|
domNode: document.createElement("div")
|
|
972
972
|
}), d.current.forEach((m) => {
|
|
973
973
|
if (m.infoContent) {
|
|
974
|
-
const
|
|
975
|
-
|
|
974
|
+
const O = document.createElement("div");
|
|
975
|
+
O.className = "blame-editor-info-holder", O.style.position = "relative", O.style.zIndex = "100", O.style.overflow = "visible", Lr(O, m.infoContent), w.addZone({
|
|
976
976
|
afterLineNumber: m.fromLineNumber - 1,
|
|
977
977
|
heightInPx: 0,
|
|
978
|
-
domNode:
|
|
978
|
+
domNode: O
|
|
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",
|
|
982
|
+
p.style.borderTop = "1px solid var(--cn-border-2)", p.style.marginTop = "9px", p.className = "blame-editor-separator", w.addZone({
|
|
983
983
|
afterLineNumber: m.toLineNumber,
|
|
984
984
|
heightInPx: 20,
|
|
985
985
|
domNode: p
|
|
@@ -987,91 +987,91 @@ function rn({
|
|
|
987
987
|
});
|
|
988
988
|
});
|
|
989
989
|
const s = [];
|
|
990
|
-
d.current.forEach((
|
|
991
|
-
for (let m =
|
|
990
|
+
d.current.forEach((w) => {
|
|
991
|
+
for (let m = w.fromLineNumber; m <= w.toLineNumber; m++)
|
|
992
992
|
s.push({
|
|
993
|
-
range: new
|
|
993
|
+
range: new v.Range(m, 0, m + 1, 0),
|
|
994
994
|
options: {
|
|
995
995
|
before: {
|
|
996
996
|
content: Ke("", Ir),
|
|
997
|
-
cursorStops:
|
|
997
|
+
cursorStops: v.editor.InjectedTextCursorStops.None,
|
|
998
998
|
inlineClassName: `blame-editor-commit blame-editor-commit-${m}`
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
1001
|
});
|
|
1002
|
-
}),
|
|
1002
|
+
}), E.createDecorationsCollection(s);
|
|
1003
1003
|
}
|
|
1004
|
-
function
|
|
1005
|
-
var s,
|
|
1006
|
-
|
|
1004
|
+
function L(E, v) {
|
|
1005
|
+
var s, w, m, p, O, c;
|
|
1006
|
+
I.current = E, h.current = v, E.setValue(e), x(E), (m = (w = (s = v.languages.typescript) == null ? void 0 : s.typescriptDefaults) == null ? void 0 : w.setDiagnosticsOptions) == null || m.call(w, {
|
|
1007
1007
|
noSuggestionDiagnostics: !0,
|
|
1008
1008
|
noSyntaxValidation: !0,
|
|
1009
1009
|
noSemanticValidation: !0
|
|
1010
|
-
}), (c = (
|
|
1010
|
+
}), (c = (O = (p = v.languages.typescript) == null ? void 0 : p.javascriptDefaults) == null ? void 0 : O.setDiagnosticsOptions) == null || c.call(O, {
|
|
1011
1011
|
noSuggestionDiagnostics: !0,
|
|
1012
1012
|
noSyntaxValidation: !0,
|
|
1013
1013
|
noSemanticValidation: !0
|
|
1014
|
-
}),
|
|
1014
|
+
}), D();
|
|
1015
1015
|
}
|
|
1016
1016
|
N(() => {
|
|
1017
|
-
|
|
1017
|
+
b == null || b.setValue(e);
|
|
1018
1018
|
}, [e]);
|
|
1019
|
-
const { theme:
|
|
1019
|
+
const { theme: j } = ce({ monacoRef: h, themeConfig: r, editor: b, theme: i }), T = V(
|
|
1020
1020
|
() => Be({
|
|
1021
1021
|
instanceId: f.current,
|
|
1022
1022
|
lineNumbersPosition: n
|
|
1023
1023
|
}),
|
|
1024
1024
|
[o]
|
|
1025
1025
|
);
|
|
1026
|
-
|
|
1027
|
-
|
|
1026
|
+
ke(() => {
|
|
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 m = parseInt(getComputedStyle(
|
|
1034
|
-
|
|
1035
|
-
},
|
|
1036
|
-
return
|
|
1037
|
-
|
|
1029
|
+
if (n === "center" && g.current) {
|
|
1030
|
+
const E = g.current.getElementsByClassName("lines-content")[0];
|
|
1031
|
+
if (E) {
|
|
1032
|
+
const v = { attributes: !0 }, s = () => {
|
|
1033
|
+
const m = parseInt(getComputedStyle(E).left);
|
|
1034
|
+
g.current && (g.current.style.setProperty("--line-number-offset", `${ve + 16 + m}px`), g.current.style.setProperty("--line-number-display", "block"));
|
|
1035
|
+
}, w = new MutationObserver(s);
|
|
1036
|
+
return w.observe(E, v), 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
|
-
}`, []),
|
|
1047
|
+
}`, []), M = V(() => `.monaco-editor-${f.current} .view-overlays {
|
|
1048
1048
|
clip-path: polygon(${ve + 16}px 0, 100% 0%, 100% 100%, ${ve + 16}px 100%);
|
|
1049
1049
|
height:100% !important;
|
|
1050
|
-
}`, []), C =
|
|
1050
|
+
}`, []), C = V(
|
|
1051
1051
|
() => ({
|
|
1052
1052
|
...Nr,
|
|
1053
1053
|
...u
|
|
1054
1054
|
}),
|
|
1055
1055
|
[u]
|
|
1056
|
-
),
|
|
1056
|
+
), $ = V(() => /* @__PURE__ */ A.jsx(
|
|
1057
1057
|
"style",
|
|
1058
1058
|
{
|
|
1059
1059
|
dangerouslySetInnerHTML: {
|
|
1060
|
-
__html: `${
|
|
1060
|
+
__html: `${T} ${k} ${M}`
|
|
1061
1061
|
}
|
|
1062
1062
|
}
|
|
1063
|
-
), [
|
|
1064
|
-
return /* @__PURE__ */ A.jsxs("div", { className: l, ref:
|
|
1065
|
-
|
|
1063
|
+
), [T, M, k]);
|
|
1064
|
+
return /* @__PURE__ */ A.jsxs("div", { className: l, ref: g, children: [
|
|
1065
|
+
$,
|
|
1066
1066
|
/* @__PURE__ */ A.jsx(
|
|
1067
1067
|
fe,
|
|
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:
|
|
1072
|
+
theme: j,
|
|
1073
1073
|
options: C,
|
|
1074
|
-
onMount:
|
|
1074
|
+
onMount: L
|
|
1075
1075
|
}
|
|
1076
1076
|
)
|
|
1077
1077
|
] });
|
|
@@ -1114,29 +1114,29 @@ function Tr(e) {
|
|
|
1114
1114
|
}, [t, r]);
|
|
1115
1115
|
}
|
|
1116
1116
|
function Dr(e) {
|
|
1117
|
-
const { enable: t, editor: r, onSelectedLineChange: n, selectedLine: o, onSelectedLineButtonClick: i } = e, a =
|
|
1117
|
+
const { enable: t, editor: r, onSelectedLineChange: n, selectedLine: o, onSelectedLineButtonClick: i } = e, a = y(null), u = y(!1), l = y(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
|
-
const f = (
|
|
1124
|
-
var
|
|
1125
|
-
if ((
|
|
1126
|
-
i == null || i((
|
|
1123
|
+
const f = (b) => {
|
|
1124
|
+
var h, I, D, L;
|
|
1125
|
+
if ((I = (h = b.target) == null ? void 0 : h.element) != null && I.classList.contains("CodeEditor_HighlightedGlyphMargin")) {
|
|
1126
|
+
i == null || i((D = b.target) == null ? void 0 : D.element);
|
|
1127
1127
|
return;
|
|
1128
1128
|
}
|
|
1129
|
-
const
|
|
1130
|
-
if (
|
|
1129
|
+
const x = _r((L = b.target) == null ? void 0 : L.element);
|
|
1130
|
+
if (!x) {
|
|
1131
1131
|
n == null || n(void 0), i == null || i(void 0), ye(r, l.current, void 0);
|
|
1132
1132
|
return;
|
|
1133
1133
|
}
|
|
1134
|
-
u.current = !0, a.current =
|
|
1134
|
+
u.current = !0, a.current = x, n == null || n(x), ye(r, l.current, x, !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
1142
|
r && a.current !== o && ye(r, l.current, o, !0);
|
|
@@ -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
|
}
|
|
@@ -1192,7 +1192,7 @@ const Vr = `.CodeEditor_HighlightedLine {
|
|
|
1192
1192
|
}
|
|
1193
1193
|
`;
|
|
1194
1194
|
q.config({ monaco: F });
|
|
1195
|
-
const
|
|
1195
|
+
const Vr = {
|
|
1196
1196
|
...ae
|
|
1197
1197
|
};
|
|
1198
1198
|
function nn({
|
|
@@ -1206,67 +1206,68 @@ 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:
|
|
1211
|
+
className: b,
|
|
1212
|
+
onMount: x
|
|
1212
1213
|
}) {
|
|
1213
|
-
const
|
|
1214
|
+
const h = y(Ee(5));
|
|
1214
1215
|
ie();
|
|
1215
|
-
const [
|
|
1216
|
-
(
|
|
1217
|
-
var
|
|
1218
|
-
|
|
1216
|
+
const [I, D] = R(), L = y(), j = y({ code: "", revisionId: 0 }), T = y(null), k = J(
|
|
1217
|
+
(E, v) => {
|
|
1218
|
+
var s, w, m, p, O, c;
|
|
1219
|
+
T.current = E, L.current = v, E.setValue(e.code), D(E), (m = (w = (s = v.languages.typescript) == null ? void 0 : s.typescriptDefaults) == null ? void 0 : w.setDiagnosticsOptions) == null || m.call(w, {
|
|
1219
1220
|
noSuggestionDiagnostics: !0,
|
|
1220
1221
|
noSyntaxValidation: !0,
|
|
1221
1222
|
noSemanticValidation: !0
|
|
1222
|
-
}), (
|
|
1223
|
+
}), (c = (O = (p = v.languages.typescript) == null ? void 0 : p.javascriptDefaults) == null ? void 0 : O.setDiagnosticsOptions) == null || c.call(O, {
|
|
1223
1224
|
noSuggestionDiagnostics: !0,
|
|
1224
1225
|
noSyntaxValidation: !0,
|
|
1225
1226
|
noSemanticValidation: !0
|
|
1226
|
-
});
|
|
1227
|
+
}), x == null || x(E, v);
|
|
1227
1228
|
},
|
|
1228
|
-
[e.code]
|
|
1229
|
+
[e.code, x]
|
|
1229
1230
|
);
|
|
1230
1231
|
N(() => {
|
|
1231
|
-
var
|
|
1232
|
-
if (
|
|
1233
|
-
const
|
|
1234
|
-
|
|
1232
|
+
var E, v;
|
|
1233
|
+
if (T.current && (!e.revisionId || e.revisionId > Number((E = j.current) == null ? void 0 : E.revisionId))) {
|
|
1234
|
+
const s = T.current.getModel();
|
|
1235
|
+
s && (o != null && o.readOnly ? (v = T.current) == null || v.setValue(e.code) : (T.current.pushUndoStop(), T.current.executeEdits("edit", [
|
|
1235
1236
|
{
|
|
1236
|
-
range:
|
|
1237
|
+
range: s.getFullModelRange(),
|
|
1237
1238
|
text: e.code
|
|
1238
1239
|
}
|
|
1239
|
-
]),
|
|
1240
|
+
]), T.current.pushUndoStop()));
|
|
1240
1241
|
}
|
|
1241
|
-
}, [e, o == null ? void 0 : o.readOnly,
|
|
1242
|
-
const { theme:
|
|
1242
|
+
}, [e, o == null ? void 0 : o.readOnly, T]);
|
|
1243
|
+
const { theme: M } = ce({ monacoRef: L, themeConfig: n, editor: I, theme: i });
|
|
1243
1244
|
Dr({
|
|
1244
1245
|
enable: a,
|
|
1245
|
-
editor:
|
|
1246
|
+
editor: I,
|
|
1246
1247
|
selectedLine: u,
|
|
1247
1248
|
onSelectedLineChange: l,
|
|
1248
1249
|
onSelectedLineButtonClick: d
|
|
1249
|
-
}), Tr({ editor:
|
|
1250
|
-
const
|
|
1251
|
-
...
|
|
1250
|
+
}), Tr({ editor: I, keyword: g });
|
|
1251
|
+
const C = 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]), $ = V(() => `.monaco-editor-${h.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: $ } }),
|
|
1258
1259
|
/* @__PURE__ */ A.jsx(
|
|
1259
1260
|
fe,
|
|
1260
1261
|
{
|
|
1261
|
-
className: `monaco-editor-${
|
|
1262
|
+
className: `monaco-editor-${h.current} ${b}`,
|
|
1262
1263
|
height: f,
|
|
1263
|
-
onChange: (
|
|
1264
|
-
|
|
1264
|
+
onChange: (E, v) => {
|
|
1265
|
+
j.current = { code: E ?? "", revisionId: v.versionId }, t == null || t({ ...j.current }, v);
|
|
1265
1266
|
},
|
|
1266
1267
|
language: r,
|
|
1267
|
-
theme:
|
|
1268
|
-
options:
|
|
1269
|
-
onMount:
|
|
1268
|
+
theme: M,
|
|
1269
|
+
options: C,
|
|
1270
|
+
onMount: k
|
|
1270
1271
|
}
|
|
1271
1272
|
)
|
|
1272
1273
|
] });
|
|
@@ -1291,13 +1292,13 @@ function on({
|
|
|
1291
1292
|
height: a = "75vh"
|
|
1292
1293
|
}) {
|
|
1293
1294
|
ie();
|
|
1294
|
-
const [u, l] = R(), d =
|
|
1295
|
+
const [u, l] = R(), d = y(), { 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,
|
|
@@ -1314,31 +1315,31 @@ function Hr(e) {
|
|
|
1314
1315
|
a.selectors.forEach((d) => {
|
|
1315
1316
|
switch (d.type) {
|
|
1316
1317
|
case Ye.ContainsPath: {
|
|
1317
|
-
d.paths.forEach((
|
|
1318
|
-
let
|
|
1319
|
-
fullPath:
|
|
1320
|
-
path:
|
|
1321
|
-
symbol: o[
|
|
1322
|
-
})).filter((
|
|
1323
|
-
|
|
1324
|
-
...
|
|
1325
|
-
path:
|
|
1326
|
-
})),
|
|
1327
|
-
const
|
|
1328
|
-
u.forEach((
|
|
1329
|
-
const
|
|
1330
|
-
range:
|
|
1331
|
-
symbols: [
|
|
1332
|
-
onClick:
|
|
1333
|
-
data:
|
|
1334
|
-
path:
|
|
1318
|
+
d.paths.forEach((g) => {
|
|
1319
|
+
let b = Object.keys(o).map((h) => ({
|
|
1320
|
+
fullPath: h,
|
|
1321
|
+
path: h,
|
|
1322
|
+
symbol: o[h]
|
|
1323
|
+
})).filter((h) => h.path.startsWith(d.basePath));
|
|
1324
|
+
b = b.map((h) => ({
|
|
1325
|
+
...h,
|
|
1326
|
+
path: h.path.substring(d.basePath.length)
|
|
1327
|
+
})), b.filter((h) => g.test(h.path)).forEach((h) => {
|
|
1328
|
+
const I = h.fullPath, D = h.symbol, L = D.range;
|
|
1329
|
+
u.forEach((j) => {
|
|
1330
|
+
const T = {
|
|
1331
|
+
range: L,
|
|
1332
|
+
symbols: [D],
|
|
1333
|
+
onClick: j.onClick,
|
|
1334
|
+
data: j.data,
|
|
1335
|
+
path: I
|
|
1335
1336
|
};
|
|
1336
1337
|
i.push({
|
|
1337
|
-
range:
|
|
1338
|
+
range: L,
|
|
1338
1339
|
command: {
|
|
1339
1340
|
id: n,
|
|
1340
|
-
title:
|
|
1341
|
-
arguments: [
|
|
1341
|
+
title: j.title,
|
|
1342
|
+
arguments: [T]
|
|
1342
1343
|
}
|
|
1343
1344
|
});
|
|
1344
1345
|
});
|
|
@@ -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, b;
|
|
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 Ge(n), i = Ze(o), a = (
|
|
1432
|
-
|
|
1432
|
+
const o = await Ge(n), i = Ze(o), a = (b = e == null ? void 0 : e.current) == null ? void 0 : b.addCommand(0, (x, { onClick: h, path: I, range: D, data: L }) => {
|
|
1433
|
+
h({ path: I, range: D, 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
|
|
1446
|
-
const l = (
|
|
1446
|
+
var b, x, h;
|
|
1447
|
+
const l = (b = e == null ? void 0 : e.current) == null ? void 0 : b.getModel();
|
|
1447
1448
|
if (!l || !a)
|
|
1448
1449
|
return n(void 0);
|
|
1449
|
-
const d = await Ge(l), f = (
|
|
1450
|
-
f && (n(f), u && ((
|
|
1450
|
+
const d = await Ge(l), f = (x = Ze(d).get(a)) == null ? void 0 : x.range;
|
|
1451
|
+
f && (n(f), u && ((h = e == null ? void 0 : e.current) == null || h.revealLineInCenter(f.startLineNumber)));
|
|
1451
1452
|
},
|
|
1452
1453
|
[]
|
|
1453
1454
|
);
|
|
@@ -1527,10 +1528,10 @@ 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((
|
|
1532
|
-
const
|
|
1533
|
-
n(
|
|
1531
|
+
const g = d.uri.toString();
|
|
1532
|
+
if (l.some((b) => b.toString() === g)) {
|
|
1533
|
+
const b = F.editor.getModelMarkers({ resource: d.uri });
|
|
1534
|
+
n(b);
|
|
1534
1535
|
}
|
|
1535
1536
|
}));
|
|
1536
1537
|
}, 100);
|
|
@@ -1541,12 +1542,12 @@ 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
|
+
const t = ((o = (n = Me) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? [], r = t.findIndex((i) => i.fileMatch[0] === e.fileMatch[0]);
|
|
1545
1546
|
r !== -1 ? t[r] = e : t.push(e), Xe(t);
|
|
1546
1547
|
}
|
|
1547
1548
|
function Kr(e) {
|
|
1548
1549
|
var n, o;
|
|
1549
|
-
const r = (((o = (n =
|
|
1550
|
+
const r = (((o = (n = Me) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? []).filter((i) => i.fileMatch[0] !== je(e));
|
|
1550
1551
|
Xe(r);
|
|
1551
1552
|
}
|
|
1552
1553
|
function Xe(e) {
|
|
@@ -1557,7 +1558,7 @@ function Xe(e) {
|
|
|
1557
1558
|
validate: !0,
|
|
1558
1559
|
schemas: e
|
|
1559
1560
|
};
|
|
1560
|
-
|
|
1561
|
+
Me.setDiagnosticsOptions({ ...t });
|
|
1561
1562
|
}
|
|
1562
1563
|
const je = (e) => it.parse(`file://${e}`).toString(), Yr = (e) => {
|
|
1563
1564
|
const { schemaConfig: t, instanceId: r } = e;
|
|
@@ -1585,74 +1586,74 @@ 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
|
-
instanceId:
|
|
1591
|
-
height:
|
|
1592
|
-
} = t,
|
|
1591
|
+
instanceId: b,
|
|
1592
|
+
height: x
|
|
1593
|
+
} = t, h = ie(), [I] = R(b ?? `yaml-editor-${Math.random()}`), { editor: D, setEditor: L } = Qe(), j = y(null), T = y(), k = y({ yaml: "", revisionId: 0 }), M = y(null), C = y(null), $ = J(
|
|
1593
1594
|
(m) => {
|
|
1594
|
-
var c,
|
|
1595
|
+
var c, S, H;
|
|
1595
1596
|
const p = m.split(`
|
|
1596
|
-
`),
|
|
1597
|
-
if (
|
|
1598
|
-
(
|
|
1597
|
+
`), O = (c = M.current) == null ? void 0 : c.getModel();
|
|
1598
|
+
if (O) {
|
|
1599
|
+
(S = M.current) == null || S.pushUndoStop(), O.setValue("");
|
|
1599
1600
|
let W = 0;
|
|
1600
1601
|
C.current = window.setInterval(() => {
|
|
1601
1602
|
var B;
|
|
1602
|
-
W < p.length ? (
|
|
1603
|
+
W < p.length ? (h && ((B = M.current) == null || B.executeEdits("addLine", [
|
|
1603
1604
|
{
|
|
1604
|
-
range: new
|
|
1605
|
+
range: new h.Range(W + 1, 1, W + 1, 1),
|
|
1605
1606
|
text: p[W] + `
|
|
1606
1607
|
`
|
|
1607
1608
|
}
|
|
1608
1609
|
])), W++) : C.current && (clearInterval(C.current), f == null || f());
|
|
1609
|
-
}, 100), (H =
|
|
1610
|
+
}, 100), (H = M.current) == null || H.pushUndoStop();
|
|
1610
1611
|
}
|
|
1611
1612
|
},
|
|
1612
|
-
[
|
|
1613
|
+
[h]
|
|
1613
1614
|
);
|
|
1614
1615
|
N(() => () => {
|
|
1615
1616
|
C.current && clearInterval(C.current);
|
|
1616
1617
|
}, []);
|
|
1617
|
-
function
|
|
1618
|
-
|
|
1619
|
-
var
|
|
1620
|
-
(
|
|
1618
|
+
function E(m, p) {
|
|
1619
|
+
M.current = m, T.current = p, m.setValue(r.yaml), L(m), setTimeout(() => {
|
|
1620
|
+
var O;
|
|
1621
|
+
(O = j.current) != null && O.style && (j.current.style.opacity = "1");
|
|
1621
1622
|
}, 50);
|
|
1622
1623
|
}
|
|
1623
1624
|
N(() => {
|
|
1624
1625
|
var m;
|
|
1625
|
-
if (
|
|
1626
|
-
const p =
|
|
1627
|
-
p && (
|
|
1626
|
+
if (M.current && (!r.revisionId || r.revisionId > Number((m = k.current) == null ? void 0 : m.revisionId))) {
|
|
1627
|
+
const p = M.current.getModel();
|
|
1628
|
+
p && (M.current.executeEdits("edit", [
|
|
1628
1629
|
{
|
|
1629
1630
|
range: p.getFullModelRange(),
|
|
1630
|
-
text:
|
|
1631
|
+
text: g ? "" : r.yaml
|
|
1631
1632
|
}
|
|
1632
|
-
]),
|
|
1633
|
+
]), g && $(r.yaml));
|
|
1633
1634
|
}
|
|
1634
|
-
}, [
|
|
1635
|
-
const { theme:
|
|
1636
|
-
qr({ monacoRef:
|
|
1637
|
-
const s =
|
|
1635
|
+
}, [$, r, g]), Yr({ schemaConfig: n, instanceId: I }), Fr({ editorRef: M, inlineActions: o });
|
|
1636
|
+
const { theme: v } = ce({ monacoRef: T, themeConfig: i, editor: D, theme: l });
|
|
1637
|
+
qr({ monacoRef: T, editorRef: M, instanceId: I }), Wr({ editorRef: M, selection: u });
|
|
1638
|
+
const s = V(() => je(I), []), w = V(
|
|
1638
1639
|
() => ({
|
|
1639
1640
|
...Gr,
|
|
1640
1641
|
...d
|
|
1641
1642
|
}),
|
|
1642
1643
|
[d]
|
|
1643
1644
|
);
|
|
1644
|
-
return /* @__PURE__ */ A.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref:
|
|
1645
|
+
return /* @__PURE__ */ A.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref: j, children: /* @__PURE__ */ A.jsx(
|
|
1645
1646
|
fe,
|
|
1646
1647
|
{
|
|
1647
1648
|
onChange: (m, p) => {
|
|
1648
|
-
|
|
1649
|
+
k.current = { yaml: m ?? "", revisionId: p.versionId }, a({ ...k.current }, p);
|
|
1649
1650
|
},
|
|
1650
1651
|
language: "yaml",
|
|
1651
|
-
theme:
|
|
1652
|
-
options:
|
|
1652
|
+
theme: v,
|
|
1653
|
+
options: w,
|
|
1653
1654
|
path: s,
|
|
1654
|
-
onMount:
|
|
1655
|
-
height:
|
|
1655
|
+
onMount: E,
|
|
1656
|
+
height: x
|
|
1656
1657
|
}
|
|
1657
1658
|
) });
|
|
1658
1659
|
};
|