treege 3.0.0-beta.27 → 3.0.0-beta.28

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.
@@ -1,9 +1,9 @@
1
- import { j as e, i as je, u as dt, L as oe, N as ye, c as Se, a as ct, b as ut } from "./node-gfy3ym4p.js";
2
- import { useNodes as Oe, useEdges as We, getBezierPath as Je, useReactFlow as ue, BaseEdge as qe, EdgeLabelRenderer as Xe, addEdge as ht, Handle as ie, Position as de, NodeResizer as mt, Panel as pt, ReactFlowProvider as xt, ReactFlow as gt, Background as jt, BackgroundVariant as Ct, MiniMap as vt, Controls as ft } from "@xyflow/react";
1
+ import { j as e, i as je, e as dt, L as oe, N as ye, c as Se, a as ct, b as ut, T as ht } from "./ThemeContext-BBEqRK_Q.js";
2
+ import { useNodes as Oe, useEdges as We, getBezierPath as Je, useReactFlow as ue, BaseEdge as qe, EdgeLabelRenderer as Xe, addEdge as mt, Handle as ie, Position as de, NodeResizer as pt, Panel as xt, ReactFlowProvider as gt, ReactFlow as jt, Background as Ct, BackgroundVariant as vt, MiniMap as ft, Controls as bt } from "@xyflow/react";
3
3
  import { useForm as ne } from "@tanstack/react-form";
4
- import { Waypoints as bt, X as se, Plus as X, Network as Nt, Boxes as yt, Type as Qe, LucidePencilRuler as wt, XIcon as et, WandSparkles as _e, Loader2 as Ft, Save as St, EllipsisVertical as Et, Copy as kt, Download as Pt, ArrowRightFromLine as Dt, Trash2 as tt, Variable as we, ChevronsUpDown as re, Check as Tt, PlusCircle as At } from "lucide-react";
5
- import { useMemo as le, createContext as Vt, useContext as It, useState as z, memo as he, useCallback as $, useRef as Ot, useEffect as Mt, useId as Fe } from "react";
6
- import { j as P, P as Me, g as Le, B as S, h as Be, F as N, L as j, I as k, f as M, k as Lt, S as _, m as R, n as Z, o as K, q as y, s as Ge, p as te, r as J, C as Bt, i as Gt, a as $t, b as zt, c as Re, d as Ve, v as $e, l as at, t as Ht, T as Ut } from "./ThemeContext-Cc71SvqK.js";
4
+ import { Waypoints as Nt, X as se, Plus as X, Network as yt, Boxes as wt, Type as Qe, LucidePencilRuler as Ft, XIcon as et, WandSparkles as _e, Loader2 as St, Save as Et, EllipsisVertical as kt, Copy as Pt, Download as Dt, ArrowRightFromLine as Tt, Trash2 as tt, Variable as we, ChevronsUpDown as re, Check as At, PlusCircle as Vt } from "lucide-react";
5
+ import { useMemo as le, createContext as It, useContext as Ot, useState as z, memo as he, useCallback as $, useRef as Mt, useEffect as Lt, useId as Fe } from "react";
6
+ import { j as P, P as Me, g as Le, B as S, h as Be, F as N, L as j, I as k, f as M, k as Bt, S as _, m as R, n as Z, o as K, q as y, T as Ge, p as te, r as J, C as Gt, i as $t, a as zt, b as Ht, c as Re, d as Ve, t as $e, l as at, s as Ut } from "./separator-oCo7kxCK.js";
7
7
  import * as Ce from "@radix-ui/react-scroll-area";
8
8
  import { Slot as _t } from "@radix-ui/react-slot";
9
9
  import { cva as Rt } from "class-variance-authority";
@@ -41,7 +41,7 @@ const Yt = "data:image/svg+xml,%3csvg%20width='462'%20height='144'%20viewBox='0%
41
41
  };
42
42
  });
43
43
  }, [t, s, l]);
