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

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 (270) hide show
  1. package/CHANGELOG.md +210 -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/chat/batchFeedback.js +1 -1
  9. package/dist/chat/commandClassifier.d.ts +11 -0
  10. package/dist/chat/commandClassifier.js +20 -0
  11. package/dist/chat/historyBuilder.d.ts +39 -0
  12. package/dist/chat/historyBuilder.js +82 -0
  13. package/dist/chat/index.d.ts +2 -1
  14. package/dist/chat/index.js +2 -1
  15. package/dist/chat/responseParser.js +16 -12
  16. package/dist/commands/executor.js +51 -26
  17. package/dist/commands/parser.d.ts +12 -0
  18. package/dist/commands/parser.js +33 -6
  19. package/dist/commands/storeIntegration.svelte.js +11 -1
  20. package/dist/commands/types.js +5 -5
  21. package/dist/components/App.svelte +547 -386
  22. package/dist/components/App.svelte.d.ts +16 -8
  23. package/dist/components/Button.stories.svelte +65 -0
  24. package/dist/components/Button.stories.svelte.d.ts +19 -0
  25. package/dist/components/Button.svelte +62 -0
  26. package/dist/components/Button.svelte.d.ts +24 -0
  27. package/dist/components/CanvasIconButton.svelte +76 -0
  28. package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
  29. package/dist/components/ConfigForm.svelte +194 -565
  30. package/dist/components/ConfigForm.svelte.d.ts +24 -7
  31. package/dist/components/ConfigModal.svelte +9 -1
  32. package/dist/components/ConfigPanel.svelte +234 -15
  33. package/dist/components/ConfigPanel.svelte.d.ts +6 -0
  34. package/dist/components/EditorStatusBar.stories.svelte +44 -0
  35. package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
  36. package/dist/components/EditorStatusBar.svelte +99 -0
  37. package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
  38. package/dist/components/IconButton.svelte +80 -0
  39. package/dist/components/IconButton.svelte.d.ts +30 -0
  40. package/dist/components/Input.svelte +74 -0
  41. package/dist/components/Input.svelte.d.ts +17 -0
  42. package/dist/components/LogoWordmark.svelte +113 -0
  43. package/dist/components/LogoWordmark.svelte.d.ts +26 -0
  44. package/dist/components/Navbar.svelte +17 -63
  45. package/dist/components/Navbar.svelte.d.ts +3 -0
  46. package/dist/components/NodeSidebar.svelte +21 -126
  47. package/dist/components/NodeSwapPicker.svelte +12 -30
  48. package/dist/components/PipelineStatus.svelte +6 -1
  49. package/dist/components/PipelineStatus.svelte.d.ts +3 -0
  50. package/dist/components/PortMappingRow.svelte +0 -2
  51. package/dist/components/SchemaForm.svelte +4 -14
  52. package/dist/components/Select.svelte +53 -0
  53. package/dist/components/Select.svelte.d.ts +15 -0
  54. package/dist/components/SettingsModal.svelte +0 -5
  55. package/dist/components/SettingsPanel.svelte +33 -6
  56. package/dist/components/Textarea.svelte +39 -0
  57. package/dist/components/Textarea.svelte.d.ts +12 -0
  58. package/dist/components/ThemeToggle.svelte +15 -94
  59. package/dist/components/UniversalNode.svelte +36 -4
  60. package/dist/components/UniversalNode.svelte.d.ts +1 -1
  61. package/dist/components/WorkflowEditor.svelte +71 -54
  62. package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
  63. package/dist/components/chat/AIChatPanel.svelte +49 -8
  64. package/dist/components/chat/CommandPreview.svelte +10 -1
  65. package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
  66. package/dist/components/console/ConsoleInput.svelte +3 -3
  67. package/dist/components/console/ConsoleOutput.svelte +2 -2
  68. package/dist/components/form/FormArray.svelte +37 -173
  69. package/dist/components/form/FormAutocomplete.svelte +18 -15
  70. package/dist/components/form/FormCheckboxGroup.svelte +1 -5
  71. package/dist/components/form/FormCodeEditor.svelte +9 -7
  72. package/dist/components/form/FormField.svelte +18 -42
  73. package/dist/components/form/FormFieldLight.svelte +52 -48
  74. package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
  75. package/dist/components/form/FormFieldset.svelte +45 -11
  76. package/dist/components/form/FormMarkdownEditor.svelte +8 -5
  77. package/dist/components/form/FormNumberField.svelte +4 -36
  78. package/dist/components/form/FormPorts.svelte +280 -0
  79. package/dist/components/form/FormPorts.svelte.d.ts +13 -0
  80. package/dist/components/form/FormRangeField.svelte +63 -30
  81. package/dist/components/form/FormSelect.svelte +13 -75
  82. package/dist/components/form/FormTemplateEditor.svelte +6 -4
  83. package/dist/components/form/FormTextField.svelte +3 -35
  84. package/dist/components/form/FormTextarea.svelte +4 -39
  85. package/dist/components/form/FormToggle.svelte +27 -6
  86. package/dist/components/form/FormToggle.svelte.d.ts +5 -0
  87. package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
  88. package/dist/components/form/resolveFieldType.d.ts +24 -0
  89. package/dist/components/form/resolveFieldType.js +55 -0
  90. package/dist/components/icons/CloseIcon.svelte +6 -0
  91. package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
  92. package/dist/components/icons/CommandLineIcon.svelte +15 -0
  93. package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
  94. package/dist/components/icons/MenuIcon.svelte +4 -0
  95. package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
  96. package/dist/components/icons/MenuOpenIcon.svelte +6 -0
  97. package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
  98. package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
  99. package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
  100. package/dist/components/interrupt/InterruptBubble.svelte +11 -12
  101. package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
  102. package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
  103. package/dist/components/layouts/MainLayout.svelte +4 -5
  104. package/dist/components/nodes/AtomNode.svelte +62 -76
  105. package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
  106. package/dist/components/nodes/GatewayNode.svelte +117 -164
  107. package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
  108. package/dist/components/nodes/IdeaNode.svelte +72 -98
  109. package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
  110. package/dist/components/nodes/NodeConfigButton.svelte +86 -0
  111. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
  112. package/dist/components/nodes/NotesNode.svelte +76 -85
  113. package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
  114. package/dist/components/nodes/SimpleNode.svelte +59 -133
  115. package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
  116. package/dist/components/nodes/SquareNode.svelte +110 -164
  117. package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
  118. package/dist/components/nodes/TerminalNode.svelte +62 -124
  119. package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
  120. package/dist/components/nodes/ToolNode.svelte +92 -103
  121. package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
  122. package/dist/components/nodes/WorkflowNode.svelte +132 -191
  123. package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
  124. package/dist/components/playground/ChatInput.svelte +316 -27
  125. package/dist/components/playground/ChatInput.svelte.d.ts +31 -1
  126. package/dist/components/playground/ControlPanel.svelte +22 -0
  127. package/dist/components/playground/ControlPanel.svelte.d.ts +13 -0
  128. package/dist/components/playground/InputCollector.svelte +11 -48
  129. package/dist/components/playground/PipelineKanbanView.svelte +6 -4
  130. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
  131. package/dist/components/playground/PipelinePanel.svelte +20 -3
  132. package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
  133. package/dist/components/playground/PipelineTableView.svelte +6 -4
  134. package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
  135. package/dist/components/playground/Playground.svelte +292 -28
  136. package/dist/components/playground/Playground.svelte.d.ts +3 -0
  137. package/dist/components/playground/PlaygroundApp.svelte +6 -1
  138. package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
  139. package/dist/components/playground/PlaygroundModal.svelte +5 -0
  140. package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
  141. package/dist/components/playground/PlaygroundStudio.svelte +7 -6
  142. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
  143. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
  144. package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
  145. package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
  146. package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
  147. package/dist/components/surfaces/TabbedSurface.svelte +133 -0
  148. package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
  149. package/dist/config/endpoints.d.ts +71 -1
  150. package/dist/config/endpoints.js +46 -5
  151. package/dist/core/index.d.ts +2 -3
  152. package/dist/core/index.js +2 -6
  153. package/dist/display/index.d.ts +6 -1
  154. package/dist/display/index.js +9 -1
  155. package/dist/editor/index.d.ts +1 -1
  156. package/dist/editor/index.js +1 -1
  157. package/dist/form/full.d.ts +2 -1
  158. package/dist/form/full.js +4 -1
  159. package/dist/form/index.d.ts +0 -1
  160. package/dist/form/index.js +3 -2
  161. package/dist/helpers/workflowEditorHelper.d.ts +4 -2
  162. package/dist/helpers/workflowEditorHelper.js +8 -8
  163. package/dist/messages/defaults.d.ts +98 -0
  164. package/dist/messages/defaults.js +58 -1
  165. package/dist/messages/index.d.ts +1 -1
  166. package/dist/messages/index.js +1 -1
  167. package/dist/openapi/v1/openapi.yaml +35 -23
  168. package/dist/playground/commands/args.d.ts +32 -0
  169. package/dist/playground/commands/args.js +50 -0
  170. package/dist/playground/commands/dispatch.d.ts +143 -0
  171. package/dist/playground/commands/dispatch.js +162 -0
  172. package/dist/playground/commands/index.d.ts +14 -0
  173. package/dist/playground/commands/index.js +10 -0
  174. package/dist/playground/commands/parser.d.ts +38 -0
  175. package/dist/playground/commands/parser.js +163 -0
  176. package/dist/playground/commands/registry.d.ts +42 -0
  177. package/dist/playground/commands/registry.js +122 -0
  178. package/dist/playground/commands/suggest.d.ts +37 -0
  179. package/dist/playground/commands/suggest.js +46 -0
  180. package/dist/playground/commands/types.d.ts +111 -0
  181. package/dist/playground/commands/types.js +15 -0
  182. package/dist/playground/index.d.ts +21 -2
  183. package/dist/playground/index.js +27 -2
  184. package/dist/playground/mount.d.ts +19 -5
  185. package/dist/playground/mount.js +16 -8
  186. package/dist/playground/runAction.d.ts +48 -0
  187. package/dist/playground/runAction.js +31 -0
  188. package/dist/registry/builtinNodeTypes.d.ts +53 -0
  189. package/dist/registry/builtinNodeTypes.js +67 -0
  190. package/dist/registry/builtinNodes.d.ts +2 -39
  191. package/dist/registry/builtinNodes.js +6 -53
  192. package/dist/registry/nodeComponentRegistry.d.ts +2 -1
  193. package/dist/schemas/v1/workflow.schema.json +16 -14
  194. package/dist/services/agentSpecExecutionService.d.ts +0 -2
  195. package/dist/services/agentSpecExecutionService.js +0 -2
  196. package/dist/services/apiVariableService.js +12 -26
  197. package/dist/services/categoriesApi.js +3 -6
  198. package/dist/services/chatService.d.ts +4 -3
  199. package/dist/services/chatService.js +13 -18
  200. package/dist/services/dynamicSchemaService.d.ts +31 -4
  201. package/dist/services/dynamicSchemaService.js +62 -33
  202. package/dist/services/historyService.d.ts +30 -8
  203. package/dist/services/historyService.js +51 -15
  204. package/dist/services/interruptService.d.ts +7 -6
  205. package/dist/services/interruptService.js +19 -21
  206. package/dist/services/pipelineSignalService.d.ts +97 -0
  207. package/dist/services/pipelineSignalService.js +94 -0
  208. package/dist/services/playgroundService.d.ts +21 -8
  209. package/dist/services/playgroundService.js +45 -25
  210. package/dist/services/portConfigApi.js +3 -6
  211. package/dist/services/settingsService.d.ts +9 -4
  212. package/dist/services/settingsService.js +23 -12
  213. package/dist/services/workflowLaunchService.d.ts +74 -0
  214. package/dist/services/workflowLaunchService.js +74 -0
  215. package/dist/skins/drafter.d.ts +30 -0
  216. package/dist/skins/drafter.js +198 -0
  217. package/dist/skins/index.d.ts +2 -1
  218. package/dist/skins/index.js +4 -2
  219. package/dist/stores/apiContext.d.ts +11 -0
  220. package/dist/stores/apiContext.js +15 -0
  221. package/dist/stores/categoriesStore.svelte.js +0 -1
  222. package/dist/stores/historyStore.svelte.d.ts +17 -3
  223. package/dist/stores/historyStore.svelte.js +30 -3
  224. package/dist/stores/instanceContainer.svelte.js +5 -0
  225. package/dist/stores/playgroundStore.svelte.js +1 -3
  226. package/dist/stores/settingsStore.svelte.d.ts +13 -0
  227. package/dist/stores/settingsStore.svelte.js +32 -0
  228. package/dist/stores/workflowStore.svelte.d.ts +42 -5
  229. package/dist/stores/workflowStore.svelte.js +109 -32
  230. package/dist/styles/base.css +285 -14
  231. package/dist/styles/tokens.css +60 -2
  232. package/dist/svelte-app.d.ts +18 -1
  233. package/dist/svelte-app.js +75 -110
  234. package/dist/themes/drafter.d.ts +2 -0
  235. package/dist/themes/drafter.js +15 -0
  236. package/dist/themes/index.d.ts +2 -1
  237. package/dist/themes/index.js +8 -2
  238. package/dist/types/auth.d.ts +9 -51
  239. package/dist/types/auth.js +4 -54
  240. package/dist/types/chat.d.ts +5 -1
  241. package/dist/types/events.d.ts +18 -0
  242. package/dist/types/events.js +2 -1
  243. package/dist/types/index.d.ts +84 -29
  244. package/dist/types/index.js +0 -1
  245. package/dist/types/settings.d.ts +28 -1
  246. package/dist/types/settings.js +6 -3
  247. package/dist/types/skin.d.ts +1 -1
  248. package/dist/types/theme.d.ts +16 -2
  249. package/dist/types/uischema.d.ts +5 -0
  250. package/dist/utils/canvasSelection.d.ts +25 -0
  251. package/dist/utils/canvasSelection.js +37 -0
  252. package/dist/utils/colors.d.ts +27 -0
  253. package/dist/utils/colors.js +23 -0
  254. package/dist/utils/connections.js +20 -56
  255. package/dist/utils/edgeStyling.js +9 -5
  256. package/dist/utils/fetchWithAuth.d.ts +36 -15
  257. package/dist/utils/fetchWithAuth.js +53 -23
  258. package/dist/utils/nodeFormSchema.d.ts +51 -0
  259. package/dist/utils/nodeFormSchema.js +87 -0
  260. package/dist/utils/nodeIds.d.ts +1 -1
  261. package/dist/utils/nodeIds.js +1 -1
  262. package/dist/utils/nodeSwap.js +3 -6
  263. package/dist/utils/nodeTypes.js +1 -1
  264. package/dist/utils/portUtils.d.ts +47 -11
  265. package/dist/utils/portUtils.js +67 -14
  266. package/dist/utils/portal.d.ts +18 -0
  267. package/dist/utils/portal.js +34 -0
  268. package/dist/utils/schemaMerge.d.ts +25 -0
  269. package/dist/utils/schemaMerge.js +61 -0
  270. package/package.json +2 -1
