@kanzo-tech/graph 0.13.1 → 0.15.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/README.md +12 -15
- package/dist/core/categories.d.ts +18 -6
- package/dist/core/categories.d.ts.map +1 -1
- package/dist/core/categories.js +41 -10
- package/dist/core/categories.js.map +1 -1
- package/dist/core/channels.d.ts +10 -5
- package/dist/core/channels.d.ts.map +1 -1
- package/dist/core/channels.js +11 -13
- package/dist/core/channels.js.map +1 -1
- package/dist/core/detail.d.ts +14 -8
- package/dist/core/detail.d.ts.map +1 -1
- package/dist/core/detail.js +33 -15
- package/dist/core/detail.js.map +1 -1
- package/dist/core/filter.d.ts +3 -1
- package/dist/core/filter.d.ts.map +1 -1
- package/dist/core/filter.js +54 -50
- package/dist/core/filter.js.map +1 -1
- package/dist/core/load.d.ts +58 -0
- package/dist/core/load.d.ts.map +1 -0
- package/dist/core/load.js +115 -0
- package/dist/core/load.js.map +1 -0
- package/dist/core/state.d.ts +31 -56
- package/dist/core/state.d.ts.map +1 -1
- package/dist/core/store.d.ts +1 -3
- package/dist/core/store.d.ts.map +1 -1
- package/dist/core/store.js +162 -172
- package/dist/core/store.js.map +1 -1
- package/dist/core/types.d.ts +21 -17
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -25
- package/dist/index.js.map +1 -1
- package/dist/parts/gesture.d.ts +1 -10
- package/dist/parts/gesture.d.ts.map +1 -1
- package/dist/parts/gesture.js +26 -28
- package/dist/parts/gesture.js.map +1 -1
- package/dist/parts/graph-canvas.d.ts.map +1 -1
- package/dist/parts/graph-canvas.js +128 -106
- package/dist/parts/graph-canvas.js.map +1 -1
- package/dist/parts/graph-inspector.d.ts +4 -4
- package/dist/parts/graph-inspector.d.ts.map +1 -1
- package/dist/parts/graph-inspector.js +55 -57
- package/dist/parts/graph-inspector.js.map +1 -1
- package/dist/parts/graph-legend.d.ts +4 -4
- package/dist/parts/graph-legend.d.ts.map +1 -1
- package/dist/parts/graph-legend.js +21 -21
- package/dist/parts/graph-legend.js.map +1 -1
- package/dist/parts/graph-toolbar.d.ts +1 -1
- package/dist/parts/graph-toolbar.d.ts.map +1 -1
- package/dist/parts/graph-toolbar.js +40 -40
- package/dist/parts/graph-toolbar.js.map +1 -1
- package/dist/parts/overlays.d.ts +6 -5
- package/dist/parts/overlays.d.ts.map +1 -1
- package/dist/parts/overlays.js +70 -68
- package/dist/parts/overlays.js.map +1 -1
- package/dist/react/use-graph-state.d.ts +4 -2
- package/dist/react/use-graph-state.d.ts.map +1 -1
- package/dist/react/use-graph-state.js +10 -6
- package/dist/react/use-graph-state.js.map +1 -1
- package/dist/react/use-graph.d.ts +1 -4
- package/dist/react/use-graph.d.ts.map +1 -1
- package/dist/react/use-graph.js +38 -49
- package/dist/react/use-graph.js.map +1 -1
- package/dist/render/graph-looks.d.ts.map +1 -1
- package/dist/render/graph-looks.js.map +1 -1
- package/dist/render/graph-model.d.ts +6 -8
- package/dist/render/graph-model.d.ts.map +1 -1
- package/dist/render/graph-model.js +51 -57
- package/dist/render/graph-model.js.map +1 -1
- package/dist/render/graph-sim.d.ts +2 -3
- package/dist/render/graph-sim.d.ts.map +1 -1
- package/dist/render/graph-sim.js.map +1 -1
- package/dist/render/renderer.d.ts +10 -10
- package/dist/render/renderer.d.ts.map +1 -1
- package/dist/render/renderer.js +121 -177
- package/dist/render/renderer.js.map +1 -1
- package/dist/section.d.ts.map +1 -1
- package/dist/section.js +3 -7
- package/dist/section.js.map +1 -1
- package/package.json +29 -10
- package/dist/core/refine.d.ts +0 -14
- package/dist/core/refine.d.ts.map +0 -1
- package/dist/core/refine.js +0 -20
- package/dist/core/refine.js.map +0 -1
- package/dist/core/resident.d.ts +0 -79
- package/dist/core/resident.d.ts.map +0 -1
- package/dist/core/resident.js +0 -44
- package/dist/core/resident.js.map +0 -1
- package/dist/core/scheduler.d.ts +0 -42
- package/dist/core/scheduler.d.ts.map +0 -1
- package/dist/core/scheduler.js +0 -77
- package/dist/core/scheduler.js.map +0 -1
- package/dist/core/tile-matrix.d.ts +0 -37
- package/dist/core/tile-matrix.d.ts.map +0 -1
- package/dist/core/tile-matrix.js +0 -49
- package/dist/core/tile-matrix.js.map +0 -1
- package/dist/core/tile.d.ts +0 -54
- package/dist/core/tile.d.ts.map +0 -1
- package/dist/core/tile.js +0 -76
- package/dist/core/tile.js.map +0 -1
- package/dist/core/tileset.d.ts +0 -59
- package/dist/core/tileset.d.ts.map +0 -1
- package/dist/core/tileset.js +0 -177
- package/dist/core/tileset.js.map +0 -1
- package/dist/render/adaptive.d.ts +0 -27
- package/dist/render/adaptive.d.ts.map +0 -1
- package/dist/render/adaptive.js +0 -25
- package/dist/render/adaptive.js.map +0 -1
- package/dist/render/compose.d.ts +0 -51
- package/dist/render/compose.d.ts.map +0 -1
- package/dist/render/compose.js +0 -107
- package/dist/render/compose.js.map +0 -1
- package/dist/render/encode.d.ts +0 -42
- package/dist/render/encode.d.ts.map +0 -1
- package/dist/render/encode.js +0 -68
- package/dist/render/encode.js.map +0 -1
- package/dist/render/when-ready.d.ts +0 -35
- package/dist/render/when-ready.d.ts.map +0 -1
- package/dist/render/when-ready.js +0 -17
- package/dist/render/when-ready.js.map +0 -1
package/dist/core/tile.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
var v = Object.defineProperty;
|
|
2
|
-
var m = (e) => {
|
|
3
|
-
throw TypeError(e);
|
|
4
|
-
};
|
|
5
|
-
var w = (e, t, s) => t in e ? v(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
6
|
-
var h = (e, t, s) => w(e, typeof t != "symbol" ? t + "" : t, s), L = (e, t, s) => t.has(e) || m("Cannot " + s);
|
|
7
|
-
var i = (e, t, s) => (L(e, t, "read from private field"), s ? s.call(e) : t.get(e)), n = (e, t, s) => t.has(e) ? m("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, s), l = (e, t, s, f) => (L(e, t, "write to private field"), f ? f.call(e, s) : t.set(e, s), s), y = (e, t, s) => (L(e, t, "access private method"), s);
|
|
8
|
-
import { tileId as z } from "./tile-matrix.js";
|
|
9
|
-
var c, a, u, d, r, o, b, I;
|
|
10
|
-
class E {
|
|
11
|
-
constructor(t) {
|
|
12
|
-
n(this, b);
|
|
13
|
-
h(this, "address");
|
|
14
|
-
h(this, "id");
|
|
15
|
-
h(this, "content", null);
|
|
16
|
-
h(this, "isSelected", !1);
|
|
17
|
-
h(this, "isVisible", !1);
|
|
18
|
-
h(this, "parent", null);
|
|
19
|
-
h(this, "children", []);
|
|
20
|
-
n(this, c, null);
|
|
21
|
-
n(this, a, null);
|
|
22
|
-
n(this, u, 0);
|
|
23
|
-
n(this, d, !1);
|
|
24
|
-
n(this, r, !1);
|
|
25
|
-
n(this, o, !1);
|
|
26
|
-
this.address = t, this.id = z(t);
|
|
27
|
-
}
|
|
28
|
-
get z() {
|
|
29
|
-
return this.address.z;
|
|
30
|
-
}
|
|
31
|
-
/** Read at least once for the current question. */
|
|
32
|
-
get isLoaded() {
|
|
33
|
-
return i(this, d) && !i(this, o);
|
|
34
|
-
}
|
|
35
|
-
/** Queued or running, and not cancelled. */
|
|
36
|
-
get isLoading() {
|
|
37
|
-
return i(this, a) !== null && !i(this, r);
|
|
38
|
-
}
|
|
39
|
-
get needsReload() {
|
|
40
|
-
return i(this, o) || i(this, r);
|
|
41
|
-
}
|
|
42
|
-
get byteLength() {
|
|
43
|
-
var t;
|
|
44
|
-
return ((t = this.content) == null ? void 0 : t.byteLength) ?? 0;
|
|
45
|
-
}
|
|
46
|
-
loadData(t) {
|
|
47
|
-
l(this, c, t.scheduler), l(this, d, !1), l(this, r, !1), l(this, o, !1), l(this, u, i(this, u) + 1);
|
|
48
|
-
const s = y(this, b, I).call(this, t);
|
|
49
|
-
return l(this, a, s), s;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* A finished tile has nothing to abort; a queued or running one is cancelled, and its batch is
|
|
53
|
-
* aborted once no tile in it is wanted.
|
|
54
|
-
*/
|
|
55
|
-
abort() {
|
|
56
|
-
var t;
|
|
57
|
-
i(this, d) || i(this, a) === null || (l(this, r, !0), (t = i(this, c)) == null || t.cancel(this));
|
|
58
|
-
}
|
|
59
|
-
setNeedsReload() {
|
|
60
|
-
this.isLoading && (this.abort(), l(this, a, null)), l(this, o, !0);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
c = new WeakMap(), a = new WeakMap(), u = new WeakMap(), d = new WeakMap(), r = new WeakMap(), o = new WeakMap(), b = new WeakSet(), I = async function({ onError: t, onLoad: s, priority: f, scheduler: R }) {
|
|
64
|
-
const p = i(this, u), g = await R.schedule(this, f);
|
|
65
|
-
if (p === i(this, u)) {
|
|
66
|
-
if (l(this, a, null), g === null || i(this, r)) {
|
|
67
|
-
l(this, r, !0);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
l(this, d, !0), "value" in g ? (this.content = g.value, s(this)) : t(g.error ?? new Error("the tile failed to load"), this);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
E as Tile
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=tile.js.map
|
package/dist/core/tile.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tile.js","sources":["../../src/core/tile.ts"],"sourcesContent":["import type { Batch, EdgeBatch, Gap, TileAddress } from \"@fossil-lang/corpus\";\nimport type { RequestScheduler } from \"./scheduler\";\nimport { tileId } from \"./tile-matrix\";\n\n/** What one tile holds once read: its rows, the relations incident to it, and what was declined. */\nexport interface TileContent {\n readonly rows: Batch;\n readonly edges: readonly EdgeBatch[];\n readonly declined: readonly Gap[];\n readonly byteLength: number;\n}\n\n/**\n * deck.gl's `getTileData`, over a batch: fossil's addresses where deck.gl has `{ x, y, z }`, and one\n * content per address, in order, because the corpus reads a run of consecutive tiles in one statement.\n */\nexport type TileLoader = (addresses: readonly TileAddress[], signal: AbortSignal) => Promise<readonly TileContent[]>;\n\nexport interface TileLoad {\n scheduler: RequestScheduler<Tile, TileContent>;\n priority: (tile: Tile) => number;\n onLoad: (tile: Tile) => void;\n onError: (error: unknown, tile: Tile) => void;\n}\n\n/**\n * deck.gl's `Tile2DHeader`: one tile's load, abort and content, and its place in the tree.\n *\n * **Content outlives a reload.** A tile marked for reload keeps what it last read until the new\n * answer arrives, and an aborted or failed reload keeps it too, so a change of question never\n * shows a hole. deck.gl drops it on a cancelled reload; the one departure, and it is what\n * `/docs/design/graph` asks of a change of data.\n */\nexport class Tile {\n readonly address: TileAddress;\n readonly id: string;\n content: TileContent | null = null;\n isSelected = false;\n isVisible = false;\n parent: Tile | null = null;\n children: Tile[] = [];\n\n #scheduler: RequestScheduler<Tile, TileContent> | null = null;\n #loader: Promise<void> | null = null;\n #loaderId = 0;\n #loaded = false;\n #cancelled = false;\n #needsReload = false;\n\n constructor(address: TileAddress) {\n this.address = address;\n this.id = tileId(address);\n }\n\n get z(): number {\n return this.address.z;\n }\n\n /** Read at least once for the current question. */\n get isLoaded(): boolean {\n return this.#loaded && !this.#needsReload;\n }\n\n /** Queued or running, and not cancelled. */\n get isLoading(): boolean {\n return this.#loader !== null && !this.#cancelled;\n }\n\n get needsReload(): boolean {\n return this.#needsReload || this.#cancelled;\n }\n\n get byteLength(): number {\n return this.content?.byteLength ?? 0;\n }\n\n loadData(options: TileLoad): Promise<void> {\n this.#scheduler = options.scheduler;\n this.#loaded = false;\n this.#cancelled = false;\n this.#needsReload = false;\n this.#loaderId += 1;\n const loader = this.#load(options);\n this.#loader = loader;\n return loader;\n }\n\n /**\n * A finished tile has nothing to abort; a queued or running one is cancelled, and its batch is\n * aborted once no tile in it is wanted.\n */\n abort(): void {\n if (this.#loaded || this.#loader === null) return;\n this.#cancelled = true;\n this.#scheduler?.cancel(this);\n }\n\n setNeedsReload(): void {\n if (this.isLoading) {\n this.abort();\n this.#loader = null;\n }\n this.#needsReload = true;\n }\n\n async #load({ onError, onLoad, priority, scheduler }: TileLoad): Promise<void> {\n const loaderId = this.#loaderId;\n const outcome = await scheduler.schedule(this, priority);\n if (loaderId !== this.#loaderId) return;\n this.#loader = null;\n if (outcome === null || this.#cancelled) {\n this.#cancelled = true;\n return;\n }\n this.#loaded = true;\n if (\"value\" in outcome) {\n this.content = outcome.value;\n onLoad(this);\n } else {\n onError(outcome.error ?? new Error(\"the tile failed to load\"), this);\n }\n }\n}\n"],"names":["Tile","address","__privateAdd","_Tile_instances","__publicField","_scheduler","_loader","_loaderId","_loaded","_cancelled","_needsReload","tileId","__privateGet","_a","options","__privateSet","loader","__privateMethod","load_fn","onError","onLoad","priority","scheduler","loaderId","outcome"],"mappings":";;;;;;;;;AAiCO,MAAMA,EAAK;AAAA,EAgBhB,YAAYC,GAAsB;AAhB7B,IAAAC,EAAA,MAAAC;AACI,IAAAC,EAAA;AACA,IAAAA,EAAA;AACT,IAAAA,EAAA,iBAA8B;AAC9B,IAAAA,EAAA,oBAAa;AACb,IAAAA,EAAA,mBAAY;AACZ,IAAAA,EAAA,gBAAsB;AACtB,IAAAA,EAAA,kBAAmB,CAAA;AAEnB,IAAAF,EAAA,MAAAG,GAAyD;AACzD,IAAAH,EAAA,MAAAI,GAAgC;AAChC,IAAAJ,EAAA,MAAAK,GAAY;AACZ,IAAAL,EAAA,MAAAM,GAAU;AACV,IAAAN,EAAA,MAAAO,GAAa;AACb,IAAAP,EAAA,MAAAQ,GAAe;AAGb,SAAK,UAAUT,GACf,KAAK,KAAKU,EAAOV,CAAO;AAAA,EAC1B;AAAA,EAEA,IAAI,IAAY;AACd,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA;AAAA,EAGA,IAAI,WAAoB;AACtB,WAAOW,EAAA,MAAKJ,MAAW,CAACI,EAAA,MAAKF;AAAA,EAC/B;AAAA;AAAA,EAGA,IAAI,YAAqB;AACvB,WAAOE,EAAA,MAAKN,OAAY,QAAQ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AAA,IACF;AACA,IAAAM,EAAA,MAAKP,GAAU,KACX,WAAWgB,KACb,KAAK,UAAUA,EAAQ,OACvBJ,EAAO,IAAI,KAEXD,EAAQK,EAAQ,SAAS,IAAI,MAAM,yBAAyB,GAAG,IAAI;AAAA;AAEvE;"}
|
package/dist/core/tileset.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { TileAddress, TileMatrixSet } from '@fossil-lang/corpus';
|
|
2
|
-
import { Tile, TileLoader } from './tile';
|
|
3
|
-
import { Viewport } from './tile-matrix';
|
|
4
|
-
export interface TilesetOptions {
|
|
5
|
-
load: TileLoader;
|
|
6
|
-
onTileLoad?: (tile: Tile) => void;
|
|
7
|
-
onTileError?: (error: unknown, tile: Tile) => void;
|
|
8
|
-
onTileUnload?: (tile: Tile) => void;
|
|
9
|
-
/** Tiles kept; five times the selected count when absent. */
|
|
10
|
-
maxCacheSize?: number;
|
|
11
|
-
/** Bytes kept; unbounded when absent. */
|
|
12
|
-
maxCacheByteSize?: number;
|
|
13
|
-
/** Batches in flight — one: see `RequestScheduler`. */
|
|
14
|
-
maxRequests?: number;
|
|
15
|
-
debounceTime?: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* **deck.gl's `Tileset2D` with the loader swapped for the corpus** — `modules/geo-layers/src/
|
|
19
|
-
* tileset-2d/tileset-2d.ts`, its names kept so either can be read from the other.
|
|
20
|
-
*
|
|
21
|
-
* `update(viewport)` selects, then sets tile states, then prunes requests, then resizes the cache,
|
|
22
|
-
* in deck.gl's order. Where it departs is `/docs/design/graph`'s table: a tile is fossil's
|
|
23
|
-
* `{ type, z, tile }`, the level is chosen by published row counts, a tile is in view by its
|
|
24
|
-
* published box, and the tiles wanted in one tick are read as one batch, whose read is aborted once
|
|
25
|
-
* no tile in it is wanted.
|
|
26
|
-
*/
|
|
27
|
-
export declare class Tileset2D {
|
|
28
|
-
#private;
|
|
29
|
-
constructor(options: TilesetOptions);
|
|
30
|
-
get tiles(): Tile[];
|
|
31
|
-
get selectedTiles(): readonly Tile[];
|
|
32
|
-
/** Moves whenever the selected or visible set, or what a tile holds, may have changed. */
|
|
33
|
-
get frame(): number;
|
|
34
|
-
/** The zoom the last selection chose, or `null` before one. */
|
|
35
|
-
get z(): number | null;
|
|
36
|
-
get isLoaded(): boolean;
|
|
37
|
-
get maxCacheSize(): number;
|
|
38
|
-
get maxCacheByteSize(): number;
|
|
39
|
-
/** The matrices, from `corpus.tileMatrix(type)`. A new set empties the cache. */
|
|
40
|
-
setMatrix(matrix: TileMatrixSet): void;
|
|
41
|
-
/** The tiles `scan.plan()` kept, by zoom — asked once per question, never per camera move. */
|
|
42
|
-
setPlan(planned: readonly TileAddress[]): void;
|
|
43
|
-
/**
|
|
44
|
-
* The question changed: every tile is marked for reload and keeps its content until the new
|
|
45
|
-
* answer arrives — `TileLayer`'s `reloadAll` when its `data` moves. A cached tile that is not
|
|
46
|
-
* selected is dropped, since nothing will ask it again under the old question.
|
|
47
|
-
*/
|
|
48
|
-
reloadAll(): void;
|
|
49
|
-
/**
|
|
50
|
-
* Select what the viewport needs and refine; returns a frame number that moves whenever the
|
|
51
|
-
* visible set may have changed.
|
|
52
|
-
*/
|
|
53
|
-
update(viewport: Viewport, limit: number): number;
|
|
54
|
-
/** Re-run refinement after a load, with no change of viewport. */
|
|
55
|
-
refresh(): number;
|
|
56
|
-
/** Abort everything and forget the cache. */
|
|
57
|
-
finalize(): void;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=tileset.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tileset.d.ts","sourceRoot":"","sources":["../../src/core/tileset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGtE,OAAO,EAAE,IAAI,EAAoB,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAA2C,KAAK,QAAQ,EAAE,M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}
|
package/dist/core/tileset.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
var w = (o) => {
|
|
2
|
-
throw TypeError(o);
|
|
3
|
-
};
|
|
4
|
-
var L = (o, e, i) => e.has(o) || w("Cannot " + i);
|
|
5
|
-
var t = (o, e, i) => (L(o, e, "read from private field"), i ? i.call(o) : e.get(o)), c = (o, e, i) => e.has(o) ? w("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, i), l = (o, e, i, s) => (L(o, e, "write to private field"), s ? s.call(o, i) : e.set(o, i), i), d = (o, e, i) => (L(o, e, "access private method"), i);
|
|
6
|
-
import { refine as $ } from "./refine.js";
|
|
7
|
-
import { RequestScheduler as D } from "./scheduler.js";
|
|
8
|
-
import { Tile as O } from "./tile.js";
|
|
9
|
-
import { selectLevel as U, tileId as E, centreOf as _, parentOf as I } from "./tile-matrix.js";
|
|
10
|
-
const k = 5;
|
|
11
|
-
var f, y, h, z, g, u, m, b, S, x, M, T, a, v, R, q, A, B, N, C;
|
|
12
|
-
class Z {
|
|
13
|
-
constructor(e) {
|
|
14
|
-
c(this, a);
|
|
15
|
-
c(this, f);
|
|
16
|
-
c(this, y);
|
|
17
|
-
c(this, h, /* @__PURE__ */ new Map());
|
|
18
|
-
c(this, z, null);
|
|
19
|
-
c(this, g, /* @__PURE__ */ new Map());
|
|
20
|
-
c(this, u, []);
|
|
21
|
-
c(this, m, null);
|
|
22
|
-
c(this, b, 0);
|
|
23
|
-
c(this, S, null);
|
|
24
|
-
c(this, x, !0);
|
|
25
|
-
c(this, M, 0);
|
|
26
|
-
c(this, T, "");
|
|
27
|
-
l(this, f, e), l(this, y, new D({
|
|
28
|
-
run: (i, s) => e.load(i.map((r) => r.address), s),
|
|
29
|
-
debounceTime: e.debounceTime,
|
|
30
|
-
maxRequests: e.maxRequests ?? 1
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
get tiles() {
|
|
34
|
-
return [...t(this, h).values()].sort((e, i) => e.z - i.z);
|
|
35
|
-
}
|
|
36
|
-
get selectedTiles() {
|
|
37
|
-
return t(this, u);
|
|
38
|
-
}
|
|
39
|
-
/** Moves whenever the selected or visible set, or what a tile holds, may have changed. */
|
|
40
|
-
get frame() {
|
|
41
|
-
return t(this, M);
|
|
42
|
-
}
|
|
43
|
-
/** The zoom the last selection chose, or `null` before one. */
|
|
44
|
-
get z() {
|
|
45
|
-
return t(this, S);
|
|
46
|
-
}
|
|
47
|
-
get isLoaded() {
|
|
48
|
-
return t(this, u).every((e) => e.isLoaded);
|
|
49
|
-
}
|
|
50
|
-
get maxCacheSize() {
|
|
51
|
-
return t(this, f).maxCacheSize ?? k * Math.max(1, t(this, u).length);
|
|
52
|
-
}
|
|
53
|
-
get maxCacheByteSize() {
|
|
54
|
-
return t(this, f).maxCacheByteSize ?? Number.POSITIVE_INFINITY;
|
|
55
|
-
}
|
|
56
|
-
/** The matrices, from `corpus.tileMatrix(type)`. A new set empties the cache. */
|
|
57
|
-
setMatrix(e) {
|
|
58
|
-
e !== t(this, z) && (l(this, z, e), this.finalize(), l(this, x, !0));
|
|
59
|
-
}
|
|
60
|
-
/** The tiles `scan.plan()` kept, by zoom — asked once per question, never per camera move. */
|
|
61
|
-
setPlan(e) {
|
|
62
|
-
const i = /* @__PURE__ */ new Map();
|
|
63
|
-
for (const { tile: s, z: r } of e) {
|
|
64
|
-
let n = i.get(r);
|
|
65
|
-
n || i.set(r, n = /* @__PURE__ */ new Set()), n.add(s);
|
|
66
|
-
}
|
|
67
|
-
l(this, g, i), l(this, x, !0);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* The question changed: every tile is marked for reload and keeps its content until the new
|
|
71
|
-
* answer arrives — `TileLayer`'s `reloadAll` when its `data` moves. A cached tile that is not
|
|
72
|
-
* selected is dropped, since nothing will ask it again under the old question.
|
|
73
|
-
*/
|
|
74
|
-
reloadAll() {
|
|
75
|
-
var e, i;
|
|
76
|
-
for (const [s, r] of t(this, h))
|
|
77
|
-
t(this, u).includes(r) ? r.setNeedsReload() : (r.abort(), t(this, h).delete(s), (i = (e = t(this, f)).onTileUnload) == null || i.call(e, r));
|
|
78
|
-
d(this, a, C).call(this), l(this, x, !0);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Select what the viewport needs and refine; returns a frame number that moves whenever the
|
|
82
|
-
* visible set may have changed.
|
|
83
|
-
*/
|
|
84
|
-
update(e, i) {
|
|
85
|
-
const s = t(this, z);
|
|
86
|
-
if (!s) return t(this, M);
|
|
87
|
-
if (t(this, x) || i !== t(this, b) || !t(this, m) || e.xMin !== t(this, m).xMin || e.yMin !== t(this, m).yMin || e.xMax !== t(this, m).xMax || e.yMax !== t(this, m).yMax) {
|
|
88
|
-
l(this, x, !1), l(this, m, e), l(this, b, i);
|
|
89
|
-
const n = U(s, e, i, t(this, g));
|
|
90
|
-
l(this, S, (n == null ? void 0 : n.z) ?? null);
|
|
91
|
-
const V = n ? n.tiles.map((p) => ({ type: s.type, z: n.z, tile: p })) : [];
|
|
92
|
-
for (const p of t(this, u)) p.isSelected = !1;
|
|
93
|
-
l(this, u, V.map((p) => d(this, a, R).call(this, p)));
|
|
94
|
-
for (const p of t(this, u)) p.isSelected = !0;
|
|
95
|
-
d(this, a, C).call(this), d(this, a, q).call(this);
|
|
96
|
-
}
|
|
97
|
-
return d(this, a, v).call(this);
|
|
98
|
-
}
|
|
99
|
-
/** Re-run refinement after a load, with no change of viewport. */
|
|
100
|
-
refresh() {
|
|
101
|
-
return d(this, a, v).call(this);
|
|
102
|
-
}
|
|
103
|
-
/** Abort everything and forget the cache. */
|
|
104
|
-
finalize() {
|
|
105
|
-
for (const e of t(this, h).values()) e.abort();
|
|
106
|
-
t(this, y).clear(), t(this, h).clear(), l(this, u, []), l(this, S, null), l(this, x, !0);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
f = new WeakMap(), y = new WeakMap(), h = new WeakMap(), z = new WeakMap(), g = new WeakMap(), u = new WeakMap(), m = new WeakMap(), b = new WeakMap(), S = new WeakMap(), x = new WeakMap(), M = new WeakMap(), T = new WeakMap(), a = new WeakSet(), v = function() {
|
|
110
|
-
$(t(this, h).values()), d(this, a, B).call(this), d(this, a, N).call(this);
|
|
111
|
-
const e = (s) => `${s.id}${s.isVisible ? "+" : ""}${s.isSelected ? "*" : ""}:${s.content ? 1 : 0}`, i = [...t(this, h).values()].map(e).join(",");
|
|
112
|
-
return i !== t(this, T) && (l(this, T, i), l(this, M, t(this, M) + 1)), t(this, M);
|
|
113
|
-
}, R = function(e) {
|
|
114
|
-
const i = E(e);
|
|
115
|
-
let s = t(this, h).get(i);
|
|
116
|
-
return s || (s = new O(e), t(this, h).set(i, s)), s;
|
|
117
|
-
}, q = function() {
|
|
118
|
-
for (const e of t(this, u))
|
|
119
|
-
e.isLoaded || e.isLoading || e.loadData({
|
|
120
|
-
scheduler: t(this, y),
|
|
121
|
-
priority: (i) => d(this, a, A).call(this, i),
|
|
122
|
-
onLoad: (i) => {
|
|
123
|
-
var s, r;
|
|
124
|
-
return (r = (s = t(this, f)).onTileLoad) == null ? void 0 : r.call(s, i);
|
|
125
|
-
},
|
|
126
|
-
onError: (i, s) => {
|
|
127
|
-
var r, n;
|
|
128
|
-
return (n = (r = t(this, f)).onTileError) == null ? void 0 : n.call(r, i, s);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}, /** `_getRequestPriority`: `-1` drops a tile nobody wants; the rest go nearest the centre first. */
|
|
132
|
-
A = function(e) {
|
|
133
|
-
if (!e.isSelected && !e.isVisible) return -1;
|
|
134
|
-
const i = t(this, z), s = t(this, m);
|
|
135
|
-
if (!i || !s) return 0;
|
|
136
|
-
const r = _(i, e.address);
|
|
137
|
-
return r ? Math.hypot(r[0] - (s.xMin + s.xMax) / 2, r[1] - (s.yMin + s.yMax) / 2) : 0;
|
|
138
|
-
}, /**
|
|
139
|
-
* Always, where deck.gl waits for `maxRequests` to be exceeded: the one slot is the only one. A
|
|
140
|
-
* batch is the unit aborted, so a tile nobody wants rides out a batch somebody else still does.
|
|
141
|
-
*/
|
|
142
|
-
B = function() {
|
|
143
|
-
t(this, y).prune();
|
|
144
|
-
}, /** Evicts tiles neither visible nor selected, in insertion order — deck.gl's, and not LRU. */
|
|
145
|
-
N = function() {
|
|
146
|
-
var i, s;
|
|
147
|
-
let e = 0;
|
|
148
|
-
for (const r of t(this, h).values()) e += r.byteLength;
|
|
149
|
-
if (!(t(this, h).size <= this.maxCacheSize && e <= this.maxCacheByteSize)) {
|
|
150
|
-
for (const [r, n] of t(this, h)) {
|
|
151
|
-
if (t(this, h).size <= this.maxCacheSize && e <= this.maxCacheByteSize) break;
|
|
152
|
-
n.isVisible || n.isSelected || (e -= n.byteLength, n.abort(), t(this, h).delete(r), (s = (i = t(this, f)).onTileUnload) == null || s.call(i, n));
|
|
153
|
-
}
|
|
154
|
-
d(this, a, C).call(this);
|
|
155
|
-
}
|
|
156
|
-
}, /** Each tile's parent is its nearest ancestor in the cache — `_rebuildTree`. */
|
|
157
|
-
C = function() {
|
|
158
|
-
const e = t(this, z);
|
|
159
|
-
for (const i of t(this, h).values())
|
|
160
|
-
i.parent = null, i.children = [];
|
|
161
|
-
if (e)
|
|
162
|
-
for (const i of t(this, h).values()) {
|
|
163
|
-
let s = I(e, i.address);
|
|
164
|
-
for (; s; ) {
|
|
165
|
-
const r = t(this, h).get(E(s));
|
|
166
|
-
if (r) {
|
|
167
|
-
i.parent = r, r.children.push(i);
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
s = I(e, s);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
export {
|
|
175
|
-
Z as Tileset2D
|
|
176
|
-
};
|
|
177
|
-
//# sourceMappingURL=tileset.js.map
|
package/dist/core/tileset.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tileset.js","sources":["../../src/core/tileset.ts"],"sourcesContent":["import type { TileAddress, TileMatrixSet } from \"@fossil-lang/corpus\";\nimport { refine } from \"./refine\";\nimport { RequestScheduler } from \"./scheduler\";\nimport { Tile, type TileContent, type TileLoader } from \"./tile\";\nimport { centreOf, parentOf, selectLevel, tileId, type Viewport } from \"./tile-matrix\";\n\n/** deck.gl's `DEFAULT_CACHE_SCALE`: the cache holds five times what is selected. */\nconst DEFAULT_CACHE_SCALE = 5;\n\nexport interface TilesetOptions {\n load: TileLoader;\n onTileLoad?: (tile: Tile) => void;\n onTileError?: (error: unknown, tile: Tile) => void;\n onTileUnload?: (tile: Tile) => void;\n /** Tiles kept; five times the selected count when absent. */\n maxCacheSize?: number;\n /** Bytes kept; unbounded when absent. */\n maxCacheByteSize?: number;\n /** Batches in flight — one: see `RequestScheduler`. */\n maxRequests?: number;\n debounceTime?: number;\n}\n\n/**\n * **deck.gl's `Tileset2D` with the loader swapped for the corpus** — `modules/geo-layers/src/\n * tileset-2d/tileset-2d.ts`, its names kept so either can be read from the other.\n *\n * `update(viewport)` selects, then sets tile states, then prunes requests, then resizes the cache,\n * in deck.gl's order. Where it departs is `/docs/design/graph`'s table: a tile is fossil's\n * `{ type, z, tile }`, the level is chosen by published row counts, a tile is in view by its\n * published box, and the tiles wanted in one tick are read as one batch, whose read is aborted once\n * no tile in it is wanted.\n */\nexport class Tileset2D {\n readonly #options: TilesetOptions;\n readonly #scheduler: RequestScheduler<Tile, TileContent>;\n readonly #cache = new Map<string, Tile>();\n #matrix: TileMatrixSet | null = null;\n #planned: ReadonlyMap<number, ReadonlySet<number>> = new Map();\n #selected: Tile[] = [];\n #viewport: Viewport | null = null;\n #limit = 0;\n #z: number | null = null;\n #stale = true;\n #frame = 0;\n #signature = \"\";\n\n constructor(options: TilesetOptions) {\n this.#options = options;\n this.#scheduler = new RequestScheduler({\n run: (tiles, signal) => options.load(tiles.map((tile) => tile.address), signal),\n debounceTime: options.debounceTime,\n maxRequests: options.maxRequests ?? 1,\n });\n }\n\n get tiles(): Tile[] {\n return [...this.#cache.values()].sort((a, b) => a.z - b.z);\n }\n\n get selectedTiles(): readonly Tile[] {\n return this.#selected;\n }\n\n /** Moves whenever the selected or visible set, or what a tile holds, may have changed. */\n get frame(): number {\n return this.#frame;\n }\n\n /** The zoom the last selection chose, or `null` before one. */\n get z(): number | null {\n return this.#z;\n }\n\n get isLoaded(): boolean {\n return this.#selected.every((tile) => tile.isLoaded);\n }\n\n get maxCacheSize(): number {\n return this.#options.maxCacheSize ?? DEFAULT_CACHE_SCALE * Math.max(1, this.#selected.length);\n }\n\n get maxCacheByteSize(): number {\n return this.#options.maxCacheByteSize ?? Number.POSITIVE_INFINITY;\n }\n\n /** The matrices, from `corpus.tileMatrix(type)`. A new set empties the cache. */\n setMatrix(matrix: TileMatrixSet): void {\n if (matrix === this.#matrix) return;\n this.#matrix = matrix;\n this.finalize();\n this.#stale = true;\n }\n\n /** The tiles `scan.plan()` kept, by zoom — asked once per question, never per camera move. */\n setPlan(planned: readonly TileAddress[]): void {\n const byZoom = new Map<number, Set<number>>();\n for (const { tile, z } of planned) {\n let tiles = byZoom.get(z);\n if (!tiles) byZoom.set(z, (tiles = new Set()));\n tiles.add(tile);\n }\n this.#planned = byZoom;\n this.#stale = true;\n }\n\n /**\n * The question changed: every tile is marked for reload and keeps its content until the new\n * answer arrives — `TileLayer`'s `reloadAll` when its `data` moves. A cached tile that is not\n * selected is dropped, since nothing will ask it again under the old question.\n */\n reloadAll(): void {\n for (const [id, tile] of this.#cache) {\n if (!this.#selected.includes(tile)) {\n tile.abort();\n this.#cache.delete(id);\n this.#options.onTileUnload?.(tile);\n } else {\n tile.setNeedsReload();\n }\n }\n this.#rebuildTree();\n this.#stale = true;\n }\n\n /**\n * Select what the viewport needs and refine; returns a frame number that moves whenever the\n * visible set may have changed.\n */\n update(viewport: Viewport, limit: number): number {\n const matrix = this.#matrix;\n if (!matrix) return this.#frame;\n const moved =\n this.#stale ||\n limit !== this.#limit ||\n !this.#viewport ||\n viewport.xMin !== this.#viewport.xMin ||\n viewport.yMin !== this.#viewport.yMin ||\n viewport.xMax !== this.#viewport.xMax ||\n viewport.yMax !== this.#viewport.yMax;\n if (moved) {\n this.#stale = false;\n this.#viewport = viewport;\n this.#limit = limit;\n const level = selectLevel(matrix, viewport, limit, this.#planned);\n this.#z = level?.z ?? null;\n const wanted = level ? level.tiles.map((tile) => ({ type: matrix.type, z: level.z, tile })) : [];\n for (const tile of this.#selected) tile.isSelected = false;\n this.#selected = wanted.map((address) => this.#getTile(address));\n for (const tile of this.#selected) tile.isSelected = true;\n this.#rebuildTree();\n this.#loadSelected();\n }\n return this.#refresh();\n }\n\n /** Re-run refinement after a load, with no change of viewport. */\n refresh(): number {\n return this.#refresh();\n }\n\n /** Abort everything and forget the cache. */\n finalize(): void {\n for (const tile of this.#cache.values()) tile.abort();\n this.#scheduler.clear();\n this.#cache.clear();\n this.#selected = [];\n this.#z = null;\n this.#stale = true;\n }\n\n #refresh(): number {\n refine(this.#cache.values());\n this.#pruneRequests();\n this.#resizeCache();\n const shown = (tile: Tile) => `${tile.id}${tile.isVisible ? \"+\" : \"\"}${tile.isSelected ? \"*\" : \"\"}:${tile.content ? 1 : 0}`;\n const signature = [...this.#cache.values()].map(shown).join(\",\");\n if (signature !== this.#signature) {\n this.#signature = signature;\n this.#frame += 1;\n }\n return this.#frame;\n }\n\n #getTile(address: TileAddress): Tile {\n const id = tileId(address);\n let tile = this.#cache.get(id);\n if (!tile) {\n tile = new Tile(address);\n this.#cache.set(id, tile);\n }\n return tile;\n }\n\n #loadSelected(): void {\n for (const tile of this.#selected) {\n if (tile.isLoaded || tile.isLoading) continue;\n void tile.loadData({\n scheduler: this.#scheduler,\n priority: (t) => this.#priority(t),\n onLoad: (t) => this.#options.onTileLoad?.(t),\n onError: (error, t) => this.#options.onTileError?.(error, t),\n });\n }\n }\n\n /** `_getRequestPriority`: `-1` drops a tile nobody wants; the rest go nearest the centre first. */\n #priority(tile: Tile): number {\n if (!tile.isSelected && !tile.isVisible) return -1;\n const matrix = this.#matrix;\n const view = this.#viewport;\n if (!matrix || !view) return 0;\n const centre = centreOf(matrix, tile.address);\n if (!centre) return 0;\n return Math.hypot(centre[0] - (view.xMin + view.xMax) / 2, centre[1] - (view.yMin + view.yMax) / 2);\n }\n\n /**\n * Always, where deck.gl waits for `maxRequests` to be exceeded: the one slot is the only one. A\n * batch is the unit aborted, so a tile nobody wants rides out a batch somebody else still does.\n */\n #pruneRequests(): void {\n this.#scheduler.prune();\n }\n\n /** Evicts tiles neither visible nor selected, in insertion order — deck.gl's, and not LRU. */\n #resizeCache(): void {\n let bytes = 0;\n for (const tile of this.#cache.values()) bytes += tile.byteLength;\n if (this.#cache.size <= this.maxCacheSize && bytes <= this.maxCacheByteSize) return;\n for (const [id, tile] of this.#cache) {\n if (this.#cache.size <= this.maxCacheSize && bytes <= this.maxCacheByteSize) break;\n if (tile.isVisible || tile.isSelected) continue;\n bytes -= tile.byteLength;\n tile.abort();\n this.#cache.delete(id);\n this.#options.onTileUnload?.(tile);\n }\n this.#rebuildTree();\n }\n\n /** Each tile's parent is its nearest ancestor in the cache — `_rebuildTree`. */\n #rebuildTree(): void {\n const matrix = this.#matrix;\n for (const tile of this.#cache.values()) {\n tile.parent = null;\n tile.children = [];\n }\n if (!matrix) return;\n for (const tile of this.#cache.values()) {\n let up = parentOf(matrix, tile.address);\n while (up) {\n const found = this.#cache.get(tileId(up));\n if (found) {\n tile.parent = found;\n found.children.push(tile);\n break;\n }\n up = parentOf(matrix, up);\n }\n }\n }\n}\n"],"names":["DEFAULT_CACHE_SCALE","Tileset2D","options","__privateAdd","_Tileset2D_instances","_options","_scheduler","_cache","_matrix","_planned","_selected","_viewport","_limit","_z","_stale","_frame","_signature","__privateSet","RequestScheduler","tiles","signal","tile","__privateGet","a","b","matrix","planned","byZoom","z","id","_b","_a","__privateMethod","rebuildTree_fn","viewport","limit","level","selectLevel","wanted","address","getTile_fn","loadSelected_fn","refresh_fn","refine","pruneRequests_fn","resizeCache_fn","shown","signature","tileId","Tile","t","priority_fn","error","view","centre","centre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B,IAAS,iBAAd,QAAAyB,EAAA,KAAAC,GAA6BV;AAAA,IAC/B;AACA,IAAAW,EAAA,MAAK5B,GAAA6B,GAAL;AAAA;AACF;AAGAA,IAAA,WAAqB;AACnB,QAAMR,IAASH,EAAA,MAAKd;AACpB,aAAWa,KAAQC,EAAA,MAAKf,GAAO,OAAA;AAC7B,IAAAc,EAAK,SAAS,MACdA,EAAK,WAAW,CAAA;AAElB,MAAKI;AACL,eAAWJ,KAAQC,EAAA,MAAKf,GAAO,OAAA,GAAU;AACvC,UAAIkD,IAAKC,EAASjC,GAAQJ,EAAK,OAAO;AACtC,aAAOoC,KAAI;AACT,cAAME,IAAQrC,EAAA,MAAKf,GAAO,IAAIyC,EAAOS,CAAE,CAAC;AACxC,YAAIE,GAAO;AACT,UAAAtC,EAAK,SAASsC,GACdA,EAAM,SAAS,KAAKtC,CAAI;AACxB;AAAA,QACF;AACA,QAAAoC,IAAKC,EAASjC,GAAQgC,CAAE;AAAA,MAC1B;AAAA,IACF;AACF;"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Sim } from './graph-sim';
|
|
2
|
-
/**
|
|
3
|
-
* The coefficients and the drawing options a graph this size wants.
|
|
4
|
-
*
|
|
5
|
-
* Returned together because they are one judgement asked of one number, and splitting them into two
|
|
6
|
-
* exports that must be called with the same argument is how they drift apart. The caller still keeps
|
|
7
|
-
* them apart downstream — a `Sim` rebuilds nothing and `links` is a uniform — which is the split
|
|
8
|
-
* that actually costs something.
|
|
9
|
-
*
|
|
10
|
-
* **The mark scale left with `Display`.** This used to answer a `pointScale` too, interpolated from
|
|
11
|
-
* 1.5 to 0.5 with the corpus, and nothing ever called it: the field it fed was a reader's multiplier
|
|
12
|
-
* over the radius ramp `lookFrom` computes from `marks`, and two ways to size a mark is one too
|
|
13
|
-
* many. What a host with a large corpus wants is the tenant policy — *start your users here* — over
|
|
14
|
-
* the declared axes, which is where a computed fit belongs.
|
|
15
|
-
*
|
|
16
|
-
* **`spaceSize` is deliberately not here.** The original scaled the simulation box from 2,048 to
|
|
17
|
-
* 8,192 with the corpus, which is coherent when a layout is computed on the fly and incoherent once
|
|
18
|
-
* positions are authority: the box is the coordinate space a source's positions are expressed in and
|
|
19
|
-
* a spatial query is asked against, so resizing it by node count would move the index under the
|
|
20
|
-
* camera. It is not a constant of ours either, for the same reason turned around — it is the
|
|
21
|
-
* tile matrix's extent, and the renderer sets it from there.
|
|
22
|
-
*/
|
|
23
|
-
export declare function adaptive(nodes: number): {
|
|
24
|
-
sim: Sim;
|
|
25
|
-
links: boolean;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=adaptive.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adaptive.d.ts","sourceRoot":"","sources":["../../src/render/adaptive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAgCvC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAgBpE"}
|
package/dist/render/adaptive.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const r = (t, n, a) => Math.min(a, Math.max(n, t)), i = (t, n, a) => t + (n - t) * r(a, 0, 1);
|
|
2
|
-
function c(t) {
|
|
3
|
-
return r((Math.log10(Math.max(t, 1)) - 1) / 4, 0, 1);
|
|
4
|
-
}
|
|
5
|
-
function e(t) {
|
|
6
|
-
const n = c(t);
|
|
7
|
-
return {
|
|
8
|
-
sim: {
|
|
9
|
-
// Bigger graphs need less push and more damping, or they never settle.
|
|
10
|
-
repulsion: i(1.2, 0.4, n),
|
|
11
|
-
friction: i(0.7, 0.92, n),
|
|
12
|
-
linkSpring: i(0.5, 0.25, n),
|
|
13
|
-
linkDistance: i(30, 12, n),
|
|
14
|
-
gravity: i(0.35, 0.08, n),
|
|
15
|
-
cluster: 0.15
|
|
16
|
-
},
|
|
17
|
-
// Past a quarter of a million links the edge layer is fog, and fog costs a draw call per frame
|
|
18
|
-
// to render. Below it, links are most of what a reader is actually looking at.
|
|
19
|
-
links: t < 25e4
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
e as adaptive
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=adaptive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adaptive.js","sources":["../../src/render/adaptive.ts"],"sourcesContent":["import type { Sim } from \"./graph-sim\";\n\n/**\n * How a graph of *this size* should be drawn — force coefficients and two render\n * switches, interpolated continuously against node count.\n *\n * Absorbed from `@fossil-lang/viewer`'s `getAdaptiveConfig` when fossil stopped shipping a viewer, which filed it under\n * \"level-of-detail policy\". Reading it, that is not quite what it is, and the difference matters:\n * almost all of it is **simulation tuning** — repulsion, friction, spring, gravity — plus two\n * genuinely render-side switches. Level of detail in the bounded sense is the zoom of fossil's cell\n * pyramid the tileset draws at, and is a different mechanism entirely.\n *\n * That means most of this only applies under `simulate: true`, which ADR-0001 made the opt-in case.\n * It is still worth having: the host with arrays in hand and no precomputed layout is exactly the\n * host that runs a live simulation, and one set of production-tuned numbers beats each call site\n * inventing its own.\n *\n * **The continuous interpolation is the design**, not an implementation detail. Breakpoints snap —\n * a graph crossing 10,000 nodes would visibly jump — and Cosmograph 1.x is the cautionary example.\n * The constants are tuned across 10 to 100,000 nodes and divergence from them is a defect.\n */\n\nconst clamp = (value: number, lo: number, hi: number): number =>\n Math.min(hi, Math.max(lo, value));\n\nconst lerp = (a: number, b: number, t: number): number => a + (b - a) * clamp(t, 0, 1);\n\n/** `0` at about ten nodes, `1` at about a hundred thousand — log₁₀, because node counts are. */\nfunction scaleOfCount(nodes: number): number {\n return clamp((Math.log10(Math.max(nodes, 1)) - 1) / 4, 0, 1);\n}\n\n/**\n * The coefficients and the drawing options a graph this size wants.\n *\n * Returned together because they are one judgement asked of one number, and splitting them into two\n * exports that must be called with the same argument is how they drift apart. The caller still keeps\n * them apart downstream — a `Sim` rebuilds nothing and `links` is a uniform — which is the split\n * that actually costs something.\n *\n * **The mark scale left with `Display`.** This used to answer a `pointScale` too, interpolated from\n * 1.5 to 0.5 with the corpus, and nothing ever called it: the field it fed was a reader's multiplier\n * over the radius ramp `lookFrom` computes from `marks`, and two ways to size a mark is one too\n * many. What a host with a large corpus wants is the tenant policy — *start your users here* — over\n * the declared axes, which is where a computed fit belongs.\n *\n * **`spaceSize` is deliberately not here.** The original scaled the simulation box from 2,048 to\n * 8,192 with the corpus, which is coherent when a layout is computed on the fly and incoherent once\n * positions are authority: the box is the coordinate space a source's positions are expressed in and\n * a spatial query is asked against, so resizing it by node count would move the index under the\n * camera. It is not a constant of ours either, for the same reason turned around — it is the\n * tile matrix's extent, and the renderer sets it from there.\n */\nexport function adaptive(nodes: number): { sim: Sim; links: boolean } {\n const t = scaleOfCount(nodes);\n return {\n sim: {\n // Bigger graphs need less push and more damping, or they never settle.\n repulsion: lerp(1.2, 0.4, t),\n friction: lerp(0.7, 0.92, t),\n linkSpring: lerp(0.5, 0.25, t),\n linkDistance: lerp(30, 12, t),\n gravity: lerp(0.35, 0.08, t),\n cluster: 0.15,\n },\n // Past a quarter of a million links the edge layer is fog, and fog costs a draw call per frame\n // to render. Below it, links are most of what a reader is actually looking at.\n links: nodes < 250_000,\n };\n}\n"],"names":["clamp","value","lo","hi","lerp","a","b","t","scaleOfCount","nodes","adaptive"],"mappings":"AAsBA,MAAMA,IAAQ,CAACC,GAAeC,GAAYC,MACxC,KAAK,IAAIA,GAAI,KAAK,IAAID,GAAID,CAAK,CAAC,GAE5BG,IAAO,CAACC,GAAWC,GAAWC,MAAsBF,KAAKC,IAAID,KAAKL,EAAMO,GAAG,GAAG,CAAC;AAGrF,SAASC,EAAaC,GAAuB;AAC3C,SAAOT,GAAO,KAAK,MAAM,KAAK,IAAIS,GAAO,CAAC,CAAC,IAAI,KAAK,GAAG,GAAG,CAAC;AAC7D;AAuBO,SAASC,EAASD,GAA6C;AACpE,QAAMF,IAAIC,EAAaC,CAAK;AAC5B,SAAO;AAAA,IACL,KAAK;AAAA;AAAA,MAEH,WAAWL,EAAK,KAAK,KAAKG,CAAC;AAAA,MAC3B,UAAUH,EAAK,KAAK,MAAMG,CAAC;AAAA,MAC3B,YAAYH,EAAK,KAAK,MAAMG,CAAC;AAAA,MAC7B,cAAcH,EAAK,IAAI,IAAIG,CAAC;AAAA,MAC5B,SAASH,EAAK,MAAM,MAAMG,CAAC;AAAA,MAC3B,SAAS;AAAA,IAAA;AAAA;AAAA;AAAA,IAIX,OAAOE,IAAQ;AAAA,EAAA;AAEnB;"}
|
package/dist/render/compose.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { TileMatrixSet } from '@fossil-lang/corpus';
|
|
2
|
-
import { Binding } from '../core/channels';
|
|
3
|
-
import { Resident } from '../core/resident';
|
|
4
|
-
import { TileView } from '../core/store';
|
|
5
|
-
/** An edge shorter than this many screen pixels is a dot on its own ends, and is not composed. */
|
|
6
|
-
export declare const MIN_LINK_PIXELS = 3;
|
|
7
|
-
/** One buffer set for one cosmos.gl instance. */
|
|
8
|
-
export interface Composition {
|
|
9
|
-
/** `[x, y, …]`: vertices first, then cells, then far ends drawn only so an edge has one. */
|
|
10
|
-
readonly positions: Float32Array;
|
|
11
|
-
/** `[src, dst, …]` as indices into `positions`. */
|
|
12
|
-
readonly links: Float32Array;
|
|
13
|
-
/** How many edges each link stands for; `null` when every link is one edge. */
|
|
14
|
-
readonly weights: Float32Array | null;
|
|
15
|
-
/** Slots that are drawn — vertices and cells. Past it, far ends. */
|
|
16
|
-
readonly marks: number;
|
|
17
|
-
/** How many of the marks are vertices; cells follow them. */
|
|
18
|
-
readonly vertices: number;
|
|
19
|
-
readonly resident: Resident;
|
|
20
|
-
/** Per slot: the category's rank, or `0` when nothing is bound. */
|
|
21
|
-
readonly categories: Uint32Array;
|
|
22
|
-
/** Per slot: the ramp's raw value, or `null` when nothing is bound. */
|
|
23
|
-
readonly sizes: Float32Array | null;
|
|
24
|
-
/** Per vertex slot: its title, when `title` is bound. */
|
|
25
|
-
readonly titles: readonly string[] | null;
|
|
26
|
-
/** What each rank is, for a legend: the seed, then the other values seen, in rank order. */
|
|
27
|
-
readonly domain: readonly unknown[];
|
|
28
|
-
/** Per rank, the vertices the marks of that rank stand for. */
|
|
29
|
-
readonly tally: readonly number[];
|
|
30
|
-
/** Vertices the marks stand for — a cell counts its members. */
|
|
31
|
-
readonly represented: number;
|
|
32
|
-
}
|
|
33
|
-
export interface ComposeInput {
|
|
34
|
-
readonly matrix: TileMatrixSet;
|
|
35
|
-
readonly typeIndex: number;
|
|
36
|
-
readonly binding: Binding;
|
|
37
|
-
readonly modeColumn: string | null;
|
|
38
|
-
/** The categorical domain fixed before any tile: it ranks first, in its own order. */
|
|
39
|
-
readonly domain: readonly unknown[];
|
|
40
|
-
readonly visible: readonly TileView[];
|
|
41
|
-
readonly cached: readonly TileView[];
|
|
42
|
-
/** Graph units per screen pixel when composed, for the stub discard. */
|
|
43
|
-
readonly perPixel: number;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* **Visible tiles → one buffer set.** cosmos.gl replaces a whole buffer per setter, so what changed
|
|
47
|
-
* is decided at the granularity it offers: the set of tiles. The same visible set under the same
|
|
48
|
-
* binding composes to `null` — nothing new, and nothing to upload.
|
|
49
|
-
*/
|
|
50
|
-
export declare function createComposer(): (input: ComposeInput) => Composition | null;
|
|
51
|
-
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/render/compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAA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AO,EAAE,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC;IACrC,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,CAAC,KAAK,EAAE,YAAY,KAAK,WAAW,GAAG,IAAI,CA+B5E"}
|
package/dist/render/compose.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { vertexId as X, residentOf as Z } from "../core/resident.js";
|
|
2
|
-
import { Dictionary as S, encode as q } from "./encode.js";
|
|
3
|
-
const G = 3;
|
|
4
|
-
function ee() {
|
|
5
|
-
let i = "", a = new S(), h = [], y = /* @__PURE__ */ new WeakMap(), m = "";
|
|
6
|
-
const w = (n, s) => {
|
|
7
|
-
let l = y.get(n.content);
|
|
8
|
-
return l || (l = q(n, s.binding, a, s.modeColumn), y.set(n.content, l)), l;
|
|
9
|
-
};
|
|
10
|
-
return (n) => {
|
|
11
|
-
const s = `${n.binding.category}|${n.binding.size}|${n.binding.title}|${n.modeColumn}`;
|
|
12
|
-
(s !== i || n.domain !== h) && (i = s, h = n.domain, a = new S(h), y = /* @__PURE__ */ new WeakMap(), m = "");
|
|
13
|
-
const l = n.visible.map((u) => J(u.content)).join(",");
|
|
14
|
-
if (l === m) return null;
|
|
15
|
-
m = l;
|
|
16
|
-
const p = n.visible.map((u) => ({ view: u, encoded: w(u, n) }));
|
|
17
|
-
return Q(n, p, a, w);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const U = /* @__PURE__ */ new WeakMap();
|
|
21
|
-
let H = 1;
|
|
22
|
-
function J(i) {
|
|
23
|
-
let a = U.get(i);
|
|
24
|
-
return a === void 0 && U.set(i, a = H++), a;
|
|
25
|
-
}
|
|
26
|
-
function Q(i, a, h, y) {
|
|
27
|
-
var B, P;
|
|
28
|
-
const m = [...a].sort((e, t) => Number(e.encoded.cells) - Number(t.encoded.cells));
|
|
29
|
-
let w = 0, n = 0;
|
|
30
|
-
for (const { encoded: e } of m)
|
|
31
|
-
w += e.n, e.cells || (n += e.n);
|
|
32
|
-
const s = [], l = [], p = [], u = [], x = [], A = new BigUint64Array(n), $ = /* @__PURE__ */ new Map(), I = (e) => {
|
|
33
|
-
let t = $.get(e);
|
|
34
|
-
return t || $.set(e, t = /* @__PURE__ */ new Map()), t;
|
|
35
|
-
}, z = (e, t, o) => {
|
|
36
|
-
var c, d;
|
|
37
|
-
const r = s.length / 2;
|
|
38
|
-
return s.push(t.positions[o * 2], t.positions[o * 2 + 1]), l.push(((c = t.codes) == null ? void 0 : c[o]) ?? 0), p.push(((d = t.sizes) == null ? void 0 : d[o]) ?? 0), I(e).set(t.keys[o], r), r;
|
|
39
|
-
};
|
|
40
|
-
let F = 0;
|
|
41
|
-
for (const { encoded: e, view: t } of m)
|
|
42
|
-
for (let o = 0; o < e.n; o++) {
|
|
43
|
-
const r = z(t.address.z, e, o), c = e.counts[o] ?? 0;
|
|
44
|
-
x[r] = c, F += c, e.cells || (A[r] = X(i.typeIndex, e.keys[o]), u.push(((B = e.titles) == null ? void 0 : B[o]) ?? ""));
|
|
45
|
-
}
|
|
46
|
-
const v = /* @__PURE__ */ new Map();
|
|
47
|
-
for (const e of i.cached) {
|
|
48
|
-
let t = v.get(e.address.z);
|
|
49
|
-
t || v.set(e.address.z, t = /* @__PURE__ */ new Map()), t.set(e.address.tile, e);
|
|
50
|
-
}
|
|
51
|
-
const N = (e, t) => {
|
|
52
|
-
var k, g;
|
|
53
|
-
const o = I(e).get(t);
|
|
54
|
-
if (o !== void 0) return o;
|
|
55
|
-
const r = ((k = i.matrix.tileMatrices[e]) == null ? void 0 : k.tileRows) ?? 1, c = (g = v.get(e)) == null ? void 0 : g.get(Math.floor(t / r));
|
|
56
|
-
if (!c) return;
|
|
57
|
-
const d = y(c, i);
|
|
58
|
-
for (let f = 0; f < d.n; f++) if (d.keys[f] === t) return z(e, d, f);
|
|
59
|
-
}, _ = G * i.perPixel, C = [], E = [], K = /* @__PURE__ */ new Set();
|
|
60
|
-
let L = !1;
|
|
61
|
-
for (const { encoded: e, view: t } of m) {
|
|
62
|
-
const { z: o } = t.address;
|
|
63
|
-
for (let r = 0; r < e.links.length / 2; r++) {
|
|
64
|
-
const c = e.links[r * 2], d = e.links[r * 2 + 1];
|
|
65
|
-
if (c === d) continue;
|
|
66
|
-
const k = `${o}:${c}:${d}`;
|
|
67
|
-
if (K.has(k)) continue;
|
|
68
|
-
const g = N(o, c), f = N(o, d);
|
|
69
|
-
if (g === void 0 || f === void 0) continue;
|
|
70
|
-
K.add(k);
|
|
71
|
-
const D = s[g * 2] - s[f * 2], R = s[g * 2 + 1] - s[f * 2 + 1];
|
|
72
|
-
if (Math.hypot(D, R) < _) continue;
|
|
73
|
-
C.push(g, f);
|
|
74
|
-
const T = ((P = e.weights) == null ? void 0 : P[r]) ?? 1;
|
|
75
|
-
e.weights && (L = !0), E.push(T);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const O = h.ranks(), W = Uint32Array.from(l, (e) => O[e] ?? 0), b = [];
|
|
79
|
-
O.forEach((e, t) => {
|
|
80
|
-
b[e] = h.values[t];
|
|
81
|
-
});
|
|
82
|
-
const M = b.map(() => 0);
|
|
83
|
-
for (let e = 0; e < w; e++) {
|
|
84
|
-
const t = W[e] ?? 0;
|
|
85
|
-
M[t] = (M[t] ?? 0) + (x[e] ?? 0);
|
|
86
|
-
}
|
|
87
|
-
const j = m.some(({ encoded: e }) => e.sizes !== null);
|
|
88
|
-
return {
|
|
89
|
-
positions: Float32Array.from(s),
|
|
90
|
-
links: Float32Array.from(C),
|
|
91
|
-
weights: L ? Float32Array.from(E) : null,
|
|
92
|
-
marks: w,
|
|
93
|
-
vertices: n,
|
|
94
|
-
resident: Z(A, n),
|
|
95
|
-
categories: W,
|
|
96
|
-
sizes: j ? Float32Array.from(p) : null,
|
|
97
|
-
titles: i.binding.title === void 0 ? null : u,
|
|
98
|
-
domain: b,
|
|
99
|
-
tally: M,
|
|
100
|
-
represented: F
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
export {
|
|
104
|
-
G as MIN_LINK_PIXELS,
|
|
105
|
-
ee as createComposer
|
|
106
|
-
};
|
|
107
|
-
//# sourceMappingURL=compose.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compose.js","sources":["../../src/render/compose.ts"],"sourcesContent":["import type { TileMatrixSet } from \"@fossil-lang/corpus\";\nimport type { Binding } from \"../core/channels\";\nimport { residentOf, vertexId, type Resident } from \"../core/resident\";\nimport type { TileContent } from \"../core/tile\";\nimport type { TileView } from \"../core/store\";\nimport { Dictionary, encode, type Encoded } from \"./encode\";\n\n/** An edge shorter than this many screen pixels is a dot on its own ends, and is not composed. */\nexport const MIN_LINK_PIXELS = 3;\n\n/** One buffer set for one cosmos.gl instance. */\nexport interface Composition {\n /** `[x, y, …]`: vertices first, then cells, then far ends drawn only so an edge has one. */\n readonly positions: Float32Array;\n /** `[src, dst, …]` as indices into `positions`. */\n readonly links: Float32Array;\n /** How many edges each link stands for; `null` when every link is one edge. */\n readonly weights: Float32Array | null;\n /** Slots that are drawn — vertices and cells. Past it, far ends. */\n readonly marks: number;\n /** How many of the marks are vertices; cells follow them. */\n readonly vertices: number;\n readonly resident: Resident;\n /** Per slot: the category's rank, or `0` when nothing is bound. */\n readonly categories: Uint32Array;\n /** Per slot: the ramp's raw value, or `null` when nothing is bound. */\n readonly sizes: Float32Array | null;\n /** Per vertex slot: its title, when `title` is bound. */\n readonly titles: readonly string[] | null;\n /** What each rank is, for a legend: the seed, then the other values seen, in rank order. */\n readonly domain: readonly unknown[];\n /** Per rank, the vertices the marks of that rank stand for. */\n readonly tally: readonly number[];\n /** Vertices the marks stand for — a cell counts its members. */\n readonly represented: number;\n}\n\nexport interface ComposeInput {\n readonly matrix: TileMatrixSet;\n readonly typeIndex: number;\n readonly binding: Binding;\n readonly modeColumn: string | null;\n /** The categorical domain fixed before any tile: it ranks first, in its own order. */\n readonly domain: readonly unknown[];\n readonly visible: readonly TileView[];\n readonly cached: readonly TileView[];\n /** Graph units per screen pixel when composed, for the stub discard. */\n readonly perPixel: number;\n}\n\n/**\n * **Visible tiles → one buffer set.** cosmos.gl replaces a whole buffer per setter, so what changed\n * is decided at the granularity it offers: the set of tiles. The same visible set under the same\n * binding composes to `null` — nothing new, and nothing to upload.\n */\nexport function createComposer(): (input: ComposeInput) => Composition | null {\n let bindingKey = \"\";\n let dictionary = new Dictionary();\n let seed: readonly unknown[] = [];\n let encoded = new WeakMap<TileContent, Encoded>();\n let setKey = \"\";\n\n const encodedOf = (view: TileView, input: ComposeInput): Encoded => {\n let found = encoded.get(view.content);\n if (!found) {\n found = encode(view, input.binding, dictionary, input.modeColumn);\n encoded.set(view.content, found);\n }\n return found;\n };\n\n return (input) => {\n const key = `${input.binding.category}|${input.binding.size}|${input.binding.title}|${input.modeColumn}`;\n if (key !== bindingKey || input.domain !== seed) {\n bindingKey = key;\n seed = input.domain;\n dictionary = new Dictionary(seed);\n encoded = new WeakMap();\n setKey = \"\";\n }\n const next = input.visible.map((view) => idOf(view.content)).join(\",\");\n if (next === setKey) return null;\n setKey = next;\n const tiles = input.visible.map((view) => ({ view, encoded: encodedOf(view, input) }));\n return assemble(input, tiles, dictionary, encodedOf);\n };\n}\n\nconst ids = new WeakMap<object, number>();\nlet nextId = 1;\nfunction idOf(content: object): number {\n let id = ids.get(content);\n if (id === undefined) ids.set(content, (id = nextId++));\n return id;\n}\n\nfunction assemble(\n input: ComposeInput,\n tiles: readonly { view: TileView; encoded: Encoded }[],\n dictionary: Dictionary,\n encodedOf: (view: TileView, input: ComposeInput) => Encoded,\n): Composition {\n const ordered = [...tiles].sort((a, b) => Number(a.encoded.cells) - Number(b.encoded.cells));\n let marks = 0;\n let vertexMarks = 0;\n for (const { encoded } of ordered) {\n marks += encoded.n;\n if (!encoded.cells) vertexMarks += encoded.n;\n }\n\n const xy: number[] = [];\n const codes: number[] = [];\n const ramp: number[] = [];\n const titles: string[] = [];\n const counts: number[] = [];\n const vertices = new BigUint64Array(vertexMarks);\n const slot = new Map<number, Map<number, number>>();\n const slotsAt = (z: number) => {\n let found = slot.get(z);\n if (!found) slot.set(z, (found = new Map()));\n return found;\n };\n const place = (z: number, encoded: Encoded, i: number) => {\n const at = xy.length / 2;\n xy.push(encoded.positions[i * 2] as number, encoded.positions[i * 2 + 1] as number);\n codes.push(encoded.codes?.[i] ?? 0);\n ramp.push(encoded.sizes?.[i] ?? 0);\n slotsAt(z).set(encoded.keys[i] as number, at);\n return at;\n };\n\n let represented = 0;\n for (const { encoded, view } of ordered) {\n for (let i = 0; i < encoded.n; i++) {\n const at = place(view.address.z, encoded, i);\n const count = encoded.counts[i] ?? 0;\n counts[at] = count;\n represented += count;\n if (!encoded.cells) {\n vertices[at] = vertexId(input.typeIndex, encoded.keys[i] as number);\n titles.push(encoded.titles?.[i] ?? \"\");\n }\n }\n }\n\n const cachedByZ = new Map<number, Map<number, TileView>>();\n for (const view of input.cached) {\n let byTile = cachedByZ.get(view.address.z);\n if (!byTile) cachedByZ.set(view.address.z, (byTile = new Map()));\n byTile.set(view.address.tile, view);\n }\n /** A far end: in the cache or not at all — never a read of its tile. */\n const farEnd = (z: number, key: number): number | undefined => {\n const known = slotsAt(z).get(key);\n if (known !== undefined) return known;\n const rows = input.matrix.tileMatrices[z]?.tileRows ?? 1;\n const view = cachedByZ.get(z)?.get(Math.floor(key / rows));\n if (!view) return undefined;\n const encoded = encodedOf(view, input);\n for (let i = 0; i < encoded.n; i++) if (encoded.keys[i] === key) return place(z, encoded, i);\n return undefined;\n };\n\n const minLength = MIN_LINK_PIXELS * input.perPixel;\n const links: number[] = [];\n const weights: number[] = [];\n const seen = new Set<string>();\n let weighted = false;\n for (const { encoded, view } of ordered) {\n const { z } = view.address;\n for (let e = 0; e < encoded.links.length / 2; e++) {\n const from = encoded.links[e * 2] as number;\n const to = encoded.links[e * 2 + 1] as number;\n if (from === to) continue;\n const pair = `${z}:${from}:${to}`;\n if (seen.has(pair)) continue;\n const a = farEnd(z, from);\n const b = farEnd(z, to);\n if (a === undefined || b === undefined) continue;\n seen.add(pair);\n const dx = (xy[a * 2] as number) - (xy[b * 2] as number);\n const dy = (xy[a * 2 + 1] as number) - (xy[b * 2 + 1] as number);\n if (Math.hypot(dx, dy) < minLength) continue;\n links.push(a, b);\n const weight = encoded.weights?.[e] ?? 1;\n if (encoded.weights) weighted = true;\n weights.push(weight);\n }\n }\n\n const ranks = dictionary.ranks();\n const categories = Uint32Array.from(codes, (code) => ranks[code] ?? 0);\n const domain: unknown[] = [];\n ranks.forEach((rank, code) => {\n domain[rank] = dictionary.values[code];\n });\n const tally = domain.map(() => 0);\n for (let i = 0; i < marks; i++) {\n const rank = categories[i] ?? 0;\n tally[rank] = (tally[rank] ?? 0) + (counts[i] ?? 0);\n }\n const bound = ordered.some(({ encoded }) => encoded.sizes !== null);\n\n return {\n positions: Float32Array.from(xy),\n links: Float32Array.from(links),\n weights: weighted ? Float32Array.from(weights) : null,\n marks,\n vertices: vertexMarks,\n resident: residentOf(vertices, vertexMarks),\n categories,\n sizes: bound ? Float32Array.from(ramp) : null,\n titles: input.binding.title === undefined ? null : titles,\n domain,\n tally,\n represented,\n };\n}\n"],"names":["MIN_LINK_PIXELS","createComposer","bindingKey","dictionary","Dictionary","seed","encoded","setKey","encodedOf","view","input","found","encode","key","next","idOf","tiles","assemble","ids","nextId","content","id","ordered","a","b","marks","vertexMarks","xy","codes","ramp","titles","counts","vertices","slot","slotsAt","z","place","i","at","_a","_b","represented","count","vertexId","cachedByZ","byTile","farEnd","known","rows","minLength","links","weights","seen","weighted","e","from","to","pair","dx","dy","weight","ranks","categories","code","domain","rank","tally","bound","residentOf"],"mappings":";;AAQO,MAAMA,IAAkB;AA+CxB,SAASC,KAA8D;AAC5E,MAAIC,IAAa,IACbC,IAAa,IAAIC,EA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