aidiagram-js 0.1.0 → 0.1.1
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/package.json +1 -1
- package/src/element.js +5 -3
- package/src/geometry.js +12 -12
- package/src/layouts/fan.js +23 -23
- package/src/layouts/flow.js +19 -9
- package/src/layouts/graph.js +44 -24
- package/src/layouts/loop.js +18 -18
- package/src/layouts/map.js +11 -11
- package/src/layouts/sequence.js +29 -28
- package/src/layouts/stack.js +15 -15
- package/src/layouts/timeline.js +12 -12
- package/src/styles.js +39 -37
- package/src/svgExport.js +34 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aidiagram-js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Turn Mermaid flowcharts and sequence diagrams into interactive, offline-ready animated walkthroughs (zero-dependency Web Component + ESM engine).",
|
|
6
6
|
"author": "PraisonAI",
|
package/src/element.js
CHANGED
|
@@ -111,7 +111,7 @@ function downloadPngFromSvg(filename, svgString, width, height) {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
function buildPacket(d, cls, keyPoints, begin = '0s') {
|
|
114
|
-
const dot = svgEl('circle', { r: 3.
|
|
114
|
+
const dot = svgEl('circle', { r: 3.4, class: cls === 'back' ? 'pv-packet back' : 'pv-packet' })
|
|
115
115
|
const motion = svgEl('animateMotion', {
|
|
116
116
|
dur: cls === 'back' ? '2.2s' : '1.7s',
|
|
117
117
|
begin,
|
|
@@ -458,7 +458,9 @@ export class PraisonaiDiagramElement extends BaseElement {
|
|
|
458
458
|
const bar = el('div', { class: 'pv-bar' })
|
|
459
459
|
const titleWrap = el('div', { class: 'pv-title' })
|
|
460
460
|
titleWrap.appendChild(el('span', { class: 'pv-kind' }, scene.type))
|
|
461
|
-
|
|
461
|
+
if (scene.eyebrow) {
|
|
462
|
+
titleWrap.appendChild(el('span', { class: 'pv-label', title: scene.label }, scene.eyebrow))
|
|
463
|
+
}
|
|
462
464
|
bar.appendChild(titleWrap)
|
|
463
465
|
|
|
464
466
|
const actions = el('div', { class: 'pv-actions' })
|
|
@@ -474,7 +476,7 @@ export class PraisonaiDiagramElement extends BaseElement {
|
|
|
474
476
|
if (total > 1) {
|
|
475
477
|
addBtn(this._playing ? 'Pause walkthrough' : 'Play walkthrough', this._playing ? 'pause' : 'play', () => this._togglePlay(), { 'aria-pressed': String(this._playing) }, this._playing ? 'Pause' : 'Play')
|
|
476
478
|
addBtn('Previous step', 'prev', () => this._stepBy(-1))
|
|
477
|
-
actions.appendChild(el('span', { class: 'pv-counter'
|
|
479
|
+
actions.appendChild(el('span', { class: 'pv-counter' }, `${this._selectedIdx !== null ? this._selectedIdx + 1 : 0}/${total}`))
|
|
478
480
|
addBtn('Next step', 'next', () => this._stepBy(1))
|
|
479
481
|
if (this._selectedIdx !== null) {
|
|
480
482
|
addBtn('Reset selection', 'reset', () => { this._stopPlay(); this._selectedIdx = null; this._render() })
|
package/src/geometry.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { safeHref } from './parser.js'
|
|
6
6
|
|
|
7
|
-
export const PAD =
|
|
7
|
+
export const PAD = 18
|
|
8
8
|
|
|
9
9
|
export const r1 = (n) => Math.round(n * 10) / 10
|
|
10
10
|
export const tw = (s, px, mono = false) => String(s).length * px * (mono ? 0.62 : 0.56)
|
|
11
11
|
|
|
12
|
-
export function wrap(s, maxPx, px =
|
|
12
|
+
export function wrap(s, maxPx, px = 13.5) {
|
|
13
13
|
const words = String(s).split(/\s+/).filter(Boolean)
|
|
14
14
|
const lines = []
|
|
15
15
|
let cur = ''
|
|
@@ -26,7 +26,7 @@ export function wrap(s, maxPx, px = 12) {
|
|
|
26
26
|
return lines
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export function shrink(s, maxPx, px, mono = false, minPx =
|
|
29
|
+
export function shrink(s, maxPx, px, mono = false, minPx = 11.5) {
|
|
30
30
|
let cur = px
|
|
31
31
|
while (cur >= minPx) {
|
|
32
32
|
if (tw(s, cur, mono) <= maxPx) return cur
|
|
@@ -36,10 +36,10 @@ export function shrink(s, maxPx, px, mono = false, minPx = 9) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export function fitLines(s, maxPx, px, mono = false) {
|
|
39
|
-
const safeMax = Math.max(maxPx,
|
|
39
|
+
const safeMax = Math.max(maxPx, 48)
|
|
40
40
|
let lines = mono ? [String(s)] : wrap(s, safeMax, px)
|
|
41
41
|
const widest = lines.reduce((a, b) => (tw(b, px, mono) > tw(a, px, mono) ? b : a), '')
|
|
42
|
-
const size = shrink(widest, safeMax, px, mono,
|
|
42
|
+
const size = shrink(widest, safeMax, px, mono, 11.5)
|
|
43
43
|
if (size !== px && !mono) lines = wrap(s, safeMax, size)
|
|
44
44
|
return { lines, px: size }
|
|
45
45
|
}
|
|
@@ -70,25 +70,25 @@ export function boxCls(it) {
|
|
|
70
70
|
return it.highlight ? 'boxHi' : it.fallback ? 'boxBack' : 'box'
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export function clampWidth(raw) {
|
|
73
|
+
export function clampWidth(raw, fallback = 880) {
|
|
74
74
|
const n = Number(raw)
|
|
75
|
-
if (!Number.isFinite(n)) return
|
|
76
|
-
return Math.max(
|
|
75
|
+
if (!Number.isFinite(n)) return fallback
|
|
76
|
+
return Math.max(420, Math.min(1600, Math.round(n)))
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export function addEyebrow(shapes, spec, W) {
|
|
80
80
|
if (!spec.eyebrow) return PAD
|
|
81
81
|
const txt = String(spec.eyebrow).toUpperCase()
|
|
82
|
-
const px = shrink(txt, (W - 2 * PAD) / 1.
|
|
82
|
+
const px = shrink(txt, (W - 2 * PAD) / 1.15, 12, true, 9.5)
|
|
83
83
|
shapes.push({
|
|
84
84
|
kind: 'text',
|
|
85
85
|
x: PAD,
|
|
86
|
-
y: PAD +
|
|
86
|
+
y: PAD + 6,
|
|
87
87
|
text: txt,
|
|
88
88
|
cls: spec.accent_eyebrow ? 'ebA' : 'eb',
|
|
89
|
-
fontSize: px !==
|
|
89
|
+
fontSize: px !== 12 ? px : undefined,
|
|
90
90
|
})
|
|
91
|
-
return PAD +
|
|
91
|
+
return PAD + 22
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
export function addLines(shapes, x, y, lines, cls, anchor, gap, px, basePx, nodeId) {
|
package/src/layouts/fan.js
CHANGED
|
@@ -2,40 +2,40 @@ import { PAD, addEyebrow, addLines, clampWidth, finalizeConnections, fitLines, n
|
|
|
2
2
|
|
|
3
3
|
/** Fan layout: one source connected to many targets (1 or 2 columns, direction out | in). */
|
|
4
4
|
export function compileFan(spec) {
|
|
5
|
-
const W = clampWidth(spec.width)
|
|
6
5
|
if (!spec.source) throw new Error("fan: 'source' is required")
|
|
7
6
|
const rawTargets = Array.isArray(spec.targets) ? spec.targets : []
|
|
8
7
|
if (rawTargets.length < 1) throw new Error("fan: 'targets' needs at least 1 item")
|
|
9
8
|
const src = normItem(spec.source, 'source')
|
|
10
9
|
const targets = rawTargets.map((t, i) => normItem(t, `target-${i + 1}`))
|
|
10
|
+
const cols = targets.length > 6 ? 2 : 1
|
|
11
|
+
const W = clampWidth(spec.width, cols === 1 ? 680 : 780)
|
|
11
12
|
|
|
12
13
|
const shapes = []
|
|
13
|
-
let top = addEyebrow(shapes, spec, W) + 8
|
|
14
|
-
const cols = targets.length > 6 ? 2 : 1
|
|
14
|
+
let top = addEyebrow(shapes, spec, W) + (spec.eyebrow ? 8 : 0)
|
|
15
15
|
const rows = Math.ceil(targets.length / cols)
|
|
16
|
-
const sw = Math.min(240, Math.max(
|
|
17
|
-
const tx0 = PAD + sw +
|
|
18
|
-
const pw = Math.max(
|
|
16
|
+
const sw = Math.min(240, Math.max(156, Math.round(W * 0.29)))
|
|
17
|
+
const tx0 = PAD + sw + 76
|
|
18
|
+
const pw = Math.max(96, (W - PAD - tx0 - (cols - 1) * 14) / cols)
|
|
19
19
|
|
|
20
20
|
if (spec.targets_eyebrow) {
|
|
21
|
-
shapes.push({ kind: 'text', x: tx0, y: top +
|
|
22
|
-
top +=
|
|
21
|
+
shapes.push({ kind: 'text', x: tx0, y: top + 6, text: String(spec.targets_eyebrow).toUpperCase(), cls: 'eb' })
|
|
22
|
+
top += 18
|
|
23
23
|
}
|
|
24
|
-
const ys = Array.from({ length: rows }, (_, r) => top +
|
|
25
|
-
const H0 = ys[ys.length - 1] +
|
|
24
|
+
const ys = Array.from({ length: rows }, (_, r) => top + 4 + r * 42)
|
|
25
|
+
const H0 = ys[ys.length - 1] + 34 + PAD
|
|
26
26
|
|
|
27
|
-
const snote = src.note ? fitLines(src.note, sw -
|
|
28
|
-
const big = tw(src.title, 20) <= sw -
|
|
29
|
-
const stitle = fitLines(src.title, sw -
|
|
30
|
-
const sh =
|
|
31
|
-
const sy = (ys[0] + ys[ys.length - 1] +
|
|
27
|
+
const snote = src.note ? fitLines(src.note, sw - 34, 13.5) : { lines: [], px: 13.5 }
|
|
28
|
+
const big = tw(src.title, 20) <= sw - 34
|
|
29
|
+
const stitle = fitLines(src.title, sw - 34, big ? 20 : 16)
|
|
30
|
+
const sh = 40 + 22 * stitle.lines.length + 18 * snote.lines.length
|
|
31
|
+
const sy = (ys[0] + ys[ys.length - 1] + 34) / 2 - sh / 2
|
|
32
32
|
const mid = r1(sy + sh / 2)
|
|
33
33
|
const trunk = tx0 - 22
|
|
34
34
|
const reverse = String(spec.direction ?? 'out').toLowerCase() === 'in'
|
|
35
35
|
|
|
36
36
|
if (cols === 2) {
|
|
37
37
|
const gy0 = ys[0] - 10
|
|
38
|
-
const gy1 = ys[ys.length - 1] +
|
|
38
|
+
const gy1 = ys[ys.length - 1] + 44
|
|
39
39
|
shapes.push({ kind: 'rect', x: tx0 - 12, y: gy0, w: r1(W - PAD - tx0 + 12), h: gy1 - gy0, rx: 12, cls: 'soft' })
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -43,8 +43,8 @@ export function compileFan(spec) {
|
|
|
43
43
|
const edges = []
|
|
44
44
|
|
|
45
45
|
shapes.push({ kind: 'rect', x: PAD, y: r1(sy), w: sw, h: sh, rx: 12, cls: src.highlight ? 'boxHi' : 'card', nodeId: src.id })
|
|
46
|
-
addLines(shapes, PAD + 18, sy +
|
|
47
|
-
addLines(shapes, PAD + 18, sy +
|
|
46
|
+
addLines(shapes, PAD + 18, sy + 32, stitle.lines, big ? 'h1' : 'h2', 'start', 22, stitle.px, big ? 22 : 16, src.id)
|
|
47
|
+
addLines(shapes, PAD + 18, sy + 32 + 22 * stitle.lines.length + 4, snote.lines, 'sm', 'start', 18, snote.px, 13.5, src.id)
|
|
48
48
|
nodes.push({ ...src, index: 0, x: PAD, y: r1(sy), w: sw, h: sh, connectedNodeIds: [], connectedEdgeIndices: [] })
|
|
49
49
|
|
|
50
50
|
shapes.push({ kind: 'path', d: `M${PAD + sw} ${mid} H${trunk}`, cls: reverse ? 'flowR' : 'flow' })
|
|
@@ -57,11 +57,11 @@ export function compileFan(spec) {
|
|
|
57
57
|
const y = ys[r]
|
|
58
58
|
const id = it.id
|
|
59
59
|
edges.push({ index: edges.length, from: reverse ? id : src.id, to: reverse ? src.id : id })
|
|
60
|
-
if (c === 0) centers.push(y +
|
|
61
|
-
const tpx = shrink(it.title, pw -
|
|
62
|
-
shapes.push({ kind: 'rect', x: r1(x), y, w: r1(pw), h:
|
|
63
|
-
shapes.push({ kind: 'text', x: r1(x + pw / 2), y: r1(y +
|
|
64
|
-
nodes.push({ ...it, index: i + 1, x: r1(x), y, w: r1(pw), h:
|
|
60
|
+
if (c === 0) centers.push(y + 17)
|
|
61
|
+
const tpx = shrink(it.title, pw - 18, 14.5)
|
|
62
|
+
shapes.push({ kind: 'rect', x: r1(x), y, w: r1(pw), h: 34, rx: 17, cls: it.highlight ? 'pillHi' : 'pill', nodeId: id })
|
|
63
|
+
shapes.push({ kind: 'text', x: r1(x + pw / 2), y: r1(y + 22), text: it.title, cls: 'tx', anchor: 'middle', fontSize: tpx !== 14.5 ? tpx : undefined, nodeId: id })
|
|
64
|
+
nodes.push({ ...it, index: i + 1, x: r1(x), y, w: r1(pw), h: 34, connectedNodeIds: [], connectedEdgeIndices: [] })
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
if (cols === 2) {
|
package/src/layouts/flow.js
CHANGED
|
@@ -2,25 +2,31 @@ import { PAD, addEyebrow, addLines, boxCls, clampWidth, finalizeConnections, fit
|
|
|
2
2
|
|
|
3
3
|
/** Flow layout: ordered steps with animated connectors and an optional return arc. */
|
|
4
4
|
export function compileFlow(spec) {
|
|
5
|
-
const W = clampWidth(spec.width)
|
|
6
5
|
const rawSteps = Array.isArray(spec.steps) ? spec.steps : []
|
|
7
6
|
if (rawSteps.length < 2) throw new Error("flow: 'steps' needs at least 2 items")
|
|
8
7
|
const steps = rawSteps.map((s, i) => normItem(s, `step-${i + 1}`))
|
|
8
|
+
const n = steps.length
|
|
9
|
+
const defaultW = n <= 2 ? 560 : n === 3 ? 680 : n === 4 ? 780 : 880
|
|
10
|
+
const W = clampWidth(spec.width, defaultW)
|
|
9
11
|
|
|
10
12
|
const shapes = []
|
|
11
|
-
const top = addEyebrow(shapes, spec, W) + 8
|
|
12
|
-
const
|
|
13
|
-
const gap = 28
|
|
13
|
+
const top = addEyebrow(shapes, spec, W) + (spec.eyebrow ? 8 : 0)
|
|
14
|
+
const gap = n <= 3 ? 28 : 24
|
|
14
15
|
const bw = (W - 2 * PAD - (n - 1) * gap) / n
|
|
15
16
|
|
|
17
|
+
const TITLE_PX = 16
|
|
18
|
+
const TITLE_LH = 21
|
|
19
|
+
const NOTE_PX = 13.5
|
|
20
|
+
const NOTE_LH = 18
|
|
16
21
|
const titles = steps.map((s, i) => {
|
|
17
22
|
const t = `${spec.numbered ? `${String(i + 1).padStart(2, '0')} ` : ''}${s.title}`
|
|
18
|
-
return fitLines(t, bw -
|
|
23
|
+
return fitLines(t, bw - 18, TITLE_PX)
|
|
19
24
|
})
|
|
20
|
-
const notes = steps.map((s) => (s.note ? fitLines(s.note, bw - 20,
|
|
25
|
+
const notes = steps.map((s) => (s.note ? fitLines(s.note, bw - 20, NOTE_PX) : { lines: [], px: NOTE_PX }))
|
|
21
26
|
const tl = Math.max(...titles.map((t) => t.lines.length), 1)
|
|
22
27
|
const nl = Math.max(...notes.map((x) => x.lines.length), 0)
|
|
23
|
-
const
|
|
28
|
+
const textH = TITLE_LH * tl + (nl ? 5 + NOTE_LH * nl : 0)
|
|
29
|
+
const bh = Math.max(54, textH + 28)
|
|
24
30
|
|
|
25
31
|
const nodes = []
|
|
26
32
|
const edges = []
|
|
@@ -41,9 +47,13 @@ export function compileFlow(spec) {
|
|
|
41
47
|
toId: id,
|
|
42
48
|
})
|
|
43
49
|
}
|
|
50
|
+
const itemTextH = TITLE_LH * titles[i].lines.length + (notes[i].lines.length ? 5 + NOTE_LH * notes[i].lines.length : 0)
|
|
51
|
+
const y0 = top + (bh - itemTextH) / 2 + 15.5
|
|
44
52
|
shapes.push({ kind: 'rect', x: r1(x), y: top, w: r1(bw), h: bh, rx: 10, cls: boxCls(s), nodeId: id })
|
|
45
|
-
addLines(shapes, x + bw / 2,
|
|
46
|
-
|
|
53
|
+
addLines(shapes, x + bw / 2, y0, titles[i].lines, 'h2', 'middle', TITLE_LH, titles[i].px, TITLE_PX, id)
|
|
54
|
+
if (notes[i].lines.length) {
|
|
55
|
+
addLines(shapes, x + bw / 2, y0 + TITLE_LH * titles[i].lines.length + 3, notes[i].lines, 'sm', 'middle', NOTE_LH, notes[i].px, NOTE_PX, id)
|
|
56
|
+
}
|
|
47
57
|
nodes.push({
|
|
48
58
|
...s,
|
|
49
59
|
index: i,
|
package/src/layouts/graph.js
CHANGED
|
@@ -47,7 +47,7 @@ function assignRanks(nodeIds, edges) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/** Build an arrowhead triangle pointing in unit direction (ux, uy) with tip at (tx, ty). */
|
|
50
|
-
function arrowPoints(tx, ty, ux, uy, len =
|
|
50
|
+
function arrowPoints(tx, ty, ux, uy, len = 9, halfW = 4.6) {
|
|
51
51
|
const bx = tx - ux * len
|
|
52
52
|
const by = ty - uy * len
|
|
53
53
|
const px = -uy * halfW
|
|
@@ -57,7 +57,6 @@ function arrowPoints(tx, ty, ux, uy, len = 8, halfW = 4.2) {
|
|
|
57
57
|
|
|
58
58
|
/** Graph layout: arbitrary directed/bidirectional/undirected graph (LR or TB) with cycle handling and animated Bezier flows. */
|
|
59
59
|
export function compileGraph(spec) {
|
|
60
|
-
const W = clampWidth(spec.width)
|
|
61
60
|
const rawNodes = Array.isArray(spec.nodes) ? spec.nodes : []
|
|
62
61
|
if (rawNodes.length < 2) throw new Error("graph: 'nodes' needs at least 2 items")
|
|
63
62
|
const items = rawNodes.map((n, i) => normItem(n, `n${i + 1}`))
|
|
@@ -84,29 +83,48 @@ export function compileGraph(spec) {
|
|
|
84
83
|
const layers = Array.from({ length: maxRank + 1 }, () => [])
|
|
85
84
|
items.forEach((it) => layers[ranks.get(it.id) ?? 0].push(it))
|
|
86
85
|
|
|
87
|
-
const shapes = []
|
|
88
|
-
const top = addEyebrow(shapes, spec, W) + 10
|
|
89
86
|
const hasGroups = Array.isArray(spec.groups) && spec.groups.length > 0
|
|
90
|
-
const
|
|
87
|
+
const hasReturnArc = validEdges.some((e) => (ranks.get(e.to) ?? 0) <= (ranks.get(e.from) ?? 0))
|
|
88
|
+
|
|
89
|
+
// Content-driven default width keeps SVG scale near 1.0x in docs columns so text matches Mermaid 16px legibility.
|
|
90
|
+
let defaultW
|
|
91
|
+
if (direction === 'LR') {
|
|
92
|
+
const cols = layers.length
|
|
93
|
+
defaultW = cols <= 2 ? 540 : cols === 3 ? 680 : cols === 4 ? 780 : 880
|
|
94
|
+
} else {
|
|
95
|
+
const maxPerRow = Math.max(...layers.map((l) => l.length), 1)
|
|
96
|
+
const idealBw = maxPerRow === 1 ? 260 : maxPerRow === 2 ? 220 : 190
|
|
97
|
+
defaultW = Math.max(420, Math.min(860, maxPerRow * idealBw + (maxPerRow - 1) * 24 + 2 * PAD + (hasReturnArc ? 96 : 48)))
|
|
98
|
+
}
|
|
99
|
+
const W = clampWidth(spec.width, defaultW)
|
|
100
|
+
|
|
101
|
+
const shapes = []
|
|
102
|
+
const top = addEyebrow(shapes, spec, W) + (spec.eyebrow ? 8 : 0)
|
|
103
|
+
const groupPadTop = hasGroups ? 28 : 0
|
|
91
104
|
const pos = new Map()
|
|
92
105
|
const metrics = new Map()
|
|
106
|
+
const TITLE_PX = 16
|
|
107
|
+
const TITLE_LH = 21
|
|
108
|
+
const NOTE_PX = 13.5
|
|
109
|
+
const NOTE_LH = 18
|
|
93
110
|
|
|
94
111
|
let H
|
|
95
112
|
if (direction === 'LR') {
|
|
96
113
|
const cols = layers.length
|
|
97
|
-
const colGap = cols <= 4 ?
|
|
98
|
-
const bw = Math.max(
|
|
99
|
-
const rowGap = hasGroups ? 26 :
|
|
114
|
+
const colGap = cols <= 2 ? 64 : cols === 3 ? 48 : cols === 4 ? 44 : 36
|
|
115
|
+
const bw = Math.max(108, (W - 2 * PAD - (cols - 1) * colGap) / cols)
|
|
116
|
+
const rowGap = hasGroups ? 26 : 18
|
|
100
117
|
for (const nd of items) {
|
|
101
|
-
const t = fitLines(nd.title, bw - 20,
|
|
102
|
-
const n = nd.note ? fitLines(nd.note, bw - 20,
|
|
103
|
-
const
|
|
104
|
-
|
|
118
|
+
const t = fitLines(nd.title, bw - 20, TITLE_PX)
|
|
119
|
+
const n = nd.note ? fitLines(nd.note, bw - 20, NOTE_PX) : { lines: [], px: NOTE_PX }
|
|
120
|
+
const textH = TITLE_LH * t.lines.length + (n.lines.length ? 4 + NOTE_LH * n.lines.length : 0)
|
|
121
|
+
const nh = Math.max(52, Math.round(textH + 26))
|
|
122
|
+
metrics.set(nd.id, { tl: t.lines, tpx: t.px, nl: n.lines, npx: n.px, h: nh, textH })
|
|
105
123
|
}
|
|
106
124
|
const colHeights = layers.map(
|
|
107
125
|
(layer) => layer.reduce((acc, nd) => acc + metrics.get(nd.id).h, 0) + rowGap * Math.max(layer.length - 1, 0),
|
|
108
126
|
)
|
|
109
|
-
const maxH = Math.max(...colHeights,
|
|
127
|
+
const maxH = Math.max(...colHeights, 52)
|
|
110
128
|
layers.forEach((layer, ci) => {
|
|
111
129
|
const x = PAD + ci * (bw + colGap)
|
|
112
130
|
let y = top + groupPadTop + (maxH - colHeights[ci]) / 2
|
|
@@ -120,13 +138,14 @@ export function compileGraph(spec) {
|
|
|
120
138
|
} else {
|
|
121
139
|
const maxPerRow = Math.max(...layers.map((l) => l.length), 1)
|
|
122
140
|
const colGap = 24
|
|
123
|
-
const rowGap = hasGroups ?
|
|
124
|
-
const bw = Math.max(
|
|
141
|
+
const rowGap = hasGroups ? 56 : 48
|
|
142
|
+
const bw = Math.max(120, Math.min(260, (W - 2 * PAD - (maxPerRow - 1) * colGap) / maxPerRow))
|
|
125
143
|
for (const nd of items) {
|
|
126
|
-
const t = fitLines(nd.title, bw -
|
|
127
|
-
const n = nd.note ? fitLines(nd.note, bw -
|
|
128
|
-
const
|
|
129
|
-
|
|
144
|
+
const t = fitLines(nd.title, bw - 22, TITLE_PX)
|
|
145
|
+
const n = nd.note ? fitLines(nd.note, bw - 22, NOTE_PX) : { lines: [], px: NOTE_PX }
|
|
146
|
+
const textH = TITLE_LH * t.lines.length + (n.lines.length ? 4 + NOTE_LH * n.lines.length : 0)
|
|
147
|
+
const nh = Math.max(52, Math.round(textH + 26))
|
|
148
|
+
metrics.set(nd.id, { tl: t.lines, tpx: t.px, nl: n.lines, npx: n.px, h: nh, textH })
|
|
130
149
|
}
|
|
131
150
|
let y = top + groupPadTop
|
|
132
151
|
for (const layer of layers) {
|
|
@@ -284,18 +303,19 @@ export function compileGraph(spec) {
|
|
|
284
303
|
})
|
|
285
304
|
}
|
|
286
305
|
if (e.label) {
|
|
287
|
-
const lw = Math.max(
|
|
288
|
-
shapes.push({ kind: 'rect', x: r1(mx - lw / 2), y: r1(my -
|
|
289
|
-
shapes.push({ kind: 'text', x: r1(mx), y: r1(my +
|
|
306
|
+
const lw = Math.max(40, tw(e.label, 13.5) + 16)
|
|
307
|
+
shapes.push({ kind: 'rect', x: r1(mx - lw / 2), y: r1(my - 12), w: r1(lw), h: 24, rx: 12, cls: 'edgeTag', edgeIndex: idx, fromId: e.from, toId: e.to })
|
|
308
|
+
shapes.push({ kind: 'text', x: r1(mx), y: r1(my + 4.5), text: e.label, cls: 'sm', anchor: 'middle', edgeIndex: idx, fromId: e.from, toId: e.to })
|
|
290
309
|
}
|
|
291
310
|
})
|
|
292
311
|
|
|
293
312
|
const nodes = items.map((nd, idx) => {
|
|
294
313
|
const p = pos.get(nd.id)
|
|
295
314
|
const m = metrics.get(nd.id)
|
|
315
|
+
const y0 = p.y + (p.h - m.textH) / 2 + 15.5
|
|
296
316
|
shapes.push({ kind: 'rect', x: r1(p.x), y: r1(p.y), w: r1(p.w), h: r1(p.h), rx: 10, cls: boxCls(nd), nodeId: nd.id })
|
|
297
|
-
addLines(shapes, p.x + p.w / 2,
|
|
298
|
-
if (m.nl.length) addLines(shapes, p.x + p.w / 2,
|
|
317
|
+
addLines(shapes, p.x + p.w / 2, y0, m.tl, 'h2', 'middle', TITLE_LH, m.tpx, TITLE_PX, nd.id)
|
|
318
|
+
if (m.nl.length) addLines(shapes, p.x + p.w / 2, y0 + TITLE_LH * m.tl.length + 3, m.nl, 'sm', 'middle', NOTE_LH, m.npx, NOTE_PX, nd.id)
|
|
299
319
|
return { ...nd, index: idx, x: r1(p.x), y: r1(p.y), w: r1(p.w), h: r1(p.h), connectedNodeIds: [], connectedEdgeIndices: [] }
|
|
300
320
|
})
|
|
301
321
|
|
package/src/layouts/loop.js
CHANGED
|
@@ -2,24 +2,24 @@ import { addEyebrow, addLines, clampWidth, finalizeConnections, fitLines, normIt
|
|
|
2
2
|
|
|
3
3
|
/** Loop layout: 3-8 numbered nodes on a circle with an orbiting dot. */
|
|
4
4
|
export function compileLoop(spec) {
|
|
5
|
-
const W = Math.max(560, clampWidth(spec.width))
|
|
6
5
|
const rawNodes = Array.isArray(spec.nodes) ? spec.nodes : []
|
|
7
6
|
if (rawNodes.length < 3 || rawNodes.length > 8) throw new Error("loop: 'nodes' needs 3-8 items")
|
|
8
7
|
const items = rawNodes.map((n, i) => normItem(n, `node-${i + 1}`))
|
|
8
|
+
const W = Math.max(560, clampWidth(spec.width, items.length <= 6 ? 720 : 820))
|
|
9
9
|
|
|
10
10
|
const shapes = []
|
|
11
11
|
const top = addEyebrow(shapes, spec, W)
|
|
12
|
-
let r = Number(spec.radius) || (items.length <= 6 ?
|
|
13
|
-
let labW = items.length <= 6 ?
|
|
14
|
-
if (W / 2 - r -
|
|
15
|
-
r = Math.max(100, Math.floor(W / 2 -
|
|
16
|
-
labW = Math.max(
|
|
12
|
+
let r = Number(spec.radius) || (items.length <= 6 ? 132 : 168)
|
|
13
|
+
let labW = items.length <= 6 ? 170 : 145
|
|
14
|
+
if (W / 2 - r - 48 < labW) {
|
|
15
|
+
r = Math.max(100, Math.floor(W / 2 - 48 - labW))
|
|
16
|
+
labW = Math.max(96, Math.floor(W / 2 - r - 48))
|
|
17
17
|
}
|
|
18
|
-
const firstTitle = fitLines(items[0].title, labW,
|
|
19
|
-
const firstNote = items[0].note ? fitLines(items[0].note, labW,
|
|
20
|
-
const firstBlock =
|
|
18
|
+
const firstTitle = fitLines(items[0].title, labW, 16)
|
|
19
|
+
const firstNote = items[0].note ? fitLines(items[0].note, labW, 13.5) : { lines: [], px: 13.5 }
|
|
20
|
+
const firstBlock = 20 * (firstTitle.lines.length - 1) + 17 * firstNote.lines.length
|
|
21
21
|
const cx = W / 2
|
|
22
|
-
const cy = top +
|
|
22
|
+
const cy = top + 68 + firstBlock + 14 + r
|
|
23
23
|
|
|
24
24
|
shapes.push({ kind: 'circle', cx, cy, r, cls: 'orbit' })
|
|
25
25
|
shapes.push({ kind: 'circle', cx, cy, r, cls: 'orbitF' })
|
|
@@ -55,22 +55,22 @@ export function compileLoop(spec) {
|
|
|
55
55
|
shapes.push({ kind: 'circle', cx: r1(x), cy: r1(y), r: 20, cls: nodeCls, nodeId: id })
|
|
56
56
|
shapes.push({ kind: 'text', x: r1(x), y: r1(y + 4), text: String(i + 1).padStart(2, '0'), cls: 'num', anchor: 'middle', nodeId: id })
|
|
57
57
|
|
|
58
|
-
const tFit = fitLines(it.title, labW,
|
|
59
|
-
const nFit = it.note ? fitLines(it.note, labW,
|
|
60
|
-
const block =
|
|
58
|
+
const tFit = fitLines(it.title, labW, 16)
|
|
59
|
+
const nFit = it.note ? fitLines(it.note, labW, 13.5) : { lines: [], px: 13.5 }
|
|
60
|
+
const block = 20 * (tFit.lines.length - 1) + 17 * nFit.lines.length
|
|
61
61
|
const dx = x - cx
|
|
62
62
|
let tx; let ty; let anc
|
|
63
63
|
if (Math.abs(dx) < 1) {
|
|
64
|
-
tx = x; ty = y < cy ? y -
|
|
64
|
+
tx = x; ty = y < cy ? y - 32 - block : y + 42; anc = 'middle'
|
|
65
65
|
} else if (dx > 0) {
|
|
66
66
|
tx = x + 30; ty = y - 6; anc = 'start'
|
|
67
67
|
} else {
|
|
68
68
|
tx = x - 30; ty = y - 6; anc = 'end'
|
|
69
69
|
}
|
|
70
|
-
addLines(shapes, tx, ty, tFit.lines, 'h2', anc,
|
|
71
|
-
const noteY = ty +
|
|
72
|
-
addLines(shapes, tx, noteY, nFit.lines, 'sm', anc,
|
|
73
|
-
bottom = Math.max(bottom, noteY +
|
|
70
|
+
addLines(shapes, tx, ty, tFit.lines, 'h2', anc, 20, tFit.px, 16, id)
|
|
71
|
+
const noteY = ty + 20 * (tFit.lines.length - 1) + 19
|
|
72
|
+
addLines(shapes, tx, noteY, nFit.lines, 'sm', anc, 17, nFit.px, 13.5, id)
|
|
73
|
+
bottom = Math.max(bottom, noteY + 17 * nFit.lines.length)
|
|
74
74
|
|
|
75
75
|
nodes.push({ ...it, index: i, x: r1(x - 20), y: r1(y - 20), w: 40, h: 40, connectedNodeIds: [], connectedEdgeIndices: [] })
|
|
76
76
|
})
|
package/src/layouts/map.js
CHANGED
|
@@ -2,15 +2,15 @@ import { PAD, clampWidth, finalizeConnections, normItem, r1, shrink, tw } from '
|
|
|
2
2
|
|
|
3
3
|
/** Map layout: three columns (inputs -> central product -> outputs) + optional dashed footer. */
|
|
4
4
|
export function compileMap(spec) {
|
|
5
|
-
const W = Math.max(
|
|
5
|
+
const W = Math.max(720, clampWidth(spec.width, 820))
|
|
6
6
|
const center = spec.center && typeof spec.center === 'object' && !Array.isArray(spec.center) ? spec.center : null
|
|
7
7
|
if (!center?.title) throw new Error("map: 'center.title' is required")
|
|
8
8
|
|
|
9
|
-
const lw =
|
|
10
|
-
const rw =
|
|
11
|
-
const cw = W - 2 * PAD - lw - rw -
|
|
9
|
+
const lw = 166
|
|
10
|
+
const rw = 180
|
|
11
|
+
const cw = W - 2 * PAD - lw - rw - 96
|
|
12
12
|
const lx = PAD
|
|
13
|
-
const cxx = PAD + lw +
|
|
13
|
+
const cxx = PAD + lw + 48
|
|
14
14
|
const rx = W - PAD - rw
|
|
15
15
|
const top = PAD + 2
|
|
16
16
|
const shapes = []
|
|
@@ -33,13 +33,13 @@ export function compileMap(spec) {
|
|
|
33
33
|
for (const rawIt of grp.items ?? []) {
|
|
34
34
|
const it = normItem(rawIt, `${side}-${nodes.length + 1}`)
|
|
35
35
|
const id = it.id
|
|
36
|
-
const tpx = shrink(it.title, w - 16,
|
|
37
|
-
shapes.push({ kind: 'rect', x, y, w, h:
|
|
38
|
-
shapes.push({ kind: 'text', x: r1(x + w / 2), y: r1(y +
|
|
39
|
-
nodes.push({ ...it, highlight: Boolean(grp.accent || it.highlight), index: nodes.length, x, y, w, h:
|
|
36
|
+
const tpx = shrink(it.title, w - 16, 14.5)
|
|
37
|
+
shapes.push({ kind: 'rect', x, y, w, h: 32, rx: 16, cls: grp.accent || it.highlight ? 'pillHi' : 'pill', nodeId: id })
|
|
38
|
+
shapes.push({ kind: 'text', x: r1(x + w / 2), y: r1(y + 21), text: it.title, cls: 'tx', anchor: 'middle', fontSize: tpx !== 14.5 ? tpx : undefined, nodeId: id })
|
|
39
|
+
nodes.push({ ...it, highlight: Boolean(grp.accent || it.highlight), index: nodes.length, x, y, w, h: 32, connectedNodeIds: [], connectedEdgeIndices: [] })
|
|
40
40
|
ids.push(id)
|
|
41
|
-
ys.push(y +
|
|
42
|
-
y +=
|
|
41
|
+
ys.push(y + 16)
|
|
42
|
+
y += 40
|
|
43
43
|
}
|
|
44
44
|
y += 8
|
|
45
45
|
}
|
package/src/layouts/sequence.js
CHANGED
|
@@ -2,9 +2,11 @@ import { PAD, addEyebrow, boxCls, clampWidth, finalizeConnections, fitLines, nor
|
|
|
2
2
|
|
|
3
3
|
/** Sequence layout: 2-6 actors with lifelines, animated message arrows, self-calls, and participant notes. */
|
|
4
4
|
export function compileSequence(spec) {
|
|
5
|
-
const W = clampWidth(spec.width)
|
|
6
5
|
const rawActors = Array.isArray(spec.actors) ? spec.actors : []
|
|
7
6
|
if (rawActors.length < 2 || rawActors.length > 6) throw new Error("sequence: 'actors' needs 2-6 items")
|
|
7
|
+
const n = rawActors.length
|
|
8
|
+
const defaultW = n === 2 ? 580 : n === 3 ? 700 : n === 4 ? 780 : 880
|
|
9
|
+
const W = clampWidth(spec.width, defaultW)
|
|
8
10
|
const actors = rawActors.map((a, i) => {
|
|
9
11
|
const it = normItem(a, `actor-${i + 1}`)
|
|
10
12
|
if (typeof a === 'string') it.id = a
|
|
@@ -25,13 +27,12 @@ export function compileSequence(spec) {
|
|
|
25
27
|
if (msgs.length < 1) throw new Error("sequence: 'messages' needs at least 1 valid message or note")
|
|
26
28
|
|
|
27
29
|
const shapes = []
|
|
28
|
-
const top = addEyebrow(shapes, spec, W) +
|
|
29
|
-
const
|
|
30
|
-
const bw = Math.min(180, (W - 2 * PAD - (n - 1) * 20) / n)
|
|
30
|
+
const top = addEyebrow(shapes, spec, W) + (spec.eyebrow ? 8 : 0)
|
|
31
|
+
const bw = Math.min(184, (W - 2 * PAD - (n - 1) * 18) / n)
|
|
31
32
|
const span = (W - 2 * PAD - bw) / Math.max(n - 1, 1)
|
|
32
33
|
const xs = actors.map((_, i) => PAD + bw / 2 + i * span)
|
|
33
|
-
const bh = actors.some((a) => a.note) ?
|
|
34
|
-
const msgTop = top + bh +
|
|
34
|
+
const bh = actors.some((a) => a.note) ? 58 : 44
|
|
35
|
+
const msgTop = top + bh + 38
|
|
35
36
|
|
|
36
37
|
// Pre-compute row layout so multi-line notes never overlap adjacent rows.
|
|
37
38
|
const rowMetrics = []
|
|
@@ -42,22 +43,22 @@ export function compileSequence(spec) {
|
|
|
42
43
|
const actorList = Array.isArray(m.actors) && m.actors.length ? m.actors.map(String) : [String(m.from)]
|
|
43
44
|
const position = m.position === 'left' || m.position === 'right' ? m.position : 'over'
|
|
44
45
|
const maxNoteW = actorList.length === 2
|
|
45
|
-
? Math.min(W - 2 * PAD, Math.max(
|
|
46
|
-
: Math.min(
|
|
47
|
-
const fitted = fitLines(label, maxNoteW - 24,
|
|
48
|
-
const textW = Math.max(...fitted.lines.map((ln) => tw(ln, fitted.px)),
|
|
49
|
-
const noteW = Math.min(maxNoteW, Math.max(
|
|
50
|
-
const noteH = Math.max(
|
|
46
|
+
? Math.min(W - 2 * PAD, Math.max(170, Math.abs(xs[byId.get(actorList[1])] - xs[byId.get(actorList[0])]) + 96))
|
|
47
|
+
: Math.min(300, Math.max(160, W - 2 * PAD))
|
|
48
|
+
const fitted = fitLines(label, maxNoteW - 24, 13.5)
|
|
49
|
+
const textW = Math.max(...fitted.lines.map((ln) => tw(ln, fitted.px)), 64)
|
|
50
|
+
const noteW = Math.min(maxNoteW, Math.max(128, Math.round(textW + 26)))
|
|
51
|
+
const noteH = Math.max(34, 16 + fitted.lines.length * 18)
|
|
51
52
|
const y = cursorY
|
|
52
|
-
cursorY += noteH +
|
|
53
|
+
cursorY += noteH + 24
|
|
53
54
|
rowMetrics.push({ kind: 'note', y, noteW, noteH, fitted, actorList, position })
|
|
54
55
|
} else {
|
|
55
56
|
const y = cursorY
|
|
56
|
-
cursorY +=
|
|
57
|
+
cursorY += 52
|
|
57
58
|
rowMetrics.push({ kind: 'message', y })
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
const bottom = cursorY +
|
|
61
|
+
const bottom = cursorY + 8
|
|
61
62
|
|
|
62
63
|
actors.forEach((a, i) => {
|
|
63
64
|
shapes.push({ kind: 'line', x1: r1(xs[i]), y1: top + bh, x2: r1(xs[i]), y2: bottom, cls: 'life', nodeId: a.id })
|
|
@@ -66,11 +67,11 @@ export function compileSequence(spec) {
|
|
|
66
67
|
const nodes = actors.map((a, i) => {
|
|
67
68
|
const x = xs[i] - bw / 2
|
|
68
69
|
shapes.push({ kind: 'rect', x: r1(x), y: top, w: r1(bw), h: bh, rx: 10, cls: boxCls(a), nodeId: a.id })
|
|
69
|
-
const tpx = shrink(a.title, bw - 16,
|
|
70
|
-
shapes.push({ kind: 'text', x: r1(xs[i]), y: top + (a.note ?
|
|
70
|
+
const tpx = shrink(a.title, bw - 16, 16)
|
|
71
|
+
shapes.push({ kind: 'text', x: r1(xs[i]), y: top + (a.note ? 25 : 27.5), text: a.title, cls: 'h2', anchor: 'middle', fontSize: tpx !== 16 ? tpx : undefined, nodeId: a.id })
|
|
71
72
|
if (a.note) {
|
|
72
|
-
const npx = shrink(a.note, bw - 16,
|
|
73
|
-
shapes.push({ kind: 'text', x: r1(xs[i]), y: top +
|
|
73
|
+
const npx = shrink(a.note, bw - 16, 13)
|
|
74
|
+
shapes.push({ kind: 'text', x: r1(xs[i]), y: top + 45, text: a.note, cls: 'sm', anchor: 'middle', fontSize: npx !== 13.5 ? npx : undefined, nodeId: a.id })
|
|
74
75
|
}
|
|
75
76
|
return { ...a, index: i, x: r1(x), y: top, w: r1(bw), h: bh, connectedNodeIds: [], connectedEdgeIndices: [] }
|
|
76
77
|
})
|
|
@@ -111,16 +112,16 @@ export function compileSequence(spec) {
|
|
|
111
112
|
description: `Note ${rm.position === 'over' ? 'over' : `${rm.position} of`} ${rm.actorList.join(', ')}: ${label}`,
|
|
112
113
|
})
|
|
113
114
|
shapes.push({ kind: 'rect', x: r1(nx), y: r1(ny), w: r1(rm.noteW), h: r1(rm.noteH), rx: 8, cls: 'noteBox', edgeIndex: idx, fromId: from, toId: to })
|
|
114
|
-
const baseTextY = ny + (rm.noteH - (rm.fitted.lines.length - 1) *
|
|
115
|
+
const baseTextY = ny + (rm.noteH - (rm.fitted.lines.length - 1) * 18) / 2 + 4.5
|
|
115
116
|
rm.fitted.lines.forEach((ln, li) => {
|
|
116
117
|
shapes.push({
|
|
117
118
|
kind: 'text',
|
|
118
119
|
x: r1(nx + rm.noteW / 2),
|
|
119
|
-
y: r1(baseTextY + li *
|
|
120
|
+
y: r1(baseTextY + li * 18),
|
|
120
121
|
text: ln,
|
|
121
122
|
cls: 'noteTx',
|
|
122
123
|
anchor: 'middle',
|
|
123
|
-
fontSize: rm.fitted.px !==
|
|
124
|
+
fontSize: rm.fitted.px !== 13.5 ? rm.fitted.px : undefined,
|
|
124
125
|
edgeIndex: idx,
|
|
125
126
|
fromId: from,
|
|
126
127
|
toId: to,
|
|
@@ -163,8 +164,8 @@ export function compileSequence(spec) {
|
|
|
163
164
|
if (label) {
|
|
164
165
|
const textLbl = spec.numbered ? `${String(msgNumber).padStart(2, '0')} ${label}` : label
|
|
165
166
|
const avail = leftSide ? x1 - loopW - 8 - PAD : W - PAD - (x1 + loopW + 8)
|
|
166
|
-
const lpx = shrink(textLbl, Math.max(avail,
|
|
167
|
-
shapes.push({ kind: 'text', x: r1(x1 + sign * (loopW + 8)), y: y +
|
|
167
|
+
const lpx = shrink(textLbl, Math.max(avail, 48), 13.5, true)
|
|
168
|
+
shapes.push({ kind: 'text', x: r1(x1 + sign * (loopW + 8)), y: y + 5, text: textLbl, cls: 'mono', anchor: leftSide ? 'end' : 'start', fontSize: lpx !== 13.5 ? lpx : undefined, edgeIndex: idx, fromId: from, toId: to })
|
|
168
169
|
}
|
|
169
170
|
} else {
|
|
170
171
|
const right = x2 > x1
|
|
@@ -174,12 +175,12 @@ export function compileSequence(spec) {
|
|
|
174
175
|
shapes.push({ kind: 'path', d, cls: 'wire', edgeIndex: idx, fromId: from, toId: to })
|
|
175
176
|
shapes.push({ kind: 'path', d, cls, edgeIndex: idx, fromId: from, toId: to })
|
|
176
177
|
const tip = x2 + (right ? -2 : 2)
|
|
177
|
-
const base = tip + (right ? -
|
|
178
|
-
shapes.push({ kind: 'polygon', points: `${r1(tip)},${y} ${r1(base)},${y - 4} ${r1(base)},${y + 4}`, cls: arrCls, edgeIndex: idx, fromId: from, toId: to })
|
|
178
|
+
const base = tip + (right ? -8 : 8)
|
|
179
|
+
shapes.push({ kind: 'polygon', points: `${r1(tip)},${y} ${r1(base)},${y - 4.5} ${r1(base)},${y + 4.5}`, cls: arrCls, edgeIndex: idx, fromId: from, toId: to })
|
|
179
180
|
if (label) {
|
|
180
181
|
const textLbl = spec.numbered ? `${String(msgNumber).padStart(2, '0')} ${label}` : label
|
|
181
|
-
const lpx = shrink(textLbl, Math.abs(x2 - x1) - 16,
|
|
182
|
-
shapes.push({ kind: 'text', x: r1((x1 + x2) / 2), y: y -
|
|
182
|
+
const lpx = shrink(textLbl, Math.abs(x2 - x1) - 16, 13.5, true)
|
|
183
|
+
shapes.push({ kind: 'text', x: r1((x1 + x2) / 2), y: y - 10, text: textLbl, cls: 'mono', anchor: 'middle', fontSize: lpx !== 13.5 ? lpx : undefined, edgeIndex: idx, fromId: from, toId: to })
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
})
|
package/src/layouts/stack.js
CHANGED
|
@@ -2,7 +2,7 @@ import { addEyebrow, clampWidth, finalizeConnections, normItem, shrink, tw } fro
|
|
|
2
2
|
|
|
3
3
|
/** Stack layout: nested concentric layers with an inside-out highlight sweep. */
|
|
4
4
|
export function compileStack(spec) {
|
|
5
|
-
const W = clampWidth(spec.width)
|
|
5
|
+
const W = clampWidth(spec.width, 720)
|
|
6
6
|
const rawLayers = Array.isArray(spec.layers) ? spec.layers : []
|
|
7
7
|
if (rawLayers.length < 2) throw new Error("stack: 'layers' needs at least 2 items")
|
|
8
8
|
const rows = rawLayers.map((l, i) => normItem(l, `layer-${i + 1}`))
|
|
@@ -13,39 +13,39 @@ export function compileStack(spec) {
|
|
|
13
13
|
const w0 = W - 16
|
|
14
14
|
let below = false
|
|
15
15
|
rows.forEach((it, i) => {
|
|
16
|
-
const w = w0 - i *
|
|
17
|
-
const left = Math.max(tw(it.title.toUpperCase(),
|
|
18
|
-
if (it.detail && left + 24 + tw(it.detail,
|
|
16
|
+
const w = w0 - i * 48
|
|
17
|
+
const left = Math.max(tw(it.title.toUpperCase(), 13.5, true) * 1.06, tw(it.note ?? '', 13.5))
|
|
18
|
+
if (it.detail && left + 24 + tw(it.detail, 12.5, true) > w - 32) below = true
|
|
19
19
|
})
|
|
20
|
-
const step = below ?
|
|
21
|
-
const innerH = below ?
|
|
20
|
+
const step = below ? 72 : 56
|
|
21
|
+
const innerH = below ? 66 : 50
|
|
22
22
|
|
|
23
23
|
const nodes = []
|
|
24
24
|
const edges = []
|
|
25
25
|
|
|
26
26
|
rows.forEach((it, i) => {
|
|
27
27
|
const id = it.id
|
|
28
|
-
const x = 8 + i *
|
|
28
|
+
const x = 8 + i * 24
|
|
29
29
|
const y = top + i * step
|
|
30
|
-
const w = w0 - i *
|
|
30
|
+
const w = w0 - i * 48
|
|
31
31
|
const h = i === n - 1 ? innerH : top + (n - 1) * step + innerH + (n - 1 - i) * 22 - y
|
|
32
32
|
const rx = Math.max(12 - i, 4)
|
|
33
33
|
const cls = i === n - 1 ? 'inner' : i === 0 && spec.outer_dashed ? 'ring m' : 'ring'
|
|
34
34
|
shapes.push({ kind: 'rect', x, y, w, h, rx, cls, nodeId: id })
|
|
35
35
|
shapes.push({ kind: 'rect', x, y, w, h, rx, cls: 'hl', delayIndex: i, nodeId: id })
|
|
36
36
|
|
|
37
|
-
const tpx = shrink(it.title.toUpperCase(), (w - 32) * 0.94,
|
|
38
|
-
shapes.push({ kind: 'text', x: x + 16, y: y +
|
|
37
|
+
const tpx = shrink(it.title.toUpperCase(), (w - 32) * 0.94, 13.5, true)
|
|
38
|
+
shapes.push({ kind: 'text', x: x + 16, y: y + 22, text: it.title.toUpperCase(), cls: 'lab', fontSize: tpx !== 13.5 ? tpx : undefined, nodeId: id })
|
|
39
39
|
if (it.note) {
|
|
40
|
-
const npx = shrink(it.note, w - 32,
|
|
41
|
-
shapes.push({ kind: 'text', x: x + 16, y: y +
|
|
40
|
+
const npx = shrink(it.note, w - 32, 13.5)
|
|
41
|
+
shapes.push({ kind: 'text', x: x + 16, y: y + 40, text: it.note, cls: 'q', fontSize: npx !== 13.5 ? npx : undefined, nodeId: id })
|
|
42
42
|
}
|
|
43
43
|
if (it.detail) {
|
|
44
44
|
if (below) {
|
|
45
|
-
const dpx = shrink(it.detail, w - 32,
|
|
46
|
-
shapes.push({ kind: 'text', x: x + 16, y: y +
|
|
45
|
+
const dpx = shrink(it.detail, w - 32, 12.5, true)
|
|
46
|
+
shapes.push({ kind: 'text', x: x + 16, y: y + 58, text: it.detail, cls: 'p', fontSize: dpx !== 12.5 ? dpx : undefined, nodeId: id })
|
|
47
47
|
} else {
|
|
48
|
-
shapes.push({ kind: 'text', x: x + w - 16, y: y +
|
|
48
|
+
shapes.push({ kind: 'text', x: x + w - 16, y: y + 30, text: it.detail, cls: 'p', anchor: 'end', nodeId: id })
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
if (i > 0) edges.push({ index: i - 1, from: rows[i - 1].id, to: id })
|
package/src/layouts/timeline.js
CHANGED
|
@@ -2,19 +2,19 @@ import { PAD, addEyebrow, addLines, boxCls, clampWidth, finalizeConnections, fit
|
|
|
2
2
|
|
|
3
3
|
/** Timeline layout: ordered events along a flowing rail with alternating labels and sequential glow. */
|
|
4
4
|
export function compileTimeline(spec) {
|
|
5
|
-
const W = clampWidth(spec.width)
|
|
6
5
|
const rawEvents = Array.isArray(spec.events) ? spec.events : []
|
|
7
6
|
if (rawEvents.length < 2) throw new Error("timeline: 'events' needs at least 2 items")
|
|
8
7
|
const ev = rawEvents.map((e, i) => normItem(e, `event-${i + 1}`))
|
|
8
|
+
const n = ev.length
|
|
9
|
+
const W = clampWidth(spec.width, n <= 3 ? 680 : n === 4 ? 760 : 840)
|
|
9
10
|
|
|
10
11
|
const shapes = []
|
|
11
12
|
const top = addEyebrow(shapes, spec, W)
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
let m = 40
|
|
13
|
+
const ly = top + 96
|
|
14
|
+
let m = 44
|
|
15
15
|
for (let k = 0; k < 4; k++) {
|
|
16
16
|
const slotEst = (W - 2 * PAD - 2 * m) / Math.max(n - 1, 1)
|
|
17
|
-
m = Math.max(
|
|
17
|
+
m = Math.max(44, Math.min(2 * slotEst - 14, 240) / 2)
|
|
18
18
|
}
|
|
19
19
|
const x0 = PAD + m
|
|
20
20
|
const x1 = W - PAD - m
|
|
@@ -34,16 +34,16 @@ export function compileTimeline(spec) {
|
|
|
34
34
|
|
|
35
35
|
shapes.push({ kind: 'circle', cx: r1(x), cy: ly, r: 8, cls: boxCls(it), nodeId: id })
|
|
36
36
|
shapes.push({ kind: 'circle', cx: r1(x), cy: ly, r: 13, cls: 'hl', delayIndex: n - 1 - i, nodeId: id })
|
|
37
|
-
const avail = n > 1 ? Math.min(2 * slot - 14,
|
|
38
|
-
const tpx = shrink(it.title, avail,
|
|
39
|
-
const nFit = it.note ? fitLines(it.note, avail,
|
|
37
|
+
const avail = n > 1 ? Math.min(2 * slot - 14, 240) : W - 2 * PAD
|
|
38
|
+
const tpx = shrink(it.title, avail, 13.5, true)
|
|
39
|
+
const nFit = it.note ? fitLines(it.note, avail, 13) : { lines: [], px: 13 }
|
|
40
40
|
const half = Math.max(tw(it.title, tpx, true), ...nFit.lines.map((ln) => tw(ln, nFit.px))) / 2
|
|
41
41
|
const lx = Math.min(Math.max(x, PAD + half), W - PAD - half)
|
|
42
|
-
const yt = i % 2 === 0 ? ly -
|
|
42
|
+
const yt = i % 2 === 0 ? ly - 28 - 17 * nFit.lines.length : ly + 38
|
|
43
43
|
shapes.push({ kind: 'path', d: i % 2 === 0 ? `M${r1(x)} ${ly - 9} V${ly - 20}` : `M${r1(x)} ${ly + 9} V${ly + 20}`, cls: 'wire', nodeId: id })
|
|
44
|
-
shapes.push({ kind: 'text', x: r1(lx), y: r1(yt), text: it.title, cls: 'mono', anchor: 'middle', fontSize: tpx !==
|
|
45
|
-
addLines(shapes, lx, yt +
|
|
46
|
-
bottom = Math.max(bottom, yt +
|
|
44
|
+
shapes.push({ kind: 'text', x: r1(lx), y: r1(yt), text: it.title, cls: 'mono', anchor: 'middle', fontSize: tpx !== 13.5 ? tpx : undefined, nodeId: id })
|
|
45
|
+
addLines(shapes, lx, yt + 18, nFit.lines, 'sm', 'middle', 17, nFit.px, 13.5, id)
|
|
46
|
+
bottom = Math.max(bottom, yt + 18 + 17 * nFit.lines.length)
|
|
47
47
|
|
|
48
48
|
nodes.push({ ...it, index: i, x: r1(x - 14), y: ly - 14, w: 28, h: 28, connectedNodeIds: [], connectedEdgeIndices: [] })
|
|
49
49
|
})
|
package/src/styles.js
CHANGED
|
@@ -52,9 +52,11 @@ export const ELEMENT_CSS = `
|
|
|
52
52
|
|
|
53
53
|
.pv-title {
|
|
54
54
|
display: flex;
|
|
55
|
+
flex: 1 1 8rem;
|
|
55
56
|
align-items: center;
|
|
56
57
|
gap: 8px;
|
|
57
58
|
min-width: 0;
|
|
59
|
+
overflow: hidden;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
.pv-kind {
|
|
@@ -75,12 +77,12 @@ export const ELEMENT_CSS = `
|
|
|
75
77
|
white-space: nowrap;
|
|
76
78
|
overflow: hidden;
|
|
77
79
|
text-overflow: ellipsis;
|
|
78
|
-
max-width: 420px;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
.pv-actions {
|
|
82
83
|
display: flex;
|
|
83
84
|
flex-wrap: wrap;
|
|
85
|
+
flex-shrink: 0;
|
|
84
86
|
align-items: center;
|
|
85
87
|
gap: 4px;
|
|
86
88
|
}
|
|
@@ -135,7 +137,7 @@ export const ELEMENT_CSS = `
|
|
|
135
137
|
.pv-stage {
|
|
136
138
|
position: relative;
|
|
137
139
|
overflow: auto;
|
|
138
|
-
padding: 12px;
|
|
140
|
+
padding: 10px 12px;
|
|
139
141
|
background: var(--v-bg);
|
|
140
142
|
cursor: grab;
|
|
141
143
|
}
|
|
@@ -182,49 +184,49 @@ export const ELEMENT_CSS = `
|
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
/* SVG token styling */
|
|
185
|
-
.pv-svg .eb { font: 500
|
|
186
|
-
.pv-svg .ebA { font: 600
|
|
187
|
+
.pv-svg .eb { font: 500 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: var(--v-muted); letter-spacing: 0.1em; }
|
|
188
|
+
.pv-svg .ebA { font: 600 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: var(--v-acc); letter-spacing: 0.1em; }
|
|
187
189
|
.pv-svg .h1 { font: 650 22px -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; fill: var(--v-ink); }
|
|
188
|
-
.pv-svg .h2 { font: 600
|
|
189
|
-
.pv-svg .tx { font:
|
|
190
|
-
.pv-svg .sm { font: 400
|
|
191
|
-
.pv-svg .mono { font: 500
|
|
192
|
-
.pv-svg .lab { font: 650
|
|
193
|
-
.pv-svg .q { font: italic 400
|
|
194
|
-
.pv-svg .p { font: 500
|
|
195
|
-
.pv-svg .bt { font: 600
|
|
196
|
-
.pv-svg .num { font: 650
|
|
197
|
-
|
|
198
|
-
.pv-svg .pill { fill: var(--v-card); stroke: var(--v-line); stroke-width: 1; }
|
|
199
|
-
.pv-svg .pillHi { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.
|
|
200
|
-
.pv-svg .card { fill: var(--v-card); stroke: var(--v-ink); stroke-width: 1.
|
|
201
|
-
.pv-svg .soft { fill: var(--v-soft); stroke: var(--v-line); stroke-width: 1; }
|
|
202
|
-
.pv-svg .dash { fill: none; stroke: var(--v-acc); stroke-width: 1.
|
|
203
|
-
.pv-svg .box { fill: var(--v-card); stroke: var(--v-ink); stroke-width: 1.
|
|
204
|
-
.pv-svg .boxHi { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.
|
|
205
|
-
.pv-svg .boxBack { fill: var(--v-card); stroke: var(--v-back); stroke-width: 1.
|
|
206
|
-
.pv-svg .node { fill: var(--v-card); stroke: var(--v-ink); stroke-width: 1.
|
|
207
|
-
.pv-svg .nodeHi { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.
|
|
208
|
-
.pv-svg .nodeBack { fill: var(--v-card); stroke: var(--v-back); stroke-width: 1.
|
|
209
|
-
.pv-svg .ring { fill: transparent; stroke: var(--v-ink); stroke-width: 1.
|
|
190
|
+
.pv-svg .h2 { font: 600 16px -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; fill: var(--v-ink); }
|
|
191
|
+
.pv-svg .tx { font: 500 14.5px -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; fill: var(--v-body); }
|
|
192
|
+
.pv-svg .sm { font: 400 13.5px -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; fill: var(--v-muted); }
|
|
193
|
+
.pv-svg .mono { font: 500 13.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: var(--v-ink); }
|
|
194
|
+
.pv-svg .lab { font: 650 13.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: var(--v-ink); letter-spacing: 0.05em; }
|
|
195
|
+
.pv-svg .q { font: italic 400 13.5px -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; fill: var(--v-muted); }
|
|
196
|
+
.pv-svg .p { font: 500 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: var(--v-acc); }
|
|
197
|
+
.pv-svg .bt { font: 600 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: var(--v-back); letter-spacing: 0.08em; }
|
|
198
|
+
.pv-svg .num { font: 650 13.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; fill: var(--v-acc); }
|
|
199
|
+
|
|
200
|
+
.pv-svg .pill { fill: var(--v-card); stroke: color-mix(in srgb, var(--v-ink) 24%, var(--v-line)); stroke-width: 1.2; }
|
|
201
|
+
.pv-svg .pillHi { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.4; }
|
|
202
|
+
.pv-svg .card { fill: var(--v-card); stroke: var(--v-ink); stroke-width: 1.5; }
|
|
203
|
+
.pv-svg .soft { fill: var(--v-soft); stroke: var(--v-line); stroke-width: 1.1; }
|
|
204
|
+
.pv-svg .dash { fill: none; stroke: var(--v-acc); stroke-width: 1.5; stroke-dasharray: 6 6; }
|
|
205
|
+
.pv-svg .box { fill: var(--v-card); stroke: color-mix(in srgb, var(--v-ink) 26%, var(--v-line)); stroke-width: 1.5; }
|
|
206
|
+
.pv-svg .boxHi { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.7; }
|
|
207
|
+
.pv-svg .boxBack { fill: var(--v-card); stroke: var(--v-back); stroke-width: 1.7; stroke-dasharray: 4 3; }
|
|
208
|
+
.pv-svg .node { fill: var(--v-card); stroke: var(--v-ink); stroke-width: 1.5; }
|
|
209
|
+
.pv-svg .nodeHi { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.7; }
|
|
210
|
+
.pv-svg .nodeBack { fill: var(--v-card); stroke: var(--v-back); stroke-width: 1.7; stroke-dasharray: 4 3; }
|
|
211
|
+
.pv-svg .ring { fill: transparent; stroke: var(--v-ink); stroke-width: 1.4; }
|
|
210
212
|
.pv-svg .ring.m { stroke-dasharray: 7 6; stroke: var(--v-acc); animation: pv-flow 2.4s linear infinite; }
|
|
211
|
-
.pv-svg .inner { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.
|
|
212
|
-
.pv-svg .edgeTag { fill: var(--v-card); stroke: var(--v-line); stroke-width: 1; }
|
|
213
|
-
.pv-svg .noteBox { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.
|
|
214
|
-
.pv-svg .noteTx { font: 500
|
|
213
|
+
.pv-svg .inner { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.5; }
|
|
214
|
+
.pv-svg .edgeTag { fill: var(--v-card); stroke: color-mix(in srgb, var(--v-ink) 22%, var(--v-line)); stroke-width: 1.1; }
|
|
215
|
+
.pv-svg .noteBox { fill: var(--v-hi); stroke: var(--v-acc); stroke-width: 1.3; stroke-dasharray: 4 3; }
|
|
216
|
+
.pv-svg .noteTx { font: 500 13.5px -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; fill: var(--v-ink); }
|
|
215
217
|
.pv-svg .okb { fill: var(--v-okbg); }
|
|
216
|
-
.pv-svg .okt { font: 600
|
|
218
|
+
.pv-svg .okt { font: 600 12px -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; fill: var(--v-ok); }
|
|
217
219
|
.pv-svg .dot { fill: var(--v-acc); }
|
|
218
220
|
.pv-svg .arr { fill: var(--v-acc); }
|
|
219
221
|
.pv-svg .arrBack { fill: var(--v-back); }
|
|
220
222
|
|
|
221
|
-
.pv-svg .wire { fill: none; stroke: var(--v-line); stroke-width: 1.
|
|
223
|
+
.pv-svg .wire { fill: none; stroke: var(--v-line); stroke-width: 1.5; }
|
|
222
224
|
.pv-svg .life { fill: none; stroke: var(--v-line); stroke-width: 1.2; stroke-dasharray: 4 4; }
|
|
223
|
-
.pv-svg .orbit { fill: none; stroke: var(--v-line); stroke-width: 1.
|
|
224
|
-
.pv-svg .orbitF { fill: none; stroke: var(--v-acc); stroke-width: 2; stroke-dasharray: 3 12; animation: pv-flow 1.8s linear infinite; }
|
|
225
|
-
.pv-svg .flow { fill: none; stroke: var(--v-acc); stroke-width:
|
|
226
|
-
.pv-svg .flowR { fill: none; stroke: var(--v-acc); stroke-width:
|
|
227
|
-
.pv-svg .back { fill: none; stroke: var(--v-back); stroke-width:
|
|
225
|
+
.pv-svg .orbit { fill: none; stroke: var(--v-line); stroke-width: 1.5; }
|
|
226
|
+
.pv-svg .orbitF { fill: none; stroke: var(--v-acc); stroke-width: 2.1; stroke-dasharray: 3 12; animation: pv-flow 1.8s linear infinite; }
|
|
227
|
+
.pv-svg .flow { fill: none; stroke: var(--v-acc); stroke-width: 2; stroke-dasharray: 4 10; animation: pv-flow 1.6s linear infinite; }
|
|
228
|
+
.pv-svg .flowR { fill: none; stroke: var(--v-acc); stroke-width: 2; stroke-dasharray: 4 10; animation: pv-flowR 1.6s linear infinite; }
|
|
229
|
+
.pv-svg .back { fill: none; stroke: var(--v-back); stroke-width: 2; stroke-dasharray: 6 6; animation: pv-flowR 1.6s linear infinite; }
|
|
228
230
|
.pv-svg .hl { fill: none; stroke: var(--v-acc); stroke-width: 2.6; opacity: 0; animation: pv-glow 9s infinite; pointer-events: none; }
|
|
229
231
|
.pv-svg .pv-spin { animation: pv-spin 10s linear infinite; }
|
|
230
232
|
|
package/src/svgExport.js
CHANGED
|
@@ -19,46 +19,46 @@ export function sceneToSvg(scene, mode = 'dark', themeOverride = undefined) {
|
|
|
19
19
|
|
|
20
20
|
let css = [
|
|
21
21
|
`.bgr{fill:${t.bg}}`,
|
|
22
|
-
`.eb{font:500
|
|
23
|
-
`.ebA{font:600
|
|
22
|
+
`.eb{font:500 12px ${mono};fill:${t.muted};letter-spacing:.1em}`,
|
|
23
|
+
`.ebA{font:600 12px ${mono};fill:${t.acc};letter-spacing:.1em}`,
|
|
24
24
|
`.h1{font:650 22px ${sans};fill:${t.ink}}`,
|
|
25
|
-
`.h2{font:600
|
|
26
|
-
`.tx{font:
|
|
27
|
-
`.sm{font:400
|
|
28
|
-
`.mono{font:500
|
|
29
|
-
`.pill{fill:${t.card};stroke:${t.line};stroke-width:1}`,
|
|
30
|
-
`.pillHi{fill:${t.hi};stroke:${t.acc};stroke-width:1.
|
|
31
|
-
`.card{fill:${t.card};stroke:${t.ink};stroke-width:1.
|
|
32
|
-
`.soft{fill:${t.soft};stroke:${t.line};stroke-width:1}`,
|
|
33
|
-
`.dash{fill:none;stroke:${t.acc};stroke-width:1.
|
|
34
|
-
`.wire{fill:none;stroke:${t.line};stroke-width:1.
|
|
25
|
+
`.h2{font:600 16px ${sans};fill:${t.ink}}`,
|
|
26
|
+
`.tx{font:500 14.5px ${sans};fill:${t.body}}`,
|
|
27
|
+
`.sm{font:400 13.5px ${sans};fill:${t.muted}}`,
|
|
28
|
+
`.mono{font:500 13.5px ${mono};fill:${t.ink}}`,
|
|
29
|
+
`.pill{fill:${t.card};stroke:${t.line};stroke-width:1.2}`,
|
|
30
|
+
`.pillHi{fill:${t.hi};stroke:${t.acc};stroke-width:1.4}`,
|
|
31
|
+
`.card{fill:${t.card};stroke:${t.ink};stroke-width:1.5}`,
|
|
32
|
+
`.soft{fill:${t.soft};stroke:${t.line};stroke-width:1.1}`,
|
|
33
|
+
`.dash{fill:none;stroke:${t.acc};stroke-width:1.5;stroke-dasharray:6 6}`,
|
|
34
|
+
`.wire{fill:none;stroke:${t.line};stroke-width:1.5}`,
|
|
35
35
|
`.life{fill:none;stroke:${t.line};stroke-width:1.2;stroke-dasharray:4 4}`,
|
|
36
|
-
`.flow{fill:none;stroke:${t.acc};stroke-width:1.
|
|
37
|
-
`.flowR{fill:none;stroke:${t.acc};stroke-width:1.
|
|
38
|
-
`.back{fill:none;stroke:${t.back};stroke-width:1.
|
|
39
|
-
`.box{fill:${t.card};stroke:${t.ink};stroke-width:1.
|
|
40
|
-
`.boxHi{fill:${t.hi};stroke:${t.acc};stroke-width:1.
|
|
41
|
-
`.boxBack{fill:${t.card};stroke:${t.back};stroke-width:1.
|
|
42
|
-
`.node{fill:${t.card};stroke:${t.ink};stroke-width:1.
|
|
43
|
-
`.nodeHi{fill:${t.hi};stroke:${t.acc};stroke-width:1.
|
|
44
|
-
`.nodeBack{fill:${t.card};stroke:${t.back};stroke-width:1.
|
|
45
|
-
`.orbit{fill:none;stroke:${t.line};stroke-width:1.
|
|
46
|
-
`.orbitF{fill:none;stroke:${t.acc};stroke-width:2;stroke-dasharray:3 12;animation:flow 1.8s linear infinite}`,
|
|
47
|
-
`.ring{fill:none;stroke:${t.ink};stroke-width:1.
|
|
36
|
+
`.flow{fill:none;stroke:${t.acc};stroke-width:1.9;stroke-dasharray:4 10;animation:flow 1.6s linear infinite}`,
|
|
37
|
+
`.flowR{fill:none;stroke:${t.acc};stroke-width:1.9;stroke-dasharray:4 10;animation:flowR 1.6s linear infinite}`,
|
|
38
|
+
`.back{fill:none;stroke:${t.back};stroke-width:1.9;stroke-dasharray:6 6;animation:flowR 1.6s linear infinite}`,
|
|
39
|
+
`.box{fill:${t.card};stroke:${t.ink};stroke-width:1.5}`,
|
|
40
|
+
`.boxHi{fill:${t.hi};stroke:${t.acc};stroke-width:1.7}`,
|
|
41
|
+
`.boxBack{fill:${t.card};stroke:${t.back};stroke-width:1.7;stroke-dasharray:4 3}`,
|
|
42
|
+
`.node{fill:${t.card};stroke:${t.ink};stroke-width:1.5}`,
|
|
43
|
+
`.nodeHi{fill:${t.hi};stroke:${t.acc};stroke-width:1.7}`,
|
|
44
|
+
`.nodeBack{fill:${t.card};stroke:${t.back};stroke-width:1.7;stroke-dasharray:4 3}`,
|
|
45
|
+
`.orbit{fill:none;stroke:${t.line};stroke-width:1.5}`,
|
|
46
|
+
`.orbitF{fill:none;stroke:${t.acc};stroke-width:2.1;stroke-dasharray:3 12;animation:flow 1.8s linear infinite}`,
|
|
47
|
+
`.ring{fill:none;stroke:${t.ink};stroke-width:1.4}`,
|
|
48
48
|
`.ring.m{stroke-dasharray:7 6;stroke:${t.acc};animation:flow 2.4s linear infinite}`,
|
|
49
|
-
`.inner{fill:${t.hi};stroke:${t.acc};stroke-width:1.
|
|
50
|
-
`.lab{font:650
|
|
51
|
-
`.q{font:italic 400
|
|
52
|
-
`.p{font:500
|
|
53
|
-
`.edgeTag{fill:${t.card};stroke:${t.line};stroke-width:1}`,
|
|
54
|
-
`.noteBox{fill:${t.hi};stroke:${t.acc};stroke-width:1.
|
|
55
|
-
`.noteTx{font:500
|
|
49
|
+
`.inner{fill:${t.hi};stroke:${t.acc};stroke-width:1.5}`,
|
|
50
|
+
`.lab{font:650 13.5px ${mono};fill:${t.ink};letter-spacing:.05em}`,
|
|
51
|
+
`.q{font:italic 400 13.5px ${sans};fill:${t.muted}}`,
|
|
52
|
+
`.p{font:500 12.5px ${mono};fill:${t.acc}}`,
|
|
53
|
+
`.edgeTag{fill:${t.card};stroke:${t.line};stroke-width:1.1}`,
|
|
54
|
+
`.noteBox{fill:${t.hi};stroke:${t.acc};stroke-width:1.3;stroke-dasharray:4 3}`,
|
|
55
|
+
`.noteTx{font:500 13.5px ${sans};fill:${t.ink}}`,
|
|
56
56
|
`.arr{fill:${t.acc}}`,
|
|
57
57
|
`.arrBack{fill:${t.back}}`,
|
|
58
|
-
`.okb{fill:${t.okbg}}.okt{font:600
|
|
58
|
+
`.okb{fill:${t.okbg}}.okt{font:600 12px ${sans};fill:${t.ok}}`,
|
|
59
59
|
`.dot{fill:${t.acc}}`,
|
|
60
|
-
`.bt{font:600
|
|
61
|
-
`.num{font:650
|
|
60
|
+
`.bt{font:600 12px ${mono};fill:${t.back};letter-spacing:.08em}`,
|
|
61
|
+
`.num{font:650 13.5px ${mono};fill:${t.acc}}`,
|
|
62
62
|
`@keyframes flow{to{stroke-dashoffset:-28}}`,
|
|
63
63
|
`@keyframes flowR{to{stroke-dashoffset:28}}`,
|
|
64
64
|
`@media (prefers-reduced-motion:reduce){*{animation:none!important}}`,
|