@casoon/opengrid 0.2.0 → 0.4.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 +136 -0
- package/README.md +45 -3
- package/engine/opengrid_wasm.d.ts +15 -1
- package/engine/opengrid_wasm.js +45 -1
- package/engine/opengrid_wasm_bg.wasm +0 -0
- package/engine/opengrid_wasm_bg.wasm.d.ts +2 -0
- package/loader.d.ts +50 -4
- package/loader.js +76 -18
- package/package.json +1 -1
- package/pkg/opengrid_web_components.d.ts +8 -8
- package/pkg/opengrid_web_components.js +99 -50
- package/pkg/opengrid_web_components_bg.wasm +0 -0
- package/pkg/opengrid_web_components_bg.wasm.d.ts +6 -6
- package/react/index.d.ts +5 -0
- package/react/index.js +3 -1
- package/svelte/OpengridGrid.svelte +2 -0
- package/svelte/OpengridPivot.svelte +2 -2
- package/svelte/OpengridTable.svelte +2 -2
- package/svelte/index.d.ts +5 -0
- package/vue/index.d.ts +5 -0
- package/vue/index.js +3 -1
- package/worker.js +5 -4
- /package/pkg/snippets/{opengrid-web-core-13b0d2b2f5d74a24 → opengrid-web-core-cf7d8c1a6d317e41}/inline0.js +0 -0
- /package/pkg/snippets/{opengrid-web-core-13b0d2b2f5d74a24 → opengrid-web-core-cf7d8c1a6d317e41}/inline1.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,142 @@ Two things belong in every release entry and are easy to leave out:
|
|
|
18
18
|
|
|
19
19
|
## [Unreleased]
|
|
20
20
|
|
|
21
|
+
## [0.4.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:** as in 0.1.0.
|
|
25
|
+
|
|
26
|
+
**Module sizes** (brotli, `just measure-modules`): the engine 335.1 → **122.6 KiB** (no
|
|
27
|
+
Arrow, #37); the elements 201.9 → 211.2 KiB (the binary result codec, #38). A page with grid
|
|
28
|
+
and engine loads about 334 KiB instead of 537 KiB.
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **The server as a library, sources as connectors** ([#45](https://github.com/casoon/opengrid/issues/45)).
|
|
33
|
+
A new crate `opengrid-connector` holds the one contract a source implements: `schema`,
|
|
34
|
+
`capabilities` and `execute`, with optional `pivot` and `export` that default to plain
|
|
35
|
+
queries. `opengrid-server` holds its sources as `Arc<dyn Connector>` and has a builder —
|
|
36
|
+
`Server::builder().source(name, connector, policy).token(..).build().await` — so an
|
|
37
|
+
application hands in its own source without changing the server. The server still checks
|
|
38
|
+
the token, the allowed fields and the row filter before a connector sees a query.
|
|
39
|
+
PostgreSQL and the local engine are reference connectors. See
|
|
40
|
+
[Connectors](docs/guides/connectors.md).
|
|
41
|
+
- **Sources that only hand out rows** ([#46](https://github.com/casoon/opengrid/issues/46)).
|
|
42
|
+
`RowSource` (`schema`, `scan` in pieces) wrapped in `Rows` is a full connector: the engine
|
|
43
|
+
answers every query on the server. `max_scan_rows` (default 1 000 000) bounds the rows one
|
|
44
|
+
answer reads; over it the server answers `413 limit_exceeded`. `DataSourceError` has a new
|
|
45
|
+
variant `LimitExceeded`.
|
|
46
|
+
- **Conformance for connector authors** ([#47](https://github.com/casoon/opengrid/issues/47)).
|
|
47
|
+
`opengrid_conformance::check_source(&source)` runs every case against any source and returns
|
|
48
|
+
a `Report` (`assert_ok()` for tests); `suite_dir`, `fixture_schema`, `fixture_csv` say where
|
|
49
|
+
the fixture is. A `Connector` runs through `opengrid_connector::AsSource`.
|
|
50
|
+
- **The server protocol, and a runner that proves a server** ([#48](https://github.com/casoon/opengrid/issues/48)).
|
|
51
|
+
[`docs/protocol.md`](docs/protocol.md) describes what an opengrid server speaks — endpoints,
|
|
52
|
+
the query object, both result forms, errors, export — and the four duties of a server:
|
|
53
|
+
token, row filter, field allowlist, bounds. `opengrid-conformance --endpoint <url> --token <t>`
|
|
54
|
+
runs the whole suite over HTTP in both result forms against any server, in any language
|
|
55
|
+
(`check_endpoint` in the library).
|
|
56
|
+
- **The rows tier streams** ([#50](https://github.com/casoon/opengrid/issues/50)). A rows-only
|
|
57
|
+
source is read piece by piece and the server keeps only what the answer needs: top
|
|
58
|
+
`offset + limit` for a page, partial aggregates per group. 100 million generated rows answer
|
|
59
|
+
a page in 13 s with 75 MiB, a grouping in 16 s with 41 MiB (reading them into one table
|
|
60
|
+
first would take about 4.5 GiB). `max_scan_rows` now bounds the rows or groups an answer
|
|
61
|
+
holds, not the rows read; `Rows::compact_at` tunes how often held rows are cut back.
|
|
62
|
+
`Table::concat` in `opengrid-columns`.
|
|
63
|
+
- **SQLite as a reference connector** ([#51](https://github.com/casoon/opengrid/issues/51)).
|
|
64
|
+
`opengrid-connector-sqlite`: filter, sort, group, aggregate and paging answered by SQLite
|
|
65
|
+
itself; a file, no installation (`rusqlite`, SQLite compiled in). All conformance cases
|
|
66
|
+
pass, plus a differential test against the engine where SQLite's habits differ most (NaN in
|
|
67
|
+
sums and extremes, NaN and -0.0 as groups, decimal averages). `examples/server` has a
|
|
68
|
+
`demo-sqlite` preset.
|
|
69
|
+
- **Results travel in a binary form** ([#38](https://github.com/casoon/opengrid/issues/38)),
|
|
70
|
+
`application/vnd.opengrid.columns`: the engine's columns written out, decimals exact, no
|
|
71
|
+
text per cell. `Engine.execute_columns` and `Planner.finish_columns` answer it next to
|
|
72
|
+
the JSON methods; the worker hands it over without a copy; `opengrid-server` answers it
|
|
73
|
+
for `POST /query` and `POST /pivot` when `Accept` asks, JSON otherwise (with
|
|
74
|
+
`Vary: Accept`). The elements and `exportRows` read both forms. For 100 000 rows × 10
|
|
75
|
+
columns the engine answers in 18 ms instead of 124 ms and an element reads the answer in
|
|
76
|
+
13 ms instead of 76 ms; compressed, both forms are about the same size.
|
|
77
|
+
|
|
78
|
+
### Changed
|
|
79
|
+
|
|
80
|
+
- **No configuration file and no binary in `opengrid-server`** ([#49](https://github.com/casoon/opengrid/issues/49)).
|
|
81
|
+
Configuration is code: the builder (#45). `opengrid-server` no longer depends on a database
|
|
82
|
+
driver, the local engine or `toml`. `LocalConnector` (with `from_csv`) moved to
|
|
83
|
+
`opengrid-connector`; PostgreSQL stays a reference connector in
|
|
84
|
+
`opengrid-datasource-postgres`. `examples/server` is a program around the library with the
|
|
85
|
+
demo's sources (`demo`, `demo-postgres`) and the end-to-end suite's (`e2e`).
|
|
86
|
+
|
|
87
|
+
**What breaks:** `opengrid-server <config.toml>` is gone, and with it `Config`,
|
|
88
|
+
`Registry::build` and `opengrid_server::build`. Write the sources as code —
|
|
89
|
+
[Connectors](docs/guides/connectors.md) shows how; `examples/server/src/main.rs` has the
|
|
90
|
+
former demo configurations as functions.
|
|
91
|
+
|
|
92
|
+
- **The built-in providers answer bytes.** `createLocalProvider` and `createWorkerProvider`
|
|
93
|
+
answer the binary form; `createRestProvider` and `createPivotProvider` ask the server
|
|
94
|
+
for it and still take JSON from a server that answers JSON. A provider of your own may
|
|
95
|
+
keep answering JSON.
|
|
96
|
+
|
|
97
|
+
**What breaks:** a page that calls a built-in provider's `execute` itself and parses the
|
|
98
|
+
answer as JSON now gets a `Uint8Array`. Call `Engine.execute` for JSON, or hand the
|
|
99
|
+
answer to the element or `exportRows`, which read both.
|
|
100
|
+
|
|
101
|
+
- **The engine no longer uses Apache Arrow** ([#37](https://github.com/casoon/opengrid/issues/37)).
|
|
102
|
+
It keeps its data in `opengrid-columns` — typed columns of exactly the seven types of
|
|
103
|
+
the query model — and `opengrid-engine` replaces `opengrid-arrow-engine`, in the browser
|
|
104
|
+
and on the server. The engine module (`engine/opengrid_wasm_bg.wasm`) shrinks from
|
|
105
|
+
335 KiB to 118 KiB brotli (1.94 MB → 0.34 MB raw). Every conformance case answers as
|
|
106
|
+
before; an old-against-new differential test over random queries found no difference
|
|
107
|
+
before the old engine was removed. In the browser, grouping and aggregating got about
|
|
108
|
+
twice as fast and a sort window over sorted data too; a single-key sort is about 1.2×
|
|
109
|
+
slower, everything else within ±12 %.
|
|
110
|
+
|
|
111
|
+
**What breaks** (Rust crates only; the npm package and its JavaScript API are
|
|
112
|
+
unchanged): the crate `opengrid-arrow-engine` is now `opengrid-engine`. `load_csv` and
|
|
113
|
+
`load_json` return one `Table` instead of `Vec<RecordBatch>`, `JsonOptions` and
|
|
114
|
+
`CsvOptions::batch_size` are gone, `LocalDataSource::new` takes the table and cannot
|
|
115
|
+
fail, and `execute::QueryResult` carries a `table`. `opengrid-types` has no `arrow`
|
|
116
|
+
feature any more.
|
|
117
|
+
|
|
118
|
+
## [0.3.0] — 2026-09-27
|
|
119
|
+
|
|
120
|
+
**Screen-reader pairings tested: none yet** — unchanged since 0.1.0
|
|
121
|
+
([issue #5](https://github.com/casoon/opengrid/issues/5)). **Browsers:** as in 0.1.0.
|
|
122
|
+
|
|
123
|
+
### Changed
|
|
124
|
+
|
|
125
|
+
- **The look of the design prototype is the default** ([#32](https://github.com/casoon/opengrid/issues/32)).
|
|
126
|
+
A grid, table or pivot without page CSS looks like the prototype's *Base*: Geist,
|
|
127
|
+
white surfaces, accent `#3d5fd6`, radius 12px.
|
|
128
|
+
- **`theme`** on all three elements picks a built-in look: `base` (default), `paper`,
|
|
129
|
+
`violet`, `orange`, `dark`. `--og-*` properties set by the page still win. The adapters
|
|
130
|
+
take `theme` as a prop. The fonts are named, not loaded.
|
|
131
|
+
|
|
132
|
+
- **The grid's parts look like the design prototype** ([#33](https://github.com/casoon/opengrid/issues/33)):
|
|
133
|
+
the search field, the switches, the column list and the density (a segmented control) in
|
|
134
|
+
one toolbar row; pill chips, the grouping chip inverted; small uppercase column headers;
|
|
135
|
+
32px filter and facet fields.
|
|
136
|
+
- **"+ Filter" and "+ Group"** in the toolbar ([#34](https://github.com/casoon/opengrid/issues/34)),
|
|
137
|
+
the prototype's two quick doors. *+ Filter* opens a non-modal dialog (column, condition,
|
|
138
|
+
value) that writes the filter row's own entry; *+ Group* opens a menu of the groupable
|
|
139
|
+
columns with the column menu's keys and adds a grouping level. New parts `add-filter`,
|
|
140
|
+
`add-grouping`, `filter-dialog`, `grouping-menu`; nine text keys (`addFilter`,
|
|
141
|
+
`addFilterTitle`, `filterColumnLabel`, `filterConditionLabel`, `filterValueLabel`,
|
|
142
|
+
`cancel`, `apply`, `addGrouping`, `groupingFull`).
|
|
143
|
+
- **A footer**: the status line moved below the rows — the same live region, so the
|
|
144
|
+
announcements are unchanged, but a screen reader reading through meets the count after the
|
|
145
|
+
table. Beside it, where the queries ran and how many were asked for what is shown
|
|
146
|
+
(`local · wasm · 2 queries`): providers carry an optional **`kind`** (`local`, `worker`,
|
|
147
|
+
`remote`, `hybrid`; the built-in ones set it), and six new text keys (`sourceLocal`,
|
|
148
|
+
`sourceWorker`, `sourceRemote`, `sourceHybrid`, `queriesOne`, `queriesOther`). New parts
|
|
149
|
+
`footer` and `source`.
|
|
150
|
+
|
|
151
|
+
**What breaks:** the defaults were the system colours (`Canvas`, `CanvasText`,
|
|
152
|
+
`LinkText`) and followed the reader's light or dark mode. A page that relied on that sets
|
|
153
|
+
`theme="dark"` itself, or its own `--og-*` properties. Under `forced-colors` nothing
|
|
154
|
+
changes. A page that styled `::part(status)` as a line above the rows finds it in the
|
|
155
|
+
footer now.
|
|
156
|
+
|
|
21
157
|
## [0.2.0] — 2026-09-27
|
|
22
158
|
|
|
23
159
|
**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
|
+
[](https://www.npmjs.com/package/@casoon/opengrid)
|
|
4
|
+
[](#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
|
|
61
|
-
|
|
62
|
-
|
|
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
|
*
|
|
@@ -59,10 +66,15 @@ export class Planner {
|
|
|
59
66
|
* Runs `client_query_json` over `result_json` — the source's answer.
|
|
60
67
|
*
|
|
61
68
|
* This is the hybrid return path E14 names: the partial result becomes
|
|
62
|
-
*
|
|
69
|
+
* a table again and the engine finishes the query over them, which
|
|
63
70
|
* includes recounting `total_count` — filtering or grouping changed it.
|
|
64
71
|
*/
|
|
65
72
|
finish(client_query_json: string, result_json: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* [`finish`](Planner::finish) for a source that answered in the binary
|
|
75
|
+
* form: the bytes in, the finished result as bytes out.
|
|
76
|
+
*/
|
|
77
|
+
finish_columns(client_query_json: string, result: Uint8Array): Uint8Array;
|
|
66
78
|
/**
|
|
67
79
|
* A planner for a source with `schema_json` and `capabilities_json`, in
|
|
68
80
|
* `mode` (`local`, `remote`, `hybrid` or `auto`).
|
|
@@ -92,10 +104,12 @@ export interface InitOutput {
|
|
|
92
104
|
readonly __wbg_engine_free: (a: number, b: number) => void;
|
|
93
105
|
readonly __wbg_planner_free: (a: number, b: number) => void;
|
|
94
106
|
readonly engine_execute: (a: number, b: number, c: number) => [number, number, number, number];
|
|
107
|
+
readonly engine_execute_columns: (a: number, b: number, c: number) => [number, number, number, number];
|
|
95
108
|
readonly engine_load_csv: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
96
109
|
readonly engine_new: () => number;
|
|
97
110
|
readonly engine_source_names: (a: number) => [number, number];
|
|
98
111
|
readonly planner_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
112
|
+
readonly planner_finish_columns: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
99
113
|
readonly planner_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
100
114
|
readonly planner_plan: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
101
115
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
package/engine/opengrid_wasm.js
CHANGED
|
@@ -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
|
*
|
|
@@ -121,7 +140,7 @@ export class Planner {
|
|
|
121
140
|
* Runs `client_query_json` over `result_json` — the source's answer.
|
|
122
141
|
*
|
|
123
142
|
* This is the hybrid return path E14 names: the partial result becomes
|
|
124
|
-
*
|
|
143
|
+
* a table again and the engine finishes the query over them, which
|
|
125
144
|
* includes recounting `total_count` — filtering or grouping changed it.
|
|
126
145
|
* @param {string} client_query_json
|
|
127
146
|
* @param {string} result_json
|
|
@@ -149,6 +168,26 @@ export class Planner {
|
|
|
149
168
|
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
150
169
|
}
|
|
151
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* [`finish`](Planner::finish) for a source that answered in the binary
|
|
173
|
+
* form: the bytes in, the finished result as bytes out.
|
|
174
|
+
* @param {string} client_query_json
|
|
175
|
+
* @param {Uint8Array} result
|
|
176
|
+
* @returns {Uint8Array}
|
|
177
|
+
*/
|
|
178
|
+
finish_columns(client_query_json, result) {
|
|
179
|
+
const ptr0 = passStringToWasm0(client_query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
180
|
+
const len0 = WASM_VECTOR_LEN;
|
|
181
|
+
const ptr1 = passArray8ToWasm0(result, wasm.__wbindgen_malloc);
|
|
182
|
+
const len1 = WASM_VECTOR_LEN;
|
|
183
|
+
const ret = wasm.planner_finish_columns(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
184
|
+
if (ret[3]) {
|
|
185
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
186
|
+
}
|
|
187
|
+
var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
188
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
189
|
+
return v3;
|
|
190
|
+
}
|
|
152
191
|
/**
|
|
153
192
|
* A planner for a source with `schema_json` and `capabilities_json`, in
|
|
154
193
|
* `mode` (`local`, `remote`, `hybrid` or `auto`).
|
|
@@ -261,6 +300,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
261
300
|
return result;
|
|
262
301
|
}
|
|
263
302
|
|
|
303
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
304
|
+
ptr = ptr >>> 0;
|
|
305
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
306
|
+
}
|
|
307
|
+
|
|
264
308
|
let cachedDataViewMemory0 = null;
|
|
265
309
|
function getDataViewMemory0() {
|
|
266
310
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
Binary file
|
|
@@ -4,10 +4,12 @@ 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];
|
|
10
11
|
export const planner_finish: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
12
|
+
export const planner_finish_columns: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
11
13
|
export const planner_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
12
14
|
export const planner_plan: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
13
15
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
package/loader.d.ts
CHANGED
|
@@ -126,15 +126,28 @@ 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
|
|
133
|
-
* without one. `options` is optional and new: a
|
|
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):
|
|
144
|
+
execute(queryJson: string, mode: string, options?: ExecuteOptions): Answer | Promise<Answer>;
|
|
145
|
+
/**
|
|
146
|
+
* Optional: where the queries run. The grid names it in its footer, beside
|
|
147
|
+
* the number of queries asked for what is shown; the built-in providers set
|
|
148
|
+
* it. A provider without it is shown with the count alone.
|
|
149
|
+
*/
|
|
150
|
+
kind?: ProviderKind;
|
|
138
151
|
/**
|
|
139
152
|
* Optional: the whole export of `query` in one go. `exportRows` uses it when
|
|
140
153
|
* it is there instead of fetching pieces over `execute` —
|
|
@@ -163,7 +176,10 @@ export interface EngineProvider extends Provider {
|
|
|
163
176
|
/** The engine of the engine module, as `createLocalProvider` uses it. */
|
|
164
177
|
export interface Engine {
|
|
165
178
|
load_csv(name: string, bytes: Uint8Array, schema: string): void;
|
|
179
|
+
/** The result as JSON. */
|
|
166
180
|
execute(queryJson: string): string;
|
|
181
|
+
/** The result in the binary form — what the tab and worker providers answer. */
|
|
182
|
+
execute_columns(queryJson: string): Uint8Array;
|
|
167
183
|
}
|
|
168
184
|
|
|
169
185
|
/** What a server says a source is. */
|
|
@@ -192,6 +208,8 @@ export interface PlannerLike {
|
|
|
192
208
|
plan(queryJson: string, mode: string): string;
|
|
193
209
|
/** Finishes the client half over the source's answer; the result as JSON. */
|
|
194
210
|
finish(clientQueryJson: string, resultJson: string): string;
|
|
211
|
+
/** The same over an answer in the binary form; the result as bytes. */
|
|
212
|
+
finish_columns(clientQueryJson: string, result: Uint8Array): Uint8Array;
|
|
195
213
|
}
|
|
196
214
|
|
|
197
215
|
/** The plan `createHybridProvider` hands to `onPlan` before anything is sent. */
|
|
@@ -350,8 +368,17 @@ export interface CodedError extends Error {
|
|
|
350
368
|
/** Where a query may run; handed to the provider unchanged. */
|
|
351
369
|
export type Mode = "local" | "remote" | "hybrid" | "auto";
|
|
352
370
|
|
|
371
|
+
/** What a provider's `kind` says: where its queries run. */
|
|
372
|
+
export type ProviderKind = "local" | "worker" | "remote" | "hybrid";
|
|
373
|
+
|
|
353
374
|
export type Density = "compact" | "normal" | "comfortable";
|
|
354
375
|
|
|
376
|
+
/**
|
|
377
|
+
* The built-in looks of the `theme` attribute; `base` is the default. The
|
|
378
|
+
* `--og-*` custom properties a page sets on the element win over them.
|
|
379
|
+
*/
|
|
380
|
+
export type Theme = "base" | "paper" | "violet" | "orange" | "dark";
|
|
381
|
+
|
|
355
382
|
/** The filter operators, by wire token. */
|
|
356
383
|
export type FilterOperator =
|
|
357
384
|
| "eq"
|
|
@@ -543,6 +570,21 @@ export type TextKey =
|
|
|
543
570
|
| "facetTo"
|
|
544
571
|
| "facetQueries"
|
|
545
572
|
| "facetChipValues"
|
|
573
|
+
| "addFilter"
|
|
574
|
+
| "addFilterTitle"
|
|
575
|
+
| "filterColumnLabel"
|
|
576
|
+
| "filterConditionLabel"
|
|
577
|
+
| "filterValueLabel"
|
|
578
|
+
| "cancel"
|
|
579
|
+
| "apply"
|
|
580
|
+
| "addGrouping"
|
|
581
|
+
| "groupingFull"
|
|
582
|
+
| "sourceLocal"
|
|
583
|
+
| "sourceWorker"
|
|
584
|
+
| "sourceRemote"
|
|
585
|
+
| "sourceHybrid"
|
|
586
|
+
| "queriesOne"
|
|
587
|
+
| "queriesOther"
|
|
546
588
|
| "searchLabel"
|
|
547
589
|
| "searchPlaceholder"
|
|
548
590
|
| "queryAnd"
|
|
@@ -643,12 +685,15 @@ export interface OpengridGridAttributes {
|
|
|
643
685
|
"column-menu"?: string;
|
|
644
686
|
selection?: string;
|
|
645
687
|
density?: Density;
|
|
688
|
+
/** One of the built-in looks; Base when absent. */
|
|
689
|
+
theme?: Theme;
|
|
646
690
|
}
|
|
647
691
|
|
|
648
692
|
export interface OpengridTableAttributes {
|
|
649
693
|
label?: string;
|
|
650
694
|
datasource?: string;
|
|
651
695
|
columns?: string;
|
|
696
|
+
theme?: Theme;
|
|
652
697
|
}
|
|
653
698
|
|
|
654
699
|
export interface OpengridPivotAttributes {
|
|
@@ -660,6 +705,7 @@ export interface OpengridPivotAttributes {
|
|
|
660
705
|
columns?: string;
|
|
661
706
|
/** The measures as the contract's JSON: `[{"field":"qty","fn":"sum","as":"total"}]`. */
|
|
662
707
|
values?: string;
|
|
708
|
+
theme?: Theme;
|
|
663
709
|
}
|
|
664
710
|
|
|
665
711
|
/** `<opengrid-grid>`; it fires the three events. */
|