@flowdrop/flowdrop 1.3.0 → 1.4.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.
@@ -9,6 +9,7 @@
9
9
  import MainLayout from "./layouts/MainLayout.svelte";
10
10
  import WorkflowEditor from "./WorkflowEditor.svelte";
11
11
  import NodeSidebar from "./NodeSidebar.svelte";
12
+ import Icon from "@iconify/svelte";
12
13
  import ConfigForm from "./ConfigForm.svelte";
13
14
  import ConfigPanel from "./ConfigPanel.svelte";
14
15
  import Navbar from "./Navbar.svelte";
@@ -46,12 +47,16 @@
46
47
  } from "../services/globalSave.js";
47
48
  import { apiToasts, dismissToast } from "../services/toastService.js";
48
49
  import { initAutoSave } from "../services/autoSaveService.js";
49
- import { getUiSettings } from "../stores/settingsStore.svelte.js";
50
+ import {
51
+ getUiSettings,
52
+ updateSettings,
53
+ } from "../stores/settingsStore.svelte.js";
50
54
  import { initializePortCompatibility } from "../utils/connections.js";
51
55
  import { DEFAULT_PORT_CONFIG } from "../config/defaultPortConfig.js";
52
56
  import { workflowFormatRegistry } from "../registry/workflowFormatRegistry.js";
53
57
  import { logger } from "../utils/logger.js";
54
58
  import { validateWorkflowData } from "../utils/validation.js";
59
+ import type { SettingsCategory } from "../types/settings.js";
55
60
 
56
61
  /**
57
62
  * Configuration props for runtime customization
@@ -104,6 +109,12 @@
104
109
  features?: FlowDropFeatures;
105
110
  /** Visual theme — named built-in ('default' | 'minimal') or custom theme object */
106
111
  theme?: FlowDropTheme | FlowDropThemeName;
112
+ /** Which settings tabs to show in the modal */
113
+ settingsCategories?: SettingsCategory[];
114
+ /** Show the "Sync to Cloud" button in the settings modal */
115
+ showSettingsSyncButton?: boolean;
116
+ /** Show the reset buttons in the settings modal */
117
+ showSettingsResetButton?: boolean;
107
118
  }
108
119
 
109
120
  let {
@@ -126,6 +137,9 @@
126
137
  eventHandlers,
127
138
  features: propFeatures,
128
139
  theme: themeProp,
140
+ settingsCategories,
141
+ showSettingsSyncButton,
142
+ showSettingsResetButton,
129
143
  }: Props = $props();
130
144
 
131
145
  // svelte-ignore state_referenced_locally — feature flags don't change at runtime
@@ -667,12 +681,22 @@
667
681
 
668
682
  /**
669
683
  * Calculate left sidebar width based on collapsed state
670
- * When collapsed, use 48px; otherwise use user-configured width
684
+ * When collapsed, use 0; otherwise use user-configured width
671
685
  */
672
686
  const leftSidebarWidth = $derived(
673
- getUiSettings().sidebarCollapsed ? 48 : getUiSettings().sidebarWidth,
687
+ getUiSettings().sidebarCollapsed ? 0 : getUiSettings().sidebarWidth,
674
688
  );
675
689
 
690
+ /** Whether the sidebar is collapsed */
691
+ const isSidebarCollapsed = $derived(getUiSettings().sidebarCollapsed);
692
+
693
+ /** Toggle sidebar collapsed state */
694
+ function toggleSidebar(): void {
695
+ updateSettings({
696
+ ui: { sidebarCollapsed: !getUiSettings().sidebarCollapsed },
697
+ });
698
+ }
699
+
676
700
  // File input reference for workflow import
677
701
  let fileInputRef = $state<HTMLInputElement | null>(null);
678
702
  </script>
@@ -705,8 +729,8 @@
705
729
  headerHeight={60}
706
730
  {leftSidebarWidth}
707
731
  rightSidebarWidth={400}
