@miragon/value-chain-renderer 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +89 -11
  2. package/dist/Modeler.d.ts +4 -1
  3. package/dist/Modeler.d.ts.map +1 -1
  4. package/dist/VcBaseViewer.d.ts +20 -2
  5. package/dist/VcBaseViewer.d.ts.map +1 -1
  6. package/dist/bounds/VcBounds.d.ts +17 -0
  7. package/dist/bounds/VcBounds.d.ts.map +1 -0
  8. package/dist/bounds/index.d.ts +5 -0
  9. package/dist/bounds/index.d.ts.map +1 -0
  10. package/dist/collaborative/CollaborativeValueChain.d.ts +27 -0
  11. package/dist/collaborative/CollaborativeValueChain.d.ts.map +1 -0
  12. package/dist/collaborative/index.d.ts +2 -0
  13. package/dist/collaborative/index.d.ts.map +1 -0
  14. package/dist/context-pad/VcContextPadProvider.d.ts +3 -1
  15. package/dist/context-pad/VcContextPadProvider.d.ts.map +1 -1
  16. package/dist/diagram-menu/ShortcutsDialog.d.ts +27 -0
  17. package/dist/diagram-menu/ShortcutsDialog.d.ts.map +1 -0
  18. package/dist/diagram-menu/index.d.ts +7 -0
  19. package/dist/diagram-menu/index.d.ts.map +1 -0
  20. package/dist/diagram-menu/menu.d.ts +44 -0
  21. package/dist/diagram-menu/menu.d.ts.map +1 -0
  22. package/dist/diagram-menu/shortcuts.d.ts +41 -0
  23. package/dist/diagram-menu/shortcuts.d.ts.map +1 -0
  24. package/dist/draw/VcRenderer.d.ts +10 -1
  25. package/dist/draw/VcRenderer.d.ts.map +1 -1
  26. package/dist/draw/icons.d.ts +4 -7
  27. package/dist/draw/icons.d.ts.map +1 -1
  28. package/dist/draw/lucide.d.ts +31 -0
  29. package/dist/draw/lucide.d.ts.map +1 -0
  30. package/dist/draw/styles.d.ts +11 -5
  31. package/dist/draw/styles.d.ts.map +1 -1
  32. package/dist/index.d.ts +8 -4
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +1228 -519
  35. package/dist/index.js.map +1 -1
  36. package/dist/io/VcExporter.d.ts +6 -5
  37. package/dist/io/VcExporter.d.ts.map +1 -1
  38. package/dist/io/VcImporter.d.ts +16 -3
  39. package/dist/io/VcImporter.d.ts.map +1 -1
  40. package/dist/io/index.d.ts +1 -0
  41. package/dist/io/index.d.ts.map +1 -1
  42. package/dist/io/png.d.ts +8 -0
  43. package/dist/io/png.d.ts.map +1 -0
  44. package/dist/io/saveSvg.d.ts +5 -5
  45. package/dist/io/saveSvg.d.ts.map +1 -1
  46. package/dist/io/types.d.ts +6 -1
  47. package/dist/io/types.d.ts.map +1 -1
  48. package/dist/keyboard/VcEditorActions.d.ts +5 -1
  49. package/dist/keyboard/VcEditorActions.d.ts.map +1 -1
  50. package/dist/keyboard/VcKeyboardBindings.d.ts +14 -2
  51. package/dist/keyboard/VcKeyboardBindings.d.ts.map +1 -1
  52. package/dist/keyboard/index.d.ts +2 -2
  53. package/dist/keyboard/index.d.ts.map +1 -1
  54. package/dist/label-editing/VcLabelEditingProvider.d.ts +40 -5
  55. package/dist/label-editing/VcLabelEditingProvider.d.ts.map +1 -1
  56. package/dist/label-editing/index.d.ts +1 -1
  57. package/dist/label-editing/index.d.ts.map +1 -1
  58. package/dist/model/VcDiagramElementFactory.d.ts +4 -4
  59. package/dist/model/VcDiagramElementFactory.d.ts.map +1 -1
  60. package/dist/palette/VcPaletteProvider.d.ts +35 -5
  61. package/dist/palette/VcPaletteProvider.d.ts.map +1 -1
  62. package/dist/palette/index.d.ts +1 -1
  63. package/dist/palette/index.d.ts.map +1 -1
  64. package/dist/read-only/VcReadOnly.d.ts +25 -0
  65. package/dist/read-only/VcReadOnly.d.ts.map +1 -0
  66. package/dist/read-only/index.d.ts +5 -0
  67. package/dist/read-only/index.d.ts.map +1 -0
  68. package/dist/value-chain.css +1 -1
  69. package/package.json +4 -3
