@kgdiff/g6 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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +149 -2
  3. package/dist/color.d.ts +24 -0
  4. package/dist/color.d.ts.map +1 -0
  5. package/dist/color.js +95 -0
  6. package/dist/color.js.map +1 -0
  7. package/dist/constants.d.ts +81 -0
  8. package/dist/constants.d.ts.map +1 -0
  9. package/dist/constants.js +81 -0
  10. package/dist/constants.js.map +1 -0
  11. package/dist/controller.d.ts +126 -0
  12. package/dist/controller.d.ts.map +1 -0
  13. package/dist/controller.js +422 -0
  14. package/dist/controller.js.map +1 -0
  15. package/dist/geometry.d.ts +19 -0
  16. package/dist/geometry.d.ts.map +1 -0
  17. package/dist/geometry.js +43 -0
  18. package/dist/geometry.js.map +1 -0
  19. package/dist/index.d.ts +101 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +99 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/locator.d.ts +24 -0
  24. package/dist/locator.d.ts.map +1 -0
  25. package/dist/locator.js +69 -0
  26. package/dist/locator.js.map +1 -0
  27. package/dist/map-context.d.ts +70 -0
  28. package/dist/map-context.d.ts.map +1 -0
  29. package/dist/map-context.js +44 -0
  30. package/dist/map-context.js.map +1 -0
  31. package/dist/map-edge.d.ts +19 -0
  32. package/dist/map-edge.d.ts.map +1 -0
  33. package/dist/map-edge.js +399 -0
  34. package/dist/map-edge.js.map +1 -0
  35. package/dist/map-node.d.ts +10 -0
  36. package/dist/map-node.d.ts.map +1 -0
  37. package/dist/map-node.js +243 -0
  38. package/dist/map-node.js.map +1 -0
  39. package/dist/map.d.ts +47 -0
  40. package/dist/map.d.ts.map +1 -0
  41. package/dist/map.js +92 -0
  42. package/dist/map.js.map +1 -0
  43. package/dist/node.d.ts +68 -0
  44. package/dist/node.d.ts.map +1 -0
  45. package/dist/node.js +189 -0
  46. package/dist/node.js.map +1 -0
  47. package/dist/options.d.ts +33 -0
  48. package/dist/options.d.ts.map +1 -0
  49. package/dist/options.js +172 -0
  50. package/dist/options.js.map +1 -0
  51. package/dist/patch.d.ts +45 -0
  52. package/dist/patch.d.ts.map +1 -0
  53. package/dist/patch.js +120 -0
  54. package/dist/patch.js.map +1 -0
  55. package/dist/replay.d.ts +20 -0
  56. package/dist/replay.d.ts.map +1 -0
  57. package/dist/replay.js +36 -0
  58. package/dist/replay.js.map +1 -0
  59. package/package.json +54 -3
  60. package/src/color.ts +101 -0
  61. package/src/constants.ts +96 -0
  62. package/src/controller.ts +517 -0
  63. package/src/geometry.ts +44 -0
  64. package/src/index.ts +140 -0
  65. package/src/locator.ts +72 -0
  66. package/src/map-context.ts +119 -0
  67. package/src/map-edge.ts +481 -0
  68. package/src/map-node.ts +272 -0
  69. package/src/map.ts +130 -0
  70. package/src/node.ts +240 -0
  71. package/src/options.ts +215 -0
  72. package/src/patch.ts +133 -0
  73. package/src/replay.ts +59 -0
