@flowdrop/flowdrop 2.0.0-beta.2 → 2.0.0-beta.4

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 (113) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/MIGRATION-2.0.md +13 -0
  3. package/README.md +5 -5
  4. package/dist/components/App.svelte +36 -191
  5. package/dist/components/App.svelte.d.ts +2 -7
  6. package/dist/components/Button.stories.svelte +65 -0
  7. package/dist/components/Button.stories.svelte.d.ts +19 -0
  8. package/dist/components/Button.svelte +62 -0
  9. package/dist/components/Button.svelte.d.ts +24 -0
  10. package/dist/components/CanvasIconButton.svelte +76 -0
  11. package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
  12. package/dist/components/ConfigForm.svelte +4 -23
  13. package/dist/components/ConfigPanel.svelte +4 -3
  14. package/dist/components/EditorStatusBar.stories.svelte +44 -0
  15. package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
  16. package/dist/components/EditorStatusBar.svelte +99 -0
  17. package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
  18. package/dist/components/IconButton.svelte +80 -0
  19. package/dist/components/IconButton.svelte.d.ts +30 -0
  20. package/dist/components/Input.svelte +74 -0
  21. package/dist/components/Input.svelte.d.ts +17 -0
  22. package/dist/components/LogoWordmark.svelte +113 -0
  23. package/dist/components/LogoWordmark.svelte.d.ts +26 -0
  24. package/dist/components/Navbar.svelte +17 -63
  25. package/dist/components/Navbar.svelte.d.ts +3 -0
  26. package/dist/components/NodeSidebar.svelte +17 -122
  27. package/dist/components/NodeSwapPicker.svelte +10 -28
  28. package/dist/components/PortMappingRow.svelte +0 -2
  29. package/dist/components/SchemaForm.svelte +0 -12
  30. package/dist/components/Select.svelte +53 -0
  31. package/dist/components/Select.svelte.d.ts +15 -0
  32. package/dist/components/SettingsModal.svelte +0 -5
  33. package/dist/components/SettingsPanel.svelte +2 -6
  34. package/dist/components/Textarea.svelte +39 -0
  35. package/dist/components/Textarea.svelte.d.ts +12 -0
  36. package/dist/components/ThemeToggle.svelte +15 -94
  37. package/dist/components/UniversalNode.svelte +32 -1
  38. package/dist/components/WorkflowEditor.svelte +62 -51
  39. package/dist/components/WorkflowEditor.svelte.d.ts +18 -0
  40. package/dist/components/chat/AIChatPanel.svelte +1 -1
  41. package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
  42. package/dist/components/console/ConsoleOutput.svelte +2 -2
  43. package/dist/components/form/FormArray.svelte +37 -173
  44. package/dist/components/form/FormAutocomplete.svelte +10 -6
  45. package/dist/components/form/FormCheckboxGroup.svelte +1 -5
  46. package/dist/components/form/FormCodeEditor.svelte +9 -7
  47. package/dist/components/form/FormField.svelte +5 -44
  48. package/dist/components/form/FormFieldLight.svelte +8 -47
  49. package/dist/components/form/FormFieldset.svelte +1 -1
  50. package/dist/components/form/FormMarkdownEditor.svelte +8 -5
  51. package/dist/components/form/FormNumberField.svelte +4 -36
  52. package/dist/components/form/FormRangeField.svelte +18 -27
  53. package/dist/components/form/FormSelect.svelte +13 -75
  54. package/dist/components/form/FormTemplateEditor.svelte +6 -4
  55. package/dist/components/form/FormTextField.svelte +3 -35
  56. package/dist/components/form/FormTextarea.svelte +4 -39
  57. package/dist/components/form/FormToggle.svelte +0 -4
  58. package/dist/components/form/resolveFieldType.d.ts +24 -0
  59. package/dist/components/form/resolveFieldType.js +55 -0
  60. package/dist/components/icons/CloseIcon.svelte +6 -0
  61. package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
  62. package/dist/components/icons/CommandLineIcon.svelte +15 -0
  63. package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
  64. package/dist/components/icons/MenuIcon.svelte +4 -0
  65. package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
  66. package/dist/components/icons/MenuOpenIcon.svelte +6 -0
  67. package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
  68. package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
  69. package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
  70. package/dist/components/interrupt/InterruptBubble.svelte +0 -10
  71. package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
  72. package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
  73. package/dist/components/layouts/MainLayout.svelte +4 -5
  74. package/dist/components/nodes/AtomNode.svelte +46 -34
  75. package/dist/components/nodes/GatewayNode.svelte +91 -99
  76. package/dist/components/nodes/IdeaNode.svelte +62 -90
  77. package/dist/components/nodes/NodeConfigButton.svelte +86 -0
  78. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
  79. package/dist/components/nodes/NotesNode.svelte +70 -81
  80. package/dist/components/nodes/SimpleNode.svelte +28 -78
  81. package/dist/components/nodes/SquareNode.svelte +79 -109
  82. package/dist/components/nodes/TerminalNode.svelte +28 -86
  83. package/dist/components/nodes/ToolNode.svelte +82 -95
  84. package/dist/components/nodes/WorkflowNode.svelte +91 -100
  85. package/dist/components/playground/ChatInput.svelte +0 -1
  86. package/dist/components/playground/InputCollector.svelte +11 -48
  87. package/dist/components/playground/PlaygroundApp.svelte +1 -1
  88. package/dist/components/playground/PlaygroundStudio.svelte +0 -5
  89. package/dist/messages/index.d.ts +1 -1
  90. package/dist/messages/index.js +1 -1
  91. package/dist/openapi/v1/openapi.yaml +2 -2
  92. package/dist/playground/mount.d.ts +9 -5
  93. package/dist/playground/mount.js +9 -5
  94. package/dist/skins/drafter.d.ts +30 -0
  95. package/dist/skins/drafter.js +198 -0
  96. package/dist/skins/index.d.ts +2 -1
  97. package/dist/skins/index.js +4 -2
  98. package/dist/styles/base.css +285 -14
  99. package/dist/styles/tokens.css +60 -2
  100. package/dist/svelte-app.d.ts +6 -0
  101. package/dist/svelte-app.js +71 -109
  102. package/dist/themes/drafter.d.ts +2 -0
  103. package/dist/themes/drafter.js +15 -0
  104. package/dist/themes/index.d.ts +2 -1
  105. package/dist/themes/index.js +8 -2
  106. package/dist/types/events.d.ts +18 -0
  107. package/dist/types/events.js +2 -1
  108. package/dist/types/settings.d.ts +1 -1
  109. package/dist/types/settings.js +1 -1
  110. package/dist/types/skin.d.ts +1 -1
  111. package/dist/types/theme.d.ts +16 -2
  112. package/dist/utils/connections.js +14 -50
  113. package/package.json +1 -1
