@flowdrop/flowdrop 2.0.0-beta.1 → 2.0.0-beta.3

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 (149) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/MIGRATION-2.0.md +173 -3
  3. package/dist/api/enhanced-client.js +6 -11
  4. package/dist/components/App.svelte +22 -45
  5. package/dist/components/App.svelte.d.ts +2 -7
  6. package/dist/components/CanvasIconButton.svelte +76 -0
  7. package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
  8. package/dist/components/ConfigForm.svelte +6 -21
  9. package/dist/components/ConfigPanel.svelte +4 -3
  10. package/dist/components/LogoWordmark.svelte +113 -0
  11. package/dist/components/LogoWordmark.svelte.d.ts +26 -0
  12. package/dist/components/Navbar.svelte +8 -59
  13. package/dist/components/NodeSidebar.svelte +4 -11
  14. package/dist/components/NodeSwapPicker.svelte +0 -2
  15. package/dist/components/PipelineStatus.svelte +6 -1
  16. package/dist/components/PipelineStatus.svelte.d.ts +3 -0
  17. package/dist/components/PortMappingRow.svelte +0 -2
  18. package/dist/components/SchemaForm.svelte +4 -14
  19. package/dist/components/SettingsModal.svelte +0 -5
  20. package/dist/components/SettingsPanel.svelte +2 -6
  21. package/dist/components/ThemeToggle.svelte +0 -5
  22. package/dist/components/UniversalNode.svelte +32 -1
  23. package/dist/components/WorkflowEditor.svelte +66 -52
  24. package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
  25. package/dist/components/chat/AIChatPanel.svelte +7 -2
  26. package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
  27. package/dist/components/console/ConsoleOutput.svelte +2 -2
  28. package/dist/components/form/FormArray.svelte +0 -16
  29. package/dist/components/form/FormAutocomplete.svelte +18 -15
  30. package/dist/components/form/FormCheckboxGroup.svelte +0 -4
  31. package/dist/components/form/FormCodeEditor.svelte +9 -7
  32. package/dist/components/form/FormFieldLight.svelte +33 -4
  33. package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
  34. package/dist/components/form/FormMarkdownEditor.svelte +8 -5
  35. package/dist/components/form/FormNumberField.svelte +0 -4
  36. package/dist/components/form/FormRangeField.svelte +1 -20
  37. package/dist/components/form/FormSelect.svelte +10 -6
  38. package/dist/components/form/FormTemplateEditor.svelte +6 -4
  39. package/dist/components/form/FormTextField.svelte +10 -6
  40. package/dist/components/form/FormTextarea.svelte +10 -6
  41. package/dist/components/form/FormToggle.svelte +0 -4
  42. package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
  43. package/dist/components/icons/CommandLineIcon.svelte +15 -0
  44. package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
  45. package/dist/components/icons/MenuIcon.svelte +4 -0
  46. package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
  47. package/dist/components/icons/MenuOpenIcon.svelte +6 -0
  48. package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
  49. package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
  50. package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
  51. package/dist/components/interrupt/InterruptBubble.svelte +11 -12
  52. package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
  53. package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
  54. package/dist/components/layouts/MainLayout.svelte +4 -5
  55. package/dist/components/nodes/AtomNode.svelte +46 -34
  56. package/dist/components/nodes/GatewayNode.svelte +91 -99
  57. package/dist/components/nodes/IdeaNode.svelte +62 -90
  58. package/dist/components/nodes/NodeConfigButton.svelte +86 -0
  59. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
  60. package/dist/components/nodes/NotesNode.svelte +70 -81
  61. package/dist/components/nodes/SimpleNode.svelte +28 -78
  62. package/dist/components/nodes/SquareNode.svelte +79 -109
  63. package/dist/components/nodes/TerminalNode.svelte +28 -86
  64. package/dist/components/nodes/ToolNode.svelte +82 -95
  65. package/dist/components/nodes/WorkflowNode.svelte +91 -100
  66. package/dist/components/playground/ChatInput.svelte +0 -1
  67. package/dist/components/playground/InputCollector.svelte +0 -2
  68. package/dist/components/playground/PipelineKanbanView.svelte +4 -2
  69. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
  70. package/dist/components/playground/PipelinePanel.svelte +20 -3
  71. package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
  72. package/dist/components/playground/PipelineTableView.svelte +4 -2
  73. package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
  74. package/dist/components/playground/Playground.svelte +76 -25
  75. package/dist/components/playground/Playground.svelte.d.ts +3 -0
  76. package/dist/components/playground/PlaygroundApp.svelte +6 -1
  77. package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
  78. package/dist/components/playground/PlaygroundModal.svelte +5 -0
  79. package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
  80. package/dist/components/playground/PlaygroundStudio.svelte +7 -6
  81. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
  82. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
  83. package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
  84. package/dist/config/endpoints.d.ts +23 -0
  85. package/dist/config/endpoints.js +28 -0
  86. package/dist/core/index.d.ts +1 -2
  87. package/dist/core/index.js +2 -6
  88. package/dist/display/index.d.ts +6 -1
  89. package/dist/display/index.js +9 -1
  90. package/dist/editor/index.d.ts +1 -1
  91. package/dist/editor/index.js +1 -1
  92. package/dist/form/full.d.ts +2 -1
  93. package/dist/form/full.js +4 -1
  94. package/dist/form/index.d.ts +0 -1
  95. package/dist/form/index.js +3 -2
  96. package/dist/helpers/workflowEditorHelper.d.ts +4 -2
  97. package/dist/helpers/workflowEditorHelper.js +4 -3
  98. package/dist/playground/index.d.ts +2 -2
  99. package/dist/playground/index.js +2 -2
  100. package/dist/playground/mount.d.ts +19 -5
  101. package/dist/playground/mount.js +16 -8
  102. package/dist/registry/builtinNodeTypes.d.ts +53 -0
  103. package/dist/registry/builtinNodeTypes.js +67 -0
  104. package/dist/registry/builtinNodes.d.ts +2 -39
  105. package/dist/registry/builtinNodes.js +6 -53
  106. package/dist/services/agentSpecExecutionService.d.ts +0 -2
  107. package/dist/services/agentSpecExecutionService.js +0 -2
  108. package/dist/services/apiVariableService.js +12 -26
  109. package/dist/services/categoriesApi.js +3 -6
  110. package/dist/services/chatService.d.ts +4 -3
  111. package/dist/services/chatService.js +13 -18
  112. package/dist/services/interruptService.d.ts +7 -6
  113. package/dist/services/interruptService.js +19 -21
  114. package/dist/services/playgroundService.d.ts +9 -8
  115. package/dist/services/playgroundService.js +23 -25
  116. package/dist/services/portConfigApi.js +3 -6
  117. package/dist/services/settingsService.d.ts +9 -4
  118. package/dist/services/settingsService.js +23 -12
  119. package/dist/skins/drafter.d.ts +30 -0
  120. package/dist/skins/drafter.js +185 -0
  121. package/dist/skins/index.d.ts +2 -1
  122. package/dist/skins/index.js +4 -2
  123. package/dist/stores/apiContext.d.ts +11 -0
  124. package/dist/stores/apiContext.js +15 -0
  125. package/dist/stores/categoriesStore.svelte.js +0 -1
  126. package/dist/stores/playgroundStore.svelte.js +0 -2
  127. package/dist/styles/base.css +38 -9
  128. package/dist/styles/tokens.css +54 -2
  129. package/dist/svelte-app.d.ts +6 -0
  130. package/dist/svelte-app.js +4 -2
  131. package/dist/themes/drafter.d.ts +2 -0
  132. package/dist/themes/drafter.js +15 -0
  133. package/dist/themes/index.d.ts +2 -1
  134. package/dist/themes/index.js +8 -2
  135. package/dist/types/auth.d.ts +9 -51
  136. package/dist/types/auth.js +4 -54
  137. package/dist/types/events.d.ts +18 -0
  138. package/dist/types/events.js +2 -1
  139. package/dist/types/index.d.ts +4 -2
  140. package/dist/types/index.js +0 -1
  141. package/dist/types/settings.d.ts +1 -1
  142. package/dist/types/settings.js +1 -1
  143. package/dist/types/skin.d.ts +1 -1
  144. package/dist/types/theme.d.ts +16 -2
  145. package/dist/utils/edgeStyling.js +9 -5
  146. package/dist/utils/fetchWithAuth.d.ts +36 -15
  147. package/dist/utils/fetchWithAuth.js +53 -23
  148. package/dist/utils/nodeTypes.js +1 -1
  149. package/package.json +2 -1