44
- }, st = Vt(null), qt = ({ children: t, value: s }) => {
44
+ }, st = It(null), qt = ({ children: t, value: s }) => {
45
45
  const [l, i] = z(s?.flowId), h = le(
46
46
  () => ({
47
47
  ...s,
@@ -57,7 +57,7 @@ const Yt = "data:image/svg+xml,%3csvg%20width='462'%20height='144'%20viewBox='0%
57
57
  [l, s]
58
58
  );
59
59
  return /* @__PURE__ */ e.jsx(st.Provider, { value: h, children: t });
60
- }, nt = () => It(st) ?? {
60
+ }, nt = () => Ot(st) ?? {
61
61
  flowId: void 0,
62
62
  language: "en",
63
63
  setFlowId: () => {
@@ -183,7 +183,7 @@ const Qt = ({
183
183
  className: "h-8 px-2 text-xs",
184
184
  onClick: A,
185
185
  children: [
186
- /* @__PURE__ */ e.jsx(bt, { className: "mr-1 h-3 w-3" }),
186
+ /* @__PURE__ */ e.jsx(Nt, { className: "mr-1 h-3 w-3" }),
187
187
  w || a?.isFallback ? T() : C("editor.conditionalEdge.condition")
188
188
  ]
189
189
  }
@@ -215,7 +215,7 @@ const Qt = ({
215
215
  ] }) }),
216
216
  /* @__PURE__ */ e.jsx(E, { name: "isFallback", children: (v) => /* @__PURE__ */ e.jsx(N, { children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3 rounded-lg border bg-muted/20 p-3", children: [
217
217
  /* @__PURE__ */ e.jsx(
218
- Lt,
218
+ Bt,
219
219
  {
220
220
  id: v.name,
221
221
  checked: v.state.value,
@@ -442,7 +442,7 @@ const rt = {
442
442
  ), f = $(
443
443
  (u) => {
444
444
  s((m) => {
445
- const p = ht(u, m), x = u.source, F = i(x);
445
+ const p = mt(u, m), x = u.source, F = i(x);
446
446
  return p.filter((w) => w.source === x).length > 1 && F && je(F) ? p.map((w) => w.source === x ? {
447
447
  ...w,
448
448
  data: {
@@ -547,7 +547,7 @@ const ia = ({ data: t, isConnectable: s, type: l, parentId: i, id: h }) => {
547
547
  /* @__PURE__ */ e.jsx(ie, { type: "target", position: de.Top, isConnectable: s, isConnectableStart: !1 }),
548
548
  /* @__PURE__ */ e.jsx("div", { className: "mb-1 max-w-full overflow-hidden text-ellipsis text-nowrap text-2xl", children: n }),
549
549
  /* @__PURE__ */ e.jsxs(ve, { variant: "destructive", className: "capitalize", children: [
550
- /* @__PURE__ */ e.jsx(Nt, {}),
550
+ /* @__PURE__ */ e.jsx(yt, {}),
551
551
  l
552
552
  ] }),
553
553
  /* @__PURE__ */ e.jsx(
@@ -565,9 +565,9 @@ const ia = ({ data: t, isConnectable: s, type: l, parentId: i, id: h }) => {
565
565
  }, da = he(ia), ca = ({ data: t }) => {
566
566
  const l = B()(t?.label);
567
567
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
568
- /* @__PURE__ */ e.jsx(mt, {}),
568
+ /* @__PURE__ */ e.jsx(pt, {}),
569
569
  /* @__PURE__ */ e.jsx("div", { className: "-top-3.5 absolute left-6", children: /* @__PURE__ */ e.jsxs(ve, { className: "max-w-50 bg-chart-2", children: [
570
- /* @__PURE__ */ e.jsx(yt, { className: "!w-3 !h-3" }),
570
+ /* @__PURE__ */ e.jsx(wt, { className: "!w-3 !h-3" }),
571
571
  l
572
572
  ] }) })
573
573
  ] });
@@ -599,7 +599,7 @@ const ia = ({ data: t, isConnectable: s, type: l, parentId: i, id: h }) => {
599
599
  /* @__PURE__ */ e.jsx("div", { className: "mb-1 max-w-full overflow-hidden text-ellipsis text-nowrap text-2xl capitalize", children: n }),
600
600
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
601
601
  /* @__PURE__ */ e.jsxs(ve, { variant: "purple", children: [
602
- /* @__PURE__ */ e.jsx(wt, {}),
602
+ /* @__PURE__ */ e.jsx(Ft, {}),
603
603
  l
604
604
  ] }),
605
605
  t?.type && /* @__PURE__ */ e.jsxs(ve, { variant: "outline", className: "capitalize", children: [
@@ -1270,7 +1270,7 @@ const Da = ({ aiConfig: t, onGenerate: s }) => {
1270
1270
  /* @__PURE__ */ e.jsxs(Ea, { children: [
1271
1271
  /* @__PURE__ */ e.jsx(S, { variant: "outline", onClick: () => i(!1), disabled: n, children: d("editor.aiGenerator.cancel") }),
1272
1272
  /* @__PURE__ */ e.jsx(S, { onClick: c, disabled: n || !h.trim() || !t?.apiKey, children: n ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1273
- /* @__PURE__ */ e.jsx(Ft, { className: "h-4 w-4 animate-spin" }),
1273
+ /* @__PURE__ */ e.jsx(St, { className: "h-4 w-4 animate-spin" }),
1274
1274
  d("editor.aiGenerator.generating")
1275
1275
  ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1276
1276
  /* @__PURE__ */ e.jsx(_e, { className: "h-4 w-4 text-[--treege-color-primary]" }),
@@ -1349,7 +1349,7 @@ function Ke({ className: t, ...s }) {
1349
1349
  );
1350
1350
  }
1351
1351
  const Aa = ce(), Va = ({ onExportJson: t, onSave: s }) => {
1352
- const { flowId: l, setFlowId: i, aiConfig: h } = nt(), { setNodes: o, setEdges: n, addNodes: f, screenToFlowPosition: d } = ue(), c = l || Aa, a = Oe(), r = We(), u = Ot(null), m = B(), p = () => {
1352
+ const { flowId: l, setFlowId: i, aiConfig: h } = nt(), { setNodes: o, setEdges: n, addNodes: f, screenToFlowPosition: d } = ue(), c = l || Aa, a = Oe(), r = We(), u = Mt(null), m = B(), p = () => {
1353
1353
  const b = (window.innerWidth || 0) / 2, E = (window.innerHeight || 0) / 2, A = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--node-width"), 10), V = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--node-height"), 10), T = d({ x: b - A, y: E - V });
1354
1354
  f([
1355
1355
  {
@@ -1401,14 +1401,14 @@ const Aa = ce(), Va = ({ onExportJson: t, onSave: s }) => {
1401
1401
  }, I = (b) => {
1402
1402
  o(b.nodes), n(b.edges);
1403
1403
  };
1404
- return Mt(() => {
1404
+ return Lt(() => {
1405
1405
  const b = (E) => {
1406
1406
  (E.ctrlKey || E.metaKey) && E.key === "s" && (E.preventDefault(), g());
1407
1407
  };
1408
1408
  return window.addEventListener("keydown", b), () => {
1409
1409
  window.removeEventListener("keydown", b);
1410
1410
  };
1411
- }, [g]), /* @__PURE__ */ e.jsxs(pt, { position: "top-right", className: "flex gap-2", children: [
1411
+ }, [g]), /* @__PURE__ */ e.jsxs(xt, { position: "top-right", className: "flex gap-2", children: [
1412
1412
  /* @__PURE__ */ e.jsx(Da, { aiConfig: h, onGenerate: I }),
1413
1413
  /* @__PURE__ */ e.jsxs(S, { variant: "outline", size: "sm", onClick: p, children: [
1414
1414
  /* @__PURE__ */ e.jsx(X, {}),
@@ -1416,12 +1416,12 @@ const Aa = ce(), Va = ({ onExportJson: t, onSave: s }) => {
1416
1416
  m("editor.actionsPanel.addNode")
1417
1417
  ] }),
1418
1418
  /* @__PURE__ */ e.jsxs(S, { variant: "outline", size: "sm", onClick: g, children: [
1419
- /* @__PURE__ */ e.jsx(St, {}),
1419
+ /* @__PURE__ */ e.jsx(Et, {}),
1420
1420
  " ",
1421
1421
  m("common.save")
1422
1422
  ] }),
1423
1423
  /* @__PURE__ */ e.jsxs(fe, { children: [
1424
- /* @__PURE__ */ e.jsx(be, { asChild: !0, children: /* @__PURE__ */ e.jsx(S, { variant: "outline", size: "sm", children: /* @__PURE__ */ e.jsx(Et, {}) }) }),
1424
+ /* @__PURE__ */ e.jsx(be, { asChild: !0, children: /* @__PURE__ */ e.jsx(S, { variant: "outline", size: "sm", children: /* @__PURE__ */ e.jsx(kt, {}) }) }),
1425
1425
  /* @__PURE__ */ e.jsxs(Ne, { align: "start", children: [
1426
1426
  /* @__PURE__ */ e.jsx(Ta, { className: "font-normal", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
1427
1427
  /* @__PURE__ */ e.jsx("span", { className: "text-muted-foreground text-xs", children: "Flow ID" }),
@@ -1432,7 +1432,7 @@ const Aa = ce(), Va = ({ onExportJson: t, onSave: s }) => {
1432
1432
  className: "flex items-center gap-2 font-mono text-muted-foreground transition-colors hover:text-primary",
1433
1433
  type: "button",
1434
1434
  children: [
1435
- /* @__PURE__ */ e.jsx(kt, { className: "h-3 w-3" }),
1435
+ /* @__PURE__ */ e.jsx(Pt, { className: "h-3 w-3" }),
1436
1436
  /* @__PURE__ */ e.jsx("span", { className: "truncate text-xs", children: c })
1437
1437
  ]
1438
1438
  }
@@ -1441,12 +1441,12 @@ const Aa = ce(), Va = ({ onExportJson: t, onSave: s }) => {
1441
1441
  /* @__PURE__ */ e.jsx(Ke, {}),
1442
1442
  /* @__PURE__ */ e.jsxs(Ze, { children: [
1443
1443
  /* @__PURE__ */ e.jsxs(W, { onClick: () => u?.current?.click(), children: [
1444
- /* @__PURE__ */ e.jsx(Pt, {}),
1444
+ /* @__PURE__ */ e.jsx(Dt, {}),
1445
1445
  " ",
1446
1446
  m("editor.actionsPanel.importJson")
1447
1447
  ] }),
1448
1448
  /* @__PURE__ */ e.jsxs(W, { onClick: F, children: [
1449
- /* @__PURE__ */ e.jsx(Dt, {}),
1449
+ /* @__PURE__ */ e.jsx(Tt, {}),
1450
1450
  " ",
1451
1451
  m("editor.actionsPanel.exportJson")
1452
1452
  ] })
@@ -2290,10 +2290,10 @@ const Aa = ce(), Va = ({ onExportJson: t, onSave: s }) => {
2290
2290
  ]
2291
2291
  }
2292
2292
  ) }),
2293
- /* @__PURE__ */ e.jsx(Be, { className: "w-full p-0", align: "start", children: /* @__PURE__ */ e.jsxs(Bt, { shouldFilter: !1, children: [
2294
- /* @__PURE__ */ e.jsx(Gt, { placeholder: o, value: p, onValueChange: x }),
2295
- /* @__PURE__ */ e.jsxs($t, { children: [
2296
- /* @__PURE__ */ e.jsx(zt, { children: d }),
2293
+ /* @__PURE__ */ e.jsx(Be, { className: "w-full p-0", align: "start", children: /* @__PURE__ */ e.jsxs(Gt, { shouldFilter: !1, children: [
2294
+ /* @__PURE__ */ e.jsx($t, { placeholder: o, value: p, onValueChange: x }),
2295
+ /* @__PURE__ */ e.jsxs(zt, { children: [
2296
+ /* @__PURE__ */ e.jsx(Ht, { children: d }),
2297
2297
  a && C && /* @__PURE__ */ e.jsx(Re, { children: /* @__PURE__ */ e.jsxs(Ve, { value: "__clear__", onSelect: T, className: "mt-1 text-muted-foreground", children: [
2298
2298
  /* @__PURE__ */ e.jsx(se, { className: "mr-2 h-4 w-4" }),
2299
2299
  f
@@ -2313,7 +2313,7 @@ const Aa = ce(), Va = ({ onExportJson: t, onSave: s }) => {
2313
2313
  onSelect: () => A(D?.value || ""),
2314
2314
  children: [
2315
2315
  /* @__PURE__ */ e.jsx(
2316
- Tt,
2316
+ At,
2317
2317
  {
2318
2318
  "aria-hidden": "true",
2319
2319
  className: P(
@@ -3059,7 +3059,7 @@ const Za = () => {
3059
3059
  ] }) })
3060
3060
  ] }),
3061
3061
  /* @__PURE__ */ e.jsxs(Me, { open: l, onOpenChange: i, children: [
3062
- /* @__PURE__ */ e.jsx(Le, { asChild: !0, children: /* @__PURE__ */ e.jsx(S, { variant: "outline", size: "icon", title: "Create a new group", children: /* @__PURE__ */ e.jsx(At, { className: "h-4 w-4" }) }) }),
3062
+ /* @__PURE__ */ e.jsx(Le, { asChild: !0, children: /* @__PURE__ */ e.jsx(S, { variant: "outline", size: "icon", title: "Create a new group", children: /* @__PURE__ */ e.jsx(Vt, { className: "h-4 w-4" }) }) }),
3063
3063
  /* @__PURE__ */ e.jsx(Be, { className: "w-80", align: "end", disablePortal: !0, children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
3064
3064
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3065
3065
  /* @__PURE__ */ e.jsx("h4", { className: "font-medium leading-none", children: c("editor.selectNodeGroup.newGroup") }),
@@ -3241,7 +3241,7 @@ const xs = () => {
3241
3241
  /* @__PURE__ */ e.jsx(ot, { className: "flex min-h-0 flex-1 flex-col px-4", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 py-4", children: [
3242
3242
  /* @__PURE__ */ e.jsx(Wa, {}),
3243
3243
  /* @__PURE__ */ e.jsx(Ya, {}),
3244
- /* @__PURE__ */ e.jsx(Ht, {}),
3244
+ /* @__PURE__ */ e.jsx(Ut, {}),
3245
3245
  je(t) && /* @__PURE__ */ e.jsx(Za, {}),
3246
3246
  ct(t) && /* @__PURE__ */ e.jsx(Ka, {}),
3247
3247
  ut(t) && /* @__PURE__ */ e.jsx(Oa, {}),
@@ -3279,7 +3279,7 @@ const xs = () => {
3279
3279
  }, js = ({ flow: t, onExportJson: s, onSave: l, theme: i, className: h }) => {
3280
3280
  const { onConnect: o, onConnectEnd: n, onEdgesDelete: f, isValidConnection: d } = lt();
3281
3281
  return /* @__PURE__ */ e.jsxs(
3282
- gt,
3282
+ jt,
3283
3283
  {
3284
3284
  fitView: !0,
3285
3285
  colorMode: i,
@@ -3294,18 +3294,18 @@ const xs = () => {
3294
3294
  isValidConnection: d,
3295
3295
  className: P(h, "treege"),
3296
3296
  children: [
3297
- /* @__PURE__ */ e.jsx(jt, { gap: 10, variant: Ct.Dots }),
3297
+ /* @__PURE__ */ e.jsx(Ct, { gap: 10, variant: vt.Dots }),
3298
3298
  /* @__PURE__ */ e.jsx(Va, { onExportJson: s, onSave: l }),
3299
3299
  /* @__PURE__ */ e.jsx(Jt, { theme: i }),
3300
- /* @__PURE__ */ e.jsx(vt, {}),
3301
3300
  /* @__PURE__ */ e.jsx(ft, {}),
3301
+ /* @__PURE__ */ e.jsx(bt, {}),
3302
3302
  /* @__PURE__ */ e.jsx(xs, {})
3303
3303
  ]
3304
3304
  }
3305
3305
  );
3306
- }, ks = ({ flow: t, onExportJson: s, onSave: l, theme: i = "dark", language: h = "en", aiConfig: o }) => /* @__PURE__ */ e.jsx(Ut, { defaultTheme: i, storageKey: "treege-editor-theme", theme: i, children: /* @__PURE__ */ e.jsxs(qt, { value: { aiConfig: o, flowId: t?.id, language: h }, children: [
3306
+ }, ks = ({ flow: t, onExportJson: s, onSave: l, theme: i = "dark", language: h = "en", aiConfig: o }) => /* @__PURE__ */ e.jsx(ht, { defaultTheme: i, storageKey: "treege-editor-theme", theme: i, children: /* @__PURE__ */ e.jsxs(qt, { value: { aiConfig: o, flowId: t?.id, language: h }, children: [
3307
3307
  /* @__PURE__ */ e.jsx(gs, { position: "bottom-center" }),
3308
- /* @__PURE__ */ e.jsx(xt, { children: /* @__PURE__ */ e.jsx(js, { onExportJson: s, onSave: l, flow: t, theme: i }) })
3308
+ /* @__PURE__ */ e.jsx(gt, { children: /* @__PURE__ */ e.jsx(js, { onExportJson: s, onSave: l, flow: t, theme: i }) })
3309
3309
  ] }) });
3310
3310
  export {
3311
3311
  ks as T