package/README.md CHANGED
@@ -4,10 +4,12 @@
4
4
  [![License: MIT](https://img.shields.io/github/license/Miragon/value-chain-modeler)](https://github.com/Miragon/value-chain-modeler/blob/main/LICENSE)
5
5
 
6
6
  Viewer and editor for value chain diagrams (ARIS-style _Wertschöpfungskettendiagramme_), built on
7
- [diagram-js](https://github.com/bpmn-io/diagram-js) with the look & feel of
8
- [bpmn.io](https://bpmn.io/). Framework-agnostic: mount it into any element. The
7
+ [diagram-js](https://github.com/bpmn-io/diagram-js) and styled by the Miragon design system.
8
+ Framework-agnostic: mount it into any element. The
9
9
  [Value Chain Modeler](https://github.com/Miragon/value-chain-modeler) web app and VS Code extension
10
- both wrap this package.
10
+ both wrap this package, and it implements the
11
+ [`@miragon/modeler-api`](https://www.npmjs.com/package/@miragon/modeler-api) contract for
12
+ collaborative hosts.
11
13
 
12
14
  ![Modeler](https://raw.githubusercontent.com/Miragon/value-chain-modeler/main/docs/screenshot.png)
13
15
 
@@ -36,8 +38,21 @@ modeler.on('commandStack.changed', () => {
36
38
  const { svg } = modeler.saveSVG(); // standalone SVG
37
39
  ```
38
40
 
39
- The stylesheet is required: it includes diagram-js' own CSS and styles the palette, context pad and
40
- label editor.
41
+ The stylesheet is required. It loads, in this order, the design-system tokens
42
+ (`cd-tokens.generated.css`, in a cascade layer, so a host page's own `--cd-*` tokens win),
43
+ diagram-js' own CSS and `cd-canvas.css`, which maps diagram-js' chrome onto the `--cd-ui-*` roles;
44
+ then it styles the canvas surround, the context pad, the label editor and the shortcuts dialog on
45
+ those roles only. The three design-system files are vendored unchanged from the
46
+ `miragon-brand:modeler-tool-design` skill (design system 1.13.0) into `src/theme/`. The diagram
47
+ itself is drawn with SVG presentation values in the light roles of those tokens, so SVG and PNG
48
+ exports stay light in every mode.
49
+
50
+ Labels are set in `'Geist Variable', 'Geist', ui-sans-serif, system-ui, sans-serif` on every SVG
51
+ text node. The package does not ship the font: self-host it, for example with
52
+ `@fontsource-variable/geist` (`import '@fontsource-variable/geist/wght.css'`), or the labels fall
53
+ back to a system sans. Labels drawn before the font arrived are laid out again once it has. A host
54
+ chrome such as [`@miragon/modeler-shell`](https://www.npmjs.com/package/@miragon/modeler-shell)
55
+ loads its own stylesheet after this one.
41
56
 
42
57
  ## Entry points
43
58
 
@@ -47,11 +62,71 @@ label editor.
47
62
  | `NavigatedViewer` | Read-only plus zoom and pan. |
48
63
  | `Modeler` | The full editor, plus `undo()` / `redo()` on top of the shared API. |
49
64
 
50
- All three take `{ container?, width?, height?, additionalModules? }` and share `importDocument`,
51
- `exportDocument`, `saveSVG`, `fitViewport`, `clear`, `attachTo`, `detach`, `destroy`, `on`/`off`
52
- and `get` (DI lookup). `additionalModules` extends the DI container as in bpmn-js; the feature
53
- modules (`vcDrawModule`, `vcRulesModule`, `vcPaletteModule`, …) are exported to build custom
54
- setups.
65
+ All three take `{ container?, width?, height?, additionalModules?, freeRectCenter?, undoRedoKeys? }`
66
+ and share `importDocument`, `exportDocument`, `saveSVG`, `fitViewport`, `clear`, `attachTo`,
67
+ `detach`, `destroy`, `on`/`off` and `get` (DI lookup). `additionalModules` extends the DI
68
+ container as in bpmn-js; the feature modules (`vcDrawModule`, `vcRulesModule`, `vcPaletteModule`,
69
+ …) are exported to build custom setups.
70
+
71
+ - `importDocument(document)` validates the document before it touches the canvas (a rejected one
72
+ throws and leaves the previous diagram, its ids and its undo history as they were), erases the
73
+ undo history silently (no `commandStack.changed`), and fits the view: the content centred at the
74
+ largest zoom that shows all of it, never above 100 %. A label being typed is taken down without
75
+ committing and reopened afterwards on the element with the same id.
76
+ - `exportDocument()` writes back every key the schema does not define (vendor extensions on the
77
+ document, its meta, its elements and connections).
78
+ - New elements get random ids (`step_k3x9q2mf`, `org_…`, `sequence_…`), so two people adding an
79
+ element to one document at the same time never pick the same id.
80
+ - `freeRectCenter: () => Point | undefined`: where Enter or Space on a creating palette entry places
81
+ the element, in diagram coordinates (a host chrome passes the centre of the canvas area it leaves
82
+ free; default: the centre of the visible canvas). The element is selected, the canvas focused and
83
+ its label editor opened.
84
+ - `undoRedoKeys: false` leaves Cmd/Ctrl+Z, Cmd/Ctrl+Shift+Z and Ctrl+Y unbound and unprevented, for
85
+ a host that owns the history (the VS Code document).
86
+
87
+ ## Keyboard
88
+
89
+ On the focused canvas: L lasso, H hand, S create or remove space, C connect, E edit the label,
90
+ Cmd/Ctrl+A select all, the arrows move the selection (Shift: in large steps), Cmd/Ctrl + arrows move
91
+ the canvas, Delete/Backspace, copy, cut, paste and duplicate, and undo/redo unless `undoRedoKeys` is
92
+ false. `diagramShortcuts()` lists them for a dialog.
93
+
94
+ ## Edit lock
95
+
96
+ `modeler.get('vcReadOnly').setReadOnly(true)` locks every edit while the document behind the canvas
97
+ cannot be saved from it (an invalid file in an IDE): no create, move, resize, connect, waypoints,
98
+ delete, align, paste, context pad or label editor, and no space, connect or label keys. Selection,
99
+ lasso, hand, zoom, copy and export keep working.
100
+
101
+ ## Collaborative modeler (`@miragon/modeler-api`)
102
+
103
+ ```ts
104
+ import {
105
+ createCollaborativeModeler,
106
+ createCollaborativeViewer,
107
+ } from '@miragon/value-chain-renderer';
108
+
109
+ const modeler = createCollaborativeModeler({ additionalModules: [] });
110
+ modeler.attachTo(host); // in the document, with a size
111
+ await modeler.importText(text); // silent, fitted; rejects when the text is no valid document
112
+ modeler.onContentChanged(() => save(modeler.exportText())); // canonical JSON
113
+ ```
114
+
115
+ `createCollaborativeModeler` and `createCollaborativeViewer` implement the `CollaborativeModeler`
116
+ contract 1.1 (`meta.notation` `"value-chain"`): blank text opens as an empty diagram,
117
+ `onContentChanged` fires for every edit and undo/redo and never for an import, view state is the
118
+ diagram-js viewbox, and the `elements` surface lists steps and organizational units (name = label)
119
+ with `reveal` and selection. The browser test suite runs the contract's conformance kit on every
120
+ law, with no case skipped. `diagram` is the wrapped `Modeler` or `NavigatedViewer` for host wiring.
121
+
122
+ ## Chrome content for hosts
123
+
124
+ What both apps show around the diagram, typed structurally like `@miragon/modeler-shell` (the
125
+ renderer never imports the shell): `diagramMenu()` (Export as PNG, then SVG, optionally JSON; Help
126
+ with "Keyboard shortcuts…"), `createShortcutsDialog(shell)` (a modal `<dialog>` in the chrome's
127
+ root, with the high-contrast and forced-colours rules of the design system; `{ fileKeys: true }`
128
+ adds the web app's File keys, Cmd/Ctrl+O and Cmd/Ctrl+S), `svgToPng()` and
129
+ `blobToBase64()` for the PNG export, and `vcBounds.contentBounds(padding)` for a host's fit.
55
130
 
56
131
  ## Notation
57
132
 
@@ -64,4 +139,7 @@ setups.
64
139
 
65
140
  ## License
66
141
 
67
- [MIT](https://github.com/Miragon/value-chain-modeler/blob/main/LICENSE)
142
+ [MIT](https://github.com/Miragon/value-chain-modeler/blob/main/LICENSE). The inlined
143
+ [Lucide](https://lucide.dev) icons are ISC (© Lucide Icons and Contributors); `trash` and `x` derive
144
+ from Feather, MIT (© Cole Bemis), as Lucide's LICENSE lists them. The bundle keeps both notices as a
145
+ legal comment.
package/dist/Modeler.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { ModuleDeclaration } from 'didi';
2
2
  import { NavigatedViewer } from './NavigatedViewer.js';
3
- /** The full value chain editor. */
3
+ /**
4
+ * The full value chain editor, with the edit lock for a document the canvas cannot save
5
+ * (`vcReadOnly`).
6
+ */
4
7
  export declare class Modeler extends NavigatedViewer {
5
8
  protected _getModules(): ModuleDeclaration[];
6
9
  undo(): void;
@@ -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;AAW9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAcvD,mCAAmC;AACnC,qBAAa,OAAQ,SAAQ,eAAe;cACvB,WAAW,IAAI,iBAAiB,EAAE;IA8BrD,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;AAW9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAevD;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,eAAe;cACvB,WAAW,IAAI,iBAAiB,EAAE;IA+BrD,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;IAIZ,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,OAAO;CAGnB"}
@@ -1,6 +1,6 @@
1
1
  import { ModuleDeclaration } from 'didi';
2
2
  import { EventBusEventCallback } from 'diagram-js/lib/core/EventBus';
3
- import { ValueChainDocument } from '@miragon/value-chain-schema-model';
3
+ import { Point, ValueChainDocument } from '@miragon/value-chain-schema-model';
4
4
  import { ImportWarning } from './io/types.js';
5
5
  export interface VcViewerOptions {
6
6
  /** Host element. If missing, a detached <div> is created (attach later via attachTo). */
@@ -9,6 +9,17 @@ export interface VcViewerOptions {
9
9
  height?: number | string;
10
10
  /** Concatenated to the end of the module list (extension point). */
11
11
  additionalModules?: ModuleDeclaration[];
12
+ /**
13
+ * Where Enter or Space on a creating palette entry places the element, in diagram coordinates:
14
+ * the centre of the canvas area the host's chrome leaves free (guide §5.5). Default: the centre
15
+ * of the visible canvas.
16
+ */
17
+ freeRectCenter?: (() => Point | undefined) | undefined;
18
+ /**
19
+ * Bind Cmd/Ctrl+Z, Cmd/Ctrl+Shift+Z and Ctrl+Y to the canvas undo/redo (default true). Pass
20
+ * false when the host owns the history (the VS Code document), so the keys reach it.
21
+ */
22
+ undoRedoKeys?: boolean | undefined;
12
23
  }
13
24
  /**
14
25
  * DI bootstrap and lifecycle shared by Viewer/NavigatedViewer/Modeler. The diagram is
@@ -27,7 +38,12 @@ export declare abstract class VcBaseViewer {
27
38
  getOptional<T>(name: string): T | null;
28
39
  on<T = unknown>(event: string, callback: EventBusEventCallback<T>, priority?: number): void;
29
40
  off<T = unknown>(event: string, callback: EventBusEventCallback<T>): void;
30
- /** Replaces the current diagram contents; clears the undo history. */
41
+ /**
42
+ * Replaces the current diagram contents and erases the undo history, silently: no
43
+ * `commandStack.changed`, since an import is no edit a host should save. The document is
44
+ * validated before the canvas is touched, so a rejected one leaves no trace; an open label edit
45
+ * is taken down without committing and reopened afterwards when its element is still there.
46
+ */
31
47
  importDocument(document: ValueChainDocument): ImportWarning[];
32
48
  exportDocument(): ValueChainDocument;
33
49
  saveSVG(): {
@@ -39,6 +55,8 @@ export declare abstract class VcBaseViewer {
39
55
  attachTo(target: HTMLElement): void;
40
56
  detach(): void;
41
57
  destroy(): void;
58
+ private _render;
59
+ private _currentDocument;
42
60
  private _createContainer;
43
61
  private _ensureDiagram;
44
62
  }
@@ -1 +1 @@
1
- {"version":3,"file":"VcBaseViewer.d.ts","sourceRoot":"","sources":["../src/VcBaseViewer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAI9C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAI5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,WAAW,eAAe;IAC9B,yFAAyF;IACzF,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAMD;;;;GAIG;AACH,8BAAsB,YAAY;IAChC,SAAS,CAAC,QAAQ,CAAC,WAAW,IAAI,iBAAiB,EAAE;IAErD,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CA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B,KAAK,IAAI,IAAI;IAKb,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAMnC,MAAM,IAAI,IAAI;IAId,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,cAAc;CAYvB"}
@@ -0,0 +1,17 @@
1
+ import { default as ElementRegistry } from 'diagram-js/lib/core/ElementRegistry';
2
+ import { Bounds } from '@miragon/value-chain-schema-model';
3
+ /**
4
+ * The extent of the diagram's content: every step, org unit and connection (waypoints included).
5
+ * One source for the import's fit, the SVG export's frame and a host's fit, which pass their own
6
+ * margin.
7
+ */
8
+ export default class VcBounds {
9
+ private readonly elementRegistry;
10
+ static $inject: string[];
11
+ constructor(elementRegistry: ElementRegistry);
12
+ /** No step and no org unit on the canvas. */
13
+ isEmpty(): boolean;
14
+ /** The tight bounds of the content grown by `padding` on every side; undefined while empty. */
15
+ contentBounds(padding?: number): Bounds | undefined;
16
+ }
17
+ //# sourceMappingURL=VcBounds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VcBounds.d.ts","sourceRoot":"","sources":["../../src/bounds/VcBounds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AAGvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAGhE;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,QAAQ;IAGf,OAAO,CAAC,QAAQ,CAAC,eAAe;IAF5C,MAAM,CAAC,OAAO,WAAuB;gBAER,eAAe,EAAE,eAAe;IAE7D,6CAA6C;IAC7C,OAAO,IAAI,OAAO;IAIlB,+FAA+F;IAC/F,aAAa,CAAC,OAAO,SAAI,GAAG,MAAM,GAAG,SAAS;CAa/C"}
@@ -0,0 +1,5 @@
1
+ import { ModuleDeclaration } from 'didi';
2
+ /** Content bounds of the diagram (import fit, SVG export, a host's fit). */
3
+ export declare const vcBoundsModule: ModuleDeclaration;
4
+ export { default as VcBounds } from './VcBounds.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bounds/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAG9C,4EAA4E;AAC5E,eAAO,MAAM,cAAc,EAAE,iBAE5B,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { CollaborativeModeler, ElementsSurface } from '@miragon/modeler-api';
2
+ import { ModuleDeclaration } from 'didi';
3
+ import { Point } from '@miragon/value-chain-schema-model';
4
+ import { Modeler } from '../Modeler.js';
5
+ import { NavigatedViewer } from '../NavigatedViewer.js';
6
+ /** Stable notation id in `meta.notation` of the collaborative-modeler contract. */
7
+ export declare const VALUE_CHAIN_NOTATION = "value-chain";
8
+ /** What a blank text (a file just created in the explorer) opens as. */
9
+ export declare const BLANK_DOCUMENT_NAME = "New value chain";
10
+ export interface CollaborativeValueChainOptions {
11
+ /** Appended to the renderer's own modules (e.g. a host's chrome module). */
12
+ additionalModules?: ModuleDeclaration[] | undefined;
13
+ /** See `VcViewerOptions.undoRedoKeys` (default true). */
14
+ undoRedoKeys?: boolean | undefined;
15
+ /** See `VcViewerOptions.freeRectCenter`. */
16
+ freeRectCenter?: (() => Point | undefined) | undefined;
17
+ }
18
+ /** The contract surface plus the wrapped diagram for host-specific wiring. */
19
+ export interface CollaborativeValueChainModeler extends CollaborativeModeler {
20
+ readonly elements: ElementsSurface;
21
+ readonly diagram: Modeler | NavigatedViewer;
22
+ }
23
+ /** The editing mount (`meta.editable: true`) of the collaborative-modeler contract. */
24
+ export declare function createCollaborativeModeler(options?: CollaborativeValueChainOptions): CollaborativeValueChainModeler;
25
+ /** The read-only mount (`meta.editable: false`): imports, exports and reveals, never edits. */
26
+ export declare function createCollaborativeViewer(options?: Pick<CollaborativeValueChainOptions, 'additionalModules'>): CollaborativeValueChainModeler;
27
+ //# sourceMappingURL=CollaborativeValueChain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollaborativeValueChain.d.ts","sourceRoot":"","sources":["../../src/collaborative/CollaborativeValueChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EAEzB,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C,OAAO,EAIL,KAAK,KAAK,EAEX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,MAAM,WAAW,8BAA8B;IAC7C,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAC;IACpD,yDAAyD;IACzD,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,4CAA4C;IAC5C,cAAc,CAAC,EAAE,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;CACxD;AAED,8EAA8E;AAC9E,MAAM,WAAW,8BAA+B,SAAQ,oBAAoB;IAC1E,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC;CAC7C;AASD,uFAAuF;AACvF,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,8BAAmC,GAC3C,8BAA8B,CAShC;AAED,+FAA+F;AAC/F,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,IAAI,CAAC,8BAA8B,EAAE,mBAAmB,CAAM,GACtE,8BAA8B,CAEhC"}
@@ -0,0 +1,2 @@
1
+ export { BLANK_DOCUMENT_NAME, VALUE_CHAIN_NOTATION, createCollaborativeModeler, createCollaborativeViewer, type CollaborativeValueChainModeler, type CollaborativeValueChainOptions, } from './CollaborativeValueChain.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collaborative/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EACzB,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,GACpC,MAAM,8BAA8B,CAAC"}
@@ -5,6 +5,7 @@ import { Element } from 'diagram-js/lib/model/Types';
5
5
  import { default as VcAppend } from '../append/VcAppend.js';
6
6
  import { default as VcConnect } from '../connect/VcConnect.js';
7
7
  import { default as VcModeling } from '../modeling/VcModeling.js';
8
+ import { default as VcReadOnly } from '../read-only/VcReadOnly.js';
8
9
  interface ContextPadEntry {
9
10
  group: string;
10
11
  html?: string;
@@ -18,8 +19,9 @@ export default class VcContextPadProvider {
18
19
  private readonly vcAppend;
19
20
  private readonly vcConnect;
20
21
  private readonly vcModeling;
22
+ private readonly readOnly;
21
23
  static $inject: string[];
22
- constructor(contextPad: ContextPad, modeling: Modeling, popupMenu: PopupMenu, vcAppend: VcAppend, vcConnect: VcConnect, vcModeling: VcModeling);
24
+ constructor(contextPad: ContextPad, modeling: Modeling, popupMenu: PopupMenu, vcAppend: VcAppend, vcConnect: VcConnect, vcModeling: VcModeling, readOnly: Pick<VcReadOnly, 'isReadOnly'>);
23
25
  getContextPadEntries(element: Element): Entries;
24
26
  getMultiElementContextPadEntries(elements: Element[]): Entries;
25
27
  private addStepEntries;
@@ -1 +1 @@
1
- {"version":3,"file":"VcContextPadProvider.d.ts","sourceRoot":"","sources":["../../src/context-pad/VcContextPadProvider.ts"],"names":[],"mappings":"A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U,EAAE,YAAY,CAAC;IAK3D,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IA8D/C,gCAAgC,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO;IAiC9D,OAAO,CAAC,cAAc;CA8CvB"}
@@ -0,0 +1,27 @@
1
+ import { DiagramShortcutOptions, ShortcutsChrome } from './shortcuts.js';
2
+ /** What the dialog needs of the chrome around the diagram; a `@miragon/modeler-shell` handle fits. */
3
+ export interface ShortcutsDialogChrome extends ShortcutsChrome {
4
+ /** Where the dialog lives (the shell root), so it shares the chrome's mode and fonts. */
5
+ readonly root: HTMLElement;
6
+ readonly messages: ShortcutsChrome['messages'] & {
7
+ readonly close: string;
8
+ };
9
+ /** The control the focus returns to once the dialog closes. */
10
+ readonly menu: {
11
+ readonly trigger: HTMLElement;
12
+ };
13
+ }
14
+ export interface ShortcutsDialog {
15
+ open(): void;
16
+ isOpen(): boolean;
17
+ close(): void;
18
+ destroy(): void;
19
+ }
20
+ /**
21
+ * The "Keyboard shortcuts…" dialog of the Help group (guide §5.4, §8), a native modal <dialog>
22
+ * inside the chrome's root: the browser keeps the focus inside it, closes it on Escape and puts it
23
+ * in the top layer. Built on the first open and kept (closed) afterwards; the host calls
24
+ * `destroy()` with the diagram's teardown, since the chrome removes only what it added itself.
25
+ */
26
+ export declare function createShortcutsDialog(chrome: ShortcutsDialogChrome, options?: DiagramShortcutOptions): ShortcutsDialog;
27
+ //# sourceMappingURL=ShortcutsDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShortcutsDialog.d.ts","sourceRoot":"","sources":["../../src/diagram-menu/ShortcutsDialog.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,sBAAsB,EAE3B,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAKxB,sGAAsG;AACtG,MAAM,WAAW,qBAAsB,SAAQ,eAAe;IAC5D,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;CAClD;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,OAAO,CAAC;IAClB,KAAK,IAAI,IAAI,CAAC;IACd,OAAO,IAAI,IAAI,CAAC;CACjB;AAuDD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,GAAE,sBAA2B,GACnC,eAAe,CAgCjB"}
@@ -0,0 +1,7 @@
1
+ export { JSON_EXPORT_LABEL, diagramMenu } from './menu.js';
2
+ export type { DiagramExport, DiagramExports, DiagramMenu, DiagramMenuAction, DiagramMenuActions, DiagramMenuDialog, DiagramMenuIcon, } from './menu.js';
3
+ export { diagramShortcuts } from './shortcuts.js';
4
+ export type { DiagramShortcutOptions, ShortcutGroup, ShortcutKeyNames, ShortcutPlatform, ShortcutRow, ShortcutsChrome, } from './shortcuts.js';
5
+ export { createShortcutsDialog } from './ShortcutsDialog.js';
6
+ export type { ShortcutsDialog, ShortcutsDialogChrome } from './ShortcutsDialog.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/diagram-menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC3D,YAAY,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EACV,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /** The icons the guide gives these entries (guide §5.14, the shell's common set). */
2
+ export type DiagramMenuIcon = 'file-image' | 'file-code-corner' | 'keyboard';
3
+ interface DiagramMenuItem {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ readonly icon?: DiagramMenuIcon;
7
+ }
8
+ export interface DiagramMenuAction extends DiagramMenuItem {
9
+ readonly kind: 'action';
10
+ readonly shortcut?: string;
11
+ onSelect(): void;
12
+ }
13
+ export interface DiagramMenuDialog extends DiagramMenuItem {
14
+ readonly kind: 'dialog';
15
+ onSelect(): void;
16
+ }
17
+ export interface DiagramMenu {
18
+ readonly export: readonly DiagramMenuAction[];
19
+ readonly help: readonly DiagramMenuDialog[];
20
+ }
21
+ export interface DiagramExport {
22
+ onSelect(): void;
23
+ /** The chip of an app key that runs the same export, e.g. "⌘S". */
24
+ readonly shortcut?: string | undefined;
25
+ }
26
+ /**
27
+ * The exports a host offers, in the guide's order: PNG first (the more frequent target), then SVG,
28
+ * then the document itself where the host is not the file (the web app).
29
+ */
30
+ export interface DiagramExports {
31
+ readonly png: DiagramExport;
32
+ readonly svg: DiagramExport;
33
+ readonly json?: DiagramExport | undefined;
34
+ }
35
+ export interface DiagramMenuActions {
36
+ readonly exports: DiagramExports;
37
+ showKeyboardShortcuts(): void;
38
+ }
39
+ /** The label of the JSON export, also its row in the shortcuts dialog's File group. */
40
+ export declare const JSON_EXPORT_LABEL = "Export as JSON";
41
+ /** The menu groups of the diagram (guide §5.4): Export with PNG first, Help. */
42
+ export declare function diagramMenu(actions: DiagramMenuActions): DiagramMenu;
43
+ export {};
44
+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,CAAC;CAC/B;AAkBD,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAElD,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAkBpE"}
@@ -0,0 +1,41 @@
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 diagram. */
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
+ export interface ShortcutRow {
24
+ readonly action: string;
25
+ /** Alternative key combinations, each shown as its own chip. */
26
+ readonly keys: readonly string[];
27
+ }
28
+ export interface ShortcutGroup {
29
+ readonly title: string;
30
+ readonly rows: readonly ShortcutRow[];
31
+ }
32
+ export interface DiagramShortcutOptions {
33
+ /** The web app's file keys: Cmd/Ctrl+O opens a file, Cmd/Ctrl+S exports the JSON document. */
34
+ readonly fileKeys?: boolean | undefined;
35
+ }
36
+ /**
37
+ * Every shortcut of the diagram, grouped as guide §5.4 asks (View, Edit, the notation's tools),
38
+ * after the web app's File keys where it binds them.
39
+ */
40
+ export declare function diagramShortcuts(chrome: ShortcutsChrome, options?: DiagramShortcutOptions): ShortcutGroup[];
41
+ //# sourceMappingURL=shortcuts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcuts.d.ts","sourceRoot":"","sources":["../../src/diagram-menu/shortcuts.ts"],"names":[],"mappings":"AASA,MAAM,M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a,EAAE,CA+CjB"}
@@ -1,12 +1,21 @@
1
1
  import { default as BaseRenderer } from 'diagram-js/lib/draw/BaseRenderer';
2
+ import { default as ElementRegistry } from 'diagram-js/lib/core/ElementRegistry';
2
3
  import { default as EventBus } from 'diagram-js/lib/core/EventBus';
4
+ import { default as GraphicsFactory } from 'diagram-js/lib/core/GraphicsFactory';
3
5
  import { Connection, Element, Shape } from 'diagram-js/lib/model/Types';
4
6
  export default class VcRenderer extends BaseRenderer {
7
+ private readonly elementRegistry;
8
+ private readonly graphicsFactory;
5
9
  static $inject: string[];
6
10
  private readonly textUtil;
7
11
  /** Unique per instance so marker ids never collide across diagrams on one page. */
8
12
  private readonly markerSuffix;
9
- constructor(eventBus: EventBus);
13
+ constructor(eventBus: EventBus, elementRegistry: ElementRegistry, graphicsFactory: GraphicsFactory);
14
+ /**
15
+ * A label drawn before the web font arrived was measured in the fallback font: its lines sit off
16
+ * centre, and may wrap differently, once the font renders. Such labels are laid out again then.
17
+ */
18
+ private relayoutLabelsWhenTheFontArrives;
10
19
  canRender(element: Element): boolean;
11
20
  drawShape(visuals: SVGElement, element: Shape): SVGElement;
12
21
  drawConnection(visuals: SVGElement, element: Connection): SVGElement;
@@ -1 +1 @@
1
- {"version":3,"file":"VcRenderer.d.ts","sourceRoot":"","sources":["../../src/draw/VcRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAG5D,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAoB7E,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,YAAY;IAClD,MAAM,CAAC,OAAO,WAAgB;IAE9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAOtB;IAEH,mFAAmF;IACnF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiC;gBAElD,QAAQ,EAAE,QAAQ;IAIrB,S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AAU,GAAG,UAAU;IA2BpE,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAOlC,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;IAQ1D,OAAO,CAAC,WAAW;CA+BpB"}
@@ -1,24 +1,21 @@
1
- /**
2
- * Inline SVG icons for palette (28px) and context pad (24px) entries. All icons use
3
- * `currentColor`, so the diagram-js palette/context-pad hover colors apply.
4
- */
5
1
  export declare const ICONS: {
6
2
  readonly handTool: string;
7
3
  readonly lassoTool: string;
8
4
  readonly spaceTool: string;
9
5
  readonly globalConnect: string;
10
6
  readonly createStep: string;
7
+ readonly createOrgUnit: string;
11
8
  readonly appendStep: string;
12
9
  readonly appendSubStep: string;
13
10
  readonly connectSequence: string;
14
11
  readonly connectHierarchy: string;
15
- readonly createOrgUnit: string;
16
12
  readonly appendOrgUnit: string;
17
13
  readonly toggleType: string;
18
14
  readonly align: string;
19
15
  readonly color: string;
20
16
  readonly trash: string;
21
17
  };
22
- export declare function paletteEntryHtml(iconSvg: string, title: string, draggable?: boolean): string;
23
- export declare function contextPadEntryHtml(iconSvg: string, title: string, draggable?: boolean): string;
18
+ /** No native `title`: the palette's tooltip (diagram-js or a host's chrome) names the entry. */
19
+ export declare function paletteEntryHtml(iconSvg: string, draggable?: boolean): string;
20
+ export declare function contextPadEntryHtml(iconSvg: string, draggable?: boolean): string;
24
21
  //# sourceMappingURL=icons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/draw/icons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;CAkDR,CAAC;AAEX,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,MAAM,CAK1F;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,MAAM,CAK7F"}
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/draw/icons.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;CAyBR,CAAC;AAEX,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,MAAM,CAK3E;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,MAAM,CAE9E"}
@@ -0,0 +1,31 @@
1
+ /*! @miragon/value-chain-renderer icon geometry
2
+ * Lucide (lucide-static 1.59.0) @license ISC
3
+ * Copyright (c) 2026 Lucide Icons and Contributors
4
+ * Derived from Feather, as Lucide's LICENSE lists them: trash and x. Feather @license MIT
5
+ * Copyright (c) 2013-present Cole Bemis */
6
+ export declare const LUCIDE: {
7
+ readonly 'square-dashed-mouse-pointer': string;
8
+ readonly hand: string;
9
+ readonly 'unfold-horizontal': string;
10
+ readonly workflow: string;
11
+ readonly palette: string;
12
+ readonly trash: string;
13
+ readonly 'arrow-left-right': "<path d=\"M8 3 4 7l4 4\"/><path d=\"M4 7h16\"/><path d=\"m16 21 4-4-4-4\"/><path d=\"M20 17H4\"/>";
14
+ readonly 'align-start-vertical': string;
15
+ readonly x: "<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>";
16
+ };
17
+ export type LucideIconName = keyof typeof LUCIDE;
18
+ export interface LucideIconOptions {
19
+ /** Rendered width and height in px. */
20
+ size: number;
21
+ /** Stroke width on the 24 grid. */
22
+ strokeWidth: number;
23
+ }
24
+ /**
25
+ * Guide §11: chrome icons are 16px at stroke 2.5 and palette tools 20px at stroke 2, both
26
+ * 1.67px on screen. `currentColor`, so the surrounding role (rest, hover, pressed) decides.
27
+ */
28
+ export declare const CHROME_ICON: LucideIconOptions;
29
+ export declare const PALETTE_TOOL_ICON: LucideIconOptions;
30
+ export declare function lucideIcon(name: LucideIconName, options?: LucideIconOptions): string;
31
+ //# sourceMappingURL=lucide.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucide.d.ts","sourceRoot":"","sources":["../../src/draw/lucide.ts"],"names":[],"mappings":"AAAA;;;;2CAI2C;AAO3C,eAAO,MAAM,MAAM;;;;;;;;;;CAgCT,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,MAAM,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,iBAAkD,CAAC;AAC7E,eAAO,MAAM,iBAAiB,EAAE,iBAAgD,CAAC;AAEjF,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,GAAE,iBAA+B,GAAG,MAAM,CAOjG"}
@@ -1,13 +1,19 @@
1
1
  /**
2
- * Single source of visual constants, matching the bpmn.io design language:
3
- * near-black ink strokes (2px, round joins) on white fills, Arial 12px labels.
2
+ * Canvas colours, the light roles of the vendored design tokens (guide §10.1): contours,
3
+ * connections and labels in the text role, element fills in the plot role. The renderer writes
4
+ * them as presentation values, so exports look the same everywhere and stay light in every mode.
4
5
  */
5
6
  export declare const COLORS: {
6
- readonly ink: "hsl(225, 10%, 15%)";
7
- readonly fill: "white";
7
+ readonly ink: string;
8
+ readonly fill: string;
8
9
  };
10
+ /**
11
+ * The family goes onto every SVG text node, since SVG text does not inherit the container's font
12
+ * (guide §4). "Geist Variable" is the name `@fontsource-variable/geist` registers; the hosts load
13
+ * it, and an exported SVG opened elsewhere falls back to "Geist" or a system sans.
14
+ */
9
15
  export declare const FONT: {
10
- readonly family: "Arial, sans-serif";
16
+ readonly family: "'Geist Variable', 'Geist', ui-sans-serif, system-ui, sans-serif";
11
17
  readonly size: 12;
12
18
  readonly lineHeight: 1.2;
13
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/draw/styles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,MAAM;;;CAGT,CAAC;AAEX,eAAO,MAAM,IAAI;;;;CAIP,CAAC;AAEX,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,yFAAyF;AACzF,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAO1E,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/draw/styles.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,MAAM;;;CAGT,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,IAAI;;;;CAIP,CAAC;AAEX,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,yFAAyF;AACzF,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAO1E,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,19 +5,23 @@ export { Modeler } from './Modeler.js';
5
5
  export { isOrgUnit, isStep, isVcConnection, isVcElement, isVcShape, type VcConnection, type VcShape, type VcShapeType, } from './model/di-types.js';
6
6
  export { vcModelModule, VcElementFactory, VcDiagramElementFactory } from './model/index.js';
7
7
  export { vcDrawModule, VcRenderer, chevronPath, chevronPathAt, ellipsePathAt, notchDepth, COLORS, COLOR_OPTIONS, FONT, } from './draw/index.js';
8
- export { ioModule, VcImporter, VcExporter, saveSVG, ROOT_ID } from './io/index.js';
8
+ export { ioModule, VcImporter, VcExporter, saveSVG, svgToPng, blobToBase64, ROOT_ID, } from './io/index.js';
9
+ export { vcBoundsModule, VcBounds } from './bounds/index.js';
10
+ export { BLANK_DOCUMENT_NAME, VALUE_CHAIN_NOTATION, createCollaborativeModeler, createCollaborativeViewer, type CollaborativeValueChainModeler, type CollaborativeValueChainOptions, } from './collaborative/index.js';
9
11
  export type { ImportWarning, RootBusinessObject } from './io/index.js';
10
12
  export { vcModelingModule, VcModeling, VcLayouter, VcConnectionTypeBehavior, } from './modeling/index.js';
11
13
  export { vcRulesModule, VcRules } from './rules/index.js';
12
14
  export { vcConnectModule, VcConnect } from './connect/index.js';
13
15
  export { vcAppendModule, VcAppend } from './append/index.js';
14
- export { vcPaletteModule, VcPaletteProvider } from './palette/index.js';
16
+ export { vcPaletteModule, VcPaletteProvider, type VcPaletteConfig } from './palette/index.js';
15
17
  export { vcContextPadModule, VcContextPadProvider } from './context-pad/index.js';
16
- export { vcLabelEditingModule, VcLabelEditingProvider } from './label-editing/index.js';
18
+ export { vcLabelEditingModule, VcLabelEditingProvider, type OpenLabelEdit, } from './label-editing/index.js';
17
19
  export { vcColorPickerModule, vcAlignMenuModule, VcColorPickerProvider, VcAlignMenuProvider, COLOR_PICKER_PROVIDER_ID, ALIGN_MENU_PROVIDER_ID, } from './popup/index.js';
18
- export { vcKeyboardModule, VcKeyboardBindings, VcEditorActions } from './keyboard/index.js';
20
+ export { vcKeyboardModule, VcKeyboardBindings, VcEditorActions, type VcKeyboardConfig, } from './keyboard/index.js';
21
+ export { vcReadOnlyModule, VcReadOnly, READ_ONLY_CHANGED_EVENT } from './read-only/index.js';
19
22
  export { vcOrderingModule, VcOrderingProvider } from './ordering/index.js';
20
23
  export { vcCopyPasteModule, VcCopyPasteBehavior } from './copy-paste/index.js';
21
24
  export { vcResizeModule, VcResizeBehavior } from './resize/index.js';
22
25
  export { ICONS } from './draw/icons.js';
26
+ export { JSON_EXPORT_LABEL, createShortcutsDialog, diagramMenu, diagramShortcuts, type DiagramExport, type DiagramExports, type DiagramMenu, type DiagramMenuAction, type DiagramMenuActions, type DiagramMenuDialog, type DiagramMenuIcon, type DiagramShortcutOptions, type ShortcutGroup, type ShortcutKeyNames, type ShortcutPlatform, type ShortcutRow, type ShortcutsChrome, type ShortcutsDialog, type ShortcutsDialogChrome, } from './diagram-menu/index.js';
23
27
  //# sourceMappingURL=index.d.ts.map