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

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 (228) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/MIGRATION-2.0.md +173 -3
  3. package/README.md +5 -5
  4. package/dist/adapters/WorkflowAdapter.js +4 -5
  5. package/dist/adapters/agentspec/AgentSpecAdapter.js +3 -3
  6. package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
  7. package/dist/api/enhanced-client.js +6 -11
  8. package/dist/commands/executor.js +51 -26
  9. package/dist/commands/storeIntegration.svelte.js +11 -1
  10. package/dist/commands/types.js +5 -5
  11. package/dist/components/App.svelte +547 -386
  12. package/dist/components/App.svelte.d.ts +16 -8
  13. package/dist/components/Button.stories.svelte +65 -0
  14. package/dist/components/Button.stories.svelte.d.ts +19 -0
  15. package/dist/components/Button.svelte +62 -0
  16. package/dist/components/Button.svelte.d.ts +24 -0
  17. package/dist/components/CanvasIconButton.svelte +76 -0
  18. package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
  19. package/dist/components/ConfigForm.svelte +167 -562
  20. package/dist/components/ConfigForm.svelte.d.ts +24 -7
  21. package/dist/components/ConfigModal.svelte +9 -1
  22. package/dist/components/ConfigPanel.svelte +234 -15
  23. package/dist/components/ConfigPanel.svelte.d.ts +6 -0
  24. package/dist/components/EditorStatusBar.stories.svelte +44 -0
  25. package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
  26. package/dist/components/EditorStatusBar.svelte +99 -0
  27. package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
  28. package/dist/components/IconButton.svelte +80 -0
  29. package/dist/components/IconButton.svelte.d.ts +30 -0
  30. package/dist/components/Input.svelte +74 -0
  31. package/dist/components/Input.svelte.d.ts +17 -0
  32. package/dist/components/LogoWordmark.svelte +113 -0
  33. package/dist/components/LogoWordmark.svelte.d.ts +26 -0
  34. package/dist/components/Navbar.svelte +17 -63
  35. package/dist/components/Navbar.svelte.d.ts +3 -0
  36. package/dist/components/NodeSidebar.svelte +21 -126
  37. package/dist/components/NodeSwapPicker.svelte +12 -30
  38. package/dist/components/PipelineStatus.svelte +6 -1
  39. package/dist/components/PipelineStatus.svelte.d.ts +3 -0
  40. package/dist/components/PortMappingRow.svelte +0 -2
  41. package/dist/components/SchemaForm.svelte +4 -14
  42. package/dist/components/Select.svelte +53 -0
  43. package/dist/components/Select.svelte.d.ts +15 -0
  44. package/dist/components/SettingsModal.svelte +0 -5
  45. package/dist/components/SettingsPanel.svelte +24 -6
  46. package/dist/components/Textarea.svelte +39 -0
  47. package/dist/components/Textarea.svelte.d.ts +12 -0
  48. package/dist/components/ThemeToggle.svelte +15 -94
  49. package/dist/components/UniversalNode.svelte +36 -4
  50. package/dist/components/UniversalNode.svelte.d.ts +1 -1
  51. package/dist/components/WorkflowEditor.svelte +66 -52
  52. package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
  53. package/dist/components/chat/AIChatPanel.svelte +7 -2
  54. package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
  55. package/dist/components/console/ConsoleInput.svelte +3 -3
  56. package/dist/components/console/ConsoleOutput.svelte +2 -2
  57. package/dist/components/form/FormArray.svelte +37 -173
  58. package/dist/components/form/FormAutocomplete.svelte +18 -15
  59. package/dist/components/form/FormCheckboxGroup.svelte +1 -5
  60. package/dist/components/form/FormCodeEditor.svelte +9 -7
  61. package/dist/components/form/FormField.svelte +18 -42
  62. package/dist/components/form/FormFieldLight.svelte +52 -48
  63. package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
  64. package/dist/components/form/FormFieldset.svelte +45 -11
  65. package/dist/components/form/FormMarkdownEditor.svelte +8 -5
  66. package/dist/components/form/FormNumberField.svelte +4 -36
  67. package/dist/components/form/FormPorts.svelte +262 -0
  68. package/dist/components/form/FormPorts.svelte.d.ts +13 -0
  69. package/dist/components/form/FormRangeField.svelte +61 -30
  70. package/dist/components/form/FormSelect.svelte +13 -75
  71. package/dist/components/form/FormTemplateEditor.svelte +6 -4
  72. package/dist/components/form/FormTextField.svelte +3 -35
  73. package/dist/components/form/FormTextarea.svelte +4 -39
  74. package/dist/components/form/FormToggle.svelte +0 -4
  75. package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
  76. package/dist/components/form/resolveFieldType.d.ts +24 -0
  77. package/dist/components/form/resolveFieldType.js +55 -0
  78. package/dist/components/icons/CloseIcon.svelte +6 -0
  79. package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
  80. package/dist/components/icons/CommandLineIcon.svelte +15 -0
  81. package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
  82. package/dist/components/icons/MenuIcon.svelte +4 -0
  83. package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
  84. package/dist/components/icons/MenuOpenIcon.svelte +6 -0
  85. package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
  86. package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
  87. package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
  88. package/dist/components/interrupt/InterruptBubble.svelte +11 -12
  89. package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
  90. package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
  91. package/dist/components/layouts/MainLayout.svelte +4 -5
  92. package/dist/components/nodes/AtomNode.svelte +62 -76
  93. package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
  94. package/dist/components/nodes/GatewayNode.svelte +117 -164
  95. package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
  96. package/dist/components/nodes/IdeaNode.svelte +72 -98
  97. package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
  98. package/dist/components/nodes/NodeConfigButton.svelte +86 -0
  99. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
  100. package/dist/components/nodes/NotesNode.svelte +76 -85
  101. package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
  102. package/dist/components/nodes/SimpleNode.svelte +59 -133
  103. package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
  104. package/dist/components/nodes/SquareNode.svelte +110 -164
  105. package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
  106. package/dist/components/nodes/TerminalNode.svelte +62 -124
  107. package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
  108. package/dist/components/nodes/ToolNode.svelte +92 -103
  109. package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
  110. package/dist/components/nodes/WorkflowNode.svelte +132 -191
  111. package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
  112. package/dist/components/playground/ChatInput.svelte +0 -1
  113. package/dist/components/playground/InputCollector.svelte +11 -48
  114. package/dist/components/playground/PipelineKanbanView.svelte +6 -4
  115. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
  116. package/dist/components/playground/PipelinePanel.svelte +20 -3
  117. package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
  118. package/dist/components/playground/PipelineTableView.svelte +6 -4
  119. package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
  120. package/dist/components/playground/Playground.svelte +76 -25
  121. package/dist/components/playground/Playground.svelte.d.ts +3 -0
  122. package/dist/components/playground/PlaygroundApp.svelte +6 -1
  123. package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
  124. package/dist/components/playground/PlaygroundModal.svelte +5 -0
  125. package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
  126. package/dist/components/playground/PlaygroundStudio.svelte +7 -6
  127. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
  128. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
  129. package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
  130. package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
  131. package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
  132. package/dist/components/surfaces/TabbedSurface.svelte +133 -0
  133. package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
  134. package/dist/config/endpoints.d.ts +23 -0
  135. package/dist/config/endpoints.js +28 -0
  136. package/dist/core/index.d.ts +2 -3
  137. package/dist/core/index.js +2 -6
  138. package/dist/display/index.d.ts +6 -1
  139. package/dist/display/index.js +9 -1
  140. package/dist/editor/index.d.ts +1 -1
  141. package/dist/editor/index.js +1 -1
  142. package/dist/form/full.d.ts +2 -1
  143. package/dist/form/full.js +4 -1
  144. package/dist/form/index.d.ts +0 -1
  145. package/dist/form/index.js +3 -2
  146. package/dist/helpers/workflowEditorHelper.d.ts +4 -2
  147. package/dist/helpers/workflowEditorHelper.js +8 -8
  148. package/dist/messages/index.d.ts +1 -1
  149. package/dist/messages/index.js +1 -1
  150. package/dist/openapi/v1/openapi.yaml +35 -23
  151. package/dist/playground/index.d.ts +2 -2
  152. package/dist/playground/index.js +2 -2
  153. package/dist/playground/mount.d.ts +19 -5
  154. package/dist/playground/mount.js +16 -8
  155. package/dist/registry/builtinNodeTypes.d.ts +53 -0
  156. package/dist/registry/builtinNodeTypes.js +67 -0
  157. package/dist/registry/builtinNodes.d.ts +2 -39
  158. package/dist/registry/builtinNodes.js +6 -53
  159. package/dist/registry/nodeComponentRegistry.d.ts +2 -1
  160. package/dist/schemas/v1/workflow.schema.json +16 -14
  161. package/dist/services/agentSpecExecutionService.d.ts +0 -2
  162. package/dist/services/agentSpecExecutionService.js +0 -2
  163. package/dist/services/apiVariableService.js +12 -26
  164. package/dist/services/categoriesApi.js +3 -6
  165. package/dist/services/chatService.d.ts +4 -3
  166. package/dist/services/chatService.js +13 -18
  167. package/dist/services/dynamicSchemaService.d.ts +31 -4
  168. package/dist/services/dynamicSchemaService.js +62 -33
  169. package/dist/services/historyService.d.ts +30 -8
  170. package/dist/services/historyService.js +51 -15
  171. package/dist/services/interruptService.d.ts +7 -6
  172. package/dist/services/interruptService.js +19 -21
  173. package/dist/services/playgroundService.d.ts +9 -8
  174. package/dist/services/playgroundService.js +23 -25
  175. package/dist/services/portConfigApi.js +3 -6
  176. package/dist/services/settingsService.d.ts +9 -4
  177. package/dist/services/settingsService.js +23 -12
  178. package/dist/skins/drafter.d.ts +30 -0
  179. package/dist/skins/drafter.js +198 -0
  180. package/dist/skins/index.d.ts +2 -1
  181. package/dist/skins/index.js +4 -2
  182. package/dist/stores/apiContext.d.ts +11 -0
  183. package/dist/stores/apiContext.js +15 -0
  184. package/dist/stores/categoriesStore.svelte.js +0 -1
  185. package/dist/stores/historyStore.svelte.d.ts +17 -3
  186. package/dist/stores/historyStore.svelte.js +30 -3
  187. package/dist/stores/instanceContainer.svelte.js +5 -0
  188. package/dist/stores/playgroundStore.svelte.js +1 -3
  189. package/dist/stores/settingsStore.svelte.d.ts +13 -0
  190. package/dist/stores/settingsStore.svelte.js +32 -0
  191. package/dist/stores/workflowStore.svelte.d.ts +42 -5
  192. package/dist/stores/workflowStore.svelte.js +109 -32
  193. package/dist/styles/base.css +285 -14
  194. package/dist/styles/tokens.css +60 -2
  195. package/dist/svelte-app.d.ts +18 -1
  196. package/dist/svelte-app.js +75 -110
  197. package/dist/themes/drafter.d.ts +2 -0
  198. package/dist/themes/drafter.js +15 -0
  199. package/dist/themes/index.d.ts +2 -1
  200. package/dist/themes/index.js +8 -2
  201. package/dist/types/auth.d.ts +9 -51
  202. package/dist/types/auth.js +4 -54
  203. package/dist/types/events.d.ts +18 -0
  204. package/dist/types/events.js +2 -1
  205. package/dist/types/index.d.ts +84 -29
  206. package/dist/types/index.js +0 -1
  207. package/dist/types/settings.d.ts +17 -1
  208. package/dist/types/settings.js +4 -2
  209. package/dist/types/skin.d.ts +1 -1
  210. package/dist/types/theme.d.ts +16 -2
  211. package/dist/types/uischema.d.ts +5 -0
  212. package/dist/utils/colors.d.ts +27 -0
  213. package/dist/utils/colors.js +23 -0
  214. package/dist/utils/connections.js +20 -56
  215. package/dist/utils/edgeStyling.js +9 -5
  216. package/dist/utils/fetchWithAuth.d.ts +36 -15
  217. package/dist/utils/fetchWithAuth.js +53 -23
  218. package/dist/utils/nodeIds.d.ts +1 -1
  219. package/dist/utils/nodeIds.js +1 -1
  220. package/dist/utils/nodeSwap.js +3 -6
  221. package/dist/utils/nodeTypes.js +1 -1
  222. package/dist/utils/portUtils.d.ts +47 -11
  223. package/dist/utils/portUtils.js +67 -14
  224. package/dist/utils/portal.d.ts +18 -0
  225. package/dist/utils/portal.js +34 -0
  226. package/dist/utils/schemaMerge.d.ts +25 -0
  227. package/dist/utils/schemaMerge.js +61 -0
  228. package/package.json +2 -1
