@yuneta/gobj-ui 7.32.7 → 7.32.8
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 +10 -3
- package/dist/gobj-ui.cjs.js +19 -1
- package/dist/gobj-ui.es.js +19 -1
- package/package.json +1 -1
- package/src/c_yui_nav.js +1 -1
- package/src/nav_icon_size.wiring.test.js +18 -1
- package/src/yui_toolbar.js +1 -43
- package/src/yui_toolbar_icon.js +63 -0
package/README.md
CHANGED
|
@@ -4519,14 +4519,21 @@ 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
|
|
4523
|
-
|
|
4524
|
-
|
|
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
|
|
|
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
|
+
|
|
4530
4537
|
The app bar, the icon bar and the cards are other bands, with their own
|
|
4531
4538
|
bigger icons. The close mark of a tab is no icon of the tab and keeps the
|
|
4532
4539
|
size of its text. Up to 7.32.6 a tab and a menu entry took the size of
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -16557,7 +16557,24 @@ function create_gclass$15(gclass_name) {
|
|
|
16557
16557
|
function register_c_yui_uplot() {
|
|
16558
16558
|
return create_gclass$15(GCLASS_NAME$15);
|
|
16559
16559
|
}
|
|
16560
|
-
// src/
|
|
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
|
+
***********************************************************************/
|
|
16561
16578
|
/************************************************************
|
|
16562
16579
|
* ONE size for every glyph of a view's toolbar, in `rem`.
|
|
16563
16580
|
*
|
|
@@ -16596,6 +16613,7 @@ function yui_toolbar_icon(icon_class, extra_style) {
|
|
|
16596
16613
|
style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
|
|
16597
16614
|
}];
|
|
16598
16615
|
}
|
|
16616
|
+
// src/yui_toolbar.js
|
|
16599
16617
|
function yui_toolbar(attrs = {}, items = []) {
|
|
16600
16618
|
function arrow_button(side, icon, label) {
|
|
16601
16619
|
return [
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -16552,7 +16552,24 @@ function create_gclass$15(gclass_name) {
|
|
|
16552
16552
|
function register_c_yui_uplot() {
|
|
16553
16553
|
return create_gclass$15(GCLASS_NAME$15);
|
|
16554
16554
|
}
|
|
16555
|
-
// src/
|
|
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
|
+
***********************************************************************/
|
|
16556
16573
|
/************************************************************
|
|
16557
16574
|
* ONE size for every glyph of a view's toolbar, in `rem`.
|
|
16558
16575
|
*
|
|
@@ -16591,6 +16608,7 @@ function yui_toolbar_icon(icon_class, extra_style) {
|
|
|
16591
16608
|
style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
|
|
16592
16609
|
}];
|
|
16593
16610
|
}
|
|
16611
|
+
// src/yui_toolbar.js
|
|
16594
16612
|
function yui_toolbar(attrs = {}, items = []) {
|
|
16595
16613
|
function arrow_button(side, icon, label) {
|
|
16596
16614
|
return [
|
package/package.json
CHANGED
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 "./
|
|
114
|
+
import {yui_toolbar_icon} from "./yui_toolbar_icon.js";
|
|
115
115
|
|
|
116
116
|
/***************************************************************
|
|
117
117
|
* Constants
|
|
@@ -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 (
|
|
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
|
+
});
|
package/src/yui_toolbar.js
CHANGED
|
@@ -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};
|