@yuneta/gobj-ui 7.26.41 → 7.26.43
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 +510 -78
- package/dist/gobj-ui.cjs.js +1120 -326
- package/dist/gobj-ui.es.js +1120 -326
- package/package.json +1 -1
- package/scripts/validate-locales.mjs +971 -177
- package/src/c_g6_nodes_tree.js +3 -2
- package/src/c_yui_form.js +261 -154
- package/src/c_yui_fsm_graph.js +3 -2
- package/src/c_yui_gobj_tree_js.js +3 -2
- package/src/c_yui_json_graph.js +3 -2
- package/src/c_yui_nav.js +43 -28
- package/src/c_yui_node.js +51 -7
- package/src/c_yui_schema_editor.css +16 -0
- package/src/c_yui_schema_editor.js +110 -20
- package/src/c_yui_shell.css +4 -1
- package/src/c_yui_shell.js +227 -61
- package/src/c_yui_treedb_schema.js +3 -2
- package/src/c_yui_window.js +373 -62
- package/src/c_yui_window_manager.js +80 -8
- package/src/escape_taken.js +58 -0
- package/src/form_close_asks_for_edits.wiring.test.js +6 -3
- package/src/form_json_editor_names.js +3 -1
- package/src/form_json_editor_names.wiring.test.js +8 -4
- package/src/form_json_expand.wiring.test.js +6 -3
- package/src/form_json_field.wiring.test.js +8 -4
- package/src/form_label_i18n.wiring.test.js +10 -5
- package/src/form_table_edits_ask.wiring.test.js +18 -8
- package/src/form_table_rearm.wiring.test.js +13 -5
- package/src/form_table_rows.wiring.test.js +489 -0
- package/src/form_table_validator.wiring.test.js +8 -4
- package/src/form_template_field.wiring.test.js +6 -3
- package/src/g6_canvas_tab_order.css +29 -0
- package/src/g6_canvas_tab_order.js +41 -9
- package/src/g6_canvas_tab_order.wiring.test.js +107 -1
- package/src/g6_long_press_clock.test.js +8 -3
- package/src/i18n_key_functions.js +81 -27
- package/src/i18n_key_functions.test.js +402 -4
- package/src/modal_guard_back.wiring.test.js +188 -0
- package/src/named_controls.wiring.test.js +323 -19
- package/src/nav_cards_helpers.js +9 -4
- package/src/nav_item_badge.wiring.test.js +163 -15
- package/src/node_nav_events.wiring.test.js +93 -1
- package/src/route_map_model.js +59 -10
- package/src/route_map_model.test.js +90 -0
- package/src/schema_editor_diagram_click.wiring.test.js +277 -0
- package/src/schema_editor_openers.wiring.test.js +283 -0
- package/src/shell_dialog_names.wiring.test.js +149 -0
- package/src/shell_escape_taken.wiring.test.js +142 -0
- package/src/shell_focus_trap.js +30 -2
- package/src/shell_focus_trap.test.js +90 -6
- package/src/shell_modals.js +113 -22
- package/src/shell_route_map.js +15 -3
- package/src/shell_section_index.js +3 -1
- package/src/table_editor_name.wiring.test.js +10 -5
- package/src/treedb_column_title.wiring.test.js +8 -4
- package/src/treedb_graph_writes.wiring.test.js +6 -3
- package/src/treedb_json_drill.wiring.test.js +6 -3
- package/src/uplot_add_serie.test.js +6 -3
- package/src/uplot_ink.test.js +8 -4
- package/src/window_dialog.wiring.test.js +486 -0
- package/src/window_dock_band.wiring.test.js +189 -0
- package/src/window_layer.wiring.test.js +114 -0
- package/src/window_rect_rounding.wiring.test.js +121 -0
- package/src/yui_gclass_view.js +16 -1
- package/src/yui_tabulator_i18n.js +31 -1
- package/src/yui_tabulator_i18n.test.js +46 -0
package/src/c_yui_nav.js
CHANGED
|
@@ -463,17 +463,17 @@ function render_tabs(gobj, items)
|
|
|
463
463
|
}
|
|
464
464
|
/* A tab with show_label:false is a bare icon: the label is
|
|
465
465
|
* its only name (same contract as item_li). */
|
|
466
|
-
let
|
|
466
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
467
467
|
let a_attrs = {
|
|
468
468
|
href: it.route ? "#" + it.route : "#",
|
|
469
469
|
"data-item-id": it.id,
|
|
470
470
|
"data-route": it.route || "",
|
|
471
|
-
"aria-label":
|
|
471
|
+
"aria-label": name_key
|
|
472
472
|
};
|
|
473
|
-
if(
|
|
474
|
-
a_attrs["data-i18n-aria-label"] =
|
|
473
|
+
if(name_key) {
|
|
474
|
+
a_attrs["data-i18n-aria-label"] = name_key;
|
|
475
475
|
}
|
|
476
|
-
let tip = it.tooltip || it.aria_label ||
|
|
476
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
477
477
|
if(tip) {
|
|
478
478
|
a_attrs.title = tip;
|
|
479
479
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -543,19 +543,22 @@ function render_breadcrumb(gobj, items)
|
|
|
543
543
|
}
|
|
544
544
|
/* Named and titled like every other item of the nav: up to
|
|
545
545
|
* 7.26.34 a crumb had no title, and no name when it had no
|
|
546
|
-
* `name` (an icon crumb read as nothing).
|
|
546
|
+
* `name` (an icon crumb read as nothing), and from 7.26.35 to
|
|
547
|
+
* 7.26.41 it was named by its raw id, with no key: the id is
|
|
548
|
+
* its key, as in item_li. */
|
|
549
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
547
550
|
let a_attrs = {
|
|
548
551
|
class: "yui-nav-item yui-nav-crumb",
|
|
549
552
|
href: it.route ? "#" + it.route : "#",
|
|
550
553
|
"data-item-id": it.id,
|
|
551
554
|
"data-route": it.route || "",
|
|
552
555
|
"data-disabled": it.disabled ? "1" : "0",
|
|
553
|
-
"aria-label":
|
|
556
|
+
"aria-label": name_key
|
|
554
557
|
};
|
|
555
|
-
if(
|
|
556
|
-
a_attrs["data-i18n-aria-label"] =
|
|
558
|
+
if(name_key) {
|
|
559
|
+
a_attrs["data-i18n-aria-label"] = name_key;
|
|
557
560
|
}
|
|
558
|
-
let tip = it.tooltip || it.aria_label ||
|
|
561
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
559
562
|
if(tip) {
|
|
560
563
|
a_attrs.title = tip;
|
|
561
564
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -690,10 +693,17 @@ function render_accordion(gobj, items)
|
|
|
690
693
|
let head_badge = item_badge_node(gobj, it, false);
|
|
691
694
|
if(!empty_string(head_text)) {
|
|
692
695
|
head_attrs.i18n = head_text;
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
696
|
+
}
|
|
697
|
+
/* Named as every item (item_li): its `name`, else its
|
|
698
|
+
* `aria_label`, else its id, a KEY in every case. Up to 7.26.41
|
|
699
|
+
* a head without a `name` was a button with no name at all. */
|
|
700
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
701
|
+
if(!empty_string(name_key)) {
|
|
702
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
703
|
+
head_attrs.title = tip;
|
|
704
|
+
head_attrs["data-i18n-title"] = tip;
|
|
705
|
+
head_attrs["aria-label"] = name_key;
|
|
706
|
+
head_attrs["data-i18n-aria-label"] = name_key;
|
|
697
707
|
/* The count is part of its name: inside a <button> the
|
|
698
708
|
* badge is no node of its own for a reader (yui_badge.js) */
|
|
699
709
|
name_control_with_badge(head_attrs, head_badge);
|
|
@@ -791,28 +801,32 @@ function item_li(gobj, it, opts)
|
|
|
791
801
|
}
|
|
792
802
|
}
|
|
793
803
|
|
|
794
|
-
|
|
804
|
+
/* The name of an item: its `name`, else its `aria_label`, else its
|
|
805
|
+
* id -- a KEY in every case, translated by the pass that translates
|
|
806
|
+
* the labels and reached by a language switch. Up to 7.26.41 an
|
|
807
|
+
* item without a `name` was named by its raw id, with no key and no
|
|
808
|
+
* title, and the `aria_label` it declared went only to the tooltip. */
|
|
809
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
795
810
|
let a_attrs = {
|
|
796
811
|
class: a_class,
|
|
797
812
|
href: it.route ? "#" + it.route : "#",
|
|
798
813
|
"data-item-id": it.id,
|
|
799
814
|
"data-route": it.route || "",
|
|
800
815
|
"data-disabled": it.disabled ? "1" : "0",
|
|
801
|
-
"aria-label":
|
|
816
|
+
"aria-label": name_key
|
|
802
817
|
};
|
|
803
818
|
/* Mirror the aria-label key in `data-i18n-aria-label` so
|
|
804
|
-
* refresh_language() can re-translate it on language switch.
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
if(label) {
|
|
808
|
-
a_attrs["data-i18n-aria-label"] = label;
|
|
819
|
+
* refresh_language() can re-translate it on language switch. */
|
|
820
|
+
if(name_key) {
|
|
821
|
+
a_attrs["data-i18n-aria-label"] = name_key;
|
|
809
822
|
}
|
|
810
823
|
/* Hover tooltip: prefer explicit `tooltip`, fall back to
|
|
811
|
-
* `aria_label` (typically equivalent, e.g. "Search (Ctrl+F)")
|
|
812
|
-
* Skip when
|
|
824
|
+
* `aria_label` (typically equivalent, e.g. "Search (Ctrl+F)"),
|
|
825
|
+
* then the name. Skip when all are empty so we don't emit
|
|
826
|
+
* `title=""` noise.
|
|
813
827
|
* Mirror the value in `data-i18n-title` so refresh_language()
|
|
814
828
|
* can re-translate the tooltip on language switch. */
|
|
815
|
-
let tip = it.tooltip || it.aria_label ||
|
|
829
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
816
830
|
if(tip) {
|
|
817
831
|
a_attrs.title = tip;
|
|
818
832
|
a_attrs["data-i18n-title"] = tip;
|
|
@@ -864,17 +878,18 @@ function item_iconbar(gobj, it, opts)
|
|
|
864
878
|
children.push(badge_el);
|
|
865
879
|
}
|
|
866
880
|
|
|
881
|
+
let name_key = it.name || it.aria_label || it.id || "";
|
|
867
882
|
let a_attrs = {
|
|
868
883
|
class: "yui-nav-item yui-nav-stacked",
|
|
869
884
|
href: it.route ? "#" + it.route : "#",
|
|
870
885
|
"data-item-id": it.id,
|
|
871
886
|
"data-route": it.route || "",
|
|
872
|
-
"aria-label":
|
|
887
|
+
"aria-label": name_key
|
|
873
888
|
};
|
|
874
|
-
if(
|
|
875
|
-
a_attrs["data-i18n-aria-label"] =
|
|
889
|
+
if(name_key) {
|
|
890
|
+
a_attrs["data-i18n-aria-label"] = name_key;
|
|
876
891
|
}
|
|
877
|
-
let tip = it.tooltip || it.aria_label ||
|
|
892
|
+
let tip = it.tooltip || it.aria_label || name_key;
|
|
878
893
|
if(tip) {
|
|
879
894
|
a_attrs.title = tip;
|
|
880
895
|
a_attrs["data-i18n-title"] = tip;
|
package/src/c_yui_node.js
CHANGED
|
@@ -112,6 +112,7 @@ import {
|
|
|
112
112
|
gobj_subscribe_event,
|
|
113
113
|
gobj_unsubscribe_event,
|
|
114
114
|
gobj_send_event,
|
|
115
|
+
gobj_post_event,
|
|
115
116
|
gobj_change_state,
|
|
116
117
|
gobj_current_state,
|
|
117
118
|
createElement2,
|
|
@@ -186,6 +187,7 @@ SDATA_END()
|
|
|
186
187
|
let PRIVATE_DATA = {
|
|
187
188
|
children: null, /* child NODE gobjs, in order */
|
|
188
189
|
navs: null, /* live C_YUI_NAV gobjs inside my own body */
|
|
190
|
+
retired_navs: null, /* navs a render left, destroyed on the next turn */
|
|
189
191
|
zone_navs: null, /* navs projected into the SPACE, by key */
|
|
190
192
|
zone_sig: null, /* their last item signature */
|
|
191
193
|
content_gobj: null,
|
|
@@ -230,6 +232,7 @@ function mt_create(gobj)
|
|
|
230
232
|
priv.children = [];
|
|
231
233
|
priv.remembered = {};
|
|
232
234
|
priv.navs = [];
|
|
235
|
+
priv.retired_navs = [];
|
|
233
236
|
priv.zone_navs = {};
|
|
234
237
|
priv.zone_sig = {};
|
|
235
238
|
|
|
@@ -309,6 +312,7 @@ function mt_stop(gobj)
|
|
|
309
312
|
}
|
|
310
313
|
|
|
311
314
|
deactivate(gobj);
|
|
315
|
+
destroy_retired_navs(gobj);
|
|
312
316
|
|
|
313
317
|
/* Symmetric with mt_start: what this node started, it stops —
|
|
314
318
|
* the framework destroys children, and destroying a RUNNING gobj
|
|
@@ -342,6 +346,7 @@ function mt_destroy(gobj)
|
|
|
342
346
|
* references and own nothing but the DOM. */
|
|
343
347
|
priv.content_gobj = null;
|
|
344
348
|
priv.navs = [];
|
|
349
|
+
priv.retired_navs = [];
|
|
345
350
|
priv.zone_navs = {};
|
|
346
351
|
priv.zone_sig = {};
|
|
347
352
|
priv.active_child = null;
|
|
@@ -613,18 +618,42 @@ function translate_own_dom(gobj, $el)
|
|
|
613
618
|
}
|
|
614
619
|
|
|
615
620
|
/************************************************************
|
|
616
|
-
*
|
|
621
|
+
* Take down the C_YUI_NAV gobjs rendering this node's projection:
|
|
622
|
+
* off the page now, destroyed on the next turn (EV_DESTROY_NAVS).
|
|
623
|
+
* A render can come from a click on one of them -- the active item
|
|
624
|
+
* clicked again is a navigation to the same hash, done in the same
|
|
625
|
+
* turn -- and that nav is still inside its publication of
|
|
626
|
+
* EV_NAV_CLICKED.
|
|
617
627
|
************************************************************/
|
|
618
628
|
function clear_navs(gobj)
|
|
619
629
|
{
|
|
620
630
|
let priv = gobj.priv;
|
|
631
|
+
if(!priv.navs.length) {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
let none_waiting = (priv.retired_navs.length === 0);
|
|
621
635
|
for(let nav of priv.navs) {
|
|
636
|
+
let $nav = gobj_read_attr(nav, "$container");
|
|
637
|
+
if($nav && $nav.parentNode) {
|
|
638
|
+
$nav.parentNode.removeChild($nav);
|
|
639
|
+
}
|
|
640
|
+
priv.retired_navs.push(nav);
|
|
641
|
+
}
|
|
642
|
+
priv.navs = [];
|
|
643
|
+
if(none_waiting) {
|
|
644
|
+
gobj_post_event(gobj, "EV_DESTROY_NAVS", {}, gobj);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
function destroy_retired_navs(gobj)
|
|
649
|
+
{
|
|
650
|
+
let priv = gobj.priv;
|
|
651
|
+
for(let nav of priv.retired_navs.splice(0)) {
|
|
622
652
|
if(gobj_is_running(nav)) {
|
|
623
653
|
gobj_stop(nav);
|
|
624
654
|
}
|
|
625
655
|
gobj_destroy(nav);
|
|
626
656
|
}
|
|
627
|
-
priv.navs = [];
|
|
628
657
|
}
|
|
629
658
|
|
|
630
659
|
/************************************************************
|
|
@@ -971,7 +1000,8 @@ function render_path(gobj, $where)
|
|
|
971
1000
|
"C_YUI_NAV",
|
|
972
1001
|
{
|
|
973
1002
|
menu_id: `node.path.${route_of(gobj)}`,
|
|
974
|
-
|
|
1003
|
+
/* As its other navs: a "submenu" heads the nav with it, as a key */
|
|
1004
|
+
nav_label: gobj_read_attr(gobj, "label") || gobj_read_attr(gobj, "node_id"),
|
|
975
1005
|
menu_items: items,
|
|
976
1006
|
layout: render.layout,
|
|
977
1007
|
icon_pos: render.icon_pos || "left",
|
|
@@ -1583,6 +1613,15 @@ function ac_set_content(gobj, event, kw, src)
|
|
|
1583
1613
|
return 0;
|
|
1584
1614
|
}
|
|
1585
1615
|
|
|
1616
|
+
/************************************************************
|
|
1617
|
+
* The navs a render left on the previous turn (clear_navs()).
|
|
1618
|
+
************************************************************/
|
|
1619
|
+
function ac_destroy_navs(gobj, event, kw, src)
|
|
1620
|
+
{
|
|
1621
|
+
destroy_retired_navs(gobj);
|
|
1622
|
+
return 0;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1586
1625
|
/************************************************************
|
|
1587
1626
|
* A descendant changed shape; keep bubbling to the root, which
|
|
1588
1627
|
* owns the site-map contribution.
|
|
@@ -1737,7 +1776,8 @@ function create_gclass(gclass_name)
|
|
|
1737
1776
|
["EV_SET_CHROME_DEPTH", ac_set_chrome_depth, null],
|
|
1738
1777
|
["EV_SET_NAV_MODE", ac_set_nav_mode, null],
|
|
1739
1778
|
["EV_SET_CONTENT", ac_set_content, null],
|
|
1740
|
-
["EV_NODE_TREE_CHANGED", ac_tree_changed, null]
|
|
1779
|
+
["EV_NODE_TREE_CHANGED", ac_tree_changed, null],
|
|
1780
|
+
["EV_DESTROY_NAVS", ac_destroy_navs, null]
|
|
1741
1781
|
]],
|
|
1742
1782
|
["ST_SELF", [
|
|
1743
1783
|
["EV_ROUTE_CHANGED", ac_route_changed, null],
|
|
@@ -1752,7 +1792,8 @@ function create_gclass(gclass_name)
|
|
|
1752
1792
|
["EV_SET_CHROME_DEPTH", ac_set_chrome_depth, null],
|
|
1753
1793
|
["EV_SET_NAV_MODE", ac_set_nav_mode, null],
|
|
1754
1794
|
["EV_SET_CONTENT", ac_set_content, null],
|
|
1755
|
-
["EV_NODE_TREE_CHANGED", ac_tree_changed, null]
|
|
1795
|
+
["EV_NODE_TREE_CHANGED", ac_tree_changed, null],
|
|
1796
|
+
["EV_DESTROY_NAVS", ac_destroy_navs, null]
|
|
1756
1797
|
]],
|
|
1757
1798
|
["ST_CHILD", [
|
|
1758
1799
|
["EV_ROUTE_CHANGED", ac_route_changed, null],
|
|
@@ -1767,7 +1808,8 @@ function create_gclass(gclass_name)
|
|
|
1767
1808
|
["EV_SET_CHROME_DEPTH", ac_set_chrome_depth, null],
|
|
1768
1809
|
["EV_SET_NAV_MODE", ac_set_nav_mode, null],
|
|
1769
1810
|
["EV_SET_CONTENT", ac_set_content, null],
|
|
1770
|
-
["EV_NODE_TREE_CHANGED", ac_tree_changed, null]
|
|
1811
|
+
["EV_NODE_TREE_CHANGED", ac_tree_changed, null],
|
|
1812
|
+
["EV_DESTROY_NAVS", ac_destroy_navs, null]
|
|
1771
1813
|
]]
|
|
1772
1814
|
];
|
|
1773
1815
|
|
|
@@ -1787,7 +1829,9 @@ function create_gclass(gclass_name)
|
|
|
1787
1829
|
["EV_SET_CHROME_DEPTH", 0],
|
|
1788
1830
|
["EV_SET_NAV_MODE", 0],
|
|
1789
1831
|
["EV_SET_CONTENT", 0],
|
|
1790
|
-
["EV_NODE_TREE_CHANGED", 0]
|
|
1832
|
+
["EV_NODE_TREE_CHANGED", 0],
|
|
1833
|
+
/* internal: posted to itself, the navs a render left */
|
|
1834
|
+
["EV_DESTROY_NAVS", 0]
|
|
1791
1835
|
];
|
|
1792
1836
|
|
|
1793
1837
|
__gclass__ = gclass_create(
|
|
@@ -58,6 +58,22 @@
|
|
|
58
58
|
cursor: pointer;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/* The opener of a topic row: a real button -- a key presses it, a
|
|
62
|
+
* reader announces it -- that looks like the name it is. Not
|
|
63
|
+
* `font: inherit`: it would undo the weight of the name. */
|
|
64
|
+
.C_YUI_SCHEMA_EDITOR .SCHEMA_TOPIC_OPEN {
|
|
65
|
+
background: none;
|
|
66
|
+
border: 0;
|
|
67
|
+
margin: 0;
|
|
68
|
+
padding: 0;
|
|
69
|
+
color: inherit;
|
|
70
|
+
font-family: inherit;
|
|
71
|
+
font-size: inherit;
|
|
72
|
+
line-height: inherit;
|
|
73
|
+
text-align: inherit;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
}
|
|
76
|
+
|
|
61
77
|
.C_YUI_SCHEMA_EDITOR .SCHEMA_COL_FLAGS .tags {
|
|
62
78
|
margin-bottom: 0;
|
|
63
79
|
}
|
|
@@ -102,8 +102,10 @@ import {
|
|
|
102
102
|
gobj_start,
|
|
103
103
|
gobj_stop,
|
|
104
104
|
gobj_destroy,
|
|
105
|
+
gobj_is_running,
|
|
105
106
|
gobj_is_destroying,
|
|
106
107
|
gobj_send_event,
|
|
108
|
+
gobj_post_event,
|
|
107
109
|
gobj_publish_event,
|
|
108
110
|
gobj_subscribe_event,
|
|
109
111
|
gobj_unsubscribe_event,
|
|
@@ -259,6 +261,7 @@ let PRIVATE_DATA = {
|
|
|
259
261
|
|
|
260
262
|
/* Children and overlays */
|
|
261
263
|
diagram_gobj: null,
|
|
264
|
+
retired_diagrams: null, /* drawings left, destroyed on the next turn */
|
|
262
265
|
dialog: null,
|
|
263
266
|
dialog_gen: 0, /* the model_gen the open dialog was built on */
|
|
264
267
|
dialog_kind: "", /* the logical class of the open dialog */
|
|
@@ -291,6 +294,10 @@ let PRIVATE_DATA = {
|
|
|
291
294
|
|
|
292
295
|
let __gclass__ = null;
|
|
293
296
|
|
|
297
|
+
/* The ids that tie an opener to what describes it (aria-describedby):
|
|
298
|
+
* the counts of a card, the id of a topic row whose name is not unique. */
|
|
299
|
+
let __described_seq__ = 0;
|
|
300
|
+
|
|
294
301
|
|
|
295
302
|
|
|
296
303
|
|
|
@@ -313,6 +320,7 @@ function mt_create(gobj)
|
|
|
313
320
|
priv.host_drafts = {}; /* what the host says is a draft, {treedb: [topics]} (EV_DRAFTS) */
|
|
314
321
|
priv.host_ids = {}; /* the same, as {topic id: true} of the model */
|
|
315
322
|
priv.save_queue = [];
|
|
323
|
+
priv.retired_diagrams = [];
|
|
316
324
|
|
|
317
325
|
build_ui(gobj);
|
|
318
326
|
|
|
@@ -354,6 +362,7 @@ function mt_stop(gobj)
|
|
|
354
362
|
}
|
|
355
363
|
close_dialog(gobj);
|
|
356
364
|
destroy_diagram(gobj);
|
|
365
|
+
destroy_retired_diagrams(gobj);
|
|
357
366
|
}
|
|
358
367
|
|
|
359
368
|
/***************************************************************
|
|
@@ -1295,6 +1304,15 @@ function render(gobj)
|
|
|
1295
1304
|
* A card that opens something, with its own logical name. The
|
|
1296
1305
|
* cards grid is the shell's, so a schema card and a nav card
|
|
1297
1306
|
* look alike on purpose.
|
|
1307
|
+
*
|
|
1308
|
+
* `title` is the card's name: `{i18n: key}`, or `{text: data}` for
|
|
1309
|
+
* a name no locale holds (a treedb's id). The card is a control --
|
|
1310
|
+
* a role=button that Enter and Space press -- and a control is
|
|
1311
|
+
* NAMED: a title and an aria-label, with their keys when the name
|
|
1312
|
+
* is one, and its tags (the counts) as its description, which an
|
|
1313
|
+
* aria-label alone would hide from a reader. Up to 7.26.41 it had
|
|
1314
|
+
* neither, and the orphans card was handed its name translated,
|
|
1315
|
+
* in the language it was drawn in for good.
|
|
1298
1316
|
***************************************************************/
|
|
1299
1317
|
function open_card(gobj, logical, title, icon, tags, event, kw)
|
|
1300
1318
|
{
|
|
@@ -1323,14 +1341,29 @@ function open_card(gobj, logical, title, icon, tags, event, kw)
|
|
|
1323
1341
|
: `${tag.text}`];
|
|
1324
1342
|
});
|
|
1325
1343
|
|
|
1326
|
-
|
|
1344
|
+
let tags_id = `yui-schema-described-${++__described_seq__}`;
|
|
1345
|
+
let card_attrs = {class: `${logical} yui-nav-card card`, role: "button", tabindex: "0",
|
|
1346
|
+
"aria-describedby": tags_id};
|
|
1347
|
+
let $name;
|
|
1348
|
+
if(title.i18n) {
|
|
1349
|
+
Object.assign(card_attrs, name_attrs(title.i18n, {}));
|
|
1350
|
+
$name = ["span", {class: `${logical}_NAME has-text-weight-semibold`, i18n: title.i18n},
|
|
1351
|
+
t(title.i18n)];
|
|
1352
|
+
} else {
|
|
1353
|
+
card_attrs.title = String(title.text);
|
|
1354
|
+
card_attrs["aria-label"] = String(title.text);
|
|
1355
|
+
$name = ["span", {class: `${logical}_NAME has-text-weight-semibold`},
|
|
1356
|
+
text_node(title.text)];
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
return ["div", card_attrs, [
|
|
1327
1360
|
["div", {class: `${logical}_BODY card-content p-3`}, [
|
|
1328
1361
|
["p", {class: `${logical}_TITLE is-flex is-align-items-center`,
|
|
1329
1362
|
style: "gap:.4rem;"}, [
|
|
1330
|
-
["span", {class: "icon"}, [["i", {class: icon}]]],
|
|
1331
|
-
|
|
1363
|
+
["span", {class: "icon"}, [["i", {class: icon, "aria-hidden": "true"}]]],
|
|
1364
|
+
$name
|
|
1332
1365
|
]],
|
|
1333
|
-
["div", {class: `${logical}_TAGS tags mt-2`, style: "gap:.25rem;"}, $tags]
|
|
1366
|
+
["div", {class: `${logical}_TAGS tags mt-2`, id: tags_id, style: "gap:.25rem;"}, $tags]
|
|
1334
1367
|
]]
|
|
1335
1368
|
], {
|
|
1336
1369
|
click: (evt) => {
|
|
@@ -1372,7 +1405,7 @@ function render_treedbs(gobj, $body)
|
|
|
1372
1405
|
? [{i18n: "from c", text: treedb.c_schema_version, style: "is-warning is-light"}]
|
|
1373
1406
|
: [])
|
|
1374
1407
|
];
|
|
1375
|
-
$cards.push(open_card(gobj, "SCHEMA_TREEDB_CARD", treedb.id, "yi-database",
|
|
1408
|
+
$cards.push(open_card(gobj, "SCHEMA_TREEDB_CARD", {text: treedb.id}, "yi-database",
|
|
1376
1409
|
tags, "EV_SELECT_TREEDB", {treedb: treedb.id}));
|
|
1377
1410
|
}
|
|
1378
1411
|
|
|
@@ -1380,7 +1413,7 @@ function render_treedbs(gobj, $body)
|
|
|
1380
1413
|
/* A leftover of a deletion belongs to no treedb and would be
|
|
1381
1414
|
* invisible in a screen that only draws the tree. Saying it
|
|
1382
1415
|
* here is the only place it can be said. */
|
|
1383
|
-
$cards.push(open_card(gobj, "SCHEMA_ORPHAN_CARD",
|
|
1416
|
+
$cards.push(open_card(gobj, "SCHEMA_ORPHAN_CARD", {i18n: "orphans"}, "yi-triangle-exclamation",
|
|
1384
1417
|
[{i18n: "topics", text: priv.model.orphan_topics.length},
|
|
1385
1418
|
{i18n: "columns", text: priv.model.orphan_cols.length}],
|
|
1386
1419
|
"EV_SHOW_ORPHANS", {}));
|
|
@@ -1429,9 +1462,30 @@ function render_topics(gobj, $body)
|
|
|
1429
1462
|
"EV_DELETE_TOPIC", {topic: address}));
|
|
1430
1463
|
}
|
|
1431
1464
|
|
|
1432
|
-
|
|
1465
|
+
/* The row stays a ROW: a `<tr role=button>` -- what it was up to
|
|
1466
|
+
* 7.26.41 -- is a button to a reader, with no cells, and it had
|
|
1467
|
+
* no name. The opener is a real button in the name cell, named
|
|
1468
|
+
* by the topic: a key presses it with no handler of ours, and a
|
|
1469
|
+
* reader reads the rest of the row as cells of a table. Two
|
|
1470
|
+
* topics of one name are told apart by the id under the name,
|
|
1471
|
+
* which describes the opener. The pointer opens the topic from
|
|
1472
|
+
* anywhere in the row, as before. */
|
|
1473
|
+
let open_attrs = {class: "SCHEMA_TOPIC_OPEN has-text-weight-semibold", type: "button",
|
|
1474
|
+
title: topic.name, "aria-label": topic.name};
|
|
1475
|
+
let id_attrs = {class: "SCHEMA_TOPIC_ID is-size-7 yui-text-quiet"};
|
|
1476
|
+
if(ambiguous) {
|
|
1477
|
+
id_attrs.id = `yui-schema-described-${++__described_seq__}`;
|
|
1478
|
+
open_attrs["aria-describedby"] = id_attrs.id;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
$rows.push(["tr", {class: "SCHEMA_TOPIC_ROW"}, [
|
|
1433
1482
|
["td", {class: "SCHEMA_TOPIC_NAME"}, [
|
|
1434
|
-
["
|
|
1483
|
+
["button", open_attrs, text_node(topic.name), {
|
|
1484
|
+
click: (evt) => {
|
|
1485
|
+
evt.stopPropagation();
|
|
1486
|
+
gobj_send_event(gobj, "EV_SELECT_TOPIC", {topic: address}, gobj);
|
|
1487
|
+
}
|
|
1488
|
+
}],
|
|
1435
1489
|
topic.system_topic
|
|
1436
1490
|
? ["span", {class: "SCHEMA_TOPIC_SYSTEM tag ml-2",
|
|
1437
1491
|
i18n: "system"}, t("system")]
|
|
@@ -1444,8 +1498,7 @@ function render_topics(gobj, $body)
|
|
|
1444
1498
|
title: t("main topic"), "data-i18n-title": "main topic"}, "★"]
|
|
1445
1499
|
: ["span", {}, ""],
|
|
1446
1500
|
ambiguous
|
|
1447
|
-
? ["div",
|
|
1448
|
-
[["code", {}, text_node(topic.id)]]]
|
|
1501
|
+
? ["div", id_attrs, [["code", {}, text_node(topic.id)]]]
|
|
1449
1502
|
: ["span", {}, ""]
|
|
1450
1503
|
]],
|
|
1451
1504
|
["td", {class: "SCHEMA_TOPIC_PKEY"}, [["code", {}, text_node(topic.pkey || "id")]]],
|
|
@@ -1456,18 +1509,14 @@ function render_topics(gobj, $body)
|
|
|
1456
1509
|
]],
|
|
1457
1510
|
["td", {class: "SCHEMA_TOPIC_ACTIONS has-text-right"}, $actions]
|
|
1458
1511
|
], {
|
|
1512
|
+
/* The pointer's way in. The keyboard's is the opener: the
|
|
1513
|
+
* row's own keydown also took an Enter meant for a row
|
|
1514
|
+
* action, which then opened the topic instead. */
|
|
1459
1515
|
click: (evt) => {
|
|
1460
1516
|
if(evt.target.closest(".SCHEMA_TOPIC_ACTIONS")) {
|
|
1461
1517
|
return; /* a row action, not the row */
|
|
1462
1518
|
}
|
|
1463
1519
|
gobj_send_event(gobj, "EV_SELECT_TOPIC", {topic: address}, gobj);
|
|
1464
|
-
},
|
|
1465
|
-
keydown: (evt) => {
|
|
1466
|
-
if(evt.key !== "Enter" && evt.key !== " ") {
|
|
1467
|
-
return;
|
|
1468
|
-
}
|
|
1469
|
-
evt.preventDefault();
|
|
1470
|
-
gobj_send_event(gobj, "EV_SELECT_TOPIC", {topic: address}, gobj);
|
|
1471
1520
|
}
|
|
1472
1521
|
}]);
|
|
1473
1522
|
}
|
|
@@ -1867,6 +1916,13 @@ function render_diagram(gobj)
|
|
|
1867
1916
|
gobj_send_event(diagram, "EV_SHOW", {}, gobj);
|
|
1868
1917
|
}
|
|
1869
1918
|
|
|
1919
|
+
/***************************************************************
|
|
1920
|
+
* The drawing leaves the screen at once and is destroyed on the
|
|
1921
|
+
* next turn (EV_DESTROY_DIAGRAMS). It can be leaving because of
|
|
1922
|
+
* its own node click, which it publishes from inside G6's dispatch
|
|
1923
|
+
* of that click: stopped there, the gobj went from under its own
|
|
1924
|
+
* publication and the G6 graph from under its own event.
|
|
1925
|
+
***************************************************************/
|
|
1870
1926
|
function destroy_diagram(gobj)
|
|
1871
1927
|
{
|
|
1872
1928
|
let priv = gobj.priv;
|
|
@@ -1874,9 +1930,29 @@ function destroy_diagram(gobj)
|
|
|
1874
1930
|
if(!priv.diagram_gobj) {
|
|
1875
1931
|
return;
|
|
1876
1932
|
}
|
|
1877
|
-
|
|
1878
|
-
gobj_destroy(priv.diagram_gobj);
|
|
1933
|
+
let diagram = priv.diagram_gobj;
|
|
1879
1934
|
priv.diagram_gobj = null;
|
|
1935
|
+
|
|
1936
|
+
let $d = gobj_read_attr(diagram, "$container");
|
|
1937
|
+
if($d && $d.parentNode) {
|
|
1938
|
+
$d.parentNode.removeChild($d);
|
|
1939
|
+
}
|
|
1940
|
+
priv.retired_diagrams.push(diagram);
|
|
1941
|
+
if(priv.retired_diagrams.length === 1) {
|
|
1942
|
+
gobj_post_event(gobj, "EV_DESTROY_DIAGRAMS", {}, gobj);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
function destroy_retired_diagrams(gobj)
|
|
1947
|
+
{
|
|
1948
|
+
let priv = gobj.priv;
|
|
1949
|
+
|
|
1950
|
+
for(let diagram of priv.retired_diagrams.splice(0)) {
|
|
1951
|
+
if(gobj_is_running(diagram)) {
|
|
1952
|
+
gobj_stop(diagram);
|
|
1953
|
+
}
|
|
1954
|
+
gobj_destroy(diagram);
|
|
1955
|
+
}
|
|
1880
1956
|
}
|
|
1881
1957
|
|
|
1882
1958
|
|
|
@@ -3952,6 +4028,15 @@ function ac_node_click(gobj, event, kw, src)
|
|
|
3952
4028
|
return reload_after_move(gobj);
|
|
3953
4029
|
}
|
|
3954
4030
|
|
|
4031
|
+
/***************************************************************
|
|
4032
|
+
* The drawings left on the previous turn (destroy_diagram()).
|
|
4033
|
+
***************************************************************/
|
|
4034
|
+
function ac_destroy_diagrams(gobj, event, kw, src)
|
|
4035
|
+
{
|
|
4036
|
+
destroy_retired_diagrams(gobj);
|
|
4037
|
+
return 0;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
3955
4040
|
function ac_show_orphans(gobj, event, kw, src)
|
|
3956
4041
|
{
|
|
3957
4042
|
if(reload_first(gobj, event)) {
|
|
@@ -4734,7 +4819,9 @@ function create_gclass(gclass_name)
|
|
|
4734
4819
|
["EV_REFRESH", ac_refresh, null],
|
|
4735
4820
|
["EV_DRAFTS", ac_drafts, null],
|
|
4736
4821
|
/* The export dialog outlives the screen it was opened from. */
|
|
4737
|
-
["EV_EXPORT_VIEW", ac_export_view, null]
|
|
4822
|
+
["EV_EXPORT_VIEW", ac_export_view, null],
|
|
4823
|
+
/* Posted to itself: a drawing left on any screen goes a turn later. */
|
|
4824
|
+
["EV_DESTROY_DIAGRAMS", ac_destroy_diagrams, null]
|
|
4738
4825
|
];
|
|
4739
4826
|
|
|
4740
4827
|
/* What a treedb is open for: reading it whole, and writing it
|
|
@@ -4861,6 +4948,9 @@ function create_gclass(gclass_name)
|
|
|
4861
4948
|
/* From the drawing, which is a child of this gobj. */
|
|
4862
4949
|
["EV_NODE_CLICK", 0],
|
|
4863
4950
|
|
|
4951
|
+
/* To itself: the drawings left, destroyed a turn later. */
|
|
4952
|
+
["EV_DESTROY_DIAGRAMS", 0],
|
|
4953
|
+
|
|
4864
4954
|
/* Outwards. The host mirrors the position into the url and
|
|
4865
4955
|
* carries the write up to whoever owns the Apply — both are
|
|
4866
4956
|
* optional, so neither warns when nobody listens. */
|
package/src/c_yui_shell.css
CHANGED
|
@@ -862,9 +862,12 @@ textarea::placeholder {
|
|
|
862
862
|
font-weight: 600;
|
|
863
863
|
}
|
|
864
864
|
/* Separator between the data half and the translated kind half. CSS,
|
|
865
|
-
* not a text node: createElement2 trims text nodes and eats the spaces.
|
|
865
|
+
* not a text node: createElement2 trims text nodes and eats the spaces.
|
|
866
|
+
* Decorative ("/ ''"): the halves NAME the dialog, and a reader would
|
|
867
|
+
* read the dot into the kind half. */
|
|
866
868
|
.MODAL_TITLE_PREFIX + .MODAL_TITLE_KIND::before {
|
|
867
869
|
content: "·";
|
|
870
|
+
content: "·" / "";
|
|
868
871
|
padding: 0 0.4em;
|
|
869
872
|
color: var(--bulma-text-weak);
|
|
870
873
|
font-weight: 400;
|