@@ -0,0 +1,15 @@
1
+ import { drafterSkin } from '../skins/drafter.js';
2
+ export const drafterTheme = {
3
+ name: 'drafter',
4
+ skin: drafterSkin,
5
+ config: {
6
+ sidebar: {
7
+ defaultOpen: true,
8
+ categoriesDefaultOpen: false
9
+ },
10
+ // Blueprint square line grid (any theme can opt into a grid variant here)
11
+ canvas: {
12
+ grid: 'lines'
13
+ }
14
+ }
15
+ };
@@ -1,6 +1,7 @@
1
1
  import type { FlowDropTheme, FlowDropThemeName } from '../types/theme.js';
2
2
  import { defaultTheme } from './default.js';
3
3
  import { minimalTheme } from './minimal.js';
4
+ import { drafterTheme } from './drafter.js';
4
5
  /**
5
6
  * Resolve a theme prop to a complete FlowDropTheme object.
6
7
  *
@@ -10,4 +11,4 @@ import { minimalTheme } from './minimal.js';
10
11
  * → minimal theme + { skin.tokens.primary: '#e11d48' }
11
12
  */
12
13
  export declare function resolveTheme(theme: FlowDropTheme | FlowDropThemeName | undefined): FlowDropTheme;
13
- export { defaultTheme, minimalTheme };
14
+ export { defaultTheme, minimalTheme, drafterTheme };
@@ -1,8 +1,10 @@
1
1
  import { defaultTheme } from './default.js';
2
2
  import { minimalTheme } from './minimal.js';
3
+ import { drafterTheme } from './drafter.js';
3
4
  const builtinThemes = {
4
5
  default: defaultTheme,
5
- minimal: minimalTheme
6
+ minimal: minimalTheme,
7
+ drafter: drafterTheme
6
8
  };
7
9
  /**
8
10
  * Resolve a theme prop to a complete FlowDropTheme object.
@@ -35,10 +37,14 @@ export function resolveTheme(theme) {
35
37
  sidebar: {
36
38
  ...base.config?.sidebar,
37
39
  ...theme.config?.sidebar
40
+ },
41
+ canvas: {
42
+ ...base.config?.canvas,
43
+ ...theme.config?.canvas
38
44
  }
39
45
  }
40
46
  };
41
47
  }
42
48
  return theme;
43
49
  }
44
- export { defaultTheme, minimalTheme };
50
+ export { defaultTheme, minimalTheme, drafterTheme };
@@ -203,6 +203,24 @@ export interface FlowDropFeatures {
203
203
  * @default true
204
204
  */
