@miragon/wardley-renderer 0.6.3 → 0.8.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 (169) hide show
  1. package/README.md +131 -1
  2. package/dist/Modeler.d.ts +5 -0
  3. package/dist/Modeler.d.ts.map +1 -1
  4. package/dist/NavigatedViewer.d.ts.map +1 -1
  5. package/dist/WardleyBaseViewer.d.ts +90 -12
  6. package/dist/WardleyBaseViewer.d.ts.map +1 -1
  7. package/dist/a11y/canvasFocus.d.ts +17 -0
  8. package/dist/a11y/canvasFocus.d.ts.map +1 -0
  9. package/dist/a11y/describeCanvas.d.ts +8 -0
  10. package/dist/a11y/describeCanvas.d.ts.map +1 -0
  11. package/dist/a11y/index.d.ts +5 -0
  12. package/dist/a11y/index.d.ts.map +1 -0
  13. package/dist/append/WardleyAppendBehavior.d.ts +7 -6
  14. package/dist/append/WardleyAppendBehavior.d.ts.map +1 -1
  15. package/dist/collaborative/CollaborativeWardley.d.ts +27 -0
  16. package/dist/collaborative/CollaborativeWardley.d.ts.map +1 -0
  17. package/dist/collaborative/index.d.ts +2 -0
  18. package/dist/collaborative/index.d.ts.map +1 -0
  19. package/dist/color-picker/WardleyColorPicker.d.ts +10 -3
  20. package/dist/color-picker/WardleyColorPicker.d.ts.map +1 -1
  21. package/dist/context-pad/WardleyContextPad.d.ts +30 -0
  22. package/dist/context-pad/WardleyContextPad.d.ts.map +1 -0
  23. package/dist/context-pad/WardleyContextPadProvider.d.ts +23 -1
  24. package/dist/context-pad/WardleyContextPadProvider.d.ts.map +1 -1
  25. package/dist/context-pad/index.d.ts +1 -0
  26. package/dist/context-pad/index.d.ts.map +1 -1
  27. package/dist/draw/WardleyRenderer.d.ts +8 -0
  28. package/dist/draw/WardleyRenderer.d.ts.map +1 -1
  29. package/dist/draw/deprecated-icons.d.ts +35 -0
  30. package/dist/draw/deprecated-icons.d.ts.map +1 -0
  31. package/dist/draw/icons.d.ts +9 -26
  32. package/dist/draw/icons.d.ts.map +1 -1
  33. package/dist/draw/index.d.ts +2 -1
  34. package/dist/draw/index.d.ts.map +1 -1
  35. package/dist/draw/label-layout.d.ts +59 -0
  36. package/dist/draw/label-layout.d.ts.map +1 -0
  37. package/dist/draw/palette-icons.d.ts +1 -0
  38. package/dist/draw/palette-icons.d.ts.map +1 -1
  39. package/dist/draw/styles.d.ts +16 -17
  40. package/dist/draw/styles.d.ts.map +1 -1
  41. package/dist/draw-tool/WardleyDrawTool.d.ts +14 -1
  42. package/dist/draw-tool/WardleyDrawTool.d.ts.map +1 -1
  43. package/dist/draw-tool/WardleyDrawingHandles.d.ts +4 -1
  44. package/dist/draw-tool/WardleyDrawingHandles.d.ts.map +1 -1
  45. package/dist/editor-state.d.ts +56 -0
  46. package/dist/editor-state.d.ts.map +1 -0
  47. package/dist/evolution-grid/EvolutionConstraintBehavior.d.ts +58 -24
  48. package/dist/evolution-grid/EvolutionConstraintBehavior.d.ts.map +1 -1
  49. package/dist/evolution-grid/EvolutionGrid.d.ts +2 -0
  50. package/dist/evolution-grid/EvolutionGrid.d.ts.map +1 -1
  51. package/dist/evolution-grid/index.d.ts.map +1 -1
  52. package/dist/evolve/WardleyEvolveDragging.d.ts +3 -1
  53. package/dist/evolve/WardleyEvolveDragging.d.ts.map +1 -1
  54. package/dist/evolve/constants.d.ts +3 -0
  55. package/dist/evolve/constants.d.ts.map +1 -0
  56. package/dist/evolve/index.d.ts +1 -0
  57. package/dist/evolve/index.d.ts.map +1 -1
  58. package/dist/free-rect/FreeRect.d.ts +34 -0
  59. package/dist/free-rect/FreeRect.d.ts.map +1 -0
  60. package/dist/free-rect/index.d.ts +6 -0
  61. package/dist/free-rect/index.d.ts.map +1 -0
  62. package/dist/index.d.ts +28 -4
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +4967 -1941
  65. package/dist/index.js.map +1 -1
  66. package/dist/io/WardleyExporter.d.ts +3 -1
  67. package/dist/io/WardleyExporter.d.ts.map +1 -1
  68. package/dist/io/WardleyImporter.d.ts.map +1 -1
  69. package/dist/io/WardleySourceOrder.d.ts +23 -0
  70. package/dist/io/WardleySourceOrder.d.ts.map +1 -0
  71. package/dist/io/exportBounds.d.ts +15 -0
  72. package/dist/io/exportBounds.d.ts.map +1 -0
  73. package/dist/io/index.d.ts +5 -0
  74. package/dist/io/index.d.ts.map +1 -1
  75. package/dist/io/rasterize.d.ts +25 -0
  76. package/dist/io/rasterize.d.ts.map +1 -0
  77. package/dist/io/saveSvg.d.ts +1 -1
  78. package/dist/io/saveSvg.d.ts.map +1 -1
  79. package/dist/io/types.d.ts +5 -0
  80. package/dist/io/types.d.ts.map +1 -1
  81. package/dist/keyboard/WardleyKeyboard.d.ts +47 -4
  82. package/dist/keyboard/WardleyKeyboard.d.ts.map +1 -1
  83. package/dist/label-drag/WardleyLabelDragging.d.ts +58 -0
  84. package/dist/label-drag/WardleyLabelDragging.d.ts.map +1 -0
  85. package/dist/label-drag/index.d.ts +5 -0
  86. package/dist/label-drag/index.d.ts.map +1 -0
  87. package/dist/label-editing/WardleyLabelEditing.d.ts +63 -6
  88. package/dist/label-editing/WardleyLabelEditing.d.ts.map +1 -1
  89. package/dist/label-editing/fieldError.d.ts +13 -0
  90. package/dist/label-editing/fieldError.d.ts.map +1 -0
  91. package/dist/label-editing/index.d.ts +1 -0
  92. package/dist/label-editing/index.d.ts.map +1 -1
  93. package/dist/link-editing/WardleyLinkEditing.d.ts +40 -0
  94. package/dist/link-editing/WardleyLinkEditing.d.ts.map +1 -0
  95. package/dist/link-editing/index.d.ts +6 -0
  96. package/dist/link-editing/index.d.ts.map +1 -0
  97. package/dist/link-editing/link-url.d.ts +14 -0
  98. package/dist/link-editing/link-url.d.ts.map +1 -0
  99. package/dist/map-menu/AxisLabelsPopover.d.ts +10 -0
  100. package/dist/map-menu/AxisLabelsPopover.d.ts.map +1 -0
  101. package/dist/map-menu/MapSizePopover.d.ts +10 -0
  102. package/dist/map-menu/MapSizePopover.d.ts.map +1 -0
  103. package/dist/map-menu/ShortcutsDialog.d.ts +14 -0
  104. package/dist/map-menu/ShortcutsDialog.d.ts.map +1 -0
  105. package/dist/map-menu/TitleDialog.d.ts +12 -0
  106. package/dist/map-menu/TitleDialog.d.ts.map +1 -0
  107. package/dist/map-menu/dialog.d.ts +41 -0
  108. package/dist/map-menu/dialog.d.ts.map +1 -0
  109. package/dist/map-menu/dom.d.ts +9 -0
  110. package/dist/map-menu/dom.d.ts.map +1 -0
  111. package/dist/map-menu/index.d.ts +14 -0
  112. package/dist/map-menu/index.d.ts.map +1 -0
  113. package/dist/map-menu/menu.d.ts +68 -0
  114. package/dist/map-menu/menu.d.ts.map +1 -0
  115. package/dist/map-menu/popover.d.ts +52 -0
  116. package/dist/map-menu/popover.d.ts.map +1 -0
  117. package/dist/map-menu/shortcuts.d.ts +48 -0
  118. package/dist/map-menu/shortcuts.d.ts.map +1 -0
  119. package/dist/map-resize/MapProjection.d.ts +84 -0
  120. package/dist/map-resize/MapProjection.d.ts.map +1 -0
  121. package/dist/map-resize/MapResizeHandles.d.ts +59 -0
  122. package/dist/map-resize/MapResizeHandles.d.ts.map +1 -0
  123. package/dist/map-resize/ResizeAwareAutoScroll.d.ts +15 -0
  124. package/dist/map-resize/ResizeAwareAutoScroll.d.ts.map +1 -0
  125. package/dist/map-resize/index.d.ts +14 -0
  126. package/dist/map-resize/index.d.ts.map +1 -0
  127. package/dist/model/WardleyElementFactory.d.ts +36 -2
  128. package/dist/model/WardleyElementFactory.d.ts.map +1 -1
  129. package/dist/modeling/WardleyCopyPaste.d.ts +9 -5
  130. package/dist/modeling/WardleyCopyPaste.d.ts.map +1 -1
  131. package/dist/modeling/WardleyModeling.d.ts +16 -2
  132. package/dist/modeling/WardleyModeling.d.ts.map +1 -1
  133. package/dist/modeling/cmd/ResizeMapHandler.d.ts +24 -0
  134. package/dist/modeling/cmd/ResizeMapHandler.d.ts.map +1 -0
  135. package/dist/modeling/cmd/UpdateConfigHandler.d.ts +42 -0
  136. package/dist/modeling/cmd/UpdateConfigHandler.d.ts.map +1 -0
  137. package/dist/modeling/index.d.ts +2 -0
  138. package/dist/modeling/index.d.ts.map +1 -1
  139. package/dist/ordering/WardleyOrderingProvider.d.ts +1 -1
  140. package/dist/ordering/WardleyOrderingProvider.d.ts.map +1 -1
  141. package/dist/palette/WardleyPaletteKeyboard.d.ts +26 -0
  142. package/dist/palette/WardleyPaletteKeyboard.d.ts.map +1 -0
  143. package/dist/palette/WardleyPaletteProvider.d.ts +20 -1
  144. package/dist/palette/WardleyPaletteProvider.d.ts.map +1 -1
  145. package/dist/palette/index.d.ts +2 -1
  146. package/dist/palette/index.d.ts.map +1 -1
  147. package/dist/pan-constraint/PanConstraint.d.ts +24 -2
  148. package/dist/pan-constraint/PanConstraint.d.ts.map +1 -1
  149. package/dist/pipeline/PipelineGroupBehavior.d.ts +24 -0
  150. package/dist/pipeline/PipelineGroupBehavior.d.ts.map +1 -0
  151. package/dist/pipeline/index.d.ts +6 -0
  152. package/dist/pipeline/index.d.ts.map +1 -0
  153. package/dist/pipeline/pipelineMembership.d.ts +23 -0
  154. package/dist/pipeline/pipelineMembership.d.ts.map +1 -0
  155. package/dist/popup/WardleyElementSettingsProvider.d.ts +2 -1
  156. package/dist/popup/WardleyElementSettingsProvider.d.ts.map +1 -1
  157. package/dist/read-only/WardleyReadOnly.d.ts +27 -0
  158. package/dist/read-only/WardleyReadOnly.d.ts.map +1 -0
  159. package/dist/read-only/index.d.ts +7 -0
  160. package/dist/read-only/index.d.ts.map +1 -0
  161. package/dist/rules/WardleyRules.d.ts.map +1 -1
  162. package/dist/snapping/StageSnapping.d.ts +6 -2
  163. package/dist/snapping/StageSnapping.d.ts.map +1 -1
  164. package/dist/theme/index.d.ts +1 -1
  165. package/dist/theme/index.d.ts.map +1 -1
  166. package/dist/theme/palette.d.ts +28 -29
  167. package/dist/theme/palette.d.ts.map +1 -1
  168. package/dist/wardley.css +1 -1
  169. package/package.json +10 -9
