@synnaxlabs/pluto 0.34.0 → 0.34.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/ether.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./aggregator-C0Ab25_o.cjs"),n=require("./css-Dh7n0EGs.cjs"),e=require("./LinePlot--yLT9nkT.cjs"),l=Object.freeze(Object.defineProperty({__proto__:null,Provider:t.Provider,REGISTRY:t.REGISTRY,SYNNAX_DARK:t.SYNNAX_DARK,SYNNAX_LIGHT:t.SYNNAX_LIGHT,SYNNAX_THEMES:t.SYNNAX_THEMES,fontSpecZ:t.fontSpecZ,fontString:t.fontString,themeZ:t.themeZ,use:t.use},Symbol.toStringTag,{value:"Module"})),a=Object.freeze(Object.defineProperty({__proto__:null,Context:e.Context,Controller:e.Controller,Eraser:e.Eraser,GLProgram:e.GLProgram,Loop:e.Loop,REASON_DATA:e.REASON_DATA,REASON_LAYOUT:e.REASON_LAYOUT,REASON_TOOL:e.REASON_TOOL},Symbol.toStringTag,{value:"Module"})),i=()=>{const o=new t.l((R,S)=>postMessage(R,S));onmessage=o.handle.bind(o);const r={...e.REGISTRY,...e.REGISTRY$1,...e.REGISTRY$2,...e.REGISTRY$3,...e.REGISTRY$4,...e.REGISTRY$5,...e.REGISTRY$6,...e.REGISTRY$7,...e.REGISTRY$8,...e.REGISTRY$9,...e.REGISTRY$10,...e.REGISTRY$11,...e.REGISTRY$12,...t.REGISTRY$1,...e.REGISTRY$13,...e.REGISTRY$14,...t.REGISTRY,...e.REGISTRY$15,...e.REGISTRY$16,...e.REGISTRY$17,...e.REGISTRY$18};t.render({worker:o.route("vis"),registry:r})},T=Object.freeze(Object.defineProperty({__proto__:null,render:i},Symbol.toStringTag,{value:"Module"})),s=Object.freeze(Object.defineProperty({__proto__:null,LinePlot:e.LinePlot,REGISTRY:e.REGISTRY$8,XAxis:e.XAxis,YAxis:e.YAxis,linePlotStateZ:e.linePlotStateZ,xAxisStateZ:e.xAxisStateZ,yAxisStateZ:e.yAxisStateZ},Symbol.toStringTag,{value:"Module"}));exports.aether=t.aether;exports.color=n.color;exports.canvas=e.canvas;exports.diagram=e.Diagram;exports.measure=e.measure;exports.rule=e.aether;exports.synnax=e.provider;exports.telem=e.external;exports.tooltip=e.tooltip;exports.value=e.value;exports.lineplot=s;exports.pluto=T;exports.render=a;exports.theming=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./aggregator-C0Ab25_o.cjs"),n=require("./css-Dh7n0EGs.cjs"),e=require("./LinePlot-44K5K51b.cjs"),l=Object.freeze(Object.defineProperty({__proto__:null,Provider:t.Provider,REGISTRY:t.REGISTRY,SYNNAX_DARK:t.SYNNAX_DARK,SYNNAX_LIGHT:t.SYNNAX_LIGHT,SYNNAX_THEMES:t.SYNNAX_THEMES,fontSpecZ:t.fontSpecZ,fontString:t.fontString,themeZ:t.themeZ,use:t.use},Symbol.toStringTag,{value:"Module"})),a=Object.freeze(Object.defineProperty({__proto__:null,Context:e.Context,Controller:e.Controller,Eraser:e.Eraser,GLProgram:e.GLProgram,Loop:e.Loop,REASON_DATA:e.REASON_DATA,REASON_LAYOUT:e.REASON_LAYOUT,REASON_TOOL:e.REASON_TOOL},Symbol.toStringTag,{value:"Module"})),i=()=>{const o=new t.l((R,S)=>postMessage(R,S));onmessage=o.handle.bind(o);const r={...e.REGISTRY,...e.REGISTRY$1,...e.REGISTRY$2,...e.REGISTRY$3,...e.REGISTRY$4,...e.REGISTRY$5,...e.REGISTRY$6,...e.REGISTRY$7,...e.REGISTRY$8,...e.REGISTRY$9,...e.REGISTRY$10,...e.REGISTRY$11,...e.REGISTRY$12,...t.REGISTRY$1,...e.REGISTRY$13,...e.REGISTRY$14,...t.REGISTRY,...e.REGISTRY$15,...e.REGISTRY$16,...e.REGISTRY$17,...e.REGISTRY$18};t.render({worker:o.route("vis"),registry:r})},T=Object.freeze(Object.defineProperty({__proto__:null,render:i},Symbol.toStringTag,{value:"Module"})),s=Object.freeze(Object.defineProperty({__proto__:null,LinePlot:e.LinePlot,REGISTRY:e.REGISTRY$8,XAxis:e.XAxis,YAxis:e.YAxis,linePlotStateZ:e.linePlotStateZ,xAxisStateZ:e.xAxisStateZ,yAxisStateZ:e.yAxisStateZ},Symbol.toStringTag,{value:"Module"}));exports.aether=t.aether;exports.color=n.color;exports.canvas=e.canvas;exports.diagram=e.Diagram;exports.measure=e.measure;exports.rule=e.aether;exports.synnax=e.provider;exports.telem=e.external;exports.tooltip=e.tooltip;exports.value=e.value;exports.lineplot=s;exports.pluto=T;exports.render=a;exports.theming=l;
package/dist/ether.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { P as R, R as a, S, a as n, b as l, f as T, c as E, t as Y, u as i, l as G, d as $, r as I } from "./aggregator-DzdAnRwI.js";
2
2
  import { e as oe } from "./aggregator-DzdAnRwI.js";
