@yuneta/gobj-ui 7.32.8 → 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 +6 -3
- package/dist/gobj-ui.cjs.js +61 -62
- package/dist/gobj-ui.es.js +61 -62
- package/package.json +1 -1
- package/src/c_yui_window.js +13 -5
- package/src/shell_modals.js +7 -2
- package/src/window_icon_size.wiring.test.js +84 -0
package/README.md
CHANGED
|
@@ -4534,9 +4534,12 @@ text is in the yunetas `CLAUDE.md` ("JS GUI conventions"); in short:
|
|
|
4534
4534
|
define the keys of every module that it imports, and `yui_toolbar.js`
|
|
4535
4535
|
carries the keys of the scroll arrows.
|
|
4536
4536
|
|
|
4537
|
-
The
|
|
4538
|
-
|
|
4539
|
-
|
|
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
|
|
4540
4543
|
their text, 16px. Under a toolbar of 20px their icons looked smaller.
|
|
4541
4544
|
- **Bulma helpers carry `!important`** (`.is-hidden`, `.is-flex`): toggle
|
|
4542
4545
|
`is-hidden`, or use `style.setProperty('display', 'none', 'important')`.
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -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
|
-
[
|
|
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
|
-
[
|
|
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:
|
|
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:
|
|
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
|
-
[
|
|
5338
|
+
[yui_toolbar_icon(icon)]
|
|
5284
5339
|
]);
|
|
5285
5340
|
}
|
|
5286
5341
|
if (!(0, _yuneta_gobj_js.empty_string)(prefix)) items.push([
|
|
@@ -16557,62 +16612,6 @@ function create_gclass$15(gclass_name) {
|
|
|
16557
16612
|
function register_c_yui_uplot() {
|
|
16558
16613
|
return create_gclass$15(GCLASS_NAME$15);
|
|
16559
16614
|
}
|
|
16560
|
-
// src/yui_toolbar_icon.js
|
|
16561
|
-
/***********************************************************************
|
|
16562
|
-
* yui_toolbar_icon.js
|
|
16563
|
-
*
|
|
16564
|
-
* The one size of the glyphs of a row of controls, and the
|
|
16565
|
-
* `<i>` that draws one at it.
|
|
16566
|
-
*
|
|
16567
|
-
* A module of its own, with no key and no CSS, so that a view
|
|
16568
|
-
* can take the size without taking the toolbar widget. In
|
|
16569
|
-
* 7.32.7 C_YUI_NAV imported it from yui_toolbar.js, and every
|
|
16570
|
-
* app that mounts a nav had to define the keys of the toolbar's
|
|
16571
|
-
* scroll arrows ("scroll left", "scroll right"), which
|
|
16572
|
-
* validate-locales reads in every module the app imports.
|
|
16573
|
-
* yui_toolbar.js exports the two names too, as before.
|
|
16574
|
-
*
|
|
16575
|
-
* Copyright (c) 2026, ArtGins.
|
|
16576
|
-
* All Rights Reserved.
|
|
16577
|
-
***********************************************************************/
|
|
16578
|
-
/************************************************************
|
|
16579
|
-
* ONE size for every glyph of a view's toolbar, in `rem`.
|
|
16580
|
-
*
|
|
16581
|
-
* It lives here because it belongs to the TOOLBAR and not to
|
|
16582
|
-
* any one view: it was born in the graph rows (7.23.86) and the
|
|
16583
|
-
* JSON viewer beside them still drew 16px, which is the same
|
|
16584
|
-
* drift one level up.
|
|
16585
|
-
*
|
|
16586
|
-
* `rem` and not `em` is the whole lesson: `em` is measured
|
|
16587
|
-
* against the button, so one declaration draws three icons --
|
|
16588
|
-
* `1.5em` is 24px in a plain button, 18px in an `is-small`
|
|
16589
|
-
* chip, and a labelled button that declares nothing keeps the
|
|
16590
|
-
* inherited 16px. `rem` is measured against the page, so a
|
|
16591
|
-
* chip deliberately shorter than a button still carries the
|
|
16592
|
-
* same glyph.
|
|
16593
|
-
*
|
|
16594
|
-
* 20px against a row's 16px text: an icon-only button is
|
|
16595
|
-
* legible at half its 40px height, and beside a label the
|
|
16596
|
-
* glyph reads as a marker rather than as a second word. The
|
|
16597
|
-
* app BAR is a different band and keeps its own, bigger size
|
|
16598
|
-
* (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
|
|
16599
|
-
*
|
|
16600
|
-
* It is also the size of the glyphs of the TABS and of the
|
|
16601
|
-
* MENU entries (C_YUI_NAV, the topic tabs of
|
|
16602
|
-
* C_YUI_TREEDB_TOPICS), and of the paginator of a table on a
|
|
16603
|
-
* phone (tabulator.css). Up to 7.32.6 a tab took the 16px of
|
|
16604
|
-
* its text, and right under a toolbar its icons read as
|
|
16605
|
-
* smaller than the toolbar's. The rows of a tab or a menu
|
|
16606
|
-
* entry are 24px of line, so the glyph changes no height.
|
|
16607
|
-
************************************************************/
|
|
16608
|
-
var YUI_TOOLBAR_ICON_SIZE = "1.25rem";
|
|
16609
|
-
function yui_toolbar_icon(icon_class, extra_style) {
|
|
16610
|
-
return ["i", {
|
|
16611
|
-
class: icon_class,
|
|
16612
|
-
"aria-hidden": "true",
|
|
16613
|
-
style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
|
|
16614
|
-
}];
|
|
16615
|
-
}
|
|
16616
16615
|
// src/yui_toolbar.js
|
|
16617
16616
|
function yui_toolbar(attrs = {}, items = []) {
|
|
16618
16617
|
function arrow_button(side, icon, label) {
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -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
|
-
[
|
|
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
|
-
[
|
|
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:
|
|
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:
|
|
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
|
-
[
|
|
5333
|
+
[yui_toolbar_icon(icon)]
|
|
5279
5334
|
]);
|
|
5280
5335
|
}
|
|
5281
5336
|
if (!empty_string(prefix)) items.push([
|
|
@@ -16552,62 +16607,6 @@ function create_gclass$15(gclass_name) {
|
|
|
16552
16607
|
function register_c_yui_uplot() {
|
|
16553
16608
|
return create_gclass$15(GCLASS_NAME$15);
|
|
16554
16609
|
}
|
|
16555
|
-
// src/yui_toolbar_icon.js
|
|
16556
|
-
/***********************************************************************
|
|
16557
|
-
* yui_toolbar_icon.js
|
|
16558
|
-
*
|
|
16559
|
-
* The one size of the glyphs of a row of controls, and the
|
|
16560
|
-
* `<i>` that draws one at it.
|
|
16561
|
-
*
|
|
16562
|
-
* A module of its own, with no key and no CSS, so that a view
|
|
16563
|
-
* can take the size without taking the toolbar widget. In
|
|
16564
|
-
* 7.32.7 C_YUI_NAV imported it from yui_toolbar.js, and every
|
|
16565
|
-
* app that mounts a nav had to define the keys of the toolbar's
|
|
16566
|
-
* scroll arrows ("scroll left", "scroll right"), which
|
|
16567
|
-
* validate-locales reads in every module the app imports.
|
|
16568
|
-
* yui_toolbar.js exports the two names too, as before.
|
|
16569
|
-
*
|
|
16570
|
-
* Copyright (c) 2026, ArtGins.
|
|
16571
|
-
* All Rights Reserved.
|
|
16572
|
-
***********************************************************************/
|
|
16573
|
-
/************************************************************
|
|
16574
|
-
* ONE size for every glyph of a view's toolbar, in `rem`.
|
|
16575
|
-
*
|
|
16576
|
-
* It lives here because it belongs to the TOOLBAR and not to
|
|
16577
|
-
* any one view: it was born in the graph rows (7.23.86) and the
|
|
16578
|
-
* JSON viewer beside them still drew 16px, which is the same
|
|
16579
|
-
* drift one level up.
|
|
16580
|
-
*
|
|
16581
|
-
* `rem` and not `em` is the whole lesson: `em` is measured
|
|
16582
|
-
* against the button, so one declaration draws three icons --
|
|
16583
|
-
* `1.5em` is 24px in a plain button, 18px in an `is-small`
|
|
16584
|
-
* chip, and a labelled button that declares nothing keeps the
|
|
16585
|
-
* inherited 16px. `rem` is measured against the page, so a
|
|
16586
|
-
* chip deliberately shorter than a button still carries the
|
|
16587
|
-
* same glyph.
|
|
16588
|
-
*
|
|
16589
|
-
* 20px against a row's 16px text: an icon-only button is
|
|
16590
|
-
* legible at half its 40px height, and beside a label the
|
|
16591
|
-
* glyph reads as a marker rather than as a second word. The
|
|
16592
|
-
* app BAR is a different band and keeps its own, bigger size
|
|
16593
|
-
* (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
|
|
16594
|
-
*
|
|
16595
|
-
* It is also the size of the glyphs of the TABS and of the
|
|
16596
|
-
* MENU entries (C_YUI_NAV, the topic tabs of
|
|
16597
|
-
* C_YUI_TREEDB_TOPICS), and of the paginator of a table on a
|
|
16598
|
-
* phone (tabulator.css). Up to 7.32.6 a tab took the 16px of
|
|
16599
|
-
* its text, and right under a toolbar its icons read as
|
|
16600
|
-
* smaller than the toolbar's. The rows of a tab or a menu
|
|
16601
|
-
* entry are 24px of line, so the glyph changes no height.
|
|
16602
|
-
************************************************************/
|
|
16603
|
-
var YUI_TOOLBAR_ICON_SIZE = "1.25rem";
|
|
16604
|
-
function yui_toolbar_icon(icon_class, extra_style) {
|
|
16605
|
-
return ["i", {
|
|
16606
|
-
class: icon_class,
|
|
16607
|
-
"aria-hidden": "true",
|
|
16608
|
-
style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
|
|
16609
|
-
}];
|
|
16610
|
-
}
|
|
16611
16610
|
// src/yui_toolbar.js
|
|
16612
16611
|
function yui_toolbar(attrs = {}, items = []) {
|
|
16613
16612
|
function arrow_button(side, icon, label) {
|
package/package.json
CHANGED
package/src/c_yui_window.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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
|
-
|
|
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)) {
|
package/src/shell_modals.js
CHANGED
|
@@ -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
|
-
[
|
|
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
|
-
[
|
|
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
|
+
});
|