@dskripchenko/flow 0.0.0-stage → 1.0.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/CHANGELOG.md +66 -0
- package/LICENSE +21 -0
- package/README.md +87 -2
- package/dist/core-DfJMfClV.js +4121 -0
- package/dist/core-dyjNI9N1.cjs +4522 -0
- package/dist/index.cjs +69 -0
- package/dist/index.d.ts +767 -0
- package/dist/index.mjs +1 -0
- package/dist/mermaid.cjs +222 -0
- package/dist/mermaid.d.ts +107 -0
- package/dist/mermaid.mjs +220 -0
- package/dist/standalone.css +2 -0
- package/dist/standalone.js +14 -0
- package/dist/style.css +1131 -0
- package/dist/vue.cjs +5836 -0
- package/dist/vue.d.ts +1039 -0
- package/dist/vue.mjs +5823 -0
- package/package.json +122 -4
- package/schema/graph.schema.json +95 -0
- package/schema/snapshot.schema.json +35 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @dskripchenko/flow
|
|
2
|
+
|
|
3
|
+
## 1.0.0 — 2026-10-26
|
|
4
|
+
|
|
5
|
+
First release: process and state-machine graphs — a viewer with live
|
|
6
|
+
monitoring, drill-down and enable/disable switches, and a visual editor. The
|
|
7
|
+
core has no runtime dependencies; the Vue components are built on
|
|
8
|
+
`@dskripchenko/ui`.
|
|
9
|
+
|
|
10
|
+
**Core (`@dskripchenko/flow`)**
|
|
11
|
+
|
|
12
|
+
- A versioned JSON model (`version: 1`) with nodes, edges, ports, groups and
|
|
13
|
+
inline or referenced sub-processes; `parseGraph` with JSON-pointer errors,
|
|
14
|
+
`stringifyGraph`; JSON Schemas for the model and the monitoring snapshot.
|
|
15
|
+
- Built-in node types `start`, `end`, `state`, `task`, `decision`,
|
|
16
|
+
`subprocess`, `note` and a registry for custom types (shape, size, ports,
|
|
17
|
+
icon, locked).
|
|
18
|
+
- `validateGraph`: errors for duplicate ids and broken references or ports,
|
|
19
|
+
warnings for missing start/end, unreachable steps, dead ends and empty labels.
|
|
20
|
+
- `layoutGraph`: a deterministic layered layout (LR/TB) that keeps fixed
|
|
21
|
+
positions and places the rest; orthogonal routing by default (or smooth
|
|
22
|
+
curves over the same corridors) that never passes through other nodes or
|
|
23
|
+
foreign groups; back edges in lanes of a channel beside the graph; edge
|
|
24
|
+
labels kept off nodes and off each other; ports, spread anchors, self
|
|
25
|
+
loops and group frames.
|
|
26
|
+
- Monitoring: the snapshot format, `reduceMonitor` / `mergeSnapshot`,
|
|
27
|
+
`isStale`, `pathEdges`, `statusSummary`; `createPoller` with visibility
|
|
28
|
+
pause, exponential backoff and cancellation.
|
|
29
|
+
- Editing: `applyCommand` over serialisable commands, `History` with undo,
|
|
30
|
+
redo and merging, copy/paste fragments, align, distribute, auto layout as a
|
|
31
|
+
command.
|
|
32
|
+
- Viewport helpers: `fitView`, `zoomAt`, `nearestInDirection`.
|
|
33
|
+
|
|
34
|
+
**Mermaid (`@dskripchenko/flow/mermaid`)**
|
|
35
|
+
|
|
36
|
+
- `fromMermaid` for `stateDiagram-v2` (composites become sub-processes, notes
|
|
37
|
+
become note nodes) and `flowchart` (shapes map to types, subgraphs to
|
|
38
|
+
groups), through `@dskripchenko/diagrams`' parser.
|
|
39
|
+
|
|
40
|
+
**Vue (`@dskripchenko/flow/vue`)**
|
|
41
|
+
|
|
42
|
+
- `FlowView`: pan, zoom, pinch, fit, minimap; opens at 100 % on the current
|
|
43
|
+
step (or whole when it fits at 85 % or more), keeping nodes clear of the
|
|
44
|
+
overlays; `edgeStyle: 'orthogonal' | 'smooth'`;
|
|
45
|
+
monitoring from `state` or `poll` with the active step, the instance path,
|
|
46
|
+
counters, error badges, a status line with last update, staleness and a
|
|
47
|
+
summary; enable/disable switches with optimistic update and rollback;
|
|
48
|
+
drill-down with a breadcrumb and `loadSubgraph`; a details drawer with
|
|
49
|
+
slots; custom node renderers; keyboard navigation and ARIA labels; en/ru.
|
|
50
|
+
- `FlowEditor`: palette, drag-to-connect with snapping, reconnect and
|
|
51
|
+
detach, grid snapping, multi-select, align/distribute, undo/redo and
|
|
52
|
+
clipboard shortcuts, a properties panel, a validation panel, context menus,
|
|
53
|
+
JSON and Mermaid import, JSON export, in-place sub-process editing, locked
|
|
54
|
+
types, a narrow-screen layout.
|
|
55
|
+
- `mountFlow`, `mountFlowEditor`, with an optional `appContext` to render
|
|
56
|
+
inside a host app (its providers reach the component).
|
|
57
|
+
- Host integration: `state` is the initial value when `poll` is set (polled
|
|
58
|
+
snapshots replace it); `pollParams` reach `poll.fetch` as
|
|
59
|
+
`context.params` and restart polling at once when they change;
|
|
60
|
+
`FlowEditor`'s `locked: string[]` locks node types; nodes added from the
|
|
61
|
+
palette land on the nearest free grid spot (next along the flow from the
|
|
62
|
+
selection, else mid-view), scrolled into view and selected
|
|
63
|
+
(`findFreeSpot` in the core).
|
|
64
|
+
|
|
65
|
+
**Standalone** — `dist/standalone.js` with `DskFlow.mountFlow` and
|
|
66
|
+
`DskFlow.mountFlowEditor`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Denis Skripchenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,88 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dskripchenko/flow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/dskripchenko/flow/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@dskripchenko/flow)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
Process and state-machine graphs: draw them, watch running instances move
|
|
8
|
+
through them, switch steps on and off, drill into sub-processes, and edit them
|
|
9
|
+
visually. The core has **no runtime dependencies**; the Vue components are
|
|
10
|
+
built on [`@dskripchenko/ui`](https://github.com/dskripchenko/ui).
|
|
11
|
+
|
|
12
|
+
```vue
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { FlowView } from '@dskripchenko/flow/vue'
|
|
15
|
+
import '@dskripchenko/ui/styles/all.css'
|
|
16
|
+
import '@dskripchenko/flow/style.css'
|
|
17
|
+
|
|
18
|
+
const poll = {
|
|
19
|
+
intervalMs: 5000,
|
|
20
|
+
fetch: (signal: AbortSignal) => fetch('/api/orders/42/state', { signal }).then((r) => r.json()),
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<FlowView :graph="orderProcess" :poll="poll" toggleable :on-toggle="saveToggle" style="height: 600px" />
|
|
26
|
+
</template>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What is inside
|
|
30
|
+
|
|
31
|
+
**Core** (`@dskripchenko/flow`, plain TypeScript, no DOM)
|
|
32
|
+
|
|
33
|
+
- A versioned JSON model: nodes (`start`, `end`, `state`, `task`, `decision`,
|
|
34
|
+
`subprocess`, `note`, or your own types), edges with labels, conditions and
|
|
35
|
+
ports, groups, inline or referenced sub-processes. JSON Schemas included.
|
|
36
|
+
- Validation: duplicate ids, broken references and ports (errors); missing
|
|
37
|
+
start/end, unreachable steps, dead ends (warnings). Cycles are fine.
|
|
38
|
+
- Layout: a layered (Sugiyama) layout, left-to-right or top-to-bottom,
|
|
39
|
+
deterministic, around nodes you have placed yourself; orthogonal (or
|
|
40
|
+
smooth) edges that never cut through other nodes or groups, with back
|
|
41
|
+
edges (retries, resends) in their own lanes beside the graph.
|
|
42
|
+
- Monitoring: a snapshot format, a pure reducer, stale detection, and a poller
|
|
43
|
+
that pauses in hidden tabs, backs off on errors and cancels requests.
|
|
44
|
+
- Editing: undoable commands, history with merging, copy/paste, align,
|
|
45
|
+
distribute, auto layout as one step.
|
|
46
|
+
|
|
47
|
+
**Vue** (`@dskripchenko/flow/vue`)
|
|
48
|
+
|
|
49
|
+
- `FlowView` — pan, zoom, pinch, fit, minimap; live state with the active
|
|
50
|
+
step, the instance's path, counters, error badges, last-updated and stale
|
|
51
|
+
indicators; enable/disable switches with rollback on failure; drill-down
|
|
52
|
+
with a breadcrumb; a details drawer with a slot for your content; custom
|
|
53
|
+
node components; keyboard navigation and ARIA labels; light and dark.
|
|
54
|
+
- `FlowEditor` — palette (drag or press), drag-to-connect with snapping,
|
|
55
|
+
reconnecting, moving on a grid, multi-select, align/distribute, undo/redo
|
|
56
|
+
with shortcuts, a properties panel, a validation panel, context menus,
|
|
57
|
+
JSON and Mermaid import, sub-process editing, locked node types.
|
|
58
|
+
|
|
59
|
+
**Mermaid** (`@dskripchenko/flow/mermaid`) — a model from `stateDiagram-v2` or
|
|
60
|
+
`flowchart` source (composite states become sub-processes).
|
|
61
|
+
|
|
62
|
+
**Standalone** — one `<script>`: `DskFlow.mountFlow('#el', { graph, poll })`.
|
|
63
|
+
|
|
64
|
+
## Documentation
|
|
65
|
+
|
|
66
|
+
| | English | Русский | Deutsch | 中文 |
|
|
67
|
+
|---|---|---|---|---|
|
|
68
|
+
| Getting started | [en](docs/en/getting-started.md) | [ru](docs/ru/getting-started.md) | [de](docs/de/getting-started.md) | [zh](docs/zh/getting-started.md) |
|
|
69
|
+
| Model | [en](docs/en/model.md) | [ru](docs/ru/model.md) | [de](docs/de/model.md) | [zh](docs/zh/model.md) |
|
|
70
|
+
| Monitoring and polling | [en](docs/en/monitoring.md) | [ru](docs/ru/monitoring.md) | [de](docs/de/monitoring.md) | [zh](docs/zh/monitoring.md) |
|
|
71
|
+
| Vue components | [en](docs/en/vue.md) | [ru](docs/ru/vue.md) | [de](docs/de/vue.md) | [zh](docs/zh/vue.md) |
|
|
72
|
+
| Editor | [en](docs/en/editor.md) | [ru](docs/ru/editor.md) | [de](docs/de/editor.md) | [zh](docs/zh/editor.md) |
|
|
73
|
+
| Host integration | [en](docs/en/integration.md) | [ru](docs/ru/integration.md) | [de](docs/de/integration.md) | [zh](docs/zh/integration.md) |
|
|
74
|
+
| Standalone | [en](docs/en/standalone.md) | [ru](docs/ru/standalone.md) | [de](docs/de/standalone.md) | [zh](docs/zh/standalone.md) |
|
|
75
|
+
|
|
76
|
+
## Development
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pnpm install
|
|
80
|
+
pnpm dev # playground: ?view=monitor | editor | large | empty, &theme=dark, &locale=ru
|
|
81
|
+
pnpm test # unit and component tests
|
|
82
|
+
pnpm check:browser # Playwright: rendering, geometry, interactions, screenshots
|
|
83
|
+
pnpm lint && pnpm typecheck && pnpm build
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
[MIT](LICENSE)
|