@miragon/context-maps-renderer 0.4.1 → 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 CHANGED
@@ -90,7 +90,7 @@ new Modeler({
90
90
  - `fitOnImport: false` leaves the view to a host whose chrome fits the content itself after every
91
91
  import, so the view changes once per import.
92
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.
93
+ It is accepted through the 0.5 releases and ignored when `freeArea` is given.
94
94
 
95
95
  ### Shared methods (`Viewer` / `NavigatedViewer` / `Modeler`)
96
96
 
@@ -101,6 +101,7 @@ new Modeler({
101
101
  | `exportDocument()` | `CmDocument` | Rebuild the canonical model from the live canvas. |
102
102
  | `exportText()` | `string` | The canonical `.cm` text (ends in a line break). |
103
103
  | `saveSVG()` | `{ svg: string }` | Self-contained SVG snapshot (fitted viewBox). |
104
+ | `contentBounds()` | `ElementBounds` or `undefined` | The content's box for a host's fit (see below). |
104
105
  | `setMeta(partial)` / `getMeta()` | — / `RootBusinessObject` | Rename the map (an undoable command) / read it. |
105
106
  | `attachTo(el)` / `detach()` | `void` | Move the canvas in/out of the DOM (keeps state). |
106
107
  | `clear()` / `destroy()` | `void` | Empty the canvas / tear it down. |
@@ -115,6 +116,14 @@ keys the model does not know and relationships whose ends are not on the map com
115
116
  label edit open during an import is taken down and reopened on the element with the same id, with
116
117
  the typed text.
117
118
 
119
+ `contentBounds()` is the tight box around what the canvas draws of the map in diagram coordinates,
120
+ without a margin: the contexts, wider where a team row or a subdomain type's name runs past a
121
+ context's sides (the renderer does not cut them), and the relationships' waypoints. It is the box a
122
+ host's chrome fits to (the modeler shell's `connectDiagramJs` reads it from the instance it gets as
123
+ `modeler`). It reads the live canvas, so a context created or moved counts at once, ignores zoom
124
+ and scroll, and is `undefined` while the map is empty. The fit after an import centres this box in
125
+ the free rectangle of `freeArea.insets`, or in the room the renderer's own palette needs.
126
+
118
127
  A **view change never commits** an open label edit or description prompt: a pan or zoom, the user's
119
128
  or the host's (`canvas.viewbox(…)`, `setViewState`, a fit), keeps it open with the typed text and
120
129
  moves it with its element or pad entry. Only the user's own gestures commit it: Enter, leaving the
@@ -136,16 +145,18 @@ modeler.onContentChanged(() => save(modeler.exportText()));
136
145
  ```
137
146
 
138
147
  `createCollaborativeModeler` and `createCollaborativeViewer` implement the `CollaborativeModeler`
139
- contract of `@miragon/modeler-api` 1.2 (`meta.notation` is `"context-maps"`): the canonical JSON text
148
+ contract of `@miragon/modeler-api` 1.3 (`meta.notation` is `"context-maps"`): the canonical JSON text
140
149
  as the text lane, `onContentChanged` for every user-visible change (element commands, the title,
141
150
  undo, redo) and never for an import or a view change, the viewbox as view state, and the `elements`
142
151
  surface over the context and relationship ids (their labels as names). `elements.bounds(id)` reads
143
152
  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.
153
+ waypoints), `undefined` for an id `elements.list()` does not report. `contentBounds()` is the
154
+ diagram's `contentBounds()`, the box around all of them, `undefined` before the first import, for
155
+ an empty map and after `destroy()`. Both factories take the contract's
156
+ `CollaborativeModelerOptions` (`freeArea`, `fitOnImport`, `undoRedoKeys`, which the viewer ignores)
157
+ next to `additionalModules` and the deprecated `freeRectInsets`. `modeler.diagram` is the wrapped
158
+ `Modeler` or `NavigatedViewer`. The contract's conformance kit runs in this package's browser
159
+ tests, every case and every hook, without a skip or an advisory.
149
160
 
150
161
  ## Around the canvas
151
162
 
@@ -153,7 +164,9 @@ What a chrome around the canvas shows, typed structurally (a `@miragon/modeler-s
153
164
 
154
165
  - `renderLegend(body, { tooltip })` renders the notation legend (subdomain types, integration roles,
155
166
  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.
167
+ Hosts without such a chrome add `cmLegendModule`, a legend card on the canvas. It starts closed
168
+ on every canvas size, so it never covers the map unasked; the user opens it with its button, and
169
+ the `cmLegend` service's `setOpen(open)` restores a state the host stored.
157
170
  - `contextMapMenu({ exports, showKeyboardShortcuts, editTitle })` builds the Model group's "Map
158
171
  title…" (with `editTitle`), the Export group (PNG, SVG, JSON, CML; an export's `shortcut` shows as
159
172
  its chip) and the Help group's "Keyboard shortcuts…". `createShortcutsDialog(chrome, { fileKeys })`
@@ -1,5 +1,5 @@
1
1
  import { ModuleDeclaration } from 'didi';
2
- import { FreeArea } from '@miragon/modeler-api';
2
+ import { ElementBounds, FreeArea } from '@miragon/modeler-api';
3
3
  import { CmDocument } from '@miragon/context-maps-schema-model';
4
4
  import { ImportWarning, RootBusinessObject } from './io/types.js';
5
5
  /** Container margins in screen px that a host's chrome covers. */
@@ -30,7 +30,7 @@ export interface CmViewerOptions {
30
30
  * fit also keeps when only `center` is given.
31
31
  */
32
32
  freeArea?: FreeArea | undefined;
33
- /** @deprecated Use `freeArea: { insets }`; accepted through the 0.4 releases, ignored next to it. */
33
+ /** @deprecated Use `freeArea: { insets }`; accepted through the 0.5 releases, ignored next to it. */
34
34
  freeRectInsets?: (() => FreeRectInsets) | undefined;
35
35
  /**
36
36
  * Fit the content into the view after every import (default true). Pass false when the host's
@@ -92,9 +92,17 @@ export declare abstract class CmBaseViewer {
92
92
  svg: string;
93
93
  };
94
94
  /**
95
- * Centres the content in the container minus room for the chrome, at the largest zoom that
95
+ * The tight box around what the canvas draws of the map in diagram coordinates, with no margin
96
+ * of its own: the box a host's chrome fits to (`@miragon/modeler-api` 1.3). It reads the live
97
+ * canvas and ignores zoom and scroll; `undefined` while the map is empty.
98
+ */
99
+ contentBounds(): ElementBounds | undefined;
100
+ /**
101
+ * Centres the content box in the container minus room for the chrome, at the largest zoom that
96
102
  * 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).
103
+ * for the same document and container (the contract's fitted view after an import). Without
104
+ * `freeArea.insets` the room is the renderer's own palette margins: `freeArea.center` names no
105
+ * rectangle to fit into.
98
106
  */
99
107
  private _fit;
100
108
  /** Attach the container into `target`. */
@@ -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;AAQ9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAOrE,OAAO,EAAW,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAErF,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,SAAS,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACrC,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAC;IACpD;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC,qGAAqG;IACrG,cAAc,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AAE,aAAa,EAAE,CAAA;KAAE;IAsB9D;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,aAAa,EAAE,CAAA;KAAE;IAMvD,oDAAoD;IACpD,cAAc,IAAI,UAAU;IAI5B,gFAAgF;IAChF,UAAU,IAAI,MAAM;IAIpB;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI;IAUnD,oFAAoF;IACpF,OAAO,IAAI,kBAAkB,GAAG,SAAS;IAIzC,8FAA8F;IAC9F,OAAO,CAAC,aAAa;IAIrB,+CAA+C;IAC/C,OAAO,IAAI;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;IAI1B;;;;OAIG;IACH,aAAa,IAAI,aAAa,GAAG,SAAS;IAO1C;;;;;;OAMG;IACH,OAAO,CAAC,IAAI;IA0BZ,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAKnC,2DAA2D;IAC3D,MAAM,IAAI,IAAI;IAId,KAAK,IAAI,IAAI;IAIb,OAAO,IAAI,IAAI;IAQf,IAAI,SAAS,IAAI,WAAW,CAE3B;CACF"}
@@ -12,7 +12,7 @@ export declare const CONTEXT_MAPS_NOTATION = "context-maps";
12
12
  export interface CollaborativeContextMapsOptions extends CollaborativeModelerOptions {
13
13
  /** Appended to the renderer's own modules (e.g. a host's chrome module). */
14
14
  additionalModules?: ModuleDeclaration[] | undefined;
15
- /** @deprecated Use `freeArea: { insets }`; accepted through the 0.4 releases, ignored next to it. */
15
+ /** @deprecated Use `freeArea: { insets }`; accepted through the 0.5 releases, ignored next to it. */
16
16
  freeRectInsets?: (() => FreeRectInsets) | undefined;
17
17
  }
18
18
  /** The contract surface plus the wrapped diagram for host-specific wiring. */
@@ -20,6 +20,7 @@ export interface CollaborativeContextMapsModeler extends CollaborativeModeler {
20
20
  readonly elements: ElementsSurface & {
21
21
  bounds(id: string): ElementBounds | undefined;
22
22
  };
23
+ contentBounds(): ElementBounds | undefined;
23
24
  readonly diagram: Modeler | NavigatedViewer;
24
25
  }
25
26
  /**
@@ -1 +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"}
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,aAAa,IAAI,aAAa,GAAG,SAAS,CAAC;IAC3C,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMapsRenderer.d.ts","sourceRoot":"","sources":["../../src/draw/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BAElB,QAAQ,EAAE,QAAQ;IAIrB,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAIxC,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,GAAG,UAAU;IAc9D,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,GAAG,UAAU;IAY3E,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAKtC,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM;IAQ9D,OAAO,CAAC,WAAW;IAkEnB,OAAO,CAAC,gBAAgB;IAuCxB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IA8DlB,iFAAiF;IACjF,OAAO,CAAC,QAAQ;IAmChB,oFAAoF;IACpF,OAAO,CAAC,IAAI;IA2CZ;;;4BAGwB;IACxB,OAAO,CAAC,WAAW;CAsCpB"}
@@ -0,0 +1,33 @@
1
+ import { SubdomainType } from '@miragon/context-maps-schema-model';
2
+ import { CmContext } from '../model/di-types.js';
3
+ /** The subdomain type's name in a context's header, right of its icon (context coordinates). */
4
+ export declare const TYPE_LABEL: {
5
+ readonly x: 28;
6
+ readonly y: 15;
7
+ readonly fontWeight: "700";
8
+ readonly letterSpacingEm: 0.03;
9
+ };
10
+ export declare const TEAM_ICON_SIZE = 14;
11
+ /** The people icon and the team's name at the bottom of a context, in context coordinates. */
12
+ export interface TeamRowLayout {
13
+ /** The icon's left edge, where the row starts. */
14
+ left: number;
15
+ iconCenterX: number;
16
+ textX: number;
17
+ centerY: number;
18
+ /** Where the team's name ends as the canvas draws it. */
19
+ right: number;
20
+ }
21
+ export declare function teamRowLayout(contextWidth: number, contextHeight: number, team: string): TeamRowLayout;
22
+ /** Where the subdomain type's name in the header ends, in context coordinates. */
23
+ export declare function typeLabelRight(type: SubdomainType): number;
24
+ /**
25
+ * The horizontal span a context draws, in diagram coordinates: its box, wider where the type's
26
+ * name or the team row runs past its sides, since neither is cut to the box. Vertically both stay
27
+ * inside, as every context is at least the notation's minimum size.
28
+ */
29
+ export declare function contextDrawnSpan(context: Pick<CmContext, "x" | "width" | "subdomainType" | "team">): {
30
+ left: number;
31
+ right: number;
32
+ };
33
+ //# sourceMappingURL=contextLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contextLayout.d.ts","sourceRoot":"","sources":["../../src/draw/contextLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD,gGAAgG;AAChG,eAAO,MAAM,UAAU;;;;;CAAsE,CAAC;AAE9F,eAAO,MAAM,cAAc,KAAK,CAAC;AAIjC,8FAA8F;AAC9F,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,aAAa,CAC3B,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GACX,aAAa,CAaf;AAED,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAQ1D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,GAAG,eAAe,GAAG,MAAM,CAAC,GACjE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAYjC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The advance width of `text` at zoom 1. A canvas measures it, not the SVG: Chromium lays SVG text
3
+ * out at the scaled font size, so a width read from the drawing would change with the zoom.
4
+ */
5
+ export declare function textWidth(text: string, fontSize: number, fontWeight: string): number;
6
+ //# sourceMappingURL=textMetrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textMetrics.d.ts","sourceRoot":"","sources":["../../src/draw/textMetrics.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAQpF"}