@xiping/react-components 1.0.22 → 1.0.24

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.
Files changed (33) hide show
  1. package/dist/cjs/components/confetti-button/index.d.ts +4 -4
  2. package/dist/cjs/components/confetti-button/index.js +1 -1
  3. package/dist/cjs/components/dock/Duck.js +1 -1
  4. package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
  5. package/dist/cjs/components/pointer/Pointer.d.ts +13 -0
  6. package/dist/cjs/components/pointer/Pointer.js +1 -0
  7. package/dist/cjs/components/pointer/index.d.ts +2 -0
  8. package/dist/cjs/components/sparkles-text/SparklesText.d.ts +43 -0
  9. package/dist/cjs/components/sparkles-text/SparklesText.js +1 -0
  10. package/dist/cjs/components/sparkles-text/index.d.ts +2 -0
  11. package/dist/cjs/components/txt-editor/TxtEditor.js +1 -1
  12. package/dist/cjs/components/txt-reader/TxtReader.js +1 -1
  13. package/dist/cjs/index.d.ts +2 -0
  14. package/dist/cjs/index.js +1 -1
  15. package/dist/cjs/node_modules/.pnpm/@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@monaco-editor/react/dist/index.js +1 -1
  16. package/dist/cjs/react-components.css +1 -1
  17. package/dist/es/components/confetti-button/index.d.ts +4 -4
  18. package/dist/es/components/confetti-button/index.js +33 -33
  19. package/dist/es/components/dock/Duck.js +31 -32
  20. package/dist/es/components/pinch-content/PinchContent.js +27 -29
  21. package/dist/es/components/pointer/Pointer.d.ts +13 -0
  22. package/dist/es/components/pointer/Pointer.js +77 -0
  23. package/dist/es/components/pointer/index.d.ts +2 -0
  24. package/dist/es/components/sparkles-text/SparklesText.d.ts +43 -0
  25. package/dist/es/components/sparkles-text/SparklesText.js +70 -0
  26. package/dist/es/components/sparkles-text/index.d.ts +2 -0
  27. package/dist/es/components/txt-editor/TxtEditor.js +29 -29
  28. package/dist/es/components/txt-reader/TxtReader.js +41 -41
  29. package/dist/es/index.d.ts +2 -0
  30. package/dist/es/index.js +24 -18
  31. package/dist/es/node_modules/.pnpm/@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@monaco-editor/react/dist/index.js +127 -142
  32. package/dist/es/react-components.css +1 -1
  33. package/package.json +9 -9
