@d34dman/flowdrop 0.0.29 → 0.0.31

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 (55) hide show
  1. package/dist/components/App.svelte +54 -6
  2. package/dist/components/NodeSidebar.svelte +17 -9
  3. package/dist/components/SchemaForm.svelte +14 -14
  4. package/dist/components/SchemaForm.svelte.d.ts +1 -1
  5. package/dist/components/WorkflowEditor.svelte +4 -0
  6. package/dist/components/form/FormFieldLight.svelte +66 -66
  7. package/dist/components/form/FormFieldLight.svelte.d.ts +1 -1
  8. package/dist/components/form/types.d.ts +1 -1
  9. package/dist/components/nodes/ToolNode.svelte +23 -8
  10. package/dist/components/playground/ChatPanel.svelte +523 -0
  11. package/dist/components/playground/ChatPanel.svelte.d.ts +20 -0
  12. package/dist/components/playground/ExecutionLogs.svelte +486 -0
  13. package/dist/components/playground/ExecutionLogs.svelte.d.ts +14 -0
  14. package/dist/components/playground/InputCollector.svelte +444 -0
  15. package/dist/components/playground/InputCollector.svelte.d.ts +16 -0
  16. package/dist/components/playground/MessageBubble.svelte +398 -0
  17. package/dist/components/playground/MessageBubble.svelte.d.ts +15 -0
  18. package/dist/components/playground/Playground.svelte +851 -0
  19. package/dist/components/playground/Playground.svelte.d.ts +25 -0
  20. package/dist/components/playground/SessionManager.svelte +537 -0
  21. package/dist/components/playground/SessionManager.svelte.d.ts +20 -0
  22. package/dist/config/endpoints.d.ts +16 -0
  23. package/dist/config/endpoints.js +9 -0
  24. package/dist/core/index.d.ts +25 -23
  25. package/dist/core/index.js +13 -12
  26. package/dist/display/index.d.ts +2 -2
  27. package/dist/display/index.js +2 -2
  28. package/dist/editor/index.d.ts +57 -49
  29. package/dist/editor/index.js +52 -42
  30. package/dist/form/code.d.ts +4 -4
  31. package/dist/form/code.js +11 -11
  32. package/dist/form/fieldRegistry.d.ts +2 -2
  33. package/dist/form/fieldRegistry.js +8 -10
  34. package/dist/form/full.d.ts +5 -5
  35. package/dist/form/full.js +7 -7
  36. package/dist/form/index.d.ts +16 -16
  37. package/dist/form/index.js +14 -14
  38. package/dist/form/markdown.d.ts +3 -3
  39. package/dist/form/markdown.js +6 -6
  40. package/dist/index.d.ts +6 -4
  41. package/dist/index.js +9 -4
  42. package/dist/playground/index.d.ts +92 -0
  43. package/dist/playground/index.js +114 -0
  44. package/dist/playground/mount.d.ts +183 -0
  45. package/dist/playground/mount.js +178 -0
  46. package/dist/services/playgroundService.d.ts +129 -0
  47. package/dist/services/playgroundService.js +317 -0
  48. package/dist/stores/playgroundStore.d.ts +199 -0
  49. package/dist/stores/playgroundStore.js +350 -0
  50. package/dist/styles/base.css +5 -0
  51. package/dist/types/playground.d.ts +230 -0
  52. package/dist/types/playground.js +28 -0
  53. package/dist/utils/colors.d.ts +42 -0
  54. package/dist/utils/colors.js +77 -0
  55. package/package.json +6 -1
@@ -42,27 +42,27 @@
42
42
  // ============================================================================
43
43
  // Main Components
44
44
  // ============================================================================
45
- export { default as SchemaForm } from "../components/SchemaForm.svelte";
45
+ export { default as SchemaForm } from '../components/SchemaForm.svelte';
46
46
  // ============================================================================
47
47
  // Form Field Components (Light - no heavy dependencies)
48
48
  // ============================================================================
49
49
  // Use the light version of FormField that uses the registry for heavy editors