205
205
  enableNodeSwap?: boolean;
206
+ /**
207
+ * Register the built-in heavy form editors (markdown / code / template).
208
+ *
209
+ * The full editor is batteries-included: node config fields with
210
+ * `format: 'markdown'` / `'code'` / `'template'` render real CodeMirror
211
+ * editors out of the box. Their chunks are code-split and load lazily, so
212
+ * an editor that never opens such a field never downloads CodeMirror/marked.
213
+ *
214
+ * Set to `false` only if you want to strip those editors (e.g. to shave the
215
+ * lazy chunks) and either live with the textarea fallback or register your
216
+ * own field components via `instance.fields.register(...)`.
217
+ *
218
+ * This does not affect the standalone `@flowdrop/flowdrop/form` primitive,
219
+ * which stays opt-in regardless.
220
+ *
221
+ * @default true
222
+ */
223
+ builtinEditors?: boolean;
206
224
  }
207
225
  /**
208
226
  * Default feature values
@@ -15,7 +15,8 @@ export const DEFAULT_FEATURES = {
15
15
  autoSaveDraft: true,
16
16
  autoSaveDraftInterval: 30000,
17
17
  showToasts: true,
18
- enableNodeSwap: true
18
+ enableNodeSwap: true,
19
+ builtinEditors: true
19
20
  };
20
21
  /**
21
22
  * Merge user-provided features with defaults
@@ -56,7 +56,7 @@ export interface UISettings {
56
56
  /** Enable compact mode for denser UI */
57
57
  compactMode: boolean;
58
58
  /** Active theme name — overridden by the theme prop when explicitly provided */
59
- theme: 'default' | 'minimal';
59
+ theme: 'default' | 'minimal' | 'drafter';
60
60
  /** Whether the command console panel is open */
61
61
  consoleOpen: boolean;
62
62
  /** Height of the command console panel in pixels */
@@ -37,7 +37,7 @@ export const SETTINGS_CATEGORY_ICONS = {
37
37
  * Default theme settings
38
38
  */
39
39
  export const DEFAULT_THEME_SETTINGS = {
40
- preference: 'dark'
40
+ preference: 'light'
41
41
  };
42
42
  /**
43
43
  * Default editor settings
@@ -28,4 +28,4 @@ export interface FlowDropSkin {
28
28
  /** CSS token overrides injected as [data-theme='dark'] rules — active in dark mode only */
29
29
  darkTokens?: FlowDropSkinTokens;
30
30
  }
31
- export type FlowDropSkinName = 'default' | 'slate';
31
+ export type FlowDropSkinName = 'default' | 'slate' | 'drafter';
@@ -1,4 +1,14 @@
1
1
  import type { FlowDropSkin } from './skin.js';
2
+ /**
3
+ * Canvas background grid pattern. Mirrors xyflow's BackgroundVariant values:
4
+ * 'dots' — a square grid of dots (the default)
5
+ * 'lines' — a square grid of solid lines (a "blueprint" / drafter look)
6
+ * 'cross' — small plus-marks at each grid intersection
7
+ *
8
+ * The grid's color is driven separately by the `--fd-grid-pattern-color` token,
9
+ * so any skin can recolor whichever variant a theme chooses.
10
+ */
11
+ export type FlowDropGridVariant = 'dots' | 'lines' | 'cross';
2
12
  /**
3
13
  * Behavioral configuration bundled with a theme.
4
14
  * These are initial-state flags, not CSS — they control runtime defaults.
@@ -10,11 +20,15 @@ export interface FlowDropThemeConfig {
10
20
  /** Whether category <details> accordion sections start open in card mode. Defaults to false. */
11
21
  categoriesDefaultOpen?: boolean;
12
22
  };
23
+ canvas?: {
24
+ /** Background grid pattern applied when this theme is selected. Defaults to 'dots'. */
25
+ grid?: FlowDropGridVariant;
26
+ };
13
27
  }
14
28
  /**
15
29
  * A FlowDrop theme bundles a visual skin (CSS tokens) with UI config (behavioral defaults).
16
30
  *
17
- * Built-in themes: 'default' | 'minimal'
31
+ * Built-in themes: 'default' | 'minimal' | 'drafter'
18
32
  *
19
33
  * @example
20
34
  * // Use a built-in theme by name
@@ -32,4 +46,4 @@ export interface FlowDropTheme {
32
46
  /** Behavioral configuration defaults */
33
47
  config?: FlowDropThemeConfig;
34
48
  }
