flowchart-sequence-designer 1.0.1 → 1.1.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 +14 -0
- package/README.md +68 -8
- package/dist/ui/index.cjs +420 -274
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +398 -252
- package/dist/ui/index.js.map +1 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,20 @@ Versioning: [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
9
|
### Added
|
|
10
|
+
- Toast notification system (`useToast` hook + `ToastContainer`) for
|
|
11
|
+
import/export success/failure feedback in both editors. Replaces silent
|
|
12
|
+
failures and `alert()` with auto-dismissing colored toasts.
|
|
13
|
+
- Keyboard accessibility on SVG canvas nodes (`DiagramCanvas`): nodes are
|
|
14
|
+
now focusable (`tabIndex=0`) with visual focus highlight, F2/Enter to
|
|
15
|
+
rename in-place. Delete handled by existing global keyboard handler.
|
|
16
|
+
- Keyboard accessibility on sequence actors (`SequenceCanvas`): actor text
|
|
17
|
+
is focusable with F2/Enter rename activation and keyboard-accessible
|
|
18
|
+
remove button.
|
|
19
|
+
- ARIA labels on all Toolbar export/import buttons.
|
|
20
|
+
- Focus-visible CSS rings for SVG `[role="button"]` elements in both
|
|
21
|
+
DiagramEditor and SequenceEditor.
|
|
22
|
+
- `className="fsd-seq-editor"` on SequenceEditor root for CSS targeting.
|
|
23
|
+
- JSDoc comments on all `demo/src/docs-primitives.tsx` helper components.
|
|
10
24
|
- `themeOverrides` prop on `DiagramEditor` and `SequenceEditor` — a
|
|
11
25
|
`Partial<ThemeColors>` (or `Partial<SequenceThemeColors>`) shallow-merged on
|
|
12
26
|
top of the resolved light/dark palette so consumers can match the editor to
|
package/README.md
CHANGED
|
@@ -166,12 +166,14 @@ All presets return a deep clone — mutate the result freely.
|
|
|
166
166
|
|
|
167
167
|
```ts
|
|
168
168
|
import { Model } from 'flowchart-sequence-designer';
|
|
169
|
-
import type { DiagramModel } from 'flowchart-sequence-designer';
|
|
170
169
|
|
|
171
|
-
const m = new Model(
|
|
170
|
+
const m = new Model('flowchart'); // new Model(type, title?, variant?)
|
|
172
171
|
m.addNode({ id: 'a', label: 'Step A', shape: 'rectangle' });
|
|
173
172
|
m.addNode({ id: 'b', label: 'Step B', shape: 'rectangle' });
|
|
174
173
|
m.addEdge({ id: 'e1', from: 'a', to: 'b', label: 'next' });
|
|
174
|
+
|
|
175
|
+
// Rehydrate from a saved DiagramModel:
|
|
176
|
+
// const m2 = Model.fromData(savedJson);
|
|
175
177
|
```
|
|
176
178
|
|
|
177
179
|
---
|
|
@@ -386,6 +388,8 @@ import { SequenceEditor, presetSequenceModel } from 'flowchart-sequence-designer
|
|
|
386
388
|
|
|
387
389
|
## Types
|
|
388
390
|
|
|
391
|
+
### Core entry (`flowchart-sequence-designer`)
|
|
392
|
+
|
|
389
393
|
```ts
|
|
390
394
|
import type {
|
|
391
395
|
DiagramModel,
|
|
@@ -396,7 +400,39 @@ import type {
|
|
|
396
400
|
NodeShape,
|
|
397
401
|
ExportFormat,
|
|
398
402
|
SequenceMessage,
|
|
403
|
+
ValidationError,
|
|
399
404
|
} from 'flowchart-sequence-designer';
|
|
405
|
+
|
|
406
|
+
import {
|
|
407
|
+
Model, // class — build / query / validate diagrams
|
|
408
|
+
flowchart, // fluent FlowchartBuilder factory
|
|
409
|
+
sequence, // fluent SequenceBuilder factory
|
|
410
|
+
toMermaid, fromMermaid,
|
|
411
|
+
toPlantUML,
|
|
412
|
+
toJSON, fromJSON,
|
|
413
|
+
toSVG, toPNG,
|
|
414
|
+
} from 'flowchart-sequence-designer';
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### UI entry (`flowchart-sequence-designer/ui`)
|
|
418
|
+
|
|
419
|
+
```ts
|
|
420
|
+
import {
|
|
421
|
+
DiagramEditor, // flowchart / question / journey editor
|
|
422
|
+
SequenceEditor, // sequence diagram editor
|
|
423
|
+
Toolbar, // standalone toolbar (used internally)
|
|
424
|
+
StepEditor, // node property panel (used internally)
|
|
425
|
+
presetFlowchartModel, // starter model for flowchart variants
|
|
426
|
+
presetSequenceModel, // starter model for sequence
|
|
427
|
+
emptyModel, // blank model factory
|
|
428
|
+
} from 'flowchart-sequence-designer/ui';
|
|
429
|
+
|
|
430
|
+
import type {
|
|
431
|
+
DiagramEditorProps,
|
|
432
|
+
SequenceEditorProps,
|
|
433
|
+
ThemeColors, // flowchart theme palette
|
|
434
|
+
SequenceThemeColors, // sequence theme palette
|
|
435
|
+
} from 'flowchart-sequence-designer/ui';
|
|
400
436
|
```
|
|
401
437
|
|
|
402
438
|
### `DiagramModel`
|
|
@@ -404,11 +440,12 @@ import type {
|
|
|
404
440
|
```ts
|
|
405
441
|
interface DiagramModel {
|
|
406
442
|
type: 'flowchart' | 'sequence';
|
|
443
|
+
variant?: DiagramVariant; // 'flowchart' | 'question' | 'journey' (flowchart-type only)
|
|
407
444
|
title?: string;
|
|
408
|
-
nodes: DiagramNode[];
|
|
409
|
-
edges: DiagramEdge[];
|
|
410
|
-
actors?: string[]; // sequence
|
|
411
|
-
messages?: SequenceMessage[]; // sequence
|
|
445
|
+
nodes: DiagramNode[]; // always present (empty array for sequence models)
|
|
446
|
+
edges: DiagramEdge[]; // always present (empty array for sequence models)
|
|
447
|
+
actors?: string[]; // sequence models only — ordered actor names
|
|
448
|
+
messages?: SequenceMessage[]; // sequence models only — ordered messages
|
|
412
449
|
}
|
|
413
450
|
```
|
|
414
451
|
|
|
@@ -436,6 +473,29 @@ interface DiagramEdge {
|
|
|
436
473
|
label?: string;
|
|
437
474
|
style?: 'solid' | 'dashed' | 'dotted';
|
|
438
475
|
arrowhead?: 'arrow' | 'none' | 'open';
|
|
476
|
+
waypoint?: { x: number; y: number }; // manual routing point (JSON only)
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### `SequenceMessage`
|
|
481
|
+
|
|
482
|
+
```ts
|
|
483
|
+
interface SequenceMessage {
|
|
484
|
+
id: string;
|
|
485
|
+
from: string; // actor name
|
|
486
|
+
to: string; // actor name
|
|
487
|
+
label: string;
|
|
488
|
+
style?: 'solid' | 'dashed';
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### `ValidationError`
|
|
493
|
+
|
|
494
|
+
```ts
|
|
495
|
+
interface ValidationError {
|
|
496
|
+
kind: 'dangling-from' | 'dangling-to' | 'duplicate-node-id' | 'duplicate-edge-id';
|
|
497
|
+
id: string;
|
|
498
|
+
message: string;
|
|
439
499
|
}
|
|
440
500
|
```
|
|
441
501
|
|
|
@@ -451,9 +511,9 @@ flowchart-sequence-designer/
|
|
|
451
511
|
│ └── index.js / index.cjs / index.d.ts ← React UI
|
|
452
512
|
└── src/
|
|
453
513
|
├── core/ # types, Model, FlowchartBuilder, SequenceBuilder
|
|
454
|
-
├── exporters/ # mermaid, plantuml, json, svg
|
|
514
|
+
├── exporters/ # mermaid, plantuml, json, svg, png
|
|
455
515
|
├── importers/ # mermaid, json
|
|
456
|
-
└── ui/ # DiagramEditor,
|
|
516
|
+
└── ui/ # DiagramEditor, SequenceEditor, Toolbar, hooks
|
|
457
517
|
```
|
|
458
518
|
|
|
459
519
|
The `"."` export gives you the core API; `"./ui"` gives you the React components. Consumers that only use the programmatic API never pull in React.
|