svelte-multistyle-ui 0.0.14-alpha → 0.0.15-alpha
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 +62 -5
- package/cli/registry.js +4 -1
- package/dist/components/GraphEditor.svelte +723 -0
- package/dist/components/GraphEditor.svelte.d.ts +28 -0
- package/dist/components/InlineEdit.svelte +142 -0
- package/dist/components/InlineEdit.svelte.d.ts +28 -0
- package/dist/components/Input.svelte +1 -0
- package/dist/components/MultiSelect.svelte +18 -4
- package/dist/components/Select.svelte +14 -4
- package/dist/components/TextEditor.svelte +1 -6
- package/dist/components/graph/FlowNode.svelte +79 -0
- package/dist/components/graph/FlowNode.svelte.d.ts +37 -0
- package/dist/components/graph/GraphNode.svelte +69 -0
- package/dist/components/graph/GraphNode.svelte.d.ts +31 -0
- package/dist/components/graph-editor-styles.css +439 -0
- package/dist/components/inline-edit-styles.css +113 -0
- package/dist/components/input-styles.css +17 -34
- package/dist/components/liquid-glass-field.css +29 -0
- package/dist/components/textarea-styles.css +14 -14
- package/dist/graph/flow-routing.d.ts +10 -0
- package/dist/graph/flow-routing.js +113 -0
- package/dist/graph/geometry.d.ts +48 -0
- package/dist/graph/geometry.js +154 -0
- package/dist/graph/index.d.ts +111 -0
- package/dist/graph/index.js +230 -0
- package/dist/graph/node-types.d.ts +24 -0
- package/dist/graph/node-types.js +82 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -84,15 +84,72 @@ A Svelte action for portaling content to `document.body`:
|
|
|
84
84
|
The library exports the following components from `svelte-multistyle-ui`:
|
|
85
85
|
|
|
86
86
|
- Actions: `Button`, `IconButton`, `FAB`, `ButtonGroup`, `DropdownMenu`, `Popover`
|
|
87
|
-
- Form: `Input`, `Textarea`, `TextEditor`, `Select`, `MultiSelect`, `Checkbox`, `Radio`, `Toggle`, `Slider`, `FileUpload`, `DatePicker`, `SortableList`
|
|
88
|
-
- Layout: `Card`, `Divider`, `Tabs`, `Accordion`, `Modal`, `Drawer`, `CommandPalette`, `Row`, `Column`, `Grid`
|
|
87
|
+
- Form: `Input`, `Textarea`, `InlineEdit`, `TextEditor`, [`CodeEditor`](skill/references/CodeEditor.md), `Select`, `MultiSelect`, `Checkbox`, `Radio`, `Toggle`, `Slider`, `FileUpload`, `DatePicker`, `SortableList`
|
|
88
|
+
- Layout: `Card`, `Divider`, `Tabs`, [`Carousel`](skill/references/Carousel.md), `Accordion`, `Modal`, `Drawer`, `CommandPalette`, `Row`, `Column`, `Grid`
|
|
89
89
|
- Navigation: `Breadcrumb`, `Pagination`, `Stepper`
|
|
90
90
|
- Data display: `Avatar`, `Chip`, `Tooltip`, `ProgressBar`, `Table`, `Spinner`, `Skeleton`, `Rating`
|
|
91
91
|
- Feedback: `Alert`, `Toast`
|
|
92
92
|
- Charts: `BarChart`, `LineChart`, `PieChart`, `DoughnutChart`, `RadarChart`, `PolarAreaChart`, `ScatterChart`, `BubbleChart`, `StackedBarChart`, `StackedLineChart`, `ComboChart`
|
|
93
|
+
- Graphs: `GraphEditor` for flowcharts and executable blueprints
|
|
93
94
|
|
|
94
95
|
You can also import individual files from `svelte-multistyle-ui/components/<Component>.svelte`, and chart components from `svelte-multistyle-ui/charts/<Chart>.svelte`.
|
|
95
96
|
|
|
97
|
+
### InlineEdit
|
|
98
|
+
|
|
99
|
+
`InlineEdit` displays dotted-underlined text as a paragraph. Activate the text to edit it in place. The default variant uses a single-line input. Set `variant="multiline"` to use a textarea.
|
|
100
|
+
|
|
101
|
+
```svelte
|
|
102
|
+
<script>
|
|
103
|
+
import { InlineEdit } from "svelte-multistyle-ui";
|
|
104
|
+
|
|
105
|
+
let title = $state("Project Atlas");
|
|
106
|
+
let notes = $state("Review the new layout.");
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<InlineEdit aria-label="Project title" bind:value={title} />
|
|
110
|
+
<InlineEdit
|
|
111
|
+
aria-label="Release notes"
|
|
112
|
+
variant="multiline"
|
|
113
|
+
value={notes}
|
|
114
|
+
rows={4}
|
|
115
|
+
onUpdate={(next) => (notes = next)}
|
|
116
|
+
/>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
When the field loses focus, a changed value updates `bind:value` and calls `onUpdate(value, previousValue)`. Enter leaves a single-line edit. In a multiline edit, Enter inserts a newline and Ctrl/⌘+Enter leaves the field. Escape discards the draft. Use `aria-label` to name the field for assistive technology.
|
|
120
|
+
|
|
121
|
+
Display and edit mode occupy the same height for the same text. Multiline fields use `rows` as a minimum and grow to fit their content without an internal scrollbar. The active field uses the selected style’s borders. [InlineEdit API](skill/references/InlineEdit.md)
|
|
122
|
+
|
|
123
|
+
## Graph editor
|
|
124
|
+
|
|
125
|
+
Open **Graph Editor** in the component gallery and choose the **Flowchart** or **Blueprint** variant. Flowchart includes a support conversation with yes/no branches and a billing subgraph. Blueprint includes a runnable order subtotal example. Each variant saves locally and can open, export, or embed graph JSON. The in-page guide includes copyable examples for setup, custom nodes, and connection styles.
|
|
126
|
+
|
|
127
|
+
```svelte
|
|
128
|
+
<script>
|
|
129
|
+
import 'svelte-multistyle-ui/theme.css';
|
|
130
|
+
import { GraphEditor, createGraph, runGraph } from 'svelte-multistyle-ui';
|
|
131
|
+
|
|
132
|
+
let graph = $state.raw(createGraph('Order logic'));
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<GraphEditor bind:graph mode="blueprint" />
|
|
136
|
+
<button onclick={() => console.log(runGraph(graph).outputs)}>Run graph</button>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Drag nodes from the palette or click to add them. Drag from an output to an input to connect, or activate the two ports in order with the keyboard. Use the canvas controls to zoom and fit the graph. With canvas focus, the arrow keys pan, `+` and `-` zoom, and Home fits the graph.
|
|
140
|
+
|
|
141
|
+
Add a **Subgraph** node and open it to edit its contents. **Graph input** and **Graph output** nodes inside it define ports on the parent node. Their IDs remain stable when their labels change. Call `editor.embedGraph(graph)` on a bound editor instance to insert an independent copy of another graph.
|
|
142
|
+
|
|
143
|
+
`mode="flowchart"` uses conventional shapes and supports loops. Choose **Horizontal** for left-to-right flow or **Vertical** for top-to-bottom flow. Each graph and subgraph saves its own direction. Use `orientFlowGraph(graph, direction)` to change it in code. Select a shape to resize it using its corner handle or the inspector.
|
|
144
|
+
|
|
145
|
+
`mode="blueprint"` shows data nodes for synchronous execution. `mode="all"` shows both sets. Use `runGraph(graph, { inputs, nodeTypes })` to evaluate data links in dependency order. Inputs and outputs are keyed by their boundary node IDs. The runner reports circular data dependencies.
|
|
146
|
+
|
|
147
|
+
Pass custom definitions as `nodeTypes` to both `GraphEditor` and `runGraph`. A definition has a title, input and output ports with stable IDs and types, optional inspector fields, and a synchronous `run(inputs, data)` function that returns values keyed by output port ID. The standalone `svelte-multistyle-ui/graph` entry also exports `createGraphNode`, `connectGraphNodes`, and `parseGraph` for building and validating graphs outside the editor.
|
|
148
|
+
|
|
149
|
+
Use `edgeStyle="straight"`, `"curve"`, or `"orthogonal"` to set the default connection style. Flowcharts default to right-angle routing and blueprints default to curves. Pass a connection’s `style` to `connectGraphNodes` or set it in the inspector to override the default. The override travels with exported graph JSON.
|
|
150
|
+
|
|
151
|
+
[GraphEditor API](skill/references/GraphEditor.md)
|
|
152
|
+
|
|
96
153
|
## Theming
|
|
97
154
|
|
|
98
155
|
### Preset themes
|
|
@@ -133,7 +190,7 @@ Key tokens include `--t-primary`, `--t-secondary`, `--t-surface`, `--t-card-bg`,
|
|
|
133
190
|
|
|
134
191
|
## Demo & development
|
|
135
192
|
|
|
136
|
-
|
|
193
|
+
The SvelteKit demo at `/` contains the component gallery, including Graph Editor.
|
|
137
194
|
|
|
138
195
|
```bash
|
|
139
196
|
pnpm install
|
|
@@ -157,7 +214,7 @@ The demo supports URL parameters for quick visual regression checks:
|
|
|
157
214
|
`svelte-multistyle-ui` ships a YAML → Svelte 5 page generator. It auto-detects three YAML input styles and emits token-efficient markup with auto-bound state and fake data injection.
|
|
158
215
|
|
|
159
216
|
```bash
|
|
160
|
-
npx svelte-multistyle-ui generate --input page.yaml --output ./src/routes/
|
|
217
|
+
npx svelte-multistyle-ui generate --input page.yaml --output ./src/routes/example/+page.svelte
|
|
161
218
|
```
|
|
162
219
|
|
|
163
220
|
**Supported YAML styles:**
|
|
@@ -203,7 +260,7 @@ npx svelte-multistyle-ui generate --input page.yaml --output ./src/routes/demo/+
|
|
|
203
260
|
|
|
204
261
|
**Features:**
|
|
205
262
|
|
|
206
|
-
- **Auto-binding**
|
|
263
|
+
- **Auto-binding** gives controls such as `Input`, `Textarea`, `InlineEdit`, and `CodeEditor` a `$state` variable and a `bind:value` directive in compact and shorthand pages. Use the verbose schema to initialize a `GraphEditor` binding with a graph object. [Generator binding reference](skill/references/generator-cli.md#auto-binding)
|
|
207
264
|
- **Fake data** — missing `options` for `Select`/`MultiSelect`, missing `data` for `Table`, and missing chart data are synthesized automatically.
|
|
208
265
|
- **Option conversion** — `options: [Apple, Banana]` becomes `[{value:"apple",label:"Apple"}, ...]`.
|
|
209
266
|
- **Lightweight output** — generated files import from `svelte-multistyle-ui`, declare `$state`, include an empty `onMount` stub, and emit markup only; dark/light mode is handled by `initMultistyleUI` in the app layout.
|
package/cli/registry.js
CHANGED
|
@@ -23,6 +23,7 @@ const registry = {
|
|
|
23
23
|
// ---------------- Form ----------------
|
|
24
24
|
Input: { importName: "Input", kind: "leaf", bindable: ["value"], primaryBindable: "value" },
|
|
25
25
|
Textarea: { importName: "Textarea", kind: "leaf", bindable: ["value"], primaryBindable: "value" },
|
|
26
|
+
InlineEdit: { importName: "InlineEdit", kind: "leaf", bindable: ["value"], primaryBindable: "value" },
|
|
26
27
|
TextEditor: { importName: "TextEditor", kind: "leaf", bindable: ["value"], primaryBindable: "value" },
|
|
27
28
|
CodeEditor: { importName: "CodeEditor", kind: "leaf", bindable: ["value"], primaryBindable: "value" },
|
|
28
29
|
Select: { importName: "Select", kind: "leaf", bindable: ["value"], primaryBindable: "value", listProps: ["options"] },
|
|
@@ -42,6 +43,8 @@ const registry = {
|
|
|
42
43
|
FAB: { importName: "FAB", kind: "children" },
|
|
43
44
|
|
|
44
45
|
// ---------------- Layout ----------------
|
|
46
|
+
Carousel: { importName: "Carousel", kind: "leaf", listProps: ["slides"] },
|
|
47
|
+
GraphEditor: { importName: "GraphEditor", kind: "leaf", bindable: ["graph"], primaryBindable: "graph", objectProps: ["graph"] },
|
|
45
48
|
Card: { importName: "Card", kind: "container" },
|
|
46
49
|
Row: { importName: "Row", kind: "container" },
|
|
47
50
|
Column: { importName: "Column", kind: "container" },
|
|
@@ -94,4 +97,4 @@ const registry = {
|
|
|
94
97
|
// against src/lib/index.js. Keep in sync with index.js when adding components.
|
|
95
98
|
export const registryKeys = Object.keys(registry);
|
|
96
99
|
|
|
97
|
-
export { registry };
|
|
100
|
+
export { registry };
|