@foresthubai/workflow-builder 0.3.0 → 0.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.
- package/LICENSE +661 -661
- package/NOTICE +16 -16
- package/README.md +110 -93
- package/dist/components/ui/command.d.ts +2 -2
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/graph/BaseNode.js +10 -10
- package/dist/graph/reactFlowRegistry.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/toolbars/CanvasTabsToolbar.d.ts +11 -0
- package/dist/toolbars/CanvasTabsToolbar.d.ts.map +1 -0
- package/dist/toolbars/CanvasTabsToolbar.js +101 -0
- package/dist/toolbars/CanvasTabsToolbar.js.map +1 -0
- package/package.json +2 -2
- package/src/BuilderLayout.tsx +345 -345
- package/src/Canvas.tsx +261 -261
- package/src/CanvasEditor.tsx +142 -142
- package/src/CanvasTabsToolbar.tsx +176 -176
- package/src/RightConfigPanel.tsx +266 -266
- package/src/WorkflowBuilder.tsx +412 -412
- package/src/cn.ts +6 -6
- package/src/components/ui/add-button.tsx +39 -39
- package/src/components/ui/alert-dialog.tsx +141 -141
- package/src/components/ui/alert.tsx +59 -59
- package/src/components/ui/badge.tsx +36 -36
- package/src/components/ui/button.tsx +85 -85
- package/src/components/ui/card.tsx +79 -79
- package/src/components/ui/checkbox.tsx +28 -28
- package/src/components/ui/collapsible.tsx +9 -9
- package/src/components/ui/command.tsx +153 -153
- package/src/components/ui/delete-button.tsx +23 -23
- package/src/components/ui/dialog.tsx +125 -125
- package/src/components/ui/dropdown-menu.tsx +198 -198
- package/src/components/ui/input.tsx +55 -55
- package/src/components/ui/label.tsx +24 -24
- package/src/components/ui/readonly-banner.tsx +15 -15
- package/src/components/ui/resizable.tsx +43 -43
- package/src/components/ui/scroll-area.tsx +102 -102
- package/src/components/ui/select.tsx +160 -160
- package/src/components/ui/separator.tsx +29 -29
- package/src/components/ui/switch.tsx +27 -27
- package/src/components/ui/textarea.tsx +51 -51
- package/src/components/ui/toast.tsx +127 -127
- package/src/components/ui/toaster.tsx +33 -33
- package/src/components/ui/toggle-group.tsx +59 -59
- package/src/components/ui/toggle.tsx +43 -43
- package/src/components/ui/tooltip.tsx +32 -32
- package/src/dialogs/NodePickerDialog.tsx +84 -84
- package/src/dialogs/ValidationDialog.tsx +184 -184
- package/src/graph/BaseNode.tsx +557 -557
- package/src/graph/CustomEdge.tsx +185 -185
- package/src/graph/CustomNode.tsx +16 -16
- package/src/graph/FunctionCallNode.tsx +30 -30
- package/src/graph/PortHandle.tsx +189 -189
- package/src/graph/reactFlowRegistry.ts +26 -26
- package/src/hooks/use-toast.ts +125 -125
- package/src/hooks/useAvailableVariables.ts +20 -20
- package/src/hooks/useCanvasHistory.ts +22 -22
- package/src/hooks/useCanvasTabs.ts +168 -168
- package/src/hooks/useFunctionDiagnosticsSync.ts +40 -40
- package/src/hooks/useFunctionRegistry.ts +26 -26
- package/src/hooks/useFunctions.ts +44 -44
- package/src/hooks/useGraph.ts +161 -161
- package/src/hooks/useNodeDefinitions.ts +82 -82
- package/src/hooks/useParamErrors.ts +26 -26
- package/src/hooks/useResolvedTheme.ts +30 -30
- package/src/hooks/useResourceDiagnosticsSync.ts +58 -58
- package/src/hooks/useSuppressThemeTransition.ts +79 -79
- package/src/hooks/useWorkflowSerialization.ts +127 -127
- package/src/i18n/index.ts +53 -53
- package/src/i18n/locales/de.json +501 -501
- package/src/i18n/locales/en.json +557 -557
- package/src/index.ts +27 -27
- package/src/inputs/ExpressionInput.tsx +297 -297
- package/src/inputs/ParameterEditor.tsx +515 -515
- package/src/inputs/PortSection.tsx +144 -144
- package/src/panels/BuilderSidebar.tsx +301 -301
- package/src/panels/ChannelConfigPanel.tsx +49 -49
- package/src/panels/ChannelsPanel.tsx +28 -28
- package/src/panels/DebugConsolePanel.tsx +73 -73
- package/src/panels/DebugContextPanel.tsx +77 -77
- package/src/panels/DebugExternalIOPanel.tsx +180 -180
- package/src/panels/DiagnosticsPanel.tsx +170 -170
- package/src/panels/EdgeConfigPanel.tsx +104 -104
- package/src/panels/FunctionConfigPanel.tsx +179 -179
- package/src/panels/FunctionListPanel.tsx +45 -45
- package/src/panels/MemoryConfigPanel.tsx +55 -55
- package/src/panels/MemoryPanel.tsx +40 -40
- package/src/panels/ModelConfigPanel.tsx +41 -41
- package/src/panels/ModelsPanel.tsx +36 -36
- package/src/panels/NodeConfigPanel.tsx +630 -630
- package/src/panels/NodeLibrary.tsx +288 -288
- package/src/panels/ResourceConfigPanel.tsx +132 -132
- package/src/panels/ResourceListPanel.tsx +113 -113
- package/src/panels/VariableConfigPanel.tsx +161 -161
- package/src/panels/VariablesPanel.tsx +145 -145
- package/src/stores/canvasStore.test.ts +44 -44
- package/src/stores/canvasStore.ts +245 -245
- package/src/stores/debugStore.ts +74 -74
- package/src/stores/diagnosticsStore.ts +130 -130
- package/src/stores/editorStore.ts +202 -202
- package/src/styles/index.css +526 -526
- package/src/utils/categoryConstants.ts +26 -26
- package/src/utils/channelOperations.ts +86 -86
- package/src/utils/connectionRules.ts +137 -137
- package/src/utils/functionOperations.ts +179 -179
- package/src/utils/graphOperations.ts +550 -550
- package/src/utils/history.ts +207 -207
- package/src/utils/memoryOperations.ts +57 -57
- package/src/utils/migrateFunctionNodes.ts +107 -107
- package/src/utils/modelOperations.ts +55 -55
- package/src/utils/paramDisplay.ts +71 -71
- package/src/utils/resourceHelpers.ts +32 -32
- package/src/utils/translation.ts +28 -28
- package/src/utils/variableOperations.ts +75 -75
- package/tailwind-preset.ts +166 -166
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { declaredVarKey, type DeclaredVariable } from "@foresthubai/workflow-core/variable";
|
|
2
|
-
import type { DataType } from "@foresthubai/workflow-core";
|
|
3
|
-
import { getOrCreateCanvasStore } from "../stores/canvasStore";
|
|
4
|
-
import { useEditorStore } from "../stores/editorStore";
|
|
5
|
-
import { generateId } from "@foresthubai/workflow-core/id";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Per-canvas mutation helpers for declared variables. Mirrors
|
|
9
|
-
* utils/modelOperations.ts, but declared variables are canvas-scoped (they live
|
|
10
|
-
* in canvasStore.variables, not editorStore), so every helper takes a canvasId.
|
|
11
|
-
*
|
|
12
|
-
* Each write takes a history checkpoint first, matching the inline editor it
|
|
13
|
-
* replaces, so a single edit is one undo step.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/** Pick a fresh `var<N>` name that doesn't collide with existing declared variables. */
|
|
17
|
-
function nextDefaultName(existingNames: string[]): string {
|
|
18
|
-
let counter = 1;
|
|
19
|
-
while (existingNames.includes(`var${counter}`)) counter++;
|
|
20
|
-
return `var${counter}`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** Create a new declared variable on the given canvas. Returns its uid. */
|
|
24
|
-
export function addDeclaredVariable(canvasId: string): string {
|
|
25
|
-
const store = getOrCreateCanvasStore(canvasId);
|
|
26
|
-
store.takeCheckpoint();
|
|
27
|
-
const existingNames = Object.values(store.getState().variables)
|
|
28
|
-
.filter((v): v is DeclaredVariable => v.kind === "declared")
|
|
29
|
-
.map((v) => v.name);
|
|
30
|
-
const uid = generateId();
|
|
31
|
-
const newVar: DeclaredVariable = {
|
|
32
|
-
kind: "declared",
|
|
33
|
-
uid,
|
|
34
|
-
name: nextDefaultName(existingNames),
|
|
35
|
-
dataType: "int",
|
|
36
|
-
};
|
|
37
|
-
store.getState().setVariables((vars) => ({ ...vars, [declaredVarKey(uid)]: newVar }));
|
|
38
|
-
return uid;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** Apply a partial patch to a declared variable. `kind`/`uid` are fixed. */
|
|
42
|
-
export function updateDeclaredVariable(canvasId: string, uid: string, updates: Partial<Omit<DeclaredVariable, "kind" | "uid">>): void {
|
|
43
|
-
const store = getOrCreateCanvasStore(canvasId);
|
|
44
|
-
store.takeCheckpoint();
|
|
45
|
-
const key = declaredVarKey(uid);
|
|
46
|
-
store.getState().setVariables((vars) => {
|
|
47
|
-
const existing = vars[key];
|
|
48
|
-
if (!existing || existing.kind !== "declared") return vars;
|
|
49
|
-
return { ...vars, [key]: { ...existing, ...updates } };
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Change a declared variable's dataType. The previous initialValue is dropped —
|
|
55
|
-
* a value entered for one type rarely makes sense for another, so we reset
|
|
56
|
-
* rather than attempt a lossy coercion.
|
|
57
|
-
*/
|
|
58
|
-
export function setDeclaredVariableType(canvasId: string, uid: string, dataType: DataType): void {
|
|
59
|
-
updateDeclaredVariable(canvasId, uid, { dataType, initialValue: undefined });
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** Delete a declared variable and clear its selection if it was open. */
|
|
63
|
-
export function deleteDeclaredVariable(canvasId: string, uid: string): void {
|
|
64
|
-
const store = getOrCreateCanvasStore(canvasId);
|
|
65
|
-
store.takeCheckpoint();
|
|
66
|
-
const key = declaredVarKey(uid);
|
|
67
|
-
store.getState().setVariables((vars) => {
|
|
68
|
-
const { [key]: _drop, ...rest } = vars;
|
|
69
|
-
return rest;
|
|
70
|
-
});
|
|
71
|
-
const sel = useEditorStore.getState().selection;
|
|
72
|
-
if (sel.kind === "variable" && sel.uid === uid) {
|
|
73
|
-
useEditorStore.getState().clearSelection();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
1
|
+
import { declaredVarKey, type DeclaredVariable } from "@foresthubai/workflow-core/variable";
|
|
2
|
+
import type { DataType } from "@foresthubai/workflow-core";
|
|
3
|
+
import { getOrCreateCanvasStore } from "../stores/canvasStore";
|
|
4
|
+
import { useEditorStore } from "../stores/editorStore";
|
|
5
|
+
import { generateId } from "@foresthubai/workflow-core/id";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Per-canvas mutation helpers for declared variables. Mirrors
|
|
9
|
+
* utils/modelOperations.ts, but declared variables are canvas-scoped (they live
|
|
10
|
+
* in canvasStore.variables, not editorStore), so every helper takes a canvasId.
|
|
11
|
+
*
|
|
12
|
+
* Each write takes a history checkpoint first, matching the inline editor it
|
|
13
|
+
* replaces, so a single edit is one undo step.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Pick a fresh `var<N>` name that doesn't collide with existing declared variables. */
|
|
17
|
+
function nextDefaultName(existingNames: string[]): string {
|
|
18
|
+
let counter = 1;
|
|
19
|
+
while (existingNames.includes(`var${counter}`)) counter++;
|
|
20
|
+
return `var${counter}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Create a new declared variable on the given canvas. Returns its uid. */
|
|
24
|
+
export function addDeclaredVariable(canvasId: string): string {
|
|
25
|
+
const store = getOrCreateCanvasStore(canvasId);
|
|
26
|
+
store.takeCheckpoint();
|
|
27
|
+
const existingNames = Object.values(store.getState().variables)
|
|
28
|
+
.filter((v): v is DeclaredVariable => v.kind === "declared")
|
|
29
|
+
.map((v) => v.name);
|
|
30
|
+
const uid = generateId();
|
|
31
|
+
const newVar: DeclaredVariable = {
|
|
32
|
+
kind: "declared",
|
|
33
|
+
uid,
|
|
34
|
+
name: nextDefaultName(existingNames),
|
|
35
|
+
dataType: "int",
|
|
36
|
+
};
|
|
37
|
+
store.getState().setVariables((vars) => ({ ...vars, [declaredVarKey(uid)]: newVar }));
|
|
38
|
+
return uid;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Apply a partial patch to a declared variable. `kind`/`uid` are fixed. */
|
|
42
|
+
export function updateDeclaredVariable(canvasId: string, uid: string, updates: Partial<Omit<DeclaredVariable, "kind" | "uid">>): void {
|
|
43
|
+
const store = getOrCreateCanvasStore(canvasId);
|
|
44
|
+
store.takeCheckpoint();
|
|
45
|
+
const key = declaredVarKey(uid);
|
|
46
|
+
store.getState().setVariables((vars) => {
|
|
47
|
+
const existing = vars[key];
|
|
48
|
+
if (!existing || existing.kind !== "declared") return vars;
|
|
49
|
+
return { ...vars, [key]: { ...existing, ...updates } };
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Change a declared variable's dataType. The previous initialValue is dropped —
|
|
55
|
+
* a value entered for one type rarely makes sense for another, so we reset
|
|
56
|
+
* rather than attempt a lossy coercion.
|
|
57
|
+
*/
|
|
58
|
+
export function setDeclaredVariableType(canvasId: string, uid: string, dataType: DataType): void {
|
|
59
|
+
updateDeclaredVariable(canvasId, uid, { dataType, initialValue: undefined });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Delete a declared variable and clear its selection if it was open. */
|
|
63
|
+
export function deleteDeclaredVariable(canvasId: string, uid: string): void {
|
|
64
|
+
const store = getOrCreateCanvasStore(canvasId);
|
|
65
|
+
store.takeCheckpoint();
|
|
66
|
+
const key = declaredVarKey(uid);
|
|
67
|
+
store.getState().setVariables((vars) => {
|
|
68
|
+
const { [key]: _drop, ...rest } = vars;
|
|
69
|
+
return rest;
|
|
70
|
+
});
|
|
71
|
+
const sel = useEditorStore.getState().selection;
|
|
72
|
+
if (sel.kind === "variable" && sel.uid === uid) {
|
|
73
|
+
useEditorStore.getState().clearSelection();
|
|
74
|
+
}
|
|
75
|
+
}
|
package/tailwind-preset.ts
CHANGED
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
import type { Config } from "tailwindcss";
|
|
2
|
-
import animate from "tailwindcss-animate";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Tailwind preset for @foresthubai/workflow-builder.
|
|
6
|
-
*
|
|
7
|
-
* This is the single source of truth that binds the design-system tokens
|
|
8
|
-
* defined in `src/styles/index.css` (raw HSL triplets like `--primary`) to the
|
|
9
|
-
* Tailwind utility classes the builder's components reference (`bg-primary`,
|
|
10
|
-
* `text-muted-foreground`, `border-border`, `bg-node-agent`, …). It also ships
|
|
11
|
-
* the `darkMode` strategy, the accordion keyframes, and the
|
|
12
|
-
* `tailwindcss-animate` plugin that the builder's shadcn components depend on.
|
|
13
|
-
*
|
|
14
|
-
* Any consumer embedding the builder must:
|
|
15
|
-
* 1. spread this preset: `presets: [workflowBuilderPreset]`
|
|
16
|
-
* 2. import the tokens once: `import "@foresthubai/workflow-builder/styles/index.css"`
|
|
17
|
-
* 3. add the builder to their Tailwind `content` so its classes are emitted
|
|
18
|
-
* (a glob over its built JS under node_modules/@foresthubai/workflow-builder,
|
|
19
|
-
* or, when consuming source as this monorepo does, the builder's src tree).
|
|
20
|
-
*
|
|
21
|
-
* `content` is intentionally NOT part of the preset: its globs are
|
|
22
|
-
* consumer-relative (source tree in this monorepo, node_modules in a published
|
|
23
|
-
* install), so each consumer owns that path.
|
|
24
|
-
*/
|
|
25
|
-
const preset: Omit<Config, "content"> = {
|
|
26
|
-
darkMode: ["class"],
|
|
27
|
-
theme: {
|
|
28
|
-
extend: {
|
|
29
|
-
fontFamily: {
|
|
30
|
-
// The builder's base body face (applied on the .fh-builder root)
|
|
31
|
-
// and its display/heading face. Defined here so `font-sans`/`font-heading`
|
|
32
|
-
// resolve to the builder's type even in portaled content (dialogs, menus)
|
|
33
|
-
// that renders outside the root and can't inherit the root's font.
|
|
34
|
-
sans: ["Poppins", "system-ui", "sans-serif"],
|
|
35
|
-
heading: ["Inter", "system-ui", "sans-serif"],
|
|
36
|
-
},
|
|
37
|
-
colors: {
|
|
38
|
-
// ───────────────────────────────────────────────────────────
|
|
39
|
-
// GENERAL UI — surfaces, text, controls. Reusable by host apps.
|
|
40
|
-
// ───────────────────────────────────────────────────────────
|
|
41
|
-
|
|
42
|
-
// Surfaces & controls
|
|
43
|
-
border: "hsl(var(--border))",
|
|
44
|
-
input: "hsl(var(--border))",
|
|
45
|
-
ring: "hsl(var(--ring))",
|
|
46
|
-
background: "hsl(var(--background))",
|
|
47
|
-
foreground: "hsl(var(--foreground))",
|
|
48
|
-
field: "hsl(var(--field))",
|
|
49
|
-
overlay: "hsl(var(--overlay))",
|
|
50
|
-
|
|
51
|
-
primary: {
|
|
52
|
-
DEFAULT: "hsl(var(--primary))",
|
|
53
|
-
foreground: "hsl(var(--primary-foreground))",
|
|
54
|
-
glow: "hsl(var(--primary-glow))",
|
|
55
|
-
},
|
|
56
|
-
secondary: {
|
|
57
|
-
DEFAULT: "hsl(var(--secondary))",
|
|
58
|
-
foreground: "hsl(var(--secondary-foreground))",
|
|
59
|
-
},
|
|
60
|
-
destructive: {
|
|
61
|
-
DEFAULT: "hsl(var(--destructive))",
|
|
62
|
-
foreground: "hsl(var(--destructive-foreground))",
|
|
63
|
-
},
|
|
64
|
-
muted: {
|
|
65
|
-
DEFAULT: "hsl(var(--muted))",
|
|
66
|
-
foreground: "hsl(var(--muted-foreground))",
|
|
67
|
-
},
|
|
68
|
-
accent: {
|
|
69
|
-
DEFAULT: "hsl(var(--accent))",
|
|
70
|
-
foreground: "hsl(var(--accent-foreground))",
|
|
71
|
-
},
|
|
72
|
-
popover: {
|
|
73
|
-
DEFAULT: "hsl(var(--popover))",
|
|
74
|
-
foreground: "hsl(var(--popover-foreground))",
|
|
75
|
-
},
|
|
76
|
-
card: {
|
|
77
|
-
DEFAULT: "hsl(var(--card))",
|
|
78
|
-
foreground: "hsl(var(--card-foreground))",
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
// Status
|
|
82
|
-
success: {
|
|
83
|
-
DEFAULT: "hsl(var(--success))",
|
|
84
|
-
foreground: "hsl(var(--success-foreground))",
|
|
85
|
-
},
|
|
86
|
-
warning: {
|
|
87
|
-
DEFAULT: "hsl(var(--warning))",
|
|
88
|
-
foreground: "hsl(var(--warning-foreground))",
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
// Sidebar
|
|
92
|
-
sidebar: {
|
|
93
|
-
DEFAULT: "hsl(var(--sidebar-background))",
|
|
94
|
-
foreground: "hsl(var(--sidebar-foreground))",
|
|
95
|
-
primary: "hsl(var(--sidebar-primary))",
|
|
96
|
-
"primary-foreground": "hsl(var(--sidebar-primary-foreground))",
|
|
97
|
-
accent: "hsl(var(--sidebar-accent))",
|
|
98
|
-
"accent-foreground": "hsl(var(--sidebar-accent-foreground))",
|
|
99
|
-
border: "hsl(var(--sidebar-border))",
|
|
100
|
-
ring: "hsl(var(--sidebar-ring))",
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
// ───────────────────────────────────────────────────────────
|
|
104
|
-
// BUILDER / GRAPH ONLY — canvas, edges, node categories.
|
|
105
|
-
// Host apps embedding the builder don't reference these.
|
|
106
|
-
// ───────────────────────────────────────────────────────────
|
|
107
|
-
canvas: {
|
|
108
|
-
bg: "hsl(var(--canvas-background))",
|
|
109
|
-
},
|
|
110
|
-
panel: {
|
|
111
|
-
background: "hsl(var(--panel-background))",
|
|
112
|
-
border: "hsl(var(--panel-border))",
|
|
113
|
-
},
|
|
114
|
-
edge: {
|
|
115
|
-
default: "hsl(var(--edge-default))",
|
|
116
|
-
},
|
|
117
|
-
"selection-glow": "hsl(var(--selection-glow))",
|
|
118
|
-
|
|
119
|
-
// Node category signals
|
|
120
|
-
node: {
|
|
121
|
-
agent: "hsl(var(--node-agent))",
|
|
122
|
-
input: "hsl(var(--node-input))",
|
|
123
|
-
output: "hsl(var(--node-output))",
|
|
124
|
-
trigger: "hsl(var(--node-trigger))",
|
|
125
|
-
logic: "hsl(var(--node-logic))",
|
|
126
|
-
data: "hsl(var(--node-data))",
|
|
127
|
-
tool: "hsl(var(--node-tool))",
|
|
128
|
-
function: "hsl(var(--node-function))",
|
|
129
|
-
shadow: "hsl(var(--node-shadow))",
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
borderRadius: {
|
|
133
|
-
lg: "var(--radius)",
|
|
134
|
-
md: "calc(var(--radius) - 2px)",
|
|
135
|
-
sm: "calc(var(--radius) - 4px)",
|
|
136
|
-
},
|
|
137
|
-
backgroundImage: {
|
|
138
|
-
"gradient-subtle": "var(--gradient-subtle)",
|
|
139
|
-
"gradient-glass": "var(--gradient-glass)",
|
|
140
|
-
},
|
|
141
|
-
boxShadow: {
|
|
142
|
-
sm: "var(--shadow-sm)",
|
|
143
|
-
md: "var(--shadow-md)",
|
|
144
|
-
lg: "var(--shadow-lg)",
|
|
145
|
-
glow: "var(--shadow-glow)",
|
|
146
|
-
},
|
|
147
|
-
keyframes: {
|
|
148
|
-
"accordion-down": {
|
|
149
|
-
from: { height: "0" },
|
|
150
|
-
to: { height: "var(--radix-accordion-content-height)" },
|
|
151
|
-
},
|
|
152
|
-
"accordion-up": {
|
|
153
|
-
from: { height: "var(--radix-accordion-content-height)" },
|
|
154
|
-
to: { height: "0" },
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
animation: {
|
|
158
|
-
"accordion-down": "accordion-down 0.2s ease-out",
|
|
159
|
-
"accordion-up": "accordion-up 0.2s ease-out",
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
plugins: [animate],
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export default preset;
|
|
1
|
+
import type { Config } from "tailwindcss";
|
|
2
|
+
import animate from "tailwindcss-animate";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tailwind preset for @foresthubai/workflow-builder.
|
|
6
|
+
*
|
|
7
|
+
* This is the single source of truth that binds the design-system tokens
|
|
8
|
+
* defined in `src/styles/index.css` (raw HSL triplets like `--primary`) to the
|
|
9
|
+
* Tailwind utility classes the builder's components reference (`bg-primary`,
|
|
10
|
+
* `text-muted-foreground`, `border-border`, `bg-node-agent`, …). It also ships
|
|
11
|
+
* the `darkMode` strategy, the accordion keyframes, and the
|
|
12
|
+
* `tailwindcss-animate` plugin that the builder's shadcn components depend on.
|
|
13
|
+
*
|
|
14
|
+
* Any consumer embedding the builder must:
|
|
15
|
+
* 1. spread this preset: `presets: [workflowBuilderPreset]`
|
|
16
|
+
* 2. import the tokens once: `import "@foresthubai/workflow-builder/styles/index.css"`
|
|
17
|
+
* 3. add the builder to their Tailwind `content` so its classes are emitted
|
|
18
|
+
* (a glob over its built JS under node_modules/@foresthubai/workflow-builder,
|
|
19
|
+
* or, when consuming source as this monorepo does, the builder's src tree).
|
|
20
|
+
*
|
|
21
|
+
* `content` is intentionally NOT part of the preset: its globs are
|
|
22
|
+
* consumer-relative (source tree in this monorepo, node_modules in a published
|
|
23
|
+
* install), so each consumer owns that path.
|
|
24
|
+
*/
|
|
25
|
+
const preset: Omit<Config, "content"> = {
|
|
26
|
+
darkMode: ["class"],
|
|
27
|
+
theme: {
|
|
28
|
+
extend: {
|
|
29
|
+
fontFamily: {
|
|
30
|
+
// The builder's base body face (applied on the .fh-builder root)
|
|
31
|
+
// and its display/heading face. Defined here so `font-sans`/`font-heading`
|
|
32
|
+
// resolve to the builder's type even in portaled content (dialogs, menus)
|
|
33
|
+
// that renders outside the root and can't inherit the root's font.
|
|
34
|
+
sans: ["Poppins", "system-ui", "sans-serif"],
|
|
35
|
+
heading: ["Inter", "system-ui", "sans-serif"],
|
|
36
|
+
},
|
|
37
|
+
colors: {
|
|
38
|
+
// ───────────────────────────────────────────────────────────
|
|
39
|
+
// GENERAL UI — surfaces, text, controls. Reusable by host apps.
|
|
40
|
+
// ───────────────────────────────────────────────────────────
|
|
41
|
+
|
|
42
|
+
// Surfaces & controls
|
|
43
|
+
border: "hsl(var(--border))",
|
|
44
|
+
input: "hsl(var(--border))",
|
|
45
|
+
ring: "hsl(var(--ring))",
|
|
46
|
+
background: "hsl(var(--background))",
|
|
47
|
+
foreground: "hsl(var(--foreground))",
|
|
48
|
+
field: "hsl(var(--field))",
|
|
49
|
+
overlay: "hsl(var(--overlay))",
|
|
50
|
+
|
|
51
|
+
primary: {
|
|
52
|
+
DEFAULT: "hsl(var(--primary))",
|
|
53
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
54
|
+
glow: "hsl(var(--primary-glow))",
|
|
55
|
+
},
|
|
56
|
+
secondary: {
|
|
57
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
58
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
59
|
+
},
|
|
60
|
+
destructive: {
|
|
61
|
+
DEFAULT: "hsl(var(--destructive))",
|
|
62
|
+
foreground: "hsl(var(--destructive-foreground))",
|
|
63
|
+
},
|
|
64
|
+
muted: {
|
|
65
|
+
DEFAULT: "hsl(var(--muted))",
|
|
66
|
+
foreground: "hsl(var(--muted-foreground))",
|
|
67
|
+
},
|
|
68
|
+
accent: {
|
|
69
|
+
DEFAULT: "hsl(var(--accent))",
|
|
70
|
+
foreground: "hsl(var(--accent-foreground))",
|
|
71
|
+
},
|
|
72
|
+
popover: {
|
|
73
|
+
DEFAULT: "hsl(var(--popover))",
|
|
74
|
+
foreground: "hsl(var(--popover-foreground))",
|
|
75
|
+
},
|
|
76
|
+
card: {
|
|
77
|
+
DEFAULT: "hsl(var(--card))",
|
|
78
|
+
foreground: "hsl(var(--card-foreground))",
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
// Status
|
|
82
|
+
success: {
|
|
83
|
+
DEFAULT: "hsl(var(--success))",
|
|
84
|
+
foreground: "hsl(var(--success-foreground))",
|
|
85
|
+
},
|
|
86
|
+
warning: {
|
|
87
|
+
DEFAULT: "hsl(var(--warning))",
|
|
88
|
+
foreground: "hsl(var(--warning-foreground))",
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
// Sidebar
|
|
92
|
+
sidebar: {
|
|
93
|
+
DEFAULT: "hsl(var(--sidebar-background))",
|
|
94
|
+
foreground: "hsl(var(--sidebar-foreground))",
|
|
95
|
+
primary: "hsl(var(--sidebar-primary))",
|
|
96
|
+
"primary-foreground": "hsl(var(--sidebar-primary-foreground))",
|
|
97
|
+
accent: "hsl(var(--sidebar-accent))",
|
|
98
|
+
"accent-foreground": "hsl(var(--sidebar-accent-foreground))",
|
|
99
|
+
border: "hsl(var(--sidebar-border))",
|
|
100
|
+
ring: "hsl(var(--sidebar-ring))",
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// ───────────────────────────────────────────────────────────
|
|
104
|
+
// BUILDER / GRAPH ONLY — canvas, edges, node categories.
|
|
105
|
+
// Host apps embedding the builder don't reference these.
|
|
106
|
+
// ───────────────────────────────────────────────────────────
|
|
107
|
+
canvas: {
|
|
108
|
+
bg: "hsl(var(--canvas-background))",
|
|
109
|
+
},
|
|
110
|
+
panel: {
|
|
111
|
+
background: "hsl(var(--panel-background))",
|
|
112
|
+
border: "hsl(var(--panel-border))",
|
|
113
|
+
},
|
|
114
|
+
edge: {
|
|
115
|
+
default: "hsl(var(--edge-default))",
|
|
116
|
+
},
|
|
117
|
+
"selection-glow": "hsl(var(--selection-glow))",
|
|
118
|
+
|
|
119
|
+
// Node category signals
|
|
120
|
+
node: {
|
|
121
|
+
agent: "hsl(var(--node-agent))",
|
|
122
|
+
input: "hsl(var(--node-input))",
|
|
123
|
+
output: "hsl(var(--node-output))",
|
|
124
|
+
trigger: "hsl(var(--node-trigger))",
|
|
125
|
+
logic: "hsl(var(--node-logic))",
|
|
126
|
+
data: "hsl(var(--node-data))",
|
|
127
|
+
tool: "hsl(var(--node-tool))",
|
|
128
|
+
function: "hsl(var(--node-function))",
|
|
129
|
+
shadow: "hsl(var(--node-shadow))",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
borderRadius: {
|
|
133
|
+
lg: "var(--radius)",
|
|
134
|
+
md: "calc(var(--radius) - 2px)",
|
|
135
|
+
sm: "calc(var(--radius) - 4px)",
|
|
136
|
+
},
|
|
137
|
+
backgroundImage: {
|
|
138
|
+
"gradient-subtle": "var(--gradient-subtle)",
|
|
139
|
+
"gradient-glass": "var(--gradient-glass)",
|
|
140
|
+
},
|
|
141
|
+
boxShadow: {
|
|
142
|
+
sm: "var(--shadow-sm)",
|
|
143
|
+
md: "var(--shadow-md)",
|
|
144
|
+
lg: "var(--shadow-lg)",
|
|
145
|
+
glow: "var(--shadow-glow)",
|
|
146
|
+
},
|
|
147
|
+
keyframes: {
|
|
148
|
+
"accordion-down": {
|
|
149
|
+
from: { height: "0" },
|
|
150
|
+
to: { height: "var(--radix-accordion-content-height)" },
|
|
151
|
+
},
|
|
152
|
+
"accordion-up": {
|
|
153
|
+
from: { height: "var(--radix-accordion-content-height)" },
|
|
154
|
+
to: { height: "0" },
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
animation: {
|
|
158
|
+
"accordion-down": "accordion-down 0.2s ease-out",
|
|
159
|
+
"accordion-up": "accordion-up 0.2s ease-out",
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
plugins: [animate],
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export default preset;
|