@yuneta/gobj-ui 7.23.101 → 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 +21 -14
- package/dist/gobj-ui.es.js +21 -14
- 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 +30 -4
- 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);
|
|
@@ -71055,11 +71054,18 @@ function repaint(gobj) {
|
|
|
71055
71054
|
let mode = cur_mode(gobj);
|
|
71056
71055
|
for (let m of priv.modes) {
|
|
71057
71056
|
if (!m.$btn) continue;
|
|
71058
|
-
|
|
71059
|
-
|
|
71057
|
+
let on = m === mode;
|
|
71058
|
+
if (m.overflow) {
|
|
71059
|
+
m.$btn.classList.toggle("is-active", on);
|
|
71060
|
+
if (on) m.$btn.setAttribute("aria-current", "true");
|
|
71061
|
+
else m.$btn.removeAttribute("aria-current");
|
|
71062
|
+
} else {
|
|
71063
|
+
m.$btn.classList.toggle("selected_state", on);
|
|
71064
|
+
m.$btn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
71065
|
+
}
|
|
71060
71066
|
}
|
|
71061
71067
|
if (mode && mode.$btn) scroll_mode_into_view(gobj, mode.$btn);
|
|
71062
|
-
if (priv.$more) priv.$more.classList.toggle("
|
|
71068
|
+
if (priv.$more) priv.$more.classList.toggle("selected_state", !!(mode && mode.overflow));
|
|
71063
71069
|
let is_bucket = !!(mode && mode.kind === "bucket");
|
|
71064
71070
|
priv.$nav.classList.toggle("yui-period-nav-off", !is_bucket);
|
|
71065
71071
|
priv.$label.disabled = !is_bucket;
|
|
@@ -71250,9 +71256,10 @@ function cell_button(gobj, label, anchor_ms, selected, logical, aria) {
|
|
|
71250
71256
|
let $btn = (0, _yuneta_gobj_js.createElement2)([
|
|
71251
71257
|
"button",
|
|
71252
71258
|
{
|
|
71253
|
-
class: `button is-small ${selected ? "
|
|
71259
|
+
class: `button is-small ${selected ? "selected_state" : "is-ghost"} ${logical}`,
|
|
71254
71260
|
type: "button",
|
|
71255
71261
|
style: "width:100%;",
|
|
71262
|
+
...selected ? { "aria-current": "date" } : {},
|
|
71256
71263
|
title: aria || "",
|
|
71257
71264
|
"aria-label": aria || ""
|
|
71258
71265
|
},
|
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);
|
|
@@ -71050,11 +71049,18 @@ function repaint(gobj) {
|
|
|
71050
71049
|
let mode = cur_mode(gobj);
|
|
71051
71050
|
for (let m of priv.modes) {
|
|
71052
71051
|
if (!m.$btn) continue;
|
|
71053
|
-
|
|
71054
|
-
|
|
71052
|
+
let on = m === mode;
|
|
71053
|
+
if (m.overflow) {
|
|
71054
|
+
m.$btn.classList.toggle("is-active", on);
|
|
71055
|
+
if (on) m.$btn.setAttribute("aria-current", "true");
|
|
71056
|
+
else m.$btn.removeAttribute("aria-current");
|
|
71057
|
+
} else {
|
|
71058
|
+
m.$btn.classList.toggle("selected_state", on);
|
|
71059
|
+
m.$btn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
71060
|
+
}
|
|
71055
71061
|
}
|
|
71056
71062
|
if (mode && mode.$btn) scroll_mode_into_view(gobj, mode.$btn);
|
|
71057
|
-
if (priv.$more) priv.$more.classList.toggle("
|
|
71063
|
+
if (priv.$more) priv.$more.classList.toggle("selected_state", !!(mode && mode.overflow));
|
|
71058
71064
|
let is_bucket = !!(mode && mode.kind === "bucket");
|
|
71059
71065
|
priv.$nav.classList.toggle("yui-period-nav-off", !is_bucket);
|
|
71060
71066
|
priv.$label.disabled = !is_bucket;
|
|
@@ -71245,9 +71251,10 @@ function cell_button(gobj, label, anchor_ms, selected, logical, aria) {
|
|
|
71245
71251
|
let $btn = createElement2([
|
|
71246
71252
|
"button",
|
|
71247
71253
|
{
|
|
71248
|
-
class: `button is-small ${selected ? "
|
|
71254
|
+
class: `button is-small ${selected ? "selected_state" : "is-ghost"} ${logical}`,
|
|
71249
71255
|
type: "button",
|
|
71250
71256
|
style: "width:100%;",
|
|
71257
|
+
...selected ? { "aria-current": "date" } : {},
|
|
71251
71258
|
title: aria || "",
|
|
71252
71259
|
"aria-label": aria || ""
|
|
71253
71260
|
},
|
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,6 +96,10 @@ import {
|
|
|
96
96
|
|
|
97
97
|
import i18next, {t} from "i18next";
|
|
98
98
|
|
|
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. */
|
|
102
|
+
import "./yui_toolbar.css";
|
|
99
103
|
import "./c_yui_period.css";
|
|
100
104
|
|
|
101
105
|
|
|
@@ -699,12 +703,30 @@ function repaint(gobj)
|
|
|
699
703
|
let priv = gobj.priv;
|
|
700
704
|
let mode = cur_mode(gobj);
|
|
701
705
|
|
|
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. */
|
|
702
712
|
for(let m of priv.modes) {
|
|
703
713
|
if(!m.$btn) {
|
|
704
714
|
continue;
|
|
705
715
|
}
|
|
706
|
-
|
|
707
|
-
|
|
716
|
+
let on = (m === mode);
|
|
717
|
+
if(m.overflow) {
|
|
718
|
+
m.$btn.classList.toggle("is-active", on);
|
|
719
|
+
/* `aria-current` and not `aria-pressed`: the item is a link
|
|
720
|
+
* in a menu, and `aria-pressed` belongs to a button. */
|
|
721
|
+
if(on) {
|
|
722
|
+
m.$btn.setAttribute("aria-current", "true");
|
|
723
|
+
} else {
|
|
724
|
+
m.$btn.removeAttribute("aria-current");
|
|
725
|
+
}
|
|
726
|
+
} else {
|
|
727
|
+
m.$btn.classList.toggle("selected_state", on);
|
|
728
|
+
m.$btn.setAttribute("aria-pressed", on? "true" : "false");
|
|
729
|
+
}
|
|
708
730
|
}
|
|
709
731
|
if(mode && mode.$btn) {
|
|
710
732
|
scroll_mode_into_view(gobj, mode.$btn);
|
|
@@ -713,7 +735,7 @@ function repaint(gobj)
|
|
|
713
735
|
/* An overflow granularity in use must SAY so on the trigger: the
|
|
714
736
|
* control shows no active segment otherwise, and the user cannot
|
|
715
737
|
* tell a quarter from a month by the arrows alone. */
|
|
716
|
-
priv.$more.classList.toggle("
|
|
738
|
+
priv.$more.classList.toggle("selected_state", !!(mode && mode.overflow));
|
|
717
739
|
}
|
|
718
740
|
|
|
719
741
|
/* The navigator STAYS, disabled, in the modes with nothing to walk: it
|
|
@@ -991,8 +1013,12 @@ function cell_button(gobj, label, anchor_ms, selected, logical, aria)
|
|
|
991
1013
|
* year around it. */
|
|
992
1014
|
let $btn = createElement2(
|
|
993
1015
|
/* The ONE place `is-small` is earned: 42 cells in a popover. */
|
|
994
|
-
|
|
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}`,
|
|
995
1020
|
type: "button", style: "width:100%;",
|
|
1021
|
+
...(selected? {"aria-current": "date"} : {}),
|
|
996
1022
|
title: aria || "", "aria-label": aria || ""}, String(label)]);
|
|
997
1023
|
$btn.addEventListener("click", () => {
|
|
998
1024
|
gobj_send_event(gobj, "EV_DATE_PICKED", {anchor: anchor_ms}, gobj);
|
|
@@ -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};
|