@01.software/sdk 0.6.0 → 0.7.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.
Files changed (44) hide show
  1. package/README.md +2 -2
  2. package/dist/auth.d.cts +1 -1
  3. package/dist/auth.d.ts +1 -1
  4. package/dist/{const-DQZQAXex.d.cts → const-B8iE-mDN.d.cts} +2 -2
  5. package/dist/{const-Bk3-zigV.d.ts → const-Chw71pKS.d.ts} +2 -2
  6. package/dist/index.cjs +9 -9
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +8 -8
  9. package/dist/index.d.ts +8 -8
  10. package/dist/index.js +9 -9
  11. package/dist/index.js.map +1 -1
  12. package/dist/{payload-types-DCVm1syH.d.cts → payload-types-Cp10MoF6.d.cts} +53 -48
  13. package/dist/{payload-types-DCVm1syH.d.ts → payload-types-Cp10MoF6.d.ts} +53 -48
  14. package/dist/realtime.d.cts +2 -2
  15. package/dist/realtime.d.ts +2 -2
  16. package/dist/{server-StNHlSjW.d.cts → server-DxhuG-_s.d.cts} +34 -34
  17. package/dist/{server-StNHlSjW.d.ts → server-DxhuG-_s.d.ts} +34 -34
  18. package/dist/ui/{flow → canvas}/server.cjs +20 -20
  19. package/dist/ui/canvas/server.cjs.map +1 -0
  20. package/dist/ui/canvas/server.d.cts +3 -0
  21. package/dist/ui/canvas/server.d.ts +3 -0
  22. package/dist/ui/{flow → canvas}/server.js +19 -19
  23. package/dist/ui/canvas/server.js.map +1 -0
  24. package/dist/ui/{flow.cjs → canvas.cjs} +63 -63
  25. package/dist/ui/canvas.cjs.map +1 -0
  26. package/dist/ui/{flow.d.cts → canvas.d.cts} +35 -35
  27. package/dist/ui/{flow.d.ts → canvas.d.ts} +35 -35
  28. package/dist/ui/{flow.js → canvas.js} +59 -59
  29. package/dist/ui/canvas.js.map +1 -0
  30. package/dist/ui/form.d.cts +1 -1
  31. package/dist/ui/form.d.ts +1 -1
  32. package/dist/ui/video.d.cts +1 -1
  33. package/dist/ui/video.d.ts +1 -1
  34. package/dist/{webhook-BTtG_8f2.d.ts → webhook-BKhMTlFN.d.ts} +2 -2
  35. package/dist/{webhook-TDfT7aKA.d.cts → webhook-CiWsseVz.d.cts} +2 -2
  36. package/dist/webhook.d.cts +3 -3
  37. package/dist/webhook.d.ts +3 -3
  38. package/package.json +13 -13
  39. package/dist/ui/flow/server.cjs.map +0 -1
  40. package/dist/ui/flow/server.d.cts +0 -3
  41. package/dist/ui/flow/server.d.ts +0 -3
  42. package/dist/ui/flow/server.js.map +0 -1
  43. package/dist/ui/flow.cjs.map +0 -1
  44. package/dist/ui/flow.js.map +0 -1
@@ -6,16 +6,16 @@ interface DynamicNodeData {
6
6
  label: string;
7
7
  fields: Record<string, unknown>;
8
8
  }
