@miragon/wardley-renderer 0.13.0 → 0.15.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.
Files changed (95) hide show
  1. package/README.md +166 -32
  2. package/dist/Modeler.d.ts.map +1 -1
  3. package/dist/WardleyBaseViewer.d.ts.map +1 -1
  4. package/dist/a11y/canvasFocus.d.ts +28 -0
  5. package/dist/a11y/canvasFocus.d.ts.map +1 -1
  6. package/dist/a11y/index.d.ts +1 -1
  7. package/dist/a11y/index.d.ts.map +1 -1
  8. package/dist/appearance/index.d.ts +10 -0
  9. package/dist/appearance/index.d.ts.map +1 -0
  10. package/dist/appearance/index.js +5 -0
  11. package/dist/appearance/index.js.map +1 -0
  12. package/dist/append/WardleyAppendBehavior.d.ts.map +1 -1
  13. package/dist/collaborative/CollaborativeWardley.d.ts +5 -3
  14. package/dist/collaborative/CollaborativeWardley.d.ts.map +1 -1
  15. package/dist/color-picker/WardleyColorPicker.d.ts.map +1 -1
  16. package/dist/draw/WardleyRenderer.d.ts.map +1 -1
  17. package/dist/draw/index.d.ts +1 -1
  18. package/dist/draw/index.d.ts.map +1 -1
  19. package/dist/draw/label-layout.d.ts +13 -4
  20. package/dist/draw/label-layout.d.ts.map +1 -1
  21. package/dist/draw-tool/WardleyDrawTool.d.ts +23 -4
  22. package/dist/draw-tool/WardleyDrawTool.d.ts.map +1 -1
  23. package/dist/draw-tool/WardleyDrawingHandles.d.ts +17 -3
  24. package/dist/draw-tool/WardleyDrawingHandles.d.ts.map +1 -1
  25. package/dist/draw-tool/index.d.ts.map +1 -1
  26. package/dist/evolution-grid/EvolutionConstraintBehavior.d.ts.map +1 -1
  27. package/dist/evolve/WardleyEvolveDragging.d.ts +10 -3
  28. package/dist/evolve/WardleyEvolveDragging.d.ts.map +1 -1
  29. package/dist/evolve/index.d.ts.map +1 -1
  30. package/dist/index.d.ts +8 -4
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2066 -1502
  33. package/dist/index.js.map +1 -1
  34. package/dist/interaction/WardleyInteraction.d.ts +92 -0
  35. package/dist/interaction/WardleyInteraction.d.ts.map +1 -0
  36. package/dist/interaction/index.d.ts +5 -0
  37. package/dist/interaction/index.d.ts.map +1 -0
  38. package/dist/io/WardleyExporter.d.ts +12 -2
  39. package/dist/io/WardleyExporter.d.ts.map +1 -1
  40. package/dist/io/blobToBase64.d.ts +3 -0
  41. package/dist/io/blobToBase64.d.ts.map +1 -0
  42. package/dist/io/index.d.ts +1 -2
  43. package/dist/io/index.d.ts.map +1 -1
  44. package/dist/keyboard/WardleyKeyboard.d.ts +19 -1
  45. package/dist/keyboard/WardleyKeyboard.d.ts.map +1 -1
  46. package/dist/label-drag/WardleyLabelDragging.d.ts +9 -3
  47. package/dist/label-drag/WardleyLabelDragging.d.ts.map +1 -1
  48. package/dist/label-drag/index.d.ts.map +1 -1
  49. package/dist/label-editing/WardleyLabelEditing.d.ts.map +1 -1
  50. package/dist/label-editing/fieldError.d.ts +6 -0
  51. package/dist/label-editing/fieldError.d.ts.map +1 -1
  52. package/dist/label-editing/imeComposition.d.ts +7 -0
  53. package/dist/label-editing/imeComposition.d.ts.map +1 -0
  54. package/dist/label-editing/index.d.ts +2 -1
  55. package/dist/label-editing/index.d.ts.map +1 -1
  56. package/dist/lasso/WardleyLassoBehavior.d.ts +5 -1
  57. package/dist/lasso/WardleyLassoBehavior.d.ts.map +1 -1
  58. package/dist/lasso/index.d.ts +1 -1
  59. package/dist/lasso/index.d.ts.map +1 -1
  60. package/dist/link-editing/WardleyLinkEditing.d.ts.map +1 -1
  61. package/dist/live-preview/LivePreview.d.ts +18 -3
  62. package/dist/live-preview/LivePreview.d.ts.map +1 -1
  63. package/dist/live-preview/index.d.ts +1 -1
  64. package/dist/live-preview/index.d.ts.map +1 -1
  65. package/dist/map-menu/AxisLabelsPopover.d.ts.map +1 -1
  66. package/dist/map-menu/MapSizePopover.d.ts.map +1 -1
  67. package/dist/map-menu/TitleDialog.d.ts.map +1 -1
  68. package/dist/map-menu/index.d.ts +0 -2
  69. package/dist/map-menu/index.d.ts.map +1 -1
  70. package/dist/map-menu/popover.d.ts.map +1 -1
  71. package/dist/palette/WardleyHoverTooltipTeardown.d.ts +18 -0
  72. package/dist/palette/WardleyHoverTooltipTeardown.d.ts.map +1 -0
  73. package/dist/palette/WardleyPaletteArmedTool.d.ts +19 -0
  74. package/dist/palette/WardleyPaletteArmedTool.d.ts.map +1 -0
  75. package/dist/palette/WardleyPaletteKeyboard.d.ts +4 -2
  76. package/dist/palette/WardleyPaletteKeyboard.d.ts.map +1 -1
  77. package/dist/palette/WardleyPaletteProvider.d.ts +8 -3
  78. package/dist/palette/WardleyPaletteProvider.d.ts.map +1 -1
  79. package/dist/palette/WardleyPaletteReadOnly.d.ts +26 -0
  80. package/dist/palette/WardleyPaletteReadOnly.d.ts.map +1 -0
  81. package/dist/palette/WardleyPaletteTooltip.d.ts +52 -0
  82. package/dist/palette/WardleyPaletteTooltip.d.ts.map +1 -0
  83. package/dist/palette/index.d.ts +8 -1
  84. package/dist/palette/index.d.ts.map +1 -1
  85. package/dist/popup/WardleyElementSettingsProvider.d.ts.map +1 -1
  86. package/dist/read-only/WardleyReadOnly.d.ts +26 -4
  87. package/dist/read-only/WardleyReadOnly.d.ts.map +1 -1
  88. package/dist/read-only/index.d.ts +3 -0
  89. package/dist/read-only/index.d.ts.map +1 -1
  90. package/dist/wardley.css +1 -1
  91. package/package.json +8 -4
  92. package/dist/io/rasterize.d.ts +0 -25
  93. package/dist/io/rasterize.d.ts.map +0 -1
  94. package/dist/map-menu/ShortcutsDialog.d.ts +0 -14
  95. package/dist/map-menu/ShortcutsDialog.d.ts.map +0 -1
