@miragon/context-maps-renderer 0.2.0 → 0.4.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 (80) hide show
  1. package/README.md +100 -10
  2. package/dist/CmBaseViewer.d.ts +67 -8
  3. package/dist/CmBaseViewer.d.ts.map +1 -1
  4. package/dist/Modeler.d.ts +3 -2
  5. package/dist/Modeler.d.ts.map +1 -1
  6. package/dist/NavigatedViewer.d.ts +1 -1
  7. package/dist/NavigatedViewer.d.ts.map +1 -1
  8. package/dist/chrome/ShortcutsDialog.d.ts +13 -0
  9. package/dist/chrome/ShortcutsDialog.d.ts.map +1 -0
  10. package/dist/chrome/TitleDialog.d.ts +15 -0
  11. package/dist/chrome/TitleDialog.d.ts.map +1 -0
  12. package/dist/chrome/dialog.d.ts +39 -0
  13. package/dist/chrome/dialog.d.ts.map +1 -0
  14. package/dist/chrome/index.d.ts +10 -0
  15. package/dist/chrome/index.d.ts.map +1 -0
  16. package/dist/chrome/menu.d.ts +50 -0
  17. package/dist/chrome/menu.d.ts.map +1 -0
  18. package/dist/chrome/shortcuts.d.ts +41 -0
  19. package/dist/chrome/shortcuts.d.ts.map +1 -0
  20. package/dist/collaborative/CollaborativeContextMaps.d.ts +32 -0
  21. package/dist/collaborative/CollaborativeContextMaps.d.ts.map +1 -0
  22. package/dist/collaborative/index.d.ts +2 -0
  23. package/dist/collaborative/index.d.ts.map +1 -0
  24. package/dist/connect-handles/CmConnectHandles.d.ts +3 -1
  25. package/dist/connect-handles/CmConnectHandles.d.ts.map +1 -1
  26. package/dist/connect-handles/index.d.ts.map +1 -1
  27. package/dist/context-maps.css +1 -1
  28. package/dist/context-pad/CmContextPadProvider.d.ts +5 -1
  29. package/dist/context-pad/CmContextPadProvider.d.ts.map +1 -1
  30. package/dist/context-pad/index.d.ts.map +1 -1
  31. package/dist/draw/lucide.d.ts +29 -0
  32. package/dist/draw/lucide.d.ts.map +1 -0
  33. package/dist/hover-tooltip/CmHoverTooltip.d.ts +16 -0
  34. package/dist/hover-tooltip/CmHoverTooltip.d.ts.map +1 -0
  35. package/dist/hover-tooltip/index.d.ts +5 -0
  36. package/dist/hover-tooltip/index.d.ts.map +1 -0
  37. package/dist/index.d.ts +11 -2
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1431 -654
  40. package/dist/index.js.map +1 -1
  41. package/dist/io/CmExporter.d.ts +1 -3
  42. package/dist/io/CmExporter.d.ts.map +1 -1
  43. package/dist/io/CmImporter.d.ts +14 -1
  44. package/dist/io/CmImporter.d.ts.map +1 -1
  45. package/dist/io/saveSvg.d.ts.map +1 -1
  46. package/dist/io/types.d.ts +9 -1
  47. package/dist/io/types.d.ts.map +1 -1
  48. package/dist/keyboard/CmKeyboard.d.ts +11 -1
  49. package/dist/keyboard/CmKeyboard.d.ts.map +1 -1
  50. package/dist/keyboard/index.d.ts +2 -1
  51. package/dist/keyboard/index.d.ts.map +1 -1
  52. package/dist/label-editing/CmLabelEditing.d.ts +30 -1
  53. package/dist/label-editing/CmLabelEditing.d.ts.map +1 -1
  54. package/dist/label-editing/index.d.ts.map +1 -1
  55. package/dist/legend/CmLegend.d.ts.map +1 -1
  56. package/dist/legend/index.d.ts +6 -0
  57. package/dist/legend/index.d.ts.map +1 -1
  58. package/dist/legend/legendContent.d.ts +38 -0
  59. package/dist/legend/legendContent.d.ts.map +1 -0
  60. package/dist/model/CmElementFactory.d.ts.map +1 -1
  61. package/dist/model/di-types.d.ts +4 -0
  62. package/dist/model/di-types.d.ts.map +1 -1
  63. package/dist/modeling/CmModeling.d.ts +2 -0
  64. package/dist/modeling/CmModeling.d.ts.map +1 -1
  65. package/dist/modeling/cmd/UpdateTitleHandler.d.ts +17 -0
  66. package/dist/modeling/cmd/UpdateTitleHandler.d.ts.map +1 -0
  67. package/dist/palette/CmPaletteProvider.d.ts +30 -2
  68. package/dist/palette/CmPaletteProvider.d.ts.map +1 -1
  69. package/dist/palette/index.d.ts +2 -1
  70. package/dist/palette/index.d.ts.map +1 -1
  71. package/dist/read-only/CmReadOnly.d.ts +20 -0
  72. package/dist/read-only/CmReadOnly.d.ts.map +1 -0
  73. package/dist/read-only/index.d.ts +5 -0
  74. package/dist/read-only/index.d.ts.map +1 -0
  75. package/dist/theme/palette.d.ts +26 -22
  76. package/dist/theme/palette.d.ts.map +1 -1
  77. package/dist/validation/CmValidationMarkers.d.ts.map +1 -1
  78. package/package.json +15 -7
  79. package/dist/draw/icons.d.ts +0 -16
  80. package/dist/draw/icons.d.ts.map +0 -1
