@kgdiff/scene 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/build.d.ts +23 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +407 -0
- package/dist/build.js.map +1 -0
- package/dist/choreography.d.ts +98 -0
- package/dist/choreography.d.ts.map +1 -0
- package/dist/choreography.js +271 -0
- package/dist/choreography.js.map +1 -0
- package/dist/color.d.ts +42 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +169 -0
- package/dist/color.js.map +1 -0
- package/dist/constants.d.ts +89 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +89 -0
- package/dist/constants.js.map +1 -0
- package/dist/easing.d.ts +28 -0
- package/dist/easing.d.ts.map +1 -0
- package/dist/easing.js +103 -0
- package/dist/easing.js.map +1 -0
- package/dist/focus.d.ts +45 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/focus.js +317 -0
- package/dist/focus.js.map +1 -0
- package/dist/frame.d.ts +13 -0
- package/dist/frame.d.ts.map +1 -0
- package/dist/frame.js +32 -0
- package/dist/frame.js.map +1 -0
- package/dist/geometry.d.ts +61 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +122 -0
- package/dist/geometry.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/resolver.d.ts +9 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +1621 -0
- package/dist/resolver.js.map +1 -0
- package/dist/roles.d.ts +46 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/roles.js +197 -0
- package/dist/roles.js.map +1 -0
- package/dist/styles.d.ts +116 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +391 -0
- package/dist/styles.js.map +1 -0
- package/dist/theme.d.ts +14 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +154 -0
- package/dist/theme.js.map +1 -0
- package/dist/timeline.d.ts +69 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +362 -0
- package/dist/timeline.js.map +1 -0
- package/dist/types.d.ts +493 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/view.d.ts +11 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +22 -0
- package/dist/view.js.map +1 -0
- package/package.json +46 -3
- package/src/build.ts +450 -0
- package/src/choreography.ts +342 -0
- package/src/color.ts +194 -0
- package/src/constants.ts +97 -0
- package/src/easing.ts +104 -0
- package/src/focus.ts +335 -0
- package/src/frame.ts +37 -0
- package/src/geometry.ts +162 -0
- package/src/index.ts +15 -0
- package/src/resolver.ts +1710 -0
- package/src/roles.ts +203 -0
- package/src/styles.ts +513 -0
- package/src/theme.ts +185 -0
- package/src/timeline.ts +391 -0
- package/src/types.ts +544 -0
- package/src/view.ts +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 iiwish and kgdiff contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kgdiff/scene
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The renderer-agnostic visual model of a graph diff: design tokens (dark, light and a
|
|
4
|
+
color-blind-safe palette), the encodings of the five change families, the before → after replay
|
|
5
|
+
timeline and focus for changes-only views. It turns a diff and a layout into drawable
|
|
6
|
+
primitives (circles, lines, labels, rings, glyphs) for any renderer:
|
|
7
|
+
[`@kgdiff/renderer`](../renderer) (Canvas 2D), [`@kgdiff/g6`](../g6) (AntV G6) or your own.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @kgdiff/scene @kgdiff/core @kgdiff/layout
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
ESM only. Node.js ≥ 22 or any evergreen browser.
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { diff } from '@kgdiff/core';
|
|
21
|
+
import { layoutDiff } from '@kgdiff/layout';
|
|
22
|
+
import { buildScene, createViewState, createVisualResolver } from '@kgdiff/scene';
|
|
23
|
+
|
|
24
|
+
const result = diff(before, after);
|
|
25
|
+
const scene = buildScene(result, layoutDiff(result), { theme: 'light', locale: 'en' });
|
|
26
|
+
scene.hunks.map((hunk) => hunk.title); // localized titles, in review order
|
|
27
|
+
|
|
28
|
+
const resolver = createVisualResolver(scene);
|
|
29
|
+
let frame = resolver.resolve(createViewState({ layer: 'union', selectedHunk: 0 }));
|
|
30
|
+
for (const node of frame.nodes) {
|
|
31
|
+
if (node.visible) drawCircle(node.x, node.y, node.r, node.fill, node.alpha); // your drawing code
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Replay: sweep `t` from 0 to scene.timeline.duration. Passing `frame` back in reuses it, so
|
|
35
|
+
// steady-state frames allocate nothing.
|
|
36
|
+
frame = resolver.resolve(createViewState({ layer: 'replay', t: 1200 }), frame);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`getTheme(name, palette)` returns the design tokens; `frameBounds(scene, hunks)` gives camera
|
|
40
|
+
targets; `computeFocus` builds the changes-only view.
|
|
41
|
+
|
|
42
|
+
## Learn more
|
|
43
|
+
|
|
44
|
+
- [Visual language](../../docs/visual-language.md): tokens, encodings, level of detail, replay
|
|
45
|
+
choreography.
|
|
46
|
+
- [Algorithms § Hunk ordering](../../docs/algorithms.md#10-hunk-ordering-for-review-and-replay-scene)
|
|
47
|
+
and [§ Focus](../../docs/algorithms.md#11-focus-changes-only-view).
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
[MIT](../../LICENSE)
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buildScene`: diff + layout → the renderer-agnostic scene (indices, roles, families, labels,
|
|
3
|
+
* badges, curvature, importance, hunks in tour order, timeline).
|
|
4
|
+
*/
|
|
5
|
+
import { type DiffResult } from '@kgdiff/core';
|
|
6
|
+
import { type LayoutResult } from '@kgdiff/layout';
|
|
7
|
+
import type { Scene, SceneOptions } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Build the visual model. Pure and deterministic.
|
|
10
|
+
*
|
|
11
|
+
* - Nodes absent from `layout.positions` (scope `changes`) are left out; edges need both
|
|
12
|
+
* endpoints. Before-version endpoints outside the layout fall back to the after ones.
|
|
13
|
+
* - Node / edge order follows the diff (sorted by union id); indices are dense.
|
|
14
|
+
* - Hunks are reordered as a spatial tour (docs/algorithms.md §10); titles come from core
|
|
15
|
+
* `formatHunk` in `options.locale`.
|
|
16
|
+
* - `degree` is the max of the before / after degree (as used for the radius).
|
|
17
|
+
*
|
|
18
|
+
* O(N log N + E + H √H). See `SceneOptions` for defaults.
|
|
19
|
+
*
|
|
20
|
+
* @throws KgdiffError(`invalid-input`) for invalid replay options or theme names.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildScene(diff: DiffResult, layout: LayoutResult, options?: SceneOptions): Scene;
|
|
23
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,KAAK,UAAU,EAShB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,gBAAgB,CAAC;AAgB/D,OAAO,KAAK,EAEV,KAAK,EAIL,YAAY,EAGb,MAAM,YAAY,CAAC;AAiHpB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,YAAiB,GACzB,KAAK,CAsRP"}
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buildScene`: diff + layout → the renderer-agnostic scene (indices, roles, families, labels,
|
|
3
|
+
* badges, curvature, importance, hunks in tour order, timeline).
|
|
4
|
+
*/
|
|
5
|
+
import { formatHunk, KgdiffError, } from '@kgdiff/core';
|
|
6
|
+
import { nodeRadius } from '@kgdiff/layout';
|
|
7
|
+
import { TIMELINE } from './constants.js';
|
|
8
|
+
import { addNodeBox, BoundsBuilder, edgeCurvatures, rectCenter } from './geometry.js';
|
|
9
|
+
import { edgeFamily, edgeLabelBefore, edgeRole, hunkFamily, nodeBadge, nodeFamily, nodeFamilyBefore, nodeLabelBefore, nodeRole, } from './roles.js';
|
|
10
|
+
import { getTheme } from './theme.js';
|
|
11
|
+
import { buildTimeline, chapterPlan, timelineMode, tourOrder } from './timeline.js';
|
|
12
|
+
function resolveTheme(options) {
|
|
13
|
+
const t = options.theme;
|
|
14
|
+
if (t !== undefined && typeof t === 'object')
|
|
15
|
+
return t;
|
|
16
|
+
return getTheme(t ?? 'dark', options.palette ?? 'default');
|
|
17
|
+
}
|
|
18
|
+
function resolveReplay(options) {
|
|
19
|
+
const pace = options.replay?.pace ?? TIMELINE.pace;
|
|
20
|
+
const chapterThreshold = options.replay?.chapterThreshold ?? TIMELINE.chapterThreshold;
|
|
21
|
+
if (!(Number.isFinite(pace) && pace > 0)) {
|
|
22
|
+
throw new KgdiffError('invalid-input', `replay.pace must be a positive number of ms, got ${pace}.`);
|
|
23
|
+
}
|
|
24
|
+
if (!(chapterThreshold >= 0)) {
|
|
25
|
+
throw new KgdiffError('invalid-input', `replay.chapterThreshold must be ≥ 0, got ${chapterThreshold}.`);
|
|
26
|
+
}
|
|
27
|
+
return { pace, chapterThreshold };
|
|
28
|
+
}
|
|
29
|
+
/** Importance in [0, 1]: changed nodes 0.8–1, unchanged 0–0.75, both by degree percentile. */
|
|
30
|
+
function importances(nodes) {
|
|
31
|
+
const n = nodes.length;
|
|
32
|
+
const degree = new Float64Array(n);
|
|
33
|
+
for (let i = 0; i < n; i++) {
|
|
34
|
+
const d = nodes[i].degree;
|
|
35
|
+
degree[i] = Math.max(d.before, d.after);
|
|
36
|
+
}
|
|
37
|
+
const order = Array.from({ length: n }, (_, i) => i).sort((a, b) => degree[a] - degree[b]);
|
|
38
|
+
const at = (k) => order[k];
|
|
39
|
+
// rank = share of nodes with a strictly lower degree (equal degrees share a rank).
|
|
40
|
+
const rank = new Float64Array(n);
|
|
41
|
+
for (let k = 0; k < n;) {
|
|
42
|
+
let j = k;
|
|
43
|
+
while (j < n && degree[at(j)] === degree[at(k)])
|
|
44
|
+
j++;
|
|
45
|
+
const r = n > 1 ? k / (n - 1) : 0;
|
|
46
|
+
for (let m = k; m < j; m++)
|
|
47
|
+
rank[at(m)] = r;
|
|
48
|
+
k = j;
|
|
49
|
+
}
|
|
50
|
+
const out = new Float64Array(n);
|
|
51
|
+
for (let i = 0; i < n; i++) {
|
|
52
|
+
const changed = nodes[i].status !== 'unchanged';
|
|
53
|
+
const r = rank[i];
|
|
54
|
+
out[i] = changed ? 0.8 + 0.2 * r : 0.75 * r;
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
function facetTarget(node, kind) {
|
|
59
|
+
for (const f of node.facets) {
|
|
60
|
+
if (f.kind === 'mergedInto' && kind === 'mergedInto')
|
|
61
|
+
return f.target;
|
|
62
|
+
if (f.kind === 'splitFrom' && kind === 'splitFrom')
|
|
63
|
+
return f.source;
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
/** `meta.predicateLabels` of a graph when it is a plain object (formats: predicate → label). */
|
|
68
|
+
function predicateLabelTable(meta) {
|
|
69
|
+
const table = meta.predicateLabels;
|
|
70
|
+
return typeof table === 'object' && table !== null && !Array.isArray(table)
|
|
71
|
+
? table
|
|
72
|
+
: null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Display labels of edges. A predicate's label comes from the files' own property labels
|
|
76
|
+
* (`after.meta.predicateLabels`, then `before.meta.predicateLabels`; own non-empty strings only),
|
|
77
|
+
* else the edge's readable predicate name. Edges with a `label` facet carry explicit labels
|
|
78
|
+
* that changed, so those are kept as they are.
|
|
79
|
+
*/
|
|
80
|
+
function edgeDisplayLabels(diff) {
|
|
81
|
+
const tables = [predicateLabelTable(diff.after.meta), predicateLabelTable(diff.before.meta)];
|
|
82
|
+
const lookup = (predicate) => {
|
|
83
|
+
if (predicate === undefined)
|
|
84
|
+
return undefined;
|
|
85
|
+
for (const table of tables) {
|
|
86
|
+
if (table === null || !Object.hasOwn(table, predicate))
|
|
87
|
+
continue;
|
|
88
|
+
const v = table[predicate];
|
|
89
|
+
if (typeof v === 'string' && v !== '')
|
|
90
|
+
return v;
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
};
|
|
94
|
+
return (e) => {
|
|
95
|
+
if (e.facets.some((f) => f.kind === 'label')) {
|
|
96
|
+
return { label: e.label, labelBefore: edgeLabelBefore(e) };
|
|
97
|
+
}
|
|
98
|
+
const predicateFacet = e.facets.find((f) => f.kind === 'predicate');
|
|
99
|
+
const before = predicateFacet?.kind === 'predicate'
|
|
100
|
+
? (lookup(e.predicateBefore ?? predicateFacet.from) ?? edgeLabelBefore(e))
|
|
101
|
+
: undefined;
|
|
102
|
+
return { label: lookup(e.predicate) ?? e.label, labelBefore: before };
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** Family of a hunk: the kind's default, refined for `modify` by its node's primary facet. */
|
|
106
|
+
function sceneHunkFamily(hunk, byId) {
|
|
107
|
+
if (hunk.kind !== 'modify')
|
|
108
|
+
return hunkFamily(hunk.kind);
|
|
109
|
+
const anchor = byId.get(hunk.anchor);
|
|
110
|
+
if (anchor === undefined)
|
|
111
|
+
return 'content';
|
|
112
|
+
const f = nodeFamily(anchor, nodeRole(anchor));
|
|
113
|
+
return f === 'neutral' ? 'content' : f;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Build the visual model. Pure and deterministic.
|
|
117
|
+
*
|
|
118
|
+
* - Nodes absent from `layout.positions` (scope `changes`) are left out; edges need both
|
|
119
|
+
* endpoints. Before-version endpoints outside the layout fall back to the after ones.
|
|
120
|
+
* - Node / edge order follows the diff (sorted by union id); indices are dense.
|
|
121
|
+
* - Hunks are reordered as a spatial tour (docs/algorithms.md §10); titles come from core
|
|
122
|
+
* `formatHunk` in `options.locale`.
|
|
123
|
+
* - `degree` is the max of the before / after degree (as used for the radius).
|
|
124
|
+
*
|
|
125
|
+
* O(N log N + E + H √H). See `SceneOptions` for defaults.
|
|
126
|
+
*
|
|
127
|
+
* @throws KgdiffError(`invalid-input`) for invalid replay options or theme names.
|
|
128
|
+
*/
|
|
129
|
+
export function buildScene(diff, layout, options = {}) {
|
|
130
|
+
const theme = resolveTheme(options);
|
|
131
|
+
const locale = options.locale ?? 'en';
|
|
132
|
+
const { pace, chapterThreshold } = resolveReplay(options);
|
|
133
|
+
// ── Nodes in scope ──
|
|
134
|
+
const unionNodes = [];
|
|
135
|
+
const nodeIndex = new Map();
|
|
136
|
+
const byId = new Map();
|
|
137
|
+
for (const n of diff.nodes) {
|
|
138
|
+
byId.set(n.id, n);
|
|
139
|
+
const p = layout.positions.get(n.id);
|
|
140
|
+
if (p === undefined || !Number.isFinite(p.x) || !Number.isFinite(p.y))
|
|
141
|
+
continue;
|
|
142
|
+
nodeIndex.set(n.id, unionNodes.length);
|
|
143
|
+
unionNodes.push(n);
|
|
144
|
+
}
|
|
145
|
+
const byAfter = new Map();
|
|
146
|
+
const byBefore = new Map();
|
|
147
|
+
for (let i = 0; i < unionNodes.length; i++) {
|
|
148
|
+
const n = unionNodes[i];
|
|
149
|
+
if (n.afterId !== undefined)
|
|
150
|
+
byAfter.set(n.afterId, i);
|
|
151
|
+
if (n.beforeId !== undefined)
|
|
152
|
+
byBefore.set(n.beforeId, i);
|
|
153
|
+
}
|
|
154
|
+
// ── Edges in scope ──
|
|
155
|
+
const unionEdges = [];
|
|
156
|
+
const ends = [];
|
|
157
|
+
for (const e of diff.edges) {
|
|
158
|
+
const s = nodeIndex.get(e.source);
|
|
159
|
+
const t = nodeIndex.get(e.target);
|
|
160
|
+
if (s === undefined || t === undefined)
|
|
161
|
+
continue;
|
|
162
|
+
const sb = e.sourceBefore === undefined ? s : (nodeIndex.get(e.sourceBefore) ?? s);
|
|
163
|
+
const tb = e.targetBefore === undefined ? t : (nodeIndex.get(e.targetBefore) ?? t);
|
|
164
|
+
unionEdges.push(e);
|
|
165
|
+
ends.push({ s, t, sb, tb });
|
|
166
|
+
}
|
|
167
|
+
// ── Positions ──
|
|
168
|
+
const xs = new Float64Array(unionNodes.length);
|
|
169
|
+
const ys = new Float64Array(unionNodes.length);
|
|
170
|
+
const rs = new Float64Array(unionNodes.length);
|
|
171
|
+
for (let i = 0; i < unionNodes.length; i++) {
|
|
172
|
+
const n = unionNodes[i];
|
|
173
|
+
const p = layout.positions.get(n.id);
|
|
174
|
+
xs[i] = p.x;
|
|
175
|
+
ys[i] = p.y;
|
|
176
|
+
const r = layout.radii.get(n.id);
|
|
177
|
+
rs[i] =
|
|
178
|
+
r !== undefined && Number.isFinite(r) && r > 0
|
|
179
|
+
? r
|
|
180
|
+
: nodeRadius(Math.max(n.degree.before, n.degree.after));
|
|
181
|
+
}
|
|
182
|
+
// ── Hunk tour order (respecting `requires`), then play order ──
|
|
183
|
+
const diffHunkIndex = new Map();
|
|
184
|
+
for (let k = 0; k < diff.hunks.length; k++)
|
|
185
|
+
diffHunkIndex.set(diff.hunks[k].id, k);
|
|
186
|
+
const requiresOf = (h) => {
|
|
187
|
+
const out = [];
|
|
188
|
+
for (const id of h.requires ?? []) {
|
|
189
|
+
const k = diffHunkIndex.get(id);
|
|
190
|
+
if (k !== undefined)
|
|
191
|
+
out.push(k);
|
|
192
|
+
}
|
|
193
|
+
return out;
|
|
194
|
+
};
|
|
195
|
+
const tourItems = diff.hunks.map((h) => {
|
|
196
|
+
let x = 0;
|
|
197
|
+
let y = 0;
|
|
198
|
+
const a = nodeIndex.get(h.anchor);
|
|
199
|
+
if (a !== undefined) {
|
|
200
|
+
x = xs[a];
|
|
201
|
+
y = ys[a];
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
let count = 0;
|
|
205
|
+
for (const id of [...h.nodes, ...h.context]) {
|
|
206
|
+
const i = nodeIndex.get(id);
|
|
207
|
+
if (i === undefined)
|
|
208
|
+
continue;
|
|
209
|
+
x += xs[i];
|
|
210
|
+
y += ys[i];
|
|
211
|
+
count++;
|
|
212
|
+
}
|
|
213
|
+
if (count > 0) {
|
|
214
|
+
x /= count;
|
|
215
|
+
y /= count;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
phase: h.phase,
|
|
220
|
+
size: h.nodes.length + h.edges.length,
|
|
221
|
+
order: h.order,
|
|
222
|
+
x,
|
|
223
|
+
y,
|
|
224
|
+
requires: requiresOf(h),
|
|
225
|
+
};
|
|
226
|
+
});
|
|
227
|
+
let tour = tourOrder(tourItems);
|
|
228
|
+
if (timelineMode(tour.length, chapterThreshold) === 'chapters') {
|
|
229
|
+
// A hunk that requires one of a later chapter plays in that chapter: reorder so the scene's
|
|
230
|
+
// hunk order is the play order (still requirement-respecting).
|
|
231
|
+
const pos = new Int32Array(tour.length);
|
|
232
|
+
for (let k = 0; k < tour.length; k++)
|
|
233
|
+
pos[tour[k]] = k;
|
|
234
|
+
const plan = chapterPlan(tour.map((h) => ({
|
|
235
|
+
phase: tourItems[h].phase,
|
|
236
|
+
requires: tourItems[h].requires.map((r) => pos[r]),
|
|
237
|
+
})));
|
|
238
|
+
tour = tour
|
|
239
|
+
.map((h, k) => ({ h, k, c: plan[k] }))
|
|
240
|
+
.sort((a, b) => a.c - b.c || a.k - b.k)
|
|
241
|
+
.map((x) => x.h);
|
|
242
|
+
}
|
|
243
|
+
const hunkIndex = new Map();
|
|
244
|
+
for (let k = 0; k < tour.length; k++)
|
|
245
|
+
hunkIndex.set(diff.hunks[tour[k]].id, k);
|
|
246
|
+
const hunkOf = (id) => id === undefined ? -1 : (hunkIndex.get(id) ?? -1);
|
|
247
|
+
// ── Scene nodes ──
|
|
248
|
+
const importance = importances(unionNodes);
|
|
249
|
+
const nodes = unionNodes.map((n, i) => {
|
|
250
|
+
const role = nodeRole(n);
|
|
251
|
+
const labelBefore = nodeLabelBefore(n);
|
|
252
|
+
const badge = nodeBadge(n, role);
|
|
253
|
+
let flow;
|
|
254
|
+
if (role === 'merge-source') {
|
|
255
|
+
const target = facetTarget(n, 'mergedInto');
|
|
256
|
+
flow = target === undefined ? undefined : nodeIndex.get(target);
|
|
257
|
+
}
|
|
258
|
+
else if (role === 'split-target') {
|
|
259
|
+
const source = facetTarget(n, 'splitFrom');
|
|
260
|
+
flow = source === undefined ? undefined : nodeIndex.get(source);
|
|
261
|
+
}
|
|
262
|
+
else if (role === 'deprecated') {
|
|
263
|
+
for (const id of n.after?.replacedBy ?? []) {
|
|
264
|
+
flow = byAfter.get(id) ?? nodeIndex.get(id);
|
|
265
|
+
if (flow !== undefined)
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (flow === i)
|
|
270
|
+
flow = undefined;
|
|
271
|
+
const family = nodeFamily(n, role);
|
|
272
|
+
const node = {
|
|
273
|
+
index: i,
|
|
274
|
+
id: n.id,
|
|
275
|
+
x: xs[i],
|
|
276
|
+
y: ys[i],
|
|
277
|
+
r: rs[i],
|
|
278
|
+
status: n.status,
|
|
279
|
+
role,
|
|
280
|
+
family,
|
|
281
|
+
familyBefore: nodeFamilyBefore(n, role, family),
|
|
282
|
+
label: n.label,
|
|
283
|
+
...(labelBefore !== undefined && labelBefore !== n.label ? { labelBefore } : {}),
|
|
284
|
+
...(badge !== undefined ? { badge } : {}),
|
|
285
|
+
...(flow !== undefined ? { flow } : {}),
|
|
286
|
+
hunk: hunkOf(n.hunk),
|
|
287
|
+
presentBefore: n.before !== undefined || n.beforeId !== undefined,
|
|
288
|
+
presentAfter: n.after !== undefined || n.afterId !== undefined,
|
|
289
|
+
implicit: (n.after ?? n.before)?.implicit ?? false,
|
|
290
|
+
degree: Math.max(n.degree.before, n.degree.after),
|
|
291
|
+
hidden: layout.hidden.get(n.id) ?? 0,
|
|
292
|
+
importance: importance[i],
|
|
293
|
+
};
|
|
294
|
+
return node;
|
|
295
|
+
});
|
|
296
|
+
// ── Scene edges ──
|
|
297
|
+
const curv = edgeCurvatures(ends);
|
|
298
|
+
const displayLabels = edgeDisplayLabels(diff);
|
|
299
|
+
const edges = unionEdges.map((e, j) => {
|
|
300
|
+
const role = edgeRole(e);
|
|
301
|
+
const end = ends[j];
|
|
302
|
+
const { label, labelBefore } = displayLabels(e);
|
|
303
|
+
return {
|
|
304
|
+
index: j,
|
|
305
|
+
id: e.id,
|
|
306
|
+
s: end.s,
|
|
307
|
+
t: end.t,
|
|
308
|
+
sb: end.sb,
|
|
309
|
+
tb: end.tb,
|
|
310
|
+
status: e.status,
|
|
311
|
+
role,
|
|
312
|
+
family: edgeFamily(e, role),
|
|
313
|
+
label,
|
|
314
|
+
...(labelBefore !== undefined && labelBefore !== label ? { labelBefore } : {}),
|
|
315
|
+
curvature: curv.primary[j],
|
|
316
|
+
hunk: hunkOf(e.hunk),
|
|
317
|
+
presentBefore: e.before !== undefined || e.beforeKey !== undefined,
|
|
318
|
+
presentAfter: e.after !== undefined || e.afterKey !== undefined,
|
|
319
|
+
hierarchical: e.hierarchical,
|
|
320
|
+
};
|
|
321
|
+
});
|
|
322
|
+
// ── Bounds ──
|
|
323
|
+
const all = new BoundsBuilder();
|
|
324
|
+
for (const n of nodes)
|
|
325
|
+
addNodeBox(all, n.x, n.y, n.r, n.label, n.labelBefore);
|
|
326
|
+
const bounds = all.rect();
|
|
327
|
+
const center = rectCenter(bounds);
|
|
328
|
+
// ── Hunks ──
|
|
329
|
+
const indicesOf = (ids, index) => {
|
|
330
|
+
const out = [];
|
|
331
|
+
for (const id of ids) {
|
|
332
|
+
const i = index.get(id);
|
|
333
|
+
if (i !== undefined)
|
|
334
|
+
out.push(i);
|
|
335
|
+
}
|
|
336
|
+
return out;
|
|
337
|
+
};
|
|
338
|
+
const edgeIndex = new Map();
|
|
339
|
+
for (const e of edges)
|
|
340
|
+
edgeIndex.set(e.id, e.index);
|
|
341
|
+
const hunks = tour.map((h, k) => {
|
|
342
|
+
const hunk = diff.hunks[h];
|
|
343
|
+
const hn = indicesOf(hunk.nodes, nodeIndex);
|
|
344
|
+
const hc = indicesOf(hunk.context, nodeIndex);
|
|
345
|
+
const b = new BoundsBuilder();
|
|
346
|
+
for (const i of [...hn, ...hc]) {
|
|
347
|
+
const n = nodes[i];
|
|
348
|
+
addNodeBox(b, n.x, n.y, n.r, n.label, n.labelBefore);
|
|
349
|
+
}
|
|
350
|
+
const text = formatHunk(hunk, diff, locale);
|
|
351
|
+
return {
|
|
352
|
+
index: k,
|
|
353
|
+
id: hunk.id,
|
|
354
|
+
kind: hunk.kind,
|
|
355
|
+
phase: hunk.phase,
|
|
356
|
+
family: sceneHunkFamily(hunk, byId),
|
|
357
|
+
title: text.title,
|
|
358
|
+
subtitle: text.subtitle,
|
|
359
|
+
anchor: nodeIndex.get(hunk.anchor) ?? -1,
|
|
360
|
+
nodes: hn,
|
|
361
|
+
edges: indicesOf(hunk.edges, edgeIndex),
|
|
362
|
+
context: hc,
|
|
363
|
+
bounds: b.rect({ x: center.x, y: center.y, width: 0, height: 0 }),
|
|
364
|
+
};
|
|
365
|
+
});
|
|
366
|
+
// ── Suggestions ──
|
|
367
|
+
const suggestions = [];
|
|
368
|
+
for (const s of diff.suggestions) {
|
|
369
|
+
const before = byBefore.get(s.before);
|
|
370
|
+
const after = byAfter.get(s.after);
|
|
371
|
+
if (before !== undefined && after !== undefined && before !== after) {
|
|
372
|
+
suggestions.push({ before, after, score: s.score });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const playPos = new Int32Array(tour.length);
|
|
376
|
+
for (let k = 0; k < tour.length; k++)
|
|
377
|
+
playPos[tour[k]] = k;
|
|
378
|
+
const timeline = buildTimeline(hunks.map((h, k) => {
|
|
379
|
+
const item = tourItems[tour[k]];
|
|
380
|
+
return {
|
|
381
|
+
kind: h.kind,
|
|
382
|
+
phase: h.phase,
|
|
383
|
+
size: item.size,
|
|
384
|
+
bounds: h.bounds,
|
|
385
|
+
requires: item.requires.map((r) => playPos[r]),
|
|
386
|
+
};
|
|
387
|
+
}), pace, chapterThreshold);
|
|
388
|
+
const hunkIdx = new Map();
|
|
389
|
+
for (const h of hunks)
|
|
390
|
+
hunkIdx.set(h.id, h.index);
|
|
391
|
+
return {
|
|
392
|
+
nodes,
|
|
393
|
+
edges,
|
|
394
|
+
hunks,
|
|
395
|
+
suggestions,
|
|
396
|
+
bounds,
|
|
397
|
+
stats: diff.stats,
|
|
398
|
+
timeline,
|
|
399
|
+
theme,
|
|
400
|
+
locale,
|
|
401
|
+
meta: { before: diff.before.meta, after: diff.after.meta },
|
|
402
|
+
nodeIndex,
|
|
403
|
+
edgeIndex,
|
|
404
|
+
hunkIndex: hunkIdx,
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAEL,UAAU,EAIV,WAAW,GAIZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAqB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EACL,UAAU,EACV,eAAe,EACf,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,QAAQ,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAYnG,SAAS,YAAY,CAAC,OAAqB;IACzC,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;IACxB,IAAI,CAAC,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACvD,OAAO,QAAQ,CAAC,CAAC,IAAI,MAAM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
|
|
1
|
+
import type { EdgeStyle, NodeStyle } from './styles.js';
|
|
2
|
+
import type { Scene } from './types.js';
|
|
3
|
+
/** Node animation kinds. */
|
|
4
|
+
export declare const NA_NONE = 0;
|
|
5
|
+
/** Both states visible: colors / rings / halos crossfade, label slides, ring flashes, badge ticks in. */
|
|
6
|
+
export declare const NA_FADE = 1;
|
|
7
|
+
/** Shrinks to 0.6·r while its fill drains into a dashed ghost, which lingers, then fades. */
|
|
8
|
+
export declare const NA_REMOVE = 2;
|
|
9
|
+
/** Pops in (scale 0 → 1.08 → 1, back-out), then its label fades in. */
|
|
10
|
+
export declare const NA_ADD = 3;
|
|
11
|
+
/** Merge source: travels on a gentle arc into its target, fades on arrival. */
|
|
12
|
+
export declare const NA_TRAVEL = 4;
|
|
13
|
+
/** Split target: emerges from its source and travels out to its position. */
|
|
14
|
+
export declare const NA_EMERGE = 5;
|
|
15
|
+
/** Edge animation kinds. */
|
|
16
|
+
export declare const EA_NONE = 0;
|
|
17
|
+
/** Grows from the existing endpoint (`progress` 0 → 1). */
|
|
18
|
+
export declare const EA_GROW = 1;
|
|
19
|
+
/** Retracts toward the surviving endpoint (`progress` 1 → 0). */
|
|
20
|
+
export declare const EA_RETRACT = 2;
|
|
21
|
+
/** The changed end swings around the shared endpoint from the old to the new node. */
|
|
22
|
+
export declare const EA_SWING = 3;
|
|
23
|
+
/** Carried by a merge: rides the travelling source (before form), then is the after form. */
|
|
24
|
+
export declare const EA_FOLLOW_MERGE = 4;
|
|
25
|
+
/** Carried by a split: rides the emerging target (after form). */
|
|
26
|
+
export declare const EA_FOLLOW_SPLIT = 5;
|
|
27
|
+
/** Same geometry, new label / predicate: label swaps, stroke flashes. */
|
|
28
|
+
export declare const EA_FADE = 6;
|
|
29
|
+
/** Geometry changes with no shared endpoint or no mover: crossfade old form → new form. */
|
|
30
|
+
export declare const EA_SWAP = 7;
|
|
31
|
+
/** Timings in transform-phase fractions. */
|
|
32
|
+
export declare const CHOREO: {
|
|
33
|
+
readonly retract: readonly [0, 0.4];
|
|
34
|
+
readonly removeShrink: readonly [0.25, 0.55];
|
|
35
|
+
/** The ghost lingers until 60% of the window (u = (0.6 − 0.18) / 0.64), then fades. */
|
|
36
|
+
readonly removeGhostFade: readonly [0.65625, 1];
|
|
37
|
+
readonly splitSourceShrink: readonly [0.6, 0.8];
|
|
38
|
+
readonly splitSourceFade: readonly [0.8, 1];
|
|
39
|
+
readonly growFromExisting: readonly [0, 0.45];
|
|
40
|
+
readonly pop: readonly [0.35, 0.75];
|
|
41
|
+
readonly popAfterArrival: readonly [0.55, 0.85];
|
|
42
|
+
readonly growBetweenNew: readonly [0.6, 0.9];
|
|
43
|
+
readonly growAfterArrival: readonly [0.7, 0.95];
|
|
44
|
+
readonly growOther: readonly [0.35, 0.85];
|
|
45
|
+
readonly labelFadeIn: 0.15;
|
|
46
|
+
readonly travelStagger: 0.15;
|
|
47
|
+
readonly travel: 0.55;
|
|
48
|
+
readonly arrivalFade: 0.12;
|
|
49
|
+
readonly mergeTargetFade: readonly [0.55, 0.85];
|
|
50
|
+
readonly mergeFlash: readonly [0.7, 1];
|
|
51
|
+
readonly splitStart: 0.05;
|
|
52
|
+
readonly splitSourceStay: readonly [0.6, 0.9];
|
|
53
|
+
readonly modifyFade: readonly [0.3, 0.7];
|
|
54
|
+
readonly modifyFlash: readonly [0.4, 0.8];
|
|
55
|
+
readonly labelOut: readonly [0.1, 0.5];
|
|
56
|
+
readonly labelIn: readonly [0.3, 0.7];
|
|
57
|
+
/** px the old label rises while fading / the new label rises from. */
|
|
58
|
+
readonly labelSlide: 6;
|
|
59
|
+
readonly badgeTick: 0.6;
|
|
60
|
+
readonly swing: readonly [0.1, 0.8];
|
|
61
|
+
readonly ghostFade: readonly [0.3, 1];
|
|
62
|
+
readonly pivotFade: readonly [0.8, 1];
|
|
63
|
+
readonly edgeFade: readonly [0.2, 0.7];
|
|
64
|
+
readonly swap: readonly [0.2, 0.8];
|
|
65
|
+
/** Bend of travel arcs and merge / split arrows. */
|
|
66
|
+
readonly arc: 0.25;
|
|
67
|
+
};
|
|
68
|
+
export interface Choreography {
|
|
69
|
+
readonly nKind: Uint8Array;
|
|
70
|
+
/** Main interval [nA, nB]; nC: extra time (REMOVE fade start, ADD label start). */
|
|
71
|
+
readonly nA: Float64Array;
|
|
72
|
+
readonly nB: Float64Array;
|
|
73
|
+
readonly nC: Float64Array;
|
|
74
|
+
/** Ring flash interval; nFlashA < 0 for none. */
|
|
75
|
+
readonly nFlashA: Float64Array;
|
|
76
|
+
readonly nFlashB: Float64Array;
|
|
77
|
+
/** 1 when the primary label text changes (slide / crossfade). */
|
|
78
|
+
readonly nLabelSwap: Uint8Array;
|
|
79
|
+
/** Badge tick-in time (u), or 2 for never during the transform. */
|
|
80
|
+
readonly nBadgeAt: Float64Array;
|
|
81
|
+
/** Merge targets: sorted arrival times and the badge text after k arrivals (`⊕ k`). */
|
|
82
|
+
readonly nArrivals: readonly (Float64Array | null)[];
|
|
83
|
+
readonly nBadgeSteps: readonly (readonly string[] | null)[];
|
|
84
|
+
/** 1 when the node pulses at its hunk's spotlight phase (visible in its before state). */
|
|
85
|
+
readonly nPulse: Uint8Array;
|
|
86
|
+
/** Per hunk: no hunk node is visible before, so its context pulses instead (additions). */
|
|
87
|
+
readonly hPulseContext: Uint8Array;
|
|
88
|
+
readonly eKind: Uint8Array;
|
|
89
|
+
readonly eA: Float64Array;
|
|
90
|
+
readonly eB: Float64Array;
|
|
91
|
+
/** GROW / RETRACT: draw from the target end. */
|
|
92
|
+
readonly eFromTarget: Uint8Array;
|
|
93
|
+
/** SWING: fixed endpoint node; FOLLOW: moving node. -1 when none. */
|
|
94
|
+
readonly ePivot: Int32Array;
|
|
95
|
+
}
|
|
96
|
+
/** Plan every element's replay animation. O(N + E). */
|
|
97
|
+
export declare function choreograph(scene: Scene, nodeStyles: readonly (readonly [NodeStyle, NodeStyle, NodeStyle])[], edgeStyles: readonly (readonly [EdgeStyle, EdgeStyle, EdgeStyle])[]): Choreography;
|
|
98
|
+
//# sourceMappingURL=choreography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choreography.d.ts","sourceRoot":"","sources":["../src/choreography.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,4BAA4B;AAC5B,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,yGAAyG;AACzG,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,6FAA6F;AAC7F,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,uEAAuE;AACvE,eAAO,MAAM,MAAM,IAAI,CAAC;AACxB,+EAA+E;AAC/E,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,6EAA6E;AAC7E,eAAO,MAAM,SAAS,IAAI,CAAC;AAE3B,4BAA4B;AAC5B,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,2DAA2D;AAC3D,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,iEAAiE;AACjE,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,sFAAsF;AACtF,eAAO,MAAM,QAAQ,IAAI,CAAC;AAC1B,6FAA6F;AAC7F,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,kEAAkE;AAClE,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,yEAAyE;AACzE,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,2FAA2F;AAC3F,eAAO,MAAM,OAAO,IAAI,CAAC;AAEzB,4CAA4C;AAC5C,eAAO,MAAM,MAAM;aACjB,OAAO,YAAG,CAAC,EAAE,GAAG;aAChB,YAAY,YAAG,IAAI,EAAE,IAAI;IACzB,uFAAuF;aACvF,eAAe,YAAG,OAAO,EAAE,CAAC;aAC5B,iBAAiB,YAAG,GAAG,EAAE,GAAG;aAC5B,eAAe,YAAG,GAAG,EAAE,CAAC;aACxB,g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