@flowdrop/flowdrop 2.10.1 → 2.11.0

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 (170) hide show
  1. package/CHANGELOG.md +162 -0
  2. package/dist/components/App.svelte +112 -29
  3. package/dist/components/ConfigForm.svelte +5 -5
  4. package/dist/components/ConfigModal.svelte +2 -2
  5. package/dist/components/ConfigModal.svelte.d.ts +1 -1
  6. package/dist/components/ConnectionLine.svelte +1 -1
  7. package/dist/components/LogsSidebar.svelte +15 -12
  8. package/dist/components/MarkdownDisplay.svelte +1 -1
  9. package/dist/components/PipelineStatus.svelte +5 -18
  10. package/dist/components/SchemaForm.svelte +1 -1
  11. package/dist/components/SettingsModal.svelte +1 -1
  12. package/dist/components/SettingsPanel.svelte +1 -1
  13. package/dist/components/WorkflowEditor.svelte +63 -37
  14. package/dist/components/WorkflowInterfaceEditor.svelte +43 -8
  15. package/dist/components/WorkflowInterfaceEditor.svelte.d.ts +12 -1
  16. package/dist/components/WorkflowInterfaceEntryCard.svelte +117 -44
  17. package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +14 -1
  18. package/dist/components/WorkflowPlaygroundSettings.svelte +551 -0
  19. package/dist/components/WorkflowPlaygroundSettings.svelte.d.ts +20 -0
  20. package/dist/components/chat/AIChatPanel.svelte +1 -1
  21. package/dist/components/form/index.d.ts +2 -2
  22. package/dist/components/form/index.js +2 -2
  23. package/dist/components/nodes/ToolNode.svelte +1 -1
  24. package/dist/components/playground/ControlPanel.svelte +30 -0
  25. package/dist/components/playground/ControlPanel.svelte.d.ts +5 -0
  26. package/dist/components/playground/Playground.svelte +94 -42
  27. package/dist/components/playground/PlaygroundApp.svelte +1 -1
  28. package/dist/components/playground/PlaygroundModal.svelte +1 -1
  29. package/dist/components/playground/PlaygroundStudio.svelte +1 -1
  30. package/dist/core/index.d.ts +1 -1
  31. package/dist/helpers/workflowEditorHelper.d.ts +12 -0
  32. package/dist/helpers/workflowEditorHelper.js +31 -0
  33. package/dist/messages/defaults.d.ts +53 -0
  34. package/dist/messages/defaults.js +48 -2
  35. package/dist/openapi/v1/openapi.yaml +113 -5
  36. package/dist/playground/index.d.ts +3 -1
  37. package/dist/playground/index.js +2 -1
  38. package/dist/playground/mount.d.ts +6 -10
  39. package/dist/playground/mount.js +43 -24
  40. package/dist/schemas/index.js +1 -1
  41. package/dist/schemas/v1/workflow.schema.json +140 -2
  42. package/dist/services/globalSave.js +11 -1
  43. package/dist/services/playgroundService.d.ts +6 -1
  44. package/dist/services/playgroundService.js +5 -0
  45. package/dist/skins/default.d.ts +1 -1
  46. package/dist/skins/drafter.d.ts +1 -1
  47. package/dist/skins/index.d.ts +4 -4
  48. package/dist/skins/index.js +3 -3
  49. package/dist/skins/slate.d.ts +1 -1
  50. package/dist/stores/instanceContainer.svelte.d.ts +15 -0
  51. package/dist/stores/instanceContainer.svelte.js +11 -1
  52. package/dist/stores/playgroundStore.svelte.d.ts +8 -0
  53. package/dist/stores/playgroundStore.svelte.js +18 -4
  54. package/dist/stores/workflowStore.svelte.d.ts +4 -1
  55. package/dist/stores/workflowStore.svelte.js +8 -1
  56. package/dist/styles/base.css +14 -3
  57. package/dist/styles/tokenAliases.d.ts +13 -0
  58. package/dist/styles/tokenAliases.js +89 -0
  59. package/dist/themes/scopedSkinCss.d.ts +30 -0
  60. package/dist/themes/scopedSkinCss.js +95 -0
  61. package/dist/types/index.d.ts +86 -4
  62. package/dist/types/index.js +15 -3
  63. package/dist/types/skin.d.ts +2 -2
  64. package/dist/utils/playgroundChat.d.ts +121 -0
  65. package/dist/utils/playgroundChat.js +275 -0
  66. package/dist/utils/portal.d.ts +8 -0
  67. package/dist/utils/portal.js +15 -0
  68. package/dist/utils/workflowInterface.d.ts +88 -20
  69. package/dist/utils/workflowInterface.js +179 -18
  70. package/dist/webmcp/WebMCPConfirm.svelte +68 -18
  71. package/dist/webmcp/gate.d.ts +6 -0
  72. package/dist/webmcp/gate.js +4 -0
  73. package/dist/webmcp/runtime.js +2 -1
  74. package/package.json +7 -6
  75. package/dist/components/Button.stories.svelte +0 -65
  76. package/dist/components/Button.stories.svelte.d.ts +0 -19
  77. package/dist/components/CanvasBanner.stories.svelte +0 -30
  78. package/dist/components/CanvasBanner.stories.svelte.d.ts +0 -27
  79. package/dist/components/CanvasContextMenu.stories.svelte +0 -63
  80. package/dist/components/CanvasContextMenu.stories.svelte.d.ts +0 -19
  81. package/dist/components/ConfigPanel.stories.svelte +0 -47
  82. package/dist/components/ConfigPanel.stories.svelte.d.ts +0 -27
  83. package/dist/components/EditorStatusBar.stories.svelte +0 -44
  84. package/dist/components/EditorStatusBar.stories.svelte.d.ts +0 -27
  85. package/dist/components/FlowDropEdge.stories.svelte +0 -197
  86. package/dist/components/FlowDropEdge.stories.svelte.d.ts +0 -26
  87. package/dist/components/LoadingSpinner.stories.svelte +0 -30
  88. package/dist/components/LoadingSpinner.stories.svelte.d.ts +0 -27
  89. package/dist/components/Logo.stories.svelte +0 -22
  90. package/dist/components/Logo.stories.svelte.d.ts +0 -27
  91. package/dist/components/MarkdownDisplay.stories.svelte +0 -38
  92. package/dist/components/MarkdownDisplay.stories.svelte.d.ts +0 -27
  93. package/dist/components/Navbar.stories.svelte +0 -58
  94. package/dist/components/Navbar.stories.svelte.d.ts +0 -27
  95. package/dist/components/NodeStatusOverlay.stories.svelte +0 -85
  96. package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +0 -27
  97. package/dist/components/SchemaForm.stories.svelte +0 -122
  98. package/dist/components/SchemaForm.stories.svelte.d.ts +0 -27
  99. package/dist/components/StatusIcon.stories.svelte +0 -60
  100. package/dist/components/StatusIcon.stories.svelte.d.ts +0 -27
  101. package/dist/components/StatusLabel.stories.svelte +0 -17
  102. package/dist/components/StatusLabel.stories.svelte.d.ts +0 -27
  103. package/dist/components/ThemeToggle.stories.svelte +0 -25
  104. package/dist/components/ThemeToggle.stories.svelte.d.ts +0 -27
  105. package/dist/components/console/CommandConsole.stories.svelte +0 -111
  106. package/dist/components/console/CommandConsole.stories.svelte.d.ts +0 -27
  107. package/dist/components/form/FormCheckboxGroup.stories.svelte +0 -28
  108. package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +0 -27
  109. package/dist/components/form/FormFieldWrapper.stories.svelte +0 -53
  110. package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +0 -27
  111. package/dist/components/form/FormNumberField.stories.svelte +0 -36
  112. package/dist/components/form/FormNumberField.stories.svelte.d.ts +0 -27
  113. package/dist/components/form/FormRangeField.stories.svelte +0 -31
  114. package/dist/components/form/FormRangeField.stories.svelte.d.ts +0 -27
  115. package/dist/components/form/FormSelect.stories.svelte +0 -50
  116. package/dist/components/form/FormSelect.stories.svelte.d.ts +0 -27
  117. package/dist/components/form/FormTextField.stories.svelte +0 -30
  118. package/dist/components/form/FormTextField.stories.svelte.d.ts +0 -27
  119. package/dist/components/form/FormTextarea.stories.svelte +0 -34
  120. package/dist/components/form/FormTextarea.stories.svelte.d.ts +0 -27
  121. package/dist/components/form/FormToggle.stories.svelte +0 -30
  122. package/dist/components/form/FormToggle.stories.svelte.d.ts +0 -27
  123. package/dist/components/interrupt/ChoicePrompt.stories.svelte +0 -68
  124. package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +0 -27
  125. package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +0 -71
  126. package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +0 -27
  127. package/dist/components/interrupt/ReviewPrompt.stories.svelte +0 -77
  128. package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +0 -27
  129. package/dist/components/interrupt/TextInputPrompt.stories.svelte +0 -51
  130. package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +0 -27
  131. package/dist/components/nodes/CaptionNode.stories.svelte +0 -65
  132. package/dist/components/nodes/CaptionNode.stories.svelte.d.ts +0 -18
  133. package/dist/components/nodes/GatewayNode.stories.svelte +0 -108
  134. package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +0 -26
  135. package/dist/components/nodes/IdeaNode.stories.svelte +0 -52
  136. package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +0 -26
  137. package/dist/components/nodes/NotesNode.stories.svelte +0 -76
  138. package/dist/components/nodes/NotesNode.stories.svelte.d.ts +0 -26
  139. package/dist/components/nodes/SimpleNode.stories.svelte +0 -223
  140. package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +0 -26
  141. package/dist/components/nodes/SquareNode.stories.svelte +0 -127
  142. package/dist/components/nodes/SquareNode.stories.svelte.d.ts +0 -26
  143. package/dist/components/nodes/TerminalNode.stories.svelte +0 -25
  144. package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +0 -26
  145. package/dist/components/nodes/ToolNode.stories.svelte +0 -189
  146. package/dist/components/nodes/ToolNode.stories.svelte.d.ts +0 -26
  147. package/dist/components/nodes/WorkflowNode.stories.svelte +0 -188
  148. package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +0 -26
  149. package/dist/components/playground/MessageBubble.stories.svelte +0 -151
  150. package/dist/components/playground/MessageBubble.stories.svelte.d.ts +0 -27
  151. package/dist/mocks/app-environment.d.ts +0 -8
  152. package/dist/mocks/app-environment.js +0 -16
  153. package/dist/mocks/app-forms.d.ts +0 -6
  154. package/dist/mocks/app-forms.js +0 -29
  155. package/dist/mocks/app-navigation.d.ts +0 -5
  156. package/dist/mocks/app-navigation.js +0 -36
  157. package/dist/mocks/app-stores.d.ts +0 -14
  158. package/dist/mocks/app-stores.js +0 -26
  159. package/dist/stories/CanvasDecorator.svelte +0 -49
  160. package/dist/stories/CanvasDecorator.svelte.d.ts +0 -8
  161. package/dist/stories/EdgeDecorator.svelte +0 -125
  162. package/dist/stories/EdgeDecorator.svelte.d.ts +0 -17
  163. package/dist/stories/NodeDecorator.svelte +0 -75
  164. package/dist/stories/NodeDecorator.svelte.d.ts +0 -8
  165. package/dist/stories/WebMCPFakeAgent.svelte +0 -229
  166. package/dist/stories/WebMCPFakeAgent.svelte.d.ts +0 -10
  167. package/dist/stories/utils.d.ts +0 -93
  168. package/dist/stories/utils.js +0 -156
  169. package/dist/webmcp/WebMCP.stories.svelte +0 -101
  170. package/dist/webmcp/WebMCP.stories.svelte.d.ts +0 -18
