@kanzo-tech/graph 0.11.0 → 0.13.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/dist/core/store.d.ts.map +1 -1
- package/dist/core/store.js +90 -85
- package/dist/core/store.js.map +1 -1
- package/package.json +4 -4
package/dist/core/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/core/store.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAA8B,UAAU,EAAY,MAAM,SAAS,CAAC;AAK9F,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjH,0FAA0F;AAC1F,eAAO,MAAM,aAAa,QAAS,CAAC;AAwBpC,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/core/store.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAA8B,UAAU,EAAY,MAAM,SAAS,CAAC;AAK9F,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjH,0FAA0F;AAC1F,eAAO,MAAM,aAAa,QAAS,CAAC;AAwBpC,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU,CA2U7D"}
|
package/dist/core/store.js
CHANGED
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
import { PAYLOAD_ADDRESS as
|
|
1
|
+
import { PAYLOAD_ADDRESS as le, PAYLOAD_COORDINATES as oe } from "@fossil-lang/corpus";
|
|
2
2
|
import { domainOf as re } from "./categories.js";
|
|
3
|
-
import { bindingOf as
|
|
4
|
-
import { graphClient as
|
|
5
|
-
import { denseOf as
|
|
6
|
-
import { Tileset2D as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
3
|
+
import { bindingOf as G, projectionOf as ie } from "./channels.js";
|
|
4
|
+
import { graphClient as se, publish as ce, filterFor as fe } from "./filter.js";
|
|
5
|
+
import { denseOf as ue } from "./resident.js";
|
|
6
|
+
import { Tileset2D as de } from "./tileset.js";
|
|
7
|
+
const Y = 2e4, Q = G({}), W = le[0];
|
|
8
|
+
function ae(i) {
|
|
9
9
|
var m;
|
|
10
10
|
let n = 0;
|
|
11
11
|
for (const s of i.edges) n += s.src.byteLength + s.dst.byteLength + (((m = s.weight) == null ? void 0 : m.byteLength) ?? 0);
|
|
12
12
|
return n + i.rows.numRows * 8 * 4;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
function
|
|
14
|
+
const pe = (i, n) => JSON.stringify(i, (m, s) => typeof s == "bigint" ? `${s}n` : s) === JSON.stringify(n, (m, s) => typeof s == "bigint" ? `${s}n` : s), me = (i) => typeof (i == null ? void 0 : i.then) == "function";
|
|
15
|
+
function X(i, n) {
|
|
16
16
|
return i.length !== n.length ? n : n.every((m, s) => {
|
|
17
17
|
var o;
|
|
18
18
|
return m.content === ((o = i[s]) == null ? void 0 : o.content);
|
|
19
19
|
}) ? i : n;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function ve(i) {
|
|
22
22
|
let n = i;
|
|
23
|
-
const m = /* @__PURE__ */ new Set(), s =
|
|
24
|
-
let o = null, b = null, M = !1, C = !1,
|
|
23
|
+
const m = /* @__PURE__ */ new Set(), s = se();
|
|
24
|
+
let o = null, b = null, M = !1, C = !1, d = null, T = 0, J = null, O = null, g = Q, P, z = null, E = [], S = null, h = null, B = !1, V = -1, $ = !0, A = null;
|
|
25
25
|
const D = (e) => {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const t = e instanceof Error ? e.message : String(e);
|
|
27
|
+
$ ? A = t : n.onFailure(t);
|
|
28
|
+
}, a = new de({
|
|
28
29
|
debounceTime: 60,
|
|
29
30
|
load: async (e, t) => {
|
|
30
31
|
if (!o || !O) throw new Error("the graph has no scan to read with");
|
|
31
|
-
const
|
|
32
|
+
const l = (u) => {
|
|
32
33
|
var w;
|
|
33
|
-
return ((w =
|
|
34
|
-
},
|
|
35
|
-
return e.map((
|
|
36
|
-
const v = y[w], L =
|
|
37
|
-
return { ...
|
|
34
|
+
return ((w = d == null ? void 0 : d.tileMatrices[u.z]) == null ? void 0 : w.kind) === "cells";
|
|
35
|
+
}, r = await O.read(e, { signal: t }), y = await o.edges({ from: e, direction: "src", signal: t }), p = e.filter((u) => !l(u)), N = p.length > 0 ? await o.edges({ from: p, direction: "dst", signal: t }) : [], F = new Map(p.map((u, w) => [u, N[w]]));
|
|
36
|
+
return e.map((u, w) => {
|
|
37
|
+
const v = y[w], L = F.get(u), ee = [...(v == null ? void 0 : v.batches) ?? [], ...(L == null ? void 0 : L.batches) ?? []], q = [...(v == null ? void 0 : v.declined) ?? [], ...(L == null ? void 0 : L.declined) ?? []], te = l(u) ? q.filter((ne) => ne.direction !== "dst") : q, H = { rows: r[w], edges: ee, declined: te };
|
|
38
|
+
return { ...H, byteLength: ae(H) };
|
|
38
39
|
});
|
|
39
40
|
},
|
|
40
41
|
onTileLoad: (e) => {
|
|
41
42
|
var t;
|
|
42
|
-
for (const
|
|
43
|
-
E.some((
|
|
43
|
+
for (const l of ((t = e.content) == null ? void 0 : t.declined) ?? [])
|
|
44
|
+
E.some((r) => r.edgeType === l.edgeType && r.direction === l.direction) || (E = [...E, l]);
|
|
44
45
|
a.refresh(), f();
|
|
45
46
|
},
|
|
46
47
|
onTileError: (e) => {
|
|
@@ -52,7 +53,7 @@ function be(i) {
|
|
|
52
53
|
matrix: null,
|
|
53
54
|
typeIndex: 0,
|
|
54
55
|
modeColumn: null,
|
|
55
|
-
binding:
|
|
56
|
+
binding: Q,
|
|
56
57
|
domain: [],
|
|
57
58
|
z: null,
|
|
58
59
|
visible: [],
|
|
@@ -71,109 +72,113 @@ function be(i) {
|
|
|
71
72
|
options: n,
|
|
72
73
|
corpus: null
|
|
73
74
|
};
|
|
74
|
-
const
|
|
75
|
+
const j = (e) => {
|
|
75
76
|
var t;
|
|
76
77
|
return {
|
|
77
78
|
address: e.address,
|
|
78
|
-
kind: ((t =
|
|
79
|
+
kind: ((t = d == null ? void 0 : d.tileMatrices[e.address.z]) == null ? void 0 : t.kind) ?? "rows",
|
|
79
80
|
content: e.content
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
|
-
let
|
|
83
|
-
function
|
|
83
|
+
let _ = { key: [], value: [] };
|
|
84
|
+
function Z() {
|
|
84
85
|
const e = [o, T, g.category, n.categories];
|
|
85
|
-
return e.some((t,
|
|
86
|
+
return e.some((t, l) => t !== _.key[l]) && (_ = { key: e, value: re(o, T, g, n.categories) }), _.value;
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function x(e, t) {
|
|
88
89
|
return M || C ? "failed" : b ? "opening" : o ? e || S !== t || c.drawn === null ? "reading" : "idle" : "none";
|
|
89
90
|
}
|
|
90
91
|
function f(e = {}) {
|
|
91
92
|
var y;
|
|
92
|
-
|
|
93
|
-
const t = a.tiles.filter((p) => p.content !== null),
|
|
93
|
+
V = a.frame;
|
|
94
|
+
const t = a.tiles.filter((p) => p.content !== null), l = X(c.visible, t.filter((p) => p.isVisible).map(j)), r = a.selectedTiles.some((p) => p.isLoading);
|
|
94
95
|
c = {
|
|
95
96
|
...c,
|
|
96
|
-
matrix:
|
|
97
|
+
matrix: d,
|
|
97
98
|
typeIndex: T,
|
|
98
|
-
modeColumn:
|
|
99
|
+
modeColumn: J,
|
|
99
100
|
binding: g,
|
|
100
|
-
domain:
|
|
101
|
+
domain: Z(),
|
|
101
102
|
z: a.z,
|
|
102
|
-
visible:
|
|
103
|
-
cached:
|
|
104
|
-
pending:
|
|
105
|
-
total:
|
|
103
|
+
visible: l,
|
|
104
|
+
cached: X(c.cached, t.map(j)),
|
|
105
|
+
pending: r,
|
|
106
|
+
total: d ? Number(((y = d.tileMatrices[d.tileMatrices.length - 1]) == null ? void 0 : y.count) ?? 0) : void 0,
|
|
106
107
|
declined: E,
|
|
107
108
|
options: n,
|
|
108
109
|
corpus: o,
|
|
109
110
|
...e
|
|
110
|
-
}, c = { ...c, status:
|
|
111
|
+
}, c = { ...c, status: x(r, c.visible) };
|
|
111
112
|
for (const p of m) p();
|
|
112
113
|
}
|
|
113
|
-
function
|
|
114
|
-
if (!(!o || !
|
|
114
|
+
function k() {
|
|
115
|
+
if (!(!o || !d)) {
|
|
115
116
|
try {
|
|
116
|
-
const e = [
|
|
117
|
-
O = o.scan({ type:
|
|
117
|
+
const e = [W, ...oe];
|
|
118
|
+
O = o.scan({ type: d.type, filter: P, select: ie(g, e) }), a.setPlan(O.plan());
|
|
118
119
|
} catch (e) {
|
|
119
120
|
O = null, a.setPlan([]), D(e);
|
|
120
121
|
}
|
|
121
|
-
a.reloadAll(), z && a.update(z, n.limit ??
|
|
122
|
+
a.reloadAll(), z && a.update(z, n.limit ?? Y), f();
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
|
-
function
|
|
125
|
-
var
|
|
126
|
-
M = !1,
|
|
125
|
+
function I() {
|
|
126
|
+
var r, y, p, N, F;
|
|
127
|
+
M = !1, d = null, O = null, E = [], S = null, a.finalize();
|
|
127
128
|
const e = { selection: null, focus: null, hovered: null, pinned: [], drawn: null };
|
|
128
129
|
if (!o) return f(e);
|
|
129
|
-
const t = o.types.vertices,
|
|
130
|
-
T = Math.max(0, t.findIndex((
|
|
130
|
+
const t = o.types.vertices, l = n.type ?? ((r = t.find((u) => u.geometry)) == null ? void 0 : r.type) ?? ((y = t[0]) == null ? void 0 : y.type);
|
|
131
|
+
T = Math.max(0, t.findIndex((u) => u.type === l));
|
|
131
132
|
try {
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
} catch (
|
|
137
|
-
M = !0, D(
|
|
133
|
+
if (l === void 0) throw new Error("the corpus has no vertex type to draw");
|
|
134
|
+
d = o.tileMatrix(l);
|
|
135
|
+
const u = ((p = o.addressing.vertexType(l).cells) == null ? void 0 : p.modeChannel) ?? null;
|
|
136
|
+
J = ((F = (N = t[T]) == null ? void 0 : N.channels.find((w) => w.name === u)) == null ? void 0 : F.column) ?? null, a.setMatrix(d);
|
|
137
|
+
} catch (u) {
|
|
138
|
+
M = !0, D(u);
|
|
138
139
|
}
|
|
139
|
-
c = { ...c, ...e },
|
|
140
|
+
c = { ...c, ...e }, k();
|
|
140
141
|
}
|
|
141
|
-
function
|
|
142
|
-
if (o = null, b =
|
|
143
|
-
return o = e,
|
|
142
|
+
function K(e) {
|
|
143
|
+
if (o = null, b = me(e) ? e : null, !b)
|
|
144
|
+
return o = e, I();
|
|
144
145
|
const t = b;
|
|
145
|
-
|
|
146
|
-
(
|
|
147
|
-
b === t && (b = null, o =
|
|
146
|
+
I(), t.then(
|
|
147
|
+
(l) => {
|
|
148
|
+
b === t && (b = null, o = l, I());
|
|
148
149
|
},
|
|
149
|
-
(
|
|
150
|
-
b === t && (b = null, M = !0, D(
|
|
150
|
+
(l) => {
|
|
151
|
+
b === t && (b = null, M = !0, D(l), f());
|
|
151
152
|
}
|
|
152
153
|
);
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
+
function R() {
|
|
155
156
|
h == null || h(), h = null;
|
|
156
157
|
const e = n.filterBy, t = () => {
|
|
157
|
-
let
|
|
158
|
+
let l;
|
|
158
159
|
try {
|
|
159
|
-
|
|
160
|
-
} catch (
|
|
161
|
-
D(
|
|
160
|
+
l = e ? fe(e, s) : void 0;
|
|
161
|
+
} catch (r) {
|
|
162
|
+
D(r);
|
|
162
163
|
return;
|
|
163
164
|
}
|
|
164
|
-
|
|
165
|
+
pe(l, P) || (P = l, k());
|
|
165
166
|
};
|
|
166
167
|
e && (e.addEventListener("value", t), h = () => e.removeEventListener("value", t)), t();
|
|
167
168
|
}
|
|
168
|
-
const
|
|
169
|
+
const U = {
|
|
169
170
|
/**
|
|
170
171
|
* The first subscriber starts listening to the crossfilter and the last one stops it and lets the
|
|
171
172
|
* tiles go — `QueryObserver`'s `onSubscribe`/`onUnsubscribe`, which is what survives StrictMode
|
|
172
173
|
* mounting everything twice.
|
|
173
174
|
*/
|
|
174
175
|
subscribe(e) {
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
if (m.add(e), !B && (B = !0, R(), A !== null)) {
|
|
177
|
+
const t = A;
|
|
178
|
+
A = null, n.onFailure(t);
|
|
179
|
+
}
|
|
180
|
+
return () => {
|
|
181
|
+
m.delete(e), m.size === 0 && U.destroy();
|
|
177
182
|
};
|
|
178
183
|
},
|
|
179
184
|
getSnapshot: () => c,
|
|
@@ -181,24 +186,24 @@ function be(i) {
|
|
|
181
186
|
setOptions(e) {
|
|
182
187
|
const t = n;
|
|
183
188
|
n = e;
|
|
184
|
-
const
|
|
185
|
-
if (g =
|
|
186
|
-
e.corpus !== t.corpus ?
|
|
189
|
+
const l = G(e), r = l.category !== g.category || l.size !== g.size || l.title !== g.title;
|
|
190
|
+
if (g = l, e.corpus !== t.corpus || e.type !== t.type) {
|
|
191
|
+
e.corpus !== t.corpus ? K(e.corpus) : I(), B && e.filterBy !== t.filterBy && R();
|
|
187
192
|
return;
|
|
188
193
|
}
|
|
189
|
-
if (B && e.filterBy !== t.filterBy &&
|
|
190
|
-
e.limit !== t.limit && z && a.update(z, e.limit ??
|
|
194
|
+
if (B && e.filterBy !== t.filterBy && R(), r) return k();
|
|
195
|
+
e.limit !== t.limit && z && a.update(z, e.limit ?? Y), f();
|
|
191
196
|
},
|
|
192
197
|
destroy() {
|
|
193
198
|
B = !1, h == null || h(), h = null, a.finalize(), m.clear();
|
|
194
199
|
},
|
|
195
200
|
setViewport(e) {
|
|
196
|
-
z = e, a.update(e, n.limit ??
|
|
201
|
+
z = e, a.update(e, n.limit ?? Y) !== V && f();
|
|
197
202
|
},
|
|
198
|
-
select(e, t = "node",
|
|
203
|
+
select(e, t = "node", l = "") {
|
|
199
204
|
var y;
|
|
200
|
-
const
|
|
201
|
-
f({ selection:
|
|
205
|
+
const r = e && e.length > 0 ? { vertices: [...e], source: t, label: l } : null;
|
|
206
|
+
f({ selection: r }), (y = n.onSelect) == null || y.call(n, r), n.filterBy && ce(n.filterBy, s, W, r ? r.vertices.map(ue) : null);
|
|
202
207
|
},
|
|
203
208
|
focus(e) {
|
|
204
209
|
var t;
|
|
@@ -226,10 +231,10 @@ function be(i) {
|
|
|
226
231
|
S === e && t === null || (S = e, f(t ? { drawn: t } : {}));
|
|
227
232
|
}
|
|
228
233
|
};
|
|
229
|
-
return g =
|
|
234
|
+
return g = G(i), K(i.corpus), $ = !1, U;
|
|
230
235
|
}
|
|
231
236
|
export {
|
|
232
|
-
|
|
233
|
-
|
|
237
|
+
Y as DEFAULT_LIMIT,
|
|
238
|
+
ve as createGraph
|
|
234
239
|
};
|
|
235
240
|
//# sourceMappingURL=store.js.map
|
package/dist/core/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sources":["../../src/core/store.ts"],"sourcesContent":["import {\n PAYLOAD_ADDRESS,\n PAYLOAD_COORDINATES,\n type Batch,\n type Corpus,\n type Filter,\n type Gap,\n type Scan,\n type TileAddress,\n type TileMatrixSet,\n} from \"@fossil-lang/corpus\";\nimport type { MosaicClient } from \"@kanzo-tech/mosaic\";\nimport { domainOf } from \"./categories\";\nimport { bindingOf, projectionOf, type Binding } from \"./channels\";\nimport { filterFor, graphClient, publish } from \"./filter\";\nimport { denseOf } from \"./resident\";\nimport type { GraphOptions, GraphSnapshot, GraphStatus, GraphStore, TileView } from \"./state\";\nimport type { TileContent } from \"./tile\";\nimport type { Viewport } from \"./tile-matrix\";\nimport { Tileset2D } from \"./tileset\";\n\nexport type { Drawn, GraphOptions, GraphSnapshot, GraphState, GraphStatus, GraphStore, TileView } from \"./state\";\n\n/** Twenty thousand marks: what a canvas draws at once before a coarser zoom is chosen. */\nexport const DEFAULT_LIMIT = 20_000;\n\nconst NO_BINDING: Binding = bindingOf({});\nconst KEY = PAYLOAD_ADDRESS[0] as string;\n\nfunction bytesOf(content: Omit<TileContent, \"byteLength\">): number {\n let bytes = 0;\n for (const edge of content.edges) bytes += edge.src.byteLength + edge.dst.byteLength + (edge.weight?.byteLength ?? 0);\n return bytes + content.rows.numRows * 8 * 4;\n}\n\nconst sameFilter = (a: Filter | undefined, b: Filter | undefined) =>\n JSON.stringify(a, (_, v: unknown) => (typeof v === \"bigint\" ? `${v}n` : v)) ===\n JSON.stringify(b, (_, v: unknown) => (typeof v === \"bigint\" ? `${v}n` : v));\n\nconst isPromise = (value: unknown): value is PromiseLike<Corpus> =>\n typeof (value as PromiseLike<Corpus> | null)?.then === \"function\";\n\n/** The same array while the set of tiles in it is the same, so a reader can compare by identity. */\nfunction keep(previous: readonly TileView[], next: TileView[]): readonly TileView[] {\n if (previous.length !== next.length) return next;\n return next.every((view, i) => view.content === previous[i]?.content) ? previous : next;\n}\n\nexport function createGraph(initial: GraphOptions): GraphStore {\n let options = initial;\n const listeners = new Set<() => void>();\n const self: MosaicClient = graphClient();\n\n let corpus: Corpus | null = null;\n let opening: PromiseLike<Corpus> | null = null;\n let failed = false;\n let unrenderable = false;\n let matrix: TileMatrixSet | null = null;\n let typeIndex = 0;\n let modeColumn: string | null = null;\n let scan: Scan | null = null;\n let binding = NO_BINDING;\n let filter: Filter | undefined;\n let viewport: Viewport | null = null;\n let declined: Gap[] = [];\n let composed: readonly TileView[] | null = null;\n let unlisten: (() => void) | null = null;\n let active = false;\n let lastFrame = -1;\n\n const fail = (error: unknown) => {\n options.onFailure(error instanceof Error ? error.message : String(error));\n };\n\n const tileset = new Tileset2D({\n debounceTime: 60,\n load: async (addresses, signal) => {\n if (!corpus || !scan) throw new Error(\"the graph has no scan to read with\");\n const isCells = (address: TileAddress) => matrix?.tileMatrices[address.z]?.kind === \"cells\";\n const rows = await scan.read(addresses, { signal });\n const src = await corpus.edges({ from: addresses, direction: \"src\", signal });\n const payload = addresses.filter((address) => !isCells(address));\n const dst = payload.length > 0 ? await corpus.edges({ from: payload, direction: \"dst\", signal }) : [];\n const dstOf = new Map(payload.map((address, i) => [address, dst[i]]));\n return addresses.map((address, i) => {\n const out = src[i];\n const back = dstOf.get(address);\n const edges = [...(out?.batches ?? []), ...(back?.batches ?? [])];\n const gaps = [...(out?.declined ?? []), ...(back?.declined ?? [])];\n const declined = isCells(address) ? gaps.filter((gap) => gap.direction !== \"dst\") : gaps;\n const content = { rows: rows[i] as Batch, edges, declined };\n return { ...content, byteLength: bytesOf(content) };\n });\n },\n onTileLoad: (tile) => {\n for (const gap of tile.content?.declined ?? []) {\n if (!declined.some((d) => d.edgeType === gap.edgeType && d.direction === gap.direction)) {\n declined = [...declined, gap];\n }\n }\n tileset.refresh();\n notify();\n },\n onTileError: (error) => {\n tileset.refresh();\n fail(error);\n notify();\n },\n });\n\n let snapshot: GraphSnapshot = {\n status: \"none\",\n matrix: null,\n typeIndex: 0,\n modeColumn: null,\n binding: NO_BINDING,\n domain: [],\n z: null,\n visible: [],\n cached: [],\n pending: false,\n total: undefined,\n declined: [],\n selection: null,\n focus: null,\n hovered: null,\n pinned: [],\n tool: null,\n motion: \"settled\",\n progress: 1,\n drawn: null,\n options,\n corpus: null,\n };\n\n const viewOf = (tile: { address: TileAddress; content: TileContent | null }): TileView => ({\n address: tile.address,\n kind: matrix?.tileMatrices[tile.address.z]?.kind ?? \"rows\",\n content: tile.content as TileContent,\n });\n\n let domain: { key: unknown[]; value: readonly unknown[] } = { key: [], value: [] };\n function domainNow(): readonly unknown[] {\n const key = [corpus, typeIndex, binding.category, options.categories];\n if (key.some((part, i) => part !== domain.key[i])) domain = { key, value: domainOf(corpus, typeIndex, binding, options.categories) };\n return domain.value;\n }\n\n function statusOf(pending: boolean, visible: readonly TileView[]): GraphStatus {\n if (failed || unrenderable) return \"failed\";\n if (opening) return \"opening\";\n if (!corpus) return \"none\";\n return pending || composed !== visible || snapshot.drawn === null ? \"reading\" : \"idle\";\n }\n\n function notify(patch: Partial<GraphSnapshot> = {}): void {\n lastFrame = tileset.frame;\n const tiles = tileset.tiles.filter((tile) => tile.content !== null);\n const visible = keep(snapshot.visible, tiles.filter((tile) => tile.isVisible).map(viewOf));\n const pending = tileset.selectedTiles.some((tile) => tile.isLoading);\n snapshot = {\n ...snapshot,\n matrix,\n typeIndex,\n modeColumn,\n binding,\n domain: domainNow(),\n z: tileset.z,\n visible,\n cached: keep(snapshot.cached, tiles.map(viewOf)),\n pending,\n total: matrix ? Number(matrix.tileMatrices[matrix.tileMatrices.length - 1]?.count ?? 0) : undefined,\n declined,\n options,\n corpus,\n ...patch,\n };\n snapshot = { ...snapshot, status: statusOf(pending, snapshot.visible) };\n for (const listener of listeners) listener();\n }\n\n /** A binding or a filter is a new scan, planned once and never per camera move. */\n function rescan(): void {\n if (!corpus || !matrix) return;\n try {\n const fixed = [KEY, ...PAYLOAD_COORDINATES];\n scan = corpus.scan({ type: matrix.type, filter, select: projectionOf(binding, fixed) });\n tileset.setPlan(scan.plan());\n } catch (error) {\n scan = null;\n tileset.setPlan([]);\n fail(error);\n }\n tileset.reloadAll();\n if (viewport) tileset.update(viewport, options.limit ?? DEFAULT_LIMIT);\n notify();\n }\n\n function reopen(): void {\n failed = false;\n matrix = null;\n scan = null;\n declined = [];\n composed = null;\n tileset.finalize();\n const cleared = { selection: null, focus: null, hovered: null, pinned: [], drawn: null };\n if (!corpus) return notify(cleared);\n const types = corpus.types.vertices;\n const type = options.type ?? types.find((t) => t.geometry)?.type ?? types[0]?.type;\n typeIndex = Math.max(0, types.findIndex((t) => t.type === type));\n try {\n if (type === undefined) throw new Error(\"the corpus has no vertex type to draw\");\n matrix = corpus.tileMatrix(type);\n const mode = corpus.addressing.vertexType(type).cells?.modeChannel ?? null;\n modeColumn = types[typeIndex]?.channels.find((channel) => channel.name === mode)?.column ?? null;\n tileset.setMatrix(matrix);\n } catch (error) {\n failed = true;\n fail(error);\n }\n snapshot = { ...snapshot, ...cleared };\n rescan();\n }\n\n /** A promise is adopted when it settles, and only if it is still the corpus the host means. */\n function adopt(given: GraphOptions[\"corpus\"]): void {\n corpus = null;\n opening = isPromise(given) ? given : null;\n if (!opening) {\n corpus = given as Corpus | null;\n return reopen();\n }\n const promised = opening;\n reopen();\n promised.then(\n (opened) => {\n if (opening !== promised) return;\n opening = null;\n corpus = opened;\n reopen();\n },\n (error: unknown) => {\n if (opening !== promised) return;\n opening = null;\n failed = true;\n fail(error);\n notify();\n },\n );\n }\n\n function listen(): void {\n unlisten?.();\n unlisten = null;\n const crossfilter = options.filterBy;\n const refilter = () => {\n let next: Filter | undefined;\n try {\n next = crossfilter ? filterFor(crossfilter, self) : undefined;\n } catch (error) {\n fail(error);\n return;\n }\n if (sameFilter(next, filter)) return;\n filter = next;\n rescan();\n };\n if (crossfilter) {\n crossfilter.addEventListener(\"value\", refilter);\n unlisten = () => crossfilter.removeEventListener(\"value\", refilter);\n }\n refilter();\n }\n\n const store: GraphStore = {\n /**\n * The first subscriber starts listening to the crossfilter and the last one stops it and lets the\n * tiles go — `QueryObserver`'s `onSubscribe`/`onUnsubscribe`, which is what survives StrictMode\n * mounting everything twice.\n */\n subscribe(listener) {\n listeners.add(listener);\n if (!active) {\n active = true;\n listen();\n }\n return () => {\n listeners.delete(listener);\n if (listeners.size === 0) store.destroy();\n };\n },\n getSnapshot: () => snapshot,\n getOptions: () => options,\n setOptions(next) {\n const previous = options;\n options = next;\n const nextBinding = bindingOf(next);\n const rebound =\n nextBinding.category !== binding.category ||\n nextBinding.size !== binding.size ||\n nextBinding.title !== binding.title;\n binding = nextBinding;\n if (next.corpus !== previous.corpus || next.type !== previous.type) {\n if (next.corpus !== previous.corpus) adopt(next.corpus);\n else reopen();\n if (active && next.filterBy !== previous.filterBy) listen();\n return;\n }\n if (active && next.filterBy !== previous.filterBy) listen();\n if (rebound) return rescan();\n if (next.limit !== previous.limit && viewport) tileset.update(viewport, next.limit ?? DEFAULT_LIMIT);\n notify();\n },\n destroy() {\n active = false;\n unlisten?.();\n unlisten = null;\n tileset.finalize();\n listeners.clear();\n },\n setViewport(next) {\n viewport = next;\n if (tileset.update(next, options.limit ?? DEFAULT_LIMIT) !== lastFrame) notify();\n },\n select(vertices, source = \"node\", label = \"\") {\n const selection = vertices && vertices.length > 0 ? { vertices: [...vertices], source, label } : null;\n notify({ selection });\n options.onSelect?.(selection);\n if (options.filterBy) publish(options.filterBy, self, KEY, selection ? selection.vertices.map(denseOf) : null);\n },\n focus(vertex) {\n if (vertex === snapshot.focus) return;\n notify({ focus: vertex });\n options.onFocus?.(vertex);\n },\n hover(vertex) {\n if (vertex !== snapshot.hovered) notify({ hovered: vertex });\n },\n pin(vertices) {\n notify({ pinned: [...vertices] });\n },\n setTool(tool) {\n if (tool !== snapshot.tool) notify({ tool });\n },\n report(motion) {\n if (motion !== snapshot.motion) notify({ motion });\n },\n reportProgress(value) {\n if (value !== snapshot.progress) notify({ progress: value });\n },\n setRenderable(renderable) {\n if (unrenderable === !renderable) return;\n unrenderable = !renderable;\n notify();\n },\n reportDrawn(visible, drawn) {\n if (composed === visible && drawn === null) return;\n composed = visible;\n notify(drawn ? { drawn } : {});\n },\n };\n\n binding = bindingOf(initial);\n adopt(initial.corpus);\n return store;\n}\n"],"names":["DEFAULT_LIMIT","NO_BINDING","bindingOf","KEY","PAYLOAD_ADDRESS","bytesOf","content","bytes","edge","_a","sameFilter","a","b","_","v","isPromise","value","keep","previous","next","view","i","createGraph","initial","options","listeners","self","graphClient","corpus","opening","failed","unrenderable","matrix","typeIndex","modeColumn","scan","binding","filter","viewport","declined","composed","unlisten","active","lastFrame","fail","error","tileset","Tileset2D","addresses","signal","isCells","address","rows","src","payload","dst","dstOf","out","back","edges","gaps","gap","tile","d","notify","snapshot","viewOf","domain","domainNow","key","part","domainOf","statusOf","pending","visible","patch","tiles","listener","rescan","fixed","PAYLOAD_COORDINATES","projectionOf","reopen","cleared","types","type","t","_b","mode","_c","_e","_d","channel","adopt","given","promised","opened","listen","crossfilter","refilter","filterFor","store","nextBinding","rebound","vertices","source","label","selection","publish","denseOf","vertex","tool","motion","renderable","drawn"],"mappings":";;;;;;AAwBO,MAAMA,IAAgB,KAEvBC,IAAsBC,EAAU,EAAE,GAClCC,IAAMC,GAAgB,CAAC;AAE7B,SAASC,GAAQC,GAAkD;;AACjE,MAAIC,IAAQ;AACZ,aAAWC,KAAQF,EAAQ,MAAO,CAAAC,KAASC,EAAK,IAAI,aAAaA,EAAK,IAAI,gBAAcC,IAAAD,EAAK,WAAL,gBAAAC,EAAa,eAAc;AACnH,SAAOF,IAAQD,EAAQ,KAAK,UAAU,IAAI;AAC5C;AAEA,MAAMI,KAAa,CAACC,GAAuBC,MACzC,KAAK,UAAUD,GAAG,CAACE,GAAGC,MAAgB,OAAOA,KAAM,WAAW,GAAGA,CAAC,MAAMA,CAAE,MAC1E,KAAK,UAAUF,GAAG,CAACC,GAAGC,MAAgB,OAAOA,KAAM,WAAW,GAAGA,CAAC,MAAMA,CAAE,GAEtEC,KAAY,CAACC,MACjB,QAAQA,KAAA,gBAAAA,EAAsC,SAAS;AAGzD,SAASC,EAAKC,GAA+BC,GAAuC;AAClF,SAAID,EAAS,WAAWC,EAAK,SAAeA,IACrCA,EAAK,MAAM,CAACC,GAAMC,MAAA;;AAAM,WAAAD,EAAK,cAAYX,IAAAS,EAASG,CAAC,MAAV,gBAAAZ,EAAa;AAAA,GAAO,IAAIS,IAAWC;AACrF;AAEO,SAASG,GAAYC,GAAmC;AAC7D,MAAIC,IAAUD;AACd,QAAME,wBAAgB,IAAA,GAChBC,IAAqBC,GAAA;AAE3B,MAAIC,IAAwB,MACxBC,IAAsC,MACtCC,IAAS,IACTC,IAAe,IACfC,IAA+B,MAC/BC,IAAY,GACZC,IAA4B,MAC5BC,IAAoB,MACpBC,IAAUnC,GACVoC,GACAC,IAA4B,MAC5BC,IAAkB,CAAA,GAClBC,IAAuC,MACvCC,IA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AA,IACF;AAAA,IACA,YAAYU,GAASwC,GAAO;AAC1B,MAAI1E,MAAakC,KAAWwC,MAAU,SACtC1E,IAAWkC,GACXV,EAAOkD,IAAQ,EAAE,OAAAA,EAAA,IAAU,CAAA,CAAE;AAAA,IAC/B;AAAA,EAAA;AAGF,SAAA9E,IAAUlC,EAAUqB,CAAO,GAC3BsE,EAAMtE,EAAQ,MAAM,GACb8E;AACT;"}
|
|
1
|
+
{"version":3,"file":"store.js","sources":["../../src/core/store.ts"],"sourcesContent":["import {\n PAYLOAD_ADDRESS,\n PAYLOAD_COORDINATES,\n type Batch,\n type Corpus,\n type Filter,\n type Gap,\n type Scan,\n type TileAddress,\n type TileMatrixSet,\n} from \"@fossil-lang/corpus\";\nimport type { MosaicClient } from \"@kanzo-tech/mosaic\";\nimport { domainOf } from \"./categories\";\nimport { bindingOf, projectionOf, type Binding } from \"./channels\";\nimport { filterFor, graphClient, publish } from \"./filter\";\nimport { denseOf } from \"./resident\";\nimport type { GraphOptions, GraphSnapshot, GraphStatus, GraphStore, TileView } from \"./state\";\nimport type { TileContent } from \"./tile\";\nimport type { Viewport } from \"./tile-matrix\";\nimport { Tileset2D } from \"./tileset\";\n\nexport type { Drawn, GraphOptions, GraphSnapshot, GraphState, GraphStatus, GraphStore, TileView } from \"./state\";\n\n/** Twenty thousand marks: what a canvas draws at once before a coarser zoom is chosen. */\nexport const DEFAULT_LIMIT = 20_000;\n\nconst NO_BINDING: Binding = bindingOf({});\nconst KEY = PAYLOAD_ADDRESS[0] as string;\n\nfunction bytesOf(content: Omit<TileContent, \"byteLength\">): number {\n let bytes = 0;\n for (const edge of content.edges) bytes += edge.src.byteLength + edge.dst.byteLength + (edge.weight?.byteLength ?? 0);\n return bytes + content.rows.numRows * 8 * 4;\n}\n\nconst sameFilter = (a: Filter | undefined, b: Filter | undefined) =>\n JSON.stringify(a, (_, v: unknown) => (typeof v === \"bigint\" ? `${v}n` : v)) ===\n JSON.stringify(b, (_, v: unknown) => (typeof v === \"bigint\" ? `${v}n` : v));\n\nconst isPromise = (value: unknown): value is PromiseLike<Corpus> =>\n typeof (value as PromiseLike<Corpus> | null)?.then === \"function\";\n\n/** The same array while the set of tiles in it is the same, so a reader can compare by identity. */\nfunction keep(previous: readonly TileView[], next: TileView[]): readonly TileView[] {\n if (previous.length !== next.length) return next;\n return next.every((view, i) => view.content === previous[i]?.content) ? previous : next;\n}\n\nexport function createGraph(initial: GraphOptions): GraphStore {\n let options = initial;\n const listeners = new Set<() => void>();\n const self: MosaicClient = graphClient();\n\n let corpus: Corpus | null = null;\n let opening: PromiseLike<Corpus> | null = null;\n let failed = false;\n let unrenderable = false;\n let matrix: TileMatrixSet | null = null;\n let typeIndex = 0;\n let modeColumn: string | null = null;\n let scan: Scan | null = null;\n let binding = NO_BINDING;\n let filter: Filter | undefined;\n let viewport: Viewport | null = null;\n let declined: Gap[] = [];\n let composed: readonly TileView[] | null = null;\n let unlisten: (() => void) | null = null;\n let active = false;\n let lastFrame = -1;\n\n // A failure found while the store is being built is found while React is still rendering —\n // `useGraph` builds it in `useState` — and a host's `onFailure` is usually a `setState`. It is held\n // and reported to the first subscriber, which arrives in the commit phase. Anything later is\n // asynchronous or effect-driven and is reported as it happens.\n let building = true;\n let held: string | null = null;\n const fail = (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n if (building) held = message;\n else options.onFailure(message);\n };\n\n const tileset = new Tileset2D({\n debounceTime: 60,\n load: async (addresses, signal) => {\n if (!corpus || !scan) throw new Error(\"the graph has no scan to read with\");\n const isCells = (address: TileAddress) => matrix?.tileMatrices[address.z]?.kind === \"cells\";\n const rows = await scan.read(addresses, { signal });\n const src = await corpus.edges({ from: addresses, direction: \"src\", signal });\n const payload = addresses.filter((address) => !isCells(address));\n const dst = payload.length > 0 ? await corpus.edges({ from: payload, direction: \"dst\", signal }) : [];\n const dstOf = new Map(payload.map((address, i) => [address, dst[i]]));\n return addresses.map((address, i) => {\n const out = src[i];\n const back = dstOf.get(address);\n const edges = [...(out?.batches ?? []), ...(back?.batches ?? [])];\n const gaps = [...(out?.declined ?? []), ...(back?.declined ?? [])];\n const declined = isCells(address) ? gaps.filter((gap) => gap.direction !== \"dst\") : gaps;\n const content = { rows: rows[i] as Batch, edges, declined };\n return { ...content, byteLength: bytesOf(content) };\n });\n },\n onTileLoad: (tile) => {\n for (const gap of tile.content?.declined ?? []) {\n if (!declined.some((d) => d.edgeType === gap.edgeType && d.direction === gap.direction)) {\n declined = [...declined, gap];\n }\n }\n tileset.refresh();\n notify();\n },\n onTileError: (error) => {\n tileset.refresh();\n fail(error);\n notify();\n },\n });\n\n let snapshot: GraphSnapshot = {\n status: \"none\",\n matrix: null,\n typeIndex: 0,\n modeColumn: null,\n binding: NO_BINDING,\n domain: [],\n z: null,\n visible: [],\n cached: [],\n pending: false,\n total: undefined,\n declined: [],\n selection: null,\n focus: null,\n hovered: null,\n pinned: [],\n tool: null,\n motion: \"settled\",\n progress: 1,\n drawn: null,\n options,\n corpus: null,\n };\n\n const viewOf = (tile: { address: TileAddress; content: TileContent | null }): TileView => ({\n address: tile.address,\n kind: matrix?.tileMatrices[tile.address.z]?.kind ?? \"rows\",\n content: tile.content as TileContent,\n });\n\n let domain: { key: unknown[]; value: readonly unknown[] } = { key: [], value: [] };\n function domainNow(): readonly unknown[] {\n const key = [corpus, typeIndex, binding.category, options.categories];\n if (key.some((part, i) => part !== domain.key[i])) domain = { key, value: domainOf(corpus, typeIndex, binding, options.categories) };\n return domain.value;\n }\n\n function statusOf(pending: boolean, visible: readonly TileView[]): GraphStatus {\n if (failed || unrenderable) return \"failed\";\n if (opening) return \"opening\";\n if (!corpus) return \"none\";\n return pending || composed !== visible || snapshot.drawn === null ? \"reading\" : \"idle\";\n }\n\n function notify(patch: Partial<GraphSnapshot> = {}): void {\n lastFrame = tileset.frame;\n const tiles = tileset.tiles.filter((tile) => tile.content !== null);\n const visible = keep(snapshot.visible, tiles.filter((tile) => tile.isVisible).map(viewOf));\n const pending = tileset.selectedTiles.some((tile) => tile.isLoading);\n snapshot = {\n ...snapshot,\n matrix,\n typeIndex,\n modeColumn,\n binding,\n domain: domainNow(),\n z: tileset.z,\n visible,\n cached: keep(snapshot.cached, tiles.map(viewOf)),\n pending,\n total: matrix ? Number(matrix.tileMatrices[matrix.tileMatrices.length - 1]?.count ?? 0) : undefined,\n declined,\n options,\n corpus,\n ...patch,\n };\n snapshot = { ...snapshot, status: statusOf(pending, snapshot.visible) };\n for (const listener of listeners) listener();\n }\n\n /** A binding or a filter is a new scan, planned once and never per camera move. */\n function rescan(): void {\n if (!corpus || !matrix) return;\n try {\n const fixed = [KEY, ...PAYLOAD_COORDINATES];\n scan = corpus.scan({ type: matrix.type, filter, select: projectionOf(binding, fixed) });\n tileset.setPlan(scan.plan());\n } catch (error) {\n scan = null;\n tileset.setPlan([]);\n fail(error);\n }\n tileset.reloadAll();\n if (viewport) tileset.update(viewport, options.limit ?? DEFAULT_LIMIT);\n notify();\n }\n\n function reopen(): void {\n failed = false;\n matrix = null;\n scan = null;\n declined = [];\n composed = null;\n tileset.finalize();\n const cleared = { selection: null, focus: null, hovered: null, pinned: [], drawn: null };\n if (!corpus) return notify(cleared);\n const types = corpus.types.vertices;\n const type = options.type ?? types.find((t) => t.geometry)?.type ?? types[0]?.type;\n typeIndex = Math.max(0, types.findIndex((t) => t.type === type));\n try {\n if (type === undefined) throw new Error(\"the corpus has no vertex type to draw\");\n matrix = corpus.tileMatrix(type);\n const mode = corpus.addressing.vertexType(type).cells?.modeChannel ?? null;\n modeColumn = types[typeIndex]?.channels.find((channel) => channel.name === mode)?.column ?? null;\n tileset.setMatrix(matrix);\n } catch (error) {\n failed = true;\n fail(error);\n }\n snapshot = { ...snapshot, ...cleared };\n rescan();\n }\n\n /** A promise is adopted when it settles, and only if it is still the corpus the host means. */\n function adopt(given: GraphOptions[\"corpus\"]): void {\n corpus = null;\n opening = isPromise(given) ? given : null;\n if (!opening) {\n corpus = given as Corpus | null;\n return reopen();\n }\n const promised = opening;\n reopen();\n promised.then(\n (opened) => {\n if (opening !== promised) return;\n opening = null;\n corpus = opened;\n reopen();\n },\n (error: unknown) => {\n if (opening !== promised) return;\n opening = null;\n failed = true;\n fail(error);\n notify();\n },\n );\n }\n\n function listen(): void {\n unlisten?.();\n unlisten = null;\n const crossfilter = options.filterBy;\n const refilter = () => {\n let next: Filter | undefined;\n try {\n next = crossfilter ? filterFor(crossfilter, self) : undefined;\n } catch (error) {\n fail(error);\n return;\n }\n if (sameFilter(next, filter)) return;\n filter = next;\n rescan();\n };\n if (crossfilter) {\n crossfilter.addEventListener(\"value\", refilter);\n unlisten = () => crossfilter.removeEventListener(\"value\", refilter);\n }\n refilter();\n }\n\n const store: GraphStore = {\n /**\n * The first subscriber starts listening to the crossfilter and the last one stops it and lets the\n * tiles go — `QueryObserver`'s `onSubscribe`/`onUnsubscribe`, which is what survives StrictMode\n * mounting everything twice.\n */\n subscribe(listener) {\n listeners.add(listener);\n if (!active) {\n active = true;\n listen();\n if (held !== null) {\n const message = held;\n held = null;\n options.onFailure(message);\n }\n }\n return () => {\n listeners.delete(listener);\n if (listeners.size === 0) store.destroy();\n };\n },\n getSnapshot: () => snapshot,\n getOptions: () => options,\n setOptions(next) {\n const previous = options;\n options = next;\n const nextBinding = bindingOf(next);\n const rebound =\n nextBinding.category !== binding.category ||\n nextBinding.size !== binding.size ||\n nextBinding.title !== binding.title;\n binding = nextBinding;\n if (next.corpus !== previous.corpus || next.type !== previous.type) {\n if (next.corpus !== previous.corpus) adopt(next.corpus);\n else reopen();\n if (active && next.filterBy !== previous.filterBy) listen();\n return;\n }\n if (active && next.filterBy !== previous.filterBy) listen();\n if (rebound) return rescan();\n if (next.limit !== previous.limit && viewport) tileset.update(viewport, next.limit ?? DEFAULT_LIMIT);\n notify();\n },\n destroy() {\n active = false;\n unlisten?.();\n unlisten = null;\n tileset.finalize();\n listeners.clear();\n },\n setViewport(next) {\n viewport = next;\n if (tileset.update(next, options.limit ?? DEFAULT_LIMIT) !== lastFrame) notify();\n },\n select(vertices, source = \"node\", label = \"\") {\n const selection = vertices && vertices.length > 0 ? { vertices: [...vertices], source, label } : null;\n notify({ selection });\n options.onSelect?.(selection);\n if (options.filterBy) publish(options.filterBy, self, KEY, selection ? selection.vertices.map(denseOf) : null);\n },\n focus(vertex) {\n if (vertex === snapshot.focus) return;\n notify({ focus: vertex });\n options.onFocus?.(vertex);\n },\n hover(vertex) {\n if (vertex !== snapshot.hovered) notify({ hovered: vertex });\n },\n pin(vertices) {\n notify({ pinned: [...vertices] });\n },\n setTool(tool) {\n if (tool !== snapshot.tool) notify({ tool });\n },\n report(motion) {\n if (motion !== snapshot.motion) notify({ motion });\n },\n reportProgress(value) {\n if (value !== snapshot.progress) notify({ progress: value });\n },\n setRenderable(renderable) {\n if (unrenderable === !renderable) return;\n unrenderable = !renderable;\n notify();\n },\n reportDrawn(visible, drawn) {\n if (composed === visible && drawn === null) return;\n composed = visible;\n notify(drawn ? { drawn } : {});\n },\n };\n\n binding = bindingOf(initial);\n adopt(initial.corpus);\n building = false;\n return store;\n}\n"],"names":["DEFAULT_LIMIT","NO_BINDING","bindingOf","KEY","PAYLOAD_ADDRESS","bytesOf","content","bytes","edge","_a","sameFilter","a","b","_","v","isPromise","value","keep","previous","next","view","i","createGraph","initial","options","listeners","self","graphClient","corpus","opening","failed","unrenderable","matrix","typeIndex","modeColumn","scan","binding","filter","viewport","declined","composed","unlisten","active","lastFrame","building","held","fail","error","message","tileset","Tileset2D","addresses","signal","isCells","address","rows","src","payload","dst","dstOf","out","back","edges","gaps","gap","tile","d","notify","snapshot","viewOf","domain","domainNow","key","part","domainOf","statusOf","pending","visible","patch","tiles","listener","rescan","fixed","PAYLOAD_COORDINATES","projectionOf","reopen","cleared","types","type","t","_b","mode","_c","_e","_d","channel","adopt","given","promised","opened","listen","crossfilter","refilter","filterFor","store","nextBinding","rebound","vertices","source","label","selection","publish","denseOf","vertex","tool","motion","renderable","drawn"],"mappings":";;;;;;AAwBO,MAAMA,IAAgB,KAE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F,IAAe,CAACqF,GAChBjD,EAAA;AAAA,IACF;AAAA,IACA,YAAYU,GAASwC,GAAO;AAC1B,MAAI7E,MAAaqC,KAAWwC,MAAU,SACtC7E,IAAWqC,GACXV,EAAOkD,IAAQ,EAAE,OAAAA,EAAA,IAAU,CAAA,CAAE;AAAA,IAC/B;AAAA,EAAA;AAGF,SAAAjF,IAAUlC,EAAUqB,CAAO,GAC3ByE,EAAMzE,EAAQ,MAAM,GACpBqB,IAAW,IACJ4D;AACT;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanzo-tech/graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Kanzo graph view — a tileset over a fossil corpus's scan, drawn with cosmos.gl, inside the page's Mosaic crossfilter. Sibling of @kanzo-tech/ui, not part of it: the admission rules exclude graphs from the generic vocabulary by name.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@fossil-lang/corpus": "^0.3.0-alpha.13",
|
|
30
30
|
"lucide-react": ">=1",
|
|
31
31
|
"react": "^19.0.0",
|
|
32
|
-
"@kanzo-tech/
|
|
33
|
-
"@kanzo-tech/
|
|
32
|
+
"@kanzo-tech/mosaic": "0.13.0",
|
|
33
|
+
"@kanzo-tech/ui": "0.13.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@cosmos.gl/graph": "^3.4.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"react": "^19.0.0",
|
|
47
47
|
"react-dom": "^19.0.0",
|
|
48
48
|
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
49
|
-
"@kanzo-tech/mosaic": "0.
|
|
49
|
+
"@kanzo-tech/mosaic": "0.13.0"
|
|
50
50
|
},
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|