708
- leftSidebarMinWidth={getUiSettings().sidebarCollapsed ? 48 : 280}
709
- leftSidebarMaxWidth={getUiSettings().sidebarCollapsed ? 48 : 450}
732
+ leftSidebarMinWidth={getUiSettings().sidebarCollapsed ? 0 : 280}
733
+ leftSidebarMaxWidth={getUiSettings().sidebarCollapsed ? 0 : 450}
710
734
  rightSidebarMinWidth={320}
711
735
  rightSidebarMaxWidth={550}
712
736
  enableLeftSplitPane={false}
@@ -763,6 +787,9 @@
763
787
  ]}
764
788
  showStatus={true}
765
789
  {showSettings}
790
+ {settingsCategories}
791
+ {showSettingsSyncButton}
792
+ {showSettingsResetButton}
766
793
  />
767
794
  {/snippet}
768
795
 
@@ -974,6 +1001,20 @@
974
1001
  role="region"
975
1002
  aria-label="Workflow canvas"
976
1003
  >
1004
+ <!-- Floating sidebar toggle — always visible on the canvas top-left -->
1005
+ {#if !disableSidebar}
1006
+ <button
1007
+ class="flowdrop-sidebar-fab"
1008
+ onclick={toggleSidebar}
1009
+ aria-label={isSidebarCollapsed
1010
+ ? "Expand sidebar"
1011
+ : "Collapse sidebar"}
1012
+ title={isSidebarCollapsed ? "Expand sidebar" : "Collapse sidebar"}
1013
+ >
1014
+ <Icon icon={isSidebarCollapsed ? "mdi:menu" : "mdi:menu-open"} />
1015
+ </button>
1016
+ {/if}
1017
+
977
1018
  <WorkflowEditor
978
1019
  bind:this={workflowEditorRef}
979
1020
  {nodes}
@@ -1098,6 +1139,40 @@
1098
1139
  font-weight: 500;
1099
1140
  }
1100
1141
 
1142
+ /* Floating sidebar toggle button */
1143
+ .flowdrop-sidebar-fab {
1144
+ position: absolute;
1145
+ top: 12px;
1146
+ left: 12px;
1147
+ z-index: 50;
1148
+ display: flex;
1149
+ align-items: center;
1150
+ justify-content: center;
1151
+ width: 2.25rem;
1152
+ height: 2.25rem;
1153
+ border: 1px solid var(--fd-border);
1154
+ border-radius: var(--fd-radius-md);
1155
+ background-color: var(--fd-background);
1156
+ color: var(--fd-muted-foreground);
1157
+ cursor: pointer;
1158
+ box-shadow: var(--fd-shadow-md);
1159
+ transition:
1160
+ color var(--fd-transition-fast),
1161
+ background-color var(--fd-transition-fast),
1162
+ box-shadow var(--fd-transition-fast);
1163
+ }
1164
+
1165
+ .flowdrop-sidebar-fab:hover {
1166
+ color: var(--fd-foreground);
1167
+ background-color: var(--fd-subtle);
1168
+ box-shadow: var(--fd-shadow-lg);
1169
+ }
1170
+
1171
+ .flowdrop-sidebar-fab:focus {
1172
+ outline: none;
1173
+ box-shadow: 0 0 0 2px var(--fd-ring);
1174
+ }
1175
+
1101
1176
  /* Main editor area */
1102
1177
  .flowdrop-editor-main {
1103
1178
  flex: 1;
@@ -3,6 +3,7 @@ import type { EndpointConfig } from "../config/endpoints.js";
3
3
  import type { AuthProvider } from "../types/auth.js";
4
4
  import type { FlowDropEventHandlers, FlowDropFeatures } from "../types/events.js";
5
5
  import type { FlowDropTheme, FlowDropThemeName } from "../types/theme.js";
6
+ import type { SettingsCategory } from "../types/settings.js";
6
7
  /**
7
8
  * Configuration props for runtime customization
8
9
  */
@@ -51,6 +52,12 @@ interface Props {
51
52
  features?: FlowDropFeatures;
52
53
  /** Visual theme — named built-in ('default' | 'minimal') or custom theme object */
53
54
  theme?: FlowDropTheme | FlowDropThemeName;
55
+ /** Which settings tabs to show in the modal */
56
+ settingsCategories?: SettingsCategory[];
57
+ /** Show the "Sync to Cloud" button in the settings modal */
58
+ showSettingsSyncButton?: boolean;
59
+ /** Show the reset buttons in the settings modal */
60
+ showSettingsResetButton?: boolean;
54
61
  }
55
62
  declare const App: import("svelte").Component<Props, {}, "">;
56
63
  type App = ReturnType<typeof App>;
@@ -2,6 +2,7 @@
2
2
  import { defineMeta } from "@storybook/addon-svelte-csf";
3
3
  import CanvasBanner from "./CanvasBanner.svelte";
4
4
  import CanvasDecorator from "../stories/CanvasDecorator.svelte";
5
+ import Icon from "@iconify/svelte";
5
6
 
6
7
  const { Story } = defineMeta({
7
8
  title: "Display/CanvasBanner",
@@ -17,8 +18,11 @@
17
18
  <CanvasBanner
18
19
  title="Empty Canvas"
19
20
  description="Drag nodes from the sidebar to get started"
20
- iconName="heroicons:squares-plus"
21
- />
21
+ >
22
+ {#snippet icon()}
23
+ <Icon icon="heroicons:squares-plus" />
24
+ {/snippet}
25
+ </CanvasBanner>
22
26
  </CanvasDecorator>
23
27
  </Story>
24
28
 
@@ -6,7 +6,7 @@
6
6
  Approach:
7
7
  1. Compute the full bezier path (xyflow's getBezierPath)
8
8
  2. Parse the SVG path to extract the cubic bezier control points
9
- 3. Evaluate the curve near the end to get the true visual tangent
9
+ 3. Compute exact tangent at endpoint via bezier derivative P'(1) = 3(P3-P2)
10
10
  4. Shorten the path along that tangent and draw the arrowhead at the target
11
11
  -->
12
12
 
@@ -42,32 +42,6 @@
42
42
  return match ? match[1].trim() : "var(--fd-edge-data, #64748b)";
43
43
  });
44
44
 
45
- /**
46
- * Evaluate a cubic bezier at parameter t.
47
- * P(t) = (1-t)^3 * P0 + 3(1-t)^2 * t * P1 + 3(1-t) * t^2 * P2 + t^3 * P3
48
- */
49
- function bezierAt(
50
- p0x: number,
51
- p0y: number,
52
- p1x: number,
53
- p1y: number,
54
- p2x: number,
55
- p2y: number,
56
- p3x: number,
57
- p3y: number,
58
- t: number,
59
- ): { x: number; y: number } {
60
- const u = 1 - t;
61
- const uu = u * u;
62
- const uuu = uu * u;
63
- const tt = t * t;
64
- const ttt = tt * t;
65
- return {
66
- x: uuu * p0x + 3 * uu * t * p1x + 3 * u * tt * p2x + ttt * p3x,
67
- y: uuu * p0y + 3 * uu * t * p1y + 3 * u * tt * p2y + ttt * p3y,
68
- };
69
- }
70
-
71
45
  /**
72
46
  * Parse the SVG cubic bezier path "M x0,y0 C x1,y1 x2,y2 x3,y3"
73
47
  * into the four control points.
@@ -87,9 +61,6 @@
87
61
  };
88
62
  }
89
63
 
90
- // Parameter near the end of the curve for tangent sampling
91
- const T_SAMPLE = 0.9;
92
-
93
64
  let computed = $derived.by(() => {
94
65
  // 1. Get the full bezier path from xyflow
95
66
  const [fullPath, lx, ly] = getBezierPath({
@@ -108,30 +79,18 @@
108
79
  return { path: fullPath, labelX: lx, labelY: ly, angleDeg: 0 };
109
80
  }
110
81
 
111
- // 3. Evaluate the curve at T_SAMPLE to get a reference point
112
- const ref = bezierAt(
113
- cp.p0x,
114
- cp.p0y,
115
- cp.p1x,
116
- cp.p1y,
117
- cp.p2x,
118
- cp.p2y,
119
- cp.p3x,
120
- cp.p3y,
121
- T_SAMPLE,
122
- );
123
-
124
- // 4. Tangent direction: from reference point to the target
125
- const dx = targetX - ref.x;
126
- const dy = targetY - ref.y;
82
+ // 3. Compute exact tangent at curve endpoint using bezier derivative:
83
+ // P'(1) = 3 * (P3 - P2), giving the true arrival direction
84
+ const dx = cp.p3x - cp.p2x;
85
+ const dy = cp.p3y - cp.p2y;
127
86
  const angleDeg = (Math.atan2(dy, dx) * 180) / Math.PI;
128
87
  const angleRad = Math.atan2(dy, dx);
129
88
 
130
- // 5. Shorten: move the endpoint back along the tangent
89
+ // 4. Shorten: move the endpoint back along the tangent
131
90
  const adjX = targetX - Math.cos(angleRad) * ARROW_LENGTH_PX;
132
91
  const adjY = targetY - Math.sin(angleRad) * ARROW_LENGTH_PX;
133
92
 
134
- // 6. Recompute the bezier path with the shortened target
93
+ // 5. Recompute the bezier path with the shortened target
135
94
  const [shortenedPath] = getBezierPath({
136
95
  sourceX,
137
96
  sourceY,
@@ -82,23 +82,23 @@
82
82
 
83
83
  <style>
84
84
  .flowdrop-logo {
85
- --logo-bg: #f9f9f9;
86
- --logo-stroke: #000000;
87
- --logo-line-fill: #000000;
88
- --logo-drop: #009cde;
89
- --logo-circle: #f46351;
90
- --logo-left: #ccbaf4;
91
- --logo-right: #ffc423;
85
+ --logo-bg: var(--fd-logo-bg, #f9f9f9);
86
+ --logo-stroke: var(--fd-logo-stroke, #000000);
87
+ --logo-line-fill: var(--fd-logo-line-fill, #000000);
88
+ --logo-drop: var(--fd-logo-drop, #009cde);
89
+ --logo-circle: var(--fd-logo-circle, #f46351);
90
+ --logo-left: var(--fd-logo-left, #ccbaf4);
91
+ --logo-right: var(--fd-logo-right, #ffc423);
92
92
  }
93
93
 
94
94
  :global([data-theme="dark"]) .flowdrop-logo {
95
- --logo-bg: none;
96
- --logo-stroke: #ffffff;
97
- --logo-line-fill: none;
98
- --logo-drop: none;
99
- --logo-circle: none;
100
- --logo-left: none;
101
- --logo-right: none;
95
+ --logo-bg: var(--fd-logo-bg, none);
96
+ --logo-stroke: var(--fd-logo-stroke, #ffffff);
97
+ --logo-line-fill: var(--fd-logo-line-fill, none);
98
+ --logo-drop: var(--fd-logo-drop, none);
99
+ --logo-circle: var(--fd-logo-circle, none);
100
+ --logo-left: var(--fd-logo-left, none);
101
+ --logo-right: var(--fd-logo-right, none);
102
102
  }
103
103
 
104
104
  .flowdrop-logo :global(svg) {
@@ -10,6 +10,7 @@
10
10
  import Icon from "@iconify/svelte";
11
11
  import Logo from "./Logo.svelte";
12
12
  import SettingsModal from "./SettingsModal.svelte";
13
+ import type { SettingsCategory } from "../types/settings.js";
13
14
 
14
15
  interface NavbarAction {
15
16
  label: string;
@@ -38,6 +39,12 @@
38
39
  breadcrumbs?: BreadcrumbItem[];
39
40
  /** Show settings gear icon */
40
41
  showSettings?: boolean;
42
+ /** Which settings tabs to show in the modal */
43
+ settingsCategories?: SettingsCategory[];
44
+ /** Show the "Sync to Cloud" button in the settings modal */
45
+ showSettingsSyncButton?: boolean;
46
+ /** Show the reset buttons in the settings modal */
47
+ showSettingsResetButton?: boolean;
41
48
  }
42
49
 
43
50
  let {
@@ -46,6 +53,9 @@
46
53
  title,
47
54
  breadcrumbs = [],
48
55
  showSettings = true,
56
+ settingsCategories,
57
+ showSettingsSyncButton,
58
+ showSettingsResetButton,
49
59
  }: Props = $props();
50
60
 
51
61
  // Dropdown state
@@ -263,7 +273,16 @@
263
273
 
264
274
  <!-- Settings Modal -->
265
275
  {#if showSettings}
266
- <SettingsModal bind:open={isSettingsOpen} />
276
+ {@const settingsModalProps = {
277
+ ...(settingsCategories !== undefined && { categories: settingsCategories }),
278
+ ...(showSettingsSyncButton !== undefined && {
279
+ showSyncButton: showSettingsSyncButton,
280
+ }),
281
+ ...(showSettingsResetButton !== undefined && {
282
+ showResetButton: showSettingsResetButton,
283
+ }),
284
+ }}
285
+ <SettingsModal bind:open={isSettingsOpen} {...settingsModalProps} />
267
286
  {/if}
268
287
 
269
288
  <style>
@@ -739,16 +758,50 @@
739
758
  }
740
759
 
741
760
  .flowdrop-navbar__start {
742
- width: 280px;
743
- min-width: 280px;
761
+ width: auto;
762
+ min-width: auto;
763
+ flex-shrink: 0;
744
764
  }
745
765
 
746
- .flowdrop-navbar__actions {
766
+ .flowdrop-navbar__center {
767
+ min-width: 0;
768
+ overflow: hidden;
769
+ }
770
+
771
+ .flowdrop-navbar__breadcrumb-list {
772
+ overflow: hidden;
773
+ }
774
+
775
+ /* Show only icons for non-current breadcrumb items */
776
+ .flowdrop-navbar__breadcrumb-link .flowdrop-navbar__breadcrumb-text {
777
+ display: none;
778
+ }
779
+
780
+ .flowdrop-navbar__breadcrumb-current .flowdrop-navbar__breadcrumb-text {
781
+ overflow: hidden;
782
+ text-overflow: ellipsis;
783
+ }
784
+
785
+ /* Force dropdown mode on small screens regardless of theme */
786
+ .flowdrop-navbar__split-actions {
787
+ display: none;
788
+ }
789
+
790
+ .flowdrop-navbar__dropdown-mode {
791
+ display: flex;
792
+ }
793
+
794
+ .flowdrop-navbar__action-label {
747
795
  display: none;
748
796
  }
749
797
 
798
+ .flowdrop-navbar__primary-action {
799
+ padding: 0.5rem;
800
+ border-radius: var(--fd-radius-md) 0 0 var(--fd-radius-md);
801
+ }
802
+
750
803
  .flowdrop-text--logo {
751
- font-size: 1rem;
804
+ display: none;
752
805
  }
753
806
 
754
807
  .flowdrop-text--tagline {
@@ -767,11 +820,6 @@
767
820
  }
768
821
 
769
822
  @media (max-width: 480px) {
770
- .flowdrop-navbar__start {
771
- width: 240px;
772
- min-width: 240px;
773
- }
774
-
775
823
  .flowdrop-navbar__title-text {
776
824
  font-size: 0.75rem;
777
825
  max-width: 200px;
@@ -1,3 +1,4 @@
1
+ import type { SettingsCategory } from "../types/settings.js";
1
2
  interface NavbarAction {
2
3
  label: string;
3
4
  href: string;
@@ -23,6 +24,12 @@ interface Props {
23
24
  breadcrumbs?: BreadcrumbItem[];
24
25
  /** Show settings gear icon */
25
26
  showSettings?: boolean;
27
+ /** Which settings tabs to show in the modal */
28
+ settingsCategories?: SettingsCategory[];
29
+ /** Show the "Sync to Cloud" button in the settings modal */
30
+ showSettingsSyncButton?: boolean;
31
+ /** Show the reset buttons in the settings modal */
32
+ showSettingsResetButton?: boolean;
26
33
  }
27
34
  declare const Navbar: import("svelte").Component<Props, {}, "">;
28
35
  type Navbar = ReturnType<typeof Navbar>;