50
- export { default as FormField } from "../components/form/FormFieldLight.svelte";
50
+ export { default as FormField } from '../components/form/FormFieldLight.svelte';
51
51
  // Also export the original (full) version for users who want everything
52
- export { default as FormFieldFull } from "../components/form/FormField.svelte";
53
- export { default as FormFieldWrapper } from "../components/form/FormFieldWrapper.svelte";
54
- export { default as FormTextField } from "../components/form/FormTextField.svelte";
55
- export { default as FormTextarea } from "../components/form/FormTextarea.svelte";
56
- export { default as FormNumberField } from "../components/form/FormNumberField.svelte";
57
- export { default as FormRangeField } from "../components/form/FormRangeField.svelte";
58
- export { default as FormToggle } from "../components/form/FormToggle.svelte";
59
- export { default as FormSelect } from "../components/form/FormSelect.svelte";
60
- export { default as FormCheckboxGroup } from "../components/form/FormCheckboxGroup.svelte";
61
- export { default as FormArray } from "../components/form/FormArray.svelte";
62
- export { isFieldOptionArray, normalizeOptions } from "../components/form/types.js";
52
+ export { default as FormFieldFull } from '../components/form/FormField.svelte';
53
+ export { default as FormFieldWrapper } from '../components/form/FormFieldWrapper.svelte';
54
+ export { default as FormTextField } from '../components/form/FormTextField.svelte';
55
+ export { default as FormTextarea } from '../components/form/FormTextarea.svelte';
56
+ export { default as FormNumberField } from '../components/form/FormNumberField.svelte';
57
+ export { default as FormRangeField } from '../components/form/FormRangeField.svelte';
58
+ export { default as FormToggle } from '../components/form/FormToggle.svelte';
59
+ export { default as FormSelect } from '../components/form/FormSelect.svelte';
60
+ export { default as FormCheckboxGroup } from '../components/form/FormCheckboxGroup.svelte';
61
+ export { default as FormArray } from '../components/form/FormArray.svelte';
62
+ export { isFieldOptionArray, normalizeOptions } from '../components/form/types.js';
63
63
  // ============================================================================
64
64
  // Field Registry (for dynamic field registration)
65
65
  // ============================================================================
66
66
  export { registerFieldComponent, unregisterFieldComponent, resolveFieldComponent, getRegisteredFieldTypes, isFieldTypeRegistered, clearFieldRegistry, getFieldRegistrySize,
67
67
  // Built-in matchers for custom components
68
- hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from "./fieldRegistry.js";
68
+ hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from './fieldRegistry.js';
@@ -23,9 +23,9 @@
23
23
  * };
24
24
  * ```
25
25
  */
26
- import type { FieldSchema } from "../components/form/types.js";
27
- export { default as FormMarkdownEditor } from "../components/form/FormMarkdownEditor.svelte";
28
- export type { MarkdownEditorFieldProps } from "../components/form/types.js";
26
+ import type { FieldSchema } from '../components/form/types.js';
27
+ export { default as FormMarkdownEditor } from '../components/form/FormMarkdownEditor.svelte';
28
+ export type { MarkdownEditorFieldProps } from '../components/form/types.js';
29
29
  /**
30
30
  * Matcher for markdown editor fields
31
31
  * Matches: format "markdown"
@@ -23,15 +23,15 @@
23
23
  * };
24
24
  * ```
25
25
  */
26
- import { registerFieldComponent } from "./fieldRegistry.js";
26
+ import { registerFieldComponent } from './fieldRegistry.js';
27
27
  // Re-export the component for direct usage if needed
28
- export { default as FormMarkdownEditor } from "../components/form/FormMarkdownEditor.svelte";
28
+ export { default as FormMarkdownEditor } from '../components/form/FormMarkdownEditor.svelte';
29
29
  /**
30
30
  * Matcher for markdown editor fields
31
31
  * Matches: format "markdown"
32
32
  */
33
33
  export function markdownEditorFieldMatcher(schema) {
34
- return schema.format === "markdown";
34
+ return schema.format === 'markdown';
35
35
  }
