@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.
- package/CHANGELOG.md +210 -0
- package/MIGRATION-2.0.md +173 -3
- package/README.md +5 -5
- package/dist/adapters/WorkflowAdapter.js +4 -5
- package/dist/adapters/agentspec/AgentSpecAdapter.js +3 -3
- package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.js +1 -1
- package/dist/chat/commandClassifier.d.ts +11 -0
- package/dist/chat/commandClassifier.js +20 -0
- package/dist/chat/historyBuilder.d.ts +39 -0
- package/dist/chat/historyBuilder.js +82 -0
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/index.js +2 -1
- package/dist/chat/responseParser.js +16 -12
- package/dist/commands/executor.js +51 -26
- package/dist/commands/parser.d.ts +12 -0
- package/dist/commands/parser.js +33 -6
- package/dist/commands/storeIntegration.svelte.js +11 -1
- package/dist/commands/types.js +5 -5
- package/dist/components/App.svelte +547 -386
- package/dist/components/App.svelte.d.ts +16 -8
- package/dist/components/Button.stories.svelte +65 -0
- package/dist/components/Button.stories.svelte.d.ts +19 -0
- package/dist/components/Button.svelte +62 -0
- package/dist/components/Button.svelte.d.ts +24 -0
- package/dist/components/CanvasIconButton.svelte +76 -0
- package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
- package/dist/components/ConfigForm.svelte +194 -565
- package/dist/components/ConfigForm.svelte.d.ts +24 -7
- package/dist/components/ConfigModal.svelte +9 -1
- package/dist/components/ConfigPanel.svelte +234 -15
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/EditorStatusBar.stories.svelte +44 -0
- package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
- package/dist/components/EditorStatusBar.svelte +99 -0
- package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
- package/dist/components/IconButton.svelte +80 -0
- package/dist/components/IconButton.svelte.d.ts +30 -0
- package/dist/components/Input.svelte +74 -0
- package/dist/components/Input.svelte.d.ts +17 -0
- package/dist/components/LogoWordmark.svelte +113 -0
- package/dist/components/LogoWordmark.svelte.d.ts +26 -0
- package/dist/components/Navbar.svelte +17 -63
- package/dist/components/Navbar.svelte.d.ts +3 -0
- package/dist/components/NodeSidebar.svelte +21 -126
- package/dist/components/NodeSwapPicker.svelte +12 -30
- package/dist/components/PipelineStatus.svelte +6 -1
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortMappingRow.svelte +0 -2
- package/dist/components/SchemaForm.svelte +4 -14
- package/dist/components/Select.svelte +53 -0
- package/dist/components/Select.svelte.d.ts +15 -0
- package/dist/components/SettingsModal.svelte +0 -5
- package/dist/components/SettingsPanel.svelte +33 -6
- package/dist/components/Textarea.svelte +39 -0
- package/dist/components/Textarea.svelte.d.ts +12 -0
- package/dist/components/ThemeToggle.svelte +15 -94
- package/dist/components/UniversalNode.svelte +36 -4
- package/dist/components/UniversalNode.svelte.d.ts +1 -1
- package/dist/components/WorkflowEditor.svelte +71 -54
- package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
- package/dist/components/chat/AIChatPanel.svelte +49 -8
- package/dist/components/chat/CommandPreview.svelte +10 -1
- package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
- package/dist/components/console/ConsoleInput.svelte +3 -3
- package/dist/components/console/ConsoleOutput.svelte +2 -2
- package/dist/components/form/FormArray.svelte +37 -173
- package/dist/components/form/FormAutocomplete.svelte +18 -15
- package/dist/components/form/FormCheckboxGroup.svelte +1 -5
- package/dist/components/form/FormCodeEditor.svelte +9 -7
- package/dist/components/form/FormField.svelte +18 -42
- package/dist/components/form/FormFieldLight.svelte +52 -48
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormFieldset.svelte +45 -11
- package/dist/components/form/FormMarkdownEditor.svelte +8 -5
- package/dist/components/form/FormNumberField.svelte +4 -36
- package/dist/components/form/FormPorts.svelte +280 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/form/FormRangeField.svelte +63 -30
- package/dist/components/form/FormSelect.svelte +13 -75
- package/dist/components/form/FormTemplateEditor.svelte +6 -4
- package/dist/components/form/FormTextField.svelte +3 -35
- package/dist/components/form/FormTextarea.svelte +4 -39
- package/dist/components/form/FormToggle.svelte +27 -6
- package/dist/components/form/FormToggle.svelte.d.ts +5 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/form/resolveFieldType.d.ts +24 -0
- package/dist/components/form/resolveFieldType.js +55 -0
- package/dist/components/icons/CloseIcon.svelte +6 -0
- package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
- package/dist/components/icons/CommandLineIcon.svelte +15 -0
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuIcon.svelte +4 -0
- package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuOpenIcon.svelte +6 -0
- package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
- package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
- package/dist/components/interrupt/InterruptBubble.svelte +11 -12
- package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
- package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
- package/dist/components/layouts/MainLayout.svelte +4 -5
- package/dist/components/nodes/AtomNode.svelte +62 -76
- package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
- package/dist/components/nodes/GatewayNode.svelte +117 -164
- package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
- package/dist/components/nodes/IdeaNode.svelte +72 -98
- package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
- package/dist/components/nodes/NodeConfigButton.svelte +86 -0
- package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
- package/dist/components/nodes/NotesNode.svelte +76 -85
- package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
- package/dist/components/nodes/SimpleNode.svelte +59 -133
- package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
- package/dist/components/nodes/SquareNode.svelte +110 -164
- package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
- package/dist/components/nodes/TerminalNode.svelte +62 -124
- package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
- package/dist/components/nodes/ToolNode.svelte +92 -103
- package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
- package/dist/components/nodes/WorkflowNode.svelte +132 -191
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
- package/dist/components/playground/ChatInput.svelte +316 -27
- package/dist/components/playground/ChatInput.svelte.d.ts +31 -1
- package/dist/components/playground/ControlPanel.svelte +22 -0
- package/dist/components/playground/ControlPanel.svelte.d.ts +13 -0
- package/dist/components/playground/InputCollector.svelte +11 -48
- package/dist/components/playground/PipelineKanbanView.svelte +6 -4
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +20 -3
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +6 -4
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +292 -28
- package/dist/components/playground/Playground.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundApp.svelte +6 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundModal.svelte +5 -0
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundStudio.svelte +7 -6
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
- package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
- package/dist/components/surfaces/TabbedSurface.svelte +133 -0
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
- package/dist/config/endpoints.d.ts +71 -1
- package/dist/config/endpoints.js +46 -5
- package/dist/core/index.d.ts +2 -3
- package/dist/core/index.js +2 -6
- package/dist/display/index.d.ts +6 -1
- package/dist/display/index.js +9 -1
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/form/full.d.ts +2 -1
- package/dist/form/full.js +4 -1
- package/dist/form/index.d.ts +0 -1
- package/dist/form/index.js +3 -2
- package/dist/helpers/workflowEditorHelper.d.ts +4 -2
- package/dist/helpers/workflowEditorHelper.js +8 -8
- package/dist/messages/defaults.d.ts +98 -0
- package/dist/messages/defaults.js +58 -1
- package/dist/messages/index.d.ts +1 -1
- package/dist/messages/index.js +1 -1
- package/dist/openapi/v1/openapi.yaml +35 -23
- package/dist/playground/commands/args.d.ts +32 -0
- package/dist/playground/commands/args.js +50 -0
- package/dist/playground/commands/dispatch.d.ts +143 -0
- package/dist/playground/commands/dispatch.js +162 -0
- package/dist/playground/commands/index.d.ts +14 -0
- package/dist/playground/commands/index.js +10 -0
- package/dist/playground/commands/parser.d.ts +38 -0
- package/dist/playground/commands/parser.js +163 -0
- package/dist/playground/commands/registry.d.ts +42 -0
- package/dist/playground/commands/registry.js +122 -0
- package/dist/playground/commands/suggest.d.ts +37 -0
- package/dist/playground/commands/suggest.js +46 -0
- package/dist/playground/commands/types.d.ts +111 -0
- package/dist/playground/commands/types.js +15 -0
- package/dist/playground/index.d.ts +21 -2
- package/dist/playground/index.js +27 -2
- package/dist/playground/mount.d.ts +19 -5
- package/dist/playground/mount.js +16 -8
- package/dist/playground/runAction.d.ts +48 -0
- package/dist/playground/runAction.js +31 -0
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -39
- package/dist/registry/builtinNodes.js +6 -53
- package/dist/registry/nodeComponentRegistry.d.ts +2 -1
- package/dist/schemas/v1/workflow.schema.json +16 -14
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -2
- package/dist/services/apiVariableService.js +12 -26
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +4 -3
- package/dist/services/chatService.js +13 -18
- package/dist/services/dynamicSchemaService.d.ts +31 -4
- package/dist/services/dynamicSchemaService.js +62 -33
- package/dist/services/historyService.d.ts +30 -8
- package/dist/services/historyService.js +51 -15
- package/dist/services/interruptService.d.ts +7 -6
- package/dist/services/interruptService.js +19 -21
- package/dist/services/pipelineSignalService.d.ts +97 -0
- package/dist/services/pipelineSignalService.js +94 -0
- package/dist/services/playgroundService.d.ts +21 -8
- package/dist/services/playgroundService.js +45 -25
- package/dist/services/portConfigApi.js +3 -6
- package/dist/services/settingsService.d.ts +9 -4
- package/dist/services/settingsService.js +23 -12
- package/dist/services/workflowLaunchService.d.ts +74 -0
- package/dist/services/workflowLaunchService.js +74 -0
- package/dist/skins/drafter.d.ts +30 -0
- package/dist/skins/drafter.js +198 -0
- package/dist/skins/index.d.ts +2 -1
- package/dist/skins/index.js +4 -2
- package/dist/stores/apiContext.d.ts +11 -0
- package/dist/stores/apiContext.js +15 -0
- package/dist/stores/categoriesStore.svelte.js +0 -1
- package/dist/stores/historyStore.svelte.d.ts +17 -3
- package/dist/stores/historyStore.svelte.js +30 -3
- package/dist/stores/instanceContainer.svelte.js +5 -0
- package/dist/stores/playgroundStore.svelte.js +1 -3
- package/dist/stores/settingsStore.svelte.d.ts +13 -0
- package/dist/stores/settingsStore.svelte.js +32 -0
- package/dist/stores/workflowStore.svelte.d.ts +42 -5
- package/dist/stores/workflowStore.svelte.js +109 -32
- package/dist/styles/base.css +285 -14
- package/dist/styles/tokens.css +60 -2
- package/dist/svelte-app.d.ts +18 -1
- package/dist/svelte-app.js +75 -110
- package/dist/themes/drafter.d.ts +2 -0
- package/dist/themes/drafter.js +15 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +8 -2
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/chat.d.ts +5 -1
- package/dist/types/events.d.ts +18 -0
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +84 -29
- package/dist/types/index.js +0 -1
- package/dist/types/settings.d.ts +28 -1
- package/dist/types/settings.js +6 -3
- package/dist/types/skin.d.ts +1 -1
- package/dist/types/theme.d.ts +16 -2
- package/dist/types/uischema.d.ts +5 -0
- package/dist/utils/canvasSelection.d.ts +25 -0
- package/dist/utils/canvasSelection.js +37 -0
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.js +23 -0
- package/dist/utils/connections.js +20 -56
- package/dist/utils/edgeStyling.js +9 -5
- package/dist/utils/fetchWithAuth.d.ts +36 -15
- package/dist/utils/fetchWithAuth.js +53 -23
- package/dist/utils/nodeFormSchema.d.ts +51 -0
- package/dist/utils/nodeFormSchema.js +87 -0
- package/dist/utils/nodeIds.d.ts +1 -1
- package/dist/utils/nodeIds.js +1 -1
- package/dist/utils/nodeSwap.js +3 -6
- package/dist/utils/nodeTypes.js +1 -1
- package/dist/utils/portUtils.d.ts +47 -11
- package/dist/utils/portUtils.js +67 -14
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/dist/utils/schemaMerge.d.ts +25 -0
- package/dist/utils/schemaMerge.js +61 -0
- package/package.json +2 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NavbarAction } from '../types/navbar.js';
|
|
1
2
|
import type { NodeMetadata, Workflow, ConfigSchema } from '../types/index.js';
|
|
2
3
|
import type { SwapStrategy } from '../utils/nodeSwap.js';
|
|
3
4
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
@@ -5,7 +6,7 @@ import type { AuthProvider } from '../types/auth.js';
|
|
|
5
6
|
import type { FlowDropEventHandlers, FlowDropFeatures } from '../types/events.js';
|
|
6
7
|
import type { FlowDropTheme, FlowDropThemeName } from '../types/theme.js';
|
|
7
8
|
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
8
|
-
import type { SettingsCategory } from '../types/settings.js';
|
|
9
|
+
import type { SettingsCategory, SurfacePlacement } from '../types/settings.js';
|
|
9
10
|
import type { MessagesOverride } from '../messages/index.js';
|
|
10
11
|
/**
|
|
11
12
|
* Configuration props for runtime customization
|
|
@@ -23,6 +24,19 @@ interface Props {
|
|
|
23
24
|
showNavbar?: boolean;
|
|
24
25
|
/** Disable the node sidebar */
|
|
25
26
|
disableSidebar?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Default host for the node/workflow configuration panel: `sidebar` (right
|
|
29
|
+
* rail), `modal` (centered overlay), or `below` (bottom panel). Seeds the
|
|
30
|
+
* user setting on first load — a value the user later changes wins.
|
|
31
|
+
* @default 'sidebar'
|
|
32
|
+
*/
|
|
33
|
+
configPlacement?: SurfacePlacement;
|
|
34
|
+
/**
|
|
35
|
+
* Default host for the console / AI Assistant group. Seeds the user setting
|
|
36
|
+
* on first load — a value the user later changes wins.
|
|
37
|
+
* @default 'below'
|
|
38
|
+
*/
|
|
39
|
+
consolePlacement?: SurfacePlacement;
|
|
26
40
|
/**
|
|
27
41
|
* Editor interaction mode. Replaces the former `readOnly` + `lockWorkflow`
|
|
28
42
|
* boolean pair (2.0 breaking change).
|
|
@@ -53,13 +67,7 @@ interface Props {
|
|
|
53
67
|
/** Custom navbar title */
|
|
54
68
|
navbarTitle?: string;
|
|
55
69
|
/** Custom navbar actions */
|
|
56
|
-
navbarActions?:
|
|
57
|
-
label: string;
|
|
58
|
-
href: string;
|
|
59
|
-
icon?: string;
|
|
60
|
-
variant?: 'primary' | 'secondary' | 'outline';
|
|
61
|
-
onclick?: (event: Event) => void;
|
|
62
|
-
}>;
|
|
70
|
+
navbarActions?: NavbarAction[];
|
|
63
71
|
/** Show settings gear icon in navbar */
|
|
64
72
|
showSettings?: boolean;
|
|
65
73
|
/** Show the "Connected" status indicator in the navbar (default: true) */
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { ComponentProps } from 'svelte';
|
|
3
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
4
|
+
import Button from './Button.svelte';
|
|
5
|
+
import { fn } from 'storybook/test';
|
|
6
|
+
|
|
7
|
+
const { Story } = defineMeta({
|
|
8
|
+
title: 'Display/Button',
|
|
9
|
+
component: Button,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'centered'
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
variant: {
|
|
16
|
+
control: { type: 'select' },
|
|
17
|
+
options: ['primary', 'secondary', 'outline', 'ghost']
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
control: { type: 'select' },
|
|
21
|
+
options: ['sm', 'md', 'lg']
|
|
22
|
+
},
|
|
23
|
+
disabled: { control: 'boolean' }
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
variant: 'secondary',
|
|
27
|
+
size: 'md',
|
|
28
|
+
disabled: false,
|
|
29
|
+
onclick: fn()
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<!-- Arg-driven template so the Controls panel can tweak variant/size/disabled live. -->
|
|
35
|
+
{#snippet template(args: Omit<ComponentProps<typeof Button>, 'children'>)}
|
|
36
|
+
<Button {...args}>Button</Button>
|
|
37
|
+
{/snippet}
|
|
38
|
+
|
|
39
|
+
<Story name="Primary" args={{ variant: 'primary' }} {template} />
|
|
40
|
+
|
|
41
|
+
<Story name="Secondary" args={{ variant: 'secondary' }} {template} />
|
|
42
|
+
|
|
43
|
+
<Story name="Outline" args={{ variant: 'outline' }} {template} />
|
|
44
|
+
|
|
45
|
+
<Story name="Ghost" args={{ variant: 'ghost' }} {template} />
|
|
46
|
+
|
|
47
|
+
<Story name="Disabled" args={{ variant: 'primary', disabled: true }} {template} />
|
|
48
|
+
|
|
49
|
+
<!-- Static showcases comparing every variant / size side by side. -->
|
|
50
|
+
<Story name="Variants" asChild>
|
|
51
|
+
<div style="display: flex; gap: 0.75rem; align-items: center;">
|
|
52
|
+
<Button variant="primary">Primary</Button>
|
|
53
|
+
<Button variant="secondary">Secondary</Button>
|
|
54
|
+
<Button variant="outline">Outline</Button>
|
|
55
|
+
<Button variant="ghost">Ghost</Button>
|
|
56
|
+
</div>
|
|
57
|
+
</Story>
|
|
58
|
+
|
|
59
|
+
<Story name="Sizes" asChild>
|
|
60
|
+
<div style="display: flex; gap: 0.75rem; align-items: center;">
|
|
61
|
+
<Button variant="primary" size="sm">Small</Button>
|
|
62
|
+
<Button variant="primary" size="md">Medium</Button>
|
|
63
|
+
<Button variant="primary" size="lg">Large</Button>
|
|
64
|
+
</div>
|
|
65
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Button from './Button.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Button: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Button = InstanceType<typeof Button>;
|
|
19
|
+
export default Button;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Button — typed wrapper over the shared `.flowdrop-btn` system (base.css).
|
|
3
|
+
|
|
4
|
+
All button styling (variants, sizes, the --fd-size-btn-min height token and the
|
|
5
|
+
centralized focus ring) lives in base.css. This component is the ergonomic,
|
|
6
|
+
type-safe entry point so callers pick `variant`/`size` instead of hand-writing
|
|
7
|
+
class strings — the single place new buttons should route through.
|
|
8
|
+
|
|
9
|
+
Internal for now (not exported from any public entry) so the API isn't frozen
|
|
10
|
+
before GA. Existing hand-rolled buttons migrate onto it incrementally.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import type { Snippet } from 'svelte';
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
/** Visual style — maps to `.flowdrop-btn--{variant}` in base.css */
|
|
18
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
19
|
+
/** Size — `md` is the base `.flowdrop-btn`; `sm`/`lg` add a modifier */
|
|
20
|
+
size?: 'sm' | 'md' | 'lg';
|
|
21
|
+
/** Native button type */
|
|
22
|
+
type?: 'button' | 'submit' | 'reset';
|
|
23
|
+
/** Tooltip text */
|
|
24
|
+
title?: string;
|
|
25
|
+
/** Accessible label (use when the button is icon-only) */
|
|
26
|
+
ariaLabel?: string;
|
|
27
|
+
/** Disabled state */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Extra classes appended to the root button */
|
|
30
|
+
class?: string;
|
|
31
|
+
/** Click handler */
|
|
32
|
+
onclick?: (event: MouseEvent) => void;
|
|
33
|
+
/** Button contents (icon, label, or both) */
|
|
34
|
+
children: Snippet;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let {
|
|
38
|
+
variant = 'secondary',
|
|
39
|
+
size = 'md',
|
|
40
|
+
type = 'button',
|
|
41
|
+
title,
|
|
42
|
+
ariaLabel,
|
|
43
|
+
disabled = false,
|
|
44
|
+
class: className = '',
|
|
45
|
+
onclick,
|
|
46
|
+
children
|
|
47
|
+
}: Props = $props();
|
|
48
|
+
|
|
49
|
+
// 'md' is the unmodified base class; only 'sm'/'lg' need a size modifier.
|
|
50
|
+
const sizeClass = $derived(size === 'md' ? '' : `flowdrop-btn--${size}`);
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<button
|
|
54
|
+
class="flowdrop-btn flowdrop-btn--{variant} {sizeClass} {className}"
|
|
55
|
+
{type}
|
|
56
|
+
{title}
|
|
57
|
+
{disabled}
|
|
58
|
+
aria-label={ariaLabel}
|
|
59
|
+
{onclick}
|
|
60
|
+
>
|
|
61
|
+
{@render children()}
|
|
62
|
+
</button>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Visual style — maps to `.flowdrop-btn--{variant}` in base.css */
|
|
4
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
5
|
+
/** Size — `md` is the base `.flowdrop-btn`; `sm`/`lg` add a modifier */
|
|
6
|
+
size?: 'sm' | 'md' | 'lg';
|
|
7
|
+
/** Native button type */
|
|
8
|
+
type?: 'button' | 'submit' | 'reset';
|
|
9
|
+
/** Tooltip text */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Accessible label (use when the button is icon-only) */
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
/** Disabled state */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Extra classes appended to the root button */
|
|
16
|
+
class?: string;
|
|
17
|
+
/** Click handler */
|
|
18
|
+
onclick?: (event: MouseEvent) => void;
|
|
19
|
+
/** Button contents (icon, label, or both) */
|
|
20
|
+
children: Snippet;
|
|
21
|
+
}
|
|
22
|
+
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
23
|
+
type Button = ReturnType<typeof Button>;
|
|
24
|
+
export default Button;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
/**
|
|
6
|
+
* The icon to render — an inline-SVG snippet (offline-safe). Pass a local
|
|
7
|
+
* icon component from `$lib/components/icons/`, not a network-fetched one.
|
|
8
|
+
*/
|
|
9
|
+
icon: Snippet;
|
|
10
|
+
/** Accessible label — drives both aria-label and the hover title. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Renders the active/toggled-on visual state (e.g. the panel it controls is open). */
|
|
13
|
+
active?: boolean;
|
|
14
|
+
onclick: () => void;
|
|
15
|
+
/** Caller-supplied class for positioning (top/left/bottom/z-index). */
|
|
16
|
+
class?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let { icon, label, active = false, onclick, class: klass = '' }: Props = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<button
|
|
23
|
+
class="flowdrop-canvas-btn {klass}"
|
|
24
|
+
class:flowdrop-canvas-btn--active={active}
|
|
25
|
+
{onclick}
|
|
26
|
+
aria-label={label}
|
|
27
|
+
title={label}
|
|
28
|
+
type="button"
|
|
29
|
+
>
|
|
30
|
+
{@render icon()}
|
|
31
|
+
</button>
|
|
32
|
+
|
|
33
|
+
<style>
|
|
34
|
+
.flowdrop-canvas-btn {
|
|
35
|
+
position: absolute;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
width: 2.25rem;
|
|
40
|
+
height: 2.25rem;
|
|
41
|
+
border: 1px solid var(--fd-border);
|
|
42
|
+
border-radius: var(--fd-radius-md);
|
|
43
|
+
background-color: var(--fd-background);
|
|
44
|
+
color: var(--fd-muted-foreground);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
box-shadow: var(--fd-shadow-md);
|
|
47
|
+
transition:
|
|
48
|
+
color var(--fd-transition-fast),
|
|
49
|
+
background-color var(--fd-transition-fast),
|
|
50
|
+
box-shadow var(--fd-transition-fast),
|
|
51
|
+
border-color var(--fd-transition-fast);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Size whatever inline SVG the caller renders. */
|
|
55
|
+
.flowdrop-canvas-btn :global(svg) {
|
|
56
|
+
width: 18px;
|
|
57
|
+
height: 18px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.flowdrop-canvas-btn:hover {
|
|
61
|
+
color: var(--fd-foreground);
|
|
62
|
+
background-color: var(--fd-subtle);
|
|
63
|
+
box-shadow: var(--fd-shadow-lg);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.flowdrop-canvas-btn--active {
|
|
67
|
+
color: var(--fd-primary);
|
|
68
|
+
background-color: var(--fd-primary-muted);
|
|
69
|
+
border-color: var(--fd-primary);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.flowdrop-canvas-btn--active:hover {
|
|
73
|
+
color: var(--fd-primary);
|
|
74
|
+
background-color: var(--fd-primary-muted);
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* The icon to render — an inline-SVG snippet (offline-safe). Pass a local
|
|
5
|
+
* icon component from `$lib/components/icons/`, not a network-fetched one.
|
|
6
|
+
*/
|
|
7
|
+
icon: Snippet;
|
|
8
|
+
/** Accessible label — drives both aria-label and the hover title. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Renders the active/toggled-on visual state (e.g. the panel it controls is open). */
|
|
11
|
+
active?: boolean;
|
|
12
|
+
onclick: () => void;
|
|
13
|
+
/** Caller-supplied class for positioning (top/left/bottom/z-index). */
|
|
14
|
+
class?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const CanvasIconButton: import("svelte").Component<Props, {}, "">;
|
|
17
|
+
type CanvasIconButton = ReturnType<typeof CanvasIconButton>;
|
|
18
|
+
export default CanvasIconButton;
|