@kanzo-tech/mosaic 0.14.0 → 0.15.1
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 +8 -11
- package/dist/arrow.d.ts +0 -18
- package/dist/arrow.d.ts.map +1 -1
- package/dist/arrow.js +0 -35
- package/dist/arrow.js.map +1 -1
- package/dist/index.d.ts +8 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -19
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Mosaic are two coordinators, and two coordinators are two crossfilters that neve
|
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { Coordinator, Selection, MosaicClient, clausePoints } from "@kanzo-tech/mosaic";
|
|
17
|
-
import { column,
|
|
17
|
+
import { column, numbers } from "@kanzo-tech/mosaic";
|
|
18
18
|
import { engine } from "@kanzo-tech/mosaic";
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -47,7 +47,7 @@ import { engine } from "@kanzo-tech/mosaic";
|
|
|
47
47
|
- **Re-exports** of the coordinator, the clients, the five clause builders and the loaders — so a
|
|
48
48
|
consumer never needs a direct `@uwdata` import. The DuckDB-WASM connector is not among them:
|
|
49
49
|
`engine()` is the only boot.
|
|
50
|
-
- **`column` / `
|
|
50
|
+
- **`column` / `numbers`** — the half of the client protocol the protocol does not
|
|
51
51
|
give you. The coordinator answers with an Arrow table, and Arrow offers a typed column only when
|
|
52
52
|
the type allows one: an integer id gives an array, a dictionary-encoded label gives nothing
|
|
53
53
|
usable. Every call site was writing `as { getChild(name: string): … }`, which asserts Arrow's
|
|
@@ -58,13 +58,10 @@ import { engine } from "@kanzo-tech/mosaic";
|
|
|
58
58
|
|
|
59
59
|
## Why it is not part of `@kanzo-tech/ui`
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
`@
|
|
64
|
-
|
|
61
|
+
Reading a column out of an answer and publishing a clause are not user-interface concerns, and the
|
|
62
|
+
consumers that need them are not all charts. `@kanzo-tech/graph` depends on this package and not on
|
|
63
|
+
`@kanzo-tech/ui/analytics`, whose barrel imports `@uwdata/vgplot` statically: a host that draws a
|
|
64
|
+
graph and no chart installs no vgplot.
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
The charts did not move. [`@kanzo-tech/ui/analytics`](https://kanzo-tech.github.io/ui) exports
|
|
70
|
-
every name it exported before, these among them.
|
|
66
|
+
`@kanzo-tech/ui/analytics` keeps the charts and re-exports these names, so a chart consumer imports
|
|
67
|
+
from one place.
|
package/dist/arrow.d.ts
CHANGED
|
@@ -16,22 +16,4 @@
|
|
|
16
16
|
export declare function column(data: unknown, field: string): unknown[];
|
|
17
17
|
/** The same, coerced — Arrow hands back `BigInt` for some integer widths. */
|
|
18
18
|
export declare function numbers(data: unknown, field: string): number[];
|
|
19
|
-
/** A pre-sized destination `fillColumn` can write into. */
|
|
20
|
-
export type NumericArray = Float32Array | Float64Array | Uint32Array | Uint16Array | Int32Array;
|
|
21
|
-
/**
|
|
22
|
-
* One numeric column, written straight into a typed array the caller already owns.
|
|
23
|
-
*
|
|
24
|
-
* `numbers()` is the wrong tool once a result is large: `toArray()` already hands back a typed
|
|
25
|
-
* buffer, and `Array.from(...).map(Number)` turns it into two full-length boxed `number[]` on the
|
|
26
|
-
* way to a third array that was the actual destination. Three allocations to move nothing. This is
|
|
27
|
-
* the same pass with none of them — which is what lets a caller size once against its own limit and
|
|
28
|
-
* fill from the Arrow batches as they arrive.
|
|
29
|
-
*
|
|
30
|
-
* `stride` and `offset` are how interleaving is expressed: `x` at `(0, 2)` and `y` at `(1, 2)` fill
|
|
31
|
-
* one `[x0, y0, x1, y1, …]` buffer with no seam between them.
|
|
32
|
-
*
|
|
33
|
-
* Returns how many rows were written, which is `min(rows, capacity)` — a caller that sized against
|
|
34
|
-
* a `LIMIT` uses it to `subarray` down to what actually came back.
|
|
35
|
-
*/
|
|
36
|
-
export declare function fillColumn(data: unknown, field: string, into: NumericArray, offset?: number, stride?: number): number;
|
|
37
19
|
//# sourceMappingURL=arrow.d.ts.map
|
package/dist/arrow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.d.ts","sourceRoot":"","sources":["../src/arrow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,4CAA4C;AAC5C,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAI9D;AAED,6EAA6E;AAC7E,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9D
|
|
1
|
+
{"version":3,"file":"arrow.d.ts","sourceRoot":"","sources":["../src/arrow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,4CAA4C;AAC5C,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAI9D;AAED,6EAA6E;AAC7E,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9D"}
|
package/dist/arrow.js
CHANGED
|
@@ -23,39 +23,4 @@ export function column(data, field) {
|
|
|
23
23
|
export function numbers(data, field) {
|
|
24
24
|
return column(data, field).map(Number);
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* One numeric column, written straight into a typed array the caller already owns.
|
|
28
|
-
*
|
|
29
|
-
* `numbers()` is the wrong tool once a result is large: `toArray()` already hands back a typed
|
|
30
|
-
* buffer, and `Array.from(...).map(Number)` turns it into two full-length boxed `number[]` on the
|
|
31
|
-
* way to a third array that was the actual destination. Three allocations to move nothing. This is
|
|
32
|
-
* the same pass with none of them — which is what lets a caller size once against its own limit and
|
|
33
|
-
* fill from the Arrow batches as they arrive.
|
|
34
|
-
*
|
|
35
|
-
* `stride` and `offset` are how interleaving is expressed: `x` at `(0, 2)` and `y` at `(1, 2)` fill
|
|
36
|
-
* one `[x0, y0, x1, y1, …]` buffer with no seam between them.
|
|
37
|
-
*
|
|
38
|
-
* Returns how many rows were written, which is `min(rows, capacity)` — a caller that sized against
|
|
39
|
-
* a `LIMIT` uses it to `subarray` down to what actually came back.
|
|
40
|
-
*/
|
|
41
|
-
export function fillColumn(data, field, into, offset = 0, stride = 1) {
|
|
42
|
-
const capacity = Math.max(0, Math.ceil((into.length - offset) / stride));
|
|
43
|
-
const values = data.getChild?.(field)?.toArray();
|
|
44
|
-
if (values) {
|
|
45
|
-
const n = Math.min(values.length, capacity);
|
|
46
|
-
// `Number` is identity on the numeric widths and the conversion on the BigInt ones; either way
|
|
47
|
-
// it reads an element rather than allocating one.
|
|
48
|
-
for (let i = 0; i < n; i++)
|
|
49
|
-
into[offset + i * stride] = Number(values[i]);
|
|
50
|
-
return n;
|
|
51
|
-
}
|
|
52
|
-
let i = 0;
|
|
53
|
-
for (const row of data) {
|
|
54
|
-
if (i >= capacity)
|
|
55
|
-
break;
|
|
56
|
-
into[offset + i * stride] = Number(row[field]);
|
|
57
|
-
i++;
|
|
58
|
-
}
|
|
59
|
-
return i;
|
|
60
|
-
}
|
|
61
26
|
//# sourceMappingURL=arrow.js.map
|
package/dist/arrow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.js","sourceRoot":"","sources":["../src/arrow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,4CAA4C;AAC5C,MAAM,UAAU,MAAM,CAAC,IAAa,EAAE,KAAa;IACjD,MAAM,KAAK,GAAI,IAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAyC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,OAAO,CAAC,IAAa,EAAE,KAAa;IAClD,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC
|
|
1
|
+
{"version":3,"file":"arrow.js","sourceRoot":"","sources":["../src/arrow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,4CAA4C;AAC5C,MAAM,UAAU,MAAM,CAAC,IAAa,EAAE,KAAa;IACjD,MAAM,KAAK,GAAI,IAAkB,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAyC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,OAAO,CAAC,IAAa,EAAE,KAAa;IAClD,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Mosaic conversation, as one import.
|
|
2
|
+
* The Mosaic conversation, as one import, with no React in it.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* not open the subpath: vgplot came along, unasked and unused. `@kanzo-tech/graph` ended up
|
|
9
|
-
* declaring vgplot as an optional peer to paper over a dependency it never names.
|
|
4
|
+
* Reading a column out of an Arrow answer and publishing a clause are not user-interface concerns,
|
|
5
|
+
* so they live here and both `@kanzo-tech/graph` and `@kanzo-tech/ui/analytics` depend on this
|
|
6
|
+
* rather than on each other; the graph never pulls in vgplot. `@kanzo-tech/ui/analytics` re-exports
|
|
7
|
+
* these names.
|
|
10
8
|
*
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
* they were only in a component library because that is where the first chart needed them.
|
|
14
|
-
*
|
|
15
|
-
* So: the data half lives here, with no React anywhere in it, and both consumers depend on this
|
|
16
|
-
* rather than on each other. `@kanzo-tech/ui/analytics` keeps every chart and re-exports these
|
|
17
|
-
* names unchanged, so nothing on that surface moves.
|
|
18
|
-
*
|
|
19
|
-
* The re-exports below are deliberate rather than lazy. A single import site for `Coordinator` and
|
|
20
|
-
* `Selection` is what makes one copy of Mosaic the easy outcome, and two copies would be two
|
|
21
|
-
* crossfilters that never hear each other.
|
|
9
|
+
* The re-exports are deliberate: one import site for `Coordinator` and `Selection` makes one copy
|
|
10
|
+
* of Mosaic the easy outcome, and two copies would be two crossfilters that never hear each other.
|
|
22
11
|
*/
|
|
23
12
|
export { Coordinator, MosaicClient, Selection, makeClient, clausePoint, clausePoints, clauseInterval, clauseIntervals, clauseMatch, type SelectionClause, } from "@uwdata/mosaic-core";
|
|
24
13
|
export { Query, asc, desc, loadCSV, loadJSON, loadObjects, loadParquet, loadSpatial, loadExtension, type ExprValue, type FilterExpr, } from "@uwdata/mosaic-sql";
|
|
25
14
|
/** Ours: turning an Arrow answer into values, which the client protocol does not do for you. */
|
|
26
|
-
export { column,
|
|
15
|
+
export { column, numbers } from "./arrow.js";
|
|
27
16
|
/** Ours: what every `table` here and in the charts takes — one identifier, or a relation named in SQL. */
|
|
28
17
|
export { type TableExpr } from "./table.js";
|
|
29
18
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,WAAW,EACX,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,EACL,GAAG,EACH,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,aAAa,EACb,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAC;AAE5B,gGAAgG;AAChG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE7C,0GAA0G;AAC1G,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Mosaic conversation, as one import.
|
|
2
|
+
* The Mosaic conversation, as one import, with no React in it.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* not open the subpath: vgplot came along, unasked and unused. `@kanzo-tech/graph` ended up
|
|
9
|
-
* declaring vgplot as an optional peer to paper over a dependency it never names.
|
|
4
|
+
* Reading a column out of an Arrow answer and publishing a clause are not user-interface concerns,
|
|
5
|
+
* so they live here and both `@kanzo-tech/graph` and `@kanzo-tech/ui/analytics` depend on this
|
|
6
|
+
* rather than on each other; the graph never pulls in vgplot. `@kanzo-tech/ui/analytics` re-exports
|
|
7
|
+
* these names.
|
|
10
8
|
*
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
* they were only in a component library because that is where the first chart needed them.
|
|
14
|
-
*
|
|
15
|
-
* So: the data half lives here, with no React anywhere in it, and both consumers depend on this
|
|
16
|
-
* rather than on each other. `@kanzo-tech/ui/analytics` keeps every chart and re-exports these
|
|
17
|
-
* names unchanged, so nothing on that surface moves.
|
|
18
|
-
*
|
|
19
|
-
* The re-exports below are deliberate rather than lazy. A single import site for `Coordinator` and
|
|
20
|
-
* `Selection` is what makes one copy of Mosaic the easy outcome, and two copies would be two
|
|
21
|
-
* crossfilters that never hear each other.
|
|
9
|
+
* The re-exports are deliberate: one import site for `Coordinator` and `Selection` makes one copy
|
|
10
|
+
* of Mosaic the easy outcome, and two copies would be two crossfilters that never hear each other.
|
|
22
11
|
*/
|
|
23
12
|
export { Coordinator, MosaicClient, Selection, makeClient, clausePoint, clausePoints, clauseInterval, clauseIntervals, clauseMatch, } from "@uwdata/mosaic-core";
|
|
24
13
|
export { Query, asc, desc, loadCSV, loadJSON, loadObjects, loadParquet, loadSpatial, loadExtension, } from "@uwdata/mosaic-sql";
|
|
25
14
|
/** Ours: turning an Arrow answer into values, which the client protocol does not do for you. */
|
|
26
|
-
export { column,
|
|
15
|
+
export { column, numbers } from "./arrow.js";
|
|
27
16
|
/** Ours: what every `table` here and in the charts takes — one identifier, or a relation named in SQL. */
|
|
28
17
|
export {} from "./table.js";
|
|
29
18
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,WAAW,GAEZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,EACL,GAAG,EACH,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,aAAa,GAGd,MAAM,oBAAoB,CAAC;AAE5B,gGAAgG;AAChG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE7C,0GAA0G;AAC1G,OAAO,EAAkB,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAe,MAAM,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanzo-tech/mosaic",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "The Mosaic conversation, without React — coordinator, clients and clauses re-exported as one surface, plus the Arrow column reader and the
|
|
3
|
+
"version": "0.15.1",
|
|
4
|
+
"description": "The Mosaic conversation, without React — coordinator, clients and clauses re-exported as one surface, plus the Arrow column reader and the page's one DuckDB-WASM engine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"sideEffects": false,
|