36
36
  /**
37
37
  * Track if markdown editor is registered
@@ -58,8 +58,8 @@ export function registerMarkdownEditorField(priority = 100) {
58
58
  return;
59
59
  }
60
60
  // Dynamic import to ensure proper code splitting
61
- import("../components/form/FormMarkdownEditor.svelte").then((module) => {
62
- registerFieldComponent("markdown-editor", module.default, markdownEditorFieldMatcher, priority);
61
+ import('../components/form/FormMarkdownEditor.svelte').then((module) => {
62
+ registerFieldComponent('markdown-editor', module.default, markdownEditorFieldMatcher, priority);
63
63
  markdownEditorRegistered = true;
64
64
  });
65
65
  }
@@ -82,7 +82,7 @@ component, priority = 100) {
82
82
  if (markdownEditorRegistered) {
83
83
  return;
84
84
  }
85
- registerFieldComponent("markdown-editor", component, markdownEditorFieldMatcher, priority);
85
+ registerFieldComponent('markdown-editor', component, markdownEditorFieldMatcher, priority);
86
86
  markdownEditorRegistered = true;
87
87
  }
88
88
  /**
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@
13
13
  * - `@d34dman/flowdrop/form/code` - Code editor support (adds CodeMirror)
14
14
  * - `@d34dman/flowdrop/form/markdown` - Markdown editor support (adds EasyMDE)
15
15
  * - `@d34dman/flowdrop/display` - MarkdownDisplay (adds marked)
16
+ * - `@d34dman/flowdrop/playground` - Playground for interactive workflow testing
16
17
  * - `@d34dman/flowdrop/styles` - CSS styles
17
18
  *
18
19
  * ## Legacy Import (Full Bundle)
@@ -28,7 +29,8 @@
28
29
  *
29
30
  * @module flowdrop
30
31
  */
31
- export * from "./core/index.js";
32
- export * from "./form/index.js";
33
- export * from "./display/index.js";
34
- export * from "./editor/index.js";
32
+ export * from './core/index.js';
33
+ export * from './form/index.js';
34
+ export * from './display/index.js';
35
+ export * from './playground/index.js';
36
+ export * from './editor/index.js';
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@
13
13
  * - `@d34dman/flowdrop/form/code` - Code editor support (adds CodeMirror)
14
14
  * - `@d34dman/flowdrop/form/markdown` - Markdown editor support (adds EasyMDE)
15
15
  * - `@d34dman/flowdrop/display` - MarkdownDisplay (adds marked)
16
+ * - `@d34dman/flowdrop/playground` - Playground for interactive workflow testing
16
17
  * - `@d34dman/flowdrop/styles` - CSS styles
17
18
  *
18
19
  * ## Legacy Import (Full Bundle)
@@ -35,18 +36,22 @@
35
36
  // ============================================================================
36
37
  // Core Exports (Types & Utilities - No Heavy Dependencies)
37
38
  // ============================================================================
38
- export * from "./core/index.js";
39
+ export * from './core/index.js';
39
40
  // ============================================================================
40
41
  // Form Exports
41
42
  // ============================================================================
42
- export * from "./form/index.js";
43
+ export * from './form/index.js';
43
44
  // Note: Heavy form fields (code, markdown) are NOT auto-registered.
44
45
  // Users must import from form/code or form/markdown and register explicitly.
45
46
  // ============================================================================
46
47
  // Display Exports
47
48
  // ============================================================================
48
- export * from "./display/index.js";
49
+ export * from './display/index.js';
50
+ // ============================================================================
51
+ // Playground Exports
52
+ // ============================================================================
53
+ export * from './playground/index.js';
49
54
  // ============================================================================
50
55
  // Editor Exports (includes @xyflow/svelte and auto-registers builtin nodes)
51
56
  // ============================================================================
