@miragon/value-chain-renderer 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -12
- package/dist/Modeler.d.ts +4 -1
- package/dist/Modeler.d.ts.map +1 -1
- package/dist/VcBaseViewer.d.ts +24 -3
- package/dist/VcBaseViewer.d.ts.map +1 -1
- package/dist/bounds/VcBounds.d.ts +17 -0
- package/dist/bounds/VcBounds.d.ts.map +1 -0
- package/dist/bounds/index.d.ts +5 -0
- package/dist/bounds/index.d.ts.map +1 -0
- package/dist/collaborative/CollaborativeValueChain.d.ts +32 -0
- package/dist/collaborative/CollaborativeValueChain.d.ts.map +1 -0
- package/dist/collaborative/index.d.ts +2 -0
- package/dist/collaborative/index.d.ts.map +1 -0
- package/dist/context-pad/VcContextPadProvider.d.ts +3 -1
- package/dist/context-pad/VcContextPadProvider.d.ts.map +1 -1
- package/dist/diagram-menu/ShortcutsDialog.d.ts +27 -0
- package/dist/diagram-menu/ShortcutsDialog.d.ts.map +1 -0
- package/dist/diagram-menu/index.d.ts +7 -0
- package/dist/diagram-menu/index.d.ts.map +1 -0
- package/dist/diagram-menu/menu.d.ts +44 -0
- package/dist/diagram-menu/menu.d.ts.map +1 -0
- package/dist/diagram-menu/shortcuts.d.ts +41 -0
- package/dist/diagram-menu/shortcuts.d.ts.map +1 -0
- package/dist/draw/VcRenderer.d.ts +10 -1
- package/dist/draw/VcRenderer.d.ts.map +1 -1
- package/dist/draw/icons.d.ts +4 -7
- package/dist/draw/icons.d.ts.map +1 -1
- package/dist/draw/lucide.d.ts +31 -0
- package/dist/draw/lucide.d.ts.map +1 -0
- package/dist/draw/styles.d.ts +11 -5
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1274 -520
- package/dist/index.js.map +1 -1
- package/dist/io/VcExporter.d.ts +6 -5
- package/dist/io/VcExporter.d.ts.map +1 -1
- package/dist/io/VcImporter.d.ts +21 -3
- package/dist/io/VcImporter.d.ts.map +1 -1
- package/dist/io/index.d.ts +2 -1
- package/dist/io/index.d.ts.map +1 -1
- package/dist/io/png.d.ts +8 -0
- package/dist/io/png.d.ts.map +1 -0
- package/dist/io/saveSvg.d.ts +5 -5
- package/dist/io/saveSvg.d.ts.map +1 -1
- package/dist/io/types.d.ts +6 -1
- package/dist/io/types.d.ts.map +1 -1
- package/dist/keyboard/VcEditorActions.d.ts +5 -1
- package/dist/keyboard/VcEditorActions.d.ts.map +1 -1
- package/dist/keyboard/VcKeyboardBindings.d.ts +14 -2
- package/dist/keyboard/VcKeyboardBindings.d.ts.map +1 -1
- package/dist/keyboard/index.d.ts +2 -2
- package/dist/keyboard/index.d.ts.map +1 -1
- package/dist/label-editing/VcLabelEditingProvider.d.ts +46 -5
- package/dist/label-editing/VcLabelEditingProvider.d.ts.map +1 -1
- package/dist/label-editing/index.d.ts +1 -1
- package/dist/label-editing/index.d.ts.map +1 -1
- package/dist/model/VcDiagramElementFactory.d.ts +4 -4
- package/dist/model/VcDiagramElementFactory.d.ts.map +1 -1
- package/dist/palette/VcPaletteProvider.d.ts +41 -5
- package/dist/palette/VcPaletteProvider.d.ts.map +1 -1
- package/dist/palette/index.d.ts +1 -1
- package/dist/palette/index.d.ts.map +1 -1
- package/dist/read-only/VcReadOnly.d.ts +25 -0
- package/dist/read-only/VcReadOnly.d.ts.map +1 -0
- package/dist/read-only/index.d.ts +5 -0
- package/dist/read-only/index.d.ts.map +1 -0
- package/dist/value-chain.css +1 -1
- package/package.json +16 -8
package/README.md
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
[](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)
|
|
8
|
-
|
|
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
|

