@code0-tech/pictor 0.10.4 → 0.10.6

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 (37) hide show
  1. package/dist/assets/components/json-view/JsonView.style.css +1 -0
  2. package/dist/components/breadcrumb/Breadcrumb.js +2 -2
  3. package/dist/components/button/Button.js +11 -11
  4. package/dist/components/command/Command.js +19 -22
  5. package/dist/components/data-table/DataTable.js +15 -15
  6. package/dist/components/data-table/DataTableFilterSuggestionMenu.js +15 -15
  7. package/dist/components/editor/Editor.js +13 -13
  8. package/dist/components/form/CheckboxInput.js +4 -4
  9. package/dist/components/form/EditorInput.js +69 -64
  10. package/dist/components/form/EmailInput.js +9 -9
  11. package/dist/components/form/InputContentEditable.hook.js +11 -11
  12. package/dist/components/form/InputWrapper.js +15 -15
  13. package/dist/components/form/NumberInput.js +9 -9
  14. package/dist/components/form/PasswordInput.js +4 -4
  15. package/dist/components/form/SwitchInput.js +7 -7
  16. package/dist/components/form/TextAreaInput.js +6 -6
  17. package/dist/components/form/TextInput.js +6 -6
  18. package/dist/components/form/useForm.js +2 -2
  19. package/dist/components/fullscreen/FullScreen.js +2 -2
  20. package/dist/components/gantt/Gantt.js +67 -54
  21. package/dist/components/gantt/GanttGroup.js +117 -98
  22. package/dist/components/gantt/GanttHeader.js +45 -36
  23. package/dist/components/json-view/JsonView.d.ts +19 -0
  24. package/dist/components/json-view/JsonView.js +107 -0
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +102 -100
  27. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +59 -0
  28. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +34 -0
  29. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +47 -0
  30. package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.js +12 -0
  31. package/dist/node_modules/framer-motion/dist/es/utils/use-composed-ref.js +28 -0
  32. package/dist/node_modules/react/cjs/react-compiler-runtime.development.js +2 -2
  33. package/dist/node_modules/react/cjs/react-compiler-runtime.production.js +8 -8
  34. package/dist/utils/reactiveArrayService.js +4 -4
  35. package/package.json +9 -7
  36. package/dist/components/gantt/GanttFooter.d.ts +0 -2
  37. package/dist/components/gantt/GanttFooter.js +0 -38
@@ -1,143 +1,162 @@
1
- import { jsxs as N, jsx as x, Fragment as F } from "react/jsx-runtime";
2
- import { c as et } from "../../_virtual/compiler-runtime.js";
3
- import P from "react";
1
+ import { jsxs as F, jsx as W, Fragment as it } from "react/jsx-runtime";
2
+ import { c as rt } from "../../_virtual/compiler-runtime.js";
3
+ import D from "react";
4
4
  import "../../utils/contextStore.js";
5
5
  import "merge-props";
