@spaethtech/svelte-ui 0.1.10 → 0.3.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/README.md +166 -42
- package/dist/components/Alert.svelte +119 -0
- package/dist/components/Alert.svelte.d.ts +29 -0
- package/dist/components/Badge/Badge.svelte +142 -69
- package/dist/components/Badge/Badge.svelte.d.ts +26 -6
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Banner.svelte +133 -0
- package/dist/components/Banner.svelte.d.ts +31 -0
- package/dist/components/Button.svelte +240 -0
- package/dist/components/Button.svelte.d.ts +33 -0
- package/dist/components/ButtonDropdown.svelte +145 -0
- package/dist/components/ButtonDropdown.svelte.d.ts +31 -0
- package/dist/components/Calendar.svelte +259 -0
- package/dist/components/Calendar.svelte.d.ts +27 -0
- package/dist/components/Card.svelte +78 -0
- package/dist/components/Card.svelte.d.ts +17 -0
- package/dist/components/CardBody.svelte +41 -0
- package/dist/components/CardBody.svelte.d.ts +17 -0
- package/dist/components/CardFooter.svelte +49 -0
- package/dist/components/CardFooter.svelte.d.ts +16 -0
- package/dist/components/CardHeader.svelte +49 -0
- package/dist/components/CardHeader.svelte.d.ts +16 -0
- package/dist/components/Checkbox.svelte +131 -0
- package/dist/components/Checkbox.svelte.d.ts +16 -0
- package/dist/components/DataTable.svelte +518 -0
- package/dist/components/DataTable.svelte.d.ts +74 -0
- package/dist/components/DatePicker.svelte +312 -0
- package/dist/components/DatePicker.svelte.d.ts +32 -0
- package/dist/components/DateTimeInput.svelte +93 -0
- package/dist/components/DateTimeInput.svelte.d.ts +20 -0
- package/dist/components/Dialog.svelte +132 -0
- package/dist/components/Dialog.svelte.d.ts +24 -0
- package/dist/components/{EmailInput/EmailInput.svelte → EmailInput.svelte} +17 -8
- package/dist/components/EmailInput.svelte.d.ts +21 -0
- package/dist/components/Input.svelte +369 -0
- package/dist/components/Input.svelte.d.ts +35 -0
- package/dist/components/{List/List.svelte → List.svelte} +194 -133
- package/dist/components/{List/List.svelte.d.ts → List.svelte.d.ts} +9 -1
- package/dist/components/Menu.svelte +117 -0
- package/dist/components/Menu.svelte.d.ts +20 -0
- package/dist/components/NotesEditor.svelte +127 -0
- package/dist/components/NotesEditor.svelte.d.ts +17 -0
- package/dist/components/{NumberInput/NumberInput.svelte → NumberInput.svelte} +146 -105
- package/dist/components/{NumberInput/NumberInput.svelte.d.ts → NumberInput.svelte.d.ts} +11 -4
- package/dist/components/PasswordInput.svelte +52 -0
- package/dist/components/PasswordInput.svelte.d.ts +20 -0
- package/dist/components/Popup.svelte +140 -0
- package/dist/components/Popup.svelte.d.ts +31 -0
- package/dist/components/Query.svelte +284 -0
- package/dist/components/Query.svelte.d.ts +15 -0
- package/dist/components/{Rating/Rating.svelte → Rating.svelte} +19 -10
- package/dist/components/Rating.svelte.d.ts +13 -0
- package/dist/components/{SearchInput/SearchInput.svelte → SearchInput.svelte} +19 -8
- package/dist/components/{SearchInput/SearchInput.svelte.d.ts → SearchInput.svelte.d.ts} +9 -2
- package/dist/components/{Select/Select.svelte → Select.svelte} +48 -76
- package/dist/components/{Select/Select.svelte.d.ts → Select.svelte.d.ts} +11 -1
- package/dist/components/SideBarMenu/SideBarMenu.svelte +724 -0
- package/dist/components/SideBarMenu/SideBarMenu.svelte.d.ts +109 -0
- package/dist/components/SideBarMenu/index.d.ts +2 -0
- package/dist/components/SideBarMenu/index.js +1 -0
- package/dist/components/TabStrip/TabStrip.svelte +384 -0
- package/dist/components/TabStrip/TabStrip.svelte.d.ts +50 -0
- package/dist/components/TabStrip/index.d.ts +3 -0
- package/dist/components/TabStrip/index.js +2 -0
- package/dist/components/{TextArea/TextArea.svelte → TextArea.svelte} +143 -112
- package/dist/components/TextArea.svelte.d.ts +38 -0
- package/dist/components/ThemeSelector.svelte +81 -0
- package/dist/components/ThemeSelector.svelte.d.ts +10 -0
- package/dist/components/TimePicker.svelte +148 -0
- package/dist/components/TimePicker.svelte.d.ts +28 -0
- package/dist/components/TimeRangeInput.svelte +203 -0
- package/dist/components/TimeRangeInput.svelte.d.ts +29 -0
- package/dist/components/TimeSpinner.svelte +202 -0
- package/dist/components/TimeSpinner.svelte.d.ts +26 -0
- package/dist/components/Toast/Toaster.svelte +51 -0
- package/dist/components/Toast/Toaster.svelte.d.ts +12 -0
- package/dist/components/Toast/toast.svelte.d.ts +29 -0
- package/dist/components/Toast/toast.svelte.js +27 -0
- package/dist/components/Toggle.svelte +93 -0
- package/dist/components/Toggle.svelte.d.ts +15 -0
- package/dist/data/dataset.d.ts +42 -0
- package/dist/data/dataset.js +3 -0
- package/dist/data/index.d.ts +3 -0
- package/dist/data/index.js +3 -0
- package/dist/data/query/ast.d.ts +62 -0
- package/dist/data/query/ast.js +12 -0
- package/dist/data/query/index.d.ts +3 -0
- package/dist/data/query/index.js +3 -0
- package/dist/data/query/lexer.d.ts +33 -0
- package/dist/data/query/lexer.js +225 -0
- package/dist/data/query/parser.d.ts +11 -0
- package/dist/data/query/parser.js +252 -0
- package/dist/data/table/grid.svelte.d.ts +57 -0
- package/dist/data/table/grid.svelte.js +139 -0
- package/dist/data/table/index.d.ts +2 -0
- package/dist/data/table/index.js +2 -0
- package/dist/data/table/types.d.ts +79 -0
- package/dist/index.d.ts +48 -22
- package/dist/index.js +45 -21
- package/dist/positioning/anchored.d.ts +61 -0
- package/dist/positioning/anchored.js +122 -0
- package/dist/positioning/tooltip.d.ts +41 -0
- package/dist/positioning/tooltip.js +147 -0
- package/dist/theme.css +205 -0
- package/dist/types/breakpoints.d.ts +24 -0
- package/dist/types/breakpoints.js +13 -0
- package/dist/types/responsive.d.ts +32 -0
- package/dist/types/responsive.js +54 -0
- package/dist/types/sizes.d.ts +10 -3
- package/dist/types/time.d.ts +19 -0
- package/dist/types/time.js +10 -0
- package/dist/types/variants.d.ts +8 -1
- package/dist/types/variants.js +16 -1
- package/package.json +93 -63
- package/dist/components/Button/Button.svelte +0 -172
- package/dist/components/Button/Button.svelte.d.ts +0 -32
- package/dist/components/Button/index.d.ts +0 -1
- package/dist/components/Button/index.js +0 -1
- package/dist/components/Dialog/Dialog.svelte +0 -101
- package/dist/components/Dialog/Dialog.svelte.d.ts +0 -18
- package/dist/components/Dialog/index.d.ts +0 -1
- package/dist/components/Dialog/index.js +0 -1
- package/dist/components/ElementManager/ElementManager.svelte +0 -397
- package/dist/components/ElementManager/ElementManager.svelte.d.ts +0 -43
- package/dist/components/ElementManager/index.d.ts +0 -1
- package/dist/components/ElementManager/index.js +0 -1
- package/dist/components/EmailInput/EmailInput.svelte.d.ts +0 -14
- package/dist/components/EmailInput/index.d.ts +0 -1
- package/dist/components/EmailInput/index.js +0 -1
- package/dist/components/Icon/Icon.svelte +0 -74
- package/dist/components/Icon/Icon.svelte.d.ts +0 -13
- package/dist/components/Icon/index.d.ts +0 -1
- package/dist/components/Icon/index.js +0 -1
- package/dist/components/Input/Input.svelte +0 -268
- package/dist/components/Input/Input.svelte.d.ts +0 -18
- package/dist/components/Input/index.d.ts +0 -1
- package/dist/components/Input/index.js +0 -1
- package/dist/components/List/index.d.ts +0 -1
- package/dist/components/List/index.js +0 -1
- package/dist/components/ListItem/ListItem.svelte +0 -175
- package/dist/components/ListItem/ListItem.svelte.d.ts +0 -24
- package/dist/components/ListItem/index.d.ts +0 -2
- package/dist/components/ListItem/index.js +0 -2
- package/dist/components/ListView/ListView.svelte +0 -463
- package/dist/components/ListView/ListView.svelte.d.ts +0 -37
- package/dist/components/ListView/index.d.ts +0 -2
- package/dist/components/ListView/index.js +0 -2
- package/dist/components/NodeGraph/BaseNode.d.ts +0 -57
- package/dist/components/NodeGraph/BaseNode.js +0 -30
- package/dist/components/NodeGraph/Edge.svelte +0 -60
- package/dist/components/NodeGraph/Edge.svelte.d.ts +0 -16
- package/dist/components/NodeGraph/ExpressionEvaluator.d.ts +0 -82
- package/dist/components/NodeGraph/ExpressionEvaluator.js +0 -152
- package/dist/components/NodeGraph/Node.svelte +0 -100
- package/dist/components/NodeGraph/Node.svelte.d.ts +0 -10
- package/dist/components/NodeGraph/NodeGraph.svelte +0 -52
- package/dist/components/NodeGraph/NodeGraph.svelte.d.ts +0 -14
- package/dist/components/NodeGraph/NodeInstance.svelte.d.ts +0 -80
- package/dist/components/NodeGraph/NodeInstance.svelte.js +0 -241
- package/dist/components/NodeGraph/NodePort.svelte +0 -75
- package/dist/components/NodeGraph/NodePort.svelte.d.ts +0 -11
- package/dist/components/NodeGraph/decorators.d.ts +0 -81
- package/dist/components/NodeGraph/decorators.js +0 -148
- package/dist/components/NodeGraph/index.d.ts +0 -9
- package/dist/components/NodeGraph/index.js +0 -9
- package/dist/components/NodeGraph/types.d.ts +0 -94
- package/dist/components/NodeGraph/types.js +0 -33
- package/dist/components/NotesEditor/NotesEditor.svelte +0 -203
- package/dist/components/NotesEditor/NotesEditor.svelte.d.ts +0 -9
- package/dist/components/NotesEditor/index.d.ts +0 -1
- package/dist/components/NotesEditor/index.js +0 -1
- package/dist/components/NumberInput/index.d.ts +0 -1
- package/dist/components/NumberInput/index.js +0 -1
- package/dist/components/PasswordInput/PasswordInput.svelte +0 -41
- package/dist/components/PasswordInput/PasswordInput.svelte.d.ts +0 -13
- package/dist/components/PasswordInput/index.d.ts +0 -1
- package/dist/components/PasswordInput/index.js +0 -1
- package/dist/components/Popup/index.d.ts +0 -1
- package/dist/components/Popup/index.js +0 -1
- package/dist/components/Rating/Rating.svelte.d.ts +0 -7
- package/dist/components/Rating/index.d.ts +0 -1
- package/dist/components/Rating/index.js +0 -1
- package/dist/components/ScrollView/ScrollView.svelte +0 -285
- package/dist/components/ScrollView/ScrollView.svelte.d.ts +0 -19
- package/dist/components/ScrollView/index.d.ts +0 -1
- package/dist/components/ScrollView/index.js +0 -1
- package/dist/components/SearchInput/index.d.ts +0 -1
- package/dist/components/SearchInput/index.js +0 -1
- package/dist/components/Select/index.d.ts +0 -1
- package/dist/components/Select/index.js +0 -1
- package/dist/components/TextArea/TextArea.svelte.d.ts +0 -19
- package/dist/components/TextArea/index.d.ts +0 -1
- package/dist/components/TextArea/index.js +0 -1
- package/dist/components/ThemeSelector/ThemeSelector.svelte +0 -64
- package/dist/components/ThemeSelector/ThemeSelector.svelte.d.ts +0 -3
- package/dist/components/ThemeSelector/index.d.ts +0 -1
- package/dist/components/ThemeSelector/index.js +0 -1
- package/dist/components/TooltipHandler/TooltipHandler.svelte +0 -593
- package/dist/components/TooltipHandler/TooltipHandler.svelte.d.ts +0 -10
- package/dist/components/TooltipHandler/index.d.ts +0 -1
- package/dist/components/TooltipHandler/index.js +0 -1
- package/dist/styles/sizes.d.ts +0 -78
- package/dist/styles/sizes.js +0 -120
- package/dist/styles/variants.d.ts +0 -106
- package/dist/styles/variants.js +0 -194
- package/dist/types/ManagerTypes.d.ts +0 -42
- /package/dist/{types/ManagerTypes.js → data/table/types.js} +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { VariableScope } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Variable store with three-level scope hierarchy
|
|
4
|
-
*/
|
|
5
|
-
export interface VariableStore {
|
|
6
|
-
global: Record<string, any>;
|
|
7
|
-
project: Record<string, any>;
|
|
8
|
-
workflow: Record<string, any>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* ExpressionEvaluator - Evaluates JavaScript expressions with variable substitution
|
|
12
|
-
*
|
|
13
|
-
* Supports:
|
|
14
|
-
* - Single expressions: `{{ age * 2 }}` → returns number
|
|
15
|
-
* - Template strings: `Hello {{ firstName }}!` → returns string
|
|
16
|
-
* - Object properties: `{{ user.name }}`
|
|
17
|
-
* - Complex expressions: `{{ items.length > 0 }}`
|
|
18
|
-
*
|
|
19
|
-
* Variable resolution order: Workflow → Project → Global
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const evaluator = new ExpressionEvaluator({
|
|
24
|
-
* global: { pi: 3.14159 },
|
|
25
|
-
* project: { projectName: 'MyProject' },
|
|
26
|
-
* workflow: { age: 25 }
|
|
27
|
-
* });
|
|
28
|
-
*
|
|
29
|
-
* evaluator.evaluate('{{ age * 2 }}'); // 50
|
|
30
|
-
* evaluator.evaluate('Hello {{ projectName }}!'); // "Hello MyProject!"
|
|
31
|
-
* evaluator.evaluate('{{ pi * 2 }}'); // 6.28318
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare class ExpressionEvaluator {
|
|
35
|
-
private variables;
|
|
36
|
-
constructor(variables?: Partial<VariableStore>);
|
|
37
|
-
/**
|
|
38
|
-
* Set a variable in the specified scope
|
|
39
|
-
*/
|
|
40
|
-
setVariable(name: string, value: any, scope?: VariableScope): void;
|
|
41
|
-
/**
|
|
42
|
-
* Get a variable with automatic scope resolution
|
|
43
|
-
* Resolution order: Workflow → Project → Global
|
|
44
|
-
*/
|
|
45
|
-
getVariable(name: string): any;
|
|
46
|
-
/**
|
|
47
|
-
* Get all variables merged with proper precedence
|
|
48
|
-
*/
|
|
49
|
-
private getAllVariables;
|
|
50
|
-
/**
|
|
51
|
-
* Evaluate an expression string
|
|
52
|
-
*
|
|
53
|
-
* @param input - The expression string (may contain {{ }} delimiters)
|
|
54
|
-
* @returns The evaluated result
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* evaluate('{{ age }}') // Variable lookup
|
|
59
|
-
* evaluate('{{ age * 2 }}') // Expression evaluation
|
|
60
|
-
* evaluate('Hello {{ name }}!') // Template string
|
|
61
|
-
* evaluate('{{ user.name }}') // Object property
|
|
62
|
-
* evaluate('{{ items.length > 0 }}') // Boolean expression
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
evaluate(input: string): any;
|
|
66
|
-
/**
|
|
67
|
-
* Evaluate a single expression (without {{ }} delimiters)
|
|
68
|
-
*/
|
|
69
|
-
private evaluateExpression;
|
|
70
|
-
/**
|
|
71
|
-
* Update the variable store
|
|
72
|
-
*/
|
|
73
|
-
updateVariables(variables: Partial<VariableStore>): void;
|
|
74
|
-
/**
|
|
75
|
-
* Clear variables in a specific scope
|
|
76
|
-
*/
|
|
77
|
-
clearScope(scope: VariableScope): void;
|
|
78
|
-
/**
|
|
79
|
-
* Get all variables in a specific scope
|
|
80
|
-
*/
|
|
81
|
-
getScope(scope: VariableScope): Record<string, any>;
|
|
82
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { VariableScope } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* ExpressionEvaluator - Evaluates JavaScript expressions with variable substitution
|
|
4
|
-
*
|
|
5
|
-
* Supports:
|
|
6
|
-
* - Single expressions: `{{ age * 2 }}` → returns number
|
|
7
|
-
* - Template strings: `Hello {{ firstName }}!` → returns string
|
|
8
|
-
* - Object properties: `{{ user.name }}`
|
|
9
|
-
* - Complex expressions: `{{ items.length > 0 }}`
|
|
10
|
-
*
|
|
11
|
-
* Variable resolution order: Workflow → Project → Global
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const evaluator = new ExpressionEvaluator({
|
|
16
|
-
* global: { pi: 3.14159 },
|
|
17
|
-
* project: { projectName: 'MyProject' },
|
|
18
|
-
* workflow: { age: 25 }
|
|
19
|
-
* });
|
|
20
|
-
*
|
|
21
|
-
* evaluator.evaluate('{{ age * 2 }}'); // 50
|
|
22
|
-
* evaluator.evaluate('Hello {{ projectName }}!'); // "Hello MyProject!"
|
|
23
|
-
* evaluator.evaluate('{{ pi * 2 }}'); // 6.28318
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export class ExpressionEvaluator {
|
|
27
|
-
variables;
|
|
28
|
-
constructor(variables) {
|
|
29
|
-
this.variables = {
|
|
30
|
-
global: variables?.global || {},
|
|
31
|
-
project: variables?.project || {},
|
|
32
|
-
workflow: variables?.workflow || {}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Set a variable in the specified scope
|
|
37
|
-
*/
|
|
38
|
-
setVariable(name, value, scope = VariableScope.Workflow) {
|
|
39
|
-
this.variables[scope][name] = value;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get a variable with automatic scope resolution
|
|
43
|
-
* Resolution order: Workflow → Project → Global
|
|
44
|
-
*/
|
|
45
|
-
getVariable(name) {
|
|
46
|
-
if (name in this.variables.workflow) {
|
|
47
|
-
return this.variables.workflow[name];
|
|
48
|
-
}
|
|
49
|
-
if (name in this.variables.project) {
|
|
50
|
-
return this.variables.project[name];
|
|
51
|
-
}
|
|
52
|
-
if (name in this.variables.global) {
|
|
53
|
-
return this.variables.global[name];
|
|
54
|
-
}
|
|
55
|
-
return undefined;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Get all variables merged with proper precedence
|
|
59
|
-
*/
|
|
60
|
-
getAllVariables() {
|
|
61
|
-
return {
|
|
62
|
-
...this.variables.global,
|
|
63
|
-
...this.variables.project,
|
|
64
|
-
...this.variables.workflow
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Evaluate an expression string
|
|
69
|
-
*
|
|
70
|
-
* @param input - The expression string (may contain {{ }} delimiters)
|
|
71
|
-
* @returns The evaluated result
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* evaluate('{{ age }}') // Variable lookup
|
|
76
|
-
* evaluate('{{ age * 2 }}') // Expression evaluation
|
|
77
|
-
* evaluate('Hello {{ name }}!') // Template string
|
|
78
|
-
* evaluate('{{ user.name }}') // Object property
|
|
79
|
-
* evaluate('{{ items.length > 0 }}') // Boolean expression
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
evaluate(input) {
|
|
83
|
-
if (typeof input !== 'string') {
|
|
84
|
-
return input;
|
|
85
|
-
}
|
|
86
|
-
const expressionRegex = /\{\{([^}]+)\}\}/g;
|
|
87
|
-
const matches = input.match(expressionRegex);
|
|
88
|
-
// No expressions found - return as is
|
|
89
|
-
if (!matches) {
|
|
90
|
-
return input;
|
|
91
|
-
}
|
|
92
|
-
// Single expression that spans entire string - return evaluated value
|
|
93
|
-
if (matches.length === 1 && input.trim() === matches[0].trim()) {
|
|
94
|
-
const expression = matches[0].replace(/\{\{|\}\}/g, '').trim();
|
|
95
|
-
return this.evaluateExpression(expression);
|
|
96
|
-
}
|
|
97
|
-
// Template string with multiple expressions - replace each and return string
|
|
98
|
-
let result = input;
|
|
99
|
-
for (const match of matches) {
|
|
100
|
-
const expression = match.replace(/\{\{|\}\}/g, '').trim();
|
|
101
|
-
const value = this.evaluateExpression(expression);
|
|
102
|
-
result = result.replace(match, String(value ?? ''));
|
|
103
|
-
}
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Evaluate a single expression (without {{ }} delimiters)
|
|
108
|
-
*/
|
|
109
|
-
evaluateExpression(expression) {
|
|
110
|
-
try {
|
|
111
|
-
// Create a function that evaluates the expression with variables in scope
|
|
112
|
-
const variables = this.getAllVariables();
|
|
113
|
-
const varNames = Object.keys(variables);
|
|
114
|
-
const varValues = Object.values(variables);
|
|
115
|
-
// Create function with variables as parameters
|
|
116
|
-
// eslint-disable-next-line no-new-func
|
|
117
|
-
const fn = new Function(...varNames, `return (${expression});`);
|
|
118
|
-
// Execute with variable values
|
|
119
|
-
return fn(...varValues);
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
console.error(`Error evaluating expression: ${expression}`, error);
|
|
123
|
-
return undefined;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Update the variable store
|
|
128
|
-
*/
|
|
129
|
-
updateVariables(variables) {
|
|
130
|
-
if (variables.global) {
|
|
131
|
-
this.variables.global = { ...this.variables.global, ...variables.global };
|
|
132
|
-
}
|
|
133
|
-
if (variables.project) {
|
|
134
|
-
this.variables.project = { ...this.variables.project, ...variables.project };
|
|
135
|
-
}
|
|
136
|
-
if (variables.workflow) {
|
|
137
|
-
this.variables.workflow = { ...this.variables.workflow, ...variables.workflow };
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Clear variables in a specific scope
|
|
142
|
-
*/
|
|
143
|
-
clearScope(scope) {
|
|
144
|
-
this.variables[scope] = {};
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Get all variables in a specific scope
|
|
148
|
-
*/
|
|
149
|
-
getScope(scope) {
|
|
150
|
-
return { ...this.variables[scope] };
|
|
151
|
-
}
|
|
152
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { NodeInstance } from "./NodeInstance.svelte.js";
|
|
3
|
-
import type { Snippet } from "svelte";
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
instance: NodeInstance;
|
|
7
|
-
selected?: boolean;
|
|
8
|
-
children?: Snippet;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
let { instance, selected = false, children }: Props = $props();
|
|
12
|
-
|
|
13
|
-
const metadata = instance.metadata;
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<div
|
|
17
|
-
class="node"
|
|
18
|
-
class:selected
|
|
19
|
-
class:executing={instance.executing}
|
|
20
|
-
class:error={instance.error}
|
|
21
|
-
style:left="{instance.position.x}px"
|
|
22
|
-
style:top="{instance.position.y}px"
|
|
23
|
-
style:border-color={selected
|
|
24
|
-
? "var(--color-primary)"
|
|
25
|
-
: "var(--color-border)"}
|
|
26
|
-
>
|
|
27
|
-
<!-- Header -->
|
|
28
|
-
<div
|
|
29
|
-
class="node-header px-3 py-2 text-white font-medium text-sm"
|
|
30
|
-
style:background-color={metadata.node.color || "var(--color-primary)"}
|
|
31
|
-
>
|
|
32
|
-
{metadata.node.title}
|
|
33
|
-
</div>
|
|
34
|
-
|
|
35
|
-
<!-- Body -->
|
|
36
|
-
<div class="node-body p-3 bg-[var(--color-background)]">
|
|
37
|
-
<!-- Input ports -->
|
|
38
|
-
<div class="inputs space-y-2">
|
|
39
|
-
{#each instance.getAllInputs() as port}
|
|
40
|
-
<div class="port-row flex items-center justify-between gap-2">
|
|
41
|
-
<span class="text-sm text-[var(--color-text)]"
|
|
42
|
-
>{port.label}</span
|
|
43
|
-
>
|
|
44
|
-
<!-- Port rendering TODO -->
|
|
45
|
-
</div>
|
|
46
|
-
{/each}
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<!-- Custom content -->
|
|
50
|
-
{#if children}
|
|
51
|
-
{@render children()}
|
|
52
|
-
{/if}
|
|
53
|
-
|
|
54
|
-
<!-- Output ports -->
|
|
55
|
-
<div class="outputs space-y-2 mt-2">
|
|
56
|
-
{#each instance.getAllOutputs() as port}
|
|
57
|
-
<div class="port-row flex items-center justify-between gap-2">
|
|
58
|
-
<span class="text-sm text-[var(--color-text)]"
|
|
59
|
-
>{port.label}</span
|
|
60
|
-
>
|
|
61
|
-
<!-- Port rendering TODO -->
|
|
62
|
-
</div>
|
|
63
|
-
{/each}
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
{#if instance.error}
|
|
68
|
-
<div class="node-error px-3 py-1 bg-red-100 text-red-700 text-xs">
|
|
69
|
-
{instance.error}
|
|
70
|
-
</div>
|
|
71
|
-
{/if}
|
|
72
|
-
</div>
|
|
73
|
-
|
|
74
|
-
<style>
|
|
75
|
-
.node {
|
|
76
|
-
position: absolute;
|
|
77
|
-
min-width: 200px;
|
|
78
|
-
border: 2px solid;
|
|
79
|
-
border-radius: 8px;
|
|
80
|
-
overflow: hidden;
|
|
81
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
82
|
-
cursor: move;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.node.selected {
|
|
86
|
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.node.executing {
|
|
90
|
-
opacity: 0.8;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.node.error {
|
|
94
|
-
border-color: #dc2626 !important;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.node-header {
|
|
98
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
99
|
-
}
|
|
100
|
-
</style>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { NodeInstance } from "./NodeInstance.svelte.js";
|
|
2
|
-
import type { Snippet } from "svelte";
|
|
3
|
-
interface Props {
|
|
4
|
-
instance: NodeInstance;
|
|
5
|
-
selected?: boolean;
|
|
6
|
-
children?: Snippet;
|
|
7
|
-
}
|
|
8
|
-
declare const Node: import("svelte").Component<Props, {}, "">;
|
|
9
|
-
type Node = ReturnType<typeof Node>;
|
|
10
|
-
export default Node;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { NodeInstance } from './NodeInstance.svelte.js';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
nodes?: NodeInstance[];
|
|
7
|
-
width?: number;
|
|
8
|
-
height?: number;
|
|
9
|
-
gridSize?: number;
|
|
10
|
-
showGrid?: boolean;
|
|
11
|
-
editable?: boolean;
|
|
12
|
-
children?: Snippet;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
nodes = [],
|
|
17
|
-
width,
|
|
18
|
-
height,
|
|
19
|
-
gridSize = 20,
|
|
20
|
-
showGrid = true,
|
|
21
|
-
editable = true,
|
|
22
|
-
children
|
|
23
|
-
}: Props = $props();
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<div
|
|
27
|
-
class="nodegraph-canvas relative overflow-hidden bg-[var(--color-background)]"
|
|
28
|
-
style:width={width ? `${width}px` : '100%'}
|
|
29
|
-
style:height={height ? `${height}px` : '100%'}
|
|
30
|
-
>
|
|
31
|
-
{#if showGrid}
|
|
32
|
-
<div class="grid-pattern absolute inset-0 pointer-events-none"></div>
|
|
33
|
-
{/if}
|
|
34
|
-
|
|
35
|
-
<!-- Nodes and edges will be rendered here -->
|
|
36
|
-
<div class="nodes-container absolute inset-0">
|
|
37
|
-
<!-- TODO: Render nodes and edges -->
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
{#if children}
|
|
41
|
-
{@render children()}
|
|
42
|
-
{/if}
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<style>
|
|
46
|
-
.grid-pattern {
|
|
47
|
-
background-image:
|
|
48
|
-
linear-gradient(to right, rgba(128, 128, 128, 0.1) 1px, transparent 1px),
|
|
49
|
-
linear-gradient(to bottom, rgba(128, 128, 128, 0.1) 1px, transparent 1px);
|
|
50
|
-
background-size: 20px 20px;
|
|
51
|
-
}
|
|
52
|
-
</style>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { NodeInstance } from './NodeInstance.svelte.js';
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
interface Props {
|
|
4
|
-
nodes?: NodeInstance[];
|
|
5
|
-
width?: number;
|
|
6
|
-
height?: number;
|
|
7
|
-
gridSize?: number;
|
|
8
|
-
showGrid?: boolean;
|
|
9
|
-
editable?: boolean;
|
|
10
|
-
children?: Snippet;
|
|
11
|
-
}
|
|
12
|
-
declare const NodeGraph: import("svelte").Component<Props, {}, "">;
|
|
13
|
-
type NodeGraph = ReturnType<typeof NodeGraph>;
|
|
14
|
-
export default NodeGraph;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { getNodeMetadata } from "./decorators.js";
|
|
2
|
-
import type { BaseNode } from "./BaseNode.js";
|
|
3
|
-
import type { PortMetadata, Position } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* NodeInstance - Reactive wrapper for node definitions
|
|
6
|
-
*
|
|
7
|
-
* Wraps a BaseNode class with Svelte 5 runes for reactivity:
|
|
8
|
-
* - `$state` for position, selection, port values, dirty tracking
|
|
9
|
-
* - `$effect` for reactive connections and auto-execution
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const mathNode = new NodeInstance(MathNode, 'node-1');
|
|
14
|
-
* mathNode.position = { x: 100, y: 100 };
|
|
15
|
-
* mathNode.execute();
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class NodeInstance {
|
|
19
|
-
id: string;
|
|
20
|
-
node: BaseNode;
|
|
21
|
-
metadata: ReturnType<typeof getNodeMetadata>;
|
|
22
|
-
position: Position;
|
|
23
|
-
selected: boolean;
|
|
24
|
-
dirty: boolean;
|
|
25
|
-
executing: boolean;
|
|
26
|
-
error: string | null;
|
|
27
|
-
dataInputs: PortMetadata[];
|
|
28
|
-
dataOutputs: PortMetadata[];
|
|
29
|
-
flowInputs: PortMetadata[];
|
|
30
|
-
flowOutputs: PortMetadata[];
|
|
31
|
-
constructor(NodeClass: new () => BaseNode, id: string, position?: Position);
|
|
32
|
-
/**
|
|
33
|
-
* Initialize port arrays from metadata
|
|
34
|
-
*/
|
|
35
|
-
private initializePorts;
|
|
36
|
-
/**
|
|
37
|
-
* Set up auto-execution effect (if executeInEditor is true)
|
|
38
|
-
*/
|
|
39
|
-
private setupAutoExecution;
|
|
40
|
-
/**
|
|
41
|
-
* Execute the node with pull-based evaluation
|
|
42
|
-
*/
|
|
43
|
-
execute(): string | void;
|
|
44
|
-
/**
|
|
45
|
-
* Get the value of an output port
|
|
46
|
-
*/
|
|
47
|
-
getOutputValue(portKey: string): any;
|
|
48
|
-
/**
|
|
49
|
-
* Connect an input port to a source node's output port
|
|
50
|
-
*/
|
|
51
|
-
connect(inputPortKey: string, sourceNode: NodeInstance, sourcePortKey: string): void;
|
|
52
|
-
/**
|
|
53
|
-
* Disconnect an input port
|
|
54
|
-
*/
|
|
55
|
-
disconnect(inputPortKey: string): void;
|
|
56
|
-
/**
|
|
57
|
-
* Mark this node as dirty (needs re-execution)
|
|
58
|
-
*/
|
|
59
|
-
markDirty(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Set an input port value (for unconnected ports)
|
|
62
|
-
*/
|
|
63
|
-
setInputValue(portKey: string, value: any): void;
|
|
64
|
-
/**
|
|
65
|
-
* Get all input ports (data + flow)
|
|
66
|
-
*/
|
|
67
|
-
getAllInputs(): PortMetadata[];
|
|
68
|
-
/**
|
|
69
|
-
* Get all output ports (data + flow)
|
|
70
|
-
*/
|
|
71
|
-
getAllOutputs(): PortMetadata[];
|
|
72
|
-
/**
|
|
73
|
-
* Clone this instance (new instance of same node type)
|
|
74
|
-
*/
|
|
75
|
-
clone(newId: string): NodeInstance;
|
|
76
|
-
/**
|
|
77
|
-
* Serialize to JSON (for saving)
|
|
78
|
-
*/
|
|
79
|
-
toJSON(): any;
|
|
80
|
-
}
|