package/README.md CHANGED
@@ -9,9 +9,12 @@ diagrams, built on [diagram-js](https://github.com/bpmn-io/diagram-js) (MIT).
9
9
 
10
10
  It renders the canonical document from
11
11
  [`@miragon/context-maps-schema-model`](../schema-model) and gives you palette, move,
12
- connect-by-relationship, context pad, a collapsible notation legend, inline label editing and
13
- undo/redo — with no UI framework required. Mount it into any `<div>`; the web app (React) and the VS Code extension both wrap this
14
- exact package.
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 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
 
@@ -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 (auto-fits the viewport)
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,107 @@ 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
+ freeArea?: // where the host's chrome leaves the canvas free
74
+ | { insets: () => { top: number; right: number; bottom: number; left: number } }
75
+ | { center: () => { x: number; y: number } | undefined },
76
+ fitOnImport?: boolean, // fit the content after every import (default true)
69
77
  });
70
78
  ```
71
79
 
80
+ - `undoRedoKeys: false` leaves the undo and redo keys unbound and unprevented, for a host whose
81
+ document owns the history (the VS Code extension).
82
+ - `freeArea` names the part of the container a host's chrome leaves free, with the names of the
83
+ `@miragon/modeler-api` 1.2 factory options: `{ insets }` are the margins the chrome covers (the
84
+ modeler shell's `shell.fitInsets()`), `{ center }` is the free rectangle's centre in diagram
85
+ coordinates (`viewport.freeRectCenter()`). Enter or Space on a palette entry (a click with
86
+ `detail === 0`) places the new context in that centre, 24px further down and right while that
87
+ spot is taken, selected and with its name editor open, and the fit after an import centres the
88
+ content in what the insets leave. Without it, and for the fit when only `center` is given, the
89
+ renderer keeps room for its own palette.
90
+ - `fitOnImport: false` leaves the view to a host whose chrome fits the content itself after every
91
+ import, so the view changes once per import.
92
+ - `freeRectInsets` (the insets function itself) is the deprecated name of `freeArea: { insets }`.
93
+ It is accepted through the 0.4 releases and ignored when `freeArea` is given.
94
+
72
95
  ### Shared methods (`Viewer` / `NavigatedViewer` / `Modeler`)
73
96
 
74
97
  | Method | Returns | Purpose |
75
98
  | ---------------------------------- | ------------------------------- | ------------------------------------------------- |
76
- | `importDocument(doc)` | `{ warnings: ImportWarning[] }` | Replace canvas content and auto-fit. |
99
+ | `importDocument(doc)` | `{ warnings: ImportWarning[] }` | Replace canvas content and fit (see below). |
100
+ | `importText(text)` | `{ warnings: ImportWarning[] }` | Parse a `.cm` text and import it; throws if not. |
77
101
  | `exportDocument()` | `CmDocument` | Rebuild the canonical model from the live canvas. |
102
+ | `exportText()` | `string` | The canonical `.cm` text (ends in a line break). |
78
103
  | `saveSVG()` | `{ svg: string }` | Self-contained SVG snapshot (fitted viewBox). |
79
- | `setMeta(partial)` / `getMeta()` | — / `RootBusinessObject` | Read/write diagram-level metadata (e.g. `title`). |
104
+ | `setMeta(partial)` / `getMeta()` | — / `RootBusinessObject` | Rename the map (an undoable command) / read it. |
80
105
  | `attachTo(el)` / `detach()` | `void` | Move the canvas in/out of the DOM (keeps state). |
81
106
  | `clear()` / `destroy()` | `void` | Empty the canvas / tear it down. |
82
107
  | `on(event, cb)` / `off(event, cb)` | `void` | Subscribe to diagram-js events. |
83
108
  | `get<T>(name)` | `T` | Resolve a diagram-js service (advanced). |
84
109
 
110
+ An import is **silent**: the previous document's undo history goes without a
111
+ `commandStack.changed`, so a host that saves on every change never writes an import back. It
112
+ **rejects without a trace**: a document with a duplicate id, an id of the engine's roots or the
113
+ name of a built-in object property as an id throws before anything is removed. It is **lossless**:
114
+ keys the model does not know and relationships whose ends are not on the map come back on export. A
115
+ label edit open during an import is taken down and reopened on the element with the same id, with
116
+ the typed text.
117
+
118
+ A **view change never commits** an open label edit or description prompt: a pan or zoom, the user's
119
+ or the host's (`canvas.viewbox(…)`, `setViewState`, a fit), keeps it open with the typed text and
120
+ moves it with its element or pad entry. Only the user's own gestures commit it: Enter, leaving the
121
+ field, or starting a drag.
122
+
85
123
  ### Modeler-only
86
124
 
87
125
  `undo()`, `redo()`, `canUndo()`, `canRedo()`.
88
126
 
127
+ ## Collaborative modeler
128
+
129
+ ```ts
130
+ import { createCollaborativeModeler } from "@miragon/context-maps-renderer";
131
+
132
+ const modeler = createCollaborativeModeler({ additionalModules: [], undoRedoKeys: true });
133
+ modeler.attachTo(host); // attached to the document, with a size
134
+ await modeler.importText(text); // silent; rejects (and changes nothing) for a non-importable text
135
+ modeler.onContentChanged(() => save(modeler.exportText()));
136
+ ```
137
+
138
+ `createCollaborativeModeler` and `createCollaborativeViewer` implement the `CollaborativeModeler`
139
+ contract of `@miragon/modeler-api` 1.2 (`meta.notation` is `"context-maps"`): the canonical JSON text
140
+ as the text lane, `onContentChanged` for every user-visible change (element commands, the title,
141
+ undo, redo) and never for an import or a view change, the viewbox as view state, and the `elements`
142
+ surface over the context and relationship ids (their labels as names). `elements.bounds(id)` reads
143
+ an element's box from the live canvas in diagram coordinates (a relationship: the box around its
144
+ waypoints), `undefined` for an id `elements.list()` does not report. Both factories take the
145
+ contract's `CollaborativeModelerOptions` (`freeArea`, `fitOnImport`, `undoRedoKeys`, which the
146
+ viewer ignores) next to `additionalModules` and the deprecated `freeRectInsets`. `modeler.diagram`
147
+ is the wrapped `Modeler` or `NavigatedViewer`. The contract's conformance kit runs in this package's
148
+ browser tests, every case and every hook, without a skip or an advisory.
149
+
150
+ ## Around the canvas
151
+
152
+ What a chrome around the canvas shows, typed structurally (a `@miragon/modeler-shell` handle fits):
153
+
154
+ - `renderLegend(body, { tooltip })` renders the notation legend (subdomain types, integration roles,
155
+ relationship patterns) into a chrome's legend card, each row explained in the chrome's tooltip.
156
+ Hosts without such a chrome add `cmLegendModule`, a legend card on the canvas.
157
+ - `contextMapMenu({ exports, showKeyboardShortcuts, editTitle })` builds the Model group's "Map
158
+ title…" (with `editTitle`), the Export group (PNG, SVG, JSON, CML; an export's `shortcut` shows as
159
+ its chip) and the Help group's "Keyboard shortcuts…". `createShortcutsDialog(chrome, { fileKeys })`
160
+ is that dialog, with a File group (Open… and Export as JSON on Cmd/Ctrl+O and S) for a web app
161
+ that binds those keys; `createTitleDialog(chrome, { title, setTitle })` renames the map in a
162
+ modal dialog with one field, Cancel and Apply. Both dialogs live in the chrome's root and go with
163
+ `destroy()`.
164
+ - While a drag runs on the canvas, the chrome's legend island (`[data-chrome="legend"]`) lets the
165
+ pointer through, so a connect drag released on a context behind it still connects.
166
+ - `cmReadOnly` (part of the `Modeler`) locks every edit while a host cannot take edits from the
167
+ canvas, an invalid file in an IDE: no context pad, move, create, connect, delete or label editor;
168
+ selection, zoom, pan, select all and export stay.
169
+ - The keyboard listens on the document but only acts on keys aimed at the canvas: keys someone
170
+ already handled (`defaultPrevented`) and keys from outside the canvas container pass. `Cmd/Ctrl+A`
171
+ selects every element.
172
+
89
173
  ### Helpers & types
90
174
 
91
175
  - **Type guards:** `isCmElement`, `isCmContext`, `isCmRelationship`.
@@ -108,12 +192,14 @@ viewer via `additionalModules`:
108
192
  | `cmModelingModule` | High-level mutations — label, subdomain type, relationship pattern, roles, colours. |
109
193
  | `cmRulesModule` | Editing rules (what can move / be created / connected; no resize). |
110
194
  | `cmBehaviorsModule` | Keeps the model **flat** — shapes never nest. |
111
- | `cmPaletteModule` | The floating tool palette (top-centre): lasso tool + drag-to-create contexts. |
195
+ | `cmPaletteModule` | The tool palette: lasso tool + create contexts (drag, click, or Enter/Space into the free rectangle). |
112
196
  | `cmConnectHandlesModule` | Opt-in (not in the default `Modeler`): four outward connect arrows around the selected context. |
113
197
  | `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. |