6
- import { withAlpha as J, hashToColor as K } from "../../utils/color.js";
7
- import { GanttItem as nt } from "./GanttItem.js";
8
- import { GanttHeader as rt } from "./GanttHeader.js";
9
- const C = (e, t, n, y, c, M) => {
10
- const S = Math.max(0, e - n), E = Math.min(c, t - n), G = S / c * M, m = (E - S) / c * M;
6
+ import { withAlpha as U, hashToColor as X } from "../../utils/color.js";
7
+ import { GanttItem as at } from "./GanttItem.js";
8
+ import { GanttHeader as ot } from "./GanttHeader.js";
9
+ const H = (e, t, a, G, g, R) => {
10
+ const L = Math.max(0, e - a), I = Math.min(g, t - a), V = L / g * R, x = (I - L) / g * R;
11
11
  return {
12
- left: G,
13
- width: m
12
+ left: V,
13
+ width: x
14
14
  };
15
- }, it = (e) => {
16
- const t = et.c(50), {
17
- items: n,
18
- stepWidth: y,
19
- rowHeight: c,
20
- step: M,
21
- start: S,
22
- end: E,
23
- hideScaling: G,
24
- children: m
25
- } = e, s = y === void 0 ? "50px" : y, $ = c === void 0 ? "50px" : c, a = M === void 0 ? 1 : M, i = S === void 0 ? 1 : S, o = E === void 0 ? 999999999 : E, l = G === void 0 ? !1 : G, R = P.useRef(null), [O, Q] = P.useState(0), [b, U] = P.useState(void 0), f = parseInt(s), d = o - i, q = Math.ceil(d / a), p = q * f, T = n?.filter(at) ?? [], W = T.length === 0 ? a : T.reduce(ot, 0) / T.length;
26
- let z;
27
- t[0] !== n || t[1] !== i ? (z = n && n.length > 0 ? Math.min(...n.map(st)) : i, t[0] = n, t[1] = i, t[2] = z) : z = t[2];
28
- const g = z;
29
- let L;
30
- t[3] !== o || t[4] !== n ? (L = n && n.length > 0 ? Math.max(...n.map(dt)) : o, t[3] = o, t[4] = n, t[5] = L) : L = t[5];
31
- const u = L, X = n && n.length > 0 ? Math.ceil((u - i) / a) : q, Y = Math.ceil(O / f), h = Math.max(Y, X + 2);
32
- let k;
33
- t[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = () => {
34
- const v = () => {
35
- Q(R.current?.offsetWidth ?? 0);
15
+ }, st = (e) => {
16
+ const t = rt.c(58), {
17
+ items: a,
18
+ stepWidth: G,
19
+ rowHeight: g,
20
+ step: R,
21
+ start: L,
22
+ end: I,
23
+ hideScaling: V,
24
+ children: x
25
+ } = e, c = G === void 0 ? "50px" : G, $ = g === void 0 ? "50px" : g, i = R === void 0 ? 1 : R, r = L === void 0 ? 1 : L, o = I === void 0 ? 999999999 : I, h = V === void 0 ? !1 : V, q = D.useRef(null), [Y, Z] = D.useState(0), [k, _] = D.useState(void 0), b = parseInt(c), p = o - r, K = Math.ceil(p / i), f = K * b;
26
+ let B;
27
+ t: {
28
+ if (!a || a.length === 0) {
29
+ let s;
30
+ t[0] !== o || t[1] !== r || t[2] !== i ? (s = {
31
+ avgDuration: i,
32
+ itemMinStart: r,
33
+ itemMaxEnd: o
34
+ }, t[0] = o, t[1] = r, t[2] = i, t[3] = s) : s = t[3], B = s;
35
+ break t;
36
+ }
37
+ let d = 0, u = 0, m = 1 / 0, E = -1 / 0;
38
+ for (let s = 0; s < a.length; s++) {
39
+ const l = a[s];
40
+ l.start < m && (m = l.start), l.end > E && (E = l.end), l.type !== "group" && (d = d + (l.end - l.start), u++);
41
+ }
42
+ const M = u === 0 ? i : d / u;
43
+ let S;
44
+ t[4] !== E || t[5] !== m || t[6] !== M ? (S = {
45
+ avgDuration: M,
46
+ itemMinStart: m,
47
+ itemMaxEnd: E
48
+ }, t[4] = E, t[5] = m, t[6] = M, t[7] = S) : S = t[7], B = S;
49
+ }
50
+ const {
51
+ avgDuration: z,
52
+ itemMinStart: y,
53
+ itemMaxEnd: v
54
+ } = B, tt = a && a.length > 0 ? Math.ceil((v - r) / i) : K, et = Math.ceil(Y / b), w = Math.max(et, tt + 2);
55
+ let A, N;
56
+ t[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (A = () => {
57
+ const d = () => {
58
+ Z(q.current?.offsetWidth ?? 0);
36
59
  };
37
- return v(), R?.current?.addEventListener("resize", v), window.addEventListener("resize", v), () => {
38
- window.removeEventListener("resize", v), R.current?.removeEventListener("resize", v);
60
+ d();
61
+ const u = q.current;
62
+ return u?.addEventListener("resize", d), window.addEventListener("resize", d), () => {
63
+ window.removeEventListener("resize", d), u?.removeEventListener("resize", d);
39
64
  };
40
- }, t[6] = k) : k = t[6], P.useEffect(k);
41
- let H;
42
- if (t[7] !== b || t[8] !== W || t[9] !== m || t[10] !== h || t[11] !== o || t[12] !== l || t[13] !== u || t[14] !== g || t[15] !== n || t[16] !== e.id || t[17] !== $ || t[18] !== i || t[19] !== a || t[20] !== s || t[21] !== f || t[22] !== d || t[23] !== p) {
43
- const v = n?.length ? n.sort(ct).reduce(lt, []) : [], j = `repeat(${h}, ${s})`;
44
- let I;
45
- t[25] !== j ? (I = {
65
+ }, N = [], t[8] = A, t[9] = N) : (A = t[8], N = t[9]), D.useEffect(A, N);
66
+ let P;
67
+ if (t[10] !== k || t[11] !== z || t[12] !== x || t[13] !== w || t[14] !== o || t[15] !== h || t[16] !== v || t[17] !== y || t[18] !== a || t[19] !== e.id || t[20] !== $ || t[21] !== r || t[22] !== i || t[23] !== c || t[24] !== b || t[25] !== p || t[26] !== f) {
68
+ const d = a?.length ? a.sort(dt).reduce(lt, []) : [], u = `repeat(${w}, ${c})`;
69
+ let m;
70
+ t[28] !== u ? (m = {
46
71
  display: "grid",
47
- gridTemplateColumns: j,
72
+ gridTemplateColumns: u,
48
73
  minWidth: "100%",
49
74
  gridColumn: "1 / -1"
50
- }, t[25] = j, t[26] = I) : I = t[26];
51
- const Z = I;
52
- let V;
53
- t[27] !== W || t[28] !== h || t[29] !== l || t[30] !== i || t[31] !== a || t[32] !== s ? (V = !l && /* @__PURE__ */ x(rt, { columnCount: h, start: i, step: a, avgDuration: W, stepWidth: s }), t[27] = W, t[28] = h, t[29] = l, t[30] = i, t[31] = a, t[32] = s, t[33] = V) : V = t[33];
54
- let A;
55
- t[34] !== b || t[35] !== m || t[36] !== h || t[37] !== o || t[38] !== l || t[39] !== u || t[40] !== g || t[41] !== e.id || t[42] !== $ || t[43] !== i || t[44] !== a || t[45] !== s || t[46] !== f || t[47] !== d || t[48] !== p ? (A = (B, _) => /* @__PURE__ */ N(F, { children: [
56
- /* @__PURE__ */ N("div", { style: {
57
- gridColumn: "1 / -1",
58
- minHeight: $,
59
- position: "relative",
60
- backgroundColor: "transparent"
61
- }, children: [
62
- Array.from({
63
- length: h - 1
64
- }).map((r, w) => /* @__PURE__ */ x("div", { style: {
75
+ }, t[28] = u, t[29] = m) : m = t[29];
76
+ const E = m;
77
+ let M;
78
+ t[30] !== $ ? (M = {
79
+ gridColumn: "1 / -1",
80
+ minHeight: $,
81
+ position: "relative",
82
+ backgroundColor: "transparent"
83
+ }, t[30] = $, t[31] = M) : M = t[31];
84
+ const S = M;
85
+ let s;
86
+ t[32] !== w ? (s = Array.from({
87
+ length: Math.max(0, w - 1)
88
+ }), t[32] = w, t[33] = s) : s = t[33];
89
+ const l = s;
90
+ let T;
91
+ t[34] !== z || t[35] !== w || t[36] !== h || t[37] !== r || t[38] !== i || t[39] !== c ? (T = !h && /* @__PURE__ */ W(ot, { columnCount: w, start: r, step: i, avgDuration: z, stepWidth: c }), t[34] = z, t[35] = w, t[36] = h, t[37] = r, t[38] = i, t[39] = c, t[40] = T) : T = t[40];
92
+ let j;
93
+ t[41] !== k || t[42] !== x || t[43] !== o || t[44] !== l || t[45] !== h || t[46] !== v || t[47] !== y || t[48] !== e.id || t[49] !== $ || t[50] !== S || t[51] !== r || t[52] !== i || t[53] !== c || t[54] !== b || t[55] !== p || t[56] !== f ? (j = (O, Q) => /* @__PURE__ */ F(D.Fragment, { children: [
94
+ /* @__PURE__ */ F("div", { style: S, children: [
95
+ l.map((n, C) => /* @__PURE__ */ W("div", { style: {
65
96
  position: "absolute",
66
- left: (w + 1) * f,
97
+ left: (C + 1) * b,
67
98
  top: 0,
68
99
  bottom: 0,
69
100
  width: "0px",
70
- borderLeft: `1px dashed rgba(255, 255, 255, ${l ? 0.05 : 0.1})`
71
- } }, `grid-${w}`)),
72
- l && /* @__PURE__ */ N(F, { children: [
73
- /* @__PURE__ */ x("div", { className: "gantt__group-wrapper", style: {
101
+ borderLeft: `1px dashed rgba(255, 255, 255, ${h ? 0.05 : 0.1})`
102
+ } }, `grid-${C}`)),
103
+ h && /* @__PURE__ */ F(it, { children: [
104
+ /* @__PURE__ */ W("div", { className: "gantt__group-wrapper", style: {
74
105
  backgroundImage: `
75
106
  linear-gradient(to right, transparent, #070514),
76
107
  repeating-linear-gradient(
77
108
  45deg,
78
109
  transparent,
79
110
  transparent 2px,
80
- ${J(K(e.id.replace("target", "source")), 0.5)} 4px
111
+ ${U(X(e.id.replace("target", "source")), 0.5)} 4px
81
112
  )
82
113
  `,
83
- left: `${C(g, g + a, i, o, d, p).left}px`,
84
- width: `${C(g, g + a, i, o, d, p).width}px`
114
+ left: `${H(y, y + i, r, o, p, f).left}px`,
115
+ width: `${H(y, y + i, r, o, p, f).width}px`
85
116
  } }),
86
- /* @__PURE__ */ x("div", { className: "gantt__group-wrapper", style: {
117
+ /* @__PURE__ */ W("div", { className: "gantt__group-wrapper", style: {
87
118
  backgroundImage: `
88
119
  linear-gradient(to left, transparent, #070514),
89
120
  repeating-linear-gradient(
90
121
  45deg,
91
122
  transparent,
92
123
  transparent 2px,
93
- ${J(K(e.id.replace("target", "source")), 0.5)} 4px
124
+ ${U(X(e.id.replace("target", "source")), 0.5)} 4px
94
125
  )
95
126
  `,
96
- left: `${C(u - a, u, i, o, d, p).left}px`,
97
- width: `${C(u - a, u, i, o, d, p).width}px`
127
+ left: `${H(v - i, v, r, o, p, f).left}px`,
128
+ width: `${H(v - i, v, r, o, p, f).width}px`
98
129
  } })
99
130
  ] }),
100
- B.map((r, w) => {
101
- const D = C(r.start, r.end, i, o, d, p);
102
- return D.width > 0 && /* @__PURE__ */ x(F, { children: /* @__PURE__ */ x(nt, { id: r.id, w: `${D.width}px`, left: `${D.left}px`, onClick: () => {
103
- r.type == "group" && U((tt) => r.id === tt ? void 0 : r.id);
104
- }, children: m?.(r, w) }, r.id) });
131
+ O.map((n, C) => {
132
+ const J = H(n.start, n.end, r, o, p, f);
133
+ return J.width > 0 && /* @__PURE__ */ W(at, { id: n.id, w: `${J.width}px`, left: `${J.left}px`, onClick: () => {
134
+ n.type == "group" && _((nt) => n.id === nt ? void 0 : n.id);
135
+ }, children: x?.(n, C) }, n.id);
105
136
  })
106
- ] }, `row-${_}`),
107
- B.map((r, w) => r.type === "group" && b === r.id && /* @__PURE__ */ x(it, { children: m, id: `group-target-${w}`, start: Math.min(...r.data.items.map(pt)) - Math.min(...r.data.items.map(ut)) / (r.data.firstGroupStep * r.data.step) * (r.data.groupStep * r.data.step), step: r.data.groupStep * r.data.step, stepWidth: s, rowHeight: $, items: r.data.items }, `group-target-${w}`))
108
- ] }), t[34] = b, t[35] = m, t[36] = h, t[37] = o, t[38] = l, t[39] = u, t[40] = g, t[41] = e.id, t[42] = $, t[43] = i, t[44] = a, t[45] = s, t[46] = f, t[47] = d, t[48] = p, t[49] = A) : A = t[49], H = /* @__PURE__ */ N("div", { "data-gantt-id": e.id, id: e.id, ref: R, style: Z, children: [
109
- V,
110
- v.map(A)
111
- ] }), t[7] = b, t[8] = W, t[9] = m, t[10] = h, t[11] = o, t[12] = l, t[13] = u, t[14] = g, t[15] = n, t[16] = e.id, t[17] = $, t[18] = i, t[19] = a, t[20] = s, t[21] = f, t[22] = d, t[23] = p, t[24] = H;
137
+ ] }, `row-${Q}`),
138
+ O.map((n, C) => n.type === "group" && k === n.id && /* @__PURE__ */ W(st, { children: x, id: `group-target-${C}`, start: Math.min(...n.data.items.map(ct)) - Math.min(...n.data.items.map(pt)) / (n.data.firstGroupStep * n.data.step) * (n.data.groupStep * n.data.step), step: n.data.groupStep * n.data.step, stepWidth: c, rowHeight: $, items: n.data.items }, `group-target-${C}`))
139
+ ] }, `row-frag-${Q}`), t[41] = k, t[42] = x, t[43] = o, t[44] = l, t[45] = h, t[46] = v, t[47] = y, t[48] = e.id, t[49] = $, t[50] = S, t[51] = r, t[52] = i, t[53] = c, t[54] = b, t[55] = p, t[56] = f, t[57] = j) : j = t[57], P = /* @__PURE__ */ F("div", { "data-gantt-id": e.id, id: e.id, ref: q, style: E, children: [
140
+ T,
141
+ d.map(j)
142
+ ] }), t[10] = k, t[11] = z, t[12] = x, t[13] = w, t[14] = o, t[15] = h, t[16] = v, t[17] = y, t[18] = a, t[19] = e.id, t[20] = $, t[21] = r, t[22] = i, t[23] = c, t[24] = b, t[25] = p, t[26] = f, t[27] = P;
112
143
  } else
113
- H = t[24];
114
- return H;
144
+ P = t[27];
145
+ return P;
115
146
  };
116
- function at(e) {
117
- return e.type !== "group";
118
- }
119
- function ot(e, t) {
120
- return e + (t.end - t.start);
121
- }
122
- function st(e) {
123
- return e.start;
124
- }
125
- function dt(e) {
126
- return e.end;
127
- }
128
- function ct(e, t) {
147
+ function dt(e, t) {
129
148
  return e.start - t.start;
130
149
  }
131
150
  function lt(e, t) {
132
- const n = e.find((y) => !y.some((c) => !(t.end <= c.start || t.start >= c.end)));
133
- return n ? (n.push(t), e) : [...e, [t]];
151
+ const a = e.find((G) => !G.some((g) => !(t.end <= g.start || t.start >= g.end)));
152
+ return a ? (a.push(t), e) : [...e, [t]];
134
153
  }
135
- function pt(e) {
154
+ function ct(e) {
136
155
  return e.start;
137
156
  }
138
- function ut(e) {
157
+ function pt(e) {
139
158
  return e.start;
140
159
  }
141
160
  export {
142
- it as GanttGroup
161
+ st as GanttGroup
143
162
  };
@@ -1,53 +1,62 @@
1
- import { jsx as p, jsxs as N } from "react/jsx-runtime";
1
+ import { jsx as g, jsxs as N } from "react/jsx-runtime";
2
2
  import { c as W } from "../../_virtual/compiler-runtime.js";
3
3
  import "../../utils/contextStore.js";
4
4
  import "react";
5
5
  import { mergeComponentProps as j } from "../../utils/component.js";
6
6
  import "js-md5";
7
- import { Text as b } from "../text/Text.js";
8
- const x = (e) => {
9
- const t = W.c(20);
10
- let a, s, i, n, r, o, m;
11
- if (t[0] !== e) {
7
+ import { Text as $ } from "../text/Text.js";
8
+ const x = (t) => {
9
+ const e = W.c(22);
10
+ let i, s, a, n, r, o, m;
11
+ if (e[0] !== t) {
12
12
  const {
13
- columnCount: _,
13
+ columnCount: f,
14
14
  start: l,
15
- step: d,
16
- avgDuration: f,
17
- stepWidth: g,
18
- ...v
19
- } = e;
20
- s = _, i = l, n = d, a = f, r = g, o = parseInt(r), m = j("gantt__header", v), t[0] = e, t[1] = a, t[2] = s, t[3] = i, t[4] = n, t[5] = r, t[6] = o, t[7] = m;
15
+ step: _,
16
+ avgDuration: c,
17
+ stepWidth: v,
18
+ ...b
19
+ } = t;
20
+ a = l, n = _, r = v, o = parseInt(r);
21
+ let u;
22
+ e[8] !== c ? (u = y(c), e[8] = c, e[9] = u) : u = e[9], s = u;
23
+ let d;
24
+ e[10] !== f ? (d = Array.from({
25
+ length: f
26
+ }), e[10] = f, e[11] = d) : d = e[11], i = d, m = j("gantt__header", b), e[0] = t, e[1] = i, e[2] = s, e[3] = a, e[4] = n, e[5] = r, e[6] = o, e[7] = m;
21
27
  } else
22
- a = t[1], s = t[2], i = t[3], n = t[4], r = t[5], o = t[6], m = t[7];
23
- let c;
24
- t[8] !== s ? (c = Array.from({
25
- length: s
26
- }), t[8] = s, t[9] = c) : c = t[9];
28
+ i = e[1], s = e[2], a = e[3], n = e[4], r = e[5], o = e[6], m = e[7];
27
29
  let h;
28
- t[10] !== a || t[11] !== i || t[12] !== n || t[13] !== r || t[14] !== o || t[15] !== c ? (h = c.map((_, l) => {
29
- const d = i + l * n, f = l % 4 === 0, g = $(a), {
30
- value: v,
31
- unit: y
32
- } = $(d), C = `${Math.round(v * 10) / 10}${y}`;
33
- return l !== 0 ? /* @__PURE__ */ p("div", { className: "gantt__header-column", style: {
30
+ e[12] !== i || e[13] !== s || e[14] !== a || e[15] !== n || e[16] !== r || e[17] !== o ? (h = i.map((f, l) => {
31
+ if (l === 0)
32
+ return /* @__PURE__ */ g("div", { className: "gantt__header-label-column", children: /* @__PURE__ */ N($, { className: "gantt__header-label", children: [
33
+ "Range in ",
34
+ s.unit
35
+ ] }) }, `header-${l}`);
36
+ const _ = l % 4 === 0;
37
+ let c = "";
38
+ if (_) {
39
+ const v = a + l * n, {
40
+ value: b,
41
+ unit: u
42
+ } = y(v);
43
+ c = `${Math.round(b * 10) / 10}${u}`;
44
+ }
45
+ return /* @__PURE__ */ g("div", { className: "gantt__header-column", style: {
34
46
  left: l * o,
35
47
  width: r
36
- }, children: /* @__PURE__ */ p(b, { children: f ? C : "" }) }, `header-${l}`) : /* @__PURE__ */ p("div", { className: "gantt__header-label-column", children: /* @__PURE__ */ N(b, { className: "gantt__header-label", children: [
37
- "Range in ",
38
- g.unit
39
- ] }) }, `header-${l}`);
40
- }), t[10] = a, t[11] = i, t[12] = n, t[13] = r, t[14] = o, t[15] = c, t[16] = h) : h = t[16];
41
- let u;
42
- return t[17] !== m || t[18] !== h ? (u = /* @__PURE__ */ p("div", { ...m, children: h }), t[17] = m, t[18] = h, t[19] = u) : u = t[19], u;
43
- }, $ = (e) => e > 5e5 ? {
44
- value: e / 1e6,
48
+ }, children: /* @__PURE__ */ g($, { children: c }) }, `header-${l}`);
49
+ }), e[12] = i, e[13] = s, e[14] = a, e[15] = n, e[16] = r, e[17] = o, e[18] = h) : h = e[18];
50
+ let p;
51
+ return e[19] !== m || e[20] !== h ? (p = /* @__PURE__ */ g("div", { ...m, children: h }), e[19] = m, e[20] = h, e[21] = p) : p = e[21], p;
52
+ }, y = (t) => t > 5e5 ? {
53
+ value: t / 1e6,
45
54
  unit: "s"
46
- } : e > 500 ? {
47
- value: e / 1e3,
55
+ } : t > 500 ? {
56
+ value: t / 1e3,
48
57
  unit: "ms"
49
58
  } : {
50
- value: e,
59
+ value: t,
51
60
  unit: "μs"
52
61
  };
53
62
  export {
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ import { JsonViewProps as ReactJsonViewProps } from '@uiw/react-json-view';
3
+ import { Component } from '../../utils';
4
+ export interface JsonViewProps<T extends object = object> extends Omit<Component<HTMLDivElement>, 'value'> {
5
+ value?: T;
6
+ keyName?: string | number;
7
+ collapsed?: boolean | number;
8
+ displayObjectSize?: boolean;
9
+ displayDataTypes?: boolean;
10
+ enableClipboard?: boolean;
11
+ indentWidth?: number;
12
+ shortenTextAfterLength?: number;
13
+ highlightUpdates?: boolean;
14
+ objectSortKeys?: ReactJsonViewProps<T>['objectSortKeys'];
15
+ shouldExpandNodeInitially?: ReactJsonViewProps<T>['shouldExpandNodeInitially'];
16
+ onCopied?: ReactJsonViewProps<T>['onCopied'];
17
+ onExpand?: ReactJsonViewProps<T>['onExpand'];
18
+ }
19
+ export declare const JsonView: <T extends object = object>(props: JsonViewProps<T>) => React.JSX.Element;
@@ -0,0 +1,107 @@
1
+ import { jsx as l, jsxs as N } from "react/jsx-runtime";
2
+ import { c as k } from "../../_virtual/compiler-runtime.js";
3
+ import b from "@uiw/react-json-view";
4
+ import { IconChevronRight as T, IconCheck as z, IconCopy as I } from "@tabler/icons-react";
5
+ import "../../utils/contextStore.js";
6
+ import "react";
7
+ import { mergeComponentProps as E } from "../../utils/component.js";
8
+ import { hashToColor as r } from "../../utils/color.js";
9
+ import '../../assets/components/json-view/JsonView.style.css';/* empty css */
10
+ import { AnimatePresence as S } from "../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js";
11
+ import { motion as V } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
12
+ const q = {
13
+ "--w-rjv-font-family": '"Inter", sans-serif',
14
+ "--w-rjv-font-size": "0.8rem",
15
+ "--w-rjv-color": "rgba(255, 255, 255, 0.75)",
16
+ "--w-rjv-key-string": "rgba(255, 255, 255, 0.75)",
17
+ "--w-rjv-background-color": "transparent",
18
+ "--w-rjv-line-color": "rgba(191, 191, 191, 0.1)",
19
+ "--w-rjv-arrow-color": "rgba(255, 255, 255, 0.5)",
20
+ "--w-rjv-edit-color": "rgba(255, 255, 255, 0.75)",
21
+ "--w-rjv-info-color": "rgba(255, 255, 255, 0.5)",
22
+ "--w-rjv-update-color": "#ebcb8b",
23
+ "--w-rjv-copied-color": "rgba(255, 255, 255, 0.75)",
24
+ "--w-rjv-copied-success-color": "#29BF12",
25
+ "--w-rjv-curlybraces-color": r("bracket"),
26
+ "--w-rjv-brackets-color": r("squareBracket"),
27
+ "--w-rjv-quotes-color": "rgba(255, 255, 255, 0.75)",
28
+ "--w-rjv-quotes-string-color": r("Text"),
29
+ "--w-rjv-type-string-color": r("Text"),
30
+ "--w-rjv-type-int-color": r("Number"),
31
+ "--w-rjv-type-float-color": r("Number"),
32
+ "--w-rjv-type-bigint-color": r("Number"),
33
+ "--w-rjv-type-boolean-color": r("Boolean"),
34
+ "--w-rjv-type-date-color": r("Text"),
35
+ "--w-rjv-type-url-color": r("Text"),
36
+ "--w-rjv-type-null-color": r("Null"),
37
+ "--w-rjv-type-nan-color": r("Number"),
38
+ "--w-rjv-type-undefined-color": r("Null")
39
+ }, K = (a) => {
40
+ const e = k.c(23);
41
+ let o, i, n, c, m, t;
42
+ if (e[0] !== a) {
43
+ const {
44
+ displayObjectSize: u,
45
+ displayDataTypes: g,
46
+ enableClipboard: h,
47
+ indentWidth: x,
48
+ value: _,
49
+ ...C
50
+ } = a;
51
+ t = _, i = u === void 0 ? !1 : u, o = g === void 0 ? !1 : g, n = h === void 0 ? !0 : h, c = x === void 0 ? 12.8 : x, m = E("json-view", C), e[0] = a, e[1] = o, e[2] = i, e[3] = n, e[4] = c, e[5] = m, e[6] = t;
52
+ } else
53
+ o = e[1], i = e[2], n = e[3], c = e[4], m = e[5], t = e[6];
54
+ const s = m;
55
+ let v;
56
+ e[7] !== t ? (v = t == null || typeof t != "object" ? [t] : t, e[7] = t, e[8] = v) : v = e[8];
57
+ const y = v;
58
+ let p;
59
+ e[9] !== s.style ? (p = s.style ?? {}, e[9] = s.style, e[10] = p) : p = e[10];
60
+ let d;
61
+ e[11] !== p ? (d = {
62
+ ...q,
63
+ ...p
64
+ }, e[11] = p, e[12] = d) : d = e[12];
65
+ let w, j;
66
+ e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ l(b.Arrow, { render: B }), j = /* @__PURE__ */ l(b.Copied, { render: J }), e[13] = w, e[14] = j) : (w = e[13], j = e[14]);
67
+ let f;
68
+ return e[15] !== o || e[16] !== i || e[17] !== n || e[18] !== c || e[19] !== s || e[20] !== y || e[21] !== d ? (f = /* @__PURE__ */ N(b, { displayObjectSize: i, displayDataTypes: o, enableClipboard: n, indentWidth: c, ...s, value: y, style: d, children: [
69
+ w,
70
+ j
71
+ ] }), e[15] = o, e[16] = i, e[17] = n, e[18] = c, e[19] = s, e[20] = y, e[21] = d, e[22] = f) : f = e[22], f;
72
+ };
73
+ function B(a) {
74
+ const {
75
+ "data-expanded": e,
76
+ ...o
77
+ } = a;
78
+ return /* @__PURE__ */ l("span", { ...o, className: "json-view__arrow", "data-expanded": e, children: /* @__PURE__ */ l(T, { size: 13 }) });
79
+ }
80
+ function J(a) {
81
+ const {
82
+ "data-copied": e,
83
+ onClick: o,
84
+ ...i
85
+ } = a;
86
+ return /* @__PURE__ */ l("span", { ...i, onClick: o, className: "json-view__copy", "data-copied": e, children: /* @__PURE__ */ l(S, { mode: "wait", initial: !1, children: /* @__PURE__ */ l(V.span, { initial: {
87
+ opacity: 0,
88
+ scale: 0.5,
89
+ filter: "blur(0.35rem)"
90
+ }, animate: {
91
+ opacity: 1,
92
+ scale: 1,
93
+ filter: "blur(0px)"
94
+ }, exit: {
95
+ opacity: 0,
96
+ scale: 0.5,
97
+ filter: "blur(0.35rem)"
98
+ }, transition: {
99
+ duration: 0.05,
100
+ ease: "easeIn"
101
+ }, style: {
102
+ display: "inline-flex"
103
+ }, children: e ? /* @__PURE__ */ l(z, { size: 13 }) : /* @__PURE__ */ l(I, { size: 13 }) }, e ? "check" : "copy") }) });
104
+ }
105
+ export {
106
+ K as JsonView
107
+ };
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export * from './components/file-tabs/index';
17
17
  export * from './components/flex/Flex';
18
18
  export * from './components/flex/Flex';
19
19
  export * from './components/form/index';
20
+ export * from './components/json-view/JsonView';
20
21
  export * from './components/fullscreen/FullScreen';
21
22
  export * from './components/gantt/Gantt';
22
23
  export * from './components/layout/Layout';