@@ -8,6 +8,36 @@
8
8
  box-sizing: border-box;
9
9
  }
10
10
 
11
+ /* Drop the UA default margin on paragraphs so block text sits on the grid;
12
+ contexts that want spacing (e.g. .markdown-display p) opt back in. */
13
+ p {
14
+ margin: 0;
15
+ }
16
+
17
+ /* ───────────────────────────────────────────────────────────────────────────
18
+ Standardized focus ring — THE single source of truth.
19
+
20
+ The entire library draws ONE focus ring: a solid outline in --fd-ring, sized
21
+ by --fd-ring-width / --fd-ring-offset. Components must NOT declare their own
22
+ focus rings (no per-element :focus outline/box-shadow). :focus-visible keeps
23
+ it to keyboard navigation; browsers still surface it for text fields on
24
+ click. Scoped to the library roots so it never leaks into the host app.
25
+ ─────────────────────────────────────────────────────────────────────────── */
26
+ .flowdrop-root :focus-visible,
27
+ .svelte-flow :focus-visible {
28
+ outline: var(--fd-ring-width) solid var(--fd-ring);
29
+ outline-offset: var(--fd-ring-offset);
30
+ }
31
+
32
+ /* xyflow hard-disables the node wrapper outline
33
+ (.svelte-flow__node.selectable:focus-visible { outline: none }). That wrapper
34
+ is our single focusable node element, so re-assert the standard ring at
35
+ matching specificity. */
36
+ .svelte-flow .svelte-flow__node.selectable:focus-visible {
37
+ outline: var(--fd-ring-width) solid var(--fd-ring);
38
+ outline-offset: var(--fd-ring-offset);
39
+ }
40
+
11
41
  /* Layout utilities */
