sketchmark 1.3.6 → 1.3.7
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/README.md +10 -10
- package/dist/animation/index.d.ts +1 -1
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/index.cjs +48 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -7
- package/dist/index.js.map +1 -1
- package/dist/renderer/svg/index.d.ts.map +1 -1
- package/dist/sketchmark.iife.js +48 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8278,6 +8278,36 @@ function setParentGroupData(el, groupId) {
|
|
|
8278
8278
|
if (groupId)
|
|
8279
8279
|
el.dataset.parentGroup = groupId;
|
|
8280
8280
|
}
|
|
8281
|
+
function resolveEdgeEndpointKind(id, nm, tm, gm, cm) {
|
|
8282
|
+
if (nm.has(id))
|
|
8283
|
+
return "node";
|
|
8284
|
+
if (gm.has(id))
|
|
8285
|
+
return "group";
|
|
8286
|
+
if (tm.has(id))
|
|
8287
|
+
return "table";
|
|
8288
|
+
if (cm.has(id))
|
|
8289
|
+
return "chart";
|
|
8290
|
+
return null;
|
|
8291
|
+
}
|
|
8292
|
+
function collectEdgeGroupLineage(endpointId, endpointKind, parentGroups) {
|
|
8293
|
+
const lineage = [];
|
|
8294
|
+
let groupId = endpointKind === "group"
|
|
8295
|
+
? endpointId
|
|
8296
|
+
: parentGroups.get(`${endpointKind}:${endpointId}`);
|
|
8297
|
+
while (groupId) {
|
|
8298
|
+
lineage.push(groupId);
|
|
8299
|
+
groupId = parentGroups.get(`group:${groupId}`);
|
|
8300
|
+
}
|
|
8301
|
+
return lineage;
|
|
8302
|
+
}
|
|
8303
|
+
function resolveEdgeParentGroupId(fromId, toId, nm, tm, gm, cm, parentGroups) {
|
|
8304
|
+
const fromKind = resolveEdgeEndpointKind(fromId, nm, tm, gm, cm);
|
|
8305
|
+
const toKind = resolveEdgeEndpointKind(toId, nm, tm, gm, cm);
|
|
8306
|
+
if (!fromKind || !toKind)
|
|
8307
|
+
return undefined;
|
|
8308
|
+
const toLineage = new Set(collectEdgeGroupLineage(toId, toKind, parentGroups));
|
|
8309
|
+
return collectEdgeGroupLineage(fromId, fromKind, parentGroups).find((groupId) => toLineage.has(groupId));
|
|
8310
|
+
}
|
|
8281
8311
|
// ── Node shapes ───────────────────────────────────────────────────────────
|
|
8282
8312
|
function renderShape$1(rc, n, palette) {
|
|
8283
8313
|
const s = n.style ?? {};
|
|
@@ -8435,6 +8465,7 @@ function renderToSVG(sg, container, options = {}) {
|
|
|
8435
8465
|
const [x1, y1] = getConnPoint(src, dstCX, dstCY, e.fromAnchor);
|
|
8436
8466
|
const [x2, y2] = getConnPoint(dst, srcCX, srcCY, e.toAnchor);
|
|
8437
8467
|
const eg = mkGroup(`edge-${e.from}-${e.to}`, "eg");
|
|
8468
|
+
setParentGroupData(eg, resolveEdgeParentGroupId(e.from, e.to, nm, tm, gmMap, cm, parentGroups));
|
|
8438
8469
|
if (e.style?.opacity != null)
|
|
8439
8470
|
eg.setAttribute("opacity", String(e.style.opacity));
|
|
8440
8471
|
const len = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) || 1;
|
|
@@ -9481,7 +9512,7 @@ const getTableEl = (svg, id) => getEl(svg, `table-${id}`);
|
|
|
9481
9512
|
const getNoteEl = (svg, id) => getEl(svg, `note-${id}`);
|
|
9482
9513
|
const getChartEl = (svg, id) => getEl(svg, `chart-${id}`);
|
|
9483
9514
|
const getMarkdownEl = (svg, id) => getEl(svg, `markdown-${id}`);
|
|
9484
|
-
const POSITIONABLE_SELECTOR = ".ng, .gg, .tg, .ntg, .cg, .mdg";
|
|
9515
|
+
const POSITIONABLE_SELECTOR = ".ng, .gg, .tg, .ntg, .cg, .eg, .mdg";
|
|
9485
9516
|
function resolveNonEdgeDrawEl(svg, target) {
|
|
9486
9517
|
return (getGroupEl(svg, target) ??
|
|
9487
9518
|
getTableEl(svg, target) ??
|
|
@@ -10075,8 +10106,16 @@ class AnimationController {
|
|
|
10075
10106
|
_buildDrawStepIndex() {
|
|
10076
10107
|
const drawStepIndexByElementId = new Map();
|
|
10077
10108
|
forEachPlaybackStep(this.steps, (step, stepIndex) => {
|
|
10078
|
-
if (step.action !== "draw"
|
|
10109
|
+
if (step.action !== "draw")
|
|
10079
10110
|
return;
|
|
10111
|
+
const edge = parseEdgeTarget(step.target);
|
|
10112
|
+
if (edge) {
|
|
10113
|
+
const edgeEl = getEdgeEl(this.svg, edge.from, edge.to);
|
|
10114
|
+
if (edgeEl && !drawStepIndexByElementId.has(edgeEl.id)) {
|
|
10115
|
+
drawStepIndexByElementId.set(edgeEl.id, stepIndex);
|
|
10116
|
+
}
|
|
10117
|
+
return;
|
|
10118
|
+
}
|
|
10080
10119
|
const el = resolveNonEdgeDrawEl(this.svg, step.target);
|
|
10081
10120
|
if (el && !drawStepIndexByElementId.has(el.id)) {
|
|
10082
10121
|
drawStepIndexByElementId.set(el.id, stepIndex);
|
|
@@ -10776,6 +10815,7 @@ class AnimationController {
|
|
|
10776
10815
|
const el = getEdgeEl(this.svg, edge.from, edge.to);
|
|
10777
10816
|
if (!el)
|
|
10778
10817
|
return;
|
|
10818
|
+
showDrawEl(el);
|
|
10779
10819
|
if (silent) {
|
|
10780
10820
|
revealEdgeInstant(el);
|
|
10781
10821
|
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
@@ -11389,11 +11429,12 @@ const ANIMATION_CSS = `
|
|
|
11389
11429
|
.cg.faded, .eg.faded, .mdg.faded { opacity: 0.22; }
|
|
11390
11430
|
|
|
11391
11431
|
.ng.hidden { opacity: 0; pointer-events: none; }
|
|
11392
|
-
.gg.gg-hidden { opacity: 0; }
|
|
11393
|
-
.tg.gg-hidden { opacity: 0; }
|
|
11394
|
-
.ntg.gg-hidden { opacity: 0; }
|
|
11395
|
-
.cg.gg-hidden { opacity: 0; }
|
|
11396
|
-
.
|
|
11432
|
+
.gg.gg-hidden { opacity: 0; }
|
|
11433
|
+
.tg.gg-hidden { opacity: 0; }
|
|
11434
|
+
.ntg.gg-hidden { opacity: 0; }
|
|
11435
|
+
.cg.gg-hidden { opacity: 0; }
|
|
11436
|
+
.eg.gg-hidden { opacity: 0; }
|
|
11437
|
+
.mdg.gg-hidden { opacity: 0; }
|
|
11397
11438
|
|
|
11398
11439
|
/* narration caption */
|
|
11399
11440
|
.skm-caption { pointer-events: none; user-select: none; }
|