@dskripchenko/flow 0.0.0-stage → 1.0.1

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 ADDED
@@ -0,0 +1,82 @@
1
+ # @dskripchenko/flow
2
+
3
+ ## 1.0.1 — 2026-10-26
4
+
5
+ Requires `@dskripchenko/ui` 1.15 and drops the workarounds for what it fixed.
6
+
7
+ - **Locale follows the host.** Without a `locale` prop, `FlowView` and
8
+ `FlowEditor` no longer wrap themselves in their own `UidLocaleProvider`:
9
+ the kit's locale stays the host's (e.g. laravel-admin's), and the
10
+ package's strings follow it (`ru-*` → Russian, else English). An explicit
11
+ `locale` still sets both, as before. The default of `locale` is now
12
+ unset instead of `'en'`.
13
+ - **Context menus** open with the kit's `UidMenu.openAt(x, y)` at the pointer
14
+ (right click, and long-press on touch) instead of a hidden trigger.
15
+ - **Toggle buttons** (minimap, snap to grid) show the pressed state with the
16
+ kit's `secondary` variant again.
17
+ - Peer and dev dependency `@dskripchenko/ui` `^1.15.0`.
18
+
19
+ ## 1.0.0 — 2026-10-26
20
+
21
+ First release: process and state-machine graphs — a viewer with live
22
+ monitoring, drill-down and enable/disable switches, and a visual editor. The
23
+ core has no runtime dependencies; the Vue components are built on
24
+ `@dskripchenko/ui`.
25
+
26
+ **Core (`@dskripchenko/flow`)**
27
+
28
+ - A versioned JSON model (`version: 1`) with nodes, edges, ports, groups and
29
+ inline or referenced sub-processes; `parseGraph` with JSON-pointer errors,
30
+ `stringifyGraph`; JSON Schemas for the model and the monitoring snapshot.
31
+ - Built-in node types `start`, `end`, `state`, `task`, `decision`,
32
+ `subprocess`, `note` and a registry for custom types (shape, size, ports,
33
+ icon, locked).
34
+ - `validateGraph`: errors for duplicate ids and broken references or ports,
35
+ warnings for missing start/end, unreachable steps, dead ends and empty labels.
36
+ - `layoutGraph`: a deterministic layered layout (LR/TB) that keeps fixed
37
+ positions and places the rest; orthogonal routing by default (or smooth
38
+ curves over the same corridors) that never passes through other nodes or
39
+ foreign groups; back edges in lanes of a channel beside the graph; edge
40
+ labels kept off nodes and off each other; ports, spread anchors, self
41
+ loops and group frames.
42
+ - Monitoring: the snapshot format, `reduceMonitor` / `mergeSnapshot`,
43
+ `isStale`, `pathEdges`, `statusSummary`; `createPoller` with visibility
44
+ pause, exponential backoff and cancellation.
45
+ - Editing: `applyCommand` over serialisable commands, `History` with undo,
46
+ redo and merging, copy/paste fragments, align, distribute, auto layout as a
47
+ command.
48
+ - Viewport helpers: `fitView`, `zoomAt`, `nearestInDirection`.
49
+
50
+ **Mermaid (`@dskripchenko/flow/mermaid`)**
51
+
52
+ - `fromMermaid` for `stateDiagram-v2` (composites become sub-processes, notes
53
+ become note nodes) and `flowchart` (shapes map to types, subgraphs to
54
+ groups), through `@dskripchenko/diagrams`' parser.
55
+
56
+ **Vue (`@dskripchenko/flow/vue`)**
57
+
58
+ - `FlowView`: pan, zoom, pinch, fit, minimap; opens at 100 % on the current
59
+ step (or whole when it fits at 85 % or more), keeping nodes clear of the
60
+ overlays; `edgeStyle: 'orthogonal' | 'smooth'`;
61
+ monitoring from `state` or `poll` with the active step, the instance path,
62
+ counters, error badges, a status line with last update, staleness and a
63
+ summary; enable/disable switches with optimistic update and rollback;
64
+ drill-down with a breadcrumb and `loadSubgraph`; a details drawer with
65
+ slots; custom node renderers; keyboard navigation and ARIA labels; en/ru.
66
+ - `FlowEditor`: palette, drag-to-connect with snapping, reconnect and
67
+ detach, grid snapping, multi-select, align/distribute, undo/redo and
68
+ clipboard shortcuts, a properties panel, a validation panel, context menus,
69
+ JSON and Mermaid import, JSON export, in-place sub-process editing, locked
70
+ types, a narrow-screen layout.
71
+ - `mountFlow`, `mountFlowEditor`, with an optional `appContext` to render
72
+ inside a host app (its providers reach the component).
73
+ - Host integration: `state` is the initial value when `poll` is set (polled
74
+ snapshots replace it); `pollParams` reach `poll.fetch` as
75
+ `context.params` and restart polling at once when they change;
76
+ `FlowEditor`'s `locked: string[]` locks node types; nodes added from the
77
+ palette land on the nearest free grid spot (next along the flow from the
78
+ selection, else mid-view), scrolled into view and selected
79
+ (`findFreeSpot` in the core).
80
+
81
+ **Standalone** — `dist/standalone.js` with `DskFlow.mountFlow` and
82
+ `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
- # Temporary Holding Version
1
+ # @dskripchenko/flow
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/dskripchenko/flow/actions/workflows/ci.yml/badge.svg)](https://github.com/dskripchenko/flow/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/@dskripchenko/flow.svg)](https://www.npmjs.com/package/@dskripchenko/flow)
5
+ [![license](https://img.shields.io/npm/l/@dskripchenko/flow.svg)](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)