@design.estate/dees-catalog 21.45.0 → 21.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist_bundle/bundle.js +299 -84
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/bundle.js.third-party-notices.json +1 -1
  4. package/dist_bundle/bundle.js.third-party-notices.txt +1 -1
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-L4Z3DS4M.js → chunk-FCUX4QGD.js} +3 -3
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-Y2OCV2BV.js → chunk-LWT7IIPZ.js} +2 -2
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-L3H6FV4W.js → chunk-VJVZHESI.js} +37 -14
  8. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-VJVZHESI.js.map +1 -0
  9. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-SOLSWJ7V.js → de-7PGZC4IF.js} +2 -2
  10. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-VDA5LOS7.js → dees-modal-VOIWY235.js} +3 -3
  11. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-SD4GXHX5.js → dees-workspace-terminal-EJRHSZ5F.js} +4 -4
  12. package/dist_bundle/third-party-notices.md +2 -2
  13. package/dist_ts_web/00_commitinfo_data.js +1 -1
  14. package/dist_ts_web/elements/00group-appui/dees-appui/dees-appui.d.ts +37 -3
  15. package/dist_ts_web/elements/00group-appui/dees-appui/dees-appui.js +79 -19
  16. package/dist_ts_web/elements/00group-dataview/dees-table/dees-table.d.ts +24 -7
  17. package/dist_ts_web/elements/00group-dataview/dees-table/dees-table.js +53 -18
  18. package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.d.ts +11 -1
  19. package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.demo.js +17 -1
  20. package/dist_ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.js +19 -2
  21. package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.d.ts +33 -2
  22. package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.js +92 -13
  23. package/dist_ts_web/elements/00group-layout/dees-stepper/dees-stepper.js +58 -15
  24. package/dist_ts_web/elements/00group-layout/dees-stepper/styles.js +31 -2
  25. package/dist_ts_web/elements/interfaces/appconfig.d.ts +9 -2
  26. package/package.json +2 -2
  27. package/readme.md +35 -6
  28. package/third-party-notices.md +2 -2
  29. package/ts_web/00_commitinfo_data.ts +1 -1
  30. package/ts_web/elements/00group-appui/dees-appui/dees-appui.ts +95 -21
  31. package/ts_web/elements/00group-appui/dees-appui/readme.md +16 -4
  32. package/ts_web/elements/00group-dataview/dees-table/dees-table.ts +54 -17
  33. package/ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.demo.ts +20 -0
  34. package/ts_web/elements/00group-input/dees-input-radiogroup/dees-input-radiogroup.ts +18 -1
  35. package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.demo.ts +79 -4
  36. package/ts_web/elements/00group-layout/dees-stepper/dees-stepper.ts +69 -13
  37. package/ts_web/elements/00group-layout/dees-stepper/styles.ts +32 -1
  38. package/ts_web/elements/interfaces/appconfig.ts +9 -2
  39. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-L3H6FV4W.js.map +0 -1
  40. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-L4Z3DS4M.js.map → chunk-FCUX4QGD.js.map} +0 -0
  41. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-Y2OCV2BV.js.map → chunk-LWT7IIPZ.js.map} +0 -0
  42. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-SOLSWJ7V.js.map → de-7PGZC4IF.js.map} +0 -0
  43. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-VDA5LOS7.js.map → dees-modal-VOIWY235.js.map} +0 -0
  44. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-SD4GXHX5.js.map → dees-workspace-terminal-EJRHSZ5F.js.map} +0 -0
@@ -115,7 +115,7 @@ wording reproduced once and every copyright notice it covers listed with it.
115
115
  - @push.rocks/smartcrypto 3.1.0 — MIT
116
116
  - @push.rocks/smartenv 6.1.0 — MIT
117
117
  - @push.rocks/smartguard 3.1.2 — MIT
118
- - @push.rocks/smarti18n 1.4.0 — MIT
118
+ - @push.rocks/smarti18n 1.5.0 — MIT
119
119
  - @push.rocks/smartjson 6.0.2 — MIT
120
120
  - @push.rocks/smartmarkdown 3.5.0 — MIT
121
121
  - @push.rocks/smartmatch 2.0.0 — MIT
@@ -761,7 +761,7 @@ THIS SOFTWARE.
761
761
 
762
762
  ### MIT — 42 packages
763
763
 