package/README.md CHANGED
@@ -5,7 +5,8 @@
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 import and OWM / JSON / SVG / PNG export. Browser/DOM only.
8
+ `Modeler`, plus OWM / JSON import and OWM / JSON / SVG export (a PNG through `svgToPng` of
9
+ `@miragon/modeler-shell/export`). Browser/DOM only.
9
10
 
10
11
  ## Install
11
12
 
@@ -34,6 +35,27 @@ const { svg } = await viewer.saveSVG();
34
35
 
35
36
  Swap `NavigatedViewer` for `Modeler` to get the editable map (palette, context pad, undo/redo).
36
37
 
38
+ For a host without the Miragon modeler shell, the `Modeler`'s palette is the toolbar of the Miragon
39
+ design guide: a glass island at the top centre of the container (opaque in high contrast), in the
40
+ second row, 64px from the top, in a container at most 760px wide, and ahead of the canvas in the
41
+ tab order, with one tab stop that the arrow keys, Home and End move. Its tooltip names the entry
42
+ and its key 8px below the palette, centred on the entry and at least 12px from the container's
43
+ sides; it shows after 300ms of hover, at once on keyboard focus or for a neighbour, never for a
44
+ tap, and hides on a press, on Escape and when the pointer or the focus leaves. Where the palette
45
+ scrolls sideways, the tooltip moves with its entry and hides once the entry has left the view. The
46
+ palette lies before the canvas `<svg>` in the container, so a host finds the canvas with
47
+ `canvas.getContainer().querySelector(":scope > svg")`, not as the first `svg`. A palette a chrome
48
+ skins (`data-chrome="palette"`) is left to that chrome.
49
+
50
+ The lasso is pressed (`aria-pressed="true"`) only while it is armed, in every host: Enter or Space
51
+ on the armed lasso puts it down, as Escape does, and so does arming the draw tool; a pointer's click
52
+ on the lasso arms it again. One tool is armed at a time: arming the lasso (a click, Enter or Space
53
+ on its entry, or L) puts the armed draw tool down, and a click, Enter or Space on the lasso's entry
54
+ saves a line the draw tool holds, as Escape does; L does nothing while it holds one. While the
55
+ read-only lock shows (below), the palette without the shell marks every entry but the lasso
56
+ `aria-disabled="true"` and mutes it (guide §13.5): it stays focusable, and a click, drag, Enter or
57
+ Space on it does nothing from the lock on.
58
+
37
59
  ## API
38
60
 
39
61
  | Member | What it does |
