@yuneta/gobj-ui 7.26.47 → 7.26.49
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 +139 -31
- package/dist/gobj-ui.cjs.js +327 -16
- package/dist/gobj-ui.es.js +327 -16
- package/package.json +2 -2
- package/scripts/validate-locales.mjs +734 -76
- package/src/c_yui_form.js +63 -5
- package/src/c_yui_gobj_tree_js.js +37 -4
- package/src/c_yui_shell.js +360 -3
- package/src/form_table_rows.wiring.test.js +32 -0
- package/src/form_time_cell_editor.js +20 -5
- package/src/form_time_cell_editor.test.js +73 -0
- package/src/form_time_field.wiring.test.js +71 -0
- package/src/gobj_tree_camera.wiring.test.js +185 -0
- package/src/overlay_marker_after_back.wiring.test.js +3 -0
- package/src/shell_focus_trap.js +21 -0
- package/src/shell_focus_trap.test.js +52 -0
- package/src/shell_history_debt.wiring.test.js +456 -0
- package/src/shell_stop_overlays.wiring.test.js +55 -2
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -148,6 +148,10 @@ function yui_tint(colour) {
|
|
|
148
148
|
* stack, which was for good: a panel that only moved (taken out
|
|
149
149
|
* and put back, its trap never released) lost its trap. It is
|
|
150
150
|
* skipped now, and leaves the stack only by its release().
|
|
151
|
+
* The first time a trap is skipped it is said, once: a panel out
|
|
152
|
+
* of the document whose owner is gone keeps its keydown listener
|
|
153
|
+
* until a release() that will never come, and up to gobj-ui
|
|
154
|
+
* 7.26.48 nothing said so (twenty such panels, twenty listeners).
|
|
151
155
|
*
|
|
152
156
|
* No gobj dependency: only gobj-js's logger. The optional
|
|
153
157
|
* second argument lets callers inject a mock document object
|
|
@@ -162,9 +166,16 @@ function top_trap() {
|
|
|
162
166
|
for (let i = __trap_stack__.length - 1; i >= 0; i--) {
|
|
163
167
|
let trap = __trap_stack__[i];
|
|
164
168
|
if (trap.$panel.isConnected !== false) return trap;
|
|
169
|
+
if (!trap.said_skipped) {
|
|
170
|
+
trap.said_skipped = true;
|
|
171
|
+
(0, _yuneta_gobj_js.log_warning)(`focus trap: its panel (${panel_name(trap.$panel)}) is out of the document and the trap was not released; it is skipped, and its listener stays until its release() (an owner torn down with it open?)`);
|
|
172
|
+
}
|
|
165
173
|
}
|
|
166
174
|
return null;
|
|
167
175
|
}
|
|
176
|
+
function panel_name($panel) {
|
|
177
|
+
return (typeof $panel.className === "string" ? $panel.className.trim() : "") || "a panel with no class";
|
|
178
|
+
}
|
|
168
179
|
function is_drawn(el) {
|
|
169
180
|
if (typeof el.checkVisibility === "function") return el.checkVisibility();
|
|
170
181
|
if (typeof el.getClientRects === "function") return el.getClientRects().length > 0;
|
|
@@ -1215,6 +1226,9 @@ function secondary_nav_renders(item, layout) {
|
|
|
1215
1226
|
***************************************************************/
|
|
1216
1227
|
var GCLASS_NAME$22 = "C_YUI_SHELL";
|
|
1217
1228
|
var __live_shells__ = [];
|
|
1229
|
+
var __retiring_shell__ = null;
|
|
1230
|
+
var __dead_entries__ = /* @__PURE__ */ new Set();
|
|
1231
|
+
var __orphan_back__ = null;
|
|
1218
1232
|
var __shell_watchers__ = [];
|
|
1219
1233
|
var __window_z__ = 10;
|
|
1220
1234
|
var ZONE_IDS = [
|
|
@@ -1280,6 +1294,7 @@ var PRIVATE_DATA$22 = {
|
|
|
1280
1294
|
deferred_timer: null,
|
|
1281
1295
|
expected_pop_ids: [],
|
|
1282
1296
|
given_up: null,
|
|
1297
|
+
own_entries: [],
|
|
1283
1298
|
popstate_handler: null,
|
|
1284
1299
|
avatar_provider: null,
|
|
1285
1300
|
avatar_nodes: [],
|
|
@@ -1380,6 +1395,7 @@ function mt_start$21(gobj) {
|
|
|
1380
1395
|
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: restoring '${p.restore_hash}' failed: ${e}`);
|
|
1381
1396
|
}
|
|
1382
1397
|
p.restore_hash = "";
|
|
1398
|
+
if (retire_dead_entries(gobj)) return;
|
|
1383
1399
|
push_pending_markers(gobj);
|
|
1384
1400
|
}
|
|
1385
1401
|
return;
|
|
@@ -1405,6 +1421,8 @@ function mt_start$21(gobj) {
|
|
|
1405
1421
|
}
|
|
1406
1422
|
};
|
|
1407
1423
|
window.addEventListener("popstate", priv.popstate_handler);
|
|
1424
|
+
keep_dead_entries_across_reload();
|
|
1425
|
+
adopt_orphan_back(gobj);
|
|
1408
1426
|
}
|
|
1409
1427
|
priv.keydown_handler = (ev) => {
|
|
1410
1428
|
if (ev.key !== "Escape" && ev.keyCode !== 27) return;
|
|
@@ -1426,6 +1444,7 @@ function mt_start$21(gobj) {
|
|
|
1426
1444
|
show_stage_placeholder(gobj, "main", "C_YUI_SHELL: no route to display (empty hash, no default_route, no stages.main.default_route)");
|
|
1427
1445
|
(0, _yuneta_gobj_js.log_error)("C_YUI_SHELL: no initial route — set default_route, shell.stages.<name>.default_route, or navigate via hash");
|
|
1428
1446
|
}
|
|
1447
|
+
if (priv.popstate_handler) retire_dead_entries(gobj);
|
|
1429
1448
|
}
|
|
1430
1449
|
/***************************************************************
|
|
1431
1450
|
* Framework Method: Stop
|
|
@@ -1435,6 +1454,7 @@ function mt_stop$20(gobj) {
|
|
|
1435
1454
|
if (!priv) return 0;
|
|
1436
1455
|
retire_overlays(gobj);
|
|
1437
1456
|
close_toolbar_dropdown(gobj);
|
|
1457
|
+
if (priv.popstate_handler) hand_over_history(gobj);
|
|
1438
1458
|
if (priv.hash_handler) {
|
|
1439
1459
|
window.removeEventListener("hashchange", priv.hash_handler);
|
|
1440
1460
|
priv.hash_handler = null;
|
|
@@ -1995,6 +2015,8 @@ function navigate_to(gobj, route, depth, no_drain) {
|
|
|
1995
2015
|
if ((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "use_hash")) {
|
|
1996
2016
|
if (!!!(priv.stages && priv.stages.main && priv.stages.main.active_route) && prev && prev !== route) {
|
|
1997
2017
|
navigate_to(gobj, prev, depth + 1, true);
|
|
2018
|
+
let key = current_entry_key();
|
|
2019
|
+
if (key) __dead_entries__.delete(key);
|
|
1998
2020
|
let h = route_to_hash(route);
|
|
1999
2021
|
try {
|
|
2000
2022
|
window.history.pushState(null, "", h);
|
|
@@ -2002,6 +2024,7 @@ function navigate_to(gobj, route, depth, no_drain) {
|
|
|
2002
2024
|
window.location.hash = h;
|
|
2003
2025
|
}
|
|
2004
2026
|
}
|
|
2027
|
+
if (window.location.hash === route_to_hash(route)) note_own_entry(gobj);
|
|
2005
2028
|
}
|
|
2006
2029
|
publish_action();
|
|
2007
2030
|
return;
|
|
@@ -2814,7 +2837,200 @@ function close_overlays(gobj) {
|
|
|
2814
2837
|
function retire_overlays(gobj) {
|
|
2815
2838
|
let priv = gobj.priv;
|
|
2816
2839
|
if (priv && priv.overlay_stack) priv.overlay_stack.splice(0);
|
|
2817
|
-
|
|
2840
|
+
let outer = __retiring_shell__;
|
|
2841
|
+
__retiring_shell__ = gobj;
|
|
2842
|
+
try {
|
|
2843
|
+
close_overlays(gobj);
|
|
2844
|
+
} finally {
|
|
2845
|
+
__retiring_shell__ = outer;
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
/************************************************************
|
|
2849
|
+
* The history a shell that stops leaves to the next one.
|
|
2850
|
+
*
|
|
2851
|
+
* Its markers and the action entries of its `stay` routes
|
|
2852
|
+
* are dead now: a Back onto one closes nothing (up to gobj-ui
|
|
2853
|
+
* 7.26.48 they stayed, one more dead Back per overlay and per
|
|
2854
|
+
* logout, accumulating). It cannot take them off itself: a
|
|
2855
|
+
* back() is asynchronous and it no longer hears where it
|
|
2856
|
+
* lands. They go to __dead_entries__, and the next shell takes
|
|
2857
|
+
* them off at its start (retire_dead_entries()). A back() of
|
|
2858
|
+
* its own still in flight goes to __orphan_back__, which a
|
|
2859
|
+
* shell started before it lands adopts.
|
|
2860
|
+
*
|
|
2861
|
+
* A page with no next shell keeps them: with no router on the
|
|
2862
|
+
* page, a Back over the app's own entries changes nothing on
|
|
2863
|
+
* screen anyway, and the next shell retires them all the same.
|
|
2864
|
+
************************************************************/
|
|
2865
|
+
function hand_over_history(gobj) {
|
|
2866
|
+
let priv = gobj.priv;
|
|
2867
|
+
for (let key of priv.own_entries) __dead_entries__.add(key);
|
|
2868
|
+
priv.own_entries = [];
|
|
2869
|
+
if (priv.expected_pops > 0) {
|
|
2870
|
+
if (__orphan_back__) drop_orphan_back("another shell stopped with a back() in flight");
|
|
2871
|
+
let orphan = {
|
|
2872
|
+
pops: priv.expected_pops,
|
|
2873
|
+
hash: priv.expected_pop_hash,
|
|
2874
|
+
restore_hash: priv.restore_hash,
|
|
2875
|
+
ids: priv.expected_pop_ids.slice(),
|
|
2876
|
+
since: performance.now(),
|
|
2877
|
+
listener: null
|
|
2878
|
+
};
|
|
2879
|
+
orphan.listener = () => {
|
|
2880
|
+
orphan.pops--;
|
|
2881
|
+
if (orphan.pops > 0) return;
|
|
2882
|
+
if (orphan.restore_hash && window.location.hash !== orphan.restore_hash) try {
|
|
2883
|
+
window.history.replaceState(window.history.state, "", orphan.restore_hash);
|
|
2884
|
+
} catch (e) {
|
|
2885
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: restoring '${orphan.restore_hash}' failed: ${e}`);
|
|
2886
|
+
}
|
|
2887
|
+
drop_orphan_back(null);
|
|
2888
|
+
};
|
|
2889
|
+
window.addEventListener("popstate", orphan.listener);
|
|
2890
|
+
__orphan_back__ = orphan;
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
function drop_orphan_back(reason) {
|
|
2894
|
+
let orphan = __orphan_back__;
|
|
2895
|
+
if (!orphan) return;
|
|
2896
|
+
__orphan_back__ = null;
|
|
2897
|
+
window.removeEventListener("popstate", orphan.listener);
|
|
2898
|
+
if (reason) (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: a back() of a stopped shell is no longer waited for: ${reason}`);
|
|
2899
|
+
}
|
|
2900
|
+
/************************************************************
|
|
2901
|
+
* A shell that starts while a back() of a stopped one is in
|
|
2902
|
+
* flight waits for it as for one of its own: an overlay it
|
|
2903
|
+
* opens meanwhile gets its marker after the landing, and a
|
|
2904
|
+
* route it pushes runs after it. Pushed before, Chromium runs
|
|
2905
|
+
* the traversal from the new entry and Firefox drops it.
|
|
2906
|
+
************************************************************/
|
|
2907
|
+
function adopt_orphan_back(gobj) {
|
|
2908
|
+
let orphan = __orphan_back__;
|
|
2909
|
+
if (!orphan) return;
|
|
2910
|
+
if (performance.now() - orphan.since > DEFERRED_ROUTE_WAIT_MS) {
|
|
2911
|
+
drop_orphan_back(`it did not land in ${DEFERRED_ROUTE_WAIT_MS} ms`);
|
|
2912
|
+
return;
|
|
2913
|
+
}
|
|
2914
|
+
__orphan_back__ = null;
|
|
2915
|
+
window.removeEventListener("popstate", orphan.listener);
|
|
2916
|
+
let priv = gobj.priv;
|
|
2917
|
+
priv.expected_pops = orphan.pops;
|
|
2918
|
+
priv.expected_pop_hash = orphan.hash;
|
|
2919
|
+
priv.restore_hash = orphan.restore_hash;
|
|
2920
|
+
priv.expected_pop_ids = orphan.ids;
|
|
2921
|
+
arm_back_wait(gobj);
|
|
2922
|
+
}
|
|
2923
|
+
/************************************************************
|
|
2924
|
+
* A reload is a shell going away with its overlays up, and
|
|
2925
|
+
* no stop: the entries it made stay in the session history,
|
|
2926
|
+
* and they are entries of the new document too (a Back onto
|
|
2927
|
+
* one is a popstate, not a load). Their keys are kept in the
|
|
2928
|
+
* tab's sessionStorage when the page goes, and the first
|
|
2929
|
+
* shell of the new document takes them off as a stop's.
|
|
2930
|
+
************************************************************/
|
|
2931
|
+
var DEAD_ENTRIES_STORAGE_KEY = "yui_shell_dead_entries";
|
|
2932
|
+
var __dead_entries_kept__ = false;
|
|
2933
|
+
function keep_dead_entries_across_reload() {
|
|
2934
|
+
if (__dead_entries_kept__) return;
|
|
2935
|
+
__dead_entries_kept__ = true;
|
|
2936
|
+
let storage = null;
|
|
2937
|
+
try {
|
|
2938
|
+
storage = window.sessionStorage;
|
|
2939
|
+
} catch (e) {
|
|
2940
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: no sessionStorage, a reload keeps its dead history entries: ${e}`);
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
if (!storage) return;
|
|
2944
|
+
let raw = null;
|
|
2945
|
+
try {
|
|
2946
|
+
raw = storage.getItem(DEAD_ENTRIES_STORAGE_KEY);
|
|
2947
|
+
storage.removeItem(DEAD_ENTRIES_STORAGE_KEY);
|
|
2948
|
+
} catch (e) {
|
|
2949
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: reading the dead history entries of the last load failed: ${e}`);
|
|
2950
|
+
}
|
|
2951
|
+
if (raw) {
|
|
2952
|
+
let keys = null;
|
|
2953
|
+
try {
|
|
2954
|
+
keys = JSON.parse(raw);
|
|
2955
|
+
} catch (e) {
|
|
2956
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: the dead history entries of the last load are not json: ${e}`);
|
|
2957
|
+
}
|
|
2958
|
+
if (Array.isArray(keys)) {
|
|
2959
|
+
for (let key of keys) if (typeof key === "string") __dead_entries__.add(key);
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
window.addEventListener("pagehide", () => {
|
|
2963
|
+
let keys = new Set(__dead_entries__);
|
|
2964
|
+
for (let shell of __live_shells__) for (let key of shell.priv && shell.priv.own_entries || []) keys.add(key);
|
|
2965
|
+
try {
|
|
2966
|
+
if (keys.size > 0) storage.setItem(DEAD_ENTRIES_STORAGE_KEY, JSON.stringify([...keys]));
|
|
2967
|
+
else storage.removeItem(DEAD_ENTRIES_STORAGE_KEY);
|
|
2968
|
+
} catch (e) {
|
|
2969
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: keeping the dead history entries for the next load failed: ${e}`);
|
|
2970
|
+
}
|
|
2971
|
+
});
|
|
2972
|
+
}
|
|
2973
|
+
function current_entry_key() {
|
|
2974
|
+
let nav = window.navigation;
|
|
2975
|
+
if (!nav || !nav.currentEntry || typeof nav.entries !== "function") return null;
|
|
2976
|
+
return nav.currentEntry.key || null;
|
|
2977
|
+
}
|
|
2978
|
+
var OWN_ENTRIES_PRUNE_AT = 64;
|
|
2979
|
+
function note_own_entry(gobj) {
|
|
2980
|
+
let priv = gobj.priv;
|
|
2981
|
+
let key = current_entry_key();
|
|
2982
|
+
if (!key || priv.own_entries.includes(key)) return;
|
|
2983
|
+
priv.own_entries.push(key);
|
|
2984
|
+
if (priv.own_entries.length > OWN_ENTRIES_PRUNE_AT) {
|
|
2985
|
+
let alive = new Set(window.navigation.entries().map((e) => e.key));
|
|
2986
|
+
priv.own_entries = priv.own_entries.filter((k) => alive.has(k));
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
/************************************************************
|
|
2990
|
+
* Take off, with ONE history.go(-n), the dead entries a
|
|
2991
|
+
* stopped shell left under the current one (hand_over_history).
|
|
2992
|
+
* The walk stops at the first entry that is not dead, so it
|
|
2993
|
+
* never goes past an entry of the reader's. The traversal is
|
|
2994
|
+
* this shell's own (expected_pops): its overlays' markers and
|
|
2995
|
+
* the routes it pushes wait for the landing, and a position
|
|
2996
|
+
* the URL holds is put back on the entry it lands on, as for
|
|
2997
|
+
* any back() of ours (restore_hash). Returns true when it
|
|
2998
|
+
* went.
|
|
2999
|
+
************************************************************/
|
|
3000
|
+
function retire_dead_entries(gobj) {
|
|
3001
|
+
let priv = gobj.priv;
|
|
3002
|
+
if (__dead_entries__.size === 0 || priv.expected_pops > 0 || !priv.popstate_handler || !current_entry_key()) return false;
|
|
3003
|
+
let nav = window.navigation;
|
|
3004
|
+
let entries = nav.entries();
|
|
3005
|
+
let index = nav.currentEntry.index;
|
|
3006
|
+
let alive = new Set(entries.map((e) => e.key));
|
|
3007
|
+
for (let key of __dead_entries__) if (!alive.has(key)) __dead_entries__.delete(key);
|
|
3008
|
+
let landing = index;
|
|
3009
|
+
while (landing > 0 && __dead_entries__.has(entries[landing].key)) landing--;
|
|
3010
|
+
let steps = index - landing;
|
|
3011
|
+
if (steps === 0) return false;
|
|
3012
|
+
let landing_hash = "";
|
|
3013
|
+
try {
|
|
3014
|
+
landing_hash = new URL(entries[landing].url).hash;
|
|
3015
|
+
} catch (e) {
|
|
3016
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: the entry under the dead ones has no url: ${e}`);
|
|
3017
|
+
return false;
|
|
3018
|
+
}
|
|
3019
|
+
for (let i = landing + 1; i <= index; i++) __dead_entries__.delete(entries[i].key);
|
|
3020
|
+
priv.expected_pops++;
|
|
3021
|
+
priv.expected_pop_hash = landing_hash;
|
|
3022
|
+
priv.restore_hash = window.location.hash !== landing_hash ? window.location.hash : "";
|
|
3023
|
+
try {
|
|
3024
|
+
window.history.go(-steps);
|
|
3025
|
+
} catch (e) {
|
|
3026
|
+
priv.expected_pops--;
|
|
3027
|
+
priv.restore_hash = "";
|
|
3028
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: retiring ${steps} dead history entries failed: ${e}`);
|
|
3029
|
+
return false;
|
|
3030
|
+
}
|
|
3031
|
+
clear_deferred_timer(gobj);
|
|
3032
|
+
arm_back_wait(gobj);
|
|
3033
|
+
return true;
|
|
2818
3034
|
}
|
|
2819
3035
|
function pop_escape(gobj, handler) {
|
|
2820
3036
|
let priv = gobj.priv;
|
|
@@ -2927,6 +3143,7 @@ function push_overlay_marker(gobj, entry) {
|
|
|
2927
3143
|
}
|
|
2928
3144
|
try {
|
|
2929
3145
|
window.history.pushState({ __yui_overlay__: entry.id }, "");
|
|
3146
|
+
note_own_entry(gobj);
|
|
2930
3147
|
} catch (e) {
|
|
2931
3148
|
let idx = priv.overlay_stack.indexOf(entry);
|
|
2932
3149
|
if (idx >= 0) priv.overlay_stack.splice(idx, 1);
|
|
@@ -2954,6 +3171,10 @@ function defer_route(gobj, route) {
|
|
|
2954
3171
|
let priv = gobj.priv;
|
|
2955
3172
|
if (priv.deferred_route && priv.deferred_route !== route) (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: route '${priv.deferred_route}' waiting for a back() of ours is replaced by '${route}'`);
|
|
2956
3173
|
priv.deferred_route = route;
|
|
3174
|
+
arm_back_wait(gobj);
|
|
3175
|
+
}
|
|
3176
|
+
function arm_back_wait(gobj) {
|
|
3177
|
+
let priv = gobj.priv;
|
|
2957
3178
|
if (!priv.deferred_timer) priv.deferred_timer = window.setTimeout(() => {
|
|
2958
3179
|
if (!gobj.priv) return;
|
|
2959
3180
|
gobj.priv.deferred_timer = null;
|
|
@@ -3756,9 +3977,39 @@ function yui_shell_overlay_dismissed(shell_gobj, overlay) {
|
|
|
3756
3977
|
* stranded action entries and RE-FIRES the action, reopening
|
|
3757
3978
|
* the overlay and hijacking the navigation the user asked
|
|
3758
3979
|
* for. Only back() while the URL still sits on the route.
|
|
3980
|
+
*
|
|
3981
|
+
* A close that comes from a shell that STOPS (a logout with the
|
|
3982
|
+
* overlay up) does not go back: the URL is rewritten in place,
|
|
3983
|
+
* to the resting route under the overlay. A back() is
|
|
3984
|
+
* asynchronous and the stopped shell would never hear where it
|
|
3985
|
+
* lands -- the overlay's own marker is left in place, so a
|
|
3986
|
+
* single back() landed on the action entry, the URL stayed on
|
|
3987
|
+
* the action route, and a new shell built in the same turn read
|
|
3988
|
+
* it and opened the overlay again (up to gobj-ui 7.26.47).
|
|
3759
3989
|
************************************************************/
|
|
3760
3990
|
function yui_shell_unpark_route(route) {
|
|
3761
|
-
|
|
3991
|
+
let hash = route_to_hash(normalize_route(route));
|
|
3992
|
+
if (window.location.hash !== hash) return;
|
|
3993
|
+
let shell = __retiring_shell__;
|
|
3994
|
+
if (shell) {
|
|
3995
|
+
let resting = resting_route_of(shell);
|
|
3996
|
+
try {
|
|
3997
|
+
window.history.replaceState(window.history.state, "", route_to_hash(resting));
|
|
3998
|
+
} catch (e) {
|
|
3999
|
+
(0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: unparking '${route}' at stop failed: ${e}`);
|
|
4000
|
+
}
|
|
4001
|
+
return;
|
|
4002
|
+
}
|
|
4003
|
+
window.history.back();
|
|
4004
|
+
}
|
|
4005
|
+
/************************************************************
|
|
4006
|
+
* The resting route a shell shows under its overlays: the
|
|
4007
|
+
* current one (only ever written for a RESTING route), else
|
|
4008
|
+
* the main stage's, else the default.
|
|
4009
|
+
************************************************************/
|
|
4010
|
+
function resting_route_of(gobj) {
|
|
4011
|
+
let priv = gobj.priv || {};
|
|
4012
|
+
return (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "current_route") || priv.stages && priv.stages.main && priv.stages.main.active_route || (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "default_route") || "/";
|
|
3762
4013
|
}
|
|
3763
4014
|
/************************************************************
|
|
3764
4015
|
* Avatar provider — toolbar items with type:"avatar" call the
|
|
@@ -9844,8 +10095,10 @@ function time_value_to_text(value, real_type) {
|
|
|
9844
10095
|
* it had. Up to gobj-ui 7.26.46 both committed null: one
|
|
9845
10096
|
* Backspace and Enter erased the stored time. To clear a time
|
|
9846
10097
|
* on purpose, clear EVERY part of the box: an empty box
|
|
9847
|
-
* commits null.
|
|
9848
|
-
*
|
|
10098
|
+
* commits null. Inside the box the Left and Right arrows move
|
|
10099
|
+
* between its parts; Tab is the table's (Tabulator's navNext):
|
|
10100
|
+
* it leaves the cell and opens the editor of the next one, in
|
|
10101
|
+
* Chromium and Firefox alike.
|
|
9849
10102
|
*
|
|
9850
10103
|
* Copyright (c) 2026, ArtGins.
|
|
9851
10104
|
* All Rights Reserved.
|
|
@@ -9881,6 +10134,7 @@ function form_time_cell_editor(real_type) {
|
|
|
9881
10134
|
let attrs = params.elementAttributes;
|
|
9882
10135
|
if (attrs && typeof attrs === "object") for (let key of Object.keys(attrs)) input.setAttribute(key, attrs[key]);
|
|
9883
10136
|
input.value = original_text;
|
|
10137
|
+
let shown_text = input.value;
|
|
9884
10138
|
onRendered(function() {
|
|
9885
10139
|
if (cell.getType() === "cell") {
|
|
9886
10140
|
input.focus({ preventScroll: true });
|
|
@@ -9896,7 +10150,7 @@ function form_time_cell_editor(real_type) {
|
|
|
9896
10150
|
else input.setAttribute("aria-invalid", "true");
|
|
9897
10151
|
return;
|
|
9898
10152
|
}
|
|
9899
|
-
if (input.value ===
|
|
10153
|
+
if (input.value === shown_text) {
|
|
9900
10154
|
cancel();
|
|
9901
10155
|
return;
|
|
9902
10156
|
}
|
|
@@ -9910,9 +10164,11 @@ function form_time_cell_editor(real_type) {
|
|
|
9910
10164
|
input.addEventListener("blur", function(e) {
|
|
9911
10165
|
if (e.relatedTarget || e.rangeParent || e.explicitOriginalTarget !== input) commit(true);
|
|
9912
10166
|
});
|
|
9913
|
-
|
|
10167
|
+
let recheck = function() {
|
|
9914
10168
|
if (!incomplete()) input.removeAttribute("aria-invalid");
|
|
9915
|
-
}
|
|
10169
|
+
};
|
|
10170
|
+
input.addEventListener("input", recheck);
|
|
10171
|
+
input.addEventListener("keyup", recheck);
|
|
9916
10172
|
input.addEventListener("keydown", function(e) {
|
|
9917
10173
|
switch (e.key) {
|
|
9918
10174
|
case "Enter":
|
|
@@ -10410,7 +10666,11 @@ function mt_writing$2(gobj, path) {
|
|
|
10410
10666
|
if (path === "selectable") {
|
|
10411
10667
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
10412
10668
|
if (!$container) return;
|
|
10413
|
-
|
|
10669
|
+
let selectable = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "selectable");
|
|
10670
|
+
for (let $table of $container.querySelectorAll(".yui-tabulator-table, .yui-tabulator-table-nested")) if ($table.tabulator) {
|
|
10671
|
+
show_row_selection(gobj, $table.tabulator);
|
|
10672
|
+
if (!selectable && $table.tabulator.initialized) $table.tabulator.deselectRow();
|
|
10673
|
+
}
|
|
10414
10674
|
}
|
|
10415
10675
|
}
|
|
10416
10676
|
/************************************************************
|
|
@@ -11036,7 +11296,7 @@ function build_form(gobj) {
|
|
|
11036
11296
|
******************************************************************/
|
|
11037
11297
|
function build_html_form(gobj, $form, prefix, template) {
|
|
11038
11298
|
Object.entries(template).forEach(([key, value]) => {
|
|
11039
|
-
const field_desc = (
|
|
11299
|
+
const field_desc = form_template_field_desc(key, value);
|
|
11040
11300
|
if (!prefix && yui_icons_is_svg_field((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "topic_name"), field_desc.name)) field_desc.type = "svg";
|
|
11041
11301
|
let html_field_conf = build_form_field_conf(gobj, field_desc);
|
|
11042
11302
|
html_field_conf.name = field_desc.name;
|
|
@@ -12039,6 +12299,7 @@ function create_coordinates(gobj, attrs) {
|
|
|
12039
12299
|
const latitude = position.coords.latitude;
|
|
12040
12300
|
$input.value = `${position.coords.longitude}, ${latitude}`;
|
|
12041
12301
|
$input.classList.remove("is-danger");
|
|
12302
|
+
$input.removeAttribute("aria-invalid");
|
|
12042
12303
|
let $h = $input.closest(".xcontrol").parentNode.querySelector(".help");
|
|
12043
12304
|
$h.textContent = "";
|
|
12044
12305
|
$h.style.display = "none";
|
|
@@ -12059,7 +12320,9 @@ function create_coordinates(gobj, attrs) {
|
|
|
12059
12320
|
default: errorMsg = (0, i18next.t)("unknown error");
|
|
12060
12321
|
}
|
|
12061
12322
|
$input.classList.add("is-danger");
|
|
12323
|
+
$input.setAttribute("aria-invalid", "true");
|
|
12062
12324
|
let $h = $input.closest(".xcontrol").parentNode.querySelector(".help");
|
|
12325
|
+
describe_by_help($input, $h);
|
|
12063
12326
|
$h.textContent = errorMsg;
|
|
12064
12327
|
$h.style.display = "block";
|
|
12065
12328
|
}
|
|
@@ -12295,7 +12558,7 @@ function column_title(field_desc) {
|
|
|
12295
12558
|
function table_column_titles(template) {
|
|
12296
12559
|
let titles = {};
|
|
12297
12560
|
Object.entries(template || {}).forEach(([key, value]) => {
|
|
12298
|
-
const field_desc = (
|
|
12561
|
+
const field_desc = form_template_field_desc(key, value);
|
|
12299
12562
|
titles[field_desc.name] = column_title(field_desc);
|
|
12300
12563
|
});
|
|
12301
12564
|
return titles;
|
|
@@ -12308,7 +12571,7 @@ function template2columns(gobj, columns, template, sub_elements) {
|
|
|
12308
12571
|
return (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "editable");
|
|
12309
12572
|
}
|
|
12310
12573
|
Object.entries(template).forEach(([key, value]) => {
|
|
12311
|
-
const field_desc = (
|
|
12574
|
+
const field_desc = form_template_field_desc(key, value);
|
|
12312
12575
|
let readonly = !field_desc.is_writable;
|
|
12313
12576
|
let validator = [];
|
|
12314
12577
|
let column = {
|
|
@@ -12478,6 +12741,21 @@ function template2columns(gobj, columns, template, sub_elements) {
|
|
|
12478
12741
|
return columns;
|
|
12479
12742
|
}
|
|
12480
12743
|
/************************************************************
|
|
12744
|
+
* A field of the template. A dot-token spec that names a
|
|
12745
|
+
* `time` / `now` type and no real type ("time.writable") is
|
|
12746
|
+
* an epoch, as the real type of a treedb time column is
|
|
12747
|
+
* integer: template_get_field_desc() (gobj-js) gives every
|
|
12748
|
+
* spec without one `string`, and a `string` time column is
|
|
12749
|
+
* an ISO text (form_time_value.js). Since gobj-ui 7.26.47
|
|
12750
|
+
* such a field showed its epoch as no time, and a save of
|
|
12751
|
+
* any field wrote null over it.
|
|
12752
|
+
************************************************************/
|
|
12753
|
+
function form_template_field_desc(key, value) {
|
|
12754
|
+
let field_desc = (0, _yuneta_gobj_js.template_get_field_desc)(key, value);
|
|
12755
|
+
if ((0, _yuneta_gobj_js.is_string)(value) && (field_desc.type === "time" || field_desc.type === "now") && !value.split(".").includes(field_desc.real_type)) field_desc.real_type = "integer";
|
|
12756
|
+
return field_desc;
|
|
12757
|
+
}
|
|
12758
|
+
/************************************************************
|
|
12481
12759
|
* What is wrong with a field, in the APP's language.
|
|
12482
12760
|
*
|
|
12483
12761
|
* `input.validationMessage` is the BROWSER's sentence in the BROWSER's
|
|
@@ -12513,6 +12791,7 @@ function mark_field_validity($input) {
|
|
|
12513
12791
|
let v = $input.validity;
|
|
12514
12792
|
if ((!v || v.valid) && !$input.yui_json_error) {
|
|
12515
12793
|
$input.classList.remove("is-danger");
|
|
12794
|
+
$input.removeAttribute("aria-invalid");
|
|
12516
12795
|
if ($h) {
|
|
12517
12796
|
$h.textContent = "";
|
|
12518
12797
|
$h.removeAttribute("data-i18n");
|
|
@@ -12521,7 +12800,9 @@ function mark_field_validity($input) {
|
|
|
12521
12800
|
return true;
|
|
12522
12801
|
}
|
|
12523
12802
|
$input.classList.add("is-danger");
|
|
12803
|
+
$input.setAttribute("aria-invalid", "true");
|
|
12524
12804
|
if ($h) {
|
|
12805
|
+
describe_by_help($input, $h);
|
|
12525
12806
|
let key = field_validation_key($input);
|
|
12526
12807
|
if (key) $h.setAttribute("data-i18n", key);
|
|
12527
12808
|
else $h.removeAttribute("data-i18n");
|
|
@@ -12530,6 +12811,15 @@ function mark_field_validity($input) {
|
|
|
12530
12811
|
}
|
|
12531
12812
|
return false;
|
|
12532
12813
|
}
|
|
12814
|
+
var __help_seq__ = 0;
|
|
12815
|
+
function describe_by_help($input, $h) {
|
|
12816
|
+
if (!$h.id) $h.id = `yui-form-help-${++__help_seq__}`;
|
|
12817
|
+
let ids = ($input.getAttribute("aria-describedby") || "").split(/\s+/).filter(Boolean);
|
|
12818
|
+
if (!ids.includes($h.id)) {
|
|
12819
|
+
ids.push($h.id);
|
|
12820
|
+
$input.setAttribute("aria-describedby", ids.join(" "));
|
|
12821
|
+
}
|
|
12822
|
+
}
|
|
12533
12823
|
/************************************************************
|
|
12534
12824
|
*
|
|
12535
12825
|
************************************************************/
|
|
@@ -12715,11 +13005,13 @@ function clear_data(gobj, $form) {
|
|
|
12715
13005
|
*
|
|
12716
13006
|
************************************************************/
|
|
12717
13007
|
function clear_validation(gobj, $form) {
|
|
12718
|
-
$form.querySelectorAll("input").forEach(($input) => {
|
|
13008
|
+
$form.querySelectorAll("input, .yui-form-data-input").forEach(($input) => {
|
|
12719
13009
|
$input.classList.remove("is-danger");
|
|
13010
|
+
$input.removeAttribute("aria-invalid");
|
|
12720
13011
|
});
|
|
12721
13012
|
$form.querySelectorAll(".help").forEach(($input) => {
|
|
12722
13013
|
$input.textContent = "";
|
|
13014
|
+
$input.removeAttribute("data-i18n");
|
|
12723
13015
|
$input.style.display = "none";
|
|
12724
13016
|
});
|
|
12725
13017
|
$form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
|
|
@@ -23416,12 +23708,12 @@ function restore_view_state(gobj) {
|
|
|
23416
23708
|
let done = false;
|
|
23417
23709
|
priv.restoring = true;
|
|
23418
23710
|
try {
|
|
23419
|
-
if (
|
|
23711
|
+
if (Number.isFinite(state.zoom) && state.zoom > 0) {
|
|
23420
23712
|
graph.zoomTo(state.zoom);
|
|
23421
23713
|
priv.last_zoom = state.zoom;
|
|
23422
23714
|
done = true;
|
|
23423
23715
|
}
|
|
23424
|
-
if (Array.isArray(state.position) && state.position.length >= 2) {
|
|
23716
|
+
if (Array.isArray(state.position) && state.position.length >= 2 && Number.isFinite(state.position[0]) && Number.isFinite(state.position[1])) {
|
|
23425
23717
|
graph.translateTo([state.position[0], state.position[1]]);
|
|
23426
23718
|
done = true;
|
|
23427
23719
|
}
|
|
@@ -23449,12 +23741,31 @@ function save_view_state(gobj) {
|
|
|
23449
23741
|
collapsed: priv.collapse_state || {},
|
|
23450
23742
|
anchor: priv.anchor_state === "on" ? priv.anchor_name : ""
|
|
23451
23743
|
};
|
|
23744
|
+
let camera = null;
|
|
23452
23745
|
try {
|
|
23453
|
-
|
|
23454
|
-
state.position = graph.getPosition();
|
|
23746
|
+
camera = camera_of(graph.getZoom(), graph.getPosition());
|
|
23455
23747
|
} catch (e) {}
|
|
23748
|
+
if (!camera) {
|
|
23749
|
+
let old = load_view_state(gobj);
|
|
23750
|
+
camera = old ? camera_of(old.zoom, old.position) : null;
|
|
23751
|
+
}
|
|
23752
|
+
if (camera) {
|
|
23753
|
+
state.zoom = camera.zoom;
|
|
23754
|
+
state.position = camera.position;
|
|
23755
|
+
}
|
|
23456
23756
|
(0, _yuneta_gobj_js.kw_set_local_storage_value)(view_store_key(gobj), state);
|
|
23457
23757
|
}
|
|
23758
|
+
function camera_of(zoom, position) {
|
|
23759
|
+
if (!(Number.isFinite(zoom) && zoom > 0)) return null;
|
|
23760
|
+
if (!position || typeof position.length !== "number" || position.length < 2) return null;
|
|
23761
|
+
let x = position[0];
|
|
23762
|
+
let y = position[1];
|
|
23763
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) return null;
|
|
23764
|
+
return {
|
|
23765
|
+
zoom,
|
|
23766
|
+
position: [x, y]
|
|
23767
|
+
};
|
|
23768
|
+
}
|
|
23458
23769
|
function load_view_state(gobj) {
|
|
23459
23770
|
let state = (0, _yuneta_gobj_js.kw_get_local_storage_value)(view_store_key(gobj), null, false);
|
|
23460
23771
|
return state && typeof state === "object" ? state : null;
|