@draftably/editor 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/assets/engine.worker-iJs-dOtM.js +8071 -0
  2. package/dist/element.js +1 -1
  3. package/dist/index.js +12045 -11341
  4. package/dist/types/src/components/scene/EdgeView.d.ts +2 -0
  5. package/dist/types/src/components/scene/Lifelines.d.ts +4 -3
  6. package/dist/types/src/components/session-context.d.ts +6 -2
  7. package/dist/types/src/dsl/compile.d.ts +2 -0
  8. package/dist/types/src/dsl/sequence-layout.d.ts +87 -0
  9. package/dist/types/src/dsl/source-edits.d.ts +2 -0
  10. package/dist/types/src/dsl/syntax.d.ts +8 -2
  11. package/dist/types/src/editor/internal.d.ts +6 -2
  12. package/dist/types/src/engines/explorer-engine.d.ts +63 -0
  13. package/dist/types/src/engines/layout/arrange.d.ts +36 -0
  14. package/dist/types/src/engines/layout/compute.d.ts +7 -0
  15. package/dist/types/src/engines/layout/forces.d.ts +8 -0
  16. package/dist/types/src/engines/layout/grid.d.ts +10 -0
  17. package/dist/types/src/engines/layout/intent.d.ts +14 -0
  18. package/dist/types/src/engines/layout/layered.d.ts +5 -0
  19. package/dist/types/src/engines/layout/objective.d.ts +6 -0
  20. package/dist/types/src/engines/layout/packing.d.ts +7 -0
  21. package/dist/types/src/engines/layout/report.d.ts +7 -0
  22. package/dist/types/src/engines/layout/scene.d.ts +53 -0
  23. package/dist/types/src/engines/layout/seed.d.ts +3 -0
  24. package/dist/types/src/engines/layout/separation.d.ts +17 -0
  25. package/dist/types/src/engines/layout/settings.d.ts +6 -0
  26. package/dist/types/src/engines/layout/topology.d.ts +18 -0
  27. package/dist/types/src/engines/layout/trees.d.ts +8 -0
  28. package/dist/types/src/engines/layout/types.d.ts +133 -0
  29. package/dist/types/src/engines/layout/util.d.ts +19 -0
  30. package/dist/types/src/engines/layout-engine.d.ts +15 -0
  31. package/dist/types/src/engines/routing/compute.d.ts +6 -0
  32. package/dist/types/src/engines/routing/conflicts.d.ts +36 -0
  33. package/dist/types/src/engines/routing/context.d.ts +37 -0
  34. package/dist/types/src/engines/routing/cost.d.ts +13 -0
  35. package/dist/types/src/engines/routing/doglegs.d.ts +16 -0
  36. package/dist/types/src/engines/routing/find.d.ts +6 -0
  37. package/dist/types/src/engines/routing/geometry.d.ts +24 -0
  38. package/dist/types/src/engines/routing/heap.d.ts +20 -0
  39. package/dist/types/src/engines/routing/improve.d.ts +7 -0
  40. package/dist/types/src/engines/routing/nudge.d.ts +7 -0
  41. package/dist/types/src/engines/routing/paths.d.ts +8 -0
  42. package/dist/types/src/engines/routing/planned.d.ts +7 -0
  43. package/dist/types/src/engines/routing/ports.d.ts +10 -0
  44. package/dist/types/src/engines/routing/repair.d.ts +9 -0
  45. package/dist/types/src/engines/routing/score.d.ts +12 -0
  46. package/dist/types/src/engines/routing/search.d.ts +16 -0
  47. package/dist/types/src/engines/routing/settings.d.ts +4 -0
  48. package/dist/types/src/engines/routing/sidepairs.d.ts +20 -0
  49. package/dist/types/src/engines/routing/tidy-ports.d.ts +13 -0
  50. package/dist/types/src/engines/routing/tidy.d.ts +10 -0
  51. package/dist/types/src/engines/routing/tuning.d.ts +9 -0
  52. package/dist/types/src/engines/routing/types.d.ts +157 -0
  53. package/dist/types/src/engines/routing-engine.d.ts +20 -0
  54. package/dist/types/src/engines/sculpt-engine.d.ts +87 -0
  55. package/dist/types/src/lib/engine-tasks.d.ts +4 -4
  56. package/dist/types/src/model/appearance.d.ts +10 -1
  57. package/dist/types/src/model/edits.d.ts +19 -0
  58. package/dist/types/src/model/labels.d.ts +23 -0
  59. package/dist/types/src/model/markers.d.ts +7 -0
  60. package/dist/types/src/model/note.d.ts +11 -2
  61. package/dist/types/src/model/routes.d.ts +5 -3
  62. package/dist/types/src/model/status.d.ts +18 -0
  63. package/dist/types/src/model/types.d.ts +20 -1
  64. package/dist/types/src/runtime/svg-renderer.d.ts +3 -2
  65. package/dist/types/src/state/active-session.d.ts +6 -2
  66. package/dist/types/src/state/canvas-commands.d.ts +37 -0
  67. package/dist/types/src/state/session/actions.d.ts +2 -0
  68. package/dist/types/src/state/session/file-session.d.ts +1 -1
  69. package/dist/types/src/state/session/index.d.ts +6 -2
  70. package/dist/types/src/state/session/layout.d.ts +1 -1
  71. package/dist/types/src/state/session/scene.d.ts +11 -9
  72. package/dist/types/src/state/session/sculpt.d.ts +1 -1
  73. package/package.json +1 -1
  74. package/dist/assets/engine.worker-BDrPGHQt.js +0 -7634