@@ -0,0 +1,41 @@
1
+ /** What a dialog needs of the chrome around the map; a `@miragon/modeler-shell` handle fits. */
2
+ export interface DialogChrome {
3
+ /** Where the dialog lives (the shell root), so it shares the chrome's mode and fonts. */
4
+ readonly root: HTMLElement;
5
+ readonly messages: {
6
+ readonly close: string;
7
+ };
8
+ /** The control the focus returns to once the dialog closes. */
9
+ readonly menu: {
10
+ readonly trigger: HTMLElement;
11
+ };
12
+ }
13
+ export interface MapDialog {
14
+ open(): void;
15
+ isOpen(): boolean;
16
+ close(): void;
17
+ destroy(): void;
18
+ }
19
+ export interface MapDialogParts {
20
+ /** Class of the `<dialog>` next to `wardley-dialog`, for the dialog's own rules. */
21
+ readonly className: string;
22
+ readonly title: string;
23
+ /** The parts below the header (body, footer), built once on the first open. */
24
+ content(close: () => void): Node[];
25
+ /** Runs before every open, while the dialog is still closed. */
26
+ beforeOpen?(): void;
27
+ /** Runs after every open, once the dialog shows and holds the focus. */
28
+ afterOpen?(): void;
29
+ /** Runs after every close, before the focus goes back. */
30
+ afterClose?(): void;
31
+ }
32
+ /** A footer button of guide §8: primary (the confirming action), secondary or ghost. */
33
+ export declare function dialogButton(label: string, variant: 'primary' | 'secondary' | 'ghost'): HTMLButtonElement;
34
+ /**
35
+ * A dialog of the map's chrome (guide §8, "Modeler dialogs" of the shell's API): a native modal
36
+ * <dialog> inside the chrome's root, so the browser keeps the focus inside it and closes it on
37
+ * Escape. Built on the first open and kept (closed) afterwards; `destroy()` removes it. The host
38
+ * calls it with the diagram's teardown, since the chrome removes only what it added itself.
39
+ */
40
+ export declare function createMapDialog(chrome: DialogChrome, parts: MapDialogParts): MapDialog;
41
+ //# sourceMappingURL=dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/map-menu/dialog.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,MAAM,WAAW,YAAY;IAC3B,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;CAClD;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,OAAO,CAAC;IAClB,KAAK,IAAI,IAAI,CAAC;IACd,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,OAAO,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,EAAE,CAAC;IACnC,gEAAgE;IAChE,UAAU,CAAC,IAAI,IAAI,CAAC;IACpB,wEAAwE;IACxE,SAAS,CAAC,IAAI,IAAI,CAAC;IACnB,0DAA0D;IAC1D,UAAU,CAAC,IAAI,IAAI,CAAC;CACrB;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GACzC,iBAAiB,CAKnB;AAoBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,GAAG,SAAS,CA8CtF"}
@@ -0,0 +1,9 @@
1
+ /*! @miragon/wardley-renderer icon geometry: x. Lucide (lucide-static 1.59.0) @license ISC
2
+ * Copyright (c) 2026 Lucide Icons and Contributors
3
+ * Derived from Feather @license MIT, Copyright (c) 2013-present Cole Bemis
4
+ * Full notices: README.md of @miragon/wardley-renderer */
5
+ /** Lucide `x` (lucide-static 1.59.0, ISC; derived from Feather, MIT) at the chrome size of §5.14. */
6
+ export declare const CLOSE_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/></svg>";
7
+ export declare function element<K extends keyof HTMLElementTagNameMap>(tag: K, className: string, text?: string): HTMLElementTagNameMap[K];
8
+ export declare function uniqueId(prefix: string): string;
9
+ //# sourceMappingURL=dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/map-menu/dom.ts"],"names":[],"mappings":"AAAA;;;0DAG0D;AAC1D,qGAAqG;AACrG,eAAO,MAAM,UAAU,6SAC2P,CAAC;AAEnR,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAC3D,GAAG,EAAE,CAAC,EACN,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,GACZ,qBAAqB,CAAC,CAAC,CAAC,CAK1B;AAID,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG/C"}
@@ -0,0 +1,14 @@
1
+ export { mapMenu, EXPORT_LABELS } from './menu.js';
2
+ export type { MapExport, MapExports, MapMenu, MapMenuAction, MapMenuActions, MapMenuDialog, MapMenuEntry, MapMenuIcon, } from './menu.js';
3
+ export { mapShortcuts } from './shortcuts.js';
4
+ export type { MapShortcutOptions, ShortcutGroup, ShortcutKeyNames, ShortcutPlatform, ShortcutRow, ShortcutsChrome, } from './shortcuts.js';
5
+ export { createMapDialog, dialogButton } from './dialog.js';
6
+ export type { DialogChrome, MapDialog, MapDialogParts } from './dialog.js';
7
+ export { createShortcutsDialog } from './ShortcutsDialog.js';
8
+ export type { ShortcutsDialog, ShortcutsDialogChrome } from './ShortcutsDialog.js';
9
+ export { createTitleDialog } from './TitleDialog.js';
10
+ export type { TitleDialog, TitleDialogChrome } from './TitleDialog.js';
11
+ export { createMapSizePopover } from './MapSizePopover.js';
12
+ export { createAxisLabelsPopover } from './AxisLabelsPopover.js';
13
+ export type { PopoverChrome, PopoverHandle } from './popover.js';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/map-menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACnD,YAAY,EACV,SAAS,EACT,UAAU,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,68 @@
1
+ /** The icons the guide gives these entries (guide §5.14, the shell's common set). */
2
+ export type MapMenuIcon = 'file-image' | 'file-code-corner' | 'keyboard';
3
+ interface MapMenuItem {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ readonly icon?: MapMenuIcon;
7
+ readonly keepEnabledWhenReadOnly?: boolean;
8
+ }
9
+ export interface MapMenuAction extends MapMenuItem {
10
+ readonly kind: 'action';
11
+ readonly shortcut?: string;
12
+ onSelect(): void;
13
+ }
14
+ export interface MapMenuDialog extends MapMenuItem {
15
+ readonly kind: 'dialog';
16
+ /** The chip of a key that opens the dialog as well, e.g. "?". */
17
+ readonly shortcut?: string;
18
+ onSelect(): void;
19
+ }
20
+ export type MapMenuEntry = MapMenuAction | MapMenuDialog;
21
+ export interface MapMenu {
22
+ readonly model: readonly MapMenuEntry[];
23
+ readonly export: readonly MapMenuEntry[];
24
+ readonly help: readonly MapMenuEntry[];
25
+ }
26
+ export interface MapExport {
27
+ onSelect(): void;
28
+ /** The chip of an app key that runs the same export, e.g. "⌘S". */
29
+ readonly shortcut?: string | undefined;
30
+ }
31
+ /**
32
+ * The exports a host offers, in the guide's order: PNG first (the more frequent target), then
33
+ * SVG, then the variants, then further formats. Only the web app adds the map file itself, which
34
+ * in VS Code is the document.
35
+ */
36
+ export interface MapExports {
37
+ readonly png: MapExport;
38
+ readonly svg: MapExport;
39
+ readonly transparentPng?: MapExport | undefined;
40
+ readonly json?: MapExport | undefined;
41
+ readonly wmap?: MapExport | undefined;
42
+ }
43
+ export interface MapMenuActions {
44
+ /** Opens the "Map title…" dialog; without it the Model group has no title entry. */
45
+ mapTitle?: (() => void) | undefined;
46
+ /** Opens the "Map size…" popover. */
47
+ mapSize(): void;
48
+ /** Opens the "X-axis labels…" popover. */
49
+ axisLabels(): void;
50
+ readonly exports: MapExports;
51
+ showKeyboardShortcuts(): void;
52
+ }
53
+ /** The labels of the export entries, also used by the hosts' commands and notifications. */
54
+ export declare const EXPORT_LABELS: {
55
+ readonly png: "Export as PNG";
56
+ readonly svg: "Export as SVG";
57
+ readonly transparentPng: "Export as PNG (4×, transparent)";
58
+ readonly json: "Export as JSON";
59
+ readonly wmap: "Export as .wmap";
60
+ };
61
+ /**
62
+ * The menu groups of a map (guide §5.4): Model with the title dialog where the host offers it and
63
+ * the two popovers (all three change the document, so a read-only canvas disables them), Export
64
+ * with PNG first, Help with the shortcuts dialog.
65
+ */
66
+ export declare function mapMenu(actions: MapMenuActions): MapMenu;
67
+ export {};
68
+ //# sourceMappingURL=menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/map-menu/menu.ts"],"names":[],"mappings":"AAMA,qFAAqF;AACrF,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,kBAAkB,GAAG,UAAU,CAAC;AAEzE,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAC5C;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,aAAa,CAAC;AAEzD,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,IAAI,IAAI,CAAC;IACjB,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACpC,qCAAqC;IACrC,OAAO,IAAI,IAAI,CAAC;IAChB,0CAA0C;IAC1C,UAAU,IAAI,IAAI,CAAC;IACnB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,qBAAqB,IAAI,IAAI,CAAC;CAC/B;AAED,4FAA4F;AAC5F,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAiCX;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CA6BxD"}
@@ -0,0 +1,52 @@
1
+ import { Modeler } from '../Modeler.js';
2
+ /** What a popover needs of the chrome around the map; a `@miragon/modeler-shell` handle fits. */
3
+ export interface PopoverChrome {
4
+ /** Where the popover lives (the shell root): it anchors at the dropdown's place there. */
5
+ readonly root: HTMLElement;
6
+ /** The control the focus returns to after Escape or Done. */
7
+ readonly menu: {
8
+ readonly trigger: HTMLElement;
9
+ };
10
+ }
11
+ /** Why a popover closes: the user is done, an import replaced the map, or the canvas locked. */
12
+ export type PopoverEnd = 'done' | 'import' | 'cancel';
13
+ export interface PopoverHandle {
14
+ open(): void;
15
+ isOpen(): boolean;
16
+ /** Closes as if the user were done: the previewed change becomes one edit. */
17
+ close(): void;
18
+ destroy(): void;
19
+ }
20
+ export interface PopoverParts {
21
+ readonly className: string;
22
+ readonly title: string;
23
+ /** Fills the body (fields) and the footer (buttons) once; `done` closes like Done. */
24
+ build(body: HTMLElement, footer: HTMLElement, done: () => void): void;
25
+ /** Reads the map into the fields on every open; returns the field to focus. */
26
+ opened(): HTMLElement | undefined;
27
+ /** Commits the preview (`done`) or drops it (`import`: the map is gone, `cancel`: revert). */
28
+ closed(end: PopoverEnd): void;
29
+ }
30
+ /**
31
+ * A popover of guide §5.4: a menu entry that needs the canvas preview opens it at the dropdown's
32
+ * place, without a backdrop, as a non-modal `role="dialog"` labelled by its title. Escape and a
33
+ * click outside close it; the focus returns to the menu trigger after Escape and Done, while a
34
+ * click outside leaves it on what was clicked.
35
+ */
36
+ export declare function createPopover(chrome: PopoverChrome, parts: PopoverParts): PopoverHandle & {
37
+ end(end: PopoverEnd): void;
38
+ };
39
+ /** A labelled field of guide §8: the label above, 4px apart, an error below it when refused. */
40
+ export declare function field(label: string, control: HTMLInputElement | HTMLSelectElement): {
41
+ wrapper: HTMLElement;
42
+ showError(message: string): void;
43
+ clearError(): void;
44
+ };
45
+ /**
46
+ * Closes `popover` without committing when the map is replaced (an import: the preview went with
47
+ * the old map) or turns read-only (the preview is put back), and stops listening on destroy.
48
+ */
49
+ export declare function withMapListeners(modeler: Modeler, popover: PopoverHandle & {
50
+ end(end: PopoverEnd): void;
51
+ }): PopoverHandle;
52
+ //# sourceMappingURL=popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/map-menu/popover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C,iGAAiG;AACjG,MAAM,WAAW,aAAa;IAC5B,0FAA0F;IAC1F,QAAQ,CAAC,IAAI,EAAE,WAA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AE,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAA;CAAE,GACtD,aAAa,CAiBf"}
@@ -0,0 +1,48 @@
1
+ export type ShortcutPlatform = 'mac' | 'other';
2
+ export interface ShortcutKeyNames {
3
+ readonly ctrl: string;
4
+ readonly shift: string;
5
+ readonly plus: string;
6
+ readonly minus: string;
7
+ }
8
+ /** What the shortcuts need of the chrome around the map. */
9
+ export interface ShortcutsChrome {
10
+ readonly platform: ShortcutPlatform;
11
+ /** The tool's UI language, for the percentage in "Zoom to 100%". */
12
+ readonly lang: string;
13
+ readonly messages: {
14
+ readonly zoomIn: string;
15
+ readonly zoomOut: string;
16
+ zoomToActual(percent: string): string;
17
+ readonly fit: string;
18
+ /** The File group's "Open…" (the shell's `messages.openFile`); default "Open…". */
19
+ readonly openFile?: string | undefined;
20
+ readonly keyNames: ShortcutKeyNames;
21
+ };
22
+ }
23
+ /** Keys a web app binds itself, next to the canvas's and the chrome's. */
24
+ export interface MapShortcutOptions {
25
+ /**
26
+ * Cmd/Ctrl+O opens a file, Cmd/Ctrl+S exports the .wmap file and Cmd/Ctrl+V opens OWM text or a
27
+ * share link pasted onto the canvas: a File group comes first.
28
+ */
29
+ readonly fileKeys?: boolean | undefined;
30
+ /** The key that opens the dialog itself, e.g. "?", listed in the View group. */
31
+ readonly shortcutsKey?: string | undefined;
32
+ }
33
+ export interface ShortcutRow {
34
+ readonly action: string;
35
+ /** Alternative keys or gestures, each shown as its own chip. */
36
+ readonly keys: readonly string[];
37
+ }
38
+ export interface ShortcutGroup {
39
+ readonly title: string;
40
+ readonly rows: readonly ShortcutRow[];
41
+ }
42
+ /**
43
+ * Every shortcut of a map, grouped as guide §5.4 asks: View (the chrome's zoom keys), Edit, the
44
+ * notation's tools and the gestures on the map itself, after the web app's File keys where it
45
+ * binds them.
46
+ */
47
+ export declare function mapShortcuts(chrome: ShortcutsChrome, options?: MapShortcutOptions): ShortcutGroup[];
48
+ //# sourceMappingURL=shortcuts.d.ts.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IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;CACvC;AAsDD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,kBAAuB,GAC/B,aAAa,EAAE,CAuEjB"}
@@ -0,0 +1,84 @@
1
+ import { default as Canvas } from 'diagram-js/lib/core/Canvas';
2
+ import { default as ElementRegistry } from 'diagram-js/lib/core/ElementRegistry';
3
+ import { default as EventBus } from 'diagram-js/lib/core/EventBus';
4
+ import { default as BaseLayouter } from 'diagram-js/lib/layout/BaseLayouter';
5
+ import { Element, Root } from 'diagram-js/lib/model/Types';
6
+ import { Point } from 'diagram-js/lib/util/Types';
7
+ import { MapConfig, MapSize, WardleyMap } from '@miragon/wardley-schema-model';
8
+ import { default as EvolutionGrid } from '../evolution-grid/EvolutionGrid.js';
9
+ import { default as WardleyExporter } from '../io/WardleyExporter.js';
10
+ import { RootBusinessObject } from '../io/index.js';
11
+ import { default as WardleyElementFactory } from '../model/WardleyElementFactory.js';
12
+ export type WardleyRoot = Root & {
13
+ businessObject?: RootBusinessObject;
14
+ };
15
+ interface ShapeGeometry {
16
+ readonly x: number;
17
+ readonly y: number;
18
+ readonly width: number;
19
+ readonly height: number;
20
+ readonly drawingPoints?: Array<{
21
+ x: number;
22
+ y: number;
23
+ }>;
24
+ }
25
+ /** Exact pixel state of the map, to undo a live preview without any rounding or clamping. */
26
+ export interface ProjectionSnapshot {
27
+ readonly businessObject: RootBusinessObject;
28
+ readonly shapes: ReadonlyMap<string, ShapeGeometry>;
29
+ readonly waypoints: ReadonlyMap<string, Point[]>;
30
+ }
31
+ /** `config` with `size` set, or without the key when `size` is undefined. */
32
+ export declare function configWithSize(config: MapConfig, size: MapSize | undefined): MapConfig;
33
+ /**
34
+ * The imported Wardley root, or undefined before the first import. Unlike
35
+ * `canvas.getRootElement()` this never creates diagram-js's implicit root, which the next
36
+ * import's `clear()` would remove and so break `setRootElement`.
37
+ */
38
+ export declare function wardleyRootOf(canvas: Canvas): WardleyRoot | undefined;
39
+ /**
40
+ * `rawPassthrough` without unreadable `size` statements: once the map writes a valid size, a kept
41
+ * one would be written after it, and OWM lets the last size line win. Comment text is never dropped.
42
+ */
43
+ export declare function withoutRawSizeStatements(rawPassthrough: readonly string[] | undefined): readonly string[] | undefined;
44
+ /**
45
+ * Re-projects the live shapes onto a new plot size in place — no re-import, so the shape objects,
46
+ * the selection and the undo history survive. The normalized model is the truth; every element is
47
+ * placed by the same factory projection the importer uses (P7), so a resize looks exactly like a
48
+ * fresh import at the new size.
49
+ */
50
+ export default class MapProjection {
51
+ private readonly canvas;
52
+ private readonly elementRegistry;
53
+ private readonly grid;
54
+ private readonly factory;
55
+ private readonly exporter;
56
+ private readonly layouter;
57
+ private readonly eventBus;
58
+ static $inject: string[];
59
+ constructor(canvas: Canvas, elementRegistry: ElementRegistry, grid: EvolutionGrid, factory: WardleyElementFactory, exporter: WardleyExporter, layouter: BaseLayouter, eventBus: EventBus);
60
+ /** The Wardley root, or undefined before the first import. */
61
+ root(): WardleyRoot | undefined;
62
+ /** The normalized truth, read under the CURRENT grid (drawings keep px-relative points). */
63
+ captureModel(): WardleyMap;
64
+ /**
65
+ * Stores `businessObject` on the root, redraws the grid for its config and re-projects every
66
+ * element of `model` onto it. Fires `wardley.config.changed`; returns the changed elements so
67
+ * the caller (command stack or live preview) can redraw them.
68
+ */
69
+ apply(businessObject: RootBusinessObject, model?: WardleyMap, options?: {
70
+ transient?: boolean;
71
+ }): Element[];
72
+ snapshot(): ProjectionSnapshot | undefined;
73
+ /** Puts the map back exactly as it was when `snapshot` was taken. */
74
+ restore(snapshot: ProjectionSnapshot, options?: {
75
+ transient?: boolean;
76
+ }): Element[];
77
+ /** `transient` marks a live preview that is not part of the document (yet). */
78
+ private fireConfigChanged;
79
+ /** Redraws elements changed outside the command stack (the live preview). */
80
+ redraw(elements: readonly Element[]): void;
81
+ private layoutConnections;
82
+ }
83
+ export {};
84
+ //# sourceMappingURL=MapProjection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapProjection.d.ts","sourceRoot":"","sources":["../../src/map-resize/MapProjection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEpF,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,eAAe,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAW,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,qBAAqB,MAAM,mCAAmC,CAAC;AAG3E,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG;IAAE,cAAc,CAAC,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAEzE,UAAU,aAAa;IACrB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1D;AAED,6FAA6F;AAC7F,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,cAA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AAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAO,GACpC,OAAO,EAAE;IAqBZ,QAAQ,IAAI,kBAAkB,GAAG,SAAS;IA0B1C,qEAAqE;IACrE,OAAO,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,EAAE;IAuBvF,+EAA+E;IAC/E,OAAO,CAAC,iBAAiB;IAIzB,6EAA6E;IAC7E,MAAM,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAI1C,OAAO,CAAC,iBAAiB;CAS1B"}
@@ -0,0 +1,59 @@
1
+ import { Injector } from 'didi';
2
+ import { default as Canvas } from 'diagram-js/lib/core/Canvas';
3
+ import { default as EventBus } from 'diagram-js/lib/core/EventBus';
4
+ import { default as Dragging } from 'diagram-js/lib/features/dragging/Dragging';
5
+ import { MapSize } from '@miragon/wardley-schema-model';
6
+ import { default as EvolutionGrid } from '../evolution-grid/EvolutionGrid.js';
7
+ import { default as MapProjection } from './MapProjection.js';
8
+ export declare const MAP_RESIZE_PREFIX = "wardley.mapResize";
9
+ export type ResizeAxis = 'x' | 'y' | 'xy';
10
+ interface ModifierKeys {
11
+ /** Keep the start aspect ratio. */
12
+ keepAspectRatio: boolean;
13
+ /** Free size: no 10px steps, no preset magnet. */
14
+ disableSnapping: boolean;
15
+ }
16
+ /** The part of `wardleyModeling` the handles use (by DI name, to keep the features decoupled). */
17
+ interface MapResizeModeling {
18
+ resizeMap(size: MapSize | undefined): void;
19
+ }
20
+ /**
21
+ * The size a drag from `start` by (dx, dy) on `axis` asks for: 10px steps with a magnetic pull
22
+ * towards the presets, Shift keeps the start aspect ratio, always whole pixels within the limits.
23
+ */
24
+ export declare function sizeForDrag(start: MapSize, axis: ResizeAxis, dx: number, dy: number, keys?: ModifierKeys): MapSize;
25
+ /** "1440 × 900 · Large" — the preset name only when the size matches one exactly. */
26
+ export declare function sizeLabel(size: MapSize): string;
27
+ /**
28
+ * Direct manipulation of the map size: handles on the plot's right edge, bottom edge and
29
+ * bottom-right corner. The drag previews live (grid and shapes re-projected, no command stack);
30
+ * on release the preview is undone and exactly ONE `wardley.map.resize` runs, so a drag is one
31
+ * undo step. Esc cancels; a double-click on the corner resets to the default size.
32
+ */
33
+ export default class MapResizeHandles {
34
+ private readonly canvas;
35
+ private readonly grid;
36
+ private readonly dragging;
37
+ private readonly projection;
38
+ private readonly modeling;
39
+ private readonly injector;
40
+ static $inject: string[];
41
+ private readonly layer;
42
+ private readonly handles;
43
+ private badge;
44
+ private scale;
45
+ constructor(eventBus: EventBus, canvas: Canvas, grid: EvolutionGrid, dragging: Dragging, projection: MapProjection, modeling: MapResizeModeling, injector: Injector);
46
+ /** Starts a resize drag on `axis` (also usable programmatically, e.g. from tests). */
47
+ start(event: MouseEvent, axis: ResizeAxis): void;
48
+ private createHandle;
49
+ private render;
50
+ private currentScale;
51
+ private onStart;
52
+ private onMove;
53
+ private onEnd;
54
+ private onCleanup;
55
+ private showBadge;
56
+ private hideBadge;
57
+ }
58
+ export {};
59
+ //# sourceMappingURL=MapResizeHandles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapResizeHandles.d.ts","sourceRoot":"","sources":["../../src/map-resize/MapResizeHandles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,EAKL,KAAK,OAAO,EAEb,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AAGpD,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAcrD,MAAM,MAAM,UAAU,GAAG,G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,GAAG,IAAI;IAUhD,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,MAAM;IA8Cd,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,MAAM;IAmBd,OAAO,CAAC,KAAK;IAYb,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,SAAS;IAiBjB,OAAO,CAAC,SAAS;CAGlB"}
@@ -0,0 +1,15 @@
1
+ import { default as AutoScroll } from 'diagram-js/lib/features/auto-scroll/AutoScroll';
2
+ import { default as Canvas } from 'diagram-js/lib/core/Canvas';
3
+ import { default as EventBus } from 'diagram-js/lib/core/EventBus';
4
+ import { Injector } from 'didi';
5
+ /**
6
+ * diagram-js AutoScroll, except while the map is being resized: scrolling under a dragged plot
7
+ * corner detaches it from the pointer, and the size jumps on the next move.
8
+ */
9
+ export default class ResizeAwareAutoScroll extends AutoScroll {
10
+ private readonly injector;
11
+ static $inject: string[];
12
+ constructor(config: unknown, eventBus: EventBus, canvas: Canvas, injector: Injector);
13
+ startScroll(point: Parameters<AutoScroll['startScroll']>[0]): void;
14
+ }
15
+ //# sourceMappingURL=ResizeAwareAutoScroll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizeAwareAutoScroll.d.ts","sourceRoot":"","sources":["../../src/map-resize/ResizeAwareAutoScroll.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,gDAAgD,CAAC;AACxE,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAGrC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,UAAU;IAOzD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAN3B,OAAgB,OAAO,WAA2D;gBAGhF,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACG,QAAQ,EAAE,QAAQ;IAK5B,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;CAQ5E"}
@@ -0,0 +1,14 @@
1
+ import { ModuleDeclaration } from 'didi';
2
+ /** In-place re-projection of all shapes onto a new plot size (used by `wardley.map.resize`). */
3
+ export declare const mapProjectionModule: ModuleDeclaration;
4
+ /**
5
+ * Plot edge/corner handles to resize the map by dragging (Modeler only). Needs the
6
+ * `wardleyModeling` service, i.e. load it together with `wardleyModelingModule`.
7
+ */
8
+ export declare const mapResizeModule: ModuleDeclaration;
9
+ export { default as MapResizeHandles, MAP_RESIZE_PREFIX, sizeForDrag, sizeLabel, } from './MapResizeHandles.js';
10
+ export type { ResizeAxis } from './MapResizeHandles.js';
11
+ export { default as MapProjection, configWithSize, withoutRawSizeStatements, wardleyRootOf, } from './MapProjection.js';
12
+ export type { ProjectionSnapshot, WardleyRoot } from './MapProjection.js';
13
+ export { default as ResizeAwareAutoScroll } from './ResizeAwareAutoScroll.js';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/map-resize/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C,gGAAgG;AAChG,eAAO,MAAM,mBAAmB,EAAE,iBAEjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,iBAI7B,CAAC;AAEF,OAAO,EACL,OAAO,IAAI,gBAAgB,EAC3B,iBAAiB,EACjB,WAAW,EACX,SAAS,GACV,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,OAAO,IAAI,aAAa,EACxB,cAAc,EACd,wBAAwB,EACxB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1,8 +1,13 @@
1
1
  import { default as ElementFactory } from 'diagram-js/lib/core/ElementFactory';
