@harnessio/yaml-editor 0.21.0 → 0.22.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/BlameEditorV2.d.ts +21 -0
- package/dist/components/CodeEditor.d.ts +7 -2
- package/dist/components/YamlEditor.d.ts +1 -0
- package/dist/hooks/useHighlight.d.ts +6 -0
- package/dist/hooks/useLinesSelection.d.ts +9 -0
- package/dist/index.cjs +61 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +868 -575
- package/dist/index.js.map +1 -1
- package/dist/types/blame.d.ts +1 -0
- package/package.json +3 -4
package/dist/index.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import { languages as
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
var tt = Object.defineProperty;
|
|
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 Pe = (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 k, useLayoutEffect as Ve, createContext as nt, useContext as ot } from "react";
|
|
5
|
+
import * as F from "monaco-editor";
|
|
6
|
+
import { languages as be, Uri as it } from "monaco-editor";
|
|
7
|
+
import { render as at } from "react-dom";
|
|
8
|
+
import { yamlDefaults as Oe } from "monaco-yaml";
|
|
9
|
+
var ke = { exports: {} }, ne = {};
|
|
9
10
|
/*
|
|
10
11
|
object-assign
|
|
11
12
|
(c) Sindre Sorhus
|
|
12
13
|
@license MIT
|
|
13
14
|
*/
|
|
14
|
-
var
|
|
15
|
-
function
|
|
15
|
+
var Ce = Object.getOwnPropertySymbols, ct = Object.prototype.hasOwnProperty, st = Object.prototype.propertyIsEnumerable;
|
|
16
|
+
function ut(e) {
|
|
16
17
|
if (e == null)
|
|
17
18
|
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
18
19
|
return Object(e);
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function lt() {
|
|
21
22
|
try {
|
|
22
23
|
if (!Object.assign)
|
|
23
24
|
return !1;
|
|
@@ -39,7 +40,7 @@ function ot() {
|
|
|
39
40
|
return !1;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
lt();
|
|
43
44
|
/** @license React v17.0.2
|
|
44
45
|
* react-jsx-runtime.production.min.js
|
|
45
46
|
*
|
|
@@ -48,28 +49,28 @@ ot();
|
|
|
48
49
|
* This source code is licensed under the MIT license found in the
|
|
49
50
|
* LICENSE file in the root directory of this source tree.
|
|
50
51
|
*/
|
|
51
|
-
var
|
|
52
|
+
var dt = Y, Ae = 60103;
|
|
52
53
|
ne.Fragment = 60107;
|
|
53
54
|
if (typeof Symbol == "function" && Symbol.for) {
|
|
54
|
-
var
|
|
55
|
-
|
|
55
|
+
var $e = Symbol.for;
|
|
56
|
+
Ae = $e("react.element"), ne.Fragment = $e("react.fragment");
|
|
56
57
|
}
|
|
57
|
-
var
|
|
58
|
-
function
|
|
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 He(e, t, r) {
|
|
59
60
|
var n, o = {}, i = null, a = null;
|
|
60
61
|
r !== void 0 && (i = "" + r), t.key !== void 0 && (i = "" + t.key), t.ref !== void 0 && (a = t.ref);
|
|
61
62
|
for (n in t)
|
|
62
|
-
|
|
63
|
+
pt.call(t, n) && !mt.hasOwnProperty(n) && (o[n] = t[n]);
|
|
63
64
|
if (e && e.defaultProps)
|
|
64
65
|
for (n in t = e.defaultProps, t)
|
|
65
66
|
o[n] === void 0 && (o[n] = t[n]);
|
|
66
|
-
return { $$typeof:
|
|
67
|
+
return { $$typeof: Ae, type: e, key: i, ref: a, props: o, _owner: ft.current };
|
|
67
68
|
}
|
|
68
|
-
ne.jsx =
|
|
69
|
-
ne.jsxs =
|
|
70
|
-
|
|
71
|
-
var
|
|
72
|
-
function
|
|
69
|
+
ne.jsx = He;
|
|
70
|
+
ne.jsxs = He;
|
|
71
|
+
ke.exports = ne;
|
|
72
|
+
var A = ke.exports;
|
|
73
|
+
function gt(e, t, r) {
|
|
73
74
|
return t in e ? Object.defineProperty(e, t, {
|
|
74
75
|
value: r,
|
|
75
76
|
enumerable: !0,
|
|
@@ -77,7 +78,7 @@ function st(e, t, r) {
|
|
|
77
78
|
writable: !0
|
|
78
79
|
}) : e[t] = r, e;
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
+
function Ie(e, t) {
|
|
81
82
|
var r = Object.keys(e);
|
|
82
83
|
if (Object.getOwnPropertySymbols) {
|
|
83
84
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -87,18 +88,18 @@ function xe(e, t) {
|
|
|
87
88
|
}
|
|
88
89
|
return r;
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function Ne(e) {
|
|
91
92
|
for (var t = 1; t < arguments.length; t++) {
|
|
92
93
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
93
|
-
t % 2 ?
|
|
94
|
-
|
|
95
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
94
|
+
t % 2 ? Ie(Object(r), !0).forEach(function(n) {
|
|
95
|
+
gt(e, n, r[n]);
|
|
96
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Ie(Object(r)).forEach(function(n) {
|
|
96
97
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
return e;
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
+
function ht(e, t) {
|
|
102
103
|
if (e == null)
|
|
103
104
|
return {};
|
|
104
105
|
var r = {}, n = Object.keys(e), o, i;
|
|
@@ -106,10 +107,10 @@ function lt(e, t) {
|
|
|
106
107
|
o = n[i], !(t.indexOf(o) >= 0) && (r[o] = e[o]);
|
|
107
108
|
return r;
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
+
function vt(e, t) {
|
|
110
111
|
if (e == null)
|
|
111
112
|
return {};
|
|
112
|
-
var r =
|
|
113
|
+
var r = ht(e, t), n, o;
|
|
113
114
|
if (Object.getOwnPropertySymbols) {
|
|
114
115
|
var i = Object.getOwnPropertySymbols(e);
|
|
115
116
|
for (o = 0; o < i.length; o++)
|
|
@@ -117,21 +118,21 @@ function dt(e, t) {
|
|
|
117
118
|
}
|
|
118
119
|
return r;
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
-
return
|
|
121
|
+
function yt(e, t) {
|
|
122
|
+
return bt(e) || wt(e, t) || Mt(e, t) || Ot();
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function bt(e) {
|
|
124
125
|
if (Array.isArray(e))
|
|
125
126
|
return e;
|
|
126
127
|
}
|
|
127
|
-
function
|
|
128
|
+
function wt(e, t) {
|
|
128
129
|
if (!(typeof Symbol > "u" || !(Symbol.iterator in Object(e)))) {
|
|
129
130
|
var r = [], n = !0, o = !1, i = void 0;
|
|
130
131
|
try {
|
|
131
132
|
for (var a = e[Symbol.iterator](), u; !(n = (u = a.next()).done) && (r.push(u.value), !(t && r.length === t)); n = !0)
|
|
132
133
|
;
|
|
133
|
-
} catch (
|
|
134
|
-
o = !0, i =
|
|
134
|
+
} catch (l) {
|
|
135
|
+
o = !0, i = l;
|
|
135
136
|
} finally {
|
|
136
137
|
try {
|
|
137
138
|
!n && a.return != null && a.return();
|
|
@@ -143,28 +144,28 @@ function mt(e, t) {
|
|
|
143
144
|
return r;
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
function
|
|
147
|
+
function Mt(e, t) {
|
|
147
148
|
if (e) {
|
|
148
149
|
if (typeof e == "string")
|
|
149
|
-
return
|
|
150
|
+
return Le(e, t);
|
|
150
151
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
151
152
|
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
|
|
152
153
|
return Array.from(e);
|
|
153
154
|
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
|
|
154
|
-
return
|
|
155
|
+
return Le(e, t);
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
|
-
function
|
|
158
|
+
function Le(e, t) {
|
|
158
159
|
(t == null || t > e.length) && (t = e.length);
|
|
159
160
|
for (var r = 0, n = new Array(t); r < t; r++)
|
|
160
161
|
n[r] = e[r];
|
|
161
162
|
return n;
|
|
162
163
|
}
|
|
163
|
-
function
|
|
164
|
+
function Ot() {
|
|
164
165
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
165
166
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
+
function St(e, t, r) {
|
|
168
169
|
return t in e ? Object.defineProperty(e, t, {
|
|
169
170
|
value: r,
|
|
170
171
|
enumerable: !0,
|
|
@@ -172,7 +173,7 @@ function vt(e, t, r) {
|
|
|
172
173
|
writable: !0
|
|
173
174
|
}) : e[t] = r, e;
|
|
174
175
|
}
|
|
175
|
-
function
|
|
176
|
+
function Te(e, t) {
|
|
176
177
|
var r = Object.keys(e);
|
|
177
178
|
if (Object.getOwnPropertySymbols) {
|
|
178
179
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -182,18 +183,18 @@ function Ie(e, t) {
|
|
|
182
183
|
}
|
|
183
184
|
return r;
|
|
184
185
|
}
|
|
185
|
-
function
|
|
186
|
+
function De(e) {
|
|
186
187
|
for (var t = 1; t < arguments.length; t++) {
|
|
187
188
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
188
|
-
t % 2 ?
|
|
189
|
-
|
|
190
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
189
|
+
t % 2 ? Te(Object(r), !0).forEach(function(n) {
|
|
190
|
+
St(e, n, r[n]);
|
|
191
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Te(Object(r)).forEach(function(n) {
|
|
191
192
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
192
193
|
});
|
|
193
194
|
}
|
|
194
195
|
return e;
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
+
function Et() {
|
|
197
198
|
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
198
199
|
t[r] = arguments[r];
|
|
199
200
|
return function(n) {
|
|
@@ -207,44 +208,44 @@ function X(e) {
|
|
|
207
208
|
for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
|
|
208
209
|
o[i] = arguments[i];
|
|
209
210
|
return o.length >= e.length ? e.apply(this, o) : function() {
|
|
210
|
-
for (var a = arguments.length, u = new Array(a),
|
|
211
|
-
u[
|
|
211
|
+
for (var a = arguments.length, u = new Array(a), l = 0; l < a; l++)
|
|
212
|
+
u[l] = arguments[l];
|
|
212
213
|
return t.apply(r, [].concat(o, u));
|
|
213
214
|
};
|
|
214
215
|
};
|
|
215
216
|
}
|
|
216
|
-
function
|
|
217
|
+
function le(e) {
|
|
217
218
|
return {}.toString.call(e).includes("Object");
|
|
218
219
|
}
|
|
219
|
-
function
|
|
220
|
+
function xt(e) {
|
|
220
221
|
return !Object.keys(e).length;
|
|
221
222
|
}
|
|
222
223
|
function re(e) {
|
|
223
224
|
return typeof e == "function";
|
|
224
225
|
}
|
|
225
|
-
function
|
|
226
|
+
function jt(e, t) {
|
|
226
227
|
return Object.prototype.hasOwnProperty.call(e, t);
|
|
227
228
|
}
|
|
228
|
-
function
|
|
229
|
-
return
|
|
230
|
-
return !
|
|
231
|
-
}) &&
|
|
229
|
+
function Pt(e, t) {
|
|
230
|
+
return le(t) || K("changeType"), Object.keys(t).some(function(r) {
|
|
231
|
+
return !jt(e, r);
|
|
232
|
+
}) && K("changeField"), t;
|
|
232
233
|
}
|
|
233
|
-
function
|
|
234
|
-
re(e) ||
|
|
234
|
+
function Ct(e) {
|
|
235
|
+
re(e) || K("selectorType");
|
|
235
236
|
}
|
|
236
|
-
function
|
|
237
|
-
re(e) ||
|
|
237
|
+
function $t(e) {
|
|
238
|
+
re(e) || le(e) || K("handlerType"), le(e) && Object.values(e).some(function(t) {
|
|
238
239
|
return !re(t);
|
|
239
|
-
}) &&
|
|
240
|
+
}) && K("handlersType");
|
|
240
241
|
}
|
|
241
|
-
function
|
|
242
|
-
e ||
|
|
242
|
+
function It(e) {
|
|
243
|
+
e || K("initialIsRequired"), le(e) || K("initialType"), xt(e) && K("initialContent");
|
|
243
244
|
}
|
|
244
|
-
function
|
|
245
|
+
function Nt(e, t) {
|
|
245
246
|
throw new Error(e[t] || e.default);
|
|
246
247
|
}
|
|
247
|
-
var
|
|
248
|
+
var Lt = {
|
|
248
249
|
initialIsRequired: "initial state is required",
|
|
249
250
|
initialType: "initial state should be an object",
|
|
250
251
|
initialContent: "initial state shouldn't be an empty object",
|
|
@@ -254,76 +255,76 @@ var Pt = {
|
|
|
254
255
|
changeType: "provided value of changes should be an object",
|
|
255
256
|
changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
|
|
256
257
|
default: "an unknown error accured in `state-local` package"
|
|
257
|
-
},
|
|
258
|
-
changes:
|
|
259
|
-
selector:
|
|
260
|
-
handler:
|
|
261
|
-
initial:
|
|
258
|
+
}, K = X(Nt)(Lt), se = {
|
|
259
|
+
changes: Pt,
|
|
260
|
+
selector: Ct,
|
|
261
|
+
handler: $t,
|
|
262
|
+
initial: It
|
|
262
263
|
};
|
|
263
|
-
function
|
|
264
|
+
function Tt(e) {
|
|
264
265
|
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
265
|
-
|
|
266
|
+
se.initial(e), se.handler(t);
|
|
266
267
|
var r = {
|
|
267
268
|
current: e
|
|
268
|
-
}, n = X(
|
|
269
|
+
}, n = X(Vt)(r, t), o = X(_t)(r), i = X(se.changes)(e), a = X(Dt)(r);
|
|
269
270
|
function u() {
|
|
270
|
-
var
|
|
271
|
-
return
|
|
271
|
+
var d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(h) {
|
|
272
|
+
return h;
|
|
272
273
|
};
|
|
273
|
-
return
|
|
274
|
+
return se.selector(d), d(r.current);
|
|
274
275
|
}
|
|
275
|
-
function d
|
|
276
|
-
|
|
276
|
+
function l(d) {
|
|
277
|
+
Et(n, o, i, a)(d);
|
|
277
278
|
}
|
|
278
|
-
return [u,
|
|
279
|
+
return [u, l];
|
|
279
280
|
}
|
|
280
|
-
function
|
|
281
|
+
function Dt(e, t) {
|
|
281
282
|
return re(t) ? t(e.current) : t;
|
|
282
283
|
}
|
|
283
|
-
function
|
|
284
|
-
return e.current =
|
|
284
|
+
function _t(e, t) {
|
|
285
|
+
return e.current = De(De({}, e.current), t), t;
|
|
285
286
|
}
|
|
286
|
-
function
|
|
287
|
+
function Vt(e, t, r) {
|
|
287
288
|
return re(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
|
|
288
289
|
var o;
|
|
289
290
|
return (o = t[n]) === null || o === void 0 ? void 0 : o.call(t, e.current[n]);
|
|
290
291
|
}), r;
|
|
291
292
|
}
|
|
292
|
-
var
|
|
293
|
-
create:
|
|
294
|
-
},
|
|
293
|
+
var kt = {
|
|
294
|
+
create: Tt
|
|
295
|
+
}, At = {
|
|
295
296
|
paths: {
|
|
296
297
|
vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"
|
|
297
298
|
}
|
|
298
299
|
};
|
|
299
|
-
function
|
|
300
|
+
function Ht(e) {
|
|
300
301
|
return function t() {
|
|
301
302
|
for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
|
|
302
303
|
o[i] = arguments[i];
|
|
303
304
|
return o.length >= e.length ? e.apply(this, o) : function() {
|
|
304
|
-
for (var a = arguments.length, u = new Array(a),
|
|
305
|
-
u[
|
|
305
|
+
for (var a = arguments.length, u = new Array(a), l = 0; l < a; l++)
|
|
306
|
+
u[l] = arguments[l];
|
|
306
307
|
return t.apply(r, [].concat(o, u));
|
|
307
308
|
};
|
|
308
309
|
};
|
|
309
310
|
}
|
|
310
|
-
function
|
|
311
|
+
function Rt(e) {
|
|
311
312
|
return {}.toString.call(e).includes("Object");
|
|
312
313
|
}
|
|
313
|
-
function
|
|
314
|
-
return e ||
|
|
314
|
+
function Ut(e) {
|
|
315
|
+
return e || _e("configIsRequired"), Rt(e) || _e("configType"), e.urls ? (zt(), {
|
|
315
316
|
paths: {
|
|
316
317
|
vs: e.urls.monacoBase
|
|
317
318
|
}
|
|
318
319
|
}) : e;
|
|
319
320
|
}
|
|
320
|
-
function
|
|
321
|
-
console.warn(
|
|
321
|
+
function zt() {
|
|
322
|
+
console.warn(Re.deprecation);
|
|
322
323
|
}
|
|
323
|
-
function
|
|
324
|
+
function Ft(e, t) {
|
|
324
325
|
throw new Error(e[t] || e.default);
|
|
325
326
|
}
|
|
326
|
-
var
|
|
327
|
+
var Re = {
|
|
327
328
|
configIsRequired: "the configuration object is required",
|
|
328
329
|
configType: "the configuration object should be an object",
|
|
329
330
|
default: "an unknown error accured in `@monaco-editor/loader` package",
|
|
@@ -337,9 +338,9 @@ var Ae = {
|
|
|
337
338
|
|
|
338
339
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
339
340
|
`
|
|
340
|
-
},
|
|
341
|
-
config:
|
|
342
|
-
},
|
|
341
|
+
}, _e = Ht(Ft)(Re), Wt = {
|
|
342
|
+
config: Ut
|
|
343
|
+
}, qt = function() {
|
|
343
344
|
for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
|
|
344
345
|
r[n] = arguments[n];
|
|
345
346
|
return function(o) {
|
|
@@ -348,42 +349,42 @@ var Ae = {
|
|
|
348
349
|
}, o);
|
|
349
350
|
};
|
|
350
351
|
};
|
|
351
|
-
function
|
|
352
|
+
function Ue(e, t) {
|
|
352
353
|
return Object.keys(t).forEach(function(r) {
|
|
353
|
-
t[r] instanceof Object && e[r] && Object.assign(t[r],
|
|
354
|
-
}),
|
|
354
|
+
t[r] instanceof Object && e[r] && Object.assign(t[r], Ue(e[r], t[r]));
|
|
355
|
+
}), Ne(Ne({}, e), t);
|
|
355
356
|
}
|
|
356
|
-
var
|
|
357
|
+
var Bt = {
|
|
357
358
|
type: "cancelation",
|
|
358
359
|
msg: "operation is manually canceled"
|
|
359
360
|
};
|
|
360
|
-
function
|
|
361
|
+
function pe(e) {
|
|
361
362
|
var t = !1, r = new Promise(function(n, o) {
|
|
362
363
|
e.then(function(i) {
|
|
363
|
-
return t ? o(
|
|
364
|
+
return t ? o(Bt) : n(i);
|
|
364
365
|
}), e.catch(o);
|
|
365
366
|
});
|
|
366
367
|
return r.cancel = function() {
|
|
367
368
|
return t = !0;
|
|
368
369
|
}, r;
|
|
369
370
|
}
|
|
370
|
-
var
|
|
371
|
-
config:
|
|
371
|
+
var Kt = kt.create({
|
|
372
|
+
config: At,
|
|
372
373
|
isInitialized: !1,
|
|
373
374
|
resolve: null,
|
|
374
375
|
reject: null,
|
|
375
376
|
monaco: null
|
|
376
|
-
}),
|
|
377
|
-
function
|
|
378
|
-
var t =
|
|
379
|
-
|
|
377
|
+
}), ze = yt(Kt, 2), oe = ze[0], de = ze[1];
|
|
378
|
+
function Yt(e) {
|
|
379
|
+
var t = Wt.config(e), r = t.monaco, n = vt(t, ["monaco"]);
|
|
380
|
+
de(function(o) {
|
|
380
381
|
return {
|
|
381
|
-
config:
|
|
382
|
+
config: Ue(o.config, n),
|
|
382
383
|
monaco: r
|
|
383
384
|
};
|
|
384
385
|
});
|
|
385
386
|
}
|
|
386
|
-
function
|
|
387
|
+
function Gt() {
|
|
387
388
|
var e = oe(function(t) {
|
|
388
389
|
var r = t.monaco, n = t.isInitialized, o = t.resolve;
|
|
389
390
|
return {
|
|
@@ -393,36 +394,36 @@ function Ht() {
|
|
|
393
394
|
};
|
|
394
395
|
});
|
|
395
396
|
if (!e.isInitialized) {
|
|
396
|
-
if (
|
|
397
|
+
if (de({
|
|
397
398
|
isInitialized: !0
|
|
398
399
|
}), e.monaco)
|
|
399
|
-
return e.resolve(e.monaco),
|
|
400
|
+
return e.resolve(e.monaco), pe(me);
|
|
400
401
|
if (window.monaco && window.monaco.editor)
|
|
401
|
-
return
|
|
402
|
-
|
|
402
|
+
return Fe(window.monaco), e.resolve(window.monaco), pe(me);
|
|
403
|
+
qt(Zt, Qt)(Xt);
|
|
403
404
|
}
|
|
404
|
-
return
|
|
405
|
+
return pe(me);
|
|
405
406
|
}
|
|
406
|
-
function
|
|
407
|
+
function Zt(e) {
|
|
407
408
|
return document.body.appendChild(e);
|
|
408
409
|
}
|
|
409
|
-
function
|
|
410
|
+
function Jt(e) {
|
|
410
411
|
var t = document.createElement("script");
|
|
411
412
|
return e && (t.src = e), t;
|
|
412
413
|
}
|
|
413
|
-
function
|
|
414
|
+
function Qt(e) {
|
|
414
415
|
var t = oe(function(n) {
|
|
415
416
|
var o = n.config, i = n.reject;
|
|
416
417
|
return {
|
|
417
418
|
config: o,
|
|
418
419
|
reject: i
|
|
419
420
|
};
|
|
420
|
-
}), r =
|
|
421
|
+
}), r = Jt("".concat(t.config.paths.vs, "/loader.js"));
|
|
421
422
|
return r.onload = function() {
|
|
422
423
|
return e();
|
|
423
424
|
}, r.onerror = t.reject, r;
|
|
424
425
|
}
|
|
425
|
-
function
|
|
426
|
+
function Xt() {
|
|
426
427
|
var e = oe(function(r) {
|
|
427
428
|
var n = r.config, o = r.resolve, i = r.reject;
|
|
428
429
|
return {
|
|
@@ -432,204 +433,204 @@ function Kt() {
|
|
|
432
433
|
};
|
|
433
434
|
}), t = window.require;
|
|
434
435
|
t.config(e.config), t(["vs/editor/editor.main"], function(r) {
|
|
435
|
-
|
|
436
|
+
Fe(r), e.resolve(r);
|
|
436
437
|
}, function(r) {
|
|
437
438
|
e.reject(r);
|
|
438
439
|
});
|
|
439
440
|
}
|
|
440
|
-
function
|
|
441
|
-
oe().monaco ||
|
|
441
|
+
function Fe(e) {
|
|
442
|
+
oe().monaco || de({
|
|
442
443
|
monaco: e
|
|
443
444
|
});
|
|
444
445
|
}
|
|
445
|
-
function
|
|
446
|
+
function er() {
|
|
446
447
|
return oe(function(e) {
|
|
447
448
|
var t = e.monaco;
|
|
448
449
|
return t;
|
|
449
450
|
});
|
|
450
451
|
}
|
|
451
|
-
var
|
|
452
|
-
return
|
|
452
|
+
var me = new Promise(function(e, t) {
|
|
453
|
+
return de({
|
|
453
454
|
resolve: e,
|
|
454
455
|
reject: t
|
|
455
456
|
});
|
|
456
|
-
}),
|
|
457
|
-
config:
|
|
458
|
-
init:
|
|
459
|
-
__getMonacoInstance:
|
|
460
|
-
},
|
|
461
|
-
function
|
|
462
|
-
return
|
|
463
|
-
}
|
|
464
|
-
var
|
|
465
|
-
function
|
|
466
|
-
return
|
|
467
|
-
}
|
|
468
|
-
var
|
|
469
|
-
function
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
var
|
|
473
|
-
function
|
|
474
|
-
let n =
|
|
475
|
-
|
|
457
|
+
}), q = {
|
|
458
|
+
config: Yt,
|
|
459
|
+
init: Gt,
|
|
460
|
+
__getMonacoInstance: er
|
|
461
|
+
}, tr = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, ge = tr, rr = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, nr = rr;
|
|
462
|
+
function or({ children: e }) {
|
|
463
|
+
return Y.createElement("div", { style: nr.container }, e);
|
|
464
|
+
}
|
|
465
|
+
var ir = or, ar = ir;
|
|
466
|
+
function cr({ width: e, height: t, isEditorReady: r, loading: n, _ref: o, className: i, wrapperProps: a }) {
|
|
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
|
+
}
|
|
469
|
+
var sr = cr, We = Me(sr);
|
|
470
|
+
function ur(e) {
|
|
471
|
+
N(e, []);
|
|
472
|
+
}
|
|
473
|
+
var Se = ur;
|
|
474
|
+
function lr(e, t, r = !0) {
|
|
475
|
+
let n = v(!0);
|
|
476
|
+
N(n.current || !r ? () => {
|
|
476
477
|
n.current = !1;
|
|
477
478
|
} : e, t);
|
|
478
479
|
}
|
|
479
|
-
var
|
|
480
|
+
var z = lr;
|
|
480
481
|
function ee() {
|
|
481
482
|
}
|
|
482
483
|
function Z(e, t, r, n) {
|
|
483
|
-
return
|
|
484
|
+
return dr(e, n) || fr(e, t, r, n);
|
|
484
485
|
}
|
|
485
|
-
function
|
|
486
|
-
return e.editor.getModel(
|
|
486
|
+
function dr(e, t) {
|
|
487
|
+
return e.editor.getModel(qe(e, t));
|
|
487
488
|
}
|
|
488
|
-
function
|
|
489
|
-
return e.editor.createModel(t, r, n ?
|
|
489
|
+
function fr(e, t, r, n) {
|
|
490
|
+
return e.editor.createModel(t, r, n ? qe(e, n) : void 0);
|
|
490
491
|
}
|
|
491
|
-
function
|
|
492
|
+
function qe(e, t) {
|
|
492
493
|
return e.Uri.parse(t);
|
|
493
494
|
}
|
|
494
|
-
function
|
|
495
|
-
let [
|
|
496
|
-
|
|
497
|
-
let c =
|
|
498
|
-
return c.then((
|
|
499
|
-
}),
|
|
500
|
-
if (
|
|
501
|
-
let c =
|
|
502
|
-
|
|
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: h = "Loading...", options: f = {}, height: y = "100%", width: $ = "100%", className: g, wrapperProps: L = {}, beforeMount: T = ee, onMount: I = ee }) {
|
|
496
|
+
let [E, V] = R(!1), [_, b] = R(!0), C = v(null), M = v(null), j = v(null), x = v(I), s = v(T), O = v(!1);
|
|
497
|
+
Se(() => {
|
|
498
|
+
let c = q.init();
|
|
499
|
+
return c.then((w) => (M.current = w) && b(!1)).catch((w) => (w == null ? void 0 : w.type) !== "cancelation" && console.error("Monaco initialization: error:", w)), () => C.current ? S() : c.cancel();
|
|
500
|
+
}), z(() => {
|
|
501
|
+
if (C.current && M.current) {
|
|
502
|
+
let c = C.current.getOriginalEditor(), w = Z(M.current, e || "", n || r || "text", i || "");
|
|
503
|
+
w !== c.getModel() && c.setModel(w);
|
|
503
504
|
}
|
|
504
|
-
}, [i],
|
|
505
|
-
if (
|
|
506
|
-
let c =
|
|
507
|
-
|
|
505
|
+
}, [i], E), z(() => {
|
|
506
|
+
if (C.current && M.current) {
|
|
507
|
+
let c = C.current.getModifiedEditor(), w = Z(M.current, t || "", o || r || "text", a || "");
|
|
508
|
+
w !== c.getModel() && c.setModel(w);
|
|
508
509
|
}
|
|
509
|
-
}, [a],
|
|
510
|
-
let c =
|
|
511
|
-
c.getOption(
|
|
512
|
-
}, [t],
|
|
513
|
-
var c,
|
|
514
|
-
(
|
|
515
|
-
}, [e],
|
|
516
|
-
let { original: c, modified:
|
|
517
|
-
|
|
518
|
-
}, [r, n, o],
|
|
510
|
+
}, [a], E), z(() => {
|
|
511
|
+
let c = C.current.getModifiedEditor();
|
|
512
|
+
c.getOption(M.current.editor.EditorOption.readOnly) ? c.setValue(t || "") : t !== c.getValue() && (c.executeEdits("", [{ range: c.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), c.pushUndoStop());
|
|
513
|
+
}, [t], E), z(() => {
|
|
514
|
+
var c, w;
|
|
515
|
+
(w = (c = C.current) == null ? void 0 : c.getModel()) == null || w.original.setValue(e || "");
|
|
516
|
+
}, [e], E), z(() => {
|
|
517
|
+
let { original: c, modified: w } = C.current.getModel();
|
|
518
|
+
M.current.editor.setModelLanguage(c, n || r || "text"), M.current.editor.setModelLanguage(w, o || r || "text");
|
|
519
|
+
}, [r, n, o], E), z(() => {
|
|
519
520
|
var c;
|
|
520
|
-
(c =
|
|
521
|
-
}, [
|
|
521
|
+
(c = M.current) == null || c.editor.setTheme(d);
|
|
522
|
+
}, [d], E), z(() => {
|
|
522
523
|
var c;
|
|
523
|
-
(c =
|
|
524
|
-
}, [
|
|
525
|
-
let
|
|
526
|
-
var
|
|
527
|
-
if (!
|
|
524
|
+
(c = C.current) == null || c.updateOptions(f);
|
|
525
|
+
}, [f], E);
|
|
526
|
+
let m = J(() => {
|
|
527
|
+
var H;
|
|
528
|
+
if (!M.current)
|
|
528
529
|
return;
|
|
529
|
-
|
|
530
|
-
let c = Z(
|
|
531
|
-
(
|
|
532
|
-
}, [r, t, o, e, n, i, a]),
|
|
530
|
+
s.current(M.current);
|
|
531
|
+
let c = Z(M.current, e || "", n || r || "text", i || ""), w = Z(M.current, t || "", o || r || "text", a || "");
|
|
532
|
+
(H = C.current) == null || H.setModel({ original: c, modified: w });
|
|
533
|
+
}, [r, t, o, e, n, i, a]), p = J(() => {
|
|
533
534
|
var c;
|
|
534
|
-
!
|
|
535
|
-
}, [
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}, [
|
|
539
|
-
!
|
|
540
|
-
}, [
|
|
541
|
-
function
|
|
542
|
-
var
|
|
543
|
-
let c = (
|
|
544
|
-
u || ((
|
|
535
|
+
!O.current && j.current && (C.current = M.current.editor.createDiffEditor(j.current, { automaticLayout: !0, ...f }), m(), (c = M.current) == null || c.editor.setTheme(d), V(!0), O.current = !0);
|
|
536
|
+
}, [f, d, m]);
|
|
537
|
+
N(() => {
|
|
538
|
+
E && x.current(C.current, M.current);
|
|
539
|
+
}, [E]), N(() => {
|
|
540
|
+
!_ && !E && p();
|
|
541
|
+
}, [_, E, p]);
|
|
542
|
+
function S() {
|
|
543
|
+
var w, H, W, B;
|
|
544
|
+
let c = (w = C.current) == null ? void 0 : w.getModel();
|
|
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();
|
|
545
546
|
}
|
|
546
|
-
return
|
|
547
|
+
return Y.createElement(We, { width: $, height: y, isEditorReady: E, loading: h, _ref: j, className: g, wrapperProps: L });
|
|
547
548
|
}
|
|
548
|
-
var
|
|
549
|
-
function
|
|
550
|
-
let [e, t] =
|
|
551
|
-
return
|
|
549
|
+
var mr = pr, gr = Me(mr);
|
|
550
|
+
function hr() {
|
|
551
|
+
let [e, t] = R(q.__getMonacoInstance());
|
|
552
|
+
return Se(() => {
|
|
552
553
|
let r;
|
|
553
|
-
return e || (r =
|
|
554
|
+
return e || (r = q.init(), r.then((n) => {
|
|
554
555
|
t(n);
|
|
555
556
|
})), () => r == null ? void 0 : r.cancel();
|
|
556
557
|
}), e;
|
|
557
558
|
}
|
|
558
|
-
var
|
|
559
|
-
function
|
|
560
|
-
let t =
|
|
561
|
-
return
|
|
559
|
+
var ie = hr;
|
|
560
|
+
function vr(e) {
|
|
561
|
+
let t = v();
|
|
562
|
+
return N(() => {
|
|
562
563
|
t.current = e;
|
|
563
564
|
}, [e]), t.current;
|
|
564
565
|
}
|
|
565
|
-
var
|
|
566
|
-
function
|
|
567
|
-
let [
|
|
568
|
-
|
|
569
|
-
let
|
|
570
|
-
return
|
|
571
|
-
}),
|
|
572
|
-
var
|
|
573
|
-
let
|
|
574
|
-
|
|
575
|
-
}, [i],
|
|
576
|
-
var
|
|
577
|
-
(
|
|
578
|
-
}, [
|
|
579
|
-
!
|
|
580
|
-
}, [n],
|
|
581
|
-
var
|
|
582
|
-
let
|
|
583
|
-
|
|
584
|
-
}, [o],
|
|
585
|
-
var
|
|
586
|
-
u !== void 0 && ((
|
|
587
|
-
}, [u],
|
|
588
|
-
var
|
|
589
|
-
(
|
|
590
|
-
}, [a],
|
|
591
|
-
let
|
|
592
|
-
var
|
|
593
|
-
if (!(!
|
|
594
|
-
|
|
595
|
-
let
|
|
596
|
-
|
|
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: h = {}, saveViewState: f = !0, keepCurrentModel: y = !1, width: $ = "100%", height: g = "100%", className: L, wrapperProps: T = {}, beforeMount: I = ee, onMount: E = ee, onChange: V, onValidate: _ = ee }) {
|
|
568
|
+
let [b, C] = R(!1), [M, j] = R(!0), x = v(null), s = v(null), O = v(null), m = v(E), p = v(I), S = v(), c = v(n), w = yr(i), H = v(!1), W = v(!1);
|
|
569
|
+
Se(() => {
|
|
570
|
+
let P = q.init();
|
|
571
|
+
return P.then((D) => (x.current = D) && j(!1)).catch((D) => (D == null ? void 0 : D.type) !== "cancelation" && console.error("Monaco initialization: error:", D)), () => s.current ? et() : P.cancel();
|
|
572
|
+
}), z(() => {
|
|
573
|
+
var D, U, Q, G;
|
|
574
|
+
let P = Z(x.current, e || n || "", t || o || "", i || r || "");
|
|
575
|
+
P !== ((D = s.current) == null ? void 0 : D.getModel()) && (f && ue.set(w, (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], b), z(() => {
|
|
577
|
+
var P;
|
|
578
|
+
(P = s.current) == null || P.updateOptions(d);
|
|
579
|
+
}, [d], b), z(() => {
|
|
580
|
+
!s.current || n === void 0 || (s.current.getOption(x.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], b), z(() => {
|
|
582
|
+
var D, U;
|
|
583
|
+
let P = (D = s.current) == null ? void 0 : D.getModel();
|
|
584
|
+
P && o && ((U = x.current) == null || U.editor.setModelLanguage(P, o));
|
|
585
|
+
}, [o], b), z(() => {
|
|
586
|
+
var P;
|
|
587
|
+
u !== void 0 && ((P = s.current) == null || P.revealLine(u));
|
|
588
|
+
}, [u], b), z(() => {
|
|
589
|
+
var P;
|
|
590
|
+
(P = x.current) == null || P.editor.setTheme(a);
|
|
591
|
+
}, [a], b);
|
|
592
|
+
let B = J(() => {
|
|
593
|
+
var P;
|
|
594
|
+
if (!(!O.current || !x.current) && !H.current) {
|
|
595
|
+
p.current(x.current);
|
|
596
|
+
let D = i || r, U = Z(x.current, n || e || "", t || o || "", D || "");
|
|
597
|
+
s.current = (P = x.current) == null ? void 0 : P.editor.create(O.current, { model: U, automaticLayout: !0, ...d }, h), f && s.current.restoreViewState(ue.get(D)), x.current.editor.setTheme(a), u !== void 0 && s.current.revealLine(u), C(!0), H.current = !0;
|
|
597
598
|
}
|
|
598
|
-
}, [e, t, r, n, o, i,
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}, [
|
|
602
|
-
!
|
|
603
|
-
}, [
|
|
604
|
-
var
|
|
605
|
-
|
|
606
|
-
|
|
599
|
+
}, [e, t, r, n, o, i, d, h, f, a, u]);
|
|
600
|
+
N(() => {
|
|
601
|
+
b && m.current(s.current, x.current);
|
|
602
|
+
}, [b]), N(() => {
|
|
603
|
+
!M && !b && B();
|
|
604
|
+
}, [M, b, B]), c.current = n, N(() => {
|
|
605
|
+
var P, D;
|
|
606
|
+
b && V && ((P = S.current) == null || P.dispose(), S.current = (D = s.current) == null ? void 0 : D.onDidChangeModelContent((U) => {
|
|
607
|
+
W.current || V(s.current.getValue(), U);
|
|
607
608
|
}));
|
|
608
|
-
}, [
|
|
609
|
-
if (
|
|
610
|
-
let
|
|
609
|
+
}, [b, V]), N(() => {
|
|
610
|
+
if (b) {
|
|
611
|
+
let P = x.current.editor.onDidChangeMarkers((D) => {
|
|
611
612
|
var Q;
|
|
612
|
-
let
|
|
613
|
-
if (
|
|
614
|
-
let
|
|
615
|
-
|
|
613
|
+
let U = (Q = s.current.getModel()) == null ? void 0 : Q.uri;
|
|
614
|
+
if (U && D.find((G) => G.path === U.path)) {
|
|
615
|
+
let G = x.current.editor.getModelMarkers({ resource: U });
|
|
616
|
+
_ == null || _(G);
|
|
616
617
|
}
|
|
617
618
|
});
|
|
618
619
|
return () => {
|
|
619
|
-
|
|
620
|
+
P == null || P.dispose();
|
|
620
621
|
};
|
|
621
622
|
}
|
|
622
623
|
return () => {
|
|
623
624
|
};
|
|
624
|
-
}, [
|
|
625
|
-
function
|
|
626
|
-
var
|
|
627
|
-
(
|
|
625
|
+
}, [b, _]);
|
|
626
|
+
function et() {
|
|
627
|
+
var P, D;
|
|
628
|
+
(P = S.current) == null || P.dispose(), y ? f && ue.set(i, s.current.saveViewState()) : (D = s.current.getModel()) == null || D.dispose(), s.current.dispose();
|
|
628
629
|
}
|
|
629
|
-
return
|
|
630
|
+
return Y.createElement(We, { width: $, height: g, isEditorReady: b, loading: l, _ref: O, className: L, wrapperProps: T });
|
|
630
631
|
}
|
|
631
|
-
var
|
|
632
|
-
const
|
|
632
|
+
var wr = br, Mr = Me(wr), fe = Mr;
|
|
633
|
+
const ae = {
|
|
633
634
|
selectOnLineNumbers: !0,
|
|
634
635
|
scrollBeyondLastLine: !1,
|
|
635
636
|
padding: {
|
|
@@ -650,28 +651,28 @@ const le = {
|
|
|
650
651
|
overviewRulerLanes: 0,
|
|
651
652
|
renderLineHighlight: "none",
|
|
652
653
|
automaticLayout: !0
|
|
653
|
-
},
|
|
654
|
-
const { themeConfig: t, editor: r, theme: n } = e, { defaultTheme: o } = t ?? {}, [i, a] =
|
|
655
|
-
return
|
|
654
|
+
}, ce = (e) => {
|
|
655
|
+
const { themeConfig: t, editor: r, theme: n } = e, { defaultTheme: o } = t ?? {}, [i, a] = R(n ?? o ?? "vs-dark");
|
|
656
|
+
return N(() => {
|
|
656
657
|
var u;
|
|
657
|
-
(u = t == null ? void 0 : t.monacoThemes) == null || u.forEach((
|
|
658
|
-
|
|
658
|
+
(u = t == null ? void 0 : t.monacoThemes) == null || u.forEach((l) => {
|
|
659
|
+
F.editor.defineTheme(l.themeName, l.themeData);
|
|
659
660
|
});
|
|
660
|
-
}, [
|
|
661
|
-
|
|
661
|
+
}, [F]), N(() => {
|
|
662
|
+
F.editor && n && (F.editor.setTheme(n), a(n));
|
|
662
663
|
}, [r, n]), { theme: i };
|
|
663
664
|
};
|
|
664
|
-
function
|
|
665
|
+
function Ee(e) {
|
|
665
666
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
666
667
|
let r = "";
|
|
667
668
|
for (let n = 0; n < e; n++)
|
|
668
669
|
r += t.charAt(Math.floor(Math.random() * t.length));
|
|
669
670
|
return r;
|
|
670
671
|
}
|
|
671
|
-
function
|
|
672
|
+
function Or(e) {
|
|
672
673
|
return e.replace("'", "'");
|
|
673
674
|
}
|
|
674
|
-
const
|
|
675
|
+
const Sr = (e) => {
|
|
675
676
|
const t = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
676
677
|
if (e < 60)
|
|
677
678
|
return t.format(-e, "second");
|
|
@@ -689,11 +690,11 @@ const yr = (e) => {
|
|
|
689
690
|
return t.format(-i, "month");
|
|
690
691
|
const a = Math.floor(i / 12);
|
|
691
692
|
return t.format(-a, "year");
|
|
692
|
-
},
|
|
693
|
+
}, Er = (e) => {
|
|
693
694
|
const t = new Date(e), n = Math.floor(((/* @__PURE__ */ new Date()).getTime() - t.getTime()) / 1e3), o = Math.abs(n);
|
|
694
|
-
return
|
|
695
|
+
return Sr(o);
|
|
695
696
|
};
|
|
696
|
-
function
|
|
697
|
+
function Be({
|
|
697
698
|
instanceId: e,
|
|
698
699
|
lineNumbersPosition: t
|
|
699
700
|
}) {
|
|
@@ -726,7 +727,7 @@ function wr({
|
|
|
726
727
|
color: var(--cn-text-1);
|
|
727
728
|
}`, r;
|
|
728
729
|
}
|
|
729
|
-
function
|
|
730
|
+
function xr({
|
|
730
731
|
instanceId: e,
|
|
731
732
|
blameData: t,
|
|
732
733
|
dateWidth: r,
|
|
@@ -734,35 +735,39 @@ function Or({
|
|
|
734
735
|
}) {
|
|
735
736
|
let o = "";
|
|
736
737
|
return t.forEach((i) => {
|
|
737
|
-
var
|
|
738
|
-
const a = (
|
|
739
|
-
for (let
|
|
740
|
-
|
|
741
|
-
.monaco-editor-${e} .view-line .blame-editor-commit-${
|
|
742
|
-
content: '${
|
|
738
|
+
var d, h, f, y, $, g, L, T;
|
|
739
|
+
const a = (h = (d = i == null ? void 0 : i.commitInfo) == null ? void 0 : d.author) == null ? void 0 : h.avatarUrl, u = (y = (f = i == null ? void 0 : i.commitInfo) == null ? void 0 : f.author) == null ? void 0 : y.initials, l = a ? `background: url('${(g = ($ = i == null ? void 0 : i.commitInfo) == null ? void 0 : $.author) == null ? void 0 : g.avatarUrl}');` : "";
|
|
740
|
+
for (let I = i.fromLineNumber; I <= i.toLineNumber; I++)
|
|
741
|
+
I === i.fromLineNumber ? o += `
|
|
742
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${I}:before {
|
|
743
|
+
content: '${Or(Er(((T = (L = i == null ? void 0 : i.commitInfo) == null ? void 0 : L.author) == null ? void 0 : T.when) || ""))}';
|
|
743
744
|
position: absolute;
|
|
744
745
|
left: 10px;
|
|
745
746
|
top: 0px;
|
|
746
747
|
color: var(--cn-text-3);
|
|
747
748
|
}
|
|
748
749
|
|
|
749
|
-
.monaco-editor-${e} .view-line .blame-editor-commit-${
|
|
750
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${I}:after {
|
|
750
751
|
content: '${u ?? " "}';
|
|
751
752
|
position: absolute;
|
|
752
753
|
border-radius: 50%;
|
|
753
754
|
padding: 4px;
|
|
754
755
|
text-align: center;
|
|
755
|
-
background: var(--cn-set-gray-soft-bg);
|
|
756
756
|
line-height: 17px;
|
|
757
757
|
left: ${r + 10}px;
|
|
758
|
-
top: -
|
|
759
|
-
|
|
758
|
+
top: -2px;
|
|
759
|
+
box-shadow: var(--cn-shadow-comp-avatar-inner);
|
|
760
|
+
font-size: var(--cn-font-size-0);
|
|
761
|
+
font-weight: var(--cn-font-weight-default-normal-500);
|
|
762
|
+
background-color: var(--cn-set-brand-secondary-bg);
|
|
763
|
+
color: var(--cn-set-brand-secondary-text);
|
|
764
|
+
font-family: var(--font-family);
|
|
760
765
|
width: ${n}px;
|
|
761
766
|
height: ${n}px;
|
|
762
|
-
${
|
|
767
|
+
${l}
|
|
763
768
|
background-size: 100% 100%;
|
|
764
769
|
}` : o += `
|
|
765
|
-
.monaco-editor-${e} .view-line .blame-editor-commit-${
|
|
770
|
+
.monaco-editor-${e} .view-line .blame-editor-commit-${I}:before {
|
|
766
771
|
content: ' ';
|
|
767
772
|
left: 10px;
|
|
768
773
|
top: 0px;
|
|
@@ -770,13 +775,13 @@ function Or({
|
|
|
770
775
|
}`;
|
|
771
776
|
}), o;
|
|
772
777
|
}
|
|
773
|
-
function
|
|
778
|
+
function Ke(e, t) {
|
|
774
779
|
let r = "";
|
|
775
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);
|
|
776
781
|
}
|
|
777
|
-
|
|
778
|
-
const he = 450,
|
|
779
|
-
...
|
|
782
|
+
q.config({ monaco: F });
|
|
783
|
+
const he = 450, jr = 30, Pr = 140, Cr = 24, $r = {
|
|
784
|
+
...ae,
|
|
780
785
|
readOnly: !0,
|
|
781
786
|
matchBrackets: "never",
|
|
782
787
|
renderValidationDecorations: "off",
|
|
@@ -786,7 +791,7 @@ const he = 450, Sr = 30, jr = 140, Er = 24, Pr = {
|
|
|
786
791
|
renderWhitespace: "none",
|
|
787
792
|
renderLineHighlight: "none"
|
|
788
793
|
};
|
|
789
|
-
function
|
|
794
|
+
function tn({
|
|
790
795
|
code: e,
|
|
791
796
|
language: t,
|
|
792
797
|
themeConfig: r,
|
|
@@ -795,160 +800,426 @@ function qr({
|
|
|
795
800
|
showSeparators: i = !0,
|
|
796
801
|
theme: a,
|
|
797
802
|
height: u = "75vh",
|
|
798
|
-
options:
|
|
799
|
-
className:
|
|
803
|
+
options: l,
|
|
804
|
+
className: d
|
|
800
805
|
}) {
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
const [
|
|
804
|
-
|
|
805
|
-
|
|
806
|
+
const h = v(o), f = v(null), y = v(Ee(5));
|
|
807
|
+
ie();
|
|
808
|
+
const [$, g] = R(), L = v(null), T = v(null);
|
|
809
|
+
N(() => {
|
|
810
|
+
h.current = o;
|
|
806
811
|
}, [o]);
|
|
807
|
-
function
|
|
808
|
-
const
|
|
809
|
-
if (!
|
|
812
|
+
function I() {
|
|
813
|
+
const s = T.current, O = L.current;
|
|
814
|
+
if (!s || !O)
|
|
810
815
|
return;
|
|
811
|
-
i &&
|
|
812
|
-
|
|
816
|
+
i && s.changeViewZones(function(p) {
|
|
817
|
+
p.addZone({
|
|
813
818
|
afterLineNumber: 0,
|
|
814
819
|
heightInPx: 10,
|
|
815
820
|
domNode: document.createElement("div")
|
|
816
|
-
}),
|
|
817
|
-
if (c !==
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
afterLineNumber:
|
|
821
|
+
}), h.current.forEach((S, c) => {
|
|
822
|
+
if (c !== h.current.length - 1) {
|
|
823
|
+
const w = document.createElement("div");
|
|
824
|
+
w.style.borderTop = "1px solid var(--cn-border-2)", w.style.marginTop = "9px", w.className = "blame-editor-separator", p.addZone({
|
|
825
|
+
afterLineNumber: S.toLineNumber,
|
|
821
826
|
heightInPx: 20,
|
|
822
|
-
domNode:
|
|
827
|
+
domNode: w
|
|
823
828
|
});
|
|
824
829
|
}
|
|
825
830
|
});
|
|
826
831
|
});
|
|
827
|
-
const
|
|
828
|
-
|
|
829
|
-
var
|
|
830
|
-
for (let c =
|
|
831
|
-
|
|
832
|
-
range: new
|
|
832
|
+
const m = [];
|
|
833
|
+
h.current.forEach((p) => {
|
|
834
|
+
var S;
|
|
835
|
+
for (let c = p.fromLineNumber; c <= p.toLineNumber; c++)
|
|
836
|
+
m.push({
|
|
837
|
+
range: new O.Range(c, 0, c + 1, 0),
|
|
833
838
|
options: {
|
|
834
839
|
before: {
|
|
835
|
-
content:
|
|
836
|
-
c ===
|
|
837
|
-
|
|
840
|
+
content: Ke(
|
|
841
|
+
c === p.fromLineNumber && ((S = p == null ? void 0 : p.commitInfo) == null ? void 0 : S.title) || "",
|
|
842
|
+
jr
|
|
838
843
|
),
|
|
839
|
-
cursorStops:
|
|
844
|
+
cursorStops: O.editor.InjectedTextCursorStops.None,
|
|
840
845
|
inlineClassName: `blame-editor-commit blame-editor-commit-${c}`
|
|
841
846
|
}
|
|
842
847
|
}
|
|
843
848
|
});
|
|
844
|
-
}),
|
|
849
|
+
}), s.createDecorationsCollection(m);
|
|
845
850
|
}
|
|
846
|
-
function
|
|
847
|
-
var
|
|
848
|
-
|
|
851
|
+
function E(s, O) {
|
|
852
|
+
var m, p, S, c, w, H;
|
|
853
|
+
T.current = s, L.current = O, s.setValue(e), g(s), (S = (p = (m = O.languages.typescript) == null ? void 0 : m.typescriptDefaults) == null ? void 0 : p.setDiagnosticsOptions) == null || S.call(p, {
|
|
849
854
|
noSuggestionDiagnostics: !0,
|
|
850
855
|
noSyntaxValidation: !0,
|
|
851
856
|
noSemanticValidation: !0
|
|
852
|
-
}), (
|
|
857
|
+
}), (H = (w = (c = O.languages.typescript) == null ? void 0 : c.javascriptDefaults) == null ? void 0 : w.setDiagnosticsOptions) == null || H.call(w, {
|
|
853
858
|
noSuggestionDiagnostics: !0,
|
|
854
859
|
noSyntaxValidation: !0,
|
|
855
860
|
noSemanticValidation: !0
|
|
856
|
-
}),
|
|
861
|
+
}), I();
|
|
857
862
|
}
|
|
858
|
-
|
|
859
|
-
|
|
863
|
+
N(() => {
|
|
864
|
+
$ == null || $.setValue(e);
|
|
860
865
|
}, [e]);
|
|
861
|
-
const { theme:
|
|
862
|
-
() =>
|
|
863
|
-
instanceId:
|
|
866
|
+
const { theme: V } = ce({ monacoRef: L, themeConfig: r, editor: $, theme: a }), _ = k(
|
|
867
|
+
() => Be({
|
|
868
|
+
instanceId: y.current,
|
|
864
869
|
lineNumbersPosition: n
|
|
865
870
|
}),
|
|
866
871
|
[o]
|
|
867
|
-
),
|
|
868
|
-
() =>
|
|
869
|
-
instanceId:
|
|
872
|
+
), b = k(
|
|
873
|
+
() => xr({
|
|
874
|
+
instanceId: y.current,
|
|
870
875
|
blameData: o,
|
|
871
|
-
avatarSize:
|
|
872
|
-
dateWidth:
|
|
876
|
+
avatarSize: Cr,
|
|
877
|
+
dateWidth: Pr
|
|
873
878
|
}),
|
|
874
879
|
[o]
|
|
875
880
|
);
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
}, []),
|
|
879
|
-
if (n === "center" &&
|
|
880
|
-
const
|
|
881
|
-
if (
|
|
882
|
-
const
|
|
883
|
-
const
|
|
884
|
-
|
|
885
|
-
},
|
|
886
|
-
return
|
|
887
|
-
|
|
881
|
+
Ve(() => {
|
|
882
|
+
f.current && f.current.style.setProperty("--line-number-display", "none");
|
|
883
|
+
}, []), N(() => {
|
|
884
|
+
if (n === "center" && f.current) {
|
|
885
|
+
const s = f.current.getElementsByClassName("lines-content")[0];
|
|
886
|
+
if (s) {
|
|
887
|
+
const O = { attributes: !0 }, m = () => {
|
|
888
|
+
const S = parseInt(getComputedStyle(s).left);
|
|
889
|
+
f.current && (f.current.style.setProperty("--line-number-offset", `${he + 16 + S}px`), f.current.style.setProperty("--line-number-display", "block"));
|
|
890
|
+
}, p = new MutationObserver(m);
|
|
891
|
+
return p.observe(s, O), m(), () => {
|
|
892
|
+
p.disconnect();
|
|
888
893
|
};
|
|
889
894
|
}
|
|
890
895
|
}
|
|
891
896
|
});
|
|
892
|
-
const
|
|
893
|
-
.monaco-editor-${
|
|
897
|
+
const C = k(() => `
|
|
898
|
+
.monaco-editor-${y.current} .margin {
|
|
894
899
|
display: var(--line-number-display);
|
|
895
900
|
left: var(--line-number-offset);
|
|
896
901
|
pointer-events: none;
|
|
897
|
-
}`, []),
|
|
902
|
+
}`, []), M = k(() => `.monaco-editor-${y.current} .view-overlays {
|
|
898
903
|
clip-path: polygon(${he + 16}px 0, 100% 0%, 100% 100%, ${he + 16}px 100%);
|
|
899
904
|
height:100% !important;
|
|
900
|
-
}`, []),
|
|
905
|
+
}`, []), j = k(
|
|
901
906
|
() => ({
|
|
902
|
-
|
|
903
|
-
...
|
|
907
|
+
...$r,
|
|
908
|
+
...l
|
|
904
909
|
}),
|
|
905
|
-
[
|
|
906
|
-
),
|
|
910
|
+
[l]
|
|
911
|
+
), x = k(() => /* @__PURE__ */ A.jsx(
|
|
907
912
|
"style",
|
|
908
913
|
{
|
|
909
914
|
dangerouslySetInnerHTML: {
|
|
910
|
-
__html: `${
|
|
915
|
+
__html: `${_} ${b} ${C} ${M}`
|
|
911
916
|
}
|
|
912
917
|
}
|
|
913
|
-
), [
|
|
914
|
-
return /* @__PURE__ */
|
|
915
|
-
|
|
916
|
-
/* @__PURE__ */
|
|
917
|
-
|
|
918
|
+
), [_, b, M, C]);
|
|
919
|
+
return /* @__PURE__ */ A.jsxs("div", { className: d, ref: f, children: [
|
|
920
|
+
x,
|
|
921
|
+
/* @__PURE__ */ A.jsx(
|
|
922
|
+
fe,
|
|
918
923
|
{
|
|
919
|
-
className: `monaco-editor-${
|
|
924
|
+
className: `monaco-editor-${y.current} overflow-hidden rounded-b-cn-3`,
|
|
920
925
|
height: u,
|
|
921
926
|
language: t,
|
|
922
|
-
theme:
|
|
923
|
-
options:
|
|
924
|
-
onMount:
|
|
927
|
+
theme: V,
|
|
928
|
+
options: j,
|
|
929
|
+
onMount: E
|
|
930
|
+
}
|
|
931
|
+
)
|
|
932
|
+
] });
|
|
933
|
+
}
|
|
934
|
+
q.config({ monaco: F });
|
|
935
|
+
const ve = 450, Ir = 30, Nr = {
|
|
936
|
+
...ae,
|
|
937
|
+
readOnly: !0,
|
|
938
|
+
matchBrackets: "never",
|
|
939
|
+
renderValidationDecorations: "off",
|
|
940
|
+
guides: { indentation: !1 },
|
|
941
|
+
folding: !1,
|
|
942
|
+
stickyScroll: { enabled: !1 },
|
|
943
|
+
renderWhitespace: "none",
|
|
944
|
+
renderLineHighlight: "none"
|
|
945
|
+
};
|
|
946
|
+
function rn({
|
|
947
|
+
code: e,
|
|
948
|
+
language: t,
|
|
949
|
+
themeConfig: r,
|
|
950
|
+
lineNumbersPosition: n = "left",
|
|
951
|
+
blameData: o,
|
|
952
|
+
theme: i,
|
|
953
|
+
height: a = "75vh",
|
|
954
|
+
options: u,
|
|
955
|
+
className: l
|
|
956
|
+
}) {
|
|
957
|
+
const d = v(o), h = v(null), f = v(Ee(5));
|
|
958
|
+
ie();
|
|
959
|
+
const [y, $] = R(), g = v(null), L = v(null);
|
|
960
|
+
N(() => {
|
|
961
|
+
d.current = o;
|
|
962
|
+
}, [o]);
|
|
963
|
+
function T() {
|
|
964
|
+
const j = L.current, x = g.current;
|
|
965
|
+
if (!j || !x)
|
|
966
|
+
return;
|
|
967
|
+
j.changeViewZones(function(O) {
|
|
968
|
+
O.addZone({
|
|
969
|
+
afterLineNumber: 0,
|
|
970
|
+
heightInPx: 1,
|
|
971
|
+
domNode: document.createElement("div")
|
|
972
|
+
}), d.current.forEach((m) => {
|
|
973
|
+
if (m.infoContent) {
|
|
974
|
+
const S = document.createElement("div");
|
|
975
|
+
S.className = "blame-editor-info-holder", S.style.position = "relative", S.style.zIndex = "100", S.style.overflow = "visible", Lr(S, m.infoContent), O.addZone({
|
|
976
|
+
afterLineNumber: m.fromLineNumber - 1,
|
|
977
|
+
heightInPx: 0,
|
|
978
|
+
domNode: S
|
|
979
|
+
});
|
|
980
|
+
}
|
|
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", O.addZone({
|
|
983
|
+
afterLineNumber: m.toLineNumber,
|
|
984
|
+
heightInPx: 20,
|
|
985
|
+
domNode: p
|
|
986
|
+
});
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
const s = [];
|
|
990
|
+
d.current.forEach((O) => {
|
|
991
|
+
for (let m = O.fromLineNumber; m <= O.toLineNumber; m++)
|
|
992
|
+
s.push({
|
|
993
|
+
range: new x.Range(m, 0, m + 1, 0),
|
|
994
|
+
options: {
|
|
995
|
+
before: {
|
|
996
|
+
content: Ke("", Ir),
|
|
997
|
+
cursorStops: x.editor.InjectedTextCursorStops.None,
|
|
998
|
+
inlineClassName: `blame-editor-commit blame-editor-commit-${m}`
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
}), j.createDecorationsCollection(s);
|
|
1003
|
+
}
|
|
1004
|
+
function I(j, x) {
|
|
1005
|
+
var s, O, m, p, S, c;
|
|
1006
|
+
L.current = j, g.current = x, j.setValue(e), $(j), (m = (O = (s = x.languages.typescript) == null ? void 0 : s.typescriptDefaults) == null ? void 0 : O.setDiagnosticsOptions) == null || m.call(O, {
|
|
1007
|
+
noSuggestionDiagnostics: !0,
|
|
1008
|
+
noSyntaxValidation: !0,
|
|
1009
|
+
noSemanticValidation: !0
|
|
1010
|
+
}), (c = (S = (p = x.languages.typescript) == null ? void 0 : p.javascriptDefaults) == null ? void 0 : S.setDiagnosticsOptions) == null || c.call(S, {
|
|
1011
|
+
noSuggestionDiagnostics: !0,
|
|
1012
|
+
noSyntaxValidation: !0,
|
|
1013
|
+
noSemanticValidation: !0
|
|
1014
|
+
}), T();
|
|
1015
|
+
}
|
|
1016
|
+
N(() => {
|
|
1017
|
+
y == null || y.setValue(e);
|
|
1018
|
+
}, [e]);
|
|
1019
|
+
const { theme: E } = ce({ monacoRef: g, themeConfig: r, editor: y, theme: i }), V = k(
|
|
1020
|
+
() => Be({
|
|
1021
|
+
instanceId: f.current,
|
|
1022
|
+
lineNumbersPosition: n
|
|
1023
|
+
}),
|
|
1024
|
+
[o]
|
|
1025
|
+
);
|
|
1026
|
+
Ve(() => {
|
|
1027
|
+
h.current && h.current.style.setProperty("--line-number-display", "none");
|
|
1028
|
+
}, []), N(() => {
|
|
1029
|
+
if (n === "center" && h.current) {
|
|
1030
|
+
const j = h.current.getElementsByClassName("lines-content")[0];
|
|
1031
|
+
if (j) {
|
|
1032
|
+
const x = { attributes: !0 }, s = () => {
|
|
1033
|
+
const m = parseInt(getComputedStyle(j).left);
|
|
1034
|
+
h.current && (h.current.style.setProperty("--line-number-offset", `${ve + 16 + m}px`), h.current.style.setProperty("--line-number-display", "block"));
|
|
1035
|
+
}, O = new MutationObserver(s);
|
|
1036
|
+
return O.observe(j, x), s(), () => {
|
|
1037
|
+
O.disconnect();
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
const _ = k(() => `
|
|
1043
|
+
.monaco-editor-${f.current} .margin {
|
|
1044
|
+
display: var(--line-number-display);
|
|
1045
|
+
left: var(--line-number-offset);
|
|
1046
|
+
pointer-events: none;
|
|
1047
|
+
}`, []), b = k(() => `.monaco-editor-${f.current} .view-overlays {
|
|
1048
|
+
clip-path: polygon(${ve + 16}px 0, 100% 0%, 100% 100%, ${ve + 16}px 100%);
|
|
1049
|
+
height:100% !important;
|
|
1050
|
+
}`, []), C = k(
|
|
1051
|
+
() => ({
|
|
1052
|
+
...Nr,
|
|
1053
|
+
...u
|
|
1054
|
+
}),
|
|
1055
|
+
[u]
|
|
1056
|
+
), M = k(() => /* @__PURE__ */ A.jsx(
|
|
1057
|
+
"style",
|
|
1058
|
+
{
|
|
1059
|
+
dangerouslySetInnerHTML: {
|
|
1060
|
+
__html: `${V} ${_} ${b}`
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
), [V, b, _]);
|
|
1064
|
+
return /* @__PURE__ */ A.jsxs("div", { className: l, ref: h, children: [
|
|
1065
|
+
M,
|
|
1066
|
+
/* @__PURE__ */ A.jsx(
|
|
1067
|
+
fe,
|
|
1068
|
+
{
|
|
1069
|
+
className: `monaco-editor-${f.current} overflow-hidden rounded-b-cn-3`,
|
|
1070
|
+
height: a,
|
|
1071
|
+
language: t,
|
|
1072
|
+
theme: E,
|
|
1073
|
+
options: C,
|
|
1074
|
+
onMount: I
|
|
925
1075
|
}
|
|
926
1076
|
)
|
|
927
1077
|
] });
|
|
928
1078
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1079
|
+
function Lr(e, t) {
|
|
1080
|
+
return new IntersectionObserver(
|
|
1081
|
+
([n], o) => {
|
|
1082
|
+
if (n.isIntersecting) {
|
|
1083
|
+
o.disconnect();
|
|
1084
|
+
const i = document.createElement("div");
|
|
1085
|
+
i.style.position = "absolute", i.style.top = "-2px", e.appendChild(i), at(t, i);
|
|
1086
|
+
}
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
root: document.querySelector(".monaco-scrollable-element"),
|
|
1090
|
+
threshold: 0.2
|
|
1091
|
+
}
|
|
1092
|
+
).observe(e), e;
|
|
1093
|
+
}
|
|
1094
|
+
function Tr(e) {
|
|
1095
|
+
const { editor: t, keyword: r } = e;
|
|
1096
|
+
N(() => {
|
|
1097
|
+
if (!t || !r)
|
|
1098
|
+
return;
|
|
1099
|
+
const n = t.getModel(), o = n.findMatches(r, !1, !1, !1, null, !1);
|
|
1100
|
+
o.length > 0 && o.forEach((i) => {
|
|
1101
|
+
n.deltaDecorations(
|
|
1102
|
+
[],
|
|
1103
|
+
[
|
|
1104
|
+
{
|
|
1105
|
+
range: i.range,
|
|
1106
|
+
options: {
|
|
1107
|
+
isWholeLine: !1,
|
|
1108
|
+
inlineClassName: "CodeEditor_HighlightedText"
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
]
|
|
1112
|
+
);
|
|
1113
|
+
});
|
|
1114
|
+
}, [t, r]);
|
|
1115
|
+
}
|
|
1116
|
+
function Dr(e) {
|
|
1117
|
+
const { enable: t, editor: r, onSelectedLineChange: n, selectedLine: o, onSelectedLineButtonClick: i } = e, a = v(null), u = v(!1), l = v(null);
|
|
1118
|
+
l.current = l.current ?? (r == null ? void 0 : r.createDecorationsCollection([])) ?? null, N(() => {
|
|
1119
|
+
let d;
|
|
1120
|
+
const h = setTimeout(() => {
|
|
1121
|
+
if (!t || !r)
|
|
1122
|
+
return;
|
|
1123
|
+
const f = (y) => {
|
|
1124
|
+
var g, L, T, I;
|
|
1125
|
+
if ((L = (g = y.target) == null ? void 0 : g.element) != null && L.classList.contains("CodeEditor_HighlightedGlyphMargin")) {
|
|
1126
|
+
i == null || i((T = y.target) == null ? void 0 : T.element);
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
const $ = _r((I = y.target) == null ? void 0 : I.element);
|
|
1130
|
+
if (!$) {
|
|
1131
|
+
n == null || n(void 0), i == null || i(void 0), ye(r, l.current, void 0);
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
u.current = !0, a.current = $, n == null || n($), ye(r, l.current, $, !1), i == null || i(void 0);
|
|
1135
|
+
};
|
|
1136
|
+
d = r.onMouseDown(f);
|
|
1137
|
+
}, 100);
|
|
1138
|
+
return () => {
|
|
1139
|
+
clearTimeout(h), d == null || d.dispose();
|
|
1140
|
+
};
|
|
1141
|
+
}, [u, o, n, t, r, i, l]), N(() => {
|
|
1142
|
+
r && a.current !== o && ye(r, l.current, o, !0);
|
|
1143
|
+
}, [r, o, l]);
|
|
1144
|
+
}
|
|
1145
|
+
function ye(e, t, r, n) {
|
|
1146
|
+
if (!r) {
|
|
1147
|
+
t == null || t.set([]);
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
t == null || t.set([
|
|
1151
|
+
{
|
|
1152
|
+
range: new F.Range(r, 1, r, 1),
|
|
1153
|
+
options: {
|
|
1154
|
+
isWholeLine: !0,
|
|
1155
|
+
className: "CodeEditor_HighlightedLine"
|
|
1156
|
+
// TODO: gonna be used if in the future
|
|
1157
|
+
// glyphMarginClassName: 'CodeEditor_HighlightedGlyphMargin'
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
]), e == null || e.setSelection(new F.Range(r, 0, r, 0)), n && (e == null || e.revealLineInCenter(r));
|
|
1161
|
+
}
|
|
1162
|
+
function _r(e) {
|
|
1163
|
+
const t = e != null && e.classList.contains("line-numbers") ? e : void 0;
|
|
1164
|
+
if (!t)
|
|
1165
|
+
return;
|
|
1166
|
+
const r = parseInt(t.textContent ?? "");
|
|
1167
|
+
if (!isNaN(r))
|
|
1168
|
+
return r;
|
|
1169
|
+
}
|
|
1170
|
+
const Vr = `.CodeEditor_HighlightedLine {
|
|
1171
|
+
opacity: 0.1;
|
|
1172
|
+
background-color: var(--cn-yellow-300, orange) !important;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
.CodeEditor_HighlightedText {
|
|
1176
|
+
background-color: var(--cn-yellow-100, orange) !important;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
.CodeEditor_HighlightedGlyphMargin {
|
|
1180
|
+
background: rgb(183, 183, 183);
|
|
1181
|
+
border: 1px solid gray;
|
|
1182
|
+
border-radius: 4px;
|
|
1183
|
+
margin-left: 5px;
|
|
1184
|
+
height: 20px;
|
|
1185
|
+
position: relative;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
.CodeEditor_HighlightedGlyphMargin::after {
|
|
1189
|
+
content: '...';
|
|
1190
|
+
position: absolute;
|
|
1191
|
+
padding: 7px 3px;
|
|
1192
|
+
}
|
|
1193
|
+
`;
|
|
1194
|
+
q.config({ monaco: F });
|
|
1195
|
+
const kr = {
|
|
1196
|
+
...ae
|
|
932
1197
|
};
|
|
933
|
-
function
|
|
1198
|
+
function nn({
|
|
934
1199
|
codeRevision: e,
|
|
935
1200
|
onCodeRevisionChange: t,
|
|
936
1201
|
language: r,
|
|
937
1202
|
themeConfig: n,
|
|
938
1203
|
options: o,
|
|
939
1204
|
theme: i,
|
|
940
|
-
|
|
941
|
-
|
|
1205
|
+
enableLinesSelection: a = !1,
|
|
1206
|
+
selectedLine: u,
|
|
1207
|
+
onSelectedLineChange: l,
|
|
1208
|
+
onSelectedLineButtonClick: d,
|
|
1209
|
+
highlightKeyword: h,
|
|
1210
|
+
height: f = "75vh",
|
|
1211
|
+
className: y
|
|
942
1212
|
}) {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1213
|
+
const $ = v(Ee(5));
|
|
1214
|
+
ie();
|
|
1215
|
+
const [g, L] = R(), T = v(), I = v({ code: "", revisionId: 0 }), E = v(null), V = J(
|
|
1216
|
+
(M, j) => {
|
|
1217
|
+
var x, s, O, m, p, S;
|
|
1218
|
+
E.current = M, T.current = j, M.setValue(e.code), L(M), (O = (s = (x = j.languages.typescript) == null ? void 0 : x.typescriptDefaults) == null ? void 0 : s.setDiagnosticsOptions) == null || O.call(s, {
|
|
948
1219
|
noSuggestionDiagnostics: !0,
|
|
949
1220
|
noSyntaxValidation: !0,
|
|
950
1221
|
noSemanticValidation: !0
|
|
951
|
-
}), (
|
|
1222
|
+
}), (S = (p = (m = j.languages.typescript) == null ? void 0 : m.javascriptDefaults) == null ? void 0 : p.setDiagnosticsOptions) == null || S.call(p, {
|
|
952
1223
|
noSuggestionDiagnostics: !0,
|
|
953
1224
|
noSyntaxValidation: !0,
|
|
954
1225
|
noSemanticValidation: !0
|
|
@@ -956,37 +1227,53 @@ function Br({
|
|
|
956
1227
|
},
|
|
957
1228
|
[e.code]
|
|
958
1229
|
);
|
|
959
|
-
|
|
960
|
-
var
|
|
961
|
-
if (
|
|
962
|
-
const
|
|
963
|
-
|
|
1230
|
+
N(() => {
|
|
1231
|
+
var M, j;
|
|
1232
|
+
if (E.current && (!e.revisionId || e.revisionId > Number((M = I.current) == null ? void 0 : M.revisionId))) {
|
|
1233
|
+
const x = E.current.getModel();
|
|
1234
|
+
x && (o != null && o.readOnly ? (j = E.current) == null || j.setValue(e.code) : (E.current.pushUndoStop(), E.current.executeEdits("edit", [
|
|
964
1235
|
{
|
|
965
|
-
range:
|
|
1236
|
+
range: x.getFullModelRange(),
|
|
966
1237
|
text: e.code
|
|
967
1238
|
}
|
|
968
|
-
]),
|
|
1239
|
+
]), E.current.pushUndoStop()));
|
|
969
1240
|
}
|
|
970
|
-
}, [e,
|
|
971
|
-
const { theme:
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1241
|
+
}, [e, o == null ? void 0 : o.readOnly, E]);
|
|
1242
|
+
const { theme: _ } = ce({ monacoRef: T, themeConfig: n, editor: g, theme: i });
|
|
1243
|
+
Dr({
|
|
1244
|
+
enable: a,
|
|
1245
|
+
editor: g,
|
|
1246
|
+
selectedLine: u,
|
|
1247
|
+
onSelectedLineChange: l,
|
|
1248
|
+
onSelectedLineButtonClick: d
|
|
1249
|
+
}), Tr({ editor: g, keyword: h });
|
|
1250
|
+
const b = k(() => ({
|
|
1251
|
+
...kr,
|
|
1252
|
+
...o || {}
|
|
1253
|
+
// TODO: this will be used in the future
|
|
1254
|
+
// ...(enableLinesSelection ? { glyphMargin: true } : {})
|
|
1255
|
+
}), [o]), C = k(() => `.monaco-editor-${$.current} .margin-view-overlays .line-numbers { cursor: pointer !important; } ${Vr}`, []);
|
|
1256
|
+
return /* @__PURE__ */ A.jsxs(A.Fragment, { children: [
|
|
1257
|
+
a && /* @__PURE__ */ A.jsx("style", { dangerouslySetInnerHTML: { __html: C } }),
|
|
1258
|
+
/* @__PURE__ */ A.jsx(
|
|
1259
|
+
fe,
|
|
1260
|
+
{
|
|
1261
|
+
className: `monaco-editor-${$.current} ${y}`,
|
|
1262
|
+
height: f,
|
|
1263
|
+
onChange: (M, j) => {
|
|
1264
|
+
I.current = { code: M ?? "", revisionId: j.versionId }, t == null || t({ ...I.current }, j);
|
|
1265
|
+
},
|
|
1266
|
+
language: r,
|
|
1267
|
+
theme: _,
|
|
1268
|
+
options: b,
|
|
1269
|
+
onMount: V
|
|
1270
|
+
}
|
|
1271
|
+
)
|
|
1272
|
+
] });
|
|
986
1273
|
}
|
|
987
|
-
|
|
988
|
-
const
|
|
989
|
-
...
|
|
1274
|
+
q.config({ monaco: F });
|
|
1275
|
+
const Ar = {
|
|
1276
|
+
...ae,
|
|
990
1277
|
codeLens: !1,
|
|
991
1278
|
smartSelect: {
|
|
992
1279
|
selectLeadingAndTrailingWhitespace: !0
|
|
@@ -994,7 +1281,7 @@ const Cr = {
|
|
|
994
1281
|
originalEditable: !1,
|
|
995
1282
|
overviewRulerBorder: !1
|
|
996
1283
|
};
|
|
997
|
-
function
|
|
1284
|
+
function on({
|
|
998
1285
|
original: e,
|
|
999
1286
|
modified: t,
|
|
1000
1287
|
language: r,
|
|
@@ -1003,55 +1290,55 @@ function Wr({
|
|
|
1003
1290
|
theme: i,
|
|
1004
1291
|
height: a = "75vh"
|
|
1005
1292
|
}) {
|
|
1006
|
-
|
|
1007
|
-
const [u,
|
|
1008
|
-
return /* @__PURE__ */
|
|
1009
|
-
|
|
1293
|
+
ie();
|
|
1294
|
+
const [u, l] = R(), d = v(), { theme: h } = ce({ monacoRef: d, themeConfig: n, editor: u, theme: i }), f = k(() => ({ ...Ar, ...o || {} }), [o]);
|
|
1295
|
+
return /* @__PURE__ */ A.jsx(A.Fragment, { children: /* @__PURE__ */ A.jsx(
|
|
1296
|
+
gr,
|
|
1010
1297
|
{
|
|
1011
|
-
className: "overflow-hidden rounded-b-
|
|
1298
|
+
className: "overflow-hidden rounded-b-cn-3 border-x border-b",
|
|
1012
1299
|
language: r,
|
|
1013
|
-
theme:
|
|
1300
|
+
theme: h,
|
|
1014
1301
|
original: e,
|
|
1015
1302
|
modified: t,
|
|
1016
1303
|
height: a,
|
|
1017
|
-
options:
|
|
1018
|
-
onMount:
|
|
1304
|
+
options: f,
|
|
1305
|
+
onMount: l
|
|
1019
1306
|
}
|
|
1020
1307
|
) });
|
|
1021
1308
|
}
|
|
1022
|
-
var
|
|
1023
|
-
function
|
|
1309
|
+
var Ye = /* @__PURE__ */ ((e) => (e.ContainsPath = "ContainsPath", e))(Ye || {});
|
|
1310
|
+
function Hr(e) {
|
|
1024
1311
|
const { pathSymbolMap: t, inlineActions: r = [], commandId: n } = e, o = Object.fromEntries(t.entries()), i = [];
|
|
1025
1312
|
return r == null || r.forEach((a) => {
|
|
1026
1313
|
const u = a.actions;
|
|
1027
|
-
a.selectors.forEach((
|
|
1028
|
-
switch (
|
|
1029
|
-
case
|
|
1030
|
-
|
|
1031
|
-
let
|
|
1032
|
-
fullPath:
|
|
1033
|
-
path:
|
|
1034
|
-
symbol: o[
|
|
1035
|
-
})).filter((
|
|
1036
|
-
|
|
1037
|
-
...
|
|
1038
|
-
path:
|
|
1039
|
-
})),
|
|
1040
|
-
const
|
|
1041
|
-
u.forEach((
|
|
1042
|
-
const
|
|
1043
|
-
range:
|
|
1044
|
-
symbols: [
|
|
1045
|
-
onClick:
|
|
1046
|
-
data:
|
|
1047
|
-
path:
|
|
1314
|
+
a.selectors.forEach((d) => {
|
|
1315
|
+
switch (d.type) {
|
|
1316
|
+
case Ye.ContainsPath: {
|
|
1317
|
+
d.paths.forEach((h) => {
|
|
1318
|
+
let y = Object.keys(o).map((g) => ({
|
|
1319
|
+
fullPath: g,
|
|
1320
|
+
path: g,
|
|
1321
|
+
symbol: o[g]
|
|
1322
|
+
})).filter((g) => g.path.startsWith(d.basePath));
|
|
1323
|
+
y = y.map((g) => ({
|
|
1324
|
+
...g,
|
|
1325
|
+
path: g.path.substring(d.basePath.length)
|
|
1326
|
+
})), y.filter((g) => h.test(g.path)).forEach((g) => {
|
|
1327
|
+
const L = g.fullPath, T = g.symbol, I = T.range;
|
|
1328
|
+
u.forEach((E) => {
|
|
1329
|
+
const V = {
|
|
1330
|
+
range: I,
|
|
1331
|
+
symbols: [T],
|
|
1332
|
+
onClick: E.onClick,
|
|
1333
|
+
data: E.data,
|
|
1334
|
+
path: L
|
|
1048
1335
|
};
|
|
1049
1336
|
i.push({
|
|
1050
|
-
range:
|
|
1337
|
+
range: I,
|
|
1051
1338
|
command: {
|
|
1052
1339
|
id: n,
|
|
1053
|
-
title:
|
|
1054
|
-
arguments: [
|
|
1340
|
+
title: E.title,
|
|
1341
|
+
arguments: [V]
|
|
1055
1342
|
}
|
|
1056
1343
|
});
|
|
1057
1344
|
});
|
|
@@ -1071,40 +1358,40 @@ const te = class te {
|
|
|
1071
1358
|
return te.data;
|
|
1072
1359
|
}
|
|
1073
1360
|
};
|
|
1074
|
-
|
|
1075
|
-
let
|
|
1076
|
-
async function
|
|
1077
|
-
const t =
|
|
1361
|
+
Pe(te, "data", {});
|
|
1362
|
+
let we = te;
|
|
1363
|
+
async function Ge(e) {
|
|
1364
|
+
const t = we.get(), { documentSymbolProvider: r } = t.StandaloneServices.get(t.ILanguageFeaturesService);
|
|
1078
1365
|
return await t.OutlineModel.create(r, e);
|
|
1079
1366
|
}
|
|
1080
|
-
function
|
|
1367
|
+
function Ze(e) {
|
|
1081
1368
|
const t = /* @__PURE__ */ new Map();
|
|
1082
|
-
return
|
|
1369
|
+
return xe({
|
|
1083
1370
|
pathSymbolMap: t,
|
|
1084
1371
|
parentPath: "",
|
|
1085
1372
|
children: e.children,
|
|
1086
|
-
parentKind:
|
|
1373
|
+
parentKind: be.SymbolKind.Module
|
|
1087
1374
|
}), t;
|
|
1088
1375
|
}
|
|
1089
|
-
function
|
|
1376
|
+
function xe(e) {
|
|
1090
1377
|
switch (e.parentKind) {
|
|
1091
|
-
case
|
|
1092
|
-
|
|
1378
|
+
case be.SymbolKind.Module: {
|
|
1379
|
+
Rr(e);
|
|
1093
1380
|
break;
|
|
1094
1381
|
}
|
|
1095
|
-
case
|
|
1096
|
-
|
|
1382
|
+
case be.SymbolKind.Array: {
|
|
1383
|
+
Ur(e);
|
|
1097
1384
|
break;
|
|
1098
1385
|
}
|
|
1099
1386
|
default:
|
|
1100
|
-
|
|
1387
|
+
zr(e);
|
|
1101
1388
|
}
|
|
1102
1389
|
}
|
|
1103
|
-
function
|
|
1390
|
+
function Rr(e) {
|
|
1104
1391
|
e.children.forEach((t) => {
|
|
1105
1392
|
var n;
|
|
1106
1393
|
let r = e.parentPath;
|
|
1107
|
-
t.symbol && (r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(r, t.symbol)),
|
|
1394
|
+
t.symbol && (r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(r, t.symbol)), xe({
|
|
1108
1395
|
pathSymbolMap: e.pathSymbolMap,
|
|
1109
1396
|
parentPath: r,
|
|
1110
1397
|
children: t.children,
|
|
@@ -1112,11 +1399,11 @@ function Ir(e) {
|
|
|
1112
1399
|
});
|
|
1113
1400
|
});
|
|
1114
1401
|
}
|
|
1115
|
-
function
|
|
1402
|
+
function Ur(e) {
|
|
1116
1403
|
let t = 0;
|
|
1117
1404
|
e.children.forEach((r) => {
|
|
1118
1405
|
const n = e.parentPath ? `${e.parentPath}.${t}` : `${t}`;
|
|
1119
|
-
e.pathSymbolMap.set(n, r.symbol), t += 1,
|
|
1406
|
+
e.pathSymbolMap.set(n, r.symbol), t += 1, xe({
|
|
1120
1407
|
pathSymbolMap: e.pathSymbolMap,
|
|
1121
1408
|
parentPath: n,
|
|
1122
1409
|
children: r.children,
|
|
@@ -1124,44 +1411,47 @@ function Lr(e) {
|
|
|
1124
1411
|
});
|
|
1125
1412
|
});
|
|
1126
1413
|
}
|
|
1127
|
-
function
|
|
1414
|
+
function zr(e) {
|
|
1128
1415
|
const t = e.children.get("0");
|
|
1129
1416
|
if (t) {
|
|
1130
1417
|
const r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t == null ? void 0 : t.symbol.name;
|
|
1131
1418
|
e.pathSymbolMap.set(r, t.symbol);
|
|
1132
1419
|
}
|
|
1133
1420
|
}
|
|
1134
|
-
function
|
|
1421
|
+
function Fr({
|
|
1135
1422
|
editorRef: e,
|
|
1136
1423
|
inlineActions: t
|
|
1137
1424
|
}) {
|
|
1138
|
-
|
|
1425
|
+
N(() => F.languages.registerCodeLensProvider("yaml", {
|
|
1139
1426
|
provideCodeLenses: async (n) => {
|
|
1140
|
-
var d;
|
|
1141
|
-
|
|
1142
|
-
|
|
1427
|
+
var l, d, h, f, y;
|
|
1428
|
+
if (((l = n == null ? void 0 : n.uri) == null ? void 0 : l.toString()) !== ((f = (h = (d = e.current) == null ? void 0 : d.getModel()) == null ? void 0 : h.uri) == null ? void 0 : f.toString()))
|
|
1429
|
+
return { lenses: [], dispose: () => {
|
|
1430
|
+
} };
|
|
1431
|
+
const o = await Ge(n), i = Ze(o), a = (y = e == null ? void 0 : e.current) == null ? void 0 : y.addCommand(0, ($, { onClick: g, path: L, range: T, data: I }) => {
|
|
1432
|
+
g({ path: L, range: T, data: I });
|
|
1143
1433
|
});
|
|
1144
1434
|
return a ? {
|
|
1145
|
-
lenses:
|
|
1435
|
+
lenses: Hr({ pathSymbolMap: i, inlineActions: t, commandId: a }),
|
|
1146
1436
|
dispose: () => {
|
|
1147
1437
|
}
|
|
1148
1438
|
} : void 0;
|
|
1149
1439
|
}
|
|
1150
1440
|
}).dispose, [t, e]);
|
|
1151
1441
|
}
|
|
1152
|
-
const
|
|
1153
|
-
const [r, n] =
|
|
1442
|
+
const Wr = ({ editorRef: e, selection: t }) => {
|
|
1443
|
+
const [r, n] = R(), o = k(
|
|
1154
1444
|
() => async (i, a, u) => {
|
|
1155
|
-
var
|
|
1156
|
-
const
|
|
1157
|
-
if (!
|
|
1445
|
+
var y, $, g;
|
|
1446
|
+
const l = (y = e == null ? void 0 : e.current) == null ? void 0 : y.getModel();
|
|
1447
|
+
if (!l || !a)
|
|
1158
1448
|
return n(void 0);
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1449
|
+
const d = await Ge(l), f = ($ = Ze(d).get(a)) == null ? void 0 : $.range;
|
|
1450
|
+
f && (n(f), u && ((g = e == null ? void 0 : e.current) == null || g.revealLineInCenter(f.startLineNumber)));
|
|
1161
1451
|
},
|
|
1162
1452
|
[]
|
|
1163
1453
|
);
|
|
1164
|
-
|
|
1454
|
+
N(() => {
|
|
1165
1455
|
if ("requestIdleCallback" in window) {
|
|
1166
1456
|
const i = requestIdleCallback(() => {
|
|
1167
1457
|
o(e, t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter);
|
|
@@ -1173,7 +1463,7 @@ const Nr = ({ editorRef: e, selection: t }) => {
|
|
|
1173
1463
|
}, 100);
|
|
1174
1464
|
return () => clearTimeout(i);
|
|
1175
1465
|
}
|
|
1176
|
-
}, [t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter, e, o]),
|
|
1466
|
+
}, [t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter, e, o]), N(() => {
|
|
1177
1467
|
var a;
|
|
1178
1468
|
if (!r)
|
|
1179
1469
|
return;
|
|
@@ -1189,7 +1479,7 @@ const Nr = ({ editorRef: e, selection: t }) => {
|
|
|
1189
1479
|
]);
|
|
1190
1480
|
return () => i == null ? void 0 : i.clear();
|
|
1191
1481
|
}, [r, e, t == null ? void 0 : t.className]);
|
|
1192
|
-
},
|
|
1482
|
+
}, Je = nt({
|
|
1193
1483
|
markers: [],
|
|
1194
1484
|
setMarkers: () => {
|
|
1195
1485
|
},
|
|
@@ -1199,17 +1489,17 @@ const Nr = ({ editorRef: e, selection: t }) => {
|
|
|
1199
1489
|
updateCursorPosition: (e) => {
|
|
1200
1490
|
}
|
|
1201
1491
|
});
|
|
1202
|
-
function
|
|
1492
|
+
function an({
|
|
1203
1493
|
children: e
|
|
1204
1494
|
}) {
|
|
1205
|
-
const [t, r] =
|
|
1495
|
+
const [t, r] = R([]), [n, o] = R(null), i = J(
|
|
1206
1496
|
(a) => {
|
|
1207
1497
|
n == null || n.setPosition(a), n == null || n.revealLineInCenterIfOutsideViewport(a.lineNumber), n == null || n.focus();
|
|
1208
1498
|
},
|
|
1209
1499
|
[n]
|
|
1210
1500
|
);
|
|
1211
|
-
return /* @__PURE__ */
|
|
1212
|
-
|
|
1501
|
+
return /* @__PURE__ */ A.jsx(
|
|
1502
|
+
Je.Provider,
|
|
1213
1503
|
{
|
|
1214
1504
|
value: {
|
|
1215
1505
|
markers: t,
|
|
@@ -1222,25 +1512,25 @@ function Kr({
|
|
|
1222
1512
|
}
|
|
1223
1513
|
);
|
|
1224
1514
|
}
|
|
1225
|
-
function
|
|
1226
|
-
return
|
|
1515
|
+
function Qe() {
|
|
1516
|
+
return ot(Je);
|
|
1227
1517
|
}
|
|
1228
|
-
const
|
|
1229
|
-
const { setMarkers: n } =
|
|
1230
|
-
|
|
1518
|
+
const qr = ({ monacoRef: e, editorRef: t, instanceId: r }) => {
|
|
1519
|
+
const { setMarkers: n } = Qe();
|
|
1520
|
+
N(() => {
|
|
1231
1521
|
let o;
|
|
1232
1522
|
const i = setTimeout(() => {
|
|
1233
1523
|
var u;
|
|
1234
1524
|
const a = (u = e.current) == null ? void 0 : u.editor;
|
|
1235
|
-
a && (o = a.onDidChangeMarkers((
|
|
1236
|
-
var
|
|
1237
|
-
const
|
|
1238
|
-
if (!
|
|
1525
|
+
a && (o = a.onDidChangeMarkers((l) => {
|
|
1526
|
+
var f;
|
|
1527
|
+
const d = (f = t.current) == null ? void 0 : f.getModel();
|
|
1528
|
+
if (!d)
|
|
1239
1529
|
return;
|
|
1240
|
-
const
|
|
1241
|
-
if (
|
|
1242
|
-
const
|
|
1243
|
-
n(
|
|
1530
|
+
const h = d.uri.toString();
|
|
1531
|
+
if (l.some((y) => y.toString() === h)) {
|
|
1532
|
+
const y = F.editor.getModelMarkers({ resource: d.uri });
|
|
1533
|
+
n(y);
|
|
1244
1534
|
}
|
|
1245
1535
|
}));
|
|
1246
1536
|
}, 100);
|
|
@@ -1249,17 +1539,17 @@ const kr = ({ monacoRef: e, editorRef: t, instanceId: r }) => {
|
|
|
1249
1539
|
};
|
|
1250
1540
|
}, [e, r, n]);
|
|
1251
1541
|
};
|
|
1252
|
-
function
|
|
1542
|
+
function Br(e) {
|
|
1253
1543
|
var n, o;
|
|
1254
|
-
const t = ((o = (n =
|
|
1255
|
-
r !== -1 ? t[r] = e : t.push(e),
|
|
1544
|
+
const t = ((o = (n = Oe) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? [], r = t.findIndex((i) => i.fileMatch[0] === e.fileMatch[0]);
|
|
1545
|
+
r !== -1 ? t[r] = e : t.push(e), Xe(t);
|
|
1256
1546
|
}
|
|
1257
|
-
function
|
|
1547
|
+
function Kr(e) {
|
|
1258
1548
|
var n, o;
|
|
1259
|
-
const r = (((o = (n =
|
|
1260
|
-
|
|
1549
|
+
const r = (((o = (n = Oe) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? []).filter((i) => i.fileMatch[0] !== je(e));
|
|
1550
|
+
Xe(r);
|
|
1261
1551
|
}
|
|
1262
|
-
function
|
|
1552
|
+
function Xe(e) {
|
|
1263
1553
|
const t = {
|
|
1264
1554
|
hover: !0,
|
|
1265
1555
|
completion: !0,
|
|
@@ -1267,25 +1557,25 @@ function Ke(e) {
|
|
|
1267
1557
|
validate: !0,
|
|
1268
1558
|
schemas: e
|
|
1269
1559
|
};
|
|
1270
|
-
|
|
1560
|
+
Oe.setDiagnosticsOptions({ ...t });
|
|
1271
1561
|
}
|
|
1272
|
-
const
|
|
1562
|
+
const je = (e) => it.parse(`file://${e}`).toString(), Yr = (e) => {
|
|
1273
1563
|
const { schemaConfig: t, instanceId: r } = e;
|
|
1274
|
-
|
|
1564
|
+
N(() => {
|
|
1275
1565
|
if (t != null && t.schema)
|
|
1276
|
-
return
|
|
1277
|
-
fileMatch: [
|
|
1566
|
+
return Br({
|
|
1567
|
+
fileMatch: [je(r.toString())],
|
|
1278
1568
|
...t
|
|
1279
1569
|
}), () => {
|
|
1280
|
-
|
|
1570
|
+
Kr(r);
|
|
1281
1571
|
};
|
|
1282
1572
|
}, [t == null ? void 0 : t.schema, r]);
|
|
1283
1573
|
};
|
|
1284
|
-
|
|
1285
|
-
const
|
|
1286
|
-
...
|
|
1574
|
+
q.config({ monaco: F });
|
|
1575
|
+
const Gr = {
|
|
1576
|
+
...ae,
|
|
1287
1577
|
folding: !0
|
|
1288
|
-
},
|
|
1578
|
+
}, cn = function(t) {
|
|
1289
1579
|
const {
|
|
1290
1580
|
yamlRevision: r,
|
|
1291
1581
|
schemaConfig: n,
|
|
@@ -1293,86 +1583,89 @@ const Ur = {
|
|
|
1293
1583
|
themeConfig: i,
|
|
1294
1584
|
onYamlRevisionChange: a,
|
|
1295
1585
|
selection: u,
|
|
1296
|
-
theme:
|
|
1297
|
-
options:
|
|
1298
|
-
animateOnUpdate:
|
|
1299
|
-
onAnimateEnd:
|
|
1300
|
-
instanceId:
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1586
|
+
theme: l,
|
|
1587
|
+
options: d,
|
|
1588
|
+
animateOnUpdate: h = !1,
|
|
1589
|
+
onAnimateEnd: f,
|
|
1590
|
+
instanceId: y,
|
|
1591
|
+
height: $
|
|
1592
|
+
} = t, g = ie(), [L] = R(y ?? `yaml-editor-${Math.random()}`), { editor: T, setEditor: I } = Qe(), E = v(null), V = v(), _ = v({ yaml: "", revisionId: 0 }), b = v(null), C = v(null), M = J(
|
|
1593
|
+
(m) => {
|
|
1594
|
+
var c, w, H;
|
|
1595
|
+
const p = m.split(`
|
|
1596
|
+
`), S = (c = b.current) == null ? void 0 : c.getModel();
|
|
1597
|
+
if (S) {
|
|
1598
|
+
(w = b.current) == null || w.pushUndoStop(), S.setValue("");
|
|
1599
|
+
let W = 0;
|
|
1600
|
+
C.current = window.setInterval(() => {
|
|
1601
|
+
var B;
|
|
1602
|
+
W < p.length ? (g && ((B = b.current) == null || B.executeEdits("addLine", [
|
|
1312
1603
|
{
|
|
1313
|
-
range: new
|
|
1314
|
-
text:
|
|
1604
|
+
range: new g.Range(W + 1, 1, W + 1, 1),
|
|
1605
|
+
text: p[W] + `
|
|
1315
1606
|
`
|
|
1316
1607
|
}
|
|
1317
|
-
])),
|
|
1318
|
-
}, 100), (
|
|
1608
|
+
])), W++) : C.current && (clearInterval(C.current), f == null || f());
|
|
1609
|
+
}, 100), (H = b.current) == null || H.pushUndoStop();
|
|
1319
1610
|
}
|
|
1320
1611
|
},
|
|
1321
|
-
[
|
|
1612
|
+
[g]
|
|
1322
1613
|
);
|
|
1323
|
-
|
|
1324
|
-
|
|
1614
|
+
N(() => () => {
|
|
1615
|
+
C.current && clearInterval(C.current);
|
|
1325
1616
|
}, []);
|
|
1326
|
-
function j(
|
|
1327
|
-
|
|
1328
|
-
var
|
|
1329
|
-
(
|
|
1617
|
+
function j(m, p) {
|
|
1618
|
+
b.current = m, V.current = p, m.setValue(r.yaml), I(m), setTimeout(() => {
|
|
1619
|
+
var S;
|
|
1620
|
+
(S = E.current) != null && S.style && (E.current.style.opacity = "1");
|
|
1330
1621
|
}, 50);
|
|
1331
1622
|
}
|
|
1332
|
-
|
|
1333
|
-
var
|
|
1334
|
-
if (
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1623
|
+
N(() => {
|
|
1624
|
+
var m;
|
|
1625
|
+
if (b.current && (!r.revisionId || r.revisionId > Number((m = _.current) == null ? void 0 : m.revisionId))) {
|
|
1626
|
+
const p = b.current.getModel();
|
|
1627
|
+
p && (b.current.executeEdits("edit", [
|
|
1337
1628
|
{
|
|
1338
|
-
range:
|
|
1339
|
-
text:
|
|
1629
|
+
range: p.getFullModelRange(),
|
|
1630
|
+
text: h ? "" : r.yaml
|
|
1340
1631
|
}
|
|
1341
|
-
]),
|
|
1632
|
+
]), h && M(r.yaml));
|
|
1342
1633
|
}
|
|
1343
|
-
}, [
|
|
1344
|
-
const { theme:
|
|
1345
|
-
|
|
1346
|
-
const
|
|
1634
|
+
}, [M, r, h]), Yr({ schemaConfig: n, instanceId: L }), Fr({ editorRef: b, inlineActions: o });
|
|
1635
|
+
const { theme: x } = ce({ monacoRef: V, themeConfig: i, editor: T, theme: l });
|
|
1636
|
+
qr({ monacoRef: V, editorRef: b, instanceId: L }), Wr({ editorRef: b, selection: u });
|
|
1637
|
+
const s = k(() => je(L), []), O = k(
|
|
1347
1638
|
() => ({
|
|
1348
|
-
...
|
|
1349
|
-
...
|
|
1639
|
+
...Gr,
|
|
1640
|
+
...d
|
|
1350
1641
|
}),
|
|
1351
|
-
[
|
|
1642
|
+
[d]
|
|
1352
1643
|
);
|
|
1353
|
-
return /* @__PURE__ */
|
|
1354
|
-
|
|
1644
|
+
return /* @__PURE__ */ A.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref: E, children: /* @__PURE__ */ A.jsx(
|
|
1645
|
+
fe,
|
|
1355
1646
|
{
|
|
1356
|
-
onChange: (
|
|
1357
|
-
|
|
1647
|
+
onChange: (m, p) => {
|
|
1648
|
+
_.current = { yaml: m ?? "", revisionId: p.versionId }, a({ ..._.current }, p);
|
|
1358
1649
|
},
|
|
1359
1650
|
language: "yaml",
|
|
1360
|
-
theme:
|
|
1361
|
-
options:
|
|
1362
|
-
path:
|
|
1363
|
-
onMount: j
|
|
1651
|
+
theme: x,
|
|
1652
|
+
options: O,
|
|
1653
|
+
path: s,
|
|
1654
|
+
onMount: j,
|
|
1655
|
+
height: $
|
|
1364
1656
|
}
|
|
1365
1657
|
) });
|
|
1366
1658
|
};
|
|
1367
1659
|
export {
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1660
|
+
tn as BlameEditor,
|
|
1661
|
+
rn as BlameEditorV2,
|
|
1662
|
+
on as CodeDiffEditor,
|
|
1663
|
+
nn as CodeEditor,
|
|
1664
|
+
we as MonacoGlobals,
|
|
1665
|
+
Ye as SelectorType,
|
|
1666
|
+
cn as YamlEditor,
|
|
1667
|
+
Je as YamlEditorContext,
|
|
1668
|
+
an as YamlEditorContextProvider,
|
|
1669
|
+
Qe as useYamlEditorContext
|
|
1377
1670
|
};
|
|
1378
1671
|
//# sourceMappingURL=index.js.map
|