12
42
  .flowdrop-layout {
13
43
  display: flex;
@@ -93,9 +123,11 @@
93
123
  background-color: var(--fd-primary);
94
124
  }
95
125
 
126
+ /* Handles are tabindex="-1" (programmatic focus only, so :focus-visible won't
127
+ fire) — keep a :focus ring, but draw it from the same tokens. */
96
128
  .svelte-flow .svelte-flow__handle:focus {
97
- outline: 2px solid var(--fd-ring);
98
- outline-offset: 2px;
129
+ outline: var(--fd-ring-width) solid var(--fd-ring);
130
+ outline-offset: var(--fd-ring-offset);
99
131
  }
100
132
 
101
133
  /* Centralized handle edge positioning — offset derived from --fd-handle-size */
@@ -135,10 +167,7 @@
135
167
  border-color: var(--fd-border);
136
168
  }
137
169
 
138
- .flowdrop-btn:focus {
139
- outline: 2px solid var(--fd-ring);
140
- outline-offset: 2px;
141
- }
170
+ /* Focus ring is centralized (see top of file). */
142
171
 
143
172
  .flowdrop-btn--primary {
144
173
  background-color: var(--fd-primary);
@@ -211,10 +240,9 @@
211
240
  box-shadow var(--fd-transition-normal);
212
241
  }
213
242
 
243
+ /* Active-field hint only; the focus ring itself is centralized (top of file). */
214
244
  .flowdrop-input:focus {
215
- outline: none;
216
- border-color: var(--fd-primary);
217
- box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
245
+ border-color: var(--fd-ring);
218
246
  }
219
247
 