|
|
13
15
|
|
|
@@ -17,7 +19,9 @@ both wrap this package.
|
|
|
17
19
|
npm install @miragon/value-chain-renderer @miragon/value-chain-schema-model
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
ESM only, for browsers and bundlers.
|
|
22
|
+
ESM only, for browsers and bundlers. `diagram-js` (^15.28.0), `didi`, `tiny-svg` and `zod` are peer
|
|
23
|
+
dependencies: an app that already has them shares its copy with the renderer, since a second
|
|
24
|
+
diagram-js or Zod breaks the dependency injection and `instanceof` checks.
|
|
21
25
|
|
|
22
26
|
## Quick start
|
|
23
27
|
|
|
@@ -36,8 +40,21 @@ modeler.on('commandStack.changed', () => {
|
|
|
36
40
|
const { svg } = modeler.saveSVG(); // standalone SVG
|
|
37
41
|
```
|
|
38
42
|
|
|
39
|
-
The stylesheet is required
|
|
40
|
-
|
|
43
|
+
The stylesheet is required. It loads, in this order, the design-system tokens
|
|
44
|
+
(`cd-tokens.generated.css`, in a cascade layer, so a host page's own `--cd-*` tokens win),
|
|
45
|
+
diagram-js' own CSS and `cd-canvas.css`, which maps diagram-js' chrome onto the `--cd-ui-*` roles;
|
|
46
|
+
then it styles the canvas surround, the context pad, the label editor and the shortcuts dialog on
|
|
47
|
+
those roles only. The three design-system files are vendored unchanged from the
|
|
48
|
+
`miragon-brand:modeler-tool-design` skill (design system 1.13.0) into `src/theme/`. The diagram
|
|
49
|
+
itself is drawn with SVG presentation values in the light roles of those tokens, so SVG and PNG
|
|
50
|
+
exports stay light in every mode.
|
|
51
|
+
|
|
52
|
+
Labels are set in `'Geist Variable', 'Geist', ui-sans-serif, system-ui, sans-serif` on every SVG
|
|
53
|
+
text node. The package does not ship the font: self-host it, for example with
|
|
54
|
+
`@fontsource-variable/geist` (`import '@fontsource-variable/geist/wght.css'`), or the labels fall
|
|
55
|
+
back to a system sans. Labels drawn before the font arrived are laid out again once it has. A host
|
|
56
|
+
chrome such as [`@miragon/modeler-shell`](https://www.npmjs.com/package/@miragon/modeler-shell)
|
|
57
|
+
loads its own stylesheet after this one.
|
|
41
58
|
|
|
42
59
|
## Entry points
|
|
43
60
|
|
|
@@ -47,11 +64,81 @@ label editor.
|
|
|
47
64
|
| `NavigatedViewer` | Read-only plus zoom and pan. |
|
|
48
65
|
| `Modeler` | The full editor, plus `undo()` / `redo()` on top of the shared API. |
|
|
49
66
|
|
|
50
|
-
All three take `{ container?, width?, height?, additionalModules
|
|
51
|
-
`exportDocument`, `saveSVG`, `fitViewport`, `clear`, `attachTo`,
|
|
52
|
-
and `get` (DI lookup). `additionalModules` extends the DI
|
|
53
|
-
modules (`vcDrawModule`, `vcRulesModule`, `vcPaletteModule`,
|
|
54
|
-
setups.
|
|
67
|
+
All three take `{ container?, width?, height?, additionalModules?, freeArea?, fitOnImport?, undoRedoKeys? }`
|
|
68
|
+
and share `importDocument`, `exportDocument`, `saveSVG`, `fitViewport`, `clear`, `attachTo`,
|
|
69
|
+
`detach`, `destroy`, `on`/`off` and `get` (DI lookup). `additionalModules` extends the DI
|
|
70
|
+
container as in bpmn-js; the feature modules (`vcDrawModule`, `vcRulesModule`, `vcPaletteModule`,
|
|
71
|
+
…) are exported to build custom setups.
|
|
72
|
+
|
|
73
|
+
- `importDocument(document)` validates the document before it touches the canvas (a rejected one
|
|
74
|
+
throws and leaves the previous diagram, its ids and its undo history as they were), erases the
|
|
75
|
+
undo history silently (no `commandStack.changed`), and fits the view: the content centred at the
|
|
76
|
+
largest zoom that shows all of it, never above 100 % (`fitOnImport: false` leaves the view to a
|
|
77
|
+
host that fits itself). A label being typed is taken down without committing and reopened
|
|
78
|
+
afterwards on the element with the same id.
|
|
79
|
+
- A label being typed stays open across every view change, a host's fit or restore as much as a
|
|
80
|
+
wheel zoom, and moves along with its element; only Enter, leaving the text box or a click or drag
|
|
81
|
+
on the canvas commits it.
|
|
82
|
+
- `exportDocument()` writes back every key the schema does not define (vendor extensions on the
|
|
83
|
+
document, its meta, its elements and connections).
|
|
84
|
+
- New elements get random ids (`step_k3x9q2mf`, `org_…`, `sequence_…`), so two people adding an
|
|
85
|
+
element to one document at the same time never pick the same id.
|
|
86
|
+
- `freeArea`: the canvas area the host's chrome leaves free, as `{ insets: () => FreeAreaInsets }`
|
|
87
|
+
(px from the container's edges) or `{ center: () => Point | undefined }` (diagram coordinates).
|
|
88
|
+
Enter or Space on a creating palette entry places the element in its centre (default: the centre
|
|
89
|
+
of the visible canvas), selected, with the canvas focused and its label editor open.
|
|
90
|
+
`freeRectCenter` is the deprecated name of `freeArea: { center }`, accepted until the next minor
|
|
91
|
+
release; given both, `freeArea` wins.
|
|
92
|
+
- `undoRedoKeys: false` leaves Cmd/Ctrl+Z, Cmd/Ctrl+Shift+Z and Ctrl+Y unbound and unprevented, for
|
|
93
|
+
a host that owns the history (the VS Code document).
|
|
94
|
+
|
|
95
|
+
## Keyboard
|
|
96
|
+
|
|
97
|
+
On the focused canvas: L lasso, H hand, S create or remove space, C connect, E edit the label,
|
|
98
|
+
Cmd/Ctrl+A select all, the arrows move the selection (Shift: in large steps), Cmd/Ctrl + arrows move
|
|
99
|
+
the canvas, Delete/Backspace, copy, cut, paste and duplicate, and undo/redo unless `undoRedoKeys` is
|
|
100
|
+
false. `diagramShortcuts()` lists them for a dialog.
|
|
101
|
+
|
|
102
|
+
## Edit lock
|
|
103
|
+
|
|
104
|
+
`modeler.get('vcReadOnly').setReadOnly(true)` locks every edit while the document behind the canvas
|
|
105
|
+
cannot be saved from it (an invalid file in an IDE): no create, move, resize, connect, waypoints,
|
|
106
|
+
delete, align, paste, context pad or label editor, and no space, connect or label keys. Selection,
|
|
107
|
+
lasso, hand, zoom, copy and export keep working.
|
|
108
|
+
|
|
109
|
+
## Collaborative modeler (`@miragon/modeler-api`)
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import {
|
|
113
|
+
createCollaborativeModeler,
|
|
114
|
+
createCollaborativeViewer,
|
|
115
|
+
} from '@miragon/value-chain-renderer';
|
|
116
|
+
|
|
117
|
+
const modeler = createCollaborativeModeler({ additionalModules: [] });
|
|
118
|
+
modeler.attachTo(host); // in the document, with a size
|
|
119
|
+
await modeler.importText(text); // silent, fitted; rejects when the text is no valid document
|
|
120
|
+
modeler.onContentChanged(() => save(modeler.exportText())); // canonical JSON
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`createCollaborativeModeler` and `createCollaborativeViewer` implement the `CollaborativeModeler`
|
|
124
|
+
contract 1.2 (`meta.notation` `"value-chain"`): blank text opens as an empty diagram,
|
|
125
|
+
`onContentChanged` fires for every edit and undo/redo and never for an import, view state is the
|
|
126
|
+
diagram-js viewbox, a host's `setViewState` or fit never commits a label being typed, and the
|
|
127
|
+
`elements` surface lists steps and organizational units (name = label) with `reveal`, selection and
|
|
128
|
+
`bounds(id)`, the live box of a step or an organizational unit in diagram coordinates. Both take
|
|
129
|
+
the contract's factory options `freeArea`, `fitOnImport` and `undoRedoKeys` (the viewer ignores
|
|
130
|
+
the two that need editing) and the deprecated `freeRectCenter`. The browser test suite runs the
|
|
131
|
+
contract's conformance kit on every law, with no case skipped and no advisory. `diagram` is the
|
|
132
|
+
wrapped `Modeler` or `NavigatedViewer` for host wiring.
|
|
133
|
+
|
|
134
|
+
## Chrome content for hosts
|
|
135
|
+
|
|
136
|
+
What both apps show around the diagram, typed structurally like `@miragon/modeler-shell` (the
|
|
137
|
+
renderer never imports the shell): `diagramMenu()` (Export as PNG, then SVG, optionally JSON; Help
|
|
138
|
+
with "Keyboard shortcuts…"), `createShortcutsDialog(shell)` (a modal `<dialog>` in the chrome's
|
|
139
|
+
root, with the high-contrast and forced-colours rules of the design system; `{ fileKeys: true }`
|
|
140
|
+
adds the web app's File keys, Cmd/Ctrl+O and Cmd/Ctrl+S), `svgToPng()` and
|
|
141
|
+
`blobToBase64()` for the PNG export, and `vcBounds.contentBounds(padding)` for a host's fit.
|
|
55
142
|
|
|
56
143
|
## Notation
|
|
57
144
|
|
|
@@ -64,4 +151,7 @@ setups.
|
|
|
64
151
|
|
|
65
152
|
## License
|
|
66
153
|
|
|
67
|
-
[MIT](https://github.com/Miragon/value-chain-modeler/blob/main/LICENSE)
|
|
154
|
+
[MIT](https://github.com/Miragon/value-chain-modeler/blob/main/LICENSE). The inlined
|
|
155
|
+
[Lucide](https://lucide.dev) icons are ISC (© Lucide Icons and Contributors); `trash` and `x` derive
|
|
156
|
+
from Feather, MIT (© Cole Bemis), as Lucide's LICENSE lists them. The bundle keeps both notices as a
|
|
157
|
+
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
|
-
/**
|
|
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;
|
package/dist/Modeler.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/VcBaseViewer.d.ts
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import { ModuleDeclaration } from 'didi';
|
|
2
|
+
import { CollaborativeModelerOptions } from '@miragon/modeler-api';
|
|
2
3
|
import { EventBusEventCallback } from 'diagram-js/lib/core/EventBus';
|
|
3
|
-
import { ValueChainDocument } from '@miragon/value-chain-schema-model';
|
|
4
|
+
import { Point, ValueChainDocument } from '@miragon/value-chain-schema-model';
|
|
4
5
|
import { ImportWarning } from './io/types.js';
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* `freeArea`, `fitOnImport` and `undoRedoKeys` as `@miragon/modeler-api` 1.2 names them:
|
|
8
|
+
* `freeArea` is where Enter or Space on a creating palette entry places the element (the centre of
|
|
9
|
+
* the canvas area the host's chrome leaves free, guide §5.5; default the centre of the visible
|
|
10
|
+
* canvas), `fitOnImport: false` leaves the view after an import to the host, and
|
|
11
|
+
* `undoRedoKeys: false` leaves Cmd/Ctrl+Z, Cmd/Ctrl+Shift+Z and Ctrl+Y to a host that owns the
|
|
12
|
+
* history (the VS Code document).
|
|
13
|
+
*/
|
|
14
|
+
export interface VcViewerOptions extends CollaborativeModelerOptions {
|
|
6
15
|
/** Host element. If missing, a detached <div> is created (attach later via attachTo). */
|
|
7
16
|
container?: HTMLElement;
|
|
8
17
|
width?: number | string;
|
|
9
18
|
height?: number | string;
|
|
10
19
|
/** Concatenated to the end of the module list (extension point). */
|
|
11
20
|
additionalModules?: ModuleDeclaration[];
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use `freeArea: { center }`; accepted until the next minor release. Given both,
|
|
23
|
+
* `freeArea` wins.
|
|
24
|
+
*/
|
|
25
|
+
freeRectCenter?: (() => Point | undefined) | undefined;
|
|
12
26
|
}
|
|
13
27
|
/**
|
|
14
28
|
* DI bootstrap and lifecycle shared by Viewer/NavigatedViewer/Modeler. The diagram is
|
|
@@ -27,7 +41,12 @@ export declare abstract class VcBaseViewer {
|
|
|
27
41
|
getOptional<T>(name: string): T | null;
|
|
28
42
|
on<T = unknown>(event: string, callback: EventBusEventCallback<T>, priority?: number): void;
|
|
29
43
|
off<T = unknown>(event: string, callback: EventBusEventCallback<T>): void;
|
|
30
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Replaces the current diagram contents and erases the undo history, silently: no
|
|
46
|
+
* `commandStack.changed`, since an import is no edit a host should save. The document is
|
|
47
|
+
* validated before the canvas is touched, so a rejected one leaves no trace; an open label edit
|
|
48
|
+
* is taken down without committing and reopened afterwards when its element is still there.
|
|
49
|
+
*/
|
|
31
50
|
importDocument(document: ValueChainDocument): ImportWarning[];
|
|
32
51
|
exportDocument(): ValueChainDocument;
|
|
33
52
|
saveSVG(): {
|
|
@@ -39,6 +58,8 @@ export declare abstract class VcBaseViewer {
|
|
|
39
58
|
attachTo(target: HTMLElement): void;
|
|
40
59
|
detach(): void;
|
|
41
60
|
destroy(): void;
|
|
61
|
+
private _render;
|
|
62
|
+
private _currentDocument;
|
|
42
63
|
private _createContainer;
|
|
43
64
|
private _ensureDiagram;
|
|
44
65
|
}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"VcBaseViewer.d.ts","sourceRoot":"","sources":["../src/VcBaseViewer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAIxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,kBAAkB,EACxB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD;;;;;;;GAOG;AACH,MAAM,WAAW,eAAgB,SAAQ,2BAA2B;IAClE,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;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;CACxD;AAUD;;;;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,CAAkB;gBAE/B,OAAO,GAAE,eAAoB;IAKzC,IAAI,SAAS,IAAI,WAAW,CAE3B;IAED,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;IAIvB,mFAAmF;IACnF,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAItC,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAAE,QAAQ,SAAO,GAAG,IAAI;IAIzF,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,IAAI;IAIzE;;;;;OAKG;IACH,cAAc,CAAC,QAAQ,EAAE,kBAAkB,GAAG,aAAa,EAAE;IAmB7D,cAAc,IAAI,kBAAkB;IAIpC,OAAO,IAAI;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;IAI1B,kDAAkD;IAClD,WAAW,IAAI,IAAI;IAYnB,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;CAgBvB"}
|
|
@@ -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 @@
|
|
|
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,32 @@
|
|
|
1
|
+
import { CollaborativeModeler, CollaborativeModelerOptions, 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
|
+
/**
|
|
11
|
+
* The contract's factory options (`freeArea`, `fitOnImport`, `undoRedoKeys`, see
|
|
12
|
+
* `VcViewerOptions`) plus the renderer's own. The viewer ignores the two that need editing.
|
|
13
|
+
*/
|
|
14
|
+
export interface CollaborativeValueChainOptions extends CollaborativeModelerOptions {
|
|
15
|
+
/** Appended to the renderer's own modules (e.g. a host's chrome module). */
|
|
16
|
+
additionalModules?: ModuleDeclaration[] | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use `freeArea: { center }`; accepted until the next minor release. Given both,
|
|
19
|
+
* `freeArea` wins.
|
|
20
|
+
*/
|
|
21
|
+
freeRectCenter?: (() => Point | undefined) | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** The contract surface plus the wrapped diagram for host-specific wiring. */
|
|
24
|
+
export interface CollaborativeValueChainModeler extends CollaborativeModeler {
|
|
25
|
+
readonly elements: ElementsSurface & Required<Pick<ElementsSurface, 'bounds'>>;
|
|
26
|
+
readonly diagram: Modeler | NavigatedViewer;
|
|
27
|
+
}
|
|
28
|
+
/** The editing mount (`meta.editable: true`) of the collaborative-modeler contract. */
|
|
29
|
+
export declare function createCollaborativeModeler(options?: CollaborativeValueChainOptions): CollaborativeValueChainModeler;
|
|
30
|
+
/** The read-only mount (`meta.editable: false`): imports, exports and reveals, never edits. */
|
|
31
|
+
export declare function createCollaborativeViewer(options?: CollaborativeValueChainOptions): CollaborativeValueChainModeler;
|
|
32
|
+
//# 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,EACzB,KAAK,2BAA2B,EAGhC,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;;;GAGG;AACH,MAAM,WAAW,8BAA+B,SAAQ,2BAA2B;IACjF,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAC;IACpD;;;OAGG;IACH,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,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/E,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC;CAC7C;AASD,uFAAuF;AACvF,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,8BAAmC,GAC3C,8BAA8B,CAUhC;AAED,+FAA+F;AAC/F,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,8BAAmC,GAC3C,8BAA8B,CAEhC"}
|
|
@@ -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":"AAAA,OAAO,KAAK,UAAU,MAAM,gDAAgD,CAAC;AAE7E,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,SAAS,MAAM,8CAA8C,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAa1D,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"VcContextPadProvider.d.ts","sourceRoot":"","sources":["../../src/context-pad/VcContextPadProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,gDAAgD,CAAC;AAE7E,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,SAAS,MAAM,8CAA8C,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAa1D,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAEzD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,CAAC;CACnE;AAED,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE/C,MAAM,CAAC,OAAO,OAAO,oBAAoB;IAarC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAjB3B,MAAM,CAAC,OAAO,WAQZ;gBAGA,UAAU,EAAE,UAAU,EACL,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,IAAI,CAAC,UAAU,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
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/diagram-menu/menu.ts"],"names":[],"mappings":"AAOA,qFAAqF;AACrF,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,kBAAkB,GAAG,UAAU,CAAC;AAE7E,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC;CACjC;AAED,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,IAAI,IAAI,CAAC;IACjB,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,qBAAqB,IAAI,IAAI,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,MAAM,gBAAgB,GAAG,KAAK,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,gEAAgE;AAChE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;QACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,mFAAmF;QACnF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACvC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KACrC,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,sBAAsB;IACrC,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC;AAiFD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,sBAA2B,GACnC,aAAa,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;
|
|
1
|
+
{"version":3,"file":"VcRenderer.d.ts","sourceRoot":"","sources":["../../src/draw/VcRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAG5D,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAoB7E,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,YAAY;IAiBhD,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAjBlC,MAAM,CAAC,OAAO,WAAsD;IAEpE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAOtB;IAEH,mFAAmF;IACnF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiC;gBAG5D,QAAQ,EAAE,QAAQ,EACD,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe;IAMnD;;;OAGG;IACH,OAAO,CAAC,gCAAgC;IA6B/B,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAIpC,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,GAAG,UAAU;IAqC1D,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,GAAG,UAAU;IA2BpE,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAOlC,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;IAQ1D,OAAO,CAAC,WAAW;CA+BpB"}
|
package/dist/draw/icons.d.ts
CHANGED
|
@@ -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
|
-
|
|
23
|
-
export declare function
|
|
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
|
package/dist/draw/icons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/draw/icons.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/draw/styles.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
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:
|
|
7
|
-
readonly fill:
|
|
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: "
|
|
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":"
|
|
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"}
|