@@ -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
  };
@@ -1,25 +1,46 @@
1
1
  /**
2
- * Fetch authentication utilities
2
+ * Authenticated fetch
3
3
  *
4
- * Shared logic for building HTTP headers with authentication.
5
- * Used by components that make authenticated API requests (e.g., FormAutocomplete).
4
+ * The single fetch path for FlowDrop's per-instance services. It builds request
5
+ * headers (static endpoint headers + the {@link AuthProvider}'s headers + any
6
+ * caller headers) and uniformly applies the auth lifecycle: on `401` it invokes
7
+ * `onUnauthorized()` and — if that reports a successful refresh — retries the
8
+ * request once with freshly fetched headers; on `403` it invokes
9
+ * `onForbidden()`. Callers receive the raw {@link Response} and keep their own
10
+ * status/parse handling.
11
+ *
12
+ * Routing every service through this helper means a configured `AuthProvider`
13
+ * authenticates *and* refreshes consistently — matching the behaviour the typed
14
+ * workflow/node API gets from {@link EnhancedFlowDropApiClient}.
6
15
  *
7
16
  * @module utils/fetchWithAuth
8
17
  */
18
+ import type { EndpointConfig } from '../config/endpoints.js';
9
19
  import type { AuthProvider } from '../types/auth.js';
