@miragon/team-topologies-renderer 0.13.2 → 0.14.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 +127 -27
- package/dist/TtBaseViewer.d.ts +2 -1
- package/dist/TtBaseViewer.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 +16 -0
- package/dist/chrome/TitleDialog.d.ts.map +1 -0
- package/dist/chrome/dialog.d.ts +40 -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 +59 -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/context-pad/TtContextPadPlacement.d.ts +31 -0
- package/dist/context-pad/TtContextPadPlacement.d.ts.map +1 -0
- package/dist/context-pad/TtContextPadProvider.d.ts +1 -0
- package/dist/context-pad/TtContextPadProvider.d.ts.map +1 -1
- package/dist/context-pad/index.d.ts +1 -1
- package/dist/context-pad/index.d.ts.map +1 -1
- package/dist/draw/TeamTopologiesRenderer.d.ts.map +1 -1
- package/dist/draw/colour.d.ts +22 -0
- package/dist/draw/colour.d.ts.map +1 -0
- package/dist/draw/label-layout.d.ts +3 -3
- package/dist/draw/label-layout.d.ts.map +1 -1
- package/dist/draw/palette-icons.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1161 -577
- package/dist/index.js.map +1 -1
- package/dist/io/TtViewport.d.ts +8 -6
- package/dist/io/TtViewport.d.ts.map +1 -1
- package/dist/io/saveSvg.d.ts.map +1 -1
- package/dist/keyboard/TtKeyboard.d.ts.map +1 -1
- package/dist/keyboard/canvasFocus.d.ts +19 -0
- package/dist/keyboard/canvasFocus.d.ts.map +1 -0
- package/dist/label-editing/TtLabelEditing.d.ts.map +1 -1
- package/dist/legend/index.d.ts +3 -0
- package/dist/legend/index.d.ts.map +1 -0
- package/dist/legend/legendContent.d.ts +34 -0
- package/dist/legend/legendContent.d.ts.map +1 -0
- package/dist/palette/TtPaletteProvider.d.ts.map +1 -1
- package/dist/palette/TtPaletteTooltip.d.ts +19 -0
- package/dist/palette/TtPaletteTooltip.d.ts.map +1 -0
- package/dist/palette/index.d.ts +4 -1
- package/dist/palette/index.d.ts.map +1 -1
- package/dist/team-topologies.css +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/notation-fills.d.ts +4 -0
- package/dist/theme/notation-fills.d.ts.map +1 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @miragon/team-topologies-renderer
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@miragon/team-topologies-renderer)
|
|
4
|
-
[](https://github.com/Miragon/modeler-suite/blob/main/modelers/team-topologies/LICENSE)
|
|
5
5
|
|
|
6
6
|
The **browser layer** of the [Team Topologies Modeler](../../README.md): a framework-agnostic viewer
|
|
7
7
|
and full editor for [Team Topologies](https://teamtopologies.com/) diagrams, built on
|
|
@@ -10,8 +10,11 @@ and full editor for [Team Topologies](https://teamtopologies.com/) diagrams, bui
|
|
|
10
10
|
It renders the canonical document from
|
|
11
11
|
[`@miragon/team-topologies-schema-model`](../schema-model) and gives you palette, move, resize,
|
|
12
12
|
connect-by-overlap, multi-selection (lasso, select all) with group move, text annotations, context
|
|
13
|
-
pad, in-place label editing and undo/redo
|
|
14
|
-
Mount it into any `<div>`; the web app and the VS Code extension both wrap this exact package.
|
|
13
|
+
pad, in-place label editing and undo/redo, with no UI framework required.
|
|
14
|
+
Mount it into any `<div>`; the web app and the VS Code extension both wrap this exact package. It
|
|
15
|
+
hands a chrome such as [`@miragon/modeler-shell`](https://www.npmjs.com/package/@miragon/modeler-shell)
|
|
16
|
+
its menu entries, legend rows and dialogs without importing it (see
|
|
17
|
+
[Around the canvas](#around-the-canvas)).
|
|
15
18
|
|
|
16
19
|
## Install
|
|
17
20
|
|
|
@@ -42,18 +45,38 @@ npm install @miragon/team-topologies-renderer @miragon/team-topologies-schema-mo
|
|
|
42
45
|
| Esc | Clear the selection |
|
|
43
46
|
| Enter / Space on a context-pad entry | Run it (rename, add annotation, delete) |
|
|
44
47
|
|
|
45
|
-
The shortcuts act only while the
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
The shortcuts act only while the canvas itself has the focus, as diagram-js 15's own keyboard
|
|
49
|
+
does: on keys whose target is the canvas `<svg>` or inside it. Keys with nothing focused
|
|
50
|
+
(`<body>`), on host chrome, on the palette, the context pad or the label editor and keys while a
|
|
51
|
+
modal dialog is open pass, and so do keys a closer listener already handled (`defaultPrevented`)
|
|
52
|
+
and keys of an IME composition. A click or drag with a pointer on a palette entry, and the
|
|
53
|
+
context pad's attach and delete, hand the focus to the canvas, so Delete and `Ctrl/Cmd+Z` act
|
|
54
|
+
at once. Enter or Space leave it on the lasso, hand it to the canvas on the pad's delete, and
|
|
55
|
+
on a creating palette entry open the label editor (see "Palette from the keyboard" below).
|
|
56
|
+
Rename and "Add annotation" open the label editor too, which gives the focus back to the
|
|
57
|
+
canvas when it closes. diagram-js rebuilds the context pad whenever its element changes, for
|
|
58
|
+
example on an undo: a focused entry then moves to the same entry of the new pad, and to the
|
|
59
|
+
canvas when the pad closes. Zoom and fit keys belong to the host's chrome (guide §5.8: only
|
|
48
60
|
Cmd/Ctrl + `+` `-` `0` and Shift+1, each acting exactly once), so the canvas binds none; the
|
|
49
61
|
[`@miragon/modeler-shell`](https://www.npmjs.com/package/@miragon/modeler-shell) chrome provides
|
|
50
62
|
them together with the zoom panel.
|
|
51
63
|
|
|
64
|
+
A host that hides the canvas without destroying the modeler makes its container `inert` or
|
|
65
|
+
`display: none`, not only transparent: a hidden or inert canvas cannot hold the focus, so no key
|
|
66
|
+
reaches it. There is no separate switch to pause the keyboard.
|
|
67
|
+
|
|
52
68
|
**Palette from the keyboard.** A host chrome that makes the palette a toolbar (the modeler shell)
|
|
53
69
|
triggers an entry with a click whose `detail` is 0. On a creating entry that click places the
|
|
54
70
|
element in the centre of the free part of the canvas (`freeArea`, else the centre of the view), 24px
|
|
55
71
|
further diagonally while that spot is taken, selects it and opens its label editor.
|
|
56
72
|
|
|
73
|
+
**Embedded in a page.** Layout reads the modeler's container, not the page: in a container up to
|
|
74
|
+
760px wide the renderer's own palette takes a second row, whatever the window's width. Its tooltip
|
|
75
|
+
stands 8px below the palette, centred on its entry and 12px from the container's sides. Without
|
|
76
|
+
`freeArea: { insets }`, the context pad keeps inside the container. A host that resizes the
|
|
77
|
+
container calls diagram-js's `canvas.resized()`, as for any diagram-js canvas; the pad then keeps
|
|
78
|
+
inside the new size as well.
|
|
79
|
+
|
|
57
80
|
**Label editor and the view.** A change of the view (a host's `setViewState` or fit, a wheel zoom or
|
|
58
81
|
scroll) never commits an open label editor: it stays open with what was typed and moves with its
|
|
59
82
|
element. Enter, a click or drag on the canvas and leaving the field commit; Escape discards (law L5
|
|
@@ -91,8 +114,8 @@ modeler.redo();
|
|
|
91
114
|
|
|
92
115
|
> **The CSS is required.** Import `@miragon/team-topologies-renderer/assets/team-topologies.css`
|
|
93
116
|
> (it also pulls in the Miragon design tokens, `diagram-js`'s own stylesheet and `cd-canvas.css`, in
|
|
94
|
-
> that order)
|
|
95
|
-
> `--cd-ui-*` role of design system 1.
|
|
117
|
+
> that order); without it the palette, context pad and label editor are unstyled. Every colour is a
|
|
118
|
+
> `--cd-ui-*` role of design system 1.20.1, vendored unchanged under `src/theme/`. The tokens sit in
|
|
96
119
|
> the cascade layer `team-topologies-tokens`, so a host page's own `--cd-*` tokens (unlayered) win
|
|
97
120
|
> over this copy.
|
|
98
121
|
|
|
@@ -105,7 +128,7 @@ modeler.redo();
|
|
|
105
128
|
|
|
106
129
|
## API
|
|
107
130
|
|
|
108
|
-
### Constructor
|
|
131
|
+
### Constructor: `TtViewerOptions`
|
|
109
132
|
|
|
110
133
|
```ts
|
|
111
134
|
new Modeler({
|
|
@@ -143,7 +166,9 @@ Options: the contract's `CollaborativeModelerOptions` (1.2) and `additionalModul
|
|
|
143
166
|
|
|
144
167
|
- `freeArea`: the part of the canvas no host chrome covers, `{ insets: () => shell.fitInsets() }`
|
|
145
168
|
(px from the container's edges) or `{ center: () => viewport.freeRectCenter() }` (diagram
|
|
146
|
-
coordinates); keyboard creation lands in its centre.
|
|
169
|
+
coordinates); keyboard creation lands in its centre. Given as `insets`, the context pad also
|
|
170
|
+
keeps inside it: it flips to the left of its element or moves up or down instead of running
|
|
171
|
+
under the host's chrome. Default: the whole view.
|
|
147
172
|
- `fitOnImport` (default true): a fit of at most 100 % that keeps the palette's strip free after
|
|
148
173
|
every import; a host whose chrome fits the diagram itself passes false.
|
|
149
174
|
- `undoRedoKeys` (default true): false when the host owns the history (VS Code).
|
|
@@ -169,8 +194,8 @@ estimated from the characters rather than measured. A host that fits the view it
|
|
|
169
194
|
| `fitToView()` | `void` | Deprecated: fit every element, keeping the strip under the palette free. |
|
|
170
195
|
| `contentBounds()` | `ElementBounds \| undefined` | The tight box around every element and its label text in diagram coordinates (contract 1.3), `undefined` without elements. |
|
|
171
196
|
| `exportDocument()` | `TtDocument` | Rebuild the canonical model from the live canvas. |
|
|
172
|
-
| `saveSVG()` | `{ svg: string }` | Self-contained SVG snapshot (
|
|
173
|
-
| `setMeta(partial)` / `getMeta()` |
|
|
197
|
+
| `saveSVG()` | `{ svg: string }` | Self-contained SVG snapshot of the `contentBounds()` box, label text included, plus a 40px margin. |
|
|
198
|
+
| `setMeta(partial)` / `getMeta()` | `void` / `RootBusinessObject` | Read/write diagram-level metadata (`title`); `setMeta` is deprecated, rename with `get("ttModeling").setTitle(title)` (one undo step). |
|
|
174
199
|
| `attachTo(el)` / `detach()` | `void` | Move the canvas in/out of the DOM (keeps state). |
|
|
175
200
|
| `clear()` / `destroy()` | `void` | Empty the canvas / tear it down. |
|
|
176
201
|
| `on(event, cb)` / `off(event, cb)` | `void` | Subscribe to diagram-js events. |
|
|
@@ -180,6 +205,74 @@ estimated from the characters rather than measured. A host that fits the view it
|
|
|
180
205
|
|
|
181
206
|
`undo()`, `redo()`, `canUndo()`, `canRedo()`.
|
|
182
207
|
|
|
208
|
+
### Around the canvas
|
|
209
|
+
|
|
210
|
+
What a chrome around the canvas shows, typed structurally (a `@miragon/modeler-shell` handle fits,
|
|
211
|
+
and so does a host's own chrome with the same fields). The renderer's stylesheet styles all of it,
|
|
212
|
+
so a host without the shell needs nothing else:
|
|
213
|
+
|
|
214
|
+
- `diagramMenu({ exports, showKeyboardShortcuts, editTitle, shortcutsKey })` builds the menu groups
|
|
215
|
+
of guide §5.4, in the shape the shell's `menu` option takes: Model with "Diagram title…" (only
|
|
216
|
+
with `editTitle`; it changes the document, so a read-only canvas disables it), Export with
|
|
217
|
+
"Export as PNG" and "Export as SVG" (then "Export as JSON" with `exports.json`; an export's
|
|
218
|
+
`shortcut` shows as its chip) and Help with "Keyboard shortcuts…" (`shortcutsKey`, e.g.
|
|
219
|
+
`SHORTCUTS_DIALOG_KEY`, as its chip). The Model group's Legend checkbox is the shell's own.
|
|
220
|
+
- `createTitleDialog(chrome, { title, setTitle })` is the "Diagram title…" dialog: one field,
|
|
221
|
+
Cancel and Apply. Enter applies the trimmed title, Escape and Cancel keep the old one, an
|
|
222
|
+
unchanged title writes nothing and a blank one cannot be applied. Pass
|
|
223
|
+
`setTitle: (title) => modeler.get("ttModeling").setTitle(title)` for one undo step.
|
|
224
|
+
- `createShortcutsDialog(chrome, { fileKeys })` is the "Keyboard shortcuts…" dialog, one table per
|
|
225
|
+
group (`diagramShortcuts(chrome, options)` returns them as data); `fileKeys` adds a File group
|
|
226
|
+
(Open… on Cmd/Ctrl+O, Export as JSON on Cmd/Ctrl+S) and the `?` key for a web app that binds
|
|
227
|
+
them. Its View rows read the chrome's own zoom and fit texts and key names.
|
|
228
|
+
- Both dialogs are native modal `<dialog>`s in `chrome.root` (the shell root), closed by Escape, the
|
|
229
|
+
Close button or a press on the backdrop; the focus goes back to the control that opened them, else
|
|
230
|
+
to `chrome.menu.trigger`. They are built on the first `open()`; call `destroy()` with the
|
|
231
|
+
diagram's teardown.
|
|
232
|
+
- `renderLegend(body)` renders the notation legend into a chrome's legend card (the shell's
|
|
233
|
+
`legend.render`): team types, interaction modes and the other elements, each with the palette's
|
|
234
|
+
glyph in its official notation colours, its name and a short explanation. Rows, previews and
|
|
235
|
+
separators carry the shell's `cd-shell-legend-*` classes next to their own, and the renderer's
|
|
236
|
+
stylesheet lays them out with the shell's values, so the legend looks the same with or without
|
|
237
|
+
the shell. It returns the function that removes the rows again.
|
|
238
|
+
`legendGroups()` is the same content as DOM-free data (`preview` is SVG markup) for a host that
|
|
239
|
+
draws the legend itself.
|
|
240
|
+
|
|
241
|
+
For the Export entries, a host takes `modeler.saveSVG()`: the SVG as it is, or rasterised to a PNG.
|
|
242
|
+
An SVG drawn as an image cannot reach the page's fonts, so embed Geist before rasterising:
|
|
243
|
+
`embedSvgStyles(svg, geistFontFaceCss({ latin, latinExt }))` (see [Typeface](#quick-start)).
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
import {
|
|
247
|
+
createShortcutsDialog,
|
|
248
|
+
createTitleDialog,
|
|
249
|
+
diagramMenu,
|
|
250
|
+
embedSvgStyles,
|
|
251
|
+
geistFontFaceCss,
|
|
252
|
+
renderLegend,
|
|
253
|
+
type TtModeling,
|
|
254
|
+
} from "@miragon/team-topologies-renderer";
|
|
255
|
+
|
|
256
|
+
// `chrome` is a modeler-shell handle or { root, menu: { trigger }, platform, lang, messages }.
|
|
257
|
+
const title = createTitleDialog(chrome, {
|
|
258
|
+
title: () => modeler.getMeta()?.title ?? "",
|
|
259
|
+
setTitle: (next) => modeler.get<TtModeling>("ttModeling").setTitle(next),
|
|
260
|
+
});
|
|
261
|
+
const shortcuts = createShortcutsDialog(chrome);
|
|
262
|
+
// The two latin Geist WOFF2 files as data: URLs, from the host's own copy of the font.
|
|
263
|
+
const fontCss = geistFontFaceCss({ latin, latinExt });
|
|
264
|
+
const menu = diagramMenu({
|
|
265
|
+
editTitle: () => title.open(),
|
|
266
|
+
exports: {
|
|
267
|
+
// savePng and saveSvg are the host's: rasterise and download, or hand the file on.
|
|
268
|
+
png: { onSelect: () => savePng(embedSvgStyles(modeler.saveSVG().svg, fontCss)) },
|
|
269
|
+
svg: { onSelect: () => saveSvg(modeler.saveSVG().svg) },
|
|
270
|
+
},
|
|
271
|
+
showKeyboardShortcuts: () => shortcuts.open(),
|
|
272
|
+
});
|
|
273
|
+
const removeLegend = renderLegend(legendBody);
|
|
274
|
+
```
|
|
275
|
+
|
|
183
276
|
### Helpers & types
|
|
184
277
|
|
|
185
278
|
- **Type guards:** `isTtElement`, `isTtTeam`, `isTtInteraction`, `isTtFlow`, `isTtAnnotation`,
|
|
@@ -187,7 +280,7 @@ estimated from the characters rather than measured. A host that fits the view it
|
|
|
187
280
|
- **Runtime element types:** `TtTeam`, `TtInteraction`, `TtFlow`, `TtAnnotation`, `TtElement`, and
|
|
188
281
|
`TtAssociation` (the connector from an annotation to the element it is attached to).
|
|
189
282
|
- **Palette icon generators:** `teamIconSvg(type)`, `interactionIconSvg(mode)`, `flowIconSvg()`,
|
|
190
|
-
`annotationIconSvg()
|
|
283
|
+
`annotationIconSvg()`: WYSIWYG SVG glyphs matching what the canvas draws. The annotation glyph
|
|
191
284
|
strokes in `currentColor`.
|
|
192
285
|
- **Functional icons:** `iconMarkup(icon, { size?, strokeWidth?, className? })` returns inline SVG
|
|
193
286
|
markup (Lucide style: 24 × 24 grid, stroke 2.5, `currentColor`) for the bundled `ICON_*` Lucide
|
|
@@ -199,6 +292,11 @@ estimated from the characters rather than measured. A host that fits the view it
|
|
|
199
292
|
- **Fonts in exports:** `geistFontFaceCss({ latin, latinExt })` builds the Geist `@font-face` rules
|
|
200
293
|
from two `data:` URLs (`GEIST_UNICODE_RANGES` holds their subsets), and `embedSvgStyles(svg, css)`
|
|
201
294
|
puts CSS at the top of a `saveSVG()` result, so a rasterised PNG keeps the canvas typeface.
|
|
295
|
+
- **Chrome content** ([Around the canvas](#around-the-canvas)): `diagramMenu`, `diagramShortcuts`,
|
|
296
|
+
`createShortcutsDialog`, `createTitleDialog`, `renderLegend`, `legendGroups`,
|
|
297
|
+
`JSON_EXPORT_LABEL`, `SHORTCUTS_DIALOG_KEY`, and their structural types (`DiagramMenu`,
|
|
298
|
+
`DiagramMenuActions`, `DiagramExports`, `ShortcutsDialogChrome`, `TitleDialogChrome`,
|
|
299
|
+
`DiagramTitle`, `LegendGroup`, `LegendRow`, …).
|
|
202
300
|
- **Other:** `TtViewerOptions`, `ImportOptions`, `ImportWarning`, `RootBusinessObject`, `ROOT_ID`,
|
|
203
301
|
`saveSVG`, `TtReadOnly` and `READ_ONLY_CHANGED_EVENT` (the lock, DI name `ttReadOnly`), and
|
|
204
302
|
`TtViewport` (DI name `ttViewport`: `contentBounds()` and the deprecated palette-aware fit behind
|
|
@@ -215,13 +313,13 @@ viewer via `additionalModules`:
|
|
|
215
313
|
| `ttModelModule` | Element factory with notation defaults (`TtElementFactory`). |
|
|
216
314
|
| `ttDrawModule` | SVG rendering of teams, interactions, flow and annotations (`TeamTopologiesRenderer`). |
|
|
217
315
|
| `ioModule` | Document ↔ canvas bridge (`TtImporter`, `TtExporter`, `saveSVG`, `TtViewport`). |
|
|
218
|
-
| `ttModelingModule` | High-level mutations
|
|
316
|
+
| `ttModelingModule` | High-level mutations: label, type, mode, colours, description, annotations. |
|
|
219
317
|
| `ttRulesModule` | Editing rules (what can move / resize / be created / be attached). |
|
|
220
318
|
| `ttBehaviorsModule` | Keeps the model **flat** and annotation connectors cropped, one per annotation. |
|
|
221
319
|
| `ttPaletteModule` | The lasso tool and the drag-to-create palette. |
|
|
222
320
|
| `ttContextPadModule` | Per-element actions (rename, add/attach annotation, delete; delete a multi-selection). |
|
|
223
321
|
| `ttLabelEditingModule` | Double-click in-place label editing. |
|
|
224
|
-
| `ttKeyboardModule` | Undo / redo / select all / delete / copy / paste / nudge / Esc
|
|
322
|
+
| `ttKeyboardModule` | Undo / redo / select all / delete / copy / paste / nudge / Esc on the focused canvas. |
|
|
225
323
|
| `ttReadOnlyModule` | The edit lock for a document the canvas cannot save (`ttReadOnly`). |
|
|
226
324
|
| `ttZOrderModule` | Fixed stacking order (flow behind, teams, interactions, annotations on top). |
|
|
227
325
|
|
|
@@ -230,12 +328,13 @@ viewer via `additionalModules`:
|
|
|
230
328
|
A custom `TeamTopologiesRenderer` (priority `1500`, beating diagram-js's default) draws each element
|
|
231
329
|
from the spec in [`@miragon/team-topologies-schema-model`](../schema-model): the four team outlines
|
|
232
330
|
(octagon, vertical/horizontal rounded rectangles, square rectangle) drawn solid; the three
|
|
233
|
-
interaction glyphs (parallelogram, triangle, circle) drawn dashed and
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
331
|
+
interaction glyphs (parallelogram, triangle, circle) drawn dashed and opaque, their translucent
|
|
332
|
+
template fill mixed over white (design guide §10.6); the flow-of-change as a dashed left-to-right
|
|
333
|
+
band; an annotation as a BPMN-style open bracket with left-aligned text, tied to its element by a
|
|
334
|
+
dashed connector. Labels are word-wrapped (explicit line breaks are kept) and centred. Per-element
|
|
335
|
+
`fill`/`stroke` overrides win over the spec defaults (an interaction's own fill is mixed over white
|
|
336
|
+
the same way), and stay visible while an element is selected or hovered (the selection is a
|
|
337
|
+
separate blue outline). On a dark custom fill, team and interaction labels switch to white.
|
|
239
338
|
|
|
240
339
|
## Import / export
|
|
241
340
|
|
|
@@ -248,14 +347,15 @@ rasterisation those formats need.
|
|
|
248
347
|
|
|
249
348
|
## Development
|
|
250
349
|
|
|
251
|
-
Part of the [Team Topologies Modeler](../../README.md)
|
|
252
|
-
|
|
350
|
+
Part of the [Team Topologies Modeler](../../README.md) in the
|
|
351
|
+
[Miragon modeler suite](https://github.com/Miragon/modeler-suite); consumed from source by the
|
|
352
|
+
apps. From the suite's root:
|
|
253
353
|
|
|
254
354
|
```bash
|
|
255
|
-
npm run build -w
|
|
256
|
-
npm test
|
|
257
|
-
npm run test:browser # renderer integration tests in real Chromium
|
|
258
|
-
npm run typecheck
|
|
355
|
+
npm run build -w @miragon/team-topologies-renderer # Vite library build → dist/ (publish build)
|
|
356
|
+
npm run team-topologies test # Vitest unit tests
|
|
357
|
+
npm run team-topologies test:browser # renderer integration tests in real Chromium
|
|
358
|
+
npm run team-topologies typecheck
|
|
259
359
|
```
|
|
260
360
|
|
|
261
361
|
## License
|
package/dist/TtBaseViewer.d.ts
CHANGED
|
@@ -19,7 +19,8 @@ export interface TtViewerOptions {
|
|
|
19
19
|
* Where Enter or Space on a creating palette entry places the element (guide §5.5): the centre
|
|
20
20
|
* of the part of the canvas no chrome covers, given as its insets in px from the container's
|
|
21
21
|
* edges (`{ insets }`) or as that centre in diagram coordinates (`{ center }`). Without it, the
|
|
22
|
-
* centre of the visible canvas.
|
|
22
|
+
* centre of the visible canvas. Given as `{ insets }`, the context pad also keeps inside that
|
|
23
|
+
* part; otherwise it keeps inside the container.
|
|
23
24
|
*/
|
|
24
25
|
freeArea?: FreeArea | undefined;
|
|
25
26
|
/**
|
|
@@ -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,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,EA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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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChromeDialog, DialogChrome } from './dialog.js';
|
|
2
|
+
import { DiagramShortcutOptions, ShortcutsChrome } from './shortcuts.js';
|
|
3
|
+
/** What the dialog needs of the chrome around the diagram; 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
|
+
* action on the left and its keys as the chrome tooltip's chips on the right.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createShortcutsDialog(chrome: ShortcutsDialogChrome, options?: DiagramShortcutOptions): 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,sBAAsB,EAE3B,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAKxB,sGAAsG;AACtG,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,sBAA2B,GACnC,eAAe,CAWjB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChromeDialog, DialogChrome } from './dialog.js';
|
|
2
|
+
/** The diagram's title, read when the dialog opens and written when it applies. */
|
|
3
|
+
export interface DiagramTitle {
|
|
4
|
+
title(): string;
|
|
5
|
+
setTitle(title: string): void;
|
|
6
|
+
}
|
|
7
|
+
export type TitleDialogChrome = DialogChrome;
|
|
8
|
+
export type TitleDialog = ChromeDialog;
|
|
9
|
+
/**
|
|
10
|
+
* The "Diagram title…" dialog of the Model group. Guide §5.4 keeps form fields out of the menu and
|
|
11
|
+
* puts no title field next to it, so the title is edited here: one field, Cancel and Apply. Enter
|
|
12
|
+
* applies, Escape cancels. An unchanged title writes nothing, so the history gets no empty step,
|
|
13
|
+
* and a blank one cannot be applied, because the exports name their files after the title.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTitleDialog(chrome: TitleDialogChrome, diagramTitle: DiagramTitle): TitleDialog;
|
|
16
|
+
//# 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,mFAAmF;AACnF,MAAM,WAAW,YAAY;IAC3B,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;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,YAAY,GACzB,WAAW,CAkDb"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The modeler's own dialogs in a host's chrome (guide §8, "Modeler dialogs" of the modeler shell's
|
|
3
|
+
* API): a native modal <dialog> in the chrome's root, so the browser keeps the focus inside it and
|
|
4
|
+
* closes it on Escape, and its top layer puts it above every island. Built on the first open and
|
|
5
|
+
* kept (closed) afterwards; `destroy()` removes it, because the chrome removes only what it added
|
|
6
|
+
* itself. The renderer's stylesheet styles it, so a host without the modeler shell gets it as is.
|
|
7
|
+
*/
|
|
8
|
+
/** What a dialog needs of the chrome around the diagram; a `@miragon/modeler-shell` handle fits. */
|
|
9
|
+
export interface DialogChrome {
|
|
10
|
+
/** Where the dialog lives (the shell root), so it shares the chrome's mode and fonts. */
|
|
11
|
+
readonly root: HTMLElement;
|
|
12
|
+
readonly messages: {
|
|
13
|
+
readonly close: string;
|
|
14
|
+
};
|
|
15
|
+
/** The control the focus returns to when the one that opened the dialog is gone. */
|
|
16
|
+
readonly menu: {
|
|
17
|
+
readonly trigger: HTMLElement;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface ChromeDialog {
|
|
21
|
+
open(): void;
|
|
22
|
+
isOpen(): boolean;
|
|
23
|
+
close(): void;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
}
|
|
26
|
+
export interface ChromeDialogSpec {
|
|
27
|
+
/** Class of the `<dialog>` next to `tt-dialog`, for the dialog's own rules. */
|
|
28
|
+
readonly className: string;
|
|
29
|
+
readonly titleId: string;
|
|
30
|
+
readonly title: string;
|
|
31
|
+
/** The parts below the header, built once on the first open. */
|
|
32
|
+
content(close: () => void): Node[];
|
|
33
|
+
/** Runs before every open, while the dialog is still closed. */
|
|
34
|
+
beforeOpen?(): void;
|
|
35
|
+
/** Runs after every open, once the dialog shows and holds the focus. */
|
|
36
|
+
afterOpen?(): void;
|
|
37
|
+
}
|
|
38
|
+
export declare function element<K extends keyof HTMLElementTagNameMap>(tag: K, className: string, text?: string): HTMLElementTagNameMap[K];
|
|
39
|
+
export declare function createChromeDialog(chrome: DialogChrome, spec: ChromeDialogSpec): ChromeDialog;
|
|
40
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/chrome/dialog.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,oGAAoG;AACpG,MAAM,WAAW,YAAY;IAC3B,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,oFAAoF;IACpF,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;KAAE,CAAC;CAClD;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,OAAO,CAAC;IAClB,KAAK,IAAI,IAAI,CAAC;IACd,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,OAAO,CAAC,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,EAAE,CAAC;IACnC,gEAAgE;IAChE,UAAU,CAAC,IAAI,IAAI,CAAC;IACpB,wEAAwE;IACxE,SAAS,CAAC,IAAI,IAAI,CAAC;CACpB;AAED,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAC3D,GAAG,EAAE,CAAC,EACN,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,GACZ,qBAAqB,CAAC,CAAC,CAAC,CAK1B;AAoBD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,GAAG,YAAY,CAwD7F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { JSON_EXPORT_LABEL, SHORTCUTS_DIALOG_KEY, diagramMenu } from './menu.js';
|
|
2
|
+
export type { DiagramExport, DiagramExports, DiagramMenu, DiagramMenuAction, DiagramMenuActions, DiagramMenuDialog, DiagramMenuEntry, DiagramMenuIcon, } from './menu.js';
|
|
3
|
+
export { diagramShortcuts } from './shortcuts.js';
|
|
4
|
+
export type { DiagramShortcutOptions, ShortcutGroup, ShortcutKeyNames, ShortcutPlatform, ShortcutRow, ShortcutsChrome, } from './shortcuts.js';
|
|
5
|
+
export type { ChromeDialog, DialogChrome } from './dialog.js';
|
|
6
|
+
export { createShortcutsDialog } from './ShortcutsDialog.js';
|
|
7
|
+
export type { ShortcutsDialog, ShortcutsDialogChrome } from './ShortcutsDialog.js';
|
|
8
|
+
export { createTitleDialog } from './TitleDialog.js';
|
|
9
|
+
export type { DiagramTitle, TitleDialog, TitleDialogChrome } from './TitleDialog.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,iBAAiB,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACjF,YAAY,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EACV,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC9D,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,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** The icons the guide gives these entries (guide §5.14, the shell's common set). */
|
|
2
|
+
export type DiagramMenuIcon = "file-image" | "file-code-corner" | "keyboard";
|
|
3
|
+
interface DiagramMenuItem {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly icon?: DiagramMenuIcon;
|
|
7
|
+
readonly keepEnabledWhenReadOnly?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface DiagramMenuAction extends DiagramMenuItem {
|
|
10
|
+
readonly kind: "action";
|
|
11
|
+
readonly shortcut?: string;
|
|
12
|
+
onSelect(): void;
|
|
13
|
+
}
|
|
14
|
+
export interface DiagramMenuDialog extends DiagramMenuItem {
|
|
15
|
+
readonly kind: "dialog";
|
|
16
|
+
/** The chip of a key that opens the dialog as well, e.g. "?". */
|
|
17
|
+
readonly shortcut?: string;
|
|
18
|
+
onSelect(): void;
|
|
19
|
+
}
|
|
20
|
+
export type DiagramMenuEntry = DiagramMenuAction | DiagramMenuDialog;
|
|
21
|
+
export interface DiagramMenu {
|
|
22
|
+
readonly model: readonly DiagramMenuEntry[];
|
|
23
|
+
readonly export: readonly DiagramMenuEntry[];
|
|
24
|
+
readonly help: readonly DiagramMenuEntry[];
|
|
25
|
+
}
|
|
26
|
+
export interface DiagramExport {
|
|
27
|
+
onSelect(): void;
|
|
28
|
+
/** The chip of an app key that runs the same export, e.g. "⌘S". */
|
|
29
|
+
readonly shortcut?: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The exports a host offers, in the guide's order: PNG first (the more frequent target), then SVG,
|
|
33
|
+
* then the document itself where the host is not the file (the web app).
|
|
34
|
+
*/
|
|
35
|
+
export interface DiagramExports {
|
|
36
|
+
readonly png: DiagramExport;
|
|
37
|
+
readonly svg: DiagramExport;
|
|
38
|
+
readonly json?: DiagramExport | undefined;
|
|
39
|
+
}
|
|
40
|
+
export interface DiagramMenuActions {
|
|
41
|
+
readonly exports: DiagramExports;
|
|
42
|
+
showKeyboardShortcuts(): void;
|
|
43
|
+
/** Opens the "Diagram title…" dialog; without it the Model group has no title entry. */
|
|
44
|
+
editTitle?: (() => void) | undefined;
|
|
45
|
+
/** The chip of a key the host binds to the shortcuts dialog as well, e.g. "?" in the web app. */
|
|
46
|
+
readonly shortcutsKey?: string | undefined;
|
|
47
|
+
}
|
|
48
|
+
/** The label of the JSON export, also its row in the shortcuts dialog's File group. */
|
|
49
|
+
export declare const JSON_EXPORT_LABEL = "Export as JSON";
|
|
50
|
+
/** The key the web app opens the shortcuts dialog with, listed in the dialog's View group. */
|
|
51
|
+
export declare const SHORTCUTS_DIALOG_KEY = "?";
|
|
52
|
+
/**
|
|
53
|
+
* The menu groups of the diagram (guide §5.4): Model with "Diagram title…" where the host renames
|
|
54
|
+
* the diagram (it changes the document, so a read-only canvas disables it), Export with PNG first,
|
|
55
|
+
* Help with the shortcuts dialog.
|
|
56
|
+
*/
|
|
57
|
+
export declare function diagramMenu(actions: DiagramMenuActions): DiagramMenu;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/chrome/menu.ts"],"names":[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E,aAAa,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,qBAAqB,IAAI,IAAI,CAAC;IAC9B,wFAAwF;IACxF,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACrC,iGAAiG;IACjG,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5C;AAED,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAElD,8FAA8F;AAC9F,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAkBxC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CA6BpE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type ShortcutPlatform = "mac" | "other";
|
|
2
|
+
export interface ShortcutKeyNames {
|
|
3
|
+
readonly ctrl: string;
|
|
4
|
+
readonly shift: string;
|
|
5
|
+
readonly plus: string;
|
|
6
|
+
readonly minus: string;
|
|
7
|
+
}
|
|
8
|
+
/** What the shortcuts need of the chrome around the diagram. */
|
|
9
|
+
export interface ShortcutsChrome {
|
|
10
|
+
readonly platform: ShortcutPlatform;
|
|
11
|
+
/** The tool's UI language, for the percentage in "Zoom to 100%". */
|
|
12
|
+
readonly lang: string;
|
|
13
|
+
readonly messages: {
|
|
14
|
+
readonly zoomIn: string;
|
|
15
|
+
readonly zoomOut: string;
|
|
16
|
+
zoomToActual(percent: string): string;
|
|
17
|
+
readonly fit: string;
|
|
18
|
+
/** The File group's "Open…" (the shell's `messages.openFile`); default "Open…". */
|
|
19
|
+
readonly openFile?: string | undefined;
|
|
20
|
+
readonly keyNames: ShortcutKeyNames;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface ShortcutRow {
|
|
24
|
+
readonly action: string;
|
|
25
|
+
/** Alternative key combinations, each shown as its own chip. */
|
|
26
|
+
readonly keys: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
export interface ShortcutGroup {
|
|
29
|
+
readonly title: string;
|
|
30
|
+
readonly rows: readonly ShortcutRow[];
|
|
31
|
+
}
|
|
32
|
+
export interface DiagramShortcutOptions {
|
|
33
|
+
/** The web app's own keys: Open…, Export as JSON and "?" for this dialog. */
|
|
34
|
+
readonly fileKeys?: boolean | undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Every shortcut of the diagram, grouped as guide §5.4 asks (View, Edit, Tools), after the web
|
|
38
|
+
* app's File keys where it binds them.
|
|
39
|
+
*/
|
|
40
|
+
export declare function diagramShortcuts(chrome: ShortcutsChrome, options?: DiagramShortcutOptions): ShortcutGroup[];
|
|
41
|
+
//# sourceMappingURL=shortcuts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortcuts.d.ts","sourceRoot":"","sources":["../../src/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,gEAAgE;AAChE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;QACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,mFAAmF;QACnF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACvC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KACrC,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,sBAAsB;IACrC,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC;AA6DD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,sBAA2B,GACnC,aAAa,EAAE,CAyDjB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { default as Canvas } from 'diagram-js/lib/core/Canvas';
|
|
2
|
+
import { default as EventBus } from 'diagram-js/lib/core/EventBus';
|
|
3
|
+
import { default as Scheduler } from 'diagram-js/lib/features/scheduler/Scheduler';
|
|
4
|
+
import { FreeArea } from '@miragon/modeler-api';
|
|
5
|
+
export interface TtContextPadConfig {
|
|
6
|
+
/**
|
|
7
|
+
* The part of the canvas no host chrome covers. Only `insets` name a rectangle; with `center`
|
|
8
|
+
* alone, or without the option, the pad keeps inside the whole container.
|
|
9
|
+
*/
|
|
10
|
+
freeArea?: FreeArea | undefined;
|
|
11
|
+
}
|
|
12
|
+
export default class TtContextPadPlacement {
|
|
13
|
+
private readonly config;
|
|
14
|
+
private readonly canvas;
|
|
15
|
+
private readonly scheduler;
|
|
16
|
+
static $inject: string[];
|
|
17
|
+
private openPad;
|
|
18
|
+
/** Where diagram-js last put the open pad; every placement starts from it. */
|
|
19
|
+
private diagramJsPosition;
|
|
20
|
+
private positionWrites;
|
|
21
|
+
constructor(config: TtContextPadConfig | undefined, eventBus: EventBus, canvas: Canvas, scheduler: Scheduler);
|
|
22
|
+
private follow;
|
|
23
|
+
private stopFollowing;
|
|
24
|
+
private schedulePlacement;
|
|
25
|
+
private keepInsideFreeArea;
|
|
26
|
+
private placementFor;
|
|
27
|
+
private moveTo;
|
|
28
|
+
/** The box around the pad's element(s) in px from the container's top left, as diagram-js reads it. */
|
|
29
|
+
private targetBox;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=TtContextPadPlacement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtContextPadPlacement.d.ts","sourceRoot":"","sources":["../../src/context-pad/TtContextPadPlacement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,6CAA6C,CAAC;AAEzE,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,sBAAsB,CAAC;AASrE,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CACjC;AA8BD,MAAM,CAAC,OAAO,OAAO,qBAAqB;IAStC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAX5B,MAAM,CAAC,OAAO,WAA8D;IAE5E,OAAO,CAAC,OAAO,CAAsB;IACrC,8EAA8E;IAC9E,OAAO,CAAC,iBAAiB,CAAuB;IAChD,OAAO,CAAC,cAAc,CAA+B;gBAGlC,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACvD,QAAQ,EAAE,QAAQ,EACD,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS;IAavC,OAAO,CAAC,MAAM;IAWd,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,YAAY;IAsCpB,OAAO,CAAC,MAAM;IASd,uGAAuG;IACvG,OAAO,CAAC,SAAS;CAwBlB"}
|
|
@@ -24,6 +24,7 @@ export default class TtContextPadProvider implements ContextPadProvider {
|
|
|
24
24
|
getContextPadEntries(element: Element): ContextPadEntries;
|
|
25
25
|
getMultiElementContextPadEntries(elements: Element[]): ContextPadEntries;
|
|
26
26
|
private onEntryKeyDown;
|
|
27
|
+
private focusSameEntryOrCanvas;
|
|
27
28
|
private editEntry;
|
|
28
29
|
private deleteEntry;
|
|
29
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TtContextPadProvider.d.ts","sourceRoot":"","sources":["../../src/context-pad/TtContextPadProvider.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TtContextPadProvider.d.ts","sourceRoot":"","sources":["../../src/context-pad/TtContextPadProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,UAAU,MAAM,gDAAgD,CAAC;AAC7E,OAAO,KAAK,QAAQ,MAAM,2CAA2C,CAAC;AACtE,OAAO,KAAK,OAAO,MAAM,yCAAyC,CAAC;AACnE,OAAO,KAAK,SAAS,MAAM,6CAA6C,CAAC;AACzE,OAAO,KAAK,EACV,iBAAiB,EAEjB,OAAO,IAAI,kBAAkB,EAC9B,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAS1D,OAAO,KAAK,cAAc,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AAyBxD,MAAM,CAAC,OAAO,OAAO,oBAAqB,YAAW,kBAAkB;IAgBnE,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IArBzB,MAAM,CAAC,OAAO,WAUZ;IAEF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;gBAG1B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,cAAc,EAC5B,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EAC/B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE;QAAE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,CAAC,GAAG,IAAI,CAAA;KAAE;IAmBhE,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB;IAwCzD,gCAAgC,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,iBAAiB;IAKxE,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,WAAW;CAYpB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleDeclaration } from 'didi';
|
|
2
|
-
/** Per-element context actions (rename, annotate, attach, delete). */
|
|
2
|
+
/** Per-element context actions (rename, annotate, attach, delete), kept inside the free area. */
|
|
3
3
|
export declare const ttContextPadModule: ModuleDeclaration;
|
|
4
4
|
export { default as TtContextPadProvider } from './TtContextPadProvider.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context-pad/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context-pad/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAO9C,iGAAiG;AACjG,eAAO,MAAM,kBAAkB,EAAE,iBAKhC,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TeamTopologiesRenderer.d.ts","sourceRoot":"","sources":["../../src/draw/TeamTopologiesRenderer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TeamTopologiesRenderer.d.ts","sourceRoot":"","sources":["../../src/draw/TeamTopologiesRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAE5D,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAgCzF,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,YAAY;IAC9D,MAAM,CAAC,OAAO,WAAgB;gBAElB,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;IAa3E,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAKtC,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM;IAM9D,OAAO,CAAC,QAAQ;IAkBhB,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,eAAe;IAyCvB,OAAO,CAAC,QAAQ;IAmChB,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,WAAW;CA0BpB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TtInteraction } from '../model/di-types.js';
|
|
2
|
+
export type Rgb = readonly [number, number, number];
|
|
3
|
+
export declare function parseHexColour(colour: unknown): Rgb | undefined;
|
|
4
|
+
export declare function contrastRatio(first: Rgb, second: Rgb): number;
|
|
5
|
+
/**
|
|
6
|
+
* `fill` at `opacity` over white, as one opaque colour, or `undefined` for a value that is not a hex
|
|
7
|
+
* colour. Guide §10.6 draws notation fills that use opacity premixed like this: translucent over a
|
|
8
|
+
* dark canvas, they would turn into a tinted tone.
|
|
9
|
+
*/
|
|
10
|
+
export declare function premixOverWhite(fill: string, opacity: number): string | undefined;
|
|
11
|
+
export interface InteractionPaint {
|
|
12
|
+
fill: string;
|
|
13
|
+
fillOpacity: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* How an interaction's fill is drawn: its mode's premixed fill, or its own fill premixed at the
|
|
17
|
+
* mode's opacity, both opaque. An own fill that is not hex cannot be mixed, so it keeps the
|
|
18
|
+
* template's opacity instead of turning solid; the schema rejects such a fill, but a host can import
|
|
19
|
+
* a document without validating it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function interactionPaint(interaction: Pick<TtInteraction, "mode" | "fill">): InteractionPaint;
|
|
22
|
+
//# sourceMappingURL=colour.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colour.d.ts","sourceRoot":"","sources":["../../src/draw/colour.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,GAAG,GAAG,SAAS,CAQ/D;AAoBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,CAK7D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKjF;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,GAChD,gBAAgB,CASlB"}
|