@draftably/runtime 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.
- package/dist/assets/render.worker-CDf818A5.js +9040 -0
- package/dist/compile-CvMiDEcR.js +7837 -0
- package/dist/element.js +1 -1
- package/dist/graph.js +1 -1
- package/dist/index.js +2 -2
- package/dist/render-DU-eRw6k.js +1250 -0
- package/dist/types/src/dsl/compile.d.ts +2 -0
- package/dist/types/src/dsl/sequence-layout.d.ts +87 -0
- package/dist/types/src/dsl/syntax.d.ts +8 -2
- package/dist/types/src/engines/layout/arrange.d.ts +36 -0
- package/dist/types/src/engines/layout/compute.d.ts +7 -0
- package/dist/types/src/engines/layout/forces.d.ts +8 -0
- package/dist/types/src/engines/layout/grid.d.ts +10 -0
- package/dist/types/src/engines/layout/intent.d.ts +14 -0
- package/dist/types/src/engines/layout/layered.d.ts +5 -0
- package/dist/types/src/engines/layout/objective.d.ts +6 -0
- package/dist/types/src/engines/layout/packing.d.ts +7 -0
- package/dist/types/src/engines/layout/report.d.ts +7 -0
- package/dist/types/src/engines/layout/scene.d.ts +53 -0
- package/dist/types/src/engines/layout/seed.d.ts +3 -0
- package/dist/types/src/engines/layout/separation.d.ts +17 -0
- package/dist/types/src/engines/layout/settings.d.ts +6 -0
- package/dist/types/src/engines/layout/topology.d.ts +18 -0
- package/dist/types/src/engines/layout/trees.d.ts +8 -0
- package/dist/types/src/engines/layout/types.d.ts +133 -0
- package/dist/types/src/engines/layout/util.d.ts +19 -0
- package/dist/types/src/engines/layout-engine.d.ts +14 -119
- package/dist/types/src/engines/routing/compute.d.ts +6 -0
- package/dist/types/src/engines/routing/conflicts.d.ts +36 -0
- package/dist/types/src/engines/routing/context.d.ts +37 -0
- package/dist/types/src/engines/routing/cost.d.ts +13 -0
- package/dist/types/src/engines/routing/doglegs.d.ts +16 -0
- package/dist/types/src/engines/routing/find.d.ts +6 -0
- package/dist/types/src/engines/routing/geometry.d.ts +24 -0
- package/dist/types/src/engines/routing/heap.d.ts +20 -0
- package/dist/types/src/engines/routing/improve.d.ts +7 -0
- package/dist/types/src/engines/routing/nudge.d.ts +7 -0
- package/dist/types/src/engines/routing/paths.d.ts +8 -0
- package/dist/types/src/engines/routing/planned.d.ts +7 -0
- package/dist/types/src/engines/routing/ports.d.ts +10 -0
- package/dist/types/src/engines/routing/repair.d.ts +9 -0
- package/dist/types/src/engines/routing/score.d.ts +12 -0
- package/dist/types/src/engines/routing/search.d.ts +16 -0
- package/dist/types/src/engines/routing/settings.d.ts +4 -0
- package/dist/types/src/engines/routing/sidepairs.d.ts +20 -0
- package/dist/types/src/engines/routing/tidy-ports.d.ts +13 -0
- package/dist/types/src/engines/routing/tidy.d.ts +10 -0
- package/dist/types/src/engines/routing/tuning.d.ts +9 -0
- package/dist/types/src/engines/routing/types.d.ts +157 -0
- package/dist/types/src/engines/routing-engine.d.ts +19 -107
- package/dist/types/src/model/appearance.d.ts +10 -1
- package/dist/types/src/model/labels.d.ts +23 -0
- package/dist/types/src/model/markers.d.ts +7 -0
- package/dist/types/src/model/note.d.ts +11 -2
- package/dist/types/src/model/routes.d.ts +2 -0
- package/dist/types/src/model/status.d.ts +18 -0
- package/dist/types/src/model/types.d.ts +20 -1
- package/dist/types/src/runtime/svg-renderer.d.ts +3 -2
- package/dist/version-D7YCY2pU.js +4 -0
- package/dist/viewer.js +27 -27
- package/package.json +1 -1
- package/dist/assets/render.worker-D11vTqoO.js +0 -8548
- package/dist/compile-BAIrdu-8.js +0 -7405
- package/dist/render-CsJYFD3o.js +0 -1188
- package/dist/types/src/engines/explorer-engine.d.ts +0 -67
- package/dist/types/src/engines/sculpt-engine.d.ts +0 -71
- package/dist/version-CO7i33cq.js +0 -4
|
@@ -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
|
-
}
|
|
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,
|
|
@@ -132,6 +132,8 @@ export declare function routeInput(doc: Diagram, vg: VisibleGraph, all: Map<stri
|
|
|
132
132
|
tail?: import("./markers.js").EndMarker;
|
|
133
133
|
emphasis: boolean;
|
|
134
134
|
dashed: boolean;
|
|
135
|
+
message?: import("./markers.js").MessageKind;
|
|
136
|
+
replyTo?: string;
|
|
135
137
|
status?: import("./status.js").Status;
|
|
136
138
|
spot?: import("./status.js").Spot;
|
|
137
139
|
}[];
|
|
@@ -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.js';
|
|
16
|
-
import type { EndMarker } from './markers.js';
|
|
16
|
+
import type { EndMarker, MessageKind } from './markers.js';
|
|
17
17
|
import type { Spot, Status } from './status.js';
|
|
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.js';
|
|
6
|
+
import { PHASE_TAB } from '../model/labels.js';
|
|
6
7
|
import { computeRoutes } from '../model/routes.js';
|
|
7
8
|
import type { Diagram, Rect } from '../model/types.js';
|
|
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
|
-
|
|
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;
|
package/dist/viewer.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as Ne, F as
|
|
1
|
+
import { i as Ne, F as Re } from "./geometry-DfUVE8b2.js";
|
|
2
2
|
import { f as kt } from "./geometry-DfUVE8b2.js";
|
|
3
|
-
import { r as St } from "./version-
|
|
3
|
+
import { r as St } from "./version-D7YCY2pU.js";
|
|
4
4
|
const $e = 0.02, ze = 8, He = 32, ye = (n, t = $e, i = ze) => Math.min(Math.max(n, Math.max($e, t)), Math.min(ze, i));
|
|
5
|
-
function
|
|
5
|
+
function Oe(n = {}) {
|
|
6
6
|
const t = n.padding ?? He;
|
|
7
7
|
return typeof t == "number" ? { top: t, right: t, bottom: t, left: t } : t;
|
|
8
8
|
}
|
|
@@ -12,7 +12,7 @@ function Ge(n) {
|
|
|
12
12
|
return { x: t, y: i, width: r - t, height: c - i };
|
|
13
13
|
}
|
|
14
14
|
function Ie(n, t, i = {}) {
|
|
15
|
-
const r =
|
|
15
|
+
const r = Oe(i), c = Math.max(1, t.width - r.left - r.right), d = Math.max(1, t.height - r.top - r.bottom), m = ye(
|
|
16
16
|
Math.min(c / Math.max(1, n.width), d / Math.max(1, n.height)),
|
|
17
17
|
i.minZoom,
|
|
18
18
|
i.maxZoom ?? 1
|
|
@@ -24,7 +24,7 @@ function Ie(n, t, i = {}) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
function Ue(n, t, i, r = {}) {
|
|
27
|
-
const c =
|
|
27
|
+
const c = Oe(r), d = { width: i.width - c.left - c.right, height: i.height - c.top - c.bottom };
|
|
28
28
|
let { centerX: m, centerY: s, zoom: f } = n;
|
|
29
29
|
if (t.width * f > d.width || t.height * f > d.height)
|
|
30
30
|
return Ie(t, i, { ...r, maxZoom: f });
|
|
@@ -97,14 +97,14 @@ function et(n, t = {}) {
|
|
|
97
97
|
let M;
|
|
98
98
|
const _ = (S) => {
|
|
99
99
|
M ??= new Map(
|
|
100
|
-
[s.nodes, s.groups, s.edges].flatMap(Object.keys).map((
|
|
100
|
+
[s.nodes, s.groups, s.edges].flatMap(Object.keys).map((O, N) => [O, N])
|
|
101
101
|
);
|
|
102
102
|
const z = S.dataset.draftAnchor;
|
|
103
103
|
return M.get(z.slice(z.indexOf(":") + 1)) ?? 1 / 0;
|
|
104
104
|
};
|
|
105
105
|
for (const S of m) {
|
|
106
|
-
const z = S.indexOf(":"),
|
|
107
|
-
if (!s || !B ||
|
|
106
|
+
const z = S.indexOf(":"), O = S.slice(0, z), N = S.slice(z + 1), B = s ? Qe(s, N) : void 0;
|
|
107
|
+
if (!s || !B || O !== "body" && O !== "overlay" || O === "body" && B !== "node" || w.has(S)) {
|
|
108
108
|
f && !w.has(S) && g.push(S);
|
|
109
109
|
continue;
|
|
110
110
|
}
|
|
@@ -114,7 +114,7 @@ function et(n, t = {}) {
|
|
|
114
114
|
if (!$ || $.kind !== B) {
|
|
115
115
|
$ && ($.el.remove(), k($));
|
|
116
116
|
const I = n.createElement("div");
|
|
117
|
-
I.className = `draft-anchor draft-anchor--${
|
|
117
|
+
I.className = `draft-anchor draft-anchor--${O}`, I.dataset.draftAnchor = S, $ = { el: I, id: N, kind: B, body: O === "body", box: D }, d.set(S, $);
|
|
118
118
|
const Q = $.body ? r : c, Z = Q.children, ue = _(I);
|
|
119
119
|
let ee = 0, H = Z.length;
|
|
120
120
|
for (; ee < H; ) {
|
|
@@ -130,7 +130,7 @@ function et(n, t = {}) {
|
|
|
130
130
|
}
|
|
131
131
|
for (const [S, z] of d) {
|
|
132
132
|
if (w.has(S)) continue;
|
|
133
|
-
const
|
|
133
|
+
const O = ne(), N = !!O && (z.el.contains(O) || U(z.el).some((B) => B.contains(O)));
|
|
134
134
|
z.el.remove(), k(z), d.delete(S), p.delete(S), l = !0, N && i.dispatchEvent(new CustomEvent("draft-anchor-focus-lost"));
|
|
135
135
|
}
|
|
136
136
|
return h && L && P(), l;
|
|
@@ -214,7 +214,7 @@ const De = Math.max(
|
|
|
214
214
|
Math.min(4, (globalThis.navigator?.hardwareConcurrency || 2) - 1)
|
|
215
215
|
), ot = 3e4, Fe = /* @__PURE__ */ new Map();
|
|
216
216
|
let st = 0;
|
|
217
|
-
const _e = "The worker is the module next to @draftably/runtime's viewer. With Vite 5–7, add optimizeDeps: { exclude: ['@draftably/runtime', '@draftably/editor'] } to vite.config.", it = () => new Worker(new URL("./assets/render.worker-
|
|
217
|
+
const _e = "The worker is the module next to @draftably/runtime's viewer. With Vite 5–7, add optimizeDeps: { exclude: ['@draftably/runtime', '@draftably/editor'] } to vite.config.", it = () => new Worker(new URL("./assets/render.worker-CDf818A5.js", import.meta.url), { type: "module" });
|
|
218
218
|
function le(n, t, i) {
|
|
219
219
|
n.slots.splice(n.slots.indexOf(t), 1), clearTimeout(t.timer), clearTimeout(t.idle), t.worker.terminate();
|
|
220
220
|
const r = t.job;
|
|
@@ -318,7 +318,7 @@ function gt(n) {
|
|
|
318
318
|
const t = /* @__PURE__ */ new Map();
|
|
319
319
|
for (const i of Array.from(n.querySelectorAll("text[font-family]"))) {
|
|
320
320
|
const r = (i.getAttribute("font-family") ?? "").split(",")[0].trim().replace(/^['"]|['"]$/g, ""), c = i.getAttribute("font-weight") ?? "400";
|
|
321
|
-
if (!Object.values(
|
|
321
|
+
if (!Object.values(Re).some((d) => d.family === r && String(d.weight) === c))
|
|
322
322
|
throw new Error("Runtime SVG requested an unknown bundled font face.");
|
|
323
323
|
t.set(`${r}:${c}`, { family: r, weight: c });
|
|
324
324
|
}
|
|
@@ -330,7 +330,7 @@ function wt(n, t) {
|
|
|
330
330
|
const c = r.textContent ?? "";
|
|
331
331
|
for (const [, d] of c.matchAll(/@font-face\s*\{([^{}]{1,200000})\}/g)) {
|
|
332
332
|
const m = /font-family\s*:\s*['"]([^'"]+)['"]/i.exec(d)?.[1], s = /font-weight\s*:\s*(\d{1,4})/i.exec(d)?.[1], f = /src\s*:\s*url\((data:font\/woff2;base64,[A-Za-z0-9+/=]+)\)/i.exec(d)?.[1];
|
|
333
|
-
!m || !s || !f || Object.values(
|
|
333
|
+
!m || !s || !f || Object.values(Re).some((g) => g.family === m && String(g.weight) === s) && i.set(`${m}:${s}`, { family: m, weight: s, data: f });
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
return t.map((r) => {
|
|
@@ -450,7 +450,7 @@ function bt(n, t = {}) {
|
|
|
450
450
|
}, z = (e, a, o) => {
|
|
451
451
|
const v = { ...e, zoom: ye(e.zoom) };
|
|
452
452
|
return re = o, Ke(E, v) ? "unchanged" : (E = v, ne(), S(a), "moved");
|
|
453
|
-
},
|
|
453
|
+
}, O = () => {
|
|
454
454
|
const [e, a, o, v] = k.viewBox;
|
|
455
455
|
return { x: e, y: a, width: o, height: v };
|
|
456
456
|
};
|
|
@@ -458,7 +458,7 @@ function bt(n, t = {}) {
|
|
|
458
458
|
const B = (e) => N ? Ne(N, e) : void 0;
|
|
459
459
|
let D;
|
|
460
460
|
const $ = (e) => L ? "unchanged" : !k || !Y.width || !Y.height ? (D = e, "pending") : (D = void 0, e()), I = (e, a, o) => $(() => {
|
|
461
|
-
const v = e ? Ge(e.flatMap((A) => B(A) ?? [])) :
|
|
461
|
+
const v = e ? Ge(e.flatMap((A) => B(A) ?? [])) : O();
|
|
462
462
|
return v ? z(Ie(v, Y, a), o, !!e) : "missing";
|
|
463
463
|
}), Q = (e = "fit") => I(void 0, void 0, e), Z = (e) => z({ ...E, zoom: E.zoom * e }, "user", !0), ue = () => z({ ...E, zoom: 1 }, "user", !0);
|
|
464
464
|
U("Zoom in", () => Z(1.2)), U("Zoom out", () => Z(1 / 1.2)), U("Fit diagram", () => Q()), U("Actual size", ue), m.hidden = t.toolbar === !1;
|
|
@@ -501,7 +501,7 @@ function bt(n, t = {}) {
|
|
|
501
501
|
}, Ce = async (e, a, o) => {
|
|
502
502
|
const v = t.execution ?? { mode: "worker" };
|
|
503
503
|
if (v.mode === "main") {
|
|
504
|
-
const { renderSvg: A } = await import("./render-
|
|
504
|
+
const { renderSvg: A } = await import("./render-DU-eRw6k.js");
|
|
505
505
|
return A(e, { ...a, signal: o });
|
|
506
506
|
}
|
|
507
507
|
return ct(e, a, {
|
|
@@ -510,7 +510,7 @@ function bt(n, t = {}) {
|
|
|
510
510
|
signal: o
|
|
511
511
|
});
|
|
512
512
|
};
|
|
513
|
-
let
|
|
513
|
+
let R;
|
|
514
514
|
const qe = (e) => {
|
|
515
515
|
const a = s.querySelector("svg"), o = a?.querySelector(":scope > rect");
|
|
516
516
|
return e === s || e === a || e === o;
|
|
@@ -522,7 +522,7 @@ function bt(n, t = {}) {
|
|
|
522
522
|
},
|
|
523
523
|
{ passive: !1 }
|
|
524
524
|
), s.addEventListener("pointerdown", (e) => {
|
|
525
|
-
!qe(e.target) || !k || (
|
|
525
|
+
!qe(e.target) || !k || (R = {
|
|
526
526
|
pointerId: e.pointerId,
|
|
527
527
|
x: e.clientX,
|
|
528
528
|
y: e.clientY,
|
|
@@ -531,10 +531,10 @@ function bt(n, t = {}) {
|
|
|
531
531
|
scale: E.zoom
|
|
532
532
|
}, s.setPointerCapture(e.pointerId));
|
|
533
533
|
}), s.addEventListener("pointermove", (e) => {
|
|
534
|
-
|
|
534
|
+
R && z(
|
|
535
535
|
{
|
|
536
|
-
centerX:
|
|
537
|
-
centerY:
|
|
536
|
+
centerX: R.centerX - (e.clientX - R.x) / R.scale,
|
|
537
|
+
centerY: R.centerY - (e.clientY - R.y) / R.scale,
|
|
538
538
|
zoom: E.zoom
|
|
539
539
|
},
|
|
540
540
|
"user",
|
|
@@ -542,12 +542,12 @@ function bt(n, t = {}) {
|
|
|
542
542
|
);
|
|
543
543
|
});
|
|
544
544
|
const be = () => {
|
|
545
|
-
if (
|
|
545
|
+
if (R) {
|
|
546
546
|
try {
|
|
547
|
-
s.releasePointerCapture(
|
|
547
|
+
s.releasePointerCapture(R.pointerId);
|
|
548
548
|
} catch {
|
|
549
549
|
}
|
|
550
|
-
|
|
550
|
+
R = void 0;
|
|
551
551
|
}
|
|
552
552
|
};
|
|
553
553
|
s.addEventListener("pointerup", be), s.addEventListener("pointercancel", be), s.addEventListener("click", (e) => {
|
|
@@ -781,12 +781,12 @@ function bt(n, t = {}) {
|
|
|
781
781
|
},
|
|
782
782
|
destroy() {
|
|
783
783
|
if (!L) {
|
|
784
|
-
if (L = !0, x.stop(), P++, D = void 0, M && (c.cancelAnimationFrame ?? c.clearTimeout)(M),
|
|
784
|
+
if (L = !0, x.stop(), P++, D = void 0, M && (c.cancelAnimationFrame ?? c.clearTimeout)(M), R) {
|
|
785
785
|
try {
|
|
786
|
-
s.releasePointerCapture(
|
|
786
|
+
s.releasePointerCapture(R.pointerId);
|
|
787
787
|
} catch {
|
|
788
788
|
}
|
|
789
|
-
|
|
789
|
+
R = void 0;
|
|
790
790
|
}
|
|
791
791
|
for (const [e, a] of J)
|
|
792
792
|
a.resolve({ status: "destroyed", revision: e });
|