@miragon/context-maps-renderer 0.1.0 → 0.3.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 +97 -25
- package/dist/CmBaseViewer.d.ts +55 -8
- package/dist/CmBaseViewer.d.ts.map +1 -1
- package/dist/Modeler.d.ts +4 -2
- package/dist/Modeler.d.ts.map +1 -1
- package/dist/NavigatedViewer.d.ts +1 -1
- package/dist/NavigatedViewer.d.ts.map +1 -1
- package/dist/behaviors/CmFlatModelBehavior.d.ts.map +1 -1
- package/dist/chrome/ShortcutsDialog.d.ts +13 -0
- package/dist/chrome/ShortcutsDialog.d.ts.map +1 -0
- package/dist/chrome/TitleDialog.d.ts +15 -0
- package/dist/chrome/TitleDialog.d.ts.map +1 -0
- package/dist/chrome/dialog.d.ts +39 -0
- package/dist/chrome/dialog.d.ts.map +1 -0
- package/dist/chrome/index.d.ts +10 -0
- package/dist/chrome/index.d.ts.map +1 -0
- package/dist/chrome/menu.d.ts +50 -0
- package/dist/chrome/menu.d.ts.map +1 -0
- package/dist/chrome/shortcuts.d.ts +41 -0
- package/dist/chrome/shortcuts.d.ts.map +1 -0
- package/dist/collaborative/CollaborativeContextMaps.d.ts +28 -0
- package/dist/collaborative/CollaborativeContextMaps.d.ts.map +1 -0
- package/dist/collaborative/index.d.ts +2 -0
- package/dist/collaborative/index.d.ts.map +1 -0
- package/dist/connect-handles/CmConnectHandles.d.ts +3 -1
- package/dist/connect-handles/CmConnectHandles.d.ts.map +1 -1
- package/dist/connect-handles/index.d.ts.map +1 -1
- package/dist/context-maps.css +1 -1
- package/dist/context-pad/CmContextPadProvider.d.ts +100 -0
- package/dist/context-pad/CmContextPadProvider.d.ts.map +1 -0
- package/dist/context-pad/index.d.ts +4 -0
- package/dist/context-pad/index.d.ts.map +1 -0
- package/dist/draw/ContextMapsRenderer.d.ts +4 -0
- package/dist/draw/ContextMapsRenderer.d.ts.map +1 -1
- package/dist/draw/lucide.d.ts +29 -0
- package/dist/draw/lucide.d.ts.map +1 -0
- package/dist/draw/palette-icons.d.ts +8 -3
- package/dist/draw/palette-icons.d.ts.map +1 -1
- package/dist/draw/styles.d.ts +11 -0
- package/dist/draw/styles.d.ts.map +1 -1
- package/dist/hover-tooltip/CmHoverTooltip.d.ts +16 -0
- package/dist/hover-tooltip/CmHoverTooltip.d.ts.map +1 -0
- package/dist/hover-tooltip/index.d.ts +5 -0
- package/dist/hover-tooltip/index.d.ts.map +1 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1852 -553
- package/dist/index.js.map +1 -1
- package/dist/io/CmExporter.d.ts +1 -3
- package/dist/io/CmExporter.d.ts.map +1 -1
- package/dist/io/CmImporter.d.ts +13 -1
- package/dist/io/CmImporter.d.ts.map +1 -1
- package/dist/io/saveSvg.d.ts.map +1 -1
- package/dist/io/types.d.ts +10 -1
- package/dist/io/types.d.ts.map +1 -1
- package/dist/keyboard/CmKeyboard.d.ts +11 -1
- package/dist/keyboard/CmKeyboard.d.ts.map +1 -1
- package/dist/keyboard/index.d.ts +2 -1
- package/dist/keyboard/index.d.ts.map +1 -1
- package/dist/label-editing/CmLabelEditing.d.ts +66 -3
- package/dist/label-editing/CmLabelEditing.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/legend/CmLegend.d.ts +15 -0
- package/dist/legend/CmLegend.d.ts.map +1 -0
- package/dist/legend/index.d.ts +10 -0
- package/dist/legend/index.d.ts.map +1 -0
- package/dist/legend/legendContent.d.ts +38 -0
- package/dist/legend/legendContent.d.ts.map +1 -0
- package/dist/model/CmElementFactory.d.ts +2 -1
- package/dist/model/CmElementFactory.d.ts.map +1 -1
- package/dist/model/di-types.d.ts +4 -0
- package/dist/model/di-types.d.ts.map +1 -1
- package/dist/modeling/CmModeling.d.ts +2 -0
- package/dist/modeling/CmModeling.d.ts.map +1 -1
- package/dist/modeling/cmd/UpdateTitleHandler.d.ts +17 -0
- package/dist/modeling/cmd/UpdateTitleHandler.d.ts.map +1 -0
- package/dist/palette/CmPaletteProvider.d.ts +29 -2
- package/dist/palette/CmPaletteProvider.d.ts.map +1 -1
- package/dist/palette/index.d.ts +2 -1
- package/dist/palette/index.d.ts.map +1 -1
- package/dist/read-only/CmReadOnly.d.ts +20 -0
- package/dist/read-only/CmReadOnly.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/rules/CmRules.d.ts.map +1 -1
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/theme/palette.d.ts +26 -22
- package/dist/theme/palette.d.ts.map +1 -1
- package/dist/validation/CmValidationMarkers.d.ts.map +1 -1
- package/package.json +15 -6
- package/dist/draw/icons.d.ts +0 -10
- package/dist/draw/icons.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -8,10 +8,13 @@ and full editor for strategic Domain-Driven Design [Context Maps](https://contex
|
|
|
8
8
|
diagrams, built on [diagram-js](https://github.com/bpmn-io/diagram-js) (MIT).
|
|
9
9
|
|
|
10
10
|
It renders the canonical document from
|
|
11
|
-
[`@miragon/context-maps-schema-model`](../schema-model) and gives you palette, move,
|
|
11
|
+
[`@miragon/context-maps-schema-model`](../schema-model) and gives you palette, move,
|
|
12
12
|
connect-by-relationship, context pad, inline label editing and undo/redo — with no UI framework
|
|
13
|
-
required. Mount it into any `<div>`; the web app
|
|
14
|
-
exact package.
|
|
13
|
+
required. Mount it into any `<div>`; the web app and the VS Code extension both wrap this
|
|
14
|
+
exact package. It implements the collaborative-modeler contract of
|
|
15
|
+
[`@miragon/modeler-api`](https://www.npmjs.com/package/@miragon/modeler-api), and it hands a chrome
|
|
16
|
+
such as [`@miragon/modeler-shell`](https://www.npmjs.com/package/@miragon/modeler-shell) its legend,
|
|
17
|
+
menu entries and shortcuts dialog without importing it.
|
|
15
18
|
|
|
16
19
|
## Install
|
|
17
20
|
|
|
@@ -21,11 +24,11 @@ npm install @miragon/context-maps-renderer @miragon/context-maps-schema-model
|
|
|
21
24
|
|
|
22
25
|
## Three entry points
|
|
23
26
|
|
|
24
|
-
| Class | Use it for
|
|
25
|
-
| ----------------- |
|
|
26
|
-
| `Viewer` | Read-only rendering, no interaction (thumbnails, static embeds).
|
|
27
|
-
| `NavigatedViewer` | Read-only + zoom (scroll), pan (drag) and selection.
|
|
28
|
-
| `Modeler` | The full editor: palette, move,
|
|
27
|
+
| Class | Use it for |
|
|
28
|
+
| ----------------- | ---------------------------------------------------------------------- |
|
|
29
|
+
| `Viewer` | Read-only rendering, no interaction (thumbnails, static embeds). |
|
|
30
|
+
| `NavigatedViewer` | Read-only + zoom (scroll), pan (drag) and selection. |
|
|
31
|
+
| `Modeler` | The full editor: palette, move, context pad, label editing, undo/redo. |
|
|
29
32
|
|
|
30
33
|
All three share a common base (`CmBaseViewer`) with the same import/export and lifecycle API.
|
|
31
34
|
|
|
@@ -38,7 +41,7 @@ import { SAMPLE_DOCUMENT } from "@miragon/context-maps-schema-model";
|
|
|
38
41
|
|
|
39
42
|
const modeler = new Modeler({ container: document.querySelector("#canvas")! });
|
|
40
43
|
|
|
41
|
-
// Load a document (
|
|
44
|
+
// Load a document (fits the content, never above 100 %; an empty map shows 100 %)
|
|
42
45
|
const { warnings } = modeler.importDocument(SAMPLE_DOCUMENT);
|
|
43
46
|
|
|
44
47
|
// Read the live canvas back as the canonical model
|
|
@@ -66,26 +69,87 @@ new Modeler({
|
|
|
66
69
|
width?: number | string, // canvas width (default "100%")
|
|
67
70
|
height?: number | string, // canvas height (default "100%", or "600px" with no container)
|
|
68
71
|
additionalModules?: ModuleDeclaration[], // extra diagram-js modules
|
|
72
|
+
undoRedoKeys?: boolean, // bind Cmd/Ctrl+Z, Shift+Z, Y to the canvas (default true)
|
|
73
|
+
freeRectInsets?: () => { top: number; right: number; bottom: number; left: number },
|
|
69
74
|
});
|
|
70
75
|
```
|
|
71
76
|
|
|
77
|
+
- `undoRedoKeys: false` leaves the undo and redo keys unbound and unprevented, for a host whose
|
|
78
|
+
document owns the history (the VS Code extension).
|
|
79
|
+
- `freeRectInsets` are the margins of the container a host's chrome covers. The fit after an import
|
|
80
|
+
centres the content in what is left, and Enter or Space on a palette entry (a click with
|
|
81
|
+
`detail === 0`) places the new context in its centre, 24px further down and right while that spot
|
|
82
|
+
is taken, selected and with its name editor open. Without it the renderer keeps room for its own
|
|
83
|
+
palette.
|
|
84
|
+
|
|
72
85
|
### Shared methods (`Viewer` / `NavigatedViewer` / `Modeler`)
|
|
73
86
|
|
|
74
87
|
| Method | Returns | Purpose |
|
|
75
88
|
| ---------------------------------- | ------------------------------- | ------------------------------------------------- |
|
|
76
|
-
| `importDocument(doc)` | `{ warnings: ImportWarning[] }` | Replace canvas content and
|
|
89
|
+
| `importDocument(doc)` | `{ warnings: ImportWarning[] }` | Replace canvas content and fit (see below). |
|
|
90
|
+
| `importText(text)` | `{ warnings: ImportWarning[] }` | Parse a `.cm` text and import it; throws if not. |
|
|
77
91
|
| `exportDocument()` | `CmDocument` | Rebuild the canonical model from the live canvas. |
|
|
92
|
+
| `exportText()` | `string` | The canonical `.cm` text (ends in a line break). |
|
|
78
93
|
| `saveSVG()` | `{ svg: string }` | Self-contained SVG snapshot (fitted viewBox). |
|
|
79
|
-
| `setMeta(partial)` / `getMeta()` | — / `RootBusinessObject` |
|
|
94
|
+
| `setMeta(partial)` / `getMeta()` | — / `RootBusinessObject` | Rename the map (an undoable command) / read it. |
|
|
80
95
|
| `attachTo(el)` / `detach()` | `void` | Move the canvas in/out of the DOM (keeps state). |
|
|
81
96
|
| `clear()` / `destroy()` | `void` | Empty the canvas / tear it down. |
|
|
82
97
|
| `on(event, cb)` / `off(event, cb)` | `void` | Subscribe to diagram-js events. |
|
|
83
98
|
| `get<T>(name)` | `T` | Resolve a diagram-js service (advanced). |
|
|
84
99
|
|
|
100
|
+
An import is **silent**: the previous document's undo history goes without a
|
|
101
|
+
`commandStack.changed`, so a host that saves on every change never writes an import back. It
|
|
102
|
+
**rejects without a trace**: a document with a duplicate id or an id of the engine's roots throws
|
|
103
|
+
before anything is removed. It is **lossless**: keys the model does not know and relationships whose
|
|
104
|
+
ends are not on the map come back on export. A label edit open during an import is taken down and
|
|
105
|
+
reopened on the element with the same id, with the typed text.
|
|
106
|
+
|
|
85
107
|
### Modeler-only
|
|
86
108
|
|
|
87
109
|
`undo()`, `redo()`, `canUndo()`, `canRedo()`.
|
|
88
110
|
|
|
111
|
+
## Collaborative modeler
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
import { createCollaborativeModeler } from "@miragon/context-maps-renderer";
|
|
115
|
+
|
|
116
|
+
const modeler = createCollaborativeModeler({ additionalModules: [], undoRedoKeys: true });
|
|
117
|
+
modeler.attachTo(host); // attached to the document, with a size
|
|
118
|
+
await modeler.importText(text); // silent; rejects (and changes nothing) for a non-importable text
|
|
119
|
+
modeler.onContentChanged(() => save(modeler.exportText()));
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`createCollaborativeModeler` and `createCollaborativeViewer` implement the `CollaborativeModeler`
|
|
123
|
+
contract of `@miragon/modeler-api` 1.1 (`meta.notation` is `"context-maps"`): the canonical JSON text
|
|
124
|
+
as the text lane, `onContentChanged` for every user-visible change (element commands, the title,
|
|
125
|
+
undo, redo) and never for an import, the viewbox as view state, and the `elements` surface over the
|
|
126
|
+
context and relationship ids (their labels as names). `modeler.diagram` is the wrapped `Modeler` or
|
|
127
|
+
`NavigatedViewer`. The contract's conformance kit runs in this package's browser tests, every case
|
|
128
|
+
and every hook, without a skip or an advisory.
|
|
129
|
+
|
|
130
|
+
## Around the canvas
|
|
131
|
+
|
|
132
|
+
What a chrome around the canvas shows, typed structurally (a `@miragon/modeler-shell` handle fits):
|
|
133
|
+
|
|
134
|
+
- `renderLegend(body, { tooltip })` renders the notation legend (subdomain types, integration roles,
|
|
135
|
+
relationship patterns) into a chrome's legend card, each row explained in the chrome's tooltip.
|
|
136
|
+
Hosts without such a chrome add `cmLegendModule`, a legend card on the canvas.
|
|
137
|
+
- `contextMapMenu({ exports, showKeyboardShortcuts, editTitle })` builds the Model group's "Map
|
|
138
|
+
title…" (with `editTitle`), the Export group (PNG, SVG, JSON, CML; an export's `shortcut` shows as
|
|
139
|
+
its chip) and the Help group's "Keyboard shortcuts…". `createShortcutsDialog(chrome, { fileKeys })`
|
|
140
|
+
is that dialog, with a File group (Open… and Export as JSON on Cmd/Ctrl+O and S) for a web app
|
|
141
|
+
that binds those keys; `createTitleDialog(chrome, { title, setTitle })` renames the map in a
|
|
142
|
+
modal dialog with one field, Cancel and Apply. Both dialogs live in the chrome's root and go with
|
|
143
|
+
`destroy()`.
|
|
144
|
+
- While a drag runs on the canvas, the chrome's legend island (`[data-chrome="legend"]`) lets the
|
|
145
|
+
pointer through, so a connect drag released on a context behind it still connects.
|
|
146
|
+
- `cmReadOnly` (part of the `Modeler`) locks every edit while a host cannot take edits from the
|
|
147
|
+
canvas, an invalid file in an IDE: no context pad, move, create, connect, delete or label editor;
|
|
148
|
+
selection, zoom, pan, select all and export stay.
|
|
149
|
+
- The keyboard listens on the document but only acts on keys aimed at the canvas: keys someone
|
|
150
|
+
already handled (`defaultPrevented`) and keys from outside the canvas container pass. `Cmd/Ctrl+A`
|
|
151
|
+
selects every element.
|
|
152
|
+
|
|
89
153
|
### Helpers & types
|
|
90
154
|
|
|
91
155
|
- **Type guards:** `isCmElement`, `isCmContext`, `isCmRelationship`.
|
|
@@ -100,19 +164,23 @@ The package is a set of [didi](https://github.com/nikku/didi) modules layered on
|
|
|
100
164
|
exported (e.g. `cmDrawModule`, `cmPaletteModule`, `cmModelingModule`) so you can compose your own
|
|
101
165
|
viewer via `additionalModules`:
|
|
102
166
|
|
|
103
|
-
| Module
|
|
104
|
-
|
|
|
105
|
-
| `cmModelModule`
|
|
106
|
-
| `cmDrawModule`
|
|
107
|
-
| `ioModule`
|
|
108
|
-
| `cmModelingModule`
|
|
109
|
-
| `cmRulesModule`
|
|
110
|
-
| `cmBehaviorsModule`
|
|
111
|
-
| `cmPaletteModule`
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
167
|
+
| Module | Responsibility |
|
|
168
|
+
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
169
|
+
| `cmModelModule` | Element factory with notation defaults (`CmElementFactory`). |
|
|
170
|
+
| `cmDrawModule` | Custom SVG rendering of contexts and relationships (`ContextMapsRenderer`). |
|
|
171
|
+
| `ioModule` | Document ↔ canvas bridge (`CmImporter`, `CmExporter`, `saveSVG`). |
|
|
172
|
+
| `cmModelingModule` | High-level mutations — label, subdomain type, relationship pattern, roles, colours. |
|
|
173
|
+
| `cmRulesModule` | Editing rules (what can move / be created / connected; no resize). |
|
|
174
|
+
| `cmBehaviorsModule` | Keeps the model **flat** — shapes never nest. |
|
|
175
|
+
| `cmPaletteModule` | The tool palette: lasso tool + create contexts (drag, click, or Enter/Space into the free rectangle). |
|
|
176
|
+
| `cmConnectHandlesModule` | Opt-in (not in the default `Modeler`): four outward connect arrows around the selected context. |
|
|
177
|
+
| `cmContextPadModule` | Per-element quick actions: append a connected context, connect, subdomain-type / pattern / integration-role menus, owning team, description, in-place rename, swap ends, delete. |
|
|
178
|
+
| `cmLegendModule` | Opt-in: the notation legend as a collapsible card (bottom-left), for hosts without a chrome that renders `renderLegend`. |
|
|
179
|
+
| `cmHoverTooltipModule` | An element's own data (description, team, technology) on hover, inside the canvas container. |
|
|
180
|
+
| `cmReadOnlyModule` | The canvas lock (`cmReadOnly`) every editing feature consults. |
|
|
181
|
+
| `cmLabelEditingModule` | In-place direct name editing (double-click / pad), bpmn.io style. |
|
|
182
|
+
| `cmKeyboardModule` | Select all / undo / redo / delete for keys aimed at the canvas (`undoRedoKeys` option). |
|
|
183
|
+
| `cmZOrderModule` | Fixed stacking order (relationships behind, contexts on top). |
|
|
116
184
|
|
|
117
185
|
### Rendering
|
|
118
186
|
|
|
@@ -145,4 +213,8 @@ npm run typecheck
|
|
|
145
213
|
|
|
146
214
|
## License
|
|
147
215
|
|
|
148
|
-
[MIT](../../LICENSE). diagram-js and its dependencies are MIT / ISC / Apache-2.0.
|
|
216
|
+
[MIT](../../LICENSE). diagram-js and its dependencies are MIT / ISC / Apache-2.0. The icons of the
|
|
217
|
+
context pad, the connect handles, the validation markers, the lasso and the shortcuts dialog are
|
|
218
|
+
[Lucide](https://lucide.dev) icons (lucide-static 1.59.0, ISC, © Lucide Icons and Contributors),
|
|
219
|
+
copied into `src/draw/lucide.ts`; `arrow-right`, `circle-x`, `trash`, `triangle-alert` and `x` derive
|
|
220
|
+
from [Feather](https://feathericons.com) (MIT, © Cole Bemis).
|
package/dist/CmBaseViewer.d.ts
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
import { ModuleDeclaration } from 'didi';
|
|
2
2
|
import { CmDocument } from '@miragon/context-maps-schema-model';
|
|
3
3
|
import { ImportWarning, RootBusinessObject } from './io/types.js';
|
|
4
|
+
/** Container margins in screen px that a host's chrome covers. */
|
|
5
|
+
export interface FreeRectInsets {
|
|
6
|
+
top: number;
|
|
7
|
+
right: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
left: number;
|
|
10
|
+
}
|
|
4
11
|
export interface CmViewerOptions {
|
|
5
12
|
/** Host element. When absent, a detached <div> is created (attach later). */
|
|
6
|
-
container?: HTMLElement;
|
|
7
|
-
width?: number | string;
|
|
8
|
-
height?: number | string;
|
|
13
|
+
container?: HTMLElement | undefined;
|
|
14
|
+
width?: number | string | undefined;
|
|
15
|
+
height?: number | string | undefined;
|
|
9
16
|
/** Appended to the module list (extension point). */
|
|
10
|
-
additionalModules?: ModuleDeclaration[];
|
|
17
|
+
additionalModules?: ModuleDeclaration[] | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Bind Cmd/Ctrl+Z, Cmd/Ctrl+Shift+Z and Cmd/Ctrl+Y to the canvas undo/redo (default true).
|
|
20
|
+
* Pass false when the host owns the history (the VS Code document), so the keys reach it.
|
|
21
|
+
*/
|
|
22
|
+
undoRedoKeys?: boolean | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The margins of the container the host's chrome covers (palette row, zoom panel, legend). The
|
|
25
|
+
* fit after an import centres the content in what is left, and an element created from the
|
|
26
|
+
* palette with Enter or Space lands in its centre (guide §5.5, §5.9). Default: room for the
|
|
27
|
+
* renderer's own palette.
|
|
28
|
+
*/
|
|
29
|
+
freeRectInsets?: (() => FreeRectInsets) | undefined;
|
|
11
30
|
}
|
|
12
31
|
export type EventCallback<T = unknown> = (event: T) => void;
|
|
13
32
|
export declare abstract class CmBaseViewer {
|
|
@@ -20,23 +39,51 @@ export declare abstract class CmBaseViewer {
|
|
|
20
39
|
private _ensureDiagram;
|
|
21
40
|
/** Resolve a diagram-js service from the didi injector. */
|
|
22
41
|
get<T>(name: string): T;
|
|
42
|
+
/** The margins the host's chrome covers right now. */
|
|
43
|
+
private readonly freeRectInsets;
|
|
44
|
+
/** A service only some of the viewers have (the Modeler's editing services), else null. */
|
|
45
|
+
private _optional;
|
|
23
46
|
on<T = unknown>(event: string, callback: EventCallback<T>, priority?: number): void;
|
|
24
47
|
off(event: string, callback: EventCallback): void;
|
|
25
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Load a document into the canvas (replaces existing content). Silent: the previous document's
|
|
50
|
+
* undo history goes without a `commandStack.changed`, so a host that saves on every change does
|
|
51
|
+
* not write the import back. Throws before anything changes when the document cannot be drawn.
|
|
52
|
+
*/
|
|
26
53
|
importDocument(doc: CmDocument): {
|
|
27
54
|
warnings: ImportWarning[];
|
|
28
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Load the text of a `.cm`/`.cm.json` file. Throws (and changes nothing) when the text is no
|
|
58
|
+
* importable document.
|
|
59
|
+
*/
|
|
60
|
+
importText(text: string): {
|
|
61
|
+
warnings: ImportWarning[];
|
|
62
|
+
};
|
|
29
63
|
/** Current canvas state as a canonical document. */
|
|
30
64
|
exportDocument(): CmDocument;
|
|
31
|
-
/**
|
|
65
|
+
/** Current canvas state as the canonical file text (ends in one line break). */
|
|
66
|
+
exportText(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Update diagram-level metadata on the root. In an editor a title change is an undoable command
|
|
69
|
+
* (`cmModeling.setTitle`); a viewer has no history and writes it directly. A locked editor
|
|
70
|
+
* (`cmReadOnly`) changes nothing: its host takes no edits, and the next import would silently
|
|
71
|
+
* revert the title.
|
|
72
|
+
*/
|
|
32
73
|
setMeta(partial: Partial<RootBusinessObject>): void;
|
|
33
|
-
/** Read diagram-level metadata
|
|
74
|
+
/** Read diagram-level metadata from the root; undefined before the first import. */
|
|
34
75
|
getMeta(): RootBusinessObject | undefined;
|
|
76
|
+
/** Through the registry: asking the canvas would create an implicit root before an import. */
|
|
77
|
+
private _documentRoot;
|
|
35
78
|
/** Standalone, self-contained SVG snapshot. */
|
|
36
79
|
saveSVG(): {
|
|
37
80
|
svg: string;
|
|
38
81
|
};
|
|
39
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Centres the content in the container minus room for the chrome, at the largest zoom that
|
|
84
|
+
* shows all of it and never above 100 % (guide §5.9); an empty map shows 100 %. The same view
|
|
85
|
+
* for the same document and container (the contract's fitted view after an import).
|
|
86
|
+
*/
|
|
40
87
|
private _fit;
|
|
41
88
|
/** Attach the container into `target`. */
|
|
42
89
|
attachTo(target: HTMLElement): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmBaseViewer.d.ts","sourceRoot":"","sources":["../src/CmBaseViewer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"CmBaseViewer.d.ts","sourceRoot":"","sources":["../src/CmBaseViewer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM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|
-
*
|
|
4
|
+
* Full Context Maps editor: palette/create, move, connect with rules,
|
|
5
|
+
* context pad, inline label editing, undo/redo, and the edit lock for a
|
|
6
|
+
* document the host cannot take edits for (`cmReadOnly`). Boxes are
|
|
7
|
+
* fixed-size — no resize feature.
|
|
6
8
|
*/
|
|
7
9
|
export declare class Modeler extends NavigatedViewer {
|
|
8
10
|
protected _getModules(): ModuleDeclaration[];
|
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;
|
|
1
|
+
{"version":3,"file":"Modeler.d.ts","sourceRoot":"","sources":["../src/Modeler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAQ9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAYvD;;;;;GAKG;AACH,qBAAa,OAAQ,SAAQ,eAAe;cACvB,WAAW,IAAI,iBAAiB,EAAE;IAsBrD,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 { Viewer } from './Viewer.js';
|
|
3
|
-
/** Read-only + navigation: zoom (scroll), pan (drag), selection. */
|
|
3
|
+
/** Read-only + navigation: zoom (scroll), pan (drag), selection, the elements' own data on hover. */
|
|
4
4
|
export declare class NavigatedViewer extends Viewer {
|
|
5
5
|
protected _getModules(): ModuleDeclaration[];
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigatedViewer.d.ts","sourceRoot":"","sources":["../src/NavigatedViewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAI9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"NavigatedViewer.d.ts","sourceRoot":"","sources":["../src/NavigatedViewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAI9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,qGAAqG;AACrG,qBAAa,eAAgB,SAAQ,MAAM;cACtB,WAAW,IAAI,iBAAiB,EAAE;CAStD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmFlatModelBehavior.d.ts","sourceRoot":"","sources":["../../src/behaviors/CmFlatModelBehavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,kBAAkB,MAAM,2CAA2C,CAAC;AAC3E,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AAQtE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,kBAAkB;IACjE,OAAgB,OAAO,WAAsC;gBAEjD,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"CmFlatModelBehavior.d.ts","sourceRoot":"","sources":["../../src/behaviors/CmFlatModelBehavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,kBAAkB,MAAM,2CAA2C,CAAC;AAC3E,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AAQtE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,kBAAkB;IACjE,OAAgB,OAAO,WAAsC;gBAEjD,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;CAwDnE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChromeDialog, DialogChrome } from './dialog.js';
|
|
2
|
+
import { ContextMapShortcutOptions, ShortcutsChrome } from './shortcuts.js';
|
|
3
|
+
/** What the dialog needs of the chrome around the map; a `@miragon/modeler-shell` handle fits. */
|
|
4
|
+
export interface ShortcutsDialogChrome extends ShortcutsChrome, DialogChrome {
|
|
5
|
+
readonly messages: ShortcutsChrome["messages"] & DialogChrome["messages"];
|
|
6
|
+
}
|
|
7
|
+
export type ShortcutsDialog = ChromeDialog;
|
|
8
|
+
/**
|
|
9
|
+
* The "Keyboard shortcuts…" dialog of the Help group (guide §5.4, §8): one table per group, the
|
|
10
|
+
* keys as chips like the chrome tooltip's.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createShortcutsDialog(chrome: ShortcutsDialogChrome, options?: ContextMapShortcutOptions): ShortcutsDialog;
|
|
13
|
+
//# sourceMappingURL=ShortcutsDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShortcutsDialog.d.ts","sourceRoot":"","sources":["../../src/chrome/ShortcutsDialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAChG,OAAO,EAEL,KAAK,yBAAyB,EAE9B,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAKxB,kGAAkG;AAClG,MAAM,WAAW,qBAAsB,SAAQ,eAAe,EAAE,YAAY;IAC1E,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;CAC3E;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAsB3C;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,GAAE,yBAA8B,GACtC,eAAe,CAWjB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChromeDialog, DialogChrome } from './dialog.js';
|
|
2
|
+
/** The map's title, read when the dialog opens and written when it applies. */
|
|
3
|
+
export interface MapTitle {
|
|
4
|
+
title(): string;
|
|
5
|
+
setTitle(title: string): void;
|
|
6
|
+
}
|
|
7
|
+
export type TitleDialogChrome = DialogChrome;
|
|
8
|
+
export type TitleDialog = ChromeDialog;
|
|
9
|
+
/**
|
|
10
|
+
* The "Map title…" dialog of the Model group: guide §5.4 keeps form fields out of the menu, so the
|
|
11
|
+
* entry opens a dialog (§8) with the title field, Cancel and Apply. Enter applies, Escape cancels;
|
|
12
|
+
* an unchanged title writes nothing, so the map's history gets no empty step.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createTitleDialog(chrome: TitleDialogChrome, mapTitle: MapTitle): TitleDialog;
|
|
15
|
+
//# sourceMappingURL=TitleDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TitleDialog.d.ts","sourceRoot":"","sources":["../../src/chrome/TitleDialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhG,+EAA+E;AAC/E,MAAM,WAAW,QAAQ;IACvB,KAAK,IAAI,MAAM,CAAC;IAChB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAC7C,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC;AASvC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAwC5F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 ChromeDialog {
|
|
14
|
+
open(): void;
|
|
15
|
+
isOpen(): boolean;
|
|
16
|
+
close(): void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface ChromeDialogSpec {
|
|
20
|
+
/** Class of the `<dialog>` next to `cm-dialog`, for the dialog's own rules. */
|
|
21
|
+
readonly className: string;
|
|
22
|
+
readonly titleId: string;
|
|
23
|
+
readonly title: string;
|
|
24
|
+
/** The parts below the header, built once on the first open. */
|
|
25
|
+
content(close: () => void): Node[];
|
|
26
|
+
/** Runs before every open, while the dialog is still closed. */
|
|
27
|
+
beforeOpen?(): void;
|
|
28
|
+
/** Runs after every open, once the dialog shows and holds the focus. */
|
|
29
|
+
afterOpen?(): void;
|
|
30
|
+
}
|
|
31
|
+
export declare function element<K extends keyof HTMLElementTagNameMap>(tag: K, className: string, text?: string): HTMLElementTagNameMap[K];
|
|
32
|
+
/**
|
|
33
|
+
* A dialog of the map's chrome (guide §8, "Modeler dialogs" of the shell's API): a native modal
|
|
34
|
+
* <dialog> inside the chrome's root, so the browser keeps the focus inside it and closes it on
|
|
35
|
+
* Escape. Built on the first open and kept (closed) afterwards; `destroy()` removes it. The host
|
|
36
|
+
* calls it with the diagram's teardown, since the chrome removes only what it added itself.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createChromeDialog(chrome: DialogChrome, spec: ChromeDialogSpec): ChromeDialog;
|
|
39
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@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enu, JSON_EXPORT_LABEL } from './menu.js';
|
|
2
|
+
export type { MapExport, MapExports, MapMenu, MapMenuAction, MapMenuActions, MapMenuDialog, MapMenuEntry, MapMenuIcon, } from './menu.js';
|
|
3
|
+
export { contextMapShortcuts } from './shortcuts.js';
|
|
4
|
+
export type { ContextMapShortcutOptions, ShortcutGroup, ShortcutKeyNames, ShortcutPlatform, ShortcutRow, ShortcutsChrome, } from './shortcuts.js';
|
|
5
|
+
export { createShortcutsDialog } from './ShortcutsDialog.js';
|
|
6
|
+
export type { ShortcutsDialog, ShortcutsDialogChrome } from './ShortcutsDialog.js';
|
|
7
|
+
export { createTitleDialog } from './TitleDialog.js';
|
|
8
|
+
export type { MapTitle, TitleDialog, TitleDialogChrome } from './TitleDialog.js';
|
|
9
|
+
export type { ChromeDialog, DialogChrome } from './dialog.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chrome/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9D,YAAY,EACV,SAAS,EACT,UAAU,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EACV,yBAAyB,EACzB,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;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACjF,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
onSelect(): void;
|
|
17
|
+
}
|
|
18
|
+
export type MapMenuEntry = MapMenuAction | MapMenuDialog;
|
|
19
|
+
export interface MapMenu {
|
|
20
|
+
readonly model: readonly MapMenuEntry[];
|
|
21
|
+
readonly export: readonly MapMenuEntry[];
|
|
22
|
+
readonly help: readonly MapMenuEntry[];
|
|
23
|
+
}
|
|
24
|
+
export interface MapExport {
|
|
25
|
+
onSelect(): void;
|
|
26
|
+
/** The chip of an app key that runs the same export, e.g. "⌘S". */
|
|
27
|
+
readonly shortcut?: string | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The exports a host offers, in the guide's order: PNG first (the more frequent target), then
|
|
31
|
+
* SVG, then the map's own JSON and Context Mapper's CML.
|
|
32
|
+
*/
|
|
33
|
+
export interface MapExports {
|
|
34
|
+
readonly png: MapExport;
|
|
35
|
+
readonly svg: MapExport;
|
|
36
|
+
readonly json: MapExport;
|
|
37
|
+
readonly cml: MapExport;
|
|
38
|
+
}
|
|
39
|
+
export interface MapMenuActions {
|
|
40
|
+
readonly exports: MapExports;
|
|
41
|
+
showKeyboardShortcuts(): void;
|
|
42
|
+
/** Opens the dialog that renames the map; without it the Model group has no title entry. */
|
|
43
|
+
editTitle?: (() => void) | undefined;
|
|
44
|
+
}
|
|
45
|
+
/** The map's native file in the Export group and in the shortcuts dialog. */
|
|
46
|
+
export declare const JSON_EXPORT_LABEL = "Export as JSON";
|
|
47
|
+
/** The menu groups of the context map (guide §5.4): Model, Export with PNG first, Help. */
|
|
48
|
+
export declare function contextMapMenu(actions: MapMenuActions): MapMenu;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/chrome/menu.ts"],"names":[],"mappings":"AAOA,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,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;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,qBAAqB,IAAI,IAAI,CAAC;IAC9B,4FAA4F;IAC5F,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CACtC;AAED,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAkBlD,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAsB/D"}
|
|
@@ -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 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
|
+
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 ContextMapShortcutOptions {
|
|
33
|
+
/** The web app's file keys: Cmd/Ctrl+O opens a file, Cmd/Ctrl+S exports the map as JSON. */
|
|
34
|
+
readonly fileKeys?: boolean | undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Every shortcut of the map, grouped as guide §5.4 asks (View, Edit, Tools), after the web app's
|
|
38
|
+
* File keys where it binds them.
|
|
39
|
+
*/
|
|
40
|
+
export declare function contextMapShortcuts(chrome: ShortcutsChrome, options?: ContextMapShortcutOptions): ShortcutGroup[];
|
|
41
|
+
//# sourceMappingURL=shortcuts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortcuts.d.ts","sourceRoot":"","sources":["../../src/chrome/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,4DAA4D;AAC5D,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,yBAAyB;IACxC,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC;AAqED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,yBAA8B,GACtC,aAAa,EAAE,CAuCjB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CollaborativeModeler, ElementsSurface } from '@miragon/modeler-api';
|
|
2
|
+
import { ModuleDeclaration } from 'didi';
|
|
3
|
+
import { FreeRectInsets } from '../CmBaseViewer.js';
|
|
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 CONTEXT_MAPS_NOTATION = "context-maps";
|
|
8
|
+
export interface CollaborativeContextMapsOptions {
|
|
9
|
+
/** Appended to the renderer's own modules (e.g. a host's chrome module). */
|
|
10
|
+
additionalModules?: ModuleDeclaration[] | undefined;
|
|
11
|
+
/** See `CmViewerOptions.undoRedoKeys` (default true). */
|
|
12
|
+
undoRedoKeys?: boolean | undefined;
|
|
13
|
+
/** See `CmViewerOptions.freeRectInsets`. */
|
|
14
|
+
freeRectInsets?: (() => FreeRectInsets) | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** The contract surface plus the wrapped diagram for host-specific wiring. */
|
|
17
|
+
export interface CollaborativeContextMapsModeler extends CollaborativeModeler {
|
|
18
|
+
readonly elements: ElementsSurface;
|
|
19
|
+
readonly diagram: Modeler | NavigatedViewer;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The editing mount (`meta.editable: true`) of the collaborative-modeler contract: the text lane
|
|
23
|
+
* is the canonical JSON of a `.cm`/`.cm.json` file (`serializeDocumentText`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function createCollaborativeModeler(options?: CollaborativeContextMapsOptions): CollaborativeContextMapsModeler;
|
|
26
|
+
/** The read-only mount (`meta.editable: false`): imports, exports and reveals, never edits. */
|
|
27
|
+
export declare function createCollaborativeViewer(options?: Omit<CollaborativeContextMapsOptions, "undoRedoKeys">): CollaborativeContextMapsModeler;
|
|
28
|
+
//# sourceMappingURL=CollaborativeContextMaps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollaborativeContextMaps.d.ts","sourceRoot":"","sources":["../../src/collaborative/CollaborativeContextMaps.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EAEzB,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAM9C,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AAEpD,MAAM,WAAW,+BAA+B;IAC9C,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,cAAc,CAAC,GAAG,SAAS,CAAC;CACrD;AAED,8EAA8E;AAC9E,MAAM,WAAW,+BAAgC,SAAQ,oBAAoB;IAC3E,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC;CAC7C;AASD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,+BAAoC,GAC5C,+BAA+B,CASjC;AAED,+FAA+F;AAC/F,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,IAAI,CAAC,+BAA+B,EAAE,cAAc,CAAM,GAClE,+BAA+B,CAQjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collaborative/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,GACrC,MAAM,+BAA+B,CAAC"}
|
|
@@ -3,13 +3,15 @@ import { default as Overlays } from 'diagram-js/lib/features/overlays/Overlays';
|
|
|
3
3
|
import { default as Selection } from 'diagram-js/lib/features/selection/Selection';
|
|
4
4
|
import { default as Connect } from 'diagram-js/lib/features/connect/Connect';
|
|
5
5
|
import { default as Dragging } from 'diagram-js/lib/features/dragging/Dragging';
|
|
6
|
+
import { CmReadOnly } from '../read-only/index.js';
|
|
6
7
|
export default class CmConnectHandles {
|
|
7
8
|
private readonly eventBus;
|
|
8
9
|
private readonly selection;
|
|
9
10
|
private readonly overlays;
|
|
10
11
|
private readonly dragging;
|
|
12
|
+
private readonly readOnly;
|
|
11
13
|
static $inject: string[];
|
|
12
|
-
constructor(eventBus: EventBus, selection: Selection, overlays: Overlays, connect: Connect, dragging: Dragging);
|
|
14
|
+
constructor(eventBus: EventBus, selection: Selection, overlays: Overlays, connect: Connect, dragging: Dragging, readOnly: Pick<CmReadOnly, "isReadOnly">);
|
|
13
15
|
private refresh;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=CmConnectHandles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CmConnectHandles.d.ts","sourceRoot":"","sources":["../../src/connect-handles/CmConnectHandles.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,SAAS,MAAM,6CAA6C,CAAC;AACzE,OAAO,KAAK,OAAO,MAAM,yCAAyC,CAAC;AACnE,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"CmConnectHandles.d.ts","sourceRoot":"","sources":["../../src/connect-handles/CmConnectHandles.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,SAAS,MAAM,6CAA6C,CAAC;AACzE,OAAO,KAAK,OAAO,MAAM,yCAAyC,CAAC;AACnE,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AAKtE,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAmCjF,MAAM,CAAC,OAAO,OAAO,gBAAgB;IAIjC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAR3B,MAAM,CAAC,OAAO,WAA8E;gBAGzE,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EACnC,OAAO,EAAE,OAAO,EACC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC;IAa3D,OAAO,CAAC,OAAO;CAoDhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connect-handles/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connect-handles/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAO9C,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,EAAE,iBAIpC,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|