220
248
  .flowdrop-input--sm {
@@ -1092,6 +1120,7 @@
1092
1120
  --fd-notes-node-width: 500px;
1093
1121
  --fd-notes-node-min-width: 250px;
1094
1122
  --fd-notes-node-max-width: 500px;
1123
+ --fd-notes-node-min-height: 200px;
1095
1124
  --fd-notes-node-backdrop-filter: blur(8px);
1096
1125
  }
1097
1126
 
@@ -127,6 +127,13 @@
127
127
  --fd-card: #ffffff; /* @public */
128
128
  --fd-card-foreground: var(--_gray-9); /* @public */
129
129
 
130
+ /* ----- CHROME PANELS (sidebar + config/inspector panel) -----
131
+ Large editor-shell panels read from these so a theme can make them
132
+ glassy/translucent without touching every other surface. Default to the
133
+ opaque app background + no blur, so existing themes are unchanged. */
134
+ --fd-panel-bg: var(--fd-background); /* @public sidebar + config panel surface */
135
+ --fd-panel-backdrop-filter: none; /* @public glass/frost behind translucent panels; e.g. blur(14px) */
136
+
130
137
  /* ----- HEADER (Distinct header styling) ----- */
131
138
  --fd-header: #f5f7fa; /* @public */
132
139
  --fd-header-foreground: var(--_gray-8); /* @public */
@@ -140,10 +147,45 @@
140
147
  --fd-border-muted: var(--_gray-3); /* @public */
141
148
  --fd-border-strong: var(--_gray-5); /* @public */
142
149
  --fd-ring: var(--_blue-2); /* @public */
150
+ /* Focus-ring geometry. The whole library draws ONE focus ring from these
151
+ (see base.css). Color is theme-aware (--fd-ring); width/offset are not, so
152
+ they live only here. */
153
+ --fd-ring-width: 2px; /* @public */
154
+ --fd-ring-offset: 2px; /* @public */
155
+
156
+ /* ----- EDITOR CANVAS & NODE SURFACES -----
157
+ Scoped surfaces for the graph editor, kept separate from the general app
158
+ "chrome" (navbar, sidebars, panels) so a theme can restyle the canvas/nodes
159
+ without tinting the rest of the UI. Each defaults to its chrome equivalent,
160
+ so overriding the base token (e.g. --fd-card) still cascades here. */
161
+ --fd-canvas-bg: var(--fd-background); /* @public editor canvas (grid) background */
162
+ --fd-node-bg: var(--fd-card); /* @public node body surface */
163
+ --fd-node-header-bg: var(--fd-header); /* @public node header surface */
164
+ --fd-node-radius: var(
165
+ --fd-radius-xl
166
+ ); /* @public node card corner radius; lower for sharper corners */
167
+ --fd-node-shadow: var(
168
+ --fd-shadow-md
169
+ ); /* @public node resting elevation; 'none' for a flat look */
170
+ --fd-node-shadow-hover: var(
171
+ --fd-shadow-lg
172
+ ); /* @public node hover/selected elevation; 'none' for a flat look */
173
+ --fd-node-backdrop-filter: none; /* @public glass/frost effect behind translucent node bodies; e.g. blur(10px) */
143
174
 
144
175
  /* ----- NODE BORDERS (Higher contrast for visibility when zoomed out) ----- */
145
176
  --fd-node-border: var(--_gray-5); /* @public */
146
177
  --fd-node-border-hover: var(--_gray-6); /* @public */
178
+ --fd-node-border-width: 1.5px; /* @public node outline thickness; lower for a thinner look */
179
+ /* Note nodes can carry their own outline so themes can read them as
180
+ informational/annotation rather than a process node. Defaults to the
181
+ shared node border so existing themes are unchanged. */
182
+ --fd-note-border: var(--fd-node-border); /* @public notes-node outline */
183
+ --fd-note-border-hover: var(--fd-node-border-hover); /* @public notes-node outline (hover) */
184
+
185
+ /* ----- CANVAS GRID (pattern color for the editor background grid; any theme
186
+ can recolor whichever grid variant it picks via config.canvas.grid).
187
+ Default matches xyflow's dot-grid color so the default theme is unchanged. */
188
+ --fd-grid-pattern-color: #91919a; /* @public */
147
189
 
