sketchmark 1.1.6 → 1.2.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.
Potentially problematic release.
This version of sketchmark might be problematic. Click here for more details.
- package/README.md +193 -147
- package/dist/animation/index.d.ts +2 -0
- package/dist/animation/index.d.ts.map +1 -1
- package/dist/ast/types.d.ts +3 -0
- package/dist/ast/types.d.ts.map +1 -1
- package/dist/index.cjs +228 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +228 -95
- package/dist/index.js.map +1 -1
- package/dist/layout/index.d.ts +8 -0
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/parser/index.d.ts +2 -1
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/tokenizer.d.ts.map +1 -1
- package/dist/plugins.d.ts +12 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/render.d.ts +2 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/renderer/shared.d.ts +1 -1
- package/dist/renderer/shared.d.ts.map +1 -1
- package/dist/renderer/svg/index.d.ts.map +1 -1
- package/dist/scene/index.d.ts +2 -0
- package/dist/scene/index.d.ts.map +1 -1
- package/dist/sketchmark.iife.js +228 -95
- package/dist/ui/canvas.d.ts +2 -0
- package/dist/ui/canvas.d.ts.map +1 -1
- package/dist/ui/embed.d.ts +2 -0
- package/dist/ui/embed.d.ts.map +1 -1
- package/package.json +18 -1
package/dist/sketchmark.iife.js
CHANGED
|
@@ -147,10 +147,16 @@ var AIDiagram = (function (exports) {
|
|
|
147
147
|
val += "\n";
|
|
148
148
|
else if (esc === "t")
|
|
149
149
|
val += "\t";
|
|
150
|
+
else if (esc === "r")
|
|
151
|
+
val += "\r";
|
|
150
152
|
else if (esc === "\\")
|
|
151
153
|
val += "\\";
|
|
154
|
+
else if (esc === q)
|
|
155
|
+
val += q;
|
|
156
|
+
else if (esc)
|
|
157
|
+
val += `\\${esc}`;
|
|
152
158
|
else
|
|
153
|
-
val +=
|
|
159
|
+
val += "\\";
|
|
154
160
|
}
|
|
155
161
|
else
|
|
156
162
|
val += src[i];
|
|
@@ -227,6 +233,47 @@ var AIDiagram = (function (exports) {
|
|
|
227
233
|
return tokens;
|
|
228
234
|
}
|
|
229
235
|
|
|
236
|
+
function pluginMessage(plugin, stage, error) {
|
|
237
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
238
|
+
return `Plugin "${plugin.name}" ${stage} failed: ${detail}`;
|
|
239
|
+
}
|
|
240
|
+
function applyPluginPreprocessors(source, plugins = []) {
|
|
241
|
+
let nextSource = source;
|
|
242
|
+
for (const plugin of plugins) {
|
|
243
|
+
if (!plugin.preprocess)
|
|
244
|
+
continue;
|
|
245
|
+
try {
|
|
246
|
+
const transformed = plugin.preprocess(nextSource);
|
|
247
|
+
if (typeof transformed !== "string") {
|
|
248
|
+
throw new Error("preprocess must return a string");
|
|
249
|
+
}
|
|
250
|
+
nextSource = transformed;
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
throw new Error(pluginMessage(plugin, "preprocess", error));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return nextSource;
|
|
257
|
+
}
|
|
258
|
+
function applyPluginAstTransforms(ast, plugins = []) {
|
|
259
|
+
let nextAst = ast;
|
|
260
|
+
for (const plugin of plugins) {
|
|
261
|
+
if (!plugin.transformAst)
|
|
262
|
+
continue;
|
|
263
|
+
try {
|
|
264
|
+
const transformed = plugin.transformAst(nextAst);
|
|
265
|
+
if (!transformed || transformed.kind !== "diagram") {
|
|
266
|
+
throw new Error('transformAst must return a DiagramAST with kind="diagram"');
|
|
267
|
+
}
|
|
268
|
+
nextAst = transformed;
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
throw new Error(pluginMessage(plugin, "transformAst", error));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return nextAst;
|
|
275
|
+
}
|
|
276
|
+
|
|
230
277
|
// ============================================================
|
|
231
278
|
// sketchmark - Parser (Tokens -> DiagramAST)
|
|
232
279
|
// ============================================================
|
|
@@ -313,9 +360,10 @@ var AIDiagram = (function (exports) {
|
|
|
313
360
|
function isPropKeyToken(t) {
|
|
314
361
|
return !!t && (t.type === "IDENT" || t.type === "KEYWORD");
|
|
315
362
|
}
|
|
316
|
-
function parse(src) {
|
|
363
|
+
function parse(src, options = {}) {
|
|
317
364
|
resetUid();
|
|
318
|
-
const
|
|
365
|
+
const preparedSource = applyPluginPreprocessors(src, options.plugins);
|
|
366
|
+
const tokens = tokenize$1(preparedSource).filter((t) => t.type !== "NEWLINE" || t.value === "\n");
|
|
319
367
|
const flat = [];
|
|
320
368
|
let lastNL = false;
|
|
321
369
|
for (const t of tokens) {
|
|
@@ -498,6 +546,7 @@ var AIDiagram = (function (exports) {
|
|
|
498
546
|
const toks = lineTokens();
|
|
499
547
|
const id = requireExplicitId(keywordTok, toks);
|
|
500
548
|
const props = parseSimpleProps(toks, 1);
|
|
549
|
+
const meta = extractNodeMeta(props);
|
|
501
550
|
const node = {
|
|
502
551
|
kind: "node",
|
|
503
552
|
id,
|
|
@@ -512,6 +561,7 @@ var AIDiagram = (function (exports) {
|
|
|
512
561
|
...(props.dy ? { dy: parseFloat(props.dy) } : {}),
|
|
513
562
|
...(props.factor ? { factor: parseFloat(props.factor) } : {}),
|
|
514
563
|
...(props.theme ? { theme: props.theme } : {}),
|
|
564
|
+
...(meta ? { meta } : {}),
|
|
515
565
|
style: propsToStyle(props),
|
|
516
566
|
};
|
|
517
567
|
if (props.url)
|
|
@@ -536,12 +586,14 @@ var AIDiagram = (function (exports) {
|
|
|
536
586
|
j = 2;
|
|
537
587
|
}
|
|
538
588
|
Object.assign(props, parseSimpleProps(toks, j));
|
|
589
|
+
const meta = extractNodeMeta(props);
|
|
539
590
|
return {
|
|
540
591
|
kind: "node",
|
|
541
592
|
id,
|
|
542
593
|
shape: "note",
|
|
543
594
|
label: (props.label ?? "").replace(/\\n/g, "\n"),
|
|
544
595
|
theme: props.theme,
|
|
596
|
+
...(meta ? { meta } : {}),
|
|
545
597
|
style: propsToStyle(props),
|
|
546
598
|
...(props.width ? { width: parseFloat(props.width) } : {}),
|
|
547
599
|
...(props.height ? { height: parseFloat(props.height) } : {}),
|
|
@@ -553,6 +605,13 @@ var AIDiagram = (function (exports) {
|
|
|
553
605
|
...(props.factor ? { factor: parseFloat(props.factor) } : {}),
|
|
554
606
|
};
|
|
555
607
|
}
|
|
608
|
+
function extractNodeMeta(props) {
|
|
609
|
+
const meta = {};
|
|
610
|
+
if (props["animation-parent"]) {
|
|
611
|
+
meta.animationParent = props["animation-parent"];
|
|
612
|
+
}
|
|
613
|
+
return Object.keys(meta).length ? meta : undefined;
|
|
614
|
+
}
|
|
556
615
|
function parseGroup() {
|
|
557
616
|
const keywordTok = cur();
|
|
558
617
|
skip();
|
|
@@ -625,6 +684,8 @@ var AIDiagram = (function (exports) {
|
|
|
625
684
|
to: toTok.value,
|
|
626
685
|
connector: connector,
|
|
627
686
|
label: props.label,
|
|
687
|
+
fromAnchor: props["anchor-from"],
|
|
688
|
+
toAnchor: props["anchor-to"],
|
|
628
689
|
dashed,
|
|
629
690
|
bidirectional,
|
|
630
691
|
style: propsToStyle(props),
|
|
@@ -938,6 +999,7 @@ var AIDiagram = (function (exports) {
|
|
|
938
999
|
registerAuthoredId(grp.id, "group", t);
|
|
939
1000
|
if (isBare) {
|
|
940
1001
|
grp.label = "";
|
|
1002
|
+
grp.padding = grp.padding ?? 0;
|
|
941
1003
|
grp.style = {
|
|
942
1004
|
...grp.style,
|
|
943
1005
|
fill: grp.style?.fill ?? "none",
|
|
@@ -1108,7 +1170,7 @@ var AIDiagram = (function (exports) {
|
|
|
1108
1170
|
node.style = { ...ast.styles[node.id], ...node.style };
|
|
1109
1171
|
}
|
|
1110
1172
|
}
|
|
1111
|
-
return ast;
|
|
1173
|
+
return applyPluginAstTransforms(ast, options.plugins);
|
|
1112
1174
|
}
|
|
1113
1175
|
|
|
1114
1176
|
// ============================================================
|
|
@@ -3555,6 +3617,8 @@ var AIDiagram = (function (exports) {
|
|
|
3555
3617
|
to: e.to,
|
|
3556
3618
|
connector: e.connector,
|
|
3557
3619
|
label: e.label,
|
|
3620
|
+
fromAnchor: e.fromAnchor,
|
|
3621
|
+
toAnchor: e.toAnchor,
|
|
3558
3622
|
dashed: e.dashed ?? false,
|
|
3559
3623
|
bidirectional: e.bidirectional ?? false,
|
|
3560
3624
|
style: e.style ?? {},
|
|
@@ -4132,28 +4196,13 @@ var AIDiagram = (function (exports) {
|
|
|
4132
4196
|
return { arrowAt: "start", dashed };
|
|
4133
4197
|
return { arrowAt: "end", dashed };
|
|
4134
4198
|
}
|
|
4135
|
-
// ── Generic rect connection point ────────────────────────────────────────
|
|
4136
|
-
function rectConnPoint$1(rx, ry, rw, rh, ox, oy) {
|
|
4137
|
-
const cx = rx + rw / 2, cy = ry + rh / 2;
|
|
4138
|
-
const dx = ox - cx, dy = oy - cy;
|
|
4139
|
-
if (Math.abs(dx) < 0.01 && Math.abs(dy) < 0.01)
|
|
4140
|
-
return [cx, cy];
|
|
4141
|
-
const hw = rw / 2 - 2, hh = rh / 2 - 2;
|
|
4142
|
-
const tx = Math.abs(dx) > 0.01 ? hw / Math.abs(dx) : 1e9;
|
|
4143
|
-
const ty = Math.abs(dy) > 0.01 ? hh / Math.abs(dy) : 1e9;
|
|
4144
|
-
const t = Math.min(tx, ty);
|
|
4145
|
-
return [cx + t * dx, cy + t * dy];
|
|
4146
|
-
}
|
|
4147
4199
|
// ── Resolve an endpoint entity by ID across all maps ─────────────────────
|
|
4148
4200
|
function resolveEndpoint(id, nm, tm, gm, cm) {
|
|
4149
4201
|
return nm.get(id) ?? tm.get(id) ?? gm.get(id) ?? cm.get(id) ?? null;
|
|
4150
4202
|
}
|
|
4151
4203
|
// ── Get connection point for any entity ──────────────────────────────────
|
|
4152
|
-
function getConnPoint(src, dstCX, dstCY) {
|
|
4153
|
-
|
|
4154
|
-
return connPoint(src, { x: dstCX - 1, y: dstCY - 1, w: 2, h: 2});
|
|
4155
|
-
}
|
|
4156
|
-
return rectConnPoint$1(src.x, src.y, src.w, src.h, dstCX, dstCY);
|
|
4204
|
+
function getConnPoint(src, dstCX, dstCY, anchor) {
|
|
4205
|
+
return anchoredConnPoint(src, anchor, dstCX, dstCY);
|
|
4157
4206
|
}
|
|
4158
4207
|
// ── Group depth (for paint order) ────────────────────────────────────────
|
|
4159
4208
|
function groupDepth(g, gm) {
|
|
@@ -4588,6 +4637,50 @@ var AIDiagram = (function (exports) {
|
|
|
4588
4637
|
const t = Math.min(tx, ty);
|
|
4589
4638
|
return [cx + t * dx, cy + t * dy];
|
|
4590
4639
|
}
|
|
4640
|
+
function clampInset(value) {
|
|
4641
|
+
return Math.max(2, value);
|
|
4642
|
+
}
|
|
4643
|
+
function anchoredConnPoint(entity, anchor, otherCX, otherCY) {
|
|
4644
|
+
if (!anchor) {
|
|
4645
|
+
if (entity.shape && otherCX != null && otherCY != null) {
|
|
4646
|
+
return connPoint(entity, { x: otherCX - 1, y: otherCY - 1, w: 2, h: 2});
|
|
4647
|
+
}
|
|
4648
|
+
if (otherCX != null && otherCY != null) {
|
|
4649
|
+
return rectConnPoint(entity.x, entity.y, entity.w, entity.h, otherCX, otherCY);
|
|
4650
|
+
}
|
|
4651
|
+
return [entity.x + entity.w / 2, entity.y + entity.h / 2];
|
|
4652
|
+
}
|
|
4653
|
+
const insetX = clampInset(Math.min(10, entity.w / 2));
|
|
4654
|
+
const insetY = clampInset(Math.min(10, entity.h / 2));
|
|
4655
|
+
const left = entity.x + insetX;
|
|
4656
|
+
const right = entity.x + entity.w - insetX;
|
|
4657
|
+
const top = entity.y + insetY;
|
|
4658
|
+
const bottom = entity.y + entity.h - insetY;
|
|
4659
|
+
const cx = entity.x + entity.w / 2;
|
|
4660
|
+
const cy = entity.y + entity.h / 2;
|
|
4661
|
+
switch (anchor) {
|
|
4662
|
+
case "top":
|
|
4663
|
+
return [cx, top];
|
|
4664
|
+
case "right":
|
|
4665
|
+
return [right, cy];
|
|
4666
|
+
case "bottom":
|
|
4667
|
+
return [cx, bottom];
|
|
4668
|
+
case "left":
|
|
4669
|
+
return [left, cy];
|
|
4670
|
+
case "center":
|
|
4671
|
+
return [cx, cy];
|
|
4672
|
+
case "top-left":
|
|
4673
|
+
return [left, top];
|
|
4674
|
+
case "top-right":
|
|
4675
|
+
return [right, top];
|
|
4676
|
+
case "bottom-left":
|
|
4677
|
+
return [left, bottom];
|
|
4678
|
+
case "bottom-right":
|
|
4679
|
+
return [right, bottom];
|
|
4680
|
+
default:
|
|
4681
|
+
return [cx, cy];
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4591
4684
|
function rectConnPoint(rx, ry, rw, rh, ox, oy) {
|
|
4592
4685
|
const cx = rx + rw / 2, cy = ry + rh / 2;
|
|
4593
4686
|
const dx = ox - cx, dy = oy - cy;
|
|
@@ -4619,17 +4712,6 @@ var AIDiagram = (function (exports) {
|
|
|
4619
4712
|
return c;
|
|
4620
4713
|
return null;
|
|
4621
4714
|
}
|
|
4622
|
-
function connPt(src, dstCX, dstCY) {
|
|
4623
|
-
// SceneNode has a .shape field; use the existing connPoint for it
|
|
4624
|
-
if ("shape" in src && src.shape) {
|
|
4625
|
-
return connPoint(src, {
|
|
4626
|
-
x: dstCX - 1,
|
|
4627
|
-
y: dstCY - 1,
|
|
4628
|
-
w: 2,
|
|
4629
|
-
h: 2});
|
|
4630
|
-
}
|
|
4631
|
-
return rectConnPoint(src.x, src.y, src.w, src.h, dstCX, dstCY);
|
|
4632
|
-
}
|
|
4633
4715
|
for (const e of sg.edges) {
|
|
4634
4716
|
const src = resolve(e.from);
|
|
4635
4717
|
const dst = resolve(e.to);
|
|
@@ -4639,7 +4721,10 @@ var AIDiagram = (function (exports) {
|
|
|
4639
4721
|
}
|
|
4640
4722
|
const dstCX = dst.x + dst.w / 2, dstCY = dst.y + dst.h / 2;
|
|
4641
4723
|
const srcCX = src.x + src.w / 2, srcCY = src.y + src.h / 2;
|
|
4642
|
-
e.points = [
|
|
4724
|
+
e.points = [
|
|
4725
|
+
anchoredConnPoint(src, e.fromAnchor, dstCX, dstCY),
|
|
4726
|
+
anchoredConnPoint(dst, e.toAnchor, srcCX, srcCY),
|
|
4727
|
+
];
|
|
4643
4728
|
}
|
|
4644
4729
|
}
|
|
4645
4730
|
function computeBounds(sg, margin) {
|
|
@@ -7780,8 +7865,8 @@ var AIDiagram = (function (exports) {
|
|
|
7780
7865
|
continue;
|
|
7781
7866
|
const dstCX = dst.x + dst.w / 2, dstCY = dst.y + dst.h / 2;
|
|
7782
7867
|
const srcCX = src.x + src.w / 2, srcCY = src.y + src.h / 2;
|
|
7783
|
-
const [x1, y1] = getConnPoint(src, dstCX, dstCY);
|
|
7784
|
-
const [x2, y2] = getConnPoint(dst, srcCX, srcCY);
|
|
7868
|
+
const [x1, y1] = getConnPoint(src, dstCX, dstCY, e.fromAnchor);
|
|
7869
|
+
const [x2, y2] = getConnPoint(dst, srcCX, srcCY, e.toAnchor);
|
|
7785
7870
|
const eg = mkGroup(`edge-${e.from}-${e.to}`, "eg");
|
|
7786
7871
|
if (e.style?.opacity != null)
|
|
7787
7872
|
eg.setAttribute("opacity", String(e.style.opacity));
|
|
@@ -7858,6 +7943,8 @@ var AIDiagram = (function (exports) {
|
|
|
7858
7943
|
ng.dataset.h = String(n.h);
|
|
7859
7944
|
if (n.pathData)
|
|
7860
7945
|
ng.dataset.pathData = n.pathData;
|
|
7946
|
+
if (n.meta?.animationParent)
|
|
7947
|
+
ng.dataset.animationParent = n.meta.animationParent;
|
|
7861
7948
|
if (n.style?.opacity != null)
|
|
7862
7949
|
ng.setAttribute("opacity", String(n.style.opacity));
|
|
7863
7950
|
// ── Static transform (deg, dx, dy, factor) ──────────
|
|
@@ -8511,8 +8598,8 @@ var AIDiagram = (function (exports) {
|
|
|
8511
8598
|
continue;
|
|
8512
8599
|
const dstCX = dst.x + dst.w / 2, dstCY = dst.y + dst.h / 2;
|
|
8513
8600
|
const srcCX = src.x + src.w / 2, srcCY = src.y + src.h / 2;
|
|
8514
|
-
const [x1, y1] = getConnPoint(src, dstCX, dstCY);
|
|
8515
|
-
const [x2, y2] = getConnPoint(dst, srcCX, srcCY);
|
|
8601
|
+
const [x1, y1] = getConnPoint(src, dstCX, dstCY, e.fromAnchor);
|
|
8602
|
+
const [x2, y2] = getConnPoint(dst, srcCX, srcCY, e.toAnchor);
|
|
8516
8603
|
if (e.style?.opacity != null)
|
|
8517
8604
|
ctx.globalAlpha = Number(e.style.opacity);
|
|
8518
8605
|
const ecol = String(e.style?.stroke ?? palette.edgeStroke);
|
|
@@ -9369,6 +9456,13 @@ var AIDiagram = (function (exports) {
|
|
|
9369
9456
|
this.drawTargetNodes.delete(`node-${s.target}`);
|
|
9370
9457
|
}
|
|
9371
9458
|
}
|
|
9459
|
+
this._relatedElementIdsByPrimaryId = this._buildRelatedElementIndex();
|
|
9460
|
+
for (const nodeId of Array.from(this.drawTargetNodes)) {
|
|
9461
|
+
const relatedIds = this._relatedElementIdsByPrimaryId.get(nodeId);
|
|
9462
|
+
if (!relatedIds)
|
|
9463
|
+
continue;
|
|
9464
|
+
relatedIds.forEach((id) => this.drawTargetNodes.add(id));
|
|
9465
|
+
}
|
|
9372
9466
|
this._drawStepIndexByElementId = this._buildDrawStepIndex();
|
|
9373
9467
|
const { parentGroupByElementId, groupDescendantIds } = this._buildGroupVisibilityIndex();
|
|
9374
9468
|
this._parentGroupByElementId = parentGroupByElementId;
|
|
@@ -9399,10 +9493,30 @@ var AIDiagram = (function (exports) {
|
|
|
9399
9493
|
const el = resolveNonEdgeDrawEl(this.svg, step.target);
|
|
9400
9494
|
if (el && !drawStepIndexByElementId.has(el.id)) {
|
|
9401
9495
|
drawStepIndexByElementId.set(el.id, stepIndex);
|
|
9496
|
+
this._relatedElementIdsByPrimaryId.get(el.id)?.forEach((relatedId) => {
|
|
9497
|
+
if (!drawStepIndexByElementId.has(relatedId)) {
|
|
9498
|
+
drawStepIndexByElementId.set(relatedId, stepIndex);
|
|
9499
|
+
}
|
|
9500
|
+
});
|
|
9402
9501
|
}
|
|
9403
9502
|
});
|
|
9404
9503
|
return drawStepIndexByElementId;
|
|
9405
9504
|
}
|
|
9505
|
+
_buildRelatedElementIndex() {
|
|
9506
|
+
const relatedElementIdsByPrimaryId = new Map();
|
|
9507
|
+
this.svg.querySelectorAll(POSITIONABLE_SELECTOR).forEach((el) => {
|
|
9508
|
+
const animationParent = el.dataset.animationParent;
|
|
9509
|
+
if (!animationParent)
|
|
9510
|
+
return;
|
|
9511
|
+
const primaryEl = resolveNonEdgeDrawEl(this.svg, animationParent);
|
|
9512
|
+
if (!primaryEl || primaryEl.id === el.id)
|
|
9513
|
+
return;
|
|
9514
|
+
const related = relatedElementIdsByPrimaryId.get(primaryEl.id) ?? new Set();
|
|
9515
|
+
related.add(el.id);
|
|
9516
|
+
relatedElementIdsByPrimaryId.set(primaryEl.id, related);
|
|
9517
|
+
});
|
|
9518
|
+
return relatedElementIdsByPrimaryId;
|
|
9519
|
+
}
|
|
9406
9520
|
_buildGroupVisibilityIndex() {
|
|
9407
9521
|
const parentGroupByElementId = new Map();
|
|
9408
9522
|
const directChildIdsByGroup = new Map();
|
|
@@ -9481,10 +9595,18 @@ var AIDiagram = (function (exports) {
|
|
|
9481
9595
|
const el = resolveEl(this.svg, target);
|
|
9482
9596
|
if (!el)
|
|
9483
9597
|
return [];
|
|
9484
|
-
if (!el.id.startsWith("group-"))
|
|
9485
|
-
|
|
9598
|
+
if (!el.id.startsWith("group-")) {
|
|
9599
|
+
const ids = new Set([el.id]);
|
|
9600
|
+
this._relatedElementIdsByPrimaryId.get(el.id)?.forEach((id) => ids.add(id));
|
|
9601
|
+
return Array.from(ids)
|
|
9602
|
+
.map((id) => getEl(this.svg, id))
|
|
9603
|
+
.filter((candidate) => candidate != null);
|
|
9604
|
+
}
|
|
9486
9605
|
const ids = new Set([el.id]);
|
|
9487
9606
|
this._groupDescendantIds.get(el.id)?.forEach((id) => ids.add(id));
|
|
9607
|
+
Array.from(ids).forEach((id) => {
|
|
9608
|
+
this._relatedElementIdsByPrimaryId.get(id)?.forEach((relatedId) => ids.add(relatedId));
|
|
9609
|
+
});
|
|
9488
9610
|
return Array.from(ids)
|
|
9489
9611
|
.map((id) => getEl(this.svg, id))
|
|
9490
9612
|
.filter((candidate) => candidate != null);
|
|
@@ -9893,9 +10015,11 @@ var AIDiagram = (function (exports) {
|
|
|
9893
10015
|
// ── highlight ────────────────────────────────────────────
|
|
9894
10016
|
_doHighlight(target) {
|
|
9895
10017
|
this.svg
|
|
9896
|
-
.querySelectorAll(".ng.hl, .tg.hl, .ntg.hl, .cg.hl, .eg.hl")
|
|
10018
|
+
.querySelectorAll(".ng.hl, .gg.hl, .tg.hl, .ntg.hl, .cg.hl, .mdg.hl, .eg.hl")
|
|
9897
10019
|
.forEach((e) => e.classList.remove("hl"));
|
|
9898
|
-
|
|
10020
|
+
for (const el of this._resolveCascadeTargets(target)) {
|
|
10021
|
+
el.classList.add("hl");
|
|
10022
|
+
}
|
|
9899
10023
|
}
|
|
9900
10024
|
// ── fade / unfade ─────────────────────────────────────────
|
|
9901
10025
|
_doFade(target, doFade) {
|
|
@@ -9931,8 +10055,8 @@ var AIDiagram = (function (exports) {
|
|
|
9931
10055
|
}
|
|
9932
10056
|
// ── move ──────────────────────────────────────────────────
|
|
9933
10057
|
_doMove(target, step, silent) {
|
|
9934
|
-
const
|
|
9935
|
-
if (!
|
|
10058
|
+
const targets = this._resolveCascadeTargets(target);
|
|
10059
|
+
if (!targets.length)
|
|
9936
10060
|
return;
|
|
9937
10061
|
const cur = this._transforms.get(target) ?? {
|
|
9938
10062
|
tx: 0,
|
|
@@ -9945,12 +10069,14 @@ var AIDiagram = (function (exports) {
|
|
|
9945
10069
|
tx: cur.tx + (step.dx ?? 0),
|
|
9946
10070
|
ty: cur.ty + (step.dy ?? 0),
|
|
9947
10071
|
});
|
|
9948
|
-
|
|
10072
|
+
for (const el of targets) {
|
|
10073
|
+
this._writeTransform(el, target, silent, step.duration ?? 420);
|
|
10074
|
+
}
|
|
9949
10075
|
}
|
|
9950
10076
|
// ── scale ─────────────────────────────────────────────────
|
|
9951
10077
|
_doScale(target, step, silent) {
|
|
9952
|
-
const
|
|
9953
|
-
if (!
|
|
10078
|
+
const targets = this._resolveCascadeTargets(target);
|
|
10079
|
+
if (!targets.length)
|
|
9954
10080
|
return;
|
|
9955
10081
|
const cur = this._transforms.get(target) ?? {
|
|
9956
10082
|
tx: 0,
|
|
@@ -9959,12 +10085,14 @@ var AIDiagram = (function (exports) {
|
|
|
9959
10085
|
rotate: 0,
|
|
9960
10086
|
};
|
|
9961
10087
|
this._transforms.set(target, { ...cur, scale: step.factor ?? 1 });
|
|
9962
|
-
|
|
10088
|
+
for (const el of targets) {
|
|
10089
|
+
this._writeTransform(el, target, silent, step.duration ?? 350);
|
|
10090
|
+
}
|
|
9963
10091
|
}
|
|
9964
10092
|
// ── rotate ────────────────────────────────────────────────
|
|
9965
10093
|
_doRotate(target, step, silent) {
|
|
9966
|
-
const
|
|
9967
|
-
if (!
|
|
10094
|
+
const targets = this._resolveCascadeTargets(target);
|
|
10095
|
+
if (!targets.length)
|
|
9968
10096
|
return;
|
|
9969
10097
|
const cur = this._transforms.get(target) ?? {
|
|
9970
10098
|
tx: 0,
|
|
@@ -9976,7 +10104,9 @@ var AIDiagram = (function (exports) {
|
|
|
9976
10104
|
...cur,
|
|
9977
10105
|
rotate: cur.rotate + (step.deg ?? 0),
|
|
9978
10106
|
});
|
|
9979
|
-
|
|
10107
|
+
for (const el of targets) {
|
|
10108
|
+
this._writeTransform(el, target, silent, step.duration ?? 400);
|
|
10109
|
+
}
|
|
9980
10110
|
}
|
|
9981
10111
|
_doDraw(step, silent) {
|
|
9982
10112
|
const { target } = step;
|
|
@@ -10120,18 +10250,20 @@ var AIDiagram = (function (exports) {
|
|
|
10120
10250
|
return;
|
|
10121
10251
|
}
|
|
10122
10252
|
// ── Node draw ──────────────────────────────────────
|
|
10123
|
-
const
|
|
10124
|
-
if (!
|
|
10253
|
+
const nodeEls = this._resolveCascadeTargets(target).filter((el) => el.classList.contains("ng"));
|
|
10254
|
+
if (!nodeEls.length)
|
|
10125
10255
|
return;
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10256
|
+
for (const nodeEl of nodeEls) {
|
|
10257
|
+
showDrawEl(nodeEl);
|
|
10258
|
+
if (silent) {
|
|
10259
|
+
revealNodeInstant(nodeEl);
|
|
10260
|
+
}
|
|
10261
|
+
else {
|
|
10262
|
+
if (!nodeGuidePathEl(nodeEl) && !nodeEl.querySelector("path")?.style.strokeDasharray) {
|
|
10263
|
+
prepareNodeForDraw(nodeEl);
|
|
10264
|
+
}
|
|
10265
|
+
animateNodeDraw(nodeEl, step.duration ?? ANIMATION.nodeStrokeDur, step.duration ?? ANIMATION.textRevealMs);
|
|
10133
10266
|
}
|
|
10134
|
-
animateNodeDraw(nodeEl, step.duration ?? ANIMATION.nodeStrokeDur, step.duration ?? ANIMATION.textRevealMs);
|
|
10135
10267
|
}
|
|
10136
10268
|
}
|
|
10137
10269
|
// ── erase ─────────────────────────────────────────────────
|
|
@@ -10152,45 +10284,44 @@ var AIDiagram = (function (exports) {
|
|
|
10152
10284
|
}
|
|
10153
10285
|
// ── pulse ─────────────────────────────────────────────────
|
|
10154
10286
|
_doPulse(target, duration = 500) {
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10287
|
+
for (const el of this._resolveCascadeTargets(target)) {
|
|
10288
|
+
el.animate([
|
|
10289
|
+
{ filter: "brightness(1)" },
|
|
10290
|
+
{ filter: "brightness(1.6)" },
|
|
10291
|
+
{ filter: "brightness(1)" },
|
|
10292
|
+
], { duration, iterations: 3 });
|
|
10293
|
+
}
|
|
10160
10294
|
}
|
|
10161
10295
|
// ── color ─────────────────────────────────────────────────
|
|
10162
10296
|
_doColor(target, color) {
|
|
10163
10297
|
if (!color)
|
|
10164
10298
|
return;
|
|
10165
|
-
const el
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
if (attrFill === null && c.tagName === "path")
|
|
10186
|
-
return;
|
|
10187
|
-
c.style.fill = color;
|
|
10188
|
-
hit = true;
|
|
10189
|
-
});
|
|
10190
|
-
if (!hit) {
|
|
10191
|
-
el.querySelectorAll("text").forEach((t) => {
|
|
10192
|
-
t.style.fill = color;
|
|
10299
|
+
for (const el of this._resolveCascadeTargets(target)) {
|
|
10300
|
+
if (parseEdgeTarget(target)) {
|
|
10301
|
+
el.querySelectorAll("path, line, polyline").forEach((p) => {
|
|
10302
|
+
p.style.stroke = color;
|
|
10303
|
+
});
|
|
10304
|
+
el.querySelectorAll("polygon").forEach((p) => {
|
|
10305
|
+
p.style.fill = color;
|
|
10306
|
+
p.style.stroke = color;
|
|
10307
|
+
});
|
|
10308
|
+
continue;
|
|
10309
|
+
}
|
|
10310
|
+
let hit = false;
|
|
10311
|
+
el.querySelectorAll("path, rect, ellipse, polygon").forEach((c) => {
|
|
10312
|
+
const attrFill = c.getAttribute("fill");
|
|
10313
|
+
if (attrFill === "none")
|
|
10314
|
+
return;
|
|
10315
|
+
if (attrFill === null && c.tagName === "path")
|
|
10316
|
+
return;
|
|
10317
|
+
c.style.fill = color;
|
|
10318
|
+
hit = true;
|
|
10193
10319
|
});
|
|
10320
|
+
if (!hit) {
|
|
10321
|
+
el.querySelectorAll("text").forEach((t) => {
|
|
10322
|
+
t.style.fill = color;
|
|
10323
|
+
});
|
|
10324
|
+
}
|
|
10194
10325
|
}
|
|
10195
10326
|
}
|
|
10196
10327
|
// ── narration ───────────────────────────────────────────
|
|
@@ -10784,7 +10915,7 @@ var AIDiagram = (function (exports) {
|
|
|
10784
10915
|
}
|
|
10785
10916
|
|
|
10786
10917
|
function render(options) {
|
|
10787
|
-
const { container: rawContainer, dsl, renderer = "svg", injectCSS = true, tts, svgOptions = {}, canvasOptions = {}, onNodeClick, onReady, } = options;
|
|
10918
|
+
const { container: rawContainer, dsl, plugins, renderer = "svg", injectCSS = true, tts, svgOptions = {}, canvasOptions = {}, onNodeClick, onReady, } = options;
|
|
10788
10919
|
if (injectCSS && !document.getElementById("ai-diagram-css")) {
|
|
10789
10920
|
const style = document.createElement("style");
|
|
10790
10921
|
style.id = "ai-diagram-css";
|
|
@@ -10800,7 +10931,7 @@ var AIDiagram = (function (exports) {
|
|
|
10800
10931
|
else {
|
|
10801
10932
|
el = rawContainer;
|
|
10802
10933
|
}
|
|
10803
|
-
const ast = parse(dsl);
|
|
10934
|
+
const ast = parse(dsl, { plugins });
|
|
10804
10935
|
const scene = buildSceneGraph(ast);
|
|
10805
10936
|
layout(scene);
|
|
10806
10937
|
let svg;
|
|
@@ -11144,6 +11275,7 @@ var AIDiagram = (function (exports) {
|
|
|
11144
11275
|
const instance = render({
|
|
11145
11276
|
container: this.diagramWrap,
|
|
11146
11277
|
dsl: this.dsl,
|
|
11278
|
+
plugins: this.options.plugins,
|
|
11147
11279
|
renderer: this.renderer,
|
|
11148
11280
|
svgOptions: { interactive: true, showTitle: true, theme: this.options.svgOptions?.theme ?? this.theme, ...this.options.svgOptions },
|
|
11149
11281
|
canvasOptions: this.options.canvasOptions,
|
|
@@ -12221,6 +12353,7 @@ var AIDiagram = (function (exports) {
|
|
|
12221
12353
|
const instance = render({
|
|
12222
12354
|
container: this.diagramWrap,
|
|
12223
12355
|
dsl: this.dsl,
|
|
12356
|
+
plugins: this.options.plugins,
|
|
12224
12357
|
renderer: "svg",
|
|
12225
12358
|
svgOptions: {
|
|
12226
12359
|
showTitle: true,
|
package/dist/ui/canvas.d.ts
CHANGED
|
@@ -4,10 +4,12 @@ import type { ASTStepItem } from "../ast/types";
|
|
|
4
4
|
import type { SVGRendererOptions } from "../renderer/svg";
|
|
5
5
|
import type { CanvasRendererOptions } from "../renderer/canvas";
|
|
6
6
|
import type { SketchmarkEditor } from "./editor";
|
|
7
|
+
import type { SketchmarkPlugin } from "../plugins";
|
|
7
8
|
type CanvasTheme = "light" | "dark";
|
|
8
9
|
export interface SketchmarkCanvasOptions {
|
|
9
10
|
container: ContainerTarget;
|
|
10
11
|
dsl?: string;
|
|
12
|
+
plugins?: readonly SketchmarkPlugin[];
|
|
11
13
|
renderer?: "svg" | "canvas";
|
|
12
14
|
theme?: CanvasTheme;
|
|
13
15
|
autoFit?: boolean;
|
package/dist/ui/canvas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/ui/canvas.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/ui/canvas.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC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C,cAAc;IAUtB,OAAO,CAAC,sBAAsB;IAyB9B,OAAO,CAAC,oBAAoB;IA0E5B,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,UAAU;CAInB"}
|
package/dist/ui/embed.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ import { type ContainerTarget } from "./shared";
|
|
|
2
2
|
import type { DiagramInstance } from "../render";
|
|
3
3
|
import type { ASTStepItem } from "../ast/types";
|
|
4
4
|
import type { SVGRendererOptions } from "../renderer/svg";
|
|
5
|
+
import type { SketchmarkPlugin } from "../plugins";
|
|
5
6
|
type EmbedTheme = "light" | "dark";
|
|
6
7
|
type EmbedSize = number | string;
|
|
7
8
|
export interface SketchmarkEmbedOptions {
|
|
8
9
|
container: ContainerTarget;
|
|
9
10
|
dsl: string;
|
|
11
|
+
plugins?: readonly SketchmarkPlugin[];
|
|
10
12
|
width?: EmbedSize;
|
|
11
13
|
height?: EmbedSize;
|
|
12
14
|
theme?: EmbedTheme;
|
package/dist/ui/embed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/ui/embed.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/ui/embed.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,E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