@01.software/sdk 0.2.9-dev.260310.cf511cb → 0.2.9-dev.260311.892250f
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/README.md +21 -8
- package/dist/auth.cjs +3 -1
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +36 -3
- package/dist/auth.d.ts +36 -3
- package/dist/auth.js +3 -1
- package/dist/auth.js.map +1 -1
- package/dist/index.cjs +214 -231
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +321 -155
- package/dist/index.d.ts +321 -155
- package/dist/index.js +217 -231
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-Cq93wqIe.d.cts → payload-types-BjvBwB8Z.d.cts} +1601 -1373
- package/dist/{payload-types-Cq93wqIe.d.ts → payload-types-BjvBwB8Z.d.ts} +1601 -1373
- package/dist/ui/code-block.cjs +182 -0
- package/dist/ui/code-block.cjs.map +1 -0
- package/dist/ui/code-block.d.cts +62 -0
- package/dist/ui/code-block.d.ts +62 -0
- package/dist/ui/code-block.js +152 -0
- package/dist/ui/code-block.js.map +1 -0
- package/dist/{flow.cjs → ui/flow.cjs} +120 -96
- package/dist/ui/flow.cjs.map +1 -0
- package/dist/{flow.d.cts → ui/flow.d.cts} +27 -11
- package/dist/{flow.d.ts → ui/flow.d.ts} +27 -11
- package/dist/{flow.js → ui/flow.js} +119 -94
- package/dist/ui/flow.js.map +1 -0
- package/dist/{components.cjs → ui/form.cjs} +27 -520
- package/dist/ui/form.cjs.map +1 -0
- package/dist/ui/form.d.cts +37 -0
- package/dist/ui/form.d.ts +37 -0
- package/dist/{components.js → ui/form.js} +20 -516
- package/dist/ui/form.js.map +1 -0
- package/dist/ui/image.cjs +208 -0
- package/dist/ui/image.cjs.map +1 -0
- package/dist/ui/image.d.cts +44 -0
- package/dist/ui/image.d.ts +44 -0
- package/dist/ui/image.js +180 -0
- package/dist/ui/image.js.map +1 -0
- package/dist/ui/rich-text.cjs +258 -0
- package/dist/ui/rich-text.cjs.map +1 -0
- package/dist/ui/rich-text.d.cts +110 -0
- package/dist/ui/rich-text.d.ts +110 -0
- package/dist/ui/rich-text.js +235 -0
- package/dist/ui/rich-text.js.map +1 -0
- package/dist/{webhook-NRdVwXN7.d.cts → webhook-CszIpUKn.d.cts} +2 -2
- package/dist/{webhook-C_7s0K66.d.ts → webhook-_LdLdjGa.d.ts} +2 -2
- package/dist/webhook.d.cts +2 -2
- package/dist/webhook.d.ts +2 -2
- package/package.json +47 -12
- package/dist/auth-CVVo5UT5.d.ts +0 -298
- package/dist/auth-CqgrT1qd.d.cts +0 -298
- package/dist/components.cjs.map +0 -1
- package/dist/components.d.cts +0 -240
- package/dist/components.d.ts +0 -240
- package/dist/components.js.map +0 -1
- package/dist/flow.cjs.map +0 -1
- package/dist/flow.js.map +0 -1
|
@@ -36,15 +36,16 @@ var __async = (__this, __arguments, generator) => {
|
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
// src/
|
|
39
|
+
// src/ui/Flow/index.tsx
|
|
40
40
|
import React from "react";
|
|
41
41
|
import {
|
|
42
42
|
ReactFlow,
|
|
43
43
|
ReactFlowProvider,
|
|
44
|
-
Background
|
|
44
|
+
Background,
|
|
45
|
+
MarkerType
|
|
45
46
|
} from "@xyflow/react";
|
|
46
47
|
|
|
47
|
-
// src/
|
|
48
|
+
// src/ui/Flow/types.ts
|
|
48
49
|
function isDynamicNode(node) {
|
|
49
50
|
return node.type === "dynamic";
|
|
50
51
|
}
|
|
@@ -52,7 +53,7 @@ function isFrameNode(node) {
|
|
|
52
53
|
return node.type === "frame";
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
// src/
|
|
56
|
+
// src/ui/Flow/built-in-node-types.ts
|
|
56
57
|
var BUILT_IN_NODE_TYPES = [
|
|
57
58
|
{
|
|
58
59
|
slug: "text",
|
|
@@ -75,68 +76,69 @@ var BUILT_IN_NODE_TYPES = [
|
|
|
75
76
|
}
|
|
76
77
|
];
|
|
77
78
|
|
|
78
|
-
// src/
|
|
79
|
+
// src/ui/Flow/built-in-edge-types.ts
|
|
79
80
|
var BUILT_IN_EDGE_TYPES = [
|
|
80
81
|
{
|
|
81
82
|
slug: "default",
|
|
82
83
|
name: "Default",
|
|
83
84
|
color: "",
|
|
84
85
|
strokeWidth: 2,
|
|
85
|
-
animated:
|
|
86
|
+
animated: false,
|
|
86
87
|
lineStyle: "default",
|
|
88
|
+
markerStart: "none",
|
|
89
|
+
markerEnd: "arrow",
|
|
87
90
|
fields: []
|
|
88
91
|
}
|
|
89
92
|
];
|
|
90
93
|
|
|
91
|
-
// src/
|
|
94
|
+
// src/ui/Flow/useFlow.ts
|
|
92
95
|
import { useQuery } from "@tanstack/react-query";
|
|
93
96
|
import { useMemo } from "react";
|
|
94
|
-
|
|
95
|
-
function isId(value) {
|
|
96
|
-
return UUID_RE.test(value);
|
|
97
|
-
}
|
|
98
|
-
function apiNodeTypeToNodeTypeDef(doc) {
|
|
97
|
+
function toNodeTypeDef(doc) {
|
|
99
98
|
var _a, _b, _c, _d;
|
|
100
99
|
return {
|
|
101
100
|
slug: String((_a = doc.slug) != null ? _a : ""),
|
|
102
|
-
name: String((_b = doc.
|
|
101
|
+
name: String((_b = doc.title) != null ? _b : ""),
|
|
103
102
|
color: String((_c = doc.color) != null ? _c : "#e5e7eb"),
|
|
104
103
|
defaultSize: (_d = doc.defaultSize) != null ? _d : { width: 200, height: 200 },
|
|
105
104
|
fields: Array.isArray(doc.fields) ? doc.fields : [],
|
|
106
105
|
transparentBackground: Boolean(doc.transparentBackground)
|
|
107
106
|
};
|
|
108
107
|
}
|
|
109
|
-
function
|
|
110
|
-
var _a, _b, _c, _d, _e, _f;
|
|
108
|
+
function toEdgeTypeDef(doc) {
|
|
109
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
111
110
|
return {
|
|
112
111
|
slug: String((_a = doc.slug) != null ? _a : ""),
|
|
113
112
|
name: String((_b = doc.title) != null ? _b : ""),
|
|
114
113
|
color: String((_c = doc.color) != null ? _c : ""),
|
|
115
114
|
strokeWidth: (_d = doc.strokeWidth) != null ? _d : 2,
|
|
116
|
-
animated: (_e = doc.animated) != null ? _e :
|
|
115
|
+
animated: (_e = doc.animated) != null ? _e : false,
|
|
117
116
|
lineStyle: String((_f = doc.lineStyle) != null ? _f : "default"),
|
|
117
|
+
markerStart: String((_g = doc.markerStart) != null ? _g : "none"),
|
|
118
|
+
markerEnd: String((_h = doc.markerEnd) != null ? _h : "arrow"),
|
|
118
119
|
fields: Array.isArray(doc.fields) ? doc.fields : []
|
|
119
120
|
};
|
|
120
121
|
}
|
|
121
|
-
function useFlow(
|
|
122
|
-
var _a, _b;
|
|
123
|
-
const { client, enabled = true } = options;
|
|
124
|
-
const
|
|
122
|
+
function useFlow(options) {
|
|
123
|
+
var _a, _b, _c;
|
|
124
|
+
const { client, slug, id, enabled = true } = options;
|
|
125
|
+
const hasIdentifier = !!(slug || id);
|
|
126
|
+
const identifier = (_a = id != null ? id : slug) != null ? _a : "";
|
|
125
127
|
const flowQuery = useQuery({
|
|
126
|
-
queryKey: ["flows",
|
|
128
|
+
queryKey: ["flows", identifier],
|
|
127
129
|
queryFn: () => __async(null, null, function* () {
|
|
128
|
-
if (
|
|
129
|
-
return client.from("flows").findById(
|
|
130
|
+
if (id) {
|
|
131
|
+
return client.from("flows").findById(id);
|
|
130
132
|
}
|
|
131
133
|
const result = yield client.from("flows").find({
|
|
132
|
-
where: { slug: { equals:
|
|
134
|
+
where: { slug: { equals: slug } },
|
|
133
135
|
limit: 1
|
|
134
136
|
});
|
|
135
137
|
const doc = result.docs[0];
|
|
136
|
-
if (!doc) throw new Error(`Flow not found: ${
|
|
138
|
+
if (!doc) throw new Error(`Flow not found: ${slug}`);
|
|
137
139
|
return doc;
|
|
138
140
|
}),
|
|
139
|
-
enabled
|
|
141
|
+
enabled: enabled && hasIdentifier
|
|
140
142
|
}, client.queryClient);
|
|
141
143
|
const nodeTypesQuery = useQuery({
|
|
142
144
|
queryKey: ["flow-node-types"],
|
|
@@ -156,14 +158,14 @@ function useFlow(slugOrId, options) {
|
|
|
156
158
|
}, client.queryClient);
|
|
157
159
|
const nodeTypeDefs = useMemo(() => {
|
|
158
160
|
var _a2;
|
|
159
|
-
const apiDefs = ((_a2 = nodeTypesQuery.data) != null ? _a2 : []).map(
|
|
161
|
+
const apiDefs = ((_a2 = nodeTypesQuery.data) != null ? _a2 : []).map(toNodeTypeDef);
|
|
160
162
|
const builtInSlugs = new Set(BUILT_IN_NODE_TYPES.map((t) => t.slug));
|
|
161
163
|
const customDefs = apiDefs.filter((d) => !builtInSlugs.has(d.slug));
|
|
162
164
|
return [...BUILT_IN_NODE_TYPES, ...customDefs];
|
|
163
165
|
}, [nodeTypesQuery.data]);
|
|
164
166
|
const edgeTypeDefs = useMemo(() => {
|
|
165
167
|
var _a2;
|
|
166
|
-
const apiDefs = ((_a2 = edgeTypesQuery.data) != null ? _a2 : []).map(
|
|
168
|
+
const apiDefs = ((_a2 = edgeTypesQuery.data) != null ? _a2 : []).map(toEdgeTypeDef);
|
|
167
169
|
const builtInSlugs = new Set(BUILT_IN_EDGE_TYPES.map((t) => t.slug));
|
|
168
170
|
const customDefs = apiDefs.filter((d) => !builtInSlugs.has(d.slug));
|
|
169
171
|
return [...BUILT_IN_EDGE_TYPES, ...customDefs];
|
|
@@ -176,11 +178,11 @@ function useFlow(slugOrId, options) {
|
|
|
176
178
|
edgeTypeDefs,
|
|
177
179
|
flow,
|
|
178
180
|
isLoading: flowQuery.isLoading || nodeTypesQuery.isLoading || edgeTypesQuery.isLoading,
|
|
179
|
-
error: (
|
|
181
|
+
error: (_c = (_b = flowQuery.error) != null ? _b : nodeTypesQuery.error) != null ? _c : edgeTypesQuery.error
|
|
180
182
|
};
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
// src/
|
|
185
|
+
// src/ui/Flow/index.tsx
|
|
184
186
|
function sanitizeUrl(url) {
|
|
185
187
|
if (!url) return url;
|
|
186
188
|
try {
|
|
@@ -191,6 +193,11 @@ function sanitizeUrl(url) {
|
|
|
191
193
|
return void 0;
|
|
192
194
|
}
|
|
193
195
|
}
|
|
196
|
+
function toMarkerType(value) {
|
|
197
|
+
if (value === "arrow") return MarkerType.Arrow;
|
|
198
|
+
if (value === "arrowclosed") return MarkerType.ArrowClosed;
|
|
199
|
+
return void 0;
|
|
200
|
+
}
|
|
194
201
|
function renderFieldValue(key, val, fieldDef) {
|
|
195
202
|
if (val == null || val === "") return null;
|
|
196
203
|
const fieldType = fieldDef == null ? void 0 : fieldDef.fieldType;
|
|
@@ -204,87 +211,58 @@ function renderFieldValue(key, val, fieldDef) {
|
|
|
204
211
|
key,
|
|
205
212
|
src: safeUrl,
|
|
206
213
|
alt: "",
|
|
207
|
-
|
|
214
|
+
draggable: false,
|
|
215
|
+
style: { flex: 1, minHeight: 0, width: "100%", objectFit: "contain" }
|
|
208
216
|
}
|
|
209
217
|
);
|
|
210
218
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
style: { display: "block", marginTop: 4, fontSize: "0.85em", color: "#3b82f6", wordBreak: "break-all" }
|
|
222
|
-
},
|
|
223
|
-
String(val)
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
if (fieldType === "color") {
|
|
227
|
-
return /* @__PURE__ */ React.createElement("div", { key, style: { display: "flex", alignItems: "center", gap: 6, marginTop: 4 } }, /* @__PURE__ */ React.createElement(
|
|
228
|
-
"span",
|
|
229
|
-
{
|
|
230
|
-
style: {
|
|
231
|
-
display: "inline-block",
|
|
232
|
-
width: 14,
|
|
233
|
-
height: 14,
|
|
234
|
-
borderRadius: 3,
|
|
235
|
-
backgroundColor: String(val),
|
|
236
|
-
border: "1px solid rgba(0,0,0,0.1)",
|
|
237
|
-
flexShrink: 0
|
|
238
|
-
}
|
|
219
|
+
return /* @__PURE__ */ React.createElement(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
key,
|
|
223
|
+
style: {
|
|
224
|
+
fontSize: 11,
|
|
225
|
+
whiteSpace: "pre-wrap",
|
|
226
|
+
wordBreak: "break-word",
|
|
227
|
+
overflow: "hidden",
|
|
228
|
+
flexShrink: 0
|
|
239
229
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const isOn = val === true || val === "true";
|
|
244
|
-
return /* @__PURE__ */ React.createElement("p", { key, style: { margin: "4px 0 0", fontSize: "0.85em" } }, isOn ? "On" : "Off");
|
|
245
|
-
}
|
|
246
|
-
return /* @__PURE__ */ React.createElement("p", { key, style: { margin: "4px 0 0", fontSize: "0.85em", whiteSpace: "pre-wrap" } }, String(val));
|
|
230
|
+
},
|
|
231
|
+
String(val)
|
|
232
|
+
);
|
|
247
233
|
}
|
|
248
234
|
function DefaultDynamicNode({ data }) {
|
|
249
235
|
const d = data;
|
|
250
|
-
return /* @__PURE__ */ React.createElement("div", { style: {
|
|
236
|
+
return /* @__PURE__ */ React.createElement("div", { style: { width: "100%", height: "100%", display: "flex", flexDirection: "column" } }, d.fields && Object.entries(d.fields).filter(([, v]) => v != null && v !== "").map(([key, val]) => renderFieldValue(key, val)));
|
|
251
237
|
}
|
|
252
238
|
function EnhancedDynamicNode({ data, typeDef }) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
style: {
|
|
259
|
-
backgroundColor: typeDef.color,
|
|
260
|
-
padding: "4px 12px",
|
|
261
|
-
borderRadius: "6px 6px 0 0",
|
|
262
|
-
fontSize: "0.75em",
|
|
263
|
-
fontWeight: 600,
|
|
264
|
-
color: "rgba(0,0,0,0.6)"
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
typeDef.name
|
|
268
|
-
), /* @__PURE__ */ React.createElement("div", { style: { padding: transparent ? 0 : 12 } }, /* @__PURE__ */ React.createElement("strong", { style: { display: "block", marginBottom: 4 } }, data.label), data.fields && Object.entries(data.fields).map(([key, val]) => {
|
|
269
|
-
const fieldDef = fieldMap.get(key);
|
|
270
|
-
return renderFieldValue(key, val, fieldDef);
|
|
271
|
-
})));
|
|
239
|
+
return /* @__PURE__ */ React.createElement("div", { style: { width: "100%", height: "100%", display: "flex", flexDirection: "column" } }, typeDef.fields.map((f) => {
|
|
240
|
+
const val = data.fields[f.name];
|
|
241
|
+
if (val == null || val === "") return null;
|
|
242
|
+
return renderFieldValue(f.name, val, f);
|
|
243
|
+
}));
|
|
272
244
|
}
|
|
273
245
|
function DefaultFrameNode({ data }) {
|
|
274
|
-
var _a, _b;
|
|
246
|
+
var _a, _b, _c, _d;
|
|
275
247
|
const d = data;
|
|
276
|
-
const
|
|
248
|
+
const baseColor = (_a = d.color) != null ? _a : "rgba(128,128,128,0.15)";
|
|
277
249
|
const padding = (_b = d.padding) != null ? _b : 20;
|
|
250
|
+
const borderStyle = (_c = d.borderStyle) != null ? _c : "dashed";
|
|
251
|
+
const opacity = (_d = d.opacity) != null ? _d : 0.15;
|
|
252
|
+
const bgColor = (() => {
|
|
253
|
+
const m = baseColor.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
254
|
+
if (m) return `rgba(${m[1]},${m[2]},${m[3]},${opacity})`;
|
|
255
|
+
return baseColor;
|
|
256
|
+
})();
|
|
278
257
|
return /* @__PURE__ */ React.createElement(
|
|
279
258
|
"div",
|
|
280
259
|
{
|
|
281
260
|
style: {
|
|
282
|
-
backgroundColor:
|
|
261
|
+
backgroundColor: bgColor,
|
|
283
262
|
padding,
|
|
284
263
|
width: "100%",
|
|
285
264
|
height: "100%",
|
|
286
|
-
|
|
287
|
-
border: "2px dashed rgba(128,128,128,0.3)"
|
|
265
|
+
border: borderStyle === "none" ? "none" : `2px ${borderStyle} rgba(128,128,128,0.3)`
|
|
288
266
|
}
|
|
289
267
|
},
|
|
290
268
|
/* @__PURE__ */ React.createElement(
|
|
@@ -327,40 +305,87 @@ function createNodeTypes(nodeRenderers, nodeTypeDefsMap) {
|
|
|
327
305
|
types.frame = DefaultFrameNode;
|
|
328
306
|
return types;
|
|
329
307
|
}
|
|
308
|
+
var EDGE_TYPE_MAP = {
|
|
309
|
+
step: "step",
|
|
310
|
+
smoothstep: "smoothstep",
|
|
311
|
+
bezier: "default",
|
|
312
|
+
default: "default"
|
|
313
|
+
};
|
|
314
|
+
function applyEdgeStyles(edges, edgeTypeDefsMap) {
|
|
315
|
+
if (!(edgeTypeDefsMap == null ? void 0 : edgeTypeDefsMap.size)) return edges;
|
|
316
|
+
return edges.map((edge) => {
|
|
317
|
+
var _a;
|
|
318
|
+
const slug = edge.edgeTypeSlug;
|
|
319
|
+
if (!slug) return edge;
|
|
320
|
+
const def = edgeTypeDefsMap.get(slug);
|
|
321
|
+
if (!def) return edge;
|
|
322
|
+
const styled = __spreadValues({}, edge);
|
|
323
|
+
if (!styled.type && def.lineStyle) {
|
|
324
|
+
styled.type = (_a = EDGE_TYPE_MAP[def.lineStyle]) != null ? _a : "default";
|
|
325
|
+
}
|
|
326
|
+
styled.style = __spreadValues(__spreadValues(__spreadValues({}, def.color ? { stroke: def.color } : void 0), def.strokeWidth ? { strokeWidth: def.strokeWidth } : void 0), edge.style);
|
|
327
|
+
if (styled.animated == null && def.animated) styled.animated = true;
|
|
328
|
+
if (!styled.markerStart) {
|
|
329
|
+
const startType = toMarkerType(def.markerStart);
|
|
330
|
+
if (startType) {
|
|
331
|
+
styled.markerStart = __spreadValues({ type: startType }, def.color ? { color: def.color } : void 0);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (!styled.markerEnd) {
|
|
335
|
+
const endType = toMarkerType(def.markerEnd);
|
|
336
|
+
if (endType) {
|
|
337
|
+
styled.markerEnd = __spreadValues({ type: endType }, def.color ? { color: def.color } : void 0);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return styled;
|
|
341
|
+
});
|
|
342
|
+
}
|
|
330
343
|
function FlowRenderer({
|
|
331
344
|
data,
|
|
332
345
|
className,
|
|
333
346
|
style,
|
|
334
347
|
nodeRenderers,
|
|
335
348
|
nodeTypeDefs,
|
|
349
|
+
edgeTypeDefs,
|
|
336
350
|
background = true,
|
|
337
351
|
interactive = false,
|
|
338
352
|
fitView = true,
|
|
339
353
|
onNodeClick,
|
|
340
354
|
onEdgeClick
|
|
341
355
|
}) {
|
|
342
|
-
var _a
|
|
356
|
+
var _a;
|
|
343
357
|
const nodeTypeDefsMap = React.useMemo(() => {
|
|
344
358
|
if (!(nodeTypeDefs == null ? void 0 : nodeTypeDefs.length)) return void 0;
|
|
345
359
|
return new Map(nodeTypeDefs.map((d) => [d.slug, d]));
|
|
346
360
|
}, [nodeTypeDefs]);
|
|
361
|
+
const edgeTypeDefsMap = React.useMemo(() => {
|
|
362
|
+
if (!(edgeTypeDefs == null ? void 0 : edgeTypeDefs.length)) return void 0;
|
|
363
|
+
return new Map(edgeTypeDefs.map((d) => [d.slug, d]));
|
|
364
|
+
}, [edgeTypeDefs]);
|
|
347
365
|
const nodeTypes = React.useMemo(
|
|
348
366
|
() => createNodeTypes(nodeRenderers, nodeTypeDefsMap),
|
|
349
367
|
[nodeRenderers, nodeTypeDefsMap]
|
|
350
368
|
);
|
|
369
|
+
const styledEdges = React.useMemo(
|
|
370
|
+
() => {
|
|
371
|
+
var _a2;
|
|
372
|
+
return applyEdgeStyles((_a2 = data == null ? void 0 : data.edges) != null ? _a2 : [], edgeTypeDefsMap);
|
|
373
|
+
},
|
|
374
|
+
[data == null ? void 0 : data.edges, edgeTypeDefsMap]
|
|
375
|
+
);
|
|
351
376
|
if (!data) return null;
|
|
352
377
|
const defaultViewport = !fitView && data.viewport ? data.viewport : void 0;
|
|
353
378
|
return /* @__PURE__ */ React.createElement(ReactFlowProvider, null, /* @__PURE__ */ React.createElement("div", { className, style: __spreadValues({ width: "100%", height: "100%" }, style) }, /* @__PURE__ */ React.createElement(
|
|
354
379
|
ReactFlow,
|
|
355
380
|
{
|
|
356
381
|
nodes: (_a = data.nodes) != null ? _a : [],
|
|
357
|
-
edges:
|
|
382
|
+
edges: styledEdges,
|
|
358
383
|
nodeTypes,
|
|
359
384
|
defaultViewport,
|
|
360
385
|
fitView,
|
|
361
386
|
onNodeClick,
|
|
362
387
|
onEdgeClick,
|
|
363
|
-
nodesDraggable: interactive,
|
|
388
|
+
nodesDraggable: interactive ? void 0 : false,
|
|
364
389
|
nodesConnectable: false,
|
|
365
390
|
elementsSelectable: interactive || !!onNodeClick || !!onEdgeClick,
|
|
366
391
|
panOnDrag: interactive,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ui/Flow/index.tsx","../../src/ui/Flow/types.ts","../../src/ui/Flow/built-in-node-types.ts","../../src/ui/Flow/built-in-edge-types.ts","../../src/ui/Flow/useFlow.ts"],"sourcesContent":["'use client'\n\nimport React from 'react'\nimport {\n ReactFlow,\n ReactFlowProvider,\n Background,\n MarkerType,\n type NodeTypes,\n type NodeProps,\n type Edge,\n} from '@xyflow/react'\nimport type {\n CanvasData,\n DynamicNodeData,\n DynamicNodeSlotProps,\n EdgeTypeDef,\n FlowEdge,\n FlowNode,\n FrameNodeData,\n NodeTypeDef,\n NodeTypeFieldDef,\n} from './types'\n\nexport type {\n CanvasData,\n DynamicNodeSlotProps,\n FlowNode,\n FlowEdge,\n FlowViewport,\n FlowNodePosition,\n FlowNodeData,\n DynamicNodeData,\n FrameNodeData,\n NodeTypeDef,\n NodeTypeFieldDef,\n EdgeTypeDef,\n} from './types'\nexport { isDynamicNode, isFrameNode } from './types'\nexport { BUILT_IN_NODE_TYPES } from './built-in-node-types'\nexport { BUILT_IN_EDGE_TYPES } from './built-in-edge-types'\nexport { useFlow } from './useFlow'\nexport type { SDKClient, UseFlowOptions, UseFlowResult } from './useFlow'\n\n// ── Helpers ──\n\nfunction sanitizeUrl(url: string | undefined): string | undefined {\n if (!url) return url\n try {\n const parsed = new URL(url)\n if (parsed.protocol === 'http:' || parsed.protocol === 'https:') return url\n return undefined\n } catch {\n return undefined\n }\n}\n\nfunction toMarkerType(value: string): MarkerType | undefined {\n if (value === 'arrow') return MarkerType.Arrow\n if (value === 'arrowclosed') return MarkerType.ArrowClosed\n return undefined\n}\n\n// ── Field renderer (type-aware, matching console style) ──\n\nfunction renderFieldValue(\n key: string,\n val: unknown,\n fieldDef?: NodeTypeFieldDef,\n): React.ReactNode {\n if (val == null || val === '') return null\n\n const fieldType = fieldDef?.fieldType\n\n // Image field — image only, no decoration\n if (fieldType === 'image' || (typeof val === 'object' && val !== null && 'url' in val)) {\n const imgUrl = typeof val === 'string' ? val : (val as { url?: string })?.url\n const safeUrl = sanitizeUrl(imgUrl)\n if (!safeUrl) return null\n return (\n <img\n key={key}\n src={safeUrl}\n alt=\"\"\n draggable={false}\n style={{ flex: 1, minHeight: 0, width: '100%', objectFit: 'contain' }}\n />\n )\n }\n\n // All other fields — text only\n return (\n <div\n key={key}\n style={{\n fontSize: 11,\n whiteSpace: 'pre-wrap',\n wordBreak: 'break-word',\n overflow: 'hidden',\n flexShrink: 0,\n }}\n >\n {String(val)}\n </div>\n )\n}\n\n// ── Default dynamic node renderer (no typeDef) ──\n\nfunction DefaultDynamicNode({ data }: NodeProps) {\n const d = data as unknown as DynamicNodeData\n return (\n <div style={{ width: '100%', height: '100%', display: 'flex', flexDirection: 'column' }}>\n {d.fields &&\n Object.entries(d.fields)\n .filter(([, v]) => v != null && v !== '')\n .map(([key, val]) => renderFieldValue(key, val))}\n </div>\n )\n}\n\n// ── Enhanced dynamic node renderer (with NodeTypeDef) ──\n\nfunction EnhancedDynamicNode({ data, typeDef }: { data: DynamicNodeData; typeDef: NodeTypeDef }) {\n return (\n <div style={{ width: '100%', height: '100%', display: 'flex', flexDirection: 'column' }}>\n {typeDef.fields.map((f) => {\n const val = data.fields[f.name]\n if (val == null || val === '') return null\n return renderFieldValue(f.name, val, f)\n })}\n </div>\n )\n}\n\n// ── Default frame node renderer ──\n\nfunction DefaultFrameNode({ data }: NodeProps) {\n const d = data as unknown as FrameNodeData\n const baseColor = d.color ?? 'rgba(128,128,128,0.15)'\n const padding = d.padding ?? 20\n const borderStyle = d.borderStyle ?? 'dashed'\n const opacity = d.opacity ?? 0.15\n\n // Apply opacity to rgba colors\n const bgColor = (() => {\n const m = baseColor.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/)\n if (m) return `rgba(${m[1]},${m[2]},${m[3]},${opacity})`\n return baseColor\n })()\n\n return (\n <div\n style={{\n backgroundColor: bgColor,\n padding,\n width: '100%',\n height: '100%',\n border: borderStyle === 'none' ? 'none' : `2px ${borderStyle} rgba(128,128,128,0.3)`,\n }}\n >\n <div\n style={{\n fontSize: 11,\n fontWeight: 600,\n color: 'rgba(128,128,128,0.6)',\n userSelect: 'none',\n }}\n >\n {d.label}\n </div>\n </div>\n )\n}\n\n// ── Node types builder ──\n\nfunction createNodeTypes(\n nodeRenderers?: Record<string, React.ComponentType<DynamicNodeSlotProps>>,\n nodeTypeDefsMap?: Map<string, NodeTypeDef>,\n): NodeTypes {\n const types: NodeTypes = {} as NodeTypes\n\n // Dynamic node type\n types.dynamic = ((props: NodeProps) => {\n const d = props.data as unknown as DynamicNodeData\n const typeDef = nodeTypeDefsMap?.get(d.nodeTypeSlug)\n const CustomRenderer = nodeRenderers?.[d.nodeTypeSlug]\n if (CustomRenderer) {\n return (\n <CustomRenderer\n id={props.id}\n nodeTypeSlug={d.nodeTypeSlug}\n label={d.label}\n fields={d.fields}\n nodeTypeDef={typeDef}\n />\n )\n }\n if (typeDef) {\n return <EnhancedDynamicNode data={d} typeDef={typeDef} />\n }\n return <DefaultDynamicNode {...props} />\n }) as NodeTypes[string]\n\n // Frame node type\n types.frame = DefaultFrameNode as NodeTypes[string]\n\n return types\n}\n\n// ── Edge style resolver ──\n\nconst EDGE_TYPE_MAP: Record<string, string> = {\n step: 'step',\n smoothstep: 'smoothstep',\n bezier: 'default',\n default: 'default',\n}\n\nfunction applyEdgeStyles(\n edges: FlowEdge[],\n edgeTypeDefsMap?: Map<string, EdgeTypeDef>,\n): Edge[] {\n if (!edgeTypeDefsMap?.size) return edges as unknown as Edge[]\n\n return edges.map((edge) => {\n const slug = edge.edgeTypeSlug\n if (!slug) return edge as unknown as Edge\n\n const def = edgeTypeDefsMap.get(slug)\n if (!def) return edge as unknown as Edge\n\n const styled: Edge = { ...(edge as unknown as Edge) }\n\n // Edge type (line style) — canvas value takes precedence\n if (!styled.type && def.lineStyle) {\n styled.type = EDGE_TYPE_MAP[def.lineStyle] ?? 'default'\n }\n\n // Visual style — canvas style merged with def as fallback\n styled.style = {\n ...(def.color ? { stroke: def.color } : undefined),\n ...(def.strokeWidth ? { strokeWidth: def.strokeWidth } : undefined),\n ...edge.style,\n }\n\n // Animation — canvas value takes precedence\n if (styled.animated == null && def.animated) styled.animated = true\n\n // Markers — canvas value takes precedence over def\n if (!styled.markerStart) {\n const startType = toMarkerType(def.markerStart)\n if (startType) {\n styled.markerStart = { type: startType, ...(def.color ? { color: def.color } : undefined) }\n }\n }\n if (!styled.markerEnd) {\n const endType = toMarkerType(def.markerEnd)\n if (endType) {\n styled.markerEnd = { type: endType, ...(def.color ? { color: def.color } : undefined) }\n }\n }\n\n return styled\n })\n}\n\n// ── FlowRenderer ──\n\n/**\n * Renders a Flow canvas in read-only mode.\n *\n * Requires `@xyflow/react` peer dependency and its CSS:\n * ```ts\n * import '@xyflow/react/dist/style.css'\n * ```\n */\nexport interface FlowRendererProps {\n /** Canvas data from Flow document's `canvas` field */\n data: CanvasData\n /** Container className */\n className?: string\n /** Container style */\n style?: React.CSSProperties\n /** Custom renderers by node type slug (e.g., `{ 'product-card': MyProductCard }`) */\n nodeRenderers?: Record<string, React.ComponentType<DynamicNodeSlotProps>>\n /** Node type definitions for enhanced rendering (field-type-aware display) */\n nodeTypeDefs?: NodeTypeDef[]\n /** Edge type definitions for styled edges (color, stroke, markers, animation) */\n edgeTypeDefs?: EdgeTypeDef[]\n /** Show background pattern (default: true) */\n background?: boolean\n /** Allow user interaction - pan, zoom (default: false for read-only display) */\n interactive?: boolean\n /** Fit view on mount (default: true) */\n fitView?: boolean\n /** Called when a node is clicked */\n onNodeClick?: (event: React.MouseEvent, node: FlowNode) => void\n /** Called when an edge is clicked */\n onEdgeClick?: (event: React.MouseEvent, edge: FlowEdge) => void\n}\n\nexport function FlowRenderer({\n data,\n className,\n style,\n nodeRenderers,\n nodeTypeDefs,\n edgeTypeDefs,\n background = true,\n interactive = false,\n fitView = true,\n onNodeClick,\n onEdgeClick,\n}: FlowRendererProps) {\n const nodeTypeDefsMap = React.useMemo(() => {\n if (!nodeTypeDefs?.length) return undefined\n return new Map(nodeTypeDefs.map((d) => [d.slug, d]))\n }, [nodeTypeDefs])\n\n const edgeTypeDefsMap = React.useMemo(() => {\n if (!edgeTypeDefs?.length) return undefined\n return new Map(edgeTypeDefs.map((d) => [d.slug, d]))\n }, [edgeTypeDefs])\n\n const nodeTypes = React.useMemo(\n () => createNodeTypes(nodeRenderers, nodeTypeDefsMap),\n [nodeRenderers, nodeTypeDefsMap],\n )\n\n const styledEdges = React.useMemo(\n () => applyEdgeStyles(data?.edges ?? [], edgeTypeDefsMap),\n [data?.edges, edgeTypeDefsMap],\n )\n\n if (!data) return null\n\n const defaultViewport = !fitView && data.viewport ? data.viewport : undefined\n\n return (\n <ReactFlowProvider>\n <div className={className} style={{ width: '100%', height: '100%', ...style }}>\n <ReactFlow\n nodes={(data.nodes ?? []) as unknown as Parameters<typeof ReactFlow>[0]['nodes']}\n edges={styledEdges}\n nodeTypes={nodeTypes}\n defaultViewport={defaultViewport}\n fitView={fitView}\n onNodeClick={onNodeClick as Parameters<typeof ReactFlow>[0]['onNodeClick']}\n onEdgeClick={onEdgeClick as Parameters<typeof ReactFlow>[0]['onEdgeClick']}\n nodesDraggable={interactive ? undefined : false}\n nodesConnectable={false}\n elementsSelectable={interactive || !!onNodeClick || !!onEdgeClick}\n panOnDrag={interactive}\n zoomOnScroll={interactive}\n zoomOnPinch={interactive}\n zoomOnDoubleClick={false}\n >\n {background && <Background />}\n </ReactFlow>\n </div>\n </ReactFlowProvider>\n )\n}\n","import type React from 'react'\n\n// ── Dynamic node data ──\n\nexport interface DynamicNodeData {\n nodeTypeSlug: string\n label: string\n fields: Record<string, unknown>\n}\n\nexport type FlowNodeData = DynamicNodeData & Record<string, unknown>\n\n// ── Canvas types (mirrors @xyflow/react but standalone) ──\n\nexport interface FlowNodePosition {\n x: number\n y: number\n}\n\nexport interface FlowNode {\n id: string\n type?: string\n position: FlowNodePosition\n data: FlowNodeData\n style?: React.CSSProperties\n width?: number\n height?: number\n measured?: { width?: number; height?: number }\n draggable?: boolean\n selectable?: boolean\n [key: string]: unknown\n}\n\nexport interface FlowEdge {\n id: string\n source: string\n target: string\n sourceHandle?: string | null\n targetHandle?: string | null\n type?: string\n style?: React.CSSProperties\n animated?: boolean\n markerStart?: unknown\n markerEnd?: unknown\n edgeTypeSlug?: string\n fields?: Record<string, unknown>\n [key: string]: unknown\n}\n\nexport interface FlowViewport {\n x: number\n y: number\n zoom: number\n}\n\nexport interface CanvasData {\n nodes: FlowNode[]\n edges: FlowEdge[]\n viewport: FlowViewport\n}\n\n// ── Node type definitions (mirrors console's NodeTypeDef) ──\n\nexport interface NodeTypeFieldDef {\n name: string\n label: string\n fieldType: 'text' | 'textarea' | 'number' | 'url' | 'color' | 'image' | 'select' | 'toggle'\n options?: { label: string; value: string }[]\n defaultValue?: string\n required?: boolean\n}\n\nexport interface NodeTypeDef {\n slug: string\n name: string\n color: string\n defaultSize: { width: number; height: number }\n fields: NodeTypeFieldDef[]\n transparentBackground?: boolean\n}\n\n// ── Edge type definitions (mirrors console's EdgeTypeDef) ──\n\nexport interface EdgeTypeDef {\n slug: string\n name: string\n color: string\n strokeWidth: number\n animated: boolean\n lineStyle: string\n markerStart: string\n markerEnd: string\n fields: NodeTypeFieldDef[]\n}\n\n// ── Type guards ──\n\nexport function isDynamicNode(node: FlowNode): node is FlowNode & { data: DynamicNodeData } {\n return node.type === 'dynamic'\n}\n\nexport function isFrameNode(node: FlowNode): node is FlowNode & { data: FrameNodeData } {\n return node.type === 'frame'\n}\n\n// ── Component slot props ──\n\nexport interface DynamicNodeSlotProps {\n id: string\n nodeTypeSlug: string\n label: string\n fields: Record<string, unknown>\n nodeTypeDef?: NodeTypeDef\n}\n\n// ── Frame node data ──\n\nexport interface FrameNodeData {\n label: string\n color?: string\n padding?: number\n borderStyle?: 'dashed' | 'solid' | 'none'\n opacity?: number\n}\n","import type { NodeTypeDef } from './types'\n\nexport const BUILT_IN_NODE_TYPES: NodeTypeDef[] = [\n {\n slug: 'text',\n name: 'Text',\n color: '#e5e7eb',\n defaultSize: { width: 200, height: 200 },\n fields: [{ name: 'body', label: 'Body', fieldType: 'textarea' }],\n },\n {\n slug: 'image',\n name: 'Image',\n color: '#e5e7eb',\n transparentBackground: true,\n defaultSize: { width: 200, height: 200 },\n fields: [\n { name: 'image', label: 'Image', fieldType: 'image' },\n { name: 'alt', label: 'Alt Text', fieldType: 'text' },\n { name: 'caption', label: 'Caption', fieldType: 'text' },\n ],\n },\n]\n","import type { EdgeTypeDef } from './types'\n\nexport const BUILT_IN_EDGE_TYPES: EdgeTypeDef[] = [\n {\n slug: 'default',\n name: 'Default',\n color: '',\n strokeWidth: 2,\n animated: false,\n lineStyle: 'default',\n markerStart: 'none',\n markerEnd: 'arrow',\n fields: [],\n },\n]\n","'use client'\n\nimport { useQuery, type QueryClient } from '@tanstack/react-query'\nimport { useMemo } from 'react'\nimport type { CanvasData, NodeTypeDef, EdgeTypeDef } from './types'\nimport { BUILT_IN_NODE_TYPES } from './built-in-node-types'\nimport { BUILT_IN_EDGE_TYPES } from './built-in-edge-types'\n\n// ── Client interface ──\n// Structurally compatible with both BrowserClient and ServerClient.\n// Lists only the collections useFlow actually queries so the generic\n// `from<T extends PublicCollection>` on the real clients satisfies this.\n\ntype FlowCollection = 'flows' | 'flow-node-types' | 'flow-edge-types'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFn = (...args: any[]) => any\n\nexport interface SDKClient {\n from(collection: FlowCollection): {\n find: AnyFn\n findById: AnyFn\n }\n queryClient: QueryClient\n}\n\n// ── Options & Result ──\n\nexport interface UseFlowOptions {\n /** SDK client instance (BrowserClient or ServerClient) */\n client: SDKClient\n /** Flow slug (URL-friendly identifier) */\n slug?: string\n /** Flow document ID (UUID) */\n id?: string\n /** Enable/disable data fetching (default: true) */\n enabled?: boolean\n}\n\nexport interface UseFlowResult {\n data: CanvasData | undefined\n nodeTypeDefs: NodeTypeDef[]\n edgeTypeDefs: EdgeTypeDef[]\n flow: Record<string, unknown> | undefined\n isLoading: boolean\n error: Error | null\n}\n\n// ── Helpers ──\n\nfunction toNodeTypeDef(doc: Record<string, unknown>): NodeTypeDef {\n return {\n slug: String(doc.slug ?? ''),\n name: String(doc.title ?? ''),\n color: String(doc.color ?? '#e5e7eb'),\n defaultSize: (doc.defaultSize as NodeTypeDef['defaultSize']) ?? { width: 200, height: 200 },\n fields: Array.isArray(doc.fields)\n ? (doc.fields as NodeTypeDef['fields'])\n : [],\n transparentBackground: Boolean(doc.transparentBackground),\n }\n}\n\nfunction toEdgeTypeDef(doc: Record<string, unknown>): EdgeTypeDef {\n return {\n slug: String(doc.slug ?? ''),\n name: String(doc.title ?? ''),\n color: String(doc.color ?? ''),\n strokeWidth: (doc.strokeWidth as number) ?? 2,\n animated: (doc.animated as boolean) ?? false,\n lineStyle: String(doc.lineStyle ?? 'default'),\n markerStart: String(doc.markerStart ?? 'none'),\n markerEnd: String(doc.markerEnd ?? 'arrow'),\n fields: Array.isArray(doc.fields)\n ? (doc.fields as EdgeTypeDef['fields'])\n : [],\n }\n}\n\n// ── Hook ──\n\nexport function useFlow(options: UseFlowOptions): UseFlowResult {\n const { client, slug, id, enabled = true } = options\n const hasIdentifier = !!(slug || id)\n const identifier = (id ?? slug) ?? ''\n\n // Fetch flow document\n const flowQuery = useQuery<Record<string, unknown>>({\n queryKey: ['flows', identifier],\n queryFn: async () => {\n if (id) {\n return client.from('flows').findById(id)\n }\n const result = await client.from('flows').find({\n where: { slug: { equals: slug } },\n limit: 1,\n })\n const doc = result.docs[0]\n if (!doc) throw new Error(`Flow not found: ${slug}`)\n return doc\n },\n enabled: enabled && hasIdentifier,\n }, client.queryClient)\n\n // Fetch tenant's custom node types\n const nodeTypesQuery = useQuery<Record<string, unknown>[]>({\n queryKey: ['flow-node-types'],\n queryFn: async () => {\n const result = await client.from('flow-node-types').find({ limit: 100 })\n return result.docs\n },\n enabled,\n }, client.queryClient)\n\n // Fetch tenant's custom edge types\n const edgeTypesQuery = useQuery<Record<string, unknown>[]>({\n queryKey: ['flow-edge-types'],\n queryFn: async () => {\n const result = await client.from('flow-edge-types').find({ limit: 100 })\n return result.docs\n },\n enabled,\n }, client.queryClient)\n\n // Merge built-in + API node types\n const nodeTypeDefs = useMemo<NodeTypeDef[]>(() => {\n const apiDefs = (nodeTypesQuery.data ?? []).map(toNodeTypeDef)\n const builtInSlugs = new Set(BUILT_IN_NODE_TYPES.map((t) => t.slug))\n const customDefs = apiDefs.filter((d) => !builtInSlugs.has(d.slug))\n return [...BUILT_IN_NODE_TYPES, ...customDefs]\n }, [nodeTypesQuery.data])\n\n // Merge built-in + API edge types\n const edgeTypeDefs = useMemo<EdgeTypeDef[]>(() => {\n const apiDefs = (edgeTypesQuery.data ?? []).map(toEdgeTypeDef)\n const builtInSlugs = new Set(BUILT_IN_EDGE_TYPES.map((t) => t.slug))\n const customDefs = apiDefs.filter((d) => !builtInSlugs.has(d.slug))\n return [...BUILT_IN_EDGE_TYPES, ...customDefs]\n }, [edgeTypesQuery.data])\n\n const flow = flowQuery.data\n const canvas = flow?.canvas as CanvasData | undefined\n\n return {\n data: canvas,\n nodeTypeDefs,\n edgeTypeDefs,\n flow,\n isLoading: flowQuery.isLoading || nodeTypesQuery.isLoading || edgeTypesQuery.isLoading,\n error: (flowQuery.error as Error | null) ?? (nodeTypes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