@holistics/anfra-sdk 0.13.5 → 0.14.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 (40) hide show
  1. package/README.md +1 -1
  2. package/dist/app.d.ts +4 -3
  3. package/dist/app.js +17 -7
  4. package/dist/{bootstrap-BbsNvZ8s.d.ts → bootstrap-MhTSkiA1.d.ts} +96 -3
  5. package/dist/build.d.ts +2 -0
  6. package/dist/chunk-7IHICYVH.js +10 -0
  7. package/dist/chunk-CYZQ7ZTJ.js +237 -0
  8. package/dist/chunk-DITKCHFQ.js +166 -0
  9. package/dist/chunk-F6MRA7J4.js +65 -0
  10. package/dist/chunk-GBXK7F2V.js +431 -0
  11. package/dist/chunk-GOUDXWG4.js +750 -0
  12. package/dist/chunk-GV7SVWEK.js +84 -0
  13. package/dist/chunk-H52PO7MP.js +105 -0
  14. package/dist/chunk-HI3ZAXJK.js +8 -0
  15. package/dist/{chunk-KI5CAVAR.js → chunk-HZEECB6R.js} +477 -25
  16. package/dist/chunk-K633QHGO.js +51 -0
  17. package/dist/chunk-KFD6CHLI.js +38 -0
  18. package/dist/{chunk-OJ5WIKWE.js → chunk-NOFPRSSI.js} +1 -1
  19. package/dist/{chunk-ADWBOQW2.js → chunk-S6XLP6U4.js} +31 -1
  20. package/dist/{chunk-TQ7S5DRE.js → chunk-WI5VJ2Z6.js} +1 -1
  21. package/dist/common.d.ts +1 -1
  22. package/dist/common.js +14 -4
  23. package/dist/data-UCCW2VWH.js +233 -0
  24. package/dist/declaration-GVDOGQY6.js +218 -0
  25. package/dist/host.d.ts +42 -4
  26. package/dist/host.js +412 -9
  27. package/dist/menu-CdGVKc4_.d.ts +151 -0
  28. package/dist/overview-3DNXEQNY.js +358 -0
  29. package/dist/plugin-BmIDirTx.d.ts +303 -0
  30. package/dist/plugins.d.ts +6 -8
  31. package/dist/plugins.js +98 -69
  32. package/dist/queries-2OHKMTPC.js +661 -0
  33. package/dist/structure-WRDUXHD4.js +256 -0
  34. package/dist/tab-HMQOITVM.js +932 -0
  35. package/dist/testing.js +4 -4
  36. package/package.json +1 -1
  37. package/dist/bridge-WC7GliCH.d.ts +0 -73
  38. package/dist/chunk-33B2D4U5.js +0 -6
  39. package/dist/plugin-056-SKwd.d.ts +0 -132
  40. /package/dist/{chunk-52LXBYQM.js → chunk-UUKXJSE4.js} +0 -0
