tosijs-ui 1.16.4 → 1.16.5

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
@@ -1,5 +1,65 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.16.5
4
+
5
+ A patch, mostly found by using the doc site on an iPhone: menus that stay on screen as Safari's
6
+ toolbars come and go, a code panel that fits the visible screen, and a REPL that completes as
7
+ you type (touchably, case-insensitively, with `$` and `$$`). Also quiet under tosijs 1.10.7's
8
+ long-list advice, and `pinnedTopRows` now works from the element creator. `dist/iife.js` grows
9
+ by 3.6 kB gzip (478.7 → 482.2 kB), including the move to tosijs 1.10.7, which it bundles.
10
+
11
+ **One read-side change to check for:** `<tosi-table>`'s `pinnedTopRows` and `pinnedBottomRows`
12
+ now read as `null` rather than `undefined` when unset (typed `any[] | null`). That is what makes
13
+ them work when passed to the element creator. Code that tested `table.pinnedTopRows ===
14
+ undefined` should test `== null` instead; truthiness checks are unaffected.
15
+
16
+ ### `$` and `$$` in the REPL
17
+
18
+ As in a browser console: `$('.thing')` returns the first match and `$$('.thing')` an array of all
19
+ of them, within the example's own preview. An example's own `$`, or a page's jQuery, takes
20
+ precedence.
21
+
22
+ ### The Console tab's REPL completes as you type
23
+
24
+ Typing a name, or a dot after a value, opens a list of suggestions above the prompt: the
25
+ value's properties (prototype chain included) or the names in scope (the example's own,
26
+ `preview`, `console`, the page's modules, globals). Tap one, or use ↓/↑ and Enter; Tab takes the
27
+ highlighted or first suggestion, and Escape closes the list. Rows are touch-sized, so it works
28
+ on a phone, where there is no Tab key and no browser console at all. Matching ignores case, and
29
+ the field turns off iOS's auto-capitalisation and autocorrect; the example's own names rank
30
+ above globals.
31
+
32
+ ### Quiet under tosijs 1.10.7's long-list advice; `pinnedTopRows` works from the creator
33
+
34
+ tosijs 1.10.7 warns once about any list binding of more than 10 items that has neither
35
+ `virtual` nor a `nonVirtualReason`. tosijs-ui builds some lists its users can't reach, so it now
36
+ gives the reason itself:
37
+
38
+ - `<tosi-table>`'s pinned rows, which are always on screen;
39
+ - its body under `rowHeight: 0`, which is the author choosing to render every row (the table's
40
+ own warning still fires past 1,000 rows);
41
+ - the doc browser's flat nav in `routing: 'query'`.
42
+
43
+ While testing this, `tosiTable({ pinnedTopRows: [...] })` (and `pinnedBottomRows`) turned out to
44
+ be silently ignored when passed to the element creator: the getter returned `undefined` when
45
+ unset, so tosijs set an attribute instead. It now returns `null` when unset, and the creator
46
+ works (see the note at the top of these notes). The dev dependency moves to tosijs 1.10.7; the peer range is unchanged (`^1.10.3`).
47
+
48
+ ### Menus stay inside the screen on iPhone as Safari's toolbars come and go
49
+
50
+ A menu's room was measured once, when it opened. Mobile Safari then shows and hides its toolbars
51
+ (and the keyboard comes and goes) as you touch the page, which changes the visible area without
52
+ a window resize, so a menu measured a moment earlier ran under the toolbar. Open floats (menus,
53
+ tooltips, hint lists) are now re-fitted to their anchor whenever the visible viewport changes.
54
+ Draggable floats are left where they are. Reported by the maintainer on an iPhone (the other
55
+ half of #2460).
56
+
57
+ ### The Console tab's REPL is reachable on iPhone
58
+
59
+ A full-screen example (the code panel, or maximized) was sized `100vh`, which on iPhone Safari is
60
+ the height without the browser toolbar, so the bottom of the panel sat under it, and that is
61
+ where the Console tab's REPL input lives. It is now sized to the visible viewport (`100dvh`).
62
+
3
63
  ## 1.16.4
4
64
 
5
65
  A patch: the example console becomes a tab with a REPL, test-only examples render on deployed
@@ -243,10 +243,10 @@ export declare class TosiTable extends TosiTable_base {
243
243
  private _nonRepeatingGroupedRowCells;
244
244
  private _pinnedTopRows?;
245
245
  private _pinnedBottomRows?;
246
- get pinnedTopRows(): any[] | undefined;
247
- set pinnedTopRows(rows: any[] | undefined);
248
- get pinnedBottomRows(): any[] | undefined;
249
- set pinnedBottomRows(rows: any[] | undefined);
246
+ get pinnedTopRows(): any[] | null;
247
+ set pinnedTopRows(rows: any[] | null | undefined);
248
+ get pinnedBottomRows(): any[] | null;
249
+ set pinnedBottomRows(rows: any[] | null | undefined);
250
250
  get effectivePinnedTopData(): any[];
251
251
  get effectivePinnedBottomData(): any[];
252
252
  private get effectiveBaseData();
@@ -1578,15 +1578,20 @@ export class TosiTable extends withAttributes({
1578
1578
  // count-based slicing.
1579
1579
  _pinnedTopRows;
1580
1580
  _pinnedBottomRows;
1581
+ /*
1582
+ `null`, not `undefined`, when unset: tosijs's element creator assigns a prop as a PROPERTY only
1583
+ when the instance's current value isn't `undefined`, and otherwise as an attribute — so
1584
+ `tosiTable({ pinnedTopRows: [...] })` was silently ignored (tosijs board #2464).
1585
+ */
1581
1586
  get pinnedTopRows() {
1582
- return this._pinnedTopRows;
1587
+ return this._pinnedTopRows ?? null;
1583
1588
  }
1584
1589
  set pinnedTopRows(rows) {
1585
1590
  this._pinnedTopRows = rows ? tosiValue(rows) : undefined;
1586
1591
  this.queueRender();
1587
1592
  }
1588
1593
  get pinnedBottomRows() {
1589
- return this._pinnedBottomRows;
1594
+ return this._pinnedBottomRows ?? null;
1590
1595
  }
1591
1596
  set pinnedBottomRows(rows) {
1592
1597
  this._pinnedBottomRows = rows ? tosiValue(rows) : undefined;
@@ -2364,7 +2369,11 @@ export class TosiTable extends withAttributes({
2364
2369
  the visible data, so they have no parity, and blanking their non-repeating cells
2365
2370
  would empty a pinned header/summary row purely because it is not in `firstRows`.
2366
2371
  */
2367
- (_elements, item) => this.buildRow(item, cols, stickyInfo, rowClass, false), {});
2372
+ (_elements, item) => this.buildRow(item, cols, stickyInfo, rowClass, false),
2373
+ // tosijs warns about long unvirtualised lists (1.10.7); the author can't reach this one
2374
+ {
2375
+ nonVirtualReason: 'pinned rows are always on screen, so every one is rendered (a handful by design)',
2376
+ });
2368
2377
  return div({
2369
2378
  class: `tbody tbody-${region}`,
2370
2379
  role: 'rowgroup',
@@ -3338,7 +3347,17 @@ export class TosiTable extends withAttributes({
3338
3347
  // The visible-rows listBinding is bound directly to .scroll-area so
3339
3348
  // virtualisation observes the same scroll container that sticky cells
3340
3349
  // stick against.
3341
- const visibleBinding = this.rowData.visible.listBinding((_elements, item) => this.buildRow(item, cols, stickyInfo), this.rowHeight > 0 ? { virtual: { height: this.rowHeight } } : {});
3350
+ const visibleBinding = this.rowData.visible.listBinding((_elements, item) => this.buildRow(item, cols, stickyInfo), this.rowHeight > 0
3351
+ ? { virtual: { height: this.rowHeight } }
3352
+ : /*
3353
+ `rowHeight: 0` IS the author saying "render every row" (documented for small tables
3354
+ and variable row heights), so say so to tosijs rather than have it warn about a choice
3355
+ already made. A table big enough for that to hurt still gets <tosi-table>'s own
3356
+ warning past NON_VIRTUAL_ROW_ADVICE rows (#84).
3357
+ */
3358
+ {
3359
+ nonVirtualReason: 'rowHeight: 0 — the author chose to render every row (<tosi-table> warns past 1,000)',
3360
+ });
3342
3361
  this._scrollArea = div({ class: 'scroll-area', part: 'visibleRows' }, ...[
3343
3362
  this._head,
3344
3363
  this._tbodyTop,
@@ -1490,6 +1490,9 @@ export function createDocBrowser(options) {
1490
1490
  idPath: 'filename',
1491
1491
  hiddenProp: 'hidden',
1492
1492
  value: app.docs,
1493
+ // the flat nav (query routing) lists every doc so the search can filter it and a
1494
+ // reader can scan it; the site's author can't reach this binding to say so
1495
+ nonVirtualReason: 'doc navigation: every doc is listed so search can filter it',
1493
1496
  },
1494
1497
  }, template(a({
1495
1498
  class: 'doc-link',
package/dist/float.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ElementCreator } from 'tosijs';
2
+ import type { FloatPosition } from './pop-float.js';
2
3
  declare const TosiFloat_base: import("tosijs").WithAttributes<{
3
4
  drag: boolean;
4
5
  remainOnResize: "hide" | "remove" | "remain";
@@ -12,6 +13,11 @@ export declare class TosiFloat extends TosiFloat_base {
12
13
  * (the page, or a scroller containing it) triggers `remainOnScroll`. `null`: any scroll does.
13
14
  */
14
15
  anchor: Element | null;
16
+ /**
17
+ * The position it was asked for against its anchor (set by `positionFloat`), so it can be
18
+ * re-fitted when the visible viewport changes. `null`: never positioned against an anchor.
19
+ */
20
+ anchorPosition: FloatPosition | null;
15
21
  content: HTMLSlotElement;
16
22
  static shadowStyleSpec: {
17
23
  ':host': {
package/dist/float.js CHANGED
@@ -106,6 +106,13 @@ export class TosiFloat extends withAttributes({
106
106
  * (the page, or a scroller containing it) triggers `remainOnScroll`. `null`: any scroll does.
107
107
  */
108
108
  anchor = null;
109
+ /**
110
+ * The position it was asked for against its anchor (set by `positionFloat`), so it can be
111
+ * re-fitted when the visible viewport changes. `null`: never positioned against an anchor.
112
+ */
113
+ // typed FloatPosition, not string: as `string` it accepted the CSS position '' / 'fixed'
114
+ // that a shadowed variable stored there (1.16.5 review B1), and the compiler said nothing
115
+ anchorPosition = null;
109
116
  content = slot();
110
117
  static shadowStyleSpec = {
111
118
  ':host': {