764
- Applies to: @api.global/typedrequest 9.0.2, @api.global/typedrequest-interfaces 3.0.19, @api.global/typedrequest-interfaces 7.1.0, @design.estate/dees-comms 2.0.0, @design.estate/dees-domtools 5.0.1, @design.estate/dees-element 4.0.2, @push.rocks/smartbuffer 3.0.6, @push.rocks/smartcrypto 3.1.0, @push.rocks/smartguard 3.1.2, @push.rocks/smarti18n 1.4.0, @push.rocks/smartmarkdown 3.5.0, @push.rocks/smartmatch 2.0.0, @push.rocks/smartpromise 4.3.0, @push.rocks/smartrequest 5.6.0, @push.rocks/smartrouter 1.3.3, @push.rocks/smartstate 2.3.4, @push.rocks/smartunique 3.0.10, @push.rocks/smarturl 3.1.0, @push.rocks/smartyaml 3.0.5, @push.rocks/websetup 3.1.1, @push.rocks/webstore 2.2.0, @tempfix/webcontainer__api 1.6.1, @xterm/addon-fit 0.11.0, @xterm/addon-search 0.16.0, @xterm/addon-serialize 0.14.0, @xterm/addon-web-links 0.12.0, @xterm/xterm 6.0.0, fancy-canvas 2.1.0, linkifyjs 4.3.2, orderedmap 2.1.1, prosemirror-commands 1.7.1, prosemirror-dropcursor 1.8.2, prosemirror-gapcursor 1.4.0, prosemirror-history 1.5.0, prosemirror-keymap 1.2.3, prosemirror-model 1.25.4, prosemirror-schema-list 1.5.1, prosemirror-state 1.4.4, prosemirror-transform 1.11.0, prosemirror-view 1.41.6, rope-sequence 1.3.4, w3c-keyname 2.2.8.
764
+ Applies to: @api.global/typedrequest 9.0.2, @api.global/typedrequest-interfaces 3.0.19, @api.global/typedrequest-interfaces 7.1.0, @design.estate/dees-comms 2.0.0, @design.estate/dees-domtools 5.0.1, @design.estate/dees-element 4.0.2, @push.rocks/smartbuffer 3.0.6, @push.rocks/smartcrypto 3.1.0, @push.rocks/smartguard 3.1.2, @push.rocks/smarti18n 1.5.0, @push.rocks/smartmarkdown 3.5.0, @push.rocks/smartmatch 2.0.0, @push.rocks/smartpromise 4.3.0, @push.rocks/smartrequest 5.6.0, @push.rocks/smartrouter 1.3.3, @push.rocks/smartstate 2.3.4, @push.rocks/smartunique 3.0.10, @push.rocks/smarturl 3.1.0, @push.rocks/smartyaml 3.0.5, @push.rocks/websetup 3.1.1, @push.rocks/webstore 2.2.0, @tempfix/webcontainer__api 1.6.1, @xterm/addon-fit 0.11.0, @xterm/addon-search 0.16.0, @xterm/addon-serialize 0.14.0, @xterm/addon-web-links 0.12.0, @xterm/xterm 6.0.0, fancy-canvas 2.1.0, linkifyjs 4.3.2, orderedmap 2.1.1, prosemirror-commands 1.7.1, prosemirror-dropcursor 1.8.2, prosemirror-gapcursor 1.4.0, prosemirror-history 1.5.0, prosemirror-keymap 1.2.3, prosemirror-model 1.25.4, prosemirror-schema-list 1.5.1, prosemirror-state 1.4.4, prosemirror-transform 1.11.0, prosemirror-view 1.41.6, rope-sequence 1.3.4, w3c-keyname 2.2.8.
765
765
 
766
766
  Copyright notices:
767
767
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '21.45.0',
6
+ version: '21.46.1',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -76,10 +76,23 @@ type TNavigationIntent = 'reader' | 'system';
76
76
 
77
77
  /**
78
78
  * How a navigation meets the browser's history: `push` adds an entry, `replace`
79
- * rewrites the current one, and `traverse` follows a move the browser already
80
- * made itself — Back, Forward, an edited address.
79
+ * rewrites the current one, `return` goes back to the entry before the current
80
+ * one where that shows the screen and replaces the current one elsewhere, and
81
+ * `traverse` follows a move the browser already made itself — Back, Forward,
82
+ * an edited address.
81
83
  */
82
- type TNavigationMode = 'push' | 'replace' | 'traverse';
84
+ type TNavigationMode = 'push' | 'replace' | 'return' | 'traverse';
85
+
86
+ /**
87
+ * The shell's mark on a history entry it wrote: whose it is, where it stands,
88
+ * its number, and for an entry pushed, the number of the entry before it.
89
+ */
90
+ interface IHistoryMarker {
91
+ owner: string;
92
+ index: number;
93
+ entry: number;
94
+ previous?: number;
95
+ }
83
96
 
84
97
  /** A navigation whose screen failed to load, kept so the reader can try it again. */
85
98
  interface IFailedNavigation {
@@ -2494,7 +2507,9 @@ export class DeesAppui extends DeesElement {
2494
2507
  * Navigate to a registered view. The URL follows an accepted activation, and
2495
2508
  * `options.history` decides whether that leaves a step behind: `push` (the
2496
2509
  * default) adds a history entry, `replace` rewrites the current one, which is
2497
- * what a screen correcting its own route needs.
2510
+ * what a screen correcting its own route needs, and `return` goes back to the
2511
+ * screen a step was taken from, where the entry before the current one shows
2512
+ * it, and replaces the current entry elsewhere.
2498
2513
  */
2499
2514
  public navigateToView(
2500
2515
  viewId: string,
@@ -2502,9 +2517,10 @@ export class DeesAppui extends DeesElement {
2502
2517
  query: Record<string, string> = {},
2503
2518
  options?: interfaces.IViewNavigationOptions,
2504
2519
  ): Promise<boolean> {
2505
- const mode = options?.history === 'replace' ? 'replace' : 'push';
2520
+ const mode = options?.history === 'replace' || options?.history === 'return' ? options.history : 'push';
2506
2521
  // A replacing navigation is a screen correcting its own route: nobody asked
2507
- // to be taken anywhere, so the focus stays where the reader put it.
2522
+ // to be taken anywhere, so the focus stays where the reader put it. A return
2523
+ // takes the reader back, as Back does.
2508
2524
  return this.queueNavigation(viewId, { ...params }, { ...query }, mode, mode === 'replace' ? 'system' : 'reader');
2509
2525
  }
2510
2526
 
@@ -2514,6 +2530,10 @@ export class DeesAppui extends DeesElement {
2514
2530
  private latestNavigationRequest = 0;
2515
2531
  private historyOwner = '';
2516
2532
  private historyIndex = 0;
2533
+ /** Numbers the history entries this shell writes, so an entry it pushes can name the one it was pushed from. */
2534
+ private historyEntries = 0;
2535
+ /** The location each history entry this shell wrote shows, by the entry's number: what a return finds before it (`returnsBack`). */
2536
+ private historyEntryLocations = new Map<number, string>();
2517
2537
  /** The traversal back a refused browser change started, to `location`; the next change of any address ends it. */
2518
2538
  private restoringHistory?: { location: string; resolve: () => void };
2519
2539
 
@@ -2582,8 +2602,8 @@ export class DeesAppui extends DeesElement {
2582
2602
  this.markViewInMainMenu(viewId);
2583
2603
  if (mode !== 'push') {
2584
2604
  this.historyIndex = index ?? this.historyIndex;
2585
- if (mode === 'replace' || this.addressing.currentLocation() === traversalLocation)
2586
- window.history.replaceState(this.routeHistoryState(), '', this.addressing.entryLocation(location));
2605
+ if (mode === 'replace' || mode === 'return' || this.addressing.currentLocation() === traversalLocation)
2606
+ window.history.replaceState(this.routeHistoryState(location), '', this.addressing.entryLocation(location));
2587
2607
  }
2588
2608
  return true;
2589
2609
  }
@@ -2642,12 +2662,14 @@ export class DeesAppui extends DeesElement {
2642
2662
  }
2643
2663
  if (mode === 'push') {
2644
2664
  this.historyIndex++;
2645
- window.history.pushState(this.routeHistoryState(), '', location);
2665
+ window.history.pushState(this.routeHistoryState(location, true), '', location);
2666
+ } else if (mode === 'return' && this.returnsBack(location)) {
2667
+ await this.goBackTo(location);
2646
2668
  } else {
2647
2669
  if (index !== undefined) this.historyIndex = index;
2648
2670
  // Traversal already moved the browser. Do not overwrite a newer queued traversal.
2649
- if (mode === 'replace' || this.addressing.currentLocation() === traversalLocation) {
2650
- window.history.replaceState(this.routeHistoryState(), '', this.addressing.entryLocation(location));
2671
+ if (mode === 'replace' || mode === 'return' || this.addressing.currentLocation() === traversalLocation) {
2672
+ window.history.replaceState(this.routeHistoryState(location), '', this.addressing.entryLocation(location));
2651
2673
  }
2652
2674
  }
2653
2675
  return true;
@@ -2692,13 +2714,16 @@ export class DeesAppui extends DeesElement {
2692
2714
  * Ask again for the screen that failed to load, as the reader who pressed
2693
2715
  * Retry: the same view, parameters and query. History is written the way the
2694
2716
  * failed request would have left it: onto the current entry for a replace, or
2695
- * while the address still shows the attempted route; as a new entry otherwise,
2696
- * which is also where a rolled-back traversal left the reader.
2717
+ * while the address still shows the attempted route; back to the entry before
2718
+ * for a return that may still go there; as a new entry otherwise, which is
2719
+ * also where a rolled-back traversal left the reader.
2697
2720
  */
2698
2721
  private retryFailedNavigation(): void {
2699
2722
  const failed = this.failedNavigation;
2700
2723
  if (!failed) return;
2701
- const mode = failed.mode === 'replace' || this.addressing.currentLocation() === failed.location ? 'replace' : 'push';
2724
+ const mode = failed.mode === 'replace' || this.addressing.currentLocation() === failed.location
2725
+ ? 'replace'
2726
+ : failed.mode === 'return' ? 'return' : 'push';
2702
2727
  void this.queueNavigation(failed.view.id, failed.params, failed.query, mode, 'reader');
2703
2728
  }
2704
2729
 
@@ -2724,8 +2749,27 @@ export class DeesAppui extends DeesElement {
2724
2749
  });
2725
2750
  }
2726
2751
 
2727
- private routeHistoryState() {
2728
- return { ...window.history.state, deesAppui: { owner: this.historyOwner, index: this.historyIndex } };
2752
+ /**
2753
+ * The state of a history entry the shell writes, showing a location: where the
2754
+ * entry stands (`historyIndex`) and a number of its own. An entry pushed also
2755
+ * names the entry it was pushed from, the one right before it; one rewritten
2756
+ * keeps its number and the entry before it. The location an entry shows is
2757
+ * kept by its number, so a return can tell what the entry before shows
2758
+ * (`returnsBack`).
2759
+ */
2760
+ private routeHistoryState(locationArg?: string, pushedArg = false) {
2761
+ const current = this.historyMarker();
2762
+ const entry = pushedArg || !current ? ++this.historyEntries : current.entry;
2763
+ const previous = pushedArg ? current?.entry : current?.previous;
2764
+ if (locationArg !== undefined) this.historyEntryLocations.set(entry, locationArg);
2765
+ const marker: IHistoryMarker = { owner: this.historyOwner, index: this.historyIndex, entry, previous };
2766
+ return { ...window.history.state, deesAppui: marker };
2767
+ }
2768
+
2769
+ /** This shell's marker on the entry the browser stands on; absent on an entry this shell never wrote. */
2770
+ private historyMarker(): IHistoryMarker | undefined {
2771
+ const marker = window.history.state?.deesAppui as IHistoryMarker | undefined;
2772
+ return marker?.owner === this.historyOwner ? marker : undefined;
2729
2773
  }
2730
2774
 
2731
2775
  /**
@@ -2733,10 +2777,9 @@ export class DeesAppui extends DeesElement {
2733
2777
  * this shell's marker on the entry, absent on an entry this shell never wrote.
2734
2778
  */
2735
2779
  private browserPosition(): { location: string; index?: number } {
2736
- const marker = window.history.state?.deesAppui as { owner?: string; index?: number } | undefined;
2737
2780
  return {
2738
2781
  location: this.addressing.currentLocation(),
2739
- index: marker?.owner === this.historyOwner ? marker.index : undefined,
2782
+ index: this.historyMarker()?.index,
2740
2783
  };
2741
2784
  }
2742
2785
 
@@ -2745,6 +2788,37 @@ export class DeesAppui extends DeesElement {
2745
2788
  return current.location !== positionArg.location || current.index !== positionArg.index;
2746
2789
  }
2747
2790
 
2791
+ /**
2792
+ * Whether a return to a location goes back: the browser stands where this
2793
+ * shell is, on an entry it pushed, and the entry that one was pushed from —
2794
+ * the one right before it — still shows the location. An entry the shell did
2795
+ * not push from one of its own, such as the first one after a reload or a deep
2796
+ * link into a flow, has no entry before it the shell knows, so a return from it
2797
+ * replaces. So does one whose address shows the location already: going back
2798
+ * from it would change no address, and no change would say it landed.
2799
+ */
2800
+ private returnsBack(locationArg: string): boolean {
2801
+ const marker = this.historyMarker();
2802
+ return marker?.index === this.historyIndex
2803
+ && marker.previous !== undefined
2804
+ && this.historyEntryLocations.get(marker.previous) === locationArg
2805
+ && this.addressing.currentLocation() !== locationArg;
2806
+ }
2807
+
2808
+ /**
2809
+ * Goes back one entry, to the location of the screen already on show, and
2810
+ * waits until the browser stands there, so no request writes history from
2811
+ * the entry it leaves. The change the browser brings finds that location
2812
+ * and is not taken as a move of the reader's (`restoringHistory`).
2813
+ */
2814
+ private goBackTo(locationArg: string): Promise<void> {
2815
+ this.historyIndex--;
2816
+ return new Promise<void>((resolve) => {
2817
+ this.restoringHistory = { location: locationArg, resolve };
2818
+ window.history.back();
2819
+ });
2820
+ }
2821
+
2748
2822
  /**
2749
2823
  * Get the current view
2750
2824
  */
@@ -2959,6 +3033,7 @@ export class DeesAppui extends DeesElement {
2959
3033
  this.failedNavigation = undefined;
2960
3034
  this.historyOwner = `${Date.now()}-${Math.random()}`;
2961
3035
  this.historyIndex = 0;
3036
+ this.historyEntryLocations.clear();
2962
3037
  }
2963
3038
 
2964
3039
  /** Follow the address: mark the entry the shell stands on, listen for its changes, show the first screen. */
@@ -3064,8 +3139,7 @@ export class DeesAppui extends DeesElement {
3064
3139
  if (location !== addressing.currentLocation()) return;
3065
3140
  const route = addressing.routeOf(new URL(window.location.href));
3066
3141
  if (route === undefined) return;
3067
- const marker = window.history.state?.deesAppui;
3068
- const index = marker?.owner === this.historyOwner ? marker.index : this.historyIndex + 1;
3142
+ const index = this.historyMarker()?.index ?? this.historyIndex + 1;
3069
3143
  if (location === this.activeLocation) {
3070
3144
  this.historyIndex = index;
3071
3145
  return;
@@ -3086,7 +3160,7 @@ export class DeesAppui extends DeesElement {
3086
3160
  this.restoringHistory = { location: this.activeLocation, resolve };
3087
3161
  window.history.go(distance);
3088
3162
  });
3089
- } else window.history.replaceState(this.routeHistoryState(), '', this.addressing.entryLocation(this.activeLocation));
3163
+ } else window.history.replaceState(this.routeHistoryState(this.activeLocation), '', this.addressing.entryLocation(this.activeLocation));
3090
3164
  return false;
3091
3165
  });
3092
3166
  // A cancelled browser traversal must finish restoring before accepting another request.
@@ -1467,8 +1467,20 @@ A fourth argument decides what the navigation leaves behind:
1467
1467
  `navigateToView(viewId, params, query, { history: 'replace' })` rewrites the current
1468
1468
  history entry instead of adding one, which is what a screen correcting its own route — a
1469
1469
  redirect to a default section, a normalized identifier — needs so that Back still returns
1470
- to the screen the reader came from. `navigateToUrl(href, { history: 'replace' })` takes
1471
- the same option. Unset, both push, as they always have.
1470
+ to the screen the reader came from. `{ history: 'return' }` ends a step the reader took
1471
+ from the screen asked for — a flow opened from a list that goes back to it once it is done
1472
+ or closed: when the entry before the current one shows that screen, the shell goes back to
1473
+ it, so the flow's entry stays only as Forward and Back leaves the list rather than showing
1474
+ it once more; otherwise, as after a reload or a deep link into the flow, it replaces the
1475
+ current entry. `navigateToUrl(href, { history })` takes the same options. Unset, both
1476
+ push, as they always have.
1477
+
1478
+ ```typescript
1479
+ // The list opens the flow as a step of its own…
1480
+ await appui.navigateToView('invoice', { id: 'new' });
1481
+ // …and the flow, once done or closed, goes back to the list it was opened from.
1482
+ await appui.navigateToView('invoices', {}, {}, { history: 'return' });
1483
+ ```
1472
1484
 
1473
1485
  A guard that returns a string asks a question, and the shell asks it in a `dees-modal`
1474
1486
  with **Stay** and **Leave** and awaits the answer, rather than opening the browser's own
@@ -1517,8 +1529,8 @@ appui.configure({
1517
1529
  entry); a final slash names the same screen as the path without it. `createViewUrl()`
1518
1530
  builds these URLs, `navigateToUrl()` accepts them, and `getCurrentRoute()`, guards,
1519
1531
  `notFoundView`, `restoreLastView`, the location field and the tray work as in hash mode.
1520
- - **History.** A navigation pushes (or, with `{ history: 'replace' }`, replaces) the path
1521
- once its view is accepted; Back and Forward arrive as `popstate` and go through the same
1532
+ - **History.** A navigation pushes (or, with `{ history: 'replace' }`, replaces; with
1533
+ `{ history: 'return' }`, goes back to or replaces) the path once its view is accepted; Back and Forward arrive as `popstate` and go through the same
1522
1534
  guards, so a refused traversal is undone. A reload or a deep link opens the screen its
1523
1535
  path names.
1524
1536
  - **Links.** A plain click on an `<a href>` inside the shell — a view's shadow tree included
@@ -343,9 +343,13 @@ export class DeesTable<T> extends DeesElement {
343
343
  * the reader scrolled in between. Rows that share an id (a `rowKey` naming
344
344
  * a missing or repeated field, one object listed twice) are told apart by
345
345
  * position. A column widens when the
346
- * window changes, `data` is replaced or a cell edit is committed and the
347
- * rows on screen hold a wider value than it was sized for; a row changed in
348
- * place without either widens it when the window next changes. Browser
346
+ * window changes, `data` is replaced, a search, a filter or a sort shows
347
+ * other rows or a cell edit is committed and the rows on screen hold a
348
+ * wider value than it was sized for; a row changed in place without any of
349
+ * these widens it when the window next changes. A widening column takes the
350
+ * room the columns were stretched by to fill the container first: the table
351
+ * grows wider than its container only once the values on screen so far need
352
+ * more than it holds. Browser
349
353
  * scroll anchoring is off for the table's rows. Recommended for tables with
350
354
  * > a few hundred rows.
351
355
  */
@@ -667,8 +671,17 @@ export class DeesTable<T> extends DeesElement {
667
671
  * virtualized.
668
672
  */
669
673
  private __settledAnchor?: IVirtualAnchor & { scrollPosition: number };
670
- /** The window whose values the column widths were last checked against. */
671
- private __virtualColumnsCheckedFor?: { start: number; end: number };
674
+ /**
675
+ * The window, and the view it showed, whose values the column widths were
676
+ * last checked against: a search, a filter or a sort shows other rows in the
677
+ * same window.
678
+ */
679
+ private __virtualColumnsCheckedFor?: { start: number; end: number; view: T[] | undefined };
680
+ /**
681
+ * What each data column's values have needed, laid out at their natural
682
+ * width, in the windows shown since the widths were frozen.
683
+ */
684
+ private __columnContentWidths?: number[];
672
685
  private __virtualSettleFrame?: number;
673
686
  /** Currently rendered range [start, end). Triggers re-render when changed. */
674
687
  @state()
@@ -1730,9 +1743,13 @@ export class DeesTable<T> extends DeesElement {
1730
1743
  /**
1731
1744
  * The column widths are frozen from the first window. Under virtualization
1732
1745
  * later windows bring other values, so a column widens to the widest value
1733
- * rendered so far: the window is laid out at its natural widths once and
1734
- * every column keeps the larger of that and its frozen width. Returns
1735
- * whether a column widened.
1746
+ * rendered so far: the window is laid out at its natural widths once, and
1747
+ * each column needs the widest it has been in any window since the freeze.
1748
+ * A column that needs more than it has takes the room the columns were
1749
+ * stretched by to fill the table's container, shared out in proportion to
1750
+ * what each needs as the browser shares it; the table grows wider than its
1751
+ * container only once the columns need more than it holds. Returns whether
1752
+ * a column's width changed.
1736
1753
  */
1737
1754
  private __growColumnWidths(): boolean {
1738
1755
  const table = this.__realTableEl;
@@ -1746,15 +1763,25 @@ export class DeesTable<T> extends DeesElement {
1746
1763
  table.style.minWidth = '0';
1747
1764
  cells.forEach((cell) => { cell.style.width = ''; });
1748
1765
  const natural = cells.map((cell) => parseFloat(getComputedStyle(cell).width) || 0);
1749
- let grew = false;
1750
- cells.forEach((cell, index) => {
1751
- const width = Math.max(frozen[index], natural[index]);
1752
- if (width > frozen[index] + 0.5) grew = true;
1753
- cell.style.width = `${width}px`;
1754
- });
1766
+ const naturalTotal = natural.reduce((sum, width) => sum + width, 0);
1767
+ const naturalTableWidth = parseFloat(getComputedStyle(table).width) || 0;
1755
1768
  table.style.minWidth = '';
1769
+ // The data columns' room: the width the container stretches the table to,
1770
+ // less what the other columns and the table's edges take.
1771
+ const room = (parseFloat(getComputedStyle(table).width) || 0) - (naturalTableWidth - naturalTotal);
1772
+ const before = this.__columnContentWidths?.length === cells.length ? this.__columnContentWidths : [];
1773
+ const needed = natural.map((width, index) => Math.max(before[index] ?? 0, width));
1774
+ this.__columnContentWidths = needed;
1775
+ const neededTotal = needed.reduce((sum, width) => sum + width, 0);
1776
+ const widths = !needed.some((width, index) => width > frozen[index] + 0.5)
1777
+ ? frozen
1778
+ : neededTotal >= room
1779
+ ? needed
1780
+ // whole pixels of the room left, so the shares never add up past it
1781
+ : needed.map((width) => width + Math.floor((room - neededTotal) * width / neededTotal));
1782
+ cells.forEach((cell, index) => { cell.style.width = `${widths[index]}px`; });
1756
1783
  table.style.tableLayout = 'fixed';
1757
- return grew;
1784
+ return widths.some((width, index) => Math.abs(width - frozen[index]) > 0.5);
1758
1785
  }
1759
1786
 
1760
1787
  /** Settles the window on the next frame: at most one range change per frame. */
@@ -1770,15 +1797,16 @@ export class DeesTable<T> extends DeesElement {
1770
1797
  this.__restoreVirtualAnchor(settled);
1771
1798
  }
1772
1799
  const range = this.__virtualRange;
1800
+ const view = this.__rowKeysFor?.view;
1773
1801
  const checked = this.__virtualColumnsCheckedFor;
1774
- if (!checked || checked.start !== range.start || checked.end !== range.end) {
1802
+ if (!checked || checked.start !== range.start || checked.end !== range.end || checked.view !== view) {
1775
1803
  const anchor = this.__captureVirtualAnchor();
1776
1804
  if (this.__growColumnWidths()) {
1777
1805
  this.__measureRenderedRows();
1778
1806
  if (anchor) this.__restoreVirtualAnchor(anchor);
1779
1807
  }
1780
1808
  // Only a window the frozen widths have seen counts as checked.
1781
- if (this.__realTableEl?.style.tableLayout === 'fixed') this.__virtualColumnsCheckedFor = { ...range };
1809
+ if (this.__realTableEl?.style.tableLayout === 'fixed') this.__virtualColumnsCheckedFor = { ...range, view };
1782
1810
  }
1783
1811
  this.__measureRenderedRows();
1784
1812
  this.__computeVirtualRange();
@@ -2549,12 +2577,21 @@ export class DeesTable<T> extends DeesElement {
2549
2577
  // their content lays them out now, not as they were.
2550
2578
  table.style.tableLayout = '';
2551
2579
  dataCells.forEach((cell) => { cell.style.width = ''; });
2580
+ this.__columnContentWidths = undefined;
2552
2581
 
2553
2582
  // An empty table has no widths worth keeping: its header and empty state
2554
2583
  // stretch across the container. It stays in automatic layout until a data
2555
2584
  // row is shown, which `updated()` measures then.
2556
2585
  if (!table.querySelector('tbody tr[data-row-idx]')) return;
2557
2586
 
2587
+ // A virtualized table shows other rows later: what the first window's
2588
+ // values need is where `__growColumnWidths()` starts.
2589
+ if (this.virtualized) {
2590
+ table.style.minWidth = '0';
2591
+ this.__columnContentWidths = dataCells.map((cell) => parseFloat(getComputedStyle(cell).width) || 0);
2592
+ table.style.minWidth = '';
2593
+ }
2594
+
2558
2595
  // Freeze data widths in one read/write batch. They include the table's
2559
2596
  // stretch to its container: in fixed layout a column without a width
2560
2597
  // takes what the others leave, so natural widths alone would hand the
@@ -9,6 +9,15 @@ const imports = [
9
9
  { key: 'website', option: 'Read them from a website', description: 'Give the address of an imprint page; a language model reads it.' },
10
10
  ];
11
11
 
12
+ const facts = [
13
+ { key: 'business_start', option: 'Business start', description: 'The day the business opened; its first fiscal year begins on it.' },
14
+ { key: 'legal_form', option: 'Legal form', description: 'The legal form from a day on, with the register entry where there is one.' },
15
+ { key: 'bookkeeping_duty', option: 'Duty to keep books', description: 'From when the books are kept as a merchant\'s, and why.' },
16
+ { key: 'profit_method', option: 'Profit method', description: 'Whether the profit is found by comparing assets or by income over expenses.' },
17
+ { key: 'fiscal_year', option: 'Fiscal year', description: 'The day and month the fiscal years start on, from a year on.' },
18
+ { key: 'accrual_waiver', option: 'Accrual waiver', description: 'That accruals are waived from a year on, where the law allows it.' },
19
+ ];
20
+
12
21
  const sections = html`
13
22
  ${demoSection('Choices that explain themselves',
14
23
  'An option can carry a description: a line under its label that says what the choice does. The circle stays on the label\'s line, and assistive technology reads the description with the option.',
@@ -29,6 +38,17 @@ const sections = html`
29
38
  ${demoOutput('Chosen: text')}
30
39
  ${demoCode('<p>How do you want to add the contact?</p>\n<dees-input-radiogroup aria-label="How do you want to add the contact?" .options=${options}></dees-input-radiogroup>')}
31
40
  `)}
41
+ ${demoSection('In a scrolled container',
42
+ 'A step\'s body or a dialog that scrolls: scroll down and press the last option\'s label or description. The press focuses that option where it stands, so the container stays put and the click chooses the option pressed, whatever option holds the group\'s tab stop.',
43
+ html`
44
+ <div style="max-height: calc(var(--dees-control-height-lg) * 4); overflow: auto; overscroll-behavior: contain;">
45
+ <dees-input-radiogroup key="fact" aria-label="Which fact holds from a day on?" .options=${facts} required
46
+ @change=${(event: Event) => showDemoResult(event.currentTarget as Element,
47
+ `Chosen: ${(event.currentTarget as DeesInputRadiogroup).selectedOption}`)}></dees-input-radiogroup>
48
+ </div>
49
+ ${demoOutput('Nothing chosen yet.')}
50
+ ${demoCode('<div style="max-height: …; overflow: auto">\n <dees-input-radiogroup required .options=${facts}></dees-input-radiogroup>\n</div>')}
51
+ `)}
32
52
  `;
33
53
 
34
54
  export const demoFunc = () => focusedInputDemo('radiogroup', sections);
@@ -261,7 +261,8 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
261
261
  * option, or the first while nothing is chosen. The arrow keys move the
262
262
  * choice with the focus and wrap; Space chooses the focused option. Enter is
263
263
  * the form's, as in a native radio group: it moves to the next field or
264
- * submits from the last.
264
+ * submits from the last. A press on an option focuses that option's own
265
+ * circle, where it is (`focusPressedOption`).
265
266
  */
266
267
  public render(): TemplateResult {
267
268
  const keys = this.options.map((option) => this.getOptionKey(option));
@@ -283,6 +284,7 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
283
284
  return html`
284
285
  <div
285
286
  class="radio-option ${isSelected ? 'selected' : ''} ${optionDescription ? 'described' : ''}"
287
+ @mousedown="${(e: MouseEvent) => this.focusPressedOption(e, optionKey)}"
286
288
  @click="${() => this.selectOption(optionKey)}"
287
289
  @keydown="${(e: KeyboardEvent) => this.handleKeydown(e, optionKey)}"
288
290
  >
@@ -386,6 +388,21 @@ export class DeesInputRadiogroup extends DeesInputBase<string | object> {
386
388
  }
387
389
  }
388
390
 
391
+ /**
392
+ * A press on an option, on its circle, label or description, focuses that
393
+ * option's circle without scrolling. Left to the browser, a press on the
394
+ * label or the description would go to the group's tab stop (the input
395
+ * delegates focus, `dees-input-base`), and in a scrolled container that
396
+ * scrolls the tab stop into view: the pressed option moves away before the
397
+ * release, and the click lands beside it.
398
+ */
399
+ private focusPressedOption(event: MouseEvent, optionKey: string) {
400
+ if (this.disabled) return;
401
+ event.preventDefault();
402
+ const keys = this.options.map((option) => this.getOptionKey(option));
403
+ this.shadowRoot!.querySelectorAll<HTMLElement>('.radio-circle')[keys.indexOf(optionKey)]?.focus({ preventScroll: true });
404
+ }
405
+
389
406
  private handleKeydown(event: KeyboardEvent, optionKey: string) {
390
407
  if (this.disabled) return;
391
408
 
@@ -1,4 +1,5 @@
1
- import { DeesElement, customElement, property, state, html, css, cssManager } from '@design.estate/dees-element';
1
+ import { DeesElement, customElement, property, state, html, css, cssManager, provideI18n } from '@design.estate/dees-element';
2
+ import * as plugins from '../../00plugins.js';
2
3
  import { DeesStepper, type IStep, type TStepperCardAlign, type TStepperLayout } from './dees-stepper.js';
3
4
  import { DeesModal } from '../../00group-overlay/dees-modal/dees-modal.js';
4
5
  import { themeDefaultStyles } from '../../00theme.js';
@@ -262,17 +263,78 @@ const createChoiceSteps = (finish: (name: string) => void): { steps: IStep[]; be
262
263
  return { steps: [choose, ...flows.manual], beforeClose };
263
264
  };
264
265
 
266
+ /**
267
+ * The host's own words, for the refusal of the one-step flow: a catalog of the
268
+ * demo's, defined once when the demo is first shown rather than whenever the
269
+ * stepper is imported.
270
+ */
271
+ const defineRecordWords = () => {
272
+ const catalog = plugins.smarti18n.defineCatalog({
273
+ namespace: '@design.estate/dees-catalog/demo-stepper',
274
+ source: 'en',
275
+ messages: {
276
+ 'record.yearClosed': {
277
+ message: 'The books of {year} are closed, so no change can start in that year. Record it again to start it in the open year.',
278
+ description: 'Why a change cannot start on the day chosen; {year} is a closed year.',
279
+ },
280
+ },
281
+ });
282
+ catalog.addTranslation(catalog.translation('de', {
283
+ 'record.yearClosed': 'Die Bücher für {year} sind abgeschlossen, in diesem Jahr kann keine Änderung beginnen. Erfassen Sie sie erneut, um sie im offenen Jahr beginnen zu lassen.',
284
+ }));
285
+ return catalog;
286
+ };
287
+ let demoRecordWords: ReturnType<typeof defineRecordWords> | undefined;
288
+
289
+ /**
290
+ * A flow of one step, under `ribbon: 'auto'`: its card alone, with no ribbon
291
+ * and no "1 of 1". Record is refused once with an error in the host's words
292
+ * (`refuse`), which follows a change of language while it shows.
293
+ */
294
+ const createOneStep = (finish: (name: string) => void, refuse: () => Error): IStep[] => {
295
+ let attempts = 0;
296
+ return [{
297
+ title: 'Record a change.',
298
+ description: 'One fact, from the day it holds. Nothing is recorded until you choose Record.',
299
+ content: html`<dees-form>
300
+ <dees-input-radiogroup key="fact" aria-label="Which fact holds from a day on?" selectedOption="small_business" .options=${[
301
+ { key: 'small_business', option: 'Small business rule', description: 'No VAT is charged on sales from this day on.' },
302
+ { key: 'cash_basis', option: 'Cash basis', description: 'Income and expenses count on the day they are paid.' },
303
+ { key: 'business_start', option: 'Business start', description: 'The day the business began.' },
304
+ ]}></dees-input-radiogroup>
305
+ </dees-form>`,
306
+ menuOptions: [{ name: 'Record', action: async (stepper) => {
307
+ attempts++;
308
+ if (attempts === 1) throw refuse();
309
+ finish('The change');
310
+ await stepper?.destroy();
311
+ } }],
312
+ }];
313
+ };
314
+
315
+ const languages = [{ key: 'en', label: 'English' }, { key: 'de', label: 'Deutsch' }];
316
+
265
317
  @customElement('dees-demo-stepper')
266
318
  class DeesDemoStepper extends DeesElement {
267
319
  @property() accessor scenario = 'Standard setup';
268
320
  @property() accessor width = 'Wide';
269
321
  @property() accessor layout = 'Auto';
270
322
  @property() accessor card = 'Top';
323
+ @state() private accessor language = 'English';
271
324
  @state() private accessor closed = false;
272
325
  @state() private accessor result = '';
273
326
  private steps = createDemoSteps(false, name => { this.result = `${name} is ready.`; });
274
327
  private beforeClose?: () => Promise<boolean>;
275
328
  private overlayStepper?: DeesStepper;
329
+ /** The language the demo's steppers speak, apart from the page's: their own words follow it, the sample's stay English. */
330
+ private readonly i18n = plugins.smarti18n.createI18n({ locale: 'en', locales: ['en', 'de'] });
331
+ private readonly recordWords = demoRecordWords ??= defineRecordWords();
332
+
333
+ constructor() {
334
+ super();
335
+ // lives with this element: the stepper in its shadow root speaks the demo's language
336
+ provideI18n(this, this.i18n);
337
+ }
276
338
 
277
339
  public static styles = [themeDefaultStyles, cssManager.defaultStyles, css`
278
340
  :host { display: block; min-width: 0; }
@@ -294,7 +356,10 @@ class DeesDemoStepper extends DeesElement {
294
356
  this.closed = false;
295
357
  const choice = this.scenario === 'Choice first' ? createChoiceSteps(name => { this.result = `${name} was added.`; }) : null;
296
358
  this.beforeClose = choice?.beforeClose;
297
- this.steps = this.scenario === 'Lookup'
359
+ const words = this.i18n.bind(this.recordWords);
360
+ this.steps = this.scenario === 'One step'
361
+ ? createOneStep(name => { this.result = `${name} was recorded.`; }, () => new plugins.smarti18n.LocalizedError(words, 'record.yearClosed', { year: '2025' }))
362
+ : this.scenario === 'Lookup'
298
363
  ? createLookupSteps(name => { this.result = `${name} was added.`; })
299
364
  : choice
300
365
  ? choice.steps
@@ -308,6 +373,7 @@ class DeesDemoStepper extends DeesElement {
308
373
  if (this.overlayStepper?.isConnected) return;
309
374
  this.overlayStepper = await DeesStepper.createAndShow({
310
375
  cancelable,
376
+ i18n: this.i18n,
311
377
  layout: this.stepperLayout(),
312
378
  cardAlign: this.stepperAlign(),
313
379
  steps: createDemoSteps(this.scenario === 'Retry example', name => { this.result = `${name} is ready.`; }, this.scenario === 'Component step'),
@@ -322,10 +388,15 @@ class DeesDemoStepper extends DeesElement {
322
388
  return this.card === 'Centred' ? 'center' : 'start';
323
389
  }
324
390
 
391
+ private async setLanguage(label: string) {
392
+ const locale = languages.find((language) => language.label === label)?.key ?? 'en';
393
+ if (await this.i18n.setLocale(locale)) this.language = label;
394
+ }
395
+
325
396
  public render() {
326
397
  return html`<div class="toolbar">
327
398
  <dees-input-multitoggle size="sm" label="Demo scenario" labelPosition="none"
328
- .options=${['Standard setup', 'Retry example', 'Component step', 'Lookup', 'Choice first', 'Long flow']} .selectedOption=${this.scenario}
399
+ .options=${['Standard setup', 'Retry example', 'Component step', 'Lookup', 'Choice first', 'Long flow', 'One step']} .selectedOption=${this.scenario}
329
400
  @change=${(event: CustomEvent<{ value: string }>) => { this.scenario = event.detail.value; this.reset(); }}></dees-input-multitoggle>
330
401
  <dees-input-multitoggle size="sm" label="Demo width" labelPosition="none"
331
402
  .options=${['Wide', 'Narrow']} .selectedOption=${this.width}
@@ -336,6 +407,9 @@ class DeesDemoStepper extends DeesElement {
336
407
  <dees-input-multitoggle size="sm" label="Demo card" labelPosition="none"
337
408
  .options=${['Top', 'Centred']} .selectedOption=${this.card}
338
409
  @change=${(event: CustomEvent<{ value: string }>) => { this.card = event.detail.value; }}></dees-input-multitoggle>
410
+ <dees-input-multitoggle size="sm" label="Demo language" labelPosition="none"
411
+ .options=${languages.map((language) => language.label)} .selectedOption=${this.language}
412
+ @change=${(event: CustomEvent<{ value: string }>) => { void this.setLanguage(event.detail.value); }}></dees-input-multitoggle>
339
413
  <div class="actions"><dees-button type="secondary" text="Open overlay" @clicked=${() => this.openOverlay()}></dees-button>
340
414
  <dees-button type="ghost" text="Reset" @clicked=${this.reset}></dees-button></div>
341
415
  </div>
@@ -343,12 +417,13 @@ class DeesDemoStepper extends DeesElement {
343
417
  <dees-icon icon=${this.result ? 'lucide:CircleCheck' : 'lucide:Layers'} iconSize="32"></dees-icon>
344
418
  <h2>${this.result || 'Setup cancelled.'}</h2><p>This example uses local sample data.</p>
345
419
  <dees-button type="secondary" text="Start again" @clicked=${this.reset}></dees-button>
346
- </div>` : html`<dees-stepper .steps=${this.steps} .layout=${this.stepperLayout()} .cardAlign=${this.stepperAlign()} .stepCounter=${this.scenario === 'Lookup' ? 'position' : 'total'} .beforeClose=${this.beforeClose} @stepper-close=${() => { this.closed = true; }}></dees-stepper>`}</div>
420
+ </div>` : html`<dees-stepper .steps=${this.steps} .layout=${this.stepperLayout()} .cardAlign=${this.stepperAlign()} .stepCounter=${this.scenario === 'Lookup' ? 'position' : 'total'} .ribbon=${this.scenario === 'One step' ? 'auto' : 'always'} .beforeClose=${this.beforeClose} @stepper-close=${() => { this.closed = true; }}></dees-stepper>`}</div>
347
421
  <p class="caption">${this.scenario === 'Retry example' ? 'The first setup attempt pauses with an error. Try again to continue with your saved choices.'
348
422
  : this.scenario === 'Lookup' ? 'The counter says only where you are and the ribbon fades out after it; the lookup is not a step of its own and can be stopped while it runs. Discard asks first, and only Discard waits for the answer.'
349
423
  : this.scenario === 'Choice first' ? 'The first step asks how; the steps after it follow the answer. Entering the details takes one more step; reading them from a text or a website reads first and then shows what was read for checking. A text that names no email address or phone number stays on its step: the field says why and takes the focus. Cancelling closes at once until something was read, and asks first after that. Centred stands the card in the middle of the stage, as a flow with a tab of its own would.'
350
424
  : this.scenario === 'Component step' ? 'The first step is a component that draws its form in its own shadow root, as an app\'s step often is. Its required fields still hold Continue, a field that refuses its value says why and takes the focus, and Enter in the last field goes on.'
351
425
  : this.scenario === 'Long flow' ? 'More steps than the ribbon has room for: it scrolls and keeps the current marker in view. Use a completed marker to go back.'
426
+ : this.scenario === 'One step' ? 'A flow of one step is its card alone: no ribbon and no "1 of 1", and the card stands in the middle. Record is refused once, in the host\'s own words; switch the language and the refusal follows it. Record again to finish.'
352
427
  : 'Move forward, go back with Back or a completed marker in the ribbon, and review your choices. Vertical, and Auto on a narrow surface, show the ribbon as a strip above the steps, and the steps slide sideways. Centred stands the card in the middle of the stage.'}</p>
353
428
  <details><summary class="caption">Completion required</summary>
354
429
  <p class="caption">For a flow that must finish, such as a required update, cancellation can be disabled.</p>