@@ -0,0 +1,20 @@
1
+ import { compute } from './routing/compute.ts';
2
+ import { conflicts, parallelConflicts, type Line } from './routing/conflicts.ts';
3
+ import { blocked } from './routing/geometry.ts';
4
+ import { port } from './routing/ports.ts';
5
+ import { settings } from './routing/settings.ts';
6
+ export declare const RouteLab: {
7
+ compute: typeof compute;
8
+ settings: typeof settings;
9
+ defaults: import("./routing/types.ts").RoutingSettings;
10
+ port: typeof port;
11
+ blocked: typeof blocked;
12
+ conflicts: typeof conflicts;
13
+ parallelConflicts: typeof parallelConflicts;
14
+ /** Crossings and shared run length of a set of routes, each counted against the ones before it. */
15
+ metrics: (routes: Line[]) => {
16
+ crossings: number;
17
+ shared: number;
18
+ };
19
+ };
20
+ export type { PriorRoute, Route, RouteEdgeInput, RouteGroupInput, RouteInput, RouteMetrics, RouteNodeInput, RoutingOptions, RoutingReport, RoutingResult, } from './routing/types.ts';
@@ -0,0 +1,87 @@
1
+ import type { Diagram, LayoutSettings, NodeGeometry, Point, Rect } from '../model/types.ts';
2
+ import type { LayoutMetrics, LayoutOptions, LayoutReport, TraceFrame } from './layout-engine.ts';
3
+ export type BrushMode = 'tidy' | 'flow' | 'space' | 'restore' | 'protect';
4
+ export interface BrushSettings {
5
+ radius: number;
6
+ strength: number;
7
+ softness: number;
8
+ step: number;
9
+ mode: BrushMode;
10
+ holdRestored: boolean;
11
+ }
12
+ export interface DabOptions extends Partial<BrushSettings> {
13
+ point?: Point;
14
+ worldRadius?: number;
15
+ reference?: NodeGeometry | null;
16
+ protectedIds?: string[];
17
+ }
18
+ export interface DabResult {
19
+ document: Diagram;
20
+ weights: Record<string, number>;
21
+ locked: string[];
22
+ moved: string[];
23
+ maxDisplacement: number;
24
+ blocked: boolean;
25
+ attenuation?: number;
26
+ mode: BrushMode;
27
+ }
28
+ export interface TimelineFrame {
29
+ nodes: NodeGeometry;
30
+ iteration: number;
31
+ phase: string;
32
+ metrics: LayoutMetrics;
33
+ index: number;
34
+ moved: number;
35
+ travel: number;
36
+ cumulative: number;
37
+ maxMove: number;
38
+ }
39
+ export interface TimelineBookmark {
40
+ index: number;
41
+ title: string;
42
+ }
43
+ export interface Timeline {
44
+ schemaVersion: 1;
45
+ kind: 'diagram-studio-journey';
46
+ baseline: Diagram;
47
+ settings: LayoutSettings;
48
+ execution: Record<string, unknown>;
49
+ report: LayoutReport;
50
+ frames: TimelineFrame[];
51
+ finalDocument: Diagram;
52
+ bookmarks: TimelineBookmark[];
53
+ createdAt: string;
54
+ /** Added by the app: routes in effect when the timeline was recorded. */
55
+ routePrior?: unknown[];
56
+ }
57
+ declare function settings(input?: Partial<BrushSettings>): BrushSettings;
58
+ /** How strongly a brush of radius `r` acts at distance `d`: 1 in the core, eased to 0 at the rim. */
59
+ declare function weight(d: number, r: number, softness?: number): number;
60
+ declare function rectDistance(p: Point, r: Rect): number;
61
+ /** The brush weight of each visible shape it reaches, and the shapes it reaches but may not move. */
62
+ declare function field(doc: Diagram, point: Point, radius: number, softness?: number, protectedIds?: string[]): {
63
+ weights: Record<string, number>;
64
+ locked: string[];
65
+ };
66
+ declare function violationPairs(doc: Diagram, nodes: NodeGeometry): Map<string, number>;
67
+ declare function noWorse(doc: Diagram, before: NodeGeometry, after: NodeGeometry): boolean;
68
+ /** One brush dab at `options.point`: moves the shapes under it a step toward the brush's goal. */
69
+ declare function dab(input: Diagram, options?: DabOptions): DabResult;
70
+ declare function summarizeFrames(frames: TraceFrame[]): TimelineFrame[];
71
+ /** A rebuild recorded as frames, from the given arrangement to the computed finish. */
72
+ declare function journey(input: Diagram, options?: LayoutOptions): Promise<Timeline>;
73
+ declare function lookahead(frames: TimelineFrame[], index: number, pixels?: number, scale?: number): number;
74
+ export declare const SculptLab: {
75
+ defaults: BrushSettings;
76
+ settings: typeof settings;
77
+ weight: typeof weight;
78
+ rectDistance: typeof rectDistance;
79
+ field: typeof field;
80
+ dab: typeof dab;
81
+ journey: typeof journey;
82
+ lookahead: typeof lookahead;
83
+ summarizeFrames: typeof summarizeFrames;
84
+ violationPairs: typeof violationPairs;
85
+ noWorse: typeof noWorse;
86
+ };
87
+ export {};
@@ -1,7 +1,7 @@
1
- import { type CandidateResult, type CandidateSpec, type ComparisonConfig } from '../engines/explorer-engine.js';
2
- import { type LayoutOptions, type LayoutResult } from '../engines/layout-engine.js';
3
- import { type Timeline } from '../engines/sculpt-engine.js';
4
- import { type RouteInput, type RoutingOptions, type RoutingResult } from '../engines/routing-engine.js';
1
+ import { type CandidateResult, type CandidateSpec, type ComparisonConfig } from '../engines/explorer-engine';
2
+ import { type LayoutOptions, type LayoutResult } from '../engines/layout-engine';
3
+ import { type Timeline } from '../engines/sculpt-engine';
4
+ import { type RouteInput, type RoutingOptions, type RoutingResult } from '../engines/routing-engine';
5
5
  import { type Scene } from '../dsl/compile';