114
- | `cmLegendModule` | Collapsible notation legend (bottom-left): subdomain types, integration roles, patterns. |
198
+ | `cmLegendModule` | Opt-in: the notation legend as a collapsible card (bottom-left), for hosts without a chrome that renders `renderLegend`. |
199
+ | `cmHoverTooltipModule` | An element's own data (description, team, technology) on hover, inside the canvas container. |
200
+ | `cmReadOnlyModule` | The canvas lock (`cmReadOnly`) every editing feature consults. |
115
201
  | `cmLabelEditingModule` | In-place direct name editing (double-click / pad), bpmn.io style. |
116
- | `cmKeyboardModule` | Undo / redo / delete shortcuts. |
202
+ | `cmKeyboardModule` | Select all / undo / redo / delete for keys aimed at the canvas (`undoRedoKeys` option). |
117
203
  | `cmZOrderModule` | Fixed stacking order (relationships behind, contexts on top). |
118
204
 
119
205
  ### Rendering
@@ -147,4 +233,8 @@ npm run typecheck
147
233
 
148
234
  ## License
149
235
 
150
- [MIT](../../LICENSE). diagram-js and its dependencies are MIT / ISC / Apache-2.0.
236
+ [MIT](../../LICENSE). diagram-js and its dependencies are MIT / ISC / Apache-2.0. The icons of the
237
+ context pad, the connect handles, the validation markers, the lasso and the shortcuts dialog are
238
+ [Lucide](https://lucide.dev) icons (lucide-static 1.59.0, ISC, © Lucide Icons and Contributors),
239
+ copied into `src/draw/lucide.ts`; `arrow-right`, `circle-x`, `trash`, `triangle-alert` and `x` derive
240
+ from [Feather](https://feathericons.com) (MIT, © Cole Bemis).
@@ -1,13 +1,42 @@
1
1
  import { ModuleDeclaration } from 'didi';
2
+ import { FreeArea } from '@miragon/modeler-api';
2
3
  import { CmDocument } from '@miragon/context-maps-schema-model';
3
4
  import { ImportWarning, RootBusinessObject } from './io/types.js';
5
+ /** Container margins in screen px that a host's chrome covers. */
6
+ export interface FreeRectInsets {
7
+ top: number;
8
+ right: number;
9
+ bottom: number;
10
+ left: number;
11
+ }
4
12
  export interface CmViewerOptions {
5
13
  /** Host element. When absent, a detached <div> is created (attach later). */
6
- container?: HTMLElement;
7
- width?: number | string;
8
- height?: number | string;
14
+ container?: HTMLElement | undefined;
15
+ width?: number | string | undefined;
16
+ height?: number | string | undefined;
9
17
  /** Appended to the module list (extension point). */
10
- additionalModules?: ModuleDeclaration[];
18
+ additionalModules?: ModuleDeclaration[] | undefined;
19
+ /**
20
+ * Bind Cmd/Ctrl+Z, Cmd/Ctrl+Shift+Z and Cmd/Ctrl+Y to the canvas undo/redo (default true).
21
+ * Pass false when the host owns the history (the VS Code document), so the keys reach it.
22
+ */
23
+ undoRedoKeys?: boolean | undefined;
24
+ /**
25
+ * The part of the container the host's chrome (palette row, zoom panel, legend) leaves free, under
26
+ * its `@miragon/modeler-api` name: `{ insets }`, the margins the chrome covers, or `{ center }`,
27
+ * the free rectangle's centre in diagram coordinates. An element created from the palette with
28
+ * Enter or Space lands in that centre, and the fit after an import centres the content in what
29
+ * the insets leave (guide §5.5, §5.9). Default: room for the renderer's own palette, which the
30
+ * fit also keeps when only `center` is given.
31
+ */
32
+ freeArea?: FreeArea | undefined;
33
+ /** @deprecated Use `freeArea: { insets }`; accepted through the 0.4 releases, ignored next to it. */
34
+ freeRectInsets?: (() => FreeRectInsets) | undefined;
35
+ /**
36
+ * Fit the content into the view after every import (default true). Pass false when the host's
37
+ * chrome fits the content itself, so the view changes once per import.
38
+ */
39
+ fitOnImport?: boolean | undefined;
11
40
  }
12
41
  export type EventCallback<T = unknown> = (event: T) => void;
13
42
  export declare abstract class CmBaseViewer {
@@ -20,23 +49,53 @@ export declare abstract class CmBaseViewer {
20
49
  private _ensureDiagram;
21
50
  /** Resolve a diagram-js service from the didi injector. */
22
51
  get<T>(name: string): T;
52
+ /** The margins the host's chrome covers right now. */
53
+ private readonly freeRectInsets;
54
+ /** The free rectangle's centre when the host names it, else the palette derives it. */
55
+ private readonly freeRectCenter;
56
+ /** A service only some of the viewers have (the Modeler's editing services), else null. */
57
+ private _optional;
23
58
  on<T = unknown>(event: string, callback: EventCallback<T>, priority?: number): void;
24
59
  off(event: string, callback: EventCallback): void;
25
- /** Load a document into the canvas (replaces existing content). */
60
+ /**
61
+ * Load a document into the canvas (replaces existing content). Silent: the previous document's
62
+ * undo history goes without a `commandStack.changed`, so a host that saves on every change does
63
+ * not write the import back. Throws before anything changes when the document cannot be drawn.
64
+ */
26
65
  importDocument(doc: CmDocument): {
27
66
  warnings: ImportWarning[];
28
67
  };
68
+ /**
69
+ * Load the text of a `.cm`/`.cm.json` file. Throws (and changes nothing) when the text is no
70
+ * importable document.
71
+ */
72
+ importText(text: string): {
73
+ warnings: ImportWarning[];
74
+ };
29
75
  /** Current canvas state as a canonical document. */
30
76
  exportDocument(): CmDocument;
31
- /** Update diagram-level metadata (title / flow-of-change) on the root. */
77
+ /** Current canvas state as the canonical file text (ends in one line break). */
78
+ exportText(): string;
79
+ /**
80
+ * Update diagram-level metadata on the root. In an editor a title change is an undoable command
81
+ * (`cmModeling.setTitle`); a viewer has no history and writes it directly. A locked editor
82
+ * (`cmReadOnly`) changes nothing: its host takes no edits, and the next import would silently
83
+ * revert the title.
84
+ */
32
85
  setMeta(partial: Partial<RootBusinessObject>): void;
33
- /** Read diagram-level metadata (title / flow-of-change) from the root. */
86
+ /** Read diagram-level metadata from the root; undefined before the first import. */
34
87
  getMeta(): RootBusinessObject | undefined;
88
+ /** Through the registry: asking the canvas would create an implicit root before an import. */
89
+ private _documentRoot;
35
90
  /** Standalone, self-contained SVG snapshot. */
36
91
  saveSVG(): {
37
92
  svg: string;
38
93
  };
39
- /** Fit the content into the viewport, leaving room at the top for the palette. */
94
+ /**
95
+ * Centres the content in the container minus room for the chrome, at the largest zoom that
96
+ * shows all of it and never above 100 % (guide §5.9); an empty map shows 100 %. The same view
97
+ * for the same document and container (the contract's fitted view after an import).
98
+ */
40
99
  private _fit;
41
100
  /** Attach the container into `target`. */
42
101
  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;AAK9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAIrE,OAAO,EAAW,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAErF,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACzC;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;AAQ5D,8BAAsB,YAAY;IAChC,SAAS,CAAC,QAAQ,CAAC,WAAW,IAAI,iBAAiB,EAAE;IAErD,OAAO,CAAC,QAAQ,CAAsB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W,CAE3B;CACF"}
package/dist/Modeler.d.ts CHANGED
@@ -2,8 +2,9 @@ import { ModuleDeclaration } from 'didi';
2
2
  import { NavigatedViewer } from './NavigatedViewer.js';
3
3
  /**
4
4
  * Full Context Maps editor: palette/create, move, connect with rules,
5
- * context pad, inline label editing, undo/redo. Boxes are fixed-size —
6
- * no resize feature.
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.
7
8
  */
8
9
  export declare class Modeler extends NavigatedViewer {
9
10
  protected _getModules(): ModuleDeclaration[];
@@ -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;AAQ9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAYvD;;;;GAIG;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
+ {"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;AAErC,oEAAoE;AACpE,qBAAa,eAAgB,SAAQ,MAAM;cACtB,WAAW,IAAI,iBAAiB,EAAE;CAGtD"}
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"}
@@ -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: Ch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@@ -0,0 +1,10 @@
1
+ export { contextMapMenu, 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":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S,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,32 @@
1
+ import { CollaborativeModeler, CollaborativeModelerOptions, ElementBounds, 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
+ /**
9
+ * The contract's factory options (`freeArea`, `fitOnImport`, `undoRedoKeys`, see
10
+ * `CmViewerOptions`) and the renderer's own. The viewer ignores `undoRedoKeys`.
11
+ */
12
+ export interface CollaborativeContextMapsOptions extends CollaborativeModelerOptions {
13
+ /** Appended to the renderer's own modules (e.g. a host's chrome module). */
14
+ additionalModules?: ModuleDeclaration[] | undefined;
15
+ /** @deprecated Use `freeArea: { insets }`; accepted through the 0.4 releases, ignored next to it. */
16
+ freeRectInsets?: (() => FreeRectInsets) | undefined;
17
+ }
18
+ /** The contract surface plus the wrapped diagram for host-specific wiring. */
19
+ export interface CollaborativeContextMapsModeler extends CollaborativeModeler {
20
+ readonly elements: ElementsSurface & {
21
+ bounds(id: string): ElementBounds | undefined;
22
+ };
23
+ readonly diagram: Modeler | NavigatedViewer;
24
+ }
25
+ /**
26
+ * The editing mount (`meta.editable: true`) of the collaborative-modeler contract: the text lane
27
+ * is the canonical JSON of a `.cm`/`.cm.json` file (`serializeDocumentText`).
28
+ */
29
+ export declare function createCollaborativeModeler(options?: CollaborativeContextMapsOptions): CollaborativeContextMapsModeler;
30
+ /** The read-only mount (`meta.editable: false`): imports, exports and reveals, never edits. */
31
+ export declare function createCollaborativeViewer(options?: CollaborativeContextMapsOptions): CollaborativeContextMapsModeler;
32
+ //# 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,EACzB,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAElB,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAO9C,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;;;GAGG;AACH,MAAM,WAAW,+BAAgC,SAAQ,2BAA2B;IAClF,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAC;IACpD,qGAAqG;IACrG,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,GAAG;QAAE,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAA;KAAE,CAAC;IACvF,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC;CAC7C;AASD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,+BAAoC,GAC5C,+BAA+B,CAKjC;AAED,+FAA+F;AAC/F,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,+BAAoC,GAC5C,+BAA+B,CAEjC"}
@@ -0,0 +1,2 @@
1
+ export { CONTEXT_MAPS_NOTATION, createCollaborativeModeler, createCollaborativeViewer, type CollaborativeContextMapsModeler, type CollaborativeContextMapsOptions, } from './CollaborativeContextMaps.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,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,MA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AAQ,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;AAM9C,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,EAAE,iBAIpC,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,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"}