@miragon/event-storming-renderer 0.4.0 → 0.5.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 +28 -5
- package/dist/EventStormingBaseViewer.d.ts +23 -3
- package/dist/EventStormingBaseViewer.d.ts.map +1 -1
- package/dist/board-bounds/BoardBounds.d.ts +6 -5
- package/dist/board-bounds/BoardBounds.d.ts.map +1 -1
- package/dist/collaborative/CollaborativeEventStorming.d.ts +8 -3
- package/dist/collaborative/CollaborativeEventStorming.d.ts.map +1 -1
- package/dist/draw/EventStormingRenderer.d.ts.map +1 -1
- package/dist/draw/extent.d.ts +47 -0
- package/dist/draw/extent.d.ts.map +1 -0
- package/dist/draw/index.d.ts +1 -0
- package/dist/draw/index.d.ts.map +1 -1
- package/dist/index.js +714 -615
- package/dist/index.js.map +1 -1
- package/dist/palette/EventStormingPaletteProvider.d.ts +1 -1
- package/dist/palette/EventStormingPaletteProvider.d.ts.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ Place Order -> Order Placed`);
|
|
|
31
31
|
const board = viewer.exportMap(); // canonical JSON model
|
|
32
32
|
const dsl = viewer.exportDSL(); // back to .storm text
|
|
33
33
|
const { svg } = await viewer.saveSVG();
|
|
34
|
+
const box = viewer.contentBounds(); // the board's tight box, undefined while it is empty
|
|
34
35
|
```
|
|
35
36
|
|
|
36
37
|
Swap `NavigatedViewer` for `Modeler` to get the editable board (sticky palette, context pad,
|
|
@@ -56,7 +57,7 @@ chrome covers, or `{ center: () => ({ x, y }) }`, the free centre in diagram coo
|
|
|
56
57
|
(`undefined` while there is none). `freeArea`, `fitOnImport` and `undoRedoKeys` are the names of
|
|
57
58
|
the [`@miragon/modeler-api`](https://www.npmjs.com/package/@miragon/modeler-api) factory options
|
|
58
59
|
(contract 1.2), the same for every Miragon renderer. `freeRectInsets: () => insets`, the earlier
|
|
59
|
-
name of `freeArea: { insets }`, is deprecated
|
|
60
|
+
name of `freeArea: { insets }`, is deprecated: still accepted through 0.5.x and removed in 0.6.0;
|
|
60
61
|
given both, `freeArea` wins. Pass `fitOnImport: false` when the host sets the view after every
|
|
61
62
|
import itself.
|
|
62
63
|
|
|
@@ -70,9 +71,24 @@ listener already handled (`defaultPrevented`) and keys typed into text fields ar
|
|
|
70
71
|
the canvas container gets no `tabindex` of its own. Cmd/Ctrl+A selects the whole board. An import
|
|
71
72
|
erases the undo history without firing `commandStack.changed`, and fires `import.parse.start`,
|
|
72
73
|
`import.render.start` and `import.done` in that order. It frames the content centred at the
|
|
73
|
-
largest zoom that shows all of it, never above 100%; an empty board shows at 100%. A
|
|
74
|
+
largest zoom that shows all of it, never above 100%; an empty board shows at 100%. A board with
|
|
75
|
+
arrow annotations is imported once the font they are set in has loaded (or failed to), so that the
|
|
76
|
+
fit on import, and a host's fit after the import resolves, frame them as drawn and not as the
|
|
77
|
+
fallback font would set them; imports still run in the order they were called. A label being
|
|
74
78
|
typed when an import arrives is reopened on the same element afterwards, with the typed text.
|
|
75
79
|
|
|
80
|
+
`contentBounds()` gives the tight box around what the board draws (`{ x, y, width, height }` in
|
|
81
|
+
board coordinates, which zoom and scroll leave alone): every sticky, note and drawing, a hotspot
|
|
82
|
+
with its tilt, and every arrow's annotation, which can reach far past the two stickies it stands
|
|
83
|
+
between. It reads the live canvas and measures the annotations on a 2D canvas, so a zoom never
|
|
84
|
+
changes it, and gives `undefined` while the board has no element. The annotations are drawn with
|
|
85
|
+
`text-rendering: geometricPrecision`, as they are measured: without it Chromium lays SVG text out
|
|
86
|
+
at the zoomed font size, and where it rounds glyph advances to whole pixels (Linux) the drawn text
|
|
87
|
+
grows and shrinks with the zoom. A host that fits the view itself fits to it and adds its own
|
|
88
|
+
margins; the importer's fit and the SVG export frame the same box with padding. A sticky's label
|
|
89
|
+
wider than the sticky can overhang it, since the wrapping goes by an estimated character width;
|
|
90
|
+
that overhang is not part of the box.
|
|
91
|
+
|
|
76
92
|
Enter or Space on a creating palette entry (a click without a pointer, `detail` 0) places the
|
|
77
93
|
element in the centre of `freeArea` (the container minus the margins a host's chrome covers, or the
|
|
78
94
|
centre the host names; without it the container's centre), 24px down and right while that spot is
|
|
@@ -90,7 +106,7 @@ drawing keeps literal light colours in its SVG attributes, so exports look the s
|
|
|
90
106
|
|
|
91
107
|
### Collaborative hosts
|
|
92
108
|
|
|
93
|
-
The package implements the collaborative-modeler contract 1.
|
|
109
|
+
The package implements the collaborative-modeler contract 1.3 of
|
|
94
110
|
[`@miragon/modeler-api`](https://www.npmjs.com/package/@miragon/modeler-api) (notation
|
|
95
111
|
`event-storming`) and runs its conformance kit in CI, every case and no advisory:
|
|
96
112
|
|
|
@@ -112,7 +128,8 @@ const viewer = createCollaborativeViewer(); // meta.editable: false, never chang
|
|
|
112
128
|
`rawPassthrough` (with a diagnostic, returned as a `warning`), gives a sticky that claims a
|
|
113
129
|
reserved id (`event-storming-root`, `__implicitroot…`) a fresh one, and reads a coordinate or
|
|
114
130
|
size beyond ±1e38 (more than the canvas's SVG transforms hold) as an unreadable line. A board
|
|
115
|
-
passed to `diagram.importMap` that uses a reserved id
|
|
131
|
+
passed to `diagram.importMap` that uses a reserved id, or a coordinate or size beyond ±1e38
|
|
132
|
+
(`UndrawableBoardError` from the schema model), rejects before the canvas changes.
|
|
116
133
|
- `onContentChanged` fires for every command-stack change, undo and redo included (also the
|
|
117
134
|
workshop level), never for imports, view options (type captions) or the viewport.
|
|
118
135
|
- `getViewState()` / `setViewState()` read and set the diagram-js viewbox (`x`, `y`, `width`,
|
|
@@ -131,13 +148,19 @@ const viewer = createCollaborativeViewer(); // meta.editable: false, never chang
|
|
|
131
148
|
top-left corner and the size, which zoom and scroll leave alone), read from the live canvas: a
|
|
132
149
|
sticky created or moved in the session has its current box. Any other id gives `undefined`. The
|
|
133
150
|
viewer answers it too.
|
|
151
|
+
- `contentBounds()` (contract 1.3) is the board's tight box, as on the `Modeler` and the viewers
|
|
152
|
+
above: it covers every `elements.bounds` box, the notes and drawings, a hotspot's tilt and every
|
|
153
|
+
arrow's annotation, and is `undefined` for a board without elements, before the first import and
|
|
154
|
+
after `destroy()`. The modeler shell's `connectDiagramJs(shell, diagram, { modeler })` fits to
|
|
155
|
+
it. The viewer answers it too.
|
|
134
156
|
- New sticky ids are random: a sticky created on the canvas (palette, keyboard, append, paste) gets
|
|
135
157
|
`<prefix>_<8 characters of [0-9a-z]>`, such as `(id event_k3x9q2ab)`, so two peers that each add
|
|
136
158
|
one at the same time do not pick the same id. Ids already in a text are read as they are.
|
|
137
159
|
- `diagram` is the wrapped `Modeler` or `NavigatedViewer`, for everything outside the contract.
|
|
138
160
|
`createCollaborativeModeler` and `createCollaborativeViewer` accept the same options:
|
|
139
161
|
`additionalModules`, `fitOnImport`, and for the modeler `undoRedoKeys` and `freeArea` (the
|
|
140
|
-
viewer ignores those two); the deprecated `freeRectInsets` still works
|
|
162
|
+
viewer ignores those two); the deprecated `freeRectInsets` still works through 0.5.x and goes
|
|
163
|
+
in 0.6.0.
|
|
141
164
|
- After `destroy()`, `exportText()` returns the last state and `importText()` rejects.
|
|
142
165
|
|
|
143
166
|
#### Migrating a host
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ModuleDeclaration } from 'didi';
|
|
2
2
|
import { EventStormingBoard } from '@miragon/event-storming-schema-model';
|
|
3
|
+
import { Bounds } from './board-bounds/BoardBounds.js';
|
|
3
4
|
import { ImportWarning } from './io/types.js';
|
|
4
5
|
import { FreeArea, FreeRectInsets } from './palette/EventStormingPaletteProvider.js';
|
|
5
6
|
export interface EventStormingViewerOptions {
|
|
@@ -22,8 +23,8 @@ export interface EventStormingViewerOptions {
|
|
|
22
23
|
*/
|
|
23
24
|
freeArea?: FreeArea | undefined;
|
|
24
25
|
/**
|
|
25
|
-
* @deprecated Pass `freeArea: { insets }` instead. Accepted
|
|
26
|
-
* `freeArea` wins when both are given.
|
|
26
|
+
* @deprecated Pass `freeArea: { insets }` instead. Accepted through renderer 0.5.x and removed
|
|
27
|
+
* in 0.6.0; `freeArea` wins when both are given.
|
|
27
28
|
*/
|
|
28
29
|
freeRectInsets?: (() => FreeRectInsets) | undefined;
|
|
29
30
|
/**
|
|
@@ -46,16 +47,28 @@ export declare abstract class EventStormingBaseViewer {
|
|
|
46
47
|
private _diagram;
|
|
47
48
|
private readonly _container;
|
|
48
49
|
private readonly _options;
|
|
50
|
+
/** The last import still waiting for its turn; a later one queues behind it. */
|
|
51
|
+
private _waitingImport;
|
|
49
52
|
constructor(options?: EventStormingViewerOptions);
|
|
50
53
|
private _createContainer;
|
|
51
54
|
private _ensureDiagram;
|
|
52
55
|
get<T>(name: string): T;
|
|
53
56
|
on<T = unknown>(event: string, callback: EventCallback<T>, priority?: number): void;
|
|
54
57
|
off(event: string, callback: EventCallback): void;
|
|
55
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Load a board into the canvas (replaces existing content). Resolves once the board stands
|
|
60
|
+
* fitted on its final content box: an annotated board waits for its annotations' font first.
|
|
61
|
+
*/
|
|
56
62
|
importMap(board: EventStormingBoard): Promise<{
|
|
57
63
|
warnings: ImportWarning[];
|
|
58
64
|
}>;
|
|
65
|
+
/**
|
|
66
|
+
* What an import waits for, `undefined` when it can run at once. The fit on import (the
|
|
67
|
+
* importer's and every host's after it) frames the annotations as measured, so they are measured
|
|
68
|
+
* in their own font, not in the fallback a board opened before it loaded would get; imports
|
|
69
|
+
* still run in call order, the waiting one before a later one that would not have to wait.
|
|
70
|
+
*/
|
|
71
|
+
private _importTurn;
|
|
59
72
|
/** Load `.storm` DSL text (internally parse -> importMap). Parser findings land in the warnings. */
|
|
60
73
|
importDSL(text: string): Promise<{
|
|
61
74
|
warnings: ImportWarning[];
|
|
@@ -63,6 +76,13 @@ export declare abstract class EventStormingBaseViewer {
|
|
|
63
76
|
/** Current state as the canonical model (from the DI properties). */
|
|
64
77
|
exportMap(): EventStormingBoard;
|
|
65
78
|
exportDSL(): string;
|
|
79
|
+
/**
|
|
80
|
+
* The tight box around what the board draws, in diagram coordinates, which zoom and scroll leave
|
|
81
|
+
* alone: every sticky, note and drawing, a hotspot with its tilt and every arrow annotation.
|
|
82
|
+
* `undefined` while the board has no element. What a host fits its view to (modeler-api 1.3
|
|
83
|
+
* `contentBounds`); read from the live canvas, so an element created or moved counts at once.
|
|
84
|
+
*/
|
|
85
|
+
contentBounds(): Bounds | undefined;
|
|
66
86
|
/** Static, standalone SVG — framed by the content bounds of the free canvas. */
|
|
67
87
|
saveSVG(): Promise<{
|
|
68
88
|
svg: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventStormingBaseViewer.d.ts","sourceRoot":"","sources":["../src/EventStormingBaseViewer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"EventStormingBaseViewer.d.ts","sourceRoot":"","sources":["../src/EventStormingBaseViewer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM/F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,cAAc,EACpB,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,0BAA0B;IACzC,kGAAkG;IAClG,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,cAAc,CAAC,GAAG,SAAS,CAAC;IACpD;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAsB5D;;;;;;GAMG;AACH,8BAAsB,uBAAuB;IAC3C,SAAS,CAAC,QAAQ,CAAC,WAAW,IAAI,iBAAiB,EAAE;IAErD,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IACtD,gFAAgF;IAChF,OAAO,CAAC,cAAc,CAA+B;gBAEzC,OAAO,GAAE,0BAA+B;IAKpD,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,cAAc;IActB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;IAIvB,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,SAAO,GAAG,IAAI;IAIjF,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI;IAIjD;;;OAGG;IACG,SAAS,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IA6BlF;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAUnB,oGAAoG;IAC9F,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IAkBrE,qEAAqE;IACrE,SAAS,IAAI,kBAAkB;IAI/B,SAAS,IAAI,MAAM;IAInB;;;;;OAKG;IACH,aAAa,IAAI,MAAM,GAAG,SAAS;IAOnC,gFAAgF;IAC1E,OAAO,IAAI,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAOzC,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAK/B,4EAA4E;IAC5E,MAAM,IAAI,IAAI;IAId,KAAK,IAAI,IAAI;IAIb,OAAO,IAAI,IAAI;IAQf,IAAI,SAAS,IAAI,WAAW,CAE3B;CACF"}
|
|
@@ -6,21 +6,22 @@ export interface Bounds {
|
|
|
6
6
|
height: number;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Content bounds of the free Event Storming canvas
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Content bounds of the free Event Storming canvas: every shape, a hotspot with its tilt, and every
|
|
10
|
+
* arrow's annotation, which stands between two stickies and can reach far past both. The single
|
|
11
|
+
* bounds source for the SVG export viewBox, the importer's fit and `contentBounds()`.
|
|
12
12
|
*/
|
|
13
13
|
export default class BoardBounds {
|
|
14
14
|
private readonly elementRegistry;
|
|
15
15
|
static $inject: string[];
|
|
16
16
|
constructor(elementRegistry: ElementRegistry);
|
|
17
17
|
/**
|
|
18
|
-
* Bounding box over
|
|
19
|
-
* schema-model default framing so fitView/export behave sensibly before the first sticky.
|
|
18
|
+
* Bounding box over everything the board draws, padded on every side. An empty board falls back
|
|
19
|
+
* to the schema-model default framing so fitView/export behave sensibly before the first sticky.
|
|
20
20
|
*/
|
|
21
21
|
contentBounds(padding?: number): Bounds;
|
|
22
22
|
/** No element on the board: `contentBounds` is only the default framing then. */
|
|
23
23
|
isEmpty(): boolean;
|
|
24
|
+
private drawnBoxes;
|
|
24
25
|
private positionedShapes;
|
|
25
26
|
}
|
|
26
27
|
//# sourceMappingURL=BoardBounds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoardBounds.d.ts","sourceRoot":"","sources":["../../src/board-bounds/BoardBounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"BoardBounds.d.ts","sourceRoot":"","sources":["../../src/board-bounds/BoardBounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AAKvE,MAAM,WAAW,MAAM;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAyBD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAGlB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAF5C,MAAM,CAAC,OAAO,WAAuB;gBAER,eAAe,EAAE,eAAe;IAE7D;;;OAGG;IACH,aAAa,CAAC,OAAO,SAAM,GAAG,MAAM;IAgBpC,iFAAiF;IACjF,OAAO,IAAI,OAAO;IAIlB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,gBAAgB;CAGzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollaborativeModeler, CollaborativeModelerOptions, ElementsSurface } from '@miragon/modeler-api';
|
|
1
|
+
import { CollaborativeModeler, CollaborativeModelerOptions, ElementBounds, ElementsSurface } from '@miragon/modeler-api';
|
|
2
2
|
import { ModuleDeclaration } from 'didi';
|
|
3
3
|
import { Modeler } from '../Modeler.js';
|
|
4
4
|
import { NavigatedViewer } from '../NavigatedViewer.js';
|
|
@@ -14,8 +14,8 @@ export interface CollaborativeEventStormingOptions extends CollaborativeModelerO
|
|
|
14
14
|
/** Appended to the renderer's own modules (e.g. a host's chrome module). */
|
|
15
15
|
additionalModules?: ModuleDeclaration[] | undefined;
|
|
16
16
|
/**
|
|
17
|
-
* @deprecated Pass `freeArea: { insets }` instead. Accepted
|
|
18
|
-
* `freeArea` wins when both are given.
|
|
17
|
+
* @deprecated Pass `freeArea: { insets }` instead. Accepted through renderer 0.5.x and removed
|
|
18
|
+
* in 0.6.0; `freeArea` wins when both are given.
|
|
19
19
|
*/
|
|
20
20
|
freeRectInsets?: (() => FreeRectInsets) | undefined;
|
|
21
21
|
}
|
|
@@ -23,6 +23,11 @@ export interface CollaborativeEventStormingOptions extends CollaborativeModelerO
|
|
|
23
23
|
export type EventStormingElementsSurface = ElementsSurface & Required<Pick<ElementsSurface, 'bounds'>>;
|
|
24
24
|
/** The contract surface plus the wrapped diagram for host-specific wiring. */
|
|
25
25
|
export interface CollaborativeEventStormingModeler extends CollaborativeModeler {
|
|
26
|
+
/**
|
|
27
|
+
* The tight box around what the board draws, arrow annotations and a hotspot's tilt included;
|
|
28
|
+
* `undefined` while it has no element (contract 1.3).
|
|
29
|
+
*/
|
|
30
|
+
contentBounds(): ElementBounds | undefined;
|
|
26
31
|
readonly elements: EventStormingElementsSurface;
|
|
27
32
|
readonly diagram: Modeler | NavigatedViewer;
|
|
28
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollaborativeEventStorming.d.ts","sourceRoot":"","sources":["../../src/collaborative/CollaborativeEventStorming.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,
|
|
1
|
+
{"version":3,"file":"CollaborativeEventStorming.d.ts","sourceRoot":"","sources":["../../src/collaborative/CollaborativeEventStorming.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAElB,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAGjF,mFAAmF;AACnF,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,iCAAkC,SAAQ,2BAA2B;IACpF,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAC;IACpD;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,cAAc,CAAC,GAAG,SAAS,CAAC;CACrD;AAED,oFAAoF;AACpF,MAAM,MAAM,4BAA4B,GAAG,eAAe,GACxD,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE5C,8EAA8E;AAC9E,MAAM,WAAW,iCAAkC,SAAQ,oBAAoB;IAC7E;;;OAGG;IACH,aAAa,IAAI,aAAa,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,4BAA4B,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC;CAC7C;AAgBD,uFAAuF;AACvF,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,iCAAsC,GAC9C,iCAAiC,CASnC;AAED,+FAA+F;AAC/F,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,iCAAsC,GAC9C,iCAAiC,CAEnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventStormingRenderer.d.ts","sourceRoot":"","sources":["../../src/draw/EventStormingRenderer.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;
|
|
1
|
+
{"version":3,"file":"EventStormingRenderer.d.ts","sourceRoot":"","sources":["../../src/draw/EventStormingRenderer.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;AA6BzF,OAAO,KAAK,wBAAwB,MAAM,6CAA6C,CAAC;AAKxF,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,gCAAgC,CAAC;AAiBhE,iGAAiG;AACjG,eAAO,MAAM,uBAAuB,iCAAiC,CAAC;AAoCtE,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,YAAY;IAK3D,OAAO,CAAC,QAAQ,CAAC,WAAW;IAJ9B,MAAM,CAAC,OAAO,WAA4C;gBAGxD,QAAQ,EAAE,QAAQ,EACD,WAAW,EAAE,wBAAwB;IAK/C,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAIxC,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,GAAG,UAAU;IAMvE,2FAA2F;IAC3F,OAAO,CAAC,WAAW;IAiBnB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IA8DT,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,GAAG,UAAU;IA+BxE,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAKtC,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM;CAK/D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Point } from 'diagram-js/lib/util/Types';
|
|
2
|
+
import { EventStormingConnection } from '../model/di-types.js';
|
|
3
|
+
/** Hotspots stand out with a slight tilt (rotated around the sticky center). */
|
|
4
|
+
export declare const HOTSPOT_ROTATION_DEG = -3;
|
|
5
|
+
/** The arrow annotation (`; …`): small italic text centred above the arrow's midpoint. */
|
|
6
|
+
export declare const LINK_LABEL_FONT_SIZE = 11;
|
|
7
|
+
export declare const LINK_LABEL_RISE = 5;
|
|
8
|
+
/**
|
|
9
|
+
* Chromium lays SVG text out at the zoomed font size and, where it snaps glyph advances to whole
|
|
10
|
+
* pixels (Linux), the annotation's width changes with the zoom, by up to a fifth. With geometric
|
|
11
|
+
* precision it lays the text out at its own size and scales the glyphs, so the canvas measure,
|
|
12
|
+
* taken with the same setting, holds at every zoom.
|
|
13
|
+
*/
|
|
14
|
+
export declare const LINK_LABEL_TEXT_RENDERING = "geometricPrecision";
|
|
15
|
+
export interface DrawnBox {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}
|
|
21
|
+
interface PositionedShape {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
eventStormingType?: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Connection endpoints from the CURRENT shape centers, cropped at the rectangle boundary
|
|
30
|
+
* (line ends at the sticky's edge, arrowhead visible — independent of z-order, and correct
|
|
31
|
+
* after moving, since recomputed on every render).
|
|
32
|
+
*/
|
|
33
|
+
export declare function connectionEndpoints(connection: EventStormingConnection): [Point, Point];
|
|
34
|
+
/** Where the arrow annotation's baseline is centred. */
|
|
35
|
+
export declare function linkLabelAnchor(connection: EventStormingConnection): Point;
|
|
36
|
+
/** The box a shape covers on the canvas: a hotspot's tilt reaches past its own box. */
|
|
37
|
+
export declare function drawnShapeBox(shape: PositionedShape): DrawnBox;
|
|
38
|
+
/** The box of an arrow's annotation, `undefined` for an arrow without one. */
|
|
39
|
+
export declare function linkLabelBox(connection: EventStormingConnection): DrawnBox | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Resolves once the font faces the annotations `texts` are set in have loaded (or failed to);
|
|
42
|
+
* `undefined` when none is pending. Their box is measured in that font: before it arrives, the
|
|
43
|
+
* fallback's widths, several px off, would be what a fit frames.
|
|
44
|
+
*/
|
|
45
|
+
export declare function linkLabelFontLoading(texts: readonly string[]): Promise<void> | undefined;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=extent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extent.d.ts","sourceRoot":"","sources":["../../src/draw/extent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,KAAK,EAAE,uBAAuB,EAAsB,MAAM,sBAAsB,CAAC;AAExF,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,0FAA0F;AAC1F,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,uBAAuB,CAAC;AAG9D,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,eAAe;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAqBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,uBAAuB,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAkBvF;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,UAAU,EAAE,uBAAuB,GAAG,KAAK,CAG1E;AAED,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,QAAQ,CAS9D;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,UAAU,EAAE,uBAAuB,GAAG,QAAQ,GAAG,SAAS,CAMtF;AAsBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAUxF"}
|
package/dist/draw/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ import { ModuleDeclaration } from 'didi';
|
|
|
3
3
|
export declare const eventStormingDrawModule: ModuleDeclaration;
|
|
4
4
|
export { default as EventStormingRenderer } from './EventStormingRenderer.js';
|
|
5
5
|
export { parseNoteMarkdown, serializeNoteMarkdown, plainNoteText, type NoteLine, type NoteRun, } from './note-markdown.js';
|
|
6
|
+
export { drawnShapeBox, linkLabelBox, type DrawnBox } from './extent.js';
|
|
6
7
|
//# 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;AAI9C,2FAA2F;AAC3F,eAAO,MAAM,uBAAuB,EAAE,iBAMrC,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,KAAK,QAAQ,EACb,KAAK,OAAO,GACb,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/draw/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAI9C,2FAA2F;AAC3F,eAAO,MAAM,uBAAuB,EAAE,iBAMrC,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,KAAK,QAAQ,EACb,KAAK,OAAO,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC"}
|