@harnessio/yaml-editor 0.14.0 → 0.15.0-beta-1

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