package/CHANGELOG.md CHANGED
@@ -5,6 +5,168 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.11.0] - 2026-10-07
9
+
10
+ ### Added
11
+
12
+ - Playground settings: a workflow's chat binding now lives in its own
13
+ `playground` key instead of `turn` on interface entries. The binding says
14
+ which interface input the chat message goes to, which input receives recent
15
+ messages (and how many), which inputs receive the session and message IDs,
16
+ which node output ports print as replies, and whether sub-workflows print
17
+ their own replies. New types `WorkflowPlayground`, `PlaygroundChatBinding`,
18
+ `PlaygroundReplyPort` and `PlaygroundChatSource` (from `core`), and from
19
+ `playground`: `resolvePlaygroundChat` (the binding in effect and where it
20
+ came from, `ResolvedPlaygroundChat`), `playgroundChatIssues` (what is wrong
21
+ with a binding, `PlaygroundChatIssue`, `PlaygroundChatInputKey`) and
22
+ `PlaygroundStore.chatBinding`. A server from FlowDrop
23
+ 2.7.0 on sends `playground: {chat, resolved, source}` with every workflow and
24
+ saves `playground.chat` with it. `chat: null` means the workflow has no chat
25
+ until somebody sets it up.
26
+ - The workflow settings surface gains a **Playground** tab beside Settings and
27
+ Interface. It is shown only when the workflow carries Playground settings, so
28
+ older backends never see it. It has Message goes to, History goes to (with a
29
+ message count), Session and message IDs, Print as replies, and the
30
+ sub-workflow switch. It also has a _Not set up_ state, a warning when a
31
+ message input is bound but no reply is, and inline errors for an input that
32
+ is no longer on the interface or a reply on a node or port that is gone. A
33
+ workflow that still chats through interface `turn` marks gets a **Move them
34
+ here** button: it writes the binding they declare and removes the marks in
35
+ one undoable step. Until then the fields show what the marks set up, and the
36
+ first edit moves them too, so a single change never switches the chat off
37
+ and clearing every field really means no chat. A turn value this library
38
+ does not know (from a newer server) stays on the interface. An invalid
39
+ message count is refused with a reason instead of falling back to 10.
40
+ Problems are worded through the message catalogue
41
+ (`playgroundSettings.issues`); an issue's `message` stays English for logs
42
+ and agents. Renaming an interface input renames it in the binding, and
43
+ removing one unbinds it, in the same undo step. Emptying an input's id puts
44
+ the old one back, since an input needs an id. A node swap moves replies to
45
+ the new node's mapped output. A reply on an output that is not exposed on
46
+ the canvas is listed like any other. When settings are stored but the
47
+ interface still carries `turn` marks, the tab says they are ignored and
48
+ offers **Remove them**; any edit in the tab removes them too, so clearing
49
+ the binding (there, or by removing its last input on the interface) never
50
+ falls back to them.
51
+ Edits mark the workflow dirty and are saved with it.
52
+ - The Playground shows one line, _No chat yet…_, when the workflow's settings
53
+ bind no chat. The form or the Run button still work. It shows _Nothing will
54
+ reply here…_ when a message input is bound but no reply is. A stored binding
55
+ that no longer binds anything (its inputs were removed) gets the _No chat
56
+ yet…_ line too.
57
+
58
+ ### Changed
59
+
60
+ - The Playground picks its input mode from the workflow's Playground settings,
61
+ then from deprecated interface `turn` marks. `legacy` (guess from the nodes)
62
+ is now used only for a workflow without a `playground` key, that is a server
63
+ before FlowDrop 2.7.0 whose interface declares no `turn`. With the key
64
+ present, a workflow that binds no message input gets a form or Run, never
65
+ `legacy`. `resolvePlaygroundInputMode` and `interfaceFormEntries` take the
66
+ settings as an optional second argument. Existing calls behave as before.
67
+ While the chat comes from `turn` marks, an input marked with a `turn` value
68
+ this library does not know (a newer server's) stays out of the form, as it
69
+ did before.
70
+ - Save and export send `playground: {chat}` when the workflow has a
71
+ `playground` key, and send nothing for it otherwise.
72
+ - `fd.workflow.batchUpdate` accepts `playground`, keyed on presence like
73
+ `interface`.
74
+ - When the host passes a workflow without `interface` or `playground`, the
75
+ Playground loads it and takes only the missing keys. A key the host passed
76
+ is its live copy (the editor's, unsaved edits and all) and is never replaced
77
+ by the saved one. Once a server has sent a workflow without `playground`
78
+ (before FlowDrop 2.7.0), the Playground stops asking it for one for the rest
79
+ of the page.
80
+ - The API spec's turn request no longer says a workflow with no chat binding
81
+ still takes `content`: from FlowDrop 2.7.0 it is form-only, and nothing is
82
+ guessed from its nodes.
83
+ - The mock backend checks `playground.chat` on save against the interface and
84
+ nodes in the same save, with `playgroundChatIssues`, and stores the saved
85
+ interface.
86
+ - **Host pages:** a skin's tokens no longer land on the host page's `:root`.
87
+ Each editor scopes them to its own root (`data-fd-scope`), so two editors
88
+ with different skins stop overwriting each other and the page around the
89
+ editor gets no `--fd-*` variables. Aliases that follow a token the skin sets
90
+ (`--fd-panel-bg` and the like) are redeclared in the scope, and overlays
91
+ moved to `<body>` (config panel, surface overlay, WebMCP approval dialog)
92
+ carry the scope along. Light/dark stays the page-wide `data-theme` on
93
+ `<html>`. A host that styled its own page with a skin's `--fd-*` variables
94
+ must set them itself.
95
+ - **Host pages:** `@flowdrop/flowdrop/styles` no longer resets the host page.
96
+ `* { box-sizing: border-box }` and `p { margin: 0 }` now apply only inside
97
+ FlowDrop's own roots (`.flowdrop-root`, the new `.flowdrop-scope` marker on
98
+ each standalone component, `.flowdrop-portal`, `.svelte-flow`), at the same
99
+ zero specificity as before. Host elements that relied on the leak need
100
+ their own rule.
101
+ - Unmounting a Playground no longer calls `interruptService.stopPolling()`.
102
+ That poller is page-wide and the library never starts it, so one
103
+ playground closing stopped polling a host had started for the whole page.
104
+ A host that starts it stops it.
105
+
106
+ ### Deprecated
107
+
108
+ - `WorkflowInterfaceEntry.turn`, `WorkflowInterfaceTurn`,
109
+ `WORKFLOW_INTERFACE_INPUT_TURNS` and `WORKFLOW_INTERFACE_OUTPUT_TURNS`. They
110
+ will be removed in 3.0. A stored `turn` is still read, for a workflow without
111
+ Playground settings, and still round-trips. For a workflow that carries
112
+ Playground settings, the interface editor no longer offers the **Chat
113
+ turn** selector: an entry that carries a `turn` shows it as a struck-through
114
+ chip with a note and an **Open Playground settings** link. A workflow
115
+ without a `playground` key (a server before FlowDrop 2.7.0) keeps the
116
+ selector and the history limit field, since `turn` is the only way to set
117
+ its chat up. `interface-turn-duplicate` and `interface-turn-direction` are
118
+ worded as deprecation warnings that point at the Playground settings, and
119
+ are no longer reported once settings are stored (the server ignores `turn`
120
+ then).
121
+
122
+ ### Fixed
123
+
124
+ - `@iconify/svelte` is a required peer dependency. It was marked optional, so
125
+ npm and pnpm did not install it, yet almost every entry point imports it:
126
+ a fresh install failed on the first import with "Failed to resolve import
127
+ '@iconify/svelte'". Install it beside the library if your app does not
128
+ have it.
129
+ - Every relative import in the package carries its file extension. Three in
130
+ the skins (reached from `core`) and two in node components had none, which
131
+ Node ESM and webpack refuse in a `"type": "module"` package. A new
132
+ `prepack` check (`scripts/check-extensions.mjs`) keeps it that way. The
133
+ workflow schema JSON is imported `with { type: 'json' }`.
134
+ - The `svelte` peer range says what the code needs: `^5.29.0` (the library
135
+ uses attachments, and `@xyflow/svelte` already asks for 5.25). An older
136
+ Svelte failed to compile the shipped components. `engines.node` is
137
+ `>=20`, as `marked` and `dompurify` already require.
138
+ - Storybook stories and their mock modules are no longer in the tarball.
139
+ - Pipeline status no longer leaks after it unmounts. Its 5-second poll kept
140
+ calling the API for the life of the page if the component went away while
141
+ the pipeline was running. The logs sidebar left the host page's body
142
+ unscrollable when it unmounted while open, and now restores the body's own
143
+ `overflow` rather than clearing it. The editor's node execution-info load,
144
+ scheduled with `requestIdleCallback`, was never cancelled (it was cleared
145
+ with `clearTimeout`), so a quick pipeline switch still ran the stale load;
146
+ it is now cancelled, and an unmounted editor drops a scheduled or
147
+ in-flight load.
148
+ - A settings change (even the theme) no longer wipes the run status from the
149
+ canvas. The editor rebuilt its nodes from the workflow store on every
150
+ settings change, and the store carries no execution info, so the status
151
+ badges vanished until the next poll. The editor now keeps the last loaded
152
+ execution info and re-applies it on every rebuild; it drops it when the
153
+ pipeline or workflow changes.
154
+ - Playgrounds on one page no longer stop each other. Live polling is now
155
+ per FlowDrop instance (`fd.playgroundService`; the page-default instance
156
+ keeps using the exported `playgroundService`, so existing calls still
157
+ reach it). A second `mountPlayground` / `mountPlaygroundStudio` /
158
+ `mountPlaygroundApp` without an `instanceId` gets its own isolated
159
+ instance instead of sharing the default, and destroying it no longer
160
+ resets or stops the first one. The first mount still owns the default
161
+ instance, as before.
162
+ - The WebMCP approval dialog keeps the editor's skin. It mounts on `<body>`,
163
+ outside the editor, so it showed the default colours for a skinned editor;
164
+ it now carries the editor's skin scope (`FlowDropInstance.skinScope`, set by
165
+ the editor while it is mounted). Step numbers from 10 on no longer hang
166
+ outside the list: each number has its own column, sized to the widest. The
167
+ dialog also sets its own margins, fonts and list style, so a host page's
168
+ `h2`, `p`, `ol`, `li` and `label` rules no longer reshape it.
169
+
8
170
  ## [2.10.1] - 2026-10-07