148
190
  /* ----- PRIMARY (Interactive/Brand) ----- */
149
191
  --fd-primary: var(--_blue-2); /* @public */
@@ -307,6 +349,7 @@
307
349
  --fd-scrollbar-thumb: var(--_gray-4); /* @internal */
308
350
  --fd-scrollbar-thumb-hover: var(--_gray-5); /* @internal */
309
351
  --fd-scrollbar-track: var(--_gray-2); /* @internal */
352
+ --fd-scrollbar-radius: 4px; /* @public scrollbar thumb/track corner radius; 0 for square */
310
353
 
311
354
  /* ----- BACKDROP/OVERLAY ----- */
312
355
  --fd-backdrop: rgba(255, 255, 255, 0.8); /* @internal */
@@ -324,11 +367,17 @@
324
367
 
325
368
  /* ----- NODE LAYOUT (Dimensions and port alignment; multiples of 10 for grid) ----- */
326
369
  --fd-node-grid-step: 10; /* @internal — layout algorithm detail */
327
- --fd-node-default-width: 290px; /* @public */
370
+ --fd-node-default-width: 280px; /* @public */
328
371
  --fd-node-header-height: 60px; /* @public */
329
- --fd-node-header-title-height: 40px; /* @internal */
372
+ --fd-node-header-title-height: 40px; /* @internal — fits icon + up to 2 text lines */
330
373
  --fd-node-header-desc-line: 20px; /* @internal */
331
374
  --fd-node-header-gap: 10px; /* @internal */
375
+ /* Divider absorbed into header bottom padding so header height stays on the
376
+ 20px grid regardless of border thickness. */
377
+ --fd-node-header-divider-width: 1px; /* @public */
378
+ --fd-node-header-divider-color: var(
379
+ --fd-border-muted
380
+ ); /* @public — header bottom divider color */
332
381
  --fd-node-port-row-height: 20px; /* @internal */
333
382
  --fd-node-terminal-size: 80px; /* @public */
334
383
  --fd-node-square-size: 80px; /* @public */
@@ -395,6 +444,9 @@
395
444
  --fd-node-border: #4a4a52;
396
445
  --fd-node-border-hover: #5a5a62;
397
446
 
447
+ /* ----- CANVAS GRID (matches xyflow's dark dot-grid color) ----- */
448
+ --fd-grid-pattern-color: #777;
449
+
398
450
  /* ----- NODE COLORS (port type labels/badges - lighter for readability on dark surfaces) ----- */
399
451
  --fd-node-emerald: #34d399;
400
452
  --fd-node-blue: #60a5fa;
@@ -204,6 +204,12 @@ export declare function mountWorkflowEditor(container: HTMLElement, options?: {
204
204
  authProvider?: AuthProvider;
205
205
  /** Instance identifier — see {@link FlowDropMountOptions.instanceId}. */
206
206
  instanceId?: string;
207
+ /**
208
+ * Register the built-in markdown/code/template editors. Batteries-included
209
+ * by default (chunks load lazily). See {@link FlowDropFeatures.builtinEditors}.
210
+ * @default true
211
+ */
212
+ builtinEditors?: boolean;
207
213
  }): Promise<MountedFlowDropApp>;
208
214
  /**
209
215
  * Unmount a FlowDrop app
@@ -335,7 +335,7 @@ export async function mountFlowDropApp(container, options = {}) {
335
335
  * @returns Promise resolving to a MountedFlowDropApp instance
336
336
  */
337
337
  export async function mountWorkflowEditor(container, options = {}) {
338
- const { workflow, endpointConfig, portConfig, categories, authProvider, instanceId } = options;
338
+ const { workflow, endpointConfig, portConfig, categories, authProvider, instanceId, builtinEditors } = options;
339
339
  // Per-instance state container (see mountFlowDropApp)
340
340
  const { fd, isDefault } = acquireInstance(instanceId);
341
341
  // Create endpoint configuration
@@ -400,7 +400,9 @@ export async function mountWorkflowEditor(container, options = {}) {
400
400
  target: container,
401
401
  props: {
402
402
  instance: fd,
403
- endpointConfig: config
403
+ endpointConfig: config,
404
+ authProvider,
405
+ builtinEditors
404
406
  }
405
407
  });
