@miragon/team-topologies-renderer 0.12.0 → 0.13.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 +11 -2
- package/dist/TtBaseViewer.d.ts +7 -1
- package/dist/TtBaseViewer.d.ts.map +1 -1
- package/dist/collaborative/CollaborativeTeamTopologies.d.ts +5 -1
- package/dist/collaborative/CollaborativeTeamTopologies.d.ts.map +1 -1
- package/dist/draw/label-layout.d.ts +7 -0
- package/dist/draw/label-layout.d.ts.map +1 -1
- package/dist/index.js +376 -343
- package/dist/index.js.map +1 -1
- package/dist/io/TtViewport.d.ts +19 -2
- package/dist/io/TtViewport.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -153,6 +153,13 @@ Options: the contract's `CollaborativeModelerOptions` (1.2) and `additionalModul
|
|
|
153
153
|
The viewer takes the same options and ignores `freeArea` and `undoRedoKeys`. `modeler.diagram` is
|
|
154
154
|
the wrapped `Modeler`. `elements.bounds(id)` (contract 1.2) returns a team's, interaction's, flow's
|
|
155
155
|
or annotation's box in diagram coordinates from the live canvas, `undefined` for any other id.
|
|
156
|
+
`contentBounds()` (contract 1.3, modeler and viewer) returns the tight box around every element and
|
|
157
|
+
its label text, in diagram coordinates from the live canvas and the same at every zoom and scroll, or
|
|
158
|
+
`undefined` while the diagram has no element. Label text counts where it reaches past its shape (a
|
|
159
|
+
word longer than a line, more lines than the shape holds); like the label wrapping, its width is
|
|
160
|
+
estimated from the characters rather than measured. A host that fits the view itself
|
|
161
|
+
(`fitOnImport: false`) fits to it and adds its own margins; the modeler shell's
|
|
162
|
+
`connectDiagramJs(shell, diagram, { modeler })` does so by default.
|
|
156
163
|
|
|
157
164
|
### Shared methods (`Viewer` / `NavigatedViewer` / `Modeler`)
|
|
158
165
|
|
|
@@ -160,6 +167,7 @@ or annotation's box in diagram coordinates from the live canvas, `undefined` for
|
|
|
160
167
|
| ---------------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
161
168
|
| `importDocument(doc, { fit? })` | `{ warnings: ImportWarning[] }` | Replace canvas content, reset undo history; fit unless `fit: false`. Throws, before anything changes, for ids that would collide. |
|
|
162
169
|
| `fitToView()` | `void` | Deprecated: fit every element, keeping the strip under the palette free. |
|
|
170
|
+
| `contentBounds()` | `ElementBounds \| undefined` | The tight box around every element and its label text in diagram coordinates (contract 1.3), `undefined` without elements. |
|
|
163
171
|
| `exportDocument()` | `TtDocument` | Rebuild the canonical model from the live canvas. |
|
|
164
172
|
| `saveSVG()` | `{ svg: string }` | Self-contained SVG snapshot (fitted viewBox). |
|
|
165
173
|
| `setMeta(partial)` / `getMeta()` | — / `RootBusinessObject` | Read/write diagram-level metadata (`title`); `setMeta` is deprecated, rename with `get("ttModeling").setTitle(title)` (one undo step). |
|
|
@@ -192,8 +200,9 @@ or annotation's box in diagram coordinates from the live canvas, `undefined` for
|
|
|
192
200
|
from two `data:` URLs (`GEIST_UNICODE_RANGES` holds their subsets), and `embedSvgStyles(svg, css)`
|
|
193
201
|
puts CSS at the top of a `saveSVG()` result, so a rasterised PNG keeps the canvas typeface.
|
|
194
202
|
- **Other:** `TtViewerOptions`, `ImportOptions`, `ImportWarning`, `RootBusinessObject`, `ROOT_ID`,
|
|
195
|
-
`saveSVG`, `TtReadOnly` and `READ_ONLY_CHANGED_EVENT` (the lock, DI name `ttReadOnly`), and
|
|
196
|
-
|
|
203
|
+
`saveSVG`, `TtReadOnly` and `READ_ONLY_CHANGED_EVENT` (the lock, DI name `ttReadOnly`), and
|
|
204
|
+
`TtViewport` (DI name `ttViewport`: `contentBounds()` and the deprecated palette-aware fit behind
|
|
205
|
+
`fitToView()`).
|
|
197
206
|
|
|
198
207
|
## How it's built
|
|
199
208
|
|
package/dist/TtBaseViewer.d.ts
CHANGED
|
@@ -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 { TtDocument } from '@miragon/team-topologies-schema-model';
|
|
4
4
|
import { ImportWarning, RootBusinessObject } from './io/types.js';
|
|
5
5
|
import { Point } from './palette/TtPaletteProvider.js';
|
|
@@ -70,6 +70,12 @@ export declare abstract class TtBaseViewer {
|
|
|
70
70
|
*/
|
|
71
71
|
fitToView(): void;
|
|
72
72
|
private _fit;
|
|
73
|
+
/**
|
|
74
|
+
* The tight box around the diagram's content in diagram coordinates (`contentBounds()` of
|
|
75
|
+
* `@miragon/modeler-api` 1.3), or `undefined` while the canvas shows no element. A host's fit
|
|
76
|
+
* adds its own margins; zoom and scroll leave the box alone.
|
|
77
|
+
*/
|
|
78
|
+
contentBounds(): ElementBounds | undefined;
|
|
73
79
|
/** Current canvas state as a canonical document. */
|
|
74
80
|
exportDocument(): TtDocument;
|
|
75
81
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TtBaseViewer.d.ts","sourceRoot":"","sources":["../src/TtBaseViewer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAM9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"TtBaseViewer.d.ts","sourceRoot":"","sources":["../src/TtBaseViewer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAM9C,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAK5F,OAAO,EAAW,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAErF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAA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E,QAAQ,EAAE,aAAa,GAAG,IAAI;IAIjD;;;;;;;OAOG;IACH,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,GAAE,aAAkB,GAAG;QAAE,QAAQ,EAAE,aAAa,EAAE,CAAA;KAAE;IAsB3F;;;;;;OAMG;IACH,SAAS,IAAI,IAAI;IAIjB,OAAO,CAAC,IAAI;IAMZ;;;;OAIG;IACH,aAAa,IAAI,aAAa,GAAG,SAAS;IAa1C,oDAAoD;IACpD,cAAc,IAAI,UAAU;IAI5B;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI;IAanD,6DAA6D;IAC7D,OAAO,IAAI,kBAAkB,GAAG,SAAS;IASzC,+CAA+C;IAC/C,OAAO,IAAI;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;IAI1B,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAK/B,2DAA2D;IAC3D,MAAM,IAAI,IAAI;IAId,KAAK,IAAI,IAAI;IAIb,OAAO,IAAI,IAAI;IAQf,IAAI,SAAS,IAAI,WAAW,CAE3B;CACF"}
|
|
@@ -23,10 +23,14 @@ export interface CollaborativeTeamTopologiesOptions extends CollaborativeModeler
|
|
|
23
23
|
export interface TtElementsSurface extends ElementsSurface {
|
|
24
24
|
bounds(id: string): ElementBounds | undefined;
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* The contract surface, with the optional `contentBounds` of contract 1.3, which this renderer
|
|
28
|
+
* has, plus the wrapped diagram for host-specific wiring.
|
|
29
|
+
*/
|
|
27
30
|
export interface CollaborativeTeamTopologiesModeler extends CollaborativeModeler {
|
|
28
31
|
readonly elements: TtElementsSurface;
|
|
29
32
|
readonly diagram: Modeler | NavigatedViewer;
|
|
33
|
+
contentBounds(): ElementBounds | undefined;
|
|
30
34
|
}
|
|
31
35
|
/** The editing mount (`meta.editable: true`) of the collaborative-modeler contract. */
|
|
32
36
|
export declare function createCollaborativeModeler(options?: CollaborativeTeamTopologiesOptions): CollaborativeTeamTopologiesModeler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollaborativeTeamTopologies.d.ts","sourceRoot":"","sources":["../../src/collaborative/CollaborativeTeamTopologies.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAElB,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAK9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAE7D,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,kCAAmC,SAAQ,2BAA2B;IACrF,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,GAAG,SAAS,CAAC;IACpD;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;CACxD;AAED,gGAAgG;AAChG,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;CAC/C;AAED
|
|
1
|
+
{"version":3,"file":"CollaborativeTeamTopologies.d.ts","sourceRoot":"","sources":["../../src/collaborative/CollaborativeTeamTopologies.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK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out(element: TtElement): LabelLayout;
|
|
|
30
30
|
* result is identical on every platform and exported SVGs stay stable.
|
|
31
31
|
*/
|
|
32
32
|
export declare function wrapLabel(text: string, maxWidth: number, fontSize: number): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Where the element's wrapped label is drawn, relative to the element's top-left corner, or
|
|
35
|
+
* `undefined` without text. A word longer than a line, or more lines than the shape holds, reach
|
|
36
|
+
* past the shape, and the editor does not grow it. Estimated from the characters like the wrapping
|
|
37
|
+
* rather than measured, so it is the same at every zoom.
|
|
38
|
+
*/
|
|
39
|
+
export declare function labelTextBox(element: TtElement): LabelBox | undefined;
|
|
33
40
|
//# sourceMappingURL=label-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label-layout.d.ts","sourceRoot":"","sources":["../../src/draw/label-layout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAIL,KAAK,SAAS,EAGf,MAAM,sBAAsB,CAAC;AAO9B,eAAO,MAAM,WAAW,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"label-layout.d.ts","sourceRoot":"","sources":["../../src/draw/label-layout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAIL,KAAK,SAAS,EAGf,MAAM,sBAAsB,CAAC;AAO9B,eAAO,MAAM,WAAW,MAAM,CAAC;AAI/B,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,mFAAmF;IACnF,GAAG,EAAE,QAAQ,CAAC;IACd,qGAAqG;IACrG,KAAK,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,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