@cardenelabs/dragon 0.45.0 → 0.45.3
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/cli.cjs +71 -30
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +71 -30
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +71 -30
- package/dist/export.cjs.map +1 -1
- package/dist/export.js +71 -30
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +71 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +71 -30
- package/dist/index.js.map +1 -1
- package/dist/light/{chunk-VRAW7VAQ.cjs → chunk-5OQV42W3.cjs} +50 -19
- package/dist/light/chunk-5OQV42W3.cjs.map +1 -0
- package/dist/light/chunk-CLS6JVKK.cjs.map +1 -1
- package/dist/light/{chunk-JNSHZTPF.js → chunk-EHTQUCW4.js} +49 -18
- package/dist/light/chunk-EHTQUCW4.js.map +1 -0
- package/dist/light/{chunk-OUQ44P45.cjs → chunk-JCEKXALJ.cjs} +81 -81
- package/dist/light/{chunk-OUQ44P45.cjs.map → chunk-JCEKXALJ.cjs.map} +1 -1
- package/dist/light/{chunk-6ZUKJ3VO.js → chunk-YEQSLVIN.js} +2 -2
- package/dist/light/{git-C4RVNFT6.js → git-GESUYKGR.js} +3 -3
- package/dist/light/{git-I7D7RIW2.cjs → git-K3KAAAWW.cjs} +59 -59
- package/dist/light/{git-I7D7RIW2.cjs.map → git-K3KAAAWW.cjs.map} +1 -1
- package/dist/light/index.cjs +232 -220
- package/dist/light/index.cjs.map +1 -1
- package/dist/light/index.js +32 -20
- package/dist/light/index.js.map +1 -1
- package/dist/light/{lineup-YEG4HHEI.js → lineup-2V2U7HZH.js} +3 -3
- package/dist/light/{lineup-FAIKTH3Y.cjs → lineup-623J25LU.cjs} +40 -40
- package/dist/light/{lineup-FAIKTH3Y.cjs.map → lineup-623J25LU.cjs.map} +1 -1
- package/dist/light/{state-ZZUK6AQT.cjs → state-OZVCHX7H.cjs} +41 -41
- package/dist/light/{state-ZZUK6AQT.cjs.map → state-OZVCHX7H.cjs.map} +1 -1
- package/dist/light/{state-P3LIVI3K.js → state-T4OTVING.js} +2 -2
- package/dist/light/{time-B5WUQOFP.js → time-6WEMD4FQ.js} +3 -3
- package/dist/light/{time-64DJKYAL.cjs → time-PQCPVQOE.cjs} +84 -84
- package/dist/light/{time-64DJKYAL.cjs.map → time-PQCPVQOE.cjs.map} +1 -1
- package/dist/light/{tree-66EH4QVI.cjs → tree-6D7KI57H.cjs} +62 -62
- package/dist/light/{tree-66EH4QVI.cjs.map → tree-6D7KI57H.cjs.map} +1 -1
- package/dist/light/{tree-5HPREYW2.js → tree-ZJZQI5QT.js} +3 -3
- package/dist/player.global.js +3 -3
- package/package.json +1 -1
- package/src/layout/scene.ts +58 -16
- package/src/look/values.ts +1 -1
- package/src/render/draw.ts +39 -17
- package/dist/light/chunk-JNSHZTPF.js.map +0 -1
- package/dist/light/chunk-VRAW7VAQ.cjs.map +0 -1
- /package/dist/light/{chunk-6ZUKJ3VO.js.map → chunk-YEQSLVIN.js.map} +0 -0
- /package/dist/light/{git-C4RVNFT6.js.map → git-GESUYKGR.js.map} +0 -0
- /package/dist/light/{lineup-YEG4HHEI.js.map → lineup-2V2U7HZH.js.map} +0 -0
- /package/dist/light/{state-P3LIVI3K.js.map → state-T4OTVING.js.map} +0 -0
- /package/dist/light/{time-B5WUQOFP.js.map → time-6WEMD4FQ.js.map} +0 -0
- /package/dist/light/{tree-5HPREYW2.js.map → tree-ZJZQI5QT.js.map} +0 -0
package/dist/light/index.js
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
sansOf,
|
|
51
51
|
side,
|
|
52
52
|
strip
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-YEQSLVIN.js";
|
|
54
54
|
import {
|
|
55
55
|
DEFAULT_PALETTE,
|
|
56
56
|
EASE,
|
|
@@ -86,13 +86,14 @@ import {
|
|
|
86
86
|
regionColors,
|
|
87
87
|
replaceSameSpot,
|
|
88
88
|
resolvePalette,
|
|
89
|
+
rewrapStrip,
|
|
89
90
|
seatCarriers,
|
|
90
91
|
shiftContent,
|
|
91
92
|
slotBoxWidth,
|
|
92
93
|
slotRooms,
|
|
93
94
|
stripNeed,
|
|
94
95
|
textWidth
|
|
95
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-EHTQUCW4.js";
|
|
96
97
|
|
|
97
98
|
// src/kinds/registry.ts
|
|
98
99
|
var LATER_KINDS = ["git", "lineup", "state", "time", "tree"];
|
|
@@ -9279,7 +9280,8 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
|
|
|
9279
9280
|
const arrivals = new Map((timeline.states ?? []).flatMap((s) => s.lit[0] ? [[s.box, s.lit[0].start]] : []));
|
|
9280
9281
|
const meters = new Map((timeline.meters ?? []).map((meter) => [meter.field, meter.keys]));
|
|
9281
9282
|
const gauge = (field2) => field2.meter ? kindParts("time").meterField({ ...field2, meter: field2.meter }, meters.get(field2.name) ?? [[0, 0]], ctx) : void 0;
|
|
9282
|
-
|
|
9283
|
+
const drawStrip = (s) => strip(s, fieldChanges(diagram, timeline, layout), ctx, isState, arrivals, gauge);
|
|
9284
|
+
if (layout.strip && !follow) L.band.push(drawStrip(layout.strip));
|
|
9283
9285
|
for (const line2 of layout.lifelines) L.base.push(lifeline(line2.x, line2.y1, line2.y2));
|
|
9284
9286
|
if (isGitLayout(layout)) {
|
|
9285
9287
|
const git = kindParts("git").drawGit(layout, diagram, timeline, ctx);
|
|
@@ -9331,7 +9333,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
|
|
|
9331
9333
|
L.node.push(linked(box.id, card(box, ctx, on.get(box.id) ?? [], subs.get(box.id) ?? [], isState ? state?.lit ?? [] : void 0)));
|
|
9332
9334
|
if (state?.done !== void 0) L.node.push(doneMark(box, state.done, ctx));
|
|
9333
9335
|
}
|
|
9334
|
-
for (const b of layout.badges) L.badge.push(badge(b, ctx, isState));
|
|
9336
|
+
for (const b of layout.badges) if (!(follow && onStrip(layout, b))) L.badge.push(badge(b, ctx, isState));
|
|
9335
9337
|
for (const l of layout.labels) {
|
|
9336
9338
|
const time = timeline.labels.find((t) => t.step === l.step && t.event === l.event);
|
|
9337
9339
|
if (time) L.top.push(label(l, fadeBefore(l, time, timeline.steps), ctx));
|
|
@@ -9351,7 +9353,8 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
|
|
|
9351
9353
|
const { near, far, nearY, farY } = LOOK.shadow;
|
|
9352
9354
|
const shadow = `<filter id="dg-sh-${id}" x="-20%" y="-30%" width="140%" height="180%"><feDropShadow dx="0" dy="${nearY}" stdDeviation="${near}" style="flood-color:var(--sh);flood-opacity:var(--shA)"/><feDropShadow dx="0" dy="${farY}" stdDeviation="${far}" style="flood-color:var(--sh);flood-opacity:var(--shB)"/></filter>`;
|
|
9353
9355
|
const heads = follow && layout.kind === "sequence" ? layout.boxes.map((box) => linked(box.id, headCard(box, ctx, on.get(box.id) ?? [], subs.get(box.id) ?? []))).join("") : "";
|
|
9354
|
-
const
|
|
9356
|
+
const drawTable = (s, from) => drawStrip(s) + layout.badges.filter((b) => onStrip(layout, b)).map((b) => badge({ ...b, x: b.x - from.x + s.x + LOOK.badge.r, y: b.y - from.y + s.y }, ctx, isState)).join("");
|
|
9357
|
+
const view = follow ? followView(layout, timeline, diagram, m, id, content, follow, heads, drawTable) : { body: `<rect class="dg-bg" width="${layout.width}" height="${layout.height}" rx="${LOOK.region.radius}"/>${content}`, w: layout.width, h: layout.height };
|
|
9355
9358
|
const css = `.dg-${id}{${FONT_VARS};--T:${timeline.total}s;${vars}}${PART_CSS}${m.frames.join("")}`;
|
|
9356
9359
|
return `<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${id}" viewBox="0 0 ${Math.ceil(view.w)} ${Math.ceil(view.h)}" width="${Math.ceil(view.w)}" height="${Math.ceil(view.h)}" role="img" aria-label="${esc(diagram.title)}" data-dragon="figure" data-view="${follow ? "follow" : "fixed"}"><style>${css}</style><defs>${shadow}</defs>${view.body}</svg>`;
|
|
9357
9360
|
}
|
|
@@ -9360,6 +9363,9 @@ function union(rects) {
|
|
|
9360
9363
|
const y = Math.min(...rects.map((r) => r.y));
|
|
9361
9364
|
return { x, y, w: Math.max(...rects.map((r) => r.x + r.w)) - x, h: Math.max(...rects.map((r) => r.y + r.h)) - y };
|
|
9362
9365
|
}
|
|
9366
|
+
function onStrip(layout, badge2) {
|
|
9367
|
+
return layout.strip !== void 0 && badge2.y >= layout.strip.y;
|
|
9368
|
+
}
|
|
9363
9369
|
function focusOf(layout, diagram, step) {
|
|
9364
9370
|
const rects = focusParts(layout, diagram, step);
|
|
9365
9371
|
return rects.length === 0 ? void 0 : union(rects);
|
|
@@ -9405,31 +9411,33 @@ function focusParts(layout, diagram, step) {
|
|
|
9405
9411
|
}
|
|
9406
9412
|
return rects;
|
|
9407
9413
|
}
|
|
9408
|
-
function followView(layout, timeline, diagram, m, id, content, follow, heads) {
|
|
9414
|
+
function followView(layout, timeline, diagram, m, id, content, follow, heads, drawTable) {
|
|
9409
9415
|
const F = LOOK.follow;
|
|
9410
9416
|
const M = LOOK.mini;
|
|
9411
9417
|
const frameWidth = Math.max(1, follow.width);
|
|
9412
9418
|
const full = Math.min(layout.width, frameWidth);
|
|
9419
|
+
const worldH = layout.strip ? layout.strip.y : layout.height;
|
|
9413
9420
|
const title = FIGURE_TEXT[follow.lang].overview;
|
|
9414
9421
|
const sized = (vh2) => {
|
|
9415
9422
|
const mw2 = Math.min(M.w, full * 0.4, vh2 * 0.4 / layout.height * layout.width);
|
|
9416
9423
|
const k2 = mw2 / layout.width;
|
|
9417
|
-
const mh2 =
|
|
9424
|
+
const mh2 = worldH * k2;
|
|
9418
9425
|
const bw2 = Math.max(mw2, Math.ceil(textWidth(title, TYPE.miniTitle)));
|
|
9419
9426
|
return { vh: vh2, mw: mw2, k: k2, mh: mh2, bw: bw2, bgW: bw2 + M.pad * 2, bgH: mh2 + M.pad * 2 + M.title, beside: mh2 > mw2 };
|
|
9420
9427
|
};
|
|
9421
|
-
const natural = sized(Math.min(
|
|
9422
|
-
const bare = natural.beside
|
|
9423
|
-
const
|
|
9424
|
-
const
|
|
9428
|
+
const natural = sized(Math.min(worldH, Math.max(F.minH, full * F.aspect)));
|
|
9429
|
+
const bare = frameWidth < F.narrow && (natural.beside || layout.strip !== void 0);
|
|
9430
|
+
const tableH = layout.strip ? rewrapStrip(layout.strip, 0, 0, full).h + M.inset : 0;
|
|
9431
|
+
const room = follow.height === void 0 ? Number.POSITIVE_INFINITY : (natural.beside || bare ? follow.height : follow.height - natural.bgH - M.inset) - tableH;
|
|
9432
|
+
const { vh, mw, k, mh, bw, bgW, bgH, beside } = room < natural.vh ? sized(Math.max(F.fitMinH, room)) : { ...natural, vh: Number.isFinite(room) ? Math.min(worldH, room) : natural.vh };
|
|
9425
9433
|
const vw = beside && !bare ? Math.min(layout.width, frameWidth - bgW - M.inset) : full;
|
|
9426
9434
|
const clampX = (x) => Math.min(layout.width - vw / 2, Math.max(vw / 2, x));
|
|
9427
9435
|
const top = heads === "" ? 0 : Math.max(...layout.boxes.map((b) => b.y + b.h)) + F.headRoom;
|
|
9428
9436
|
const strip2 = heads === "" ? 0 : F.head.pad * 2 + F.head.h;
|
|
9429
9437
|
const below = vh - strip2;
|
|
9430
|
-
const clampY = (y) => Math.min(
|
|
9438
|
+
const clampY = (y) => Math.min(worldH - below / 2, Math.max(top + below / 2, y));
|
|
9431
9439
|
const r = LOOK.badge.r;
|
|
9432
|
-
let prev = [layout.width / 2,
|
|
9440
|
+
let prev = [layout.width / 2, worldH / 2];
|
|
9433
9441
|
const middles = timeline.steps.map((_, s) => {
|
|
9434
9442
|
if (isTimeLayout(layout)) {
|
|
9435
9443
|
const f2 = kindParts("time").timeFocus(layout, timeline, s, focusParts(layout, diagram, s), vw, below);
|
|
@@ -9440,7 +9448,7 @@ function followView(layout, timeline, diagram, m, id, content, follow, heads) {
|
|
|
9440
9448
|
prev = f ? [f.x + f.w / 2, f.y + f.h / 2] : prev;
|
|
9441
9449
|
const at = [clampX(prev[0]), clampY(prev[1])];
|
|
9442
9450
|
const b = layout.badges.find((x) => x.step === s);
|
|
9443
|
-
if (!b || Math.abs(b.x - at[0]) <= vw / 2 - r && Math.abs(b.y - at[1]) <= below / 2 - r) return at;
|
|
9451
|
+
if (!b || onStrip(layout, b) || Math.abs(b.x - at[0]) <= vw / 2 - r && Math.abs(b.y - at[1]) <= below / 2 - r) return at;
|
|
9444
9452
|
const near = badgeFocus(b, focusParts(layout, diagram, s), vw, below);
|
|
9445
9453
|
prev = [near.x + near.w / 2, near.y + near.h / 2];
|
|
9446
9454
|
return [clampX(prev[0]), clampY(prev[1])];
|
|
@@ -9480,7 +9488,11 @@ function followView(layout, timeline, diagram, m, id, content, follow, heads) {
|
|
|
9480
9488
|
const mini = bare ? { clip: "", body: "" } : overview();
|
|
9481
9489
|
const head = strip2 === 0 ? "" : `<g class="dg-hd"><rect class="dg-hd-bg" width="${vw}" height="${strip2}"/><line class="dg-sep" x1="0" y1="${strip2}" x2="${vw}" y2="${strip2}"/><g class="dg-a" style="${m.move(cam.map(([t, cx, , s, e]) => [t, vw / 2 - cx, 0, s, e]))}">${heads}</g></g>`;
|
|
9482
9490
|
const body = `<defs><clipPath id="dg-vp-${id}"><rect width="${vw}" height="${vh}" rx="${LOOK.region.radius}"/></clipPath>${mini.clip}</defs><g clip-path="url(#dg-vp-${id})"><rect class="dg-vp-bg" width="${vw}" height="${vh}"/><g class="dg-a" style="${camKf}">${content}</g>${head}</g><rect class="dg-vp-frame" x="0.5" y="0.5" width="${vw - 1}" height="${vh - 1}" rx="${LOOK.region.radius}"/>${mini.body}`;
|
|
9483
|
-
|
|
9491
|
+
const w = beside && !bare ? vw + M.inset + bgW : full;
|
|
9492
|
+
const bottom = beside || bare ? vh : bgY + bgH;
|
|
9493
|
+
if (!layout.strip) return { body, w, h: bottom };
|
|
9494
|
+
const table = rewrapStrip(layout.strip, 0, bottom + M.inset, full);
|
|
9495
|
+
return { body: body + drawTable(table, layout.strip), w, h: table.y + table.h };
|
|
9484
9496
|
}
|
|
9485
9497
|
function paletteOf(options, theme) {
|
|
9486
9498
|
const palette = resolvePalette(options.palette);
|
|
@@ -9846,11 +9858,11 @@ function mountDiagram(host, diagram, options = {}) {
|
|
|
9846
9858
|
|
|
9847
9859
|
// src/light.ts
|
|
9848
9860
|
var LOADERS = {
|
|
9849
|
-
git: () => import("./git-
|
|
9850
|
-
lineup: () => import("./lineup-
|
|
9851
|
-
state: () => import("./state-
|
|
9852
|
-
time: () => import("./time-
|
|
9853
|
-
tree: () => import("./tree-
|
|
9861
|
+
git: () => import("./git-GESUYKGR.js"),
|
|
9862
|
+
lineup: () => import("./lineup-2V2U7HZH.js"),
|
|
9863
|
+
state: () => import("./state-T4OTVING.js"),
|
|
9864
|
+
time: () => import("./time-6WEMD4FQ.js"),
|
|
9865
|
+
tree: () => import("./tree-ZJZQI5QT.js")
|
|
9854
9866
|
};
|
|
9855
9867
|
var isLater = (kind) => LATER_KINDS.includes(kind);
|
|
9856
9868
|
async function loadKind(kind) {
|