@@ -55,6 +55,58 @@ function releaseInstance(fd, isDefault) {
55
55
  fd.destroy();
56
56
  }
57
57
  }
58
+ /**
59
+ * Resolve endpoint config, port config and categories from mount options and
60
+ * apply them to the given instance (API context, port-compatibility checker,
61
+ * categories). Shared by `mountFlowDropApp` and `mountWorkflowEditor`.
62
+ *
63
+ * @returns the resolved {@link EndpointConfig} (merged with defaults), which the
64
+ * callers forward to their mounted component.
65
+ */
66
+ async function configureInstance(fd, options) {
67
+ const { endpointConfig, portConfig, categories, authProvider } = options;
68
+ // Create endpoint configuration, merging with defaults so all required
69
+ // endpoints are present.
70
+ const { defaultEndpointConfig } = await import('./config/endpoints.js');
71
+ const config = endpointConfig
72
+ ? {
73
+ ...defaultEndpointConfig,
74
+ ...endpointConfig,
75
+ endpoints: {
76
+ ...defaultEndpointConfig.endpoints,
77
+ ...endpointConfig.endpoints
78
+ }
79
+ }
80
+ : defaultEndpointConfig;
81
+ // Initialize port configuration (fetch from API when not supplied).
82
+ let finalPortConfig = portConfig;
83
+ if (!finalPortConfig) {
84
+ try {
85
+ finalPortConfig = await fetchPortConfig(config, authProvider);
86
+ }
87
+ catch (error) {
88
+ logger.warn('Failed to fetch port config from API, using default:', error);
89
+ finalPortConfig = DEFAULT_PORT_CONFIG;
90
+ }
91
+ }
92
+ // Configure this instance's API context and port compatibility checker.
93
+ fd.api.configure(config, authProvider);
94
+ fd.portCompatibility.reinitialize(finalPortConfig);
95
+ // Initialize this instance's categories (fetch from API when not supplied).
96
+ if (categories) {
97
+ fd.categories.initialize(categories);
98
+ }
99
+ else {
100
+ try {
101
+ const fetchedCategories = await fetchCategories(config, authProvider);
102
+ fd.categories.initialize(fetchedCategories);
103
+ }
104
+ catch (error) {
105
+ logger.warn('Failed to fetch categories from API, using defaults:', error);
106
+ }
107
+ }
108
+ return config;
109
+ }
58
110
  /**
59
111
  * Mount the full FlowDrop App with navbar, sidebars, and workflow editor
60
112
  *
@@ -80,7 +132,7 @@ function releaseInstance(fd, isDefault) {
80
132
  * ```
81
133
  */