@@ -0,0 +1,399 @@
1
+ import { ANCHOR_ID_PREFIX, ARROW_GAP, ARROW_LENGTH, ARROW_WIDTH, EDGE_HIT_WIDTH, GLYPH_ID_PREFIX, LABEL_MAX_WIDTH, MARK_RADIUS, PIVOT_OUTLINE, TEXT_HALO_ALPHA, TEXT_HALO_WIDTH, Z, } from './constants.js';
2
+ import { band, finite, linkLength, unit } from './geometry.js';
3
+ import { NodeLocator } from './locator.js';
4
+ import { claim, noteLod, shown, text, } from './map-context.js';
5
+ import { nodeBase } from './map-node.js';
6
+ const ARC = { arrow: true, dash: null, mark: false };
7
+ const GHOST = { arrow: true, dash: [4, 3], mark: false };
8
+ const SUGGESTION = { arrow: false, dash: [1, 3], mark: true };
9
+ const PLAIN = { arrow: false, dash: null, mark: false };
10
+ function glyphStyle(kind) {
11
+ switch (kind) {
12
+ case 'merge-arrow':
13
+ case 'split-arrow':
14
+ case 'replacement-arrow':
15
+ case 'move-arrow':
16
+ return ARC;
17
+ case 'edge-ghost':
18
+ return GHOST;
19
+ case 'suggestion':
20
+ return SUGGESTION;
21
+ default:
22
+ return PLAIN;
23
+ }
24
+ }
25
+ /**
26
+ * G6 arrowhead size: [length along the line, width]. Shared by every edge so G6's shallow style
27
+ * comparison sees no change; G6 only reads it (`parseSize` copies), freezing guards the rest.
28
+ */
29
+ const ARROW_SIZE = Object.freeze([ARROW_LENGTH, ARROW_WIDTH]);
30
+ /** Gap long enough to hide the rest of a partially drawn line. */
31
+ const DASH_REST = 1e6;
32
+ function edgeBase(ctx) {
33
+ if (ctx.edgeBase === null)
34
+ ctx.edgeBase = Object.freeze(buildEdgeBase(ctx));
35
+ return ctx.edgeBase;
36
+ }
37
+ function buildEdgeBase(ctx) {
38
+ const t = ctx.theme;
39
+ return {
40
+ zIndex: Z.edge,
41
+ visibility: 'visible',
42
+ cursor: 'pointer',
43
+ pointerEvents: 'auto',
44
+ increasedLineWidthForHitTesting: EDGE_HIT_WIDTH,
45
+ opacity: 1,
46
+ stroke: t.neutral.edge,
47
+ strokeOpacity: 1,
48
+ lineWidth: 1,
49
+ lineDash: 0,
50
+ lineDashOffset: 0,
51
+ lineCap: 'round',
52
+ curvePosition: 0.5,
53
+ curveOffset: 0,
54
+ loop: true,
55
+ loopPlacement: 'top',
56
+ halo: false,
57
+ startArrow: false,
58
+ endArrow: false,
59
+ endArrowType: 'triangle',
60
+ endArrowSize: ARROW_SIZE,
61
+ endArrowLineWidth: 0,
62
+ endArrowOffset: ARROW_LENGTH / 2 + ARROW_GAP,
63
+ label: false,
64
+ labelText: '',
65
+ labelFill: t.neutral.label,
66
+ labelFontSize: 10.5,
67
+ labelFontWeight: t.font.weightRegular,
68
+ labelFontFamily: t.font.family,
69
+ labelOpacity: 0,
70
+ labelPlacement: 'center',
71
+ labelAutoRotate: false,
72
+ labelOffsetX: 0,
73
+ labelOffsetY: 0,
74
+ labelTextAlign: 'center',
75
+ labelTextBaseline: 'middle',
76
+ labelTextDecorationLine: 'none',
77
+ labelTextDecorationColor: t.neutral.label,
78
+ labelStroke: ctx.bg,
79
+ labelLineWidth: TEXT_HALO_WIDTH,
80
+ labelStrokeOpacity: 0,
81
+ labelLineJoin: 'round',
82
+ labelMaxWidth: LABEL_MAX_WIDTH,
83
+ labelWordWrap: true,
84
+ labelMaxLines: 1,
85
+ labelTextOverflow: '…',
86
+ labelBackground: false,
87
+ labelBackgroundFill: ctx.bg,
88
+ labelBackgroundStroke: ctx.bg,
89
+ labelBackgroundLineWidth: 0,
90
+ labelBackgroundRadius: 0,
91
+ labelBackgroundOpacity: 1,
92
+ labelBackgroundWidth: 0,
93
+ labelBackgroundHeight: 0,
94
+ labelPadding: 0,
95
+ };
96
+ }
97
+ /**
98
+ * Geometry shared by edges and glyph arcs: G6 type, curve offset, partial drawing, arrow.
99
+ * G6 has no "draw a fraction of the path": a solid line shows `progress` with a dash pattern
100
+ * (visible part, then a gap longer than the path); a dashed one fades with it instead.
101
+ */
102
+ function linkStyle(link, arrow) {
103
+ const { a, b } = link;
104
+ const loop = a.id === b.id;
105
+ const len = loop ? 0 : Math.hypot(b.x - a.x, b.y - a.y);
106
+ const c = loop || !(len > 0) ? 0 : finite(link.curvature, 0);
107
+ const p = unit(link.progress);
108
+ let alpha = link.alpha;
109
+ let lineDash = link.dash !== null && link.dash.length > 0 ? [...link.dash] : 0;
110
+ let lineDashOffset = 0;
111
+ if (p < 1) {
112
+ if (lineDash === 0) {
113
+ const drawn = Math.max(0, linkLength(len, c) - Math.max(0, a.r) - Math.max(0, b.r));
114
+ lineDash = [drawn * p, DASH_REST];
115
+ if (link.fromTarget)
116
+ lineDashOffset = -drawn * (1 - p);
117
+ }
118
+ else
119
+ alpha *= p;
120
+ }
121
+ const dashed = Array.isArray(lineDash) && lineDash.length > 0 && lineDash[0] >= 0.5;
122
+ return {
123
+ type: c !== 0 ? 'quadratic' : 'line',
124
+ style: {
125
+ opacity: unit(alpha),
126
+ lineDash,
127
+ lineDashOffset,
128
+ lineCap: dashed ? 'butt' : 'round',
129
+ // Scene: control = midpoint + c·(−dy, dx). G6: midpoint + curveOffset·unit(dy, −dx).
130
+ curveOffset: c === 0 ? 0 : -c * len,
131
+ // The tip follows the drawn end, so a line growing from its source shows no arrow yet.
132
+ endArrow: arrow && !loop && (p >= 1 || link.fromTarget),
133
+ endArrowOffset: ARROW_LENGTH / 2 + ARROW_GAP + Math.max(0, link.clearance),
134
+ },
135
+ };
136
+ }
137
+ function edgeLabelKeys(l, ctx) {
138
+ return {
139
+ label: l.show,
140
+ labelText: l.text,
141
+ labelFill: l.fill,
142
+ labelFontSize: l.size,
143
+ labelFontWeight: l.weight,
144
+ labelOpacity: l.opacity,
145
+ labelOffsetY: l.offset,
146
+ labelTextDecorationLine: l.strike ? 'line-through' : 'none',
147
+ labelTextDecorationColor: l.fill,
148
+ labelStroke: ctx.bg,
149
+ labelStrokeOpacity: TEXT_HALO_ALPHA * l.opacity,
150
+ };
151
+ }
152
+ /** The present node among the candidates nearest to (x, y), or -1. Ties keep `a`. */
153
+ function endpoint(ctx, x, y, a, b) {
154
+ const nodes = ctx.frame.nodes;
155
+ const ok = (i) => i >= 0 && i < nodes.length && ctx.present[i] === 1;
156
+ if (a === b || !ok(b))
157
+ return ok(a) ? a : -1;
158
+ if (!ok(a))
159
+ return b;
160
+ const na = nodes[a];
161
+ const nb = nodes[b];
162
+ const da = Math.hypot(na.x - x, na.y - y);
163
+ const db = Math.hypot(nb.x - x, nb.y - y);
164
+ return db < da ? b : a;
165
+ }
166
+ function nodeEnd(ctx, i) {
167
+ const v = ctx.frame.nodes[i];
168
+ return {
169
+ id: ctx.nodeIds[i],
170
+ key: ctx.scene.nodes[i].id,
171
+ index: i,
172
+ x: v.x,
173
+ y: v.y,
174
+ r: Math.max(0, finite(v.r, 0)),
175
+ };
176
+ }
177
+ export function mapEdge(se, ev, ctx) {
178
+ const drawn = ev.visible && ev.progress > 0;
179
+ if (!drawn && !ctx.keepHidden)
180
+ return null;
181
+ // Retargeted / carried edges are drawn at their before or after endpoints depending on the
182
+ // layer: attach to whichever candidate node the visual's endpoint sits on.
183
+ const source = endpoint(ctx, ev.x1, ev.y1, se.s, se.sb);
184
+ const target = endpoint(ctx, ev.x2, ev.y2, se.t, se.tb);
185
+ if (source < 0 || target < 0)
186
+ return null;
187
+ if (ev.arrow)
188
+ noteLod(ctx, ev.arrowMinZoom);
189
+ const { type, style: link } = linkStyle({
190
+ a: nodeEnd(ctx, source),
191
+ b: nodeEnd(ctx, target),
192
+ curvature: ev.curvature,
193
+ progress: ev.progress,
194
+ fromTarget: ev.fromTarget,
195
+ dash: ev.dash,
196
+ alpha: ev.alpha,
197
+ clearance: 0,
198
+ }, ev.arrow && shown(ev.arrowMinZoom, ctx.zoom));
199
+ const label = text(ev.label, unit(ev.alpha), ctx, 10.5, ctx.theme.neutral.label);
200
+ const style = {
201
+ ...edgeBase(ctx),
202
+ ...link,
203
+ ...edgeLabelKeys(label, ctx),
204
+ zIndex: band(Z.edge, ev.z, Z.span),
205
+ visibility: drawn ? 'visible' : 'hidden',
206
+ stroke: ev.color,
207
+ lineWidth: Math.max(0, finite(ev.width, 1)),
208
+ lineDashOffset: link.lineDashOffset + finite(ev.dashOffset, 0),
209
+ };
210
+ const data = {
211
+ kgdiff: 'edge',
212
+ index: se.index,
213
+ hunk: se.hunk,
214
+ family: se.family,
215
+ changed: se.family !== 'neutral',
216
+ label: label.text.length > 0 ? label.text : se.label,
217
+ glyph: '',
218
+ };
219
+ return {
220
+ id: claim(ctx, ctx.prefix + se.id),
221
+ source: ctx.nodeIds[source],
222
+ target: ctx.nodeIds[target],
223
+ type,
224
+ style,
225
+ data,
226
+ };
227
+ }
228
+ // ─── Glyphs ─────────────────────────────────────────────────────────────────
229
+ function locator(ctx) {
230
+ if (ctx.locator === null) {
231
+ const nodes = ctx.frame.nodes;
232
+ ctx.locator = new NodeLocator(nodes, (i) => ctx.present[i] === 1 && nodes[i].visible);
233
+ }
234
+ return ctx.locator;
235
+ }
236
+ /** Every scene node, drawn or not: names the anchor of a glyph end that has no drawn node. */
237
+ function anyLocator(ctx) {
238
+ if (ctx.anyLocator === null)
239
+ ctx.anyLocator = new NodeLocator(ctx.frame.nodes, () => true);
240
+ return ctx.anyLocator;
241
+ }
242
+ /**
243
+ * The end of a glyph line at (x, y): the drawn node whose disc holds it, else an anchor — an
244
+ * invisible, non-interactive point node — so arcs towards nodes that are not drawn yet (a split
245
+ * target before it emerges) are kept. Anchors are shared within a frame and named after the
246
+ * scene node at that point when there is one, so their ids are stable across frames.
247
+ */
248
+ function glyphEnd(ctx, x, y, nodes) {
249
+ if (!Number.isFinite(x) || !Number.isFinite(y))
250
+ return null;
251
+ const at = locator(ctx).nearest(x, y, 0.5);
252
+ if (at >= 0)
253
+ return nodeEnd(ctx, at);
254
+ const owner = anyLocator(ctx).nearest(x, y, 0.5);
255
+ const key = owner >= 0 ? ctx.scene.nodes[owner].id : `@${Math.round(x)},${Math.round(y)}`;
256
+ let id = ctx.anchors.get(key);
257
+ if (id === undefined) {
258
+ id = claim(ctx, `${ctx.prefix}${ANCHOR_ID_PREFIX}${JSON.stringify(key)}`);
259
+ ctx.anchors.set(key, id);
260
+ const style = {
261
+ ...nodeBase(ctx),
262
+ x,
263
+ y,
264
+ // Not 0: G measures an empty circle as an empty box, and edges need a real point.
265
+ size: 0.01,
266
+ zIndex: Z.pivot,
267
+ cursor: 'default',
268
+ pointerEvents: 'none',
269
+ fill: 'transparent',
270
+ stroke: 'transparent',
271
+ lineWidth: 0,
272
+ };
273
+ const data = {
274
+ kgdiff: 'anchor',
275
+ index: owner,
276
+ hunk: owner >= 0 ? ctx.scene.nodes[owner].hunk : -1,
277
+ family: 'neutral',
278
+ changed: false,
279
+ label: '',
280
+ glyph: '',
281
+ };
282
+ nodes.push({ id, style, data });
283
+ }
284
+ return { id, key, index: owner, x, y, r: 0 };
285
+ }
286
+ function glyphHunk(ctx, a, b) {
287
+ const ha = a.index >= 0 ? ctx.scene.nodes[a.index].hunk : -1;
288
+ return ha >= 0 || b.index < 0 ? ha : ctx.scene.nodes[b.index].hunk;
289
+ }
290
+ function glyphId(ctx, kind, a, b) {
291
+ // JSON keeps ids containing separators unambiguous.
292
+ return claim(ctx, `${ctx.prefix}${GLYPH_ID_PREFIX}${kind}:${JSON.stringify([a.key, b.key])}`);
293
+ }
294
+ function glyphData(ctx, g, i, a, b) {
295
+ const hunk = glyphHunk(ctx, a, b);
296
+ return {
297
+ kgdiff: 'glyph',
298
+ index: i,
299
+ hunk,
300
+ family: hunk >= 0 ? (ctx.scene.hunks[hunk]?.family ?? 'neutral') : 'neutral',
301
+ changed: hunk >= 0,
302
+ label: g.label?.text ?? '',
303
+ glyph: g.kind,
304
+ };
305
+ }
306
+ /** A pivot: a dot of diameter `width` with a background outline, as a non-interactive node. */
307
+ function mapPivot(g, i, ctx) {
308
+ const w = Math.max(3, finite(g.width, 5));
309
+ // The dot sits on its node's outline: attach its identity to that node.
310
+ const at = locator(ctx).nearest(g.x1, g.y1, w);
311
+ if (at < 0)
312
+ return null;
313
+ const end = nodeEnd(ctx, at);
314
+ const style = {
315
+ ...nodeBase(ctx),
316
+ x: g.x1,
317
+ y: g.y1,
318
+ size: w + PIVOT_OUTLINE,
319
+ zIndex: Z.pivot,
320
+ cursor: 'default',
321
+ pointerEvents: 'none',
322
+ opacity: unit(g.alpha),
323
+ fill: g.color,
324
+ stroke: ctx.bg,
325
+ lineWidth: PIVOT_OUTLINE,
326
+ };
327
+ return {
328
+ node: { id: glyphId(ctx, g.kind, end, end), style, data: glyphData(ctx, g, i, end, end) },
329
+ };
330
+ }
331
+ /**
332
+ * A glyph as G6 data: pivots become nodes, everything else an edge between the ends' nodes or
333
+ * anchors (anchor nodes are pushed to `nodes`). Null when the glyph is invisible or degenerate.
334
+ */
335
+ export function mapGlyph(g, i, ctx, nodes) {
336
+ if (!(g.alpha > 0))
337
+ return null;
338
+ const kind = String(g.kind);
339
+ if (kind === 'pivot' || (g.x1 === g.x2 && g.y1 === g.y2))
340
+ return mapPivot(g, i, ctx);
341
+ const source = glyphEnd(ctx, g.x1, g.y1, nodes);
342
+ const target = glyphEnd(ctx, g.x2, g.y2, nodes);
343
+ if (source === null || target === null || source.id === target.id)
344
+ return null;
345
+ const spec = glyphStyle(kind);
346
+ // A newer scene may carry its own arrow flag (the native renderer honours it too).
347
+ const own = g.arrow;
348
+ const arrow = typeof own === 'boolean' ? own : spec.arrow;
349
+ const { type, style: link } = linkStyle({
350
+ a: source,
351
+ b: target,
352
+ curvature: g.curvature,
353
+ progress: g.progress,
354
+ fromTarget: false,
355
+ dash: g.dash !== null && g.dash.length > 0 ? g.dash : spec.dash,
356
+ alpha: g.alpha,
357
+ clearance: finite(g.r2, 0) - target.r,
358
+ }, arrow);
359
+ const label = text(g.label, unit(g.alpha), ctx, ctx.theme.font.size, g.color);
360
+ const chord = Math.hypot(target.x - source.x, target.y - source.y);
361
+ // Suggestions: the `?` sits in a small disc at the midpoint once the line is complete.
362
+ const mark = spec.mark && unit(g.progress) >= 1 && chord > 6 * MARK_RADIUS;
363
+ const style = {
364
+ ...edgeBase(ctx),
365
+ ...link,
366
+ ...edgeLabelKeys(label, ctx),
367
+ zIndex: Z.glyph,
368
+ stroke: g.color,
369
+ lineWidth: Math.max(0, finite(g.width, 1.5)),
370
+ ...(spec.mark
371
+ ? {
372
+ label: mark && label.show,
373
+ labelFill: g.color,
374
+ labelFontSize: 10,
375
+ labelFontWeight: 700,
376
+ labelStrokeOpacity: 0,
377
+ labelOffsetY: 0,
378
+ labelBackground: mark && label.show,
379
+ labelBackgroundFill: ctx.bg,
380
+ labelBackgroundStroke: g.color,
381
+ labelBackgroundLineWidth: 1.25,
382
+ labelBackgroundRadius: MARK_RADIUS,
383
+ labelBackgroundWidth: 2 * MARK_RADIUS,
384
+ labelBackgroundHeight: 2 * MARK_RADIUS,
385
+ }
386
+ : {}),
387
+ };
388
+ return {
389
+ edge: {
390
+ id: glyphId(ctx, kind, source, target),
391
+ source: source.id,
392
+ target: target.id,
393
+ type,
394
+ style,
395
+ data: glyphData(ctx, g, i, source, target),
396
+ },
397
+ };
398
+ }
399
+ //# sourceMappingURL=map-edge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-edge.js","sourceRoot":"","sources":["../src/map-edge.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,EACb,eAAe,EACf,eAAe,EACf,CAAC,GACF,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAEL,KAAK,EAIL,OAAO,EACP,KAAK,EAEL,IAAI,GACL,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAWzC,MAAM,GAAG,GAAe,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACjE,MAAM,KAAK,GAAe,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACrE,MAAM,UAAU,GAAe,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC1E,MAAM,KAAK,GAAe,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAEpE,SAAS,UAAU,CAAC,IAAY;IAC9B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,aAAa,CAAC;QACnB,KAAK,aAAa,CAAC;QACnB,KAAK,mBAAmB,CAAC;QAC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AE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC;SAC3C;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** Scene nodes and collapsed-group pills → G6 node data (see map.ts for the conventions). */
2
+ import type { NodeData } from '@antv/g6';
3
+ import type { CollapsedGroup, NodeVisual, SceneNode } from '@kgdiff/scene';
4
+ import { type Ctx, type NodeStyle } from './map-context.js';
5
+ /** Style keys shared by every node so updates never inherit stale values (see file comment). */
6
+ export declare function nodeBase(ctx: Ctx): Readonly<NodeStyle>;
7
+ export declare function mapNode(sn: SceneNode, v: NodeVisual, ctx: Ctx): NodeData | null;
8
+ /** “+38 unchanged” pill: an invisible point node whose centred label has a pill background. */
9
+ export declare function mapCollapsed(g: CollapsedGroup, i: number, ctx: Ctx): NodeData | null;
10
+ //# sourceMappingURL=map-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-node.d.ts","sourceRoot":"","sources":["../src/map-node.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,KAAK,EAAuB,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAmB3E,OAAO,EACL,KAAK,GAAG,EAGR,KAAK,SAAS,EAIf,MAAM,kBAAkB,CAAC;AAI1B,gGAAgG;AAChG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,CAGtD;AAwGD,wBAAgB,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,QAAQ,GAAG,IAAI,CA8E/E;AAUD,+FAA+F;AAC/F,wBAAgB,YAAY,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,QAAQ,GAAG,IAAI,CAyCpF"}
@@ -0,0 +1,243 @@
1
+ import { composite } from './color.js';
2
+ import { BADGE_FONT_SIZE, BADGE_HEIGHT, BADGE_PAD_X, COLLAPSED_ID_PREFIX, GLOW_MIN_SCALE, HALO_RING_OFFSET, HALO_RING_WIDTH, LABEL_MAX_WIDTH, PILL_FONT_SIZE, PILL_HEIGHT, PILL_PAD_X, TEXT_HALO_ALPHA, TEXT_HALO_WIDTH, Z, } from './constants.js';
3
+ import { band, evenCircleDash, finite, unit } from './geometry.js';
4
+ import { claim, noteLod, shown, text, } from './map-context.js';
5
+ const NO_BADGES = Object.freeze([]);
6
+ /** Style keys shared by every node so updates never inherit stale values (see file comment). */
7
+ export function nodeBase(ctx) {
8
+ if (ctx.nodeBase === null)
9
+ ctx.nodeBase = Object.freeze(buildNodeBase(ctx));
10
+ return ctx.nodeBase;
11
+ }
12
+ function buildNodeBase(ctx) {
13
+ const t = ctx.theme;
14
+ return {
15
+ x: 0,
16
+ y: 0,
17
+ size: 0,
18
+ zIndex: Z.node,
19
+ visibility: 'visible',
20
+ cursor: 'pointer',
21
+ pointerEvents: 'auto',
22
+ opacity: 1,
23
+ fill: ctx.bg,
24
+ fillOpacity: 1,
25
+ stroke: ctx.bg,
26
+ strokeOpacity: 1,
27
+ lineWidth: 0,
28
+ lineDash: 0,
29
+ halo: false,
30
+ haloStroke: ctx.bg,
31
+ haloStrokeOpacity: 0,
32
+ haloLineWidth: 0,
33
+ haloLineDash: 0,
34
+ haloGlow: t.glow,
35
+ haloRadius: 0,
36
+ ring: false,
37
+ ringStroke: ctx.bg,
38
+ ringLineWidth: 0,
39
+ ringGap: 0,
40
+ ringOpacity: 0,
41
+ pulse: 0,
42
+ pulseStroke: t.accent.base,
43
+ label: false,
44
+ labelText: '',
45
+ labelFill: t.neutral.label,
46
+ labelFontSize: t.font.size,
47
+ labelFontWeight: t.font.weightRegular,
48
+ labelFontFamily: t.font.family,
49
+ labelOpacity: 0,
50
+ labelPlacement: 'bottom',
51
+ labelOffsetX: 0,
52
+ labelOffsetY: 0,
53
+ labelTextDecorationLine: 'none',
54
+ labelTextDecorationColor: t.neutral.label,
55
+ labelStroke: ctx.bg,
56
+ labelLineWidth: TEXT_HALO_WIDTH,
57
+ labelStrokeOpacity: 0,
58
+ labelLineJoin: 'round',
59
+ labelMaxWidth: LABEL_MAX_WIDTH,
60
+ labelWordWrap: true,
61
+ labelMaxLines: 1,
62
+ labelTextOverflow: '…',
63
+ labelBackground: false,
64
+ labelBackgroundFill: ctx.bg,
65
+ labelBackgroundStroke: ctx.bg,
66
+ labelBackgroundLineWidth: 0,
67
+ labelBackgroundRadius: 0,
68
+ labelBackgroundOpacity: 1,
69
+ labelPadding: 0,
70
+ sublabel: false,
71
+ sublabelText: '',
72
+ sublabelFill: t.text.muted,
73
+ sublabelFontSize: t.font.size,
74
+ sublabelFontWeight: t.font.weightRegular,
75
+ sublabelFontFamily: t.font.family,
76
+ sublabelOpacity: 0,
77
+ sublabelOffsetY: 0,
78
+ sublabelTextDecorationLine: 'none',
79
+ sublabelStroke: ctx.bg,
80
+ sublabelStrokeOpacity: 0,
81
+ badge: false,
82
+ badges: NO_BADGES,
83
+ };
84
+ }
85
+ function badgeOf(v, r, ctx) {
86
+ const b = v.badge;
87
+ if (b === null)
88
+ return NO_BADGES;
89
+ noteLod(ctx, b.minZoom);
90
+ if (b.text.length === 0 || !shown(b.minZoom, ctx.zoom))
91
+ return NO_BADGES;
92
+ // The native pill sits at (x + 0.7·R − 2, y − 0.7·R − 15 + 2), R = outermost outline (ring
93
+ // included). G6 anchors 'right-top' badges with their text's top-left at the key's corner.
94
+ const ring = v.ring;
95
+ const outer = r + (ring !== null ? ring.gap + ring.width / 2 : 0);
96
+ const padY = (BADGE_HEIGHT - BADGE_FONT_SIZE * 1.2) / 2;
97
+ return [
98
+ {
99
+ text: b.text,
100
+ placement: 'right-top',
101
+ offsetX: 0.7 * outer - 2 + BADGE_PAD_X - r,
102
+ offsetY: r - 0.7 * outer - BADGE_HEIGHT + 2 + padY,
103
+ fill: b.color,
104
+ fontSize: BADGE_FONT_SIZE,
105
+ fontWeight: 600,
106
+ fontFamily: ctx.theme.font.mono,
107
+ // Translucent tints are composited over the canvas, like the native opaque underlay.
108
+ backgroundFill: composite(b.background, ctx.bg),
109
+ backgroundOpacity: 1,
110
+ padding: [padY, BADGE_PAD_X, padY, BADGE_PAD_X],
111
+ },
112
+ ];
113
+ }
114
+ export function mapNode(sn, v, ctx) {
115
+ if (!v.visible && !ctx.keepHidden)
116
+ return null;
117
+ const t = ctx.theme;
118
+ const alpha = unit(v.alpha);
119
+ const r = Math.max(0, finite(v.r, 0));
120
+ const hasStroke = v.stroke !== null && v.strokeWidth > 0;
121
+ const ring = v.ring !== null && v.ring.width > 0 ? v.ring : null;
122
+ const halo = v.halo;
123
+ const label = text(v.label, alpha, ctx, t.font.size, t.neutral.label);
124
+ const sub = text(v.secondaryLabel, alpha, ctx, t.font.size, t.text.muted);
125
+ const badges = badgeOf(v, r, ctx);
126
+ const changed = v.family !== 'neutral';
127
+ const pulse = v.pulse > 0 && v.pulse < 1 ? v.pulse : 0;
128
+ const style = {
129
+ ...nodeBase(ctx),
130
+ x: finite(v.x, 0),
131
+ y: finite(v.y, 0),
132
+ size: 2 * r,
133
+ zIndex: band(Z.node, v.z, Z.span),
134
+ visibility: v.visible ? 'visible' : 'hidden',
135
+ opacity: alpha,
136
+ // Ghosts (fill null) are filled with the canvas so edges do not show through.
137
+ fill: v.fill ?? ctx.bg,
138
+ stroke: v.stroke ?? v.fill ?? ctx.bg,
139
+ lineWidth: hasStroke ? v.strokeWidth : 0,
140
+ lineDash: hasStroke && v.dash !== null && v.dash.length > 0 ? evenCircleDash(v.dash, r) : 0,
141
+ halo: halo !== null,
142
+ haloStroke: halo?.color ?? ctx.bg,
143
+ haloStrokeOpacity: halo !== null ? unit(halo.alpha) : 0,
144
+ // Plain G6 circles draw the halo as a band centred on the outline: cover r → glow radius
145
+ // (dark) or the offset ring (light). kgdiff-node replaces it with the real glow / ring.
146
+ haloLineWidth: halo === null
147
+ ? 0
148
+ : t.glow
149
+ ? 2 * Math.max(0, Math.max(halo.radius, GLOW_MIN_SCALE * r) - r)
150
+ : 2 * (HALO_RING_OFFSET + HALO_RING_WIDTH),
151
+ haloRadius: halo !== null ? Math.max(0, finite(halo.radius, r)) : 0,
152
+ ring: ring !== null,
153
+ ringStroke: ring?.color ?? ctx.bg,
154
+ ringLineWidth: ring?.width ?? 0,
155
+ ringGap: ring?.gap ?? 0,
156
+ ringOpacity: ring !== null ? unit(ring.alpha) : 0,
157
+ pulse,
158
+ pulseStroke: ring?.color ?? v.stroke ?? v.fill ?? t.accent.base,
159
+ label: label.show,
160
+ labelText: label.text,
161
+ labelFill: label.fill,
162
+ labelFontSize: label.size,
163
+ labelFontWeight: label.weight,
164
+ labelOpacity: label.opacity,
165
+ labelOffsetY: label.offset,
166
+ labelTextDecorationLine: label.strike ? 'line-through' : 'none',
167
+ // G strikes with the current stroke style unless told otherwise — the background halo.
168
+ labelTextDecorationColor: label.fill,
169
+ labelStrokeOpacity: TEXT_HALO_ALPHA * label.opacity,
170
+ sublabel: sub.show,
171
+ sublabelText: sub.text,
172
+ sublabelFill: sub.fill,
173
+ sublabelFontSize: sub.size,
174
+ sublabelFontWeight: sub.weight,
175
+ sublabelOpacity: sub.opacity,
176
+ sublabelOffsetY: sub.offset,
177
+ sublabelTextDecorationLine: sub.strike ? 'line-through' : 'none',
178
+ sublabelStrokeOpacity: TEXT_HALO_ALPHA * sub.opacity,
179
+ badge: badges.length > 0,
180
+ badges,
181
+ };
182
+ const data = {
183
+ kgdiff: 'node',
184
+ index: sn.index,
185
+ hunk: sn.hunk,
186
+ family: v.family,
187
+ changed,
188
+ label: label.text.length > 0 ? label.text : sn.label,
189
+ glyph: '',
190
+ };
191
+ return { id: ctx.nodeIds[sn.index], style, data };
192
+ }
193
+ // ─── Collapsed groups ───────────────────────────────────────────────────────
194
+ function pillText(g) {
195
+ return typeof g.label === 'string' && g.label.length > 0
196
+ ? g.label
197
+ : `+${g.count.toLocaleString('en-US')}`;
198
+ }
199
+ /** “+38 unchanged” pill: an invisible point node whose centred label has a pill background. */
200
+ export function mapCollapsed(g, i, ctx) {
201
+ if (!(g.count > 0) || !Number.isFinite(g.x) || !Number.isFinite(g.y))
202
+ return null;
203
+ const t = ctx.theme;
204
+ const padY = (PILL_HEIGHT - PILL_FONT_SIZE * 1.2) / 2;
205
+ const label = pillText(g);
206
+ const style = {
207
+ ...nodeBase(ctx),
208
+ x: g.x,
209
+ y: g.y,
210
+ size: 1,
211
+ zIndex: Z.collapsed,
212
+ cursor: 'default',
213
+ fill: 'transparent',
214
+ stroke: 'transparent',
215
+ label: true,
216
+ labelText: label,
217
+ labelFill: t.text.secondary,
218
+ labelFontSize: PILL_FONT_SIZE,
219
+ labelFontWeight: 500,
220
+ labelOpacity: 1,
221
+ labelPlacement: 'center',
222
+ labelLineWidth: 0,
223
+ labelWordWrap: false,
224
+ labelBackground: true,
225
+ labelBackgroundFill: t.surface.raised,
226
+ labelBackgroundStroke: t.surface.borderStrong,
227
+ labelBackgroundLineWidth: 1,
228
+ labelBackgroundRadius: PILL_HEIGHT / 2,
229
+ labelBackgroundOpacity: 1,
230
+ labelPadding: [padY, PILL_PAD_X, padY, PILL_PAD_X],
231
+ };
232
+ const data = {
233
+ kgdiff: 'collapsed',
234
+ index: i,
235
+ hunk: -1,
236
+ family: 'neutral',
237
+ changed: false,
238
+ label,
239
+ glyph: '',
240
+ };
241
+ return { id: claim(ctx, `${ctx.prefix}${COLLAPSED_ID_PREFIX}${g.id}`), style, data };
242
+ }
243
+ //# sourceMappingURL=map-node.js.map