@yuneta/gobj-ui 7.26.7 → 7.26.8
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 +372 -175
- package/dist/gobj-ui.es.js +372 -175
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +28 -24
- package/src/c_yui_form.js +197 -63
- package/src/c_yui_gclass.js +22 -21
- package/src/c_yui_gobj_tree_js.js +7 -7
- 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 +7 -6
- package/src/c_yui_schema_editor.js +3 -2
- package/src/c_yui_shell.js +7 -0
- package/src/c_yui_treedb_topic_with_form.js +22 -17
- package/src/c_yui_treedb_topics.js +8 -7
- package/src/c_yui_window.js +72 -31
- 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/g6_event_kw.js +36 -0
- package/src/nav_cards_helpers.js +2 -1
- package/src/nav_cards_helpers.test.js +7 -3
- package/src/schema_to_c.js +10 -0
- package/src/schema_to_c.test.js +8 -1
- package/src/shell_modals.js +5 -3
- 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 +79 -0
- package/src/window_show.wiring.test.js +83 -0
- package/src/window_veto_back.wiring.test.js +35 -0
- package/src/yui_dev.js +13 -11
- package/src/yui_frontend_view.js +4 -4
- package/src/yui_gclass_view.js +3 -3
- package/src/yui_text.js +31 -0
- package/src/yui_text.test.js +39 -0
- package/vite-plugin-yuneta-html.js +9 -4
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
|
}
|
|
@@ -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) => {
|
|
@@ -2715,7 +2711,11 @@ function ac_node_click(gobj, event, kw, src)
|
|
|
2715
2711
|
if(nd && nd.data) {
|
|
2716
2712
|
node_data = nd.data;
|
|
2717
2713
|
}
|
|
2718
|
-
} catch(e) {
|
|
2714
|
+
} catch(e) {
|
|
2715
|
+
/* G6 throws for an id it no longer holds (a click that raced
|
|
2716
|
+
* a redraw): the click lands on nothing. */
|
|
2717
|
+
log_warning(`${gobj_short_name(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
|
|
2718
|
+
}
|
|
2719
2719
|
}
|
|
2720
2720
|
|
|
2721
2721
|
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
|
);
|
|
@@ -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
|
/***************************************************************
|
|
@@ -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"}, "/"]);
|
package/src/c_yui_shell.js
CHANGED
|
@@ -2552,6 +2552,9 @@ function drain_overlays(gobj)
|
|
|
2552
2552
|
let kept = [];
|
|
2553
2553
|
while(entries.length > 0) {
|
|
2554
2554
|
let entry = entries.pop();
|
|
2555
|
+
if(entry.dismissed) {
|
|
2556
|
+
continue; // its owner went with an earlier close of this drain
|
|
2557
|
+
}
|
|
2555
2558
|
if(entry.keep_on_navigate) {
|
|
2556
2559
|
kept.unshift(entry);
|
|
2557
2560
|
continue;
|
|
@@ -2618,6 +2621,10 @@ function overlay_dismissed(gobj, entry)
|
|
|
2618
2621
|
if(!priv || !priv.overlay_stack || !entry) {
|
|
2619
2622
|
return;
|
|
2620
2623
|
}
|
|
2624
|
+
/* Marked even when it is no longer on the stack: drain_overlays()
|
|
2625
|
+
* works on a COPY, and an entry whose owner an earlier close of the
|
|
2626
|
+
* same drain already took down must not be closed a second time. */
|
|
2627
|
+
entry.dismissed = true;
|
|
2621
2628
|
let idx = priv.overlay_stack.indexOf(entry);
|
|
2622
2629
|
if(idx < 0) {
|
|
2623
2630
|
/* Already removed by the popstate handler (closed via Back). */
|
|
@@ -122,6 +122,7 @@ import "./tabulator.css";
|
|
|
122
122
|
import {cell_text, hook_cell_spec} from "./table_cell_text.js";
|
|
123
123
|
|
|
124
124
|
import { TabulatorFull as Tabulator } from "tabulator-tables";
|
|
125
|
+
import {text_node} from "./yui_text.js";
|
|
125
126
|
|
|
126
127
|
/***************************************************************
|
|
127
128
|
* Constants
|
|
@@ -612,8 +613,8 @@ function build_ui(gobj)
|
|
|
612
613
|
{
|
|
613
614
|
function create_table_toolbar()
|
|
614
615
|
{
|
|
615
|
-
// TODO
|
|
616
|
-
// TODO
|
|
616
|
+
// TODO authorization: only when the user may modify the data!!!
|
|
617
|
+
// TODO keep these buttons at the top when scrolling (clip ?)
|
|
617
618
|
let $table_toolbar = [];
|
|
618
619
|
/* One plan decides every write affordance (treedb_write_plan.js):
|
|
619
620
|
* `readonly` is the STATE of the topic and beats each with_* flag,
|
|
@@ -1886,9 +1887,9 @@ function create_tabulator(gobj)
|
|
|
1886
1887
|
tabulator._ready = true;
|
|
1887
1888
|
apply_row_filters(gobj);
|
|
1888
1889
|
update_rowcount();
|
|
1889
|
-
/*
|
|
1890
|
-
*
|
|
1891
|
-
*
|
|
1890
|
+
/* The ✕ of each header filter. A filter is removed by erasing what
|
|
1891
|
+
* was typed, and with several columns filtered, getting back to the
|
|
1892
|
+
* whole table meant remembering which ones were touched. */
|
|
1892
1893
|
yui_table_filter_clear(tabulator);
|
|
1893
1894
|
if(tabulator._pendingData !== undefined) {
|
|
1894
1895
|
tabulator.setData(tabulator._pendingData);
|
|
@@ -2146,7 +2147,7 @@ function build_json_cell_preview(value)
|
|
|
2146
2147
|
'data-i18n-aria-label': 'show json'
|
|
2147
2148
|
}, [
|
|
2148
2149
|
['span', {class: 'JSON_CELL_ICON icon yi-eye'}],
|
|
2149
|
-
['span', {class: 'JSON_CELL_PREVIEW'}, text]
|
|
2150
|
+
['span', {class: 'JSON_CELL_PREVIEW'}, text_node(text)]
|
|
2150
2151
|
]]
|
|
2151
2152
|
);
|
|
2152
2153
|
}
|
|
@@ -3002,7 +3003,7 @@ function open_cell_file_dialog(gobj, row_id, col_id)
|
|
|
3002
3003
|
['span', {class: 'CELL_FILE_LOADING', i18n: 'loading'}, 'loading']
|
|
3003
3004
|
]],
|
|
3004
3005
|
['div', {class: 'CELL_FILE_CAPTION'}, [
|
|
3005
|
-
['span', {class: 'CELL_FILE_ID'}, id]
|
|
3006
|
+
['span', {class: 'CELL_FILE_ID'}, text_node(id)]
|
|
3006
3007
|
]]
|
|
3007
3008
|
]]
|
|
3008
3009
|
));
|
|
@@ -3065,7 +3066,7 @@ function fill_cell_file_slot(gobj, pend, answer, error)
|
|
|
3065
3066
|
.filter((s) => !!s).join(" · ");
|
|
3066
3067
|
if(meta) {
|
|
3067
3068
|
$caption.appendChild(
|
|
3068
|
-
createElement2(['span', {class: 'CELL_FILE_META'}, meta])
|
|
3069
|
+
createElement2(['span', {class: 'CELL_FILE_META'}, text_node(meta)])
|
|
3069
3070
|
);
|
|
3070
3071
|
}
|
|
3071
3072
|
/* Full size, in the browser's own viewer: a photo is read at its
|
|
@@ -3149,7 +3150,7 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook)
|
|
|
3149
3150
|
'aria-label': t(tg.topic_name),
|
|
3150
3151
|
'data-i18n-aria-label': tg.topic_name
|
|
3151
3152
|
}, [
|
|
3152
|
-
['span', {i18n: tg.topic_name}, tg.topic_name]
|
|
3153
|
+
['span', {i18n: tg.topic_name}, text_node(tg.topic_name)]
|
|
3153
3154
|
], {
|
|
3154
3155
|
click: () => {
|
|
3155
3156
|
gobj_send_event(gobj, "EV_CHOOSE_LINKED", {
|
|
@@ -3489,13 +3490,17 @@ function transform__form_value_2_treedb_value(gobj, col, value, operation)
|
|
|
3489
3490
|
case "list":
|
|
3490
3491
|
case "coordinates":
|
|
3491
3492
|
case "blob": {
|
|
3492
|
-
/* A value that is no json of the column's shape
|
|
3493
|
-
*
|
|
3493
|
+
/* A value that is no json of the column's shape is logged and
|
|
3494
|
+
* handed on AS IT IS, the same as C_YUI_FORM does: an empty
|
|
3495
|
+
* {} / [] in its place is a value nobody wrote (a copy put it
|
|
3496
|
+
* on the clipboard, a save wiped the column). The form refuses
|
|
3497
|
+
* to save such a field before it gets here. */
|
|
3494
3498
|
let r = parse_json_field(value, field_desc.type);
|
|
3495
3499
|
if(r.error) {
|
|
3496
|
-
|
|
3500
|
+
log_error(`${gobj_short_name(gobj)}: column '${col.id}' (${field_desc.type}) holds no valid json, handed on as it is`);
|
|
3501
|
+
} else {
|
|
3502
|
+
value = r.value;
|
|
3497
3503
|
}
|
|
3498
|
-
value = r.value;
|
|
3499
3504
|
break;
|
|
3500
3505
|
}
|
|
3501
3506
|
|
|
@@ -3820,7 +3825,7 @@ function ac_load_nodes(gobj, event, kw, src)
|
|
|
3820
3825
|
}
|
|
3821
3826
|
|
|
3822
3827
|
/*
|
|
3823
|
-
* TODO
|
|
3828
|
+
* TODO scroll to the updated row ???
|
|
3824
3829
|
* Select only if it has update/create mode
|
|
3825
3830
|
*/
|
|
3826
3831
|
// if(data.length == 1) {
|
|
@@ -3860,7 +3865,7 @@ function ac_load_node_created(gobj, event, kw, src)
|
|
|
3860
3865
|
}
|
|
3861
3866
|
|
|
3862
3867
|
/*
|
|
3863
|
-
* TODO
|
|
3868
|
+
* TODO scroll to the updated row ???
|
|
3864
3869
|
* Select only if it has update/create mode
|
|
3865
3870
|
*/
|
|
3866
3871
|
|
|
@@ -3902,7 +3907,7 @@ function ac_load_node_updated(gobj, event, kw, src)
|
|
|
3902
3907
|
}
|
|
3903
3908
|
|
|
3904
3909
|
/*
|
|
3905
|
-
* TODO
|
|
3910
|
+
* TODO scroll to the updated row ???
|
|
3906
3911
|
* Select only if it has update/create mode
|
|
3907
3912
|
*/
|
|
3908
3913
|
|
|
@@ -4056,7 +4061,7 @@ function ac_new_row(gobj, event, kw, src)
|
|
|
4056
4061
|
return -1; /* Error already logged */
|
|
4057
4062
|
}
|
|
4058
4063
|
/*
|
|
4059
|
-
* Build default values. TODO
|
|
4064
|
+
* Build default values. TODO should this not be in the desc configuration?
|
|
4060
4065
|
*/
|
|
4061
4066
|
let row = {};
|
|
4062
4067
|
let desc = gobj_read_attr(gobj, "desc");
|
|
@@ -85,6 +85,7 @@ import {
|
|
|
85
85
|
} from "./treedb_topic_keys.js";
|
|
86
86
|
|
|
87
87
|
import {t} from "i18next";
|
|
88
|
+
import {text_node} from "./yui_text.js";
|
|
88
89
|
|
|
89
90
|
/***************************************************************
|
|
90
91
|
* Constants
|
|
@@ -440,7 +441,7 @@ function build_ui(gobj)
|
|
|
440
441
|
'TREEDB_TOPICS_SOURCE' : 'TREEDB_TOPICS_SOURCE is-hidden',
|
|
441
442
|
title: source_url, 'aria-label': source_url}, [
|
|
442
443
|
['span', {class: 'icon'}, [yui_toolbar_icon('yi-cloudversify')]],
|
|
443
|
-
['span', {class: 'TREEDB_TOPICS_SOURCE_URL'}, source_url]
|
|
444
|
+
['span', {class: 'TREEDB_TOPICS_SOURCE_URL'}, text_node(source_url)]
|
|
444
445
|
]],
|
|
445
446
|
...graph_items,
|
|
446
447
|
/* Inspect the treedb's raw tranger json (whole service,
|
|
@@ -622,7 +623,7 @@ function add_tab(gobj, gobj2, id, text, icon)
|
|
|
622
623
|
* TAB: Add text
|
|
623
624
|
*/
|
|
624
625
|
$a.appendChild(
|
|
625
|
-
createElement2(['span', {i18n: text, class: ''}, text])
|
|
626
|
+
createElement2(['span', {i18n: text, class: ''}, text_node(text)])
|
|
626
627
|
);
|
|
627
628
|
|
|
628
629
|
/*
|
|
@@ -824,7 +825,7 @@ function add_topic_card(gobj, id, text, icon, desc)
|
|
|
824
825
|
'aria-label': text, 'data-i18n-aria-label': text}, [
|
|
825
826
|
['span', {class: 'icon is-medium'}, [['i', {class: icon || 'yi-table',
|
|
826
827
|
'aria-hidden': 'true'}]]],
|
|
827
|
-
['span', {class: 'yui-nav-label', i18n: text}, text]
|
|
828
|
+
['span', {class: 'yui-nav-label', i18n: text}, text_node(text)]
|
|
828
829
|
]]
|
|
829
830
|
);
|
|
830
831
|
$card.addEventListener("click", function(ev) {
|
|
@@ -861,7 +862,7 @@ function add_topic_card(gobj, id, text, icon, desc)
|
|
|
861
862
|
|
|
862
863
|
let $card = createElement2(
|
|
863
864
|
['div', {class: 'TREEDB_TOPIC_CARD', 'data-topic': topic}, [
|
|
864
|
-
['span', {class: 'TREEDB_TOPIC_CARD_NAME', i18n: text}, text],
|
|
865
|
+
['span', {class: 'TREEDB_TOPIC_CARD_NAME', i18n: text}, text_node(text)],
|
|
865
866
|
...topic_card_meta(desc),
|
|
866
867
|
['div', {class: 'TREEDB_TOPIC_CARD_ACTIONS'}, actions]
|
|
867
868
|
]]
|
|
@@ -1169,15 +1170,15 @@ function build_topic_info_panel(gobj, $info, topic, desc)
|
|
|
1169
1170
|
push_meta("system", ["code", {title: `${desc.system_flag}`}, sf_names.join(" | ")]);
|
|
1170
1171
|
}
|
|
1171
1172
|
if(pkey) {
|
|
1172
|
-
push_meta("pkey", ["code", {}, pkey]);
|
|
1173
|
+
push_meta("pkey", ["code", {}, text_node(pkey)]);
|
|
1173
1174
|
}
|
|
1174
1175
|
if(pkey2s.length > 0) {
|
|
1175
1176
|
push_meta("pkey2s", ["span", {class: "tags"},
|
|
1176
|
-
pkey2s.map(name => ["span", {class: "tag is-warning"}, name])
|
|
1177
|
+
pkey2s.map(name => ["span", {class: "tag is-warning"}, text_node(name)])
|
|
1177
1178
|
]);
|
|
1178
1179
|
}
|
|
1179
1180
|
push_meta("tkey", tkey
|
|
1180
|
-
? ["code", {}, tkey]
|
|
1181
|
+
? ["code", {}, text_node(tkey)]
|
|
1181
1182
|
: ["span", {class: "has-text-grey", i18n: "append time"}, "append time"]
|
|
1182
1183
|
);
|
|
1183
1184
|
|