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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderer/svg/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,UAAU,EAEX,MAAM,aAAa,CAAC;AAoQrB,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,WAAW,CACzB,EAAE,EAAE,UAAU,EACd,SAAS,EAAE,WAAW,GAAG,aAAa,EACtC,OAAO,GAAE,kBAAuB,GAC/B,aAAa,CAglBf;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAKtD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderer/svg/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,UAAU,EAKX,MAAM,aAAa,CAAC;AA0TrB,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,WAAW,CACzB,EAAE,EAAE,UAAU,EACd,SAAS,EAAE,WAAW,GAAG,aAAa,EACtC,OAAO,GAAE,kBAAuB,GAC/B,aAAa,CAolBf;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAKtD"}
@@ -8281,6 +8281,36 @@ var AIDiagram = (function (exports) {
8281
8281
  if (groupId)
8282
8282
  el.dataset.parentGroup = groupId;
8283
8283
  }
8284
+ function resolveEdgeEndpointKind(id, nm, tm, gm, cm) {
8285
+ if (nm.has(id))
8286
+ return "node";
8287
+ if (gm.has(id))
8288
+ return "group";
8289
+ if (tm.has(id))
8290
+ return "table";
8291
+ if (cm.has(id))
8292
+ return "chart";
8293
+ return null;
8294
+ }
8295
+ function collectEdgeGroupLineage(endpointId, endpointKind, parentGroups) {
8296
+ const lineage = [];
8297
+ let groupId = endpointKind === "group"
8298
+ ? endpointId
8299
+ : parentGroups.get(`${endpointKind}:${endpointId}`);
8300
+ while (groupId) {
8301
+ lineage.push(groupId);
8302
+ groupId = parentGroups.get(`group:${groupId}`);
8303
+ }
8304
+ return lineage;
8305
+ }
8306
+ function resolveEdgeParentGroupId(fromId, toId, nm, tm, gm, cm, parentGroups) {
8307
+ const fromKind = resolveEdgeEndpointKind(fromId, nm, tm, gm, cm);
8308
+ const toKind = resolveEdgeEndpointKind(toId, nm, tm, gm, cm);
8309
+ if (!fromKind || !toKind)
8310
+ return undefined;
8311
+ const toLineage = new Set(collectEdgeGroupLineage(toId, toKind, parentGroups));
8312
+ return collectEdgeGroupLineage(fromId, fromKind, parentGroups).find((groupId) => toLineage.has(groupId));
8313
+ }
8284
8314
  // ── Node shapes ───────────────────────────────────────────────────────────
8285
8315
  function renderShape$1(rc, n, palette) {
8286
8316
  const s = n.style ?? {};
@@ -8438,6 +8468,7 @@ var AIDiagram = (function (exports) {
8438
8468
  const [x1, y1] = getConnPoint(src, dstCX, dstCY, e.fromAnchor);
8439
8469
  const [x2, y2] = getConnPoint(dst, srcCX, srcCY, e.toAnchor);
8440
8470
  const eg = mkGroup(`edge-${e.from}-${e.to}`, "eg");
8471
+ setParentGroupData(eg, resolveEdgeParentGroupId(e.from, e.to, nm, tm, gmMap, cm, parentGroups));
8441
8472
  if (e.style?.opacity != null)
8442
8473
  eg.setAttribute("opacity", String(e.style.opacity));
8443
8474
  const len = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) || 1;
@@ -9484,7 +9515,7 @@ var AIDiagram = (function (exports) {
9484
9515
  const getNoteEl = (svg, id) => getEl(svg, `note-${id}`);
9485
9516
  const getChartEl = (svg, id) => getEl(svg, `chart-${id}`);
9486
9517
  const getMarkdownEl = (svg, id) => getEl(svg, `markdown-${id}`);
9487
- const POSITIONABLE_SELECTOR = ".ng, .gg, .tg, .ntg, .cg, .mdg";
9518
+ const POSITIONABLE_SELECTOR = ".ng, .gg, .tg, .ntg, .cg, .eg, .mdg";
9488
9519
  function resolveNonEdgeDrawEl(svg, target) {
9489
9520
  return (getGroupEl(svg, target) ??
9490
9521
  getTableEl(svg, target) ??
@@ -10078,8 +10109,16 @@ var AIDiagram = (function (exports) {
10078
10109
  _buildDrawStepIndex() {
10079
10110
  const drawStepIndexByElementId = new Map();
10080
10111
  forEachPlaybackStep(this.steps, (step, stepIndex) => {
10081
- if (step.action !== "draw" || parseEdgeTarget(step.target))
10112
+ if (step.action !== "draw")
10082
10113
  return;
10114
+ const edge = parseEdgeTarget(step.target);
10115
+ if (edge) {
10116
+ const edgeEl = getEdgeEl(this.svg, edge.from, edge.to);
10117
+ if (edgeEl && !drawStepIndexByElementId.has(edgeEl.id)) {
10118
+ drawStepIndexByElementId.set(edgeEl.id, stepIndex);
10119
+ }
10120
+ return;
10121
+ }
10083
10122
  const el = resolveNonEdgeDrawEl(this.svg, step.target);
10084
10123
  if (el && !drawStepIndexByElementId.has(el.id)) {
10085
10124
  drawStepIndexByElementId.set(el.id, stepIndex);
@@ -10779,6 +10818,7 @@ var AIDiagram = (function (exports) {
10779
10818
  const el = getEdgeEl(this.svg, edge.from, edge.to);
10780
10819
  if (!el)
10781
10820
  return;
10821
+ showDrawEl(el);
10782
10822
  if (silent) {
10783
10823
  revealEdgeInstant(el);
10784
10824
  requestAnimationFrame(() => requestAnimationFrame(() => {
@@ -11392,11 +11432,12 @@ var AIDiagram = (function (exports) {
11392
11432
  .cg.faded, .eg.faded, .mdg.faded { opacity: 0.22; }
11393
11433
 
11394
11434
  .ng.hidden { opacity: 0; pointer-events: none; }
11395
- .gg.gg-hidden { opacity: 0; }
11396
- .tg.gg-hidden { opacity: 0; }
11397
- .ntg.gg-hidden { opacity: 0; }
11398
- .cg.gg-hidden { opacity: 0; }
11399
- .mdg.gg-hidden { opacity: 0; }
11435
+ .gg.gg-hidden { opacity: 0; }
11436
+ .tg.gg-hidden { opacity: 0; }
11437
+ .ntg.gg-hidden { opacity: 0; }
11438
+ .cg.gg-hidden { opacity: 0; }
11439
+ .eg.gg-hidden { opacity: 0; }
11440
+ .mdg.gg-hidden { opacity: 0; }
11400
11441
 
11401
11442
  /* narration caption */
11402
11443
  .skm-caption { pointer-events: none; user-select: none; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sketchmark",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "A plain-text DSL for hand-drawn diagrams. Write boxes, edges, and groups as code — renders sketchy SVG/Canvas via rough.js with a built-in step-by-step animation system.",
5
5
  "keywords": [
6
6
  "diagram",