10
20
  /**
11
- * Build fetch headers with optional authentication
12
- *
13
- * Constructs standard JSON request headers and merges in authentication
14
- * headers from the provided AuthProvider, if available.
21
+ * Options describing how to authenticate and where the base headers come from.
15
22
  *
16
- * @param authProvider - Optional auth provider to get headers from
17
- * @returns Promise resolving to a complete headers object
23
+ * Provide `config` + `endpointKey` to source static endpoint headers (the usual
24
+ * case for endpoint-keyed services), or `baseHeaders` for ad-hoc requests that
25
+ * are not tied to a configured endpoint (e.g. a user-configured autocomplete
26
+ * URL). When neither is given the request carries only JSON defaults plus auth.
27
+ */
28
+ export interface AuthenticatedFetchOptions {
29
+ /** Auth provider supplying `Authorization` etc. and 401/403 lifecycle hooks. */
30
+ authProvider?: AuthProvider;
31
+ /** Endpoint configuration, used with `endpointKey` to look up static headers. */
32
+ config?: EndpointConfig;
33
+ /** Endpoint key identifying which static headers to apply. */
34
+ endpointKey?: string;
35
+ /** Base headers for requests not tied to a configured endpoint. */
36
+ baseHeaders?: Record<string, string>;
37
+ }
38
+ /**
39
+ * Perform an authenticated fetch with consistent 401/403 handling.
18
40
  *
19
- * @example
20
- * ```typescript
21
- * const headers = await buildFetchHeaders(authProvider);
22
- * const response = await fetch(url, { headers });
23
- * ```
41
+ * @param url - The fully-resolved request URL
42
+ * @param init - Standard fetch options (method, body, signal, headers, …)
43
+ * @param opts - Auth provider and header source
44
+ * @returns The raw {@link Response}; callers handle `.ok`/parsing themselves
24
45
  */