82
134
  export async function mountFlowDropApp(container, options = {}) {
83
- const { workflow, nodes, endpointConfig, portConfig, categories, height = '100vh', width = '100%', showNavbar = false, disableSidebar, mode, pipelineId, navbarTitle, navbarActions, showSettings, showStatus, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey, draftStorage, formatAdapters, theme, settingsCategories, showSettingsSyncButton, showSettingsResetButton, instanceId } = options;
135
+ const { workflow, nodes, endpointConfig, portConfig, categories, height = '100vh', width = '100%', showNavbar = false, disableSidebar, configPlacement, consolePlacement, mode, pipelineId, navbarTitle, navbarActions, showSettings, showStatus, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey, draftStorage, formatAdapters, theme, settingsCategories, showSettingsSyncButton, showSettingsResetButton, instanceId } = options;
84
136
  // Per-instance state container — this is what allows multiple FlowDrop
85
137
  // editors to coexist on one page without sharing workflow/history state.
86
138
  const { fd, isDefault } = acquireInstance(instanceId);
@@ -103,61 +155,14 @@ export async function mountFlowDropApp(container, options = {}) {
103
155
  await initializeSettings({
104
156
  defaults: initialSettings
105
157
  });
106
- // Create endpoint configuration
107
- let config;
108
- if (endpointConfig) {
109
- // Merge with default configuration to ensure all required endpoints are present
110
- const { defaultEndpointConfig } = await import('./config/endpoints.js');
111
- config = {
112
- ...defaultEndpointConfig,
113
- ...endpointConfig,
114
- endpoints: {
115
- ...defaultEndpointConfig.endpoints,
116
- ...endpointConfig.endpoints
117
- }
118
- };
119
- }
120
- else {
121
- // Use default configuration if none provided
122
- const { defaultEndpointConfig } = await import('./config/endpoints.js');
123
- config = defaultEndpointConfig;
124
- }
125
- // Initialize port configuration
126
- let finalPortConfig = portConfig;
127
- if (!finalPortConfig && config) {
128
- // Try to fetch port configuration from API
129
- try {
130
- finalPortConfig = await fetchPortConfig(config, authProvider);
131
- }
132
- catch (error) {
133
- logger.warn('Failed to fetch port config from API, using default:', error);
134
- finalPortConfig = DEFAULT_PORT_CONFIG;
135
- }
136
- }
137
- else if (!finalPortConfig) {
138
- finalPortConfig = DEFAULT_PORT_CONFIG;
139
- }
140
- // Configure this instance's API context (endpoints + auth provider) so
141
- // <App> and services resolve it via getInstance().api.
142
- if (config) {
143
- fd.api.configure(config, authProvider);
144
- }
145
- // Re-initialize this instance's port compatibility checker with the resolved
146
- // config (it was seeded with DEFAULT_PORT_CONFIG at construction).
147
- fd.portCompatibility.reinitialize(finalPortConfig);
148
- // Initialize this instance's categories
149
- if (categories) {
150
- fd.categories.initialize(categories);
151
- }
152
- else if (config) {
153
- try {
154
- const fetchedCategories = await fetchCategories(config, authProvider);
155
- fd.categories.initialize(fetchedCategories);
156
- }
157
- catch (error) {
158
- logger.warn('Failed to fetch categories from API, using defaults:', error);
159
- }
160
- }
158
+ // Resolve and apply endpoint config, port config and categories to this
159
+ // instance (see configureInstance).
160
+ const config = await configureInstance(fd, {
161
+ endpointConfig,
162
+ portConfig,
163
+ categories,
164
+ authProvider
165
+ });
161
166
  // Set up event handler callbacks in this instance's store
162
167
  if (eventHandlers?.onDirtyStateChange) {
163
168
  fd.workflow.setOnDirtyStateChange(eventHandlers.onDirtyStateChange);
@@ -176,6 +181,8 @@ export async function mountFlowDropApp(container, options = {}) {
176
181
  width,
177
182
  showNavbar,
178
183
  disableSidebar,
184
+ configPlacement,
185
+ consolePlacement,
179
186
  mode,
180
187
  pipelineId,
181
188
  navbarTitle,
@@ -335,61 +342,17 @@ export async function mountFlowDropApp(container, options = {}) {
335
342
  * @returns Promise resolving to a MountedFlowDropApp instance
336
343
  */
337
344
  export async function mountWorkflowEditor(container, options = {}) {
338
- const { workflow, endpointConfig, portConfig, categories, authProvider, instanceId } = options;
345
+ const { workflow, endpointConfig, portConfig, categories, authProvider, instanceId, builtinEditors } = options;
339
346
  // Per-instance state container (see mountFlowDropApp)
340
347
  const { fd, isDefault } = acquireInstance(instanceId);
341
- // Create endpoint configuration
342
- let config;
343
- if (endpointConfig) {
344
- // Merge with default configuration to ensure all required endpoints are present
345
- const { defaultEndpointConfig } = await import('./config/endpoints.js');
346
- config = {
347
- ...defaultEndpointConfig,
348
- ...endpointConfig,
349
- endpoints: {
350
- ...defaultEndpointConfig.endpoints,
351
- ...endpointConfig.endpoints
352
- }
353
- };
354
- }
355
- else {
356
- // Use default configuration if none provided
357
- const { defaultEndpointConfig } = await import('./config/endpoints.js');
358
- config = defaultEndpointConfig;
359
- }
360
- // Initialize port configuration
361
- let finalPortConfig = portConfig;
362
- if (!finalPortConfig && config) {
363
- // Try to fetch port configuration from API
364
- try {
365
- finalPortConfig = await fetchPortConfig(config, authProvider);
366
- }
367
- catch (error) {
368
- logger.warn('Failed to fetch port config from API, using default:', error);
369
- finalPortConfig = DEFAULT_PORT_CONFIG;
370
- }
371
- }
372
- else if (!finalPortConfig) {
373
- finalPortConfig = DEFAULT_PORT_CONFIG;
374
- }
375
- // Configure this instance's API context and port compatibility checker.
376
- if (config) {
377
- fd.api.configure(config, authProvider);
378
- }
379
- fd.portCompatibility.reinitialize(finalPortConfig);
380
- // Initialize this instance's categories
381
- if (categories) {
382
- fd.categories.initialize(categories);
383
- }
384
- else if (config) {
385
- try {
386
- const fetchedCategories = await fetchCategories(config, authProvider);
387
- fd.categories.initialize(fetchedCategories);
388
- }
389
- catch (error) {
390
- logger.warn('Failed to fetch categories from API, using defaults:', error);
391
- }
392
- }
348
+ // Resolve and apply endpoint config, port config and categories to this
349
+ // instance (see configureInstance).
350
+ const config = await configureInstance(fd, {
351
+ endpointConfig,
352
+ portConfig,
353
+ categories,
354
+ authProvider
355
+ });
393
356
  // Seed the instance's workflow before mounting so the editor renders it
394
357
  // immediately. (1.x accepted this option but silently ignored it.)
395
358
  if (workflow) {
@@ -400,7 +363,9 @@ export async function mountWorkflowEditor(container, options = {}) {
400
363
  target: container,
401
364
  props: {
402
365
  instance: fd,
403
- endpointConfig: config
366
+ endpointConfig: config,
367
+ authProvider,
368
+ builtinEditors
404
369
  }
405
370
  });
406
371
  // 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