@kanzo-tech/graph 0.25.0 → 0.27.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 +2 -2
- package/dist/core/categories.d.ts +1 -1
- package/dist/core/categories.d.ts.map +1 -1
- package/dist/core/categories.js.map +1 -1
- package/dist/core/channels.d.ts +12 -6
- package/dist/core/channels.d.ts.map +1 -1
- package/dist/core/channels.js +15 -12
- package/dist/core/channels.js.map +1 -1
- package/dist/core/client.d.ts +26 -0
- package/dist/core/client.d.ts.map +1 -0
- package/dist/core/client.js +62 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/error.d.ts +3 -3
- package/dist/core/error.d.ts.map +1 -1
- package/dist/core/error.js.map +1 -1
- package/dist/core/load.d.ts +30 -39
- package/dist/core/load.d.ts.map +1 -1
- package/dist/core/load.js +63 -117
- package/dist/core/load.js.map +1 -1
- package/dist/core/source.d.ts +90 -0
- package/dist/core/source.d.ts.map +1 -0
- package/dist/core/source.js +105 -0
- package/dist/core/source.js.map +1 -0
- package/dist/core/state.d.ts +19 -20
- package/dist/core/state.d.ts.map +1 -1
- package/dist/core/store.d.ts.map +1 -1
- package/dist/core/store.js +138 -158
- package/dist/core/store.js.map +1 -1
- package/dist/core/types.d.ts +5 -3
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -18
- package/dist/index.js.map +1 -1
- package/dist/parts/graph-canvas.d.ts.map +1 -1
- package/dist/parts/graph-canvas.js +49 -48
- package/dist/parts/graph-canvas.js.map +1 -1
- package/dist/parts/graph-counts.js +4 -4
- package/dist/parts/graph-counts.js.map +1 -1
- package/dist/parts/graph-inspector.d.ts +3 -3
- package/dist/parts/graph-inspector.d.ts.map +1 -1
- package/dist/parts/graph-inspector.js +45 -43
- package/dist/parts/graph-inspector.js.map +1 -1
- package/dist/parts/graph-search.d.ts +7 -7
- package/dist/parts/graph-search.d.ts.map +1 -1
- package/dist/parts/graph-search.js +60 -69
- package/dist/parts/graph-search.js.map +1 -1
- package/dist/parts/graph-select.d.ts +27 -0
- package/dist/parts/graph-select.d.ts.map +1 -0
- package/dist/parts/graph-select.js +53 -0
- package/dist/parts/graph-select.js.map +1 -0
- package/dist/parts/graph-toolbar.js +1 -1
- package/dist/parts/graph-toolbar.js.map +1 -1
- package/dist/react/use-graph.js +31 -31
- package/dist/react/use-graph.js.map +1 -1
- package/dist/render/camera.d.ts +12 -1
- package/dist/render/camera.d.ts.map +1 -1
- package/dist/render/camera.js +33 -21
- package/dist/render/camera.js.map +1 -1
- package/dist/render/graph-sim.d.ts +1 -1
- package/dist/render/graph-sim.d.ts.map +1 -1
- package/dist/render/graph-sim.js.map +1 -1
- package/dist/render/motion.d.ts +33 -0
- package/dist/render/motion.d.ts.map +1 -0
- package/dist/render/motion.js +19 -0
- package/dist/render/motion.js.map +1 -0
- package/dist/render/placement.d.ts +2 -4
- package/dist/render/placement.d.ts.map +1 -1
- package/dist/render/placement.js +12 -16
- package/dist/render/placement.js.map +1 -1
- package/dist/render/renderer.d.ts +6 -5
- package/dist/render/renderer.d.ts.map +1 -1
- package/dist/render/renderer.js +130 -118
- package/dist/render/renderer.js.map +1 -1
- package/dist/section.js +1 -1
- package/dist/section.js.map +1 -1
- package/package.json +12 -14
- package/dist/core/detail.d.ts +0 -26
- package/dist/core/detail.d.ts.map +0 -1
- package/dist/core/detail.js +0 -63
- package/dist/core/detail.js.map +0 -1
- package/dist/core/filter.d.ts +0 -23
- package/dist/core/filter.d.ts.map +0 -1
- package/dist/core/filter.js +0 -95
- package/dist/core/filter.js.map +0 -1
package/dist/core/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sources":["../../src/core/load.ts"],"sourcesContent":["import { GraphError } from \"./error\";\nimport { Dictionary } from \"./categories\";\nimport { projectionOf, type Binding } from \"./channels\";\nimport type { Batch, Corpus, EdgeTable, Filter, VertexTable } from \"@fossil-lang/corpus\";\nimport { columnsOf } from \"./filter\";\n\n/**\n * **The whole graph, read once and laid out as cosmos.gl's buffers.** A drawn vertex's `dense_id` is\n * its index, so every array is sized from the manifest's `record_count`s before a row arrives, and a\n * row is written where its id says. The camera never reaches here: nothing is read because it moved.\n */\n\n/** Where the drawn vertices are and how they connect — read once per corpus. */\nexport interface Geometry {\n /** The vertex tables with a position, in the manifest's order. */\n readonly tables: readonly VertexTable[];\n /** Drawn vertices: ids `0 … size − 1`. */\n readonly size: number;\n /** `[x, y, …]` by id; `NaN` where no row has a position. */\n readonly positions: Float32Array;\n /** By id, the vertex's index in `tables`. */\n readonly table: Uint16Array;\n /** `[src, dst, …]` by id, every relation whose two ends are drawn. */\n readonly links: Float32Array;\n readonly extent: { readonly x: number; readonly y: number; readonly w: number; readonly h: number } | null;\n}\n\n/** What the bound channels say about each vertex — read again when a binding changes. */\nexport interface Encoding {\n /** By id, the category's rank. */\n readonly ranks: Uint32Array;\n /** By id, the ramp's raw value, or `null` when `r` is unbound. */\n readonly sizes: Float32Array | null;\n /** What each rank is: the seed, then the other values seen, in rank order. */\n readonly domain: readonly unknown[];\n}\n\n/** The vertex tables fossil lays out or the program places; a table without a position is not drawn. */\nexport const drawnTables = (corpus: Corpus): VertexTable[] => corpus.manifest.vertex_tables.filter((table) => table.position);\n\nconst has = (table: VertexTable) => (column: string) => table.properties.some((p) => p.name === column);\n\n/**\n * Reads in parallel that end together: the first to fail aborts the rest, so no read outlives the\n * answer and no second failure goes unheard behind the first.\n */\nexport function together<T>(signal: AbortSignal, reads: (signal: AbortSignal) => Promise<T>): Promise<T> {\n const local = new AbortController();\n return reads(AbortSignal.any([signal, local.signal])).catch((error: unknown) => {\n local.abort();\n throw error;\n });\n}\n\nasync function readAll(corpus: Corpus, params: Parameters<Corpus[\"scan\"]>[0], signal: AbortSignal): Promise<readonly Batch[]> {\n const scan = corpus.scan(params);\n return scan.read(scan.plan(), { signal });\n}\n\nfunction encoder(tables: readonly VertexTable[], size: number, binding: Binding, seed: readonly unknown[]) {\n const dictionary = new Dictionary(seed);\n const codes = new Uint32Array(size);\n const sizes = binding.size === undefined ? null : new Float32Array(size).fill(Number.NaN);\n return {\n add(t: number, batch: Batch) {\n const table = tables[t] as VertexTable;\n const ids = batch.getChild(table.key)?.toArray() ?? [];\n const values = binding.category === undefined ? undefined : batch.getChild(binding.category)?.toArray();\n const ramp = binding.size === undefined ? undefined : batch.getChild(binding.size)?.toArray();\n const own = binding.byTable ? dictionary.code(table.name) : 0;\n for (let i = 0; i < batch.numRows; i++) {\n const id = Number(ids[i]);\n if (!(id < size)) continue;\n codes[id] = binding.byTable || binding.category === undefined ? own : dictionary.code(values?.[i] ?? null);\n if (sizes) sizes[id] = Number(ramp?.[i] ?? Number.NaN);\n }\n },\n finish(): Encoding {\n const order = dictionary.ranks();\n const ranks = codes.map((code) => order[code] ?? 0);\n const domain: unknown[] = [];\n order.forEach((rank, code) => {\n domain[rank] = dictionary.values[code];\n });\n return { ranks, sizes, domain };\n },\n };\n}\n\nfunction extentOf(positions: Float32Array): Geometry[\"extent\"] {\n let [x0, y0, x1, y1] = [Infinity, Infinity, -Infinity, -Infinity];\n for (let i = 0; i < positions.length; i += 2) {\n const x = positions[i] as number;\n const y = positions[i + 1] as number;\n if (Number.isNaN(x) || Number.isNaN(y)) continue;\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n return x0 > x1 ? null : { x: x0, y: y0, w: x1 - x0, h: y1 - y0 };\n}\n\nasync function readLinks(corpus: Corpus, tables: readonly VertexTable[], size: number, signal: AbortSignal): Promise<Float32Array> {\n const drawn = new Set(tables.map((table) => table.name));\n const relations = corpus.manifest.edge_tables.filter(\n (edge: EdgeTable) => drawn.has(edge.source.references) && drawn.has(edge.destination.references),\n );\n const answers = await Promise.all(\n relations.map((edge) => readAll(corpus, { table: edge.name, select: [edge.source.key, edge.destination.key] }, signal)),\n );\n const links = new Float32Array(2 * relations.reduce((sum, edge) => sum + edge.record_count, 0));\n let at = 0;\n answers.forEach((batches, r) => {\n const edge = relations[r] as EdgeTable;\n for (const batch of batches) {\n const src = batch.getChild(edge.source.key)?.toArray() ?? [];\n const dst = batch.getChild(edge.destination.key)?.toArray() ?? [];\n for (let e = 0; e < batch.numRows && at < links.length; e++) {\n const a = Number(src[e]);\n const b = Number(dst[e]);\n if (!(a < size && b < size)) continue;\n links[at++] = a;\n links[at++] = b;\n }\n }\n });\n return at === links.length ? links : links.slice(0, at);\n}\n\n/** One scan per drawn table and one per relation between them, read whole, in parallel. */\nexport async function loadGraph(\n corpus: Corpus,\n binding: Binding,\n seed: readonly unknown[],\n signal: AbortSignal,\n): Promise<{ geometry: Geometry; encoding: Encoding }> {\n const tables = drawnTables(corpus);\n const size = tables.reduce((sum, table) => sum + table.record_count, 0);\n const positions = new Float32Array(2 * size).fill(Number.NaN);\n const table = new Uint16Array(size);\n const encode = encoder(tables, size, binding, seed);\n const [vertices, links] = await together(signal, (signal) =>\n Promise.all([\n Promise.all(\n tables.map((t) => {\n const { x, y } = t.position as NonNullable<VertexTable[\"position\"]>;\n return readAll(corpus, { table: t.name, select: projectionOf(binding, [t.key, x, y], has(t)) }, signal);\n }),\n ),\n readLinks(corpus, tables, size, signal),\n ]),\n );\n vertices.forEach((batches, t) => {\n const { key, position } = tables[t] as VertexTable;\n for (const batch of batches) {\n const ids = batch.getChild(key)?.toArray() ?? [];\n const xs = batch.getChild(position?.x ?? \"\")?.toArray() ?? [];\n const ys = batch.getChild(position?.y ?? \"\")?.toArray() ?? [];\n for (let i = 0; i < batch.numRows; i++) {\n const id = Number(ids[i]);\n if (!(id < size)) continue;\n positions[id * 2] = Number(xs[i] ?? Number.NaN);\n positions[id * 2 + 1] = Number(ys[i] ?? Number.NaN);\n table[id] = t;\n }\n encode.add(t, batch);\n }\n });\n return { geometry: { tables, size, positions, table, links, extent: extentOf(positions) }, encoding: encode.finish() };\n}\n\n/** A new binding re-reads the channels and nothing else: the positions and the links stay uploaded. */\nexport async function loadEncoding(\n corpus: Corpus,\n geometry: Geometry,\n binding: Binding,\n seed: readonly unknown[],\n signal: AbortSignal,\n): Promise<Encoding> {\n const { tables, size } = geometry;\n const encode = encoder(tables, size, binding, seed);\n const answers = await together(signal, (signal) =>\n Promise.all(tables.map((t) => readAll(corpus, { table: t.name, select: projectionOf(binding, [t.key], has(t)) }, signal))),\n );\n answers.forEach((batches, t) => {\n for (const batch of batches) encode.add(t, batch);\n });\n return encode.finish();\n}\n\n/** What a filter kept: per table that holds every column it names, the surviving ids. */\nexport interface Kept {\n readonly filtered: ReadonlySet<number>;\n readonly ids: readonly number[];\n}\n\n/**\n * **A predicate, applied as a mask.** A table that lacks a column the filter names is not filtered,\n * which is what a `WHERE` over a union of the tables would do; a filter no drawn table can answer at\n * all is refused, so the unfiltered picture is never drawn as the filtered one.\n */\nexport async function readKept(corpus: Corpus, tables: readonly VertexTable[], filter: Filter, signal: AbortSignal): Promise<Kept> {\n const columns = columnsOf(filter);\n const filtered = tables.flatMap((table, t) => (columns.every(has(table)) ? [t] : []));\n if (filtered.length === 0) {\n throw new GraphError(\"graph/untranslatable-filter\", `no drawn vertex type has every column this filter names: ${columns.join(\", \")}`);\n }\n const answers = await together(signal, (signal) =>\n Promise.all(\n filtered.map((t) => readAll(corpus, { table: (tables[t] as VertexTable).name, filter, select: [(tables[t] as VertexTable).key] }, signal)),\n ),\n );\n const ids: number[] = [];\n answers.forEach((batches, i) => {\n const { key } = tables[filtered[i] as number] as VertexTable;\n for (const batch of batches) {\n const column = batch.getChild(key)?.toArray() ?? [];\n for (let r = 0; r < batch.numRows; r++) ids.push(Number(column[r]));\n }\n });\n return { filtered: new Set(filtered), ids };\n}\n\n/** `1` where a vertex survives the page's filter. */\nexport function maskOf(geometry: Geometry, kept: Kept): Uint8Array {\n const mask = new Uint8Array(geometry.size);\n for (let id = 0; id < geometry.size; id++) mask[id] = kept.filtered.has(geometry.table[id] as number) ? 0 : 1;\n for (const id of kept.ids) if (id < geometry.size) mask[id] = 1;\n return mask;\n}\n"],"names":["drawnTables","corpus","table","has","column","p","together","signal","reads","local","error","readAll","params","scan","encoder","tables","size","binding","seed","dictionary","Dictionary","codes","sizes","t","batch","ids","_a","values","_b","ramp","_c","own","i","id","order","ranks","code","domain","rank","extentOf","positions","x0","y0","x1","y1","x","y","readLinks","drawn","relations","edge","answers","links","sum","at","batches","r","src","dst","e","a","b","loadGraph","encode","vertices","projectionOf","key","position","xs","ys","loadEncoding","geometry","readKept","filter","columns","columnsOf","filtered","GraphError","maskOf","kept","mask"],"mappings":";;;;AAsCO,MAAMA,IAAc,CAACC,MAAkCA,EAAO,SAAS,cAAc,OAAO,CAACC,MAAUA,EAAM,QAAQ,GAEtHC,IAAM,CAACD,MAAuB,CAACE,MAAmBF,EAAM,WAAW,KAAK,CAACG,MAAMA,EAAE,SAASD,CAAM;AAM/F,SAASE,EAAYC,GAAqBC,GAAwD;AACvG,QAAMC,IAAQ,IAAI,gBAAA;AAClB,SAAOD,EAAM,YAAY,IAAI,CAACD,GAAQE,EAAM,MAAM,CAAC,CAAC,EAAE,MAAM,CAACC,MAAmB;AAC9E,UAAAD,EAAM,MAAA,GACAC;AAAA,EACR,CAAC;AACH;AAEA,eAAeC,EAAQV,GAAgBW,GAAuCL,GAAgD;AAC5H,QAAMM,IAAOZ,EAAO,KAAKW,CAAM;AAC/B,SAAOC,EAAK,KAAKA,EAAK,QAAQ,EAAE,QAAAN,GAAQ;AAC1C;AAEA,SAASO,EAAQC,GAAgCC,GAAcC,GAAkBC,GAA0B;AACzG,QAAMC,IAAa,IAAIC,EAAWF,CAAI,GAChCG,IAAQ,IAAI,YAAYL,CAAI,GAC5BM,IAAQL,EAAQ,SAAS,SAAY,OAAO,IAAI,aAAaD,CAAI,EAAE,KAAK,OAAO,GAAG;AACxF,SAAO;AAAA,IACL,IAAIO,GAAWC,GAAc;;AAC3B,YAAMtB,IAAQa,EAAOQ,CAAC,GAChBE,MAAMC,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KAAAnD,EAAA;AACxC;AAGO,SAASqD,EAAOP,GAAoBQ,GAAwB;AACjE,QAAMC,IAAO,IAAI,WAAWT,EAAS,IAAI;AACzC,WAAStC,IAAK,GAAGA,IAAKsC,EAAS,MAAMtC,IAAM,CAAA+C,EAAK/C,CAAE,IAAI8C,EAAK,SAAS,IAAIR,EAAS,MAAMtC,CAAE,CAAW,IAAI,IAAI;AAC5G,aAAWA,KAAM8C,EAAK,IAAK,CAAI9C,IAAKsC,EAAS,SAAMS,EAAK/C,CAAE,IAAI;AAC9D,SAAO+C;AACT;"}
|
|
1
|
+
{"version":3,"file":"load.js","sources":["../../src/core/load.ts"],"sourcesContent":["import type { Coordinator } from \"@kanzo-tech/mosaic\";\nimport { Dictionary } from \"./categories\";\nimport type { Binding } from \"./channels\";\nimport { readColumns, readLinks, type Structure } from \"./source\";\n\n/**\n * **The whole graph, read once and laid out as cosmos.gl's buffers.** A vertex's `dense_id` is its\n * index, and a vertex table is one contiguous range of them, so each table's answer is written into\n * its own slice and nothing is resolved row by row.\n */\n\n/** Where the vertices start and how they connect — read once per corpus and per position binding. */\nexport interface Geometry {\n readonly structure: Structure;\n /** Every vertex: ids `0 … size − 1`. */\n readonly size: number;\n /**\n * `[x, y, …]` by id. With `x` and `y` bound, the columns' values — `NaN` where a table lacks them,\n * which cosmos.gl does not draw. Unbound, a seeded start for the layout, inside `space`.\n */\n readonly positions: Float32Array;\n /** Whether the positions are the data's (`x`/`y` bound) or a start for the layout to move. */\n readonly bound: boolean;\n /** `[src, dst, …]` by id, every relation. */\n readonly links: Float32Array;\n /** Bound positions' extent; `null` for a layout's start, whose square is `space`. */\n readonly extent: { readonly x: number; readonly y: number; readonly w: number; readonly h: number } | null;\n /** The side of the square the layout runs in. */\n readonly space: number;\n}\n\n/** What the bound channels say about each vertex — read again when a binding changes. */\nexport interface Encoding {\n /** By id, the category's rank. */\n readonly ranks: Uint32Array;\n /** By id, the size ramp's raw value: the bound `r` column, or the vertex's degree. */\n readonly sizes: Float32Array;\n /** By id, the cluster a layout pulls the vertex toward, or `null` when `cluster` is unbound. */\n readonly clusters: (number | undefined)[] | null;\n /** What each rank is: the seed, then the other values seen, in rank order. */\n readonly domain: readonly unknown[];\n}\n\n/**\n * The layout's square: cosmos.gl's own 4,096 up to 200,000 vertices, and twice that past them —\n * measured on the gate in `/docs/graph/layout`: at 500,000 the default square presses the layout\n * against its border and the communities mix.\n */\nexport const spaceFor = (size: number): number => (size > 200_000 ? 8192 : 4096);\n\n/** A seeded `[0, 1)`: the same start for the same corpus, so a layout is reproducible. */\nfunction random(seed: number): () => number {\n let a = seed >>> 0;\n return () => {\n a = (a + 0x6d2b79f5) >>> 0;\n let t = a;\n t = Math.imul(t ^ (t >>> 15), t | 1);\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61);\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/**\n * **Cosmograph's start**: a Gaussian around the square's centre, its spread growing with the graph up\n * to an eighth of the side — tight enough that the forces gather it in a few hundred ticks, wide\n * enough that a million points are not one pixel.\n */\nfunction seeded(size: number, space: number): Float32Array {\n const next = random(size);\n const sigma = (space / 8) * Math.sqrt(Math.min(1, size / 1.5e6));\n const positions = new Float32Array(2 * size);\n for (let i = 0; i < size; i++) {\n const r = Math.sqrt(-2 * Math.log(1 - next())) * sigma;\n const theta = 2 * Math.PI * next();\n positions[2 * i] = space / 2 + r * Math.cos(theta);\n positions[2 * i + 1] = space / 2 + r * Math.sin(theta);\n }\n return positions;\n}\n\nfunction extentOf(positions: Float32Array): Geometry[\"extent\"] {\n let [x0, y0, x1, y1] = [Infinity, Infinity, -Infinity, -Infinity];\n for (let i = 0; i < positions.length; i += 2) {\n const x = positions[i] as number;\n const y = positions[i + 1] as number;\n if (Number.isNaN(x) || Number.isNaN(y)) continue;\n if (x < x0) x0 = x;\n if (x > x1) x1 = x;\n if (y < y0) y0 = y;\n if (y > y1) y1 = y;\n }\n return x0 > x1 ? null : { x: x0, y: y0, w: x1 - x0, h: y1 - y0 };\n}\n\n/** The links, and the positions: two bound columns, or a seeded start for the layout. */\nexport async function loadGeometry(coordinator: Coordinator, structure: Structure, binding: Binding): Promise<Geometry> {\n const { size } = structure;\n const space = spaceFor(size);\n const bound = binding.x !== undefined && binding.y !== undefined;\n const [links, columns] = await Promise.all([\n readLinks(coordinator, structure),\n bound ? readColumns(coordinator, structure, [binding.x as string, binding.y as string]) : Promise.resolve([]),\n ]);\n if (!bound) return { structure, size, positions: seeded(size, space), bound, links, extent: null, space };\n const positions = new Float32Array(2 * size).fill(Number.NaN);\n for (const { table, answer } of columns) {\n const xs = answer.getChild(binding.x as string)?.toArray() ?? [];\n const ys = answer.getChild(binding.y as string)?.toArray() ?? [];\n for (let i = 0; i < answer.numRows; i++) {\n const at = 2 * (table.first + i);\n positions[at] = xs[i] === null ? Number.NaN : Number(xs[i]);\n positions[at + 1] = ys[i] === null ? Number.NaN : Number(ys[i]);\n }\n }\n return { structure, size, positions, bound, links, extent: extentOf(positions), space };\n}\n\n/** Each vertex's degree over every relation — the size a point takes when `r` is unbound. */\nfunction degrees(size: number, links: Float32Array): Float32Array {\n const degree = new Float32Array(size);\n for (let i = 0; i < links.length; i++) {\n const id = links[i] as number;\n degree[id] = (degree[id] as number) + 1;\n }\n return degree;\n}\n\n/** The bound channels — category, size and cluster — over every vertex. */\nexport async function loadEncoding(\n coordinator: Coordinator,\n geometry: Geometry,\n binding: Binding,\n seed: readonly unknown[],\n): Promise<Encoding> {\n const { structure, size } = geometry;\n const select = [binding.category, binding.size, binding.cluster].filter((c): c is string => c !== undefined);\n const answers = select.length > 0 ? await readColumns(coordinator, structure, [...new Set(select)]) : [];\n const dictionary = new Dictionary(seed);\n const codes = new Uint32Array(size);\n const sizes = binding.size === undefined ? degrees(size, geometry.links) : new Float32Array(size).fill(Number.NaN);\n const groups = binding.cluster === undefined ? null : new Dictionary();\n const clusters: (number | undefined)[] | null = groups ? new Array<number | undefined>(size) : null;\n if (binding.byTable) {\n for (const table of structure.vertices) codes.fill(dictionary.code(table.name), table.first, table.first + table.rows);\n } else if (binding.category === undefined) {\n codes.fill(dictionary.code(null));\n }\n for (const { table, answer } of answers) {\n const values = binding.category === undefined || binding.byTable ? undefined : answer.getChild(binding.category)?.toArray();\n const ramp = binding.size === undefined ? undefined : answer.getChild(binding.size)?.toArray();\n const cluster = binding.cluster === undefined ? undefined : answer.getChild(binding.cluster)?.toArray();\n for (let i = 0; i < answer.numRows; i++) {\n const id = table.first + i;\n if (values) codes[id] = dictionary.code(values[i] ?? null);\n if (ramp) sizes[id] = ramp[i] === null ? Number.NaN : Number(ramp[i]);\n if (cluster && clusters && groups) clusters[id] = cluster[i] === null ? undefined : groups.code(cluster[i]);\n }\n }\n const order = dictionary.ranks();\n const ranks = codes.map((code) => order[code] ?? 0);\n const domain: unknown[] = [];\n order.forEach((rank, code) => {\n domain[rank] = dictionary.values[code];\n });\n return { ranks, sizes, clusters, domain };\n}\n"],"names":["spaceFor","size","random","seed","a","seeded","space","next","sigma","positions","i","r","theta","extentOf","x0","y0","x1","y1","x","y","loadGeometry","coordinator","structure","binding","bound","links","columns","readLinks","readColumns","table","answer","xs","_a","ys","_b","at","degrees","degree","id","loadEncoding","geometry","select","answers","dictionary","Dictionary","codes","sizes","groups","clusters","values","ramp","cluster","_c","order","ranks","code","domain","rank"],"mappings":";;AAgDO,MAAMA,IAAW,CAACC,MAA0BA,IAAO,MAAU,OAAO;AAG3E,SAASC,EAAOC,GAA4B;AAC1C,MAAIC,IAAID,MAAS;AACjB,SAAO,MAAM;AACX,IAAAC,IAAKA,IAAI,eAAgB;AACzB,QAAI,IAAIA;AACR,eAAI,KAAK,KAAK,IAAK,MAAM,IAAK,IAAI,CAAC,GACnC,KAAK,IAAI,KAAK,KAAK,IAAK,MAAM,GAAI,IAAI,EAAE,KAC/B,IAAK,MAAM,QAAS,KAAK;AAAA,EACpC;AACF;AAOA,SAASC,EAAOJ,GAAcK,GAA6B;AACzD,QAAMC,IAAOL,EAAOD,C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6B,IAAAtB,EAAO,SAASP,EAAQ,OAAO,MAA/B,OAAZ,SAAY6B,EAAkC;AAC9F,aAAS1C,IAAI,GAAGA,IAAIoB,EAAO,SAASpB,KAAK;AACvC,YAAM4B,IAAKT,EAAM,QAAQnB;AACzB,MAAIuC,QAAcX,CAAE,IAAIK,EAAW,KAAKM,EAAOvC,CAAC,KAAK,IAAI,IACrDwC,MAAMJ,EAAMR,CAAE,IAAIY,EAAKxC,CAAC,MAAM,OAAO,OAAO,MAAM,OAAOwC,EAAKxC,CAAC,CAAC,IAChEyC,KAAWH,KAAYD,MAAQC,EAASV,CAAE,IAAIa,EAAQzC,CAAC,MAAM,OAAO,SAAYqC,EAAO,KAAKI,EAAQzC,CAAC,CAAC;AAAA,IAC5G;AAAA,EACF;AACA,QAAM2C,IAAQV,EAAW,MAAA,GACnBW,IAAQT,EAAM,IAAI,CAACU,MAASF,EAAME,CAAI,KAAK,CAAC,GAC5CC,IAAoB,CAAA;AAC1B,SAAAH,EAAM,QAAQ,CAACI,GAAMF,MAAS;AAC5B,IAAAC,EAAOC,CAAI,IAAId,EAAW,OAAOY,CAAI;AAAA,EACvC,CAAC,GACM,EAAE,OAAAD,GAAO,OAAAR,GAAO,UAAAE,GAAU,QAAAQ,EAAA;AACnC;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Coordinator } from '@kanzo-tech/mosaic';
|
|
2
|
+
/**
|
|
3
|
+
* **What the graph reads, through the page's coordinator.** A corpus fossil's `open` attached under
|
|
4
|
+
* a name is a catalog: a view per table, and the manifest as two relations — `fossil_tables` and
|
|
5
|
+
* `fossil_columns`. The graph reads the structure from those and the rows from the views, with the
|
|
6
|
+
* same coordinator — and the same cache — every chart on the page uses. Nothing here parses a
|
|
7
|
+
* manifest and nothing here owns a connection.
|
|
8
|
+
*/
|
|
9
|
+
/** One vertex table: the `dense_id` range it holds, and what it can be asked for. */
|
|
10
|
+
export interface VertexTable {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
/** Its first `dense_id`; its vertices are `first … first + rows − 1`. */
|
|
13
|
+
readonly first: number;
|
|
14
|
+
readonly rows: number;
|
|
15
|
+
/** Every column, by name. */
|
|
16
|
+
readonly columns: ReadonlySet<string>;
|
|
17
|
+
/** The `identity` column — what a label falls back to. */
|
|
18
|
+
readonly identity: string;
|
|
19
|
+
}
|
|
20
|
+
/** One relation: its table, and the vertex tables its `src` and `dst` point into. */
|
|
21
|
+
export interface EdgeTable {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly source: string;
|
|
24
|
+
readonly destination: string;
|
|
25
|
+
readonly rows: number;
|
|
26
|
+
}
|
|
27
|
+
/** The attached corpus, as its two relations describe it. */
|
|
28
|
+
export interface Structure {
|
|
29
|
+
/** The catalog `open` attached the corpus under. */
|
|
30
|
+
readonly from: string;
|
|
31
|
+
readonly vertices: readonly VertexTable[];
|
|
32
|
+
readonly edges: readonly EdgeTable[];
|
|
33
|
+
/** Every vertex, every table: `dense_id` runs `0 … size − 1`. */
|
|
34
|
+
readonly size: number;
|
|
35
|
+
}
|
|
36
|
+
/** A quoted SQL identifier. */
|
|
37
|
+
export declare const ident: (name: string) => string;
|
|
38
|
+
/** A single-quoted SQL string. */
|
|
39
|
+
export declare const lit: (value: string) => string;
|
|
40
|
+
/** A table of the attached corpus, as SQL names it. */
|
|
41
|
+
export declare const relation: (from: string, table: string) => string;
|
|
42
|
+
/** One column of an answer, by name, as its own array. */
|
|
43
|
+
export interface Answer {
|
|
44
|
+
readonly numRows: number;
|
|
45
|
+
getChild(name: string): {
|
|
46
|
+
toArray(): ArrayLike<unknown>;
|
|
47
|
+
get(index: number): unknown;
|
|
48
|
+
} | null;
|
|
49
|
+
}
|
|
50
|
+
/** Run `sql` on the coordinator, in Arrow. */
|
|
51
|
+
export declare const ask: (coordinator: Coordinator, sql: string) => Promise<Answer>;
|
|
52
|
+
/** `fossil_tables` and `fossil_columns`, read once per corpus. */
|
|
53
|
+
export declare function readStructure(coordinator: Coordinator, from: string): Promise<Structure>;
|
|
54
|
+
/** The vertex table a `dense_id` falls in. */
|
|
55
|
+
export declare function tableOf(structure: Structure, vertex: number): VertexTable | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Each table's rows of `select`, in `dense_id` order — the table's slice of every buffer. A table
|
|
58
|
+
* that lacks a selected column answers `null` for it, so one statement shape serves every table.
|
|
59
|
+
*/
|
|
60
|
+
export declare function readColumns(coordinator: Coordinator, structure: Structure, select: readonly string[]): Promise<{
|
|
61
|
+
table: VertexTable;
|
|
62
|
+
answer: Answer;
|
|
63
|
+
}[]>;
|
|
64
|
+
/** `[src, dst, …]` over every relation, as cosmos.gl takes links. */
|
|
65
|
+
export declare function readLinks(coordinator: Coordinator, structure: Structure): Promise<Float32Array>;
|
|
66
|
+
/** The column a vertex's text is read from: `title` where its table has it, else its `identity`. */
|
|
67
|
+
export declare const titleColumn: (table: VertexTable, title: string | undefined) => string;
|
|
68
|
+
/** One vertex's row, as its table orders it — every column but the address. */
|
|
69
|
+
export interface VertexDetail {
|
|
70
|
+
readonly vertex: number;
|
|
71
|
+
/** The vertex table it belongs to. */
|
|
72
|
+
readonly table: string;
|
|
73
|
+
readonly fields: readonly {
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly value: unknown;
|
|
76
|
+
}[];
|
|
77
|
+
}
|
|
78
|
+
/** One vertex's row: every column but the address. */
|
|
79
|
+
export declare function readVertex(coordinator: Coordinator, structure: Structure, vertex: number): Promise<VertexDetail | null>;
|
|
80
|
+
/** The text of a few vertices, by id — a label's, a hover card's. One statement per table they fall in. */
|
|
81
|
+
export declare function readTitles(coordinator: Coordinator, structure: Structure, vertices: readonly number[], title: string | undefined): Promise<Map<number, string>>;
|
|
82
|
+
/**
|
|
83
|
+
* **Vertices whose text contains `query`**, case-insensitively, `limit` at most — Cosmograph's search,
|
|
84
|
+
* a `LIKE` per table in one statement. Nothing is read until the reader types.
|
|
85
|
+
*/
|
|
86
|
+
export declare function searchTitles(coordinator: Coordinator, structure: Structure, query: string, title: string | undefined, limit: number): Promise<{
|
|
87
|
+
id: number;
|
|
88
|
+
text: string;
|
|
89
|
+
}[]>;
|
|
90
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/core/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;GAMG;AAEH,qFAAqF;AACrF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,0DAA0D;IAC1D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,qFAAqF;AACrF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,6DAA6D;AAC7D,MAAM,WAAW,SAAS;IACxB,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,+BAA+B;AAC/B,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,KAAG,MAAyC,CAAC;AAC/E,kCAAkC;AAClC,eAAO,MAAM,GAAG,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AAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAChF;AAED,sDAAsD;AACtD,wBAAsB,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAO7H;AAED,2GAA2G;AAC3G,wBAAsB,UAAU,CAC9B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAmB9B;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAYzC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const w = (t) => `"${t.replace(/"/g, '""')}"`, p = (t) => `'${t.replace(/'/g, "''")}'`, S = (t, n) => `${w(t)}.${w(n)}`, R = (t, n) => t.query(n, { type: "arrow" }), l = (t, n) => {
|
|
2
|
+
var e;
|
|
3
|
+
return ((e = t.getChild(n)) == null ? void 0 : e.toArray()) ?? [];
|
|
4
|
+
};
|
|
5
|
+
async function C(t, n) {
|
|
6
|
+
const [e, o] = await Promise.all([
|
|
7
|
+
R(t, `SELECT table_name, kind, rows::DOUBLE AS rows, first_id::DOUBLE AS first_id, source, destination FROM ${S(n, "fossil_tables")} ORDER BY first_id NULLS LAST, table_name`),
|
|
8
|
+
R(t, `SELECT table_name, column_name, role FROM ${S(n, "fossil_columns")} ORDER BY table_name, ordinal`)
|
|
9
|
+
]), a = /* @__PURE__ */ new Map(), [i, s, c] = [l(o, "table_name"), l(o, "column_name"), l(o, "role")];
|
|
10
|
+
for (let r = 0; r < o.numRows; r++) {
|
|
11
|
+
const f = a.get(String(i[r])) ?? { names: /* @__PURE__ */ new Set(), identity: "subject" };
|
|
12
|
+
f.names.add(String(s[r])), c[r] === "identity" && (f.identity = String(s[r])), a.set(String(i[r]), f);
|
|
13
|
+
}
|
|
14
|
+
const d = l(e, "table_name"), E = l(e, "kind"), m = l(e, "rows"), u = l(e, "first_id"), $ = l(e, "source"), O = l(e, "destination"), g = [], _ = [];
|
|
15
|
+
for (let r = 0; r < e.numRows; r++) {
|
|
16
|
+
const f = String(d[r]);
|
|
17
|
+
if (E[r] === "vertex") {
|
|
18
|
+
const L = a.get(f);
|
|
19
|
+
g.push({
|
|
20
|
+
name: f,
|
|
21
|
+
first: Number(u[r]),
|
|
22
|
+
rows: Number(m[r]),
|
|
23
|
+
columns: (L == null ? void 0 : L.names) ?? /* @__PURE__ */ new Set(),
|
|
24
|
+
identity: (L == null ? void 0 : L.identity) ?? "subject"
|
|
25
|
+
});
|
|
26
|
+
} else
|
|
27
|
+
_.push({ name: f, source: String($[r]), destination: String(O[r]), rows: Number(m[r]) });
|
|
28
|
+
}
|
|
29
|
+
return { from: n, vertices: g, edges: _, size: g.reduce((r, f) => r + f.rows, 0) };
|
|
30
|
+
}
|
|
31
|
+
function y(t, n) {
|
|
32
|
+
return t.vertices.find((e) => n >= e.first && n < e.first + e.rows);
|
|
33
|
+
}
|
|
34
|
+
async function b(t, n, e) {
|
|
35
|
+
return Promise.all(
|
|
36
|
+
n.vertices.map(async (o) => {
|
|
37
|
+
const a = e.map((s) => o.columns.has(s) ? `${w(s)} AS ${w(s)}` : `NULL AS ${w(s)}`).join(", "), i = await R(t, `SELECT ${a} FROM ${S(n.from, o.name)} ORDER BY dense_id`);
|
|
38
|
+
return { table: o, answer: i };
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
async function T(t, n) {
|
|
43
|
+
const e = await Promise.all(
|
|
44
|
+
n.edges.map((i) => R(t, `SELECT src::DOUBLE AS src, dst::DOUBLE AS dst FROM ${S(n.from, i.name)}`))
|
|
45
|
+
), o = new Float32Array(2 * e.reduce((i, s) => i + s.numRows, 0));
|
|
46
|
+
let a = 0;
|
|
47
|
+
for (const i of e) {
|
|
48
|
+
const [s, c] = [l(i, "src"), l(i, "dst")];
|
|
49
|
+
for (let d = 0; d < i.numRows; d++)
|
|
50
|
+
o[a++] = s[d], o[a++] = c[d];
|
|
51
|
+
}
|
|
52
|
+
return o;
|
|
53
|
+
}
|
|
54
|
+
const A = (t, n) => n !== void 0 && t.columns.has(n) ? n : t.identity;
|
|
55
|
+
async function x(t, n, e) {
|
|
56
|
+
const o = y(n, e);
|
|
57
|
+
if (!o) return null;
|
|
58
|
+
const a = await R(t, `SELECT * EXCLUDE (dense_id) FROM ${S(n.from, o.name)} WHERE dense_id = ${e}`);
|
|
59
|
+
if (a.numRows === 0) return null;
|
|
60
|
+
const i = [...o.columns].filter((s) => s !== "dense_id");
|
|
61
|
+
return { vertex: e, table: o.name, fields: i.map((s) => {
|
|
62
|
+
var c;
|
|
63
|
+
return { name: s, value: ((c = a.getChild(s)) == null ? void 0 : c.get(0)) ?? null };
|
|
64
|
+
}) };
|
|
65
|
+
}
|
|
66
|
+
async function M(t, n, e, o) {
|
|
67
|
+
const a = /* @__PURE__ */ new Map();
|
|
68
|
+
for (const s of e) {
|
|
69
|
+
const c = y(n, s);
|
|
70
|
+
c && a.set(c, [...a.get(c) ?? [], s]);
|
|
71
|
+
}
|
|
72
|
+
const i = /* @__PURE__ */ new Map();
|
|
73
|
+
return await Promise.all(
|
|
74
|
+
[...a].map(async ([s, c]) => {
|
|
75
|
+
const d = A(s, o), E = await R(
|
|
76
|
+
t,
|
|
77
|
+
`SELECT dense_id::DOUBLE AS id, ${w(d)}::VARCHAR AS text FROM ${S(n.from, s.name)} WHERE dense_id IN (${c.join(", ")})`
|
|
78
|
+
), [m, u] = [l(E, "id"), l(E, "text")];
|
|
79
|
+
for (let $ = 0; $ < E.numRows; $++) i.set(m[$], String(u[$] ?? ""));
|
|
80
|
+
})
|
|
81
|
+
), i;
|
|
82
|
+
}
|
|
83
|
+
async function D(t, n, e, o, a) {
|
|
84
|
+
if (n.vertices.length === 0) return [];
|
|
85
|
+
const i = p(`%${e.replace(/[\\%_]/g, (m) => `\\${m}`)}%`), s = n.vertices.map((m) => {
|
|
86
|
+
const u = `${w(A(m, o))}::VARCHAR`;
|
|
87
|
+
return `SELECT dense_id::DOUBLE AS id, ${u} AS text FROM ${S(n.from, m.name)} WHERE ${u} ILIKE ${i} ESCAPE '\\'`;
|
|
88
|
+
}).join(" UNION ALL "), c = await R(t, `SELECT * FROM (${s}) ORDER BY length(text), text LIMIT ${a}`), [d, E] = [l(c, "id"), l(c, "text")];
|
|
89
|
+
return Array.from({ length: c.numRows }, (m, u) => ({ id: d[u], text: String(E[u] ?? "") }));
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
R as ask,
|
|
93
|
+
w as ident,
|
|
94
|
+
p as lit,
|
|
95
|
+
b as readColumns,
|
|
96
|
+
T as readLinks,
|
|
97
|
+
C as readStructure,
|
|
98
|
+
M as readTitles,
|
|
99
|
+
x as readVertex,
|
|
100
|
+
S as relation,
|
|
101
|
+
D as searchTitles,
|
|
102
|
+
y as tableOf,
|
|
103
|
+
A as titleColumn
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sources":["../../src/core/source.ts"],"sourcesContent":["import type { Coordinator } from \"@kanzo-tech/mosaic\";\n\n/**\n * **What the graph reads, through the page's coordinator.** A corpus fossil's `open` attached under\n * a name is a catalog: a view per table, and the manifest as two relations — `fossil_tables` and\n * `fossil_columns`. The graph reads the structure from those and the rows from the views, with the\n * same coordinator — and the same cache — every chart on the page uses. Nothing here parses a\n * manifest and nothing here owns a connection.\n */\n\n/** One vertex table: the `dense_id` range it holds, and what it can be asked for. */\nexport interface VertexTable {\n readonly name: string;\n /** Its first `dense_id`; its vertices are `first … first + rows − 1`. */\n readonly first: number;\n readonly rows: number;\n /** Every column, by name. */\n readonly columns: ReadonlySet<string>;\n /** The `identity` column — what a label falls back to. */\n readonly identity: string;\n}\n\n/** One relation: its table, and the vertex tables its `src` and `dst` point into. */\nexport interface EdgeTable {\n readonly name: string;\n readonly source: string;\n readonly destination: string;\n readonly rows: number;\n}\n\n/** The attached corpus, as its two relations describe it. */\nexport interface Structure {\n /** The catalog `open` attached the corpus under. */\n readonly from: string;\n readonly vertices: readonly VertexTable[];\n readonly edges: readonly EdgeTable[];\n /** Every vertex, every table: `dense_id` runs `0 … size − 1`. */\n readonly size: number;\n}\n\n/** A quoted SQL identifier. */\nexport const ident = (name: string): string => `\"${name.replace(/\"/g, '\"\"')}\"`;\n/** A single-quoted SQL string. */\nexport const lit = (value: string): string => `'${value.replace(/'/g, \"''\")}'`;\n/** A table of the attached corpus, as SQL names it. */\nexport const relation = (from: string, table: string): string => `${ident(from)}.${ident(table)}`;\n\n/** One column of an answer, by name, as its own array. */\nexport interface Answer {\n readonly numRows: number;\n getChild(name: string): { toArray(): ArrayLike<unknown>; get(index: number): unknown } | null;\n}\n\n/** Run `sql` on the coordinator, in Arrow. */\nexport const ask = (coordinator: Coordinator, sql: string): Promise<Answer> =>\n coordinator.query(sql, { type: \"arrow\" }) as Promise<Answer>;\n\nconst column = (answer: Answer, name: string): ArrayLike<unknown> => answer.getChild(name)?.toArray() ?? [];\n\n/** `fossil_tables` and `fossil_columns`, read once per corpus. */\nexport async function readStructure(coordinator: Coordinator, from: string): Promise<Structure> {\n const [tables, columns] = await Promise.all([\n ask(coordinator, `SELECT table_name, kind, rows::DOUBLE AS rows, first_id::DOUBLE AS first_id, source, destination FROM ${relation(from, \"fossil_tables\")} ORDER BY first_id NULLS LAST, table_name`),\n ask(coordinator, `SELECT table_name, column_name, role FROM ${relation(from, \"fossil_columns\")} ORDER BY table_name, ordinal`),\n ]);\n const byTable = new Map<string, { names: Set<string>; identity: string }>();\n const [tn, cn, role] = [column(columns, \"table_name\"), column(columns, \"column_name\"), column(columns, \"role\")];\n for (let i = 0; i < columns.numRows; i++) {\n const entry = byTable.get(String(tn[i])) ?? { names: new Set<string>(), identity: \"subject\" };\n entry.names.add(String(cn[i]));\n if (role[i] === \"identity\") entry.identity = String(cn[i]);\n byTable.set(String(tn[i]), entry);\n }\n const name = column(tables, \"table_name\");\n const kind = column(tables, \"kind\");\n const rows = column(tables, \"rows\");\n const first = column(tables, \"first_id\");\n const source = column(tables, \"source\");\n const destination = column(tables, \"destination\");\n const vertices: VertexTable[] = [];\n const edges: EdgeTable[] = [];\n for (let i = 0; i < tables.numRows; i++) {\n const table = String(name[i]);\n if (kind[i] === \"vertex\") {\n const described = byTable.get(table);\n vertices.push({\n name: table,\n first: Number(first[i]),\n rows: Number(rows[i]),\n columns: described?.names ?? new Set(),\n identity: described?.identity ?? \"subject\",\n });\n } else {\n edges.push({ name: table, source: String(source[i]), destination: String(destination[i]), rows: Number(rows[i]) });\n }\n }\n return { from, vertices, edges, size: vertices.reduce((sum, v) => sum + v.rows, 0) };\n}\n\n/** The vertex table a `dense_id` falls in. */\nexport function tableOf(structure: Structure, vertex: number): VertexTable | undefined {\n return structure.vertices.find((t) => vertex >= t.first && vertex < t.first + t.rows);\n}\n\n/**\n * Each table's rows of `select`, in `dense_id` order — the table's slice of every buffer. A table\n * that lacks a selected column answers `null` for it, so one statement shape serves every table.\n */\nexport async function readColumns(\n coordinator: Coordinator,\n structure: Structure,\n select: readonly string[],\n): Promise<{ table: VertexTable; answer: Answer }[]> {\n return Promise.all(\n structure.vertices.map(async (table) => {\n const projection = select.map((c) => (table.columns.has(c) ? `${ident(c)} AS ${ident(c)}` : `NULL AS ${ident(c)}`)).join(\", \");\n const answer = await ask(coordinator, `SELECT ${projection} FROM ${relation(structure.from, table.name)} ORDER BY dense_id`);\n return { table, answer };\n }),\n );\n}\n\n/** `[src, dst, …]` over every relation, as cosmos.gl takes links. */\nexport async function readLinks(coordinator: Coordinator, structure: Structure): Promise<Float32Array> {\n const answers = await Promise.all(\n structure.edges.map((edge) => ask(coordinator, `SELECT src::DOUBLE AS src, dst::DOUBLE AS dst FROM ${relation(structure.from, edge.name)}`)),\n );\n const links = new Float32Array(2 * answers.reduce((sum, a) => sum + a.numRows, 0));\n let at = 0;\n for (const answer of answers) {\n const [src, dst] = [column(answer, \"src\"), column(answer, \"dst\")];\n for (let e = 0; e < answer.numRows; e++) {\n links[at++] = src[e] as number;\n links[at++] = dst[e] as number;\n }\n }\n return links;\n}\n\n/** The column a vertex's text is read from: `title` where its table has it, else its `identity`. */\nexport const titleColumn = (table: VertexTable, title: string | undefined): string =>\n title !== undefined && table.columns.has(title) ? title : table.identity;\n\n/** One vertex's row, as its table orders it — every column but the address. */\nexport interface VertexDetail {\n readonly vertex: number;\n /** The vertex table it belongs to. */\n readonly table: string;\n readonly fields: readonly { readonly name: string; readonly value: unknown }[];\n}\n\n/** One vertex's row: every column but the address. */\nexport async function readVertex(coordinator: Coordinator, structure: Structure, vertex: number): Promise<VertexDetail | null> {\n const table = tableOf(structure, vertex);\n if (!table) return null;\n const answer = await ask(coordinator, `SELECT * EXCLUDE (dense_id) FROM ${relation(structure.from, table.name)} WHERE dense_id = ${vertex}`);\n if (answer.numRows === 0) return null;\n const names = [...table.columns].filter((name) => name !== \"dense_id\");\n return { vertex, table: table.name, fields: names.map((name) => ({ name, value: answer.getChild(name)?.get(0) ?? null })) };\n}\n\n/** The text of a few vertices, by id — a label's, a hover card's. One statement per table they fall in. */\nexport async function readTitles(\n coordinator: Coordinator,\n structure: Structure,\n vertices: readonly number[],\n title: string | undefined,\n): Promise<Map<number, string>> {\n const byTable = new Map<VertexTable, number[]>();\n for (const vertex of vertices) {\n const table = tableOf(structure, vertex);\n if (table) byTable.set(table, [...(byTable.get(table) ?? []), vertex]);\n }\n const found = new Map<number, string>();\n await Promise.all(\n [...byTable].map(async ([table, ids]) => {\n const text = titleColumn(table, title);\n const answer = await ask(\n coordinator,\n `SELECT dense_id::DOUBLE AS id, ${ident(text)}::VARCHAR AS text FROM ${relation(structure.from, table.name)} WHERE dense_id IN (${ids.join(\", \")})`,\n );\n const [id, texts] = [column(answer, \"id\"), column(answer, \"text\")];\n for (let i = 0; i < answer.numRows; i++) found.set(id[i] as number, String(texts[i] ?? \"\"));\n }),\n );\n return found;\n}\n\n/**\n * **Vertices whose text contains `query`**, case-insensitively, `limit` at most — Cosmograph's search,\n * a `LIKE` per table in one statement. Nothing is read until the reader types.\n */\nexport async function searchTitles(\n coordinator: Coordinator,\n structure: Structure,\n query: string,\n title: string | undefined,\n limit: number,\n): Promise<{ id: number; text: string }[]> {\n if (structure.vertices.length === 0) return [];\n const needle = lit(`%${query.replace(/[\\\\%_]/g, (c) => `\\\\${c}`)}%`);\n const union = structure.vertices\n .map((table) => {\n const text = `${ident(titleColumn(table, title))}::VARCHAR`;\n return `SELECT dense_id::DOUBLE AS id, ${text} AS text FROM ${relation(structure.from, table.name)} WHERE ${text} ILIKE ${needle} ESCAPE '\\\\'`;\n })\n .join(\" UNION ALL \");\n const answer = await ask(coordinator, `SELECT * FROM (${union}) ORDER BY length(text), text LIMIT ${limit}`);\n const [id, text] = [column(answer, \"id\"), column(answer, \"text\")];\n return Array.from({ length: answer.numRows }, (_, i) => ({ id: id[i] as number, text: String(text[i] ?? \"\") }));\n}\n"],"names":["ident","name","lit","value","relation","from","table","ask","coordinator","sql","column","answer","_a","readStructure","tables","columns","byTable","tn","cn","role","i","entry","kind","rows","first","source","destination","vertices","edges","described","sum","v","tableOf","structure","vertex","t","readColumns","select","projection","c","readLinks","answers","edge","links","a","at","src","dst","e","titleColumn","title","readVertex","names","readTitles","found","ids","text","id","texts","searchTitles","query","limit","needle","union","_"],"mappings":"AAyCO,MAAMA,IAAQ,CAACC,MAAyB,IAAIA,EAAK,QAAQ,MAAM,IAAI,CAAC,KAE9DC,IAAM,CAACC,MAA0B,IAAIA,EAAM,QAAQ,MAAM,IAAI,CAAC,KAE9DC,IAAW,CAACC,GAAcC,MAA0B,GAAGN,EAAMK,CAAI,CAAC,IAAIL,EAAMM,CAAK,CAAC,IASlFC,IAAM,CAACC,GAA0BC,MAC5CD,EAAY,MAAMC,GAAK,EAAE,MAAM,QAAA,CAAS,GAEpCC,IAAS,CAACC,GAAgBV,MAAA;AAhBzB,MAAAW;AAgB8D,WAAAA,IAAAD,EAAO,SAASV,CAAI,MAApB,gBAAAW,EAAuB,cAAa,CAAA;AAAA;AAGzG,eAAsBC,EAAcL,GAA0BH,GAAkC;AAC9F,QAAM,CAACS,GAAQC,CAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC1CR,EAAIC,GAAa,yGAAyGJ,EAASC,GAAM,eAAe,CAAC,2CAA2C;AAAA,IACpME,EAAIC,GAAa,6CAA6CJ,EAASC,GAAM,gBAAgB,CAAC,+BAA+B;AAAA,EAAA,CAC9H,GACKW,wBAAc,IAAA,GACd,CAACC,GAAIC,GAAIC,CAAI,IAAI,CAACT,EAAOK,GAAS,YAAY,GAAGL,EAAOK,GAAS,aAAa,GAAGL,EAAOK,GAAS,MAAM,CAAC;AAC9G,WAASK,IAAI,GAAGA,IAAIL,EAAQ,SAASK,KAAK;AACxC,UAAMC,IAAQL,EAAQ,IAAI,OAAOC,EAAGG,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,oBAAI,IAAA,GAAe,UAAU,UAAA;AAClF,IAAAC,EAAM,MAAM,IAAI,OAAOH,EAAGE,CAAC,CAAC,CAAC,GACzBD,EAAKC,CAAC,MAAM,iBAAkB,WA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AA,GAE5I,CAACE,GAAIC,CAAK,IAAI,CAAChD,EAAOC,GAAQ,IAAI,GAAGD,EAAOC,GAAQ,MAAM,CAAC;AACjE,eAASS,IAAI,GAAGA,IAAIT,EAAO,SAASS,IAAK,CAAAkC,EAAM,IAAIG,EAAGrC,CAAC,GAAa,OAAOsC,EAAMtC,CAAC,KAAK,EAAE,CAAC;AAAA,IAC5F,CAAC;AAAA,EAAA,GAEIkC;AACT;AAMA,eAAsBK,EACpBnD,GACAyB,GACA2B,GACAV,GACAW,GACyC;AACzC,MAAI5B,EAAU,SAAS,WAAW,UAAU,CAAA;AAC5C,QAAM6B,IAAS5D,EAAI,IAAI0D,EAAM,QAAQ,WAAW,CAACrB,MAAM,KAAKA,CAAC,EAAE,CAAC,GAAG,GAC7DwB,IAAQ9B,EAAU,SACrB,IAAI,CAAC3B,MAAU;AACd,UAAMkD,IAAO,GAAGxD,EAAMiD,EAAY3C,GAAO4C,CAAK,CAAC,CAAC;AAChD,WAAO,kCAAkCM,CAAI,iBAAiBpD,EAAS6B,EAAU,MAAM3B,EAAM,IAAI,CAAC,UAAUkD,CAAI,UAAUM,CAAM;AAAA,EAClI,CAAC,EACA,KAAK,aAAa,GACfnD,IAAS,MAAMJ,EAAIC,GAAa,kBAAkBuD,CAAK,uCAAuCF,CAAK,EAAE,GACrG,CAACJ,GAAID,CAAI,IAAI,CAAC9C,EAAOC,GAAQ,IAAI,GAAGD,EAAOC,GAAQ,MAAM,CAAC;AAChE,SAAO,MAAM,KAAK,EAAE,QAAQA,EAAO,QAAA,GAAW,CAACqD,GAAG5C,OAAO,EAAE,IAAIqC,EAAGrC,CAAC,GAAa,MAAM,OAAOoC,EAAKpC,CAAC,KAAK,EAAE,EAAA,EAAI;AAChH;"}
|
package/dist/core/state.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { Selection as Crossfilter } from '@kanzo-tech/mosaic';
|
|
1
|
+
import { Coordinator, Selection as Crossfilter } from '@kanzo-tech/mosaic';
|
|
2
2
|
import { LookPatch } from '../render/graph-looks';
|
|
3
3
|
import { Sim } from '../render/graph-sim';
|
|
4
4
|
import { Binding, Channels } from './channels';
|
|
5
|
-
import { Corpus } from '@fossil-lang/corpus';
|
|
6
5
|
import { Encoding, Geometry } from './load';
|
|
6
|
+
import { Structure } from './source';
|
|
7
7
|
import { Motion, Selection, SelectionSource, Tool, VertexId } from './types';
|
|
8
8
|
export interface GraphOptions extends Channels {
|
|
9
9
|
/**
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* The promise must settle. The graph shows *opening* until it does and sets no deadline of its
|
|
14
|
-
* own: the waits inside an open are fossil's to bound, and a rejection reaches `onFailure`.
|
|
10
|
+
* The catalog fossil's `open` attached the corpus under — its tables, `fossil_tables` and
|
|
11
|
+
* `fossil_columns` — or `null` for none yet. The graph reads it through `coordinator`.
|
|
15
12
|
*/
|
|
16
|
-
|
|
13
|
+
from: string | null;
|
|
14
|
+
/** The page's Mosaic coordinator: the one connection every chart and the graph read through. */
|
|
15
|
+
coordinator: Coordinator | null;
|
|
17
16
|
/** Which column the size ramp is spent on — Plot's `r`. */
|
|
18
17
|
r?: string;
|
|
19
18
|
/** Which column a label and the hover card show — Plot's `title`. Absent, each table's `identity`. */
|
|
@@ -30,8 +29,9 @@ export interface GraphOptions extends Channels {
|
|
|
30
29
|
/** The force coefficients, as a patch over this package's own. */
|
|
31
30
|
sim?: Partial<Sim>;
|
|
32
31
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* Whether the layout runs. By default it does exactly when `x` and `y` are unbound — Cosmograph's
|
|
33
|
+
* rule: bound columns place the points and nothing else does. `GraphToolbar` starts and stops the
|
|
34
|
+
* layout whatever this says.
|
|
35
35
|
*/
|
|
36
36
|
simulate?: boolean;
|
|
37
37
|
/**
|
|
@@ -43,20 +43,19 @@ export interface GraphOptions extends Channels {
|
|
|
43
43
|
onFocus?: (vertex: VertexId | null) => void;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* Where the graph is in its life. `none` is no corpus; `
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* with — none came up, or the one it had was lost.
|
|
46
|
+
* Where the graph is in its life. `none` is no corpus; `loading` is the graph, a binding or a filter
|
|
47
|
+
* not yet read or not yet drawn; `idle` is all of it drawn; `failed` is a corpus that would not read,
|
|
48
|
+
* or a canvas with no GPU device to draw with — none came up, or the one it had was lost.
|
|
50
49
|
*
|
|
51
50
|
* **It is the data's life, not the layout's.** A layout running over a drawn graph is `idle` here and
|
|
52
51
|
* `running` in `motion`: two axes, because each can move without the other — a filter loads under a
|
|
53
52
|
* paused layout, and a layout runs over a graph with nothing left to read. A host that shows one word
|
|
54
53
|
* reads both, `motion === "running"` as "laying out" and `progress` for how far.
|
|
55
54
|
*/
|
|
56
|
-
export type GraphStatus = "none" | "
|
|
55
|
+
export type GraphStatus = "none" | "loading" | "idle" | "failed";
|
|
57
56
|
/** What the loaded graph holds, under the page's filter. */
|
|
58
57
|
export interface Drawn {
|
|
59
|
-
/** Vertices
|
|
58
|
+
/** Vertices in full colour: every one with a position that survives the filter. */
|
|
60
59
|
readonly vertices: number;
|
|
61
60
|
/** Links drawn: every loaded relation whose two ends are drawn. */
|
|
62
61
|
readonly edges: number;
|
|
@@ -68,7 +67,7 @@ export interface Drawn {
|
|
|
68
67
|
/** What a host and the parts read, through `useGraphState`. */
|
|
69
68
|
export interface GraphState {
|
|
70
69
|
readonly status: GraphStatus;
|
|
71
|
-
/**
|
|
70
|
+
/** Every vertex of the corpus — it does not shrink with a filter. */
|
|
72
71
|
readonly total: number | undefined;
|
|
73
72
|
/** What is loaded, or `null` before the graph has loaded. */
|
|
74
73
|
readonly drawn: Drawn | null;
|
|
@@ -82,16 +81,16 @@ export interface GraphState {
|
|
|
82
81
|
readonly motion: Motion;
|
|
83
82
|
/** How far through settling a live layout is, `0`–`1`. */
|
|
84
83
|
readonly progress: number;
|
|
85
|
-
/** The options as given, with the corpus once it is open. */
|
|
86
84
|
readonly options: GraphOptions;
|
|
87
|
-
|
|
85
|
+
/** The corpus's tables, once read. */
|
|
86
|
+
readonly structure: Structure | null;
|
|
88
87
|
}
|
|
89
88
|
/** The state, plus what only the renderer and the parts read. */
|
|
90
89
|
export interface GraphSnapshot extends GraphState {
|
|
91
90
|
readonly binding: Binding;
|
|
92
91
|
readonly geometry: Geometry | null;
|
|
93
92
|
readonly encoding: Encoding | null;
|
|
94
|
-
/** `1` where a vertex survives the page's filter; `null` when nothing is filtered. */
|
|
93
|
+
/** `1` where a vertex survives the page's filter; `null` when nothing is filtered. A vertex that does not is greyed out, never hidden. */
|
|
95
94
|
readonly mask: Uint8Array | null;
|
|
96
95
|
}
|
|
97
96
|
/**
|
package/dist/core/state.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/core/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/core/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;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IAC3B,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IACxC,OAAO,IAAI,IAAI,CAAC;IAChB,MAAM,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,eAAe,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7F,KAAK,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;IACrC,KAAK,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;IACrC,GAAG,CAAC,QAAQ,EAAE,SAAS,QAAQ,EAAE,GAAG,IAAI,CAAC;IACzC,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,uCAAuC;IACvC,UAAU,IAAI,IAAI,CAAC;IACnB,sFAAsF;IACtF,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,yEAAyE;IACzE,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;CAC5C"}
|
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":"AAOA,OAAO,KAAK,EAAS,YAAY,EAA8B,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3F,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA4BvG,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/core/store.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAS,YAAY,EAA8B,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3F,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA4BvG,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU,CA4S7D"}
|