52
- export * from "./editor/index.js";
57
+ export * from './editor/index.js';
@@ -0,0 +1,92 @@
1
+ /**
2
+ * FlowDrop Playground Module
3
+ *
4
+ * Provides the Playground feature for interactive workflow testing with
5
+ * chat interface, session management, and real-time execution logs.
6
+ *
7
+ * @module playground
8
+ *
9
+ * @example Using mountPlayground for vanilla JS / Drupal / IIFE:
10
+ * ```typescript
11
+ * import { mountPlayground, createEndpointConfig } from "@d34dman/flowdrop/playground";
12
+ *
13
+ * const app = await mountPlayground(
14
+ * document.getElementById("playground-container"),
15
+ * {
16
+ * workflowId: "wf-123",
17
+ * endpointConfig: createEndpointConfig("/api/flowdrop"),
18
+ * mode: "standalone"
19
+ * }
20
+ * );
21
+ *
22
+ * // Later, to cleanup:
23
+ * app.destroy();
24
+ * ```
25
+ *
26
+ * @example Drupal Behaviors integration:
27
+ * ```javascript
28
+ * (function (Drupal, FlowDrop) {
29
+ * Drupal.behaviors.flowdropPlayground = {
30
+ * attach: function (context, settings) {
31
+ * var container = document.getElementById("playground-container");
32
+ * if (!container || container.dataset.initialized) return;
33
+ * container.dataset.initialized = "true";
34
+ *
35
+ * FlowDrop.mountPlayground(container, {
36
+ * workflowId: settings.flowdrop.workflowId,
37
+ * endpointConfig: FlowDrop.createEndpointConfig(settings.flowdrop.apiBaseUrl),
38
+ * mode: "standalone"
39
+ * }).then(function (app) {
40
+ * container._flowdropApp = app;
41
+ * });
42
+ * },
43
+ * detach: function (context, settings, trigger) {
44
+ * if (trigger === "unload") {
45
+ * var container = document.getElementById("playground-container");
46
+ * if (container && container._flowdropApp) {
47
+ * container._flowdropApp.destroy();
48
+ * }
49
+ * }
50
+ * }
51
+ * };
52
+ * })(Drupal, window.FlowDrop);
53
+ * ```
54
+ *
55
+ * @example In Svelte (Standalone mode):
56
+ * ```svelte
57
+ * <script>
58
+ * import { Playground } from "@d34dman/flowdrop/playground";
59
+ * </script>
60
+ *
61
+ * <Playground workflowId="wf-123" mode="standalone" />
62
+ * ```
63
+ *
64
+ * @example In Svelte (Embedded mode):
65
+ * ```svelte
66
+ * <script>
67
+ * import { Playground } from "@d34dman/flowdrop/playground";
68
+ * let showPlayground = false;
69
+ * </script>
70
+ *
71
+ * {#if showPlayground}
72
+ * <Playground
73
+ * workflowId="wf-123"
74
+ * workflow={myWorkflow}
75
+ * mode="embedded"
76
+ * onClose={() => showPlayground = false}
77
+ * />
78
+ * {/if}
79
+ * ```
80
+ */
81
+ export { default as Playground } from '../components/playground/Playground.svelte';
82
+ export { default as ChatPanel } from '../components/playground/ChatPanel.svelte';
83
+ export { default as SessionManager } from '../components/playground/SessionManager.svelte';
84
+ export { default as InputCollector } from '../components/playground/InputCollector.svelte';
85
+ export { default as ExecutionLogs } from '../components/playground/ExecutionLogs.svelte';
86
+ export { default as MessageBubble } from '../components/playground/MessageBubble.svelte';
87
+ export { PlaygroundService, playgroundService } from '../services/playgroundService.js';
88
+ export { currentSession, sessions, messages, isExecuting, isLoading, error as playgroundError, currentWorkflow, lastPollTimestamp, sessionStatus, messageCount, chatMessages, logMessages, latestMessage, inputFields, hasChatInput, sessionCount, playgroundActions, getCurrentSessionId, isSessionSelected, getMessagesSnapshot, getLatestMessageTimestamp } from '../stores/playgroundStore.js';
89
+ export type { PlaygroundSession, PlaygroundMessage, PlaygroundInputField, PlaygroundMessageRequest, PlaygroundMessagesResult, PlaygroundConfig, PlaygroundMode, PlaygroundSessionStatus, PlaygroundMessageRole, PlaygroundMessageLevel, PlaygroundMessageMetadata, PlaygroundApiResponse, PlaygroundSessionsResponse, PlaygroundSessionResponse, PlaygroundMessageResponse, PlaygroundMessagesApiResponse } from '../types/playground.js';
90
+ export { isChatInputNode, CHAT_INPUT_PATTERNS } from '../types/playground.js';
91
+ export { mountPlayground, unmountPlayground, type PlaygroundMountOptions, type MountedPlayground } from './mount.js';
92
+ export { createEndpointConfig, defaultEndpointConfig, buildEndpointUrl, type EndpointConfig } from '../config/endpoints.js';
@@ -0,0 +1,114 @@
1
+ /**
2
+ * FlowDrop Playground Module
3
+ *
4
+ * Provides the Playground feature for interactive workflow testing with
5
+ * chat interface, session management, and real-time execution logs.
6
+ *
7
+ * @module playground
8
+ *
9
+ * @example Using mountPlayground for vanilla JS / Drupal / IIFE:
10
+ * ```typescript
11
+ * import { mountPlayground, createEndpointConfig } from "@d34dman/flowdrop/playground";
12
+ *
13
+ * const app = await mountPlayground(
14
+ * document.getElementById("playground-container"),
15
+ * {
16
+ * workflowId: "wf-123",
17
+ * endpointConfig: createEndpointConfig("/api/flowdrop"),
18
+ * mode: "standalone"
19
+ * }
20
+ * );
21
+ *
22
+ * // Later, to cleanup:
23
+ * app.destroy();
24
+ * ```
25
+ *
26
+ * @example Drupal Behaviors integration:
27
+ * ```javascript
28
+ * (function (Drupal, FlowDrop) {
29
+ * Drupal.behaviors.flowdropPlayground = {
30
+ * attach: function (context, settings) {
31
+ * var container = document.getElementById("playground-container");
32
+ * if (!container || container.dataset.initialized) return;
33
+ * container.dataset.initialized = "true";
34
+ *
35
+ * FlowDrop.mountPlayground(container, {
36
+ * workflowId: settings.flowdrop.workflowId,
37
+ * endpointConfig: FlowDrop.createEndpointConfig(settings.flowdrop.apiBaseUrl),
38
+ * mode: "standalone"
39
+ * }).then(function (app) {
40
+ * container._flowdropApp = app;
41
+ * });
42
+ * },
43
+ * detach: function (context, settings, trigger) {
44
+ * if (trigger === "unload") {
45
+ * var container = document.getElementById("playground-container");
46
+ * if (container && container._flowdropApp) {
47
+ * container._flowdropApp.destroy();
48
+ * }
49
+ * }
50
+ * }
51
+ * };
52
+ * })(Drupal, window.FlowDrop);
53
+ * ```
54
+ *
55
+ * @example In Svelte (Standalone mode):
56
+ * ```svelte
57
+ * <script>
58
+ * import { Playground } from "@d34dman/flowdrop/playground";
59
+ * </script>
60
+ *
61
+ * <Playground workflowId="wf-123" mode="standalone" />
62
+ * ```
63
+ *
64
+ * @example In Svelte (Embedded mode):
65
+ * ```svelte
66
+ * <script>
67
+ * import { Playground } from "@d34dman/flowdrop/playground";
68
+ * let showPlayground = false;
69
+ * </script>
70
+ *
71
+ * {#if showPlayground}
72
+ * <Playground
73
+ * workflowId="wf-123"
74
+ * workflow={myWorkflow}
75
+ * mode="embedded"
76
+ * onClose={() => showPlayground = false}
77
+ * />
78
+ * {/if}
79
+ * ```
80
+ */
81
+ // ============================================================================
82
+ // Playground Components
83
+ // ============================================================================
84
+ export { default as Playground } from '../components/playground/Playground.svelte';
85
+ export { default as ChatPanel } from '../components/playground/ChatPanel.svelte';
86
+ export { default as SessionManager } from '../components/playground/SessionManager.svelte';
87
+ export { default as InputCollector } from '../components/playground/InputCollector.svelte';
88
+ export { default as ExecutionLogs } from '../components/playground/ExecutionLogs.svelte';
89
+ export { default as MessageBubble } from '../components/playground/MessageBubble.svelte';
90
+ // ============================================================================
91
+ // Playground Service
92
+ // ============================================================================
93
+ export { PlaygroundService, playgroundService } from '../services/playgroundService.js';
94
+ // ============================================================================
95
+ // Playground Store
96
+ // ============================================================================
97
+ export {
98
+ // Core stores
99
+ currentSession, sessions, messages, isExecuting, isLoading, error as playgroundError, currentWorkflow, lastPollTimestamp,
100
+ // Derived stores
101
+ sessionStatus, messageCount, chatMessages, logMessages, latestMessage, inputFields, hasChatInput, sessionCount,
102
+ // Actions
103
+ playgroundActions,
104
+ // Utilities
105
+ getCurrentSessionId, isSessionSelected, getMessagesSnapshot, getLatestMessageTimestamp } from '../stores/playgroundStore.js';
106
+ export { isChatInputNode, CHAT_INPUT_PATTERNS } from '../types/playground.js';
107
+ // ============================================================================
108
+ // Playground Mount Functions (for vanilla JS / Drupal / IIFE integration)
109
+ // ============================================================================
110
+ export { mountPlayground, unmountPlayground } from './mount.js';
111
+ // ============================================================================
112
+ // Endpoint Configuration (re-exported for convenience)
113
+ // ============================================================================
114
+ export { createEndpointConfig, defaultEndpointConfig, buildEndpointUrl } from '../config/endpoints.js';
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Playground Mount Functions
3
+ *
4
+ * Provides mount/unmount functions for integrating the Playground component
5
+ * into any web application. Particularly useful for integration with
6
+ * vanilla JS, Drupal, WordPress, or other frameworks.
7
+ *
8
+ * @module playground/mount
9
+ *
10
+ * @example Basic usage in vanilla JavaScript:
11
+ * ```javascript
12
+ * const app = await FlowDrop.mountPlayground(
13
+ * document.getElementById("playground-container"),
14
+ * {
15
+ * workflowId: "wf-123",
16
+ * endpointConfig: FlowDrop.createEndpointConfig("/api/flowdrop"),
17
+ * mode: "standalone"
18
+ * }
19
+ * );
20
+ *
21
+ * // Later, to cleanup:
22
+ * app.destroy();
23
+ * ```
24
+ *
25
+ * @example Drupal integration:
26
+ * ```javascript
27
+ * (function (Drupal, FlowDrop) {
28
+ * Drupal.behaviors.flowdropPlayground = {
29
+ * attach: function (context, settings) {
30
+ * const container = document.getElementById("playground-container");
31
+ * if (!container || container.dataset.initialized) return;
32
+ * container.dataset.initialized = "true";
33
+ *
34
+ * FlowDrop.mountPlayground(container, {
35
+ * workflowId: settings.flowdrop.workflowId,
36
+ * endpointConfig: FlowDrop.createEndpointConfig(settings.flowdrop.apiBaseUrl),
37
+ * mode: "standalone"
38
+ * }).then(function (app) {
39
+ * container._flowdropApp = app;
40
+ * });
41
+ * }
42
+ * };
43
+ * })(Drupal, window.FlowDrop);
44
+ * ```
45
+ */
46
+ import type { Workflow } from "../types/index.js";
47
+ import type { EndpointConfig } from "../config/endpoints.js";
48
+ import type { PlaygroundMode, PlaygroundConfig, PlaygroundSession } from "../types/playground.js";
49
+ /**
50
+ * Mount options for Playground component
51
+ */
52
+ export interface PlaygroundMountOptions {
53
+ /**
54
+ * Target workflow ID (required)
55
+ * The workflow that the playground will interact with
56
+ */
57
+ workflowId: string;
58
+ /**
59
+ * Pre-loaded workflow data (optional)
60
+ * If not provided, the component will fetch it from the API
61
+ */
62
+ workflow?: Workflow;
63
+ /**
64
+ * Display mode
65
+ * - "standalone": Full-page playground experience
66
+ * - "embedded": Panel mode for embedding alongside other content
67
+ * @default "standalone"
68
+ */
69
+ mode?: PlaygroundMode;
70
+ /**
71
+ * Resume a specific session by ID
72
+ * If provided, the playground will load this session on mount
73
+ */
74
+ initialSessionId?: string;
75
+ /**
76
+ * API endpoint configuration
77
+ * Use createEndpointConfig() to create this
78
+ */
79
+ endpointConfig?: EndpointConfig;
80
+ /**
81
+ * Playground-specific configuration options
82
+ */
83
+ config?: PlaygroundConfig;
84
+ /**
85
+ * Container height (CSS value)
86
+ * @default "100%"
87
+ */
88
+ height?: string;
89
+ /**
90
+ * Container width (CSS value)
91
+ * @default "100%"
92
+ */
93
+ width?: string;
94
+ /**
95
+ * Callback when playground is closed (for embedded mode)
96
+ */
97
+ onClose?: () => void;
98
+ }
99
+ /**
100
+ * Return type for mounted Playground instance
101
+ */
102
+ export interface MountedPlayground {
103
+ /**
104
+ * Destroy the playground and clean up resources
105
+ * Should be called when removing the playground from the DOM
106
+ */
107
+ destroy: () => void;
108
+ /**
109
+ * Get the current session
110
+ * @returns The current session or null if none selected
111
+ */
112
+ getCurrentSession: () => PlaygroundSession | null;
113
+ /**
114
+ * Get all sessions for the workflow
115
+ * @returns Array of playground sessions
116
+ */
117
+ getSessions: () => PlaygroundSession[];
118
+ /**
119
+ * Get the message count in the current session
120
+ * @returns Number of messages
121
+ */
122
+ getMessageCount: () => number;
123
+ /**
124
+ * Check if the playground is currently executing
125
+ * @returns True if a workflow execution is in progress
126
+ */
127
+ isExecuting: () => boolean;
128
+ /**
129
+ * Stop any active polling
130
+ */
131
+ stopPolling: () => void;
132
+ /**
133
+ * Reset the playground state
134
+ * Clears the current session and messages
135
+ */
136
+ reset: () => void;
137
+ }
138
+ /**
139
+ * Mount the Playground component in a container
140
+ *
141
+ * This function mounts the Playground Svelte component into a DOM container,
142
+ * enabling interactive workflow testing with a chat interface.
143
+ *
144
+ * @param container - DOM element to mount the playground into
145
+ * @param options - Configuration options for the playground
146
+ * @returns Promise resolving to a MountedPlayground instance
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * import { mountPlayground, createEndpointConfig } from "@d34dman/flowdrop/playground";
151
+ *
152
+ * const app = await mountPlayground(
153
+ * document.getElementById("playground"),
154
+ * {
155
+ * workflowId: "wf-123",
156
+ * endpointConfig: createEndpointConfig("/api/flowdrop"),
157
+ * mode: "standalone",
158
+ * config: {
159
+ * showTimestamps: true,
160
+ * autoScroll: true,
161
+ * pollingInterval: 1500
162
+ * }
163
+ * }
164
+ * );
165
+ * ```
166
+ */
167
+ export declare function mountPlayground(container: HTMLElement, options: PlaygroundMountOptions): Promise<MountedPlayground>;
168
+ /**
169
+ * Unmount a Playground instance
170
+ *
171
+ * Convenience function for destroying a mounted playground.
172
+ * Equivalent to calling `app.destroy()`.
173
+ *
174
+ * @param app - The mounted playground to unmount
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * const app = await mountPlayground(container, options);
179
+ * // ... later
180
+ * unmountPlayground(app);
181
+ * ```
182
+ */
183
+ export declare function unmountPlayground(app: MountedPlayground): void;