@@ -47,7 +69,7 @@ Swap `NavigatedViewer` for `Modeler` to get the editable map (palette, context p
47
69
  | `undo()` / `redo()` / `canUndo()` / `canRedo()` | `Modeler` only: the canvas command stack. |
48
70
  | `commitPendingEdits()` | `Modeler` only: saves an open inline editor, e.g. before a save shortcut. |
49
71
  | `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). |
72
+ | `blobToBase64(blob)` | Encodes a Blob, such as the PNG of the shell's `svgToPng` (see below), as Base64 without the data-URL prefix. |
51
73
  | `setAsideEditorState(modeler)` / `restoreEditorState(…)` | Keeps the selection and an open inline editor across a re-import of an externally changed map. |
52
74
 
53
75
  `setEvolutionLabels` turns an empty stage into its default label and `->` into `→`, so the labels
@@ -63,7 +85,8 @@ typed text across a view change, a scroll, a zoom or a host's fit, and moves wit
63
85
  Enter, leaving the field, or a click or drag on the canvas saves it. Shift+Enter breaks the line in
64
86
  a name (a note's Enter breaks it, and Cmd/Ctrl+Enter saves); the editor of a name is a `<textarea>`
65
87
  that grows with its lines, `textarea.wardley-label-input`. A name's line breaks are drawn as lines
66
- of the label and written to the DSL as a literal `\n` (`@miragon/wardley-dsl`).
88
+ of the label and written to the DSL as a literal `\n` (`@miragon/wardley-dsl`). A backslash typed
89
+ before an `n` in a name is saved as `∖` (U+2216), because the DSL would read `\n` back as a break.
67
90
 
68
91
  Options (the names of the `@miragon/modeler-api` 1.2 factory options):
69
92
 
@@ -80,7 +103,12 @@ Options (the names of the `@miragon/modeler-api` 1.2 factory options):
80
103
  The `wardleyReadOnly` service (`modeler.get<WardleyReadOnly>('wardleyReadOnly').setReadOnly(true)`)
81
104
  locks the canvas while its host cannot save an edit, e.g. while the document is invalid: every edit
82
105
  rule is vetoed, an open editor, popup or drag ends without saving, the handles hide, and selection,
83
- zoom, pan, select all and export stay. It fires `wardley.readOnly.changed`.
106
+ zoom, pan, select all and export stay. `setReadOnly(true, { delayMs: 800 })` locks at once but marks
107
+ the palette only once the delay has passed without `setReadOnly(false)`, so typing an invalid file
108
+ in an editor beside the canvas does not flicker (guide §13.5); a call while the delay runs keeps
109
+ its timer, `setReadOnly(false)` takes the marks off at once, and `isReadOnlyShown()` tells whether
110
+ they show. It fires `wardley.readOnly.changed` with `{ readOnly, shown }` when the lock changes and
111
+ once more when delayed marks show.
84
112
 
85
113
  The canvas's keys (undo and redo, delete, copy, paste and duplicate, select all, the arrows, Escape
86
114
  and the single-key tools C, U, N, P, L and A) act only while the canvas `<svg>` has the focus, as
@@ -91,8 +119,28 @@ Enter and Space on a palette tool (lasso, draw) leave the focus on the entry; on
91
119
  they place the element and hand the focus to the canvas, or to the new element's name editor; on a
92
120
  context-pad action they keep the focus in the pad, and an action that closes or redraws the pad
93
121
  (delete, line style, remove evolve) returns it to the canvas. A host that hides the canvas without
94
- destroying it makes the container `inert`, so the hidden canvas can neither keep the focus nor act
95
- on a key.
122
+ destroying it makes the container `inert` or hides it with `display: none` or `visibility: hidden`,
123
+ not only transparent: the browser moves the focus off the canvas at its next rendering update. A
124
+ key that reaches the canvas or the map's own chrome before then stays with the page, for each way
125
+ of hiding: the canvas acts on no key, the palette triggers no entry and moves no focus, a line the
126
+ draw tool holds stays as it is, the context pad, the name, annotation and link editors, the colour
127
+ picker and the map menu's popovers take no key, Enter on one of their buttons included, and the
128
+ element settings menu picks no entry: nothing is saved or closed, and the focus stays where it is.
129
+
130
+ Escape on the canvas ends every drag without a change, as it ends a diagram-js drag: also a label
131
+ drag, the point drag of a drawing (the drawing stays selected) and the drag of a component's red
132
+ evolve target. These drags and the colour picker take only an Escape aimed at the canvas (the
133
+ picker also one on its swatches); one aimed at the palette, the context pad, a name editor or a
134
+ host's field, menu, dialog or overlay, inside the canvas container or next to it, stays with that
135
+ control. While the draw tool holds the points of a line, the single-key tools and Cmd/Ctrl+V (the
136
+ paste attaches to the pointer) do nothing until the line is finished or cancelled, and the canvas
137
+ takes them with `preventDefault()`. Enter and Space on the Draw entry save the line, as Enter on
138
+ the canvas does. While a point of a drawing is dragged,
139
+ the keys that would change the drawing under the drag or start a second gesture next to it do
140
+ nothing until the release, and the canvas takes them with `preventDefault()`: the single-key tools,
141
+ the arrow keys, paste and duplicate. Delete still removes the drawing, which ends the drag without a
142
+ commit. An undo, a redo or any other command before the release ends the drag without a commit too,
143
+ and the drawing stays selected, as after Escape.
96
144
 
97
145
  ## Collaborative hosts
98
146
 
@@ -112,47 +160,133 @@ modeler.onContentChanged(() => save(modeler.exportText()));
112
160
 
113
161
  An import is silent (no content change is reported back), keeps the selection and an open label
114
162
  editor and fits the view (unless `fitOnImport: false`); a host's view change (`setViewState`, a fit)
115
- never saves an open editor either. A gesture that runs during an import (a move, resize, connect or
116
- lasso drag, a create from the palette or the context pad, the evolve or plot-corner drag, the point
117
- drag of a drawing) is cancelled first, as Escape cancels it, so its release changes nothing. A tool
118
- that only waits for the user's next press stays armed: the lasso from the palette or `L`, and the
119
- draw tool. A drop whose change the host imports over at once, from its change listener, has applied
120
- and is left to finish, and the name editor of a create then stays closed, since the shape it would
121
- name is gone. `exportText()` is the committed document, never a live preview:
122
- while the plot corner is dragged or the size or axis-label popover previews a change, it returns the
123
- document as it was before, and the change event of the commit brings the new one. A command during a
163
+ never saves an open editor either. A gesture that runs during an import ends first, so its release
164
+ changes nothing. A diagram-js drag is cancelled as Escape cancels it: a move, resize, connect or
165
+ lasso drag, a create from the palette, the context pad or a quick-create key (`C`, `U`, `N`, `P`
166
+ with the pointer over the canvas), a connect started with `A`, the evolve drag the context pad
167
+ starts and the plot-corner drag. A label drag, the point drag of a drawing and the drag of a
168
+ component's red evolve target end when the import removes their element. A line the draw tool holds
169
+ ends without a drawing, and the draw tool with it. A tool that only waits for the user's next press
170
+ stays armed: the lasso from the palette or `L`, and the draw tool before its first point. An
171
+ `importText` called while a user's action runs (a host that echoes its own change back through its
172
+ store imports from the action's change listener) waits until the action has finished, then imports,
173
+ and its Promise settles after that import; imports that wait keep their call order. A drop has
174
+ finished once it has ended and the steps it defers to the next task have run (the name editor of a
175
+ create or an append with the pointer). Any other command, undo or redo has finished once the code
176
+ that ran it has returned, so an import from any listener it calls waits too: a create without a
177
+ pointer (C, U, N, P, a palette entry with Enter or Space, the context pad's append with Enter), the
178
+ save of a name editor (Enter, leaving the field), the save a press on the map or the palette
179
+ makes, and a delete, an undo or a redo that deselects what it removes. The import keeps what the
180
+ action left, as any import does: a create keeps its new element selected and its name editor open
181
+ on it, with what was typed, and a saved name keeps its element selected. A drag that a press started
182
+ after it saved a name ends with the import, as an accepted import ends a running gesture and a press
183
+ below the drag threshold (L1, 1.5;
184
+ [#285](https://github.com/Miragon/modeler-suite/issues/285),
185
+ [#305](https://github.com/Miragon/modeler-suite/issues/305)). The start of a diagram-js drag is an
186
+ action too, until diagram-js has activated the drag: the start clears the selection, so an import
187
+ from the selection listener at the start of a move, a resize, a connect, the evolve placement or a
188
+ create from the palette, the context pad or a quick-create key runs right after it and then ends
189
+ that drag, without an error and without a change
190
+ ([#336](https://github.com/Miragon/modeler-suite/issues/336)). A `destroy()` from the selection
191
+ listener there, or from `interaction.onChange` as the drag starts, throws nothing either, also at
192
+ the start of the renderer's own drags (a label, a point of a drawing, the evolve target): the map is
193
+ torn down once the code that started the drag has returned, and no listener of the host hears
194
+ anything after `destroy()`, also not the selection the cancelled drag brings back
195
+ ([#346](https://github.com/Miragon/modeler-suite/issues/346)). The same holds for a `destroy()`
196
+ from any listener at a drop or at Escape, the renderer's own drags included, at a create from the
197
+ palette or the keyboard and at a paste placed with a click: the map is torn down once the handler
198
+ of that input has returned, and the name editor a create opens a task later stays closed. No
199
+ delivery calls a listener that an earlier listener of the same delivery unsubscribed
200
+ ([#380](https://github.com/Miragon/modeler-suite/issues/380),
201
+ [#373](https://github.com/Miragon/modeler-suite/issues/373)). So does a `destroy()` from a listener
202
+ that a host's own call reaches: the selection listener of `elements.reveal`, or the interaction and
203
+ selection listeners of an import, which ends a held gesture, empties the selection as it clears the
204
+ canvas and selects again what was selected before it. The map is torn down once that call has
205
+ returned. The import still draws its map, which `exportText()` then returns
206
+ ([#415](https://github.com/Miragon/modeler-suite/issues/415)), and its Promise rejects with "The
207
+ modeler was destroyed.", as an import does that waits when the modeler is destroyed.
208
+ `exportText()` is the committed document, never a live preview: while the plot corner, an evolve target (its red circle
209
+ or the evolve placement of the context pad) or a label is dragged, or the size or axis-label popover
210
+ previews a change, it returns the document as it was before, and the change event of the commit
211
+ brings the new one ([#347](https://github.com/Miragon/modeler-suite/issues/347)). A command during a
124
212
  size preview (an undo pressed mid-drag, a title the host sets) puts the preview back first, and a
125
- drag then ends without resizing, so the history stays in step with the document. `elements` names
126
- components, anchors, pipelines, submaps and accelerators by the id the document gives them
127
- (`cmp_kettle`), also right after a canvas edit, and `elements.bounds(id)` gives an element's live
128
- box in diagram coordinates; `getViewState` and `setViewState` carry the viewbox. `contentBounds()`
129
- (contract 1.3) gives the box a host fits the view to, in diagram coordinates and without padding:
130
- the plot with its axes and everything drawn beyond it (a long label at the commodity edge, a note in
131
- the margin), the box the pan constraint keeps in view. It follows every edit at once and stays the
132
- same across zoom and scroll. A map without elements still has its plot, so it is never `undefined`
133
- while the modeler lives (before the first import it is the default plot); tell an empty map by its
134
- elements. `diagram` is the wrapped `Modeler` or `NavigatedViewer` for host-specific wiring. Both
135
- factories take the options above (`additionalModules`, `freeArea`, `fitOnImport` and
136
- `undoRedoKeys`); the viewer never edits and ignores the undo keys. Both pass the
213
+ drag then ends without resizing, so the history stays in step with the document. A drawing's point
214
+ drag, the drag of an evolve target and a label drag end the same way, without a commit, when a
215
+ command runs before their release (an undo pressed mid-drag, or an arrow-key nudge during the other
216
+ two, since a point drag leaves the arrow keys without effect).
217
+ `elements` names components, anchors, pipelines, submaps and accelerators by the id the document
218
+ gives them (`cmp_kettle`), also right after a canvas edit, and `elements.bounds(id)` gives an
219
+ element's live box in diagram coordinates; `getViewState` and `setViewState` carry the viewbox.
220
+ `contentBounds()` (contract 1.3) gives the box a host fits the view to, in diagram coordinates and
221
+ without padding: the plot with its axes and everything drawn beyond it (a long label at the
222
+ commodity edge, a note in the margin), the box the pan constraint keeps in view. It follows every
223
+ edit at once and stays the same across zoom and scroll. A map without elements still has its plot,
224
+ so it is never `undefined` while the modeler lives (before the first import it is the default plot);
225
+ tell an empty map by its elements. `diagram` is the wrapped `Modeler` or `NavigatedViewer` for
226
+ host-specific wiring. Both factories take the options above (`additionalModules`, `freeArea`,
227
+ `fitOnImport` and `undoRedoKeys`); the viewer never edits and ignores the undo keys. Both pass the
137
228
  contract's conformance kit (1.3) without skips.
138
229
 
230
+ `interaction` (contract 1.5) tells a host whether the user holds a gesture, so it can defer a remote
231
+ re-import until the gesture ends: `active()` is true from the moment a move, resize, connect or
232
+ lasso drag, a label drag, the point drag of a drawing, the drag of an evolve target, the evolve or
233
+ plot-corner drag, a create from the palette, the context pad or a quick-create key with the pointer
234
+ over the canvas (also while its preview is over the palette) or a connect started with `A` starts,
235
+ until its drop or cancel. It stays false while the lasso or the draw tool only waits for the next
236
+ press, during a pan and on the viewer. `onChange(callback)` reports each change once, and may run
237
+ inside `importText` (its cancel of a gesture), so a host queues its re-import instead of importing
238
+ from the callback. A callback that throws is reported as an uncaught error a microtask later; the
239
+ gesture and the other callbacks go on as if it had returned.
240
+
241
+ `appearance` (contract 1.5) takes a host's mode: `themes` is `WARDLEY_THEMES`, `["light"]` until the
242
+ Miragon modelers turn dark together, and `set({ theme, contrast })` writes `data-cd-theme` (the theme
243
+ when `themes` lists it, else `themes[0]`) and, for `contrast: "high"`, `data-cd-kontrast="hoch"` on
244
+ the map's container, so the design tokens resolve there and not from the page: on a dark page the
245
+ map stays light, and the contrast the host asks for holds. It is view state: no change event, the
246
+ same text and SVG export, and the history, view, selection and an open editor are left as they are.
247
+ Until the first `set` the map takes its mode from the page, as before. `WARDLEY_THEMES` is also
248
+ `@miragon/wardley-renderer/themes`, which loads no DOM code, for hosts outside the browser (the VS
249
+ Code extension's theme bridge).
250
+
139
251
  ### Menu entries and dialogs for a host's chrome
140
252
 
141
253
  The map's entries of a chrome menu (Model: "Map title…" where the host passes `mapTitle`, "Map
142
254
  size…" and "X-axis labels…"; Export; Help) come from `mapMenu(actions)`, in the shape the menu
143
255
  groups of [`@miragon/modeler-shell`](https://www.npmjs.com/package/@miragon/modeler-shell) take.
144
256
  `createMapSizePopover(chrome, modeler)` and `createAxisLabelsPopover(chrome, modeler)` build the two
145
- popovers (a live preview, one undo step when done), `createTitleDialog(chrome, modeler)` the "Map
257
+ popovers (a live preview, one undo step when done; an Escape that closes one keeps a tool armed from
258
+ the palette, as the shell's own layers do), `createTitleDialog(chrome, modeler)` the "Map
146
259
  title…" dialog (one undo step on Apply, nothing for an unchanged title),
147
- `createShortcutsDialog(chrome, options)` the "Keyboard shortcuts…" dialog and
148
- `mapShortcuts(chrome, options)` its table. A web app that binds Cmd/Ctrl+O, Cmd/Ctrl+S, Cmd/Ctrl+V
149
- on the canvas and `?` itself passes `{ fileKeys: true, shortcutsKey: '?' }`, so the dialog lists
150
- them too, and `mapMenu({ …, shortcutsKey: '?' })` shows the key's chip on "Keyboard shortcuts…".
260
+ `mapShortcuts(chrome, options)` the groups of its "Keyboard shortcuts…" dialog as data. A web app
261
+ that binds Cmd/Ctrl+O, Cmd/Ctrl+S, Cmd/Ctrl+V on the canvas and `?` itself passes
262
+ `{ fileKeys: true, shortcutsKey: '?' }`, so the dialog lists them too, and
263
+ `mapMenu({ …, shortcutsKey: '?' })` shows the key's chip on "Keyboard shortcuts…". The shell opens
264
+ the dialog: `shell.showShortcutsDialog(mapShortcuts(shell, options))`, or, in a host without a
265
+ mounted shell, `showShortcutsDialog(mapShortcuts(chrome, options), { container })` of
266
+ `@miragon/modeler-shell`.
151
267
  `createMapDialog(chrome, parts)` is the modal dialog all of them share (guide §8: header with Close,
152
268
  scrolling body, footer), for a host's own dialogs in the same look; `dialogButton(label, variant)`
153
269
  gives its buttons. `chrome` is the shell handle or anything of the same shape; the renderer never
154
270
  imports the shell itself.
155
271
 
272
+ ### PNG export
273
+
274
+ The package draws no PNG itself: `svgToPng` of `@miragon/modeler-shell/export` rasterizes the SVG of
275
+ `saveSVG()`, embeds Geist, loads the SVG as a data: URL and fills the background the caller names. A
276
+ map has a plot, so its PNG lies on `--cd-ui-plot` (guide §10.7), which is `COLORS.plotBackground`:
277
+
278
+ ```ts
279
+ import { COLORS } from "@miragon/wardley-renderer";
280
+ import { svgToPng } from "@miragon/modeler-shell/export";
281
+
282
+ const { svg } = await modeler.saveSVG();
283
+ const png = await svgToPng(svg, { background: COLORS.plotBackground }); // 2×
284
+ const forSlides = await svgToPng(svg, { background: "transparent", scale: 4 });
285
+ ```
286
+
287
+ `blobToBase64(png)` gives the picture as Base64 without the data-URL prefix, e.g. to post it to a VS
288
+ Code extension host.
289
+
156
290
  ## Events
157
291
 
158
292
  | Event | Payload | Notes |
@@ -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;AAiB9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA6BvD;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,eAAe;cACvB,WAAW,IAAI,iBAAiB,EAAE;IA0CrD;;;OAGG;IACH,kBAAkB,IAAI,IAAI;IAK1B,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;IAIZ,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,OAAO;CAGnB"}
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;AA8BvD;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,eAAe;cACvB,WAAW,IAAI,iBAAiB,EAAE;IA2CrD;;;OAGG;IACH,kBAAkB,IAAI,IAAI;IAK1B,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IA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C;YAI7E,UAAU;IA0BxB,oEAAoE;IACpE,OAAO,CAAC,mBAAmB;IAQ3B,UAAU,IAAI,WAAW;YAWX,iBAAiB;IAmB/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAO7B;;;;;;;;;;;OAWG;IACH,kBAAkB,CAChB,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACxC,OAAO,GAAE,yBAA8B,GACtC,IAAI;IA6BP;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAa5B,mEAAmE;IACnE,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,mBAAmB;IAI3B,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAKzC,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAKnC,4EAA4E;IAC5E,MAAM,IAAI,IAAI;IAId,KAAK,IAAI,IAAI;IAIb,OAAO,IAAI,IAAI;IAQf,IAAI,SAAS,IAAI,WAAW,CAE3B;CACF"}
@@ -1,6 +1,34 @@
1
1
  import { default as Canvas } from 'diagram-js/lib/core/Canvas';
2
+ import { default as PopupMenu } from 'diagram-js/lib/features/popup-menu/PopupMenu';
2
3
  /** The focusable canvas svg diagram-js renders into its container. */
3
4
  export declare function canvasSvg(canvas: Canvas): SVGElement | null;
5
+ /**
6
+ * Whether a keydown is aimed at `root` or an element inside it and still free to act on. A keydown
7
+ * without a key (autofill), one a listener before this one took, and IME composition stay with the
8
+ * page, and so does a key inside an `inert` subtree or on a `root` that an ancestor with
9
+ * `display: none` or `visibility: hidden` hides: Chromium moves the focus off an element the host
10
+ * made inert or hid only at its next rendering update, so until then the key still reaches it.
11
+ */
12
+ export declare function isKeyAimedAt(event: KeyboardEvent, root: Node | null | undefined): boolean;
13
+ /**
14
+ * Whether a key reaches an element the host made inert or hid, before the browser moved the focus
15
+ * off it. The map's own chrome (context pad, editors, popovers, colour picker, popup menu) leaves
16
+ * such a key to the page, as the canvas and the palette do. Its buttons ask it of their click too:
17
+ * Enter on a focused button still clicks it once the host hid it.
18
+ */
19
+ export declare function isKeyOnHiddenTarget(event: Event): boolean;
20
+ /**
21
+ * diagram-js's popup menu runs its selected entry on Enter, also on one the browser still sends to
22
+ * a menu the host made inert or hid: such a key picks nothing and goes on to the page unprevented.
23
+ */
24
+ export declare function leaveKeysOnHiddenMenuToPage(popupMenu: Pick<PopupMenu, "trigger">): void;
25
+ /**
26
+ * A key is the canvas's only while the canvas `<svg>` has the focus, as with diagram-js' own
27
+ * keyboard: the svg holds no editor, palette, context pad or popup, so they keep their keys, and so
28
+ * do a host's controls inside the container or next to it, a page with nothing focused and a canvas
29
+ * the host made inert or hid.
30
+ */
31
+ export declare function isCanvasKey(event: KeyboardEvent, canvas: Canvas): boolean;
4
32
  /**
5
33
  * Moves keyboard focus to the canvas after a pointer gesture or an editor commit. Pointer work
6
34
  * must not light up the keyboard focus ring around the whole viewport, and a press that suppressed
@@ -1 +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"}
1
+ {"version":3,"file":"canvasFocus.d.ts","sourceRoot":"","sources":["../../src/a11y/canvasFocus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,SAAS,MAAM,8CAA8C,CAAC;AAE1E,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAK3D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAWzF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAGzD;AAID;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,IAAI,CAMvF;AAOD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzE;AAcD;;;;;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"}
@@ -1,5 +1,5 @@
1
1
  import { ModuleDeclaration } from 'didi';
2
2
  /** Names the canvas for assistive technology (role, role description, label). */
3
3
  export declare const canvasAccessibilityModule: ModuleDeclaration;
4
- export { canvasSvg, focusCanvasWithoutRing, lastInteractionWasPointer, trackInputModality, } from './canvasFocus.js';
4
+ export { canvasSvg, focusCanvasWithoutRing, isCanvasKey, isKeyAimedAt, isKeyOnHiddenTarget, lastInteractionWasPointer, leaveKeysOnHiddenMenuToPage, trackInputModality, } from './canvasFocus.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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
+ {"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,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { AppearanceTheme } from '@miragon/modeler-api';
2
+ /**
3
+ * The themes a Wardley map can be drawn in (`appearance.themes` of `@miragon/modeler-api`): light
4
+ * only until the Miragon modelers turn dark together (guide §13.5). Both apps and the VS Code theme
5
+ * bridge read this one list, so the web app, the webview and an embedding host draw the same modes.
6
+ * The module touches no DOM, for hosts that read it outside the browser
7
+ * (`@miragon/wardley-renderer/themes`).
8
+ */
9
+ export declare const WARDLEY_THEMES: readonly [AppearanceTheme, ...AppearanceTheme[]];
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/appearance/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,eAAe,EAAE,GAAG,eAAe,EAAE,CAEjE,CAAC"}
@@ -0,0 +1,5 @@
1
+ // src/appearance/index.ts
2
+ var e = Object.freeze(["light"]);
3
+ export { e as WARDLEY_THEMES };
4
+
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["WARDLEY_THEMES"],"sources":["../../src/appearance/index.ts"],"sourcesContent":["import type { AppearanceTheme } from \"@miragon/modeler-api\";\n\n/**\n * The themes a Wardley map can be drawn in (`appearance.themes` of `@miragon/modeler-api`): light\n * only until the Miragon modelers turn dark together (guide §13.5). Both apps and the VS Code theme\n * bridge read this one list, so the web app, the webview and an embedding host draw the same modes.\n * The module touches no DOM, for hosts that read it outside the browser\n * (`@miragon/wardley-renderer/themes`).\n */\nexport const WARDLEY_THEMES: readonly [AppearanceTheme, ...AppearanceTheme[]] = Object.freeze([\n \"light\",\n] as const);\n"],"mappings":";AASA,IAAaA,IAAmE,OAAO,OAAO,CAC5F,OACF,CAAU"}
@@ -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;AA6CrC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAqB;IACxC,MAAM,CAAC,OAAO,WAA4B;gBAE9B,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;CA0CnD"}
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;CAkDnD"}
@@ -1,4 +1,4 @@
1
- import { CollaborativeModeler, CollaborativeModelerOptions, ElementBounds, ElementsSurface } from '@miragon/modeler-api';
1
+ import { AppearanceSurface, CollaborativeModeler, CollaborativeModelerOptions, ElementBounds, ElementsSurface, InteractionSurface } from '@miragon/modeler-api';
2
2
  import { ModuleDeclaration } from 'didi';
3
3
  import { Modeler } from '../Modeler.js';
4
4
  import { NavigatedViewer } from '../NavigatedViewer.js';
@@ -17,11 +17,13 @@ export interface WardleyElementsSurface extends ElementsSurface {
17
17
  bounds(id: string): ElementBounds | undefined;
18
18
  }
19
19
  /**
20
- * The contract surface, with the optional `contentBounds` of contract 1.3 always present, plus the
21
- * wrapped diagram for host-specific wiring.
20
+ * The contract surface, with the optional `contentBounds` of contract 1.3 and `interaction` and
21
+ * `appearance` of contract 1.5 always present, plus the wrapped diagram for host-specific wiring.
22
22
  */
23
23
  export interface CollaborativeWardleyModeler extends CollaborativeModeler {
24
24
  readonly elements: WardleyElementsSurface;
25
+ readonly interaction: InteractionSurface;
26
+ readonly appearance: AppearanceSurface;
25
27
  readonly diagram: Modeler | NavigatedViewer;
26
28
  contentBounds(): ElementBounds | undefined;
27
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CollaborativeWardley.d.ts","sourceRoot":"","sources":["../../src/collaborative/CollaborativeWardley.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAElB,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAM9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAOxD,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C;;;GAGG;AACH,MAAM,WAAW,2BAA4B,SAAQ,2BAA2B;IAC9E,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,GAAG,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qF;IACrF,OAAO,CAAC,WAAW;IAiBV,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,GAAG,UAAU;IAkDxE,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAKtC,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM;IAM9D,OAAO,CAAC,aAAa;IAsCrB,kFAAkF;IAClF,OAAO,CAAC,YAAY;IAmFpB,OAAO,CAAC,UAAU;IA0BlB,OAAO,CAAC,YAAY;IAyDpB,OAAO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,YAAY;IAuCpB,OAAO,CAAC,cAAc;IAmCtB,OAAO,CAAC,eAAe;IA6BvB,OAAO,CAAC,UAAU;CA8CnB"}
@@ -2,5 +2,5 @@ import { ModuleDeclaration } from 'didi';
2
2
  /** SVG rendering of all Wardley types (BaseRenderer subclass, priority 1500). */
3
3
  export declare const wardleyDrawModule: ModuleDeclaration;
4
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
+ export { componentLabelPlacement, componentLabelSlot, movementDeltaX, movementLabelPlacement, movementLabelSlot, nameLineGrowth, normalizeLabelOffset, type LabelPlacement, type LineGrowth, } from './label-layout.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -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,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"}
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,cAAc,EACd,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,mBAAmB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { default as ElementRegistry } from 'diagram-js/lib/core/ElementRegistry';
1
2
  import { LabelOffset } from '@miragon/wardley-schema-model';
2
3
  import { WardleyShape } from '../model/di-types.js';
3
4
  import { default as EvolutionGrid } from '../evolution-grid/EvolutionGrid.js';
@@ -31,14 +32,22 @@ export declare function movementDeltaX(shape: WardleyShape, grid: Pick<Evolution
31
32
  export declare function estimatedLabelWidth(text: string): number;
32
33
  export declare function nameLines(text: string | undefined): string[];
33
34
  /**
34
- * How the lines of a name that holds line breaks spread around the slot of its first line:
35
+ * How the lines of a name that holds line breaks spread around the slot of a one-line name:
35
36
  * `centered` keeps the block's middle on the slot (names beside a circle or a symbol), `up` keeps
36
- * the last line on it (a name above an icon, a pipeline's edge or an evolve arrow, which the lines
37
- * must stay clear of).
37
+ * the last line on it (a name above an icon, a pipeline's top edge or an evolve arrow, which the
38
+ * lines must stay clear of), `down` keeps the first line on it (a name below a pipeline's top edge).
38
39
  */
39
- export type LineGrowth = "centered" | "up";
40
+ export type LineGrowth = "centered" | "up" | "down";
40
41
  export declare function firstLineBaseline(slotY: number, lineCount: number, growth: LineGrowth): number;
41
42
  export declare function lastLineBaseline(slotY: number, lineCount: number, growth: LineGrowth): number;
43
+ /**
44
+ * How the lines of an element's own name grow, shared by the renderer and the name editor. A
45
+ * pipeline's dashed top edge runs through the centre of its anchor component, whose name grows
46
+ * upward as it does over an evolve arrow. The edge runs 11 px above the slot of a member's name:
47
+ * upward, its lines would straddle the edge and run into the anchor component's name, so they grow
48
+ * downward inside the box.
49
+ */
50
+ export declare function nameLineGrowth(shape: WardleyShape, elementRegistry: Pick<ElementRegistry, "find">): LineGrowth;
42
51
  /** The canonical OWM slot of a component name — the origin of its `label [dx, dy]`. */
43
52
  export declare function componentLabelSlot(): {
44
53
  x: number;
@@ -1 +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,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,+FAA+F;AAC/F,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEpD,MA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,cAAc,CAShB;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,IAAI;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAE1D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,CAOxE;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAKpF"}
@@ -8,8 +8,11 @@ import { default as EvolutionGrid } from '../evolution-grid/EvolutionGrid.js';
8
8
  /**
9
9
  * Excalidraw-style polyline tool: activate, click point by point (rubber-band preview).
10
10
  * Finishing (like Excalidraw): click the LAST point again, double-click, Enter or Escape
11
- * commits the open line; clicking the FIRST point closes the shape. Escape with fewer than
12
- * two points cancels. The result is ONE undoable `drawing` shape that moves as a whole.
11
+ * commits the open line, and so does Space on the tool's palette entry; clicking the FIRST point
12
+ * closes the shape. Escape with fewer than two points cancels. The result is ONE undoable
13
+ * `drawing` shape that moves as a whole. An import cancels a line in progress without committing
14
+ * it and leaves a tool without points armed. Arming another tool (the lasso) puts it down and saves
15
+ * a held line as Escape does, so one tool is armed at a time.
13
16
  */
14
17
  export default class WardleyDrawTool {
15
18
  private readonly canvas;
@@ -26,6 +29,8 @@ export default class WardleyDrawTool {
26
29
  private layer;
27
30
  constructor(canvas: Canvas, eventBus: EventBus, modeling: Modeling, selection: Selection, factory: WardleyElementFactory, grid: EvolutionGrid, injector: Injector);
28
31
  isActive(): boolean;
32
+ /** True while the tool holds the points of a line it has not finished yet. */
33
+ holdsLine(): boolean;
29
34
  toggle(): void;
30
35
  /**
31
36
  * The OUTER viewer container — getContainer() returns the inner .djs-container, but the
@@ -35,6 +40,12 @@ export default class WardleyDrawTool {
35
40
  activate(): void;
36
41
  /** Finishes the current polyline (>= 2 points) and deactivates the tool. */
37
42
  finish(): void;
43
+ /**
44
+ * Another tool took the press: the line is saved as Escape saves it, and the release is not
45
+ * reported, which would show that tool released while it is armed.
46
+ */
47
+ private giveWay;
48
+ private finishLine;
38
49
  /** Closes the shape (polygon) using the collected points. */
39
50
  private finishClosed;
40
51
  /**
@@ -58,10 +69,18 @@ export default class WardleyDrawTool {
58
69
  * Enter and Escape end the drawing only when aimed at the canvas `<svg>`, or at the palette entry
59
70
  * that starts this tool, where a tool started with Enter leaves the focus (guide §5.5). Every
60
71
  * other target keeps them, inside the container too: a host's fields, buttons, menus and dialogs,
61
- * its zoom panel, a focusable element in an overlay next to the canvas, and `<body>`. A capture
62
- * listener on the document would otherwise take them from all of these.
72
+ * its zoom panel, a focusable element in an overlay next to the canvas, `<body>` and a canvas the
73
+ * host made inert or hid. A capture listener on the document would otherwise take them from all
74
+ * of these.
63
75
  */
64
76
  private ownsKey;
77
+ private targetsOwnPaletteEntry;
78
+ /**
79
+ * Enter and Space act alike on a palette entry (guide §5.5), and Space on this tool's entry would
80
+ * otherwise toggle the tool off and drop the line it holds, where Enter saves it. A Space with
81
+ * Alt, Ctrl or Meta activates no entry and stays the page's here too.
82
+ */
83
+ private savesWithSpace;
65
84
  private readonly onKeyDown;
66
85
  private renderPreview;
67
86
  private clearPreview;
@@ -1 +1 @@
1
- {"version":3,"file":"WardleyDrawTool.d.ts","sourceRoot":"","sources":["../../src/draw-tool/WardleyDrawTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAQrC,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,SAAS,MAAM,6CAA6C,CAAC;AAGzE,OAAO,KAAK,qBAAqB,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAC;AAcpE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe;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