3
3
  import { d as Re } from "./css-B4FcyECk.js";
4
- import { C as _, a as c, E as p, G as u, L as d, R as m, b as f, c as g, d as b, e as x, f as A, g as O, h as y, i as j, j as v, k as N, l as s, m as P, n as L, o as h, p as M, q as z, r as X, s as Z, t as w, u as C, v as k, H as D, X as H, Y as K, I as q, J as B, K as F } from "./LinePlot-6KHKqa-2.js";
5
- import { y as ne, D as le, A as Te, B as Ee, w as Ye, x as ie, z as Ge, F as $e } from "./LinePlot-6KHKqa-2.js";
4
+ import { C as _, a as c, E as p, G as u, L as d, R as m, b as f, c as g, d as b, e as x, f as A, g as O, h as y, i as j, j as v, k as N, l as s, m as P, n as L, o as h, p as M, q as z, r as X, s as Z, t as w, u as C, v as k, H as D, X as H, Y as K, I as q, J as B, K as F } from "./LinePlot-DN8KOMtR.js";
5
+ import { y as ne, D as le, A as Te, B as Ee, w as Ye, x as ie, z as Ge, F as $e } from "./LinePlot-DN8KOMtR.js";
6
6
  const V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7
7
  __proto__: null,
8
8
  Provider: R,
