@yuneta/gobj-ui 7.26.7 → 7.26.9
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 +53 -0
- package/dist/gobj-ui.cjs.js +534 -232
- package/dist/gobj-ui.es.js +534 -232
- package/package.json +2 -2
- package/src/c_g6_nodes_tree.js +65 -31
- package/src/c_yui_form.js +230 -63
- package/src/c_yui_gclass.js +23 -22
- package/src/c_yui_gobj_tree_js.js +13 -9
- package/src/c_yui_json.js +7 -6
- package/src/c_yui_json_graph.js +8 -7
- package/src/c_yui_json_pad.js +2 -1
- package/src/c_yui_map.js +25 -1
- package/src/c_yui_nav.js +9 -8
- package/src/c_yui_schema_editor.js +25 -24
- package/src/c_yui_shell.js +64 -3
- package/src/c_yui_treedb_topic_with_form.js +26 -21
- package/src/c_yui_treedb_topics.js +17 -16
- package/src/c_yui_window.js +73 -32
- package/src/c_yui_window_manager.js +3 -2
- package/src/form_json_field.js +10 -3
- package/src/form_json_field.test.js +6 -0
- package/src/form_json_field.wiring.test.js +1 -1
- package/src/form_table_rearm.wiring.test.js +158 -0
- package/src/form_toolbar_plan.js +5 -5
- package/src/g6_event_kw.js +36 -0
- package/src/map_stop_windows.wiring.test.js +112 -0
- package/src/nav_cards_helpers.js +2 -1
- package/src/nav_cards_helpers.test.js +7 -3
- package/src/overlay_marker_after_back.wiring.test.js +212 -0
- package/src/schema_to_c.js +10 -0
- package/src/schema_to_c.test.js +8 -1
- package/src/shell_modals.js +7 -5
- package/src/shell_route_map.js +12 -13
- package/src/treedb_topics_transport.wiring.test.js +26 -0
- package/src/vite_plugin_yuneta_html.test.js +94 -0
- package/src/window_show.wiring.test.js +83 -0
- package/src/window_veto_back.wiring.test.js +35 -0
- package/src/yui_asset.js +3 -2
- package/src/yui_data_color.js +33 -0
- package/src/yui_data_color.test.js +27 -0
- package/src/yui_dev.js +15 -13
- package/src/yui_frontend_view.js +4 -4
- package/src/yui_gclass_view.js +3 -3
- package/src/yui_text.js +43 -0
- package/src/yui_text.test.js +67 -0
- package/vite-plugin-yuneta-html.js +24 -5
package/src/c_yui_gclass.js
CHANGED
|
@@ -85,6 +85,7 @@ import {yui_copy_json, yui_button_mark_done} from "./yui_clipboard.js";
|
|
|
85
85
|
import {t} from "i18next";
|
|
86
86
|
|
|
87
87
|
import "./c_yui_gclass.css";
|
|
88
|
+
import {text_node} from "./yui_text.js";
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
/***************************************************************
|
|
@@ -451,7 +452,7 @@ function render_raw(gobj)
|
|
|
451
452
|
|
|
452
453
|
let dump = json_text_dump(description, MAX_RAW_CHARS);
|
|
453
454
|
let children = [
|
|
454
|
-
['pre', {class: 'GCLASS_RAW_BODY'}, dump.text]
|
|
455
|
+
['pre', {class: 'GCLASS_RAW_BODY'}, document.createTextNode(String(dump.text))]
|
|
455
456
|
];
|
|
456
457
|
if(dump.capped) {
|
|
457
458
|
children.push(
|
|
@@ -568,7 +569,7 @@ function build_head(gobj, model)
|
|
|
568
569
|
}
|
|
569
570
|
|
|
570
571
|
for(let flag of model.gcflag) {
|
|
571
|
-
items.push(['span', {class: 'GCLASS_CHIP GCLASS_GCFLAG'}, flag]);
|
|
572
|
+
items.push(['span', {class: 'GCLASS_CHIP GCLASS_GCFLAG'}, text_node(flag)]);
|
|
572
573
|
}
|
|
573
574
|
|
|
574
575
|
let current = gobj_read_str_attr(gobj, "current_state");
|
|
@@ -710,7 +711,7 @@ function flag_chips(flags)
|
|
|
710
711
|
} else if(flag.indexOf("REQUIRED") >= 0) {
|
|
711
712
|
cls += ' is-required';
|
|
712
713
|
}
|
|
713
|
-
return ['span', {class: cls}, flag];
|
|
714
|
+
return ['span', {class: cls}, text_node(flag)];
|
|
714
715
|
});
|
|
715
716
|
}
|
|
716
717
|
|
|
@@ -725,13 +726,13 @@ function build_attrs(attrs)
|
|
|
725
726
|
|
|
726
727
|
let rows = attrs.map(function(a) {
|
|
727
728
|
return ['tr', row_attrs(`${a.id} ${a.type} ${a.flags.join(" ")} ${a.description}`), [
|
|
728
|
-
['td', {class: 'GCLASS_CELL_KEY'}, a.id],
|
|
729
|
-
['td', {class: 'GCLASS_CELL_TYPE'}, a.type],
|
|
729
|
+
['td', {class: 'GCLASS_CELL_KEY'}, text_node(a.id)],
|
|
730
|
+
['td', {class: 'GCLASS_CELL_TYPE'}, text_node(a.type)],
|
|
730
731
|
['td', {class: 'GCLASS_CELL_FLAGS'}, flag_chips(a.flags)],
|
|
731
732
|
/* What a remote yuno answers is data, not markup: Text nodes,
|
|
732
733
|
* or a default starting with '<' would be parsed as HTML. */
|
|
733
|
-
['td', {class: 'GCLASS_CELL_DEFAULT'},
|
|
734
|
-
['td', {class: 'GCLASS_CELL_DESC'},
|
|
734
|
+
['td', {class: 'GCLASS_CELL_DEFAULT'}, text_node(a.default_value)],
|
|
735
|
+
['td', {class: 'GCLASS_CELL_DESC'}, text_node(a.description)]
|
|
735
736
|
]];
|
|
736
737
|
});
|
|
737
738
|
|
|
@@ -767,20 +768,20 @@ function build_commands(commands)
|
|
|
767
768
|
for(let c of commands) {
|
|
768
769
|
if(c.kind === "section") {
|
|
769
770
|
rows.push(['tr', row_attrs(c.label, {class: 'GCLASS_ROW GCLASS_CMD_SECTION'}), [
|
|
770
|
-
['td', {colspan: '2'}, c.label]
|
|
771
|
+
['td', {colspan: '2'}, text_node(c.label)]
|
|
771
772
|
]]);
|
|
772
773
|
continue;
|
|
773
774
|
}
|
|
774
775
|
|
|
775
|
-
let name_items = [['span', {class: 'GCLASS_CMD_NAME'}, c.id]];
|
|
776
|
+
let name_items = [['span', {class: 'GCLASS_CMD_NAME'}, text_node(c.id)]];
|
|
776
777
|
for(let alias of c.alias) {
|
|
777
|
-
name_items.push(['span', {class: 'GCLASS_CHIP GCLASS_ALIAS'}, alias]);
|
|
778
|
+
name_items.push(['span', {class: 'GCLASS_CHIP GCLASS_ALIAS'}, text_node(alias)]);
|
|
778
779
|
}
|
|
779
780
|
name_items = name_items.concat(flag_chips(c.flags));
|
|
780
781
|
|
|
781
782
|
rows.push(['tr', row_attrs(`${c.id} ${c.alias.join(" ")} ${c.description}`), [
|
|
782
783
|
['td', {class: 'GCLASS_CELL_KEY'}, name_items],
|
|
783
|
-
['td', {class: 'GCLASS_CELL_DESC'}, c.description]
|
|
784
|
+
['td', {class: 'GCLASS_CELL_DESC'}, text_node(c.description)]
|
|
784
785
|
]]);
|
|
785
786
|
|
|
786
787
|
for(let p of c.parameters) {
|
|
@@ -788,10 +789,10 @@ function build_commands(commands)
|
|
|
788
789
|
{class: 'GCLASS_ROW GCLASS_CMD_PARAM'}), [
|
|
789
790
|
['td', {class: 'GCLASS_CELL_KEY'}, [
|
|
790
791
|
['span', {class: 'GCLASS_PARAM_MARK'}, "↳"],
|
|
791
|
-
['span', {class: 'GCLASS_PARAM_NAME'}, p.id],
|
|
792
|
-
['span', {class: 'GCLASS_PARAM_TYPE'}, p.type]
|
|
792
|
+
['span', {class: 'GCLASS_PARAM_NAME'}, text_node(p.id)],
|
|
793
|
+
['span', {class: 'GCLASS_PARAM_TYPE'}, text_node(p.type)]
|
|
793
794
|
].concat(flag_chips(p.flags))],
|
|
794
|
-
['td', {class: 'GCLASS_CELL_DESC'}, p.description]
|
|
795
|
+
['td', {class: 'GCLASS_CELL_DESC'}, text_node(p.description)]
|
|
795
796
|
]]);
|
|
796
797
|
}
|
|
797
798
|
}
|
|
@@ -842,8 +843,8 @@ function build_traces(levels)
|
|
|
842
843
|
|
|
843
844
|
let rows = levels.map(function(l) {
|
|
844
845
|
return ['tr', row_attrs(`${l.id} ${l.description}`), [
|
|
845
|
-
['td', {class: 'GCLASS_CELL_KEY'}, l.id],
|
|
846
|
-
['td', {class: 'GCLASS_CELL_DESC'}, l.description]
|
|
846
|
+
['td', {class: 'GCLASS_CELL_KEY'}, text_node(l.id)],
|
|
847
|
+
['td', {class: 'GCLASS_CELL_DESC'}, text_node(l.description)]
|
|
847
848
|
]];
|
|
848
849
|
});
|
|
849
850
|
|
|
@@ -881,7 +882,7 @@ function build_machine(gobj, fsm)
|
|
|
881
882
|
];
|
|
882
883
|
for(let state of fsm.states) {
|
|
883
884
|
let cls = 'GCLASS_MX_STATE';
|
|
884
|
-
let items = [['span', {class: 'GCLASS_MX_STATE_NAME'}, state.name]];
|
|
885
|
+
let items = [['span', {class: 'GCLASS_MX_STATE_NAME'}, text_node(state.name)]];
|
|
885
886
|
|
|
886
887
|
if(state.name === current) {
|
|
887
888
|
cls += ' is-current';
|
|
@@ -901,7 +902,7 @@ function build_machine(gobj, fsm)
|
|
|
901
902
|
let body_rows = fsm.rows.map(function(row) {
|
|
902
903
|
let cells = [
|
|
903
904
|
['td', {class: 'GCLASS_MX_EVENT'},
|
|
904
|
-
[['span', {}, row.event]].concat(event_flag_chips(row.flags))]
|
|
905
|
+
[['span', {}, text_node(row.event)]].concat(event_flag_chips(row.flags))]
|
|
905
906
|
];
|
|
906
907
|
row.cells.forEach(function(cell, i) {
|
|
907
908
|
let state = fsm.states[i];
|
|
@@ -918,7 +919,7 @@ function build_machine(gobj, fsm)
|
|
|
918
919
|
|
|
919
920
|
let items = [];
|
|
920
921
|
if(cell.action) {
|
|
921
|
-
items.push(['span', {class: 'GCLASS_MX_ACTION'}, cell.action]);
|
|
922
|
+
items.push(['span', {class: 'GCLASS_MX_ACTION'}, text_node(cell.action)]);
|
|
922
923
|
} else if(cell.has_action) {
|
|
923
924
|
/* The C side cannot name an action: `states2json()`
|
|
924
925
|
* writes the literal "action" for all of them. A mark
|
|
@@ -940,7 +941,7 @@ function build_machine(gobj, fsm)
|
|
|
940
941
|
}
|
|
941
942
|
if(cell.next_state) {
|
|
942
943
|
items.push(['span', {class: 'GCLASS_MX_ARROW'}, "▸"]);
|
|
943
|
-
items.push(['span', {class: 'GCLASS_MX_NEXT'}, cell.next_state]);
|
|
944
|
+
items.push(['span', {class: 'GCLASS_MX_NEXT'}, text_node(cell.next_state)]);
|
|
944
945
|
}
|
|
945
946
|
|
|
946
947
|
cells.push(['td', {class: 'GCLASS_MX_CELL' +
|
|
@@ -967,7 +968,7 @@ function build_machine(gobj, fsm)
|
|
|
967
968
|
blocks.push(['div', {class: 'GCLASS_CHIPS GCLASS_PUBLISHED'},
|
|
968
969
|
fsm.published.map(function(p) {
|
|
969
970
|
return ['span', row_attrs(p.event, {class: 'GCLASS_PUB_ROW'}), [
|
|
970
|
-
['span', {class: 'GCLASS_CHIP GCLASS_PUB_EVENT'}, p.event]
|
|
971
|
+
['span', {class: 'GCLASS_CHIP GCLASS_PUB_EVENT'}, text_node(p.event)]
|
|
971
972
|
].concat(event_flag_chips(p.flags))];
|
|
972
973
|
})]);
|
|
973
974
|
}
|
|
@@ -1069,7 +1070,7 @@ function event_flag_chips(flags)
|
|
|
1069
1070
|
} else {
|
|
1070
1071
|
cls += ' is-public';
|
|
1071
1072
|
}
|
|
1072
|
-
return ['span', {class: cls}, flag.replace("EVF_", "")];
|
|
1073
|
+
return ['span', {class: cls}, text_node(flag.replace("EVF_", ""))];
|
|
1073
1074
|
});
|
|
1074
1075
|
}
|
|
1075
1076
|
|
|
@@ -81,6 +81,7 @@ import {
|
|
|
81
81
|
import { ensure_drag_canvas_patch } from "./g6_drag_canvas_touch.js";
|
|
82
82
|
import { ensure_pinch_zoom_patch } from "./g6_touch_gestures.js";
|
|
83
83
|
import { yui_is_dark, yui_theme_now, yui_watch_theme } from "./yui_theme.js";
|
|
84
|
+
import {g6_event_kw} from "./g6_event_kw.js";
|
|
84
85
|
|
|
85
86
|
/***************************************************************
|
|
86
87
|
* Constants
|
|
@@ -1183,12 +1184,7 @@ function build_graph(gobj)
|
|
|
1183
1184
|
graph.on(NodeEvent.CLICK, (evt) => {
|
|
1184
1185
|
/* An identity, never the G6 event: a kw is plain json, and the
|
|
1185
1186
|
* event is circular -- the machine trace dumps the kw. */
|
|
1186
|
-
|
|
1187
|
-
gobj_send_event(gobj, "EV_NODE_CLICK", {
|
|
1188
|
-
id: (evt && evt.target && evt.target.id)? String(evt.target.id) : "",
|
|
1189
|
-
client_x: (client && typeof client.x === "number")? client.x : 0,
|
|
1190
|
-
client_y: (client && typeof client.y === "number")? client.y : 0
|
|
1191
|
-
}, gobj);
|
|
1187
|
+
gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
|
|
1192
1188
|
});
|
|
1193
1189
|
|
|
1194
1190
|
graph.on(CanvasEvent.CLICK, (evt) => {
|
|
@@ -1760,7 +1756,9 @@ function restore_view_anchored(gobj, anchor)
|
|
|
1760
1756
|
if(typeof anchor.zoom === "number" && anchor.zoom > 0) {
|
|
1761
1757
|
try {
|
|
1762
1758
|
graph.zoomTo(anchor.zoom);
|
|
1763
|
-
} catch(e) {
|
|
1759
|
+
} catch(e) {
|
|
1760
|
+
log_warning(`${gobj_short_name(gobj)}: zoom not restored: ${e}`);
|
|
1761
|
+
}
|
|
1764
1762
|
}
|
|
1765
1763
|
|
|
1766
1764
|
/*
|
|
@@ -1772,7 +1770,9 @@ function restore_view_anchored(gobj, anchor)
|
|
|
1772
1770
|
let dx = anchor.viewport_x - vp[0];
|
|
1773
1771
|
let dy = anchor.viewport_y - vp[1];
|
|
1774
1772
|
graph.translateBy([dx, dy]);
|
|
1775
|
-
} catch(e) {
|
|
1773
|
+
} catch(e) {
|
|
1774
|
+
log_warning(`${gobj_short_name(gobj)}: anchor node not put back at its screen spot: ${e}`);
|
|
1775
|
+
}
|
|
1776
1776
|
}
|
|
1777
1777
|
|
|
1778
1778
|
/************************************************************
|
|
@@ -2715,7 +2715,11 @@ function ac_node_click(gobj, event, kw, src)
|
|
|
2715
2715
|
if(nd && nd.data) {
|
|
2716
2716
|
node_data = nd.data;
|
|
2717
2717
|
}
|
|
2718
|
-
} catch(e) {
|
|
2718
|
+
} catch(e) {
|
|
2719
|
+
/* G6 throws for an id it no longer holds (a click that raced
|
|
2720
|
+
* a redraw): the click lands on nothing. */
|
|
2721
|
+
log_warning(`${gobj_short_name(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
|
|
2722
|
+
}
|
|
2719
2723
|
}
|
|
2720
2724
|
|
|
2721
2725
|
if(!node_data) {
|
package/src/c_yui_json.js
CHANGED
|
@@ -111,6 +111,7 @@ import {attach_clear} from "./yui_inputs.js";
|
|
|
111
111
|
import {t} from "i18next";
|
|
112
112
|
|
|
113
113
|
import "./c_yui_json.css";
|
|
114
|
+
import {text_node} from "./yui_text.js";
|
|
114
115
|
|
|
115
116
|
|
|
116
117
|
/***************************************************************
|
|
@@ -884,7 +885,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows)
|
|
|
884
885
|
|
|
885
886
|
let key_spec = (key === null || key === "")
|
|
886
887
|
? null
|
|
887
|
-
: ['span', {class: 'JSON_KEY'},
|
|
888
|
+
: ['span', {class: 'JSON_KEY'}, text_node(key)];
|
|
888
889
|
|
|
889
890
|
let stub_text = (info.is_array ? "[" : "{") +
|
|
890
891
|
(size !== undefined ? String(size) : "?") +
|
|
@@ -895,7 +896,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows)
|
|
|
895
896
|
children.push(key_spec);
|
|
896
897
|
children.push(['span', {class: 'JSON_PUNCT'}, ': ']);
|
|
897
898
|
}
|
|
898
|
-
children.push(['span', {class: 'JSON_STUB'}, stub_text]);
|
|
899
|
+
children.push(['span', {class: 'JSON_STUB'}, text_node(stub_text)]);
|
|
899
900
|
children.push(['span', {class: 'JSON_STUB_HINT is-size-7 ml-2',
|
|
900
901
|
'data-i18n': is_pending ? 'loading' : 'click to load'},
|
|
901
902
|
is_pending ? 'loading' : 'click to load']);
|
|
@@ -935,7 +936,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value)
|
|
|
935
936
|
|
|
936
937
|
let body = [];
|
|
937
938
|
if(key !== null && key !== "") {
|
|
938
|
-
body.push(['span', {class: 'JSON_KEY'},
|
|
939
|
+
body.push(['span', {class: 'JSON_KEY'}, text_node(key)]);
|
|
939
940
|
body.push(['span', {class: 'JSON_PUNCT'}, ': ']);
|
|
940
941
|
}
|
|
941
942
|
body.push(['span', {class: 'JSON_SUMMARY yui-text-quiet'}, summary]);
|
|
@@ -952,7 +953,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value)
|
|
|
952
953
|
*/
|
|
953
954
|
let label = container_label(value, MAX_LABEL_CHARS);
|
|
954
955
|
if(label) {
|
|
955
|
-
body.push(['span', {class: 'JSON_SUMMARY_ID ml-2'}, label]);
|
|
956
|
+
body.push(['span', {class: 'JSON_SUMMARY_ID ml-2'}, text_node(label)]);
|
|
956
957
|
}
|
|
957
958
|
|
|
958
959
|
return ['div', {class: 'JSON_ROW JSON_CONTAINER', style: row_indent(depth)}, [
|
|
@@ -992,10 +993,10 @@ function leaf_row(key, value, depth)
|
|
|
992
993
|
|
|
993
994
|
let body = [];
|
|
994
995
|
if(key !== null && key !== "") {
|
|
995
|
-
body.push(['span', {class: 'JSON_KEY'},
|
|
996
|
+
body.push(['span', {class: 'JSON_KEY'}, text_node(key)]);
|
|
996
997
|
body.push(['span', {class: 'JSON_PUNCT'}, ': ']);
|
|
997
998
|
}
|
|
998
|
-
body.push(['span', {class: 'JSON_VALUE JSON_TYPE_' + type.toUpperCase()}, text]);
|
|
999
|
+
body.push(['span', {class: 'JSON_VALUE JSON_TYPE_' + type.toUpperCase()}, text_node(text)]);
|
|
999
1000
|
|
|
1000
1001
|
if(key !== null && is_time_field(String(key))) {
|
|
1001
1002
|
let wall = format_epoch(value);
|
package/src/c_yui_json_graph.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
gclass_create,
|
|
18
18
|
gclass_find_by_name,
|
|
19
19
|
log_error,
|
|
20
|
+
log_warning,
|
|
20
21
|
gobj_read_pointer_attr,
|
|
21
22
|
gobj_parent,
|
|
22
23
|
gobj_subscribe_event,
|
|
@@ -81,6 +82,7 @@ import {
|
|
|
81
82
|
has_branch,
|
|
82
83
|
count_branches,
|
|
83
84
|
} from "./json_view_helpers.js";
|
|
85
|
+
import {g6_event_kw} from "./g6_event_kw.js";
|
|
84
86
|
|
|
85
87
|
/***************************************************************
|
|
86
88
|
* Constants
|
|
@@ -755,12 +757,7 @@ function build_graph(gobj)
|
|
|
755
757
|
graph.on(NodeEvent.CLICK, (evt) => {
|
|
756
758
|
/* An identity, never the G6 event: a kw is plain json, and the
|
|
757
759
|
* event is circular -- the machine trace dumps the kw. */
|
|
758
|
-
|
|
759
|
-
gobj_send_event(gobj, "EV_NODE_CLICK", {
|
|
760
|
-
id: (evt && evt.target && evt.target.id)? String(evt.target.id) : "",
|
|
761
|
-
client_x: (client && typeof client.x === "number")? client.x : 0,
|
|
762
|
-
client_y: (client && typeof client.y === "number")? client.y : 0
|
|
763
|
-
}, gobj);
|
|
760
|
+
gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
|
|
764
761
|
});
|
|
765
762
|
|
|
766
763
|
/* ONE hook for the readout, the same one the treedb graph uses:
|
|
@@ -2355,7 +2352,11 @@ function ac_node_click(gobj, event, kw, src)
|
|
|
2355
2352
|
let nodedata;
|
|
2356
2353
|
try {
|
|
2357
2354
|
nodedata = graph.getNodeData(node_id);
|
|
2358
|
-
} catch(e) {
|
|
2355
|
+
} catch(e) {
|
|
2356
|
+
/* G6 throws for an id it no longer holds (a click that raced a
|
|
2357
|
+
* redraw): the click lands on nothing. */
|
|
2358
|
+
log_warning(`${gobj_short_name(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
|
|
2359
|
+
}
|
|
2359
2360
|
|
|
2360
2361
|
/*
|
|
2361
2362
|
* A waiting anchor TAKES the click: it is what the reader armed
|
package/src/c_yui_json_pad.js
CHANGED
|
@@ -110,6 +110,7 @@ import {json_diff_rows} from "./json_view_helpers.js";
|
|
|
110
110
|
import {t} from "i18next";
|
|
111
111
|
|
|
112
112
|
import "./c_yui_json_pad.css";
|
|
113
|
+
import {text_node} from "./yui_text.js";
|
|
113
114
|
|
|
114
115
|
/***************************************************************
|
|
115
116
|
* Constants
|
|
@@ -605,7 +606,7 @@ function render_diff(gobj)
|
|
|
605
606
|
['tbody', {}, rows.map((row) => {
|
|
606
607
|
return ['tr', {class: `JSON_PAD_DIFF_ROW JSON_PAD_DIFF_${row.kind.toUpperCase()}`}, [
|
|
607
608
|
['td', {}, [KIND_TAG[row.kind]()]],
|
|
608
|
-
['td', {class: 'JSON_PAD_DIFF_PATH'}, row.id],
|
|
609
|
+
['td', {class: 'JSON_PAD_DIFF_PATH'}, text_node(row.id)],
|
|
609
610
|
value_cell('JSON_PAD_DIFF_FROM', row, 'from'),
|
|
610
611
|
value_cell('JSON_PAD_DIFF_TO', row, 'to')
|
|
611
612
|
]];
|
package/src/c_yui_map.js
CHANGED
|
@@ -31,6 +31,10 @@ import {
|
|
|
31
31
|
gobj_name,
|
|
32
32
|
gobj_unsubscribe_event,
|
|
33
33
|
gobj_stop_children,
|
|
34
|
+
gobj_match_children,
|
|
35
|
+
gobj_is_running,
|
|
36
|
+
gobj_stop,
|
|
37
|
+
gobj_destroy,
|
|
34
38
|
} from "@yuneta/gobj-js";
|
|
35
39
|
|
|
36
40
|
import "maplibre-gl/dist/maplibre-gl.css"; // Import MapLibre styles
|
|
@@ -309,11 +313,31 @@ function mt_stop(gobj)
|
|
|
309
313
|
if(shell) {
|
|
310
314
|
gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
311
315
|
}
|
|
312
|
-
/* The marker windows are children of the map
|
|
316
|
+
/* The marker windows are children of the map, and they go with it:
|
|
317
|
+
* a C_YUI_WINDOW has no mt_stop, so stopping one leaves it on screen
|
|
318
|
+
* holding its service name. They are destroyed here, not in
|
|
319
|
+
* mt_destroy (gobj_destroy() destroys the children BEFORE calling
|
|
320
|
+
* mt_destroy). */
|
|
321
|
+
retire_marker_windows(gobj);
|
|
313
322
|
gobj_stop_children(gobj);
|
|
314
323
|
return 0;
|
|
315
324
|
}
|
|
316
325
|
|
|
326
|
+
/***************************************************************
|
|
327
|
+
* Destroy the windows the markers opened.
|
|
328
|
+
***************************************************************/
|
|
329
|
+
function retire_marker_windows(gobj)
|
|
330
|
+
{
|
|
331
|
+
let windows = gobj_match_children(gobj, {__gclass_name__: "C_YUI_WINDOW"}) || [];
|
|
332
|
+
for(let win of windows) {
|
|
333
|
+
if(gobj_is_running(win)) {
|
|
334
|
+
gobj_stop(win);
|
|
335
|
+
}
|
|
336
|
+
gobj_stop_children(win);
|
|
337
|
+
gobj_destroy(win);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
317
341
|
/***************************************************************
|
|
318
342
|
* Framework Method: Destroy
|
|
319
343
|
***************************************************************/
|
package/src/c_yui_nav.js
CHANGED
|
@@ -82,6 +82,7 @@ import {
|
|
|
82
82
|
breakpoints_from_expr,
|
|
83
83
|
bulma_hidden_class,
|
|
84
84
|
} from "./shell_show_on.js";
|
|
85
|
+
import {text_node} from "./yui_text.js";
|
|
85
86
|
|
|
86
87
|
/***************************************************************
|
|
87
88
|
* Constants
|
|
@@ -411,7 +412,7 @@ function render_tabs(gobj, items)
|
|
|
411
412
|
["i", {class: it.icon, "aria-hidden":"true"}]]);
|
|
412
413
|
}
|
|
413
414
|
if(show_label && !empty_string(it.name)) {
|
|
414
|
-
children.push(["span", {i18n: it.name}, it.name]);
|
|
415
|
+
children.push(["span", {i18n: it.name}, text_node(it.name)]);
|
|
415
416
|
}
|
|
416
417
|
/* Optional close affordance: a trailing ✕ that emits
|
|
417
418
|
* EV_NAV_ITEM_CLOSE instead of navigating (caught first in
|
|
@@ -495,7 +496,7 @@ function render_breadcrumb(gobj, items)
|
|
|
495
496
|
}
|
|
496
497
|
if(show_label !== false) {
|
|
497
498
|
let label = it.name || it.id || "";
|
|
498
|
-
children.push(["span", {class: "yui-nav-label", i18n: label}, label]);
|
|
499
|
+
children.push(["span", {class: "yui-nav-label", i18n: label}, text_node(label)]);
|
|
499
500
|
}
|
|
500
501
|
let a_attrs = {
|
|
501
502
|
class: "yui-nav-item yui-nav-crumb",
|
|
@@ -541,7 +542,7 @@ function render_backbar(gobj)
|
|
|
541
542
|
["a", a_attrs, [
|
|
542
543
|
["span", {class: "icon is-small"},
|
|
543
544
|
["i", {class: "yi-arrow-left", "aria-hidden": "true"}]],
|
|
544
|
-
["span", label_attrs, label]
|
|
545
|
+
["span", label_attrs, text_node(label)]
|
|
545
546
|
]]
|
|
546
547
|
]
|
|
547
548
|
);
|
|
@@ -596,7 +597,7 @@ function render_submenu(gobj, items)
|
|
|
596
597
|
return createElement2(
|
|
597
598
|
["aside", {class: "menu p-2"},
|
|
598
599
|
[
|
|
599
|
-
["p", heading_attrs, heading_text],
|
|
600
|
+
["p", heading_attrs, text_node(heading_text)],
|
|
600
601
|
["ul", {class: "menu-list"}, lis]
|
|
601
602
|
]
|
|
602
603
|
]
|
|
@@ -638,7 +639,7 @@ function render_accordion(gobj, items)
|
|
|
638
639
|
head_attrs["aria-label"] = head_text;
|
|
639
640
|
head_attrs["data-i18n-aria-label"] = head_text;
|
|
640
641
|
}
|
|
641
|
-
let $hdr = createElement2(["button", head_attrs, head_text]);
|
|
642
|
+
let $hdr = createElement2(["button", head_attrs, text_node(head_text)]);
|
|
642
643
|
$container.appendChild($hdr);
|
|
643
644
|
|
|
644
645
|
let $ul = createElement2(
|
|
@@ -683,7 +684,7 @@ function item_li(gobj, it, opts)
|
|
|
683
684
|
span_attrs.i18n = label;
|
|
684
685
|
}
|
|
685
686
|
return ["li", {class: "yui-nav-section-header", role: "presentation"},
|
|
686
|
-
["span", span_attrs, label]
|
|
687
|
+
["span", span_attrs, text_node(label)]
|
|
687
688
|
];
|
|
688
689
|
}
|
|
689
690
|
|
|
@@ -695,7 +696,7 @@ function item_li(gobj, it, opts)
|
|
|
695
696
|
? ["span", {class: "icon"}, ["i", {class: it.icon, "aria-hidden":"true"}]]
|
|
696
697
|
: null;
|
|
697
698
|
let label_el = (show_label && !empty_string(label))
|
|
698
|
-
? ["span", {class: "yui-nav-label", i18n: label}, label]
|
|
699
|
+
? ["span", {class: "yui-nav-label", i18n: label}, text_node(label)]
|
|
699
700
|
: null;
|
|
700
701
|
|
|
701
702
|
let a_class = "yui-nav-item";
|
|
@@ -764,7 +765,7 @@ function item_iconbar(gobj, it, opts)
|
|
|
764
765
|
["i", {class: it.icon, "aria-hidden":"true"}]]
|
|
765
766
|
: null;
|
|
766
767
|
let label_el = (show_label && !empty_string(label))
|
|
767
|
-
? ["span", {class: "yui-nav-label is-size-7", i18n: label}, label]
|
|
768
|
+
? ["span", {class: "yui-nav-label is-size-7", i18n: label}, text_node(label)]
|
|
768
769
|
: null;
|
|
769
770
|
|
|
770
771
|
let children = [];
|
|
@@ -158,6 +158,7 @@ import {
|
|
|
158
158
|
} from "./shell_modals.js";
|
|
159
159
|
|
|
160
160
|
import {t} from "i18next";
|
|
161
|
+
import {text_node} from "./yui_text.js";
|
|
161
162
|
|
|
162
163
|
|
|
163
164
|
/***************************************************************
|
|
@@ -1028,7 +1029,7 @@ function show_notice(gobj, key, detail, detail_is_key)
|
|
|
1028
1029
|
attrs.i18n = `${detail}`;
|
|
1029
1030
|
}
|
|
1030
1031
|
$notice.appendChild(createElement2(
|
|
1031
|
-
["span", attrs, detail_is_key ? t(`${detail}`) : `${detail}`]
|
|
1032
|
+
["span", attrs, text_node(detail_is_key ? t(`${detail}`) : `${detail}`)]
|
|
1032
1033
|
));
|
|
1033
1034
|
}
|
|
1034
1035
|
}
|
|
@@ -1111,11 +1112,11 @@ function render_toolbar(gobj)
|
|
|
1111
1112
|
];
|
|
1112
1113
|
if(priv.treedb_id) {
|
|
1113
1114
|
$trail.push(["span", {class: "SCHEMA_CRUMB_SEP"}, "/"]);
|
|
1114
|
-
$trail.push(["span", {class: "SCHEMA_CRUMB_TREEDB"}, priv.treedb_id]);
|
|
1115
|
+
$trail.push(["span", {class: "SCHEMA_CRUMB_TREEDB"}, text_node(priv.treedb_id)]);
|
|
1115
1116
|
}
|
|
1116
1117
|
if(priv.topic_name) {
|
|
1117
1118
|
$trail.push(["span", {class: "SCHEMA_CRUMB_SEP"}, "/"]);
|
|
1118
|
-
$trail.push(["span", {class: "SCHEMA_CRUMB_TOPIC"}, priv.topic_name]);
|
|
1119
|
+
$trail.push(["span", {class: "SCHEMA_CRUMB_TOPIC"}, text_node(priv.topic_name)]);
|
|
1119
1120
|
}
|
|
1120
1121
|
if(priv.diagram) {
|
|
1121
1122
|
$trail.push(["span", {class: "SCHEMA_CRUMB_SEP"}, "/"]);
|
|
@@ -1272,7 +1273,7 @@ function open_card(gobj, logical, title, icon, tags, event, kw)
|
|
|
1272
1273
|
return ["span", {class: `${logical}_TAG tag ${tag.style || ""}`.trimEnd()},
|
|
1273
1274
|
tag.i18n
|
|
1274
1275
|
? [["span", {i18n: tag.i18n}, t(tag.i18n)],
|
|
1275
|
-
["span", {class: "ml-1"},
|
|
1276
|
+
["span", {class: "ml-1"}, text_node(tag.text)]]
|
|
1276
1277
|
: `${tag.text}`];
|
|
1277
1278
|
});
|
|
1278
1279
|
|
|
@@ -1281,7 +1282,7 @@ function open_card(gobj, logical, title, icon, tags, event, kw)
|
|
|
1281
1282
|
["p", {class: `${logical}_TITLE is-flex is-align-items-center`,
|
|
1282
1283
|
style: "gap:.4rem;"}, [
|
|
1283
1284
|
["span", {class: "icon"}, [["i", {class: icon}]]],
|
|
1284
|
-
["span", {class: `${logical}_NAME has-text-weight-semibold`},
|
|
1285
|
+
["span", {class: `${logical}_NAME has-text-weight-semibold`}, text_node(title)]
|
|
1285
1286
|
]],
|
|
1286
1287
|
["div", {class: `${logical}_TAGS tags mt-2`, style: "gap:.25rem;"}, $tags]
|
|
1287
1288
|
]]
|
|
@@ -1384,7 +1385,7 @@ function render_topics(gobj, $body)
|
|
|
1384
1385
|
|
|
1385
1386
|
$rows.push(["tr", {class: "SCHEMA_TOPIC_ROW", role: "button", tabindex: "0"}, [
|
|
1386
1387
|
["td", {class: "SCHEMA_TOPIC_NAME"}, [
|
|
1387
|
-
["span", {class: "has-text-weight-semibold"},
|
|
1388
|
+
["span", {class: "has-text-weight-semibold"}, text_node(topic.name)],
|
|
1388
1389
|
topic.system_topic
|
|
1389
1390
|
? ["span", {class: "SCHEMA_TOPIC_SYSTEM tag ml-2",
|
|
1390
1391
|
i18n: "system"}, t("system")]
|
|
@@ -1398,14 +1399,14 @@ function render_topics(gobj, $body)
|
|
|
1398
1399
|
: ["span", {}, ""],
|
|
1399
1400
|
ambiguous
|
|
1400
1401
|
? ["div", {class: "SCHEMA_TOPIC_ID is-size-7 yui-text-quiet"},
|
|
1401
|
-
[["code", {},
|
|
1402
|
+
[["code", {}, text_node(topic.id)]]]
|
|
1402
1403
|
: ["span", {}, ""]
|
|
1403
1404
|
]],
|
|
1404
|
-
["td", {class: "SCHEMA_TOPIC_PKEY"}, [["code", {},
|
|
1405
|
-
["td", {class: "SCHEMA_TOPIC_COLS has-text-right"},
|
|
1405
|
+
["td", {class: "SCHEMA_TOPIC_PKEY"}, [["code", {}, text_node(topic.pkey || "id")]]],
|
|
1406
|
+
["td", {class: "SCHEMA_TOPIC_COLS has-text-right"}, text_node(topic.cols.length)],
|
|
1406
1407
|
["td", {class: "SCHEMA_TOPIC_VERSION"}, [
|
|
1407
1408
|
["span", {class: `tag ${pending ? "is-warning" : "is-info"} is-light`},
|
|
1408
|
-
|
|
1409
|
+
text_node(topic.topic_version === undefined ? "?" : topic.topic_version)]
|
|
1409
1410
|
]],
|
|
1410
1411
|
["td", {class: "SCHEMA_TOPIC_ACTIONS has-text-right"}, $actions]
|
|
1411
1412
|
], {
|
|
@@ -1615,7 +1616,7 @@ function column_row(gobj, topic, col, index, readonly, twice)
|
|
|
1615
1616
|
* open_card(). It is why 'writable', 'image', 'wild' and every
|
|
1616
1617
|
* other unstyled flag rendered as an empty pill. */
|
|
1617
1618
|
return ["span", {class: `SCHEMA_COL_FLAG tag ${yui_tint(flag_style(flag))}`.trimEnd()},
|
|
1618
|
-
|
|
1619
|
+
text_node(flag)];
|
|
1619
1620
|
});
|
|
1620
1621
|
|
|
1621
1622
|
/* An unset `blob` column comes back as `{}`, which is an object and
|
|
@@ -1645,22 +1646,22 @@ function column_row(gobj, topic, col, index, readonly, twice)
|
|
|
1645
1646
|
readonly ? [] : [["span", {class: "icon yui-text-quiet"},
|
|
1646
1647
|
[["i", {class: "yi-grip-vertical"}]]]]],
|
|
1647
1648
|
["td", {class: "SCHEMA_COL_NAME"}, [
|
|
1648
|
-
["code", {},
|
|
1649
|
+
["code", {}, text_node(col.name)],
|
|
1649
1650
|
ambiguous
|
|
1650
1651
|
? ["span", {class: "SCHEMA_COL_ID is-size-7 yui-text-quiet ml-2"},
|
|
1651
|
-
[["code", {},
|
|
1652
|
+
[["code", {}, text_node(col.id)]]]
|
|
1652
1653
|
: ["span", {}, ""],
|
|
1653
1654
|
is_pkey
|
|
1654
1655
|
? ["span", {class: "SCHEMA_COL_PKEY tag is-info is-light ml-2",
|
|
1655
1656
|
i18n: "pkey"}, t("pkey")]
|
|
1656
1657
|
: ["span", {}, ""]
|
|
1657
1658
|
]],
|
|
1658
|
-
["td", {class: "SCHEMA_COL_HEADER"},
|
|
1659
|
-
["td", {class: "SCHEMA_COL_TYPE"}, [["code", {},
|
|
1659
|
+
["td", {class: "SCHEMA_COL_HEADER"}, text_node(record.header || "")],
|
|
1660
|
+
["td", {class: "SCHEMA_COL_TYPE"}, [["code", {}, text_node(record.type || "")]]],
|
|
1660
1661
|
["td", {class: "SCHEMA_COL_FLAGS"}, [
|
|
1661
1662
|
["div", {class: "tags", style: "gap:.2rem;"}, $flags]
|
|
1662
1663
|
]],
|
|
1663
|
-
["td", {class: "SCHEMA_COL_LINK"},
|
|
1664
|
+
["td", {class: "SCHEMA_COL_LINK"}, text_node(link)],
|
|
1664
1665
|
["td", {class: "SCHEMA_COL_ACTIONS has-text-right"}, $actions]
|
|
1665
1666
|
]]
|
|
1666
1667
|
);
|
|
@@ -2115,7 +2116,7 @@ function flags_field(gobj, type, current)
|
|
|
2115
2116
|
["input", el_attrs({type: "checkbox", class: "SCHEMA_FLAG_BOX",
|
|
2116
2117
|
"data-flag": flag.name,
|
|
2117
2118
|
checked: flag.on ? "checked" : undefined})],
|
|
2118
|
-
["span", {class: "SCHEMA_FLAG_NAME ml-1"},
|
|
2119
|
+
["span", {class: "SCHEMA_FLAG_NAME ml-1"}, text_node(flag.name)]
|
|
2119
2120
|
]];
|
|
2120
2121
|
});
|
|
2121
2122
|
|
|
@@ -2388,9 +2389,9 @@ function open_report(gobj, findings, treedb_id)
|
|
|
2388
2389
|
" is-light", i18n: finding.severity}, t(finding.severity)]
|
|
2389
2390
|
]],
|
|
2390
2391
|
["td", {class: "SCHEMA_REPORT_WHAT", i18n: finding.code}, t(finding.code)],
|
|
2391
|
-
["td", {class: "SCHEMA_REPORT_TOPIC"},
|
|
2392
|
-
["td", {class: "SCHEMA_REPORT_COL"},
|
|
2393
|
-
["td", {class: "SCHEMA_REPORT_DETAIL"}, [["code", {},
|
|
2392
|
+
["td", {class: "SCHEMA_REPORT_TOPIC"}, text_node(finding.topic || "")],
|
|
2393
|
+
["td", {class: "SCHEMA_REPORT_COL"}, text_node(finding.col || "")],
|
|
2394
|
+
["td", {class: "SCHEMA_REPORT_DETAIL"}, [["code", {}, text_node(finding.detail || "")]]]
|
|
2394
2395
|
]];
|
|
2395
2396
|
});
|
|
2396
2397
|
|
|
@@ -2663,7 +2664,7 @@ function render_import_plan(gobj, plan)
|
|
|
2663
2664
|
return ["li", {class: `SCHEMA_IMPORT_LINE SCHEMA_IMPORT_${write.op.toUpperCase()}`}, [
|
|
2664
2665
|
["span", {class: `tag is-light ${write.op === "delete" ? "is-danger" : "is-info"}`,
|
|
2665
2666
|
i18n: write.op}, t(write.op)],
|
|
2666
|
-
["code", {class: "ml-2"},
|
|
2667
|
+
["code", {class: "ml-2"}, text_node(what)]
|
|
2667
2668
|
]];
|
|
2668
2669
|
});
|
|
2669
2670
|
|
|
@@ -2671,9 +2672,9 @@ function render_import_plan(gobj, plan)
|
|
|
2671
2672
|
["div", {class: "SCHEMA_IMPORT_SUMMARY"}, [
|
|
2672
2673
|
["p", {class: "SCHEMA_IMPORT_COUNT is-size-7 yui-text-quiet mb-2"}, [
|
|
2673
2674
|
["span", {i18n: "writes"}, t("writes")],
|
|
2674
|
-
["span", {class: "ml-1"},
|
|
2675
|
+
["span", {class: "ml-1"}, text_node(plan.writes.length)],
|
|
2675
2676
|
["span", {class: "ml-3", i18n: "deletions"}, t("deletions")],
|
|
2676
|
-
["span", {class: "ml-1 has-text-weight-bold"},
|
|
2677
|
+
["span", {class: "ml-1 has-text-weight-bold"}, text_node(deletes.length)]
|
|
2677
2678
|
]],
|
|
2678
2679
|
["ul", {class: "SCHEMA_IMPORT_LINES is-size-7",
|
|
2679
2680
|
style: "max-height:14rem; overflow:auto;"}, $lines]
|
|
@@ -2698,7 +2699,7 @@ function open_orphans(gobj)
|
|
|
2698
2699
|
let row = (kind, entry) => {
|
|
2699
2700
|
return ["tr", {class: "SCHEMA_ORPHAN_ROW"}, [
|
|
2700
2701
|
["td", {class: "SCHEMA_ORPHAN_KIND", i18n: kind}, t(kind)],
|
|
2701
|
-
["td", {class: "SCHEMA_ORPHAN_ID"}, [["code", {},
|
|
2702
|
+
["td", {class: "SCHEMA_ORPHAN_ID"}, [["code", {}, text_node(entry.id)]]],
|
|
2702
2703
|
["td", {class: "SCHEMA_ORPHAN_ACTIONS has-text-right"},
|
|
2703
2704
|
readonly ? [] : [row_icon(gobj, "SCHEMA_ORPHAN_DELETE", "yi-trash", "delete",
|
|
2704
2705
|
"EV_DELETE_ORPHAN", {kind: kind, id: entry.id, model_gen: priv.model_gen})]]
|