@meltemi/diagrams-editor 1.10.0 → 1.10.18
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/dist/arrange.d.ts +54 -1
- package/dist/arrange.d.ts.map +1 -1
- package/dist/arrange.js +209 -7
- package/dist/arrange.js.map +1 -1
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.d.ts.map +1 -1
- package/dist/canvas/index.js +1 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/keyboard.d.ts +21 -2
- package/dist/canvas/keyboard.d.ts.map +1 -1
- package/dist/canvas/keyboard.js +19 -0
- package/dist/canvas/keyboard.js.map +1 -1
- package/dist/canvas/palette.d.ts +41 -1
- package/dist/canvas/palette.d.ts.map +1 -1
- package/dist/canvas/palette.js +42 -0
- package/dist/canvas/palette.js.map +1 -1
- package/dist/canvas/pens.d.ts +10 -0
- package/dist/canvas/pens.d.ts.map +1 -0
- package/dist/canvas/pens.js +29 -0
- package/dist/canvas/pens.js.map +1 -0
- package/dist/canvas/protocol.d.ts +359 -16
- package/dist/canvas/protocol.d.ts.map +1 -1
- package/dist/canvas/protocol.js +83 -3
- package/dist/canvas/protocol.js.map +1 -1
- package/dist/catalog.d.ts +5 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/clipboard.js +39 -2
- package/dist/clipboard.js.map +1 -1
- package/dist/effects.d.ts.map +1 -1
- package/dist/effects.js +7 -4
- package/dist/effects.js.map +1 -1
- package/dist/exports.d.ts +6 -0
- package/dist/exports.d.ts.map +1 -1
- package/dist/exports.js +11 -9
- package/dist/exports.js.map +1 -1
- package/dist/fonts.d.ts +63 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +175 -0
- package/dist/fonts.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inspector.d.ts.map +1 -1
- package/dist/inspector.js +339 -67
- package/dist/inspector.js.map +1 -1
- package/dist/layouts.d.ts +3 -2
- package/dist/layouts.d.ts.map +1 -1
- package/dist/layouts.js +4 -2
- package/dist/layouts.js.map +1 -1
- package/dist/messages/en.d.ts +51 -0
- package/dist/messages/en.d.ts.map +1 -1
- package/dist/messages/en.js +51 -0
- package/dist/messages/en.js.map +1 -1
- package/dist/messages/es.d.ts.map +1 -1
- package/dist/messages/es.js +33 -0
- package/dist/messages/es.js.map +1 -1
- package/dist/messages/index.d.ts +33 -0
- package/dist/messages/index.d.ts.map +1 -1
- package/dist/messages/keys.d.ts.map +1 -1
- package/dist/messages/keys.js +24 -0
- package/dist/messages/keys.js.map +1 -1
- package/dist/messages/services.d.ts +124 -1
- package/dist/messages/services.d.ts.map +1 -1
- package/dist/messages/services.js +142 -16
- package/dist/messages/services.js.map +1 -1
- package/dist/render.d.ts +5 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +4 -2
- package/dist/render.js.map +1 -1
- package/dist/sequence.d.ts +37 -8
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +409 -38
- package/dist/sequence.js.map +1 -1
- package/dist/services/actions.d.ts.map +1 -1
- package/dist/services/actions.js +54 -0
- package/dist/services/actions.js.map +1 -1
- package/dist/services/completion.d.ts.map +1 -1
- package/dist/services/completion.js +100 -10
- package/dist/services/completion.js.map +1 -1
- package/dist/services/docs.d.ts +5 -0
- package/dist/services/docs.d.ts.map +1 -1
- package/dist/services/docs.js +7 -0
- package/dist/services/docs.js.map +1 -1
- package/dist/services/hover.d.ts +5 -0
- package/dist/services/hover.d.ts.map +1 -1
- package/dist/services/hover.js +152 -20
- package/dist/services/hover.js.map +1 -1
- package/dist/services/navigation.d.ts.map +1 -1
- package/dist/services/navigation.js +6 -3
- package/dist/services/navigation.js.map +1 -1
- package/dist/services/stories.d.ts.map +1 -1
- package/dist/services/stories.js +31 -3
- package/dist/services/stories.js.map +1 -1
- package/dist/session.d.ts +65 -3
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +707 -50
- package/dist/session.js.map +1 -1
- package/dist/syntax.d.ts.map +1 -1
- package/dist/syntax.js +3 -0
- package/dist/syntax.js.map +1 -1
- package/dist/text-places.d.ts +15 -3
- package/dist/text-places.d.ts.map +1 -1
- package/dist/text-places.js +136 -15
- package/dist/text-places.js.map +1 -1
- package/dist/themes.d.ts +0 -2
- package/dist/themes.d.ts.map +1 -1
- package/dist/themes.js +16 -12
- package/dist/themes.js.map +1 -1
- package/package.json +21 -16
|
@@ -2,7 +2,7 @@ import type { StoryTimeline, StoryViewData } from "@meltemi/diagrams-motion";
|
|
|
2
2
|
import type { AlignEdge } from "./arrange.js";
|
|
3
3
|
import type { Box, Point } from "./geometry.js";
|
|
4
4
|
import type { Side } from "./routes.js";
|
|
5
|
-
export type ElementKind = "node" | "decision" | "data" | "group" | "note" | "tag" | "box" | "text" | "icon" | "image" | "line" | "participant" | "actor" | "boundary" | "control" | "entity" | "database" | "collections" | "queue" | "person" | "system" | "container" | "datastore" | "component";
|
|
5
|
+
export type ElementKind = "node" | "decision" | "data" | "group" | "note" | "tag" | "box" | "text" | "icon" | "image" | "line" | "pen" | "sticky" | "participant" | "actor" | "boundary" | "control" | "entity" | "database" | "collections" | "queue" | "person" | "system" | "container" | "datastore" | "component";
|
|
6
6
|
/** The profile of a diagram, which sets the palette, the keys and the drags. */
|
|
7
7
|
export type CanvasProfile = "flow" | "free" | "sequence" | "c4";
|
|
8
8
|
export type FragmentOperator = "alt" | "opt" | "loop" | "par" | "break" | "critical" | "region";
|
|
@@ -52,6 +52,12 @@ export interface TextPlace {
|
|
|
52
52
|
/** The CSS font stack. */
|
|
53
53
|
readonly font: string;
|
|
54
54
|
readonly size: number;
|
|
55
|
+
/**
|
|
56
|
+
* A sticky note's: the size its words are drawn at before they shrink to fit the card (its
|
|
57
|
+
* `fontSize`, or 1.2 times the theme's label size), which `size` is when they fit. The editor
|
|
58
|
+
* types from it, so a long text shortened is typed at the size the card will draw it.
|
|
59
|
+
*/
|
|
60
|
+
readonly fullSize?: number;
|
|
55
61
|
readonly weight: number;
|
|
56
62
|
readonly color: string;
|
|
57
63
|
/** The distance between two lines. */
|
|
@@ -63,6 +69,32 @@ export interface TextPlace {
|
|
|
63
69
|
* is typed, as it does not cross the drawn label. Absent for the others: they have none.
|
|
64
70
|
*/
|
|
65
71
|
readonly background?: string;
|
|
72
|
+
/**
|
|
73
|
+
* How the drawing wraps the text in `area`, for an editor that wraps as it does; absent when the
|
|
74
|
+
* drawing does not wrap it. `shrink`: a sticky's text, wrapped at the area's width and shrunk to
|
|
75
|
+
* fit the card (from `fullSize`). `grow`: the label of a sequence message whose participants are
|
|
76
|
+
* pulled closer than their natural distance (`MessageText.wraps`), wrapped at the area's width
|
|
77
|
+
* (the room between its lifelines) at `size`, never shrunk; the block keeps its top (`area.y`,
|
|
78
|
+
* the top of the first line) and grows down by `line` with each line, as the row grows. A
|
|
79
|
+
* message at its natural distance (its label pushes the pair apart) and a self-call have none.
|
|
80
|
+
*/
|
|
81
|
+
readonly wrap?: "shrink" | "grow";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A tag of a sequence participant or message (`tag "Text"` in its block), as drawn: a pill of the
|
|
85
|
+
* owner, which a press selects and a drag drags with it.
|
|
86
|
+
*/
|
|
87
|
+
export interface TagInfo {
|
|
88
|
+
/** The text written in the tag. */
|
|
89
|
+
readonly text: string;
|
|
90
|
+
/** The pill, in diagram coordinates. */
|
|
91
|
+
readonly box: Box;
|
|
92
|
+
/**
|
|
93
|
+
* Where the pill's text is drawn, for the inline editor of the tag: its mono font, size, weight
|
|
94
|
+
* and colour, centred on the pill, the pill's fill as its background. Absent when the drawing
|
|
95
|
+
* holds no such pill.
|
|
96
|
+
*/
|
|
97
|
+
readonly place?: TextPlace;
|
|
66
98
|
}
|
|
67
99
|
/** What the canvas knows about an element. */
|
|
68
100
|
export interface ElementInfo {
|
|
@@ -130,6 +162,35 @@ export interface ElementInfo {
|
|
|
130
162
|
readonly drawn: readonly Point[];
|
|
131
163
|
readonly via: readonly Point[];
|
|
132
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* A `pen` stroke: its points where they are drawn, in diagram coordinates (its written points
|
|
167
|
+
* moved by its group's interior origin), the box of the points grown by half its width (its
|
|
168
|
+
* `box` too, which its frame and its resize handles use), and its drawn width. It has no
|
|
169
|
+
* rotation, connection, point or label handles; moving or scaling it writes every point
|
|
170
|
+
* (`setPenPoints`).
|
|
171
|
+
*/
|
|
172
|
+
readonly pen?: {
|
|
173
|
+
readonly points: readonly Point[];
|
|
174
|
+
readonly bounds: Box;
|
|
175
|
+
readonly width: number;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* A group of a free diagram that arranges its children (`layout column` or `layout row`): its
|
|
179
|
+
* layout, its spacing and its alignment as the layout applies them (defaults filled in), and the
|
|
180
|
+
* children it places in source order, its lines and pens left out. A `move` or a `create` with
|
|
181
|
+
* an `index` counts among these children.
|
|
182
|
+
*/
|
|
183
|
+
readonly list?: {
|
|
184
|
+
readonly layout: "column" | "row";
|
|
185
|
+
readonly spacing: number;
|
|
186
|
+
readonly align: "start" | "center" | "end" | "stretch";
|
|
187
|
+
readonly children: readonly string[];
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Sequence diagrams: the tags of a participant, in source order, each with its badge as drawn
|
|
191
|
+
* over the head; absent when it has none.
|
|
192
|
+
*/
|
|
193
|
+
readonly tags?: readonly TagInfo[];
|
|
133
194
|
}
|
|
134
195
|
/** What the canvas knows about a relation. */
|
|
135
196
|
export interface RelationInfo {
|
|
@@ -152,6 +213,20 @@ export interface RelationInfo {
|
|
|
152
213
|
readonly layer: string | null;
|
|
153
214
|
/** Where its label is drawn, or goes: the middle of its line when it has none. */
|
|
154
215
|
readonly text?: TextPlace;
|
|
216
|
+
/** Sequence diagrams: the key of the call a `return` answers; absent on other messages. */
|
|
217
|
+
readonly returns?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Sequence diagrams: the tags of a message, in source order, each with its pill as drawn on the
|
|
220
|
+
* arrow next to the source end; absent when it has none.
|
|
221
|
+
*/
|
|
222
|
+
readonly tags?: readonly TagInfo[];
|
|
223
|
+
/**
|
|
224
|
+
* Sequence diagrams: whether the message's receiver is activated after it: `written` when the
|
|
225
|
+
* next event of its block is `activate <receiver>` (Alt+A and **Activate** remove that pair),
|
|
226
|
+
* `block` when the message is a call whose block activates the receiver (they refuse); absent
|
|
227
|
+
* otherwise.
|
|
228
|
+
*/
|
|
229
|
+
readonly activation?: "written" | "block";
|
|
155
230
|
}
|
|
156
231
|
/** What the canvas knows about an event of a sequence diagram. */
|
|
157
232
|
export interface EventInfo {
|
|
@@ -161,9 +236,18 @@ export interface EventInfo {
|
|
|
161
236
|
/** The row of the event, in diagram coordinates. */
|
|
162
237
|
readonly y: number;
|
|
163
238
|
readonly height: number;
|
|
164
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* The frame of a note or a fragment, or the bar an `activate` opens (`activate#1`), which a
|
|
241
|
+
* press on it selects and its outline is; in diagram coordinates. Null for the others.
|
|
242
|
+
*/
|
|
165
243
|
readonly box: Box | null;
|
|
166
|
-
/**
|
|
244
|
+
/**
|
|
245
|
+
* The other end of an activation: an `activate`'s `deactivate`, a `deactivate`'s `activate`.
|
|
246
|
+
* Null for an `activate` open to the end, a `deactivate` that closes nothing and every other
|
|
247
|
+
* event.
|
|
248
|
+
*/
|
|
249
|
+
readonly pair: string | null;
|
|
250
|
+
/** The fragment or the call around the event, or null. */
|
|
167
251
|
readonly parent: string | null;
|
|
168
252
|
/** The participant of an activation or a lifecycle event. */
|
|
169
253
|
readonly participant: string | null;
|
|
@@ -237,6 +321,12 @@ export interface CanvasRender {
|
|
|
237
321
|
readonly guide: string;
|
|
238
322
|
readonly accent: string;
|
|
239
323
|
};
|
|
324
|
+
/**
|
|
325
|
+
* The colour tokens of the diagram's theme with the colours they resolve to, in the theme's
|
|
326
|
+
* order (the strip's swatches): the pen menu's colour row, and the colour a stroke in progress
|
|
327
|
+
* is drawn in when its colour is a token (`@ink`, `@highlight`).
|
|
328
|
+
*/
|
|
329
|
+
readonly swatches?: readonly ColorSwatch[];
|
|
240
330
|
}
|
|
241
331
|
export interface CanvasSettings {
|
|
242
332
|
readonly grid: number;
|
|
@@ -252,7 +342,13 @@ export interface CanvasSettings {
|
|
|
252
342
|
*/
|
|
253
343
|
readonly readOnly?: boolean;
|
|
254
344
|
}
|
|
255
|
-
|
|
345
|
+
/**
|
|
346
|
+
* The control of a field. `boolean` is a checkbox whose value is `on` when checked and `off` when
|
|
347
|
+
* not; checking or clearing it sends `setField` with `on` or `off`. `font` is a font stack chosen
|
|
348
|
+
* in the canvas's font picker (`listFonts`): its value is the written stack, its placeholder the
|
|
349
|
+
* family that applies, and its `options` the families the picker lists.
|
|
350
|
+
*/
|
|
351
|
+
export type FieldType = "id" | "text" | "multiline" | "number" | "enum" | "color" | "icon" | "classes" | "ports" | "boolean" | "font";
|
|
256
352
|
/** One editable property in the inspector. */
|
|
257
353
|
export interface InspectorField {
|
|
258
354
|
readonly name: string;
|
|
@@ -306,6 +402,11 @@ export interface InspectorField {
|
|
|
306
402
|
readonly max: number;
|
|
307
403
|
readonly step: number;
|
|
308
404
|
};
|
|
405
|
+
/**
|
|
406
|
+
* Number fields with values offered in a list beside the field, which its − and + buttons step
|
|
407
|
+
* along: the text size's common sizes. Any number in the property's bounds may still be typed.
|
|
408
|
+
*/
|
|
409
|
+
readonly list?: readonly number[];
|
|
309
410
|
/**
|
|
310
411
|
* Icon fields (`style.icon`, the `source` of an icon object): the icon they show, the written
|
|
311
412
|
* one or else the one that applies (`placeholder`), with its readable name and a 24 px SVG
|
|
@@ -315,19 +416,36 @@ export interface InspectorField {
|
|
|
315
416
|
readonly thumbnail?: IconChoiceInfo;
|
|
316
417
|
/**
|
|
317
418
|
* A button the canvas draws beside the field, which sends `action`: Convert to container
|
|
318
|
-
* beside Inside. Canvases that only show leave it out.
|
|
419
|
+
* beside Inside, **Remove** beside a tag (`removeTag`). Canvases that only show leave it out.
|
|
319
420
|
*/
|
|
320
421
|
readonly button?: {
|
|
321
422
|
readonly label: string;
|
|
322
423
|
readonly action: CanvasAction;
|
|
323
424
|
};
|
|
425
|
+
/**
|
|
426
|
+
* A sentence the canvas shows under the field, such as why it is read-only: "The block of `pay`
|
|
427
|
+
* activates `api`." under a call's **Activates the receiver**.
|
|
428
|
+
*/
|
|
429
|
+
readonly note?: string;
|
|
324
430
|
}
|
|
325
431
|
/**
|
|
326
432
|
* The picture family of a field: see `InspectorField.glyphs`. `iconPosition` pictures the five
|
|
327
433
|
* places of an icon in its box (`ICON_POSITIONS`), `labelPosition` the four edges a label takes
|
|
328
434
|
* around a centred icon (`LABEL_POSITIONS`).
|
|
329
435
|
*/
|
|
330
|
-
export type FieldGlyphs = "line" | "route" | "corners" | "arrowStart" | "arrowEnd" | "shape" | "iconPosition" | "labelPosition" | "sketch" | "textAlign" | "verticalAlign";
|
|
436
|
+
export type FieldGlyphs = "line" | "route" | "corners" | "arrowStart" | "arrowEnd" | "shape" | "iconPosition" | "labelPosition" | "sketch" | "textAlign" | "verticalAlign" | "fontWeight";
|
|
437
|
+
/**
|
|
438
|
+
* A family the font picker lists: its name and group, the weights it has files for, and the
|
|
439
|
+
* `@font-face` rules that draw its row ("<Family> Aa") in its own face, empty while its files are
|
|
440
|
+
* on their way or when it cannot be shown. A restricted project font measures text only.
|
|
441
|
+
*/
|
|
442
|
+
export interface FontOption {
|
|
443
|
+
readonly family: string;
|
|
444
|
+
readonly group: "sans" | "serif" | "mono" | "hand" | "project";
|
|
445
|
+
readonly weights: readonly number[];
|
|
446
|
+
readonly faces: readonly string[];
|
|
447
|
+
readonly restricted?: boolean;
|
|
448
|
+
}
|
|
331
449
|
/** The panel that edits a theme block: its tokens by group, written or inherited. */
|
|
332
450
|
export interface ThemePanelModel {
|
|
333
451
|
/** The theme's id in its file. */
|
|
@@ -368,8 +486,11 @@ export interface StoryPlaybackInfo {
|
|
|
368
486
|
/** `@font-face` rules for the text of the views. */
|
|
369
487
|
readonly fontFaces: readonly string[];
|
|
370
488
|
}
|
|
371
|
-
/**
|
|
372
|
-
|
|
489
|
+
/**
|
|
490
|
+
* Actions a scene can run, which **Add to scene** inserts. `draw` replays pens, free lines and
|
|
491
|
+
* named relations (`story-language`); the edit refuses it on anything else.
|
|
492
|
+
*/
|
|
493
|
+
export type SceneActionKind = "reveal" | "hide" | "highlight" | "focus" | "camera" | "trace" | "draw" | "hold";
|
|
373
494
|
/** Statements that would be removed with an element, listed for confirmation. */
|
|
374
495
|
export interface DependentInfo {
|
|
375
496
|
readonly kind: string;
|
|
@@ -421,6 +542,12 @@ export interface PresencePerson {
|
|
|
421
542
|
* at most 64 entries, `x` and `y` in diagram units and `t` the milliseconds since the batch's
|
|
422
543
|
* first point, 0 to 1000. The trail is drawn in `colour`, point by point at its own pace, and
|
|
423
544
|
* fades as the person's own does. A batch that does not fit those bounds is not drawn.
|
|
545
|
+
*
|
|
546
|
+
* A batch with `pen` holds the points of a stroke the person is drawing with the pen or the
|
|
547
|
+
* highlighter (`diagram-canvas` "Strokes of others"): drawn in the pen's width, colour and
|
|
548
|
+
* opacity, the batches of one `stroke` number growing one stroke that does not fade, until the
|
|
549
|
+
* next `render` after its last batch or ten seconds, or at once on its `cancel` batch. A batch
|
|
550
|
+
* whose `pen` does not fit `isPresencePen` is not drawn.
|
|
424
551
|
*/
|
|
425
552
|
readonly laser?: {
|
|
426
553
|
readonly batch: number;
|
|
@@ -429,8 +556,43 @@ export interface PresencePerson {
|
|
|
429
556
|
readonly y: number;
|
|
430
557
|
readonly t: number;
|
|
431
558
|
}[];
|
|
559
|
+
readonly pen?: PresencePen;
|
|
432
560
|
};
|
|
433
561
|
}
|
|
562
|
+
/**
|
|
563
|
+
* How a stroke being drawn looks, as a laser batch carries it to the others, and which of the
|
|
564
|
+
* person's strokes it is: `width` a whole number of pixels from 1 to 64, `colour` a CSS colour of
|
|
565
|
+
* at most 32 characters (the resolved colour, not a token), `opacity` from 0 to 1, `stroke` an
|
|
566
|
+
* integer from 0 to 2,147,483,647 that the person's canvas increases with each stroke (the batches
|
|
567
|
+
* of one stroke carry the same number, and a stroke is never joined to another), and `cancel`,
|
|
568
|
+
* only ever `true`, on the batch that ends a stroke cancelled with Escape (its points may be none):
|
|
569
|
+
* the others drop that stroke at once.
|
|
570
|
+
*/
|
|
571
|
+
export interface PresencePen {
|
|
572
|
+
readonly width: number;
|
|
573
|
+
readonly colour: string;
|
|
574
|
+
readonly opacity: number;
|
|
575
|
+
readonly stroke: number;
|
|
576
|
+
readonly cancel?: true;
|
|
577
|
+
}
|
|
578
|
+
/** The bounds of `PresencePen`, which the canvas, the page and the room apply alike. */
|
|
579
|
+
export declare const PRESENCE_PEN_LIMITS: {
|
|
580
|
+
readonly width: {
|
|
581
|
+
readonly min: 1;
|
|
582
|
+
readonly max: 64;
|
|
583
|
+
};
|
|
584
|
+
readonly colour: 32;
|
|
585
|
+
readonly opacity: {
|
|
586
|
+
readonly min: 0;
|
|
587
|
+
readonly max: 1;
|
|
588
|
+
};
|
|
589
|
+
readonly stroke: {
|
|
590
|
+
readonly min: 0;
|
|
591
|
+
readonly max: 2147483647;
|
|
592
|
+
};
|
|
593
|
+
};
|
|
594
|
+
/** Whether a value is a `PresencePen` within its bounds (`PRESENCE_PEN_LIMITS`). */
|
|
595
|
+
export declare function isPresencePen(v: unknown): v is PresencePen;
|
|
434
596
|
/** An element of a library with its thumbnail, null while its pack is still loading. */
|
|
435
597
|
export interface LibraryItemInfo {
|
|
436
598
|
readonly library: string;
|
|
@@ -541,6 +703,12 @@ export type HostMessage = ({
|
|
|
541
703
|
readonly offset?: Point;
|
|
542
704
|
/** For a rotation, the turned element's box in the drawing, in diagram coordinates. */
|
|
543
705
|
readonly box?: Box;
|
|
706
|
+
/**
|
|
707
|
+
* Without a drawing, why the drop would be refused, when the session knows it: the order
|
|
708
|
+
* rule a `moveActivation` breaks ("`b` is not active here."). The canvas says it while the
|
|
709
|
+
* gesture goes on, and its drop writes nothing.
|
|
710
|
+
*/
|
|
711
|
+
readonly reason?: string;
|
|
544
712
|
} | {
|
|
545
713
|
readonly type: "rejected";
|
|
546
714
|
readonly code: string;
|
|
@@ -551,9 +719,16 @@ export type HostMessage = ({
|
|
|
551
719
|
} | {
|
|
552
720
|
readonly type: "highlight";
|
|
553
721
|
readonly ids: readonly string[];
|
|
554
|
-
}
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* The selection after an edit. One id alone opens the inline editor of what was just created;
|
|
725
|
+
* with `tag`, the editor opens on the pill at that index of the selected participant or
|
|
726
|
+
* message (`TagInfo.place`), the tag that `addTag` just wrote, instead of its label.
|
|
727
|
+
*/
|
|
728
|
+
| {
|
|
555
729
|
readonly type: "select";
|
|
556
730
|
readonly ids: readonly string[];
|
|
731
|
+
readonly tag?: number;
|
|
557
732
|
}
|
|
558
733
|
/**
|
|
559
734
|
* The other people of a shared project and what each has selected (`live-collaboration`). Each
|
|
@@ -587,6 +762,17 @@ export type HostMessage = ({
|
|
|
587
762
|
readonly type: "themePanel";
|
|
588
763
|
readonly panel: ThemePanelModel | null;
|
|
589
764
|
}
|
|
765
|
+
/**
|
|
766
|
+
* The answer to `listFonts`, with its `token`: the families the font picker lists, bundled ones
|
|
767
|
+
* by group, then the project's. A family whose faces are empty is drawn in the interface's font
|
|
768
|
+
* until a later answer brings them: the canvas asks again when a render arrives while the
|
|
769
|
+
* picker is open.
|
|
770
|
+
*/
|
|
771
|
+
| {
|
|
772
|
+
readonly type: "fonts";
|
|
773
|
+
readonly token: number;
|
|
774
|
+
readonly families: readonly FontOption[];
|
|
775
|
+
}
|
|
590
776
|
/** The element libraries of the document, for the libraries panel. */
|
|
591
777
|
| {
|
|
592
778
|
readonly type: "libraries";
|
|
@@ -651,24 +837,75 @@ export type HostMessage = ({
|
|
|
651
837
|
};
|
|
652
838
|
/** The kinds of diagram the canvas creates: C4 views need a model, written in text. */
|
|
653
839
|
export type CreatableDiagram = "flow" | "free" | "sequence";
|
|
654
|
-
/**
|
|
840
|
+
/**
|
|
841
|
+
* Moves elements by a delta in diagram coordinates, or into a list group at a position. A child
|
|
842
|
+
* of a list stays where its list puts it: a move by a delta that leaves it in its list (a nudge,
|
|
843
|
+
* an Alt-drag) is refused with a status that says how to move it.
|
|
844
|
+
*/
|
|
655
845
|
export interface MoveAction {
|
|
656
846
|
readonly kind: "move";
|
|
657
847
|
readonly ids: readonly string[];
|
|
658
|
-
|
|
848
|
+
/**
|
|
849
|
+
* How far the elements move, in diagram coordinates. Absent only with `index`, whose drop
|
|
850
|
+
* writes no position; a pen or a line moved with it keeps its points.
|
|
851
|
+
*/
|
|
852
|
+
readonly delta?: Point;
|
|
659
853
|
/**
|
|
660
854
|
* The group the moved elements land in, or null for the diagram's top level: each one whose
|
|
661
855
|
* parent differs is declared in it, placed where it is dropped (flow and free diagrams).
|
|
662
|
-
* Absent, every element keeps its parent, as nudges and Alt-drags do.
|
|
856
|
+
* Absent, every element keeps its parent, as nudges and Alt-drags do. A list group places them
|
|
857
|
+
* itself: they are declared at the end of it, or at `index`, and lose their `place`.
|
|
663
858
|
*/
|
|
664
859
|
readonly parent?: string | null;
|
|
860
|
+
/**
|
|
861
|
+
* With `parent` a list group: where the elements go among its children (`ElementInfo.list`)
|
|
862
|
+
* once the moved ones are taken out, before the child at that index, after the last when it is
|
|
863
|
+
* the count. Several elements go there one after another in the order of `ids`; moving a child
|
|
864
|
+
* within its own list reorders it. A whole number from 0.
|
|
865
|
+
*/
|
|
866
|
+
readonly index?: number;
|
|
665
867
|
}
|
|
666
|
-
/**
|
|
868
|
+
/**
|
|
869
|
+
* Gives an element a new box in diagram coordinates. A child of a list writes its size alone; a
|
|
870
|
+
* pen stroke's points are scaled from its bounds to the box (`scalePenPoints`), its width kept,
|
|
871
|
+
* so its resize handles preview and drop as a box's do.
|
|
872
|
+
*/
|
|
667
873
|
export interface ResizeAction {
|
|
668
874
|
readonly kind: "resize";
|
|
669
875
|
readonly id: string;
|
|
670
876
|
readonly box: Box;
|
|
671
877
|
}
|
|
878
|
+
/**
|
|
879
|
+
* Sequence diagrams: an end of a written activation bar dragged to the boundary below an event
|
|
880
|
+
* row (a bar handle's drop). `id` is the bar's `activate` (its `deactivate` is taken as its
|
|
881
|
+
* `activate`); `row` is the key of the event whose row the handle snapped below. The session writes
|
|
882
|
+
* it as `moveEvent` with a destination: `start` puts the `activate` right after `row`, or first in
|
|
883
|
+
* the block of `row` when it is a call with a block, so the bar starts at that call's arrow; `end`
|
|
884
|
+
* puts the `deactivate` right after `row`, and on a bar open to the end writes `deactivate
|
|
885
|
+
* <participant>` there. A move the order rules forbid is refused with the rule's reason.
|
|
886
|
+
*/
|
|
887
|
+
export interface MoveActivationAction {
|
|
888
|
+
readonly kind: "moveActivation";
|
|
889
|
+
readonly id: string;
|
|
890
|
+
readonly end: "start" | "end";
|
|
891
|
+
readonly row: string;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* The styles a new pen stroke writes in its `style` statement; what is absent keeps the default
|
|
895
|
+
* (the theme's `ink`, 3 wide, opaque, no heads).
|
|
896
|
+
*/
|
|
897
|
+
export interface PenStyle {
|
|
898
|
+
/** A colour token such as `@highlight`, or a colour such as `#e03131`. */
|
|
899
|
+
readonly stroke?: string;
|
|
900
|
+
/** 1 to 64. */
|
|
901
|
+
readonly width?: number;
|
|
902
|
+
/** 0 to 1. */
|
|
903
|
+
readonly opacity?: number;
|
|
904
|
+
/** A head at the last point, by its name in the language (`triangle`). */
|
|
905
|
+
readonly arrowhead?: string;
|
|
906
|
+
/** A head at the first point. */
|
|
907
|
+
readonly arrowtail?: string;
|
|
908
|
+
}
|
|
672
909
|
/**
|
|
673
910
|
* A change requested by the canvas; each becomes one edit plan, but `preview`, which asks for the
|
|
674
911
|
* drawing of a move or a resize without writing it.
|
|
@@ -700,6 +937,31 @@ export type CanvasAction = MoveAction | ResizeAction | {
|
|
|
700
937
|
readonly from: Point;
|
|
701
938
|
readonly to: Point;
|
|
702
939
|
readonly via: readonly Point[];
|
|
940
|
+
} | {
|
|
941
|
+
/**
|
|
942
|
+
* Draws a pen stroke through `points`, in diagram coordinates as the pointer gave them
|
|
943
|
+
* (simplified, not snapped). `parent` is the innermost group under the first point, where
|
|
944
|
+
* the session starts looking for the stroke's group: from it outwards, the first group that
|
|
945
|
+
* is not a list and whose drawn box holds the whole stroke (its points grown by half its
|
|
946
|
+
* width), else the top level, so that a stroke never grows a list nor moves its cards. The
|
|
947
|
+
* points are written in that group's interior, and a group without `size` gets the size it
|
|
948
|
+
* is drawn with, so that it stays as drawn. `style` holds only what differs from a stroke's
|
|
949
|
+
* defaults (`penStyleFor`). The new pen is not selected and no editor opens, so the next
|
|
950
|
+
* stroke starts at once.
|
|
951
|
+
*/
|
|
952
|
+
readonly kind: "createPen";
|
|
953
|
+
readonly points: readonly Point[];
|
|
954
|
+
readonly parent?: string;
|
|
955
|
+
readonly style?: PenStyle;
|
|
956
|
+
} | {
|
|
957
|
+
/**
|
|
958
|
+
* Moves the points of a pen stroke, in diagram coordinates: a drag of its stroke or a scale.
|
|
959
|
+
* A pen in a list goes out to the nearest group around it that is not a list and holds it,
|
|
960
|
+
* else to the top level, as `createPen` chooses.
|
|
961
|
+
*/
|
|
962
|
+
readonly kind: "setPenPoints";
|
|
963
|
+
readonly element: string;
|
|
964
|
+
readonly points: readonly Point[];
|
|
703
965
|
} | {
|
|
704
966
|
readonly kind: "setEnd";
|
|
705
967
|
readonly relation: string;
|
|
@@ -740,6 +1002,19 @@ export type CanvasAction = MoveAction | ResizeAction | {
|
|
|
740
1002
|
* to its top.
|
|
741
1003
|
*/
|
|
742
1004
|
readonly attachedTo?: string;
|
|
1005
|
+
/**
|
|
1006
|
+
* The fill of a new sticky, written as `style <id> { fill … }` in the same edit: a colour
|
|
1007
|
+
* such as `#f8bbd0`, or a colour token as `@sticky`.
|
|
1008
|
+
*/
|
|
1009
|
+
readonly fill?: string;
|
|
1010
|
+
/** A new group that is a list (the group menu's Column and Row): `{ layout column }`. */
|
|
1011
|
+
readonly layout?: "column" | "row";
|
|
1012
|
+
/**
|
|
1013
|
+
* With `parent` a list group: where the new element goes among its children
|
|
1014
|
+
* (`ElementInfo.list`), before the child at that index, at the end when it is the count;
|
|
1015
|
+
* the list places it, so it gets no `place`.
|
|
1016
|
+
*/
|
|
1017
|
+
readonly index?: number;
|
|
743
1018
|
} | {
|
|
744
1019
|
/**
|
|
745
1020
|
* Writes, changes or removes the `on <element>` clause of a note (the inspector's **Attached
|
|
@@ -884,6 +1159,58 @@ export type CanvasAction = MoveAction | ResizeAction | {
|
|
|
884
1159
|
readonly kind: "toggleActivation";
|
|
885
1160
|
readonly ids: readonly string[];
|
|
886
1161
|
}
|
|
1162
|
+
/**
|
|
1163
|
+
* The text size of every item of `ids` that takes `fontSize`, one step of the common sizes up
|
|
1164
|
+
* (1) or down (-1) from what each draws, in one edit; nothing at the ends of the list.
|
|
1165
|
+
*/
|
|
1166
|
+
| {
|
|
1167
|
+
readonly kind: "stepTextSize";
|
|
1168
|
+
readonly ids: readonly string[];
|
|
1169
|
+
readonly step: 1 | -1;
|
|
1170
|
+
}
|
|
1171
|
+
/** Sequence diagrams: an end of an activation bar to another event row. */
|
|
1172
|
+
| MoveActivationAction
|
|
1173
|
+
/**
|
|
1174
|
+
* Sequence diagrams: `tag "Tag"` (the word in the interface language, "Tag 2" when the owner has
|
|
1175
|
+
* "Tag" already) added last to the selected message, else to the selected participant; the
|
|
1176
|
+
* session selects the owner and opens the editor on the new pill (`select` with `tag`). Refused
|
|
1177
|
+
* with a reason when neither is selected.
|
|
1178
|
+
*/
|
|
1179
|
+
| {
|
|
1180
|
+
readonly kind: "addTag";
|
|
1181
|
+
readonly ids: readonly string[];
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Sequence diagrams: the text of the tag at `index` (from 0) of the selected message, else the
|
|
1185
|
+
* selected participant; an empty text removes the tag (`removeTag`).
|
|
1186
|
+
*/
|
|
1187
|
+
| {
|
|
1188
|
+
readonly kind: "setTag";
|
|
1189
|
+
readonly ids: readonly string[];
|
|
1190
|
+
readonly index: number;
|
|
1191
|
+
readonly text: string;
|
|
1192
|
+
}
|
|
1193
|
+
/** Sequence diagrams: removes the tag at `index` of the selected message, else participant. */
|
|
1194
|
+
| {
|
|
1195
|
+
readonly kind: "removeTag";
|
|
1196
|
+
readonly ids: readonly string[];
|
|
1197
|
+
readonly index: number;
|
|
1198
|
+
}
|
|
1199
|
+
/** Sequence diagrams: the selected events into the block of the call right before them. */
|
|
1200
|
+
| {
|
|
1201
|
+
readonly kind: "nestInCall";
|
|
1202
|
+
readonly ids: readonly string[];
|
|
1203
|
+
}
|
|
1204
|
+
/** Sequence diagrams: the events of the selected call, or of the call around the selection, out. */
|
|
1205
|
+
| {
|
|
1206
|
+
readonly kind: "unnestCall";
|
|
1207
|
+
readonly ids: readonly string[];
|
|
1208
|
+
}
|
|
1209
|
+
/** Sequence diagrams: a `return` at the end of the selected call, or of the call around it. */
|
|
1210
|
+
| {
|
|
1211
|
+
readonly kind: "addReturn";
|
|
1212
|
+
readonly ids: readonly string[];
|
|
1213
|
+
}
|
|
887
1214
|
/** Sequence diagrams: a note, divider or delay after the selection, or at the end. */
|
|
888
1215
|
| {
|
|
889
1216
|
readonly kind: "insertEvent";
|
|
@@ -939,7 +1266,8 @@ export type CanvasAction = MoveAction | ResizeAction | {
|
|
|
939
1266
|
/**
|
|
940
1267
|
* The drawing the move, resize or rotation `action` would give on the drop, while the gesture
|
|
941
1268
|
* goes on. Nothing is written: no plan, no history, no new revision. The session answers with a
|
|
942
|
-
* `preview` host message carrying the same `token` (flow and free diagrams and C4 views
|
|
1269
|
+
* `preview` host message carrying the same `token` (flow and free diagrams and C4 views; on
|
|
1270
|
+
* sequence diagrams, a bar handle's `moveActivation`, with the reason when it is refused).
|
|
943
1271
|
*/
|
|
944
1272
|
| {
|
|
945
1273
|
readonly kind: "preview";
|
|
@@ -953,8 +1281,11 @@ export interface RotationAction {
|
|
|
953
1281
|
readonly field: "style.rotation";
|
|
954
1282
|
readonly value: number | null;
|
|
955
1283
|
}
|
|
956
|
-
/**
|
|
957
|
-
|
|
1284
|
+
/**
|
|
1285
|
+
* The gestures a canvas previews: moves, resizes and rotations, and the end of an activation bar
|
|
1286
|
+
* dragged on a sequence diagram.
|
|
1287
|
+
*/
|
|
1288
|
+
export type PreviewedAction = MoveAction | ResizeAction | RotationAction | MoveActivationAction;
|
|
958
1289
|
export type CanvasMessage = {
|
|
959
1290
|
readonly type: "ready";
|
|
960
1291
|
} | {
|
|
@@ -1021,6 +1352,11 @@ export type CanvasMessage = {
|
|
|
1021
1352
|
readonly query: string;
|
|
1022
1353
|
readonly token: number;
|
|
1023
1354
|
}
|
|
1355
|
+
/** The font picker's families, answered by a `fonts` message with the same `token`. */
|
|
1356
|
+
| {
|
|
1357
|
+
readonly type: "listFonts";
|
|
1358
|
+
readonly token: number;
|
|
1359
|
+
}
|
|
1024
1360
|
/**
|
|
1025
1361
|
* The Add icon dialog's files and prefix, checked as they are typed: answered by `iconsChecked`
|
|
1026
1362
|
* with the same `token`.
|
|
@@ -1089,6 +1425,13 @@ export type CanvasMessage = {
|
|
|
1089
1425
|
readonly t: number;
|
|
1090
1426
|
}[];
|
|
1091
1427
|
readonly diagram?: string;
|
|
1428
|
+
/**
|
|
1429
|
+
* Set while the points are a stroke of the pen or the highlighter, for the others to draw it
|
|
1430
|
+
* as it grows: its width, its resolved colour, its opacity and its number, within
|
|
1431
|
+
* `PRESENCE_PEN_LIMITS`, with `cancel` on the batch (maybe of no points) that ends a stroke
|
|
1432
|
+
* cancelled with Escape. The Pointer's batches carry none.
|
|
1433
|
+
*/
|
|
1434
|
+
readonly pen?: PresencePen;
|
|
1092
1435
|
};
|
|
1093
1436
|
/** How many files the Add icon dialog sends at once, and the longest SVG text it sends. */
|
|
1094
1437
|
export declare const ADD_ICON_LIMITS: {
|