406
408
  // Create the mounted app interface (simpler version)
@@ -0,0 +1,2 @@
1
+ import type { FlowDropTheme } from '../types/theme.js';
2
+ export declare const drafterTheme: FlowDropTheme;
@@ -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 };
@@ -2,7 +2,9 @@
2
2
  * Authentication Provider Types for FlowDrop
3
3
  *
4
4
  * Provides interfaces and implementations for authentication in FlowDrop.
5
- * AuthProvider is passed at mount time and cannot be changed without remounting.
5
+ * An AuthProvider is supplied at mount time (or via `fd.api.configure`) and can
6
+ * be swapped at runtime with `fd.api.setAuthProvider(...)` — e.g. on login or
7
+ * logout — without remounting.
6
8
  *
7
9
  * @module types/auth
8
10
  */
@@ -15,8 +17,7 @@
15
17
  * @example
16
18
  * ```typescript
17
19
  * const authProvider: AuthProvider = {
18
- * getAuthHeaders: async () => ({ Authorization: "Bearer token123" }),
19
- * isAuthenticated: () => true
20
+ * getAuthHeaders: async () => ({ Authorization: "Bearer token123" })
20
21
  * };
21
22
  * ```
22
23
  */
@@ -30,15 +31,6 @@ export interface AuthProvider {
30
31
  * @returns Promise resolving to a record of header name-value pairs
31
32
  */
32
33
  getAuthHeaders(): Promise<Record<string, string>>;
33
- /**
34
- * Check if currently authenticated
35
- *
36
- * Used to determine if API requests should be attempted.
37
- * Should return synchronously for performance.
38
- *
39
- * @returns true if authenticated, false otherwise
40
- */
41
- isAuthenticated(): boolean;
42
34
  /**
43
35
  * Called when API returns 401 Unauthorized
44
36
  *
@@ -68,6 +60,11 @@ export interface StaticAuthConfig {
68
60
  token?: string;
69
61
  /** API key (used when type is "api_key") */
70
62
  apiKey?: string;
63
+ /**
64
+ * Header name to carry the API key (used when type is "api_key").
65
+ * Defaults to `"X-API-Key"`.
66
+ */
67
+ apiKeyHeader?: string;
71
68
  /** Custom headers (used when type is "custom") */
72
69
  headers?: Record<string, string>;
73
70
  }
@@ -119,28 +116,6 @@ export declare class StaticAuthProvider implements AuthProvider {
119
116
  * @returns Promise resolving to authentication headers
120
117
  */
121
118
  getAuthHeaders(): Promise<Record<string, string>>;
122
- /**
123
- * Check if authenticated
124
- *
125
- * Returns true if any auth headers are configured.
126
- *
127
- * @returns true if headers are configured
128
- */
129
- isAuthenticated(): boolean;
130
- /**
131
- * Handle unauthorized response
132
- *
133
- * Static provider cannot refresh tokens, so always returns false.
134
- *
135
- * @returns Promise resolving to false (cannot refresh)
136
- */
137
- onUnauthorized(): Promise<boolean>;
138
- /**
139
- * Handle forbidden response
140
- *
141
- * Static provider has no special handling for 403.
142
- */
143
- onForbidden(): Promise<void>;
144
119
  }
145
120
  /**
146
121
  * Configuration for callback-based authentication
@@ -213,15 +188,6 @@ export declare class CallbackAuthProvider implements AuthProvider {
213
188
  * @returns Promise resolving to authentication headers
214
189
  */
215
190
  getAuthHeaders(): Promise<Record<string, string>>;
216
- /**
217
- * Check if authenticated
218
- *
219
- * For callback-based auth, we assume authenticated if getToken exists.
220
- * The actual token validity is checked when making requests.
221
- *
222
- * @returns true (assumes authenticated, actual check happens on request)
223
- */
224
- isAuthenticated(): boolean;
225
191
  /**
226
192
  * Handle unauthorized response
227
193
  *
@@ -252,12 +218,4 @@ export declare class NoAuthProvider implements AuthProvider {
252
218
  * @returns Promise resolving to empty object
253
219
  */