25
- export declare function buildFetchHeaders(authProvider?: AuthProvider): Promise<Record<string, string>>;
46
+ export declare function authenticatedFetch(url: string, init?: RequestInit, opts?: AuthenticatedFetchOptions): Promise<Response>;
@@ -1,34 +1,64 @@
1
1
  /**
2
- * Fetch authentication utilities
2
+ * Authenticated fetch
3
3
  *
4
- * Shared logic for building HTTP headers with authentication.
5
- * Used by components that make authenticated API requests (e.g., FormAutocomplete).
4
+ * The single fetch path for FlowDrop's per-instance services. It builds request
5
+ * headers (static endpoint headers + the {@link AuthProvider}'s headers + any
6
+ * caller headers) and uniformly applies the auth lifecycle: on `401` it invokes
7
+ * `onUnauthorized()` and — if that reports a successful refresh — retries the
8
+ * request once with freshly fetched headers; on `403` it invokes
9
+ * `onForbidden()`. Callers receive the raw {@link Response} and keep their own
10
+ * status/parse handling.
11
+ *
12
+ * Routing every service through this helper means a configured `AuthProvider`
13
+ * authenticates *and* refreshes consistently — matching the behaviour the typed
14
+ * workflow/node API gets from {@link EnhancedFlowDropApiClient}.
6
15
  *
7
16
  * @module utils/fetchWithAuth
8
17
  */
18
+ import { getEndpointHeaders } from '../config/endpoints.js';
19
+ const DEFAULT_HEADERS = {
20
+ Accept: 'application/json',
21
+ 'Content-Type': 'application/json'
22
+ };
9
23
  /**
10
- * Build fetch headers with optional authentication
11
- *
12
- * Constructs standard JSON request headers and merges in authentication
13
- * headers from the provided AuthProvider, if available.
14
- *
15
- * @param authProvider - Optional auth provider to get headers from
16
- * @returns Promise resolving to a complete headers object
24
+ * Build the merged header set: base headers < auth headers < per-request headers.
17
25
  *
18
- * @example
19
- * ```typescript
20
- * const headers = await buildFetchHeaders(authProvider);
21
- * const response = await fetch(url, { headers });
22
- * ```
26
+ * Re-invoked for the retry so a refreshed token is picked up.
23
27
  */