@@ -4,7 +4,7 @@ import { a0 as le, a1 as oe, Q as ie, _ as ce, d as de, C as fe, a2 as ue, a3 as
4
4
  import { memo as Ne, useState as be, useCallback as b, useMemo as Te } from "react";
5
5
  import { L as _e } from "./Link-CDG2-g6A.js";
6
6
  import { A as ve } from "./Animated-CnvOerW9.js";
7
- import { C as u } from "./css-B4FcyECk.js";
7
+ import { C as h } from "./css-B4FcyECk.js";
8
8
  import "./Pack-D6eMgf33.js";
9
9
  import { L as Ie } from "./List-BjimX8fM.js";
10
10
  const X = (e, t) => t.includes(e.key), H = (e, t) => {
@@ -19,16 +19,23 @@ const X = (e, t) => t.includes(e.key), H = (e, t) => {
19
19
  nodes: e,
20
20
  expanded: t,
21
21
  depth: r = 0,
22
- sort: n = !0
22
+ sort: n = !0,
23
+ path: a = ""
23
24
  }) => {
24
- r === 0 && n && (e = e.sort((s, o) => s.name.localeCompare(o.name)));
25
- const a = [];
26
- return e.forEach((s, o) => {
27
- const i = X(s, t);
28
- a.push({ ...s, depth: r, expanded: i, index: o }), i && s.children != null && (s.children = H(s.children, n), a.push(
29
- ...K({ nodes: s.children, expanded: t, depth: r + 1, sort: n })
25
+ r === 0 && n && (e = e.sort((l, i) => l.name.localeCompare(i.name)));
26
+ const s = [];
27
+ return e.forEach((l, i) => {
28
+ const o = `${a}${l.key}/`, u = X(l, t);
29
+ s.push({ ...l, depth: r, expanded: u, index: i, path: o }), u && l.children != null && (l.children = H(l.children, n), s.push(
30
+ ...K({
31
+ nodes: l.children,
32
+ expanded: t,
33
+ depth: r + 1,
34
+ sort: n,
35
+ path: o
36
+ })
30
37
  ));
31
- }), a;
38
+ }), s;
32
39
  }, Se = ({ tree: e, destination: t, keys: r }) => (r = k(r), r.forEach((n) => {
33
40
  const a = T({ tree: e, key: n });
34
41
  a != null && (Y({ tree: e, keys: n }), z({ tree: e, destination: t, additions: a }));
@@ -40,8 +47,8 @@ const X = (e, t) => t.includes(e.key), H = (e, t) => {
40
47
  const a = r.indexOf(n);
41
48
  if (a !== -1) e.splice(a, 1);
42
49
  else {
43
- const o = $({ tree: e, key: n });
44
- o != null && (o.children = (s = o.children) == null ? void 0 : s.filter((i) => i.key !== n));
50
+ const l = R({ tree: e, key: n });
51
+ l != null && (l.children = (s = l.children) == null ? void 0 : s.filter((i) => i.key !== n));
45
52
  }
46
53
  }), e;
47
54
  }, z = ({ tree: e, destination: t, additions: r }) => {
@@ -60,19 +67,19 @@ const X = (e, t) => t.includes(e.key), H = (e, t) => {
60
67
  updater: r,
61
68
  throwOnMissing: n = !0
62
69
  }) => {
63
- var o, i;
70
+ var l, i;
64
71
  const a = T({ tree: e, key: t });
65
72
  if (a == null) {
66
73
  if (n) throw new Error(`Could not find node with key ${t}`);
67
74
  return e;
68
75
  }
69
- const s = $({ tree: e, key: t });
76
+ const s = R({ tree: e, key: t });
70
77
  if (s != null) {
71
- const l = (o = s.children) == null ? void 0 : o.findIndex((x) => x.key === t);
72
- l != null && l !== -1 && ((i = s.children) == null || i.splice(l, 1, r(a)));
78
+ const o = (l = s.children) == null ? void 0 : l.findIndex((u) => u.key === t);
79
+ o != null && o !== -1 && ((i = s.children) == null || i.splice(o, 1, r(a)));
73
80
  } else
74
81
  e.splice(
75
- e.findIndex((l) => l.key === t),
82
+ e.findIndex((o) => o.key === t),
76
83
  1,
77
84
  r(a)
78
85
  );
@@ -106,18 +113,18 @@ const X = (e, t) => t.includes(e.key), H = (e, t) => {
106
113
  }
107
114
  }
108
115
  return null;
109
- }, je = ({ tree: e, keys: t }) => {
116
+ }, $e = ({ tree: e, keys: t }) => {
110
117
  const r = [];
111
118
  for (const n of t) {
112
119
  const a = T({ tree: e, key: n });
113
120
  a != null && r.push(a);
114
121
  }
115
122
  return r;
116
- }, $ = ({ tree: e, key: t }) => {
123
+ }, R = ({ tree: e, key: t }) => {
117
124
  for (const r of e)
118
125
  if (r.children != null) {
119
126
  if (r.children.some((a) => a.key === t)) return r;
120
- const n = $({ tree: r.children, key: t });
127
+ const n = R({ tree: r.children, key: t });
121
128
  if (n != null) return n;
122
129
  }
123
130
  return null;
@@ -126,48 +133,48 @@ const X = (e, t) => t.includes(e.key), H = (e, t) => {
126
133
  return e.forEach((r) => {
127
134
  t.push(r), r.children != null && t.push(...J(...r.children));
128
135
  }), t;
129
- }, M = "tree-item", Pe = [["Shift"]], Re = (e) => {
136
+ }, M = "tree-item", je = [["Shift"]], Pe = (e) => {
130
137
  const {
131
138
  onExpand: t,
132
139
  nodes: r,
133
140
  initialExpanded: n = [],
134
141
  sort: a = !0,
135
142
  selected: s,
136
- onSelectedChange: o
137
- } = e ?? {}, [i, l, x] = he(n), [c, _] = ae({
143
+ onSelectedChange: l
144
+ } = e ?? {}, [i, o, u] = he(n), [c, _] = ae({
138
145
  initial: [],
139
146
  value: s,
140
- onChange: o
147
+ onChange: l
141
148
  }), v = Te(
142
149
  () => K({ nodes: r, expanded: i, sort: a }),
143
150
  [r, i, a]
144
- ), I = pe(v), L = me({ triggers: Pe }), R = b(
151
+ ), I = pe(v), L = me({ triggers: je }), P = b(
145
152
  (f, { clicked: d }) => {
146
153
  _(f);
147
- const g = I.current.find((E) => E.key === d);
148
- if ((g == null ? void 0 : g.hasChildren) === !1 || d == null || L.current.held) return;
149
- const y = x.current, w = y.some((E) => E === d) ? "contract" : "expand";
154
+ const x = I.current.find((E) => E.key === d);
155
+ if ((x == null ? void 0 : x.hasChildren) === !1 || d == null || L.current.held) return;
156
+ const y = u.current, w = y.some((E) => E === d) ? "contract" : "expand";
150
157
  let C;
151
- w === "contract" ? C = y.filter((E) => E !== d) : C = [...y, d], l(C), t == null || t({ current: C, action: w, clicked: d });
158
+ w === "contract" ? C = y.filter((E) => E !== d) : C = [...y, d], o(C), t == null || t({ current: C, action: w, clicked: d });
152
159
  },
153
- [t, I, l, _]
154
- ), h = b(
160
+ [t, I, o, _]
161
+ ), p = b(
155
162
  (f) => {
156
- l((d) => se([...d, f])), t == null || t({ current: i, action: "expand", clicked: f });
163
+ o((d) => se([...d, f])), t == null || t({ current: i, action: "expand", clicked: f });
157
164
  },
158
- [l]
159
- ), j = b(
165
+ [o]
166
+ ), $ = b(
160
167
  (f) => {
161
- l((d) => d.filter((g) => g !== f)), t == null || t({ current: i, action: "contract", clicked: f });
168
+ o((d) => d.filter((x) => x !== f)), t == null || t({ current: i, action: "contract", clicked: f });
162
169
  },
163
- [l]
164
- ), S = b(() => l([]), [l]);
170
+ [o]
171
+ ), S = b(() => o([]), [o]);
165
172
  return {
166
- onSelect: R,
173
+ onSelect: P,
167
174
  selected: c,
168
175
  expanded: i,
169
- contract: j,
170
- expand: h,
176
+ contract: $,
177
+ expand: p,
171
178
  nodes: v,
172
179
  clearExpanded: S
173
180
  };
@@ -179,10 +186,10 @@ const X = (e, t) => t.includes(e.key), H = (e, t) => {
179
186
  onDrop: n,
180
187
  onRename: a,
181
188
  onSuccessfulDrop: s,
182
- onDoubleClick: o,
189
+ onDoubleClick: l,
183
190
  loading: i = !1,
184
- useMargin: l = !0,
185
- translate: x
191
+ useMargin: o = !0,
192
+ translate: u
186
193
  }) => {
187
194
  const {
188
195
  key: c,
@@ -190,119 +197,119 @@ const X = (e, t) => t.includes(e.key), H = (e, t) => {
190
197
  allowRename: v = !1,
191
198
  children: I,
192
199
  icon: L,
193
- name: R,
194
- depth: h,
195
- expanded: j,
200
+ name: P,
201
+ depth: p,
202
+ expanded: $,
196
203
  href: S,
197
204
  haulItems: f = []
198
- } = e, { getSelected: d } = le(), { getSourceData: g } = oe(), y = _ || I != null && I.length > 0, w = [];
205
+ } = e, { getSelected: d } = le(), { getSourceData: x } = oe(), y = _ || I != null && I.length > 0, w = [];
199
206
  y && w.push(
200
- /* @__PURE__ */ N.jsx(ve, { enabled: j, enabledLoc: "bottom", disabledLoc: "right" })
207
+ /* @__PURE__ */ N.jsx(ve, { enabled: $, enabledLoc: "bottom", disabledLoc: "right" })
201
208
  ), L != null && w.push(L);
202
209
  const C = [];
203
- i && C.push(/* @__PURE__ */ N.jsx(ie.Loading, { className: u.B("loading-indicator") }));
210
+ i && C.push(/* @__PURE__ */ N.jsx(ie.Loading, { className: h.B("loading-indicator") }));
204
211
  const [E, O] = be(!1), { startDrag: U, ...Z } = ce({
205
212
  type: "Tree.Item",
206
213
  key: c,
207
- canDrop: b(({ items: p, source: A }) => {
208
- const m = p.map((P) => P.key);
209
- return O(!1), A.type === "Tree.Item" && !m.includes(c);
214
+ canDrop: b(({ items: m, source: A }) => {
215
+ const g = m.map((j) => j.key);
216
+ return O(!1), A.type === "Tree.Item" && !g.includes(c);
210
217
  }, []),
211
- onDrop: b((p) => (n == null ? void 0 : n(c, p)) ?? [], [c, n]),
218
+ onDrop: b((m) => (n == null ? void 0 : n(c, m)) ?? [], [c, n]),
212
219
  onDragOver: b(() => O(!0), [])
213
220
  }), D = () => {
214
- const p = d(), A = g().filter(
215
- (m) => p.includes(m.key)
221
+ const m = d(), A = x().filter(
222
+ (g) => m.includes(g.key)
216
223
  );
217
- if (p.includes(c)) {
218
- const m = A.map(({ key: P, haulItems: B, depth: Q }) => [
219
- { type: M, key: P, data: { depth: Q } },
224
+ if (m.includes(c)) {
225
+ const g = A.map(({ key: j, haulItems: B, depth: Q }) => [
226
+ { type: M, key: j, data: { depth: Q } },
220
227
  ...(B == null ? void 0 : B.map((V) => ({
221
228
  ...V,
222
229
  data: { ...V.data, depth: Q }
223
230
  }))) ?? []
224
231
  ]).flat();
225
- return U(m, (P) => s == null ? void 0 : s(c, P));
232
+ return U(g, (j) => s == null ? void 0 : s(c, j));
226
233
  }
227
234
  U(
228
235
  [
229
- { type: M, key: c, data: { depth: h } },
230
- ...f.map((m) => ({ ...m, data: { ...m.data, depth: h } }))
236
+ { type: M, key: c, data: { depth: p } },
237
+ ...f.map((g) => ({ ...g, data: { ...g.data, depth: p } }))
231
238
  ],
232
- (m) => s == null ? void 0 : s(c, m)
239
+ (g) => s == null ? void 0 : s(c, g)
233
240
  );
234
- }, ee = l ? "marginLeft" : "paddingLeft";
235
- let F = h * 2 + 1;
236
- y && l && (F -= 1);
241
+ }, ee = o ? "marginLeft" : "paddingLeft";
242
+ let F = p * 2 + 1;
243
+ y && o && (F -= 1);
237
244
  const te = {
238
245
  id: c,
239
246
  variant: "text",
240
247
  draggable: f.length > 0,
241
- className: u(
242
- u.BE("list", "item"),
248
+ className: h(
249
+ h.BE("list", "item"),
243
250
  de,
244
- E && u.M("dragging-over"),
251
+ E && h.M("dragging-over"),
245
252
  t && fe,
246
- u.selected(t),
247
- y && u.M("has-children"),
248
- u.BM("depth", h.toString())
253
+ h.selected(t),
254
+ y && h.M("has-children"),
255
+ h.BM("depth", p.toString())
249
256
  ),
250
257
  onDragLeave: () => O(!1),
251
258
  onDragStart: D,
252
259
  onClick: () => r == null ? void 0 : r(c),
253
260
  style: {
254
261
  border: "none",
255
- position: x != null ? "absolute" : "relative",
256
- transform: `translateY(${x}px)`,
262
+ position: u != null ? "absolute" : "relative",
263
+ transform: `translateY(${u}px)`,
257
264
  [ee]: `${F}rem`,
258
265
  // @ts-expect-error - CSS variable
259
- "--pluto-tree-indicator-offset": `${h * 1.5 + (h === 0 ? 0 : 0.5)}rem`
266
+ "--pluto-tree-indicator-offset": `${p * 1.5 + (p === 0 ? 0 : 0.5)}rem`
260
267
  },
261
268
  startIcon: w,
262
269
  iconSpacing: "small",
263
270
  noWrap: !0,
264
271
  endIcon: C,
265
- onDoubleClick: (p) => o == null ? void 0 : o(c, p),
272
+ onDoubleClick: (m) => l == null ? void 0 : l(c, m),
266
273
  href: S,
267
274
  ...Z
268
275
  }, ne = S != null ? _e : ge;
269
- return /* @__PURE__ */ N.jsx(ne, { className: u.BE("list", "item"), ...te, children: /* @__PURE__ */ N.jsx(
276
+ return /* @__PURE__ */ N.jsx(ne, { className: h.BE("list", "item"), ...te, children: /* @__PURE__ */ N.jsx(
270
277
  ue,
271
278
  {
272
279
  id: `text-${c}`,
273
280
  level: "p",
274
281
  allowDoubleClick: !1,
275
- value: R,
282
+ value: P,
276
283
  disabled: !v,
277
- onChange: (p) => a == null ? void 0 : a(c, p)
284
+ onChange: (m) => a == null ? void 0 : a(c, m)
278
285
  }
279
286
  ) });
280
287
  }
281
288
  );
282
289
  G.displayName = "Tree.Item";
283
- const $e = Ee(G), Oe = ({
290
+ const Re = Ee(G), Oe = ({
284
291
  nodes: e,
285
292
  selected: t = [],
286
293
  onSelect: r,
287
294
  onDrop: n,
288
295
  onRename: a,
289
296
  onSuccessfulDrop: s,
290
- onDoubleClick: o,
297
+ onDoubleClick: l,
291
298
  className: i,
292
- children: l = $e,
293
- itemHeight: x = 27,
299
+ children: o = Re,
300
+ itemHeight: u = 27,
294
301
  useMargin: c = !1,
295
302
  showRules: _ = !1,
296
303
  virtual: v = !0,
297
304
  clearExpanded: I,
298
305
  expand: L,
299
- contract: R,
300
- emptyContent: h,
301
- loading: j,
306
+ contract: P,
307
+ emptyContent: p,
308
+ loading: $,
302
309
  ...S
303
310
  }) => {
304
311
  const f = v ? W.Virtual : W;
305
- return /* @__PURE__ */ N.jsx(Ie, { data: e, emptyContent: h, children: /* @__PURE__ */ N.jsx(
312
+ return /* @__PURE__ */ N.jsx(Ie, { data: e, emptyContent: p, children: /* @__PURE__ */ N.jsx(
306
313
  xe,
307
314
  {
308
315
  value: t,
@@ -312,18 +319,18 @@ const $e = Ee(G), Oe = ({
312
319
  children: /* @__PURE__ */ N.jsx(
313
320
  f,
314
321
  {
315
- itemHeight: x,
316
- className: u(i, u.B("tree"), _ && u.M("rules")),
322
+ itemHeight: u,
323
+ className: h(i, h.B("tree"), _ && h.M("rules")),
317
324
  ...S,
318
- children: ({ key: d, ...g }) => l({
319
- ...g,
325
+ children: ({ key: d, ...x }) => o({
326
+ ...x,
320
327
  key: d,
321
- loading: j === d,
328
+ loading: $ === d,
322
329
  useMargin: c,
323
330
  onDrop: n,
324
331
  onRename: a,
325
332
  onSuccessfulDrop: s,
326
- onDoubleClick: o
333
+ onDoubleClick: l
327
334
  })
328
335
  }
329
336
  )
@@ -337,8 +344,8 @@ const $e = Ee(G), Oe = ({
337
344
  asyncRename: Be,
338
345
  deepCopy: q,
339
346
  findNode: T,
340
- findNodeParent: $,
341
- findNodes: je,
347
+ findNodeParent: R,
348
+ findNodes: $e,
342
349
  flatten: K,
343
350
  getDescendants: J,
344
351
  moveNode: Se,
@@ -349,7 +356,7 @@ const $e = Ee(G), Oe = ({
349
356
  startRenaming: Ae,
350
357
  updateNode: we,
351
358
  updateNodeChildren: Le,
352
- use: Re
359
+ use: Pe
353
360
  }, Symbol.toStringTag, { value: "Module" }));
354
361
  export {
355
362
  We as e
@@ -0,0 +1 @@
1
+ "use strict";const I=require("./aggregator-C0Ab25_o.cjs"),R=require("./jsx-runtime-Cek9Ww4S.cjs"),d=require("./Toggle-CP9KtybX.cjs"),C=require("react"),re=require("./Link-BHtl4aby.cjs"),se=require("./Animated-Ck87AGOu.cjs"),p=require("./css-Dh7n0EGs.cjs");require("./Pack-DijAGcm_.cjs");const le=require("./List-C8vXIE2j.cjs"),Y=(e,t)=>t.includes(e.key),H=(e,t)=>{t&&e.sort((n,s)=>I.F.stringsWithNumbers(n.name,s.name));let r=!1;for(let n=0;n<e.length;n++){const s=e[n];s.forcePosition!=null&&n!==s.forcePosition&&(r=!0,e.splice(n,1),e.splice(s.forcePosition,0,s))}return r?H(e,!1):e},K=({nodes:e,expanded:t,depth:r=0,sort:n=!0,path:s=""})=>{r===0&&n&&(e=e.sort((a,c)=>a.name.localeCompare(c.name)));const l=[];return e.forEach((a,c)=>{const i=`${s}${a.key}/`,h=Y(a,t);l.push({...a,depth:r,expanded:h,index:c,path:i}),h&&a.children!=null&&(a.children=H(a.children,n),l.push(...K({nodes:a.children,expanded:t,depth:r+1,sort:n,path:i})))}),l},ae=({tree:e,destination:t,keys:r})=>(r=I.A(r),r.forEach(n=>{const s=j({tree:e,key:n});s!=null&&(z({tree:e,keys:n}),Q({tree:e,destination:t,additions:s}))}),e),z=({tree:e,keys:t})=>{t=I.A(t);const r=e.map(n=>n.key);return t.forEach(n=>{var l;const s=r.indexOf(n);if(s!==-1)e.splice(s,1);else{const a=A({tree:e,key:n});a!=null&&(a.children=(l=a.children)==null?void 0:l.filter(c=>c.key!==n))}}),e},Q=({tree:e,destination:t,additions:r})=>{r=I.A(r);const n=j({tree:e,key:t});if(n==null)throw new Error(`Could not find node with key ${t}`);n.children??(n.children=[]);const s=r.map(l=>l.key);return n.children=[...r,...n.children.filter(l=>!s.includes(l.key))],e},ie=({tree:e,key:t,updater:r,throwOnMissing:n=!0})=>{var a,c;const s=j({tree:e,key:t});if(s==null){if(n)throw new Error(`Could not find node with key ${t}`);return e}const l=A({tree:e,key:t});if(l!=null){const i=(a=l.children)==null?void 0:a.findIndex(h=>h.key===t);i!=null&&i!==-1&&((c=l.children)==null||c.splice(i,1,r(s)))}else e.splice(e.findIndex(i=>i.key===t),1,r(s));return e},ce=({tree:e,parent:t,updater:r,throwOnMissing:n=!0})=>{const s=j({tree:e,key:t});if(s==null){if(n)throw new Error(`Could not find node with key ${t}`);return e}return s.children=r(s.children??[]),e},j=({tree:e,key:t,depth:r=0})=>{for(let n=0;n<e.length;n++){const s=e[n];if(s.key===t){const l=s;return l.depth=r,l.position=n,l}if(s.children!=null){const l=j({tree:s.children,key:t,depth:r+1});if(l!=null)return l}}return null},oe=({tree:e,keys:t})=>{const r=[];for(const n of t){const s=j({tree:e,key:n});s!=null&&r.push(s)}return r},A=({tree:e,key:t})=>{for(const r of e)if(r.children!=null){if(r.children.some(s=>s.key===t))return r;const n=A({tree:r.children,key:t});if(n!=null)return n}return null},V=e=>e.map(t=>({...t,children:V(t.children??[])})),J=(...e)=>{const t=[];return e.forEach(r=>{t.push(r),r.children!=null&&t.push(...J(...r.children))}),t},M="tree-item",de=[["Shift"]],ue=e=>{const{onExpand:t,nodes:r,initialExpanded:n=[],sort:s=!0,selected:l,onSelectedChange:a}=e??{},[c,i,h]=d.useCombinedStateAndRef(n),[o,N]=I.usePassthrough({initial:[],value:l,onChange:a}),T=C.useMemo(()=>K({nodes:r,expanded:c,sort:s}),[r,c,s]),v=d.useSyncedRef(T),w=d.useHeldRef({triggers:de}),$=C.useCallback((f,{clicked:u})=>{N(f);const S=v.current.find(b=>b.key===u);if((S==null?void 0:S.hasChildren)===!1||u==null||w.current.held)return;const E=h.current,k=E.some(b=>b===u)?"contract":"expand";let y;k==="contract"?y=E.filter(b=>b!==u):y=[...E,u],i(y),t==null||t({current:y,action:k,clicked:u})},[t,v,i,N]),m=C.useCallback(f=>{i(u=>I.n([...u,f])),t==null||t({current:c,action:"expand",clicked:f})},[i]),L=C.useCallback(f=>{i(u=>u.filter(S=>S!==f)),t==null||t({current:c,action:"contract",clicked:f})},[i]),_=C.useCallback(()=>i([]),[i]);return{onSelect:$,selected:o,expanded:c,contract:L,expand:m,nodes:T,clearExpanded:_}},G=C.memo(({entry:e,selected:t,onSelect:r,onDrop:n,onRename:s,onSuccessfulDrop:l,onDoubleClick:a,loading:c=!1,useMargin:i=!0,translate:h})=>{const{key:o,hasChildren:N=!1,allowRename:T=!1,children:v,icon:w,name:$,depth:m,expanded:L,href:_,haulItems:f=[]}=e,{getSelected:u}=d.useSelectionUtils(),{getSourceData:S}=d.useDataUtilContext(),E=N||v!=null&&v.length>0,k=[];E&&k.push(R.jsxRuntimeExports.jsx(se.Animated,{enabled:L,enabledLoc:"bottom",disabledLoc:"right"})),w!=null&&k.push(w);const y=[];c&&y.push(R.jsxRuntimeExports.jsx(d.Qt.Loading,{className:p.CSS.B("loading-indicator")}));const[b,q]=C.useState(!1),{startDrag:U,...Z}=d.useDragAndDrop({type:"Tree.Item",key:o,canDrop:C.useCallback(({items:g,source:O})=>{const x=g.map(P=>P.key);return q(!1),O.type==="Tree.Item"&&!x.includes(o)},[]),onDrop:C.useCallback(g=>(n==null?void 0:n(o,g))??[],[o,n]),onDragOver:C.useCallback(()=>q(!0),[])}),D=()=>{const g=u(),O=S().filter(x=>g.includes(x.key));if(g.includes(o)){const x=O.map(({key:P,haulItems:B,depth:W})=>[{type:M,key:P,data:{depth:W}},...(B==null?void 0:B.map(X=>({...X,data:{...X.data,depth:W}})))??[]]).flat();return U(x,P=>l==null?void 0:l(o,P))}U([{type:M,key:o,data:{depth:m}},...f.map(x=>({...x,data:{...x.data,depth:m}}))],x=>l==null?void 0:l(o,x))},ee=i?"marginLeft":"paddingLeft";let F=m*2+1;E&&i&&(F-=1);const te={id:o,variant:"text",draggable:f.length>0,className:p.CSS(p.CSS.BE("list","item"),d.CONTEXT_TARGET,b&&p.CSS.M("dragging-over"),t&&d.CONTEXT_SELECTED,p.CSS.selected(t),E&&p.CSS.M("has-children"),p.CSS.BM("depth",m.toString())),onDragLeave:()=>q(!1),onDragStart:D,onClick:()=>r==null?void 0:r(o),style:{border:"none",position:h!=null?"absolute":"relative",transform:`translateY(${h}px)`,[ee]:`${F}rem`,"--pluto-tree-indicator-offset":`${m*1.5+(m===0?0:.5)}rem`},startIcon:k,iconSpacing:"small",noWrap:!0,endIcon:y,onDoubleClick:g=>a==null?void 0:a(o,g),href:_,...Z},ne=_!=null?re.Link:d.Button;return R.jsxRuntimeExports.jsx(ne,{className:p.CSS.BE("list","item"),...te,children:R.jsxRuntimeExports.jsx(d.MaybeEditable,{id:`text-${o}`,level:"p",allowDoubleClick:!1,value:$,disabled:!T,onChange:g=>s==null?void 0:s(o,g)})})});G.displayName="Tree.Item";const fe=d.componentRenderProp(G),he=({nodes:e,selected:t=[],onSelect:r,onDrop:n,onRename:s,onSuccessfulDrop:l,onDoubleClick:a,className:c,children:i=fe,itemHeight:h=27,useMargin:o=!1,showRules:N=!1,virtual:T=!0,clearExpanded:v,expand:w,contract:$,emptyContent:m,loading:L,..._})=>{const f=T?d.Core.Virtual:d.Core;return R.jsxRuntimeExports.jsx(le.List,{data:e,emptyContent:m,children:R.jsxRuntimeExports.jsx(d.Selector,{value:t,onChange:r,allowMultiple:!0,replaceOnSingle:!0,children:R.jsxRuntimeExports.jsx(f,{itemHeight:h,className:p.CSS(c,p.CSS.B("tree"),N&&p.CSS.M("rules")),..._,children:({key:u,...S})=>i({...S,key:u,loading:L===u,useMargin:o,onDrop:n,onRename:s,onSuccessfulDrop:l,onDoubleClick:a})})})})},pe=(e,t)=>d.edit(`text-${e}`,t),me=e=>d.asyncEdit(`text-${e}`),ge=Object.freeze(Object.defineProperty({__proto__:null,DefaultItem:G,HAUL_TYPE:M,Tree:he,asyncRename:me,deepCopy:V,findNode:j,findNodeParent:A,findNodes:oe,flatten:K,getDescendants:J,moveNode:ae,removeNode:z,setNode:Q,shouldExpand:Y,sortAndSplice:H,startRenaming:pe,updateNode:ie,updateNodeChildren:ce,use:ue},Symbol.toStringTag,{value:"Module"}));exports.external=ge;