@yuneta/gobj-ui 7.23.82 → 7.23.83
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 +7 -4
- package/dist/gobj-ui.cjs.js +63 -59
- package/dist/gobj-ui.es.js +63 -59
- package/package.json +1 -1
- package/src/c_yui_treedb_graph.js +38 -26
package/README.md
CHANGED
|
@@ -1364,10 +1364,13 @@ screen every card is a smudge. Since `7.23.82` a record has **three views**
|
|
|
1364
1364
|
popover's own scope: this node, the topic, every node), remembered as the
|
|
1365
1365
|
topic's default and saved per node in `__graphs__` as `node_shape`.
|
|
1366
1366
|
|
|
1367
|
-
In the view's toolbar (`C_YUI_TREEDB_GRAPH`), next to the fold pair:
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1367
|
+
In the view's toolbar (`C_YUI_TREEDB_GRAPH`), next to the fold pair: three
|
|
1368
|
+
push buttons in one group — a card, a line, a figure — the pressed one being
|
|
1369
|
+
the view that is on (`full` / `compact` / `shape`, persisted as `node_mode`;
|
|
1370
|
+
a change lays the graph out again, because a figure and a card do not take
|
|
1371
|
+
the same room; buttons and not a select since `7.23.83`, because a view is
|
|
1372
|
+
picked at a glance and a closed list says nothing until it is opened) and a
|
|
1373
|
+
labels toggle (`node_labels`, the name under each figure,
|
|
1371
1374
|
enabled in the `shape` view only — nothing moves, the label hangs outside the
|
|
1372
1375
|
figure and the layout measures the figure).
|
|
1373
1376
|
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -61911,68 +61911,64 @@ function option_label(name) {
|
|
|
61911
61911
|
* its context menu (the child's business).
|
|
61912
61912
|
************************************************************/
|
|
61913
61913
|
function node_shape_items(gobj, wide) {
|
|
61914
|
-
|
|
61915
|
-
"
|
|
61914
|
+
return [[
|
|
61915
|
+
"div",
|
|
61916
61916
|
{
|
|
61917
|
-
|
|
61918
|
-
"
|
|
61917
|
+
class: "GRAPH_NODE_MODE buttons has-addons",
|
|
61918
|
+
style: "margin:0 0 0 .5rem; flex:0 0 auto; flex-wrap:nowrap;"
|
|
61919
61919
|
},
|
|
61920
|
-
|
|
61921
|
-
|
|
61922
|
-
|
|
61923
|
-
|
|
61924
|
-
"span",
|
|
61925
|
-
{
|
|
61926
|
-
class: "GRAPH_NODE_MODE_LABEL is-hidden-mobile",
|
|
61927
|
-
style: "padding-left:10px; padding-right:5px;",
|
|
61928
|
-
i18n: "nodes"
|
|
61929
|
-
},
|
|
61930
|
-
"nodes"
|
|
61931
|
-
],
|
|
61932
|
-
[
|
|
61933
|
-
"div",
|
|
61934
|
-
{ class: "select" },
|
|
61935
|
-
[[
|
|
61936
|
-
"select",
|
|
61920
|
+
NODE_MODES.map((mode) => {
|
|
61921
|
+
let key = NODE_MODE_LABELS[mode];
|
|
61922
|
+
return [
|
|
61923
|
+
"button",
|
|
61937
61924
|
{
|
|
61938
|
-
class: "
|
|
61939
|
-
|
|
61940
|
-
"data-
|
|
61941
|
-
|
|
61942
|
-
|
|
61943
|
-
|
|
61944
|
-
|
|
61945
|
-
|
|
61946
|
-
|
|
61947
|
-
|
|
61948
|
-
|
|
61949
|
-
|
|
61950
|
-
],
|
|
61951
|
-
[
|
|
61952
|
-
"button",
|
|
61953
|
-
{
|
|
61954
|
-
class: "GRAPH_NODE_LABELS button",
|
|
61955
|
-
type: "button",
|
|
61956
|
-
style: {
|
|
61957
|
-
height: wide,
|
|
61958
|
-
width: "2.5em"
|
|
61925
|
+
class: "GRAPH_NODE_MODE_BTN button",
|
|
61926
|
+
type: "button",
|
|
61927
|
+
"data-mode": mode,
|
|
61928
|
+
style: {
|
|
61929
|
+
height: wide,
|
|
61930
|
+
width: "2.5em"
|
|
61931
|
+
},
|
|
61932
|
+
title: (0, i18next.t)(key),
|
|
61933
|
+
"data-i18n-title": key,
|
|
61934
|
+
"aria-label": (0, i18next.t)(key),
|
|
61935
|
+
"data-i18n-aria-label": key,
|
|
61936
|
+
"aria-pressed": "false"
|
|
61959
61937
|
},
|
|
61960
|
-
|
|
61961
|
-
|
|
61962
|
-
|
|
61963
|
-
|
|
61964
|
-
|
|
61938
|
+
["i", {
|
|
61939
|
+
style: "font-size:1.5em; color:inherit;",
|
|
61940
|
+
class: NODE_MODE_ICONS[mode]
|
|
61941
|
+
}],
|
|
61942
|
+
{ click: (evt) => {
|
|
61943
|
+
evt.stopPropagation();
|
|
61944
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SET_NODE_MODE", { node_mode: mode }, gobj);
|
|
61945
|
+
} }
|
|
61946
|
+
];
|
|
61947
|
+
})
|
|
61948
|
+
], [
|
|
61949
|
+
"button",
|
|
61950
|
+
{
|
|
61951
|
+
class: "GRAPH_NODE_LABELS button",
|
|
61952
|
+
type: "button",
|
|
61953
|
+
style: {
|
|
61954
|
+
height: wide,
|
|
61955
|
+
width: "2.5em"
|
|
61965
61956
|
},
|
|
61966
|
-
|
|
61967
|
-
|
|
61968
|
-
|
|
61969
|
-
|
|
61970
|
-
|
|
61971
|
-
|
|
61972
|
-
|
|
61973
|
-
|
|
61974
|
-
|
|
61975
|
-
|
|
61957
|
+
title: (0, i18next.t)("node labels"),
|
|
61958
|
+
"data-i18n-title": "node labels",
|
|
61959
|
+
"aria-label": (0, i18next.t)("node labels"),
|
|
61960
|
+
"data-i18n-aria-label": "node labels",
|
|
61961
|
+
"aria-pressed": "false"
|
|
61962
|
+
},
|
|
61963
|
+
["i", {
|
|
61964
|
+
style: "font-size:1.5em; color:inherit;",
|
|
61965
|
+
class: "yi-font"
|
|
61966
|
+
}],
|
|
61967
|
+
{ click: (evt) => {
|
|
61968
|
+
evt.stopPropagation();
|
|
61969
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TOGGLE_NODE_LABELS", {}, gobj);
|
|
61970
|
+
} }
|
|
61971
|
+
]];
|
|
61976
61972
|
}
|
|
61977
61973
|
var NODE_MODES = [
|
|
61978
61974
|
"expanded",
|
|
@@ -61984,13 +61980,21 @@ var NODE_MODE_LABELS = {
|
|
|
61984
61980
|
compact: "compact",
|
|
61985
61981
|
shape: "shape"
|
|
61986
61982
|
};
|
|
61983
|
+
var NODE_MODE_ICONS = {
|
|
61984
|
+
expanded: "yi-square",
|
|
61985
|
+
compact: "yi-bars",
|
|
61986
|
+
shape: "yi-hexagon-nodes"
|
|
61987
|
+
};
|
|
61987
61988
|
function refresh_node_shape_buttons(gobj, $root) {
|
|
61988
61989
|
if (!$root) return;
|
|
61989
61990
|
let mode = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "node_mode");
|
|
61990
61991
|
if (!NODE_MODES.includes(mode)) mode = "expanded";
|
|
61991
61992
|
let labels = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "node_labels");
|
|
61992
|
-
let $
|
|
61993
|
-
|
|
61993
|
+
for (let $btn of $root.querySelectorAll(".GRAPH_NODE_MODE_BTN")) {
|
|
61994
|
+
let on = $btn.getAttribute("data-mode") === mode;
|
|
61995
|
+
$btn.classList.toggle("pressed_state", on);
|
|
61996
|
+
$btn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
61997
|
+
}
|
|
61994
61998
|
set_pressed_state($root, ".GRAPH_NODE_LABELS", labels);
|
|
61995
61999
|
let $labels = $root.querySelector(".GRAPH_NODE_LABELS");
|
|
61996
62000
|
if ($labels) {
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -61906,68 +61906,64 @@ function option_label(name) {
|
|
|
61906
61906
|
* its context menu (the child's business).
|
|
61907
61907
|
************************************************************/
|
|
61908
61908
|
function node_shape_items(gobj, wide) {
|
|
61909
|
-
|
|
61910
|
-
"
|
|
61909
|
+
return [[
|
|
61910
|
+
"div",
|
|
61911
61911
|
{
|
|
61912
|
-
|
|
61913
|
-
"
|
|
61912
|
+
class: "GRAPH_NODE_MODE buttons has-addons",
|
|
61913
|
+
style: "margin:0 0 0 .5rem; flex:0 0 auto; flex-wrap:nowrap;"
|
|
61914
61914
|
},
|
|
61915
|
-
|
|
61916
|
-
|
|
61917
|
-
|
|
61918
|
-
|
|
61919
|
-
"span",
|
|
61920
|
-
{
|
|
61921
|
-
class: "GRAPH_NODE_MODE_LABEL is-hidden-mobile",
|
|
61922
|
-
style: "padding-left:10px; padding-right:5px;",
|
|
61923
|
-
i18n: "nodes"
|
|
61924
|
-
},
|
|
61925
|
-
"nodes"
|
|
61926
|
-
],
|
|
61927
|
-
[
|
|
61928
|
-
"div",
|
|
61929
|
-
{ class: "select" },
|
|
61930
|
-
[[
|
|
61931
|
-
"select",
|
|
61915
|
+
NODE_MODES.map((mode) => {
|
|
61916
|
+
let key = NODE_MODE_LABELS[mode];
|
|
61917
|
+
return [
|
|
61918
|
+
"button",
|
|
61932
61919
|
{
|
|
61933
|
-
class: "
|
|
61934
|
-
|
|
61935
|
-
"data-
|
|
61936
|
-
|
|
61937
|
-
|
|
61938
|
-
|
|
61939
|
-
|
|
61940
|
-
|
|
61941
|
-
|
|
61942
|
-
|
|
61943
|
-
|
|
61944
|
-
|
|
61945
|
-
],
|
|
61946
|
-
[
|
|
61947
|
-
"button",
|
|
61948
|
-
{
|
|
61949
|
-
class: "GRAPH_NODE_LABELS button",
|
|
61950
|
-
type: "button",
|
|
61951
|
-
style: {
|
|
61952
|
-
height: wide,
|
|
61953
|
-
width: "2.5em"
|
|
61920
|
+
class: "GRAPH_NODE_MODE_BTN button",
|
|
61921
|
+
type: "button",
|
|
61922
|
+
"data-mode": mode,
|
|
61923
|
+
style: {
|
|
61924
|
+
height: wide,
|
|
61925
|
+
width: "2.5em"
|
|
61926
|
+
},
|
|
61927
|
+
title: t(key),
|
|
61928
|
+
"data-i18n-title": key,
|
|
61929
|
+
"aria-label": t(key),
|
|
61930
|
+
"data-i18n-aria-label": key,
|
|
61931
|
+
"aria-pressed": "false"
|
|
61954
61932
|
},
|
|
61955
|
-
|
|
61956
|
-
|
|
61957
|
-
|
|
61958
|
-
|
|
61959
|
-
|
|
61933
|
+
["i", {
|
|
61934
|
+
style: "font-size:1.5em; color:inherit;",
|
|
61935
|
+
class: NODE_MODE_ICONS[mode]
|
|
61936
|
+
}],
|
|
61937
|
+
{ click: (evt) => {
|
|
61938
|
+
evt.stopPropagation();
|
|
61939
|
+
gobj_send_event(gobj, "EV_SET_NODE_MODE", { node_mode: mode }, gobj);
|
|
61940
|
+
} }
|
|
61941
|
+
];
|
|
61942
|
+
})
|
|
61943
|
+
], [
|
|
61944
|
+
"button",
|
|
61945
|
+
{
|
|
61946
|
+
class: "GRAPH_NODE_LABELS button",
|
|
61947
|
+
type: "button",
|
|
61948
|
+
style: {
|
|
61949
|
+
height: wide,
|
|
61950
|
+
width: "2.5em"
|
|
61960
61951
|
},
|
|
61961
|
-
|
|
61962
|
-
|
|
61963
|
-
|
|
61964
|
-
|
|
61965
|
-
|
|
61966
|
-
|
|
61967
|
-
|
|
61968
|
-
|
|
61969
|
-
|
|
61970
|
-
|
|
61952
|
+
title: t("node labels"),
|
|
61953
|
+
"data-i18n-title": "node labels",
|
|
61954
|
+
"aria-label": t("node labels"),
|
|
61955
|
+
"data-i18n-aria-label": "node labels",
|
|
61956
|
+
"aria-pressed": "false"
|
|
61957
|
+
},
|
|
61958
|
+
["i", {
|
|
61959
|
+
style: "font-size:1.5em; color:inherit;",
|
|
61960
|
+
class: "yi-font"
|
|
61961
|
+
}],
|
|
61962
|
+
{ click: (evt) => {
|
|
61963
|
+
evt.stopPropagation();
|
|
61964
|
+
gobj_send_event(gobj, "EV_TOGGLE_NODE_LABELS", {}, gobj);
|
|
61965
|
+
} }
|
|
61966
|
+
]];
|
|
61971
61967
|
}
|
|
61972
61968
|
var NODE_MODES = [
|
|
61973
61969
|
"expanded",
|
|
@@ -61979,13 +61975,21 @@ var NODE_MODE_LABELS = {
|
|
|
61979
61975
|
compact: "compact",
|
|
61980
61976
|
shape: "shape"
|
|
61981
61977
|
};
|
|
61978
|
+
var NODE_MODE_ICONS = {
|
|
61979
|
+
expanded: "yi-square",
|
|
61980
|
+
compact: "yi-bars",
|
|
61981
|
+
shape: "yi-hexagon-nodes"
|
|
61982
|
+
};
|
|
61982
61983
|
function refresh_node_shape_buttons(gobj, $root) {
|
|
61983
61984
|
if (!$root) return;
|
|
61984
61985
|
let mode = gobj_read_str_attr(gobj, "node_mode");
|
|
61985
61986
|
if (!NODE_MODES.includes(mode)) mode = "expanded";
|
|
61986
61987
|
let labels = gobj_read_bool_attr(gobj, "node_labels");
|
|
61987
|
-
let $
|
|
61988
|
-
|
|
61988
|
+
for (let $btn of $root.querySelectorAll(".GRAPH_NODE_MODE_BTN")) {
|
|
61989
|
+
let on = $btn.getAttribute("data-mode") === mode;
|
|
61990
|
+
$btn.classList.toggle("pressed_state", on);
|
|
61991
|
+
$btn.setAttribute("aria-pressed", on ? "true" : "false");
|
|
61992
|
+
}
|
|
61989
61993
|
set_pressed_state($root, ".GRAPH_NODE_LABELS", labels);
|
|
61990
61994
|
let $labels = $root.querySelector(".GRAPH_NODE_LABELS");
|
|
61991
61995
|
if ($labels) {
|
package/package.json
CHANGED
|
@@ -547,26 +547,31 @@ function option_label(name)
|
|
|
547
547
|
************************************************************/
|
|
548
548
|
function node_shape_items(gobj, wide)
|
|
549
549
|
{
|
|
550
|
-
/*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
550
|
+
/* Three push buttons in one group, not a select: a view is
|
|
551
|
+
* picked at a glance and in one press, and the pressed one
|
|
552
|
+
* SAYS which view is on -- a closed list says nothing until it
|
|
553
|
+
* is opened. Icons, because a card, a line and a figure draw
|
|
554
|
+
* themselves better than three words. */
|
|
555
|
+
let mode_buttons = NODE_MODES.map((mode) => {
|
|
556
|
+
let key = NODE_MODE_LABELS[mode];
|
|
557
|
+
return ['button', {class: 'GRAPH_NODE_MODE_BTN button', type: 'button',
|
|
558
|
+
'data-mode': mode,
|
|
559
|
+
style: {height: wide, width: '2.5em'},
|
|
560
|
+
title: t(key), 'data-i18n-title': key,
|
|
561
|
+
'aria-label': t(key), 'data-i18n-aria-label': key,
|
|
562
|
+
'aria-pressed': 'false'},
|
|
563
|
+
['i', {style: 'font-size:1.5em; color:inherit;', class: NODE_MODE_ICONS[mode]}],
|
|
564
|
+
{
|
|
565
|
+
click: (evt) => {
|
|
566
|
+
evt.stopPropagation();
|
|
567
|
+
gobj_send_event(gobj, "EV_SET_NODE_MODE", {node_mode: mode}, gobj);
|
|
568
|
+
}
|
|
568
569
|
}
|
|
569
|
-
|
|
570
|
+
];
|
|
571
|
+
});
|
|
572
|
+
return [
|
|
573
|
+
['div', {class: 'GRAPH_NODE_MODE buttons has-addons',
|
|
574
|
+
style: 'margin:0 0 0 .5rem; flex:0 0 auto; flex-wrap:nowrap;'}, mode_buttons],
|
|
570
575
|
['button', {class: 'GRAPH_NODE_LABELS button', type: 'button',
|
|
571
576
|
style: {height: wide, width: '2.5em'},
|
|
572
577
|
title: t('node labels'), 'data-i18n-title': 'node labels',
|
|
@@ -583,17 +588,23 @@ function node_shape_items(gobj, wide)
|
|
|
583
588
|
];
|
|
584
589
|
}
|
|
585
590
|
|
|
586
|
-
/* The three views of a record
|
|
587
|
-
*
|
|
591
|
+
/* The three views of a record: the child's `node_mode`, the i18n
|
|
592
|
+
* key of each, and the glyph -- a card, a line, a figure. */
|
|
588
593
|
const NODE_MODES = ['expanded', 'compact', 'shape'];
|
|
589
594
|
const NODE_MODE_LABELS = {
|
|
590
595
|
expanded: 'full',
|
|
591
596
|
compact: 'compact',
|
|
592
597
|
shape: 'shape',
|
|
593
598
|
};
|
|
599
|
+
const NODE_MODE_ICONS = {
|
|
600
|
+
expanded: 'yi-square',
|
|
601
|
+
compact: 'yi-bars',
|
|
602
|
+
shape: 'yi-hexagon-nodes',
|
|
603
|
+
};
|
|
594
604
|
|
|
595
|
-
/* The
|
|
596
|
-
* only means something on figures, so it is disabled
|
|
605
|
+
/* The pressed view and the labels toggle, from the attrs. The
|
|
606
|
+
* toggle only means something on figures, so it is disabled
|
|
607
|
+
* elsewhere.
|
|
597
608
|
* `$root` is whatever holds the toolbar: the toolbar itself before
|
|
598
609
|
* the view is mounted, the view's container after. */
|
|
599
610
|
function refresh_node_shape_buttons(gobj, $root)
|
|
@@ -606,9 +617,10 @@ function refresh_node_shape_buttons(gobj, $root)
|
|
|
606
617
|
mode = 'expanded';
|
|
607
618
|
}
|
|
608
619
|
let labels = gobj_read_bool_attr(gobj, "node_labels");
|
|
609
|
-
let $
|
|
610
|
-
|
|
611
|
-
$
|
|
620
|
+
for(let $btn of $root.querySelectorAll('.GRAPH_NODE_MODE_BTN')) {
|
|
621
|
+
let on = ($btn.getAttribute('data-mode') === mode);
|
|
622
|
+
$btn.classList.toggle('pressed_state', on);
|
|
623
|
+
$btn.setAttribute('aria-pressed', on? 'true' : 'false');
|
|
612
624
|
}
|
|
613
625
|
set_pressed_state($root, '.GRAPH_NODE_LABELS', labels);
|
|
614
626
|
let $labels = $root.querySelector('.GRAPH_NODE_LABELS');
|