@ws-ui/code-editor 0.2.12 → 0.2.14

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.es.js CHANGED
@@ -1,20 +1,20 @@
1
1
  var ve = Object.defineProperty;
2
2
  var Se = (n, e, t) => e in n ? ve(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var W = (n, e, t) => (Se(n, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { jsxs as J, jsx as R, Fragment as Ne } from "react/jsx-runtime";
5
- import E, { useEffect as D, createContext as oe, useState as z, useRef as te, useContext as re, memo as ye } from "react";
6
- import { loader as xe, useMonaco as Re, Editor as we } from "@monaco-editor/react";
7
- import { lspSubject as ke, LspActions as X, hasAttributesString as se, FileFolderType as Le } from "@ws-ui/shared";
8
- import { MonacoLanguageClient as We } from "monaco-languageclient";
3
+ var L = (n, e, t) => (Se(n, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { jsxs as D, jsx as x, Fragment as ye } from "react/jsx-runtime";
5
+ import E, { useEffect as J, createContext as oe, useState as z, useRef as te, useContext as re, memo as Ne } from "react";
6
+ import { loader as we, useMonaco as xe, Editor as Re } from "@monaco-editor/react";
7
+ import { lspSubject as ke, LspActions as X, hasAttributesString as se, FileFolderType as We } from "@ws-ui/shared";
8
+ import { MonacoLanguageClient as Le } from "monaco-languageclient";
9
9
  import { mergeServices as Fe, initServices as Ze } from "monaco-languageclient/vscode/services";
10
10
  import je, { initUserConfiguration as Xe } from "@codingame/monaco-vscode-configuration-service-override";
11
- import Be from "@codingame/monaco-vscode-languages-service-override";
12
- import Ke from "@codingame/monaco-vscode-textmate-service-override";
11
+ import Ke from "@codingame/monaco-vscode-languages-service-override";
12
+ import Be from "@codingame/monaco-vscode-textmate-service-override";
13
13
  import "@codingame/monaco-vscode-theme-defaults-default-extension";
14
14
  import Ee from "@codingame/monaco-vscode-editor-service-override";
15
15
  import Te from "@codingame/monaco-vscode-theme-service-override";
16
16
  import * as s from "monaco-editor";
17
- import { Selection as Oe, KeyMod as O, KeyCode as G, editor as le, Range as Ge, Uri as Je, CancellationTokenSource as De } from "monaco-editor";
17
+ import { Selection as Oe, KeyMod as O, KeyCode as G, editor as le, Range as Ge, Uri as De, CancellationTokenSource as Je } from "monaco-editor";
18
18
  import { Logger as Me } from "monaco-languageclient/tools";
19
19
  import { ErrorAction as Ve, CloseAction as Pe } from "vscode-languageclient";
20
20
  import { WebSocketMessageReader as Ye, WebSocketMessageWriter as He, toSocket as ze } from "vscode-ws-jsonrpc";
@@ -136,8 +136,8 @@ const gt = () => je(), ct = () => Ee(
136
136
  // @see https://github.com/CodinGame/monaco-vscode-api#monaco-standalone-services
137
137
  ...gt(),
138
138
  ...ut(),
139
- ...Ke(),
140
139
  ...Be(),
140
+ ...Ke(),
141
141
  ...ct()
142
142
  };
143
143
  Fe(l, e.userServices);
@@ -157,7 +157,7 @@ const gt = () => je(), ct = () => Ee(
157
157
  class mt extends Ye {
158
158
  constructor(t, i) {
159
159
  super(t);
160
- W(this, "onMessage");
160
+ L(this, "onMessage");
161
161
  this.onMessage = i;
162
162
  }
163
163
  readMessage(t) {
@@ -176,7 +176,7 @@ class mt extends Ye {
176
176
  class ft extends He {
177
177
  constructor(t, i) {
178
178
  super(t);
179
- W(this, "onSend");
179
+ L(this, "onSend");
180
180
  this.onSend = i;
181
181
  }
182
182
  async write(t) {
@@ -483,10 +483,10 @@ const bt = {
483
483
  keybinding: O.CtrlCmd | G.Digit0,
484
484
  command: "editor.action.fontZoomReset"
485
485
  }
486
- ], St = ({ defaultZoom: n }) => (D(() => {
486
+ ], St = ({ defaultZoom: n }) => (J(() => {
487
487
  n !== void 0 && le.EditorZoom.setZoomLevel(n);
488
488
  }, []), null);
489
- ({}).VITE_DISABLE_MONACO_LOADER || xe.config({
489
+ ({}).VITE_DISABLE_MONACO_LOADER || we.config({
490
490
  monaco: s
491
491
  // paths: {
492
492
  // vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.41.0/min/vs",
@@ -535,29 +535,29 @@ class P {
535
535
  };
536
536
  }
537
537
  }
538
- function Nt(n, e, t, i) {
538
+ function yt(n, e, t, i) {
539
539
  const o = t.tokens.data, l = n.getLanguageId();
540
540
  let r = 0, I = 0;
541
541
  const C = i.lineNumber - 1, h = i.column - 1;
542
542
  for (let S = 0; S < o.length; S += 5) {
543
- const p = o[S], f = o[S + 1], N = o[S + 2], x = o[S + 3], v = o[S + 4], y = r + p, A = p === 0 ? I + f : f;
544
- if (C === y && A <= h && h < A + N) {
545
- const m = t.legend.tokenTypes[x] || "not in legend (ignored)", F = [];
543
+ const p = o[S], f = o[S + 1], y = o[S + 2], w = o[S + 3], v = o[S + 4], N = r + p, A = p === 0 ? I + f : f;
544
+ if (C === N && A <= h && h < A + y) {
545
+ const m = t.legend.tokenTypes[w] || "not in legend (ignored)", F = [];
546
546
  let a = v;
547
547
  for (let M = 0; a > 0 && M < t.legend.tokenModifiers.length; M++)
548
548
  a & 1 && F.push(t.legend.tokenModifiers[M]), a = a >> 1;
549
549
  a > 0 && F.push("not in legend (ignored)");
550
550
  const g = new Ge(
551
- y + 1,
551
+ N + 1,
552
552
  A + 1,
553
- y + 1,
554
- A + 1 + N
555
- ), w = {}, k = e.getColorTheme().tokenColorMap, b = e.getColorTheme().getTokenStyleMetadata(
553
+ N + 1,
554
+ A + 1 + y
555
+ ), R = {}, k = e.getColorTheme().tokenColorMap, b = e.getColorTheme().getTokenStyleMetadata(
556
556
  m,
557
557
  F,
558
558
  l,
559
559
  !0,
560
- w
560
+ R
561
561
  );
562
562
  let $;
563
563
  return b && ($ = {
@@ -569,13 +569,13 @@ function Nt(n, e, t, i) {
569
569
  strikethrough: b == null ? void 0 : b.strikethrough,
570
570
  foreground: k[(b == null ? void 0 : b.foreground) || ge.None],
571
571
  background: void 0
572
- }), { type: m, modifiers: F, range: g, metadata: $, definitions: w };
572
+ }), { type: m, modifiers: F, range: g, metadata: $, definitions: R };
573
573
  }
574
- r = y, I = A;
574
+ r = N, I = A;
575
575
  }
576
576
  return null;
577
577
  }
578
- function yt(n, e, t) {
578
+ function Nt(n, e, t) {
579
579
  let i = null;
580
580
  for (let o = 1; o < t; o++)
581
581
  i = e.tokenizeLine(
@@ -584,7 +584,7 @@ function yt(n, e, t) {
584
584
  ).ruleStack;
585
585
  return i;
586
586
  }
587
- function xt(n, e, t) {
587
+ function wt(n, e, t) {
588
588
  const i = n.getColorTheme().tokenColorMap, o = P.getLanguageId(t), l = P.getTokenType(t), r = P.getFontStyle(t), I = P.getForeground(t), C = P.getBackground(t);
589
589
  return {
590
590
  languageId: e.languageIdCodec.decodeLanguageId(o),
@@ -597,8 +597,8 @@ function xt(n, e, t) {
597
597
  background: i[C]
598
598
  };
599
599
  }
600
- function Rt(n, e, t) {
601
- const i = t.lineNumber, o = n, l = o._tokenizationTextModelPart.grammarTokens._tokenizer.tokenizationSupport._actual._grammar, r = yt(n, l, i), I = l.tokenizeLine(
600
+ function xt(n, e, t) {
601
+ const i = t.lineNumber, o = n, l = o._tokenizationTextModelPart.grammarTokens._tokenizer.tokenizationSupport._actual._grammar, r = Nt(n, l, i), I = l.tokenizeLine(
602
602
  n.getLineContent(i),
603
603
  r
604
604
  ), C = l.tokenizeLine2(
@@ -621,14 +621,14 @@ function Rt(n, e, t) {
621
621
  }
622
622
  return {
623
623
  token: I.tokens[h],
624
- metadata: xt(
624
+ metadata: wt(
625
625
  e,
626
626
  o._languageService,
627
627
  C.tokens[(S << 1) + 1]
628
628
  )
629
629
  };
630
630
  }
631
- const ue = oe(void 0), Nn = ({
631
+ const ue = oe(void 0), yn = ({
632
632
  children: n,
633
633
  url: e,
634
634
  qodly: t,
@@ -637,11 +637,11 @@ const ue = oe(void 0), Nn = ({
637
637
  language: l = "4d",
638
638
  defaultInited: r = !1
639
639
  }) => {
640
- const I = Re(), [C, h] = z(r), [S, p] = z(null), f = te(), N = te(0);
641
- D(() => {
642
- e && I && x();
640
+ const I = xe(), [C, h] = z(r), [S, p] = z(null), f = te(), y = te(0);
641
+ J(() => {
642
+ e && I && w();
643
643
  }, [e, I]);
644
- const x = async () => {
644
+ const w = async () => {
645
645
  if (!I)
646
646
  return;
647
647
  const d = new Me({
@@ -674,13 +674,13 @@ const ue = oe(void 0), Nn = ({
674
674
  p(new Event("INVALID_URL"));
675
675
  return;
676
676
  }
677
- d.onopen = y, d.onclose = A, d.onerror = m, N.current = 0;
678
- }, y = async function() {
679
- const d = ze(this), c = new mt(d), u = new ft(d), L = new We({
677
+ d.onopen = N, d.onclose = A, d.onerror = m, y.current = 0;
678
+ }, N = async function() {
679
+ const d = ze(this), c = new mt(d), u = new ft(d), W = new Le({
680
680
  name: "4D Language Client",
681
681
  clientOptions: {
682
682
  workspaceFolder: {
683
- uri: Je.parse("file:///PACKAGE")
683
+ uri: De.parse("file:///PACKAGE")
684
684
  },
685
685
  // use a language id as a document selector
686
686
  documentSelector: [{ scheme: "file", language: l }],
@@ -698,29 +698,29 @@ const ue = oe(void 0), Nn = ({
698
698
  })
699
699
  }
700
700
  });
701
- f.current = L;
702
- const Z = L.sendRequest.bind(L);
701
+ f.current = W;
702
+ const Z = W.sendRequest.bind(W);
703
703
  f.current.sendRequest = function(T, V, U) {
704
704
  return typeof T == "object" && T.method === "textDocument/diagnostic" && /file:\/\/\/PACKAGE\/Project\/Sources\/Methods\/__Debugger_.*/.test(
705
705
  V.textDocument.uri
706
706
  ) ? Promise.resolve() : Z(T, V, U);
707
707
  }, c.onClose(() => {
708
- L.stop(), N.current < 3 ? setTimeout(() => {
709
- N.current++, v();
708
+ W.stop(), y.current < 3 ? setTimeout(() => {
709
+ y.current++, v();
710
710
  }, 1e3) : p(new Event("WEBSOCKET_CLOSED"));
711
- }), L.needsStart() && await L.start(), h(!0);
711
+ }), W.needsStart() && await W.start(), h(!0);
712
712
  }, A = () => {
713
713
  }, m = (d) => {
714
714
  p(d);
715
715
  };
716
- D(() => {
716
+ J(() => {
717
717
  const d = ke.subscribe(({ action: c, payload: u }) => {
718
718
  switch (c) {
719
719
  case X.WILL_SAVE:
720
720
  k(u.filePath);
721
721
  break;
722
722
  case X.DID_SAVE:
723
- K(u.filePath, u.content);
723
+ B(u.filePath, u.content);
724
724
  break;
725
725
  case X.WILL_CREATE:
726
726
  b(u.filePath);
@@ -741,7 +741,7 @@ const ue = oe(void 0), Nn = ({
741
741
  pe(u.filePath);
742
742
  break;
743
743
  case X.DIAGNOSTIC_REFRESH:
744
- w(u.filePath);
744
+ R(u.filePath);
745
745
  break;
746
746
  }
747
747
  });
@@ -750,29 +750,29 @@ const ue = oe(void 0), Nn = ({
750
750
  const F = (d) => {
751
751
  var c, u;
752
752
  return (u = (c = f.current) == null ? void 0 : c._features) == null ? void 0 : u.find(
753
- (L) => {
753
+ (W) => {
754
754
  var Z;
755
- return ((Z = L._registrationType) == null ? void 0 : Z.method) === d;
755
+ return ((Z = W._registrationType) == null ? void 0 : Z.method) === d;
756
756
  }
757
757
  );
758
758
  }, a = (d) => {
759
759
  const c = [], u = F(d);
760
760
  if (u)
761
- for (const [L, Z] of u._registrations)
761
+ for (const [W, Z] of u._registrations)
762
762
  Z.provider && c.push(Z.provider);
763
763
  return c;
764
764
  }, g = async (d, c, u) => {
765
765
  var Z, T, V;
766
- const L = a(
766
+ const W = a(
767
767
  rt.method
768
768
  );
769
- if (L[0]) {
770
- const U = new De(), Q = await Promise.resolve(
771
- L[0].full.provideDocumentSemanticTokens(
769
+ if (W[0]) {
770
+ const U = new Je(), Q = await Promise.resolve(
771
+ W[0].full.provideDocumentSemanticTokens(
772
772
  c,
773
773
  U.token
774
774
  )
775
- ), ee = d, be = Q ? Nt(
775
+ ), ee = d, be = Q ? yt(
776
776
  c,
777
777
  ee._themeService,
778
778
  {
@@ -780,14 +780,18 @@ const ue = oe(void 0), Nn = ({
780
780
  legend: (V = (T = (Z = f.current) == null ? void 0 : Z._capabilities) == null ? void 0 : T.semanticTokensProvider) == null ? void 0 : V.legend
781
781
  },
782
782
  u
783
- ) : null, he = Rt(c, ee._themeService, u);
783
+ ) : null, he = xt(
784
+ c,
785
+ ee._themeService,
786
+ u
787
+ );
784
788
  return {
785
789
  semanticTokenInfo: be,
786
790
  textmateTokenInfo: he
787
791
  };
788
792
  }
789
793
  return null;
790
- }, w = (d) => {
794
+ }, R = (d) => {
791
795
  if (f.current) {
792
796
  const c = a(
793
797
  $e.method
@@ -803,7 +807,7 @@ const ue = oe(void 0), Nn = ({
803
807
  },
804
808
  reason: c
805
809
  });
806
- }, K = (d, c) => {
810
+ }, B = (d, c) => {
807
811
  var u;
808
812
  (u = f.current) == null || u.sendNotification(qe.type, {
809
813
  textDocument: {
@@ -868,7 +872,7 @@ const ue = oe(void 0), Nn = ({
868
872
  ]
869
873
  });
870
874
  };
871
- return /* @__PURE__ */ J(
875
+ return /* @__PURE__ */ D(
872
876
  ue.Provider,
873
877
  {
874
878
  value: {
@@ -880,12 +884,12 @@ const ue = oe(void 0), Nn = ({
880
884
  },
881
885
  children: [
882
886
  n,
883
- /* @__PURE__ */ R(St, { defaultZoom: i })
887
+ /* @__PURE__ */ x(St, { defaultZoom: i })
884
888
  ]
885
889
  }
886
890
  );
887
891
  };
888
- function yn() {
892
+ function Nn() {
889
893
  const n = re(ue);
890
894
  if (n === void 0)
891
895
  throw new Error("useLSP must be used within an LSPContext");
@@ -893,9 +897,9 @@ function yn() {
893
897
  }
894
898
  const de = oe(
895
899
  void 0
896
- ), xn = ye(({ children: n }) => {
900
+ ), wn = Ne(({ children: n }) => {
897
901
  const [e, t] = z(null);
898
- return /* @__PURE__ */ R(
902
+ return /* @__PURE__ */ x(
899
903
  de.Provider,
900
904
  {
901
905
  value: {
@@ -906,7 +910,7 @@ const de = oe(
906
910
  }
907
911
  );
908
912
  });
909
- function wt() {
913
+ function Rt() {
910
914
  const n = re(de), e = z(null);
911
915
  if (n === void 0) {
912
916
  const [t, i] = e;
@@ -923,15 +927,15 @@ var Ie = {
923
927
  className: void 0,
924
928
  style: void 0,
925
929
  attr: void 0
926
- }, ne = E.createContext && E.createContext(Ie), B = globalThis && globalThis.__assign || function() {
927
- return B = Object.assign || function(n) {
930
+ }, ne = E.createContext && E.createContext(Ie), K = globalThis && globalThis.__assign || function() {
931
+ return K = Object.assign || function(n) {
928
932
  for (var e, t = 1, i = arguments.length; t < i; t++) {
929
933
  e = arguments[t];
930
934
  for (var o in e)
931
935
  Object.prototype.hasOwnProperty.call(e, o) && (n[o] = e[o]);
932
936
  }
933
937
  return n;
934
- }, B.apply(this, arguments);
938
+ }, K.apply(this, arguments);
935
939
  }, kt = globalThis && globalThis.__rest || function(n, e) {
936
940
  var t = {};
937
941
  for (var i in n)
@@ -943,28 +947,28 @@ var Ie = {
943
947
  };
944
948
  function Ce(n) {
945
949
  return n && n.map(function(e, t) {
946
- return E.createElement(e.tag, B({
950
+ return E.createElement(e.tag, K({
947
951
  key: t
948
952
  }, e.attr), Ce(e.child));
949
953
  });
950
954
  }
951
955
  function me(n) {
952
956
  return function(e) {
953
- return E.createElement(Lt, B({
954
- attr: B({}, n.attr)
957
+ return E.createElement(Wt, K({
958
+ attr: K({}, n.attr)
955
959
  }, e), Ce(n.child));
956
960
  };
957
961
  }
958
- function Lt(n) {
962
+ function Wt(n) {
959
963
  var e = function(t) {
960
964
  var i = n.attr, o = n.size, l = n.title, r = kt(n, ["attr", "size", "title"]), I = o || t.size || "1em", C;
961
- return t.className && (C = t.className), n.className && (C = (C ? C + " " : "") + n.className), E.createElement("svg", B({
965
+ return t.className && (C = t.className), n.className && (C = (C ? C + " " : "") + n.className), E.createElement("svg", K({
962
966
  stroke: "currentColor",
963
967
  fill: "currentColor",
964
968
  strokeWidth: "0"
965
969
  }, t.attr, i, r, {
966
970
  className: C,
967
- style: B(B({
971
+ style: K(K({
968
972
  color: n.color || t.color
969
973
  }, t.style), n.style),
970
974
  height: I,
@@ -976,27 +980,29 @@ function Lt(n) {
976
980
  return e(t);
977
981
  }) : e(Ie);
978
982
  }
979
- function Wt(n) {
983
+ function Lt(n) {
980
984
  return me({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z" } }] })(n);
981
985
  }
982
986
  function Ft(n) {
983
987
  return me({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0080 446.25h340.89a32 32 0 0028.18-47.17zm-198.6-1.83a20 20 0 1120-20 20 20 0 01-20 20zm21.72-201.15l-5.74 122a16 16 0 01-32 0l-5.74-121.95a21.73 21.73 0 0121.5-22.69h.21a21.74 21.74 0 0121.73 22.7z" } }] })(n);
984
988
  }
985
- const Zt = ({ lspProps: { lastError: n, reload: e } }) => {
989
+ const Zt = ({
990
+ lspProps: { lastError: n, reload: e }
991
+ }) => {
986
992
  const [t, i] = z(!1), o = () => {
987
993
  e();
988
994
  }, l = () => {
989
995
  i(!1);
990
996
  };
991
- return D(() => {
997
+ return J(() => {
992
998
  i(!!n);
993
- }, [n]), t ? /* @__PURE__ */ J("div", { className: "flex items-center border-b border-fd-gray-darker bg-grey-800 px-2 py-1.5 text-xs text-grey-50", children: [
994
- /* @__PURE__ */ J("span", { className: "flex flex-1 justify-center gap-1", children: [
995
- /* @__PURE__ */ R(Ft, { className: "h-4 w-4 text-yellow-600" }),
996
- /* @__PURE__ */ J("span", { children: [
999
+ }, [n]), t ? /* @__PURE__ */ D("div", { className: "flex items-center border-b border-fd-gray-darker bg-grey-800 px-2 py-1.5 text-xs text-grey-50", children: [
1000
+ /* @__PURE__ */ D("span", { className: "flex flex-1 justify-center gap-1", children: [
1001
+ /* @__PURE__ */ x(Ft, { className: "h-4 w-4 text-yellow-600" }),
1002
+ /* @__PURE__ */ D("span", { children: [
997
1003
  "LSP not loaded.",
998
1004
  " ",
999
- /* @__PURE__ */ R(
1005
+ /* @__PURE__ */ x(
1000
1006
  "button",
1001
1007
  {
1002
1008
  className: "text-primary-dark underline",
@@ -1006,8 +1012,8 @@ const Zt = ({ lspProps: { lastError: n, reload: e } }) => {
1006
1012
  )
1007
1013
  ] })
1008
1014
  ] }),
1009
- /* @__PURE__ */ R("button", { className: "focus:outline-none", children: /* @__PURE__ */ R(
1010
- Wt,
1015
+ /* @__PURE__ */ x("button", { className: "focus:outline-none", children: /* @__PURE__ */ x(
1016
+ Lt,
1011
1017
  {
1012
1018
  className: "h-4 w-4 text-white",
1013
1019
  onClick: l
@@ -1042,7 +1048,7 @@ const Zt = ({ lspProps: { lastError: n, reload: e } }) => {
1042
1048
  ]
1043
1049
  };
1044
1050
  }
1045
- }, Xt = "#/definitions/Condition", Bt = {
1051
+ }, Xt = "#/definitions/Condition", Kt = {
1046
1052
  Base: {
1047
1053
  type: "object",
1048
1054
  properties: {
@@ -1310,9 +1316,9 @@ const Zt = ({ lspProps: { lastError: n, reload: e } }) => {
1310
1316
  "ref"
1311
1317
  ]
1312
1318
  }
1313
- }, Kt = {
1319
+ }, Bt = {
1314
1320
  $ref: Xt,
1315
- definitions: Bt
1321
+ definitions: Kt
1316
1322
  };
1317
1323
  function Et(n, e) {
1318
1324
  const t = document.createElement("style");
@@ -1326,10 +1332,10 @@ function Tt(n) {
1326
1332
  function Ot(n, e) {
1327
1333
  const t = [];
1328
1334
  let i = [];
1329
- const o = [], l = (a, g, w, k) => {
1335
+ const o = [], l = (a, g, R, k) => {
1330
1336
  t.push({
1331
1337
  startLineNumber: a,
1332
- endLineNumber: w,
1338
+ endLineNumber: R,
1333
1339
  startColumn: g,
1334
1340
  endColumn: k
1335
1341
  }), h(), C();
@@ -1347,7 +1353,7 @@ function Ot(n, e) {
1347
1353
  }
1348
1354
  }, h = () => {
1349
1355
  const a = n.getModel();
1350
- a && (i = Jt(
1356
+ a && (i = Dt(
1351
1357
  t.map((g) => [
1352
1358
  a.getOffsetAt({
1353
1359
  lineNumber: g.startLineNumber,
@@ -1373,12 +1379,12 @@ function Ot(n, e) {
1373
1379
  }), f = n.onDidChangeModelContent((a) => {
1374
1380
  if (!a.isUndoing)
1375
1381
  for (const g of a.changes) {
1376
- const w = S(g);
1377
- if (w.isReplacement || w.isDeletion || w.isAddition) {
1382
+ const R = S(g);
1383
+ if (R.isReplacement || R.isDeletion || R.isAddition) {
1378
1384
  const k = t.some(
1379
1385
  (b) => g.range.startLineNumber >= b.startLineNumber && g.range.endLineNumber <= b.endLineNumber && g.range.startColumn >= b.startColumn && g.range.endColumn <= b.endColumn
1380
- ), K = !k && e && g.range.startLineNumber === 1 && g.range.startColumn === 1 && !se(g.text);
1381
- if (k || K) {
1386
+ ), B = !k && e && g.range.startLineNumber === 1 && g.range.startColumn === 1 && !se(g.text);
1387
+ if (k || B) {
1382
1388
  const b = n.getModel();
1383
1389
  if (b) {
1384
1390
  b.undo();
@@ -1387,10 +1393,10 @@ function Ot(n, e) {
1387
1393
  }
1388
1394
  }
1389
1395
  }
1390
- }), N = () => {
1396
+ }), y = () => {
1391
1397
  p.dispose(), f.dispose();
1392
1398
  };
1393
- let x = [], v = `
1399
+ let w = [], v = `
1394
1400
  .idoc-readonly-mark {
1395
1401
  cursor: not-allowed;
1396
1402
  z-index: 1;
@@ -1400,22 +1406,22 @@ function Ot(n, e) {
1400
1406
  const a = "monaco-read-only";
1401
1407
  Tt(a) || Et(v, a), v = null;
1402
1408
  }
1403
- const y = () => {
1409
+ const N = () => {
1404
1410
  r(m), m();
1405
1411
  }, A = () => {
1406
- I(m), x = n.deltaDecorations(x, []);
1412
+ I(m), w = n.deltaDecorations(w, []);
1407
1413
  }, m = () => {
1408
1414
  const a = n.getModel();
1409
- a && (x = n.deltaDecorations(
1410
- x,
1415
+ a && (w = n.deltaDecorations(
1416
+ w,
1411
1417
  i.map(F(a))
1412
1418
  ));
1413
1419
  }, F = (a) => (g) => {
1414
- const w = a.getPositionAt(g[0]), k = a.getPositionAt(g[1]);
1420
+ const R = a.getPositionAt(g[0]), k = a.getPositionAt(g[1]);
1415
1421
  return {
1416
1422
  range: new s.Range(
1417
- w.lineNumber,
1418
- w.column,
1423
+ R.lineNumber,
1424
+ R.column,
1419
1425
  k.lineNumber,
1420
1426
  k.column
1421
1427
  ),
@@ -1431,8 +1437,8 @@ function Ot(n, e) {
1431
1437
  exclude: l,
1432
1438
  attach: r,
1433
1439
  detach: I,
1434
- dispose: N,
1435
- show: y,
1440
+ dispose: y,
1441
+ show: N,
1436
1442
  hide: A
1437
1443
  };
1438
1444
  }
@@ -1441,21 +1447,21 @@ function Gt(n, e, t) {
1441
1447
  const o = (A) => A[1] < A[0] ? (i = !0, [[A[1], A[0]]]) : [[...A]], l = (A) => i ? A.map((m) => m[1] > m[0] ? I(m) : m).reverse() : A;
1442
1448
  let r;
1443
1449
  const I = (A) => (r = A[1], A[1] = A[0], A[0] = r, A), C = o(n);
1444
- let h, S, p, f, N, x, v, y;
1450
+ let h, S, p, f, y, w, v, N;
1445
1451
  p = C[0];
1446
1452
  for (S of e)
1447
- for (v = S[0], y = S[1], f = 0; f < C.length; f++) {
1448
- if (p = C[f], N = p[0], x = p[1], N < v)
1449
- x < v ? h = [p] : x <= y ? h = [[N, v - 1]] : h = [
1450
- [N, v - 1],
1451
- [y + 1, x]
1453
+ for (v = S[0], N = S[1], f = 0; f < C.length; f++) {
1454
+ if (p = C[f], y = p[0], w = p[1], y < v)
1455
+ w < v ? h = [p] : w <= N ? h = [[y, v - 1]] : h = [
1456
+ [y, v - 1],
1457
+ [N + 1, w]
1452
1458
  ];
1453
- else if (N <= y)
1459
+ else if (y <= N)
1454
1460
  if (v === Number.NEGATIVE_INFINITY) {
1455
- const A = y + 1;
1456
- h = t === 0 ? [] : [[A, x > A ? x : A]];
1461
+ const A = N + 1;
1462
+ h = t === 0 ? [] : [[A, w > A ? w : A]];
1457
1463
  } else
1458
- y === Number.POSITIVE_INFINITY ? h = t === 0 ? [] : [[v - 1, v - 1]] : x <= y ? h = t < 0 ? [[v - 1, v - 1]] : t > 0 ? [[y + 1, y + 1]] : [] : h = [[y + 1, x]];
1464
+ N === Number.POSITIVE_INFINITY ? h = t === 0 ? [] : [[v - 1, v - 1]] : w <= N ? h = t < 0 ? [[v - 1, v - 1]] : t > 0 ? [[N + 1, N + 1]] : [] : h = [[N + 1, w]];
1459
1465
  else
1460
1466
  h = [p];
1461
1467
  if (C.splice(f, 1, ...h), C.length === 1 && C[0][1] < v)
@@ -1463,7 +1469,7 @@ function Gt(n, e, t) {
1463
1469
  }
1464
1470
  return l(C);
1465
1471
  }
1466
- function Jt(n, e) {
1472
+ function Dt(n, e) {
1467
1473
  if (n.length < 2)
1468
1474
  return n;
1469
1475
  const t = [];
@@ -1478,20 +1484,20 @@ function Jt(n, e) {
1478
1484
  function Y(n, e) {
1479
1485
  return e.bind(n);
1480
1486
  }
1481
- class Dt {
1487
+ class Jt {
1482
1488
  constructor(e, t) {
1483
- W(this, "editor");
1484
- W(this, "intervals");
1485
- W(this, "disposables", []);
1489
+ L(this, "editor");
1490
+ L(this, "intervals");
1491
+ L(this, "disposables", []);
1486
1492
  /**
1487
1493
  * Flag for `excludeIntervals`
1488
1494
  */
1489
- W(this, "prefer", 1);
1490
- W(this, "lastPrefer", 1);
1495
+ L(this, "prefer", 1);
1496
+ L(this, "lastPrefer", 1);
1491
1497
  /**
1492
1498
  * Linked to ICodeEditor.onDidChangeCursorPosition event.
1493
1499
  */
1494
- W(this, "onCursor", Y(
1500
+ L(this, "onCursor", Y(
1495
1501
  this,
1496
1502
  function(e) {
1497
1503
  if (e.source === "api")
@@ -1500,16 +1506,16 @@ class Dt {
1500
1506
  t.length !== 0 && this.editor.setSelections(t);
1501
1507
  }
1502
1508
  ));
1503
- W(this, "onRectangleSelectionStart", Y(this, function({ event: e }) {
1509
+ L(this, "onRectangleSelectionStart", Y(this, function({ event: e }) {
1504
1510
  e.middleButton && (this.lastPrefer = this.prefer, this.prefer = 0, window.addEventListener("pointerup", this.onRectangleSelectionStop));
1505
1511
  }));
1506
- W(this, "onRectangleSelectionStop", Y(this, function() {
1512
+ L(this, "onRectangleSelectionStop", Y(this, function() {
1507
1513
  this.prefer = this.lastPrefer, window.removeEventListener("pointerup", this.onRectangleSelectionStop);
1508
1514
  }));
1509
1515
  /**
1510
1516
  * Linked to ICodeEditor.onKeyDown event.
1511
1517
  */
1512
- W(this, "onKey", Y(this, function(e) {
1518
+ L(this, "onKey", Y(this, function(e) {
1513
1519
  const t = e.keyCode, i = s.KeyCode;
1514
1520
  if (e.altKey || i.F1 <= t && t <= i.F19 || e.ctrlKey && t !== i.Backspace)
1515
1521
  return;
@@ -1531,7 +1537,7 @@ class Dt {
1531
1537
  return;
1532
1538
  o.findIndex(r) !== -1 && (e.stopPropagation(), e.preventDefault());
1533
1539
  }));
1534
- W(this, "getOffsetAt", Y(this, function(e) {
1540
+ L(this, "getOffsetAt", Y(this, function(e) {
1535
1541
  let t;
1536
1542
  for (let i = 0; i < this.intervals.buffer.length; i++)
1537
1543
  if (t = this.intervals.buffer[i], e <= t[1])
@@ -1587,13 +1593,13 @@ class Dt {
1587
1593
  ]);
1588
1594
  }
1589
1595
  }
1590
- const Mt = new RegExp("^[ s]+(exposed|Function)", "i"), ie = () => /* @__PURE__ */ R("div", { className: "absolute inset-0 animate-pulse", children: /* @__PURE__ */ R("div", { className: "w-full space-y-4 px-4 py-1", children: /* @__PURE__ */ J("div", { className: "space-y-2", children: [
1591
- /* @__PURE__ */ R("div", { className: "h-3 w-3/4 rounded bg-grey-200" }),
1592
- /* @__PURE__ */ R("div", { className: "h-3 rounded bg-grey-200" }),
1593
- /* @__PURE__ */ R("div", { className: "h-3 w-5/6 rounded bg-grey-200" }),
1594
- /* @__PURE__ */ R("div", { className: "h-3 rounded bg-grey-200" }),
1595
- /* @__PURE__ */ R("div", { className: "h-3 rounded bg-grey-200" })
1596
- ] }) }) }), Rn = ({
1596
+ const Mt = new RegExp("^[ s]+(exposed|Function)", "i"), ie = () => /* @__PURE__ */ x("div", { className: "absolute inset-0 animate-pulse", children: /* @__PURE__ */ x("div", { className: "w-full space-y-4 px-4 py-1", children: /* @__PURE__ */ D("div", { className: "space-y-2", children: [
1597
+ /* @__PURE__ */ x("div", { className: "h-3 w-3/4 rounded bg-grey-200" }),
1598
+ /* @__PURE__ */ x("div", { className: "h-3 rounded bg-grey-200" }),
1599
+ /* @__PURE__ */ x("div", { className: "h-3 w-5/6 rounded bg-grey-200" }),
1600
+ /* @__PURE__ */ x("div", { className: "h-3 rounded bg-grey-200" }),
1601
+ /* @__PURE__ */ x("div", { className: "h-3 rounded bg-grey-200" })
1602
+ ] }) }) }), xn = ({
1597
1603
  path: n,
1598
1604
  initialValue: e,
1599
1605
  theme: t = "fd-dark",
@@ -1606,61 +1612,61 @@ const Mt = new RegExp("^[ s]+(exposed|Function)", "i"), ie = () => /* @__PURE__
1606
1612
  lspProps: h,
1607
1613
  ...S
1608
1614
  }) => {
1609
- const { initialLineInfo: p, initialSelectionInfo: f } = I, { editor: N, setEditor: x } = wt(), { inited: v } = h;
1610
- function y(m) {
1615
+ const { initialLineInfo: p, initialSelectionInfo: f } = I, { editor: y, setEditor: w } = Rt(), { inited: v } = h;
1616
+ function N(m) {
1611
1617
  o === "css" && m.languages.registerCompletionItemProvider("css", jt), o === "json" && m.languages.json && m.languages.json.jsonDefaults.setDiagnosticsOptions({
1612
1618
  validate: !0,
1613
1619
  schemas: [
1614
1620
  {
1615
1621
  uri: "condition-schema.json",
1616
1622
  fileMatch: ["*.condition.json"],
1617
- schema: Kt
1623
+ schema: Bt
1618
1624
  }
1619
1625
  ]
1620
1626
  });
1621
1627
  }
1622
1628
  function A(m, F) {
1623
- x(m);
1629
+ w(m);
1624
1630
  const a = m.getModel();
1625
1631
  if (a && (a.updateOptions({ insertSpaces: !1 }), m.onKeyUp(() => {
1626
- var w;
1627
- const g = (w = m.getPosition()) == null ? void 0 : w.lineNumber;
1632
+ var R;
1633
+ const g = (R = m.getPosition()) == null ? void 0 : R.lineNumber;
1628
1634
  if (g) {
1629
- const k = a.getLineFirstNonWhitespaceColumn(g), K = a.getLineLength(g), b = a.getLineContent(g);
1635
+ const k = a.getLineFirstNonWhitespaceColumn(g), B = a.getLineLength(g), b = a.getLineContent(g);
1630
1636
  Mt.test(b) && m.executeEdits("edit-handler", [
1631
1637
  {
1632
1638
  range: new F.Range(
1633
1639
  g,
1634
1640
  0,
1635
1641
  g,
1636
- K
1642
+ B
1637
1643
  ),
1638
1644
  text: b.substr(
1639
1645
  k - 1,
1640
- K - k
1646
+ B - k
1641
1647
  )
1642
1648
  }
1643
1649
  ]);
1644
1650
  }
1645
- })), i === Le.METHOD && se(e)) {
1646
- const g = new Dt(m, !0);
1651
+ })), i === We.METHOD && se(e)) {
1652
+ const g = new Jt(m, !0);
1647
1653
  g.exclude(1, 1, 1, Number.POSITIVE_INFINITY), g.enable();
1648
1654
  }
1649
1655
  }
1650
- return D(() => {
1651
- if (!N)
1656
+ return J(() => {
1657
+ if (!y)
1652
1658
  return;
1653
1659
  const { line: m, offset: F } = p || {};
1654
- m && pt(N, m, F);
1655
- }, [p, N]), D(() => {
1656
- if (!N)
1660
+ m && pt(y, m, F);
1661
+ }, [p, y]), J(() => {
1662
+ if (!y)
1657
1663
  return;
1658
1664
  const { selection: m } = f || {};
1659
- m && At(N, m);
1660
- }, [f, N]), v ? /* @__PURE__ */ J(Ne, { children: [
1661
- C ? /* @__PURE__ */ R(Zt, { lspProps: h }) : null,
1662
- /* @__PURE__ */ R(
1663
- we,
1665
+ m && At(y, m);
1666
+ }, [f, y]), v ? /* @__PURE__ */ D(ye, { children: [
1667
+ C ? /* @__PURE__ */ x(Zt, { lspProps: h }) : null,
1668
+ /* @__PURE__ */ x(
1669
+ Re,
1664
1670
  {
1665
1671
  options: {
1666
1672
  readOnly: !0,
@@ -1674,13 +1680,13 @@ const Mt = new RegExp("^[ s]+(exposed|Function)", "i"), ie = () => /* @__PURE__
1674
1680
  theme: "fd-dark",
1675
1681
  onChange: (m) => l && l(m || ""),
1676
1682
  language: o,
1677
- beforeMount: y,
1683
+ beforeMount: N,
1678
1684
  onMount: A,
1679
- loading: /* @__PURE__ */ R(ie, {}),
1685
+ loading: /* @__PURE__ */ x(ie, {}),
1680
1686
  ...S
1681
1687
  }
1682
1688
  )
1683
- ] }) : /* @__PURE__ */ R(ie, {});
1689
+ ] }) : /* @__PURE__ */ x(ie, {});
1684
1690
  }, Vt = {
1685
1691
  name: "4d",
1686
1692
  displayName: "%displayName%",
@@ -1706,7 +1712,7 @@ const Mt = new RegExp("^[ s]+(exposed|Function)", "i"), ie = () => /* @__PURE__
1706
1712
  }
1707
1713
  ]
1708
1714
  }
1709
- }, { registerFileUrl: _, whenReady: wn } = at(Vt, void 0, {
1715
+ }, { registerFileUrl: _, whenReady: Rn } = at(Vt, void 0, {
1710
1716
  system: !0
1711
1717
  });
1712
1718
  _(
@@ -1721,7 +1727,7 @@ _(
1721
1727
  );
1722
1728
  _(
1723
1729
  "package.json",
1724
- new URL("data:application/json;base64,ewogICAgIm5hbWUiOiAiNGQiLAogICAgImRpc3BsYXlOYW1lIjogIiVkaXNwbGF5TmFtZSUiLAogICAgImRlc2NyaXB0aW9uIjogIiVkZXNjcmlwdGlvbiUiLAogICAgInZlcnNpb24iOiAiMS4wLjAiLAogICAgInB1Ymxpc2hlciI6ICJ2c2NvZGUiLAogICAgImxpY2Vuc2UiOiAiTUlUIiwKICAgICJlbmdpbmVzIjogewogICAgICAgICJ2c2NvZGUiOiAiMC4xMC54IgogICAgfSwKICAgICJzY3JpcHRzIjogewogICAgICAgICJ1cGRhdGUtZ3JhbW1hciI6ICJub2RlIC4uL25vZGVfbW9kdWxlcy92c2NvZGUtZ3JhbW1hci11cGRhdGVyL2JpbiBtaWNyb3NvZnQvdnNjb2RlLTRkIGdyYW1tYXJzLzRkLmNzb24gLi9zeW50YXhlcy80ZC50bUxhbmd1YWdlLmpzb24iCiAgICB9LAogICAgImNhdGVnb3JpZXMiOiBbCiAgICAgICAgIlByb2dyYW1taW5nIExhbmd1YWdlcyIKICAgIF0sCiAgICAiY29udHJpYnV0ZXMiOiB7CiAgICAgICAgImxhbmd1YWdlcyI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICJpZCI6ICI0ZCIsCiAgICAgICAgICAgICAgImFsaWFzZXMiOiBbIjREIiwgIjRkIl0sCiAgICAgICAgICAgICAgImV4dGVuc2lvbnMiOiBbIi40ZG0iLCAiLjRxcyJdLAogICAgICAgICAgICAgICJjb25maWd1cmF0aW9uIjogIi4vbGFuZ3VhZ2UtY29uZmlndXJhdGlvbi5qc29uIgogICAgICAgICAgICB9CiAgICAgICAgICBdLAogICAgICAgICAgImdyYW1tYXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgImxhbmd1YWdlIjogIjRkIiwKICAgICAgICAgICAgICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICAgICAgICAgICAgICJwYXRoIjogIi4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogICAgICAgICAgICB9CiAgICAgICAgICBdCiAgICB9LAogICAgInJlcG9zaXRvcnkiOiB7CiAgICAgICAgInR5cGUiOiAiZ2l0IiwKICAgICAgICAidXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9taWNyb3NvZnQvdnNjb2RlLmdpdCIKICAgIH0KfQ==", self.location).toString(),
1730
+ new URL("data:application/json;base64,ewogICJuYW1lIjogIjRkIiwKICAiZGlzcGxheU5hbWUiOiAiJWRpc3BsYXlOYW1lJSIsCiAgImRlc2NyaXB0aW9uIjogIiVkZXNjcmlwdGlvbiUiLAogICJ2ZXJzaW9uIjogIjEuMC4wIiwKICAicHVibGlzaGVyIjogInZzY29kZSIsCiAgImxpY2Vuc2UiOiAiTUlUIiwKICAiZW5naW5lcyI6IHsKICAgICJ2c2NvZGUiOiAiMC4xMC54IgogIH0sCiAgInNjcmlwdHMiOiB7CiAgICAidXBkYXRlLWdyYW1tYXIiOiAibm9kZSAuLi9ub2RlX21vZHVsZXMvdnNjb2RlLWdyYW1tYXItdXBkYXRlci9iaW4gbWljcm9zb2Z0L3ZzY29kZS00ZCBncmFtbWFycy80ZC5jc29uIC4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogIH0sCiAgImNhdGVnb3JpZXMiOiBbCiAgICAiUHJvZ3JhbW1pbmcgTGFuZ3VhZ2VzIgogIF0sCiAgImNvbnRyaWJ1dGVzIjogewogICAgImxhbmd1YWdlcyI6IFsKICAgICAgewogICAgICAgICJpZCI6ICI0ZCIsCiAgICAgICAgImFsaWFzZXMiOiBbCiAgICAgICAgICAiNEQiLAogICAgICAgICAgIjRkIgogICAgICAgIF0sCiAgICAgICAgImV4dGVuc2lvbnMiOiBbCiAgICAgICAgICAiLjRkbSIsCiAgICAgICAgICAiLjRxcyIKICAgICAgICBdLAogICAgICAgICJjb25maWd1cmF0aW9uIjogIi4vbGFuZ3VhZ2UtY29uZmlndXJhdGlvbi5qc29uIgogICAgICB9CiAgICBdLAogICAgImdyYW1tYXJzIjogWwogICAgICB7CiAgICAgICAgImxhbmd1YWdlIjogIjRkIiwKICAgICAgICAic2NvcGVOYW1lIjogInNvdXJjZS40ZG0iLAogICAgICAgICJwYXRoIjogIi4vc3ludGF4ZXMvNGQudG1MYW5ndWFnZS5qc29uIgogICAgICB9CiAgICBdCiAgfSwKICAicmVwb3NpdG9yeSI6IHsKICAgICJ0eXBlIjogImdpdCIsCiAgICAidXJsIjogImh0dHBzOi8vZ2l0aHViLmNvbS9taWNyb3NvZnQvdnNjb2RlLmdpdCIKICB9Cn0K", self.location).toString(),
1725
1731
  { mimeType: "application/json", size: 1006 }
1726
1732
  );
1727
1733
  _(
@@ -1731,9 +1737,9 @@ _(
1731
1737
  );
1732
1738
  export {
1733
1739
  Zt as Alerts,
1734
- Rn as CodeEditor,
1735
- xn as CodeEditorProvider,
1736
- Nn as LSPProvider,
1740
+ xn as CodeEditor,
1741
+ wn as CodeEditorProvider,
1742
+ yn as LSPProvider,
1737
1743
  ae as _await,
1738
1744
  Ct as configureServices,
1739
1745
  j as getFileSystemPath,
@@ -1741,7 +1747,7 @@ export {
1741
1747
  It as initMonacoUserConfiguration,
1742
1748
  pt as jumpToLine,
1743
1749
  At as jumpToSelection,
1744
- wt as useCodeEditor,
1745
- yn as useLSP
1750
+ Rt as useCodeEditor,
1751
+ Nn as useLSP
1746
1752
  };
1747
1753
  //# sourceMappingURL=index.es.js.map