@miragon/wardley-renderer 0.6.3 → 0.7.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 +37 -1
- package/dist/Modeler.d.ts +5 -0
- package/dist/Modeler.d.ts.map +1 -1
- package/dist/WardleyBaseViewer.d.ts +66 -8
- package/dist/WardleyBaseViewer.d.ts.map +1 -1
- package/dist/a11y/canvasFocus.d.ts +17 -0
- package/dist/a11y/canvasFocus.d.ts.map +1 -0
- package/dist/a11y/describeCanvas.d.ts +8 -0
- package/dist/a11y/describeCanvas.d.ts.map +1 -0
- package/dist/a11y/index.d.ts +5 -0
- package/dist/a11y/index.d.ts.map +1 -0
- package/dist/append/WardleyAppendBehavior.d.ts +7 -6
- package/dist/append/WardleyAppendBehavior.d.ts.map +1 -1
- package/dist/color-picker/WardleyColorPicker.d.ts +7 -2
- package/dist/color-picker/WardleyColorPicker.d.ts.map +1 -1
- package/dist/context-pad/WardleyContextPad.d.ts +30 -0
- package/dist/context-pad/WardleyContextPad.d.ts.map +1 -0
- package/dist/context-pad/WardleyContextPadProvider.d.ts +23 -1
- package/dist/context-pad/WardleyContextPadProvider.d.ts.map +1 -1
- package/dist/context-pad/index.d.ts +1 -0
- package/dist/context-pad/index.d.ts.map +1 -1
- package/dist/draw/WardleyRenderer.d.ts +8 -0
- package/dist/draw/WardleyRenderer.d.ts.map +1 -1
- package/dist/draw/icons.d.ts +9 -2
- package/dist/draw/icons.d.ts.map +1 -1
- package/dist/draw/index.d.ts +2 -1
- package/dist/draw/index.d.ts.map +1 -1
- package/dist/draw/label-layout.d.ts +59 -0
- package/dist/draw/label-layout.d.ts.map +1 -0
- package/dist/draw/palette-icons.d.ts +1 -0
- package/dist/draw/palette-icons.d.ts.map +1 -1
- package/dist/draw/styles.d.ts +16 -17
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/draw-tool/WardleyDrawTool.d.ts +12 -1
- package/dist/draw-tool/WardleyDrawTool.d.ts.map +1 -1
- package/dist/draw-tool/WardleyDrawingHandles.d.ts +1 -0
- package/dist/draw-tool/WardleyDrawingHandles.d.ts.map +1 -1
- package/dist/editor-state.d.ts +46 -0
- package/dist/editor-state.d.ts.map +1 -0
- package/dist/evolution-grid/EvolutionConstraintBehavior.d.ts +58 -24
- package/dist/evolution-grid/EvolutionConstraintBehavior.d.ts.map +1 -1
- package/dist/evolution-grid/EvolutionGrid.d.ts +2 -0
- package/dist/evolution-grid/EvolutionGrid.d.ts.map +1 -1
- package/dist/evolution-grid/index.d.ts.map +1 -1
- package/dist/evolve/WardleyEvolveDragging.d.ts.map +1 -1
- package/dist/evolve/constants.d.ts +3 -0
- package/dist/evolve/constants.d.ts.map +1 -0
- package/dist/evolve/index.d.ts +1 -0
- package/dist/evolve/index.d.ts.map +1 -1
- package/dist/index.d.ts +20 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4003 -1881
- package/dist/index.js.map +1 -1
- package/dist/io/WardleyExporter.d.ts +3 -1
- package/dist/io/WardleyExporter.d.ts.map +1 -1
- package/dist/io/WardleyImporter.d.ts.map +1 -1
- package/dist/io/WardleySourceOrder.d.ts +23 -0
- package/dist/io/WardleySourceOrder.d.ts.map +1 -0
- package/dist/io/exportBounds.d.ts +15 -0
- package/dist/io/exportBounds.d.ts.map +1 -0
- package/dist/io/index.d.ts +5 -0
- package/dist/io/index.d.ts.map +1 -1
- package/dist/io/rasterize.d.ts +25 -0
- package/dist/io/rasterize.d.ts.map +1 -0
- package/dist/io/saveSvg.d.ts +1 -1
- package/dist/io/saveSvg.d.ts.map +1 -1
- package/dist/io/types.d.ts +5 -0
- package/dist/io/types.d.ts.map +1 -1
- package/dist/keyboard/WardleyKeyboard.d.ts +44 -4
- package/dist/keyboard/WardleyKeyboard.d.ts.map +1 -1
- package/dist/label-drag/WardleyLabelDragging.d.ts +56 -0
- package/dist/label-drag/WardleyLabelDragging.d.ts.map +1 -0
- package/dist/label-drag/index.d.ts +5 -0
- package/dist/label-drag/index.d.ts.map +1 -0
- package/dist/label-editing/WardleyLabelEditing.d.ts +62 -6
- package/dist/label-editing/WardleyLabelEditing.d.ts.map +1 -1
- package/dist/label-editing/fieldError.d.ts +13 -0
- package/dist/label-editing/fieldError.d.ts.map +1 -0
- package/dist/label-editing/index.d.ts +1 -0
- package/dist/label-editing/index.d.ts.map +1 -1
- package/dist/link-editing/WardleyLinkEditing.d.ts +38 -0
- package/dist/link-editing/WardleyLinkEditing.d.ts.map +1 -0
- package/dist/link-editing/index.d.ts +6 -0
- package/dist/link-editing/index.d.ts.map +1 -0
- package/dist/link-editing/link-url.d.ts +14 -0
- package/dist/link-editing/link-url.d.ts.map +1 -0
- package/dist/map-resize/MapProjection.d.ts +84 -0
- package/dist/map-resize/MapProjection.d.ts.map +1 -0
- package/dist/map-resize/MapResizeHandles.d.ts +57 -0
- package/dist/map-resize/MapResizeHandles.d.ts.map +1 -0
- package/dist/map-resize/ResizeAwareAutoScroll.d.ts +15 -0
- package/dist/map-resize/ResizeAwareAutoScroll.d.ts.map +1 -0
- package/dist/map-resize/index.d.ts +14 -0
- package/dist/map-resize/index.d.ts.map +1 -0
- package/dist/model/WardleyElementFactory.d.ts +36 -2
- package/dist/model/WardleyElementFactory.d.ts.map +1 -1
- package/dist/modeling/WardleyCopyPaste.d.ts +9 -5
- package/dist/modeling/WardleyCopyPaste.d.ts.map +1 -1
- package/dist/modeling/WardleyModeling.d.ts +16 -2
- package/dist/modeling/WardleyModeling.d.ts.map +1 -1
- package/dist/modeling/cmd/ResizeMapHandler.d.ts +24 -0
- package/dist/modeling/cmd/ResizeMapHandler.d.ts.map +1 -0
- package/dist/modeling/cmd/UpdateConfigHandler.d.ts +42 -0
- package/dist/modeling/cmd/UpdateConfigHandler.d.ts.map +1 -0
- package/dist/modeling/index.d.ts +2 -0
- package/dist/modeling/index.d.ts.map +1 -1
- package/dist/ordering/WardleyOrderingProvider.d.ts +1 -1
- package/dist/ordering/WardleyOrderingProvider.d.ts.map +1 -1
- package/dist/palette/WardleyPaletteKeyboard.d.ts +24 -0
- package/dist/palette/WardleyPaletteKeyboard.d.ts.map +1 -0
- package/dist/palette/WardleyPaletteProvider.d.ts +16 -1
- package/dist/palette/WardleyPaletteProvider.d.ts.map +1 -1
- package/dist/palette/index.d.ts +2 -1
- package/dist/palette/index.d.ts.map +1 -1
- package/dist/pan-constraint/PanConstraint.d.ts +9 -1
- package/dist/pan-constraint/PanConstraint.d.ts.map +1 -1
- package/dist/pipeline/PipelineGroupBehavior.d.ts +24 -0
- package/dist/pipeline/PipelineGroupBehavior.d.ts.map +1 -0
- package/dist/pipeline/index.d.ts +6 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/pipelineMembership.d.ts +23 -0
- package/dist/pipeline/pipelineMembership.d.ts.map +1 -0
- package/dist/popup/WardleyElementSettingsProvider.d.ts +2 -1
- package/dist/popup/WardleyElementSettingsProvider.d.ts.map +1 -1
- package/dist/rules/WardleyRules.d.ts.map +1 -1
- package/dist/snapping/StageSnapping.d.ts +6 -2
- package/dist/snapping/StageSnapping.d.ts.map +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/palette.d.ts +16 -3
- package/dist/theme/palette.d.ts.map +1 -1
- package/dist/wardley.css +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
[diagram-js](https://github.com/bpmn-io/diagram-js)-based renderer for
|
|
7
7
|
[Wardley Maps](https://learnwardleymapping.com/): `Viewer`, `NavigatedViewer`, and a full editable
|
|
8
|
-
`Modeler`, plus OWM / JSON / SVG / PNG
|
|
8
|
+
`Modeler`, plus OWM / JSON import and OWM / JSON / SVG / PNG export. Browser/DOM only.
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
@@ -34,6 +34,38 @@ const { svg } = await viewer.saveSVG();
|
|
|
34
34
|
|
|
35
35
|
Swap `NavigatedViewer` for `Modeler` to get the editable map (palette, context pad, undo/redo).
|
|
36
36
|
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
| Member | What it does |
|
|
40
|
+
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
41
|
+
| `importDSL(text)` / `importMap(map)` | Loads a map (replaces the content, clears the undo history). Resolves to `{ warnings }`. |
|
|
42
|
+
| `exportDSL()` / `exportMap()` / `saveSVG()` | The map as canonical OWM text, as the JSON model, or as a standalone SVG (never shows selection or hover state). |
|
|
43
|
+
| `setTitle(title)` | Sets the map title (one undo step in the `Modeler`). |
|
|
44
|
+
| `getMapSize()` | The plot size as drawn, whether the map writes it (`size [w, h]`) and the matching preset. |
|
|
45
|
+
| `setMapSize(width, height)` / `resetMapSize()` | Changes the plot size (rounded and clamped to 480–5000 × 320–5000). In the `Modeler` one undo step, no re-import. |
|
|
46
|
+
| `setEvolutionLabels(labels, { transient })` | Sets the four X-axis stage labels (normalized, see below); `transient` previews without an undo step. |
|
|
47
|
+
| `undo()` / `redo()` / `canUndo()` / `canRedo()` | `Modeler` only: the canvas command stack. |
|
|
48
|
+
| `commitPendingEdits()` | `Modeler` only: saves an open inline editor, e.g. before a save shortcut. |
|
|
49
|
+
| `on(event, callback)` / `off(event, callback)` | diagram-js events, see below. |
|
|
50
|
+
| `svgToPng(svg, { scale, transparent })` / `blobToBase64` | Rasterizes an exported SVG (default 2×, paper background). |
|
|
51
|
+
| `setAsideEditorState(modeler)` / `restoreEditorState(…)` | Keeps the selection and an open inline editor across a re-import of an externally changed map. |
|
|
52
|
+
|
|
53
|
+
`setEvolutionLabels` turns an empty stage into its default label and `->` into `→`, so the labels
|
|
54
|
+
always write a valid `evolution` line; the default set is stored as `undefined`.
|
|
55
|
+
|
|
56
|
+
Options: `new Modeler({ container, keyboard: { undoRedo: false } })` leaves Cmd/Ctrl+Z/Y to the
|
|
57
|
+
host (VS Code owns its document's undo stack). `additionalModules` adds diagram-js modules; every
|
|
58
|
+
Wardley feature module is exported for custom editors.
|
|
59
|
+
|
|
60
|
+
## Events
|
|
61
|
+
|
|
62
|
+
| Event | Payload | Notes |
|
|
63
|
+
| ---------------------------- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `import.done` | `{ warnings }` | After every import. |
|
|
65
|
+
| `commandStack.changed` | `{ trigger }` | `Modeler`: after every committed edit, undo and redo, including size, title and label changes. |
|
|
66
|
+
| `wardley.config.changed` | `WardleyConfigChangedEvent` | Title, size or axis labels changed. `transient` events are live previews (typing, dragging the plot corner): do not persist them. |
|
|
67
|
+
| `wardley.label.deduplicated` | `{ element, requested, applied }` | A typed name was taken and a free variant (`Tea 2`) was used instead. |
|
|
68
|
+
|
|
37
69
|
### Fonts
|
|
38
70
|
|
|
39
71
|
The package ships no fonts and uses no CDN. The canvas typeface is **Geist** (Miragon corporate
|
|
@@ -44,6 +76,10 @@ identity); provide it yourself — recommended self-hosted via [`@fontsource`](h
|
|
|
44
76
|
import '@fontsource-variable/geist/wght.css';
|
|
45
77
|
```
|
|
46
78
|
|
|
79
|
+
That package registers the family as `'Geist Variable'`; the renderer's font stack starts with
|
|
80
|
+
`'Geist Variable', 'Geist', …` so it matches either that package or a locally installed Geist. Use
|
|
81
|
+
`'Geist Variable'` in your own CSS too — `'Geist'` alone never matches the self-hosted face.
|
|
82
|
+
|
|
47
83
|
Part of the [Wardley Maps](https://github.com/Miragon/wardley-maps-modeler) monorepo.
|
|
48
84
|
|
|
49
85
|
## License
|
package/dist/Modeler.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ import { NavigatedViewer } from './NavigatedViewer.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class Modeler extends NavigatedViewer {
|
|
8
8
|
protected _getModules(): ModuleDeclaration[];
|
|
9
|
+
/**
|
|
10
|
+
* Saves any open inline editor (name, note, link annotation, flow value, link address). Call it
|
|
11
|
+
* before saving or exporting from a keyboard shortcut, which does not take focus off the editor.
|
|
12
|
+
*/
|
|
13
|
+
commitPendingEdits(): void;
|
|
9
14
|
undo(): void;
|
|
10
15
|
redo(): void;
|
|
11
16
|
canUndo(): boolean;
|
package/dist/Modeler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modeler.d.ts","sourceRoot":"","sources":["../src/Modeler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Modeler.d.ts","sourceRoot":"","sources":["../src/Modeler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAiB9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA4BvD;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,eAAe;cACvB,WAAW,IAAI,iBAAiB,EAAE;IAyCrD;;;OAGG;IACH,kBAAkB,IAAI,IAAI;IAK1B,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;IAIZ,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,OAAO;CAGnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleDeclaration } from 'didi';
|
|
2
|
-
import { WardleyMap } from '@miragon/wardley-schema-model';
|
|
2
|
+
import { MapConfig, MapSizePresetId, WardleyMap } from '@miragon/wardley-schema-model';
|
|
3
3
|
import { ImportWarning } from './io/types.js';
|
|
4
4
|
export interface WardleyViewerOptions {
|
|
5
5
|
/** Host element. If missing, a detached <div> is created (can be attached later via attachTo). */
|
|
@@ -8,8 +8,32 @@ export interface WardleyViewerOptions {
|
|
|
8
8
|
height?: number | string;
|
|
9
9
|
/** Concatenated to the end of the module list (extension point, §12). */
|
|
10
10
|
additionalModules?: ModuleDeclaration[];
|
|
11
|
+
/**
|
|
12
|
+
* Modeler keyboard behaviour. `undoRedo: false` leaves Cmd/Ctrl+Z/Y to the host (e.g. VS Code,
|
|
13
|
+
* which owns the document's undo stack). Default: the canvas handles undo/redo.
|
|
14
|
+
*/
|
|
15
|
+
keyboard?: {
|
|
16
|
+
undoRedo?: boolean;
|
|
17
|
+
};
|
|
11
18
|
}
|
|
12
19
|
export type EventCallback<T = unknown> = (event: T) => void;
|
|
20
|
+
/** The plot size as drawn, plus whether the map writes it explicitly (`size [w, h]`). */
|
|
21
|
+
export interface MapSizeInfo {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
isExplicit: boolean;
|
|
25
|
+
presetId?: MapSizePresetId;
|
|
26
|
+
}
|
|
27
|
+
/** Payload of `wardley.config.changed`: title, size or axis labels changed. */
|
|
28
|
+
export interface WardleyConfigChangedEvent {
|
|
29
|
+
config: MapConfig;
|
|
30
|
+
/** A live preview (typing, dragging the plot corner): not a change to persist. */
|
|
31
|
+
transient?: true;
|
|
32
|
+
}
|
|
33
|
+
export interface SetEvolutionLabelsOptions {
|
|
34
|
+
/** Live preview: applied directly, without an undo step (commit later without this flag). */
|
|
35
|
+
transient?: boolean;
|
|
36
|
+
}
|
|
13
37
|
/**
|
|
14
38
|
* Shared lifecycle & DI bootstrap for all Wardley viewers (analogous to bpmn-js BaseViewer, but OUR
|
|
15
39
|
* OWN code — no bpmn-js as a dependency, §3.3). Subclasses only override `_getModules()` (a method
|
|
@@ -21,6 +45,8 @@ export declare abstract class WardleyBaseViewer {
|
|
|
21
45
|
private _diagram;
|
|
22
46
|
private readonly _container;
|
|
23
47
|
private readonly _options;
|
|
48
|
+
/** Labels before the first transient preview, so the commit becomes one undo step from there. */
|
|
49
|
+
private _labelsBeforePreview;
|
|
24
50
|
constructor(options?: WardleyViewerOptions);
|
|
25
51
|
private _createContainer;
|
|
26
52
|
private _ensureDiagram;
|
|
@@ -40,21 +66,53 @@ export declare abstract class WardleyBaseViewer {
|
|
|
40
66
|
/** Current state as the canonical model (from the DI properties). */
|
|
41
67
|
exportMap(): WardleyMap;
|
|
42
68
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
69
|
+
* Sets the plot size in diagram-px. The size is normalized first (whole pixels, clamped to
|
|
70
|
+
* PLOT_MIN..PLOT_MAX); non-finite input throws a RangeError before anything changes. In the
|
|
71
|
+
* Modeler this is one undoable step that re-projects the shapes in place (selection, viewport and
|
|
72
|
+
* history survive); the read-only viewers re-import. An explicit size line is written even for
|
|
73
|
+
* the default size — only `resetMapSize` removes it.
|
|
45
74
|
*/
|
|
46
75
|
setMapSize(width: number, height: number): Promise<{
|
|
47
76
|
warnings: ImportWarning[];
|
|
48
77
|
}>;
|
|
78
|
+
/** Removes the `size` line: the map is drawn at the default plot size again. */
|
|
79
|
+
resetMapSize(): Promise<{
|
|
80
|
+
warnings: ImportWarning[];
|
|
81
|
+
}>;
|
|
82
|
+
getMapSize(): MapSizeInfo;
|
|
83
|
+
private _reimportWithSize;
|
|
84
|
+
/**
|
|
85
|
+
* Sets the map title (one undoable step in the Modeler). Line breaks become spaces so the DSL
|
|
86
|
+
* `title` line stays one line; an empty title falls back to the default.
|
|
87
|
+
*/
|
|
88
|
+
setTitle(title: string): void;
|
|
49
89
|
/**
|
|
50
90
|
* Sets the four X-axis stage labels (`undefined` = default Genesis/Custom/Product/Commodity).
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
91
|
+
* Empty stages fall back to their default and a `->` becomes `→`, so the labels always write a
|
|
92
|
+
* valid `evolution` line; the default set is stored as `undefined`.
|
|
93
|
+
* Changes only the labeling, not the geometry (no re-import -> no view jump, no selection loss).
|
|
94
|
+
* In the Modeler this is one undoable step; `{ transient: true }` applies a live preview without
|
|
95
|
+
* an undo step, and the next non-transient call commits it as ONE step from the state before the
|
|
96
|
+
* preview (no step at all when the labels end where the preview started). Fires
|
|
97
|
+
* `wardley.config.changed` (`{ config, transient? }`): transient events are live previews and
|
|
98
|
+
* must not be persisted; in the Modeler every committed change is followed by
|
|
99
|
+
* `commandStack.changed`.
|
|
100
|
+
*/
|
|
101
|
+
setEvolutionLabels(requested: readonly string[] | undefined, options?: SetEvolutionLabelsOptions): void;
|
|
102
|
+
/**
|
|
103
|
+
* Config change without the command stack (read-only viewers, live previews): updates the root
|
|
104
|
+
* config in place and re-renders only the axis background.
|
|
54
105
|
*/
|
|
55
|
-
|
|
106
|
+
private _applyConfigDirectly;
|
|
107
|
+
/** The Modeler's command API, or null in the read-only viewers. */
|
|
108
|
+
private _wardleyModeling;
|
|
109
|
+
private _root;
|
|
110
|
+
private _rootBusinessObject;
|
|
56
111
|
exportDSL(): string;
|
|
57
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Static, standalone SVG covering the whole plot (at its actual `config.size`) plus any content
|
|
114
|
+
* drawn beyond it, such as long labels of commodity components.
|
|
115
|
+
*/
|
|
58
116
|
saveSVG(): Promise<{
|
|
59
117
|
svg: string;
|
|
60
118
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WardleyBaseViewer.d.ts","sourceRoot":"","sources":["../src/WardleyBaseViewer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"WardleyBaseViewer.d.ts","sourceRoot":"","sources":["../src/WardleyBaseViewer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAM9C,OAAO,EAML,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,eAAe,CAAC;AASvE,MAAM,WAAW,oBAAoB;IACnC,kGAAkG;IAClG,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACxC;;;OAGG;IACH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'diagram-js/lib/core/Canvas';
|
|
2
|
+
/** The focusable canvas svg diagram-js renders into its container. */
|
|
3
|
+
export declare function canvasSvg(canvas: Canvas): SVGElement | null;
|
|
4
|
+
/**
|
|
5
|
+
* Moves keyboard focus to the canvas after a pointer gesture or an editor commit. Pointer work
|
|
6
|
+
* must not light up the keyboard focus ring around the whole viewport, and a press that suppressed
|
|
7
|
+
* the browser's own focus change must still take focus away from host inputs (title, size
|
|
8
|
+
* fields), or Delete/Undo would edit those instead of the map.
|
|
9
|
+
*/
|
|
10
|
+
export declare function focusCanvasWithoutRing(canvas: Canvas): void;
|
|
11
|
+
/**
|
|
12
|
+
* Starts following whether the user last used the pointer or the keyboard (idempotent). Editors
|
|
13
|
+
* opened with the pointer hand focus back without the keyboard focus ring.
|
|
14
|
+
*/
|
|
15
|
+
export declare function trackInputModality(): void;
|
|
16
|
+
export declare function lastInteractionWasPointer(): boolean;
|
|
17
|
+
//# sourceMappingURL=canvasFocus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvasFocus.d.ts","sourceRoot":"","sources":["../../src/a11y/canvasFocus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AAErD,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAK3D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAO3D;AAKD;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAezC;AAED,wBAAgB,yBAAyB,IAAI,OAAO,CAEnD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as Canvas } from 'diagram-js/lib/core/Canvas';
|
|
2
|
+
/** Names the focusable canvas for assistive technology (it is otherwise an anonymous svg). */
|
|
3
|
+
declare function describeCanvas(canvas: Canvas): void;
|
|
4
|
+
declare namespace describeCanvas {
|
|
5
|
+
var $inject: string[];
|
|
6
|
+
}
|
|
7
|
+
export default describeCanvas;
|
|
8
|
+
//# sourceMappingURL=describeCanvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describeCanvas.d.ts","sourceRoot":"","sources":["../../src/a11y/describeCanvas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AAGrD,8FAA8F;AAC9F,iBAAwB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAM3D;kBANuB,cAAc;;;eAAd,cAAc"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ModuleDeclaration } from 'didi';
|
|
2
|
+
/** Names the canvas for assistive technology (role, role description, label). */
|
|
3
|
+
export declare const canvasAccessibilityModule: ModuleDeclaration;
|
|
4
|
+
export { canvasSvg, focusCanvasWithoutRing, lastInteractionWasPointer, trackInputModality, } from './canvasFocus.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/a11y/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAG9C,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,EAAE,iBAEvC,CAAC;AAEF,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { default as EventBus } from 'diagram-js/lib/core/EventBus';
|
|
2
2
|
import { Injector } from 'didi';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
4
|
+
* Create behavior for palette, keyboard and "append component" (`create.start`, the latter with
|
|
5
|
+
* `context.source`):
|
|
6
|
+
* 1. Append only: LIVE arrow preview from the source to the cursor (analogous to diagram-js
|
|
7
|
+
* ConnectPreview, but in the create flow) — requires the `connectionPreview` service.
|
|
8
|
+
* 2. After placing a single named element (component, user, submap, pipeline, accelerator, note)
|
|
9
|
+
* the label editor opens with the placeholder selected, so typing names it right away.
|
|
10
|
+
* Regions, drawings and pasted copies are left alone.
|
|
10
11
|
*/
|
|
11
12
|
export default class WardleyAppendBehavior {
|
|
12
13
|
static $inject: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WardleyAppendBehavior.d.ts","sourceRoot":"","sources":["../../src/append/WardleyAppendBehavior.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"WardleyAppendBehavior.d.ts","sourceRoot":"","sources":["../../src/append/WardleyAppendBehavior.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AA6CrC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAqB;IACxC,MAAM,CAAC,OAAO,WAA4B;gBAE9B,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;CA0CnD"}
|
|
@@ -6,7 +6,8 @@ import { WardleyShape } from '../model/di-types.js';
|
|
|
6
6
|
* Compact color picker (bpmn.io-style): a 3x3 grid of small color squares (no text), opened from a
|
|
7
7
|
* note's context pad. Uses its own popover (instead of diagram-js PopupMenu) so the swatch grid can
|
|
8
8
|
* be rendered exactly and without text. Sets the color via `wardleyModeling` (undo/redo). First
|
|
9
|
-
* cell = "no color".
|
|
9
|
+
* cell = "no color". Keyboard: focus starts on the active swatch, arrow keys move through the grid,
|
|
10
|
+
* Enter/Space picks, Escape closes; focus then returns to the canvas.
|
|
10
11
|
*/
|
|
11
12
|
export default class WardleyColorPicker {
|
|
12
13
|
private readonly canvas;
|
|
@@ -18,6 +19,10 @@ export default class WardleyColorPicker {
|
|
|
18
19
|
constructor(canvas: Canvas, eventBus: EventBus, modeling: WardleyModeling);
|
|
19
20
|
/** Opens the swatch grid for `shape` at the click position (viewport coordinates). */
|
|
20
21
|
open(shape: WardleyShape, clientX: number, clientY: number): void;
|
|
21
|
-
|
|
22
|
+
isOpen(): boolean;
|
|
23
|
+
close(options?: {
|
|
24
|
+
restoreFocus?: boolean;
|
|
25
|
+
}): void;
|
|
26
|
+
private onGridKeydown;
|
|
22
27
|
}
|
|
23
28
|
//# sourceMappingURL=WardleyColorPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WardleyColorPicker.d.ts","sourceRoot":"","sources":["../../src/color-picker/WardleyColorPicker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,eAAe,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"WardleyColorPicker.d.ts","sourceRoot":"","sources":["../../src/color-picker/WardleyColorPicker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,eAAe,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAazD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAiBnC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAlB3B,MAAM,CAAC,OAAO,WAA6C;IAE3D,OAAO,CAAC,OAAO,CAA0B;IAEzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAE3B;IACF,OAAO,CAAC,QAAQ,CAAC,KAAK,CAMpB;gBAGiB,MAAM,EAAE,MAAM,EAC/B,QAAQ,EAAE,QAAQ,EACD,QAAQ,EAAE,eAAe;IAM5C,sFAAsF;IACtF,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IA4DjE,MAAM,IAAI,OAAO;IAIjB,KAAK,CAAC,OAAO,GAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IAUrD,OAAO,CAAC,aAAa;CAkBtB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as ContextPad } from 'diagram-js/lib/features/context-pad/ContextPad';
|
|
2
|
+
import { Element } from 'diagram-js/lib/model/Types';
|
|
3
|
+
interface TargetBounds {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
right: number;
|
|
7
|
+
bottom: number;
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Anchors the pad to a node and its own label instead of the whole graphics group: an evolving
|
|
15
|
+
* component's group also holds the evolve arrow, target circle and target name, which would push the
|
|
16
|
+
* pad hundreds of pixels away from the node the user selected. When the evolve target lies where
|
|
17
|
+
* the pad would open, the pad clears the whole movement instead — otherwise it would hide the target
|
|
18
|
+
* circle, which is the evolve's drag handle.
|
|
19
|
+
*
|
|
20
|
+
* Overrides diagram-js's private `_getTargetBounds` (guarded by a browser test).
|
|
21
|
+
*/
|
|
22
|
+
export default class WardleyContextPad extends ContextPad {
|
|
23
|
+
_getTargetBounds(target: Element | Element[]): TargetBounds;
|
|
24
|
+
private internals;
|
|
25
|
+
private padWidth;
|
|
26
|
+
private movementTargetRects;
|
|
27
|
+
private visualRects;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=WardleyContextPad.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WardleyContextPad.d.ts","sourceRoot":"","sources":["../../src/context-pad/WardleyContextPad.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,gDAAgD,CAAC;AAExE,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,4BAA4B,CAAC;AAGrE,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAcD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU;IACvD,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,YAAY;IAkB3D,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,WAAW;CAgBpB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { default as Canvas } from 'diagram-js/lib/core/Canvas';
|
|
2
|
+
import { default as EventBus } from 'diagram-js/lib/core/EventBus';
|
|
1
3
|
import { default as ContextPad } from 'diagram-js/lib/features/context-pad/ContextPad';
|
|
2
4
|
import { default as Modeling } from 'diagram-js/lib/features/modeling/Modeling';
|
|
3
5
|
import { default as Connect } from 'diagram-js/lib/features/connect/Connect';
|
|
@@ -5,6 +7,7 @@ import { default as Create } from 'diagram-js/lib/features/create/Create';
|
|
|
5
7
|
import { default as PopupMenu } from 'diagram-js/lib/features/popup-menu/PopupMenu';
|
|
6
8
|
import { ContextPadEntries, default as ContextPadProvider } from 'diagram-js/lib/features/context-pad/ContextPadProvider';
|
|
7
9
|
import { Element } from 'diagram-js/lib/model/Types';
|
|
10
|
+
import { Injector } from 'didi';
|
|
8
11
|
import { default as WardleyModeling } from '../modeling/WardleyModeling.js';
|
|
9
12
|
import { default as WardleyLabelEditing } from '../label-editing/WardleyLabelEditing.js';
|
|
10
13
|
import { default as WardleyEvolveDragging } from '../evolve/WardleyEvolveDragging.js';
|
|
@@ -12,6 +15,7 @@ import { default as WardleyElementFactory } from '../model/WardleyElementFactory
|
|
|
12
15
|
import { default as WardleyColorPicker } from '../color-picker/WardleyColorPicker.js';
|
|
13
16
|
/** Context actions per element (concept doc §5.5). */
|
|
14
17
|
export default class WardleyContextPadProvider implements ContextPadProvider {
|
|
18
|
+
private readonly contextPad;
|
|
15
19
|
private readonly modeling;
|
|
16
20
|
private readonly connect;
|
|
17
21
|
private readonly create;
|
|
@@ -21,8 +25,26 @@ export default class WardleyContextPadProvider implements ContextPadProvider {
|
|
|
21
25
|
private readonly evolveDragging;
|
|
22
26
|
private readonly factory;
|
|
23
27
|
private readonly colorPicker;
|
|
28
|
+
private readonly canvas;
|
|
29
|
+
private readonly injector;
|
|
24
30
|
static $inject: string[];
|
|
25
|
-
|
|
31
|
+
/** Synthetic clicks created for Enter/Space, so actions can pick a pointer-free variant. */
|
|
32
|
+
private readonly keyboardEvents;
|
|
33
|
+
constructor(contextPad: ContextPad, modeling: Modeling, connect: Connect, create: Create, popupMenu: PopupMenu, wardleyModeling: WardleyModeling, labelEditing: WardleyLabelEditing, evolveDragging: WardleyEvolveDragging, factory: WardleyElementFactory, colorPicker: WardleyColorPicker, eventBus: EventBus, canvas: Canvas, injector: Injector);
|
|
26
34
|
getContextPadEntries(element: Element): ContextPadEntries;
|
|
35
|
+
/** Connections: edit the annotation (or the flow value of an imported flow link) + delete. */
|
|
36
|
+
private connectionEntries;
|
|
37
|
+
/** Row 1: edit label, append, connect, evolve. */
|
|
38
|
+
private addPrimaryEntries;
|
|
39
|
+
/** Row 2: settings, line style, colour, link. */
|
|
40
|
+
private addPropertyEntries;
|
|
41
|
+
/** Enter/Space on a focused entry = a click at the element's centre. */
|
|
42
|
+
private onPadKeydown;
|
|
43
|
+
private clientCenterOf;
|
|
44
|
+
/**
|
|
45
|
+
* Keyboard append: there is no pointer to drag the new component to, so it is placed one step
|
|
46
|
+
* further down the value chain, connected, selected and opened for naming.
|
|
47
|
+
*/
|
|
48
|
+
private appendBelow;
|
|
27
49
|
}
|
|
28
50
|
//# sourceMappingURL=WardleyContextPadProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WardleyContextPadProvider.d.ts","sourceRoot":"","sources":["../../src/context-pad/WardleyContextPadProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,gDAAgD,CAAC;AAC7E,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,OAAO,MAAM,yCAAyC,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,uCAAuC,CAAC;AAChE,OAAO,KAAK,SAAS,MAAM,8CAA8C,CAAC;AAC1E,OAAO,KAAK,EACV,iBAAiB,EACjB,OAAO,IAAI,kBAAkB,EAC9B,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"WardleyContextPadProvider.d.ts","sourceRoot":"","sources":["../../src/context-pad/WardleyContextPadProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,UAAU,MAAM,gDAAgD,CAAC;AAC7E,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,OAAO,MAAM,yCAAyC,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,uCAAuC,CAAC;AAChE,OAAO,KAAK,SAAS,MAAM,8CAA8C,CAAC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,EACjC,cAAc,EAAE,qBAAqB,EACrC,OAAO,EAAE,qBAAqB,EAC9B,WAAW,EAAE,kBAAkB,EAChD,QAAQ,EAAE,QAAQ,EACD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ;IAUrC,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB;IAiBzD,8FAA8F;IAC9F,OAAO,CAAC,iBAAiB;IAmBzB,kDAAkD;IAClD,OAAO,CAAC,iBAAiB;IA4EzB,iDAAiD;IACjD,OAAO,CAAC,kBAAkB;IA0E1B,wEAAwE;IACxE,OAAO,CAAC,YAAY;IAwCpB,OAAO,CAAC,cAAc;IAiBtB;;;OAGG;IACH,OAAO,CAAC,WAAW;CAuBpB"}
|
|
@@ -2,4 +2,5 @@ import { ModuleDeclaration } from 'didi';
|
|
|
2
2
|
/** Context actions per element. */
|
|
3
3
|
export declare const wardleyContextPadModule: ModuleDeclaration;
|
|
4
4
|
export { default as WardleyContextPadProvider } from './WardleyContextPadProvider.js';
|
|
5
|
+
export { default as WardleyContextPad } from './WardleyContextPad.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context-pad/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context-pad/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C,mCAAmC;AACnC,eAAO,MAAM,uBAAuB,EAAE,iBAMrC,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -3,6 +3,14 @@ import { default as EventBus } from 'diagram-js/lib/core/EventBus';
|
|
|
3
3
|
import { ElementLike, ShapeLike, ConnectionLike } from 'diagram-js/lib/model/Types';
|
|
4
4
|
import { default as ElementRegistry } from 'diagram-js/lib/core/ElementRegistry';
|
|
5
5
|
import { default as EvolutionGrid } from '../evolution-grid/EvolutionGrid.js';
|
|
6
|
+
/** Primary name text of a node (contract shared with other modules and consumers' CSS). */
|
|
7
|
+
export declare const NAME_LABEL_CLASS = "wardley-name-label";
|
|
8
|
+
/** Groups every evolve visual so tools (e.g. the context pad) can tell the node from its movement. */
|
|
9
|
+
export declare const MOVEMENT_CLASS = "wardley-movement";
|
|
10
|
+
/** Labels the user may drag to set an OWM `label [dx, dy]` offset (see the label-drag module). */
|
|
11
|
+
export declare const LABEL_HANDLE_CLASS = "wardley-label-handle";
|
|
12
|
+
/** Which offset a dragged label writes: the node's own `labelOffset` or its evolve's. */
|
|
13
|
+
export declare const LABEL_ROLE_ATTRIBUTE = "data-label-role";
|
|
6
14
|
export default class WardleyRenderer extends BaseRenderer {
|
|
7
15
|
private readonly grid;
|
|
8
16
|
private readonly elementRegistry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WardleyRenderer.d.ts","sourceRoot":"","sources":["../../src/draw/WardleyRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAE5D,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEzF,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"WardleyRenderer.d.ts","sourceRoot":"","sources":["../../src/draw/WardleyRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAE5D,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE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-15,8 +15,6 @@ export declare const ICON_DOUBLE_ARROW = "M15.5 5H11l5 7-5 7h4.5l5-7zM8.5 5H4l5
|
|
|
15
15
|
export declare const ICON_BLOCK = "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z";
|
|
16
16
|
export declare const ICON_EDIT = "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z";
|
|
17
17
|
export declare const ICON_DELETE = "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z";
|
|
18
|
-
/** close — remove evolve. */
|
|
19
|
-
export declare const ICON_CLOSE = "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z";
|
|
20
18
|
/** description — note. */
|
|
21
19
|
export declare const ICON_NOTE = "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z";
|
|
22
20
|
export declare const ICON_UNDO = "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z";
|
|
@@ -59,6 +57,10 @@ export declare const ICON_LAYERS = "M11.99 18.54l-7.37-5.73L3 14.07l9 7 9-7-1.63
|
|
|
59
57
|
export declare const ICON_AUTORENEW = "M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z";
|
|
60
58
|
/** aspect_ratio — map size. */
|
|
61
59
|
export declare const ICON_ASPECT_RATIO = "M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z";
|
|
60
|
+
/** open_in_new — open the element's link in a new tab. */
|
|
61
|
+
export declare const ICON_OPEN_IN_NEW = "M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z";
|
|
62
|
+
/** link — set the element's link (url). */
|
|
63
|
+
export declare const ICON_LINK = "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z";
|
|
62
64
|
/** menu — hamburger (main menu). */
|
|
63
65
|
export declare const ICON_MENU = "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z";
|
|
64
66
|
/** add — append component. */
|
|
@@ -67,6 +69,11 @@ export declare const ICON_ADD = "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z";
|
|
|
67
69
|
export declare const ICON_VISIBILITY = "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z";
|
|
68
70
|
/** Draws a 24x24 icon as an SVG group centered on (cx, cy), scaled to `size`. */
|
|
69
71
|
export declare function drawIcon(path: string, cx: number, cy: number, size: number, fill: string): SVGElement;
|
|
72
|
+
/**
|
|
73
|
+
* Like `iconMarkup`, but crossed out by a diagonal stroke (e.g. "remove evolve" = struck double
|
|
74
|
+
* arrow). The mask cuts a gap around the stroke so it stays legible over the filled glyph.
|
|
75
|
+
*/
|
|
76
|
+
export declare function struckIconMarkup(path: string, size?: number): string;
|
|
70
77
|
/** Returns an icon as an HTML SVG string (for palette/context pad/buttons), color = currentColor. */
|
|
71
78
|
export declare function iconMarkup(path: string, size?: number): string;
|
|
72
79
|
//# sourceMappingURL=icons.d.ts.map
|
package/dist/draw/icons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/draw/icons.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,eAAO,MAAM,WAAW,kHACyF,CAAC;AAClH,eAAO,MAAM,UAAU,sSAC8Q,CAAC;AAEtS,yDAAyD;AACzD,eAAO,MAAM,WAAW,iIACwG,CAAC;AACjI,eAAO,MAAM,kBAAkB,8DAA8D,CAAC;AAC9F,6BAA6B;AAC7B,eAAO,MAAM,iBAAiB,yDAAyD,CAAC;AACxF,8CAA8C;AAC9C,eAAO,MAAM,UAAU,mPAC2N,CAAC;AACnP,eAAO,MAAM,SAAS,0JACmI,CAAC;AAC1J,eAAO,MAAM,WAAW,kFACyD,CAAC;AAClF,
|
|
1
|
+
{"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kC;AAClC,eAAO,MAAM,iBAAiB,4CAA4C,CAAC;AAC3E,mCAAmC;AACnC,eAAO,MAAM,gBAAgB,gDAAgD,CAAC;AAC9E,iEAAiE;AACjE,eAAO,MAAM,eAAe,4EAC+C,CAAC;AAC5E,4CAA4C;AAC5C,eAAO,MAAM,mBAAmB,iGACgE,CAAC;AACjG,oCAAoC;AACpC,eAAO,MAAM,WAAW,gHACuF,CAAC;AAChH,kEAAkE;AAClE,eAAO,MAAM,cAAc,2OAC+M,CAAC;AAC3O,+BAA+B;AAC/B,eAAO,MAAM,iBAAiB,iJACkH,CAAC;AACjJ,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,uIACyG,CAAC;AACvI,2CAA2C;AAC3C,eAAO,MAAM,SAAS,wNACiM,CAAC;AACxN,oCAAoC;AACpC,eAAO,MAAM,SAAS,kDAAkD,CAAC;AACzE,8BAA8B;AAC9B,eAAO,MAAM,QAAQ,wCAAwC,CAAC;AAC9D,uCAAuC;AACvC,eAAO,MAAM,eAAe,sNACyL,CAAC;AAEtN,iFAAiF;AACjF,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,UAAU,CAUZ;AAeD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,CAUhE;AAED,qGAAqG;AACrG,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,CAE1D"}
|
package/dist/draw/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ModuleDeclaration } from 'didi';
|
|
2
2
|
/** SVG rendering of all Wardley types (BaseRenderer subclass, priority 1500). */
|
|
3
3
|
export declare const wardleyDrawModule: ModuleDeclaration;
|
|
4
|
-
export { default as WardleyRenderer } from './WardleyRenderer.js';
|
|
4
|
+
export { default as WardleyRenderer, LABEL_HANDLE_CLASS, LABEL_ROLE_ATTRIBUTE, MOVEMENT_CLASS, NAME_LABEL_CLASS, } from './WardleyRenderer.js';
|
|
5
|
+
export { componentLabelPlacement, componentLabelSlot, movementDeltaX, movementLabelPlacement, movementLabelSlot, normalizeLabelOffset, type LabelPlacement, } from './label-layout.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/draw/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/draw/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAG9C,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,EAAE,iBAG/B,CAAC;AAEF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/draw/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAG9C,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,EAAE,iBAG/B,CAAC;AAEF,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LabelOffset } from '@miragon/wardley-schema-model';
|
|
2
|
+
import { WardleyShape } from '../model/di-types.js';
|
|
3
|
+
import { default as EvolutionGrid } from '../evolution-grid/EvolutionGrid.js';
|
|
4
|
+
/**
|
|
5
|
+
* Where the renderer puts component, anchor and evolve-target labels. Shared by the renderer and the
|
|
6
|
+
* label-drag interaction so a dragged label lands exactly where the stored offset renders it.
|
|
7
|
+
*
|
|
8
|
+
* All positions are relative to the owning node's centre. An explicit OWM `label [dx, dy]` offset is
|
|
9
|
+
* always relative to the canonical OWM slot (right of the circle, or centred above an anchor) — the
|
|
10
|
+
* automatic placements below only apply while no offset is set, so imported OWM maps keep their look.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LABEL_GAP = 7;
|
|
13
|
+
/** Rough average advance of a 13px/500 label glyph; the renderer never measures text (jsdom). */
|
|
14
|
+
export declare const LABEL_CHAR_WIDTH = 7.5;
|
|
15
|
+
/** Keeps the default label clear of the inertia bar (drawn right next to the circle). */
|
|
16
|
+
export declare const INERTIA_LABEL_SHIFT = 6;
|
|
17
|
+
export declare const LABEL_BASELINE_SHIFT = -4;
|
|
18
|
+
/** Second line (sourcing method) below a name label. */
|
|
19
|
+
export declare const LABEL_METHOD_LINE_SHIFT = 15;
|
|
20
|
+
export declare const LABEL_OFFSET_LIMIT = 200;
|
|
21
|
+
export type TextAnchor = 'start' | 'middle' | 'end';
|
|
22
|
+
export interface LabelPlacement {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
anchor: TextAnchor;
|
|
26
|
+
}
|
|
27
|
+
/** px from a component to its evolve target along the evolution axis (undefined without evolve). */
|
|
28
|
+
export declare function movementDeltaX(shape: WardleyShape, grid: Pick<EvolutionGrid, 'toCanvas'>): number | undefined;
|
|
29
|
+
export declare function estimatedLabelWidth(text: string): number;
|
|
30
|
+
/** The canonical OWM slot of a component name — the origin of its `label [dx, dy]`. */
|
|
31
|
+
export declare function componentLabelSlot(): {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A short rightward evolve would run the arrow, the target circle and the red target name into the
|
|
37
|
+
* source name, so the source name moves to the left of its circle.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isShortRightwardMovement(shape: WardleyShape, movementDeltaX: number): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @param movementDeltaX px from the component to its evolve target (undefined without an evolve).
|
|
42
|
+
*/
|
|
43
|
+
export declare function componentLabelPlacement(shape: WardleyShape, movementDeltaX: number | undefined): LabelPlacement;
|
|
44
|
+
/** The canonical OWM slot of the evolve target name — the origin of the evolve's `label [dx, dy]`. */
|
|
45
|
+
export declare function movementLabelSlot(movementDeltaX: number): {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
};
|
|
49
|
+
/** A leftward evolve puts the target name on the far side, away from the arrow. */
|
|
50
|
+
export declare function movementLabelPlacement(labelOffset: LabelOffset | undefined, movementDeltaX: number): LabelPlacement;
|
|
51
|
+
/** The canonical slot of an anchor name: centred above the person icon. */
|
|
52
|
+
export declare function anchorLabelSlot(): {
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
};
|
|
56
|
+
export declare function anchorLabelPlacement(shape: WardleyShape): LabelPlacement;
|
|
57
|
+
/** Integer px, clamped to ±LABEL_OFFSET_LIMIT; `undefined` when the label is back in its slot. */
|
|
58
|
+
export declare function normalizeLabelOffset(dx: number, dy: number): LabelOffset | undefined;
|
|
59
|
+
//# sourceMappingURL=label-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-layout.d.ts","sourceRoot":"","sources":["../../src/draw/label-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAC;AAEpE;;;;;;;GAOG;AAEH,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,iGAAiG;AACjG,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,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AAc,CAOxE;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAKpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"palette-icons.d.ts","sourceRoot":"","sources":["../../src/draw/palette-icons.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"palette-icons.d.ts","sourceRoot":"","sources":["../../src/draw/palette-icons.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAoDhD,CAAC;AAQF,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD"}
|