@@ -0,0 +1,932 @@
1
+ import {
2
+ STYLES,
3
+ h,
4
+ icon,
5
+ popover,
6
+ replace,
7
+ tooltips
8
+ } from "./chunk-GOUDXWG4.js";
9
+ import {
10
+ LINEAGE_KINDS,
11
+ LINEAGE_PRESETS,
12
+ buildLineageGraph,
13
+ filterGraph,
14
+ focusGraph,
15
+ hiddenCount,
16
+ lineageTargets,
17
+ matchPreset,
18
+ orderForLayout,
19
+ pathOf,
20
+ showsCrossFilters,
21
+ stateOf,
22
+ traceKey
23
+ } from "./chunk-GBXK7F2V.js";
24
+ import "./chunk-K633QHGO.js";
25
+ import {
26
+ findNode
27
+ } from "./chunk-H52PO7MP.js";
28
+ import "./chunk-PKBMQBKP.js";
29
+
30
+ // src/plugins/lineage/layout.ts
31
+ var CARD_SIZE = { width: 240, height: 80 };
32
+ var COLUMN_GAP = 80;
33
+ var CARD_GAP = 28;
34
+ var SWEEPS = 8;
35
+ function shapeOf(graph) {
36
+ return `${graph.nodes.map((n) => n.id).join()}|${graph.edges.map((e) => e.id).join()}`;
37
+ }
38
+ function layoutKey(graph, sizeOf) {
39
+ const sizes = graph.nodes.map((n) => {
40
+ const size = sizeOf(n.id);
41
+ return size ? `${Math.round(size.width)}x${Math.round(size.height)}` : "?";
42
+ });
43
+ return `${shapeOf(graph)}|${sizes.join()}`;
44
+ }
45
+ function layout(graph, sizeOf) {
46
+ const size = (id) => {
47
+ const measured = sizeOf(id);
48
+ return measured && measured.width > 0 && measured.height > 0 ? measured : CARD_SIZE;
49
+ };
50
+ const columns = LINEAGE_KINDS.map((kind) => orderForLayout(graph).filter((n) => n.kind === kind).map((n) => n.id)).filter((column) => column.length > 0);
51
+ const columnOf = new Map(columns.flatMap((column, index) => column.map((id) => [id, index])));
52
+ const left = /* @__PURE__ */ new Map();
53
+ const right = /* @__PURE__ */ new Map();
54
+ for (const e of graph.edges) {
55
+ if (e.kind === "crossFilter") continue;
56
+ const [a, b] = [columnOf.get(e.source), columnOf.get(e.target)];
57
+ if (a === void 0 || b === void 0 || a === b) continue;
58
+ const [from, to] = a < b ? [e.source, e.target] : [e.target, e.source];
59
+ right.set(from, [...right.get(from) ?? [], to]);
60
+ left.set(to, [...left.get(to) ?? [], from]);
61
+ }
62
+ const y = /* @__PURE__ */ new Map();
63
+ const center = (id) => y.get(id) + size(id).height / 2;
64
+ const stack = (column) => {
65
+ let at = 0;
66
+ for (const id of column) {
67
+ y.set(id, at);
68
+ at += size(id).height + CARD_GAP;
69
+ }
70
+ };
71
+ columns.forEach(stack);
72
+ const barycenter = (id, by) => {
73
+ const linked2 = by.get(id) ?? [];
74
+ return linked2.length ? linked2.reduce((sum, other) => sum + center(other), 0) / linked2.length : center(id);
75
+ };
76
+ let best = columns.map((column) => [...column]);
77
+ let fewest = crossings(columns, right);
78
+ for (let sweep = 0; sweep < SWEEPS; sweep++) {
79
+ const toRight = sweep % 2 === 0;
80
+ const order = toRight ? columns.keys() : [...columns.keys()].reverse();
81
+ for (const index of order) {
82
+ const by = toRight ? left : right;
83
+ const keyed = columns[index].map((id, at) => ({ id, at, key: barycenter(id, by) }));
84
+ keyed.sort((a, b) => a.key - b.key || a.at - b.at);
85
+ columns[index] = keyed.map((k) => k.id);
86
+ stack(columns[index]);
87
+ }
88
+ const count = crossings(columns, right);
89
+ if (count < fewest) {
90
+ fewest = count;
91
+ best = columns.map((column) => [...column]);
92
+ }
93
+ }
94
+ best.forEach(stack);
95
+ const linked = new Map([...columnOf.keys()].map((id) => [id, [...left.get(id) ?? [], ...right.get(id) ?? []]]));
96
+ for (let sweep = 0; sweep < SWEEPS; sweep++) {
97
+ const toRight = sweep % 2 === 0;
98
+ const order = toRight ? best.keys() : [...best.keys()].reverse();
99
+ for (const index of order) {
100
+ const column = best[index];
101
+ const wanted = column.map((id) => barycenter(id, linked) - size(id).height / 2);
102
+ settle(column.map((id) => size(id).height), wanted).forEach((top2, at) => y.set(column[at], top2));
103
+ }
104
+ }
105
+ const boxes = /* @__PURE__ */ new Map();
106
+ const top = Math.min(...[...y.values()]);
107
+ let x = 0;
108
+ for (const column of best) {
109
+ const width = Math.max(...column.map((id) => size(id).width));
110
+ for (const id of column) boxes.set(id, { x, y: y.get(id) - top, ...size(id) });
111
+ x += width + COLUMN_GAP;
112
+ }
113
+ return boxes;
114
+ }
115
+ function crossings(columns, right) {
116
+ const position = new Map(columns.flatMap((column) => column.map((id, at) => [id, at])));
117
+ const columnOf = new Map(columns.flatMap((column, index) => column.map((id) => [id, index])));
118
+ const links = columns.flatMap((column) => column.flatMap((id) => (right.get(id) ?? []).map((to) => ({
119
+ from: columnOf.get(id),
120
+ to: columnOf.get(to),
121
+ a: position.get(id),
122
+ b: position.get(to)
123
+ }))));
124
+ let count = 0;
125
+ for (let i = 0; i < links.length; i++) {
126
+ for (let j = i + 1; j < links.length; j++) {
127
+ const [p, q] = [links[i], links[j]];
128
+ if (p.from !== q.from || p.to !== q.to) continue;
129
+ if ((p.a - q.a) * (p.b - q.b) < 0) count++;
130
+ }
131
+ }
132
+ return count;
133
+ }
134
+ function settle(heights, wanted) {
135
+ const offsets = [];
136
+ let at = 0;
137
+ for (const height of heights) {
138
+ offsets.push(at);
139
+ at += height + CARD_GAP;
140
+ }
141
+ const blocks = [];
142
+ wanted.forEach((top, index) => {
143
+ blocks.push({ sum: top - offsets[index], count: 1 });
144
+ while (blocks.length > 1) {
145
+ const [a, b] = blocks.slice(-2);
146
+ if (a.sum / a.count <= b.sum / b.count) break;
147
+ blocks.splice(-2, 2, { sum: a.sum + b.sum, count: a.count + b.count });
148
+ }
149
+ });
150
+ return blocks.flatMap((block) => Array(block.count).fill(block.sum / block.count)).map((base, index) => base + offsets[index]);
151
+ }
152
+ function curve(from, to) {
153
+ const [sx, sy] = [from.x + from.width, from.y + from.height / 2];
154
+ const [tx, ty] = [to.x, to.y + to.height / 2];
155
+ const bend = Math.max(40, Math.abs(tx - sx) / 2);
156
+ return { path: `M${sx},${sy} C${sx + bend},${sy} ${tx - bend},${ty} ${tx},${ty}`, end: { x: tx, y: ty } };
157
+ }
158
+ var RADIUS = 8;
159
+ function crossFilterLoops(graph, boxes) {
160
+ const edges = graph.edges.filter((e) => e.kind === "crossFilter" && boxes.has(e.source) && boxes.has(e.target));
161
+ const slots = /* @__PURE__ */ new Map();
162
+ for (const e of edges) {
163
+ slots.set(e.source, [...slots.get(e.source) ?? [], `out:${e.id}`]);
164
+ slots.set(e.target, [...slots.get(e.target) ?? [], `in:${e.id}`]);
165
+ }
166
+ const point = (id, slot) => {
167
+ const box = boxes.get(id);
168
+ const all = slots.get(id);
169
+ return { x: box.x + box.width, y: box.y + (all.indexOf(slot) + 1) / (all.length + 1) * box.height };
170
+ };
171
+ const span = (e) => Math.abs(boxes.get(e.source).y - boxes.get(e.target).y);
172
+ const ranked = [...edges].sort((a, b) => span(a) - span(b));
173
+ return new Map(ranked.map((e, rank) => {
174
+ const from = point(e.source, `out:${e.id}`);
175
+ const to = point(e.target, `in:${e.id}`);
176
+ const lane = Math.max(from.x, to.x) + 18 + 12 * rank;
177
+ const down = to.y >= from.y ? 1 : -1;
178
+ const r = Math.min(RADIUS, Math.abs(to.y - from.y) / 2);
179
+ const path = [
180
+ `M${from.x},${from.y}`,
181
+ `H${lane - r}`,
182
+ `Q${lane},${from.y} ${lane},${from.y + down * r}`,
183
+ `V${to.y - down * r}`,
184
+ `Q${lane},${to.y} ${lane - r},${to.y}`,
185
+ `H${to.x}`
186
+ ].join(" ");
187
+ return [e.id, path];
188
+ }));
189
+ }
190
+
191
+ // src/plugins/lineage/canvas.ts
192
+ var SVG = "http://www.w3.org/2000/svg";
193
+ var FIT_PADDING = 0.12;
194
+ var MAX_FIT_ZOOM = 1;
195
+ var MIN_ZOOM = 0.1;
196
+ var MAX_ZOOM = 2;
197
+ var CENTER_ZOOM = 0.8;
198
+ var canvases = 0;
199
+ function edgeClass(e) {
200
+ if (!e.kind) return "uses";
201
+ return e.active ? "filter-on" : "filter-off";
202
+ }
203
+ function createCanvas(doc, options) {
204
+ const prefix = `lineage-${++canvases}`;
205
+ const svg = doc.createElementNS(SVG, "svg");
206
+ svg.setAttribute("class", "edges");
207
+ svg.setAttribute("width", "1");
208
+ svg.setAttribute("height", "1");
209
+ svg.setAttribute("aria-hidden", "true");
210
+ const cardsLayer = h(doc, "div", { class: "cards" });
211
+ const world = h(doc, "div", { class: "world" });
212
+ world.append(svg, cardsLayer);
213
+ const view = { x: 0, y: 0, k: 1 };
214
+ const controls = h(
215
+ doc,
216
+ "div",
217
+ { class: "controls" },
218
+ h(doc, "button", { type: "button", class: "row-action", "data-tip": "Zoom in", "aria-label": "Zoom in", onclick: () => zoomBy(1.25) }, icon(doc, "plus")),
219
+ h(doc, "button", { type: "button", class: "row-action", "data-tip": "Zoom out", "aria-label": "Zoom out", onclick: () => zoomBy(0.8) }, icon(doc, "minus")),
220
+ h(doc, "button", { type: "button", class: "row-action", "data-tip": "Fit to view", "aria-label": "Fit to view", "data-testid": "lineage-fit", onclick: () => fit(true) }, icon(doc, "fit"))
221
+ );
222
+ const element = h(doc, "div", { class: "canvas", "data-testid": "lineage-canvas" }, world, controls);
223
+ const cards = /* @__PURE__ */ new Map();
224
+ let graph = { nodes: [], edges: [] };
225
+ let selected;
226
+ let boxes = /* @__PURE__ */ new Map();
227
+ let laidOutKey;
228
+ let fittedShape;
229
+ let owesFit = false;
230
+ let hasFitted = false;
231
+ let owesCenter;
232
+ const apply = (duration = 0) => {
233
+ world.style.transition = duration ? `transform ${duration}ms ease` : "";
234
+ world.style.transform = `translate(${view.x}px, ${view.y}px) scale(${view.k})`;
235
+ element.style.backgroundSize = `${18 * view.k}px ${18 * view.k}px`;
236
+ element.style.backgroundPosition = `${view.x}px ${view.y}px`;
237
+ };
238
+ const clamp = (k) => Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, k));
239
+ const size = () => ({ width: element.clientWidth, height: element.clientHeight });
240
+ const zoomAt = (px, py, k, duration = 0) => {
241
+ const next = clamp(k);
242
+ view.x = px - (px - view.x) / view.k * next;
243
+ view.y = py - (py - view.y) / view.k * next;
244
+ view.k = next;
245
+ apply(duration);
246
+ };
247
+ const zoomBy = (factor) => {
248
+ const { width, height } = size();
249
+ zoomAt(width / 2, height / 2, view.k * factor, 150);
250
+ };
251
+ function fit(animate) {
252
+ const { width, height } = size();
253
+ if (!width || !height || boxes.size === 0) {
254
+ owesFit = true;
255
+ return;
256
+ }
257
+ owesFit = false;
258
+ const all = [...boxes.values()];
259
+ const [minX, minY] = [Math.min(...all.map((b) => b.x)), Math.min(...all.map((b) => b.y))];
260
+ const [maxX, maxY] = [Math.max(...all.map((b) => b.x + b.width)), Math.max(...all.map((b) => b.y + b.height))];
261
+ const [w, hgt] = [maxX - minX, maxY - minY];
262
+ const k = Math.min(MAX_FIT_ZOOM, Math.max(options.minFitZoom, Math.min(width / (w * (1 + 2 * FIT_PADDING)), height / (hgt * (1 + 2 * FIT_PADDING)))));
263
+ view.k = clamp(k);
264
+ view.x = (width - w * view.k) / 2 - minX * view.k;
265
+ view.y = Math.max((height - hgt * view.k) / 2, height * FIT_PADDING / 2) - minY * view.k;
266
+ apply(animate ? 200 : 0);
267
+ hasFitted = true;
268
+ }
269
+ function center(id) {
270
+ const box = boxes.get(id);
271
+ const { width, height } = size();
272
+ if (!box || !width || !height) {
273
+ owesCenter = id;
274
+ return;
275
+ }
276
+ owesCenter = void 0;
277
+ const k = clamp(Math.max(view.k, CENTER_ZOOM));
278
+ view.k = k;
279
+ view.x = width / 2 - (box.x + box.width / 2) * k;
280
+ view.y = height / 2 - (box.y + box.height / 2) * k;
281
+ apply(250);
282
+ }
283
+ const measure = (id) => {
284
+ const card = cards.get(id);
285
+ return card ? { width: card.offsetWidth, height: card.offsetHeight } : void 0;
286
+ };
287
+ function drawEdges(path) {
288
+ const loops = crossFilterLoops(graph, boxes);
289
+ const defs = doc.createElementNS(SVG, "defs");
290
+ for (const name of ["uses", "filter-on", "filter-off"]) {
291
+ for (const on of [false, true]) {
292
+ const marker = doc.createElementNS(SVG, "marker");
293
+ const attributes = {
294
+ id: `${prefix}-${name}${on ? "-on" : ""}`,
295
+ class: `m ${name}${on ? " on" : ""}`,
296
+ viewBox: "0 0 10 10",
297
+ refX: "10",
298
+ refY: "5",
299
+ markerWidth: "14",
300
+ markerHeight: "14",
301
+ markerUnits: "userSpaceOnUse",
302
+ orient: "auto-start-reverse"
303
+ };
304
+ for (const [key, value] of Object.entries(attributes)) marker.setAttribute(key, value);
305
+ const arrow = doc.createElementNS(SVG, "path");
306
+ arrow.setAttribute("d", "M0,1 L10,5 L0,9 z");
307
+ marker.append(arrow);
308
+ defs.append(marker);
309
+ }
310
+ }
311
+ const lines = graph.edges.flatMap((e) => {
312
+ const [from, to] = [boxes.get(e.source), boxes.get(e.target)];
313
+ if (!from || !to) return [];
314
+ const d = e.kind === "crossFilter" ? loops.get(e.id) : curve(from, to).path;
315
+ if (!d) return [];
316
+ const on = path?.edges.has(e.id) ?? false;
317
+ const look = edgeClass(e);
318
+ const line = doc.createElementNS(SVG, "path");
319
+ line.setAttribute("d", d);
320
+ line.setAttribute("class", `edge ${look}${on ? " on" : path ? " dim" : ""}`);
321
+ line.setAttribute("marker-end", `url(#${prefix}-${look}${on ? "-on" : ""})`);
322
+ line.setAttribute("data-edge", e.id);
323
+ return [{ line, on }];
324
+ });
325
+ lines.sort((a, b) => Number(a.on) - Number(b.on));
326
+ svg.replaceChildren(defs, ...lines.map((l) => l.line));
327
+ }
328
+ function place() {
329
+ const key = layoutKey(graph, measure);
330
+ if (key !== laidOutKey) {
331
+ laidOutKey = key;
332
+ boxes = layout(graph, measure);
333
+ for (const [id, box] of boxes) {
334
+ const card = cards.get(id);
335
+ if (card) card.style.transform = `translate(${box.x}px, ${box.y}px)`;
336
+ }
337
+ }
338
+ const shape = shapeOf(graph);
339
+ if (shape !== fittedShape) {
340
+ fittedShape = shape;
341
+ fit(hasFitted);
342
+ }
343
+ }
344
+ function draw(next, pinned) {
345
+ graph = next;
346
+ selected = pinned && next.nodes.some((n) => n.id === pinned) ? pinned : void 0;
347
+ const path = selected ? pathOf(graph, selected) : void 0;
348
+ const seen = /* @__PURE__ */ new Set();
349
+ for (const node of graph.nodes) {
350
+ seen.add(node.id);
351
+ let card = cards.get(node.id);
352
+ if (!card) {
353
+ card = h(doc, "div", { class: "lcard", "data-id": node.id, "data-testid": `card-${node.id}` });
354
+ const id = node.id;
355
+ card.addEventListener("click", (event) => {
356
+ if (event.target.closest?.("button")) return;
357
+ options.onSelect(selected === id ? void 0 : id);
358
+ });
359
+ cards.set(node.id, card);
360
+ resizes?.observe(card);
361
+ }
362
+ const tone = !path ? "normal" : node.id === selected ? "selected" : path.nodes.has(node.id) ? "on-path" : "dim";
363
+ card.className = `lcard kind-${node.kind} ${tone}`;
364
+ replace(doc, card, options.card(node));
365
+ cardsLayer.append(card);
366
+ }
367
+ for (const [id, card] of cards) {
368
+ if (seen.has(id)) continue;
369
+ resizes?.unobserve(card);
370
+ card.remove();
371
+ cards.delete(id);
372
+ }
373
+ place();
374
+ drawEdges(path);
375
+ if (owesCenter) center(owesCenter);
376
+ }
377
+ const View = doc.defaultView;
378
+ let frame;
379
+ const later = () => {
380
+ if (frame !== void 0 || !View) return;
381
+ frame = View.requestAnimationFrame(() => {
382
+ frame = void 0;
383
+ const before = laidOutKey;
384
+ place();
385
+ if (laidOutKey !== before) drawEdges(selected ? pathOf(graph, selected) : void 0);
386
+ if (owesFit) fit(false);
387
+ if (owesCenter) center(owesCenter);
388
+ });
389
+ };
390
+ const resizes = View && "ResizeObserver" in View ? new View.ResizeObserver(later) : void 0;
391
+ resizes?.observe(element);
392
+ let drag;
393
+ element.addEventListener("pointerdown", (event) => {
394
+ if (event.button !== 0 || event.target.closest?.(".lcard, .controls")) return;
395
+ drag = { id: event.pointerId, x: event.clientX, y: event.clientY, vx: view.x, vy: view.y, moved: false };
396
+ element.setPointerCapture?.(event.pointerId);
397
+ });
398
+ element.addEventListener("pointermove", (event) => {
399
+ if (!drag || event.pointerId !== drag.id) return;
400
+ const [dx, dy] = [event.clientX - drag.x, event.clientY - drag.y];
401
+ if (!drag.moved && Math.hypot(dx, dy) < 3) return;
402
+ drag.moved = true;
403
+ element.classList.add("panning");
404
+ view.x = drag.vx + dx;
405
+ view.y = drag.vy + dy;
406
+ apply();
407
+ });
408
+ const release = (event) => {
409
+ if (!drag || event.pointerId !== drag.id) return;
410
+ const { moved } = drag;
411
+ drag = void 0;
412
+ element.classList.remove("panning");
413
+ if (!moved && event.type === "pointerup") options.onSelect(void 0);
414
+ };
415
+ element.addEventListener("pointerup", release);
416
+ element.addEventListener("pointercancel", release);
417
+ element.addEventListener("wheel", (event) => {
418
+ event.preventDefault();
419
+ const at = element.getBoundingClientRect();
420
+ const factor = Math.exp(-event.deltaY * (event.deltaMode ? 0.05 : 2e-3));
421
+ zoomAt(event.clientX - at.left, event.clientY - at.top, view.k * factor);
422
+ }, { passive: false });
423
+ apply();
424
+ return {
425
+ element,
426
+ draw,
427
+ center,
428
+ dispose: () => {
429
+ resizes?.disconnect();
430
+ if (frame !== void 0) View?.cancelAnimationFrame(frame);
431
+ }
432
+ };
433
+ }
434
+
435
+ // src/plugins/lineage/tab.ts
436
+ var STRUCTURE_TAB = "inspect.structure";
437
+ var MENU_GAP = 4;
438
+ var MENU_MARGIN = 8;
439
+ var KIND_LABELS = {
440
+ control: "Control",
441
+ block: "Block",
442
+ query: "Query",
443
+ metric: "Metric",
444
+ dimension: "Dimension",
445
+ dataset: "Dataset",
446
+ model: "Model",
447
+ table: "Database table"
448
+ };
449
+ var KIND_ICONS = {
450
+ control: "control",
451
+ block: "block",
452
+ query: "query",
453
+ metric: "metric",
454
+ dimension: "dimension",
455
+ dataset: "dataset",
456
+ model: "model",
457
+ table: "table"
458
+ };
459
+ function subtreeKeys(nodes, key) {
460
+ const node = findNode(nodes, key);
461
+ if (!node) return [];
462
+ const out = [];
463
+ const walk = (n) => {
464
+ out.push(n.key);
465
+ n.children.forEach(walk);
466
+ };
467
+ walk(node);
468
+ return out;
469
+ }
470
+ function lineageTab(root, context) {
471
+ const doc = context.document;
472
+ const { panel } = context;
473
+ const state = stateOf(context.mount);
474
+ const { view } = state;
475
+ const hasStructure = context.plugins.some((plugin) => plugin.name === "inspect");
476
+ const datasetLabels = Object.fromEntries(Object.entries(context.mount.datasets).map(([name, dataset]) => [name, dataset.label]));
477
+ let retried = false;
478
+ let landed;
479
+ let missed = false;
480
+ let menu;
481
+ let outlined;
482
+ const select = (id) => {
483
+ view.selected = id;
484
+ state.changed();
485
+ };
486
+ const focus = (id) => {
487
+ view.focus = id;
488
+ view.selected = id;
489
+ state.changed();
490
+ };
491
+ function card(node) {
492
+ const onPage = (node.kind === "block" || node.kind === "query" || node.kind === "control") && node.structureKey !== void 0;
493
+ const action = (label, name, run, testid) => h(doc, "button", {
494
+ type: "button",
495
+ class: "row-action",
496
+ "data-tip": label,
497
+ "aria-label": label,
498
+ "data-testid": testid,
499
+ onclick: (event) => {
500
+ event.stopPropagation();
501
+ run();
502
+ }
503
+ }, icon(doc, name));
504
+ return [
505
+ h(doc, "div", { class: "lkind" }, h(doc, "span", { class: "badge", "aria-hidden": "true" }, icon(doc, KIND_ICONS[node.kind])), KIND_LABELS[node.kind]),
506
+ h(doc, "div", { class: `ltitle${node.kind === "table" ? " mono" : ""}` }, node.label),
507
+ node.name && node.name !== node.label && h(doc, "div", { class: "lname" }, node.name),
508
+ node.value !== void 0 && h(doc, "div", { class: `lvalue${node.isSet ? "" : " unset"}` }, h(doc, "span", { class: "lvalue-label" }, "Value"), h(doc, "span", { class: "mono" }, node.value)),
509
+ node.pending && h(doc, "div", { class: "lname wrap" }, `pending: ${node.pending}`),
510
+ node.description && h(doc, "p", { class: "ldesc" }, node.description),
511
+ !!node.chips?.length && h(doc, "div", { class: "chips" }, node.chips.map((chip) => h(doc, "span", { class: "chip" }, chip))),
512
+ node.error && h(doc, "div", { class: "lerror" }, `Lineage: ${node.error}`),
513
+ h(
514
+ doc,
515
+ "div",
516
+ { class: "lactions" },
517
+ onPage && action("Locate on the page", "locate", () => panel.locate({ node: node.structureKey }), "card-locate"),
518
+ onPage && hasStructure && action("Show in Structure", "tree", () => {
519
+ expanded.close();
520
+ panel.show(STRUCTURE_TAB, node.structureKey);
521
+ }, "card-structure"),
522
+ action("Focus on its lineage", "focus", () => focus(node.id), "card-focus")
523
+ )
524
+ ];
525
+ }
526
+ const legendRow = (stroke, title, text) => h(
527
+ doc,
528
+ "div",
529
+ { class: "legend-row" },
530
+ h(doc, "div", { class: "legend-title" }, h(doc, "span", { class: `legend-line ${stroke}` }), title),
531
+ h(doc, "p", {}, text)
532
+ );
533
+ const legend = () => [
534
+ legendRow("uses", "Is built from", "Points from what uses to what it uses: a block draws a query, a query returns a field, a field comes from a dataset, a model, a table."),
535
+ legendRow("filter-on", "Filters, with a value", "A control the reader has set, mapped to a query: its value changes that query's numbers. The control is not part of where they come from."),
536
+ legendRow("filter-off", "Filters, not set", "The control is mapped to the query but has no value yet, so it changes nothing for now."),
537
+ legendRow("filter-on", "Cross-filter, active", "A selection in the source query is applied, so it filters the target query's numbers."),
538
+ legendRow("filter-off", "Cross-filter, inactive", "The queries are linked but nothing is selected in the source yet. Shown when cross-filters are on.")
539
+ ];
540
+ function toolbar(where, graph, focused, loading) {
541
+ const counts = {};
542
+ for (const node of graph.nodes) counts[node.kind] = (counts[node.kind] ?? 0) + 1;
543
+ const crossCount = graph.edges.filter((e) => e.kind === "crossFilter").length;
544
+ const preset = matchPreset(view);
545
+ const hiddenTotal = hiddenCount(view, counts, crossCount);
546
+ const crossDrawn = showsCrossFilters(view);
547
+ const key = JSON.stringify([where, counts, crossCount, preset?.id, [...view.hidden].sort(), view.crossFilters, focused?.id, focused?.label, loading, menu === where]);
548
+ const toggle = (kind) => {
549
+ if (view.hidden.has(kind)) view.hidden.delete(kind);
550
+ else view.hidden.add(kind);
551
+ state.changed();
552
+ };
553
+ const row = (shown, onclick, badge, label, count, testid) => h(doc, "button", {
554
+ type: "button",
555
+ role: "menuitemcheckbox",
556
+ "aria-checked": String(shown),
557
+ "data-testid": testid,
558
+ onclick
559
+ }, badge, label, h(doc, "span", { class: "count" }, count), icon(doc, shown ? "eye" : "hidden"));
560
+ const draw = () => [
561
+ h(
562
+ doc,
563
+ "div",
564
+ { class: "ltools" },
565
+ h(
566
+ doc,
567
+ "select",
568
+ {
569
+ class: "preset",
570
+ "aria-label": "Preset",
571
+ "data-testid": "lineage-preset",
572
+ onchange: (event) => {
573
+ const picked = LINEAGE_PRESETS.find((p) => p.id === event.target.value);
574
+ if (!picked) return;
575
+ view.hidden = new Set(picked.hidden);
576
+ view.crossFilters = picked.crossFilters;
577
+ state.changed();
578
+ }
579
+ },
580
+ !preset && h(doc, "option", { value: "custom", disabled: true, selected: true }, "Custom"),
581
+ LINEAGE_PRESETS.map((p) => h(doc, "option", { value: p.id, selected: p.id === preset?.id }, p.label))
582
+ ),
583
+ h(
584
+ doc,
585
+ "div",
586
+ { class: "menu-wrap" },
587
+ h(doc, "button", {
588
+ type: "button",
589
+ class: "tool",
590
+ "aria-haspopup": "menu",
591
+ "aria-expanded": String(menu === where),
592
+ "data-testid": "lineage-show",
593
+ onclick: () => {
594
+ menu = menu === where ? void 0 : where;
595
+ redraw();
596
+ }
597
+ }, icon(doc, hiddenTotal > 0 ? "hidden" : "eye"), "Show", hiddenTotal > 0 && h(doc, "span", { class: "muted" }, `${hiddenTotal} hidden`)),
598
+ menu === where && h(
599
+ doc,
600
+ "div",
601
+ { class: "menu", role: "menu", popover: "manual", "data-testid": "lineage-show-menu" },
602
+ LINEAGE_KINDS.filter((kind) => counts[kind]).map((kind) => row(
603
+ !view.hidden.has(kind),
604
+ () => toggle(kind),
605
+ h(doc, "span", { class: `badge kind-${kind}`, "aria-hidden": "true" }, icon(doc, KIND_ICONS[kind])),
606
+ KIND_LABELS[kind],
607
+ String(counts[kind]),
608
+ `show-${kind}`
609
+ )),
610
+ crossCount > 0 && row(
611
+ crossDrawn,
612
+ () => {
613
+ view.crossFilters = !view.crossFilters;
614
+ state.changed();
615
+ },
616
+ h(doc, "span", { class: "badge kind-control", "aria-hidden": "true" }, icon(doc, "filter")),
617
+ "Cross-filters",
618
+ view.crossFilters && !crossDrawn ? "with queries" : String(crossCount),
619
+ "show-cross-filters"
620
+ )
621
+ )
622
+ ),
623
+ h(doc, "span", { class: "spacer" }),
624
+ loading && h(doc, "span", { class: "dot executing", role: "img", "aria-label": "Tracing", "data-tip": "Tracing the fields through the catalog\u2026" }),
625
+ popover(doc, icon(doc, "help"), legend, { class: "pop-trigger row-action", "aria-label": "What the arrows mean" }),
626
+ where === "panel" && h(doc, "button", {
627
+ type: "button",
628
+ class: "row-action",
629
+ "data-tip": "Open in a large view",
630
+ "aria-label": "Open in a large view",
631
+ "data-testid": "lineage-expand",
632
+ onclick: () => {
633
+ menu = void 0;
634
+ expanded.open();
635
+ }
636
+ }, icon(doc, "expand"))
637
+ ),
638
+ focused && h(
639
+ doc,
640
+ "div",
641
+ { class: "focus-row", "data-testid": "lineage-focus" },
642
+ h(doc, "span", { class: "muted" }, "Focused on"),
643
+ h(
644
+ doc,
645
+ "span",
646
+ { class: "focus-chip" },
647
+ h(doc, "span", { class: "focus-label" }, `${KIND_LABELS[focused.kind]}: ${focused.label}`),
648
+ h(doc, "button", {
649
+ type: "button",
650
+ class: "row-action",
651
+ "aria-label": "Show everything",
652
+ "data-testid": "lineage-unfocus",
653
+ onclick: () => {
654
+ view.focus = void 0;
655
+ state.changed();
656
+ }
657
+ }, icon(doc, "close"))
658
+ )
659
+ )
660
+ ];
661
+ return { key, draw };
662
+ }
663
+ function placeMenu(element) {
664
+ const win2 = doc.defaultView;
665
+ const button = element.parentElement?.querySelector("button");
666
+ if (!win2 || !button) return;
667
+ element.showPopover?.();
668
+ const at = button.getBoundingClientRect();
669
+ const size = element.getBoundingClientRect();
670
+ const below = at.bottom + MENU_GAP;
671
+ const above = at.top - MENU_GAP - size.height;
672
+ const top = below + size.height <= win2.innerHeight - MENU_MARGIN || above < MENU_MARGIN ? Math.max(MENU_MARGIN, Math.min(below, win2.innerHeight - MENU_MARGIN - size.height)) : above;
673
+ element.style.left = `${Math.max(MENU_MARGIN, Math.min(at.left, win2.innerWidth - MENU_MARGIN - size.width))}px`;
674
+ element.style.top = `${top}px`;
675
+ }
676
+ function surface(where, minFitZoom) {
677
+ const head = h(doc, "div", { class: "ltoolbar" });
678
+ const canvas = createCanvas(doc, { minFitZoom, card, onSelect: select });
679
+ let drawnKey;
680
+ return {
681
+ head,
682
+ canvas,
683
+ draw(graph, shown, focused, loading) {
684
+ const bar = toolbar(where, graph, focused, loading);
685
+ if (bar.key !== drawnKey) {
686
+ drawnKey = bar.key;
687
+ replace(doc, head, bar.draw());
688
+ const opened = head.querySelector(".menu");
689
+ if (opened) placeMenu(opened);
690
+ }
691
+ canvas.draw(shown, view.selected);
692
+ }
693
+ };
694
+ }
695
+ const panelSurface = surface("panel", 0.6);
696
+ const notes = h(doc, "div", { class: "notes" });
697
+ const empty = h(doc, "div", { class: "body" });
698
+ const largeSurface = surface("expanded", 0.2);
699
+ const dialog = h(
700
+ doc,
701
+ "dialog",
702
+ { class: "expanded", "aria-label": "Lineage", "data-testid": "lineage-expanded" },
703
+ h(
704
+ doc,
705
+ "div",
706
+ { class: "dialog-head" },
707
+ h(
708
+ doc,
709
+ "div",
710
+ {},
711
+ h(doc, "h3", {}, "Lineage"),
712
+ h(doc, "p", { class: "muted" }, "From the page's blocks to the database tables. Click a card to follow its path.")
713
+ ),
714
+ h(doc, "button", { type: "button", class: "row-action", "aria-label": "Close", "data-testid": "lineage-close", onclick: () => expanded.close() }, icon(doc, "close"))
715
+ ),
716
+ largeSurface.head,
717
+ largeSurface.canvas.element
718
+ );
719
+ const expanded = {
720
+ isOpen: () => dialog.open,
721
+ open() {
722
+ if (dialog.open) return;
723
+ if (typeof dialog.showModal === "function") dialog.showModal();
724
+ else dialog.setAttribute("open", "");
725
+ redraw();
726
+ },
727
+ close() {
728
+ if (!dialog.open) return;
729
+ if (typeof dialog.close === "function") dialog.close();
730
+ else dialog.removeAttribute("open");
731
+ }
732
+ };
733
+ dialog.addEventListener("close", () => {
734
+ if (menu === "expanded") menu = void 0;
735
+ redraw();
736
+ });
737
+ const pane = h(doc, "div", { class: "pane" }, panelSurface.head, notes, empty, panelSurface.canvas.element, dialog);
738
+ root.append(h(doc, "style", {}, STYLES, LINEAGE_STYLES), pane);
739
+ const tooltip = tooltips(root);
740
+ function redraw() {
741
+ const snapshot = panel.snapshot;
742
+ const apps = snapshot?.apps;
743
+ const structure = snapshot?.structure;
744
+ const targets = lineageTargets(apps ?? []);
745
+ if (apps) {
746
+ state.traceFor(targets, (asked) => context.call("lineage.trace", { targets: asked }), !retried);
747
+ retried = true;
748
+ }
749
+ const trace = state.trace?.key === traceKey(targets) ? state.trace : void 0;
750
+ const graph = buildLineageGraph(apps ?? [], structure, trace?.traced, datasetLabels);
751
+ const filtered = filterGraph(graph, view);
752
+ const focused = view.focus ? filtered.nodes.find((n) => n.id === view.focus) : void 0;
753
+ const shown = focused ? focusGraph(filtered, focused.id) : filtered;
754
+ const loading = trace?.status === "loading";
755
+ if (panel.selection !== landed && (panel.selection === null || structure && apps && trace && !loading)) {
756
+ landed = panel.selection;
757
+ if (landed !== null && structure) {
758
+ const keys = subtreeKeys(structure.nodes, landed);
759
+ const hit = keys.map((key) => shown.nodes.find((n) => n.structureKey === key)).find((n) => n !== void 0);
760
+ missed = !hit;
761
+ if (hit) {
762
+ view.selected = hit.id;
763
+ queueMicrotask(() => panelSurface.canvas.center(hit.id));
764
+ }
765
+ }
766
+ }
767
+ const waiting = !apps;
768
+ const nothing = !waiting && graph.nodes.length === 0;
769
+ panelSurface.head.hidden = waiting || nothing;
770
+ panelSurface.canvas.element.hidden = waiting || nothing;
771
+ empty.hidden = !(waiting || nothing);
772
+ replace(doc, empty, waiting ? h(doc, "p", { class: "note", "data-testid": "lineage-waiting" }, "Waiting for the Data App\u2026") : nothing && h(doc, "p", { class: "note", "data-testid": "lineage-none" }, "Nothing to trace yet. The lineage starts from the fields the app's queries return: it fills in once they have run."));
773
+ replace(
774
+ doc,
775
+ notes,
776
+ trace?.status === "failed" && h(
777
+ doc,
778
+ "div",
779
+ { class: "banner warn", role: "alert", "data-testid": "lineage-failed" },
780
+ icon(doc, "info"),
781
+ h(doc, "span", {}, `Couldn't trace lineage: ${trace.error}. Fields stop at their dataset, or at the model their query names.`)
782
+ ),
783
+ missed && !waiting && h(
784
+ doc,
785
+ "div",
786
+ { class: "banner", "data-testid": "lineage-missed" },
787
+ icon(doc, "info"),
788
+ h(doc, "span", {}, "Nothing you picked is drawn here: it holds no query or control, or the current filter or focus hides it."),
789
+ h(doc, "button", {
790
+ type: "button",
791
+ class: "row-action",
792
+ "aria-label": "Dismiss",
793
+ onclick: () => {
794
+ missed = false;
795
+ redraw();
796
+ }
797
+ }, icon(doc, "close"))
798
+ )
799
+ );
800
+ if (!waiting && !nothing) panelSurface.draw(graph, shown, focused, loading);
801
+ if (expanded.isOpen()) largeSurface.draw(graph, shown, focused, loading);
802
+ tooltip.redrawn();
803
+ const pinned = view.selected ? shown.nodes.find((n) => n.id === view.selected) : void 0;
804
+ const outline = pinned?.kind === "block" || pinned?.kind === "query" ? pinned.structureKey : void 0;
805
+ if (outline !== outlined) {
806
+ outlined = outline;
807
+ panel.highlight(outline ?? null);
808
+ }
809
+ }
810
+ const onKey = (event) => {
811
+ if (event.key !== "Escape") return;
812
+ if (menu) {
813
+ menu = void 0;
814
+ redraw();
815
+ } else if (view.selected && !expanded.isOpen()) {
816
+ select(void 0);
817
+ }
818
+ };
819
+ const onPress = (event) => {
820
+ if (!menu || event.composedPath().some((node) => node instanceof Element && node.classList.contains("menu-wrap"))) return;
821
+ menu = void 0;
822
+ redraw();
823
+ };
824
+ const onMove = (event) => {
825
+ if (!menu || event.target instanceof Node && root.contains(event.target) && event.target.closest?.(".menu")) return;
826
+ menu = void 0;
827
+ redraw();
828
+ };
829
+ const win = doc.defaultView;
830
+ doc.addEventListener("keydown", onKey);
831
+ win?.addEventListener("resize", onMove);
832
+ win?.addEventListener("scroll", onMove, true);
833
+ root.addEventListener("pointerdown", onPress, true);
834
+ redraw();
835
+ const stops = [panel.subscribe(redraw), state.subscribe(redraw)];
836
+ return () => {
837
+ stops.forEach((stop) => stop());
838
+ doc.removeEventListener("keydown", onKey);
839
+ win?.removeEventListener("resize", onMove);
840
+ win?.removeEventListener("scroll", onMove, true);
841
+ root.removeEventListener("pointerdown", onPress, true);
842
+ expanded.close();
843
+ panelSurface.canvas.dispose();
844
+ largeSurface.canvas.dispose();
845
+ tooltip.dispose();
846
+ if (outlined) panel.highlight(null);
847
+ root.replaceChildren();
848
+ };
849
+ }
850
+ var LINEAGE_STYLES = `
851
+ .pane { position: relative; }
852
+ .mono { font-family: var(--anfra-font-mono); }
853
+ .wrap { overflow-wrap: anywhere; }
854
+ .kind-control { --kind: #f97316; } .kind-block { --kind: #6366f1; } .kind-query { --kind: #10b981; } .kind-metric { --kind: #14b8a6; }
855
+ .kind-dimension { --kind: #0ea5e9; } .kind-dataset { --kind: #f59e0b; } .kind-model { --kind: #8b5cf6; } .kind-table { --kind: #64748b; }
856
+ .badge { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; background: color-mix(in srgb, var(--kind) 16%, transparent); color: var(--kind); }
857
+ /* Toolbar */
858
+ .ltoolbar { flex: none; position: relative; z-index: 3; padding: 8px 14px; border-bottom: 1px solid var(--anfra-color-border); }
859
+ .ltools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
860
+ .preset { min-width: 0; max-width: 180px; border: 1px solid var(--anfra-color-border); border-radius: 6px; background: var(--anfra-color-bg); color: var(--anfra-color-fg); padding: 3px 6px; font: inherit; font-size: 12px; }
861
+ .menu-wrap { position: relative; }
862
+ .menu { position: fixed; inset: auto; margin: 0; z-index: 10; min-width: 220px; max-height: calc(100vh - 16px); overflow: auto; color: var(--anfra-color-fg); padding: 4px; border: 1px solid var(--anfra-color-border); border-radius: 6px; background: var(--anfra-color-bg); box-shadow: 0 6px 20px rgb(0 0 0 / 0.15); }
863
+ .menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; border-radius: 4px; background: none; padding: 4px 8px; font-size: 12px; text-align: left; }
864
+ .menu button:hover { background: var(--hover); }
865
+ .menu button[aria-checked="false"] { color: var(--anfra-color-muted); }
866
+ .menu button[aria-checked="false"] .badge { background: var(--hover); color: var(--anfra-color-muted); }
867
+ .menu .badge { width: 16px; height: 16px; }
868
+ .menu .badge .icon { width: 12px; height: 12px; }
869
+ .count { margin-left: auto; color: var(--anfra-color-muted); font-variant-numeric: tabular-nums; }
870
+ .focus-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; }
871
+ .focus-chip { display: inline-flex; align-items: center; gap: 2px; min-width: 0; padding: 0 2px 0 8px; border-radius: 6px; background: color-mix(in srgb, #8b5cf6 16%, transparent); font-weight: 500; }
872
+ .focus-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
873
+ /* The legend's trigger is a popover's and a row action's: centred as a row action. */
874
+ .pop-trigger.row-action { display: grid; place-items: center; }
875
+ .legend-row + .legend-row { margin-top: 10px; }
876
+ .legend-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
877
+ .legend-row p { margin: 2px 0 0; color: var(--anfra-color-muted); }
878
+ .legend-line { flex: none; width: 40px; height: 0; border-top: 2px solid; }
879
+ .legend-line.uses { border-color: #a78bfa; } .legend-line.filter-on { border-color: #fb923c; } .legend-line.filter-off { border-color: light-dark(#e5e7eb, #4b5563); }
880
+ /* Notes */
881
+ .notes { flex: none; }
882
+ .banner { display: flex; align-items: flex-start; gap: 6px; padding: 6px 14px; border-bottom: 1px solid var(--anfra-color-border); background: var(--subtle); color: var(--anfra-color-muted); font-size: 12px; }
883
+ .banner.warn { background: var(--warn-bg); color: var(--anfra-color-fg); }
884
+ .banner.warn .icon { color: var(--warn); }
885
+ .banner > span { flex: 1; min-width: 0; }
886
+ .banner .icon { margin-top: 2px; }
887
+ .banner .row-action { margin: -3px 0; }
888
+ /* Canvas */
889
+ .canvas { flex: 1; min-height: 0; position: relative; overflow: hidden; cursor: grab; touch-action: none; user-select: none;
890
+ background-color: var(--subtle); background-image: radial-gradient(circle, color-mix(in srgb, var(--anfra-color-muted) 40%, transparent) 1px, transparent 1.2px); }
891
+ .canvas.panning { cursor: grabbing; }
892
+ .world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
893
+ .edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
894
+ .edge { fill: none; stroke-width: 1.25; }
895
+ .edge.on { stroke-width: 2; } .edge.dim { opacity: 0.15; }
896
+ .edge.uses { stroke: #a78bfa; } .edge.uses.on { stroke: #7c3aed; }
897
+ .edge.filter-on { stroke: #fb923c; } .edge.filter-on.on { stroke: #ea580c; }
898
+ .edge.filter-off { stroke: light-dark(#e5e7eb, #4b5563); } .edge.filter-off.on { stroke: #9ca3af; }
899
+ .m.uses path { fill: #a78bfa; } .m.uses.on path { fill: #7c3aed; }
900
+ .m.filter-on path { fill: #fb923c; } .m.filter-on.on path { fill: #ea580c; }
901
+ .m.filter-off path { fill: light-dark(#e5e7eb, #4b5563); } .m.filter-off.on path { fill: #9ca3af; }
902
+ .lcard { position: absolute; left: 0; top: 0; width: 240px; padding: 8px 12px 10px; border: 1px solid var(--anfra-color-border); border-left: 3px solid var(--kind); border-radius: 8px;
903
+ background: var(--anfra-color-bg); box-shadow: 0 1px 2px rgb(0 0 0 / 0.06); cursor: pointer; transition: opacity 0.15s, box-shadow 0.15s; }
904
+ .lcard.selected { box-shadow: 0 0 0 2px color-mix(in srgb, #8b5cf6 70%, transparent); }
905
+ .lcard.on-path { border-top-color: #c4b5fd; border-right-color: #c4b5fd; border-bottom-color: #c4b5fd; }
906
+ .lcard.dim { opacity: 0.3; }
907
+ .lkind { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--anfra-color-muted); }
908
+ .ltitle { margin-top: 4px; font-size: 13px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
909
+ .lname { margin-top: 2px; font-family: var(--anfra-font-mono); font-size: 11px; color: var(--anfra-color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
910
+ .lname.wrap { white-space: normal; }
911
+ .lvalue { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; padding: 3px 8px; border-radius: 4px; background: var(--hover); font-size: 12px; overflow-wrap: anywhere; }
912
+ .lvalue.unset { color: var(--anfra-color-muted); font-style: italic; }
913
+ .lvalue-label { flex: none; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--anfra-color-muted); font-style: normal; }
914
+ .ldesc { margin: 4px 0 0; font-size: 12px; line-height: 1.35; color: var(--anfra-color-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
915
+ .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
916
+ .chip { padding: 1px 6px; border-radius: 4px; background: color-mix(in srgb, #8b5cf6 16%, transparent); color: light-dark(#6d28d9, #c4b5fd); font-family: var(--anfra-font-mono); font-size: 10px; }
917
+ .lerror { margin-top: 6px; font-size: 11px; color: var(--warn); overflow-wrap: anywhere; }
918
+ .lactions { position: absolute; top: -12px; right: 8px; display: none; gap: 2px; padding: 1px; border: 1px solid var(--anfra-color-border); border-radius: 6px; background: var(--anfra-color-bg); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
919
+ .lcard:hover .lactions, .lcard:focus-within .lactions { display: flex; }
920
+ .controls { position: absolute; left: 10px; bottom: 10px; z-index: 2; display: flex; flex-direction: column; padding: 2px; border: 1px solid var(--anfra-color-border); border-radius: 6px; background: var(--anfra-color-bg); }
921
+ /* The large view */
922
+ dialog.expanded { width: 95vw; height: 90vh; max-width: 95vw; max-height: 90vh; padding: 0; border: 1px solid var(--anfra-color-border); border-radius: 10px; background: var(--anfra-color-bg); color: var(--anfra-color-fg); overflow: hidden; }
923
+ dialog.expanded[open] { display: flex; flex-direction: column; }
924
+ dialog.expanded::backdrop { background: rgb(0 0 0 / 0.4); }
925
+ .dialog-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--anfra-color-border); }
926
+ .dialog-head h3 { margin: 0; font-size: 15px; }
927
+ .dialog-head p { margin: 2px 0 0; font-size: 12px; }
928
+ `;
929
+ export {
930
+ KIND_LABELS,
931
+ lineageTab as default
932
+ };