treege 3.0.0-beta.95 → 3.0.0-beta.96
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/{DefaultSubmitButton-D4Hqyara.js → DefaultSubmitButton-CAOTg3w7.js} +196 -196
- package/dist/{ThemeContext-CDewydK5.js → ThemeContext-B9-cptw0.js} +21 -7
- package/dist/editor/types/ai.d.ts +1 -1
- package/dist/editor/utils/aiFlowGenerator.d.ts +16 -1
- package/dist/{editor-BzhBNy8O.js → editor-CSc1Ygb5.js} +745 -722
- package/dist/editor.js +2 -2
- package/dist/main.js +6 -6
- package/dist/renderer/types/renderer.d.ts +3 -3
- package/dist/renderer/utils/form.d.ts +13 -1
- package/dist/renderer-DX3WeZtk.js +437 -0
- package/dist/renderer-native.js +899 -899
- package/dist/renderer.js +5 -5
- package/dist/useRenderNode-C9RSQFX3.js +600 -0
- package/package.json +1 -1
- package/dist/renderer-Cd2P21x9.js +0 -437
- package/dist/useRenderNode-BaBKq6Ed.js +0 -600
|
@@ -862,7 +862,21 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
|
|
|
862
862
|
]), Ee = (e) => e.filter(s), q = (e) => e.data.name ? e.data.name : g(e.data.label) || e.id, De = (e, t) => g(e.data.label, t) || e.data.name || e.id, Oe = (e, t) => {
|
|
863
863
|
let n = e.type ?? "text";
|
|
864
864
|
return !_(e.placeholder, t) && Te.has(n) ? b(t)["renderer.defaultInputs.newAnswer"] ?? "" : g(e.placeholder, t);
|
|
865
|
-
}, ke = (e) => e == null || typeof e == "string" && e.trim() === "" ? !0 : Array.isArray(e) && e.length === 0, Ae = (e
|
|
865
|
+
}, ke = (e) => e == null || typeof e == "string" && e.trim() === "" ? !0 : Array.isArray(e) && e.length === 0, Ae = (e) => {
|
|
866
|
+
let { multiple: t, options: n, optionsSource: r, type: i } = e.data;
|
|
867
|
+
switch (i) {
|
|
868
|
+
case S.switch: return !1;
|
|
869
|
+
case S.checkbox: return n?.length || r ? [] : !1;
|
|
870
|
+
case S.select:
|
|
871
|
+
case S.http: return t ? [] : "";
|
|
872
|
+
case S.number:
|
|
873
|
+
case S.file:
|
|
874
|
+
case S.daterange:
|
|
875
|
+
case S.timerange: return null;
|
|
876
|
+
case S.submit: return;
|
|
877
|
+
default: return "";
|
|
878
|
+
}
|
|
879
|
+
}, je = (e, t) => e ? t[e] != null : !1, J = (e, t) => {
|
|
866
880
|
let { defaultValue: n } = e.data;
|
|
867
881
|
if (n) {
|
|
868
882
|
if (n.type === "static" && n.staticValue !== void 0) return n.staticValue;
|
|
@@ -871,7 +885,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
|
|
|
871
885
|
if (e !== void 0) return e;
|
|
872
886
|
}
|
|
873
887
|
}
|
|
874
|
-
},
|
|
888
|
+
}, Y = (e, t) => {
|
|
875
889
|
let n = {};
|
|
876
890
|
return t.forEach((t) => {
|
|
877
891
|
if (e[t.id] !== void 0) {
|
|
@@ -885,7 +899,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
|
|
|
885
899
|
let t = J(e, n);
|
|
886
900
|
t !== void 0 && (n[e.id] = t);
|
|
887
901
|
}), n;
|
|
888
|
-
},
|
|
902
|
+
}, Me = (e, t) => {
|
|
889
903
|
let n = {};
|
|
890
904
|
return t.forEach((t) => {
|
|
891
905
|
let r = t.id, i = q(t);
|
|
@@ -934,7 +948,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
|
|
|
934
948
|
} catch {
|
|
935
949
|
return !1;
|
|
936
950
|
}
|
|
937
|
-
},
|
|
951
|
+
}, Ne = (e, t, n) => {
|
|
938
952
|
let r = {};
|
|
939
953
|
return e.forEach((e) => {
|
|
940
954
|
let { defaultValue: i } = e.data;
|
|
@@ -991,7 +1005,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
|
|
|
991
1005
|
colors: Q.light,
|
|
992
1006
|
setTheme: () => null,
|
|
993
1007
|
theme: "system"
|
|
994
|
-
}),
|
|
1008
|
+
}), Pe = ({ children: e, defaultTheme: t = "system", storageKey: o = "treege-theme", theme: s, ...c }) => {
|
|
995
1009
|
let [l, u] = i(() => s || typeof localStorage < "u" && localStorage.getItem(o) || t), d = s ?? l, f = Q[d === "system" ? typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : d], p = r(() => ({
|
|
996
1010
|
colors: f,
|
|
997
1011
|
setTheme: (e) => {
|
|
@@ -1023,10 +1037,10 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
|
|
|
1023
1037
|
value: p,
|
|
1024
1038
|
children: e
|
|
1025
1039
|
});
|
|
1026
|
-
},
|
|
1040
|
+
}, Fe = () => {
|
|
1027
1041
|
let e = t($);
|
|
1028
1042
|
if (e === void 0) throw Error("useTheme must be used within a ThemeProvider");
|
|
1029
1043
|
return e;
|
|
1030
1044
|
};
|
|
1031
1045
|
//#endregion
|
|
1032
|
-
export {
|
|
1046
|
+
export { s as $, N as A, k as B, ye as C, z as D, P as E, fe as F, re as G, E as H, le as I, b as J, ne as K, A as L, F as M, ue as N, R as O, de as P, l as Q, M as R, W as S, ve as T, C as U, ie as V, S as W, g as X, _ as Y, te as Z, xe as _, Ne as a, Ce as b, ke as c, Ee as d, c as et, Oe as f, G as g, K as h, Y as i, I as j, pe as k, Ae as l, De as m, Fe as n, je as o, q as p, x as q, X as r, Me as s, Pe as t, J as u, we as v, U as w, be as x, Se as y, D as z };
|
|
@@ -21,7 +21,7 @@ export interface AIConfig {
|
|
|
21
21
|
* - Gemini: "gemini-2.5-flash" (default), "gemini-2.5-pro-preview-03-25"
|
|
22
22
|
* - OpenAI: "gpt-4o-mini" (default), "gpt-4o", "gpt-3.5-turbo"
|
|
23
23
|
* - DeepSeek: "deepseek-chat" (default)
|
|
24
|
-
* - Claude: "claude-
|
|
24
|
+
* - Claude: "claude-opus-4-8" (default), "claude-sonnet-5", "claude-haiku-4-5"
|
|
25
25
|
*/
|
|
26
26
|
model?: string;
|
|
27
27
|
/**
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { AIGenerationRequest, AIGenerationResponse } from '../types/ai';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Enforce the editor's structural invariants on an AI-generated flow, so a
|
|
4
|
+
* model that drifts from the prompt can never inject a malformed flow into
|
|
5
|
+
* the canvas:
|
|
6
|
+
* - the response must carry `nodes` and `edges` arrays;
|
|
7
|
+
* - group nodes are metadata only: always `hidden` and anchored at (0, 0)
|
|
8
|
+
* (a visible or offset group breaks pointer events and the auto-layout —
|
|
9
|
+
* see `getLayoutedElements`);
|
|
10
|
+
* - a `parentId` pointing to a node that isn't a group is dropped;
|
|
11
|
+
* - groups are hoisted before other nodes, since xyflow requires parents to
|
|
12
|
+
* precede their children in the nodes array.
|
|
13
|
+
*/
|
|
14
|
+
export declare const sanitizeGeneratedFlow: (response: AIGenerationResponse) => AIGenerationResponse;
|
|
15
|
+
/**
|
|
16
|
+
* Main function to generate flow using AI.
|
|
17
|
+
* Whatever the provider returns is passed through `sanitizeGeneratedFlow`, so
|
|
18
|
+
* the caller always receives a flow that respects the editor's invariants.
|
|
4
19
|
*/
|
|
5
20
|
export declare function generateFlowWithAI(request: AIGenerationRequest): Promise<AIGenerationResponse>;
|