2
2
  import { default as ElementRegistry } from 'diagram-js/lib/core/ElementRegistry';
3
- import { AcceleratorDirection, AcceleratorElement, AnchorElement, AnnotationElement, AttitudeElement, AttitudeKind, ComponentElement, DrawingElement, MapEdge, NoteElement, PipelineElement, SubmapElement } from '@miragon/wardley-schema-model';
3
+ import { AcceleratorDirection, AcceleratorElement, AnchorElement, AnnotationElement, AttitudeElement, AttitudeKind, ComponentElement, DrawingElement, MapEdge, MapElement, NoteElement, PipelineElement, SubmapElement } from '@miragon/wardley-schema-model';
4
4
  import { default as EvolutionGrid } from '../evolution-grid/EvolutionGrid.js';
5
5
  import { WardleyConnection, WardleyShape } from './di-types.js';
6
+ /**
7
+ * First label not in `taken`: `base` itself, otherwise the next counter. A base that already ends
8
+ * in a counter continues it ('Cup 2' -> 'Cup 3') instead of stacking ('Cup 2 2').
9
+ */
10
+ export declare function nextFreeLabel(base: string, taken: ReadonlySet<string>): string;
6
11
  export interface CreateNewExtra {
7
12
  attitudeKind?: AttitudeKind;
8
13
  acceleratorDirection?: AcceleratorDirection;
@@ -23,12 +28,36 @@ export default class WardleyElementFactory {
23
28
  /**
24
29
  * Returns a unique label: `base`, otherwise `base 2`, `base 3`, … Unique labels are mandatory
25
30
  * because the OWM DSL references elements BY THEIR NAME — duplicate names would cause ID
26
- * collisions on serialize/re-import and lose edges (lines).
31
+ * collisions on serialize/re-import and lose edges (lines). Only linkable elements count:
32
+ * notes and regions are never referenced, so their text must not force a suffix.
27
33
  *
28
34
  * @param excludeId optional ID of the element currently being renamed (does NOT count its own
29
35
  * current name as a collision — otherwise every rename would add a suffix).
30
36
  */
31
37
  uniqueLabel(base: string, excludeId?: string): string;
38
+ /**
39
+ * Batch variant for pasted copies: linkable labels unique against the map AND each other;
40
+ * everything else keeps its text.
41
+ */
42
+ uniqueLabels(entries: ReadonlyArray<{
43
+ type: unknown;
44
+ label: string;
45
+ }>): string[];
46
+ /** Whether elements of `type` are referenced by name (and so need a unique label). */
47
+ isLinkable(type: unknown): boolean;
48
+ /**
49
+ * @param pairableType elements of this type that still lack their OWM partner do not block a
50
+ * name: a standalone component may take the name of a pipeline without an anchor (and so
51
+ * anchor it), and such a pipeline may take the name of a free standalone component.
52
+ */
53
+ private takenLinkableLabels;
54
+ /** Which partner type the element being renamed may share its new name with. */
55
+ private pairableTypeFor;
56
+ /**
57
+ * A pipeline without an anchor component, or a standalone (non-member) component that anchors
58
+ * no pipeline. Members never pair: they belong to their own pipeline.
59
+ */
60
+ private isUnpaired;
32
61
  /** Next free annotation number (max + 1) — palette annotations therefore never collide. */
33
62
  private nextAnnotationNumber;
34
63
  createComponent(el: ComponentElement): WardleyShape;
@@ -40,6 +69,11 @@ export default class WardleyElementFactory {
40
69
  createAttitude(el: AttitudeElement): WardleyShape;
41
70
  createSubmap(el: SubmapElement): WardleyShape;
42
71
  createDrawing(el: DrawingElement): WardleyShape;
72
+ /**
73
+ * The shape for any model element, projected with the current grid. Shared by the importer and
74
+ * the in-place map resize, so both place every element type identically.
75
+ */
76
+ createFromModel(el: MapElement): WardleyShape | undefined;
43
77
  /** Builds a drawing shape from ABSOLUTE canvas points (bbox shape + relative points). */
44
78
  drawingFromCanvasPoints(canvasPoints: ReadonlyArray<{
45
79
  x: number;
@@ -1 +1 @@
1
- {"version":3,"file":"WardleyElementFactory.d.ts","sourceRoot":"","sources":["../../src/model/WardleyElementFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,Y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1,10 @@
1
1
  import { default as ElementFactory } from 'diagram-js/lib/core/ElementFactory';
2
- import { default as ElementRegistry } from 'diagram-js/lib/core/ElementRegistry';
3
2
  import { default as Canvas } from 'diagram-js/lib/core/Canvas';
4
3
  import { default as Create } from 'diagram-js/lib/features/create/Create';
5
4
  import { default as Modeling } from 'diagram-js/lib/features/modeling/Modeling';
6
5
  import { default as Mouse } from 'diagram-js/lib/features/mouse/Mouse';
7
6
  import { default as Selection } from 'diagram-js/lib/features/selection/Selection';
7
+ import { default as WardleyElementFactory } from '../model/WardleyElementFactory.js';
8
8
  /**
9
9
  * Custom copy/paste for Wardley shapes: copies the selection including the connections BETWEEN
10
10
  * selected shapes and assigns unique labels (the DSL references by name!).
@@ -16,14 +16,14 @@ export default class WardleyCopyPaste {
16
16
  private readonly selection;
17
17
  private readonly modeling;
18
18
  private readonly elementFactory;
19
- private readonly elementRegistry;
20
19
  private readonly canvas;
21
20
  private readonly create;
22
21
  private readonly mouse;
22
+ private readonly wardleyElementFactory;
23
23
  static $inject: string[];
24
24
  private clipboard;
25
25
  private pasteCount;
26
- constructor(selection: Selection, modeling: Modeling, elementFactory: ElementFactory, elementRegistry: ElementRegistry, canvas: Canvas, create: Create, mouse: Mouse);
26
+ constructor(selection: Selection, modeling: Modeling, elementFactory: ElementFactory, canvas: Canvas, create: Create, mouse: Mouse, wardleyElementFactory: WardleyElementFactory);
27
27
  /** Copies the current selection. Returns false if nothing copyable is selected. */
28
28
  copy(): boolean;
29
29
  /**
@@ -36,9 +36,13 @@ export default class WardleyCopyPaste {
36
36
  duplicate(): boolean;
37
37
  /** Builds fresh clone elements (unique labels, internal connections rewired). */
38
38
  private buildClones;
39
+ /**
40
+ * Unique labels for the clones. A pipeline copied together with its anchor component (the
41
+ * component written under the pipeline's name) keeps that pairing: both get the same new name,
42
+ * otherwise the copy loses its anchor and the renamed component would join a box as a member.
43
+ */
44
+ private cloneLabels;
39
45
  /** One `elements.create` command = one undo step; position = group center + offset. */
40
46
  private insertWithOffset;
41
- /** Labels unique against the registry AND within the paste batch. */
42
- private uniqueLabels;
43
47
  }
44
48
  //# sourceMappingURL=WardleyCopyPaste.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WardleyCopyPaste.d.ts","sourceRoot":"","sources":["../../src/modeling/WardleyCopyPaste.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,MAAM,MAAM,uCAAuC,CAAC;AAChE,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,qCAAqC,CAAC;AAC7D,OAAO,KAAK,SAAS,MAAM,6CAA6C,CAAC;AA4DzE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAejC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IApBxB,MAAM,CAAC,OAAO,WAQZ;IAEF,OAAO,CAAC,SAAS,CAA+E;IAChG,OAAO,CAAC,UAAU,CAAK;gBAGJ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,EAC9B,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK;IAG/B,mFAAmF;IACnF,IAAI,IAAI,OAAO;IAsCf;;;;OAIG;IACH,KAAK,IAAI,OAAO;IAWhB,oFAAoF;IACpF,SAAS,IAAI,OAAO;I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pF,SAAS,IAAI,OAAO;IAKpB,iFAAiF;IACjF,OAAO,CAAC,WAAW;IAsCnB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IA8BnB,uFAAuF;IACvF,OAAO,CAAC,gBAAgB;CAYzB"}
@@ -1,6 +1,10 @@
1
1
  import { default as CommandStack } from 'diagram-js/lib/command/CommandStack';
2
- import { Method } from '@miragon/wardley-schema-model';
2
+ import { default as Canvas } from 'diagram-js/lib/core/Canvas';
3
+ import { MapSize, Method } from '@miragon/wardley-schema-model';
3
4
  import { WardleyConnection, WardleyShape } from '../model/di-types.js';
5
+ import { MapConfigUpdate } from './cmd/UpdateConfigHandler.js';
6
+ export declare const RESIZE_MAP = "wardley.map.resize";
7
+ export declare const UPDATE_CONFIG = "wardley.config.update";
4
8
  export interface EvolveOptions {
5
9
  newLabel?: string;
6
10
  method?: Method;
@@ -11,8 +15,18 @@ export interface EvolveOptions {
11
15
  */
12
16
  export default class WardleyModeling {
13
17
  private readonly commandStack;
18
+ private readonly canvas;
14
19
  static $inject: string[];
15
- constructor(commandStack: CommandStack);
20
+ constructor(commandStack: CommandStack, canvas: Canvas);
21
+ /**
22
+ * Sets the plot size (`undefined` removes the `size` line) as one undoable step that re-projects
23
+ * the shapes in place. Pass an already normalized size (see `normalizeMapSize`). Does nothing
24
+ * when the config would not change.
25
+ */
26
+ resizeMap(size: MapSize | undefined): void;
27
+ /** Changes config fields (title, labels, …) as one undoable step; `undefined` removes a field. */
28
+ updateConfig(properties: MapConfigUpdate): void;
29
+ private currentConfig;
16
30
  updateProperties(element: WardleyShape | WardleyConnection, properties: Record<string, unknown>): void;
17
31
  updateLabel(element: WardleyShape, label: string): void;
18
32
  evolveComponent(element: WardleyShape, targetEvolution: number, opts?: EvolveOptions): void;