@casoon/opengrid 0.3.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -18,6 +18,173 @@ Two things belong in every release entry and are easy to leave out:
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [0.5.0] — 2026-09-28
22
+
23
+ **Screen-reader pairings tested: none yet** — unchanged since 0.1.0
24
+ ([issue #5](https://github.com/casoon/opengrid/issues/5)). **Browsers:** Chromium, the whole
25
+ e2e suite. WebKit (Playwright's, not Safari): the whole suite, one failure — the layout
26
+ misses the look's colour and font until the first restyle
27
+ ([#81](https://github.com/casoon/opengrid/issues/81), there since 0.3.0). Firefox: **not
28
+ run** — Playwright's Firefox did not start on the release machine.
29
+
30
+ **What breaks:** no frozen name was renamed or removed; what moved is structure a page
31
+ stylesheet or script may have leaned on:
32
+ - the pager is in `part="footer"` now, not above the header (#75);
33
+ - a boolean column's filter-row control is a `<select>` (any / yes / no), no longer a
34
+ checkbox (#60);
35
+ - a column is drawn at least 96 px wide with the column menu, 64 px without, and at least
36
+ 128 px while the filter row shows (#61, #62);
37
+ - the toolbar's buttons sit in an inner row without a part, and an opened column list
38
+ follows the density (#77).
39
+
40
+ **Module sizes** (brotli, `just measure-modules`): the elements 211.2 → 215.8 KiB, the
41
+ engine 122.6 → 124.9 KiB (the resource report's measuring, #70).
42
+
43
+ ### Added
44
+
45
+ - **A resource report** ([#70](https://github.com/casoon/opengrid/issues/70)). The grid fires
46
+ `opengrid-query` after every answer of its provider — `{ kind, ms, rows, total, bytes,
47
+ form, memory }`: where it ran, the round trip measured in the tab, what came back and in
48
+ which form, and the element module's WASM memory. The local and worker providers answer
49
+ `stats()` — the engine's WASM memory and, per loaded source, rows, columns and bytes held
50
+ (`Engine.stats()`, a worker message `stats`). Measured always, sent nowhere.
51
+ - **Column titles** ([#66](https://github.com/casoon/opengrid/issues/66)). `set_columns` takes
52
+ `title` per column — what a reader reads wherever the grid names the column: the header,
53
+ the column list, the filter row's labels, the column menu, the "+ Filter" dialog and
54
+ "+ Group" menu, group rows, chips, facet headings, search suggestions (which show the
55
+ field name beside it, since that is what an expression takes) and every announcement.
56
+ The field name stays the identifier in queries, views, expressions, exports and events.
57
+
58
+ ### Fixed
59
+
60
+ - **The toolbar on a narrow grid** ([#77](https://github.com/casoon/opengrid/issues/77)).
61
+ On a phone it wrapped into four rows, 178 of a 460 px grid, and left room for four
62
+ rows of data. Under 560 px of grid width, the search field now takes a line of its own
63
+ and the buttons stay in one row that scrolls sideways; a button that takes the focus
64
+ comes fully into view. At a 320 px viewport (reflow, 1.4.10) it wraps as before. The
65
+ buttons now sit in an inner row without a part, so `::part` rules are unaffected;
66
+ an opened column list comes after the density rather than before it.
67
+ - **The pager sits in the footer** ([#75](https://github.com/casoon/opengrid/issues/75)).
68
+ It stood between the filter row and the header, in the browser's unstyled buttons. It
69
+ now follows the status in `part="footer"`, below the rows it pages, as compact glyph
70
+ buttons (« ‹ › ») that keep their names — "First page" and so on — as `aria-label`.
71
+ A stylesheet that placed `[part="pager"]` by its old position has to follow.
72
+ - **A boolean column in the filter row** ([#60](https://github.com/casoon/opengrid/issues/60)).
73
+ It was a checkbox whose value reads `on` whether ticked or not: the grid showed a chip
74
+ "… is on" with nothing filtered, and the first filter on any other column silently
75
+ brought `= true` along. It is now a choice of three — *any*, *yes*, *no* — with three new
76
+ text keys `filterAny`, `booleanTrue`, `booleanFalse`. The "+ Filter" dialog reads a
77
+ boolean's checkbox by whether it is ticked.
78
+ - **A narrow column keeps its name** ([#61](https://github.com/casoon/opengrid/issues/61)).
79
+ With the column menu, a sorted 80 px column showed only "▲ ⋯": the header reserved a
80
+ fixed 2.75em for the sort marks on top of the menu button. It now reserves what stands
81
+ beside the name, the name keeps two characters at least, and a column is drawn at least
82
+ 96 px wide with the column menu (64 px without) whatever width it was given.
83
+ - **The filter row stands under the columns and scrolls with them** ([#62](https://github.com/casoon/opengrid/issues/62)).
84
+ Its groups sat at fixed 248 px steps and the row scrolled on its own, so at a phone's
85
+ width a field was under the wrong column. Each group is now as wide as its column and
86
+ starts where it starts (measured from the header, again whenever the table changes size),
87
+ rows and filter share one horizontal position, and the table is at least as wide as its
88
+ columns' minimum widths — a column without a width of its own no longer shrinks to a few
89
+ pixels, the grid scrolls sideways instead.
90
+
91
+ ## [0.4.0] — 2026-09-28
92
+
93
+ **Screen-reader pairings tested: none yet** — unchanged since 0.1.0
94
+ ([issue #5](https://github.com/casoon/opengrid/issues/5)). **Browsers:** as in 0.1.0.
95
+
96
+ **Module sizes** (brotli, `just measure-modules`): the engine 335.1 → **122.6 KiB** (no
97
+ Arrow, #37); the elements 201.9 → 211.2 KiB (the binary result codec, #38). A page with grid
98
+ and engine loads about 334 KiB instead of 537 KiB.
99
+
100
+ ### Added
101
+
102
+ - **The server as a library, sources as connectors** ([#45](https://github.com/casoon/opengrid/issues/45)).
103
+ A new crate `opengrid-connector` holds the one contract a source implements: `schema`,
104
+ `capabilities` and `execute`, with optional `pivot` and `export` that default to plain
105
+ queries. `opengrid-server` holds its sources as `Arc<dyn Connector>` and has a builder —
106
+ `Server::builder().source(name, connector, policy).token(..).build().await` — so an
107
+ application hands in its own source without changing the server. The server still checks
108
+ the token, the allowed fields and the row filter before a connector sees a query.
109
+ PostgreSQL and the local engine are reference connectors. See
110
+ [Connectors](docs/guides/connectors.md).
111
+ - **Sources that only hand out rows** ([#46](https://github.com/casoon/opengrid/issues/46)).
112
+ `RowSource` (`schema`, `scan` in pieces) wrapped in `Rows` is a full connector: the engine
113
+ answers every query on the server. `max_scan_rows` (default 1 000 000) bounds the rows one
114
+ answer reads; over it the server answers `413 limit_exceeded`. `DataSourceError` has a new
115
+ variant `LimitExceeded`.
116
+ - **Conformance for connector authors** ([#47](https://github.com/casoon/opengrid/issues/47)).
117
+ `opengrid_conformance::check_source(&source)` runs every case against any source and returns
118
+ a `Report` (`assert_ok()` for tests); `suite_dir`, `fixture_schema`, `fixture_csv` say where
119
+ the fixture is. A `Connector` runs through `opengrid_connector::AsSource`.
120
+ - **The server protocol, and a runner that proves a server** ([#48](https://github.com/casoon/opengrid/issues/48)).
121
+ [`docs/protocol.md`](docs/protocol.md) describes what an opengrid server speaks — endpoints,
122
+ the query object, both result forms, errors, export — and the four duties of a server:
123
+ token, row filter, field allowlist, bounds. `opengrid-conformance --endpoint <url> --token <t>`
124
+ runs the whole suite over HTTP in both result forms against any server, in any language
125
+ (`check_endpoint` in the library).
126
+ - **The rows tier streams** ([#50](https://github.com/casoon/opengrid/issues/50)). A rows-only
127
+ source is read piece by piece and the server keeps only what the answer needs: top
128
+ `offset + limit` for a page, partial aggregates per group. 100 million generated rows answer
129
+ a page in 13 s with 75 MiB, a grouping in 16 s with 41 MiB (reading them into one table
130
+ first would take about 4.5 GiB). `max_scan_rows` now bounds the rows or groups an answer
131
+ holds, not the rows read; `Rows::compact_at` tunes how often held rows are cut back.
132
+ `Table::concat` in `opengrid-columns`.
133
+ - **SQLite as a reference connector** ([#51](https://github.com/casoon/opengrid/issues/51)).
134
+ `opengrid-connector-sqlite`: filter, sort, group, aggregate and paging answered by SQLite
135
+ itself; a file, no installation (`rusqlite`, SQLite compiled in). All conformance cases
136
+ pass, plus a differential test against the engine where SQLite's habits differ most (NaN in
137
+ sums and extremes, NaN and -0.0 as groups, decimal averages). `examples/server` has a
138
+ `demo-sqlite` preset.
139
+ - **Results travel in a binary form** ([#38](https://github.com/casoon/opengrid/issues/38)),
140
+ `application/vnd.opengrid.columns`: the engine's columns written out, decimals exact, no
141
+ text per cell. `Engine.execute_columns` and `Planner.finish_columns` answer it next to
142
+ the JSON methods; the worker hands it over without a copy; `opengrid-server` answers it
143
+ for `POST /query` and `POST /pivot` when `Accept` asks, JSON otherwise (with
144
+ `Vary: Accept`). The elements and `exportRows` read both forms. For 100 000 rows × 10
145
+ columns the engine answers in 18 ms instead of 124 ms and an element reads the answer in
146
+ 13 ms instead of 76 ms; compressed, both forms are about the same size.
147
+
148
+ ### Changed
149
+
150
+ - **No configuration file and no binary in `opengrid-server`** ([#49](https://github.com/casoon/opengrid/issues/49)).
151
+ Configuration is code: the builder (#45). `opengrid-server` no longer depends on a database
152
+ driver, the local engine or `toml`. `LocalConnector` (with `from_csv`) moved to
153
+ `opengrid-connector`; PostgreSQL stays a reference connector in
154
+ `opengrid-datasource-postgres`. `examples/server` is a program around the library with the
155
+ demo's sources (`demo`, `demo-postgres`) and the end-to-end suite's (`e2e`).
156
+
157
+ **What breaks:** `opengrid-server <config.toml>` is gone, and with it `Config`,
158
+ `Registry::build` and `opengrid_server::build`. Write the sources as code —
159
+ [Connectors](docs/guides/connectors.md) shows how; `examples/server/src/main.rs` has the
160
+ former demo configurations as functions.
161
+
162
+ - **The built-in providers answer bytes.** `createLocalProvider` and `createWorkerProvider`
163
+ answer the binary form; `createRestProvider` and `createPivotProvider` ask the server
164
+ for it and still take JSON from a server that answers JSON. A provider of your own may
165
+ keep answering JSON.
166
+
167
+ **What breaks:** a page that calls a built-in provider's `execute` itself and parses the
168
+ answer as JSON now gets a `Uint8Array`. Call `Engine.execute` for JSON, or hand the
169
+ answer to the element or `exportRows`, which read both.
170
+
171
+ - **The engine no longer uses Apache Arrow** ([#37](https://github.com/casoon/opengrid/issues/37)).
172
+ It keeps its data in `opengrid-columns` — typed columns of exactly the seven types of
173
+ the query model — and `opengrid-engine` replaces `opengrid-arrow-engine`, in the browser
174
+ and on the server. The engine module (`engine/opengrid_wasm_bg.wasm`) shrinks from
175
+ 335 KiB to 118 KiB brotli (1.94 MB → 0.34 MB raw). Every conformance case answers as
176
+ before; an old-against-new differential test over random queries found no difference
177
+ before the old engine was removed. In the browser, grouping and aggregating got about
178
+ twice as fast and a sort window over sorted data too; a single-key sort is about 1.2×
179
+ slower, everything else within ±12 %.
180
+
181
+ **What breaks** (Rust crates only; the npm package and its JavaScript API are
182
+ unchanged): the crate `opengrid-arrow-engine` is now `opengrid-engine`. `load_csv` and
183
+ `load_json` return one `Table` instead of `Vec<RecordBatch>`, `JsonOptions` and
184
+ `CsvOptions::batch_size` are gone, `LocalDataSource::new` takes the table and cannot
185
+ fail, and `execute::QueryResult` carries a `table`. `opengrid-types` has no `arrow`
186
+ feature any more.
187
+
21
188
  ## [0.3.0] — 2026-09-27
22
189
 
23
190
  **Screen-reader pairings tested: none yet** — unchanged since 0.1.0
package/README.md CHANGED
@@ -1,14 +1,36 @@
1
1
  # opengrid
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@casoon/opengrid?color=3d5fd6&label=npm)](https://www.npmjs.com/package/@casoon/opengrid)
4
+ [![licence](https://img.shields.io/badge/licence-MIT%20OR%20Apache--2.0-3d5fd6)](#licence)
5
+
3
6
  Accessible data grid, table and pivot as Web Components — driven by one query engine that
4
7
  runs in the browser (WebAssembly), on a server (PostgreSQL), or split between the two, with
5
8
  the same results everywhere.
6
9
 
10
+ <p>
11
+ <img src="https://raw.githubusercontent.com/casoon/opengrid/main/docs/assets/grid-base.png" alt="opengrid-grid in the Base look: search, + Filter, + Group, filter row and 5,000 orders" width="49%">
12
+ <img src="https://raw.githubusercontent.com/casoon/opengrid/main/docs/assets/grid-dark.png" alt="opengrid-grid in the Dark look, grouped by country with sums per group" width="49%">
13
+ </p>
14
+
7
15
  - **`<opengrid-grid>`** — sorting, filtering, search, facets, grouping with totals,
8
16
  selection, editing, virtualized or paged; fully operable from the keyboard.
9
17
  - **`<opengrid-table>`** — a plain semantic `<table>` for displaying data.
10
18
  - **`<opengrid-pivot>`** — a pivot with subtotals and a grand total.
11
19
  - **Export** — what the reader sees, every match of it, as CSV or JSON.
20
+ - **Five built-in looks** — `theme="paper"`, and your own `--og-*` properties on top.
21
+
22
+ ## Live demos
23
+
24
+ The same 17 demos in every framework, each with its source, its data and options to change
25
+ live:
26
+
27
+ | [JavaScript](https://og-vanilla.casoon.dev) | [React](https://og-react.casoon.dev) | [Vue](https://og-vue.casoon.dev) | [Svelte](https://og-svelte.casoon.dev) | [Angular](https://og-angular.casoon.dev) |
28
+ | :-: | :-: | :-: | :-: | :-: |
29
+
30
+ Start with the [overview](https://og-vanilla.casoon.dev/overview), the
31
+ [grouping](https://og-vanilla.casoon.dev/grouping), the
32
+ [100,000 rows in a worker](https://og-vanilla.casoon.dev/large-data) or the
33
+ [looks](https://og-vanilla.casoon.dev/theming).
12
34
 
13
35
  ## Install
14
36
 
@@ -57,9 +79,11 @@ The engine reads a CSV against a schema — it never guesses types.
57
79
 
58
80
  ## Data from a server
59
81
 
60
- `opengrid-server` answers the same queries against PostgreSQL — the browser sends a query
61
- object, never SQL, and the server enforces tokens, a per-tenant row filter and a field
62
- allowlist.
82
+ `opengrid-server` answers the same queries on a server — the browser sends a query object,
83
+ never SQL, and the server enforces tokens, a per-tenant row filter and a field allowlist. It
84
+ knows no database: your program hands it its sources as
85
+ [connectors](https://github.com/casoon/opengrid/blob/main/docs/guides/connectors.md), and
86
+ PostgreSQL is one reference among them.
63
87
 
64
88
  ```js
65
89
  import { connect, createRestProvider } from "@casoon/opengrid";
@@ -89,6 +113,24 @@ import { OpengridGrid } from "@casoon/opengrid/react"; // or /vue, /svelte
89
113
  Angular, Astro and server-rendered pages use `connect` directly —
90
114
  [Frameworks](https://github.com/casoon/opengrid/blob/main/docs/guides/frameworks.md).
91
115
 
116
+ ## Looks
117
+
118
+ A grid without any page CSS wears **Base**. `theme` picks another of the five built-in looks —
119
+ `base`, `paper`, `violet`, `orange`, `dark` — on all three elements:
120
+
121
+ ```html
122
+ <opengrid-grid theme="dark" label="Orders" datasource="orders"></opengrid-grid>
123
+ ```
124
+
125
+ ```css
126
+ /* The page's own properties win over the look. */
127
+ opengrid-grid { --og-accent: #0f766e; --og-row-height: 36px; }
128
+ ```
129
+
130
+ The focus ring, the selection bar and the forced-colours palette stay what they are in every
131
+ look. The fonts are named, not loaded: a page that wants Geist or IBM Plex Sans hosts them.
132
+ See [Styling](https://github.com/casoon/opengrid/blob/main/docs/api.md#styling).
133
+
92
134
  ## Export
93
135
 
94
136
  ```js
@@ -19,6 +19,13 @@ export class Engine {
19
19
  * `{ "name", "values" }` object per output column, in schema order.
20
20
  */
21
21
  execute(query_json: string): string;
22
+ /**
23
+ * Runs a query JSON and answers with the result in the binary form
24
+ * (decision E35, `opengrid_columns::wire`): the same answer as
25
+ * [`execute`](Engine::execute_js), but as bytes a worker can hand over
26
+ * without copying and an element can read without parsing.
27
+ */
28
+ execute_columns(query_json: string): Uint8Array;
22
29
  /**
23
30
  * Reads CSV bytes against an explicit schema and registers the source.
24
31
  *
@@ -35,6 +42,15 @@ export class Engine {
35
42
  * The names of the registered sources, in unspecified order.
36
43
  */
37
44
  source_names(): string[];
45
+ /**
46
+ * What the engine holds (issue #70), as JSON:
47
+ * `{ "memory": bytes, "sources": [{ "name", "rows", "columns", "bytes" }] }`.
48
+ *
49
+ * `memory` is the module's whole linear memory — what the browser gave
50
+ * it, which only grows; `bytes` is what a source's columns take inside
51
+ * it. Sources by name.
52
+ */
53
+ stats(): string;
38
54
  }
39
55
 
40
56
  /**
@@ -59,10 +75,15 @@ export class Planner {
59
75
  * Runs `client_query_json` over `result_json` — the source's answer.
60
76
  *
61
77
  * This is the hybrid return path E14 names: the partial result becomes
62
- * Arrow batches again and the engine finishes the query over them, which
78
+ * a table again and the engine finishes the query over them, which
63
79
  * includes recounting `total_count` — filtering or grouping changed it.
64
80
  */
65
81
  finish(client_query_json: string, result_json: string): string;
82
+ /**
83
+ * [`finish`](Planner::finish) for a source that answered in the binary
84
+ * form: the bytes in, the finished result as bytes out.
85
+ */
86
+ finish_columns(client_query_json: string, result: Uint8Array): Uint8Array;
66
87
  /**
67
88
  * A planner for a source with `schema_json` and `capabilities_json`, in
68
89
  * `mode` (`local`, `remote`, `hybrid` or `auto`).
@@ -92,10 +113,13 @@ export interface InitOutput {
92
113
  readonly __wbg_engine_free: (a: number, b: number) => void;
93
114
  readonly __wbg_planner_free: (a: number, b: number) => void;
94
115
  readonly engine_execute: (a: number, b: number, c: number) => [number, number, number, number];
116
+ readonly engine_execute_columns: (a: number, b: number, c: number) => [number, number, number, number];
95
117
  readonly engine_load_csv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
96
118
  readonly engine_new: () => number;
97
119
  readonly engine_source_names: (a: number) => [number, number];
120
+ readonly engine_stats: (a: number) => [number, number];
98
121
  readonly planner_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
122
+ readonly planner_finish_columns: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
99
123
  readonly planner_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
100
124
  readonly planner_plan: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
101
125
  readonly __wbindgen_externrefs: WebAssembly.Table;
@@ -47,6 +47,25 @@ export class Engine {
47
47
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
48
48
  }
49
49
  }
50
+ /**
51
+ * Runs a query JSON and answers with the result in the binary form
52
+ * (decision E35, `opengrid_columns::wire`): the same answer as
53
+ * [`execute`](Engine::execute_js), but as bytes a worker can hand over
54
+ * without copying and an element can read without parsing.
55
+ * @param {string} query_json
56
+ * @returns {Uint8Array}
57
+ */
58
+ execute_columns(query_json) {
59
+ const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
60
+ const len0 = WASM_VECTOR_LEN;
61
+ const ret = wasm.engine_execute_columns(this.__wbg_ptr, ptr0, len0);
62
+ if (ret[3]) {
63
+ throw takeFromExternrefTable0(ret[2]);
64
+ }
65
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
66
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
67
+ return v2;
68
+ }
50
69
  /**
51
70
  * Reads CSV bytes against an explicit schema and registers the source.
52
71
  *
@@ -88,6 +107,27 @@ export class Engine {
88
107
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
89
108
  return v1;
90
109
  }
110
+ /**
111
+ * What the engine holds (issue #70), as JSON:
112
+ * `{ "memory": bytes, "sources": [{ "name", "rows", "columns", "bytes" }] }`.
113
+ *
114
+ * `memory` is the module's whole linear memory — what the browser gave
115
+ * it, which only grows; `bytes` is what a source's columns take inside
116
+ * it. Sources by name.
117
+ * @returns {string}
118
+ */
119
+ stats() {
120
+ let deferred1_0;
121
+ let deferred1_1;
122
+ try {
123
+ const ret = wasm.engine_stats(this.__wbg_ptr);
124
+ deferred1_0 = ret[0];
125
+ deferred1_1 = ret[1];
126
+ return getStringFromWasm0(ret[0], ret[1]);
127
+ } finally {
128
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
129
+ }
130
+ }
91
131
  }
92
132
  if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
93
133
 
@@ -121,7 +161,7 @@ export class Planner {
121
161
  * Runs `client_query_json` over `result_json` — the source's answer.
122
162
  *
123
163
  * This is the hybrid return path E14 names: the partial result becomes
124
- * Arrow batches again and the engine finishes the query over them, which
164
+ * a table again and the engine finishes the query over them, which
125
165
  * includes recounting `total_count` — filtering or grouping changed it.
126
166
  * @param {string} client_query_json
127
167
  * @param {string} result_json
@@ -149,6 +189,26 @@ export class Planner {
149
189
  wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
150
190
  }
151
191
  }
192
+ /**
193
+ * [`finish`](Planner::finish) for a source that answered in the binary
194
+ * form: the bytes in, the finished result as bytes out.
195
+ * @param {string} client_query_json
196
+ * @param {Uint8Array} result
197
+ * @returns {Uint8Array}
198
+ */
199
+ finish_columns(client_query_json, result) {
200
+ const ptr0 = passStringToWasm0(client_query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
201
+ const len0 = WASM_VECTOR_LEN;
202
+ const ptr1 = passArray8ToWasm0(result, wasm.__wbindgen_malloc);
203
+ const len1 = WASM_VECTOR_LEN;
204
+ const ret = wasm.planner_finish_columns(this.__wbg_ptr, ptr0, len0, ptr1, len1);
205
+ if (ret[3]) {
206
+ throw takeFromExternrefTable0(ret[2]);
207
+ }
208
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
209
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
210
+ return v3;
211
+ }
152
212
  /**
153
213
  * A planner for a source with `schema_json` and `capabilities_json`, in
154
214
  * `mode` (`local`, `remote`, `hybrid` or `auto`).
@@ -261,6 +321,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
261
321
  return result;
262
322
  }
263
323
 
324
+ function getArrayU8FromWasm0(ptr, len) {
325
+ ptr = ptr >>> 0;
326
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
327
+ }
328
+
264
329
  let cachedDataViewMemory0 = null;
265
330
  function getDataViewMemory0() {
266
331
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
Binary file
@@ -4,10 +4,13 @@ export const memory: WebAssembly.Memory;
4
4
  export const __wbg_engine_free: (a: number, b: number) => void;
5
5
  export const __wbg_planner_free: (a: number, b: number) => void;
6
6
  export const engine_execute: (a: number, b: number, c: number) => [number, number, number, number];
7
+ export const engine_execute_columns: (a: number, b: number, c: number) => [number, number, number, number];
7
8
  export const engine_load_csv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
8
9
  export const engine_new: () => number;
9
10
  export const engine_source_names: (a: number) => [number, number];
11
+ export const engine_stats: (a: number) => [number, number];
10
12
  export const planner_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
13
+ export const planner_finish_columns: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
11
14
  export const planner_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
12
15
  export const planner_plan: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
13
16
  export const __wbindgen_externrefs: WebAssembly.Table;
package/loader.d.ts CHANGED
@@ -126,15 +126,22 @@ export function connect(host: HTMLElement, options?: ConnectOptions): Connection
126
126
  // Providers
127
127
  // ---------------------------------------------------------------------------
128
128
 
129
+ /**
130
+ * What a provider's `execute` answers: the result as JSON, or the binary result
131
+ * form (`application/vnd.opengrid.columns`) as bytes. The elements and
132
+ * `exportRows` read both.
133
+ */
134
+ export type Answer = string | Uint8Array | ArrayBuffer;
135
+
129
136
  /**
130
137
  * Where the data comes from. A seam, not a class: anything with an `execute`
131
138
  * method fits. `queryJson` is the query as JSON; the answer is the result as
132
- * JSON, or a Promise of it. `mode` is the element's `mode` attribute, `""`
133
- * without one. `options` is optional and new: a provider written for two
134
- * arguments still fits.
139
+ * JSON or in the binary form, or a Promise of it. `mode` is the element's
140
+ * `mode` attribute, `""` without one. `options` is optional and new: a
141
+ * provider written for two arguments still fits.
135
142
  */
136
143
  export interface Provider {
137
- execute(queryJson: string, mode: string, options?: ExecuteOptions): string | Promise<string>;
144
+ execute(queryJson: string, mode: string, options?: ExecuteOptions): Answer | Promise<Answer>;
138
145
  /**
139
146
  * Optional: where the queries run. The grid names it in its footer, beside
140
147
  * the number of queries asked for what is shown; the built-in providers set
@@ -162,14 +169,30 @@ export interface ExecuteOptions {
162
169
  export interface EngineProvider extends Provider {
163
170
  /** Loads CSV bytes as the source `name`, against a schema (JSON). */
164
171
  load(name: string, bytes: ArrayBuffer | Uint8Array, schema: string): Promise<void>;
172
+ /** What the engine holds: its memory and each source's size (issue #70). */
173
+ stats(): Promise<EngineStats>;
165
174
  /** Stops a worker; a no-op in the tab. */
166
175
  terminate(): void;
167
176
  }
168
177
 
178
+ /** What an engine holds, from `stats()` of an engine provider. */
179
+ export interface EngineStats {
180
+ kind: "local" | "worker";
181
+ /** The engine module's WASM linear memory in bytes — it only grows. */
182
+ memory: number;
183
+ /** Every loaded source, by name. */
184
+ sources: { name: string; rows: number; columns: number; bytes: number }[];
185
+ }
186
+
169
187
  /** The engine of the engine module, as `createLocalProvider` uses it. */
170
188
  export interface Engine {
171
189
  load_csv(name: string, bytes: Uint8Array, schema: string): void;
190
+ /** The result as JSON. */
172
191
  execute(queryJson: string): string;
192
+ /** The result in the binary form — what the tab and worker providers answer. */
193
+ execute_columns(queryJson: string): Uint8Array;
194
+ /** What it holds, as JSON (see `EngineStats`). */
195
+ stats(): string;
173
196
  }
174
197
 
175
198
  /** What a server says a source is. */
@@ -198,6 +221,8 @@ export interface PlannerLike {
198
221
  plan(queryJson: string, mode: string): string;
199
222
  /** Finishes the client half over the source's answer; the result as JSON. */
200
223
  finish(clientQueryJson: string, resultJson: string): string;
224
+ /** The same over an answer in the binary form; the result as bytes. */
225
+ finish_columns(clientQueryJson: string, result: Uint8Array): Uint8Array;
201
226
  }
202
227
 
203
228
  /** The plan `createHybridProvider` hands to `onPlan` before anything is sent. */
@@ -391,6 +416,12 @@ export type WireValue = string | number | boolean | null;
391
416
 
392
417
  /** Per-column presentation for `set_columns` — `presentation` in `connect`. */
393
418
  export interface ColumnConfig {
419
+ /**
420
+ * What the column is called where a reader reads it — header, column list,
421
+ * filter labels, menus, chips, announcements. The field name stays the
422
+ * identifier: query, view, search expressions, export.
423
+ */
424
+ title?: string;
394
425
  /** The starting width in pixels; a reader's resize leads after that. */
395
426
  width?: number;
396
427
  align?: "start" | "end" | "center";
@@ -567,6 +598,9 @@ export type TextKey =
567
598
  | "apply"
568
599
  | "addGrouping"
569
600
  | "groupingFull"
601
+ | "filterAny"
602
+ | "booleanTrue"
603
+ | "booleanFalse"
570
604
  | "sourceLocal"
571
605
  | "sourceWorker"
572
606
  | "sourceRemote"
@@ -637,6 +671,22 @@ export interface CellChangeDetail {
637
671
  previous: string;
638
672
  }
639
673
 
674
+ /** `opengrid-query`: one answer of the grid's provider (issue #70). */
675
+ export interface QueryDetail {
676
+ /** The provider's `kind`, or `null` when it names none. */
677
+ kind: ProviderKind | null;
678
+ /** The round trip in milliseconds, measured in the tab. */
679
+ ms: number;
680
+ /** Rows answered, and matches before paging. */
681
+ rows: number;
682
+ total: number;
683
+ /** The answer's size as it arrived, and its form. */
684
+ bytes: number;
685
+ form: "binary" | "json";
686
+ /** The element module's WASM linear memory in bytes. */
687
+ memory: number;
688
+ }
689
+
640
690
  /** `opengrid-view-change`: the whole view after the change. */
641
691
  export interface ViewChangeDetail {
642
692
  view: View;
@@ -647,6 +697,7 @@ export interface OpengridEventMap {
647
697
  "opengrid-selection-change": CustomEvent<SelectionChangeDetail>;
648
698
  "opengrid-cell-change": CustomEvent<CellChangeDetail>;
649
699
  "opengrid-view-change": CustomEvent<ViewChangeDetail>;
700
+ "opengrid-query": CustomEvent<QueryDetail>;
650
701
  }
651
702
 
652
703
  // ---------------------------------------------------------------------------
package/loader.js CHANGED
@@ -21,6 +21,12 @@
21
21
  * createLocalProvider(engine) engine on the main thread
22
22
  * createRestProvider({ url, source, token }) opengrid-server über HTTP (point 27)
23
23
  *
24
+ * A provider's `execute` answers the result JSON **or** the binary result form
25
+ * (decision E35, a `Uint8Array`): the elements and `exportRows` read both. The
26
+ * tab and worker providers answer bytes — the worker hands them over without a
27
+ * copy — and the REST providers ask the server for them and fall back to JSON
28
+ * when it answers JSON.
29
+ *
24
30
  * Every provider's `execute(queryJson, mode, { signal })` may take an
25
31
  * `AbortSignal` as its third argument (point 84). The providers that talk HTTP
26
32
  * hand it to `fetch`, so an aborted export leaves no request running; the tab
@@ -198,12 +204,21 @@ export function createWorkerProvider({
198
204
  await request({ type: "load", name, bytes: buffer, schema }, [buffer]);
199
205
  },
200
206
 
201
- /** Runs a query JSON and resolves with the result JSON. */
207
+ /** Runs a query JSON and resolves with the result in the binary form. */
202
208
  async execute(queryJson) {
203
209
  await start();
204
210
  return request({ type: "query", query: queryJson });
205
211
  },
206
212
 
213
+ /**
214
+ * What the engine in the worker holds (issue #70): its WASM memory and,
215
+ * per source, rows, columns and bytes.
216
+ */
217
+ async stats() {
218
+ await start();
219
+ return { kind: "worker", ...JSON.parse(await request({ type: "stats" })) };
220
+ },
221
+
207
222
  /** Stops the worker and rejects everything still in flight. */
208
223
  terminate() {
209
224
  worker?.terminate();
@@ -242,7 +257,11 @@ export function createLocalProvider(engine) {
242
257
  );
243
258
  },
244
259
  execute(queryJson) {
245
- return engine.execute(queryJson);
260
+ return engine.execute_columns(queryJson);
261
+ },
262
+ /** What the engine holds (issue #70), as the worker provider says it. */
263
+ async stats() {
264
+ return { kind: "local", ...JSON.parse(engine.stats()) };
246
265
  },
247
266
  terminate() {},
248
267
  };
@@ -275,10 +294,12 @@ export function createLocalProvider(engine) {
275
294
  export function createRestProvider({ url, source, token } = {}) {
276
295
  const base = String(url).replace(/\/$/, "");
277
296
  const endpoint = `${base}/query/${encodeURIComponent(source)}`;
278
- const headers = { "Content-Type": "application/json" };
297
+ const headers = { "Content-Type": "application/json", Accept: ACCEPT_ANSWER };
279
298
  if (token) {
280
299
  headers.Authorization = `Bearer ${token}`;
281
300
  }
301
+ // The export answers a file, CSV or JSON, whatever a query would.
302
+ const { Accept: _answer, ...exportHeaders } = headers;
282
303
 
283
304
  return {
284
305
  /** Where the queries run; the grid names it in its footer (issue #33). */
@@ -310,11 +331,7 @@ export function createRestProvider({ url, source, token } = {}) {
310
331
  signal,
311
332
  redirect: "error",
312
333
  });
313
- const text = await response.text();
314
- if (response.ok) {
315
- return text;
316
- }
317
- throw refusal(text, response.status);
334
+ return answerOf(response);
318
335
  },
319
336
 
320
337
  /**
@@ -353,7 +370,7 @@ export function createRestProvider({ url, source, token } = {}) {
353
370
  }
354
371
  const response = await fetch(`${base}/export/${encodeURIComponent(source)}?${parameters}`, {
355
372
  method: "POST",
356
- headers,
373
+ headers: exportHeaders,
357
374
  body: JSON.stringify(query),
358
375
  signal,
359
376
  redirect: "error",
@@ -388,6 +405,29 @@ export function createRestProvider({ url, source, token } = {}) {
388
405
  };
389
406
  }
390
407
 
408
+ /**
409
+ * What a provider asks the server for: the binary result form (E35), JSON as
410
+ * the fallback — a server that does not know the form answers JSON, and
411
+ * `answerOf` takes that too.
412
+ */
413
+ const COLUMNS_TYPE = "application/vnd.opengrid.columns";
414
+ const ACCEPT_ANSWER = `${COLUMNS_TYPE}, application/json;q=0.9`;
415
+
416
+ /**
417
+ * A response as a provider's answer: the bytes of the binary form, the result
418
+ * JSON otherwise, the server's refusal as an `Error`.
419
+ */
420
+ async function answerOf(response) {
421
+ if (!response.ok) {
422
+ throw refusal(await response.text(), response.status);
423
+ }
424
+ const type = response.headers.get("Content-Type") ?? "";
425
+ if (type.split(";")[0].trim().toLowerCase() === COLUMNS_TYPE) {
426
+ return new Uint8Array(await response.arrayBuffer());
427
+ }
428
+ return response.text();
429
+ }
430
+
391
431
  /**
392
432
  * A failed request as the `Error` it rejects with (issue #16). The message is
393
433
  * the server's own sentence, or the status when the body is not the error
@@ -446,7 +486,7 @@ function coded(code, message) {
446
486
  */
447
487
  export function createPivotProvider({ url, source, token } = {}) {
448
488
  const endpoint = `${String(url).replace(/\/$/, "")}/pivot/${encodeURIComponent(source)}`;
449
- const headers = { "Content-Type": "application/json" };
489
+ const headers = { "Content-Type": "application/json", Accept: ACCEPT_ANSWER };
450
490
  if (token) {
451
491
  headers.Authorization = `Bearer ${token}`;
452
492
  }
@@ -462,11 +502,7 @@ export function createPivotProvider({ url, source, token } = {}) {
462
502
  signal,
463
503
  redirect: "error",
464
504
  });
465
- const text = await response.text();
466
- if (response.ok) {
467
- return text;
468
- }
469
- throw refusal(text, response.status);
505
+ return answerOf(response);
470
506
  },
471
507
  };
472
508
  }
@@ -517,7 +553,10 @@ export function createHybridProvider({ remote, planner, mode = "auto", onPlan }
517
553
  if (!plan.client) {
518
554
  return partial;
519
555
  }
520
- return planner.finish(JSON.stringify(plan.client), partial);
556
+ // The engine finishes in the form the source answered in.
557
+ return typeof partial === "string"
558
+ ? planner.finish(JSON.stringify(plan.client), partial)
559
+ : planner.finish_columns(JSON.stringify(plan.client), partial);
521
560
  },
522
561
  };
523
562
  }
@@ -688,8 +727,8 @@ export async function exportRows(provider, query, options = {}) {
688
727
  const limit = total === undefined ? chunkSize : Math.min(chunkSize, total - rows);
689
728
  const piece = JSON.stringify({ ...query, sort, offset: rows, limit });
690
729
  const answer = await unlessAborted(ask(provider, piece, signal), signal);
691
- const result = JSON.parse(answer);
692
- const count = result.columns[0]?.values.length ?? 0;
730
+ const result = countsOf(answer);
731
+ const count = result.rows;
693
732
  const first = total === undefined;
694
733
  if (first) {
695
734
  total = result.total_count;
@@ -732,6 +771,28 @@ export async function exportRows(provider, query, options = {}) {
732
771
  });
733
772
  }
734
773
 
774
+ /**
775
+ * `total_count` and the rows of an answer, whichever form it came in: from the
776
+ * JSON, or from the header of the binary form (E35) — `total_count` at byte 8,
777
+ * the row count at byte 16, both little-endian `u64`.
778
+ */
779
+ function countsOf(answer) {
780
+ if (typeof answer === "string") {
781
+ const result = JSON.parse(answer);
782
+ return { total_count: result.total_count, rows: result.columns[0]?.values.length ?? 0 };
783
+ }
784
+ const bytes = answer instanceof ArrayBuffer ? new Uint8Array(answer) : answer;
785
+ if (bytes.byteLength < 24) {
786
+ throw new TypeError("exportRows: the provider answered neither JSON nor the binary form");
787
+ }
788
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
789
+ const columns = view.getUint32(24, true);
790
+ return {
791
+ total_count: Number(view.getBigUint64(8, true)),
792
+ rows: columns === 0 ? 0 : Number(view.getBigUint64(16, true)),
793
+ };
794
+ }
795
+
735
796
  /** One piece from the provider; a synchronous throw becomes a rejection. */
736
797
  async function ask(provider, queryJson, signal) {
737
798
  return provider.execute(queryJson, "", { signal });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casoon/opengrid",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Accessible data grid, table and pivot as web components, driven by a portable Rust/WASM query engine — with React, Vue and Svelte components.",
6
6
  "keywords": [
@@ -6,14 +6,14 @@
6
6
  * mark) first. `options`: `{ delimiter, bom, protectFormulas, null }`, each
7
7
  * optional (docs/guides/export.md, point 87).
8
8
  */
9
- export function export_csv(result_json: string, options: any, header: boolean): string;
9
+ export function export_csv(answer: any, options: any, header: boolean): string;
10
10
 
11
11
  /**
12
12
  * One piece of a JSON array: the rows as objects, joined by commas. `first`:
13
13
  * no row has been written yet (not "the first piece" — after an empty first
14
14
  * piece it is still true), so no comma leads. `loader.js` writes the brackets.
15
15
  */
16
- export function export_json(result_json: string, first: boolean): string;
16
+ export function export_json(answer: any, first: boolean): string;
17
17
 
18
18
  /**
19
19
  * The pivot as it is shown, as CSV (issue #3).
@@ -169,8 +169,8 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
169
169
 
170
170
  export interface InitOutput {
171
171
  readonly memory: WebAssembly.Memory;
172
- readonly export_csv: (a: number, b: number, c: any, d: number) => [number, number, number, number];
173
- readonly export_json: (a: number, b: number, c: number) => [number, number, number, number];
172
+ readonly export_csv: (a: any, b: any, c: number) => [number, number, number, number];
173
+ readonly export_json: (a: any, b: number) => [number, number, number, number];
174
174
  readonly get_pivot: (a: any, b: any) => [number, number, number];
175
175
  readonly get_query: (a: any) => any;
176
176
  readonly get_view: (a: any) => any;
@@ -181,11 +181,12 @@ export interface InitOutput {
181
181
  readonly set_provider: (a: any, b: any) => void;
182
182
  readonly set_texts: (a: any, b: any) => void;
183
183
  readonly set_view: (a: any, b: any) => void;
184
- readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
184
+ readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_90ed3bea5014610e___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
185
185
  readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___wasm_bindgen_66404d18cc2edcc2___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_66404d18cc2edcc2___JsError___true_: (a: number, b: number, c: any) => [number, number];
186
- readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true_: (a: number, b: number, c: any) => void;
187
- readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__3: (a: number, b: number, c: any) => void;
188
- readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__4: (a: number, b: number, c: any) => void;
186
+ readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true_: (a: number, b: number, c: any) => void;
187
+ readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__2: (a: number, b: number, c: any) => void;
188
+ readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__4: (a: number, b: number, c: any) => void;
189
+ readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__5: (a: number, b: number, c: any) => void;
189
190
  readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___u32______true_: (a: number, b: number, c: number) => void;
190
191
  readonly wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke_______true_: (a: number, b: number) => void;
191
192
  readonly __wbindgen_malloc: (a: number, b: number) => number;
@@ -1,37 +1,35 @@
1
1
  /* @ts-self-types="./opengrid_web_components.d.ts" */
2
- import { __opengrid_define_element } from './snippets/opengrid-web-core-51c93662af7982d2/inline1.js';
3
- import * as import1 from "./snippets/opengrid-web-core-51c93662af7982d2/inline0.js"
4
- import * as import2 from "./snippets/opengrid-web-core-51c93662af7982d2/inline0.js"
5
- import * as import3 from "./snippets/opengrid-web-core-51c93662af7982d2/inline0.js"
2
+ import { __opengrid_define_element } from './snippets/opengrid-web-core-54e8640e6ad3b889/inline1.js';
3
+ import * as import1 from "./snippets/opengrid-web-core-54e8640e6ad3b889/inline0.js"
4
+ import * as import2 from "./snippets/opengrid-web-core-54e8640e6ad3b889/inline0.js"
5
+ import * as import3 from "./snippets/opengrid-web-core-54e8640e6ad3b889/inline0.js"
6
6
 
7
7
 
8
8
  /**
9
9
  * One piece of a CSV: with `header`, the header line (and the byte order
10
10
  * mark) first. `options`: `{ delimiter, bom, protectFormulas, null }`, each
11
11
  * optional (docs/guides/export.md, point 87).
12
- * @param {string} result_json
12
+ * @param {any} answer
13
13
  * @param {any} options
14
14
  * @param {boolean} header
15
15
  * @returns {string}
16
16
  */
17
- export function export_csv(result_json, options, header) {
18
- let deferred3_0;
19
- let deferred3_1;
17
+ export function export_csv(answer, options, header) {
18
+ let deferred2_0;
19
+ let deferred2_1;
20
20
  try {
21
- const ptr0 = passStringToWasm0(result_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
22
- const len0 = WASM_VECTOR_LEN;
23
- const ret = wasm.export_csv(ptr0, len0, options, header);
24
- var ptr2 = ret[0];
25
- var len2 = ret[1];
21
+ const ret = wasm.export_csv(answer, options, header);
22
+ var ptr1 = ret[0];
23
+ var len1 = ret[1];
26
24
  if (ret[3]) {
27
- ptr2 = 0; len2 = 0;
25
+ ptr1 = 0; len1 = 0;
28
26
  throw takeFromExternrefTable0(ret[2]);
29
27
  }
30
- deferred3_0 = ptr2;
31
- deferred3_1 = len2;
32
- return getStringFromWasm0(ptr2, len2);
28
+ deferred2_0 = ptr1;
29
+ deferred2_1 = len1;
30
+ return getStringFromWasm0(ptr1, len1);
33
31
  } finally {
34
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
32
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
35
33
  }
36
34
  }
37
35
 
@@ -39,28 +37,26 @@ export function export_csv(result_json, options, header) {
39
37
  * One piece of a JSON array: the rows as objects, joined by commas. `first`:
40
38
  * no row has been written yet (not "the first piece" — after an empty first
41
39
  * piece it is still true), so no comma leads. `loader.js` writes the brackets.
42
- * @param {string} result_json
40
+ * @param {any} answer
43
41
  * @param {boolean} first
44
42
  * @returns {string}
45
43
  */
46
- export function export_json(result_json, first) {
47
- let deferred3_0;
48
- let deferred3_1;
44
+ export function export_json(answer, first) {
45
+ let deferred2_0;
46
+ let deferred2_1;
49
47
  try {
50
- const ptr0 = passStringToWasm0(result_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
51
- const len0 = WASM_VECTOR_LEN;
52
- const ret = wasm.export_json(ptr0, len0, first);
53
- var ptr2 = ret[0];
54
- var len2 = ret[1];
48
+ const ret = wasm.export_json(answer, first);
49
+ var ptr1 = ret[0];
50
+ var len1 = ret[1];
55
51
  if (ret[3]) {
56
- ptr2 = 0; len2 = 0;
52
+ ptr1 = 0; len1 = 0;
57
53
  throw takeFromExternrefTable0(ret[2]);
58
54
  }
59
- deferred3_0 = ptr2;
60
- deferred3_1 = len2;
61
- return getStringFromWasm0(ptr2, len2);
55
+ deferred2_0 = ptr1;
56
+ deferred2_1 = len1;
57
+ return getStringFromWasm0(ptr1, len1);
62
58
  } finally {
63
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
59
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
64
60
  }
65
61
  }
66
62
 
@@ -270,7 +266,7 @@ function __wbg_get_imports() {
270
266
  const ret = Error(getStringFromWasm0(arg0, arg1));
271
267
  return ret;
272
268
  },
273
- __wbg___opengrid_define_element_807a943a07794ca2: function(arg0, arg1, arg2, arg3, arg4, arg5) {
269
+ __wbg___opengrid_define_element_88bb7bec24bcb1d2: function(arg0, arg1, arg2, arg3, arg4, arg5) {
274
270
  __opengrid_define_element(getStringFromWasm0(arg0, arg1), arg2, arg3, arg4, arg5);
275
271
  },
276
272
  __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
@@ -352,6 +348,10 @@ function __wbg_get_imports() {
352
348
  const ret = arg0.call(arg1, arg2, arg3, arg4);
353
349
  return ret;
354
350
  }, arguments); },
351
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
352
+ const ret = arg0.call(arg1);
353
+ return ret;
354
+ }, arguments); },
355
355
  __wbg_call_e3b662382210db98: function() { return handleError(function (arg0, arg1, arg2, arg3) {
356
356
  const ret = arg0.call(arg1, arg2, arg3);
357
357
  return ret;
@@ -368,6 +368,10 @@ function __wbg_get_imports() {
368
368
  const ret = arg0.clientHeight;
369
369
  return ret;
370
370
  },
371
+ __wbg_clientLeft_bdcddc3e40fccaa7: function(arg0) {
372
+ const ret = arg0.clientLeft;
373
+ return ret;
374
+ },
371
375
  __wbg_closest_d889c758da4bb13b: function() { return handleError(function (arg0, arg1, arg2) {
372
376
  const ret = arg0.closest(getStringFromWasm0(arg1, arg2));
373
377
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -388,6 +392,14 @@ function __wbg_get_imports() {
388
392
  const ret = arg0.customElements;
389
393
  return ret;
390
394
  },
395
+ __wbg_disabled_03c1f71b366d407a: function(arg0) {
396
+ const ret = arg0.disabled;
397
+ return ret;
398
+ },
399
+ __wbg_disabled_ff46632391f3512a: function(arg0) {
400
+ const ret = arg0.disabled;
401
+ return ret;
402
+ },
391
403
  __wbg_dispatchEvent_ca78eaf3d469bc25: function() { return handleError(function (arg0, arg1) {
392
404
  const ret = arg0.dispatchEvent(arg1);
393
405
  return ret;
@@ -429,6 +441,14 @@ function __wbg_get_imports() {
429
441
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
430
442
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
431
443
  }, arguments); },
444
+ __wbg_getRootNode_f724c3be671a9a57: function(arg0) {
445
+ const ret = arg0.getRootNode();
446
+ return ret;
447
+ },
448
+ __wbg_get_507a50627bffa49b: function(arg0, arg1) {
449
+ const ret = arg0[arg1 >>> 0];
450
+ return ret;
451
+ },
432
452
  __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
433
453
  const ret = Reflect.get(arg0, arg1);
434
454
  return ret;
@@ -471,6 +491,16 @@ function __wbg_get_imports() {
471
491
  const ret = arg0.innerWidth;
472
492
  return ret;
473
493
  }, arguments); },
494
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
495
+ let result;
496
+ try {
497
+ result = arg0 instanceof ArrayBuffer;
498
+ } catch (_) {
499
+ result = false;
500
+ }
501
+ const ret = result;
502
+ return ret;
503
+ },
474
504
  __wbg_instanceof_Element_beebfaab75d12d9d: function(arg0) {
475
505
  let result;
476
506
  try {
@@ -541,6 +571,16 @@ function __wbg_get_imports() {
541
571
  const ret = result;
542
572
  return ret;
543
573
  },
574
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
575
+ let result;
576
+ try {
577
+ result = arg0 instanceof Uint8Array;
578
+ } catch (_) {
579
+ result = false;
580
+ }
581
+ const ret = result;
582
+ return ret;
583
+ },
544
584
  __wbg_instanceof_Window_05ba1ee4f6781663: function(arg0) {
545
585
  let result;
546
586
  try {
@@ -586,6 +626,10 @@ function __wbg_get_imports() {
586
626
  const ret = arg0.left;
587
627
  return ret;
588
628
  },
629
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
630
+ const ret = arg0.length;
631
+ return ret;
632
+ },
589
633
  __wbg_length_370319915dc99107: function(arg0) {
590
634
  const ret = arg0.length;
591
635
  return ret;
@@ -606,6 +650,14 @@ function __wbg_get_imports() {
606
650
  const ret = new Array();
607
651
  return ret;
608
652
  },
653
+ __wbg_new_5394f65338077341: function() { return handleError(function (arg0) {
654
+ const ret = new ResizeObserver(arg0);
655
+ return ret;
656
+ }, arguments); },
657
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
658
+ const ret = new Uint8Array(arg0);
659
+ return ret;
660
+ },
609
661
  __wbg_new_da52cf8fe3429cb2: function() {
610
662
  const ret = new Object();
611
663
  return ret;
@@ -622,6 +674,13 @@ function __wbg_get_imports() {
622
674
  const ret = new CustomEvent(getStringFromWasm0(arg0, arg1), arg2);
623
675
  return ret;
624
676
  }, arguments); },
677
+ __wbg_now_86c0d4ba3fa605b8: function() {
678
+ const ret = Date.now();
679
+ return ret;
680
+ },
681
+ __wbg_observe_f27242eadc2ebd47: function(arg0, arg1) {
682
+ arg0.observe(arg1);
683
+ },
625
684
  __wbg_of_85f52f8b6491a7ca: function(arg0) {
626
685
  const ret = Array.of(arg0);
627
686
  return ret;
@@ -630,6 +689,10 @@ function __wbg_get_imports() {
630
689
  const ret = arg0.ownerDocument;
631
690
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
632
691
  },
692
+ __wbg_parentElement_5030754e30795652: function(arg0) {
693
+ const ret = arg0.parentElement;
694
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
695
+ },
633
696
  __wbg_parse_1c0d8a8656d7e016: function() { return handleError(function (arg0, arg1) {
634
697
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
635
698
  return ret;
@@ -637,6 +700,9 @@ function __wbg_get_imports() {
637
700
  __wbg_preventDefault_b64888c857500682: function(arg0) {
638
701
  arg0.preventDefault();
639
702
  },
703
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
704
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
705
+ },
640
706
  __wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
641
707
  const ret = arg0.push(arg1);
642
708
  return ret;
@@ -696,6 +762,10 @@ function __wbg_get_imports() {
696
762
  __wbg_scrollIntoView_d8b806f471b7418e: function(arg0, arg1) {
697
763
  arg0.scrollIntoView(arg1);
698
764
  },
765
+ __wbg_scrollLeft_5be50f489b342a09: function(arg0) {
766
+ const ret = arg0.scrollLeft;
767
+ return ret;
768
+ },
699
769
  __wbg_scrollTop_b3effa9c5de14d21: function(arg0) {
700
770
  const ret = arg0.scrollTop;
701
771
  return ret;
@@ -735,6 +805,9 @@ function __wbg_get_imports() {
735
805
  __wbg_set_detail_564ad103413aa5dc: function(arg0, arg1) {
736
806
  arg0.detail = arg1;
737
807
  },
808
+ __wbg_set_disabled_0ae5c051bdb880d2: function(arg0, arg1) {
809
+ arg0.disabled = arg1 !== 0;
810
+ },
738
811
  __wbg_set_disabled_cad2c12b3643aa52: function(arg0, arg1) {
739
812
  arg0.disabled = arg1 !== 0;
740
813
  },
@@ -747,6 +820,9 @@ function __wbg_get_imports() {
747
820
  __wbg_set_mode_17bd6a9f8e12d5a5: function(arg0, arg1) {
748
821
  arg0.mode = __wbindgen_enum_ShadowRootMode[arg1];
749
822
  },
823
+ __wbg_set_scrollLeft_075e81a16fc93cca: function(arg0, arg1) {
824
+ arg0.scrollLeft = arg1;
825
+ },
750
826
  __wbg_set_scrollTop_431b03eeb3e9c636: function(arg0, arg1) {
751
827
  arg0.scrollTop = arg1;
752
828
  },
@@ -856,46 +932,51 @@ function __wbg_get_imports() {
856
932
  return ret;
857
933
  },
858
934
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
859
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 186, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
935
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 205, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
860
936
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___wasm_bindgen_66404d18cc2edcc2___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_66404d18cc2edcc2___JsError___true_);
861
937
  return ret;
862
938
  },
863
939
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
864
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 17, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
865
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true_);
940
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
941
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true_);
866
942
  return ret;
867
943
  },
868
944
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
869
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement"), String, Option(String), Option(String)], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
870
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_);
945
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
946
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__2);
871
947
  return ret;
872
948
  },
873
949
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
874
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement")], shim_idx: 17, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
875
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__3);
950
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement"), String, Option(String), Option(String)], shim_idx: 19, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
951
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_90ed3bea5014610e___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_);
876
952
  return ret;
877
953
  },
878
954
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
879
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 17, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
880
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__4);
955
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("HTMLElement")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
956
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__4);
881
957
  return ret;
882
958
  },
883
959
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
884
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 173, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
885
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___u32______true_);
960
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 18, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
961
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__5);
886
962
  return ret;
887
963
  },
888
964
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
889
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 16, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
965
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 192, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
966
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___u32______true_);
967
+ return ret;
968
+ },
969
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
970
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 17, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
890
971
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke_______true_);
891
972
  return ret;
892
973
  },
893
- __wbindgen_cast_0000000000000008: function(arg0) {
974
+ __wbindgen_cast_0000000000000009: function(arg0) {
894
975
  // Cast intrinsic for `F64 -> Externref`.
895
976
  const ret = arg0;
896
977
  return ret;
897
978
  },
898
- __wbindgen_cast_0000000000000009: function(arg0, arg1) {
979
+ __wbindgen_cast_000000000000000a: function(arg0, arg1) {
899
980
  // Cast intrinsic for `Ref(String) -> Externref`.
900
981
  const ret = getStringFromWasm0(arg0, arg1);
901
982
  return ret;
@@ -913,9 +994,9 @@ function __wbg_get_imports() {
913
994
  return {
914
995
  __proto__: null,
915
996
  "./opengrid_web_components_bg.js": import0,
916
- "./snippets/opengrid-web-core-51c93662af7982d2/inline0.js": import1,
917
- "./snippets/opengrid-web-core-51c93662af7982d2/inline0.js": import2,
918
- "./snippets/opengrid-web-core-51c93662af7982d2/inline0.js": import3,
997
+ "./snippets/opengrid-web-core-54e8640e6ad3b889/inline0.js": import1,
998
+ "./snippets/opengrid-web-core-54e8640e6ad3b889/inline0.js": import2,
999
+ "./snippets/opengrid-web-core-54e8640e6ad3b889/inline0.js": import3,
919
1000
  };
920
1001
  }
921
1002
 
@@ -923,16 +1004,20 @@ function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke_______true
923
1004
  wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke_______true_(arg0, arg1);
924
1005
  }
925
1006
 
926
- function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true_(arg0, arg1, arg2) {
927
- wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true_(arg0, arg1, arg2);
1007
+ function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true_(arg0, arg1, arg2) {
1008
+ wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true_(arg0, arg1, arg2);
1009
+ }
1010
+
1011
+ function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__2(arg0, arg1, arg2) {
1012
+ wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__2(arg0, arg1, arg2);
928
1013
  }
929
1014
 
930
- function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__3(arg0, arg1, arg2) {
931
- wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__3(arg0, arg1, arg2);
1015
+ function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__4(arg0, arg1, arg2) {
1016
+ wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__4(arg0, arg1, arg2);
932
1017
  }
933
1018
 
934
- function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__4(arg0, arg1, arg2) {
935
- wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__4(arg0, arg1, arg2);
1019
+ function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__5(arg0, arg1, arg2) {
1020
+ wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__5(arg0, arg1, arg2);
936
1021
  }
937
1022
 
938
1023
  function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___wasm_bindgen_66404d18cc2edcc2___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_66404d18cc2edcc2___JsError___true_(arg0, arg1, arg2) {
@@ -942,14 +1027,14 @@ function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___wasm_bin
942
1027
  }
943
1028
  }
944
1029
 
945
- function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_(arg0, arg1, arg2, arg3, arg4, arg5) {
1030
+ function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_90ed3bea5014610e___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_(arg0, arg1, arg2, arg3, arg4, arg5) {
946
1031
  const ptr0 = passStringToWasm0(arg3, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
947
1032
  const len0 = WASM_VECTOR_LEN;
948
1033
  var ptr1 = isLikeNone(arg4) ? 0 : passStringToWasm0(arg4, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
949
1034
  var len1 = WASM_VECTOR_LEN;
950
1035
  var ptr2 = isLikeNone(arg5) ? 0 : passStringToWasm0(arg5, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
951
1036
  var len2 = WASM_VECTOR_LEN;
952
- wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_(arg0, arg1, arg2, ptr0, len0, ptr1, len1, ptr2, len2);
1037
+ wasm.wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_90ed3bea5014610e___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_(arg0, arg1, arg2, ptr0, len0, ptr1, len1, ptr2, len2);
953
1038
  }
954
1039
 
955
1040
  function wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___u32______true_(arg0, arg1, arg2) {
@@ -1037,6 +1122,11 @@ function debugString(val) {
1037
1122
  return className;
1038
1123
  }
1039
1124
 
1125
+ function getArrayU8FromWasm0(ptr, len) {
1126
+ ptr = ptr >>> 0;
1127
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1128
+ }
1129
+
1040
1130
  let cachedDataViewMemory0 = null;
1041
1131
  function getDataViewMemory0() {
1042
1132
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
Binary file
@@ -1,8 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const export_csv: (a: number, b: number, c: any, d: number) => [number, number, number, number];
5
- export const export_json: (a: number, b: number, c: number) => [number, number, number, number];
4
+ export const export_csv: (a: any, b: any, c: number) => [number, number, number, number];
5
+ export const export_json: (a: any, b: number) => [number, number, number, number];
6
6
  export const get_pivot: (a: any, b: any) => [number, number, number];
7
7
  export const get_query: (a: any) => any;
8
8
  export const get_view: (a: any) => any;
@@ -13,11 +13,12 @@ export const set_formats: (a: any, b: any) => void;
13
13
  export const set_provider: (a: any, b: any) => void;
14
14
  export const set_texts: (a: any, b: any) => void;
15
15
  export const set_view: (a: any, b: any) => void;
16
- export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
16
+ export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_90ed3bea5014610e___features__gen_HtmlElement__HtmlElement__alloc_508e33bd5656020b___string__String__core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String___core_ed718c3d60ebd546___option__Option_alloc_508e33bd5656020b___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
17
17
  export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___wasm_bindgen_66404d18cc2edcc2___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_66404d18cc2edcc2___JsError___true_: (a: number, b: number, c: any) => [number, number];
18
- export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true_: (a: number, b: number, c: any) => void;
19
- export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__3: (a: number, b: number, c: any) => void;
20
- export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___web_sys_c43fef36ea7eb37c___features__gen_HtmlElement__HtmlElement______true__4: (a: number, b: number, c: any) => void;
18
+ export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true_: (a: number, b: number, c: any) => void;
19
+ export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__2: (a: number, b: number, c: any) => void;
20
+ export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__4: (a: number, b: number, c: any) => void;
21
+ export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___js_sys_f6d81f9cdcf4f83___Array______true__5: (a: number, b: number, c: any) => void;
21
22
  export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke___u32______true_: (a: number, b: number, c: number) => void;
22
23
  export const wasm_bindgen_66404d18cc2edcc2___convert__closures_____invoke_______true_: (a: number, b: number) => void;
23
24
  export const __wbindgen_malloc: (a: number, b: number) => number;
package/worker.js CHANGED
@@ -13,11 +13,12 @@
13
13
  * load { type:"load", id, name, bytes, schema }
14
14
  * -> { type:"loaded", id }
15
15
  * query { type:"query", id, query } -> { id, result }
16
+ * stats { type:"stats", id } -> { id, result } (issue #70)
16
17
  *
17
18
  * Any request that throws answers `{ id, type:"error", message }`. The `bytes`
18
- * of `load` arrive as a transferable `ArrayBuffer`; the response strings are the
19
- * wire JSON of the engine (E6/E13), so nothing engine-specific is serialised
20
- * here.
19
+ * of `load` arrive as a transferable `ArrayBuffer`; a `result` is the engine's
20
+ * binary result form (E35, `execute_columns`) and travels back the same way —
21
+ * transferred, not copied. Nothing engine-specific is serialised here.
21
22
  */
22
23
 
23
24
  /** The single engine instance, created on `init` and reused for every query. */
@@ -40,8 +41,14 @@ self.onmessage = async ({ data }) => {
40
41
  self.postMessage({ type: "loaded", id: data.id });
41
42
  break;
42
43
  }
44
+ case "stats": {
45
+ // What the engine holds: its memory and each source's size, as JSON.
46
+ self.postMessage({ id: data.id, result: engine.stats() });
47
+ break;
48
+ }
43
49
  case "query": {
44
- self.postMessage({ id: data.id, result: engine.execute(data.query) });
50
+ const result = engine.execute_columns(data.query);
51
+ self.postMessage({ id: data.id, result }, [result.buffer]);
45
52
  break;
46
53
  }
47
54
  default: