@casoon/opengrid 0.10.0 → 0.12.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,83 @@ Two things belong in every release entry and are easy to leave out:
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [0.12.0] — 2026-10-09
22
+
23
+ **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
24
+ **Browsers:** Chromium (the whole e2e suite: 1138 passed; a GC test of the Angular example passed on
25
+ its retry). Firefox and WebKit on Linux (`gh workflow run ci.yml -f browsers=true`): 561 passed in
26
+ each; Firefox still has the two failures of [#157](https://github.com/casoon/opengrid/issues/157),
27
+ WebKit failed the new CSP test on a reading of the tbody's position WebKit computes as `static`
28
+ for any grid — the test, not the grid ([#162](https://github.com/casoon/opengrid/pull/162)).
29
+
30
+ Typing into a cell edits it, as in a spreadsheet, and `<opengrid-grid>` draws under a
31
+ `style-src` without `'unsafe-inline'`.
32
+
33
+ **What breaks:** nothing in the API. The grid's shadow root has no `<style>` element any more;
34
+ its look needs `adoptedStyleSheets` (see *Fixed*).
35
+
36
+ **Module sizes** (brotli, `just measure-modules`): the elements 243.5 → 244.1 KiB, inside their
37
+ bound; the engine is unchanged.
38
+
39
+ ### Added
40
+
41
+ - **Typing opens the editor.** On a data cell a typed character opens the editor with that
42
+ character in it — replacing the value in a text or number field, as in a spreadsheet — and in a
43
+ select it picks the one choice that is the character or starts with it; `Enter` still commits,
44
+ `Escape` still discards. `F2` opens the editor as `Enter` does. Both are the WAI-ARIA grid
45
+ pattern's; a marks sheet is filled by focusing a cell and typing the mark. `Space` keeps
46
+ selecting the row, a `Ctrl`/`Cmd` shortcut is not typing, and read-only columns, a grouped grid
47
+ and a tree open no editor this way either.
48
+
49
+ ### Fixed
50
+
51
+ - **`<opengrid-grid>` under a `style-src` without `'unsafe-inline'`.** A page whose policy allows
52
+ styles only from files and hashes — no `'unsafe-inline'`, no nonce — refused the `<style>`
53
+ element in the grid's shadow root and every `style` attribute it set: the grid drew without its
54
+ look, its column widths and its row positions, and the console filled with refusals. The look
55
+ is now a constructed stylesheet adopted into the shadow root (as table and pivot already did),
56
+ the column widths a second adopted sheet of each grid's own, and every inline style is written
57
+ through the CSSOM (`element.style`), which `style-src` does not govern. The shadow root has no
58
+ `<style>` element any more. Needs `adoptedStyleSheets` — every browser of the baseline (Chrome
59
+ and Edge 73+, Firefox 101+, Safari 16.4+); there is no fallback. Tested under
60
+ `script-src 'self' 'wasm-unsafe-eval'; style-src 'self'` with editing, choices, read-only
61
+ columns, widths and scrolling.
62
+
63
+ ## [0.11.0] — 2026-10-08
64
+
65
+ **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
66
+ **Browsers:** Chromium (the whole e2e suite: 1127 passed), WebKit (`just e2e-browsers` on macOS:
67
+ 556 passed, 10 skipped by design). Firefox, on Linux (`gh workflow run ci.yml -f browsers=true`,
68
+ since Playwright's Firefox does not start on the release machine): **two failures** — an unnamed
69
+ tab stop in the narrow toolbar and a scroll area 1 px short after unfolding a cell
70
+ ([#157](https://github.com/casoon/opengrid/issues/157)); everything else passed.
71
+
72
+ The grid as an editing surface a page saves cell by cell: the edit names its record, the page says
73
+ what became of it, and fills columns of its own. Asked for by a grade entry grid.
74
+
75
+ **What breaks:** nothing. Every change is an addition.
76
+
77
+ **Module sizes** (brotli, `just measure-modules`): the elements 239.8 → 243.5 KiB, past their bound,
78
+ which this release raises (`scripts/module-budget.txt`); the engine is unchanged to the byte.
79
+
80
+ ### Added
81
+
82
+ - **Saving edits from the page** ([#153](https://github.com/casoon/opengrid/issues/153)).
83
+ - `row-key="<field>"` names the record: `opengrid-cell-change` carries `key`, the edited row's
84
+ value of that field, next to `row` — which holds only until something sorts or reloads.
85
+ - `set_cell_state(host, key, column, state, message?)` with `saving`, `saved` or `error`.
86
+ `saved` takes the unsaved mark off without a reload; `error` keeps the value and the mark,
87
+ sets `aria-invalid` and says `message` in the grid's one polite live region. The focus never
88
+ moves.
89
+ - Each state is a part of its own next to `cell` — `cell-saving`, `cell-saved`, `cell-error` —
90
+ so a page styles it with `::part(cell-error)`.
91
+ - `set_values(host, [{ key, column, value }])` shows values the page computes. Not edits: no
92
+ unsaved mark, no event.
93
+ - `readonly: true` in `set_columns`: the column never opens an editor and its cells say
94
+ `aria-readonly`. `<opengrid-table>` refuses the option.
95
+ - States and values name records, so they outlive sorting, filtering and reloading; another
96
+ `row-key` or `datasource` forgets them. A guide: *Saving edits from the page*.
97
+
21
98
  ## [0.10.0] — 2026-10-02
22
99
 
23
100
  **Screen-reader pairings tested: none yet** ([issue #5](https://github.com/casoon/opengrid/issues/5)).
Binary file
package/loader.d.ts CHANGED
@@ -75,6 +75,27 @@ export interface OpengridModule {
75
75
  * Values are in the canonical wire notation: a float `2` reads `2.0`.
76
76
  */
77
77
  get_pivot(host: HTMLElement, options?: CsvOptions): string | null;
78
+ /**
79
+ * What became of an edit the page saves (issue #153). `key` is the record's
80
+ * `row-key` value as `opengrid-cell-change` gave it. `saved` clears the
81
+ * unsaved mark; `error` keeps the value and says `message` in the live
82
+ * region. The cell's part is then `cell cell-<state>` (`::part(cell-error)`);
83
+ * the focus never moves.
84
+ * Requires `row-key`.
85
+ */
86
+ set_cell_state(
87
+ host: HTMLElement,
88
+ key: WireValue,
89
+ column: string,
90
+ state: CellState,
91
+ message?: string,
92
+ ): void;
93
+ /**
94
+ * Values the page computes, shown in place of the source's — not edits: no
95
+ * unsaved mark, no event. The column is `readonly` in `set_columns`.
96
+ * Requires `row-key`.
97
+ */
98
+ set_values(host: HTMLElement, values: CellValue[]): void;
78
99
  /** Defines the three elements. `loadOpengrid()` calls it. */
79
100
  register(): void;
80
101
  }
@@ -471,6 +492,21 @@ export interface ColumnConfig {
471
492
  muted?: boolean;
472
493
  aggregate?: Aggregate;
473
494
  facet?: FacetKind;
495
+ /**
496
+ * The page fills this column (`set_values`): it never opens an editor and
497
+ * its cells are announced as read-only. The grid only.
498
+ */
499
+ readonly?: boolean;
500
+ }
501
+
502
+ /** What `set_cell_state` says became of an edit. */
503
+ export type CellState = "saving" | "saved" | "error";
504
+
505
+ /** One value for `set_values`: the record by its `row-key`, the column, the value. */
506
+ export interface CellValue {
507
+ key: WireValue;
508
+ column: string;
509
+ value: WireValue;
474
510
  }
475
511
 
476
512
  export type Columns = Record<string, ColumnConfig>;
@@ -782,6 +818,11 @@ export interface SelectionChangeDetail {
782
818
  /** `opengrid-cell-change`: everything a page needs to persist an edit. */
783
819
  export interface CellChangeDetail {
784
820
  row: number;
821
+ /**
822
+ * With `row-key` only: the edited row's value of that field — `null` when
823
+ * the result does not carry it. The record, where `row` is a position.
824
+ */
825
+ key?: WireValue;
785
826
  column: string;
786
827
  value: string;
787
828
  previous: string;
@@ -839,6 +880,8 @@ export interface OpengridGridAttributes {
839
880
  tree?: string;
840
881
  /** The field the parent key refers to; `id` when absent. */
841
882
  "tree-key"?: string;
883
+ /** The field that names a record: `key` in `opengrid-cell-change`. */
884
+ "row-key"?: string;
842
885
  search?: string;
843
886
  facets?: string;
844
887
  toolbar?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casoon/opengrid",
3
- "version": "0.10.0",
3
+ "version": "0.12.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": [
@@ -80,6 +80,18 @@ export function get_view(host: HTMLElement): any;
80
80
  */
81
81
  export function register(): void;
82
82
 
83
+ /**
84
+ * Says what became of an edit the page saves (issue #153).
85
+ *
86
+ * `key` is the record's `row-key` value, as `opengrid-cell-change` gave it;
87
+ * `state` is `saving`, `saved` or `error`. `saved` takes the unsaved mark
88
+ * off; `error` keeps the value and the mark and says `message` in the live
89
+ * region. The state shows on the cell as `data-state`, stays with the record
90
+ * through sorting and reloading, and never moves the focus. Nothing happens
91
+ * without `row-key`, or for a key, column or state the grid does not know.
92
+ */
93
+ export function set_cell_state(host: HTMLElement, key: any, column: string, state: string, message?: string | null): void;
94
+
83
95
  /**
84
96
  * Sets the choices a column's editor offers (plan point 37).
85
97
  *
@@ -155,6 +167,15 @@ export function set_provider(host: HTMLElement, provider: any): void;
155
167
 
156
168
  export function set_texts(host: HTMLElement, values: any): void;
157
169
 
170
+ /**
171
+ * Shows values the page computes (issue #153): `[{ key, column, value }]`.
172
+ *
173
+ * Not edits: no unsaved mark, no `opengrid-cell-change`. They stand over the
174
+ * source's value for that record until the page sets another. A column the
175
+ * page fills is `readonly` in `set_columns`. Requires `row-key`.
176
+ */
177
+ export function set_values(host: HTMLElement, values: any): void;
178
+
158
179
  /**
159
180
  * Applies a whole view at once (plan point 59).
160
181
  *
@@ -186,11 +207,13 @@ export interface InitOutput {
186
207
  readonly get_query: (a: any) => any;
187
208
  readonly get_view: (a: any) => any;
188
209
  readonly register: () => [number, number];
210
+ readonly set_cell_state: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => void;
189
211
  readonly set_choices: (a: any, b: any) => void;
190
212
  readonly set_columns: (a: any, b: any) => void;
191
213
  readonly set_formats: (a: any, b: any) => void;
192
214
  readonly set_provider: (a: any, b: any) => void;
193
215
  readonly set_texts: (a: any, b: any) => void;
216
+ readonly set_values: (a: any, b: any) => void;
194
217
  readonly set_view: (a: any, b: any, c: any) => void;
195
218
  readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___web_sys_390d3ac0468b6516___features__gen_HtmlElement__HtmlElement__alloc_cb2b8d99256f33df___string__String__core_608f92abc48d28da___option__Option_alloc_cb2b8d99256f33df___string__String___core_608f92abc48d28da___option__Option_alloc_cb2b8d99256f33df___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
196
219
  readonly wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___wasm_bindgen_6af9200f0870d488___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6af9200f0870d488___JsError___true_: (a: number, b: number, c: any) => [number, number];
@@ -1,9 +1,9 @@
1
1
  /* @ts-self-types="./opengrid_web_components.d.ts" */
2
- import { __opengrid_intl_formatter } from './snippets/opengrid-web-components-cfa74f7f54f9c66d/inline0.js';
3
- import { __opengrid_define_element } from './snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline1.js';
4
- import * as import1 from "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js"
5
- import * as import2 from "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js"
6
- import * as import3 from "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js"
2
+ import { __opengrid_intl_formatter } from './snippets/opengrid-web-components-47f0023c89578a83/inline0.js';
3
+ import { __opengrid_define_element } from './snippets/opengrid-web-core-2a174e372aad3f8d/inline1.js';
4
+ import * as import1 from "./snippets/opengrid-web-core-2a174e372aad3f8d/inline0.js"
5
+ import * as import2 from "./snippets/opengrid-web-core-2a174e372aad3f8d/inline0.js"
6
+ import * as import3 from "./snippets/opengrid-web-core-2a174e372aad3f8d/inline0.js"
7
7
 
8
8
 
9
9
  /**
@@ -150,6 +150,31 @@ export function register() {
150
150
  }
151
151
  }
152
152
 
153
+ /**
154
+ * Says what became of an edit the page saves (issue #153).
155
+ *
156
+ * `key` is the record's `row-key` value, as `opengrid-cell-change` gave it;
157
+ * `state` is `saving`, `saved` or `error`. `saved` takes the unsaved mark
158
+ * off; `error` keeps the value and the mark and says `message` in the live
159
+ * region. The state shows on the cell as `data-state`, stays with the record
160
+ * through sorting and reloading, and never moves the focus. Nothing happens
161
+ * without `row-key`, or for a key, column or state the grid does not know.
162
+ * @param {HTMLElement} host
163
+ * @param {any} key
164
+ * @param {string} column
165
+ * @param {string} state
166
+ * @param {string | null} [message]
167
+ */
168
+ export function set_cell_state(host, key, column, state, message) {
169
+ const ptr0 = passStringToWasm0(column, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
170
+ const len0 = WASM_VECTOR_LEN;
171
+ const ptr1 = passStringToWasm0(state, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
172
+ const len1 = WASM_VECTOR_LEN;
173
+ var ptr2 = isLikeNone(message) ? 0 : passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
174
+ var len2 = WASM_VECTOR_LEN;
175
+ wasm.set_cell_state(host, key, ptr0, len0, ptr1, len1, ptr2, len2);
176
+ }
177
+
153
178
  /**
154
179
  * Sets the choices a column's editor offers (plan point 37).
155
180
  *
@@ -247,6 +272,19 @@ export function set_texts(host, values) {
247
272
  wasm.set_texts(host, values);
248
273
  }
249
274
 
275
+ /**
276
+ * Shows values the page computes (issue #153): `[{ key, column, value }]`.
277
+ *
278
+ * Not edits: no unsaved mark, no `opengrid-cell-change`. They stand over the
279
+ * source's value for that record until the page sets another. A column the
280
+ * page fills is `readonly` in `set_columns`. Requires `row-key`.
281
+ * @param {HTMLElement} host
282
+ * @param {any} values
283
+ */
284
+ export function set_values(host, values) {
285
+ wasm.set_values(host, values);
286
+ }
287
+
250
288
  /**
251
289
  * Applies a whole view at once (plan point 59).
252
290
  *
@@ -279,10 +317,10 @@ function __wbg_get_imports() {
279
317
  const ret = Error(getStringFromWasm0(arg0, arg1));
280
318
  return ret;
281
319
  },
282
- __wbg___opengrid_define_element_7231be6371bb9dcb: function(arg0, arg1, arg2, arg3, arg4, arg5) {
320
+ __wbg___opengrid_define_element_8c87a0a2dccaa52c: function(arg0, arg1, arg2, arg3, arg4, arg5) {
283
321
  __opengrid_define_element(getStringFromWasm0(arg0, arg1), arg2, arg3, arg4, arg5);
284
322
  },
285
- __wbg___opengrid_intl_formatter_9b6d5f011d93dec7: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
323
+ __wbg___opengrid_intl_formatter_988fce30cea03d00: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
286
324
  const ret = __opengrid_intl_formatter(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), arg4);
287
325
  return ret;
288
326
  }, arguments); },
@@ -345,6 +383,10 @@ function __wbg_get_imports() {
345
383
  __wbg_addEventListener_d85450ee1320c989: function() { return handleError(function (arg0, arg1, arg2, arg3) {
346
384
  arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3);
347
385
  }, arguments); },
386
+ __wbg_adoptedStyleSheets_29ecb7d2ba97edad: function(arg0) {
387
+ const ret = arg0.adoptedStyleSheets;
388
+ return ret;
389
+ },
348
390
  __wbg_altKey_50f830d1793a2eea: function(arg0) {
349
391
  const ret = arg0.altKey;
350
392
  return ret;
@@ -514,6 +556,16 @@ function __wbg_get_imports() {
514
556
  const ret = result;
515
557
  return ret;
516
558
  },
559
+ __wbg_instanceof_CssStyleSheet_69eb2b4dfaec58a9: function(arg0) {
560
+ let result;
561
+ try {
562
+ result = arg0 instanceof CSSStyleSheet;
563
+ } catch (_) {
564
+ result = false;
565
+ }
566
+ const ret = result;
567
+ return ret;
568
+ },
517
569
  __wbg_instanceof_Element_beebfaab75d12d9d: function(arg0) {
518
570
  let result;
519
571
  try {
@@ -618,6 +670,10 @@ function __wbg_get_imports() {
618
670
  const ret = Array.isArray(arg0);
619
671
  return ret;
620
672
  },
673
+ __wbg_isComposing_919a0fdf6ac030c9: function(arg0) {
674
+ const ret = arg0.isComposing;
675
+ return ret;
676
+ },
621
677
  __wbg_isConnected_c24b5a7bb035eae0: function(arg0) {
622
678
  const ret = arg0.isConnected;
623
679
  return ret;
@@ -704,6 +760,10 @@ function __wbg_get_imports() {
704
760
  __wbg_observe_f27242eadc2ebd47: function(arg0, arg1) {
705
761
  arg0.observe(arg1);
706
762
  },
763
+ __wbg_of_5f1b88183ddb5d94: function(arg0, arg1) {
764
+ const ret = Array.of(arg0, arg1);
765
+ return ret;
766
+ },
707
767
  __wbg_of_85f52f8b6491a7ca: function(arg0) {
708
768
  const ret = Array.of(arg0);
709
769
  return ret;
@@ -825,6 +885,9 @@ function __wbg_get_imports() {
825
885
  __wbg_set_composed_4b360b2fea1c1905: function(arg0, arg1) {
826
886
  arg0.composed = arg1 !== 0;
827
887
  },
888
+ __wbg_set_cssText_1d203a1b8ff80e20: function(arg0, arg1, arg2) {
889
+ arg0.cssText = getStringFromWasm0(arg1, arg2);
890
+ },
828
891
  __wbg_set_detail_564ad103413aa5dc: function(arg0, arg1) {
829
892
  arg0.detail = arg1;
830
893
  },
@@ -955,7 +1018,7 @@ function __wbg_get_imports() {
955
1018
  return ret;
956
1019
  },
957
1020
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
958
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 209, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1021
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 210, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
959
1022
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___wasm_bindgen_6af9200f0870d488___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6af9200f0870d488___JsError___true_);
960
1023
  return ret;
961
1024
  },
@@ -985,7 +1048,7 @@ function __wbg_get_imports() {
985
1048
  return ret;
986
1049
  },
987
1050
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
988
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 195, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1051
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [U32], shim_idx: 196, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
989
1052
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___u32______true_);
990
1053
  return ret;
991
1054
  },
@@ -1017,9 +1080,9 @@ function __wbg_get_imports() {
1017
1080
  return {
1018
1081
  __proto__: null,
1019
1082
  "./opengrid_web_components_bg.js": import0,
1020
- "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js": import1,
1021
- "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js": import2,
1022
- "./snippets/opengrid-web-core-8e0e8a7cacb9d3df/inline0.js": import3,
1083
+ "./snippets/opengrid-web-core-2a174e372aad3f8d/inline0.js": import1,
1084
+ "./snippets/opengrid-web-core-2a174e372aad3f8d/inline0.js": import2,
1085
+ "./snippets/opengrid-web-core-2a174e372aad3f8d/inline0.js": import3,
1023
1086
  };
1024
1087
  }
1025
1088
 
Binary file
@@ -7,11 +7,13 @@ 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;
9
9
  export const register: () => [number, number];
10
+ export const set_cell_state: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => void;
10
11
  export const set_choices: (a: any, b: any) => void;
11
12
  export const set_columns: (a: any, b: any) => void;
12
13
  export const set_formats: (a: any, b: any) => void;
13
14
  export const set_provider: (a: any, b: any) => void;
14
15
  export const set_texts: (a: any, b: any) => void;
16
+ export const set_values: (a: any, b: any) => void;
15
17
  export const set_view: (a: any, b: any, c: any) => void;
16
18
  export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___web_sys_390d3ac0468b6516___features__gen_HtmlElement__HtmlElement__alloc_cb2b8d99256f33df___string__String__core_608f92abc48d28da___option__Option_alloc_cb2b8d99256f33df___string__String___core_608f92abc48d28da___option__Option_alloc_cb2b8d99256f33df___string__String_______true_: (a: number, b: number, c: any, d: number, e: number, f: number, g: number, h: number, i: number) => void;
17
19
  export const wasm_bindgen_6af9200f0870d488___convert__closures_____invoke___wasm_bindgen_6af9200f0870d488___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_6af9200f0870d488___JsError___true_: (a: number, b: number, c: any) => [number, number];