@@ -1,78 +1,78 @@
1
- import { jsxs as E, Fragment as F, jsx as t } from "react/jsx-runtime";
2
- import { useRef as c } from "react";
3
- import e from "clsx";
4
- import { useScroll as _, useTransform as v, useMotionTemplate as y, motion as n } from "motion/react";
5
- import g from "./index.module.css.js";
1
+ import { jsxs as w, Fragment as E, jsx as e } from "react/jsx-runtime";
2
+ import { useRef as i } from "react";
3
+ import t from "clsx";
4
+ import { useScroll as F, useTransform as _, useMotionTemplate as v, motion as n } from "motion/react";
5
+ import y from "./index.module.css.js";
6
6
  const I = 16, L = 1.5, R = "normal", k = ({
7
- content: a,
8
- lineHeight: f = L,
9
- fontSize: m = I,
10
- fontWeight: p = R,
11
- className: d = "",
12
- style: u = {},
13
- onProgressChange: r,
7
+ content: c,
8
+ lineHeight: a = L,
9
+ fontSize: f = I,
10
+ fontWeight: m = R,
11
+ className: p = "",
12
+ style: d = {},
13
+ onProgressChange: u,
14
14
  initialScrollPosition: S,
15
15
  cacheKey: A,
16
- showTopProgress: x = !0,
17
- topProgressClassName: T,
18
- showBottomProgress: b = !0,
19
- bottomProgressClassName: h
16
+ showTopProgress: g = !0,
17
+ topProgressClassName: h,
18
+ showBottomProgress: x = !0,
19
+ bottomProgressClassName: T
20
20
  }) => {
21
- const l = c(null), o = c(null), { scrollYProgress: i } = _({
22
- container: l,
21
+ const r = i(null), o = i(null), { scrollYProgress: l } = F({
22
+ container: r,
23
23
  target: o
24
- }), s = v(() => (i.get() * 100).toFixed(2).replace(/\.0*$/, "")), N = y`${s}%`;
25
- return s.on("change", (w) => {
26
- r == null || r(Number(w));
27
- }), /* @__PURE__ */ E(F, { children: [
28
- x && /* @__PURE__ */ t(
24
+ }), s = _(() => (l.get() * 100).toFixed(2).replace(/\.0*$/, "")), b = v`${s}%`;
25
+ return s.on("change", (N) => {
26
+ u?.(Number(N));
27
+ }), /* @__PURE__ */ w(E, { children: [
28
+ g && /* @__PURE__ */ e(
29
29
  n.div,
30
30
  {
31
31
  id: "scroll-indicator",
32
- className: e(
32
+ className: t(
33
33
  "fixed left-0 top-0 right-0 bg-[#ff0088] h-2.5",
34
- T
34
+ h
35
35
  ),
36
36
  style: {
37
- scaleX: i,
37
+ scaleX: l,
38
38
  originX: 0
39
39
  }
40
40
  }
41
41
  ),
42
- /* @__PURE__ */ t(
42
+ /* @__PURE__ */ e(
43
43
  "div",
44
44
  {
45
- className: e(
45
+ className: t(
46
46
  "relative w-full h-full overflow-y-auto",
47
- g.textContent
47
+ y.textContent
48
48
  // "scrollbar-thumb-rounded-full scrollbar-track-rounded-full scrollbar scrollbar-thumb-slate-700 scrollbar-track-slate-300",
49
49
  ),
50
- ref: l,
51
- children: /* @__PURE__ */ t(
50
+ ref: r,
51
+ children: /* @__PURE__ */ e(
52
52
  "div",
53
53
  {
54
54
  ref: o,
55
- className: e("w-full whitespace-pre-wrap break-words", d),
55
+ className: t("w-full whitespace-pre-wrap break-words", p),
56
56
  style: {
57
- fontSize: `${m}px`,
58
- lineHeight: f,
59
- fontWeight: p,
60
- ...u
57
+ fontSize: `${f}px`,
58
+ lineHeight: a,
59
+ fontWeight: m,
60
+ ...d
61
61
  },
62
- children: a
62
+ children: c
63
63
  }
64
64
  )
65
65
  }
66
66
  ),
67
- b && /* @__PURE__ */ t(
67
+ x && /* @__PURE__ */ e(
68
68
  n.div,
69
69
  {
70
70
  id: "scroll-present",
71
- className: e(
71
+ className: t(
72
72
  "fixed text-white rounded text-sm bg-black bg-opacity-70 pl-2 pr-2 pb-1 pt-1 right-5 bottom-5",
73
- h
73
+ T
74
74
  ),
75
- children: N
75
+ children: b
76
76
  }
77
77
  )
78
78
  ] });
@@ -14,3 +14,5 @@ export * from './components/qr-code';
14
14
  export * from './components/react-force-graph-3d';
15
15
  export * from './components/confetti-button';
16
16
  export * from './hooks/useStayTimeReport';
17
+ export * from './components/pointer';
18
+ export * from './components/sparkles-text';
package/dist/es/index.js CHANGED
@@ -3,36 +3,42 @@ import { Button as e } from "./components/button/Button.js";
3
3
  import { TxtReader as f } from "./components/txt-reader/TxtReader.js";
4
4
  import { HyperText as x } from "./components/hyper-text/index.js";
5
5
  import { TypingAnimation as n } from "./components/typing-animation/index.js";
6
- import { QRCode as d } from "./components/qr-code/index.js";
6
+ import { QRCode as s } from "./components/qr-code/index.js";
7
7
  import { Confetti as u, ConfettiButton as c } from "./components/confetti-button/index.js";
8
- import { useStayTimeReport as C } from "./hooks/useStayTimeReport.js";
9
- import { default as l } from "./components/pinch-content/PinchContent.js";
10
- import { default as k } from "./components/image-viewer/ImageViewer.js";
8
+ import { useStayTimeReport as l } from "./hooks/useStayTimeReport.js";
9
+ import { default as g } from "./components/pinch-content/PinchContent.js";
10
+ import { default as h } from "./components/image-viewer/ImageViewer.js";
11
11
  import { ShimmerButton as B } from "./components/shimmer-button/ShimmerButton.js";
12
12
  import { default as I } from "./components/image-compare/ImageCompare.js";
13
- import { TextAnimate as A } from "./components/text-animate/TextAnimate.js";
14
- import { Dock as V, DockIcon as w, dockVariants as E } from "./components/dock/Duck.js";
15
- import { TxtEditor as G } from "./components/txt-editor/TxtEditor.js";
16
- import { Message as M } from "./components/message/Message.js";
13
+ import { TextAnimate as S } from "./components/text-animate/TextAnimate.js";
14
+ import { Dock as P, DockIcon as V, dockVariants as w } from "./components/dock/Duck.js";
15
+ import { TxtEditor as F } from "./components/txt-editor/TxtEditor.js";
16
+ import { Message as H } from "./components/message/Message.js";
17
17
  import { default as Q } from "./node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js";
18
+ import { default as j } from "./node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js";
19
+ import { Pointer as v } from "./components/pointer/Pointer.js";
20
+ import { SparklesText as J } from "./components/sparkles-text/SparklesText.js";
18
21
  export {
19
22
  e as Button,
20
23
  u as Confetti,
21
24
  c as ConfettiButton,
22
- V as Dock,
23
- w as DockIcon,
25
+ P as Dock,
26
+ V as DockIcon,
24
27
  Q as ForceGraph3D,
25
28
  x as HyperText,
26
29
  I as ImageCompare,
27
- k as ImageViewer,
28
- M as Message,
29
- l as PinchContent,
30
- d as QRCode,
30
+ h as ImageViewer,
31
+ H as Message,
32
+ g as PinchContent,
33
+ v as Pointer,
34
+ s as QRCode,
31
35
  B as ShimmerButton,
32
- A as TextAnimate,
33
- G as TxtEditor,
36
+ J as SparklesText,
37
+ S as TextAnimate,
38
+ F as TxtEditor,
34
39
  f as TxtReader,
35
40
  n as TypingAnimation,
36
- E as dockVariants,
37
- C as useStayTimeReport
41
+ j as confetti,
42
+ w as dockVariants,
43
+ l as useStayTimeReport
38
44
  };
@@ -1,169 +1,154 @@
1
- import K from "../../../../../@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/loader/index.js";
2
- import b, { memo as q, useState as j, useRef as s, useCallback as $, useEffect as V } from "react";
3
- var ne = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, Z = ne, ie = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, ue = ie;
4
- function oe({ children: r }) {
5
- return b.createElement("div", { style: ue.container }, r);
1
+ import $ from "../../../../../@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/loader/index.js";
2
+ import k, { memo as X, useState as T, useRef as l, useCallback as Q, useEffect as E } from "react";
3
+ var te = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, J = te, ne = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, ie = ne;
4
+ function ue({ children: e }) {
5
+ return k.createElement("div", { style: ie.container }, e);
6
6
  }
7
- var ae = oe, le = ae;
8
- function ce({ width: r, height: u, isEditorReady: l, loading: n, _ref: p, className: h, wrapperProps: w }) {
9
- return b.createElement("section", { style: { ...Z.wrapper, width: r, height: u }, ...w }, !l && b.createElement(le, null, n), b.createElement("div", { ref: p, style: { ...Z.fullWidth, ...!l && Z.hide }, className: h }));
7
+ var oe = ue, ae = oe;
8
+ function le({ width: e, height: n, isEditorReady: u, loading: r, _ref: g, className: p, wrapperProps: v }) {
9
+ return k.createElement("section", { style: { ...J.wrapper, width: e, height: n }, ...v }, !u && k.createElement(ae, null, r), k.createElement("div", { ref: g, style: { ...J.fullWidth, ...!u && J.hide }, className: p }));
10
10
  }
11
- var de = ce, T = q(de);
12
- function se(r) {
13
- V(r, []);
11
+ var ce = le, q = X(ce);
12
+ function de(e) {
13
+ E(e, []);
14
14
  }
15
- var ee = se;
16
- function ge(r, u, l = !0) {
17
- let n = s(!0);
18
- V(n.current || !l ? () => {
19
- n.current = !1;
20
- } : r, u);
15
+ var K = de;
16
+ function se(e, n, u = !0) {
17
+ let r = l(!0);
18
+ E(r.current || !u ? () => {
19
+ r.current = !1;
20
+ } : e, n);
21
21
  }
22
- var m = ge;
23
- function I() {
22
+ var M = se;
23
+ function R() {
24
24
  }
25
- function P(r, u, l, n) {
26
- return fe(r, n) || pe(r, u, l, n);
25
+ function O(e, n, u, r) {
26
+ return fe(e, r) || ge(e, n, u, r);
27
27
  }
28
- function fe(r, u) {
29
- return r.editor.getModel(re(r, u));
28
+ function fe(e, n) {
29
+ return e.editor.getModel(ee(e, n));
30
30
  }
31
- function pe(r, u, l, n) {
32
- return r.editor.createModel(u, l, n ? re(r, n) : void 0);
31
+ function ge(e, n, u, r) {
32
+ return e.editor.createModel(n, u, r ? ee(e, r) : void 0);
33
33
  }
34
- function re(r, u) {
35
- return r.Uri.parse(u);
34
+ function ee(e, n) {
35
+ return e.Uri.parse(n);
36
36
  }
37
- function he({ original: r, modified: u, language: l, originalLanguage: n, modifiedLanguage: p, originalModelPath: h, modifiedModelPath: w, keepCurrentOriginalModel: C = !1, keepCurrentModifiedModel: A = !1, theme: L = "light", loading: R = "Loading...", options: E = {}, height: B = "100%", width: G = "100%", className: J, wrapperProps: Q = {}, beforeMount: X = I, onMount: Y = I }) {
38
- let [M, N] = j(!1), [k, d] = j(!0), g = s(null), c = s(null), D = s(null), f = s(Y), i = s(X), y = s(!1);
39
- ee(() => {
40
- let e = K.init();
41
- return e.then((o) => (c.current = o) && d(!1)).catch((o) => (o == null ? void 0 : o.type) !== "cancelation" && console.error("Monaco initialization: error:", o)), () => g.current ? U() : e.cancel();
42
- }), m(() => {
43
- if (g.current && c.current) {
44
- let e = g.current.getOriginalEditor(), o = P(c.current, r || "", n || l || "text", h || "");
45
- o !== e.getModel() && e.setModel(o);
37
+ function pe({ original: e, modified: n, language: u, originalLanguage: r, modifiedLanguage: g, originalModelPath: p, modifiedModelPath: v, keepCurrentOriginalModel: L = !1, keepCurrentModifiedModel: _ = !1, theme: w = "light", loading: b = "Loading...", options: m = {}, height: F = "100%", width: I = "100%", className: z, wrapperProps: H = {}, beforeMount: W = R, onMount: j = R }) {
38
+ let [h, y] = T(!1), [S, a] = T(!0), c = l(null), o = l(null), x = l(null), s = l(j), t = l(W), C = l(!1);
39
+ K(() => {
40
+ let i = $.init();
41
+ return i.then((d) => (o.current = d) && a(!1)).catch((d) => d?.type !== "cancelation" && console.error("Monaco initialization: error:", d)), () => c.current ? P() : i.cancel();
42
+ }), M(() => {
43
+ if (c.current && o.current) {
44
+ let i = c.current.getOriginalEditor(), d = O(o.current, e || "", r || u || "text", p || "");
45
+ d !== i.getModel() && i.setModel(d);
46
46
  }
47
- }, [h], M), m(() => {
48
- if (g.current && c.current) {
49
- let e = g.current.getModifiedEditor(), o = P(c.current, u || "", p || l || "text", w || "");
50
- o !== e.getModel() && e.setModel(o);
47
+ }, [p], h), M(() => {
48
+ if (c.current && o.current) {
49
+ let i = c.current.getModifiedEditor(), d = O(o.current, n || "", g || u || "text", v || "");
50
+ d !== i.getModel() && i.setModel(d);
51
51
  }
52
- }, [w], M), m(() => {
53
- let e = g.current.getModifiedEditor();
54
- e.getOption(c.current.editor.EditorOption.readOnly) ? e.setValue(u || "") : u !== e.getValue() && (e.executeEdits("", [{ range: e.getModel().getFullModelRange(), text: u || "", forceMoveMarkers: !0 }]), e.pushUndoStop());
55
- }, [u], M), m(() => {
56
- var e, o;
57
- (o = (e = g.current) == null ? void 0 : e.getModel()) == null || o.original.setValue(r || "");
58
- }, [r], M), m(() => {
59
- let { original: e, modified: o } = g.current.getModel();
60
- c.current.editor.setModelLanguage(e, n || l || "text"), c.current.editor.setModelLanguage(o, p || l || "text");
61
- }, [l, n, p], M), m(() => {
62
- var e;
63
- (e = c.current) == null || e.editor.setTheme(L);
64
- }, [L], M), m(() => {
65
- var e;
66
- (e = g.current) == null || e.updateOptions(E);
67
- }, [E], M);
68
- let z = $(() => {
69
- var O;
70
- if (!c.current) return;
71
- i.current(c.current);
72
- let e = P(c.current, r || "", n || l || "text", h || ""), o = P(c.current, u || "", p || l || "text", w || "");
73
- (O = g.current) == null || O.setModel({ original: e, modified: o });
74
- }, [l, u, p, r, n, h, w]), H = $(() => {
75
- var e;
76
- !y.current && D.current && (g.current = c.current.editor.createDiffEditor(D.current, { automaticLayout: !0, ...E }), z(), (e = c.current) == null || e.editor.setTheme(L), N(!0), y.current = !0);
77
- }, [E, L, z]);
78
- V(() => {
79
- M && f.current(g.current, c.current);
80
- }, [M]), V(() => {
81
- !k && !M && H();
82
- }, [k, M, H]);
83
- function U() {
84
- var o, O, S, _;
85
- let e = (o = g.current) == null ? void 0 : o.getModel();
86
- C || ((O = e == null ? void 0 : e.original) == null || O.dispose()), A || ((S = e == null ? void 0 : e.modified) == null || S.dispose()), (_ = g.current) == null || _.dispose();
52
+ }, [v], h), M(() => {
53
+ let i = c.current.getModifiedEditor();
54
+ i.getOption(o.current.editor.EditorOption.readOnly) ? i.setValue(n || "") : n !== i.getValue() && (i.executeEdits("", [{ range: i.getModel().getFullModelRange(), text: n || "", forceMoveMarkers: !0 }]), i.pushUndoStop());
55
+ }, [n], h), M(() => {
56
+ c.current?.getModel()?.original.setValue(e || "");
57
+ }, [e], h), M(() => {
58
+ let { original: i, modified: d } = c.current.getModel();
59
+ o.current.editor.setModelLanguage(i, r || u || "text"), o.current.editor.setModelLanguage(d, g || u || "text");
60
+ }, [u, r, g], h), M(() => {
61
+ o.current?.editor.setTheme(w);
62
+ }, [w], h), M(() => {
63
+ c.current?.updateOptions(m);
64
+ }, [m], h);
65
+ let N = Q(() => {
66
+ if (!o.current) return;
67
+ t.current(o.current);
68
+ let i = O(o.current, e || "", r || u || "text", p || ""), d = O(o.current, n || "", g || u || "text", v || "");
69
+ c.current?.setModel({ original: i, modified: d });
70
+ }, [u, n, g, e, r, p, v]), D = Q(() => {
71
+ !C.current && x.current && (c.current = o.current.editor.createDiffEditor(x.current, { automaticLayout: !0, ...m }), N(), o.current?.editor.setTheme(w), y(!0), C.current = !0);
72
+ }, [m, w, N]);
73
+ E(() => {
74
+ h && s.current(c.current, o.current);
75
+ }, [h]), E(() => {
76
+ !S && !h && D();
77
+ }, [S, h, D]);
78
+ function P() {
79
+ let i = c.current?.getModel();
80
+ L || i?.original?.dispose(), _ || i?.modified?.dispose(), c.current?.dispose();
87
81
  }
88
- return b.createElement(T, { width: G, height: B, isEditorReady: M, loading: R, _ref: D, className: J, wrapperProps: Q });
82
+ return k.createElement(q, { width: I, height: F, isEditorReady: h, loading: b, _ref: x, className: z, wrapperProps: H });
89
83
  }
90
- var Me = he;
91
- q(Me);
92
- function ve(r) {
93
- let u = s();
94
- return V(() => {
95
- u.current = r;
96
- }, [r]), u.current;
84
+ var he = pe;
85
+ X(he);
86
+ function Me(e) {
87
+ let n = l();
88
+ return E(() => {
89
+ n.current = e;
90
+ }, [e]), n.current;
97
91
  }
98
- var me = ve, W = /* @__PURE__ */ new Map();
99
- function we({ defaultValue: r, defaultLanguage: u, defaultPath: l, value: n, language: p, path: h, theme: w = "light", line: C, loading: A = "Loading...", options: L = {}, overrideServices: R = {}, saveViewState: E = !0, keepCurrentModel: B = !1, width: G = "100%", height: J = "100%", className: Q, wrapperProps: X = {}, beforeMount: Y = I, onMount: M = I, onChange: N, onValidate: k = I }) {
100
- let [d, g] = j(!1), [c, D] = j(!0), f = s(null), i = s(null), y = s(null), z = s(M), H = s(Y), U = s(), e = s(n), o = me(h), O = s(!1), S = s(!1);
101
- ee(() => {
102
- let t = K.init();
103
- return t.then((a) => (f.current = a) && D(!1)).catch((a) => (a == null ? void 0 : a.type) !== "cancelation" && console.error("Monaco initialization: error:", a)), () => i.current ? te() : t.cancel();
104
- }), m(() => {
105
- var a, v, F, x;
106
- let t = P(f.current, r || n || "", u || p || "", h || l || "");
107
- t !== ((a = i.current) == null ? void 0 : a.getModel()) && (E && W.set(o, (v = i.current) == null ? void 0 : v.saveViewState()), (F = i.current) == null || F.setModel(t), E && ((x = i.current) == null || x.restoreViewState(W.get(h))));
108
- }, [h], d), m(() => {
109
- var t;
110
- (t = i.current) == null || t.updateOptions(L);
111
- }, [L], d), m(() => {
112
- !i.current || n === void 0 || (i.current.getOption(f.current.editor.EditorOption.readOnly) ? i.current.setValue(n) : n !== i.current.getValue() && (S.current = !0, i.current.executeEdits("", [{ range: i.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), i.current.pushUndoStop(), S.current = !1));
113
- }, [n], d), m(() => {
114
- var a, v;
115
- let t = (a = i.current) == null ? void 0 : a.getModel();
116
- t && p && ((v = f.current) == null || v.editor.setModelLanguage(t, p));
117
- }, [p], d), m(() => {
118
- var t;
119
- C !== void 0 && ((t = i.current) == null || t.revealLine(C));
120
- }, [C], d), m(() => {
121
- var t;
122
- (t = f.current) == null || t.editor.setTheme(w);
123
- }, [w], d);
124
- let _ = $(() => {
125
- var t;
126
- if (!(!y.current || !f.current) && !O.current) {
127
- H.current(f.current);
128
- let a = h || l, v = P(f.current, n || r || "", u || p || "", a || "");
129
- i.current = (t = f.current) == null ? void 0 : t.editor.create(y.current, { model: v, automaticLayout: !0, ...L }, R), E && i.current.restoreViewState(W.get(a)), f.current.editor.setTheme(w), C !== void 0 && i.current.revealLine(C), g(!0), O.current = !0;
92
+ var ve = Me, U = /* @__PURE__ */ new Map();
93
+ function me({ defaultValue: e, defaultLanguage: n, defaultPath: u, value: r, language: g, path: p, theme: v = "light", line: L, loading: _ = "Loading...", options: w = {}, overrideServices: b = {}, saveViewState: m = !0, keepCurrentModel: F = !1, width: I = "100%", height: z = "100%", className: H, wrapperProps: W = {}, beforeMount: j = R, onMount: h = R, onChange: y, onValidate: S = R }) {
94
+ let [a, c] = T(!1), [o, x] = T(!0), s = l(null), t = l(null), C = l(null), N = l(h), D = l(j), P = l(), i = l(r), d = ve(p), Y = l(!1), A = l(!1);
95
+ K(() => {
96
+ let f = $.init();
97
+ return f.then((V) => (s.current = V) && x(!1)).catch((V) => V?.type !== "cancelation" && console.error("Monaco initialization: error:", V)), () => t.current ? re() : f.cancel();
98
+ }), M(() => {
99
+ let f = O(s.current, e || r || "", n || g || "", p || u || "");
100
+ f !== t.current?.getModel() && (m && U.set(d, t.current?.saveViewState()), t.current?.setModel(f), m && t.current?.restoreViewState(U.get(p)));
101
+ }, [p], a), M(() => {
102
+ t.current?.updateOptions(w);
103
+ }, [w], a), M(() => {
104
+ !t.current || r === void 0 || (t.current.getOption(s.current.editor.EditorOption.readOnly) ? t.current.setValue(r) : r !== t.current.getValue() && (A.current = !0, t.current.executeEdits("", [{ range: t.current.getModel().getFullModelRange(), text: r, forceMoveMarkers: !0 }]), t.current.pushUndoStop(), A.current = !1));
105
+ }, [r], a), M(() => {
106
+ let f = t.current?.getModel();
107
+ f && g && s.current?.editor.setModelLanguage(f, g);
108
+ }, [g], a), M(() => {
109
+ L !== void 0 && t.current?.revealLine(L);
110
+ }, [L], a), M(() => {
111
+ s.current?.editor.setTheme(v);
112
+ }, [v], a);
113
+ let Z = Q(() => {
114
+ if (!(!C.current || !s.current) && !Y.current) {
115
+ D.current(s.current);
116
+ let f = p || u, V = O(s.current, r || e || "", n || g || "", f || "");
117
+ t.current = s.current?.editor.create(C.current, { model: V, automaticLayout: !0, ...w }, b), m && t.current.restoreViewState(U.get(f)), s.current.editor.setTheme(v), L !== void 0 && t.current.revealLine(L), c(!0), Y.current = !0;
130
118
  }
131
- }, [r, u, l, n, p, h, L, R, E, w, C]);
132
- V(() => {
133
- d && z.current(i.current, f.current);
134
- }, [d]), V(() => {
135
- !c && !d && _();
136
- }, [c, d, _]), e.current = n, V(() => {
137
- var t, a;
138
- d && N && ((t = U.current) == null || t.dispose(), U.current = (a = i.current) == null ? void 0 : a.onDidChangeModelContent((v) => {
139
- S.current || N(i.current.getValue(), v);
119
+ }, [e, n, u, r, g, p, w, b, m, v, L]);
120
+ E(() => {
121
+ a && N.current(t.current, s.current);
122
+ }, [a]), E(() => {
123
+ !o && !a && Z();
124
+ }, [o, a, Z]), i.current = r, E(() => {
125
+ a && y && (P.current?.dispose(), P.current = t.current?.onDidChangeModelContent((f) => {
126
+ A.current || y(t.current.getValue(), f);
140
127
  }));
141
- }, [d, N]), V(() => {
142
- if (d) {
143
- let t = f.current.editor.onDidChangeMarkers((a) => {
144
- var F;
145
- let v = (F = i.current.getModel()) == null ? void 0 : F.uri;
146
- if (v && a.find((x) => x.path === v.path)) {
147
- let x = f.current.editor.getModelMarkers({ resource: v });
148
- k == null || k(x);
128
+ }, [a, y]), E(() => {
129
+ if (a) {
130
+ let f = s.current.editor.onDidChangeMarkers((V) => {
131
+ let B = t.current.getModel()?.uri;
132
+ if (B && V.find((G) => G.path === B.path)) {
133
+ let G = s.current.editor.getModelMarkers({ resource: B });
134
+ S?.(G);
149
135
  }
150
136
  });
151
137
  return () => {
152
- t == null || t.dispose();
138
+ f?.dispose();
153
139
  };
154
140
  }
155
141
  return () => {
156
142
  };
157
- }, [d, k]);
158
- function te() {
159
- var t, a;
160
- (t = U.current) == null || t.dispose(), B ? E && W.set(h, i.current.saveViewState()) : (a = i.current.getModel()) == null || a.dispose(), i.current.dispose();
143
+ }, [a, S]);
144
+ function re() {
145
+ P.current?.dispose(), F ? m && U.set(p, t.current.saveViewState()) : t.current.getModel()?.dispose(), t.current.dispose();
161
146
  }
162
- return b.createElement(T, { width: G, height: J, isEditorReady: d, loading: A, _ref: y, className: Q, wrapperProps: X });
147
+ return k.createElement(q, { width: I, height: z, isEditorReady: a, loading: _, _ref: C, className: H, wrapperProps: W });
163
148
  }
164
- var Ee = we, Le = q(Ee), Oe = Le;
149
+ var we = me, Ee = X(we), Ce = Ee;
165
150
  export {
166
- Le as Editor,
167
- Oe as default,
168
- K as loader
151
+ Ee as Editor,
152
+ Ce as default,
153
+ $ as loader
169
154
  };