@yuneta/gobj-ui 7.32.7 → 7.32.9

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/README.md CHANGED
@@ -4519,17 +4519,27 @@ text is in the yunetas `CLAUDE.md` ("JS GUI conventions"); in short:
4519
4519
  1em square, and a wide glyph was drawn smaller to fit: in one row of tool
4520
4520
  buttons, `yi-code` was 80% of the height of the others.
4521
4521
  - **The icons of a row of controls have one size**: `YUI_TOOLBAR_ICON_SIZE`
4522
- (1.25rem, `yui_toolbar.js`). A toolbar, a tab, a menu entry and the
4523
- paginator of a table on a phone take it (7.32.7+). Build the glyph with
4524
- `yui_toolbar_icon()` in a plain Bulma `.icon`:
4522
+ (1.25rem). A toolbar, a tab, a menu entry and the paginator of a table on
4523
+ a phone take it (7.32.7+). Build the glyph with `yui_toolbar_icon()` in a
4524
+ plain Bulma `.icon`:
4525
4525
 
4526
4526
  ```js
4527
+ import {yui_toolbar_icon} from "@yuneta/gobj-ui/src/yui_toolbar_icon.js";
4527
4528
  ['span', {class: 'icon'}, [yui_toolbar_icon('yi-table')]]
4528
4529
  ```
4529
4530
 
4530
- The app bar, the icon bar and the cards are other bands, with their own
4531
- bigger icons. The close mark of a tab is no icon of the tab and keeps the
4532
- size of its text. Up to 7.32.6 a tab and a menu entry took the size of
4531
+ The two names live in `yui_toolbar_icon.js`, a module with no i18n key
4532
+ and no CSS (7.32.8+). `yui_toolbar.js` exports them too. A view that
4533
+ draws no toolbar imports them from `yui_toolbar_icon.js`: an app must
4534
+ define the keys of every module that it imports, and `yui_toolbar.js`
4535
+ carries the keys of the scroll arrows.
4536
+
4537
+ The title bar of a `C_YUI_WINDOW` takes it too: its icon, and the
4538
+ minimize, maximize and close glyphs, drawn in a box of that size. So does
4539
+ the header of a dialog of the shell (its back arrow and its close), which
4540
+ is the phone's face of a window (7.32.9+). The app bar, the icon bar, the
4541
+ cards and the dock of windows are other bands, with their own sizes. The
4542
+ close mark of a tab is no icon of the tab and keeps the size of its text. Up to 7.32.6 a tab and a menu entry took the size of
4533
4543
  their text, 16px. Under a toolbar of 20px their icons looked smaller.
4534
4544
  - **Bulma helpers carry `!important`** (`.is-hidden`, `.is-flex`): toggle
4535
4545
  `is-hidden`, or use `style.setProperty('display', 'none', 'important')`.