24
- export async function buildFetchHeaders(authProvider) {
25
- const headers = {
26
- Accept: 'application/json',
27
- 'Content-Type': 'application/json'
28
- };
29
- if (authProvider) {
30
- const authHeaders = await authProvider.getAuthHeaders();
31
- Object.assign(headers, authHeaders);
28
+ async function buildHeaders(init, opts) {
29
+ const headers = opts.config && opts.endpointKey
30
+ ? getEndpointHeaders(opts.config, opts.endpointKey)
31
+ : { ...DEFAULT_HEADERS, ...opts.baseHeaders };
32
+ if (opts.authProvider) {
33
+ Object.assign(headers, await opts.authProvider.getAuthHeaders());
34
+ }
35
+ if (init.headers) {
36
+ Object.assign(headers, init.headers);
32
37
  }
33
38
  return headers;
34
39
  }
40
+ /**
41
+ * Perform an authenticated fetch with consistent 401/403 handling.
42
+ *
43
+ * @param url - The fully-resolved request URL
44
+ * @param init - Standard fetch options (method, body, signal, headers, …)
45
+ * @param opts - Auth provider and header source
46
+ * @returns The raw {@link Response}; callers handle `.ok`/parsing themselves
47
+ */
48
+ export async function authenticatedFetch(url, init = {}, opts = {}) {
49
+ const headers = await buildHeaders(init, opts);
50
+ let response = await fetch(url, { ...init, headers });
51
+ // 401 → let the provider refresh, then retry once with fresh headers.
52
+ if (response.status === 401 && opts.authProvider?.onUnauthorized) {
53
+ const refreshed = await opts.authProvider.onUnauthorized();
54
+ if (refreshed) {
55
+ const retryHeaders = await buildHeaders(init, opts);
56
+ response = await fetch(url, { ...init, headers: retryHeaders });
57
+ }
58
+ }
59
+ // 403 → notify the provider (e.g. surface a permission error).
60
+ if (response.status === 403 && opts.authProvider?.onForbidden) {
61
+ await opts.authProvider.onForbidden();
62
+ }
63
+ return response;
64
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Node-level form contributions — the config fields the *editor* owns for every
3
+ * node, independent of what the node type's own `configSchema` declares.
4
+ *
5
+ * Today that is the port order + exposure widget bound to the reserved
6
+ * `config.ports` key (see {@link PORTS_CONFIG_KEY}). It is a library feature —
7
+ * `PortsConfig` is read by the canvas, not by the engine — so the library
8
+ * injects it rather than expecting every backend to serve it.
9
+ *
10
+ * Why this matters beyond convenience: `ConfigForm` renders its whole form only
11
+ * when it has a schema, so a node type contributing no `configSchema` used to
12
+ * fall straight through to "No configuration options available" and lose the
13
+ * node-level settings with it (#34). Injecting here gives such a node a schema,
14
+ * and the panel something to render.
15
+ *
16
+ * Kept as pure functions so they can be unit-tested directly against the same
17
+ * code `ConfigForm` runs, rather than through the component.
18
+ */
19
+ import type { ConfigSchema, WorkflowNode } from '../types/index.js';
20
+ import type { UISchemaElement } from '../types/uischema.js';
21
+ /**
22
+ * Reserved config key holding the instance's `PortsConfig` (per-direction
23
+ * ordered port list with optional exposure overrides).
24
+ */
25
+ export declare const PORTS_CONFIG_KEY = "ports";
26
+ /**
27
+ * Append the reserved `ports` property to a node's effective config schema.
28
+ *
29
+ * A no-op when there is no node (the standalone `schema`/`values` mode), when
30
+ * the schema already declares `ports` (a backend that serves the field itself
31
+ * stays authoritative), or when the node has no ports to configure — in which
32
+ * case a schema-less node keeps falling through to the empty state, as it
33
+ * should.
34
+ *
35
+ * @returns The schema to render — `base` untouched, or a copy with the field
36
+ * appended (last, so it renders below the node type's own fields).
37
+ */
38
+ export declare function withPortsField(base: ConfigSchema | undefined, node: WorkflowNode | undefined): ConfigSchema | undefined;
39
+ /**
40
+ * Mirror {@link withPortsField} in the UI schema.
41
+ *
42
+ * The UISchema renderer draws only the controls the tree lists, so an injected
43
+ * property is invisible unless a control is added for it. Wraps the authored
44
+ * tree and the new control in a `VerticalLayout`, keeping the author's layout
45
+ * intact and putting the ports control in its own collapsible group below it.
46
+ *
47
+ * @param uiSchema - The authored UI schema, if any. When absent, nothing to do:
48
+ * `ConfigForm` renders the schema's properties flat and picks the field up.
49
+ * @param injected - Whether {@link withPortsField} actually added the property.
50
+ */
51
+ export declare function withPortsControl(uiSchema: UISchemaElement | undefined, injected: boolean): UISchemaElement | undefined;
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Reserved config key holding the instance's `PortsConfig` (per-direction
3
+ * ordered port list with optional exposure overrides).
4
+ */
5
+ export const PORTS_CONFIG_KEY = 'ports';
6
+ /** Config properties whose presence means the node can grow ports at runtime. */
7
+ const DYNAMIC_PORT_KEYS = ['dynamicInputs', 'dynamicOutputs'];
8
+ /**
9
+ * Whether the node has anything for the ports widget to show: a static
10
+ * metadata port, or a config field through which the author adds dynamic ones.
11
+ *
12
+ * Deliberately reads only `metadata` and the schema — never `data.config`.
13
+ * `ConfigForm` drops its in-flight `edits` buffer whenever the effective schema
14
+ * changes identity, so a decision that moved with config values would discard a
15
+ * user's half-typed edit the moment it flipped.
16
+ */
17
+ function hasConfigurablePorts(node, schema) {
18
+ const meta = node.data.metadata;
19
+ if ((meta?.inputs?.length ?? 0) > 0 || (meta?.outputs?.length ?? 0) > 0)
20
+ return true;
21
+ const properties = schema?.properties;
22
+ if (!properties)
23
+ return false;
24
+ return DYNAMIC_PORT_KEYS.some((key) => key in properties);
25
+ }
26
+ /**
27
+ * Append the reserved `ports` property to a node's effective config schema.
28
+ *
29
+ * A no-op when there is no node (the standalone `schema`/`values` mode), when
30
+ * the schema already declares `ports` (a backend that serves the field itself
31
+ * stays authoritative), or when the node has no ports to configure — in which
32
+ * case a schema-less node keeps falling through to the empty state, as it
33
+ * should.
34
+ *
35
+ * @returns The schema to render — `base` untouched, or a copy with the field
36
+ * appended (last, so it renders below the node type's own fields).
37
+ */
38
+ export function withPortsField(base, node) {
39
+ if (!node)
40
+ return base;
41
+ if (base?.properties && PORTS_CONFIG_KEY in base.properties)
42
+ return base;
43
+ if (!hasConfigurablePorts(node, base))
44
+ return base;
45
+ return {
46
+ ...(base ?? { type: 'object', properties: {} }),
47
+ properties: {
48
+ ...(base?.properties ?? {}),
49
+ [PORTS_CONFIG_KEY]: {
50
+ type: 'object',
51
+ // The signal FormField/FormFieldLight match to render <FormPorts>.
52
+ format: 'ports',
53
+ title: 'Ports',
54
+ description: 'Order the node’s ports and choose which ones are exposed.'
55
+ }
56
+ }
57
+ };
58
+ }
59
+ /**
60
+ * Mirror {@link withPortsField} in the UI schema.
61
+ *
62
+ * The UISchema renderer draws only the controls the tree lists, so an injected
63
+ * property is invisible unless a control is added for it. Wraps the authored
64
+ * tree and the new control in a `VerticalLayout`, keeping the author's layout
65
+ * intact and putting the ports control in its own collapsible group below it.
66
+ *
67
+ * @param uiSchema - The authored UI schema, if any. When absent, nothing to do:
68
+ * `ConfigForm` renders the schema's properties flat and picks the field up.
69
+ * @param injected - Whether {@link withPortsField} actually added the property.
70
+ */
71
+ export function withPortsControl(uiSchema, injected) {
72
+ if (!uiSchema || !injected)
73
+ return uiSchema;
74
+ return {
75
+ type: 'VerticalLayout',
76
+ elements: [
77
+ uiSchema,
78
+ {
79
+ type: 'Group',
80
+ label: 'Ports',
81
+ collapsible: true,
82
+ defaultOpen: false,
83
+ elements: [{ type: 'Control', scope: `#/properties/${PORTS_CONFIG_KEY}` }]
84
+ }
85
+ ]
86
+ };
87
+ }
@@ -12,7 +12,7 @@ interface NodeWithMetadata {
12
12
  id: string;
13
13
  data?: {
14
14
  metadata?: {
15
- id?: string;
15
+ node_type_id?: string;
16
16
  };
17
17
  };
18
18
  }
@@ -11,7 +11,7 @@
11
11
  export function generateNodeId(nodeTypeId, existingNodes) {
12
12
  // Count how many nodes of this type already exist
13
13
  const existingNodeIds = existingNodes
14
- .filter((node) => node.data?.metadata?.id === nodeTypeId)
14
+ .filter((node) => node.data?.metadata?.node_type_id === nodeTypeId)
15
15
  .map((node) => node.id);
16
16
  // Extract the numbers from existing IDs with the same prefix
17
17
  const existingNumbers = existingNodeIds
@@ -176,9 +176,6 @@ export function executeSwap(oldNode, newMetadata, preview, allNodes, allEdges) {
176
176
  label: newMetadata.name,
177
177
  config: mappedConfig,
178
178
  metadata: newMetadata,
179
- // Node components derive their handle IDs from data.nodeId — without it
180
- // every edge anchored to this node silently disappears from the canvas.
181
- nodeId: newNodeId,
182
179
  extensions
183
180
  }
184
181
  };
@@ -218,7 +215,7 @@ export function executeSwap(oldNode, newMetadata, preview, allNodes, allEdges) {
218
215
  * @returns The newer NodeMetadata if an upgrade is available, null otherwise
219
216
  */
220
217
  export function getVersionUpgrade(currentMetadata, allNodeTypes) {
221
- const available = allNodeTypes.find((n) => n.id === currentMetadata.id);
218
+ const available = allNodeTypes.find((n) => n.node_type_id === currentMetadata.node_type_id);
222
219
  if (!available)
223
220
  return null;
224
221
  if (compareSemver(available.version, currentMetadata.version) > 0) {
@@ -253,7 +250,7 @@ function classifyMatch(oldPort, matchedPort) {
253
250
  export function computeSwapPreviewWithOptions(oldNode, newMetadata, edges, allNodes, options) {
254
251
  const checker = options.checker ?? null;
255
252
  const oldNodeId = oldNode.id;
256
- const newNodeId = generateNodeId(newMetadata.id, allNodes);
253
+ const newNodeId = generateNodeId(newMetadata.node_type_id, allNodes);
257
254
  // Collect connected edges
258
255
  const connectedEdges = edges.filter((e) => e.source === oldNodeId || e.target === oldNodeId);
259
256
  // Try strategy-based port mapping
@@ -420,7 +417,7 @@ export function computeSwapPreviewWithOptions(oldNode, newMetadata, edges, allNo
420
417
  */
421
418
  export function computeInteractiveState(oldNode, newMetadata, edges, allNodes, options = {}) {
422
419
  const oldNodeId = oldNode.id;
423
- const newNodeId = generateNodeId(newMetadata.id, allNodes);
420
+ const newNodeId = generateNodeId(newMetadata.node_type_id, allNodes);
424
421
  const connectedEdges = edges.filter((e) => e.source === oldNodeId || e.target === oldNodeId);
425
422
  // Compute the base preview to get auto-matched ports
426
423
  const preview = computeSwapPreviewWithOptions(oldNode, newMetadata, edges, allNodes, options);
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * Works with both built-in types and custom registered types.
11
11
  */
12
- import { resolveBuiltinAlias, isBuiltinType } from '../registry/builtinNodes.js';
12
+ import { resolveBuiltinAlias, isBuiltinType } from '../registry/builtinNodeTypes.js';
13
13
  /**
14
14
  * Display names for built-in node types.
15
15
  */
@@ -1,9 +1,46 @@
1
- import type { NodePort } from '../types/index.js';
1
+ import type { NodePort, PortConfigEntry, PortsConfig } from '../types/index.js';
2
+ /**
3
+ * Default sort weight applied to reserved ports (the `error` output and the
4
+ * `trigger`/`tool` control-flow ports) that don't set an explicit
5
+ * `displayOrder`. High enough to sink them below author-declared ports, which
6
+ * default to `0`. The single home for the "high weight" the docs refer to — an
7
+ * explicit `displayOrder` on the port still overrides it.
8
+ */
9
+ export declare const RESERVED_PORT_DISPLAY_ORDER = 100;
10
+ /**
11
+ * Whether a port is a reserved one that should default to the bottom of its
12
+ * direction: the reserved `error` output, or a `trigger`/`tool` control-flow
13
+ * port (identified by data type, mirroring the port config's control types).
14
+ */
15
+ export declare function isReservedPort(port: {
16
+ id: string;
17
+ type?: string;
18
+ dataType?: string;
19
+ }): boolean;
2
20
  /**
3
21
  * Sort ports by an ordered array of port IDs.
4
22
  * Ports not listed appear at the end in their original order.
5
23
  */
6
24
  export declare function applyPortOrder(ports: NodePort[], orderedIds: string[] | undefined): NodePort[];
25
+ /**
26
+ * Sort ports by their effective `displayOrder` weight (ascending), breaking ties
27
+ * on declaration order (stable). This is the default order before any
28
+ * instance-level reordering — reserved ports (trigger/tool/error) carry a high
29
+ * default weight so they land at the bottom without authors hand-setting it.
30
+ */
31
+ export declare function byDefaultOrder(ports: NodePort[]): NodePort[];
32
+ /**
33
+ * Effective render order for a direction: the metadata default order, then the
34
+ * instance's `ports` config override (listed ports first in their stored order,
35
+ * the rest following in default order).
36
+ */
37
+ export declare function orderPortsFor(ports: NodePort[], entries: PortConfigEntry[] | undefined): NodePort[];
38
+ /**
39
+ * Effective exposure for a port: the instance's explicit `exposed` override if
40
+ * present, else the port's metadata `exposedByDefault` (which itself defaults to
41
+ * exposed).
42
+ */
43
+ export declare function isPortExposed(port: NodePort, entries: PortConfigEntry[] | undefined): boolean;
7
44
  /**
8
45
  * Compute the CSS `top` offset (px) for a port handle.
9
46
  * - 1 port: centered at 40px
@@ -11,14 +48,13 @@ export declare function applyPortOrder(ports: NodePort[], orderedIds: string[] |
11
48
  */
12
49
  export declare function getPortTop(index: number, count: number): number;
13
50
  /**
14
- * Determine whether a port should be rendered.
51
+ * Whether a port is exposed, and so rendered on the canvas.
52
+ *
53
+ * In v2 exposure is semantic, not cosmetic: a not-exposed port is hidden, not
54
+ * wireable, and not runtime-overridable. Effective exposure is the instance's
55
+ * explicit `data.config.ports` override for the port, falling back to the port's
56
+ * metadata `exposedByDefault` (which itself defaults to exposed).
15
57
  *
16
- * Priority:
17
- * 1. Manual hide (`hiddenPorts`) — always wins, regardless of connections
18
- * 2. `hideUnconnectedHandles` — hide if not present in the connected handles set
19
- * 3. Default — visible
20
- */
21
- export declare function isPortVisible(port: NodePort, direction: 'input' | 'output', hiddenPorts: {
22
- inputs?: string[];
23
- outputs?: string[];
24
- }, hideUnconnectedHandles: boolean, connectedHandles: Set<string>, nodeId: string | undefined): boolean;
58
+ * @see .claude/plans/exposed-ports.md
59
+ */
60
+ export declare function isPortVisible(port: NodePort, direction: 'input' | 'output', ports: PortsConfig | undefined): boolean;
@@ -1,3 +1,27 @@
1
+ import { isErrorPort } from './colors.js';
2
+ /**
3
+ * Default sort weight applied to reserved ports (the `error` output and the
4
+ * `trigger`/`tool` control-flow ports) that don't set an explicit
5
+ * `displayOrder`. High enough to sink them below author-declared ports, which
6
+ * default to `0`. The single home for the "high weight" the docs refer to — an
7
+ * explicit `displayOrder` on the port still overrides it.
8
+ */
9
+ export const RESERVED_PORT_DISPLAY_ORDER = 100;
10
+ /**
11
+ * Whether a port is a reserved one that should default to the bottom of its
12
+ * direction: the reserved `error` output, or a `trigger`/`tool` control-flow
13
+ * port (identified by data type, mirroring the port config's control types).
14
+ */
15
+ export function isReservedPort(port) {
16
+ return isErrorPort(port) || port.dataType === 'trigger' || port.dataType === 'tool';
17
+ }
18
+ /**
19
+ * The port's effective default sort weight: its explicit `displayOrder` if set,
20
+ * else a high weight for reserved ports, else `0`.
21
+ */
22
+ function defaultWeight(port) {
23
+ return port.displayOrder ?? (isReservedPort(port) ? RESERVED_PORT_DISPLAY_ORDER : 0);
24
+ }
1
25
  /**
2
26
  * Sort ports by an ordered array of port IDs.
3
27
  * Ports not listed appear at the end in their original order.
@@ -13,6 +37,38 @@ export function applyPortOrder(ports, orderedIds) {
13
37
  return aIdx === bIdx ? 0 : aIdx - bIdx;
14
38
  });
15
39
  }
40
+ /**
41
+ * Sort ports by their effective `displayOrder` weight (ascending), breaking ties
42
+ * on declaration order (stable). This is the default order before any
43
+ * instance-level reordering — reserved ports (trigger/tool/error) carry a high
44
+ * default weight so they land at the bottom without authors hand-setting it.
45
+ */
46
+ export function byDefaultOrder(ports) {
47
+ return ports
48
+ .map((port, index) => ({ port, index }))
49
+ .sort((a, b) => defaultWeight(a.port) - defaultWeight(b.port) || a.index - b.index)
50
+ .map(({ port }) => port);
51
+ }
52
+ /**
53
+ * Effective render order for a direction: the metadata default order, then the
54
+ * instance's `ports` config override (listed ports first in their stored order,
55
+ * the rest following in default order).
56
+ */
57
+ export function orderPortsFor(ports, entries) {
58
+ const base = byDefaultOrder(ports);
59
+ return applyPortOrder(base, entries?.map((entry) => entry.id));
60
+ }
61
+ /**
62
+ * Effective exposure for a port: the instance's explicit `exposed` override if
63
+ * present, else the port's metadata `exposedByDefault` (which itself defaults to
64
+ * exposed).
65
+ */
66
+ export function isPortExposed(port, entries) {
67
+ const entry = entries?.find((candidate) => candidate.id === port.id);
68
+ if (entry && entry.exposed !== undefined)
69
+ return entry.exposed;
70
+ return port.exposedByDefault ?? true;
71
+ }
16
72
  /**
17
73
  * Compute the CSS `top` offset (px) for a port handle.
18
74
  * - 1 port: centered at 40px
@@ -24,19 +80,16 @@ export function getPortTop(index, count) {
24
80
  return 20 + index * 40;
25
81
  }
26
82
  /**
27
- * Determine whether a port should be rendered.
83
+ * Whether a port is exposed, and so rendered on the canvas.
28
84
  *
29
- * Priority:
30
- * 1. Manual hide (`hiddenPorts`) — always wins, regardless of connections
31
- * 2. `hideUnconnectedHandles` — hide if not present in the connected handles set
32
- * 3. Default — visible
33
- */
34
- export function isPortVisible(port, direction, hiddenPorts, hideUnconnectedHandles, connectedHandles, nodeId) {
35
- const hiddenList = direction === 'input' ? hiddenPorts.inputs : hiddenPorts.outputs;
36
- if (hiddenList?.includes(port.id))
37
- return false;
38
- if (hideUnconnectedHandles) {
39
- return connectedHandles.has(`${nodeId}-${direction}-${port.id}`);
40
- }
41
- return true;
85
+ * In v2 exposure is semantic, not cosmetic: a not-exposed port is hidden, not
86
+ * wireable, and not runtime-overridable. Effective exposure is the instance's
87
+ * explicit `data.config.ports` override for the port, falling back to the port's
88
+ * metadata `exposedByDefault` (which itself defaults to exposed).
89
+ *
90
+ * @see .claude/plans/exposed-ports.md
91
+ */
92
+ export function isPortVisible(port, direction, ports) {
93
+ const entries = direction === 'input' ? ports?.inputs : ports?.outputs;
94
+ return isPortExposed(port, entries);
42
95
  }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Svelte action that relocates an element to `document.body` (or another
3
+ * target) for its lifetime, then removes it on destroy.
4
+ *
5
+ * Modals and overlays use `position: fixed` expecting the viewport as their
6
+ * containing block. When any ancestor establishes a containing block — via
7
+ * `transform`, `filter`, `backdrop-filter`, `will-change`, `contain`, etc. —
8
+ * `fixed` resolves against that ancestor instead, causing clipping and
9
+ * mis-centering. Portalling the node to `document.body` sidesteps this by
10
+ * escaping those ancestors entirely.
11
+ *
12
+ * Usage: `<div use:portal>…</div>` or `<div use:portal={targetElement}>…</div>`.
13
+ * No-op during SSR (no `document`).
14
+ */
15
+ export declare function portal(node: HTMLElement, target?: HTMLElement | undefined): {
16
+ update(nextTarget: HTMLElement | undefined): void;
17
+ destroy(): void;
18
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Svelte action that relocates an element to `document.body` (or another
3
+ * target) for its lifetime, then removes it on destroy.
4
+ *
5
+ * Modals and overlays use `position: fixed` expecting the viewport as their
6
+ * containing block. When any ancestor establishes a containing block — via
7
+ * `transform`, `filter`, `backdrop-filter`, `will-change`, `contain`, etc. —
8
+ * `fixed` resolves against that ancestor instead, causing clipping and
9
+ * mis-centering. Portalling the node to `document.body` sidesteps this by
10
+ * escaping those ancestors entirely.
11
+ *
12
+ * Usage: `<div use:portal>…</div>` or `<div use:portal={targetElement}>…</div>`.
13
+ * No-op during SSR (no `document`).
14
+ */
15
+ export function portal(node, target = undefined) {
16
+ let host = null;
17
+ function mount(to) {
18
+ if (typeof document === 'undefined')
19
+ return;
20
+ host = to ?? document.body;
21
+ host.appendChild(node);
22
+ }
23
+ mount(target);
24
+ return {
25
+ update(nextTarget) {
26
+ mount(nextTarget);
27
+ },
28
+ destroy() {
29
+ if (node.parentNode) {
30
+ node.parentNode.removeChild(node);
31
+ }
32
+ }
33
+ };
34
+ }