@yuneta/gobj-ui 7.26.11 → 7.26.13
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 +18 -8
- package/dist/gobj-ui.cjs.js +76 -16
- package/dist/gobj-ui.es.js +76 -16
- package/package.json +1 -1
- package/scripts/check-markup-strings.mjs +134 -28
- package/src/c_g6_nodes_tree.js +23 -6
- package/src/c_yui_gclass.js +2 -2
- package/src/c_yui_shell.js +124 -9
- package/src/c_yui_treedb_graph.js +2 -1
- package/src/gclass_head_text.wiring.test.js +63 -0
- package/src/overlay_marker_after_back.wiring.test.js +307 -17
package/README.md
CHANGED
|
@@ -3350,16 +3350,26 @@ text is in the yunetas `CLAUDE.md` ("JS GUI conventions"); in short:
|
|
|
3350
3350
|
must declare as a devDependency (npm does not install a dependency's
|
|
3351
3351
|
devDependencies). It lists a markup string literal in a description
|
|
3352
3352
|
(`literal`, wrap it in `html_markup()`), markup built with values
|
|
3353
|
-
(`built`: a template, a `+`
|
|
3354
|
-
`
|
|
3353
|
+
(`built`: a template, `String.raw`, a `+` chain, `.concat()`, a
|
|
3354
|
+
`[...].join()`, or a string method such as `.trim()` over one of those,
|
|
3355
|
+
whose STATIC head starts with `<` — empty pieces before it are skipped;
|
|
3356
|
+
build the element with `createElement2()` and pass the value as text),
|
|
3357
|
+
a markup string in a list
|
|
3355
3358
|
of children (`in-list`, which is text since gobj-js 7.26.2) and a list of
|
|
3356
3359
|
children whose first item is a markup string (`list-head`: such a list is
|
|
3357
|
-
read as one description). A ternary
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3360
|
+
read as one description). A ternary, `||`/`&&`/`??` and a comma
|
|
3361
|
+
sequence (its last item) are checked branch by branch; a tag is matched
|
|
3362
|
+
in any case; a pure string method over a static string
|
|
3363
|
+
(`'<b>s</b>'.toUpperCase()`) is still a `literal`. `.replace()` /
|
|
3364
|
+
`.replaceAll()` are NOT taken as keeping the head (they can remove it),
|
|
3365
|
+
so their result is not checked. It CANNOT see: a variable or a function
|
|
3366
|
+
result that holds a string (a helper that returns markup); the result of
|
|
3367
|
+
`.replace()`/`.replaceAll()`; a template whose head is an
|
|
3368
|
+
expression that is not a static string (`` `${prefix}<b>` ``); a
|
|
3369
|
+
description built piece by piece (`push()` into the content list); a
|
|
3370
|
+
computed tag with an attrs slot that is not an object literal; markup
|
|
3371
|
+
given to `innerHTML` or to a widget (Tabulator, G6). Step 3 is the check
|
|
3372
|
+
for those. A path that does not exist exits with 2 and a message.
|
|
3363
3373
|
2. Call `set_strings_are_text(true)` before the first `createElement2()`.
|
|
3364
3374
|
3. Walk the app and read the console: each string that starts with `<` is
|
|
3365
3375
|
logged once (*"use html_markup() if it is markup"*). A logged string is
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -974,6 +974,10 @@ var PRIVATE_DATA$22 = {
|
|
|
974
974
|
expected_pops: 0,
|
|
975
975
|
expected_pop_hash: "",
|
|
976
976
|
pending_markers: [],
|
|
977
|
+
last_hash: "",
|
|
978
|
+
markers_after_hashchange: false,
|
|
979
|
+
restore_hash: "",
|
|
980
|
+
skip_hash: "",
|
|
977
981
|
popstate_handler: null,
|
|
978
982
|
avatar_provider: null,
|
|
979
983
|
avatar_nodes: [],
|
|
@@ -1021,27 +1025,68 @@ function mt_start$20(gobj) {
|
|
|
1021
1025
|
build_toolbar$1(gobj, config);
|
|
1022
1026
|
preinstantiate_eager_views(gobj);
|
|
1023
1027
|
if ((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "use_hash")) {
|
|
1028
|
+
priv.last_hash = window.location.hash;
|
|
1024
1029
|
priv.hash_handler = () => {
|
|
1025
1030
|
let p = gobj.priv;
|
|
1026
|
-
if (p
|
|
1031
|
+
if (!p) return;
|
|
1032
|
+
let markers_now = p.markers_after_hashchange;
|
|
1033
|
+
p.markers_after_hashchange = false;
|
|
1034
|
+
if (p.skip_hash && window.location.hash === p.skip_hash) {
|
|
1035
|
+
p.skip_hash = "";
|
|
1036
|
+
p.last_hash = window.location.hash;
|
|
1037
|
+
if (markers_now) push_pending_markers(gobj);
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
p.skip_hash = "";
|
|
1041
|
+
if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
|
|
1042
|
+
drop_expected_pops(gobj);
|
|
1043
|
+
markers_now = true;
|
|
1044
|
+
}
|
|
1027
1045
|
let route = hash_to_route(window.location.hash);
|
|
1028
1046
|
if (!(0, _yuneta_gobj_js.empty_string)(route)) navigate_to(gobj, route);
|
|
1047
|
+
p.last_hash = window.location.hash;
|
|
1048
|
+
if (markers_now) push_pending_markers(gobj);
|
|
1029
1049
|
};
|
|
1030
1050
|
window.addEventListener("hashchange", priv.hash_handler);
|
|
1031
1051
|
priv.popstate_handler = (ev) => {
|
|
1032
1052
|
let p = gobj.priv;
|
|
1033
1053
|
if (!p) return;
|
|
1034
|
-
|
|
1054
|
+
let hash_moved = window.location.hash !== p.last_hash;
|
|
1055
|
+
if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
|
|
1056
|
+
drop_expected_pops(gobj);
|
|
1057
|
+
on_traversal(ev);
|
|
1058
|
+
if (hash_moved) p.markers_after_hashchange = true;
|
|
1059
|
+
else push_pending_markers(gobj);
|
|
1060
|
+
p.last_hash = window.location.hash;
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
on_traversal(ev);
|
|
1064
|
+
if (!p.skip_hash) p.last_hash = window.location.hash;
|
|
1065
|
+
};
|
|
1066
|
+
let on_traversal = (ev) => {
|
|
1067
|
+
let p = gobj.priv;
|
|
1035
1068
|
if (p.expected_pops > 0) {
|
|
1036
1069
|
p.expected_pops--;
|
|
1037
|
-
if (p.expected_pops === 0)
|
|
1070
|
+
if (p.expected_pops === 0) {
|
|
1071
|
+
if (p.restore_hash && p.restore_hash !== window.location.hash) try {
|
|
1072
|
+
window.history.replaceState(window.history.state, "", p.restore_hash);
|
|
1073
|
+
p.skip_hash = p.restore_hash;
|
|
1074
|
+
p.last_hash = p.restore_hash;
|
|
1075
|
+
} catch (e) {
|
|
1076
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: restoring '${p.restore_hash}' failed: ${e}`);
|
|
1077
|
+
}
|
|
1078
|
+
p.restore_hash = "";
|
|
1079
|
+
push_pending_markers(gobj);
|
|
1080
|
+
}
|
|
1038
1081
|
return;
|
|
1039
1082
|
}
|
|
1040
1083
|
if (p.overlay_stack.length === 0) return;
|
|
1041
1084
|
let top = p.overlay_stack[p.overlay_stack.length - 1];
|
|
1042
|
-
if (
|
|
1085
|
+
if (top.marker_pending || top.no_marker) return;
|
|
1086
|
+
if (window.location.hash !== top.hash && window.location.hash !== top.below_hash) return;
|
|
1043
1087
|
let st = ev && ev.state;
|
|
1044
1088
|
if (st && st.__yui_overlay__ === top.id) return;
|
|
1089
|
+
if (st && st.__yui_overlay__ > top.id && !p.overlay_stack.some((e) => e.id === st.__yui_overlay__)) return;
|
|
1045
1090
|
p.overlay_stack.pop();
|
|
1046
1091
|
try {
|
|
1047
1092
|
top.close();
|
|
@@ -1083,9 +1128,16 @@ function mt_stop$20(gobj) {
|
|
|
1083
1128
|
window.removeEventListener("popstate", priv.popstate_handler);
|
|
1084
1129
|
priv.popstate_handler = null;
|
|
1085
1130
|
}
|
|
1131
|
+
for (let entry of priv.pending_markers) {
|
|
1132
|
+
entry.marker_pending = false;
|
|
1133
|
+
entry.no_marker = true;
|
|
1134
|
+
}
|
|
1086
1135
|
priv.expected_pops = 0;
|
|
1087
1136
|
priv.expected_pop_hash = "";
|
|
1088
1137
|
priv.pending_markers = [];
|
|
1138
|
+
priv.markers_after_hashchange = false;
|
|
1139
|
+
priv.restore_hash = "";
|
|
1140
|
+
priv.skip_hash = "";
|
|
1089
1141
|
if (priv.keydown_handler) {
|
|
1090
1142
|
window.removeEventListener("keydown", priv.keydown_handler);
|
|
1091
1143
|
priv.keydown_handler = null;
|
|
@@ -1691,6 +1743,7 @@ function navigate_to(gobj, route, depth, no_drain) {
|
|
|
1691
1743
|
let target_hash = route_to_hash(route);
|
|
1692
1744
|
if (window.location.hash !== target_hash) try {
|
|
1693
1745
|
window.history.replaceState(window.history.state, "", target_hash);
|
|
1746
|
+
priv.last_hash = target_hash;
|
|
1694
1747
|
retag_overlay_hash(gobj, window.history.state, target_hash);
|
|
1695
1748
|
} catch (e) {
|
|
1696
1749
|
window.location.hash = target_hash;
|
|
@@ -2493,6 +2546,7 @@ function push_overlay_history(gobj, close, opts) {
|
|
|
2493
2546
|
}
|
|
2494
2547
|
function push_overlay_marker(gobj, entry) {
|
|
2495
2548
|
let priv = gobj.priv;
|
|
2549
|
+
entry.below_hash = window.location.hash;
|
|
2496
2550
|
try {
|
|
2497
2551
|
window.history.pushState({ __yui_overlay__: entry.id }, "");
|
|
2498
2552
|
} catch (e) {
|
|
@@ -2509,7 +2563,6 @@ function drop_expected_pops(gobj) {
|
|
|
2509
2563
|
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: ${priv.expected_pops} history.back() of ours did not land on '${priv.expected_pop_hash}' (now '${window.location.hash}'), dropped`);
|
|
2510
2564
|
priv.expected_pops = 0;
|
|
2511
2565
|
priv.expected_pop_hash = "";
|
|
2512
|
-
push_pending_markers(gobj);
|
|
2513
2566
|
}
|
|
2514
2567
|
function push_pending_markers(gobj) {
|
|
2515
2568
|
let priv = gobj.priv;
|
|
@@ -2528,11 +2581,12 @@ function overlay_dismissed(gobj, entry) {
|
|
|
2528
2581
|
let idx = priv.overlay_stack.indexOf(entry);
|
|
2529
2582
|
if (idx < 0) return;
|
|
2530
2583
|
priv.overlay_stack.splice(idx, 1);
|
|
2531
|
-
if (entry.marker_pending) return;
|
|
2584
|
+
if (entry.marker_pending || entry.no_marker) return;
|
|
2532
2585
|
let st = window.history.state;
|
|
2533
2586
|
if (st && st.__yui_overlay__ === entry.id) {
|
|
2534
2587
|
priv.expected_pops++;
|
|
2535
|
-
priv.expected_pop_hash = window.location.hash;
|
|
2588
|
+
priv.expected_pop_hash = typeof entry.below_hash === "string" ? entry.below_hash : window.location.hash;
|
|
2589
|
+
priv.restore_hash = window.location.hash !== priv.expected_pop_hash ? window.location.hash : "";
|
|
2536
2590
|
try {
|
|
2537
2591
|
window.history.back();
|
|
2538
2592
|
} catch (e) {
|
|
@@ -19057,7 +19111,7 @@ function build_head(gobj, model) {
|
|
|
19057
19111
|
let items = [[
|
|
19058
19112
|
"span",
|
|
19059
19113
|
{ class: "GCLASS_NAME" },
|
|
19060
|
-
model.id || (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "gclass_name") || "?"
|
|
19114
|
+
text_node(model.id || (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "gclass_name") || "?")
|
|
19061
19115
|
]];
|
|
19062
19116
|
if (model.instances !== null) items.push([
|
|
19063
19117
|
"span",
|
|
@@ -19088,7 +19142,7 @@ function build_head(gobj, model) {
|
|
|
19088
19142
|
title: (0, i18next.t)("current state"),
|
|
19089
19143
|
"data-i18n-title": "current state"
|
|
19090
19144
|
},
|
|
19091
|
-
current
|
|
19145
|
+
text_node(current)
|
|
19092
19146
|
]);
|
|
19093
19147
|
return [
|
|
19094
19148
|
"div",
|
|
@@ -60619,14 +60673,14 @@ var YuiToolbar = class extends _antv_g6.Toolbar {
|
|
|
60619
60673
|
async getDOMContent() {
|
|
60620
60674
|
return (await this.options.getItems()).map((item) => {
|
|
60621
60675
|
if (item.separator) return `<div class="g6-toolbar-sep" aria-hidden="true"></div>`;
|
|
60622
|
-
const extra_class = item.className ? ` ${item.className}` : "";
|
|
60623
|
-
const title = item.title ?? "";
|
|
60624
|
-
if (item.readout) return `<div class="g6-toolbar-readout${extra_class}" title="${title}" aria-label="${title}">${item.text ?? ""}</div>`;
|
|
60676
|
+
const extra_class = item.className ? ` ${(0, _yuneta_gobj_js.escapeHtml)(String(item.className))}` : "";
|
|
60677
|
+
const title = (0, _yuneta_gobj_js.escapeHtml)(String(item.title ?? ""));
|
|
60678
|
+
if (item.readout) return `<div class="g6-toolbar-readout${extra_class}" title="${title}" aria-label="${title}">${(0, _yuneta_gobj_js.escapeHtml)(String(item.text ?? ""))}</div>`;
|
|
60625
60679
|
const disabled = item.disabled ? " disabled" : "";
|
|
60626
60680
|
const is_text = item.text !== void 0;
|
|
60627
60681
|
const kind_class = is_text ? " g6-toolbar-item-text" : "";
|
|
60628
|
-
const body = is_text ? `<span class="g6-toolbar-text">${(0, _yuneta_gobj_js.escapeHtml)(String(item.text))}</span>` : `<svg aria-hidden="true" focusable="false"><use xlink:href="#${item.id}"></use></svg>`;
|
|
60629
|
-
return `<div class="g6-toolbar-item${kind_class}${extra_class}" value="${item.value}" title="${title}" aria-label="${title}"${disabled}>${body}</div>`;
|
|
60682
|
+
const body = is_text ? `<span class="g6-toolbar-text">${(0, _yuneta_gobj_js.escapeHtml)(String(item.text))}</span>` : `<svg aria-hidden="true" focusable="false"><use xlink:href="#${(0, _yuneta_gobj_js.escapeHtml)(String(item.id))}"></use></svg>`;
|
|
60683
|
+
return `<div class="g6-toolbar-item${kind_class}${extra_class}" value="${(0, _yuneta_gobj_js.escapeHtml)(String(item.value))}" title="${title}" aria-label="${title}"${disabled}>${body}</div>`;
|
|
60630
60684
|
}).join("");
|
|
60631
60685
|
}
|
|
60632
60686
|
};
|
|
@@ -61856,14 +61910,20 @@ function topic_defaults_of(gobj, topic_name) {
|
|
|
61856
61910
|
* refused value logs, and the node wears the topic's colour.
|
|
61857
61911
|
************************************************************/
|
|
61858
61912
|
var refused_colors_logged = /* @__PURE__ */ new Set();
|
|
61913
|
+
var REFUSED_COLORS_LOG_MAX = 200;
|
|
61914
|
+
var refused_colors_capped = false;
|
|
61859
61915
|
function data_color(gobj, value) {
|
|
61860
61916
|
if (value === void 0 || value === null || value === "") return null;
|
|
61861
61917
|
let color = css_color_or_null(value);
|
|
61862
61918
|
if (!color) {
|
|
61863
61919
|
let key = `${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}\u0000${String(value)}`;
|
|
61864
|
-
if (
|
|
61920
|
+
if (refused_colors_logged.has(key)) return color;
|
|
61921
|
+
if (refused_colors_logged.size < REFUSED_COLORS_LOG_MAX) {
|
|
61865
61922
|
refused_colors_logged.add(key);
|
|
61866
61923
|
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: colour refused, not a css colour: ${JSON.stringify(value)}`);
|
|
61924
|
+
} else if (!refused_colors_capped) {
|
|
61925
|
+
refused_colors_capped = true;
|
|
61926
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${REFUSED_COLORS_LOG_MAX} refused colours logged; further refused colours are not logged`);
|
|
61867
61927
|
}
|
|
61868
61928
|
}
|
|
61869
61929
|
return color;
|
|
@@ -70844,7 +70904,7 @@ function refresh_legend(gobj) {
|
|
|
70844
70904
|
class: "GRAPH_LEGEND_NAME",
|
|
70845
70905
|
style: (is_main ? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) + (hidden ? " text-decoration:line-through; opacity:.6;" : "")
|
|
70846
70906
|
},
|
|
70847
|
-
topic_name
|
|
70907
|
+
text_node(topic_name)
|
|
70848
70908
|
], [
|
|
70849
70909
|
"span",
|
|
70850
70910
|
{
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -969,6 +969,10 @@ var PRIVATE_DATA$22 = {
|
|
|
969
969
|
expected_pops: 0,
|
|
970
970
|
expected_pop_hash: "",
|
|
971
971
|
pending_markers: [],
|
|
972
|
+
last_hash: "",
|
|
973
|
+
markers_after_hashchange: false,
|
|
974
|
+
restore_hash: "",
|
|
975
|
+
skip_hash: "",
|
|
972
976
|
popstate_handler: null,
|
|
973
977
|
avatar_provider: null,
|
|
974
978
|
avatar_nodes: [],
|
|
@@ -1016,27 +1020,68 @@ function mt_start$20(gobj) {
|
|
|
1016
1020
|
build_toolbar$1(gobj, config);
|
|
1017
1021
|
preinstantiate_eager_views(gobj);
|
|
1018
1022
|
if (gobj_read_attr(gobj, "use_hash")) {
|
|
1023
|
+
priv.last_hash = window.location.hash;
|
|
1019
1024
|
priv.hash_handler = () => {
|
|
1020
1025
|
let p = gobj.priv;
|
|
1021
|
-
if (p
|
|
1026
|
+
if (!p) return;
|
|
1027
|
+
let markers_now = p.markers_after_hashchange;
|
|
1028
|
+
p.markers_after_hashchange = false;
|
|
1029
|
+
if (p.skip_hash && window.location.hash === p.skip_hash) {
|
|
1030
|
+
p.skip_hash = "";
|
|
1031
|
+
p.last_hash = window.location.hash;
|
|
1032
|
+
if (markers_now) push_pending_markers(gobj);
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
p.skip_hash = "";
|
|
1036
|
+
if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
|
|
1037
|
+
drop_expected_pops(gobj);
|
|
1038
|
+
markers_now = true;
|
|
1039
|
+
}
|
|
1022
1040
|
let route = hash_to_route(window.location.hash);
|
|
1023
1041
|
if (!empty_string(route)) navigate_to(gobj, route);
|
|
1042
|
+
p.last_hash = window.location.hash;
|
|
1043
|
+
if (markers_now) push_pending_markers(gobj);
|
|
1024
1044
|
};
|
|
1025
1045
|
window.addEventListener("hashchange", priv.hash_handler);
|
|
1026
1046
|
priv.popstate_handler = (ev) => {
|
|
1027
1047
|
let p = gobj.priv;
|
|
1028
1048
|
if (!p) return;
|
|
1029
|
-
|
|
1049
|
+
let hash_moved = window.location.hash !== p.last_hash;
|
|
1050
|
+
if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
|
|
1051
|
+
drop_expected_pops(gobj);
|
|
1052
|
+
on_traversal(ev);
|
|
1053
|
+
if (hash_moved) p.markers_after_hashchange = true;
|
|
1054
|
+
else push_pending_markers(gobj);
|
|
1055
|
+
p.last_hash = window.location.hash;
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
on_traversal(ev);
|
|
1059
|
+
if (!p.skip_hash) p.last_hash = window.location.hash;
|
|
1060
|
+
};
|
|
1061
|
+
let on_traversal = (ev) => {
|
|
1062
|
+
let p = gobj.priv;
|
|
1030
1063
|
if (p.expected_pops > 0) {
|
|
1031
1064
|
p.expected_pops--;
|
|
1032
|
-
if (p.expected_pops === 0)
|
|
1065
|
+
if (p.expected_pops === 0) {
|
|
1066
|
+
if (p.restore_hash && p.restore_hash !== window.location.hash) try {
|
|
1067
|
+
window.history.replaceState(window.history.state, "", p.restore_hash);
|
|
1068
|
+
p.skip_hash = p.restore_hash;
|
|
1069
|
+
p.last_hash = p.restore_hash;
|
|
1070
|
+
} catch (e) {
|
|
1071
|
+
log_warning(`C_YUI_SHELL: restoring '${p.restore_hash}' failed: ${e}`);
|
|
1072
|
+
}
|
|
1073
|
+
p.restore_hash = "";
|
|
1074
|
+
push_pending_markers(gobj);
|
|
1075
|
+
}
|
|
1033
1076
|
return;
|
|
1034
1077
|
}
|
|
1035
1078
|
if (p.overlay_stack.length === 0) return;
|
|
1036
1079
|
let top = p.overlay_stack[p.overlay_stack.length - 1];
|
|
1037
|
-
if (
|
|
1080
|
+
if (top.marker_pending || top.no_marker) return;
|
|
1081
|
+
if (window.location.hash !== top.hash && window.location.hash !== top.below_hash) return;
|
|
1038
1082
|
let st = ev && ev.state;
|
|
1039
1083
|
if (st && st.__yui_overlay__ === top.id) return;
|
|
1084
|
+
if (st && st.__yui_overlay__ > top.id && !p.overlay_stack.some((e) => e.id === st.__yui_overlay__)) return;
|
|
1040
1085
|
p.overlay_stack.pop();
|
|
1041
1086
|
try {
|
|
1042
1087
|
top.close();
|
|
@@ -1078,9 +1123,16 @@ function mt_stop$20(gobj) {
|
|
|
1078
1123
|
window.removeEventListener("popstate", priv.popstate_handler);
|
|
1079
1124
|
priv.popstate_handler = null;
|
|
1080
1125
|
}
|
|
1126
|
+
for (let entry of priv.pending_markers) {
|
|
1127
|
+
entry.marker_pending = false;
|
|
1128
|
+
entry.no_marker = true;
|
|
1129
|
+
}
|
|
1081
1130
|
priv.expected_pops = 0;
|
|
1082
1131
|
priv.expected_pop_hash = "";
|
|
1083
1132
|
priv.pending_markers = [];
|
|
1133
|
+
priv.markers_after_hashchange = false;
|
|
1134
|
+
priv.restore_hash = "";
|
|
1135
|
+
priv.skip_hash = "";
|
|
1084
1136
|
if (priv.keydown_handler) {
|
|
1085
1137
|
window.removeEventListener("keydown", priv.keydown_handler);
|
|
1086
1138
|
priv.keydown_handler = null;
|
|
@@ -1686,6 +1738,7 @@ function navigate_to(gobj, route, depth, no_drain) {
|
|
|
1686
1738
|
let target_hash = route_to_hash(route);
|
|
1687
1739
|
if (window.location.hash !== target_hash) try {
|
|
1688
1740
|
window.history.replaceState(window.history.state, "", target_hash);
|
|
1741
|
+
priv.last_hash = target_hash;
|
|
1689
1742
|
retag_overlay_hash(gobj, window.history.state, target_hash);
|
|
1690
1743
|
} catch (e) {
|
|
1691
1744
|
window.location.hash = target_hash;
|
|
@@ -2488,6 +2541,7 @@ function push_overlay_history(gobj, close, opts) {
|
|
|
2488
2541
|
}
|
|
2489
2542
|
function push_overlay_marker(gobj, entry) {
|
|
2490
2543
|
let priv = gobj.priv;
|
|
2544
|
+
entry.below_hash = window.location.hash;
|
|
2491
2545
|
try {
|
|
2492
2546
|
window.history.pushState({ __yui_overlay__: entry.id }, "");
|
|
2493
2547
|
} catch (e) {
|
|
@@ -2504,7 +2558,6 @@ function drop_expected_pops(gobj) {
|
|
|
2504
2558
|
log_warning(`C_YUI_SHELL: ${priv.expected_pops} history.back() of ours did not land on '${priv.expected_pop_hash}' (now '${window.location.hash}'), dropped`);
|
|
2505
2559
|
priv.expected_pops = 0;
|
|
2506
2560
|
priv.expected_pop_hash = "";
|
|
2507
|
-
push_pending_markers(gobj);
|
|
2508
2561
|
}
|
|
2509
2562
|
function push_pending_markers(gobj) {
|
|
2510
2563
|
let priv = gobj.priv;
|
|
@@ -2523,11 +2576,12 @@ function overlay_dismissed(gobj, entry) {
|
|
|
2523
2576
|
let idx = priv.overlay_stack.indexOf(entry);
|
|
2524
2577
|
if (idx < 0) return;
|
|
2525
2578
|
priv.overlay_stack.splice(idx, 1);
|
|
2526
|
-
if (entry.marker_pending) return;
|
|
2579
|
+
if (entry.marker_pending || entry.no_marker) return;
|
|
2527
2580
|
let st = window.history.state;
|
|
2528
2581
|
if (st && st.__yui_overlay__ === entry.id) {
|
|
2529
2582
|
priv.expected_pops++;
|
|
2530
|
-
priv.expected_pop_hash = window.location.hash;
|
|
2583
|
+
priv.expected_pop_hash = typeof entry.below_hash === "string" ? entry.below_hash : window.location.hash;
|
|
2584
|
+
priv.restore_hash = window.location.hash !== priv.expected_pop_hash ? window.location.hash : "";
|
|
2531
2585
|
try {
|
|
2532
2586
|
window.history.back();
|
|
2533
2587
|
} catch (e) {
|
|
@@ -19052,7 +19106,7 @@ function build_head(gobj, model) {
|
|
|
19052
19106
|
let items = [[
|
|
19053
19107
|
"span",
|
|
19054
19108
|
{ class: "GCLASS_NAME" },
|
|
19055
|
-
model.id || gobj_read_str_attr(gobj, "gclass_name") || "?"
|
|
19109
|
+
text_node(model.id || gobj_read_str_attr(gobj, "gclass_name") || "?")
|
|
19056
19110
|
]];
|
|
19057
19111
|
if (model.instances !== null) items.push([
|
|
19058
19112
|
"span",
|
|
@@ -19083,7 +19137,7 @@ function build_head(gobj, model) {
|
|
|
19083
19137
|
title: t("current state"),
|
|
19084
19138
|
"data-i18n-title": "current state"
|
|
19085
19139
|
},
|
|
19086
|
-
current
|
|
19140
|
+
text_node(current)
|
|
19087
19141
|
]);
|
|
19088
19142
|
return [
|
|
19089
19143
|
"div",
|
|
@@ -60614,14 +60668,14 @@ var YuiToolbar = class extends Toolbar {
|
|
|
60614
60668
|
async getDOMContent() {
|
|
60615
60669
|
return (await this.options.getItems()).map((item) => {
|
|
60616
60670
|
if (item.separator) return `<div class="g6-toolbar-sep" aria-hidden="true"></div>`;
|
|
60617
|
-
const extra_class = item.className ? ` ${item.className}` : "";
|
|
60618
|
-
const title = item.title ?? "";
|
|
60619
|
-
if (item.readout) return `<div class="g6-toolbar-readout${extra_class}" title="${title}" aria-label="${title}">${item.text ?? ""}</div>`;
|
|
60671
|
+
const extra_class = item.className ? ` ${escapeHtml(String(item.className))}` : "";
|
|
60672
|
+
const title = escapeHtml(String(item.title ?? ""));
|
|
60673
|
+
if (item.readout) return `<div class="g6-toolbar-readout${extra_class}" title="${title}" aria-label="${title}">${escapeHtml(String(item.text ?? ""))}</div>`;
|
|
60620
60674
|
const disabled = item.disabled ? " disabled" : "";
|
|
60621
60675
|
const is_text = item.text !== void 0;
|
|
60622
60676
|
const kind_class = is_text ? " g6-toolbar-item-text" : "";
|
|
60623
|
-
const body = is_text ? `<span class="g6-toolbar-text">${escapeHtml(String(item.text))}</span>` : `<svg aria-hidden="true" focusable="false"><use xlink:href="#${item.id}"></use></svg>`;
|
|
60624
|
-
return `<div class="g6-toolbar-item${kind_class}${extra_class}" value="${item.value}" title="${title}" aria-label="${title}"${disabled}>${body}</div>`;
|
|
60677
|
+
const body = is_text ? `<span class="g6-toolbar-text">${escapeHtml(String(item.text))}</span>` : `<svg aria-hidden="true" focusable="false"><use xlink:href="#${escapeHtml(String(item.id))}"></use></svg>`;
|
|
60678
|
+
return `<div class="g6-toolbar-item${kind_class}${extra_class}" value="${escapeHtml(String(item.value))}" title="${title}" aria-label="${title}"${disabled}>${body}</div>`;
|
|
60625
60679
|
}).join("");
|
|
60626
60680
|
}
|
|
60627
60681
|
};
|
|
@@ -61851,14 +61905,20 @@ function topic_defaults_of(gobj, topic_name) {
|
|
|
61851
61905
|
* refused value logs, and the node wears the topic's colour.
|
|
61852
61906
|
************************************************************/
|
|
61853
61907
|
var refused_colors_logged = /* @__PURE__ */ new Set();
|
|
61908
|
+
var REFUSED_COLORS_LOG_MAX = 200;
|
|
61909
|
+
var refused_colors_capped = false;
|
|
61854
61910
|
function data_color(gobj, value) {
|
|
61855
61911
|
if (value === void 0 || value === null || value === "") return null;
|
|
61856
61912
|
let color = css_color_or_null(value);
|
|
61857
61913
|
if (!color) {
|
|
61858
61914
|
let key = `${gobj_short_name(gobj)}\u0000${String(value)}`;
|
|
61859
|
-
if (
|
|
61915
|
+
if (refused_colors_logged.has(key)) return color;
|
|
61916
|
+
if (refused_colors_logged.size < REFUSED_COLORS_LOG_MAX) {
|
|
61860
61917
|
refused_colors_logged.add(key);
|
|
61861
61918
|
log_warning(`${gobj_short_name(gobj)}: colour refused, not a css colour: ${JSON.stringify(value)}`);
|
|
61919
|
+
} else if (!refused_colors_capped) {
|
|
61920
|
+
refused_colors_capped = true;
|
|
61921
|
+
log_warning(`${gobj_short_name(gobj)}: ${REFUSED_COLORS_LOG_MAX} refused colours logged; further refused colours are not logged`);
|
|
61862
61922
|
}
|
|
61863
61923
|
}
|
|
61864
61924
|
return color;
|
|
@@ -70839,7 +70899,7 @@ function refresh_legend(gobj) {
|
|
|
70839
70899
|
class: "GRAPH_LEGEND_NAME",
|
|
70840
70900
|
style: (is_main ? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) + (hidden ? " text-decoration:line-through; opacity:.6;" : "")
|
|
70841
70901
|
},
|
|
70842
|
-
topic_name
|
|
70902
|
+
text_node(topic_name)
|
|
70843
70903
|
], [
|
|
70844
70904
|
"span",
|
|
70845
70905
|
{
|
package/package.json
CHANGED
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
* All Rights Reserved.
|
|
48
48
|
***********************************************************************/
|
|
49
49
|
import {readFileSync, readdirSync, statSync, realpathSync} from "node:fs";
|
|
50
|
-
import {join, relative} from "node:path";
|
|
50
|
+
import {join, relative, resolve} from "node:path";
|
|
51
51
|
import {fileURLToPath} from "node:url";
|
|
52
52
|
import {parse} from "acorn";
|
|
53
53
|
|
|
54
|
-
const TAG_RE = /^[a-z][a-z0-9-]
|
|
54
|
+
const TAG_RE = /^[a-z][a-z0-9-]*$/i;
|
|
55
55
|
const SKIP_DIRS = new Set(["node_modules", "dist", ".git", "build", "_build"]);
|
|
56
56
|
|
|
57
57
|
function list_files(path, out)
|
|
@@ -91,37 +91,131 @@ function starts_with_markup(s)
|
|
|
91
91
|
return typeof s === "string" && s.trim().startsWith("<");
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
/*
|
|
95
|
-
*
|
|
96
|
-
|
|
94
|
+
/* String methods that keep the head of their receiver (a markup head
|
|
95
|
+
* stays a markup head through them). Not replace()/replaceAll(): they
|
|
96
|
+
* can take the head away ('<b>x</b>'.replace(/<[^>]+>/g, '') is text),
|
|
97
|
+
* so what they give back is not known. */
|
|
98
|
+
const HEAD_KEEPING_METHODS = new Set([
|
|
99
|
+
"trim", "trimStart", "trimEnd", "toString", "valueOf", "normalize",
|
|
100
|
+
"toLowerCase", "toUpperCase", "padEnd", "concat"
|
|
101
|
+
]);
|
|
102
|
+
|
|
103
|
+
/* The ones with no argument that give a static value from a static
|
|
104
|
+
* receiver: '<b>s</b>'.toUpperCase() is a literal, not built markup. */
|
|
105
|
+
const PURE_METHODS = new Set([
|
|
106
|
+
"trim", "trimStart", "trimEnd", "toString", "valueOf", "normalize",
|
|
107
|
+
"toLowerCase", "toUpperCase"
|
|
108
|
+
]);
|
|
109
|
+
|
|
110
|
+
function concat_parts(parts)
|
|
97
111
|
{
|
|
98
|
-
|
|
99
|
-
|
|
112
|
+
/* parts: [{text, complete}] in order. The leading text runs while
|
|
113
|
+
* the parts are static. */
|
|
114
|
+
let text = "";
|
|
115
|
+
for(const p of parts) {
|
|
116
|
+
if(p === null) {
|
|
117
|
+
return {text, complete: false};
|
|
118
|
+
}
|
|
119
|
+
text += p.text;
|
|
120
|
+
if(!p.complete) {
|
|
121
|
+
return {text, complete: false};
|
|
122
|
+
}
|
|
100
123
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
124
|
+
return {text, complete: true};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function template_parts(quasis, expressions, raw)
|
|
128
|
+
{
|
|
129
|
+
let parts = [];
|
|
130
|
+
for(let i = 0; i < quasis.length; i++) {
|
|
131
|
+
let q = quasis[i].value;
|
|
132
|
+
parts.push({text: raw ? q.raw : (q.cooked ?? ""), complete: true});
|
|
133
|
+
if(i < expressions.length) {
|
|
134
|
+
parts.push(leading(expressions[i]));
|
|
107
135
|
}
|
|
108
|
-
return built_markup(head);
|
|
109
136
|
}
|
|
110
|
-
|
|
111
|
-
|
|
137
|
+
return parts;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* The text an expression STARTS with, as far as it is static:
|
|
141
|
+
* {text, complete} (complete: the whole value is static), or null when
|
|
142
|
+
* it starts with something the check cannot see. */
|
|
143
|
+
function leading(n)
|
|
144
|
+
{
|
|
145
|
+
if(!n) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
if(is_string_literal(n)) {
|
|
149
|
+
return {text: n.value, complete: true};
|
|
150
|
+
}
|
|
151
|
+
if(n.type === "TemplateLiteral") {
|
|
152
|
+
return concat_parts(template_parts(n.quasis, n.expressions, false));
|
|
153
|
+
}
|
|
154
|
+
if(n.type === "TaggedTemplateExpression") {
|
|
155
|
+
let tag = n.tag;
|
|
156
|
+
if(tag.type === "MemberExpression" && !tag.computed &&
|
|
157
|
+
tag.object.type === "Identifier" && tag.object.name === "String" &&
|
|
158
|
+
tag.property.name === "raw") {
|
|
159
|
+
return concat_parts(template_parts(n.quasi.quasis, n.quasi.expressions, true));
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
112
162
|
}
|
|
113
163
|
if(n.type === "BinaryExpression" && n.operator === "+") {
|
|
114
|
-
let
|
|
115
|
-
|
|
116
|
-
|
|
164
|
+
let operands = [];
|
|
165
|
+
let flatten = (e) => {
|
|
166
|
+
if(e.type === "BinaryExpression" && e.operator === "+") {
|
|
167
|
+
flatten(e.left);
|
|
168
|
+
flatten(e.right);
|
|
169
|
+
} else {
|
|
170
|
+
operands.push(e);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
flatten(n);
|
|
174
|
+
return concat_parts(operands.map(leading));
|
|
175
|
+
}
|
|
176
|
+
if(n.type === "SequenceExpression") {
|
|
177
|
+
return leading(n.expressions[n.expressions.length - 1]);
|
|
178
|
+
}
|
|
179
|
+
if(n.type === "CallExpression" && n.callee.type === "MemberExpression" &&
|
|
180
|
+
!n.callee.computed) {
|
|
181
|
+
let method = n.callee.property.name;
|
|
182
|
+
let receiver = n.callee.object;
|
|
183
|
+
if(method === "join" && receiver.type === "ArrayExpression") {
|
|
184
|
+
let sep = n.arguments.length ? leading(n.arguments[0]) : {text: ",", complete: true};
|
|
185
|
+
let parts = [];
|
|
186
|
+
receiver.elements.forEach((el, k) => {
|
|
187
|
+
if(k > 0) {
|
|
188
|
+
parts.push(sep);
|
|
189
|
+
}
|
|
190
|
+
parts.push(leading(el));
|
|
191
|
+
});
|
|
192
|
+
return concat_parts(parts);
|
|
117
193
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
194
|
+
if(HEAD_KEEPING_METHODS.has(method)) {
|
|
195
|
+
let head = leading(receiver);
|
|
196
|
+
if(head === null) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
if(method === "concat") {
|
|
200
|
+
return concat_parts([head, ...n.arguments.map(leading)]);
|
|
201
|
+
}
|
|
202
|
+
if(head.complete && PURE_METHODS.has(method) && n.arguments.length === 0) {
|
|
203
|
+
return {text: String.prototype[method].call(head.text), complete: true};
|
|
204
|
+
}
|
|
205
|
+
/* The head is kept; the whole is no longer known to be static. */
|
|
206
|
+
return {text: head.text, complete: false};
|
|
121
207
|
}
|
|
122
|
-
return
|
|
208
|
+
return null;
|
|
123
209
|
}
|
|
124
|
-
return
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* Markup BUILT with values: its static head starts with '<' and it is
|
|
214
|
+
* not static as a whole. */
|
|
215
|
+
function built_markup(n)
|
|
216
|
+
{
|
|
217
|
+
let head = leading(n);
|
|
218
|
+
return !!head && !head.complete && starts_with_markup(head.text);
|
|
125
219
|
}
|
|
126
220
|
|
|
127
221
|
/* [tag, attrs, content, events?]: a tag and an attrs slot. A literal
|
|
@@ -192,8 +286,12 @@ function check_content(n, findings, file, src, where)
|
|
|
192
286
|
check_content(n.right, findings, file, src, where);
|
|
193
287
|
return;
|
|
194
288
|
}
|
|
195
|
-
|
|
196
|
-
|
|
289
|
+
if(n.type === "SequenceExpression") {
|
|
290
|
+
check_content(n.expressions[n.expressions.length - 1], findings, file, src, where);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
let head = leading(n);
|
|
294
|
+
if(head && head.complete && starts_with_markup(head.text)) {
|
|
197
295
|
findings.push({file, line: n.loc.start.line, rule: where === "list" ? "in-list" : "literal",
|
|
198
296
|
text: src.slice(n.start, Math.min(n.end, n.start + 90))});
|
|
199
297
|
return;
|
|
@@ -223,7 +321,8 @@ function check_file(file, root)
|
|
|
223
321
|
}
|
|
224
322
|
let content = n.elements[2];
|
|
225
323
|
if(content && content.type === "ArrayExpression" && content.elements.length > 0) {
|
|
226
|
-
let
|
|
324
|
+
let lead = leading(content.elements[0]);
|
|
325
|
+
let head = (lead && lead.complete)? lead.text : null;
|
|
227
326
|
if(head !== null && starts_with_markup(head)) {
|
|
228
327
|
/* createElement2() reads a list that starts with a string
|
|
229
328
|
* as ONE description: '<b>' would be its tag. */
|
|
@@ -256,7 +355,14 @@ function main()
|
|
|
256
355
|
const targets = process.argv.slice(2).length ? process.argv.slice(2) : ["src"];
|
|
257
356
|
let files = [];
|
|
258
357
|
for(const t of targets) {
|
|
259
|
-
|
|
358
|
+
const path = resolve(root, t); // an absolute path stays absolute
|
|
359
|
+
try {
|
|
360
|
+
statSync(path);
|
|
361
|
+
} catch(e) {
|
|
362
|
+
console.error(`check-markup-strings: no such file or directory: ${t}`);
|
|
363
|
+
process.exit(2);
|
|
364
|
+
}
|
|
365
|
+
list_files(path, files);
|
|
260
366
|
}
|
|
261
367
|
|
|
262
368
|
let all = [];
|