35
- export type FlowDropThemeName = 'default' | 'minimal';
49
+ export type FlowDropThemeName = 'default' | 'minimal' | 'drafter';
@@ -253,8 +253,17 @@ export function getConnectionSuggestions(checker, nodeId, nodes, nodeTypes) {
253
253
  * @returns True if any cycle exists in the workflow
254
254
  */
255
255
  export function hasCycles(nodes, edges) {
256
- // Build adjacency map once (O(E)) so the DFS inner loop is O(1) per lookup
257
- // instead of scanning all edges on every recursive call (which was O(V*E)).
256
+ return detectCycles(nodes, edges);
257
+ }
258
+ /**
259
+ * Detect whether a directed graph contains a cycle, using DFS over a pre-built
260
+ * adjacency map (O(E) build, O(1) per neighbour lookup — avoids the O(V*E) of
261
+ * re-scanning every edge on each recursive call).
262
+ *
263
+ * Shared by `hasCycles` (all edges) and `hasInvalidCycles` (loopback edges
264
+ * pre-filtered out by the caller).
265
+ */
266
+ function detectCycles(nodes, edges) {
258
267
  const adjacencyMap = new Map();
259
268
  for (const node of nodes) {
260
269
  adjacencyMap.set(node.id, []);
@@ -274,7 +283,6 @@ export function hasCycles(nodes, edges) {
274
283
  return false;
275
284
  visited.add(nodeId);
276
285
  recursionStack.add(nodeId);
277
- // Use pre-built adjacency map instead of filtering all edges each call
278
286
  const neighbors = adjacencyMap.get(nodeId) || [];
279
287
  for (const target of neighbors) {
280
288
  if (hasCycleUtil(target))
@@ -283,7 +291,6 @@ export function hasCycles(nodes, edges) {
283
291
  recursionStack.delete(nodeId);
284
292
  return false;
285
293
  }
286
- // Check each node
287
294
  for (const node of nodes) {
288
295
  if (!visited.has(node.id)) {
289
296
  if (hasCycleUtil(node.id))
@@ -309,53 +316,10 @@ export function hasCycles(nodes, edges) {
309
316
  * ```
310
317
  */
311
318
  export function hasInvalidCycles(nodes, edges) {
312
- // Filter out loopback edges - these create valid cycles for loop iteration
319
+ // Filter out loopback edges - these create valid cycles for loop iteration,
320
+ // then reuse the shared detector over the remaining edges.
313
321
  const nonLoopbackEdges = edges.filter((edge) => !isLoopbackEdge(edge));
314
- // Build adjacency map from non-loopback edges once (O(E)) so the DFS inner
315
- // loop is O(1) per lookup instead of scanning all edges on every recursive
316
- // call (which was O(V*E)).
317
- const adjacencyMap = new Map();
318
- for (const node of nodes) {
319
- adjacencyMap.set(node.id, []);
320
- }
321
- for (const edge of nonLoopbackEdges) {
322
- const neighbors = adjacencyMap.get(edge.source);
323
- if (neighbors) {
324
- neighbors.push(edge.target);
325
- }
326
- }
327
- // Check for cycles using only non-loopback edges
328
- const visited = new Set();
329
- const recursionStack = new Set();
330
- /**
331
- * DFS utility to detect cycles in the graph
332
- * @param nodeId - Current node being visited
333
- * @returns True if a cycle is found from this node
334
- */
335
- function hasCycleUtil(nodeId) {
336
- if (recursionStack.has(nodeId))
337
- return true;
338
- if (visited.has(nodeId))
339
- return false;
340
- visited.add(nodeId);
341
- recursionStack.add(nodeId);
342
- // Use pre-built adjacency map instead of filtering all edges each call
343
- const neighbors = adjacencyMap.get(nodeId) || [];
344
- for (const target of neighbors) {
345
- if (hasCycleUtil(target))
346
- return true;
347
- }
348
- recursionStack.delete(nodeId);
349
- return false;
350
- }
351
- // Check each node for cycles
352
- for (const node of nodes) {
353
- if (!visited.has(node.id)) {
354
- if (hasCycleUtil(node.id))
355
- return true;
356
- }
357
- }
358
- return false;
322
+ return detectCycles(nodes, nonLoopbackEdges);
359
323
  }
360
324
  /**
361
325
  * Get the execution order for a workflow (topological sort)
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
4
4
  "license": "MIT",
5
5
  "private": false,
6
- "version": "2.0.0-beta.2",
6
+ "version": "2.0.0-beta.4",
7
7
  "author": "Shibin Das (D34dMan)",
8
8
  "bugs": {
9
9
  "url": "https://github.com/flowdrop-io/flowdrop/issues"