@miragon/event-storming-renderer 0.4.1 → 0.5.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/README.md +52 -19
- 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/board-menu/ShortcutsDialog.d.ts +1 -1
- package/dist/board-menu/menu.d.ts +5 -5
- package/dist/board-menu/shortcuts.d.ts +2 -2
- package/dist/collaborative/CollaborativeEventStorming.d.ts +9 -4
- package/dist/collaborative/CollaborativeEventStorming.d.ts.map +1 -1
- package/dist/color-picker/EventStormingColorPicker.d.ts.map +1 -1
- package/dist/context-pad/EventStormingContextPadProvider.d.ts +9 -1
- package/dist/context-pad/EventStormingContextPadProvider.d.ts.map +1 -1
- package/dist/draw/EventStormingRenderer.d.ts +4 -3
- package/dist/draw/EventStormingRenderer.d.ts.map +1 -1
- package/dist/draw/contrast.d.ts +8 -0
- package/dist/draw/contrast.d.ts.map +1 -0
- 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/draw/lucide.d.ts +8 -8
- package/dist/draw/styles.d.ts +27 -6
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/draw-tool/EventStormingDrawTool.d.ts +6 -0
- package/dist/draw-tool/EventStormingDrawTool.d.ts.map +1 -1
- package/dist/index.js +880 -688
- package/dist/index.js.map +1 -1
- package/dist/keyboard/EventStormingKeyboard.d.ts +4 -3
- package/dist/keyboard/EventStormingKeyboard.d.ts.map +1 -1
- package/dist/keyboard/canvas-focus.d.ts +11 -0
- package/dist/keyboard/canvas-focus.d.ts.map +1 -0
- package/dist/keyboard/index.d.ts +2 -0
- package/dist/keyboard/index.d.ts.map +1 -1
- package/dist/keyboard/key-scope.d.ts +16 -0
- package/dist/keyboard/key-scope.d.ts.map +1 -0
- package/dist/label-editing/note-editor-dom.d.ts +2 -2
- package/dist/model/EventStormingElementFactory.d.ts +1 -1
- package/dist/model/di-types.d.ts +2 -2
- package/dist/palette/EventStormingPaletteProvider.d.ts +7 -1
- package/dist/palette/EventStormingPaletteProvider.d.ts.map +1 -1
- package/dist/theme/palette.d.ts +10 -1
- package/dist/theme/palette.d.ts.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @miragon/event-storming-renderer
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@miragon/event-storming-renderer)
|
|
4
|
-
[](https://github.com/Miragon/modeler-suite/blob/main/modelers/event-storming/LICENSE)
|
|
5
5
|
|
|
6
6
|
[diagram-js](https://github.com/bpmn-io/diagram-js)-based renderer for
|
|
7
7
|
[Event Storming](https://www.eventstorming.com/) boards: `Viewer`, `NavigatedViewer`, and a full
|
|
@@ -16,10 +16,10 @@ npm install @miragon/event-storming-renderer
|
|
|
16
16
|
## Usage
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
|
-
import { NavigatedViewer } from
|
|
20
|
-
import
|
|
19
|
+
import { NavigatedViewer } from "@miragon/event-storming-renderer";
|
|
20
|
+
import "@miragon/event-storming-renderer/assets/event-storming.css";
|
|
21
21
|
|
|
22
|
-
const viewer = new NavigatedViewer({ container: document.querySelector(
|
|
22
|
+
const viewer = new NavigatedViewer({ container: document.querySelector("#canvas")! });
|
|
23
23
|
|
|
24
24
|
await viewer.importDSL(`title Order Checkout
|
|
25
25
|
actor Customer [80, 300]
|
|
@@ -31,11 +31,12 @@ 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,
|
|
37
38
|
arrows, undo/redo). Stickies are colored per kind (`STICKY_STYLES`): domain event, command,
|
|
38
|
-
actor, aggregate, policy, read model, external system
|
|
39
|
+
actor, aggregate, policy, read model, external system and hotspot, plus free-text notes and
|
|
39
40
|
freeform drawings on an unbounded canvas.
|
|
40
41
|
|
|
41
42
|
### Options
|
|
@@ -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
|
|
|
@@ -64,15 +65,41 @@ Pass `undoRedoKeys: false` when the host owns the history, as the VS Code extens
|
|
|
64
65
|
then reach the host untouched and the host undoes the document, while copy, paste, delete, the
|
|
65
66
|
arrow keys and the single-key tools keep working on the canvas.
|
|
66
67
|
|
|
67
|
-
The modeler's keyboard listens on `document`, but only
|
|
68
|
-
target
|
|
69
|
-
|
|
70
|
-
the
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
The modeler's keyboard listens on `document`, but acts only while the canvas itself has the focus:
|
|
69
|
+
the key's target is the canvas `<svg>` or lies inside it, the element diagram-js 15 binds its own
|
|
70
|
+
keyboard to. `<body>` does not count, so no key acts right after a load or after a click on page
|
|
71
|
+
text, and the palette, the context pad and the label editor, which sit next to the `<svg>`, keep
|
|
72
|
+
their keys. Keys another listener already handled (`defaultPrevented`), events without a `key` and
|
|
73
|
+
keys typed during an IME composition are left alone, and the canvas container gets no `tabindex` of
|
|
74
|
+
its own. A pointer click or drag on a palette entry, a click on a context-pad entry that opens no
|
|
75
|
+
editor or popup (delete, connect, append, line style) and a picked colour hand the focus to the
|
|
76
|
+
canvas, without the keyboard focus ring. Enter and Space on a tool entry (lasso, draw) leave the
|
|
77
|
+
focus on the entry; on a creating entry they place the sticky in the middle of the free area and
|
|
78
|
+
open its label editor. While a line is drawn, Enter and Escape end it only when aimed at the
|
|
79
|
+
modeler's container (the canvas, the palette or the context pad), never at a text field or a control
|
|
80
|
+
outside the container, and every point focuses the canvas. To keep the keys away from a canvas it
|
|
81
|
+
hides without destroying it, a host makes it `inert` (or `display: none`): the browser then moves
|
|
82
|
+
the focus off the `<svg>` at its next rendering update. Cmd/Ctrl+A selects the whole board. An
|
|
83
|
+
import erases the undo history without firing `commandStack.changed`, and fires
|
|
84
|
+
`import.parse.start`, `import.render.start` and `import.done` in that order. It frames the content
|
|
85
|
+
centred at the largest zoom that shows all of it, never above 100%; an empty board shows at 100%. A
|
|
86
|
+
board with arrow annotations is imported once the font they are set in has loaded (or failed to), so
|
|
87
|
+
that the fit on import, and a host's fit after the import resolves, frame them as drawn and not as
|
|
88
|
+
the fallback font would set them; imports still run in the order they were called. A label being
|
|
74
89
|
typed when an import arrives is reopened on the same element afterwards, with the typed text.
|
|
75
90
|
|
|
91
|
+
`contentBounds()` gives the tight box around what the board draws (`{ x, y, width, height }` in
|
|
92
|
+
board coordinates, which zoom and scroll leave alone): every sticky, note and drawing, a hotspot
|
|
93
|
+
with its tilt, and every arrow's annotation, which can reach far past the two stickies it stands
|
|
94
|
+
between. It reads the live canvas and measures the annotations on a 2D canvas, so a zoom never
|
|
95
|
+
changes it, and gives `undefined` while the board has no element. The annotations are drawn with
|
|
96
|
+
`text-rendering: geometricPrecision`, as they are measured: without it Chromium lays SVG text out
|
|
97
|
+
at the zoomed font size, and where it rounds glyph advances to whole pixels (Linux) the drawn text
|
|
98
|
+
grows and shrinks with the zoom. A host that fits the view itself fits to it and adds its own
|
|
99
|
+
margins; the importer's fit and the SVG export frame the same box with padding. A sticky's label
|
|
100
|
+
wider than the sticky can overhang it, since the wrapping goes by an estimated character width;
|
|
101
|
+
that overhang is not part of the box.
|
|
102
|
+
|
|
76
103
|
Enter or Space on a creating palette entry (a click without a pointer, `detail` 0) places the
|
|
77
104
|
element in the centre of `freeArea` (the container minus the margins a host's chrome covers, or the
|
|
78
105
|
centre the host names; without it the container's centre), 24px down and right while that spot is
|
|
@@ -90,7 +117,7 @@ drawing keeps literal light colours in its SVG attributes, so exports look the s
|
|
|
90
117
|
|
|
91
118
|
### Collaborative hosts
|
|
92
119
|
|
|
93
|
-
The package implements the collaborative-modeler contract 1.
|
|
120
|
+
The package implements the collaborative-modeler contract 1.3 of
|
|
94
121
|
[`@miragon/modeler-api`](https://www.npmjs.com/package/@miragon/modeler-api) (notation
|
|
95
122
|
`event-storming`) and runs its conformance kit in CI, every case and no advisory:
|
|
96
123
|
|
|
@@ -98,7 +125,7 @@ The package implements the collaborative-modeler contract 1.2 of
|
|
|
98
125
|
import {
|
|
99
126
|
createCollaborativeModeler,
|
|
100
127
|
createCollaborativeViewer,
|
|
101
|
-
} from
|
|
128
|
+
} from "@miragon/event-storming-renderer";
|
|
102
129
|
|
|
103
130
|
const modeler = createCollaborativeModeler(); // meta.editable: true
|
|
104
131
|
modeler.attachTo(host); // in the document, with a size
|
|
@@ -132,13 +159,19 @@ const viewer = createCollaborativeViewer(); // meta.editable: false, never chang
|
|
|
132
159
|
top-left corner and the size, which zoom and scroll leave alone), read from the live canvas: a
|
|
133
160
|
sticky created or moved in the session has its current box. Any other id gives `undefined`. The
|
|
134
161
|
viewer answers it too.
|
|
162
|
+
- `contentBounds()` (contract 1.3) is the board's tight box, as on the `Modeler` and the viewers
|
|
163
|
+
above: it covers every `elements.bounds` box, the notes and drawings, a hotspot's tilt and every
|
|
164
|
+
arrow's annotation, and is `undefined` for a board without elements, before the first import and
|
|
165
|
+
after `destroy()`. The modeler shell's `connectDiagramJs(shell, diagram, { modeler })` fits to
|
|
166
|
+
it. The viewer answers it too.
|
|
135
167
|
- New sticky ids are random: a sticky created on the canvas (palette, keyboard, append, paste) gets
|
|
136
168
|
`<prefix>_<8 characters of [0-9a-z]>`, such as `(id event_k3x9q2ab)`, so two peers that each add
|
|
137
169
|
one at the same time do not pick the same id. Ids already in a text are read as they are.
|
|
138
170
|
- `diagram` is the wrapped `Modeler` or `NavigatedViewer`, for everything outside the contract.
|
|
139
171
|
`createCollaborativeModeler` and `createCollaborativeViewer` accept the same options:
|
|
140
172
|
`additionalModules`, `fitOnImport`, and for the modeler `undoRedoKeys` and `freeArea` (the
|
|
141
|
-
viewer ignores those two); the deprecated `freeRectInsets` still works
|
|
173
|
+
viewer ignores those two); the deprecated `freeRectInsets` still works through 0.5.x and goes
|
|
174
|
+
in 0.6.0.
|
|
142
175
|
- After `destroy()`, `exportText()` returns the last state and `importText()` rejects.
|
|
143
176
|
|
|
144
177
|
#### Migrating a host
|
|
@@ -161,14 +194,14 @@ const viewer = createCollaborativeViewer(); // meta.editable: false, never chang
|
|
|
161
194
|
### Fonts
|
|
162
195
|
|
|
163
196
|
The package ships no fonts and uses no CDN. The canvas typeface is **Geist** (Miragon corporate
|
|
164
|
-
identity); provide it yourself
|
|
197
|
+
identity); provide it yourself, preferably self-hosted via [`@fontsource`](https://fontsource.org/)
|
|
165
198
|
(one variable file covers all weights):
|
|
166
199
|
|
|
167
200
|
```ts
|
|
168
|
-
import
|
|
201
|
+
import "@fontsource-variable/geist/wght.css";
|
|
169
202
|
```
|
|
170
203
|
|
|
171
|
-
Part of the [Event Storming Modeler](https://github.com/Miragon/event-storming
|
|
204
|
+
Part of the [Event Storming Modeler](https://github.com/Miragon/modeler-suite/tree/main/modelers/event-storming) in the [Miragon modeler suite](https://github.com/Miragon/modeler-suite).
|
|
172
205
|
|
|
173
206
|
## License
|
|
174
207
|
|
|
@@ -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,EAAkB,KAAK,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"EventStormingBaseViewer.d.ts","sourceRoot":"","sources":["../src/EventStormingBaseViewer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,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AC,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"}
|
|
@@ -3,7 +3,7 @@ import { BoardShortcutOptions, ShortcutsChrome } from './shortcuts.js';
|
|
|
3
3
|
export interface ShortcutsDialogChrome extends ShortcutsChrome {
|
|
4
4
|
/** Where the dialog lives (the shell root), so it shares the chrome's mode and fonts. */
|
|
5
5
|
readonly root: HTMLElement;
|
|
6
|
-
readonly messages: ShortcutsChrome[
|
|
6
|
+
readonly messages: ShortcutsChrome["messages"] & {
|
|
7
7
|
readonly close: string;
|
|
8
8
|
};
|
|
9
9
|
/** The control the focus returns to once the dialog closes. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BoardLevel } from '@miragon/event-storming-schema-model';
|
|
2
2
|
/** The icons the guide gives these entries (guide §5.14, the shell's common set). */
|
|
3
|
-
export type BoardMenuIcon =
|
|
3
|
+
export type BoardMenuIcon = "file-image" | "file-code-corner" | "keyboard";
|
|
4
4
|
interface BoardMenuItem {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly label: string;
|
|
@@ -8,21 +8,21 @@ interface BoardMenuItem {
|
|
|
8
8
|
readonly keepEnabledWhenReadOnly?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export interface BoardMenuAction extends BoardMenuItem {
|
|
11
|
-
readonly kind:
|
|
11
|
+
readonly kind: "action";
|
|
12
12
|
readonly shortcut?: string;
|
|
13
13
|
onSelect(): void;
|
|
14
14
|
}
|
|
15
15
|
export interface BoardMenuDialog extends BoardMenuItem {
|
|
16
|
-
readonly kind:
|
|
16
|
+
readonly kind: "dialog";
|
|
17
17
|
onSelect(): void;
|
|
18
18
|
}
|
|
19
19
|
export interface BoardMenuCheckbox extends BoardMenuItem {
|
|
20
|
-
readonly kind:
|
|
20
|
+
readonly kind: "checkbox";
|
|
21
21
|
checked(): boolean;
|
|
22
22
|
onToggle(checked: boolean): void;
|
|
23
23
|
}
|
|
24
24
|
export interface BoardMenuRadioGroup {
|
|
25
|
-
readonly kind:
|
|
25
|
+
readonly kind: "radio";
|
|
26
26
|
readonly id: string;
|
|
27
27
|
readonly label: string;
|
|
28
28
|
readonly options: ReadonlyArray<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ShortcutPlatform =
|
|
1
|
+
export type ShortcutPlatform = "mac" | "other";
|
|
2
2
|
export interface ShortcutKeyNames {
|
|
3
3
|
readonly ctrl: string;
|
|
4
4
|
readonly shift: string;
|
|
@@ -34,7 +34,7 @@ export interface BoardShortcutOptions {
|
|
|
34
34
|
readonly fileKeys?: boolean | undefined;
|
|
35
35
|
}
|
|
36
36
|
/** "⌘O" on macOS, "Ctrl+O" elsewhere: the chip of a Cmd/Ctrl key the app binds itself. */
|
|
37
|
-
export declare function commandKeyLabel(key: string, platform: ShortcutPlatform, keyNames: Pick<ShortcutKeyNames,
|
|
37
|
+
export declare function commandKeyLabel(key: string, platform: ShortcutPlatform, keyNames: Pick<ShortcutKeyNames, "ctrl">): string;
|
|
38
38
|
/**
|
|
39
39
|
* Every shortcut of the board, grouped as guide §5.4 asks (View, Edit, the notation's tools),
|
|
40
40
|
* after the web app's File keys where it binds them.
|
|
@@ -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,15 +14,20 @@ 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
|
}
|
|
22
22
|
/** The elements surface with `bounds`, which every Event Storming mount answers. */
|
|
23
|
-
export type EventStormingElementsSurface = ElementsSurface & Required<Pick<ElementsSurface,
|
|
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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AM,GAAG,IAAI;IA+CvE,KAAK,IAAI,IAAI;CAUd"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as ContextPad } from 'diagram-js/lib/features/context-pad/ContextPad';
|
|
2
|
+
import { default as Canvas } from 'diagram-js/lib/core/Canvas';
|
|
2
3
|
import { default as EventBus } from 'diagram-js/lib/core/EventBus';
|
|
3
4
|
import { default as Modeling } from 'diagram-js/lib/features/modeling/Modeling';
|
|
4
5
|
import { default as Connect } from 'diagram-js/lib/features/connect/Connect';
|
|
@@ -22,8 +23,15 @@ export default class EventStormingContextPadProvider implements ContextPadProvid
|
|
|
22
23
|
private readonly factory;
|
|
23
24
|
private readonly colorPicker;
|
|
24
25
|
private readonly readOnly?;
|
|
26
|
+
private readonly canvas?;
|
|
25
27
|
static $inject: string[];
|
|
26
|
-
constructor(contextPad: ContextPad, modeling: Modeling, connect: Connect, create: Create, popupMenu: PopupMenu, eventStormingModeling: EventStormingModeling, labelEditing: EventStormingLabelEditing, factory: EventStormingElementFactory, colorPicker: EventStormingColorPicker, eventBus?: EventBus, readOnly?: Pick<EventStormingReadOnly, "isReadOnly"> | undefined);
|
|
28
|
+
constructor(contextPad: ContextPad, modeling: Modeling, connect: Connect, create: Create, popupMenu: PopupMenu, eventStormingModeling: EventStormingModeling, labelEditing: EventStormingLabelEditing, factory: EventStormingElementFactory, colorPicker: EventStormingColorPicker, eventBus?: EventBus, readOnly?: Pick<EventStormingReadOnly, "isReadOnly"> | undefined, canvas?: Pick<Canvas, "focus" | "getContainer"> | undefined);
|
|
27
29
|
getContextPadEntries(element: Element): ContextPadEntries;
|
|
30
|
+
/**
|
|
31
|
+
* The entries take no focus, so a click on one drops it to `<body>`, where the board's keys do
|
|
32
|
+
* not act: Cmd/Ctrl+Z after a delete or Delete after a connect would do nothing. Entries that
|
|
33
|
+
* open the label editor, the type popup or the colour picker leave the focus to them.
|
|
34
|
+
*/
|
|
35
|
+
private focusingCanvas;
|
|
28
36
|
}
|
|
29
37
|
//# sourceMappingURL=EventStormingContextPadProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventStormingContextPadProvider.d.ts","sourceRoot":"","sources":["../../src/context-pad/EventStormingContextPadProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,gDAAgD,CAAC;AAC7E,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,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,EAAE,MAAM,4BAA4B,CAAC;AAO1D,OAAO,KAAK,qBAAqB,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,yBAAyB,MAAM,+CAA+C,CAAC;AAC3F,OAAO,KAAK,2BAA2B,MAAM,yCAAyC,CAAC;AACvF,OAAO,KAAK,wBAAwB,MAAM,6CAA6C,CAAC;AAExF,OAAO,EAA2B,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"EventStormingContextPadProvider.d.ts","sourceRoot":"","sources":["../../src/context-pad/EventStormingContextPadProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,gDAAgD,CAAC;AAC7E,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,OAAO,MAAM,yCAAyC,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,uCAAuC,CAAC;AAChE,OAAO,KAAK,SAAS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AY,CAAC,YAAA,EACpD,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CAAC,YAAA;IAQlE,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB;IAkIzD;;;;OAIG;IACH,OAAO,CAAC,cAAc;CAMvB"}
|
|
@@ -15,9 +15,10 @@ export default class EventStormingRenderer extends BaseRenderer {
|
|
|
15
15
|
/** Freeform drawing: polyline/polygon from relative points (see EventStormingDrawTool). */
|
|
16
16
|
private drawDrawing;
|
|
17
17
|
/**
|
|
18
|
-
* Every sticky (and the free note) is a rounded rectangle with centered, wrapped
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Every sticky (and the free note) is a rounded rectangle with centered, wrapped text inside —
|
|
19
|
+
* the label lives IN the sticky, never beside it. A user-picked `color` overrides the kind's
|
|
20
|
+
* fill and turns the text black or white, whichever reads better on it; the border stays the
|
|
21
|
+
* kind's own (so the type remains recognizable).
|
|
21
22
|
*/
|
|
22
23
|
private drawSticky;
|
|
23
24
|
drawConnection(visuals: SVGElement, element: ConnectionLike): SVGElement;
|
|
@@ -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;AAgCzF,OAAO,KAAK,wBAAwB,MAAM,6CAA6C,CAAC;AAKxF,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,gCAAgC,CAAC;AAWhE,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;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAgET,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,8 @@
|
|
|
1
|
+
import { MIRAGON } from '../theme/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Text colour on a sticky's fill (guide §10.6): `schwarz` or `weiss`, whichever contrasts more
|
|
4
|
+
* with the fill, so a fill the user picks keeps its text readable. A translucent fill counts as
|
|
5
|
+
* it shows over the canvas ground; a fill the renderer cannot read keeps `schwarz`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function textColorOn(fill: string): typeof MIRAGON.schwarz | typeof MIRAGON.weiss;
|
|
8
|
+
//# sourceMappingURL=contrast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contrast.d.ts","sourceRoot":"","sources":["../../src/draw/contrast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AA6F5C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,OAAO,CAAC,OAAO,GAAG,OAAO,OAAO,CAAC,KAAK,CAKvF"}
|
|
@@ -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"}
|
package/dist/draw/lucide.d.ts
CHANGED
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const LUCIDE: {
|
|
7
7
|
readonly plus: "<path d=\"M5 12h14\"/><path d=\"M12 5v14\"/>";
|
|
8
|
-
readonly
|
|
8
|
+
readonly "arrow-right": "<path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>";
|
|
9
9
|
readonly pencil: "<path d=\"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\"/><path d=\"m15 5 4 4\"/>";
|
|
10
10
|
readonly trash: "<path d=\"M10 11v6\"/><path d=\"M14 11v6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\"/><path d=\"M3 6h18\"/><path d=\"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/>";
|
|
11
11
|
readonly replace: "<path d=\"M14 4a1 1 0 0 1 1-1\"/><path d=\"M15 10a1 1 0 0 1-1-1\"/><path d=\"M21 4a1 1 0 0 0-1-1\"/><path d=\"M21 9a1 1 0 0 1-1 1\"/><path d=\"m3 7 3 3 3-3\"/><path d=\"M6 10V5a2 2 0 0 1 2-2h2\"/><rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\"/>";
|
|
12
12
|
readonly palette: "<path d=\"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z\"/><circle cx=\"13.5\" cy=\"6.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"17.5\" cy=\"10.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"6.5\" cy=\"12.5\" r=\".5\" fill=\"currentColor\"/><circle cx=\"8.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\"/>";
|
|
13
|
-
readonly
|
|
13
|
+
readonly "line-style": "<path d=\"M11 5h2\"/><path d=\"M15 12h6\"/><path d=\"M19 5h2\"/><path d=\"M3 12h6\"/><path d=\"M3 19h18\"/><path d=\"M3 5h2\"/>";
|
|
14
14
|
readonly bold: "<path d=\"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8\"/>";
|
|
15
15
|
readonly italic: "<line x1=\"19\" x2=\"10\" y1=\"4\" y2=\"4\"/><line x1=\"14\" x2=\"5\" y1=\"20\" y2=\"20\"/><line x1=\"15\" x2=\"9\" y1=\"4\" y2=\"20\"/>";
|
|
16
16
|
readonly list: "<path d=\"M3 5h.01\"/><path d=\"M3 12h.01\"/><path d=\"M3 19h.01\"/><path d=\"M8 5h13\"/><path d=\"M8 12h13\"/><path d=\"M8 19h13\"/>";
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
17
|
+
readonly "text-align-start": "<path d=\"M21 5H3\"/><path d=\"M15 12H3\"/><path d=\"M17 19H3\"/>";
|
|
18
|
+
readonly "text-align-center": "<path d=\"M21 5H3\"/><path d=\"M17 12H7\"/><path d=\"M19 19H5\"/>";
|
|
19
|
+
readonly "text-align-end": "<path d=\"M21 5H3\"/><path d=\"M21 12H9\"/><path d=\"M21 19H7\"/>";
|
|
20
|
+
readonly "align-vertical-justify-start": "<rect width=\"14\" height=\"6\" x=\"5\" y=\"16\" rx=\"2\"/><rect width=\"10\" height=\"6\" x=\"7\" y=\"6\" rx=\"2\"/><path d=\"M2 2h20\"/>";
|
|
21
|
+
readonly "align-vertical-justify-center": "<rect width=\"14\" height=\"6\" x=\"5\" y=\"16\" rx=\"2\"/><rect width=\"10\" height=\"6\" x=\"7\" y=\"2\" rx=\"2\"/><path d=\"M2 12h20\"/>";
|
|
22
|
+
readonly "align-vertical-justify-end": "<rect width=\"14\" height=\"6\" x=\"5\" y=\"12\" rx=\"2\"/><rect width=\"10\" height=\"6\" x=\"7\" y=\"2\" rx=\"2\"/><path d=\"M2 22h20\"/>";
|
|
23
23
|
readonly x: "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>";
|
|
24
24
|
};
|
|
25
25
|
export type LucideIconName = keyof typeof LUCIDE;
|
package/dist/draw/styles.d.ts
CHANGED
|
@@ -12,14 +12,31 @@ export interface StickyStyle {
|
|
|
12
12
|
* size and fill/border. Single source for the renderer, element factory, palette previews and
|
|
13
13
|
* the color-picker swatches. Aggregate, policy and external system share the large block format —
|
|
14
14
|
* they occupy the same slot in the grammar (receive commands / react to events); actors are the
|
|
15
|
-
* small corner stickies.
|
|
15
|
+
* small corner stickies. Each border is the fill's hue, dark enough for 3:1 on the canvas ground:
|
|
16
|
+
* the light fills barely differ from the ground, so the border carries the sticky's outline.
|
|
16
17
|
*/
|
|
17
18
|
export declare const STICKY_STYLES: Record<StickyKind, StickyStyle>;
|
|
18
19
|
/** Free-text note: grows with its text (see `noteMetrics`) unless resized by hand, neutral grey. */
|
|
19
20
|
export declare const NOTE_STYLE: {
|
|
20
21
|
readonly label: "Note";
|
|
21
22
|
readonly fill: "#ECECEC";
|
|
22
|
-
readonly stroke: "#
|
|
23
|
+
readonly stroke: "#8F8A8A";
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Provisional (blank append) sticky: plain paper with a dashed border in `kontur`, no kind yet.
|
|
27
|
+
* The border is all that sets it off the canvas ground, so it keeps 3:1 there (guide §3.6).
|
|
28
|
+
*/
|
|
29
|
+
export declare const PROVISIONAL_STICKY: {
|
|
30
|
+
readonly fill: "#FFFFFF";
|
|
31
|
+
readonly stroke: "#8F8A8A";
|
|
32
|
+
readonly dash: "6 4";
|
|
33
|
+
};
|
|
34
|
+
/** Soft drop shadow that makes stickies read as paper, in the ink of the design system's shadows. */
|
|
35
|
+
export declare const STICKY_SHADOW: {
|
|
36
|
+
readonly color: "#1D1D1D";
|
|
37
|
+
readonly opacity: 0.2;
|
|
38
|
+
readonly dy: 5;
|
|
39
|
+
readonly blur: 5;
|
|
23
40
|
};
|
|
24
41
|
/** Smallest hand-resized note box — keeps a shrunken note grabbable and its handles apart. */
|
|
25
42
|
export declare const NOTE_MIN_RESIZE: {
|
|
@@ -67,14 +84,18 @@ export declare function isManualNoteBox(label: string, box: {
|
|
|
67
84
|
export declare const COLORS: {
|
|
68
85
|
readonly paper: "#F9F7F7";
|
|
69
86
|
readonly ink: "#1D1D1D";
|
|
70
|
-
readonly inkSoft: "#
|
|
87
|
+
readonly inkSoft: "#6B6666";
|
|
71
88
|
readonly surface: "#FFFFFF";
|
|
72
89
|
readonly stroke: "#1D1D1D";
|
|
73
|
-
/** The single connection style:
|
|
74
|
-
readonly arrow: "#
|
|
90
|
+
/** The single connection style: an arrowed line in `kontur`, as edges are (guide §10.1). */
|
|
91
|
+
readonly arrow: "#8F8A8A";
|
|
75
92
|
readonly accent: "#335DE5";
|
|
76
93
|
readonly accentSoft: "rgba(51,93,229,0.12)";
|
|
77
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Text inside a sticky on its kind's fill: #1D1D1D reaches 4.5:1 on all eight fills, the hotspot
|
|
96
|
+
* included. A fill the user picks gets black or white text, whichever reads better
|
|
97
|
+
* (`textColorOn`).
|
|
98
|
+
*/
|
|
78
99
|
readonly stickyText: "#1D1D1D";
|
|
79
100
|
};
|
|
80
101
|
/**
|