254
220
  getAuthHeaders(): Promise<Record<string, string>>;
255
- /**
256
- * Check if authenticated
257
- *
258
- * Always returns false (no auth configured).
259
- *
260
- * @returns false
261
- */
262
- isAuthenticated(): boolean;
263
221
  }
@@ -2,7 +2,9 @@
2
2
  * Authentication Provider Types for FlowDrop
3
3
  *
4
4
  * Provides interfaces and implementations for authentication in FlowDrop.
5
- * AuthProvider is passed at mount time and cannot be changed without remounting.
5
+ * An AuthProvider is supplied at mount time (or via `fd.api.configure`) and can
6
+ * be swapped at runtime with `fd.api.setAuthProvider(...)` — e.g. on login or
7
+ * logout — without remounting.
6
8
  *
7
9
  * @module types/auth
8
10
  */
@@ -55,7 +57,7 @@ export class StaticAuthProvider {
55
57
  break;
56
58
  case 'api_key':
57
59
  if (config.apiKey) {
58
- this.headers['X-API-Key'] = config.apiKey;
60
+ this.headers[config.apiKeyHeader ?? 'X-API-Key'] = config.apiKey;
59
61
  }
60
62
  break;
61
63
  case 'custom':
@@ -79,35 +81,6 @@ export class StaticAuthProvider {
79
81
  async getAuthHeaders() {
80
82
  return this.headers;
81
83
  }
82
- /**
83
- * Check if authenticated
84
- *
85
- * Returns true if any auth headers are configured.
86
- *
87
- * @returns true if headers are configured
88
- */
89
- isAuthenticated() {
90
- return Object.keys(this.headers).length > 0;
91
- }
92
- /**
93
- * Handle unauthorized response
94
- *
95
- * Static provider cannot refresh tokens, so always returns false.
96
- *
97
- * @returns Promise resolving to false (cannot refresh)
98
- */
99
- async onUnauthorized() {
100
- // Static provider cannot refresh tokens
101
- return false;
102
- }
103
- /**
104
- * Handle forbidden response
105
- *
106
- * Static provider has no special handling for 403.
107
- */
108
- async onForbidden() {
109
- // No special handling for static provider
110
- }
111
84
  }
112
85
  /**
113
86
  * Callback-based authentication provider
@@ -162,19 +135,6 @@ export class CallbackAuthProvider {
162
135
  }
163
136
  return {};
164
137
  }
165
- /**
166
- * Check if authenticated
167
- *
168
- * For callback-based auth, we assume authenticated if getToken exists.
169
- * The actual token validity is checked when making requests.
170
- *
171
- * @returns true (assumes authenticated, actual check happens on request)
172
- */
173
- isAuthenticated() {
174
- // For callback-based auth, we assume authenticated if getToken exists
175
- // The actual token validity is checked when making requests
176
- return true;
177
- }
178
138
  /**
179
139
  * Handle unauthorized response
180
140
  *
@@ -216,14 +176,4 @@ export class NoAuthProvider {
216
176
  async getAuthHeaders() {
217
177
  return {};
218
178
  }
219
- /**
220
- * Check if authenticated
221
- *
222
- * Always returns false (no auth configured).
223
- *
224
- * @returns false
225
- */
226
- isAuthenticated() {
227
- return false;
228
- }
229
179
  }
@@ -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
@@ -2,9 +2,9 @@
2
2
  * Core types for the Workflow Library
3
3
  */
4
4
  import type { Component } from 'svelte';
5
- import type { Node, Edge, XYPosition } from '@xyflow/svelte';
6
- import { ConnectionLineType } from '@xyflow/svelte';
5
+ import type { Node, Edge, XYPosition, ConnectionLineType } from '@xyflow/svelte';
7
6
  import type { EndpointConfig } from '../config/endpoints.js';