9
171
 
10
172
  ### Fixed
@@ -17,6 +17,12 @@
17
17
  import ConfigForm from './ConfigForm.svelte';
18
18
  import ConfigPanel from './ConfigPanel.svelte';
19
19
  import WorkflowInterfaceEditor from './WorkflowInterfaceEditor.svelte';
20
+ import WorkflowPlaygroundSettings from './WorkflowPlaygroundSettings.svelte';
21
+ import {
22
+ followInterfaceInputEdit,
23
+ withPlaygroundChat,
24
+ withoutInterfaceTurns
25
+ } from '../utils/playgroundChat.js';
20
26
  import ReadOnlyDetails from './ReadOnlyDetails.svelte';
21
27
  import CommandConsole from './console/CommandConsole.svelte';
22
28
  import AIChatPanel from './chat/AIChatPanel.svelte';
@@ -45,7 +51,7 @@
45
51
  import type { FlowDropEventHandlers, FlowDropFeatures } from '../types/events.js';
46
52
  import { mergeFeatures } from '../types/events.js';
47
53
  import type { FlowDropTheme, FlowDropThemeName } from '../types/theme.js';
48
- import type { FlowDropSkinTokens } from '../types/skin.js';
54
+ import { buildScopedSkinCss, toScopeId } from '../themes/scopedSkinCss.js';
49
55
  import { resolveTheme } from '../themes/index.js';
