@casoon/opengrid 0.1.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 ADDED
@@ -0,0 +1,256 @@
1
+ # Changelog
2
+
3
+ Notable changes to `@casoon/opengrid` and the `opengrid-*` crates. The npm
4
+ package and the crates carry the same version and are released together, so one
5
+ entry covers both.
6
+
7
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
8
+ the versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
9
+ with the `0.x` reading written down in [docs/releasing.md](docs/releasing.md): a
10
+ minor bump may break the API, a patch bump may not.
11
+
12
+ Two things belong in every release entry and are easy to leave out:
13
+
14
+ - **What breaks**, named, whenever the minor version moves. "Renamed X to Y" is
15
+ an entry; "various improvements" is not.
16
+ - **Which screen-reader pairings were tested**, and which were not. An untested
17
+ pairing is a documented gap until 1.0, so it has to be documented.
18
+
19
+ ## [Unreleased]
20
+
21
+ ## [0.1.0] — 2026-09-26
22
+
23
+ The first release: `@casoon/opengrid`, `@casoon/opengrid-react`,
24
+ `@casoon/opengrid-vue`, `@casoon/opengrid-svelte` and the `opengrid-*` crates,
25
+ all at `0.1.0`. Nothing breaks — there was nothing before it.
26
+
27
+ **Screen-reader pairings tested: none yet.** Everything below is built and
28
+ tested — keyboard, focus, announcements, axe-core in every state — but no screen
29
+ reader has been run over it. The passes follow this release
30
+ ([issue #5](https://github.com/casoon/opengrid/issues/5)). **Browsers:**
31
+ Chromium, Firefox and WebKit through the end-to-end suite (Firefox and WebKit at
32
+ a desktop viewport, `just e2e-browsers`); Safari itself, iOS and Edge not
33
+ tested.
34
+
35
+ ### Added
36
+
37
+ - **One query model.** A JSON AST — filter, sort, group, aggregate, paging,
38
+ projection — that a browser sends instead of SQL. Its semantics are pinned by
39
+ a conformance suite of 53 query cases and 5 pivot cases covering NULL
40
+ ordering, binary collation, exact decimals, non-finite floats and microsecond
41
+ timestamps.
42
+ - **Three ways to run that model, proven to agree.** In the tab over Apache
43
+ Arrow compiled to WebAssembly; on a server against PostgreSQL as one compiled
44
+ statement; or split between the two, with a planner deciding from what the
45
+ source declares it can do. All three answer every conformance case
46
+ identically.
47
+ - **`<opengrid-table>`** — an ordinary semantic `<table>` for display, so
48
+ copying, find-in-page and screen readers behave as they do anywhere else.
49
+ - **`<opengrid-grid>`** — the interactive element: keyboard navigation under the
50
+ WAI-ARIA grid pattern, virtualized row recycling that keeps a ~40-row DOM
51
+ window over 100,000 logical rows, a type-aware filter row, multi-column sort,
52
+ row selection, cell editing, columns that move, resize and hide from the
53
+ keyboard alone, and paging as an alternative to virtualization.
54
+ - **`<opengrid-pivot>`** — a pivot as a set of grouping sets plus a reshaping,
55
+ which PostgreSQL folds into a single `GROUPING SETS` statement. Limits are
56
+ errors with a sentence, never a silently truncated result.
57
+ - **`opengrid-server`** — the gateway: bearer tokens from configuration, a
58
+ mandatory row filter derived from the token's context that a client cannot
59
+ opt out of, an `allowed_fields` allowlist, and explicit CORS origins.
60
+ - **Derived columns**, computed from a date part (year, month) without an
61
+ expression language.
62
+ - **Cell formatting** through `Intl` in the browser, kept strictly out of the
63
+ query: sorting stays binary, decimals stay exact, dates are computed in UTC.
64
+ - **Overridable texts** via `set_texts`, with the language declared on the nodes
65
+ carrying the component's own words and never on the page's data.
66
+ - **Theming** through eighteen `--og-*` custom properties and `::part`. The
67
+ defaults are system colours, so an unthemed grid follows light and dark on its
68
+ own; the focus ring, `forced-colors` and `prefers-reduced-motion` cannot be
69
+ switched off. `density` sets row height, padding and font size in one step.
70
+ - **Configurable views.** The schema from the source is the truth;
71
+ `set_columns` narrows it — width, alignment, emphasis, the aggregate a column
72
+ shows, how it is offered as a facet — and refuses, in words, what the type
73
+ contradicts. The reader's view (sort, filters, columns, density, grouping,
74
+ facets) is one value: `get_view`, `set_view` and `opengrid-view-change`. A
75
+ saved view is that value with a name on it, so naming and storing views stays
76
+ with the page.
77
+ - **Grouping** by up to two columns, still virtualized, as a `treegrid` while
78
+ grouped, with sums, averages, counts, minima, maxima or the range a group
79
+ spans, and a grand total as the last row.
80
+ - **Search** that takes free text or a filter written out
81
+ (`country = DE and amount ≥ 10`) as an ARIA combobox, and turns the latter
82
+ into the filter row's own entries rather than a second kind of filter.
83
+ - **Facets** — lists, toggle buttons, ranges and periods — each counted
84
+ without its own restriction, with the cost of the counting said.
85
+ - **A toolbar** with the active filters as chips, a **column menu** as a second
86
+ way to sort, filter, aggregate, group and hide, a **selection column**, and an
87
+ **empty state** that says why and offers a way out only where one exists.
88
+ - **The engine ships in `@casoon/opengrid`**, under `engine/` — `Engine` and
89
+ `Planner`, imported as `@casoon/opengrid/engine/opengrid_wasm.js` to query
90
+ in the tab. `createWorkerProvider()` defaults to it; `moduleUrl` and
91
+ `wasmUrl` still pick another, and a production bundler needs `moduleUrl`
92
+ and `workerUrl` passed (docs/guides/frameworks.md).
93
+ - **A frozen public API**, written down in `docs/api.md` and held by a test.
94
+ - **TypeScript declarations** (`loader.d.ts`) for everything in
95
+ [docs/api.md](docs/api.md), resolved through the package's `exports`. The
96
+ event `detail`s are typed on the element and on the document; a view, a
97
+ column configuration or a text key the API does not take is a compile error.
98
+ - **`opengrid-export`** — a query result as CSV (RFC 4180, UTF-8 with a byte
99
+ order mark, a guard against formula injection in text cells) or JSON rows,
100
+ in the wire notation and piece by piece; the same code for the browser and
101
+ the server. With NULL spelled `\N` and the guard off, an export reads back
102
+ into opengrid unchanged — except a text that is `\N` itself, which comes
103
+ back as NULL.
104
+ - **`get_query(host)`** hands out the query of the grid's current view —
105
+ the filter row, the facets and the search and-ed together, the sort, the
106
+ shown columns in their order — without a window: what a page exports is
107
+ then what the reader sees, every match of it. Grouped, the group keys lead,
108
+ NULL last said explicitly, and the rows come in the order the grid draws
109
+ them. A grouped grid whose filter does not hold says so in its status line,
110
+ as an ungrouped one does, instead of falling back to the filter row alone.
111
+ - **`exportRows(provider, query, options)`** — every match of a query, through
112
+ any provider, fetched in pieces of `chunkSize` (10 000) and handed back as a
113
+ `Blob` of CSV or JSON in the `opengrid-export` notation. The sort is made
114
+ total by appending every selected column not yet in it, so a tie cannot
115
+ repeat or drop a row between two pieces, even over PostgreSQL; within a tie
116
+ the export follows the columns, not the grid. A source whose count changes
117
+ during the export is detected and refused with an error, not exported.
118
+ Progress after each piece, an
119
+ `AbortSignal` that stops the request in flight, and `maxRows` (1 000 000) as
120
+ an error with a sentence, never a truncated file. Providers take the signal
121
+ as an optional third argument, `execute(query, mode, { signal })`; the REST,
122
+ pivot and hybrid providers hand it to `fetch`. The prototype page exports its
123
+ current view with it.
124
+ - **`POST /export/{source}`** on `opengrid-server` streams every row of a query
125
+ as CSV or JSON, under the rules of `POST /query` — the token, `allowed_fields`,
126
+ the tenant's `row_filter`, both validations — with its own bound,
127
+ `max_export_rows` (1 000 000), instead of `max_limit`. More rows are a `413`
128
+ before the first byte, counted in the same `REPEATABLE READ` snapshot a
129
+ PostgreSQL cursor then reads; `timeout_ms` bounds the time to the first byte,
130
+ each fetch, and the time a client may take to accept each piece. At most
131
+ `max_concurrent_exports` run at once (half the smallest PostgreSQL pool by
132
+ default; one more is a `503` with the error code `busy`, before any database
133
+ work), and PostgreSQL's own
134
+ `idle_in_transaction_session_timeout` backs both up. The body is a bounded
135
+ channel, so a slow client slows the reading and a client that leaves or
136
+ stalls ends the query; a failure midway — a panic included — breaks the
137
+ connection off rather than ending a short file. `Content-Disposition` names
138
+ the file after the source, `X-Total-Count` carries the row count. A million
139
+ rows from PostgreSQL keep the server under 40 MiB (measured in
140
+ [docs/guides/where-queries-run.md](docs/guides/where-queries-run.md)).
141
+ `createRestProvider(...).export(query, options)` fetches it as a `Blob`, and
142
+ `exportRows` uses a provider's `export` when there is one — one request
143
+ instead of pieces, the same file. No request of the REST or pivot provider
144
+ follows a redirect, so the token goes nowhere but the configured URL.
145
+ - **Errors a page can tell apart without reading the sentence.** A rejection
146
+ of `createRestProvider` (`describe`, `execute`, `export`) and
147
+ `createPivotProvider` carries the server's HTTP `status`, and the `code` and
148
+ `path` of its error form, as fields on the `Error`; `exportRows`' own
149
+ refusals carry a `code` — `too_many_rows`, `source_changed`,
150
+ `module_not_loaded`. The message is what it was, and there is no error class:
151
+ a page switches on `error.code`. The server's codes are the closed list of
152
+ its error form `{ "error": { "code", "message", "path" } }` — part of the
153
+ wire format — and `busy` (`503`, try again later) is kept apart from
154
+ `limit_exceeded` (`413`, narrow the request). Typed as `CodedError` and
155
+ `ErrorCode`, frozen with the rest of the API, and listed with their statuses
156
+ in [docs/api.md → Errors](docs/api.md#errors).
157
+ - Under the formula guard, the CSV option `null` may not start like a formula
158
+ (`=`, `+`, `-`, `@`, a tab): it is written into every empty cell unguarded.
159
+ `exportRows`, `get_pivot` and the server refuse it with a sentence.
160
+ - Against PostgreSQL, a query with aggregates and no grouping reports
161
+ `total_count` 1 — its one row — as the local engine does, instead of the
162
+ number of rows it aggregated.
163
+ - **An export guide** ([docs/guides/export.md](docs/guides/export.md)): what an export
164
+ holds and why raw values, the browser and the server path, a pivot as shown, the formula
165
+ guard and when to switch it off, NULL in a CSV, reading an export back into opengrid, and
166
+ the errors a page handles. The framework guide shows the export for each adapter.
167
+ - **`get_pivot(host, options)`** exports an `<opengrid-pivot>` as it is shown,
168
+ as CSV: the row dimensions as columns, one header line naming each generated
169
+ column by its value and measure (`2025 · total`), the subtotals and the grand
170
+ total as rows with their labels, NULL and the empty group named as in the
171
+ table — in the element's own texts. The element exports the answer it holds
172
+ rather than asking again, so the file is the table on screen. In the crates:
173
+ `opengrid_export::pivot_csv`, and `opengrid_pivot::pivot_from_json`, which
174
+ reads the pivot wire form back and refuses one of the wrong shape.
175
+ - **`connect(host, options)`** supplies an element from one object — provider,
176
+ texts, formats, presentation, choices, a controlled view and the three event
177
+ callbacks — in the one order that asks the source once, after the module has
178
+ loaded, and keeps it supplied: `update` writes only what changed, and writing
179
+ back the view the grid just reported costs nothing. The seam for framework
180
+ adapters, usable as it is from Angular, Lit or plain pages.
181
+ - **`@casoon/opengrid-react`** — `OpengridGrid`, `OpengridTable` and
182
+ `OpengridPivot` for React 18 and 19: the attributes as props (rendered, so
183
+ they are in the server HTML), everything else through `connect`, the view
184
+ controlled (`view` + `onViewChange`) or not (`defaultView`), the element
185
+ through `ref`, `"use client"` for Server Components. Tested in React 18
186
+ and 19 under StrictMode; rendered on the server with React 19; the packed
187
+ tarball checked in a scratch project (server rendering and types).
188
+ - **`@casoon/opengrid-vue`** — the same three components for Vue 3.3 and
189
+ later: `v-model:view`, `@selection-change`, `@cell-change`, the other
190
+ options as props. Under `<KeepAlive>` a grid comes back with its view and
191
+ selection and asks nothing; taken out for good, it is collected. Rendered
192
+ on the server, and its packed tarball checked like the React one.
193
+ - **`@casoon/opengrid-svelte`** — the three components for Svelte 5, shipped
194
+ as `.svelte` sources: `bind:view`, `bind:element`, `onselectionchange`,
195
+ `oncellchange`, the other options as props. Rendered on the server through
196
+ Vite's SSR with the Svelte plugin, and its packed tarball checked like the
197
+ others.
198
+ - **Elements that come and go.** A grid or table removed from the page is
199
+ garbage-collected, and with it its rows and whatever the page handed only to
200
+ it — the provider, a format function — even when those close over the
201
+ element. A grid that is moved, or taken out and put back later (Vue's
202
+ `<KeepAlive>`, a detached tab panel), keeps its view, selection, active cell
203
+ and scroll position. It asks its source again only for rows it no longer
204
+ holds: when its active cell had been scrolled out of the loaded window, it
205
+ comes back at that cell, so `Tab` still finds the grid.
206
+
207
+ ### Accessibility
208
+
209
+ - Every feature is keyboard-operable; nothing requires dragging (WCAG 2.5.7),
210
+ and targets meet 2.5.8.
211
+ - One polite live region carries every state: loading, N matches, no matches,
212
+ and an error that does **not** replace the grid.
213
+ - 880 end-to-end test runs in Chromium — most specs on both a desktop and a
214
+ narrow viewport — and the same suite in Firefox (433) and WebKit (432) before a
215
+ release, with
216
+ axe-core in every state the components can be in — open menus, the facet
217
+ sidebar and all five looks of the design prototype included — and a spec that
218
+ records the status line's *successive* states, so an announcement made twice,
219
+ never, or too early is a failing test.
220
+ - The language of every leaf node and every accessible name is checked in the
221
+ real DOM: the component's own words carry its language, the page's column
222
+ names and values never do.
223
+ - New texts or a new presentation rebuild the grid without taking the focus:
224
+ the active cell gets it back only if the grid had it, so `set_texts` while a
225
+ page loads — or from the page's own language switch — leaves the focus where
226
+ the reader put it.
227
+ - Scroll areas are not tab stops in Firefox, which makes every scroller
228
+ focusable: Tab meets the controls and the grid, never an unnamed box. A key
229
+ pressed on the grid's scroll area after a click into empty space scrolls, and
230
+ does nothing to a cell the reader cannot see.
231
+ - A filter or facet control reached by Tab is scrolled fully into view, also in
232
+ the narrow layout.
233
+ - In WebKit the filter row's selects are drawn by the grid, so they meet the
234
+ 24 px target and follow the theme; under forced colours they fall back to the
235
+ native control.
236
+ - **Not yet verified by a screen reader.** The passes follow the first release
237
+ ([issue #5](https://github.com/casoon/opengrid/issues/5)); see `docs/releasing.md`.
238
+
239
+ ### Known limitations
240
+
241
+ - No calculated fields beyond date parts.
242
+ - One column dimension per pivot; at most 256 generated columns and 2,000 rows.
243
+ - Paging and virtualization are mutually exclusive, and so are paging and
244
+ grouping.
245
+ - At most two levels of grouping; while grouped, rows can be neither selected
246
+ nor edited, because both are reported by position and a position would include
247
+ the group headers.
248
+ - `<opengrid-pivot>` requires a server: the browser engine has no pivot export,
249
+ so the element cannot run client-side.
250
+ - No CDN build, no documentation site beyond the project page. Adapters exist for
251
+ React, Vue and Svelte; Angular uses a directive over `connect`, run in an
252
+ Angular 22 example; the rest use `connect` directly
253
+ ([docs/guides/frameworks.md](docs/guides/frameworks.md)). Hydration is tested
254
+ in all three adapters; Vite's development server only checked by hand; not
255
+ tested: React 18 rendering on the server, SvelteKit, Nuxt, Next.js and Astro
256
+ as real applications. A Vite production build needs `loadOpengrid({ moduleUrl })`.
package/LICENSE-APACHE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2026 Jörn Seidel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # opengrid
2
+
3
+ Accessible data grid, table and pivot as Web Components — driven by one query engine that
4
+ runs in the browser (WebAssembly), on a server (PostgreSQL), or split between the two, with
5
+ the same results everywhere.
6
+
7
+ - **`<opengrid-grid>`** — sorting, filtering, search, facets, grouping with totals,
8
+ selection, editing, virtualized or paged; fully operable from the keyboard.
9
+ - **`<opengrid-table>`** — a plain semantic `<table>` for displaying data.
10
+ - **`<opengrid-pivot>`** — a pivot with subtotals and a grand total.
11
+ - **Export** — what the reader sees, every match of it, as CSV or JSON.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npm install @casoon/opengrid
17
+ ```
18
+
19
+ The package holds the elements and the query engine. With a bundler, import from
20
+ `@casoon/opengrid`; without one, see
21
+ [Installation](https://github.com/casoon/opengrid/blob/main/docs/getting-started/installation.mdx).
22
+
23
+ ## Data in the browser
24
+
25
+ The engine reads a CSV against a schema — it never guesses types.
26
+
27
+ ```html
28
+ <opengrid-grid label="Orders" datasource="orders" columns="id,customer,amount"></opengrid-grid>
29
+
30
+ <script type="module">
31
+ import { connect, createLocalProvider } from "@casoon/opengrid";
32
+ import init, { Engine } from "@casoon/opengrid/engine/opengrid_wasm.js";
33
+
34
+ await init();
35
+ const engine = new Engine();
36
+ const csv = await (await fetch("/orders.csv")).arrayBuffer();
37
+ const schema = await (await fetch("/orders.schema.json")).text();
38
+ engine.load_csv("orders", new Uint8Array(csv), schema);
39
+
40
+ connect(document.querySelector("opengrid-grid"), {
41
+ provider: createLocalProvider(engine),
42
+ });
43
+ </script>
44
+ ```
45
+
46
+ ```json
47
+ {
48
+ "fields": [
49
+ { "name": "id", "type": "int64", "nullable": false },
50
+ { "name": "customer", "type": "utf8", "nullable": true },
51
+ { "name": "amount", "type": { "decimal": { "precision": 12, "scale": 2 } }, "nullable": true }
52
+ ]
53
+ }
54
+ ```
55
+
56
+ `createWorkerProvider()` runs the same engine in a worker instead.
57
+
58
+ ## Data from a server
59
+
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.
63
+
64
+ ```js
65
+ import { connect, createRestProvider } from "@casoon/opengrid";
66
+
67
+ connect(document.querySelector("opengrid-grid"), {
68
+ provider: createRestProvider({ url: "https://example.org", source: "orders", token: "…" }),
69
+ });
70
+ ```
71
+
72
+ See [Where queries run](https://github.com/casoon/opengrid/blob/main/docs/guides/where-queries-run.md).
73
+
74
+ ## React, Vue, Svelte
75
+
76
+ ```sh
77
+ npm install @casoon/opengrid @casoon/opengrid-react # or -vue, -svelte
78
+ ```
79
+
80
+ ```jsx
81
+ import { OpengridGrid } from "@casoon/opengrid-react";
82
+
83
+ <OpengridGrid label="Orders" datasource="orders" columns="id,customer,amount"
84
+ provider={provider} view={view} onViewChange={setView} />
85
+ ```
86
+
87
+ Angular, Astro and server-rendered pages use `connect` directly —
88
+ [Frameworks](https://github.com/casoon/opengrid/blob/main/docs/guides/frameworks.md).
89
+
90
+ ## Export
91
+
92
+ ```js
93
+ import { loadOpengrid, exportRows } from "@casoon/opengrid";
94
+
95
+ const { module } = await loadOpengrid();
96
+ const query = module.get_query(grid); // the reader's view, without a window
97
+ const blob = await exportRows(provider, query, { format: "csv" });
98
+ ```
99
+
100
+ CSV per RFC 4180 with a guard against formula injection, or JSON; a pivot exports as shown
101
+ with `get_pivot`. See [Export](https://github.com/casoon/opengrid/blob/main/docs/guides/export.md).
102
+
103
+ ## Documentation
104
+
105
+ - [The public API](https://github.com/casoon/opengrid/blob/main/docs/api.md) — elements,
106
+ attributes, events, the view, styling, texts, errors
107
+ - [Guides](https://github.com/casoon/opengrid/tree/main/docs/guides) and the
108
+ [project page](https://casoon.github.io/opengrid/)
109
+
110
+ ## Accessibility
111
+
112
+ Keyboard operation under the WAI-ARIA grid pattern, one polite live region for every state,
113
+ no dragging required, and axe-core in every state of the end-to-end suite (Chromium, Firefox,
114
+ WebKit). **Not yet verified with a screen reader** — that pass follows this release.
115
+
116
+ ## Status
117
+
118
+ Pre-1.0: a minor version may change the API, a patch version does not
119
+ ([CHANGELOG](https://github.com/casoon/opengrid/blob/main/CHANGELOG.md)).
120
+
121
+ ## Licence
122
+
123
+ MIT OR Apache-2.0.