9
- type FlowNodeData = (DynamicNodeData | FrameNodeData) & Record<string, unknown>;
10
- interface FlowNodePosition {
9
+ type CanvasNodeData = (DynamicNodeData | FrameNodeData) & Record<string, unknown>;
10
+ interface CanvasNodePosition {
11
11
  x: number;
12
12
  y: number;
13
13
  }
14
- interface FlowNode {
14
+ interface CanvasNode {
15
15
  id: string;
16
16
  type?: string;
17
- position: FlowNodePosition;
18
- data: FlowNodeData;
17
+ position: CanvasNodePosition;
18
+ data: CanvasNodeData;
19
19
  parentId?: string;
20
20
  style?: React.CSSProperties;
21
21
  width?: number;
@@ -28,7 +28,7 @@ interface FlowNode {
28
28
  selectable?: boolean;
29
29
  [key: string]: unknown;
30
30
  }
31
- interface FlowEdge {
31
+ interface CanvasEdge {
32
32
  id: string;
33
33
  source: string;
34
34
  target: string;
@@ -43,15 +43,15 @@ interface FlowEdge {
43
43
  fields?: Record<string, unknown>;
44
44
  [key: string]: unknown;
45
45
  }
46
- interface FlowViewport {
46
+ interface CanvasViewport {
47
47
  x: number;
48
48
  y: number;
49
49
  zoom: number;
50
50
  }
51
51
  interface CanvasData {
52
- nodes: FlowNode[];
53
- edges: FlowEdge[];
54
- viewport: FlowViewport;
52
+ nodes: CanvasNode[];
53
+ edges: CanvasEdge[];
54
+ viewport: CanvasViewport;
55
55
  }
56
56
  interface NodeTypeFieldDef {
57
57
  name: string;
@@ -88,10 +88,10 @@ interface EdgeTypeDef {
88
88
  markerEnd: string;
89
89
  fields: NodeTypeFieldDef[];
90
90
  }
91
- declare function isDynamicNode(node: FlowNode): node is FlowNode & {
91
+ declare function isDynamicNode(node: CanvasNode): node is CanvasNode & {
92
92
  data: DynamicNodeData;
93
93
  };
94
- declare function isFrameNode(node: FlowNode): node is FlowNode & {
94
+ declare function isFrameNode(node: CanvasNode): node is CanvasNode & {
95
95
  data: FrameNodeData;
96
96
  };
97
97
  interface DynamicNodeSlotProps {
@@ -145,7 +145,7 @@ interface NodeWrapperSlotProps {
145
145
  nodeTypeDef?: NodeTypeDef;
146
146
  children: React.ReactNode;
147
147
  }
148
- interface FlowBounds {
148
+ interface CanvasBounds {
149
149
  x: number;
150
150
  y: number;
151
151
  width: number;
@@ -156,78 +156,78 @@ declare const BUILT_IN_NODE_TYPES: NodeTypeDef[];
156
156
 
157
157
  declare const BUILT_IN_EDGE_TYPES: EdgeTypeDef[];
158
158
 
159
- type FlowCollection = 'flows' | 'flow-node-types' | 'flow-edge-types';
159
+ type CanvasCollection = 'canvases' | 'canvas-node-types' | 'canvas-edge-types';
160
160
  type AnyFn = (...args: any[]) => any;
161
161
  interface SDKClient {
162
- from(collection: FlowCollection): {
162
+ from(collection: CanvasCollection): {
163
163
  find: AnyFn;
164
164
  findById: AnyFn;
165
165
  };
166
166
  queryClient: QueryClient;
167
167
  }
168
- interface UseFlowOptions {
168
+ interface UseCanvasOptions {
169
169
  /** SDK client instance (Client or ServerClient) */
170
170
  client: SDKClient;
171
- /** Flow slug (URL-friendly identifier) */
171
+ /** Canvas slug (URL-friendly identifier) */
172
172
  slug?: string;
173
- /** Flow document ID (UUID) */
173
+ /** Canvas document ID (UUID) */
174
174
  id?: string;
175
175
  /** Enable/disable data fetching (default: true) */
176
176
  enabled?: boolean;
177
177
  }
178
- interface UseFlowResult {
178
+ interface UseCanvasResult {
179
179
  data: CanvasData | undefined;
180
180
  nodeTypeDefs: NodeTypeDef[];
181
181
  edgeTypeDefs: EdgeTypeDef[];
182
- flow: Record<string, unknown> | undefined;
182
+ canvas: Record<string, unknown> | undefined;
183
183
  isLoading: boolean;
184
184
  error: Error | null;
185
185
  }
186
- declare function useFlow(options: UseFlowOptions): UseFlowResult;
186
+ declare function useCanvas(options: UseCanvasOptions): UseCanvasResult;
187
187
 
188
- interface PrefetchFlowOptions {
188
+ interface PrefetchCanvasOptions {
189
189
  /** SDK client instance (Client or ServerClient) */
190
190
  client: SDKClient;
191
- /** Flow slug (URL-friendly identifier) */
191
+ /** Canvas slug (URL-friendly identifier) */
192
192
  slug?: string;
193
- /** Flow document ID (UUID) */
193
+ /** Canvas document ID (UUID) */
194
194
  id?: string;
195
195
  }
196
196
  /**
197
- * Prefetch flow data into the query cache.
197
+ * Prefetch canvas data into the query cache.
198
198
  * Call in route loaders or server components to eliminate loading states on mount.
199
199
  *
200
200
  * ```ts
201
201
  * // React Router loader / Server Component
202
- * await prefetchFlow({ client, slug: 'Home' })
202
+ * await prefetchCanvas({ client, slug: 'Home' })
203
203
  * ```
204
204
  */
205
- declare function prefetchFlow(options: PrefetchFlowOptions): Promise<void>;
205
+ declare function prefetchCanvas(options: PrefetchCanvasOptions): Promise<void>;
206
206
 
207
207
  /**
208
208
  * Calculate bounding box for given node IDs.
209
209
  * Pure function — usable in SSR, server components, or outside React.
210
210
  */
211
- declare function getNodeBounds(nodes: FlowNode[], nodeIds: string[]): FlowBounds | undefined;
211
+ declare function getNodeBounds(nodes: CanvasNode[], nodeIds: string[]): CanvasBounds | undefined;
212
212
  /**
213
213
  * Get all frame nodes with their bounds.
214
214
  * Sorted by position (top-left to bottom-right).
215
215
  */
216
- declare function getFrames(nodes: FlowNode[]): Array<{
216
+ declare function getFrames(nodes: CanvasNode[]): Array<{
217
217
  id: string;
218
218
  label: string;
219
- bounds: FlowBounds;
219
+ bounds: CanvasBounds;
220
220
  }>;
221
221
  /** Result of getFrameData — contains filtered canvas + dual bounds. */
222
222
  interface FrameData {
223
223
  /** Canvas data containing only the frame's descendants (nodes have draggable: false). */
224
224
  data: CanvasData;
225
225
  /** Bounding box of child content nodes — use for initial viewport fit (centering). */
226
- fitBounds: FlowBounds;
226
+ fitBounds: CanvasBounds;
227
227
  /** Bounding box of the frame itself — use for panning/zoom restriction (clamp). */
228
- clampBounds: FlowBounds;
228
+ clampBounds: CanvasBounds;
229
229
  /** @deprecated Use fitBounds instead. Alias for clampBounds for backward compatibility. */
230
- bounds: FlowBounds;
230
+ bounds: CanvasBounds;
231
231
  }
232
232
  /**
233
233
  * Extract a frame's descendants and related edges from canvas data.
@@ -243,4 +243,4 @@ interface FrameData {
243
243
  */
244
244
  declare function getFrameData(data: CanvasData, frameId: string): FrameData | undefined;
245
245
 
246
- export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FlowNode as F, type NodeTypeDef as N, type PrefetchFlowOptions as P, type SDKClient as S, type UseFlowOptions as U, type NodeTypeFieldDef as a, type FlowEdge as b, type FrameNodeSlotProps as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type FlowViewport as f, type FlowBounds as g, type FrameData as h, type FlowNodePosition as i, type FlowNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseFlowResult as p, prefetchFlow as q, getNodeBounds as r, getFrames as s, getFrameData as t, useFlow as u };
246
+ export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FrameNodeSlotProps as F, type NodeTypeDef as N, type PrefetchCanvasOptions as P, type SDKClient as S, type UseCanvasOptions as U, type CanvasNode as a, type NodeTypeFieldDef as b, type CanvasEdge as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type CanvasViewport as f, type CanvasBounds as g, type FrameData as h, type CanvasNodePosition as i, type CanvasNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseCanvasResult as p, prefetchCanvas as q, getNodeBounds as r, getFrames as s, getFrameData as t, useCanvas as u };
@@ -6,16 +6,16 @@ interface DynamicNodeData {
6
6
  label: string;
7
7
  fields: Record<string, unknown>;
8
8
  }
9
- type FlowNodeData = (DynamicNodeData | FrameNodeData) & Record<string, unknown>;
10
- interface FlowNodePosition {
9
+ type CanvasNodeData = (DynamicNodeData | FrameNodeData) & Record<string, unknown>;
10
+ interface CanvasNodePosition {
11
11
  x: number;
12
12
  y: number;
13
13
  }
14
- interface FlowNode {
14
+ interface CanvasNode {
15
15
  id: string;
16
16
  type?: string;
17
- position: FlowNodePosition;
18
- data: FlowNodeData;
17
+ position: CanvasNodePosition;
18
+ data: CanvasNodeData;
19
19
  parentId?: string;
20
20
  style?: React.CSSProperties;
21
21
  width?: number;
@@ -28,7 +28,7 @@ interface FlowNode {
28
28
  selectable?: boolean;
29
29
  [key: string]: unknown;
30
30
  }
31
- interface FlowEdge {
31
+ interface CanvasEdge {
32
32
  id: string;
33
33
  source: string;
34
34
  target: string;
@@ -43,15 +43,15 @@ interface FlowEdge {
43
43
  fields?: Record<string, unknown>;
44
44
  [key: string]: unknown;
45
45
  }
46
- interface FlowViewport {
46
+ interface CanvasViewport {
47
47
  x: number;
48
48
  y: number;
49
49
  zoom: number;
50
50
  }
51
51
  interface CanvasData {
52
- nodes: FlowNode[];
53
- edges: FlowEdge[];
54
- viewport: FlowViewport;
52
+ nodes: CanvasNode[];
53
+ edges: CanvasEdge[];
54
+ viewport: CanvasViewport;
55
55
  }
56
56
  interface NodeTypeFieldDef {
57
57
  name: string;
@@ -88,10 +88,10 @@ interface EdgeTypeDef {
88
88
  markerEnd: string;
89
89
  fields: NodeTypeFieldDef[];
90
90
  }
91
- declare function isDynamicNode(node: FlowNode): node is FlowNode & {
91
+ declare function isDynamicNode(node: CanvasNode): node is CanvasNode & {
92
92
  data: DynamicNodeData;
93
93
  };
94
- declare function isFrameNode(node: FlowNode): node is FlowNode & {
94
+ declare function isFrameNode(node: CanvasNode): node is CanvasNode & {
95
95
  data: FrameNodeData;
96
96
  };
97
97
  interface DynamicNodeSlotProps {
@@ -145,7 +145,7 @@ interface NodeWrapperSlotProps {
145
145
  nodeTypeDef?: NodeTypeDef;
146
146
  children: React.ReactNode;
147
147
  }
148
- interface FlowBounds {
148
+ interface CanvasBounds {
149
149
  x: number;
150
150
  y: number;
151
151
  width: number;
@@ -156,78 +156,78 @@ declare const BUILT_IN_NODE_TYPES: NodeTypeDef[];
156
156
 
157
157
  declare const BUILT_IN_EDGE_TYPES: EdgeTypeDef[];
158
158
 
159
- type FlowCollection = 'flows' | 'flow-node-types' | 'flow-edge-types';
159
+ type CanvasCollection = 'canvases' | 'canvas-node-types' | 'canvas-edge-types';
160
160
  type AnyFn = (...args: any[]) => any;
161
161
  interface SDKClient {
162
- from(collection: FlowCollection): {
162
+ from(collection: CanvasCollection): {
163
163
  find: AnyFn;
164
164
  findById: AnyFn;
165
165
  };
166
166
  queryClient: QueryClient;
167
167
  }
168
- interface UseFlowOptions {
168
+ interface UseCanvasOptions {
169
169
  /** SDK client instance (Client or ServerClient) */
170
170
  client: SDKClient;
171
- /** Flow slug (URL-friendly identifier) */
171
+ /** Canvas slug (URL-friendly identifier) */
172
172
  slug?: string;
173
- /** Flow document ID (UUID) */
173
+ /** Canvas document ID (UUID) */
174
174
  id?: string;
175
175
  /** Enable/disable data fetching (default: true) */
176
176
  enabled?: boolean;
177
177
  }
178
- interface UseFlowResult {
178
+ interface UseCanvasResult {
179
179
  data: CanvasData | undefined;
180
180
  nodeTypeDefs: NodeTypeDef[];
181
181
  edgeTypeDefs: EdgeTypeDef[];
182
- flow: Record<string, unknown> | undefined;
182
+ canvas: Record<string, unknown> | undefined;
183
183
  isLoading: boolean;
184
184
  error: Error | null;
185
185
  }
186
- declare function useFlow(options: UseFlowOptions): UseFlowResult;
186
+ declare function useCanvas(options: UseCanvasOptions): UseCanvasResult;
187
187
 
188
- interface PrefetchFlowOptions {
188
+ interface PrefetchCanvasOptions {
189
189
  /** SDK client instance (Client or ServerClient) */
190
190
  client: SDKClient;
191
- /** Flow slug (URL-friendly identifier) */
191
+ /** Canvas slug (URL-friendly identifier) */
192
192
  slug?: string;
193
- /** Flow document ID (UUID) */
193
+ /** Canvas document ID (UUID) */
194
194
  id?: string;
195
195
  }
196
196
  /**
197
- * Prefetch flow data into the query cache.
197
+ * Prefetch canvas data into the query cache.
198
198
  * Call in route loaders or server components to eliminate loading states on mount.
199
199
  *
200
200
  * ```ts
201
201
  * // React Router loader / Server Component
202
- * await prefetchFlow({ client, slug: 'Home' })
202
+ * await prefetchCanvas({ client, slug: 'Home' })
203
203
  * ```
204
204
  */
205
- declare function prefetchFlow(options: PrefetchFlowOptions): Promise<void>;
205
+ declare function prefetchCanvas(options: PrefetchCanvasOptions): Promise<void>;
206
206
 
207
207
  /**
208
208
  * Calculate bounding box for given node IDs.
209
209
  * Pure function — usable in SSR, server components, or outside React.
210
210
  */
211
- declare function getNodeBounds(nodes: FlowNode[], nodeIds: string[]): FlowBounds | undefined;
211
+ declare function getNodeBounds(nodes: CanvasNode[], nodeIds: string[]): CanvasBounds | undefined;
212
212
  /**
213
213
  * Get all frame nodes with their bounds.
214
214
  * Sorted by position (top-left to bottom-right).
215
215
  */
216
- declare function getFrames(nodes: FlowNode[]): Array<{
216
+ declare function getFrames(nodes: CanvasNode[]): Array<{
217
217
  id: string;
218
218
  label: string;
219
- bounds: FlowBounds;
219
+ bounds: CanvasBounds;
220
220
  }>;
221
221
  /** Result of getFrameData — contains filtered canvas + dual bounds. */
222
222
  interface FrameData {
223
223
  /** Canvas data containing only the frame's descendants (nodes have draggable: false). */
224
224
  data: CanvasData;
225
225
  /** Bounding box of child content nodes — use for initial viewport fit (centering). */
226
- fitBounds: FlowBounds;
226
+ fitBounds: CanvasBounds;
227
227
  /** Bounding box of the frame itself — use for panning/zoom restriction (clamp). */
228
- clampBounds: FlowBounds;
228
+ clampBounds: CanvasBounds;
229
229
  /** @deprecated Use fitBounds instead. Alias for clampBounds for backward compatibility. */
230
- bounds: FlowBounds;
230
+ bounds: CanvasBounds;
231
231
  }
232
232
  /**
233
233
  * Extract a frame's descendants and related edges from canvas data.
@@ -243,4 +243,4 @@ interface FrameData {
243
243
  */
244
244
  declare function getFrameData(data: CanvasData, frameId: string): FrameData | undefined;
245
245
 
246
- export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FlowNode as F, type NodeTypeDef as N, type PrefetchFlowOptions as P, type SDKClient as S, type UseFlowOptions as U, type NodeTypeFieldDef as a, type FlowEdge as b, type FrameNodeSlotProps as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type FlowViewport as f, type FlowBounds as g, type FrameData as h, type FlowNodePosition as i, type FlowNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseFlowResult as p, prefetchFlow as q, getNodeBounds as r, getFrames as s, getFrameData as t, useFlow as u };
246
+ export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FrameNodeSlotProps as F, type NodeTypeDef as N, type PrefetchCanvasOptions as P, type SDKClient as S, type UseCanvasOptions as U, type CanvasNode as a, type NodeTypeFieldDef as b, type CanvasEdge as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type CanvasViewport as f, type CanvasBounds as g, type FrameData as h, type CanvasNodePosition as i, type CanvasNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseCanvasResult as p, prefetchCanvas as q, getNodeBounds as r, getFrames as s, getFrameData as t, useCanvas as u };
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/ui/Flow/server.ts
20
+ // src/ui/Canvas/server.ts
21
21
  var server_exports = {};
22
22
  __export(server_exports, {
23
23
  BUILT_IN_EDGE_TYPES: () => BUILT_IN_EDGE_TYPES,
@@ -27,7 +27,7 @@ __export(server_exports, {
27
27
  getNodeBounds: () => getNodeBounds,
28
28
  isDynamicNode: () => isDynamicNode,
29
29
  isFrameNode: () => isFrameNode,
30
- prefetchFlow: () => prefetchFlow
30
+ prefetchCanvas: () => prefetchCanvas
31
31
  });
32
32
  module.exports = __toCommonJS(server_exports);
33
33
 
@@ -44,56 +44,56 @@ function collectionKeys(collection) {
44
44
  };
45
45
  }
46
46
 
47
- // src/ui/Flow/query-options.ts
48
- function flowQueryOptions(client, slug, id) {
47
+ // src/ui/Canvas/query-options.ts
48
+ function canvasQueryOptions(client, slug, id) {
49
49
  const identifier = id ?? slug ?? "";
50
50
  return {
51
- queryKey: collectionKeys("flows").detail(identifier),
51
+ queryKey: collectionKeys("canvases").detail(identifier),
52
52
  queryFn: async () => {
53
- if (id) return client.from("flows").findById(id);
54
- const result = await client.from("flows").find({
53
+ if (id) return client.from("canvases").findById(id);
54
+ const result = await client.from("canvases").find({
55
55
  where: { slug: { equals: slug } },
56
56
  limit: 1
57
57
  });
58
58
  const doc = result.docs[0];
59
- if (!doc) throw new Error(`Flow not found: ${slug}`);
59
+ if (!doc) throw new Error(`Canvas not found: ${slug}`);
60
60
  return doc;
61
61
  }
62
62
  };
63
63
  }
64
64
  function nodeTypesQueryOptions(client) {
65
65
  return {
66
- queryKey: collectionKeys("flow-node-types").lists(),
66
+ queryKey: collectionKeys("canvas-node-types").lists(),
67
67
  queryFn: async () => {
68
- const result = await client.from("flow-node-types").find({ limit: 0 });
68
+ const result = await client.from("canvas-node-types").find({ limit: 0 });
69
69
  return result.docs;
70
70
  }
71
71
  };
72
72
  }
73
73
  function edgeTypesQueryOptions(client) {
74
74
  return {
75
- queryKey: collectionKeys("flow-edge-types").lists(),
75
+ queryKey: collectionKeys("canvas-edge-types").lists(),
76
76
  queryFn: async () => {
77
- const result = await client.from("flow-edge-types").find({ limit: 0 });
77
+ const result = await client.from("canvas-edge-types").find({ limit: 0 });
78
78
  return result.docs;
79
79
  }
80
80
  };
81
81
  }
82
82
 
83
- // src/ui/Flow/prefetchFlow.ts
84
- async function prefetchFlow(options) {
83
+ // src/ui/Canvas/prefetchCanvas.ts
84
+ async function prefetchCanvas(options) {
85
85
  const { client, slug, id } = options;
86
86
  if (!slug && !id) {
87
- throw new Error("prefetchFlow requires either slug or id");
87
+ throw new Error("prefetchCanvas requires either slug or id");
88
88
  }
89
89
  await Promise.all([
90
- client.queryClient.prefetchQuery(flowQueryOptions(client, slug, id)),
90
+ client.queryClient.prefetchQuery(canvasQueryOptions(client, slug, id)),
91
91
  client.queryClient.prefetchQuery(nodeTypesQueryOptions(client)),
92
92
  client.queryClient.prefetchQuery(edgeTypesQueryOptions(client))
93
93
  ]);
94
94
  }
95
95
 
96
- // src/ui/Flow/utils.ts
96
+ // src/ui/Canvas/utils.ts
97
97
  function getNodeSize(node) {
98
98
  return {
99
99
  width: node.style?.width ?? node.measured?.width ?? node.width ?? 200,
@@ -210,7 +210,7 @@ function getFrameData(data, frameId) {
210
210
  };
211
211
  }
212
212
 
213
- // src/ui/Flow/types.ts
213
+ // src/ui/Canvas/types.ts
214
214
  function isDynamicNode(node) {
215
215
  return node.type === "dynamic";
216
216
  }
@@ -218,7 +218,7 @@ function isFrameNode(node) {
218
218
  return node.type === "frame";
219
219
  }
220
220
 
221
- // src/ui/Flow/built-in-node-types.ts
221
+ // src/ui/Canvas/built-in-node-types.ts
222
222
  var BUILT_IN_NODE_TYPES = [
223
223
  {
224
224
  slug: "text",
@@ -241,7 +241,7 @@ var BUILT_IN_NODE_TYPES = [
241
241
  }
242
242
  ];
243
243
 
244
- // src/ui/Flow/built-in-edge-types.ts
244
+ // src/ui/Canvas/built-in-edge-types.ts
245
245
  var BUILT_IN_EDGE_TYPES = [
246
246
  {
247
247
  slug: "default",
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/ui/Canvas/server.ts","../../../src/core/query/query-keys.ts","../../../src/ui/Canvas/query-options.ts","../../../src/ui/Canvas/prefetchCanvas.ts","../../../src/ui/Canvas/utils.ts","../../../src/ui/Canvas/types.ts","../../../src/ui/Canvas/built-in-node-types.ts","../../../src/ui/Canvas/built-in-edge-types.ts"],"sourcesContent":["// Server-safe exports (no 'use client' directive).\n// Use `@01.software/sdk/ui/canvas/server` for server components and route loaders.\n\nexport { prefetchCanvas } from './prefetchCanvas'\nexport type { PrefetchCanvasOptions } from './prefetchCanvas'\nexport { getNodeBounds, getFrames, getFrameData } from './utils'\nexport type { FrameData } from './utils'\nexport type {\n CanvasData,\n CanvasNode,\n CanvasEdge,\n CanvasViewport,\n CanvasNodePosition,\n CanvasNodeData,\n DynamicNodeData,\n FrameNodeData,\n CanvasBounds,\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'\n","import type { PublicCollection, ApiQueryOptions } from '../client/types'\n\nexport function collectionKeys<T extends PublicCollection>(collection: T) {\n return {\n all: [collection] as const,\n lists: () => [collection, 'list'] as const,\n list: (options?: ApiQueryOptions) => [collection, 'list', options] as const,\n details: () => [collection, 'detail'] as const,\n detail: (id: string, options?: ApiQueryOptions) =>\n [collection, 'detail', id, options] as const,\n infinites: () => [collection, 'infinite'] as const,\n infinite: (options?: Omit<ApiQueryOptions, 'page'>) =>\n [collection, 'infinite', options] as const,\n }\n}\n\nexport const customerKeys = {\n all: ['customer'] as const,\n me: () => ['customer', 'me'] as const,\n}\n","import { collectionKeys } from '../../core/query/query-keys'\nimport type { SDKClient } from './useCanvas'\n\nexport function canvasQueryOptions(\n client: SDKClient,\n slug?: string,\n id?: string,\n) {\n const identifier = id ?? slug ?? ''\n return {\n queryKey: collectionKeys('canvases').detail(identifier),\n queryFn: async () => {\n if (id) return client.from('canvases').findById(id)\n const result = await client.from('canvases').find({\n where: { slug: { equals: slug } },\n limit: 1,\n })\n const doc = result.docs[0]\n if (!doc) throw new Error(`Canvas not found: ${slug}`)\n return doc\n },\n }\n}\n\nexport function nodeTypesQueryOptions(client: SDKClient) {\n return {\n queryKey: collectionKeys('canvas-node-types').lists(),\n queryFn: async () => {\n // limit: 0 = fetch all documents (Payload CMS convention, disables pagination)\n const result = await client.from('canvas-node-types').find({ limit: 0 })\n return result.docs\n },\n }\n}\n\nexport function edgeTypesQueryOptions(client: SDKClient) {\n return {\n queryKey: collectionKeys('canvas-edge-types').lists(),\n queryFn: async () => {\n const result = await client.from('canvas-edge-types').find({ limit: 0 })\n return result.docs\n },\n }\n}\n","import type { SDKClient } from './useCanvas'\nimport {\n canvasQueryOptions,\n nodeTypesQueryOptions,\n edgeTypesQueryOptions,\n} from './query-options'\n\nexport interface PrefetchCanvasOptions {\n /** SDK client instance (Client or ServerClient) */\n client: SDKClient\n /** Canvas slug (URL-friendly identifier) */\n slug?: string\n /** Canvas document ID (UUID) */\n id?: string\n}\n\n/**\n * Prefetch canvas data into the query cache.\n * Call in route loaders or server components to eliminate loading states on mount.\n *\n * ```ts\n * // React Router loader / Server Component\n * await prefetchCanvas({ client, slug: 'Home' })\n * ```\n */\nexport async function prefetchCanvas(\n options: PrefetchCanvasOptions,\n): Promise<void> {\n const { client, slug, id } = options\n\n if (!slug && !id) {\n throw new Error('prefetchCanvas requires either slug or id')\n }\n\n await Promise.all([\n client.queryClient.prefetchQuery(canvasQueryOptions(client, slug, id)),\n client.queryClient.prefetchQuery(nodeTypesQueryOptions(client)),\n client.queryClient.prefetchQuery(edgeTypesQueryOptions(client)),\n ])\n}\n","import type { CanvasNode, CanvasEdge, CanvasBounds, CanvasData } from './types'\n\n// ── Shared helpers ──\n\nfunction getNodeSize(node: CanvasNode): { width: number; height: number } {\n return {\n width:\n (node.style?.width as number) ??\n node.measured?.width ??\n node.width ??\n 200,\n height:\n (node.style?.height as number) ??\n node.measured?.height ??\n node.height ??\n 200,\n }\n}\n\nfunction getAbsolutePosition(\n node: CanvasNode,\n nodeMap: Map<string, CanvasNode>,\n): { x: number; y: number } {\n let x = node.position.x\n let y = node.position.y\n let current = node\n const visited = new Set<string>([node.id])\n while (current.parentId) {\n const parentId = current.parentId\n if (visited.has(parentId)) break\n const parent = nodeMap.get(parentId)\n if (!parent) break\n visited.add(parent.id)\n x += parent.position.x\n y += parent.position.y\n current = parent\n }\n return { x, y }\n}\n\n/** Collect a node and all its descendants using a pre-built parent→children map (O(N)). */\nfunction collectDescendants(\n nodes: CanvasNode[],\n rootId: string,\n): Set<string> {\n // Build parent → children lookup in O(N)\n const childrenMap = new Map<string, string[]>()\n for (const n of nodes) {\n if (n.parentId) {\n let siblings = childrenMap.get(n.parentId)\n if (!siblings) {\n siblings = []\n childrenMap.set(n.parentId, siblings)\n }\n siblings.push(n.id)\n }\n }\n\n // BFS over children map in O(descendants)\n const result = new Set<string>([rootId])\n const queue = [rootId]\n let i = 0\n while (i < queue.length) {\n const children = childrenMap.get(queue[i++]!)\n if (children) {\n for (const childId of children) {\n if (!result.has(childId)) {\n result.add(childId)\n queue.push(childId)\n }\n }\n }\n }\n return result\n}\n\n// ── Public utilities ──\n\n/**\n * Calculate bounding box for given node IDs.\n * Pure function — usable in SSR, server components, or outside React.\n */\nexport function getNodeBounds(\n nodes: CanvasNode[],\n nodeIds: string[],\n): CanvasBounds | undefined {\n const idSet = new Set(nodeIds)\n const targetNodes = nodes.filter((n) => idSet.has(n.id))\n if (targetNodes.length === 0) return undefined\n\n const nodeMap = new Map(nodes.map((n) => [n.id, n]))\n\n let minX = Infinity\n let minY = Infinity\n let maxX = -Infinity\n let maxY = -Infinity\n\n for (const node of targetNodes) {\n const abs = getAbsolutePosition(node, nodeMap)\n const { width: w, height: h } = getNodeSize(node)\n minX = Math.min(minX, abs.x)\n minY = Math.min(minY, abs.y)\n maxX = Math.max(maxX, abs.x + w)\n maxY = Math.max(maxY, abs.y + h)\n }\n\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\n}\n\n/**\n * Get all frame nodes with their bounds.\n * Sorted by position (top-left to bottom-right).\n */\nexport function getFrames(\n nodes: CanvasNode[],\n): Array<{ id: string; label: string; bounds: CanvasBounds }> {\n const frames = nodes.filter((n) => n.type === 'frame')\n if (frames.length === 0) return []\n\n const nodeMap = new Map(nodes.map((n) => [n.id, n]))\n\n return frames\n .map((f) => {\n const data = f.data as { label?: string }\n const abs = getAbsolutePosition(f, nodeMap)\n const { width: w, height: h } = getNodeSize(f)\n return {\n id: f.id,\n label: data.label ?? '',\n bounds: { x: abs.x, y: abs.y, width: w, height: h },\n }\n })\n .sort((a, b) => a.bounds.y - b.bounds.y || a.bounds.x - b.bounds.x)\n}\n\n/** Result of getFrameData — contains filtered canvas + dual bounds. */\nexport interface FrameData {\n /** Canvas data containing only the frame's descendants (nodes have draggable: false). */\n data: CanvasData\n /** Bounding box of child content nodes — use for initial viewport fit (centering). */\n fitBounds: CanvasBounds\n /** Bounding box of the frame itself — use for panning/zoom restriction (clamp). */\n clampBounds: CanvasBounds\n /** @deprecated Use fitBounds instead. Alias for clampBounds for backward compatibility. */\n bounds: CanvasBounds\n}\n\n/**\n * Extract a frame's descendants and related edges from canvas data.\n * Recursively collects all nested children (supports nested frames).\n * Returns undefined if frameId is not found or is not a frame node.\n *\n * Child nodes are marked `draggable: false` to prevent interfering with canvas panning.\n * The frame node itself is included (use `frameRenderer={() => null}` to hide it).\n *\n * Returns dual bounds:\n * - `fitBounds`: child content bounding box (for centering the viewport)\n * - `clampBounds`: frame area bounding box (for panning restriction)\n */\nexport function getFrameData(\n data: CanvasData,\n frameId: string,\n): FrameData | undefined {\n const frame = data.nodes.find((n) => n.id === frameId)\n if (!frame || frame.type !== 'frame') return undefined\n\n // Recursively collect frame + all descendants\n const descendantIds = collectDescendants(data.nodes, frameId)\n const childNodes = data.nodes\n .filter((n) => descendantIds.has(n.id))\n .map((n) => ({ ...n, draggable: false }))\n\n // Keep only edges where both source and target are within the frame\n const childEdges = data.edges.filter(\n (e: CanvasEdge) => descendantIds.has(e.source) && descendantIds.has(e.target),\n )\n\n // clampBounds: frame's own bounding box (for panning restriction)\n const frameBounds = getNodeBounds(data.nodes, [frameId])\n const { width: w, height: h } = getNodeSize(frame)\n const clampBounds: CanvasBounds = frameBounds ?? {\n x: frame.position.x,\n y: frame.position.y,\n width: w,\n height: h,\n }\n\n // fitBounds: child content bounding box (for centering)\n const contentNodeIds = childNodes\n .filter((n) => n.id !== frameId)\n .map((n) => n.id)\n const contentBounds = contentNodeIds.length > 0\n ? getNodeBounds(data.nodes, contentNodeIds)\n : undefined\n const fitBounds = contentBounds ?? clampBounds\n\n return {\n data: {\n nodes: childNodes,\n edges: childEdges,\n viewport: data.viewport,\n },\n fitBounds,\n clampBounds,\n bounds: clampBounds,\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 CanvasNodeData = (DynamicNodeData | FrameNodeData) &\n Record<string, unknown>\n\n// ── Canvas types (mirrors @xyflow/react but standalone) ──\n\nexport interface CanvasNodePosition {\n x: number\n y: number\n}\n\nexport interface CanvasNode {\n id: string\n type?: string\n position: CanvasNodePosition\n data: CanvasNodeData\n parentId?: string\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 CanvasEdge {\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 CanvasViewport {\n x: number\n y: number\n zoom: number\n}\n\nexport interface CanvasData {\n nodes: CanvasNode[]\n edges: CanvasEdge[]\n viewport: CanvasViewport\n}\n\n// ── Node type definitions (mirrors console's NodeTypeDef) ──\n\nexport interface NodeTypeFieldDef {\n name: string\n label: string\n fieldType:\n | 'text'\n | 'textarea'\n | 'number'\n | 'url'\n | 'color'\n | 'image'\n | 'select'\n | '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 template?: string | null\n customCSS?: string | null\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(\n node: CanvasNode,\n): node is CanvasNode & { data: DynamicNodeData } {\n return node.type === 'dynamic'\n}\n\nexport function isFrameNode(\n node: CanvasNode,\n): node is CanvasNode & { 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 /** Whether this node is currently selected */\n selected?: boolean\n /** Measured node width (undefined before first measurement) */\n width?: number\n /** Measured node height (undefined before first measurement) */\n height?: number\n /** The default rendering (template or field-based). Allows custom renderers to wrap/extend instead of replacing entirely. */\n defaultRender?: React.ReactElement\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\n// S1: Frame renderer slot\nexport interface FrameNodeSlotProps {\n id: string\n label: string\n color?: string\n padding?: number\n borderStyle?: 'dashed' | 'solid' | 'none'\n opacity?: number\n width?: number\n height?: number\n children?: React.ReactNode\n}\n\n// S2: Edge renderer slot\nexport interface EdgeSlotProps {\n id: string\n edgeTypeSlug?: string\n source: string\n target: string\n label?: string\n fields?: Record<string, unknown>\n edgeTypeDef?: EdgeTypeDef\n style?: React.CSSProperties\n}\n\n// S3: Node wrapper slot\nexport interface NodeWrapperSlotProps {\n id: string\n nodeTypeSlug: string\n label: string\n selected?: boolean\n nodeTypeDef?: NodeTypeDef\n children: React.ReactNode\n}\n\n// S8: Viewport focus\nexport interface CanvasBounds {\n x: number\n y: number\n width: number\n height: 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,SAAS,eAA2C,YAAe;AACxE,SAAO;AAAA,IACL,KAAK,CAAC,UAAU;AAAA,IAChB,OAAO,MAAM,CAAC,YAAY,MAAM;AAAA,IAChC,MAAM,CAAC,YAA8B,CAAC,YAAY,QAAQ,OAAO;AAAA,IACjE,SAAS,MAA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,CAAC;AAAA,EACX;AACF;","names":[]}
@@ -0,0 +1,3 @@
1
+ export { o as BUILT_IN_EDGE_TYPES, B as BUILT_IN_NODE_TYPES, g as CanvasBounds, C as CanvasData, c as CanvasEdge, a as CanvasNode, j as CanvasNodeData, i as CanvasNodePosition, f as CanvasViewport, k as DynamicNodeData, E as EdgeTypeDef, h as FrameData, l as FrameNodeData, N as NodeTypeDef, b as NodeTypeFieldDef, P as PrefetchCanvasOptions, t as getFrameData, s as getFrames, r as getNodeBounds, m as isDynamicNode, n as isFrameNode, q as prefetchCanvas } from '../../server-DxhuG-_s.cjs';
2
+ import '@tanstack/react-query';
3
+ import 'react';
@@ -0,0 +1,3 @@
1
+ export { o as BUILT_IN_EDGE_TYPES, B as BUILT_IN_NODE_TYPES, g as CanvasBounds, C as CanvasData, c as CanvasEdge, a as CanvasNode, j as CanvasNodeData, i as CanvasNodePosition, f as CanvasViewport, k as DynamicNodeData, E as EdgeTypeDef, h as FrameData, l as FrameNodeData, N as NodeTypeDef, b as NodeTypeFieldDef, P as PrefetchCanvasOptions, t as getFrameData, s as getFrames, r as getNodeBounds, m as isDynamicNode, n as isFrameNode, q as prefetchCanvas } from '../../server-DxhuG-_s.js';
2
+ import '@tanstack/react-query';
3
+ import 'react';
@@ -11,56 +11,56 @@ function collectionKeys(collection) {
11
11
  };
12
12
  }
13
13
 
14
- // src/ui/Flow/query-options.ts
15
- function flowQueryOptions(client, slug, id) {
14
+ // src/ui/Canvas/query-options.ts
15
+ function canvasQueryOptions(client, slug, id) {
16
16
  const identifier = id ?? slug ?? "";
17
17
  return {
18
- queryKey: collectionKeys("flows").detail(identifier),
18
+ queryKey: collectionKeys("canvases").detail(identifier),
19
19
  queryFn: async () => {
20
- if (id) return client.from("flows").findById(id);
21
- const result = await client.from("flows").find({
20
+ if (id) return client.from("canvases").findById(id);
21
+ const result = await client.from("canvases").find({
22
22
  where: { slug: { equals: slug } },
23
23
  limit: 1
24
24
  });
25
25
  const doc = result.docs[0];
26
- if (!doc) throw new Error(`Flow not found: ${slug}`);
26
+ if (!doc) throw new Error(`Canvas not found: ${slug}`);
27
27
  return doc;
28
28
  }
29
29
  };
30
30
  }
31
31
  function nodeTypesQueryOptions(client) {
32
32
  return {
33
- queryKey: collectionKeys("flow-node-types").lists(),
33
+ queryKey: collectionKeys("canvas-node-types").lists(),
34
34
  queryFn: async () => {
35
- const result = await client.from("flow-node-types").find({ limit: 0 });
35
+ const result = await client.from("canvas-node-types").find({ limit: 0 });
36
36
  return result.docs;
37
37
  }
38
38
  };
39
39
  }
40
40
  function edgeTypesQueryOptions(client) {
41
41
  return {
42
- queryKey: collectionKeys("flow-edge-types").lists(),
42
+ queryKey: collectionKeys("canvas-edge-types").lists(),
43
43
  queryFn: async () => {
44
- const result = await client.from("flow-edge-types").find({ limit: 0 });
44
+ const result = await client.from("canvas-edge-types").find({ limit: 0 });
45
45
  return result.docs;
46
46
  }
47
47
  };
48
48
  }
49
49
 
50
- // src/ui/Flow/prefetchFlow.ts
51
- async function prefetchFlow(options) {
50
+ // src/ui/Canvas/prefetchCanvas.ts
51
+ async function prefetchCanvas(options) {
52
52
  const { client, slug, id } = options;
53
53
  if (!slug && !id) {
54
- throw new Error("prefetchFlow requires either slug or id");
54
+ throw new Error("prefetchCanvas requires either slug or id");
55
55
  }
56
56
  await Promise.all([
57
- client.queryClient.prefetchQuery(flowQueryOptions(client, slug, id)),
57
+ client.queryClient.prefetchQuery(canvasQueryOptions(client, slug, id)),
58
58
  client.queryClient.prefetchQuery(nodeTypesQueryOptions(client)),
59
59
  client.queryClient.prefetchQuery(edgeTypesQueryOptions(client))
60
60
  ]);
61
61
  }
62
62
 
63
- // src/ui/Flow/utils.ts
63
+ // src/ui/Canvas/utils.ts
64
64
  function getNodeSize(node) {
65
65
  return {
66
66
  width: node.style?.width ?? node.measured?.width ?? node.width ?? 200,
@@ -177,7 +177,7 @@ function getFrameData(data, frameId) {
177
177
  };
178
178
  }
179
179
 
180
- // src/ui/Flow/types.ts
180
+ // src/ui/Canvas/types.ts
181
181
  function isDynamicNode(node) {
182
182
  return node.type === "dynamic";
183
183
  }
@@ -185,7 +185,7 @@ function isFrameNode(node) {
185
185
  return node.type === "frame";
186
186
  }
187
187
 
188
- // src/ui/Flow/built-in-node-types.ts
188
+ // src/ui/Canvas/built-in-node-types.ts
189
189
  var BUILT_IN_NODE_TYPES = [
190
190
  {
191
191
  slug: "text",
@@ -208,7 +208,7 @@ var BUILT_IN_NODE_TYPES = [
208
208
  }
209
209
  ];
210
210
 
211
- // src/ui/Flow/built-in-edge-types.ts
211
+ // src/ui/Canvas/built-in-edge-types.ts
212
212
  var BUILT_IN_EDGE_TYPES = [
213
213
  {
214
214
  slug: "default",
@@ -230,6 +230,6 @@ export {
230
230
  getNodeBounds,
231
231
  isDynamicNode,
232
232
  isFrameNode,
233
- prefetchFlow
233
+ prefetchCanvas
234
234
  };
235
235
  //# sourceMappingURL=server.js.map