@@ -4340,6 +4340,62 @@ function yui_shell_set_nav_item_badge(shell_gobj, item_id, value, tone) {
4340
4340
  function yui_shell_close_dropdown(shell_gobj) {
4341
4341
  close_toolbar_dropdown(shell_gobj);
4342
4342
  }
4343
+ // src/yui_toolbar_icon.js
4344
+ /***********************************************************************
4345
+ * yui_toolbar_icon.js
4346
+ *
4347
+ * The one size of the glyphs of a row of controls, and the
4348
+ * `<i>` that draws one at it.
4349
+ *
4350
+ * A module of its own, with no key and no CSS, so that a view
4351
+ * can take the size without taking the toolbar widget. In
4352
+ * 7.32.7 C_YUI_NAV imported it from yui_toolbar.js, and every
4353
+ * app that mounts a nav had to define the keys of the toolbar's
4354
+ * scroll arrows ("scroll left", "scroll right"), which
4355
+ * validate-locales reads in every module the app imports.
4356
+ * yui_toolbar.js exports the two names too, as before.
4357
+ *
4358
+ * Copyright (c) 2026, ArtGins.
4359
+ * All Rights Reserved.
4360
+ ***********************************************************************/
4361
+ /************************************************************
4362
+ * ONE size for every glyph of a view's toolbar, in `rem`.
4363
+ *
4364
+ * It lives here because it belongs to the TOOLBAR and not to
4365
+ * any one view: it was born in the graph rows (7.23.86) and the
4366
+ * JSON viewer beside them still drew 16px, which is the same
4367
+ * drift one level up.
4368
+ *
4369
+ * `rem` and not `em` is the whole lesson: `em` is measured
4370
+ * against the button, so one declaration draws three icons --
4371
+ * `1.5em` is 24px in a plain button, 18px in an `is-small`
4372
+ * chip, and a labelled button that declares nothing keeps the
4373
+ * inherited 16px. `rem` is measured against the page, so a
4374
+ * chip deliberately shorter than a button still carries the
4375
+ * same glyph.
4376
+ *
4377
+ * 20px against a row's 16px text: an icon-only button is
4378
+ * legible at half its 40px height, and beside a label the
4379
+ * glyph reads as a marker rather than as a second word. The
4380
+ * app BAR is a different band and keeps its own, bigger size
4381
+ * (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
4382
+ *
4383
+ * It is also the size of the glyphs of the TABS and of the
4384
+ * MENU entries (C_YUI_NAV, the topic tabs of
4385
+ * C_YUI_TREEDB_TOPICS), and of the paginator of a table on a
4386
+ * phone (tabulator.css). Up to 7.32.6 a tab took the 16px of
4387
+ * its text, and right under a toolbar its icons read as
4388
+ * smaller than the toolbar's. The rows of a tab or a menu
4389
+ * entry are 24px of line, so the glyph changes no height.
4390
+ ************************************************************/
4391
+ var YUI_TOOLBAR_ICON_SIZE = "1.25rem";
4392
+ function yui_toolbar_icon(icon_class, extra_style) {
4393
+ return ["i", {
4394
+ class: icon_class,
4395
+ "aria-hidden": "true",
4396
+ style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
4397
+ }];
4398
+ }
4343
4399
  // src/shell_modals.js
4344
4400
  /***********************************************************************
4345
4401
  * shell_modals.js
@@ -4582,7 +4638,7 @@ function yui_shell_show_modal(shell, content, opts) {
4582
4638
  "aria-label": (0, i18next.t)("back"),
4583
4639
  "data-i18n-aria-label": "back"
4584
4640
  },
4585
- [["i", { class: "yi-arrow-left" }]]
4641
+ [yui_toolbar_icon("yi-arrow-left")]
4586
4642
  ],
4587
4643
  [
4588
4644
  "span",
@@ -4599,7 +4655,7 @@ function yui_shell_show_modal(shell, content, opts) {
4599
4655
  "aria-label": (0, i18next.t)("close"),
4600
4656
  "data-i18n-aria-label": "close"
4601
4657
  },
4602
- [["i", { class: "yi-xmark" }]]
4658
+ [yui_toolbar_icon("yi-xmark")]
4603
4659
  ]
4604
4660
  ]
4605
4661
  ], [
@@ -5194,7 +5250,7 @@ function ensure_window_style() {
5194
5250
  .yui-window-titlebar-controls { display: flex; align-items: center; gap: 2px; padding-left: 6px; }
5195
5251
  .yui-window-title { white-space: nowrap; }
5196
5252
  .yui-window-title .icon { flex: 0 0 auto; }
5197
- .yui-window-title svg { width: 14px; height: 14px; display: block; }
5253
+ .yui-window-title svg { width: ${YUI_TOOLBAR_ICON_SIZE}; height: ${YUI_TOOLBAR_ICON_SIZE}; display: block; }
5198
5254
  /* Separator between the data half and the translated kind half. CSS,
5199
5255
  * not a text node: createElement2 trims text nodes and eats the spaces.
5200
5256
  * Decorative ("/ ''"): the halves NAME the window, and a reader read
@@ -5212,7 +5268,7 @@ function ensure_window_style() {
5212
5268
  }
5213
5269
  .yui-wc:hover { background: var(--bulma-scheme-main-ter); color: var(--bulma-text-strong); }
5214
5270
  .yui-wc.wc-close:hover { background: #e0364a; color: #fff; }
5215
- .yui-wc svg { width: 15px; height: 15px; display: block; }
5271
+ .yui-wc svg { width: ${YUI_TOOLBAR_ICON_SIZE}; height: ${YUI_TOOLBAR_ICON_SIZE}; display: block; }
5216
5272
  .yui-window-resize { color: var(--bulma-text-weak); opacity: 0.55; }
5217
5273
  .yui-window-resize:hover { opacity: 1; color: var(--bulma-text); }
5218
5274
  /* A modal window over its backdrop: the backdrop of a Bulma .modal,
@@ -5227,7 +5283,6 @@ function ensure_window_style() {
5227
5283
  .C_YUI_WINDOW.is-mobile-sheet .yui-window-resize { display: none !important; }
5228
5284
  .yui-wc { width: 42px; height: 38px; }
5229
5285
  .yui-wc.wc-max { display: none !important; }
5230
- .yui-wc svg { width: 18px; height: 18px; }
5231
5286
  }
5232
5287
  `;
5233
5288
  let $style = document.createElement("style");
@@ -5280,7 +5335,7 @@ function build_title_node(gobj, id, hidden) {
5280
5335
  else items.push([
5281
5336
  "span",
5282
5337
  { class: "icon" },
5283
- [["i", { class: icon }]]
5338
+ [yui_toolbar_icon(icon)]
5284
5339
  ]);
5285
5340
  }
5286
5341
  if (!(0, _yuneta_gobj_js.empty_string)(prefix)) items.push([
@@ -16558,44 +16613,6 @@ function register_c_yui_uplot() {
16558
16613
  return create_gclass$15(GCLASS_NAME$15);
16559
16614
  }
16560
16615
  // src/yui_toolbar.js
16561
- /************************************************************
16562
- * ONE size for every glyph of a view's toolbar, in `rem`.
16563
- *
16564
- * It lives here because it belongs to the TOOLBAR and not to
16565
- * any one view: it was born in the graph rows (7.23.86) and the
16566
- * JSON viewer beside them still drew 16px, which is the same
16567
- * drift one level up.
16568
- *
16569
- * `rem` and not `em` is the whole lesson: `em` is measured
16570
- * against the button, so one declaration draws three icons --
16571
- * `1.5em` is 24px in a plain button, 18px in an `is-small`
16572
- * chip, and a labelled button that declares nothing keeps the
16573
- * inherited 16px. `rem` is measured against the page, so a
16574
- * chip deliberately shorter than a button still carries the
16575
- * same glyph.
16576
- *
16577
- * 20px against a row's 16px text: an icon-only button is
16578
- * legible at half its 40px height, and beside a label the
16579
- * glyph reads as a marker rather than as a second word. The
16580
- * app BAR is a different band and keeps its own, bigger size
16581
- * (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
16582
- *
16583
- * It is also the size of the glyphs of the TABS and of the
16584
- * MENU entries (C_YUI_NAV, the topic tabs of
16585
- * C_YUI_TREEDB_TOPICS), and of the paginator of a table on a
16586
- * phone (tabulator.css). Up to 7.32.6 a tab took the 16px of
16587
- * its text, and right under a toolbar its icons read as
16588
- * smaller than the toolbar's. The rows of a tab or a menu
16589
- * entry are 24px of line, so the glyph changes no height.
16590
- ************************************************************/
16591
- var YUI_TOOLBAR_ICON_SIZE = "1.25rem";
16592
- function yui_toolbar_icon(icon_class, extra_style) {
16593
- return ["i", {
16594
- class: icon_class,
16595
- "aria-hidden": "true",
16596
- style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
16597
- }];
16598
- }
16599
16616
  function yui_toolbar(attrs = {}, items = []) {
16600
16617
  function arrow_button(side, icon, label) {
16601
16618
  return [
@@ -4335,6 +4335,62 @@ function yui_shell_set_nav_item_badge(shell_gobj, item_id, value, tone) {
4335
4335
  function yui_shell_close_dropdown(shell_gobj) {
4336
4336
  close_toolbar_dropdown(shell_gobj);
4337
4337
  }
4338
+ // src/yui_toolbar_icon.js
4339
+ /***********************************************************************
4340
+ * yui_toolbar_icon.js
4341
+ *
4342
+ * The one size of the glyphs of a row of controls, and the
4343
+ * `<i>` that draws one at it.
4344
+ *
4345
+ * A module of its own, with no key and no CSS, so that a view
4346
+ * can take the size without taking the toolbar widget. In
4347
+ * 7.32.7 C_YUI_NAV imported it from yui_toolbar.js, and every
4348
+ * app that mounts a nav had to define the keys of the toolbar's
4349
+ * scroll arrows ("scroll left", "scroll right"), which
4350
+ * validate-locales reads in every module the app imports.
4351
+ * yui_toolbar.js exports the two names too, as before.
4352
+ *
4353
+ * Copyright (c) 2026, ArtGins.
4354
+ * All Rights Reserved.
4355
+ ***********************************************************************/
4356
+ /************************************************************
4357
+ * ONE size for every glyph of a view's toolbar, in `rem`.
4358
+ *
4359
+ * It lives here because it belongs to the TOOLBAR and not to
4360
+ * any one view: it was born in the graph rows (7.23.86) and the
4361
+ * JSON viewer beside them still drew 16px, which is the same
4362
+ * drift one level up.
4363
+ *
4364
+ * `rem` and not `em` is the whole lesson: `em` is measured
4365
+ * against the button, so one declaration draws three icons --
4366
+ * `1.5em` is 24px in a plain button, 18px in an `is-small`
4367
+ * chip, and a labelled button that declares nothing keeps the
4368
+ * inherited 16px. `rem` is measured against the page, so a
4369
+ * chip deliberately shorter than a button still carries the
4370
+ * same glyph.
4371
+ *
4372
+ * 20px against a row's 16px text: an icon-only button is
4373
+ * legible at half its 40px height, and beside a label the
4374
+ * glyph reads as a marker rather than as a second word. The
4375
+ * app BAR is a different band and keeps its own, bigger size
4376
+ * (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
4377
+ *
4378
+ * It is also the size of the glyphs of the TABS and of the
4379
+ * MENU entries (C_YUI_NAV, the topic tabs of
4380
+ * C_YUI_TREEDB_TOPICS), and of the paginator of a table on a
4381
+ * phone (tabulator.css). Up to 7.32.6 a tab took the 16px of
4382
+ * its text, and right under a toolbar its icons read as
4383
+ * smaller than the toolbar's. The rows of a tab or a menu
4384
+ * entry are 24px of line, so the glyph changes no height.
4385
+ ************************************************************/
4386
+ var YUI_TOOLBAR_ICON_SIZE = "1.25rem";
4387
+ function yui_toolbar_icon(icon_class, extra_style) {
4388
+ return ["i", {
4389
+ class: icon_class,
4390
+ "aria-hidden": "true",
4391
+ style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
4392
+ }];
4393
+ }
4338
4394
  // src/shell_modals.js
4339
4395
  /***********************************************************************
4340
4396
  * shell_modals.js
@@ -4577,7 +4633,7 @@ function yui_shell_show_modal(shell, content, opts) {
4577
4633
  "aria-label": t("back"),
4578
4634
  "data-i18n-aria-label": "back"
4579
4635
  },
4580
- [["i", { class: "yi-arrow-left" }]]
4636
+ [yui_toolbar_icon("yi-arrow-left")]
4581
4637
  ],
4582
4638
  [
4583
4639
  "span",
@@ -4594,7 +4650,7 @@ function yui_shell_show_modal(shell, content, opts) {
4594
4650
  "aria-label": t("close"),
4595
4651
  "data-i18n-aria-label": "close"
4596
4652
  },
4597
- [["i", { class: "yi-xmark" }]]
4653
+ [yui_toolbar_icon("yi-xmark")]
4598
4654
  ]
4599
4655
  ]
4600
4656
  ], [
@@ -5189,7 +5245,7 @@ function ensure_window_style() {
5189
5245
  .yui-window-titlebar-controls { display: flex; align-items: center; gap: 2px; padding-left: 6px; }
5190
5246
  .yui-window-title { white-space: nowrap; }
5191
5247
  .yui-window-title .icon { flex: 0 0 auto; }
5192
- .yui-window-title svg { width: 14px; height: 14px; display: block; }
5248
+ .yui-window-title svg { width: ${YUI_TOOLBAR_ICON_SIZE}; height: ${YUI_TOOLBAR_ICON_SIZE}; display: block; }
5193
5249
  /* Separator between the data half and the translated kind half. CSS,
5194
5250
  * not a text node: createElement2 trims text nodes and eats the spaces.
5195
5251
  * Decorative ("/ ''"): the halves NAME the window, and a reader read
@@ -5207,7 +5263,7 @@ function ensure_window_style() {
5207
5263
  }
5208
5264
  .yui-wc:hover { background: var(--bulma-scheme-main-ter); color: var(--bulma-text-strong); }
5209
5265
  .yui-wc.wc-close:hover { background: #e0364a; color: #fff; }
5210
- .yui-wc svg { width: 15px; height: 15px; display: block; }
5266
+ .yui-wc svg { width: ${YUI_TOOLBAR_ICON_SIZE}; height: ${YUI_TOOLBAR_ICON_SIZE}; display: block; }
5211
5267
  .yui-window-resize { color: var(--bulma-text-weak); opacity: 0.55; }
5212
5268
  .yui-window-resize:hover { opacity: 1; color: var(--bulma-text); }
5213
5269
  /* A modal window over its backdrop: the backdrop of a Bulma .modal,
@@ -5222,7 +5278,6 @@ function ensure_window_style() {
5222
5278
  .C_YUI_WINDOW.is-mobile-sheet .yui-window-resize { display: none !important; }
5223
5279
  .yui-wc { width: 42px; height: 38px; }
5224
5280
  .yui-wc.wc-max { display: none !important; }
5225
- .yui-wc svg { width: 18px; height: 18px; }
5226
5281
  }
5227
5282
  `;
5228
5283
  let $style = document.createElement("style");
@@ -5275,7 +5330,7 @@ function build_title_node(gobj, id, hidden) {
5275
5330
  else items.push([
5276
5331
  "span",
5277
5332
  { class: "icon" },
5278
- [["i", { class: icon }]]
5333
+ [yui_toolbar_icon(icon)]
5279
5334
  ]);
5280
5335
  }
5281
5336
  if (!empty_string(prefix)) items.push([
@@ -16553,44 +16608,6 @@ function register_c_yui_uplot() {
16553
16608
  return create_gclass$15(GCLASS_NAME$15);
16554
16609
  }
16555
16610
  // src/yui_toolbar.js
16556
- /************************************************************
16557
- * ONE size for every glyph of a view's toolbar, in `rem`.
16558
- *
16559
- * It lives here because it belongs to the TOOLBAR and not to
16560
- * any one view: it was born in the graph rows (7.23.86) and the
16561
- * JSON viewer beside them still drew 16px, which is the same
16562
- * drift one level up.
16563
- *
16564
- * `rem` and not `em` is the whole lesson: `em` is measured
16565
- * against the button, so one declaration draws three icons --
16566
- * `1.5em` is 24px in a plain button, 18px in an `is-small`
16567
- * chip, and a labelled button that declares nothing keeps the
16568
- * inherited 16px. `rem` is measured against the page, so a
16569
- * chip deliberately shorter than a button still carries the
16570
- * same glyph.
16571
- *
16572
- * 20px against a row's 16px text: an icon-only button is
16573
- * legible at half its 40px height, and beside a label the
16574
- * glyph reads as a marker rather than as a second word. The
16575
- * app BAR is a different band and keeps its own, bigger size
16576
- * (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
16577
- *
16578
- * It is also the size of the glyphs of the TABS and of the
16579
- * MENU entries (C_YUI_NAV, the topic tabs of
16580
- * C_YUI_TREEDB_TOPICS), and of the paginator of a table on a
16581
- * phone (tabulator.css). Up to 7.32.6 a tab took the 16px of
16582
- * its text, and right under a toolbar its icons read as
16583
- * smaller than the toolbar's. The rows of a tab or a menu
16584
- * entry are 24px of line, so the glyph changes no height.
16585
- ************************************************************/
16586
- var YUI_TOOLBAR_ICON_SIZE = "1.25rem";
16587
- function yui_toolbar_icon(icon_class, extra_style) {
16588
- return ["i", {
16589
- class: icon_class,
16590
- "aria-hidden": "true",
16591
- style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
16592
- }];
16593
- }
16594
16611
  function yui_toolbar(attrs = {}, items = []) {
16595
16612
  function arrow_button(side, icon, label) {
16596
16613
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.32.7",
3
+ "version": "7.32.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/gobj-ui.cjs.js",
package/src/c_yui_nav.js CHANGED
@@ -111,7 +111,7 @@ import {
111
111
  import {text_node} from "./yui_text.js";
112
112
  import {css_string} from "./yui_selector.js";
113
113
  import {badge_node, badge_tone, paint_badge, name_control_with_badge} from "./yui_badge.js";
114
- import {yui_toolbar_icon} from "./yui_toolbar.js";
114
+ import {yui_toolbar_icon} from "./yui_toolbar_icon.js";
115
115
 
116
116
  /***************************************************************
117
117
  * Constants
@@ -90,6 +90,7 @@ import {escape_is_taken} from "./escape_taken.js";
90
90
 
91
91
  import "./c_yui_window.css";
92
92
  import {text_node} from "./yui_text.js";
93
+ import {yui_toolbar_icon, YUI_TOOLBAR_ICON_SIZE} from "./yui_toolbar_icon.js";
93
94
 
94
95
  /***************************************************************
95
96
  * Constants
@@ -99,7 +100,13 @@ const GCLASS_NAME = "C_YUI_WINDOW";
99
100
  /* Window-control glyphs as inline SVG (currentColor → theme-aware,
100
101
  * pixel-consistent). There is no minimize/restore glyph in the
101
102
  * yui_icons.css mask set, and chrome affordances read better as
102
- * crisp SVG than as content icons. */
103
+ * crisp SVG than as content icons.
104
+ *
105
+ * Each one is drawn in a box of YUI_TOOLBAR_ICON_SIZE, the size of
106
+ * the glyphs of the toolbar right under the title bar (7.32.9). Up to
107
+ * 7.32.8 the box was 15px, and the drawn marks were 7.5px (close),
108
+ * 8.8px (maximize) and 9.4px (minimize) next to toolbar icons of
109
+ * 20px. In a 20px box they are 10, 11.75 and 12.5px. */
103
110
  const WC_MIN = '<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="3" y="11" width="10" height="1.6" rx="0.8" fill="currentColor"/></svg>';
104
111
  const WC_MAX = '<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="3.3" y="3.3" width="9.4" height="9.4" rx="1.6" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>';
105
112
  const WC_RESTORE = '<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="5.2" y="3" width="7.8" height="7.8" rx="1.3" fill="none" stroke="currentColor" stroke-width="1.4"/><rect x="3" y="5.2" width="7.8" height="7.8" rx="1.3" fill="var(--bulma-scheme-main)" stroke="currentColor" stroke-width="1.4"/></svg>';
@@ -420,7 +427,7 @@ function ensure_window_style()
420
427
  .yui-window-titlebar-controls { display: flex; align-items: center; gap: 2px; padding-left: 6px; }
421
428
  .yui-window-title { white-space: nowrap; }
422
429
  .yui-window-title .icon { flex: 0 0 auto; }
423
- .yui-window-title svg { width: 14px; height: 14px; display: block; }
430
+ .yui-window-title svg { width: ${YUI_TOOLBAR_ICON_SIZE}; height: ${YUI_TOOLBAR_ICON_SIZE}; display: block; }
424
431
  /* Separator between the data half and the translated kind half. CSS,
425
432
  * not a text node: createElement2 trims text nodes and eats the spaces.
426
433
  * Decorative ("/ ''"): the halves NAME the window, and a reader read
@@ -438,7 +445,7 @@ function ensure_window_style()
438
445
  }
439
446
  .yui-wc:hover { background: var(--bulma-scheme-main-ter); color: var(--bulma-text-strong); }
440
447
  .yui-wc.wc-close:hover { background: #e0364a; color: #fff; }
441
- .yui-wc svg { width: 15px; height: 15px; display: block; }
448
+ .yui-wc svg { width: ${YUI_TOOLBAR_ICON_SIZE}; height: ${YUI_TOOLBAR_ICON_SIZE}; display: block; }
442
449
  .yui-window-resize { color: var(--bulma-text-weak); opacity: 0.55; }
443
450
  .yui-window-resize:hover { opacity: 1; color: var(--bulma-text); }
444
451
  /* A modal window over its backdrop: the backdrop of a Bulma .modal,
@@ -453,7 +460,6 @@ function ensure_window_style()
453
460
  .C_YUI_WINDOW.is-mobile-sheet .yui-window-resize { display: none !important; }
454
461
  .yui-wc { width: 42px; height: 38px; }
455
462
  .yui-wc.wc-max { display: none !important; }
456
- .yui-wc svg { width: 18px; height: 18px; }
457
463
  }
458
464
  `;
459
465
  let $style = document.createElement('style');
@@ -507,7 +513,9 @@ function build_title_node(gobj, id, hidden)
507
513
  /* The `icon` attr is the app's own: inline svg is markup. */
508
514
  items.push(['span', {class: 'icon'}, html_markup(icon)]);
509
515
  } else {
510
- items.push(['span', {class: 'icon'}, [['i', {class: icon}]]]);
516
+ /* The size of the glyphs of a row of controls, as a tab:
517
+ * up to 7.32.8 it took the 16px of the title. */
518
+ items.push(['span', {class: 'icon'}, [yui_toolbar_icon(icon)]]);
511
519
  }
512
520
  }
513
521
  if(!empty_string(prefix)) {
@@ -2,19 +2,26 @@
2
2
  * nav_icon_size.wiring.test.js
3
3
  *
4
4
  * The glyph of a tab and of a menu entry of C_YUI_NAV is the size
5
- * of the glyphs of a toolbar: YUI_TOOLBAR_ICON_SIZE (yui_toolbar.js).
5
+ * of the glyphs of a toolbar: YUI_TOOLBAR_ICON_SIZE (yui_toolbar_icon.js).
6
6
  * Up to 7.32.6 a tab and a menu entry took the 16px of their text,
7
7
  * and right under a toolbar of 20px their icons read as smaller.
8
8
  * The icon bar and the cards are other bands: they keep their own
9
9
  * size. The close mark of a tab is no icon of the tab: it keeps
10
10
  * its own size too.
11
11
  *
12
+ * The nav takes the size from yui_toolbar_icon.js, a module with
13
+ * no key and no CSS, and never from yui_toolbar.js: validate-locales
14
+ * reads every module an app imports, and in 7.32.7 the keys of the
15
+ * toolbar's scroll arrows failed the build of each app that mounts
16
+ * a nav and no toolbar.
17
+ *
12
18
  * Driven through the real gclass on a document double.
13
19
  *
14
20
  * Copyright (c) 2026, ArtGins.
15
21
  * All Rights Reserved.
16
22
  ***********************************************************************/
17
23
  import {test, expect, beforeAll} from "vitest";
24
+ import {readFileSync} from "fs";
18
25
  import {install_dom_double} from "../test/dom_double.js";
19
26
 
20
27
  install_dom_double();
@@ -92,3 +99,13 @@ test("the glyph is decoration: the control carries the name", () => {
92
99
  const $i = $c.querySelector("i.yi-table");
93
100
  expect($i.getAttribute("aria-hidden")).toBe("true");
94
101
  });
102
+
103
+ test("the nav takes the size from a module with no key and no CSS", () => {
104
+ const nav_src = readFileSync(new URL("./c_yui_nav.js", import.meta.url), "utf8");
105
+ expect(nav_src).toContain('from "./yui_toolbar_icon.js"');
106
+ expect(nav_src).not.toContain('from "./yui_toolbar.js"');
107
+
108
+ const icon_src = readFileSync(new URL("./yui_toolbar_icon.js", import.meta.url), "utf8");
109
+ expect(icon_src).not.toMatch(/^\s*import\b/m);
110
+ expect(icon_src).not.toMatch(/\bt\(/);
111
+ });
@@ -48,6 +48,7 @@ import {
48
48
  yui_shell_overlay_dismissed,
49
49
  } from "./c_yui_shell.js";
50
50
  import {text_node} from "./yui_text.js";
51
+ import {yui_toolbar_icon} from "./yui_toolbar_icon.js";
51
52
 
52
53
 
53
54
  /***************************************************************
@@ -330,14 +331,18 @@ export function yui_shell_show_modal(shell, content, opts)
330
331
  let with_close = !(opts && opts.with_close_button === false);
331
332
  let modal_children;
332
333
  if(dialog) {
334
+ /* Its glyphs are the size of a toolbar's (yui_toolbar_icon):
335
+ * a dialog is the phone's face of a window, whose bar draws
336
+ * them so too (7.32.9). Up to 7.32.8 they took the 16px of
337
+ * the title. */
333
338
  let header = ["div", {class: "MODAL_HEADER yui-dialog-header"}, [
334
339
  ["button", {class: "MODAL_BACK yui-dialog-back", type: "button", title: t("back"), "data-i18n-title": "back",
335
340
  "aria-label": t("back"), "data-i18n-aria-label": "back"},
336
- [["i", {class: "yi-arrow-left"}]]],
341
+ [yui_toolbar_icon("yi-arrow-left")]],
337
342
  ["span", {class: "MODAL_TITLE yui-dialog-title"}, title_halves],
338
343
  ["button", {class: "MODAL_CLOSE yui-dialog-x", type: "button", title: t("close"), "data-i18n-title": "close",
339
344
  "aria-label": t("close"), "data-i18n-aria-label": "close"},
340
- [["i", {class: "yi-xmark"}]]],
345
+ [yui_toolbar_icon("yi-xmark")]],
341
346
  ]];
342
347
  let body = ["div", {class: "MODAL_BODY yui-dialog-body"}, inner ? [inner] : []];
343
348
  modal_children = [
@@ -0,0 +1,84 @@
1
+ /***********************************************************************
2
+ * window_icon_size.wiring.test.js
3
+ *
4
+ * The glyphs of a window's title bar and of a dialog's header are
5
+ * the size of a toolbar's: YUI_TOOLBAR_ICON_SIZE (yui_toolbar_icon.js).
6
+ * A json cell of a treedb table opens in a C_YUI_WINDOW on a
7
+ * desktop and in a dialog of the shell on a phone, and a toolbar of
8
+ * 20px sits right under either header.
9
+ *
10
+ * Up to 7.32.8 the title icon took the 16px of the title, the
11
+ * minimize / maximize / close glyphs were drawn in a box of 15px
12
+ * (marks of 7.5 to 9.4px), and the back arrow and the close of a
13
+ * dialog took the 16px of its title.
14
+ *
15
+ * Driven through the real gclasses on a document double.
16
+ *
17
+ * Copyright (c) 2026, ArtGins.
18
+ * All Rights Reserved.
19
+ ***********************************************************************/
20
+ import {test, expect, beforeAll} from "vitest";
21
+ import {install_dom_double} from "../test/dom_double.js";
22
+
23
+ install_dom_double();
24
+
25
+ const {
26
+ SDATA_END, gclass_create, gobj_start_up, gobj_create_yuno, gobj_create,
27
+ gobj_create_service, gobj_start, gobj_read_attr,
28
+ } = await import("@yuneta/gobj-js");
29
+ const {register_c_yui_window} = await import("./c_yui_window.js");
30
+ const {register_c_yui_shell} = await import("./c_yui_shell.js");
31
+ const {yui_shell_show_modal} = await import("./shell_modals.js");
32
+ const {YUI_TOOLBAR_ICON_SIZE} = await import("./yui_toolbar_icon.js");
33
+
34
+ let yuno = null;
35
+ let shell = null;
36
+
37
+ beforeAll(async () => {
38
+ const i18next = (await import("i18next")).default;
39
+ await i18next.init({lng: "en", resources: {}});
40
+ gobj_start_up(null, null, null, null, null, null, null);
41
+ gclass_create("C_TEST_WIN_ICON_HOST", [], [["ST_IDLE", []]], {}, 0, [SDATA_END()], {}, 0, 0, 0, 0);
42
+ register_c_yui_window();
43
+ register_c_yui_shell();
44
+ yuno = gobj_create_yuno("win_icon_yuno", "C_TEST_WIN_ICON_HOST", {});
45
+ gobj_start(yuno);
46
+ shell = gobj_create("win_icon_shell", "C_YUI_SHELL",
47
+ {config: {shell: {}}, default_route: "/home"}, yuno);
48
+ gobj_start(shell);
49
+ });
50
+
51
+ /* The font size a glyph carries in its own style */
52
+ function size_of($i)
53
+ {
54
+ const m = /font-size:\s*([^;]+)/.exec(($i && $i.style.cssText) || "");
55
+ return m ? m[1].trim() : "";
56
+ }
57
+
58
+ test("the icon of a window's title is the size of a toolbar's", () => {
59
+ const w = gobj_create_service("win_icon_w", "C_YUI_WINDOW",
60
+ {title: "keys", title_prefix: "raw_events", icon: "yi-code",
61
+ body: ["div", {}, "w"]}, yuno);
62
+ gobj_start(w);
63
+ const $w = gobj_read_attr(w, "$container");
64
+ const $i = $w.querySelector(".WINDOW_TITLE .icon i.yi-code");
65
+ expect(size_of($i)).toBe(YUI_TOOLBAR_ICON_SIZE);
66
+ expect($i.getAttribute("aria-hidden")).toBe("true");
67
+ });
68
+
69
+ test("the glyphs of minimize, maximize and close are drawn in a box of that size", () => {
70
+ const css = document.getElementById("yui-window-style").textContent;
71
+ expect(css).toContain(`.yui-wc svg { width: ${YUI_TOOLBAR_ICON_SIZE}; height: ${YUI_TOOLBAR_ICON_SIZE};`);
72
+ expect(css).toContain(`.yui-window-title svg { width: ${YUI_TOOLBAR_ICON_SIZE}; height: ${YUI_TOOLBAR_ICON_SIZE};`);
73
+ /* One size on a phone too: the buttons grow there, not the glyphs. */
74
+ expect(css).not.toMatch(/\.yui-wc svg \{ width: \d+px/);
75
+ });
76
+
77
+ test("the back arrow and the close of a dialog are the size of a toolbar's", () => {
78
+ const handle = yui_shell_show_modal(shell, document.createElement("div"),
79
+ {dialog: true, title: "keys", logical_class: "ICON_SIZE_SHEET"});
80
+ const $modal = document.querySelector(".ICON_SIZE_SHEET");
81
+ expect(size_of($modal.querySelector(".MODAL_BACK i.yi-arrow-left"))).toBe(YUI_TOOLBAR_ICON_SIZE);
82
+ expect(size_of($modal.querySelector(".MODAL_CLOSE i.yi-xmark"))).toBe(YUI_TOOLBAR_ICON_SIZE);
83
+ handle.close();
84
+ });
@@ -18,50 +18,8 @@ import {t} from "i18next";
18
18
 
19
19
  import "./yui_toolbar.css"; // Must be in index.js ?
20
20
 
21
+ import {yui_toolbar_icon, YUI_TOOLBAR_ICON_SIZE} from "./yui_toolbar_icon.js";
21
22
 
22
- /************************************************************
23
- * ONE size for every glyph of a view's toolbar, in `rem`.
24
- *
25
- * It lives here because it belongs to the TOOLBAR and not to
26
- * any one view: it was born in the graph rows (7.23.86) and the
27
- * JSON viewer beside them still drew 16px, which is the same
28
- * drift one level up.
29
- *
30
- * `rem` and not `em` is the whole lesson: `em` is measured
31
- * against the button, so one declaration draws three icons --
32
- * `1.5em` is 24px in a plain button, 18px in an `is-small`
33
- * chip, and a labelled button that declares nothing keeps the
34
- * inherited 16px. `rem` is measured against the page, so a
35
- * chip deliberately shorter than a button still carries the
36
- * same glyph.
37
- *
38
- * 20px against a row's 16px text: an icon-only button is
39
- * legible at half its 40px height, and beside a label the
40
- * glyph reads as a marker rather than as a second word. The
41
- * app BAR is a different band and keeps its own, bigger size
42
- * (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
43
- *
44
- * It is also the size of the glyphs of the TABS and of the
45
- * MENU entries (C_YUI_NAV, the topic tabs of
46
- * C_YUI_TREEDB_TOPICS), and of the paginator of a table on a
47
- * phone (tabulator.css). Up to 7.32.6 a tab took the 16px of
48
- * its text, and right under a toolbar its icons read as
49
- * smaller than the toolbar's. The rows of a tab or a menu
50
- * entry are 24px of line, so the glyph changes no height.
51
- ************************************************************/
52
- const YUI_TOOLBAR_ICON_SIZE = "1.25rem";
53
-
54
- /* The `<i>` spec of a toolbar glyph, at that one size. The
55
- * glyph is decoration: the control around it carries the name. */
56
- function yui_toolbar_icon(icon_class, extra_style)
57
- {
58
- return ['i', {
59
- class: icon_class,
60
- 'aria-hidden': 'true',
61
- style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` +
62
- (extra_style || ''),
63
- }];
64
- }
65
23
 
66
24
  function yui_toolbar(attrs={}, items = [])
67
25
  {
@@ -0,0 +1,63 @@
1
+ /***********************************************************************
2
+ * yui_toolbar_icon.js
3
+ *
4
+ * The one size of the glyphs of a row of controls, and the
5
+ * `<i>` that draws one at it.
6
+ *
7
+ * A module of its own, with no key and no CSS, so that a view
8
+ * can take the size without taking the toolbar widget. In
9
+ * 7.32.7 C_YUI_NAV imported it from yui_toolbar.js, and every
10
+ * app that mounts a nav had to define the keys of the toolbar's
11
+ * scroll arrows ("scroll left", "scroll right"), which
12
+ * validate-locales reads in every module the app imports.
13
+ * yui_toolbar.js exports the two names too, as before.
14
+ *
15
+ * Copyright (c) 2026, ArtGins.
16
+ * All Rights Reserved.
17
+ ***********************************************************************/
18
+
19
+ /************************************************************
20
+ * ONE size for every glyph of a view's toolbar, in `rem`.
21
+ *
22
+ * It lives here because it belongs to the TOOLBAR and not to
23
+ * any one view: it was born in the graph rows (7.23.86) and the
24
+ * JSON viewer beside them still drew 16px, which is the same
25
+ * drift one level up.
26
+ *
27
+ * `rem` and not `em` is the whole lesson: `em` is measured
28
+ * against the button, so one declaration draws three icons --
29
+ * `1.5em` is 24px in a plain button, 18px in an `is-small`
30
+ * chip, and a labelled button that declares nothing keeps the
31
+ * inherited 16px. `rem` is measured against the page, so a
32
+ * chip deliberately shorter than a button still carries the
33
+ * same glyph.
34
+ *
35
+ * 20px against a row's 16px text: an icon-only button is
36
+ * legible at half its 40px height, and beside a label the
37
+ * glyph reads as a marker rather than as a second word. The
38
+ * app BAR is a different band and keeps its own, bigger size
39
+ * (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
40
+ *
41
+ * It is also the size of the glyphs of the TABS and of the
42
+ * MENU entries (C_YUI_NAV, the topic tabs of
43
+ * C_YUI_TREEDB_TOPICS), and of the paginator of a table on a
44
+ * phone (tabulator.css). Up to 7.32.6 a tab took the 16px of
45
+ * its text, and right under a toolbar its icons read as
46
+ * smaller than the toolbar's. The rows of a tab or a menu
47
+ * entry are 24px of line, so the glyph changes no height.
48
+ ************************************************************/
49
+ const YUI_TOOLBAR_ICON_SIZE = "1.25rem";
50
+
51
+ /* The `<i>` spec of a toolbar glyph, at that one size. The
52
+ * glyph is decoration: the control around it carries the name. */
53
+ function yui_toolbar_icon(icon_class, extra_style)
54
+ {
55
+ return ['i', {
56
+ class: icon_class,
57
+ 'aria-hidden': 'true',
58
+ style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` +
59
+ (extra_style || ''),
60
+ }];
61
+ }
62
+
63
+ export {yui_toolbar_icon, YUI_TOOLBAR_ICON_SIZE};