@loadmap/react 0.36.0 → 0.37.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/{Loadmap-CqMtEnju.d.ts → Loadmap-BMlU1-mr.d.ts} +21 -1
- package/dist/{Loadmap-DeE-vrG_.js → Loadmap-DbAbcbNc.js} +61 -15
- package/dist/frames-DjP2S7qS.js +88 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{later-XkpIfZ0O.js → later-DpL22rlH.js} +1 -1
- package/dist/source.d.ts +1 -1
- package/dist/source.js +1 -1
- package/dist/{zoom-B_Ux15iu.js → zoom-DGmIQ7aO.js} +71 -3
- package/package.json +5 -5
|
@@ -88,6 +88,16 @@ declare class Viewer {
|
|
|
88
88
|
* all. Nothing when they show already: a view the reader never moved shows the whole diagram.
|
|
89
89
|
*/
|
|
90
90
|
show(ids: readonly string[]): void;
|
|
91
|
+
/**
|
|
92
|
+
* Flies in to this part of the scene, as close as it fits the board: a subsystem's frame, from a click on it or on
|
|
93
|
+
* the path over the board. `id` names it: while the view stays where the flight ends, the path ends there.
|
|
94
|
+
*/
|
|
95
|
+
enter(r: Rect, id?: string): void;
|
|
96
|
+
/** The frame the view last flew in to, and where it went. */
|
|
97
|
+
entered: {
|
|
98
|
+
id: string;
|
|
99
|
+
at: Viewpoint;
|
|
100
|
+
} | null;
|
|
91
101
|
/** The part of the scene the board shows now: its viewBox. */
|
|
92
102
|
box(): Rect | null;
|
|
93
103
|
/** Where the board draws the scene now, in its pixels: its scale and offset. */
|
|
@@ -324,6 +334,12 @@ interface LoadmapOptions<P> extends SimOptions {
|
|
|
324
334
|
* page of its own zooms with the wheel alone. Pictures and recordings show the whole diagram whatever the view.
|
|
325
335
|
*/
|
|
326
336
|
zoom?: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* The subsystems drawn closed at first, each as one box that stands for everything inside it, by the ids the view
|
|
339
|
+
* gives them. The reader opens one with a click on it and closes one with a click on its name; a story step says
|
|
340
|
+
* its own (`closed` in the step). Default none.
|
|
341
|
+
*/
|
|
342
|
+
closed?: readonly string[];
|
|
327
343
|
/**
|
|
328
344
|
* Seconds the diagram takes to move to a new structure (a scenario, a story step or a control that adds pods): what
|
|
329
345
|
* stays moves, what is new fades in. 0 cuts. Default 0.8; with reduced motion it always cuts. The load never moves it.
|
|
@@ -349,6 +365,10 @@ interface LoadmapController<P = any> {
|
|
|
349
365
|
setStep: (i: number | null) => void;
|
|
350
366
|
/** The component the story points at now. */
|
|
351
367
|
focus: string | null;
|
|
368
|
+
/** The subsystems drawn closed now. */
|
|
369
|
+
closed: readonly string[];
|
|
370
|
+
/** Draws these subsystems closed, and every other one open. */
|
|
371
|
+
setClosed: (ids: readonly string[]) => void;
|
|
352
372
|
/**
|
|
353
373
|
* The story plays: the whole diagram, then for each step a close-up on what it changes, the change, and the whole
|
|
354
374
|
* diagram again for its seconds, until the last.
|
|
@@ -383,7 +403,7 @@ interface LoadmapController<P = any> {
|
|
|
383
403
|
root: HTMLElement | null;
|
|
384
404
|
}
|
|
385
405
|
/** The state behind a loadmap: values, the model's evaluation, the layout and the engine. */
|
|
386
|
-
declare function useLoadmap<P>(model: Model<P>,
|
|
406
|
+
declare function useLoadmap<P>(model: Model<P>, whole: View, o?: LoadmapOptions<P>): LoadmapController<P>;
|
|
387
407
|
/** `auto` follows the system's light or dark; `inherit` the page's own switch (`data-theme`, or a `dark` or `light` class, on `<html>`). */
|
|
388
408
|
type Theme = 'auto' | 'light' | 'dark' | 'inherit';
|
|
389
409
|
/**
|
|
@@ -3,7 +3,7 @@ import { capital, compact, duration, fmt, monthOf, multiple, multiples, pct, sec
|
|
|
3
3
|
import { anchor, directionOf, labelsAt, layout, legPath, localElk, pointAt, structureKey } from "@loadmap/layout";
|
|
4
4
|
import { Suspense, lazy, memo, useCallback, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { arrange, morph, shapesOf } from "@loadmap/layout/internal";
|
|
6
|
+
import { arrange, closing, morph, shapesOf } from "@loadmap/layout/internal";
|
|
7
7
|
import { createSim } from "@loadmap/sim";
|
|
8
8
|
// src/ranks.ts
|
|
9
9
|
/** Badges after the limit: the two next in line. */
|
|
@@ -98,6 +98,8 @@ const whole = (s) => ({
|
|
|
98
98
|
function boxComponent(ev, n) {
|
|
99
99
|
return n.stages.map((s) => ev.stages[s]?.component).find(Boolean) ?? n.component ?? void 0;
|
|
100
100
|
}
|
|
101
|
+
/** Whether a box stands for a component: its own, and for a closed subsystem's box every component inside. */
|
|
102
|
+
const showsComponent = (ev, n, c) => n.subsystem != null ? n.stages.some((s) => ev.stages[s]?.component === c) : boxComponent(ev, n) === c;
|
|
101
103
|
/**
|
|
102
104
|
* The boxes a step's change is about, from the values before (`a`) to the step's (`b`): the box it points at and any box
|
|
103
105
|
* the change reshapes; else the boxes it reshapes or an edge that comes or goes ends at; else those whose component
|
|
@@ -112,7 +114,7 @@ function targets(scene, a, b, shapes, focus) {
|
|
|
112
114
|
for (const e of [...shapes.a.edges, ...shapes.b.edges]) if (edgesA.has(e.id) !== edgesB.has(e.id)) {
|
|
113
115
|
for (const end of [e.from, e.to]) if (ids.has(end)) reshaped.add(end);
|
|
114
116
|
}
|
|
115
|
-
const of = (c) => scene.nodes.filter((n) => c &&
|
|
117
|
+
const of = (c) => scene.nodes.filter((n) => c && showsComponent(b, n, c)).map((n) => n.id);
|
|
116
118
|
const order = (s) => scene.nodes.filter((n) => s.has(n.id)).map((n) => n.id);
|
|
117
119
|
if (focus) return order(/* @__PURE__ */ new Set([...of(focus), ...reshaped]));
|
|
118
120
|
if (reshaped.size) return order(reshaped);
|
|
@@ -211,7 +213,16 @@ function stepDetail(a, b, components) {
|
|
|
211
213
|
}).filter(Boolean).join(" · ");
|
|
212
214
|
}
|
|
213
215
|
// src/Diagram.tsx
|
|
214
|
-
const Detail = lazy(() => import("./later-
|
|
216
|
+
const Detail = lazy(() => import("./later-DpL22rlH.js").then((m) => ({ default: m.Detail })));
|
|
217
|
+
/**
|
|
218
|
+
* What draws the subsystems (frames.tsx): their frames, and what a closed one's box says and does. It comes with the
|
|
219
|
+
* first view that has a subsystem, before that view is laid out, so a page without subsystems never loads it and a
|
|
220
|
+
* frame is never a moment late.
|
|
221
|
+
*/
|
|
222
|
+
let sub;
|
|
223
|
+
const loadFrames = async () => {
|
|
224
|
+
sub ??= await import("./frames-DjP2S7qS.js");
|
|
225
|
+
};
|
|
215
226
|
const STATE_STROKE = {
|
|
216
227
|
off: "var(--lm-line)",
|
|
217
228
|
ok: "var(--lm-ok)",
|
|
@@ -338,7 +349,7 @@ function Diagram({ lm, legend = true, onNodeClick, selected = null, canvas = fal
|
|
|
338
349
|
if (!zoom || !board) return;
|
|
339
350
|
let gone = false;
|
|
340
351
|
if (canvas) engine.expectRoom(true);
|
|
341
|
-
import("./zoom-
|
|
352
|
+
import("./zoom-DGmIQ7aO.js").then(({ mountZoom }) => {
|
|
342
353
|
if (!gone) zoomed.current = mountZoom(board, engine, () => shape.current);
|
|
343
354
|
}).catch(() => engine.expectRoom(false));
|
|
344
355
|
return () => {
|
|
@@ -609,6 +620,7 @@ const Structure = memo(function Structure({ lm, scene, hand, svgRef, rates, setT
|
|
|
609
620
|
const marker = useId().replace(/:/g, "");
|
|
610
621
|
const { labels, ev } = lm;
|
|
611
622
|
const stateOf = (n) => {
|
|
623
|
+
if (n.subsystem != null && sub) return sub.stateIn(ev, n);
|
|
612
624
|
const c = componentOf(lm, n);
|
|
613
625
|
return c ? ev.components[c]?.state ?? null : null;
|
|
614
626
|
};
|
|
@@ -616,6 +628,7 @@ const Structure = memo(function Structure({ lm, scene, hand, svgRef, rates, setT
|
|
|
616
628
|
const cid = componentOf(lm, n);
|
|
617
629
|
const c = cid ? ev.components[cid] : void 0;
|
|
618
630
|
const title = labels.nodes[n.id]?.title;
|
|
631
|
+
if (n.subsystem != null && sub) return sub.opener(lm, n.subsystem, title);
|
|
619
632
|
if (!c) {
|
|
620
633
|
if (!onClick) return {};
|
|
621
634
|
return {
|
|
@@ -669,13 +682,14 @@ const Structure = memo(function Structure({ lm, scene, hand, svgRef, rates, setT
|
|
|
669
682
|
const summary = scene.nodes.map((n) => labels.nodes[n.id]?.title).join(", ");
|
|
670
683
|
const ranks = rankLabels(ev, lm.model);
|
|
671
684
|
const staying = lm.scene && new Set(lm.scene.nodes.map((n) => n.id));
|
|
672
|
-
const boxes = (c) => scene.nodes.filter((n) =>
|
|
685
|
+
const boxes = (c) => scene.nodes.filter((n) => showsComponent(ev, n, c) && (!staying || staying.has(n.id)));
|
|
673
686
|
const first = ev.firstLimit;
|
|
674
687
|
const was = hand && hand.from !== first?.id && ev.components[hand.from] ? ev.components[hand.from] : null;
|
|
675
688
|
const wasBoxes = was ? boxes(was.id) : [];
|
|
676
689
|
const wasRank = was && ranks.get(was.id);
|
|
677
690
|
const note = was && (wasRank ? wasRank.text : `now ${multiple(edge(was), lm.model.searchMax)}`);
|
|
678
691
|
const lost = lostBoxes(lm, scene);
|
|
692
|
+
const worn = new Set(first && boxes(first.id));
|
|
679
693
|
return /* @__PURE__ */ jsxs("svg", {
|
|
680
694
|
ref: svgRef,
|
|
681
695
|
viewBox: `0 0 ${scene.width} ${scene.height}`,
|
|
@@ -700,6 +714,11 @@ const Structure = memo(function Structure({ lm, scene, hand, svgRef, rates, setT
|
|
|
700
714
|
i,
|
|
701
715
|
striped: lm.view.def.lanes === "striped"
|
|
702
716
|
}, t.id)),
|
|
717
|
+
sub && scene.subsystems.length > 0 && /* @__PURE__ */ jsx(sub.Frames, {
|
|
718
|
+
scene,
|
|
719
|
+
stateOf,
|
|
720
|
+
lm
|
|
721
|
+
}),
|
|
703
722
|
rates && /* @__PURE__ */ jsx(RateStrokes, {
|
|
704
723
|
lm,
|
|
705
724
|
scene
|
|
@@ -716,7 +735,7 @@ const Structure = memo(function Structure({ lm, scene, hand, svgRef, rates, setT
|
|
|
716
735
|
title: labels.nodes[n.id]?.title,
|
|
717
736
|
sub: labels.nodes[n.id]?.sub,
|
|
718
737
|
lm,
|
|
719
|
-
focused: !!lm.focus &&
|
|
738
|
+
focused: !!lm.focus && showsComponent(ev, n, lm.focus),
|
|
720
739
|
selected: selected === n.id,
|
|
721
740
|
handlers: handlers(n)
|
|
722
741
|
}, n.id)),
|
|
@@ -732,8 +751,10 @@ const Structure = memo(function Structure({ lm, scene, hand, svgRef, rates, setT
|
|
|
732
751
|
tag: i ? void 0 : ranks.get(first.id)?.text
|
|
733
752
|
}, n.id)),
|
|
734
753
|
[...ranks].map(([c, r]) => {
|
|
735
|
-
const n = r.rank > 1 && c !== was?.id ? boxes(c)
|
|
736
|
-
|
|
754
|
+
const n = r.rank > 1 && c !== was?.id ? boxes(c).find((x) => !worn.has(x)) : void 0;
|
|
755
|
+
if (!n) return null;
|
|
756
|
+
worn.add(n);
|
|
757
|
+
return /* @__PURE__ */ jsx(Badge, {
|
|
737
758
|
n,
|
|
738
759
|
text: r.text
|
|
739
760
|
}, c);
|
|
@@ -819,7 +840,7 @@ function Tier({ t, i, striped }) {
|
|
|
819
840
|
const pathOf = (pts) => pts.map(([x, y], i) => `${i ? "L" : "M"}${x} ${y}`).join(" ");
|
|
820
841
|
/** The lost boxes: their look, and the edges into them, say that what goes there is lost. */
|
|
821
842
|
function lostBoxes(lm, scene) {
|
|
822
|
-
return new Set(scene.nodes.filter((n) => n.stages.some((s) => lm.ev.stages[s]?.kind === "lost")).map((n) => n.id));
|
|
843
|
+
return new Set(scene.nodes.filter((n) => n.subsystem == null && n.stages.some((s) => lm.ev.stages[s]?.kind === "lost")).map((n) => n.id));
|
|
823
844
|
}
|
|
824
845
|
function Edge({ e, text, marker, lost }) {
|
|
825
846
|
const drawing = e.draw != null && e.draw < 1;
|
|
@@ -3553,7 +3574,24 @@ const DUE = {
|
|
|
3553
3574
|
h: 0
|
|
3554
3575
|
};
|
|
3555
3576
|
/** The state behind a loadmap: values, the model's evaluation, the layout and the engine. */
|
|
3556
|
-
function useLoadmap(model,
|
|
3577
|
+
function useLoadmap(model, whole, o = {}) {
|
|
3578
|
+
const [shut, setShut] = useState(null);
|
|
3579
|
+
const closed = shut?.view === whole ? shut.ids : o.closed ?? [];
|
|
3580
|
+
const [close, setClose] = useState(null);
|
|
3581
|
+
useEffect(() => {
|
|
3582
|
+
let live = true;
|
|
3583
|
+
const loading = closing(whole);
|
|
3584
|
+
if (loading) Promise.all([loading, loadFrames()]).then(([f]) => live && setClose(() => f), (err) => console.error("loadmap: layout failed", err));
|
|
3585
|
+
return () => {
|
|
3586
|
+
live = false;
|
|
3587
|
+
};
|
|
3588
|
+
}, [whole]);
|
|
3589
|
+
const unready = !close && Object.keys(whole.def.subsystems ?? {}).length > 0;
|
|
3590
|
+
const view = close && closed.length ? close(whole, closed) : whole;
|
|
3591
|
+
const setClosed = useCallback((ids) => setShut({
|
|
3592
|
+
view: whole,
|
|
3593
|
+
ids
|
|
3594
|
+
}), [whole]);
|
|
3557
3595
|
const init = () => ({
|
|
3558
3596
|
...model.defaults(),
|
|
3559
3597
|
...o.initial
|
|
@@ -3578,7 +3616,8 @@ function useLoadmap(model, view, o = {}) {
|
|
|
3578
3616
|
engineRef.current ??= new Engine(model, view, ev, o);
|
|
3579
3617
|
const engine = engineRef.current;
|
|
3580
3618
|
useLayoutEffect(() => {
|
|
3581
|
-
if (engine.model !== model
|
|
3619
|
+
if (engine.model !== model) engine.setModel(model, view, evaluated.current?.ev ?? ev, o);
|
|
3620
|
+
else engine.view = view;
|
|
3582
3621
|
});
|
|
3583
3622
|
engine.transition = o.transition ?? .8;
|
|
3584
3623
|
const [root, setRoot] = useState(null);
|
|
@@ -3663,7 +3702,7 @@ function useLoadmap(model, view, o = {}) {
|
|
|
3663
3702
|
elk
|
|
3664
3703
|
]);
|
|
3665
3704
|
const pending = due || chooses && (picked?.view !== view || picked.among !== among);
|
|
3666
|
-
const waits = due || chooses && !picked;
|
|
3705
|
+
const waits = due || unready || chooses && !picked;
|
|
3667
3706
|
const chosen = chooses ? picked : null;
|
|
3668
3707
|
const direction = held ?? chosen?.direction ?? shape;
|
|
3669
3708
|
const rows = fixed ?? (chosen && chosen.direction === direction ? chosen.rows : 1);
|
|
@@ -3757,10 +3796,15 @@ function useLoadmap(model, view, o = {}) {
|
|
|
3757
3796
|
model,
|
|
3758
3797
|
i: st ? i : null
|
|
3759
3798
|
});
|
|
3799
|
+
setShut(st?.closed ? {
|
|
3800
|
+
view: whole,
|
|
3801
|
+
ids: st.closed
|
|
3802
|
+
} : null);
|
|
3760
3803
|
}, [
|
|
3761
3804
|
model,
|
|
3762
3805
|
apply,
|
|
3763
|
-
engine
|
|
3806
|
+
engine,
|
|
3807
|
+
whole
|
|
3764
3808
|
]);
|
|
3765
3809
|
const setStep = useCallback((i) => {
|
|
3766
3810
|
stop();
|
|
@@ -3893,6 +3937,8 @@ function useLoadmap(model, view, o = {}) {
|
|
|
3893
3937
|
stepChanged,
|
|
3894
3938
|
setStep,
|
|
3895
3939
|
focus,
|
|
3940
|
+
closed,
|
|
3941
|
+
setClosed,
|
|
3896
3942
|
storyPlaying,
|
|
3897
3943
|
setStoryPlaying,
|
|
3898
3944
|
cue: storyPlaying ? cue : null,
|
|
@@ -3933,8 +3979,8 @@ function canvasMeasure(fontFamily) {
|
|
|
3933
3979
|
};
|
|
3934
3980
|
}
|
|
3935
3981
|
// src/Loadmap.tsx
|
|
3936
|
-
const Dock = lazy(() => import("./later-
|
|
3937
|
-
const VerdictLine = lazy(() => import("./later-
|
|
3982
|
+
const Dock = lazy(() => import("./later-DpL22rlH.js").then((m) => ({ default: m.Dock })));
|
|
3983
|
+
const VerdictLine = lazy(() => import("./later-DpL22rlH.js").then((m) => ({ default: m.VerdictLine })));
|
|
3938
3984
|
/** What the page's own switch says, on `<html>`: `data-theme`, or a `dark` or `light` class; null when it says nothing. */
|
|
3939
3985
|
function pageTheme() {
|
|
3940
3986
|
if (typeof document === "undefined") return null;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
// src/frames.tsx
|
|
3
|
+
/** Enter or Space presses what a click does. */
|
|
4
|
+
const pressed = (press) => (e) => {
|
|
5
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
6
|
+
e.preventDefault();
|
|
7
|
+
press();
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const past = (states) => states.includes("over") ? "over" : states.includes("warn") ? "warn" : void 0;
|
|
11
|
+
/**
|
|
12
|
+
* The subsystems' frames behind the boxes and edges: a tint that lets a lane show through and deepens where a frame
|
|
13
|
+
* stands in another, its name at its top (up its left side running down, as a tier's), and its line in the colour of
|
|
14
|
+
* the worst box inside once one is past its target. The name is a button that closes the subsystem into one box; on
|
|
15
|
+
* a board that zooms, the frame is one that flies in to it (the path to where the view is shows with the zoom's
|
|
16
|
+
* buttons, zoom.tsx).
|
|
17
|
+
* Paint goes in attributes, as a tier's does: export resolves the tokens in them.
|
|
18
|
+
*/
|
|
19
|
+
function Frames({ scene, stateOf, lm }) {
|
|
20
|
+
return scene.subsystems.map((s) => {
|
|
21
|
+
const state = past(scene.nodes.filter((n) => s.nodes.includes(n.id)).map(stateOf));
|
|
22
|
+
const { x, y, size, weight } = s.title;
|
|
23
|
+
const close = () => lm.setClosed([...lm.closed, s.id]);
|
|
24
|
+
const enter = () => lm.engine.viewer?.enter(s, s.id);
|
|
25
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
26
|
+
"data-subsystem-id": s.id,
|
|
27
|
+
"data-state": state,
|
|
28
|
+
opacity: s.fade,
|
|
29
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
30
|
+
...lm.zoom && {
|
|
31
|
+
role: "button",
|
|
32
|
+
tabIndex: 0,
|
|
33
|
+
"aria-label": `${s.label}: fly in to it`,
|
|
34
|
+
onClick: enter,
|
|
35
|
+
onKeyDown: pressed(enter)
|
|
36
|
+
},
|
|
37
|
+
x: s.x,
|
|
38
|
+
y: s.y,
|
|
39
|
+
width: s.w,
|
|
40
|
+
height: s.h,
|
|
41
|
+
rx: 10,
|
|
42
|
+
fill: "var(--lm-muted)",
|
|
43
|
+
fillOpacity: .07,
|
|
44
|
+
stroke: state ? `var(--lm-${state === "over" ? "drop" : "warn"})` : "var(--lm-line)",
|
|
45
|
+
strokeWidth: state ? 1.5 : 1
|
|
46
|
+
}), /* @__PURE__ */ jsx("text", {
|
|
47
|
+
role: "button",
|
|
48
|
+
tabIndex: 0,
|
|
49
|
+
"aria-label": `${s.label}: open. Close it into one box`,
|
|
50
|
+
"aria-expanded": true,
|
|
51
|
+
onClick: close,
|
|
52
|
+
onKeyDown: pressed(close),
|
|
53
|
+
x,
|
|
54
|
+
y,
|
|
55
|
+
fontSize: size,
|
|
56
|
+
fontWeight: weight,
|
|
57
|
+
fill: "var(--lm-muted)",
|
|
58
|
+
textAnchor: s.vertical ? "end" : void 0,
|
|
59
|
+
transform: s.vertical ? `rotate(-90 ${x} ${y})` : void 0,
|
|
60
|
+
children: `${OPEN} ${s.label}`
|
|
61
|
+
})]
|
|
62
|
+
}, s.id);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** What a frame's name starts with, and a closed subsystem's box: the same marks a folder tree uses. */
|
|
66
|
+
const OPEN = "▾";
|
|
67
|
+
/** The state of the worst component inside a closed subsystem's box: what its outline says. */
|
|
68
|
+
function stateIn(ev, n) {
|
|
69
|
+
const states = n.stages.map((s) => {
|
|
70
|
+
const c = ev.stages[s]?.component;
|
|
71
|
+
return c ? ev.components[c]?.state ?? null : null;
|
|
72
|
+
});
|
|
73
|
+
return past(states) ?? (states.includes("ok") ? "ok" : states.includes("off") ? "off" : null);
|
|
74
|
+
}
|
|
75
|
+
/** A closed subsystem's box is a button that opens it; one closed inside it stays closed. */
|
|
76
|
+
function opener(lm, id, title = id) {
|
|
77
|
+
const open = () => lm.setClosed(lm.closed.filter((c) => c !== id));
|
|
78
|
+
return {
|
|
79
|
+
tabIndex: 0,
|
|
80
|
+
role: "button",
|
|
81
|
+
className: "lm-node",
|
|
82
|
+
"aria-label": `${title}: closed. Open it`,
|
|
83
|
+
"aria-expanded": false,
|
|
84
|
+
onClick: open,
|
|
85
|
+
onKeyDown: pressed(open)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export { Frames, opener, stateIn };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as Insets, a as LoadmapProps, c as handleOf, d as LoadmapController, f as LoadmapOptions, g as Engine, h as Dot, i as LoadmapPanel, l as usePageTheme, m as Cue, n as Loadmap, o as LoadmapRoot, p as useLoadmap, r as LoadmapHandle, s as Theme, t as LOADMAP_PANELS, u as FullScreenMode } from "./Loadmap-
|
|
1
|
+
import { _ as Insets, a as LoadmapProps, c as handleOf, d as LoadmapController, f as LoadmapOptions, g as Engine, h as Dot, i as LoadmapPanel, l as usePageTheme, m as Cue, n as Loadmap, o as LoadmapRoot, p as useLoadmap, r as LoadmapHandle, s as Theme, t as LOADMAP_PANELS, u as FullScreenMode } from "./Loadmap-BMlU1-mr.js";
|
|
2
2
|
import { Comparison, Model } from "@loadmap/core";
|
|
3
3
|
import { fitLinear } from "@loadmap/core/calibrate";
|
|
4
4
|
import { compact, fmt, multiple, pct, secs } from "@loadmap/core/format";
|
|
5
5
|
import { MEASURES, fromSnapshot, originText, parseSnapshot, summarize } from "@loadmap/core/measure";
|
|
6
|
-
import { AnyNodeDef, ClusterDef, EdgeDef, ElkEngine, ElkEngine as ElkEngine$1, FlowColor, FlowView, Label, NodeDef, PoolDef, TierDef, View, ViewDef, cluster, defineView, directionOf, edge, node, pool } from "@loadmap/layout";
|
|
6
|
+
import { AnyNodeDef, ClusterDef, EdgeDef, ElkEngine, ElkEngine as ElkEngine$1, FlowColor, FlowView, Label, NodeDef, PoolDef, SubsystemDef, TierDef, View, ViewDef, cluster, defineView, directionOf, edge, node, pool } from "@loadmap/layout";
|
|
7
7
|
import { ReactNode } from "react";
|
|
8
8
|
export * from "@loadmap/core";
|
|
9
9
|
/** The architecture: SVG for the structure, a canvas on top for the dots. Expands to full screen. */
|
|
@@ -115,4 +115,4 @@ export declare function Story({ lm }: {
|
|
|
115
115
|
export declare const LOADMAP_CSS = "\n.lm { \n --lm-bg: #eef2f5; --lm-surface: #ffffff; --lm-fg: #17212b; --lm-muted: #5d6d7c; --lm-line: #c6d0da;\n --lm-accent: #0b6b8f; --lm-accent-soft: #d6e9f0; --lm-alt: #7a4f9a; --lm-alt-soft: #efe5f6;\n --lm-ok: #2a7f5a; --lm-warn: #b86e00; --lm-drop: #b7392e; --lm-lane: #e3e9ee;\n --lm-lost-fill: #fbefed; --lm-lost-line: #b7392e;\n --lm-tier-base: #f4f7fa; --lm-tier: #e8eef3; --lm-tier-head: #dbe3eb; --lm-tier-fg: #34424f; --lm-tier-line: #c6d0da;\n --lm-s1: #2a78d6; --lm-s2: #eb6834; --lm-s3: #6250d6; --lm-s4: #eda100; color-scheme: light;\n --lm-font: ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n --lm-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font: 14px/1.45 var(--lm-font); color: var(--lm-fg); background: var(--lm-root-bg, var(--lm-bg));\n display: grid; gap: 14px; padding: var(--lm-pad, 16px); min-width: 0; box-sizing: border-box; }\n@media (prefers-color-scheme: dark) { .lm:not([data-theme=\"light\"]) { \n --lm-bg: #0d141b; --lm-surface: #151e27; --lm-fg: #e4ebf1; --lm-muted: #93a3b3; --lm-line: #2a3744;\n --lm-accent: #5fb7d6; --lm-accent-soft: #163442; --lm-alt: #c39be0; --lm-alt-soft: #2b2236;\n --lm-ok: #5fc08f; --lm-warn: #e2a24a; --lm-drop: #e26a5c; --lm-lane: #1b2631;\n --lm-lost-fill: #2b1c1d; --lm-lost-line: #e26a5c;\n --lm-tier-base: #1b2530; --lm-tier: #24323f; --lm-tier-head: #2c3b4a; --lm-tier-fg: #c3cfda; --lm-tier-line: #33424f;\n --lm-s1: #3987e5; --lm-s2: #d95926; --lm-s3: #9085e9; --lm-s4: #c98500; color-scheme: dark; } }\n.lm[data-theme=\"dark\"] { \n --lm-bg: #0d141b; --lm-surface: #151e27; --lm-fg: #e4ebf1; --lm-muted: #93a3b3; --lm-line: #2a3744;\n --lm-accent: #5fb7d6; --lm-accent-soft: #163442; --lm-alt: #c39be0; --lm-alt-soft: #2b2236;\n --lm-ok: #5fc08f; --lm-warn: #e2a24a; --lm-drop: #e26a5c; --lm-lane: #1b2631;\n --lm-lost-fill: #2b1c1d; --lm-lost-line: #e26a5c;\n --lm-tier-base: #1b2530; --lm-tier: #24323f; --lm-tier-head: #2c3b4a; --lm-tier-fg: #c3cfda; --lm-tier-line: #33424f;\n --lm-s1: #3987e5; --lm-s2: #d95926; --lm-s3: #9085e9; --lm-s4: #c98500; color-scheme: dark; }\n.lm *, .lm *::before, .lm *::after { box-sizing: border-box; }\n.lm h2 { font-size: 1.3rem; font-weight: 600; margin: 0; text-wrap: balance; }\n.lm h3 { font: 600 .74rem var(--lm-font); text-transform: uppercase; letter-spacing: .08em; color: var(--lm-muted); margin: 0; }\n.lm button:focus-visible, .lm input:focus-visible, .lm select:focus-visible { outline: 2px solid var(--lm-accent); outline-offset: 2px; }\n.lm-problems { margin: 0; padding: 10px 12px; font: .8rem/1.5 var(--lm-mono); white-space: pre-wrap; overflow-x: auto; color: var(--lm-fg); background: var(--lm-surface); border: 1px solid var(--lm-line); border-left: 3px solid var(--lm-drop); border-radius: 6px; }\n.lm-note { margin: 0; font-size: .8rem; color: var(--lm-muted); }\n.lm-card { background: var(--lm-surface); border: 1px solid var(--lm-line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }\n\n.lm-wrap { display: grid; gap: 8px; min-width: 0; position: relative; }\n.lm-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }\n.lm-btn { font: 500 .8rem var(--lm-font); color: var(--lm-fg); background: var(--lm-surface); border: 1px solid var(--lm-line); border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }\n.lm-board { position: relative; background: var(--lm-surface); border: 1px solid var(--lm-line); border-radius: 8px; overflow: hidden; margin: 0 auto; width: 100%; }\n.lm-board svg { display: block; width: 100%; height: auto; font-family: var(--lm-font); }\n.lm-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }\n/* the story's title over the board while it plays: a lower third, at the top when what is framed is low; a strip\n across the top of a narrow board */\n.lm-title { position: absolute; left: 12px; bottom: 12px; z-index: 1; display: grid; gap: 1px; max-width: min(34rem, calc(100% - 24px)); padding: 7px 12px 8px; border-left: 4px solid var(--lm-accent); border-radius: 0 6px 6px 0; background: color-mix(in srgb, var(--lm-surface) 92%, transparent); box-shadow: 0 4px 16px rgb(0 0 0 / .12); pointer-events: none; overflow-wrap: anywhere; }\n.lm-title[data-top] { top: 12px; bottom: auto; }\n.lm-title b { font-size: .95rem; font-weight: 600; }\n.lm-title span { font: 500 .8rem var(--lm-mono); color: var(--lm-muted); }\n@container (max-width: 520px) {\n .lm-title, .lm-title[data-top] { top: 0; right: 0; bottom: auto; left: 0; max-width: none; padding: 4px 8px; border-radius: 0; box-shadow: none; }\n .lm-title b { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .lm-title span { display: none; }\n}\n.lm-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .78rem; color: var(--lm-muted); }\n.lm-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; margin-right: 5px; }\n.lm-legend i.lm-legend-merge { box-sizing: border-box; border: 1.5px solid var(--lm-muted); }\n\n/* full screen (the browser's, or a fixed overlay): a column that never scrolls. The diagram as wide as the screen on\n top; under it the verdict in a line and the panels, compact, in a dock the screen sizes. The load changes what is\n in them, never their size, so it never moves the board. Focus: the diagram, the story, the verdict and the load */\n.lm-side, .lm-card > .lm-panel { display: contents; }\n.lm-panel { display: grid; gap: 14px; min-width: 0; }\n.lm[data-full] { height: 100vh; height: 100dvh; padding: 16px; background: var(--lm-bg); overflow: hidden; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; position: relative; }\n.lm[data-full=\"fill\"] { height: 100%; padding: 10px; }\n.lm[data-full=\"overlay\"] { position: fixed; inset: 0; z-index: 2147483000; width: auto; max-width: none; max-height: none; margin: 0; border: 0; }\n.lm[data-full] > * { flex: none; }\n/* a page of its own keeps the rest outside full screen, as <Loadmap> does */\n.lm[data-full] > :not(.lm-head, h2, .lm-scenarios, .lm-loadbar, .lm-story, .lm-wrap, .lm-line, .lm-dock, .lm-side) { display: none; }\n.lm-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; min-width: 0; }\n.lm-head h2 { font-size: 1.1rem; }\n.lm-head .lm-loadbar { flex: 1 1 520px; }\n.lm[data-full] .lm-wrap { gap: 6px; }\n/* the board as large as fits (--lm-fit, from Diagram), left under the bar, so the legend starts where the board does */\n.lm[data-full] .lm-board { width: var(--lm-fit, 100%); margin: 0; align-self: start; justify-self: start; }\n.lm-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }\n.lm-modes { display: inline-flex; margin: 0; padding: 0; min-width: 0; border: 1px solid var(--lm-line); border-radius: 6px; overflow: hidden; }\n.lm-modes button { font: 500 .8rem var(--lm-font); color: var(--lm-fg); background: var(--lm-surface); border: 0; padding: 6px 12px; cursor: pointer; }\n.lm-modes button[aria-pressed=\"true\"] { background: var(--lm-fg); color: var(--lm-surface); }\n.lm[data-full] .lm-story { padding: 6px 12px; }\n.lm[data-full] [data-out] { display: none; }\n\n.lm-line { display: flex; align-items: center; gap: 6px 14px; min-width: 0; padding: 6px 12px; border-left: 4px solid var(--lm-ok); background: var(--lm-accent-soft); border-radius: 0 6px 6px 0; }\n.lm-line[data-tier=\"warn\"] { border-color: var(--lm-warn); }\n.lm-line[data-tier=\"over\"] { border-color: var(--lm-drop); }\n.lm-headline { flex: 1 1 auto; min-width: 0; margin: 0; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.lm-num { font: 600 .95em var(--lm-mono); font-variant-numeric: tabular-nums; }\n.lm-link { font: 500 .8rem var(--lm-font); color: var(--lm-accent); background: none; border: 0; padding: 2px 4px; cursor: pointer; white-space: nowrap; }\n\n.lm-dock { display: flex; gap: 10px; min-width: 0; }\n.lm[data-full] > .lm-dock { flex: 1 1 0; min-height: clamp(200px, 26dvh, 340px); }\n.lm-tabs { display: none; margin: 0; padding: 0; border: 0; min-width: 0; }\n.lm-mini { position: relative; flex: 1 1 0; min-width: 0; min-height: 0; display: grid; container-type: inline-size; }\n.lm-mini[data-mini=\"controls\"] { flex-grow: 1.25; }\n.lm-mini[data-mini=\"limits\"] { flex-grow: 1.45; }\n.lm-mini[data-mini=\"live\"] { flex-grow: .8; }\n.lm-mini[data-mini=\"headroom\"] { flex-grow: .9; }\n.lm-mini[data-mini=\"compare\"] { flex-grow: 1.3; }\n.lm-mini > .lm-card { min-height: 0; overflow: hidden; padding: 10px 12px; gap: 6px; align-content: start; }\n.lm-mini [data-clip] { visibility: hidden; }\n.lm-more { position: absolute; top: 6px; right: 6px; font: 500 .8rem var(--lm-font); color: var(--lm-accent); background: var(--lm-surface); border: 0; border-radius: 4px; padding: 2px 6px; cursor: pointer; }\n.lm-more[data-more]:not([data-more=\"\"])::before { content: attr(data-more) \" \"; }\n.lm-mini .lm-meters { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px; }\n.lm-mini .lm-meter { display: flex; align-items: baseline; gap: 8px; padding: 3px 8px; }\n.lm-mini .lm-meter b { flex: none; font-size: .9rem; }\n.lm-mini .lm-meter span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n/* one grid for every row, so the bars line up whatever the names */\n.lm-mini-limits { display: grid; grid-template-columns: minmax(0, max-content) minmax(48px, 1fr) auto auto; gap: 6px 10px; }\n.lm-mini-lim { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; font-size: .8rem; }\n.lm-mini-lim .lm-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.lm-mini-lim .lm-tag { margin-left: 5px; }\n.lm-mini-lim .lm-track { height: 9px; }\n.lm-mini-lim .lm-val { white-space: nowrap; }\n.lm-mini-lim .lm-sub { font: 400 .74rem var(--lm-mono); color: var(--lm-muted); }\n.lm-mini .lm-controls { gap: 6px; column-gap: 16px; }\n.lm-mini .lm-controls small, .lm-mini .lm-controls > h3:not(:first-child) { display: none; }\n.lm-mini .lm-controls label.lm-range { grid-template-columns: minmax(0, 1fr) minmax(90px, 1.2fr); align-items: center; gap: 10px; font-size: .8rem; }\n.lm-mini .lm-select { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: .8rem; }\n.lm-mini .lm-select select { width: auto; padding: 1px 6px; font-size: .78rem; }\n.lm-mini .lm-switch { font-size: .8rem; }\n.lm-mini .lm-switch input { margin-top: 2px; }\n.lm-mini .lm-presets { gap: 4px; }\n.lm-mini .lm-presets button { padding: 2px 8px; font-size: .72rem; }\n@container (min-width: 420px) {\n .lm-mini .lm-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }\n .lm-mini .lm-controls > :is(h3, .lm-presets) { grid-column: 1 / -1; }\n}\n.lm-mini .lm-compare > :not(h3:first-child, .lm-table-wrap:nth-child(3)) { display: none; }\n.lm-mini .lm-table { font-size: .76rem; }\n.lm-mini .lm-table th, .lm-mini .lm-table td { padding: 3px 8px 3px 0; }\n.lm-mini .lm-table small { display: none; }\n.lm-mini .lm-table thead th { white-space: nowrap; font-size: .6rem; }\n.lm-mini > .lm-card:has(> .lm-spark) { grid-template-rows: auto minmax(0, 1fr) auto; align-content: stretch; }\n.lm-spark { position: relative; min-height: 0; }\n.lm-spark svg { position: absolute; inset: 0; display: block; overflow: hidden; }\n.lm-spark-th { stroke: var(--lm-muted); stroke-dasharray: 4 3; }\n.lm-spark-load { stroke: var(--lm-fg); opacity: .45; }\n.lm-spark-text { margin: 0; font-size: .76rem; color: var(--lm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n\n/* the drawer: the page's own panel, alone, over the right of the board */\n.lm[data-full] > .lm-drawer:not([data-drawer]) { display: none; }\n.lm[data-full] > .lm-drawer[data-drawer] { display: grid; gap: 14px; align-content: start; position: absolute; top: 16px; right: 16px; bottom: 16px; z-index: 4; width: min(640px, calc(100% - 32px)); overflow: auto; overscroll-behavior: contain; padding: 14px; background: var(--lm-bg); border: 1px solid var(--lm-line); border-radius: 10px; box-shadow: -8px 0 30px rgb(0 0 0 / .2); container-type: inline-size; }\n.lm-side[data-drawer] :is(.lm-panel, .lm-strip, .lm-charts, .lm-card):not([data-drawn]):not(.lm-panel *) { display: none; }\n.lm-side[data-drawer] .lm-strip { grid-template-columns: minmax(0, 1fr); }\n.lm-drawer-bar { display: flex; justify-content: flex-end; }\n\n/* a page of its own: its .lm-side is a box under the board that scrolls on its own, the board as large as leaves it a\n third of the screen */\n.lm[data-full] > .lm-side:not(.lm-drawer) { display: grid; gap: 14px; align-content: start; flex: 1 1 0; min-height: 33dvh; overflow: auto; overscroll-behavior: contain; container-type: inline-size; }\n\n/* focus: the board and what runs on it in the middle of the screen */\n.lm[data-mode=\"focus\"] > .lm-side:not(.lm-drawer) { display: none; }\n.lm[data-mode=\"focus\"] > .lm-wrap { margin-top: auto; }\n.lm[data-mode=\"focus\"] > :is(.lm-story, .lm-line) { order: 1; }\n.lm[data-mode=\"focus\"]::after { content: \"\"; order: 2; margin-top: auto; }\n.lm[data-mode=\"focus\"] > .lm-story { border-left-width: 4px; padding: 10px 14px; }\n.lm[data-mode=\"focus\"] > .lm-story p { font-size: 1.1rem; }\n\n@media (max-width: 760px) {\n .lm[data-full] { padding: 10px; gap: 8px; }\n /* the page has the title, and the legend: here they would leave the diagram no room */\n .lm[data-full] > h2, .lm[data-full] :is(.lm-head h2, .lm-legend, .lm-story legend) { display: none; }\n /* the one exception: here the diagram runs top to bottom, and shrunk to the screen it is too small to read, so it\n pans in a box of its own with the bar on top. The page never scrolls */\n .lm[data-full] .lm-board { width: 100%; }\n .lm[data-full] > .lm-wrap { height: 40dvh; overflow: auto; row-gap: 0; overscroll-behavior: contain; }\n .lm[data-mode=\"focus\"] > .lm-wrap { height: auto; flex: 1 1 0; min-height: 0; margin-top: 0; }\n .lm[data-full] .lm-bar { position: sticky; top: 0; z-index: 1; padding-bottom: 8px; background: var(--lm-bg); }\n .lm[data-full] .lm-line { flex-wrap: wrap; }\n .lm[data-full] > .lm-story { padding: 6px 10px; gap: 6px 10px; }\n .lm[data-full] > .lm-story p { font-size: .84rem; }\n .lm[data-full] .lm-story button { padding: 4px 10px; }\n .lm[data-full] .lm-headline { flex-basis: 100%; }\n .lm-dock { flex-direction: column; min-height: 0; gap: 6px; }\n /* the load bar takes some of the dock's room: the load is no longer in a card */\n .lm[data-full] > .lm-dock { min-height: clamp(170px, 22dvh, 340px); }\n .lm-tabs { display: flex; flex: none; gap: 2px; border-bottom: 1px solid var(--lm-line); overflow: hidden; }\n .lm-tabs button { font: 500 .78rem var(--lm-font); color: var(--lm-muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 8px; cursor: pointer; white-space: nowrap; }\n .lm-tabs button[aria-pressed=\"true\"] { color: var(--lm-fg); border-color: var(--lm-fg); }\n .lm-mini:not([data-active]) { display: none; }\n .lm[data-full] > .lm-side[data-drawer] { inset: 8px; width: auto; }\n /* the load in thumb reach: the bar under the board and the story, over the verdict */\n .lm[data-full] .lm-head { display: contents; }\n .lm[data-full] .lm-loadbar { order: 2; flex: none; }\n /* two lines, so the board keeps its room: the scenarios and the load's value, then the track; the label names the\n slider unseen */\n .lm[data-full] .lm-load small { display: none; }\n .lm[data-full] .lm-load { display: contents; }\n .lm[data-full] :is(.lm-loadbar legend, .lm-load > label) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }\n .lm[data-full] .lm-load > output { margin-left: auto; }\n .lm[data-full] .lm-load-track { flex: 1 1 100%; }\n .lm[data-full] > :is(.lm-line, .lm-dock) { order: 3; }\n}\n\n.lm-verdict { margin: 0; padding: 10px 14px; border-left: 4px solid var(--lm-ok); background: var(--lm-accent-soft); border-radius: 0 6px 6px 0; }\n.lm-verdict[data-tier=\"warn\"] { border-color: var(--lm-warn); }\n.lm-verdict[data-tier=\"over\"] { border-color: var(--lm-drop); }\n.lm-measure { margin: 6px 0 0; padding: 0 14px; font-size: .86rem; color: var(--lm-muted); }\n\n.lm-strip { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 14px; align-items: start; }\n@container (max-width: 860px) { .lm-strip { grid-template-columns: minmax(0, 1fr); } }\n.lm { container-type: inline-size; }\n\n.lm-meters { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }\n.lm-meter { padding: 8px 10px; border-radius: 6px; background: var(--lm-bg); min-width: 0; }\n.lm-meter b { display: block; font: 500 1.15rem var(--lm-mono); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.lm-meter span { font-size: .74rem; color: var(--lm-muted); }\n.lm-meter[data-state=\"warn\"] b { color: var(--lm-warn); } .lm-meter[data-state=\"over\"] b { color: var(--lm-drop); }\n\n.lm-limits { display: grid; gap: 10px; }\n.lm-lim, .lm-scale { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr) 10rem; gap: 4px 14px; align-items: center; }\n@container (max-width: 640px) { .lm-lim, .lm-scale { grid-template-columns: minmax(0, 1fr); } .lm-scale > :first-child, .lm-scale > :last-child { display: none; } }\n.lm-lim b { display: block; font-weight: 600; font-size: .88rem; }\n.lm-lim .lm-sub { display: block; font-size: .74rem; color: var(--lm-muted); }\n.lm-tag { font: 600 .64rem var(--lm-font); text-transform: uppercase; letter-spacing: .06em; border-radius: 3px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }\n.lm-tag[data-kind=\"first\"] { color: var(--lm-surface); background: var(--lm-drop); }\n.lm-tag[data-kind=\"estimated\"] { color: var(--lm-warn); border: 1px solid currentColor; }\n.lm-tag[data-kind=\"published\"] { color: var(--lm-alt); border: 1px solid currentColor; }\n.lm-tag[data-kind=\"none\"] { color: var(--lm-muted); border: 1px dashed currentColor; }\n.lm-tag[data-kind=\"range\"], .lm-tag[data-kind=\"rank\"] { color: var(--lm-muted); border: 1px solid currentColor; }\n.lm-track { position: relative; height: 16px; background: var(--lm-bg); border-radius: 3px; overflow: hidden; }\n.lm-fill { position: absolute; inset: 0 auto 0 0; background: var(--lm-ok); transition: width .25s ease; }\n.lm-fill[data-state=\"warn\"] { background: var(--lm-warn); } .lm-fill[data-state=\"over\"] { background: var(--lm-drop); }\n.lm-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--lm-fg); opacity: .55; }\n.lm-val { font: 500 .8rem var(--lm-mono); font-variant-numeric: tabular-nums; }\n.lm-val small { display: block; font: 400 .72rem var(--lm-font); color: var(--lm-muted); }\n.lm-scale { font: 400 .7rem var(--lm-mono); color: var(--lm-muted); }\n.lm-scale div { position: relative; height: 12px; }\n.lm-scale div span { position: absolute; transform: translateX(-50%); white-space: nowrap; }\n\n.lm-controls label.lm-range { display: grid; gap: 4px; font-size: .84rem; }\n.lm-controls label.lm-range > span { display: flex; justify-content: space-between; gap: 8px; }\n.lm-controls output { font-family: var(--lm-mono); font-variant-numeric: tabular-nums; }\n.lm-controls input[type=range] { width: 100%; accent-color: var(--lm-accent); }\n.lm-presets { display: flex; flex-wrap: wrap; gap: 6px; }\n.lm-presets button { font: 500 .76rem var(--lm-font); background: var(--lm-accent-soft); color: var(--lm-fg); border: 1px solid transparent; border-radius: 5px; padding: 5px 10px; cursor: pointer; }\n.lm-presets button[aria-pressed=\"true\"] { border-color: var(--lm-accent); }\n.lm-switch { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 8px; align-items: start; font-size: .84rem; cursor: pointer; }\n.lm-switch input { margin: 3px 0 0; accent-color: var(--lm-accent); }\n.lm-switch small, .lm-select small { grid-column: 2; color: var(--lm-muted); font-size: .74rem; line-height: 1.3; }\n.lm-select { display: grid; gap: 4px; font-size: .84rem; }\n.lm-select select { width: 100%; min-width: 0; font: 400 .84rem var(--lm-font); color: var(--lm-fg); background: var(--lm-surface); border: 1px solid var(--lm-line); border-radius: 5px; padding: 5px 8px; }\n.lm-off { opacity: .45; cursor: default; }\n\n.lm-facts { margin: 0; padding-left: 1.1em; font-size: .88rem; columns: 2; column-gap: 28px; }\n@container (max-width: 860px) { .lm-facts { columns: 1; } }\n.lm-facts li { margin-bottom: 8px; break-inside: avoid; }\n.lm-prov { font: 600 .66rem var(--lm-font); text-transform: uppercase; letter-spacing: .06em; }\n.lm-prov[data-kind=\"measured\"] { color: var(--lm-ok); } .lm-prov[data-kind=\"estimated\"] { color: var(--lm-warn); }\n.lm-prov[data-kind=\"configured\"] { color: var(--lm-accent); } .lm-prov[data-kind=\"published\"] { color: var(--lm-alt); }\n\n/* scenario identity colours (s1–s4) are checked for colour-blind separation on both surfaces; text never wears them */\n.lm-scenarios { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }\n.lm-scenarios legend { float: left; font: 600 .74rem var(--lm-font); text-transform: uppercase; letter-spacing: .08em; color: var(--lm-muted); margin-right: 6px; padding: 0; }\n.lm-scenarios button { font: 500 .84rem var(--lm-font); color: var(--lm-fg); background: var(--lm-surface); border: 1px solid var(--lm-line); border-radius: 6px; padding: 6px 12px; cursor: pointer; }\n.lm-scenarios button[aria-pressed=\"true\"] { border-color: var(--lm-fg); box-shadow: inset 0 0 0 1px var(--lm-fg); }\n.lm-scenarios i, .lm-table i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; margin-right: 6px; }\n.lm-story { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; min-width: 0; padding: 8px 12px; border: 1px solid var(--lm-line); border-left: 3px solid var(--lm-accent); border-radius: 6px; background: var(--lm-surface); }\n.lm-story legend { float: left; font: 600 .74rem var(--lm-font); text-transform: uppercase; letter-spacing: .08em; color: var(--lm-muted); padding: 0; }\n.lm-story p { flex: 1 1 240px; display: grid; margin: 0; font: 400 .9rem/1.4 var(--lm-font); color: var(--lm-fg); }\n.lm-story p > span { grid-area: 1 / 1; }\n.lm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n.lm-story p > span:not([data-shown]), .lm-story em:not([data-shown]) { visibility: hidden; }\n.lm-story-progress { display: flex; align-items: center; gap: 4px; }\n.lm-story-progress i { position: relative; width: 28px; height: 4px; border-radius: 2px; background: var(--lm-line); overflow: hidden; }\n.lm-story-progress i[data-state=\"done\"], .lm-story:not([data-playing]) .lm-story-progress i[data-state=\"now\"] { background: var(--lm-accent); }\n.lm-story[data-playing] .lm-story-progress i[data-state=\"now\"]::before { content: \"\"; position: absolute; inset: 0; background: var(--lm-accent); transform-origin: left; animation: lm-step var(--lm-step) linear both; }\n@keyframes lm-step { from { transform: scaleX(0); } to { transform: scaleX(1); } }\n.lm-story b { font-weight: 600; color: var(--lm-muted); margin-right: 4px; white-space: nowrap; }\n.lm-story-nav { display: flex; gap: 6px; }\n.lm-story em { color: var(--lm-muted); }\n.lm-story button { font: 500 .84rem var(--lm-font); color: var(--lm-fg); background: var(--lm-surface); border: 1px solid var(--lm-line); border-radius: 6px; padding: 6px 12px; cursor: pointer; }\n.lm-story button[aria-disabled=\"true\"] { opacity: .45; cursor: default; }\n.lm-own { font-size: .78rem; color: var(--lm-muted); }\n\n/* the scenarios and the load over the board, in view while the page scrolls; on a phone under the board */\n.lm-loadbar { position: sticky; top: var(--lm-sticky-top, 0px); z-index: 3; container-type: inline-size; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 6px 12px 2px; background: var(--lm-surface); border: 1px solid var(--lm-line); border-radius: 8px; box-shadow: 0 4px 14px -10px rgb(0 0 0 / .4); }\n.lm-loadbar .lm-scenarios { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; padding: 2px; }\n.lm-loadbar .lm-scenarios button { flex: none; white-space: nowrap; }\n.lm-loadbar .lm-load { flex: 1 1 300px; }\n@container (min-width: 720px) {\n .lm-loadbar .lm-load { grid-template: \"label track value\" / minmax(0, max-content) minmax(160px, 1fr) auto; align-items: start; }\n .lm-loadbar .lm-load > label { max-width: 14em; padding-top: 6px; }\n}\n@container (max-width: 520px) {\n .lm:not([data-full]) > .lm-loadbar { order: 1; top: auto; bottom: 0; }\n .lm:not([data-full]) > .lm-side { order: 2; }\n}\n/* the load: its label and value, the track under them, the marks under it */\n.lm-load { display: grid; grid-template: \"label value\" \"track track\" / minmax(0, 1fr) auto; align-items: center; gap: 0 12px; font-size: .84rem; min-width: 0; }\n.lm-load > label { grid-area: label; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.lm-load > output { grid-area: value; text-align: right; font: 600 .95rem/1.2 var(--lm-mono); font-variant-numeric: tabular-nums; }\n.lm-load small { display: block; font: 400 .7rem var(--lm-mono); color: var(--lm-muted); }\n.lm-load-track { grid-area: track; position: relative; min-width: 0; padding-bottom: 22px; }\n.lm-load input { display: block; width: 100%; height: 32px; margin: 0; accent-color: var(--lm-accent); cursor: pointer; }\n.lm-zones, .lm-marks { position: absolute; left: 8px; right: 8px; top: 30px; }\n.lm-zones { height: 4px; border-radius: 2px; }\n.lm-marks button { position: absolute; top: 0; transform: translateX(-50%); min-width: 20px; height: 24px; padding: 7px 2px 0; border: 0; background: none; font: 500 .68rem var(--lm-mono); color: var(--lm-accent); white-space: nowrap; cursor: pointer; }\n.lm-marks button::before { content: \"\"; position: absolute; left: 50%; top: 0; width: 2px; height: 6px; margin-left: -1px; background: currentColor; }\n.lm-marks button:not([data-label]) span { display: none; }\n.lm-marks [data-kind=\"target\"] { color: var(--lm-warn); }\n.lm-marks [data-kind=\"full\"] { color: var(--lm-drop); }\n.lm-marks [aria-pressed=\"true\"] { font-weight: 700; text-decoration: underline; }\n.lm-key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; vertical-align: 3px; margin-right: 6px; }\n\n.lm-compare-text { margin: 0; }\n.lm-table-wrap { overflow-x: auto; }\n.lm-table { border-collapse: collapse; width: 100%; font-size: .84rem; }\n.lm-table th, .lm-table td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--lm-line); vertical-align: top; }\n.lm-table thead th { font: 600 .7rem var(--lm-font); text-transform: uppercase; letter-spacing: .06em; color: var(--lm-muted); }\n.lm-table tbody th { font-weight: 600; white-space: nowrap; }\n.lm-table td { font-family: var(--lm-mono); font-variant-numeric: tabular-nums; }\n.lm-table td.lm-text { font-family: var(--lm-font); }\n.lm-table td small { display: block; font: 400 .72rem var(--lm-font); color: var(--lm-muted); }\n.lm-table tr[aria-current] th { text-decoration: underline; text-underline-offset: 3px; }\n\n.lm-chart { position: relative; min-width: 0; }\n.lm-chart svg { display: block; overflow: visible; }\n.lm-chart:focus-visible { outline: 2px solid var(--lm-accent); outline-offset: 2px; }\n.lm-axis, .lm-axis text { font: 400 11px var(--lm-mono); fill: var(--lm-muted); }\n.lm-mark { font: 600 11px var(--lm-mono); fill: var(--lm-fg); }\n.lm-tip { position: absolute; z-index: 2; display: grid; gap: 2px; width: max-content; max-width: min(17rem, calc(100% - 8px)); overflow-wrap: anywhere; padding: 8px 10px; font-size: .78rem; background: var(--lm-surface); color: var(--lm-fg); border: 1px solid var(--lm-line); border-radius: 6px; box-shadow: 0 4px 14px rgb(0 0 0 / .14); pointer-events: none; }\n.lm-tip strong { font: 600 .82rem var(--lm-mono); font-variant-numeric: tabular-nums; }\n.lm-tip .lm-sub { color: var(--lm-muted); }\n.lm-nowrap { white-space: nowrap; }\n.lm-node { cursor: pointer; outline: none; }\n.lm-node:focus-visible > :first-child { stroke-width: 3; }\n\n@media (prefers-reduced-motion: reduce) {\n .lm-fill { transition: none; }\n .lm-story[data-playing] .lm-story-progress i[data-state=\"now\"]::before { animation: none; transform: none; }\n}\n";
|
|
116
116
|
/** Adds the stylesheet once per document. */
|
|
117
117
|
export declare function injectStyles(doc?: Document): void;
|
|
118
|
-
export { type AnyNodeDef, type ClusterDef, type Cue, type DiagramProps, type Dot, type EdgeDef, type ElkEngine, type Engine, type FlowColor, type FlowView, type FullScreenMode, LOADMAP_PANELS, type Label, Loadmap, type LoadmapController, type LoadmapHandle, type LoadmapOptions, type LoadmapPanel, type LoadmapProps, LoadmapRoot, MEASURES, type NodeDef, type PoolDef, type Theme, type TierDef, type View, type ViewDef, cluster, compact, defineView, directionOf, edge, fitLinear, fmt, fromSnapshot, handleOf, multiple, node, originText, parseSnapshot, pct, pool, secs, summarize, useLoadmap, usePageTheme };
|
|
118
|
+
export { type AnyNodeDef, type ClusterDef, type Cue, type DiagramProps, type Dot, type EdgeDef, type ElkEngine, type Engine, type FlowColor, type FlowView, type FullScreenMode, LOADMAP_PANELS, type Label, Loadmap, type LoadmapController, type LoadmapHandle, type LoadmapOptions, type LoadmapPanel, type LoadmapProps, LoadmapRoot, MEASURES, type NodeDef, type PoolDef, type SubsystemDef, type Theme, type TierDef, type View, type ViewDef, cluster, compact, defineView, directionOf, edge, fitLinear, fmt, fromSnapshot, handleOf, multiple, node, originText, parseSnapshot, pct, pool, secs, summarize, useLoadmap, usePageTheme };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as useComparison, D as workerElk, O as Diagram, S as scenarioColor, _ as Verdict, a as usePageTheme, b as HeadroomChart, c as injectStyles, f as Controls, g as Meters, h as LoadRange, i as handleOf, l as Story, m as LoadBar, n as Loadmap, o as useLoadmap, p as Limits, r as LoadmapRoot, s as LOADMAP_CSS, t as LOADMAP_PANELS, u as Assumptions, x as Scenarios, y as Compare } from "./Loadmap-
|
|
1
|
+
import { C as useComparison, D as workerElk, O as Diagram, S as scenarioColor, _ as Verdict, a as usePageTheme, b as HeadroomChart, c as injectStyles, f as Controls, g as Meters, h as LoadRange, i as handleOf, l as Story, m as LoadBar, n as Loadmap, o as useLoadmap, p as Limits, r as LoadmapRoot, s as LOADMAP_CSS, t as LOADMAP_PANELS, u as Assumptions, x as Scenarios, y as Compare } from "./Loadmap-DbAbcbNc.js";
|
|
2
2
|
import { fitLinear } from "@loadmap/core/calibrate";
|
|
3
3
|
import { compact, fmt, multiple, pct, secs } from "@loadmap/core/format";
|
|
4
4
|
import { MEASURES, fromSnapshot, originText, parseSnapshot, summarize } from "@loadmap/core/measure";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as rankLabels, C as useComparison, E as whenRange, S as scenarioColor, T as useSize, d as CapTag, f as Controls, g as Meters, k as boxComponent, v as plusMinus, w as useHeadroom, y as Compare } from "./Loadmap-
|
|
1
|
+
import { A as rankLabels, C as useComparison, E as whenRange, S as scenarioColor, T as useSize, d as CapTag, f as Controls, g as Meters, k as boxComponent, v as plusMinus, w as useHeadroom, y as Compare } from "./Loadmap-DbAbcbNc.js";
|
|
2
2
|
import { reach } from "@loadmap/core";
|
|
3
3
|
import { compact, fmt, multiple, multiples, pct } from "@loadmap/core/format";
|
|
4
4
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
package/dist/source.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as LoadmapProps } from "./Loadmap-
|
|
1
|
+
import { a as LoadmapProps } from "./Loadmap-BMlU1-mr.js";
|
|
2
2
|
import { CompileOptions } from "@loadmap/dsl";
|
|
3
3
|
export interface LoadmapSourceProps extends Omit<LoadmapProps<any>, 'model' | 'view'> {
|
|
4
4
|
/** The `.loadmap` text. Compiled again when its tokens change: spaces, line breaks and comments change nothing. */
|
package/dist/source.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as usePageTheme, c as injectStyles, n as Loadmap } from "./Loadmap-
|
|
1
|
+
import { a as usePageTheme, c as injectStyles, n as Loadmap } from "./Loadmap-DbAbcbNc.js";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { compile, formatDiagnostic, loadCatalogFor, loadedCatalog, needsCatalog, sharedValues } from "@loadmap/dsl";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createRoot } from "react-dom/client";
|
|
4
4
|
// src/viewpoint.ts
|
|
5
5
|
/** The zoom's range in board pixels a scene unit, and how much of the diagram always stays in view. */
|
|
@@ -329,6 +329,27 @@ var Viewer = class {
|
|
|
329
329
|
};
|
|
330
330
|
if (!seen(v, this.viewport, r)) this.go(frame(r, this.viewport, v.k), true);
|
|
331
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* Flies in to this part of the scene, as close as it fits the board: a subsystem's frame, from a click on it or on
|
|
334
|
+
* the path over the board. `id` names it: while the view stays where the flight ends, the path ends there.
|
|
335
|
+
*/
|
|
336
|
+
enter(r, id) {
|
|
337
|
+
const to = frame({
|
|
338
|
+
x: r.x - ROOM,
|
|
339
|
+
y: r.y - ROOM,
|
|
340
|
+
w: r.w + 60,
|
|
341
|
+
h: r.h + 60
|
|
342
|
+
}, this.viewport);
|
|
343
|
+
this.go(to, true);
|
|
344
|
+
const fit = this.fit();
|
|
345
|
+
const at = fit && clamp(to, this.viewport, whole(this.engine.frame), range(fit));
|
|
346
|
+
this.entered = id == null || !at ? null : {
|
|
347
|
+
id,
|
|
348
|
+
at
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
/** The frame the view last flew in to, and where it went. */
|
|
352
|
+
entered = null;
|
|
332
353
|
/** The part of the scene the board shows now: its viewBox. */
|
|
333
354
|
box() {
|
|
334
355
|
const v = this.shownView();
|
|
@@ -382,6 +403,13 @@ const ZOOM_CSS = `
|
|
|
382
403
|
.lm-zoom .lm-btn:nth-child(2) { min-width: 4.4em; }
|
|
383
404
|
.lm-zoom [aria-disabled="true"] { opacity: .4; cursor: default; }
|
|
384
405
|
@media (pointer: coarse) { .lm-zoom .lm-btn { min-width: 44px; min-height: 44px; } }
|
|
406
|
+
.lm-crumbs { position: absolute; left: 8px; top: 8px; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; max-width: calc(100% - 16px); padding: 3px 6px; font-size: 12px; background: var(--lm-surface); border: 1px solid var(--lm-line); border-radius: 8px; box-shadow: 0 2px 10px rgb(0 0 0 / .12); cursor: auto; }
|
|
407
|
+
.lm-crumbs button { font: inherit; color: var(--lm-accent); background: none; border: 0; padding: 2px 4px; border-radius: 4px; cursor: pointer; }
|
|
408
|
+
.lm-crumbs button:hover { text-decoration: underline; }
|
|
409
|
+
.lm-crumbs [aria-current] { font-weight: 600; color: var(--lm-fg); }
|
|
410
|
+
.lm-crumbs span { color: var(--lm-muted); }
|
|
411
|
+
@media (pointer: coarse) { .lm-crumbs button { min-height: 44px; } }
|
|
412
|
+
.lm-wrap[data-canvas] .lm-crumbs { left: calc(var(--lm-inset-left) + 12px); top: calc(var(--lm-inset-top) + 12px); }
|
|
385
413
|
.lm-wrap[data-canvas] .lm-zoom { right: calc(var(--lm-inset-right) + 12px); bottom: calc(var(--lm-inset-bottom) + 12px); }
|
|
386
414
|
.lm-wrap[data-canvas] > .lm-bar { position: absolute; left: calc(var(--lm-inset-left) + 12px); bottom: calc(var(--lm-inset-bottom) + 12px); z-index: 2; max-width: calc(100% - var(--lm-inset-left) - var(--lm-inset-right) - 260px); padding: 4px 8px; border-radius: 6px; background: color-mix(in srgb, var(--lm-surface) 88%, transparent); pointer-events: none; }
|
|
387
415
|
`;
|
|
@@ -454,7 +482,7 @@ function attachZoom(board, viewer, o) {
|
|
|
454
482
|
if (board.style.touchAction !== action) board.style.touchAction = action;
|
|
455
483
|
};
|
|
456
484
|
const down = (e) => {
|
|
457
|
-
if (e.button !== 0 && e.button !== 1 || e.target.closest(".lm-zoom")) return;
|
|
485
|
+
if (e.button !== 0 && e.button !== 1 || e.target.closest(".lm-zoom, .lm-crumbs")) return;
|
|
458
486
|
if (!viewer.shownView()) return;
|
|
459
487
|
points.set(e.pointerId, at(e));
|
|
460
488
|
if (points.size === 1) {
|
|
@@ -630,7 +658,7 @@ function mountZoom(board, engine, shape) {
|
|
|
630
658
|
const corner = board.ownerDocument.createElement("div");
|
|
631
659
|
board.appendChild(corner);
|
|
632
660
|
const buttons = createRoot(corner);
|
|
633
|
-
buttons.render(/* @__PURE__ */ jsx(ZoomControls, { engine }));
|
|
661
|
+
buttons.render(/* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Crumbs, { engine }), /* @__PURE__ */ jsx(ZoomControls, { engine })] }));
|
|
634
662
|
return {
|
|
635
663
|
measure,
|
|
636
664
|
off: () => {
|
|
@@ -647,6 +675,46 @@ function mountZoom(board, engine, shape) {
|
|
|
647
675
|
}
|
|
648
676
|
};
|
|
649
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* Where the view is, as the path down the subsystems to it, over the top corner of the board while it shows only a
|
|
680
|
+
* part: the whole diagram, then each frame the view stands in, each a button that flies there. The frame the view last
|
|
681
|
+
* flew in to ends it while the view stays there; else the frames around the middle of the view. Not while a story
|
|
682
|
+
* plays: its camera and its title have the board.
|
|
683
|
+
*/
|
|
684
|
+
function Crumbs({ engine }) {
|
|
685
|
+
useSyncExternalStore(engine.subscribe, () => engine.viewId);
|
|
686
|
+
const viewer = engine.viewer;
|
|
687
|
+
const r = viewer?.box();
|
|
688
|
+
const f = engine.frame;
|
|
689
|
+
const near = (a, b) => Math.abs(a - b) < .001 * Math.max(1, Math.abs(b));
|
|
690
|
+
if (!viewer || !r || !f?.subsystems.length || engine.camera) return null;
|
|
691
|
+
if (r.x <= 1 && r.y <= 1 && r.x + r.w >= f.width - 1 && r.y + r.h >= f.height - 1) return null;
|
|
692
|
+
const frames = f.subsystems.filter((s) => (s.fade ?? 1) === 1);
|
|
693
|
+
const v = viewer.readerView;
|
|
694
|
+
const e = viewer.entered;
|
|
695
|
+
const at = e && v && near(v.x, e.at.x) && near(v.y, e.at.y) && near(v.k, e.at.k) ? e.id : void 0;
|
|
696
|
+
const [cx, cy] = [r.x + r.w / 2, r.y + r.h / 2];
|
|
697
|
+
let s = at != null ? frames.find((x) => x.id === at) : frames.findLast((x) => cx >= x.x && cx <= x.x + x.w && cy >= x.y && cy <= x.y + x.h);
|
|
698
|
+
const path = [];
|
|
699
|
+
for (; s; s = frames.find((x) => x.id === s?.in)) path.unshift(s);
|
|
700
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
701
|
+
className: "lm-crumbs",
|
|
702
|
+
"aria-label": "Where the view is",
|
|
703
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
704
|
+
type: "button",
|
|
705
|
+
onClick: () => viewer.go(null, true),
|
|
706
|
+
children: "Whole diagram"
|
|
707
|
+
}), path.map((x, i) => [/* @__PURE__ */ jsx("span", {
|
|
708
|
+
"aria-hidden": "true",
|
|
709
|
+
children: "›"
|
|
710
|
+
}, `${x.id}>`), /* @__PURE__ */ jsx("button", {
|
|
711
|
+
type: "button",
|
|
712
|
+
"aria-current": i === path.length - 1 ? "location" : void 0,
|
|
713
|
+
onClick: () => viewer.enter(x, x.id),
|
|
714
|
+
children: x.label
|
|
715
|
+
}, x.id)])]
|
|
716
|
+
});
|
|
717
|
+
}
|
|
650
718
|
/** − · the zoom · + · Fit, over a corner of the board. The zoom shown is a button too: one pixel a scene unit. */
|
|
651
719
|
function ZoomControls({ engine }) {
|
|
652
720
|
useSyncExternalStore(engine.subscribe, () => engine.viewId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadmap/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Interactive capacity models for React: an architecture diagram with moving dots, the limits ranked, the verdict, scenarios and headroom.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"loadmap",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"dist"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@loadmap/core": "0.
|
|
43
|
-
"@loadmap/dsl": "0.
|
|
44
|
-
"@loadmap/sim": "0.
|
|
45
|
-
"@loadmap/layout": "0.
|
|
42
|
+
"@loadmap/core": "0.37.0",
|
|
43
|
+
"@loadmap/dsl": "0.37.0",
|
|
44
|
+
"@loadmap/sim": "0.37.0",
|
|
45
|
+
"@loadmap/layout": "0.37.0",
|
|
46
46
|
"elkjs": "^0.12.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|