@yuneta/gobj-ui 7.23.102 → 7.23.103
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/dist/gobj-ui.cjs.js +12 -13
- package/dist/gobj-ui.es.js +12 -13
- package/package.json +1 -1
- package/src/c_yui_gclass.js +2 -2
- package/src/c_yui_json.css +8 -8
- package/src/c_yui_json.js +6 -7
- package/src/c_yui_period.js +15 -15
- package/src/c_yui_treedb_graph.js +5 -1
- package/src/yui_toolbar.css +33 -0
- package/src/yui_toolbar.js +22 -1
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -13420,12 +13420,11 @@ function icon_button$1(gobj, icon, event_name, label_key) {
|
|
|
13420
13420
|
* aimed — reaching the graph from the tree would mean passing
|
|
13421
13421
|
* through the text and rebuilding it on the way — so each view gets
|
|
13422
13422
|
* its own button and says where it goes. apply_view_mode() moves
|
|
13423
|
-
* the `
|
|
13424
|
-
*
|
|
13425
|
-
*
|
|
13426
|
-
*
|
|
13427
|
-
*
|
|
13428
|
-
* thing the library already had a name for.
|
|
13423
|
+
* the `selected_state` mark -- the library's one way of saying
|
|
13424
|
+
* WHICH segment of a selector is chosen, filled with the link
|
|
13425
|
+
* colour. It used to be `is-active` with a fill written here: the
|
|
13426
|
+
* right idea, spelled a third time. A toggle, which has no "which
|
|
13427
|
+
* one" to answer, wears the neutral `pressed_state` pill instead.
|
|
13429
13428
|
************************************************************/
|
|
13430
13429
|
function view_mode_switch$1(gobj) {
|
|
13431
13430
|
return [
|
|
@@ -13522,7 +13521,7 @@ function apply_view_mode$1(gobj) {
|
|
|
13522
13521
|
if ($el) $el.classList.toggle("is-hidden", mode !== "tree");
|
|
13523
13522
|
});
|
|
13524
13523
|
if (priv.$mode_btns) for (let [m, $btn] of priv.$mode_btns) {
|
|
13525
|
-
$btn.classList.toggle("
|
|
13524
|
+
$btn.classList.toggle("selected_state", m === mode);
|
|
13526
13525
|
$btn.setAttribute("aria-pressed", m === mode ? "true" : "false");
|
|
13527
13526
|
}
|
|
13528
13527
|
}
|
|
@@ -15829,7 +15828,7 @@ function apply_view_mode(gobj) {
|
|
|
15829
15828
|
};
|
|
15830
15829
|
for (let [m, $el] of Object.entries(bodies)) if ($el) $el.classList.toggle("is-hidden", m !== mode);
|
|
15831
15830
|
if (priv.$mode_btns) for (let [m, $btn] of priv.$mode_btns) {
|
|
15832
|
-
$btn.classList.toggle("
|
|
15831
|
+
$btn.classList.toggle("selected_state", m === mode);
|
|
15833
15832
|
$btn.setAttribute("aria-pressed", m === mode ? "true" : "false");
|
|
15834
15833
|
}
|
|
15835
15834
|
}
|
|
@@ -16582,7 +16581,7 @@ function machine_view_switch(gobj) {
|
|
|
16582
16581
|
return [
|
|
16583
16582
|
"button",
|
|
16584
16583
|
{
|
|
16585
|
-
class: `button is-small GCLASS_MACHINE_VIEW GCLASS_MACHINE_VIEW_${v.mode.toUpperCase()}` + (on ? "
|
|
16584
|
+
class: `button is-small GCLASS_MACHINE_VIEW GCLASS_MACHINE_VIEW_${v.mode.toUpperCase()}` + (on ? " selected_state" : ""),
|
|
16586
16585
|
type: "button",
|
|
16587
16586
|
"aria-pressed": on ? "true" : "false",
|
|
16588
16587
|
title: (0, i18next.t)(v.key),
|
|
@@ -62402,7 +62401,7 @@ function refresh_node_shape_buttons(gobj, $root) {
|
|
|
62402
62401
|
let labels = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "node_labels");
|
|
62403
62402
|
for (let $btn of $root.querySelectorAll(".GRAPH_NODE_MODE_BTN")) {
|
|
62404
62403
|
let on = $btn.getAttribute("data-mode") === mode;
|
|
62405
|
-
$btn.classList.toggle("
|
|
62404
|
+
$btn.classList.toggle("selected_state", on);
|
|
62406
62405
|
$btn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
62407
62406
|
}
|
|
62408
62407
|
set_pressed_state($root, ".GRAPH_NODE_LABELS", labels);
|
|
@@ -71061,12 +71060,12 @@ function repaint(gobj) {
|
|
|
71061
71060
|
if (on) m.$btn.setAttribute("aria-current", "true");
|
|
71062
71061
|
else m.$btn.removeAttribute("aria-current");
|
|
71063
71062
|
} else {
|
|
71064
|
-
m.$btn.classList.toggle("
|
|
71063
|
+
m.$btn.classList.toggle("selected_state", on);
|
|
71065
71064
|
m.$btn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
71066
71065
|
}
|
|
71067
71066
|
}
|
|
71068
71067
|
if (mode && mode.$btn) scroll_mode_into_view(gobj, mode.$btn);
|
|
71069
|
-
if (priv.$more) priv.$more.classList.toggle("
|
|
71068
|
+
if (priv.$more) priv.$more.classList.toggle("selected_state", !!(mode && mode.overflow));
|
|
71070
71069
|
let is_bucket = !!(mode && mode.kind === "bucket");
|
|
71071
71070
|
priv.$nav.classList.toggle("yui-period-nav-off", !is_bucket);
|
|
71072
71071
|
priv.$label.disabled = !is_bucket;
|
|
@@ -71257,7 +71256,7 @@ function cell_button(gobj, label, anchor_ms, selected, logical, aria) {
|
|
|
71257
71256
|
let $btn = (0, _yuneta_gobj_js.createElement2)([
|
|
71258
71257
|
"button",
|
|
71259
71258
|
{
|
|
71260
|
-
class: `button is-small ${selected ? "
|
|
71259
|
+
class: `button is-small ${selected ? "selected_state" : "is-ghost"} ${logical}`,
|
|
71261
71260
|
type: "button",
|
|
71262
71261
|
style: "width:100%;",
|
|
71263
71262
|
...selected ? { "aria-current": "date" } : {},
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -13415,12 +13415,11 @@ function icon_button$1(gobj, icon, event_name, label_key) {
|
|
|
13415
13415
|
* aimed — reaching the graph from the tree would mean passing
|
|
13416
13416
|
* through the text and rebuilding it on the way — so each view gets
|
|
13417
13417
|
* its own button and says where it goes. apply_view_mode() moves
|
|
13418
|
-
* the `
|
|
13419
|
-
*
|
|
13420
|
-
*
|
|
13421
|
-
*
|
|
13422
|
-
*
|
|
13423
|
-
* thing the library already had a name for.
|
|
13418
|
+
* the `selected_state` mark -- the library's one way of saying
|
|
13419
|
+
* WHICH segment of a selector is chosen, filled with the link
|
|
13420
|
+
* colour. It used to be `is-active` with a fill written here: the
|
|
13421
|
+
* right idea, spelled a third time. A toggle, which has no "which
|
|
13422
|
+
* one" to answer, wears the neutral `pressed_state` pill instead.
|
|
13424
13423
|
************************************************************/
|
|
13425
13424
|
function view_mode_switch$1(gobj) {
|
|
13426
13425
|
return [
|
|
@@ -13517,7 +13516,7 @@ function apply_view_mode$1(gobj) {
|
|
|
13517
13516
|
if ($el) $el.classList.toggle("is-hidden", mode !== "tree");
|
|
13518
13517
|
});
|
|
13519
13518
|
if (priv.$mode_btns) for (let [m, $btn] of priv.$mode_btns) {
|
|
13520
|
-
$btn.classList.toggle("
|
|
13519
|
+
$btn.classList.toggle("selected_state", m === mode);
|
|
13521
13520
|
$btn.setAttribute("aria-pressed", m === mode ? "true" : "false");
|
|
13522
13521
|
}
|
|
13523
13522
|
}
|
|
@@ -15824,7 +15823,7 @@ function apply_view_mode(gobj) {
|
|
|
15824
15823
|
};
|
|
15825
15824
|
for (let [m, $el] of Object.entries(bodies)) if ($el) $el.classList.toggle("is-hidden", m !== mode);
|
|
15826
15825
|
if (priv.$mode_btns) for (let [m, $btn] of priv.$mode_btns) {
|
|
15827
|
-
$btn.classList.toggle("
|
|
15826
|
+
$btn.classList.toggle("selected_state", m === mode);
|
|
15828
15827
|
$btn.setAttribute("aria-pressed", m === mode ? "true" : "false");
|
|
15829
15828
|
}
|
|
15830
15829
|
}
|
|
@@ -16577,7 +16576,7 @@ function machine_view_switch(gobj) {
|
|
|
16577
16576
|
return [
|
|
16578
16577
|
"button",
|
|
16579
16578
|
{
|
|
16580
|
-
class: `button is-small GCLASS_MACHINE_VIEW GCLASS_MACHINE_VIEW_${v.mode.toUpperCase()}` + (on ? "
|
|
16579
|
+
class: `button is-small GCLASS_MACHINE_VIEW GCLASS_MACHINE_VIEW_${v.mode.toUpperCase()}` + (on ? " selected_state" : ""),
|
|
16581
16580
|
type: "button",
|
|
16582
16581
|
"aria-pressed": on ? "true" : "false",
|
|
16583
16582
|
title: t(v.key),
|
|
@@ -62397,7 +62396,7 @@ function refresh_node_shape_buttons(gobj, $root) {
|
|
|
62397
62396
|
let labels = gobj_read_bool_attr(gobj, "node_labels");
|
|
62398
62397
|
for (let $btn of $root.querySelectorAll(".GRAPH_NODE_MODE_BTN")) {
|
|
62399
62398
|
let on = $btn.getAttribute("data-mode") === mode;
|
|
62400
|
-
$btn.classList.toggle("
|
|
62399
|
+
$btn.classList.toggle("selected_state", on);
|
|
62401
62400
|
$btn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
62402
62401
|
}
|
|
62403
62402
|
set_pressed_state($root, ".GRAPH_NODE_LABELS", labels);
|
|
@@ -71056,12 +71055,12 @@ function repaint(gobj) {
|
|
|
71056
71055
|
if (on) m.$btn.setAttribute("aria-current", "true");
|
|
71057
71056
|
else m.$btn.removeAttribute("aria-current");
|
|
71058
71057
|
} else {
|
|
71059
|
-
m.$btn.classList.toggle("
|
|
71058
|
+
m.$btn.classList.toggle("selected_state", on);
|
|
71060
71059
|
m.$btn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
71061
71060
|
}
|
|
71062
71061
|
}
|
|
71063
71062
|
if (mode && mode.$btn) scroll_mode_into_view(gobj, mode.$btn);
|
|
71064
|
-
if (priv.$more) priv.$more.classList.toggle("
|
|
71063
|
+
if (priv.$more) priv.$more.classList.toggle("selected_state", !!(mode && mode.overflow));
|
|
71065
71064
|
let is_bucket = !!(mode && mode.kind === "bucket");
|
|
71066
71065
|
priv.$nav.classList.toggle("yui-period-nav-off", !is_bucket);
|
|
71067
71066
|
priv.$label.disabled = !is_bucket;
|
|
@@ -71252,7 +71251,7 @@ function cell_button(gobj, label, anchor_ms, selected, logical, aria) {
|
|
|
71252
71251
|
let $btn = createElement2([
|
|
71253
71252
|
"button",
|
|
71254
71253
|
{
|
|
71255
|
-
class: `button is-small ${selected ? "
|
|
71254
|
+
class: `button is-small ${selected ? "selected_state" : "is-ghost"} ${logical}`,
|
|
71256
71255
|
type: "button",
|
|
71257
71256
|
style: "width:100%;",
|
|
71258
71257
|
...selected ? { "aria-current": "date" } : {},
|
package/package.json
CHANGED
package/src/c_yui_gclass.js
CHANGED
|
@@ -404,7 +404,7 @@ function apply_view_mode(gobj)
|
|
|
404
404
|
|
|
405
405
|
if(priv.$mode_btns) {
|
|
406
406
|
for(let [m, $btn] of priv.$mode_btns) {
|
|
407
|
-
$btn.classList.toggle('
|
|
407
|
+
$btn.classList.toggle('selected_state', m === mode);
|
|
408
408
|
$btn.setAttribute("aria-pressed", (m === mode)? "true": "false");
|
|
409
409
|
}
|
|
410
410
|
}
|
|
@@ -983,7 +983,7 @@ function machine_view_switch(gobj)
|
|
|
983
983
|
let on = (priv.machine_view === v.mode);
|
|
984
984
|
return ['button', {class: 'button is-small GCLASS_MACHINE_VIEW ' +
|
|
985
985
|
`GCLASS_MACHINE_VIEW_${v.mode.toUpperCase()}` +
|
|
986
|
-
(on? '
|
|
986
|
+
(on? ' selected_state': ''),
|
|
987
987
|
type: 'button',
|
|
988
988
|
'aria-pressed': on? 'true': 'false',
|
|
989
989
|
title: t(v.key), 'data-i18n-title': v.key,
|
package/src/c_yui_json.css
CHANGED
|
@@ -283,14 +283,14 @@
|
|
|
283
283
|
margin-bottom: 0;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
/* The current view is marked with `
|
|
287
|
-
*
|
|
288
|
-
* used to fill itself
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
.C_YUI_JSON .JSON_VIEW_MODE.
|
|
286
|
+
/* The current view is marked with `selected_state` (`yui_toolbar.css`):
|
|
287
|
+
* the library's one way of saying WHICH segment of a selector is
|
|
288
|
+
* chosen. This switch used to write that fill here itself -- the right
|
|
289
|
+
* idea in the wrong place, since the same question is answered by the
|
|
290
|
+
* graph's node modes, the map's modes and the period's granularities.
|
|
291
|
+
* `z-index` is all that is left, so the marked button's border wins
|
|
292
|
+
* over its neighbours' in the `has-addons` group. */
|
|
293
|
+
.C_YUI_JSON .JSON_VIEW_MODE.selected_state {
|
|
294
294
|
z-index: 1;
|
|
295
295
|
}
|
|
296
296
|
|
package/src/c_yui_json.js
CHANGED
|
@@ -442,12 +442,11 @@ function icon_button(gobj, icon, event_name, label_key)
|
|
|
442
442
|
* aimed — reaching the graph from the tree would mean passing
|
|
443
443
|
* through the text and rebuilding it on the way — so each view gets
|
|
444
444
|
* its own button and says where it goes. apply_view_mode() moves
|
|
445
|
-
* the `
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
* thing the library already had a name for.
|
|
445
|
+
* the `selected_state` mark -- the library's one way of saying
|
|
446
|
+
* WHICH segment of a selector is chosen, filled with the link
|
|
447
|
+
* colour. It used to be `is-active` with a fill written here: the
|
|
448
|
+
* right idea, spelled a third time. A toggle, which has no "which
|
|
449
|
+
* one" to answer, wears the neutral `pressed_state` pill instead.
|
|
451
450
|
************************************************************/
|
|
452
451
|
function view_mode_switch(gobj)
|
|
453
452
|
{
|
|
@@ -558,7 +557,7 @@ function apply_view_mode(gobj)
|
|
|
558
557
|
|
|
559
558
|
if(priv.$mode_btns) {
|
|
560
559
|
for(let [m, $btn] of priv.$mode_btns) {
|
|
561
|
-
$btn.classList.toggle('
|
|
560
|
+
$btn.classList.toggle('selected_state', m === mode);
|
|
562
561
|
$btn.setAttribute("aria-pressed", (m === mode)? "true": "false");
|
|
563
562
|
}
|
|
564
563
|
}
|
package/src/c_yui_period.js
CHANGED
|
@@ -96,8 +96,9 @@ import {
|
|
|
96
96
|
|
|
97
97
|
import i18next, {t} from "i18next";
|
|
98
98
|
|
|
99
|
-
/* `yui_toolbar.css` for `
|
|
100
|
-
*
|
|
99
|
+
/* `yui_toolbar.css` for `selected_state`: the mark of the chosen
|
|
100
|
+
* segment of a selector lives with the toolbar, and a stylesheet
|
|
101
|
+
* rides its import. */
|
|
101
102
|
import "./yui_toolbar.css";
|
|
102
103
|
import "./c_yui_period.css";
|
|
103
104
|
|
|
@@ -702,13 +703,12 @@ function repaint(gobj)
|
|
|
702
703
|
let priv = gobj.priv;
|
|
703
704
|
let mode = cur_mode(gobj);
|
|
704
705
|
|
|
705
|
-
/*
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
* exactly what it is. */
|
|
706
|
+
/* This is a SELECTOR -- one granularity of several -- so the
|
|
707
|
+
* chosen segment is FILLED (`selected_state`, `yui_toolbar.css`),
|
|
708
|
+
* the same mark the graph's node modes and the map's modes wear.
|
|
709
|
+
* An overflow granularity is a `dropdown-item` and not a button,
|
|
710
|
+
* and there `is-active` is Bulma's own mark for the current item
|
|
711
|
+
* of a menu -- which is exactly what it is. */
|
|
712
712
|
for(let m of priv.modes) {
|
|
713
713
|
if(!m.$btn) {
|
|
714
714
|
continue;
|
|
@@ -724,7 +724,7 @@ function repaint(gobj)
|
|
|
724
724
|
m.$btn.removeAttribute("aria-current");
|
|
725
725
|
}
|
|
726
726
|
} else {
|
|
727
|
-
m.$btn.classList.toggle("
|
|
727
|
+
m.$btn.classList.toggle("selected_state", on);
|
|
728
728
|
m.$btn.setAttribute("aria-pressed", on? "true" : "false");
|
|
729
729
|
}
|
|
730
730
|
}
|
|
@@ -735,7 +735,7 @@ function repaint(gobj)
|
|
|
735
735
|
/* An overflow granularity in use must SAY so on the trigger: the
|
|
736
736
|
* control shows no active segment otherwise, and the user cannot
|
|
737
737
|
* tell a quarter from a month by the arrows alone. */
|
|
738
|
-
priv.$more.classList.toggle("
|
|
738
|
+
priv.$more.classList.toggle("selected_state", !!(mode && mode.overflow));
|
|
739
739
|
}
|
|
740
740
|
|
|
741
741
|
/* The navigator STAYS, disabled, in the modes with nothing to walk: it
|
|
@@ -1013,10 +1013,10 @@ function cell_button(gobj, label, anchor_ms, selected, logical, aria)
|
|
|
1013
1013
|
* year around it. */
|
|
1014
1014
|
let $btn = createElement2(
|
|
1015
1015
|
/* The ONE place `is-small` is earned: 42 cells in a popover. */
|
|
1016
|
-
/* The picked instant is
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1019
|
-
["button", {class: `button is-small ${selected? "
|
|
1016
|
+
/* The picked instant is the chosen one of a grid of 42, which
|
|
1017
|
+
* is the selector's question and not a toggle's, so it takes
|
|
1018
|
+
* the same fill. `aria-current="date"` says it to a reader. */
|
|
1019
|
+
["button", {class: `button is-small ${selected? "selected_state" : "is-ghost"} ${logical}`,
|
|
1020
1020
|
type: "button", style: "width:100%;",
|
|
1021
1021
|
...(selected? {"aria-current": "date"} : {}),
|
|
1022
1022
|
title: aria || "", "aria-label": aria || ""}, String(label)]);
|
|
@@ -652,9 +652,13 @@ function refresh_node_shape_buttons(gobj, $root)
|
|
|
652
652
|
mode = 'expanded';
|
|
653
653
|
}
|
|
654
654
|
let labels = gobj_read_bool_attr(gobj, "node_labels");
|
|
655
|
+
/* A SELECTOR, not a toggle: it picks one of three views, so the
|
|
656
|
+
* chosen segment is FILLED (`selected_state`) and not drawn as a
|
|
657
|
+
* pressed pill. The labels button below IS a toggle -- on or off,
|
|
658
|
+
* no "which one" -- and keeps the pill. */
|
|
655
659
|
for(let $btn of $root.querySelectorAll('.GRAPH_NODE_MODE_BTN')) {
|
|
656
660
|
let on = ($btn.getAttribute('data-mode') === mode);
|
|
657
|
-
$btn.classList.toggle('
|
|
661
|
+
$btn.classList.toggle('selected_state', on);
|
|
658
662
|
$btn.setAttribute('aria-pressed', on? 'true' : 'false');
|
|
659
663
|
}
|
|
660
664
|
set_pressed_state($root, '.GRAPH_NODE_LABELS', labels);
|
package/src/yui_toolbar.css
CHANGED
|
@@ -110,3 +110,36 @@ a.flex-horizontal-section { /* To make flex any <a> */
|
|
|
110
110
|
color: var(--bulma-background, #ffffff);
|
|
111
111
|
border-color: var(--bulma-text, #2e333d);
|
|
112
112
|
}
|
|
113
|
+
|
|
114
|
+
/*********************************************************
|
|
115
|
+
* The CHOSEN segment of a selector is FILLED
|
|
116
|
+
*
|
|
117
|
+
* Two different controls, two different marks, and telling them apart
|
|
118
|
+
* is the whole point:
|
|
119
|
+
*
|
|
120
|
+
* - a TOGGLE is on or off, and looks PRESSED (above) -- a neutral
|
|
121
|
+
* pill, no hue, because there is no "which one" to answer;
|
|
122
|
+
* - a SELECTOR picks ONE of N, and the chosen segment is FILLED with
|
|
123
|
+
* the link colour. A hue is what the eye finds in a row of
|
|
124
|
+
* identical grey buttons: measured against the button's own ground
|
|
125
|
+
* the fill is 5.14:1 in light and 3.53:1 in dark -- less luminance
|
|
126
|
+
* than the pressed pill (9.44 / 8.46) and a different HUE, which
|
|
127
|
+
* is what says "this one, of these".
|
|
128
|
+
*
|
|
129
|
+
* The raw `--bulma-link` and not `-on-scheme`: this is a FILL. The
|
|
130
|
+
* `-on-scheme` variants exist for a brand colour used as INK -- they
|
|
131
|
+
* darken it on a light scheme so text can sit on the page -- and a
|
|
132
|
+
* darkened fill under `link-invert` text is a button nobody asked for.
|
|
133
|
+
* Ink takes `-on-scheme`; a background takes the raw token and pairs
|
|
134
|
+
* it with `-invert`.
|
|
135
|
+
*
|
|
136
|
+
* `:hover` for the same reason as the pressed rule: without it, Bulma's
|
|
137
|
+
* `.button:hover` takes the fill back and the chosen segment appears to
|
|
138
|
+
* come unchosen under the pointer.
|
|
139
|
+
*********************************************************/
|
|
140
|
+
.button.selected_state,
|
|
141
|
+
.button.selected_state:hover {
|
|
142
|
+
background-color: var(--bulma-link, #3273dc);
|
|
143
|
+
border-color: var(--bulma-link, #3273dc);
|
|
144
|
+
color: var(--bulma-link-invert, #fff);
|
|
145
|
+
}
|
package/src/yui_toolbar.js
CHANGED
|
@@ -186,4 +186,25 @@ function set_pressed_state($container, selector, set)
|
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
/************************************************************
|
|
190
|
+
* Set or reset the CHOSEN state of one segment of a selector.
|
|
191
|
+
*
|
|
192
|
+
* Not the same control as a toggle, and not the same mark: a
|
|
193
|
+
* toggle is on or off and looks pressed (a neutral pill, no
|
|
194
|
+
* hue, because there is no "which one" to answer); a selector
|
|
195
|
+
* picks ONE of N and fills the chosen segment with the link
|
|
196
|
+
* colour, which is what the eye finds in a row of identical
|
|
197
|
+
* grey buttons. See `yui_toolbar.css` for the measurements.
|
|
198
|
+
************************************************************/
|
|
199
|
+
function set_selected_state($container, selector, set)
|
|
200
|
+
{
|
|
201
|
+
if(!$container) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
$container.querySelectorAll(selector).forEach(($el) => {
|
|
205
|
+
$el.classList.toggle("selected_state", !!set);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export {yui_toolbar, yui_toolbar_icon, YUI_TOOLBAR_ICON_SIZE,
|
|
210
|
+
set_pressed_state, set_selected_state};
|