7
+ import type { AuthProvider } from './auth.js';
8
8
  /**
9
9
  * Built-in node categories that ship with FlowDrop.
10
10
  * These categories have predefined icons, colors, and display names.
@@ -1231,6 +1231,8 @@ export interface PipelineViewProps {
1231
1231
  pipelineId: string | null;
1232
1232
  workflow: Workflow;
1233
1233
  endpointConfig: EndpointConfig;
1234
+ /** Auth provider for building authenticated API clients in custom views. */
1235
+ authProvider?: AuthProvider;
1234
1236
  refreshTrigger?: number;
1235
1237
  }
1236
1238
  /** A custom view injected into the PipelinePanel view switcher. */
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Core types for the Workflow Library
3
3
  */
4
- import { ConnectionLineType } from '@xyflow/svelte';
5
4
  /**
6
5
  * Default workflow format used when none is specified.
7
6
  */
@@ -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';
@@ -5,10 +5,14 @@
5
5
  * visual styling to workflow edges based on source port data types.
6
6
  * Used by both the visual editor and the command DSL system.
7
7
  */
8
- import { MarkerType } from '@xyflow/svelte';
9
8
  import { extractPortId } from '../utils/handleIds.js';
10
9
  import { isLoopbackEdge } from '../utils/connections.js';
11
10
  import { EDGE_MARKER_SIZES } from '../config/constants.js';
11
+ // xyflow's `MarkerType.ArrowClosed`, inlined as its literal value. This module
12
+ // is shared with the headless command DSL (reachable from `@flowdrop/flowdrop/core`),
13
+ // so it must NOT carry a runtime import of @xyflow/svelte — a type-only import
14
+ // plus this constant keeps the marker type-safe without the dependency.
15
+ const ARROW_CLOSED_MARKER = 'arrowclosed';
12
16
  /**
13
17
  * Check if a port ID matches a dynamic branch in a Gateway node.
14
18
  * Gateway nodes store branches in config.branches array.
@@ -101,7 +105,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
101
105
  'stroke: var(--fd-edge-loopback); stroke-dasharray: var(--fd-edge-loopback-dasharray); stroke-width: var(--fd-edge-loopback-width); opacity: var(--fd-edge-loopback-opacity);';
102
106
  edge.class = 'flowdrop--edge--loopback';
103
107
  edge.markerEnd = {
104
- type: MarkerType.ArrowClosed,
108
+ type: ARROW_CLOSED_MARKER,
105
109
  ...EDGE_MARKER_SIZES.loopback,
106
110
  color: 'var(--fd-edge-loopback)'
107
111
  };
@@ -110,7 +114,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
110
114
  edge.style = 'stroke: var(--fd-edge-trigger); stroke-width: var(--fd-edge-trigger-width);';
111
115
  edge.class = 'flowdrop--edge--trigger';
112
116
  edge.markerEnd = {
113
- type: MarkerType.ArrowClosed,
117
+ type: ARROW_CLOSED_MARKER,
114
118
  ...EDGE_MARKER_SIZES.trigger,
115
119
  color: 'var(--fd-edge-trigger)'
116
120
  };
@@ -119,7 +123,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
119
123
  edge.style = 'stroke: var(--fd-edge-tool); stroke-dasharray: 5 3;';
120
124
  edge.class = 'flowdrop--edge--tool';
121
125
  edge.markerEnd = {
122
- type: MarkerType.ArrowClosed,
126
+ type: ARROW_CLOSED_MARKER,
123
127
  ...EDGE_MARKER_SIZES.tool,
124
128
  color: 'var(--fd-edge-tool)'
125
129
  };
@@ -129,7 +133,7 @@ export function applyConnectionStyling(edge, sourceNode, targetNode) {
129
133
  edge.style = 'stroke: var(--fd-edge-data);';
130
134
  edge.class = 'flowdrop--edge--data';
131
135
  edge.markerEnd = {
132
- type: MarkerType.ArrowClosed,
136
+ type: ARROW_CLOSED_MARKER,
133
137
  ...EDGE_MARKER_SIZES.data,
134
138
  color: 'var(--fd-edge-data)'
135
139
  };