50
56
  import { provideInstance } from '../stores/getInstance.svelte.js';
51
57
  import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
@@ -313,29 +319,32 @@
313
319
  let resolvedTheme = $derived(resolveTheme(themeProp ?? getUiSettings().theme));
314
320
  let themeConfig = $derived(resolvedTheme.config);
315
321
 
316
- // Inject skin tokens as a style tag so light/dark palettes can coexist.
317
- // tokens → :root { ... } (light mode / base)
318
- // darkTokens → [data-theme='dark'] { ... } (dark mode override)
319
- // The tag is appended after tokens.css so it wins via source order.
320
- $effect(() => {
321
- const skin = resolvedTheme.skin;
322
- const tokens = skin?.tokens;
323
- const darkTokens = skin?.darkTokens;
324
- if ((!tokens && !darkTokens) || typeof document === 'undefined') return;
322
+ // Skin tokens are scoped to this instance (data-fd-scope on .flowdrop-root,
323
+ // copied onto portalled overlays), so two editors with different skins do
324
+ // not overwrite each other and the host page gets no --fd-* variables.
325
+ // See themes/scopedSkinCss.ts. data-theme stays page-global on <html>.
326
+ // One cleaned value for the attribute, the skin rule and fd.skinScope.
327
+ const rawScopeId = $props.id();
328
+ const scopeId = toScopeId(rawScopeId);
325
329
 
326
- const toRules = (dict: FlowDropSkinTokens) =>
327
- Object.entries(dict)
328
- .map(([k, v]) => ` --fd-${k}: ${v};`)
329
- .join('\n');
330
+ // Publish the scope on the instance so overlays mounted outside this tree
331
+ // (the WebMCP approval dialog) can carry it. Cleared only if still ours.
332
+ $effect(() => {
333
+ fd.skinScope = scopeId;
334
+ return () => {
335
+ if (fd.skinScope === scopeId) fd.skinScope = null;
336
+ };
337
+ });
330
338
 
331
- let css = '';
332
- if (tokens) css += `:root {\n${toRules(tokens)}\n}\n`;
333
- if (darkTokens) css += `[data-theme='dark'] {\n${toRules(darkTokens)}\n}\n`;
339
+ $effect(() => {
340
+ if (typeof document === 'undefined') return;
341
+ const css = buildScopedSkinCss(scopeId, resolvedTheme.skin);
342
+ if (!css) return;
334
343
 
335
344
  const style = document.createElement('style');
336
- style.id = 'fd-skin-tokens';
337
- document.head.appendChild(style);
345
+ style.setAttribute('data-fd-skin', scopeId);
338
346
  style.textContent = css;
347
+ document.head.appendChild(style);
339
348
 
340
349
  return () => style.remove();
341
350
  });
@@ -377,7 +386,16 @@
377
386
  // Inner tab within the workflow-settings surface — see Phase 3 of
378
387
  // `.claude/plans/workflow-interface.md`. Settings and the interface editor
379
388
  // are two tabs of one surface, not a field inside the settings form.
380
- let workflowSettingsTab = $state<'settings' | 'interface'>('settings');
389
+ let workflowSettingsTab = $state<'settings' | 'interface' | 'playground'>('settings');
390
+ // The Playground tab exists only while the workflow carries Playground
391
+ // settings; a workflow loaded without them shows Settings. Derived rather
392
+ // than reset, so there is no frame with the Playground tab picked and
393
+ // nothing shown, and the pick comes back with a workflow that has them.
394
+ const activeWorkflowSettingsTab = $derived(
395
+ workflowSettingsTab === 'playground' && fd.workflow.current?.playground === undefined
396
+ ? 'settings'
397
+ : workflowSettingsTab
398
+ );
381
399
 
382
400
  // Which surface (`config` | `console` | `chat`) is focused in its host. A
383
401
  // single selector across hosts: each TabbedSurface highlights this id when it
@@ -392,7 +410,13 @@
392
410
  // Built-in workflow settings field names — consumer schemas must not reuse these.
393
411
  // 'interface' is reserved too: it names `Workflow.interface`'s own tab, not a
394
412
  // workflowSettingsSchema field, but a consumer schema could still collide.
395
- const WORKFLOW_SETTINGS_RESERVED = new Set(['name', 'description', 'format', 'interface']);
413
+ const WORKFLOW_SETTINGS_RESERVED = new Set([
414
+ 'name',
415
+ 'description',
416
+ 'format',
417
+ 'interface',
418
+ 'playground'
419
+ ]);
396
420
 
397
421
  // Registered formats this host offers — the mount-level `workflowFormats`
398
422
  // allowlist filters the registry (an unknown id filters to nothing rather
@@ -1303,7 +1327,46 @@
1303
1327
  workflow={fd.workflow.current}
1304
1328
  dataTypes={fd.portCompatibility.getEnabledDataTypes()}
1305
1329
  checker={fd.portCompatibility}
1306
- onChange={(next) => fd.workflow.batchUpdate({ interface: next })}
1330
+ onChange={(next, edit) => {
1331
+ // A renamed or removed input is followed in the chat binding, in the
1332
+ // same update (one undo step), so the binding never names an input
1333
+ // the interface no longer has.
1334
+ const playground = fd.workflow.current?.playground;
1335
+ const followed = edit ? followInterfaceInputEdit(playground, edit) : playground;
1336
+ // Settings that no longer bind anything must not fall back to `turn`
1337
+ // marks left on the interface: they go in the same update.
1338
+ const cleared = followed !== playground && followed?.chat === null;
1339
+ fd.workflow.batchUpdate({
1340
+ interface: cleared ? withoutInterfaceTurns(next) : next,
1341
+ ...(followed !== playground && { playground: followed })
1342
+ });
1343
+ }}
1344
+ onOpenPlaygroundSettings={fd.workflow.current.playground !== undefined
1345
+ ? () => (workflowSettingsTab = 'playground')
1346
+ : undefined}
1347
+ />
1348
+ {/if}
1349
+ {/snippet}
1350
+
1351
+ <!--
1352
+ The workflow's Playground settings (its chat binding). Only for a backend
1353
+ that sends them (`workflow.playground`, FlowDrop 2.7.0 on): an older one
1354
+ would drop the key on save. Edits go through the workflow store, so they
1355
+ mark the workflow dirty and are saved with it.
1356
+ -->
1357
+ {#snippet workflowPlaygroundEl()}
1358
+ {#if fd.workflow.current}
1359
+ <WorkflowPlaygroundSettings
1360
+ workflow={fd.workflow.current}
1361
+ onChange={(next) => fd.workflow.batchUpdate({ playground: next })}
1362
+ onMoveTurns={(chat) => {
1363
+ const current = fd.workflow.current;
1364
+ if (!current) return;
1365
+ fd.workflow.batchUpdate({
1366
+ playground: withPlaygroundChat(current.playground, chat),
1367
+ interface: withoutInterfaceTurns(current.interface)
1368
+ });
1369
+ }}
1307
1370
  />
1308
1371
  {/if}
1309
1372
  {/snippet}
@@ -1319,9 +1382,9 @@
1319
1382
  <button
1320
1383
  type="button"
1321
1384
  role="tab"
1322
- aria-selected={workflowSettingsTab === 'settings'}
1385
+ aria-selected={activeWorkflowSettingsTab === 'settings'}
1323
1386
  class="workflow-settings-tabs__tab"
1324
- class:workflow-settings-tabs__tab--active={workflowSettingsTab === 'settings'}
1387
+ class:workflow-settings-tabs__tab--active={activeWorkflowSettingsTab === 'settings'}
1325
1388
  onclick={() => (workflowSettingsTab = 'settings')}
1326
1389
  >
1327
1390
  {mergedMessages.navigation.workflowSettingsPanelSubtitle}
@@ -1329,26 +1392,46 @@
1329
1392
  <button
1330
1393
  type="button"
1331
1394
  role="tab"
1332
- aria-selected={workflowSettingsTab === 'interface'}
1395
+ aria-selected={activeWorkflowSettingsTab === 'interface'}
1333
1396
  class="workflow-settings-tabs__tab"
1334
- class:workflow-settings-tabs__tab--active={workflowSettingsTab === 'interface'}
1397
+ class:workflow-settings-tabs__tab--active={activeWorkflowSettingsTab === 'interface'}
1335
1398
  onclick={() => (workflowSettingsTab = 'interface')}
1336
1399
  >
1337
1400
  {mergedMessages.navigation.workflowSettingsInterfaceTab}
1338
1401
  </button>
1402
+ {#if fd.workflow.current?.playground !== undefined}
1403
+ <button
1404
+ type="button"
1405
+ role="tab"
1406
+ aria-selected={activeWorkflowSettingsTab === 'playground'}
1407
+ class="workflow-settings-tabs__tab"
1408
+ class:workflow-settings-tabs__tab--active={activeWorkflowSettingsTab === 'playground'}
1409
+ onclick={() => (workflowSettingsTab = 'playground')}
1410
+ >
1411
+ {mergedMessages.navigation.workflowSettingsPlaygroundTab}
1412
+ </button>
1413
+ {/if}
1339
1414
  </div>
1340
1415
  <div
1341
1416
  class="workflow-settings-tabs__panel"
1342
- style:display={workflowSettingsTab === 'settings' ? 'block' : 'none'}
1417
+ style:display={activeWorkflowSettingsTab === 'settings' ? 'block' : 'none'}
1343
1418
  >
1344
1419
  {@render workflowConfigFormEl()}
1345
1420
  </div>
1346
1421
  <div
1347
1422
  class="workflow-settings-tabs__panel"
1348
- style:display={workflowSettingsTab === 'interface' ? 'block' : 'none'}
1423
+ style:display={activeWorkflowSettingsTab === 'interface' ? 'block' : 'none'}
1349
1424
  >
1350
1425
  {@render workflowInterfaceEl()}
1351
1426
  </div>
1427
+ {#if fd.workflow.current?.playground !== undefined}
1428
+ <div
1429
+ class="workflow-settings-tabs__panel"
1430
+ style:display={activeWorkflowSettingsTab === 'playground' ? 'block' : 'none'}
1431
+ >
1432
+ {@render workflowPlaygroundEl()}
1433
+ </div>
1434
+ {/if}
1352
1435
  </div>
1353
1436
  {/snippet}
1354
1437
 
@@ -1454,7 +1537,7 @@
1454
1537
  {/snippet}
1455
1538
 
1456
1539
  <!-- MainLayout wrapper for workflow editor -->
1457
- <div class="flowdrop-root">
1540
+ <div class="flowdrop-root" data-fd-scope={scopeId}>
1458
1541
  <MainLayout
1459
1542
  {height}
1460
1543
  {width}
@@ -608,7 +608,7 @@
608
608
 
609
609
  <!-- External Edit Link Section (shown when configured and preferred) -->
610
610
  {#if showExternalEditLink && configEditOptions?.externalEditLink}
611
- <div class="config-form__admin-edit">
611
+ <div class="flowdrop-scope config-form__admin-edit">
612
612
  <div class="config-form__admin-edit-header">
613
613
  <Icon icon="heroicons:arrow-top-right-on-square" />
614
614
  <span>External Configuration</span>
@@ -634,14 +634,14 @@
634
634
 
635
635
  <!-- Dynamic Schema Loading State -->
636
636
  {#if dynamicSchemaLoading}
637
- <div class="config-form__loading">
637
+ <div class="flowdrop-scope config-form__loading">
638
638
  <div class="config-form__loading-spinner"></div>
639
639
  <p class="config-form__loading-text">
640
640
  {configEditOptions?.loadingMessage ?? 'Loading configuration options...'}
641
641
  </p>
642
642
  </div>
643
643
  {:else if dynamicSchemaError}
644
- <div class="config-form__error">
644
+ <div class="flowdrop-scope config-form__error">
645
645
  <div class="config-form__error-header">
646
646
  <Icon icon="heroicons:exclamation-triangle" />
647
647
  <span>Configuration Error</span>
@@ -675,7 +675,7 @@
675
675
  </div>
676
676
  {:else if configSchema}
677
677
  <form
678
- class="config-form"
678
+ class="flowdrop-scope config-form"
679
679
  onfocusout={handleFormBlur}
680
680
  onsubmit={(e) => {
681
681
  e.preventDefault();
@@ -789,7 +789,7 @@
789
789
  {/if}
790
790
  </form>
791
791
  {:else if !dynamicSchemaLoading && !showExternalEditLink}
792
- <div class="config-form__empty">
792
+ <div class="flowdrop-scope config-form__empty">
793
793
  <div class="config-form__empty-icon">
794
794
  <Icon icon="heroicons:cog-6-tooth" />
795
795
  </div>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import type { ConfigSchema, ConfigValues } from '../types';
2
+ import type { ConfigSchema, ConfigValues } from '../types/index.js';
3
3
  import ConfigForm from './ConfigForm.svelte';
4
4
  import { m } from '../messages/index.js';
5
5
 
@@ -47,7 +47,7 @@
47
47
  {#if props.isOpen}
48
48
  <!-- Modal Backdrop -->
49
49
  <div
50
- class="config-modal-backdrop"
50
+ class="flowdrop-scope config-modal-backdrop"
51
51
  onclick={handleBackdropClick}
52
52
  onkeydown={handleKeydown}
53
53
  role="dialog"
@@ -1,4 +1,4 @@
1
- import type { ConfigSchema, ConfigValues } from '../types';
1
+ import type { ConfigSchema, ConfigValues } from '../types/index.js';
2
2
  interface Props {
3
3
  isOpen: boolean;
4
4
  nodeLabel: string;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { getDataTypeColor } from '../utils/colors';
2
+ import { getDataTypeColor } from '../utils/colors.js';
3
3
  import { getInstance } from '../stores/getInstance.svelte.js';
4
4
  import { useConnection } from '@xyflow/svelte';
5
5
 
@@ -30,19 +30,22 @@
30
30
  let sidebarRef: HTMLElement | undefined = $state();
31
31
 
32
32
  // Focus management and body scroll control
33
+ // The teardown restores the body's own overflow when the sidebar closes or
34
+ // unmounts while open, so the host page is never left unscrollable.
33
35
  $effect(() => {
34
- if (props.isOpen) {
35
- // Focus management - focus the sidebar when it opens
36
- setTimeout(() => {
37
- sidebarRef?.focus();
38
- }, 100);
39
-
40
- // Prevent body scroll
41
- document.body.style.overflow = 'hidden';
42
- } else {
43
- // Restore body scroll
44
- document.body.style.overflow = '';
45
- }
36
+ if (!props.isOpen) return;
37
+ // Focus management - focus the sidebar when it opens
38
+ const focusTimer = setTimeout(() => {
39
+ sidebarRef?.focus();
40
+ }, 100);
41
+
42
+ // Prevent body scroll
43
+ const previousOverflow = document.body.style.overflow;
44
+ document.body.style.overflow = 'hidden';
45
+ return () => {
46
+ clearTimeout(focusTimer);
47
+ document.body.style.overflow = previousOverflow;
48
+ };
46
49
  });
47
50
 
48
51
  /**
@@ -22,7 +22,7 @@
22
22
  let displayClass = $derived(props.className || 'markdown-display');
23
23
  </script>
24
24
 
25
- <div class={displayClass}>
25
+ <div class="flowdrop-scope {displayClass}">
26
26
  <!-- Content is sanitized with DOMPurify to prevent XSS -->
27
27
  <!-- eslint-disable-next-line svelte/no-at-html-tags -->
28
28
  {@html renderedContent}
@@ -232,27 +232,14 @@
232
232
  }
233
233
  });
234
234
 
235
- // Auto-refresh pipeline data every 5 seconds when pipeline is running
236
- let refreshInterval: NodeJS.Timeout | null = null;
237
-
235
+ // Auto-refresh pipeline data every 5 seconds while the pipeline is running.
236
+ // The teardown stops it when the status or pipeline changes, and on unmount.
238
237
  $effect(() => {
239
- // Clear existing interval
240
- if (refreshInterval) {
241
- clearInterval(refreshInterval);
242
- refreshInterval = null;
243
- }
244
-
245
- // Only start polling if pipeline is running
246
- if (pipelineStatus === 'running' && pipelineId) {
247
- refreshInterval = setInterval(() => {
248
- fetchPipelineData();
249
- }, 5000);
250
- }
238
+ if (pipelineStatus !== 'running' || !pipelineId) return;
239
+ const refreshInterval = setInterval(() => fetchPipelineData(), 5000);
240
+ return () => clearInterval(refreshInterval);
251
241
  });
252
242
 
253
- // Note: Interval cleanup is handled by the $effect above.
254
- // In Svelte 5, $effect cleanup runs both on re-execution and component destroy.
255
-
256
243
  // Refresh pipeline data whenever new messages arrive (e.g. log messages during execution).
257
244
  // Debounced so burst arrivals collapse into one fetch.
258
245
  $effect(() => {
@@ -327,7 +327,7 @@
327
327
  {#if schema?.properties}
328
328
  <form
329
329
  bind:this={formRef}
330
- class="schema-form {className}"
330
+ class="flowdrop-scope schema-form {className}"
331
331
  class:schema-form--loading={loading}
332
332
  class:schema-form--disabled={disabled}
333
333
  onsubmit={(e) => {
@@ -126,7 +126,7 @@
126
126
  <!-- native <dialog> backdrop click-to-close pattern -->
127
127
  <dialog
128
128
  bind:this={dialogRef}
129
- class="flowdrop-settings-modal {className}"
129
+ class="flowdrop-scope flowdrop-settings-modal {className}"
130
130
  onclick={handleBackdropClick}
131
131
  onkeydown={handleKeydown}
132
132
  onclose={handleDialogClose}
@@ -420,7 +420,7 @@
420
420
  }
421
421
  </script>
422
422
 
423
- <div class="flowdrop-settings-panel {className}">
423
+ <div class="flowdrop-scope flowdrop-settings-panel {className}">
424
424
  <!-- Tab Navigation -->
425
425
  <div
426
426
  class="flowdrop-settings-panel__tabs"