6
6
  import { type ViewState } from '../dsl/project';
7
7
  import type { Diagram } from '../model/types';
@@ -9,6 +9,7 @@ import type { Footnote } from './footnote';
9
9
  import type { Note } from './note';
10
10
  import { type FontRole, type TypeProfile } from './fonts';
11
11
  import type { FileConfig } from './link';
12
+ import type { MessageKind } from './markers';
12
13
  export type ThemeId = 'drafting' | 'fieldnotes' | 'signal' | 'ink' | 'blueprint' | 'drafting-dark';
13
14
  export declare const THEME_IDS: ThemeId[];
14
15
  export declare const DEFAULT_THEME: ThemeId;
@@ -101,10 +102,18 @@ export interface Heading {
101
102
  /** The connection styles a `legend line` row can explain. */
102
103
  export declare const LEGEND_LINES: readonly ["dashed", "solid"];
103
104
  export type LegendLine = (typeof LEGEND_LINES)[number];
104
- /** One row of the key: a color swatch (`family`), or a short connection (`line`). */
105
+ /**
106
+ * One row of the key: a color swatch (`family`), a short connection (`line`), or the mark of a
107
+ * kind of sequence message (`message`), which the drawing adds for each kind it uses.
108
+ */
105
109
  export interface LegendEntry {
106
110
  family?: string;
107
111
  line?: LegendLine;
112
+ message?: MessageKind;
113
+ /** An activation bar, which a sequence with `activations=on` adds a row for. */
114
+ activation?: true;
115
+ /** Words with no swatch: a sequence's line that its rows show order, not time. */
116
+ caption?: true;
108
117
  /** Shade of the swatch; nodes' default when omitted. */
109
118
  shade?: Shade;
110
119
  label: string;
@@ -1,4 +1,5 @@
1
1
  import { emptyDiagram } from './document';
2
+ import type { MessageKind } from './markers';
2
3
  import type { ContainerLayout, Diagram, DiagramEdge, DiagramGroup, DiagramNode, EdgeLayout, IntentPlacement, IntentRole, NodeLayout, NodeStyle, Point, PortSide, Rect, Side } from './types';
3
4
  export declare function moveObject(doc: Diagram, id: string, dx: number, dy: number, manual?: boolean): void;
4
5
  /** Bounds of a container's direct children, including shape labels. */
@@ -99,6 +100,24 @@ export declare function setLabelMode(doc: Diagram, id: string, mode: NonNullable
99
100
  export declare function setParent(doc: Diagram, id: string, parentId: string | null): void;
100
101
  export declare function setContainer(doc: Diagram, id: string, patch: Partial<ContainerLayout>): void;
101
102
  export declare function setEdge(doc: Diagram, id: string, patch: Partial<Pick<DiagramEdge, 'directed' | 'dashed' | 'emphasis' | 'head' | 'tail'>>): void;
103
+ /**
104
+ * Give a sequence message a kind, or take it away. The kind draws the line and its ends, so the
105
+ * message keeps no style of its own. A reply to a message that can no longer take one is unpaired.
106
+ */
107
+ export declare function setMessage(doc: Diagram, id: string, kind: MessageKind | undefined): void;
108
+ /**
109
+ * Add an event to a sequence before or after another: a plain message between the same two
110
+ * participants, or an action beside an action. The file gives it its row when it draws again.
111
+ */
112
+ export declare function insertEvent(doc: Diagram, id: string, where: 'before' | 'after'): string | undefined;
113
+ /** Move a sequence event one place up or down among the events. False at either end. */
114
+ export declare function moveEvent(doc: Diagram, id: string, by: -1 | 1): boolean;
115
+ /** Turn a sequence's activation bars on or off. The file's layout line holds the switch. */
116
+ export declare function setActivations(doc: Diagram, on: boolean): void;
117
+ /** The earlier messages a reply can answer: those with a kind that run the other way. */
118
+ export declare function replyTargets(doc: Diagram, id: string): DiagramEdge[];
119
+ /** Say which message a reply answers, or that it names none. */
120
+ export declare function setReplyTo(doc: Diagram, id: string, target: string | undefined): void;
102
121
  export declare function setEdgeLayout(doc: Diagram, id: string, patch: Partial<EdgeLayout>): void;
103
122
  export declare function reverseEdge(doc: Diagram, id: string): void;
104
123
  export declare function useAutomaticPorts(doc: Diagram, edgeIds: string[]): void;
@@ -62,6 +62,12 @@ export interface NodeLabel {
62
62
  export declare function nodeLabel(doc: Diagram, id: string, title: string, r: Rect): NodeLabel;
63
63
  /** Bounds of a shape together with its label. */
64
64
  export declare function visualBounds(doc: Diagram, id: string, title: string, r: Rect): Rect;
65
+ /** Text width a sequence phase's label wraps to, so a long one does not push the lanes right. */
66
+ export declare const PHASE_WRAP = 96;
67
+ /** Inset of a phase label from its band's top left corner. */
68
+ export declare const PHASE_TAB = 8;
69
+ /** A phase label's lines, in the annotation type. */
70
+ export declare const phaseLabelLines: (label: string, r: ResolvedAppearance) => string[];
65
71
  /** Text width a sequence message's label wraps to; the gap between participants follows it. */
66
72
  export declare const MESSAGE_WRAP = 168;
67
73
  /**
@@ -93,6 +99,23 @@ export declare function edgeLabelSize(label: string, r?: ResolvedAppearance, mes
93
99
  w: number;
94
100
  h: number;
95
101
  };
102
+ /**
103
+ * An activation bar: its width, how far a nested bar steps to the right, how far it runs past
104
+ * its first and last rows, and the length of a bar whose call gets no reply.
105
+ */
106
+ export declare const ACTIVATION: {
107
+ w: number;
108
+ step: number;
109
+ over: number;
110
+ stub: number;
111
+ };
112
+ /** Room between a local action's label and its box, on each side. */
113
+ export declare const ACTION_PAD = 5;
114
+ /** The box of a local action: its label and `ACTION_PAD` round it, centred on the lifeline. */
115
+ export declare function actionSize(label: string, r: ResolvedAppearance): {
116
+ w: number;
117
+ h: number;
118
+ };
96
119
  /**
97
120
  * What a self-message draws, measured from where its row meets the lifeline: how far right, how
98
121
  * far above the row and how far below it.
@@ -30,10 +30,17 @@ export declare const markerBox: (kind: Exclude<EndMarker, "none">, tail: boolean
30
30
  };
31
31
  /** The fill a marker takes on this line and surface. */
32
32
  export declare function markerFill(kind: Exclude<EndMarker, 'none'>, ink: string, surface: string): string;
33
+ /**
34
+ * What `message=` accepts on a sequence message, plus `action`, which an `action` line makes.
35
+ * Each says what the author means; none is read from a line's style.
36
+ */
37
+ export declare const MESSAGE_KINDS: readonly ["interaction", "call", "send", "reply", "outcome"];
38
+ export type MessageKind = (typeof MESSAGE_KINDS)[number] | 'action';
33
39
  type Ends = {
34
40
  directed?: boolean;
35
41
  head?: EndMarker;
36
42
  tail?: EndMarker;
43
+ message?: MessageKind;
37
44
  };
38
45
  /** An undirected edge has no marks, whatever else it holds. */
39
46
  export declare const headOf: (e: Ends) => EndMarker;
@@ -46,13 +46,22 @@ export declare function noteBox(look: ResolvedAppearance, note: Note): PlacedNot
46
46
  * Spots in a sequence's side margins, by index in `notes`, for notes on the messages in `rows`.
47
47
  * `left` and `right` are the margins' inner edges and `top` the highest a note goes. A note is
48
48
  * level with its row, or pushed down clear of the note above it. The panel grows round these, so
49
- * no note here can cover the drawing.
49
+ * no note here can cover the drawing. A note on a message in a phase stays inside that phase's
50
+ * band (`bands`, by message), which `marginNoteRoom` makes tall enough for its notes.
50
51
  */
51
52
  export declare function marginNotes(look: ResolvedAppearance, notes: readonly Note[], rows: ReadonlyMap<string, number>, { left, right, top }: {
52
53
  left: number;
53
54
  right: number;
54
55
  top: number;
55
- }): (Rect | null)[];
56
+ }, bands?: ReadonlyMap<string, {
57
+ y: number;
58
+ h: number;
59
+ }>): (Rect | null)[];
60
+ /**
61
+ * The height a phase band needs for the margin notes on its messages (`ids`): the taller of its
62
+ * two sides, each a stack of its notes.
63
+ */
64
+ export declare function marginNoteRoom(look: ResolvedAppearance, notes: readonly Note[], ids: string[]): number;
56
65
  /**
57
66
  * Place every anchored note beside its object or message, clear of shapes, group borders, lines
58
67
  * and earlier notes when a nearby spot allows it. Frame notes, and notes whose object is not drawn,
@@ -1,4 +1,4 @@
1
- import { type PriorRoute, type Route, type RoutingResult } from '../engines/routing-engine.js';
1
+ import { type PriorRoute, type Route, type RoutingResult } from '../engines/routing-engine';
2
2
  import { type ResolvedAppearance } from './appearance';
3
3
  import { type VisibleGraph } from './graph';
4
4
  import type { Diagram, EdgeLayout, Point, Rect, ShapeKind, Side } from './types';
@@ -132,8 +132,10 @@ export declare function routeInput(doc: Diagram, vg: VisibleGraph, all: Map<stri
132
132
  tail?: import("./markers").EndMarker;
133
133
  emphasis: boolean;
134
134
  dashed: boolean;
135
- status?: import("./status.js").Status;
136
- spot?: import("./status.js").Spot;
135
+ message?: import("./markers").MessageKind;
136
+ replyTo?: string;
137
+ status?: import("./status").Status;
138
+ spot?: import("./status").Spot;
137
139
  }[];
138
140
  };
139
141
  /**
@@ -82,3 +82,21 @@ export declare function withState(doc: Diagram, id: string): Diagram;
82
82
  export declare function usedStatuses(doc: Diagram): StatusCount[];
83
83
  /** The color key's rows: a diff draws no family colors, so it lists only its statuses. */
84
84
  export declare const drawnLegend: (doc: Diagram) => LegendEntry[];
85
+ /** What every sequence says under its drawing. */
86
+ export declare const SEQUENCE_CAPTION = "Rows show order, not elapsed time.";
87
+ /**
88
+ * The events that belong with one event of a sequence: a message, the reply that answers it,
89
+ * and the message a reply answers. Only pairs the file states, never a guess from direction.
90
+ */
91
+ export declare function replyPair(doc: Diagram, id: string): string[];
92
+ /**
93
+ * A sequence in words, for a reader who cannot see it: the participants, then each event in
94
+ * order with its kind. An exported SVG carries it as its description unless the host gives one.
95
+ */
96
+ export declare function sequenceDescription(doc: Diagram): string | undefined;
97
+ /**
98
+ * The key a sequence draws for its kinds of message: one row for each mark in use, so a reader
99
+ * never has to guess what a solid head or a box means. Nothing unless a message has a kind. A
100
+ * plain message and a shown result draw the same arrow, so they share a row.
101
+ */
102
+ export declare function messageKey(doc: Diagram): LegendEntry[];
@@ -13,7 +13,7 @@ export type PortSide = Side | 'auto';
13
13
  export type Direction = 'RIGHT' | 'DOWN';
14
14
  export type Theme = 'light' | 'dark';
15
15
  import type { DiagramAppearance, Shade } from './appearance';
16
- import type { EndMarker } from './markers';
16
+ import type { EndMarker, MessageKind } from './markers';
17
17
  import type { Spot, Status } from './status';
18
18
  export type ShapeKind = 'box' | 'pill' | 'circle' | 'diamond' | 'text' | 'icon' | 'image'
19
19
  /** A seam between two cells of a `cells` group. */
@@ -70,6 +70,13 @@ export interface DiagramEdge {
70
70
  tail?: EndMarker;
71
71
  emphasis: boolean;
72
72
  dashed: boolean;
73
+ /**
74
+ * A sequence message's meaning, from `message=`, or `action` for work one participant does
75
+ * (an `action` line; `from` and `to` are that participant). Unset for a plain message.
76
+ */
77
+ message?: MessageKind;
78
+ /** With `message: 'reply'`: the earlier message this one answers, from `answers=`. */
79
+ replyTo?: string;
73
80
  /** How it differs between two versions of the diagram. */
74
81
  status?: Status;
75
82
  /** How the drawn emphasis state treats it; see `withState`. */
@@ -93,6 +100,8 @@ export interface EdgeLayout {
93
100
  toOffset?: number;
94
101
  /** A sequence message: drawn straight between the two lifelines at this height, not routed. */
95
102
  row?: number;
103
+ /** A message between distant lanes: the middle of the gap between lifelines its label sits in. */
104
+ labelX?: number;
96
105
  /**
97
106
  * Set by the compiler for a forward line in a `flow` scope: its route planned from the ranks.
98
107
  * The quick router takes it as it is when it clears every box.
@@ -274,8 +283,18 @@ export interface SequenceLayout {
274
283
  rows: Record<string, number>;
275
284
  phases: SequencePhase[];
276
285
  grow: number;
286
+ activations?: Activation[];
277
287
  };
288
+ /** With `activations=on`: the bars on the lifelines of participants at work on a call. */
289
+ activations?: Activation[];
290
+ /** The `activations=on` switch itself, which the Inspector turns on and off. */
291
+ bars?: true;
278
292
  }
293
+ /** One activation bar: its participant, the call that opened it, and its box. */
294
+ export type Activation = Rect & {
295
+ node: string;
296
+ call: string;
297
+ };
279
298
  export type SequencePhase = {
280
299
  id: string;
281
300
  label: string;
@@ -3,6 +3,7 @@
3
3
  * same appearance, shapes and title wrapping as the canvas and embeds the fonts it uses.
4
4
  */
5
5
  import { type ResolvedAppearance } from '../model/appearance';
6
+ import { PHASE_TAB } from '../model/labels';
6
7
  import { computeRoutes } from '../model/routes';
7
8
  import type { Diagram, Rect } from '../model/types';
8
9
  /** How an object's `href` is written into the file; as written unless the caller says. */
@@ -41,10 +42,10 @@ export type Route = ReturnType<typeof computeRoutes>['routes'][number];
41
42
  */
42
43
  export declare function sequenceBackdrop(doc: Diagram, look: ResolvedAppearance): {
43
44
  panel: string[];
45
+ bars: string[];
44
46
  phases: string[];
45
47
  };
46
- /** Inset of a phase label from its band's top left corner. */
47
- export declare const PHASE_TAB = 8;
48
+ export { PHASE_TAB };
48
49
  /** A thin stripe across the top of a box, inside its rounded corners. */
49
50
  export declare function accentPath(r: Rect, radius: number): string;
50
51
  export declare function renderSvg(doc: Diagram, opts?: SvgOptions): string;
@@ -208,6 +208,8 @@ export declare const setActiveSession: (session: DiagramSession) => {
208
208
  tail?: import("../model/markers").EndMarker;
209
209
  emphasis: boolean;
210
210
  dashed: boolean;
211
+ message?: import("../model/markers").MessageKind;
212
+ replyTo?: string;
211
213
  status?: import("../model/status").Status;
212
214
  spot?: import("../model/status").Spot;
213
215
  }[];
@@ -216,7 +218,7 @@ export declare const setActiveSession: (session: DiagramSession) => {
216
218
  routingReport: () => import("../engines/routing-engine").RoutingReport;
217
219
  blockedRouteIds: () => string[];
218
220
  sceneBounds: () => import("../model/types").Rect;
219
- viewerFrame: () => {
221
+ viewerFrame: import("solid-js").Accessor<{
220
222
  x: number;
221
223
  y: number;
222
224
  w: number;
@@ -260,7 +262,7 @@ export declare const setActiveSession: (session: DiagramSession) => {
260
262
  h: number;
261
263
  };
262
264
  notes: import("../model/note").PlacedNote[];
263
- };
265
+ }>;
264
266
  } & {
265
267
  states: () => import("../model/appearance").EmphasisState[];
266
268
  activeState: () => string | null;
@@ -398,6 +400,8 @@ export declare const setActiveSession: (session: DiagramSession) => {
398
400
  fitSelectedContainer: () => void;
399
401
  toggleCollapse: (id?: string | undefined) => void;
400
402
  reverseSelectedEdge: () => void;
403
+ insertEvent: (where: "before" | "after") => string | undefined;
404
+ moveEvent: (by: -1 | 1) => void;
401
405
  resetSelectedBends: () => void;
402
406
  setLayoutIntent: (role: import("../model/types").IntentRole, id: string | null, placement?: import("../model/types").IntentPlacement) => void;
403
407
  markSelectedAs: (role: import("../model/types").IntentRole) => void;
@@ -17,6 +17,15 @@ export interface Command {
17
17
  declare function undoCommand(): void;
18
18
  declare function redoCommand(): void;
19
19
  export declare const hasSelection: () => boolean;
20
+ /** A sequence draws from its file, so its messages are added and moved in a file only. */
21
+ declare function sequenceFileOnly(): "Open the diagram as a file to add or move its messages." | null;
22
+ declare let nameInPanel: (() => boolean) | null;
23
+ /**
24
+ * Set by the app shell, which owns the Inspector: put the caret in its Label field and return
25
+ * true, or return false when the Inspector is not showing. The embedded editor has no
26
+ * Inspector and sets nothing, so it names a new message in place.
27
+ */
28
+ export declare const setLabelNamer: (fn: typeof nameInPanel) => (() => boolean) | null;
20
29
  export declare const canvasCommands: {
21
30
  undo: {
22
31
  hint: string;
@@ -49,6 +58,34 @@ export declare const canvasCommands: {
49
58
  icon: string;
50
59
  run: () => string | undefined;
51
60
  };
61
+ 'insert-event-after': {
62
+ label: string;
63
+ keys: string;
64
+ hint: string;
65
+ run: () => void;
66
+ blocked: typeof sequenceFileOnly;
67
+ };
68
+ 'insert-event-before': {
69
+ label: string;
70
+ keys: string;
71
+ hint: string;
72
+ run: () => void;
73
+ blocked: typeof sequenceFileOnly;
74
+ };
75
+ 'move-event-up': {
76
+ label: string;
77
+ keys: string;
78
+ hint: string;
79
+ run: () => void;
80
+ blocked: typeof sequenceFileOnly;
81
+ };
82
+ 'move-event-down': {
83
+ label: string;
84
+ keys: string;
85
+ hint: string;
86
+ run: () => void;
87
+ blocked: typeof sequenceFileOnly;
88
+ };
52
89
  duplicate: {
53
90
  hint: string;
54
91
  enabled: () => boolean;
@@ -54,6 +54,8 @@ export declare function createActions(s: EditorPart & DocumentPart & ScenePart &
54
54
  fitSelectedContainer: () => void;
55
55
  toggleCollapse: (id?: string | undefined) => void;
56
56
  reverseSelectedEdge: () => void;
57
+ insertEvent: (where: "before" | "after") => string | undefined;
58
+ moveEvent: (by: -1 | 1) => void;
57
59
  resetSelectedBends: () => void;
58
60
  setLayoutIntent: (role: IntentRole, id: string | null, placement?: IntentPlacement) => void;
59
61
  markSelectedAs: (role: IntentRole) => void;
@@ -1,6 +1,6 @@
1
1
  import { type Diagnostic, type Scene } from '../../dsl/compile';
2
2
  import { type ShapeChange, UnstorableLayout } from '../../dsl/layout-edits';
3
- import type { RoutingResult } from '../../engines/routing-engine.js';
3
+ import type { RoutingResult } from '../../engines/routing-engine';
4
4
  import type { Diagram, LayoutSettings, RoutingSettings } from '../../model/types';
5
5
  import type { DocumentPart } from './document';
6
6
  import type { CanvasTextPart } from './canvas-text';
@@ -228,6 +228,8 @@ export declare function createDiagramSession(options?: SessionOptions): {
228
228
  tail?: import("../../model/markers").EndMarker;
229
229
  emphasis: boolean;
230
230
  dashed: boolean;
231
+ message?: import("../../model/markers").MessageKind;
232
+ replyTo?: string;
231
233
  status?: import("../../model/status").Status;
232
234
  spot?: import("../../model/status").Spot;
233
235
  }[];
@@ -236,7 +238,7 @@ export declare function createDiagramSession(options?: SessionOptions): {
236
238
  routingReport: () => import("../../engines/routing-engine").RoutingReport;
237
239
  blockedRouteIds: () => string[];
238
240
  sceneBounds: () => import("../../model/types").Rect;
239
- viewerFrame: () => {
241
+ viewerFrame: import("solid-js").Accessor<{
240
242
  x: number;
241
243
  y: number;
242
244
  w: number;
@@ -280,7 +282,7 @@ export declare function createDiagramSession(options?: SessionOptions): {
280
282
  h: number;
281
283
  };
282
284
  notes: import("../../model/note").PlacedNote[];
283
- };
285
+ }>;
284
286
  } & {
285
287
  states: () => import("../../model/appearance").EmphasisState[];
286
288
  activeState: () => string | null;
@@ -418,6 +420,8 @@ export declare function createDiagramSession(options?: SessionOptions): {
418
420
  fitSelectedContainer: () => void;
419
421
  toggleCollapse: (id?: string | undefined) => void;
420
422
  reverseSelectedEdge: () => void;
423
+ insertEvent: (where: "before" | "after") => string | undefined;
424
+ moveEvent: (by: -1 | 1) => void;
421
425
  resetSelectedBends: () => void;
422
426
  setLayoutIntent: (role: import("../../model/types").IntentRole, id: string | null, placement?: import("../../model/types").IntentPlacement) => void;
423
427
  markSelectedAs: (role: import("../../model/types").IntentRole) => void;
@@ -1,4 +1,4 @@
1
- import { type LayoutOptions, type LayoutReport, type LayoutScope } from '../../engines/layout-engine.js';
1
+ import { type LayoutOptions, type LayoutReport, type LayoutScope } from '../../engines/layout-engine';
2
2
  import { type ShapeChange } from '../../dsl/layout-edits';
3
3
  import type { Diagram, LayoutAlgorithmId, RoutingSettings } from '../../model/types';
4
4
  import type { DocumentPart } from './document';
@@ -1,4 +1,4 @@
1
- import type { PriorRoute, RoutingResult } from '../../engines/routing-engine.js';
1
+ import type { PriorRoute, RoutingResult } from '../../engines/routing-engine';
2
2
  import { type VisibleGraph } from '../../model/graph';
3
3
  import { type DrawnRoute } from '../../model/routes';
4
4
  import type { NodeGeometry, NodeLayout, Rect } from '../../model/types';
@@ -83,19 +83,21 @@ export declare function createScene(s: DocumentPart & FileSessionPart): {
83
83
  label: string;
84
84
  was?: string;
85
85
  directed: boolean;
86
- head?: import("../../model/markers.js").EndMarker;
87
- tail?: import("../../model/markers.js").EndMarker;
86
+ head?: import("../../model/markers").EndMarker;
87
+ tail?: import("../../model/markers").EndMarker;
88
88
  emphasis: boolean;
89
89
  dashed: boolean;
90
+ message?: import("../../model/markers").MessageKind;
91
+ replyTo?: string;
90
92
  status?: import("../../model/status").Status;
91
93
  spot?: import("../../model/status").Spot;
92
94
  }[];
93
95
  };
94
96
  routes: () => DrawnRoute[];
95
- routingReport: () => import("../../engines/routing-engine.js").RoutingReport;
97
+ routingReport: () => import("../../engines/routing-engine").RoutingReport;
96
98
  blockedRouteIds: () => string[];
97
99
  sceneBounds: () => Rect;
98
- viewerFrame: () => {
100
+ viewerFrame: import("solid-js").Accessor<{
99
101
  x: number;
100
102
  y: number;
101
103
  w: number;
@@ -129,16 +131,16 @@ export declare function createScene(s: DocumentPart & FileSessionPart): {
129
131
  foot: {
130
132
  x: number;
131
133
  y: number;
132
- type: import("../../model/fonts.js").TypeProfile;
134
+ type: import("../../model/fonts").TypeProfile;
133
135
  gutter: number;
134
136
  items: {
135
- note: import("../../model/footnote.js").Footnote;
136
- lines: import("../../model/rich-text.js").Run[][];
137
+ note: import("../../model/footnote").Footnote;
138
+ lines: import("../../model/rich-text").Run[][];
137
139
  y: number;
138
140
  }[];
139
141
  h: number;
140
142
  };
141
143
  notes: import("../../model/note").PlacedNote[];
142
- };
144
+ }>;
143
145
  };
144
146
  export type ScenePart = ReturnType<typeof createScene>;
@@ -1,4 +1,4 @@
1
- import { type BrushSettings, type DabResult, type Timeline } from '../../engines/sculpt-engine.js';
1
+ import { type BrushSettings, type DabResult, type Timeline } from '../../engines/sculpt-engine';
2
2
  import type { Point } from '../../model/types';
3
3
  import type { DocumentPart } from './document';
4
4
  import type { LayoutPart } from './layout';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftably/editor",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "The Draftably diagram editor: drag boxes and lines, and get the .draft source back.",
5
5
  "license": "MIT",
6
6
  "type": "module",