@yuneta/gobj-ui 7.26.48 → 7.26.50

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.
@@ -143,6 +143,10 @@ function yui_tint(colour) {
143
143
  * stack, which was for good: a panel that only moved (taken out
144
144
  * and put back, its trap never released) lost its trap. It is
145
145
  * skipped now, and leaves the stack only by its release().
146
+ * The first time a trap is skipped it is said, once: a panel out
147
+ * of the document whose owner is gone keeps its keydown listener
148
+ * until a release() that will never come, and up to gobj-ui
149
+ * 7.26.48 nothing said so (twenty such panels, twenty listeners).
146
150
  *
147
151
  * No gobj dependency: only gobj-js's logger. The optional
148
152
  * second argument lets callers inject a mock document object
@@ -157,9 +161,16 @@ function top_trap() {
157
161
  for (let i = __trap_stack__.length - 1; i >= 0; i--) {
158
162
  let trap = __trap_stack__[i];
159
163
  if (trap.$panel.isConnected !== false) return trap;
164
+ if (!trap.said_skipped) {
165
+ trap.said_skipped = true;
166
+ 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?)`);
167
+ }
160
168
  }
161
169
  return null;
162
170
  }
171
+ function panel_name($panel) {
172
+ return (typeof $panel.className === "string" ? $panel.className.trim() : "") || "a panel with no class";
173
+ }
163
174
  function is_drawn(el) {
164
175
  if (typeof el.checkVisibility === "function") return el.checkVisibility();
165
176
  if (typeof el.getClientRects === "function") return el.getClientRects().length > 0;
@@ -1211,6 +1222,8 @@ function secondary_nav_renders(item, layout) {
1211
1222
  var GCLASS_NAME$22 = "C_YUI_SHELL";
1212
1223
  var __live_shells__ = [];
1213
1224
  var __retiring_shell__ = null;
1225
+ var __dead_entries__ = /* @__PURE__ */ new Set();
1226
+ var __orphan_back__ = null;
1214
1227
  var __shell_watchers__ = [];
1215
1228
  var __window_z__ = 10;
1216
1229
  var ZONE_IDS = [
@@ -1276,6 +1289,7 @@ var PRIVATE_DATA$22 = {
1276
1289
  deferred_timer: null,
1277
1290
  expected_pop_ids: [],
1278
1291
  given_up: null,
1292
+ own_entries: [],
1279
1293
  popstate_handler: null,
1280
1294
  avatar_provider: null,
1281
1295
  avatar_nodes: [],
@@ -1376,6 +1390,7 @@ function mt_start$21(gobj) {
1376
1390
  log_warning(`C_YUI_SHELL: restoring '${p.restore_hash}' failed: ${e}`);
1377
1391
  }
1378
1392
  p.restore_hash = "";
1393
+ if (retire_dead_entries(gobj)) return;
1379
1394
  push_pending_markers(gobj);
1380
1395
  }
1381
1396
  return;
@@ -1401,6 +1416,8 @@ function mt_start$21(gobj) {
1401
1416
  }
1402
1417
  };
1403
1418
  window.addEventListener("popstate", priv.popstate_handler);
1419
+ keep_dead_entries_across_reload();
1420
+ adopt_orphan_back(gobj);
1404
1421
  }
1405
1422
  priv.keydown_handler = (ev) => {
1406
1423
  if (ev.key !== "Escape" && ev.keyCode !== 27) return;
@@ -1422,6 +1439,7 @@ function mt_start$21(gobj) {
1422
1439
  show_stage_placeholder(gobj, "main", "C_YUI_SHELL: no route to display (empty hash, no default_route, no stages.main.default_route)");
1423
1440
  log_error("C_YUI_SHELL: no initial route — set default_route, shell.stages.<name>.default_route, or navigate via hash");
1424
1441
  }
1442
+ if (priv.popstate_handler) retire_dead_entries(gobj);
1425
1443
  }
1426
1444
  /***************************************************************
1427
1445
  * Framework Method: Stop
@@ -1431,6 +1449,7 @@ function mt_stop$20(gobj) {
1431
1449
  if (!priv) return 0;
1432
1450
  retire_overlays(gobj);
1433
1451
  close_toolbar_dropdown(gobj);
1452
+ if (priv.popstate_handler) hand_over_history(gobj);
1434
1453
  if (priv.hash_handler) {
1435
1454
  window.removeEventListener("hashchange", priv.hash_handler);
1436
1455
  priv.hash_handler = null;
@@ -1991,6 +2010,8 @@ function navigate_to(gobj, route, depth, no_drain) {
1991
2010
  if (gobj_read_attr(gobj, "use_hash")) {
1992
2011
  if (!!!(priv.stages && priv.stages.main && priv.stages.main.active_route) && prev && prev !== route) {
1993
2012
  navigate_to(gobj, prev, depth + 1, true);
2013
+ let key = current_entry_key();
2014
+ if (key) __dead_entries__.delete(key);
1994
2015
  let h = route_to_hash(route);
1995
2016
  try {
1996
2017
  window.history.pushState(null, "", h);
@@ -1998,6 +2019,7 @@ function navigate_to(gobj, route, depth, no_drain) {
1998
2019
  window.location.hash = h;
1999
2020
  }
2000
2021
  }
2022
+ if (window.location.hash === route_to_hash(route)) note_own_entry(gobj);
2001
2023
  }
2002
2024
  publish_action();
2003
2025
  return;
@@ -2818,6 +2840,193 @@ function retire_overlays(gobj) {
2818
2840
  __retiring_shell__ = outer;
2819
2841
  }
2820
2842
  }
2843
+ /************************************************************
2844
+ * The history a shell that stops leaves to the next one.
2845
+ *
2846
+ * Its markers and the action entries of its `stay` routes
2847
+ * are dead now: a Back onto one closes nothing (up to gobj-ui
2848
+ * 7.26.48 they stayed, one more dead Back per overlay and per
2849
+ * logout, accumulating). It cannot take them off itself: a
2850
+ * back() is asynchronous and it no longer hears where it
2851
+ * lands. They go to __dead_entries__, and the next shell takes
2852
+ * them off at its start (retire_dead_entries()). A back() of
2853
+ * its own still in flight goes to __orphan_back__, which a
2854
+ * shell started before it lands adopts.
2855
+ *
2856
+ * A page with no next shell keeps them: with no router on the
2857
+ * page, a Back over the app's own entries changes nothing on
2858
+ * screen anyway, and the next shell retires them all the same.
2859
+ ************************************************************/
2860
+ function hand_over_history(gobj) {
2861
+ let priv = gobj.priv;
2862
+ for (let key of priv.own_entries) __dead_entries__.add(key);
2863
+ priv.own_entries = [];
2864
+ if (priv.expected_pops > 0) {
2865
+ if (__orphan_back__) drop_orphan_back("another shell stopped with a back() in flight");
2866
+ let orphan = {
2867
+ pops: priv.expected_pops,
2868
+ hash: priv.expected_pop_hash,
2869
+ restore_hash: priv.restore_hash,
2870
+ ids: priv.expected_pop_ids.slice(),
2871
+ since: performance.now(),
2872
+ listener: null
2873
+ };
2874
+ orphan.listener = () => {
2875
+ orphan.pops--;
2876
+ if (orphan.pops > 0) return;
2877
+ if (orphan.restore_hash && window.location.hash !== orphan.restore_hash) try {
2878
+ window.history.replaceState(window.history.state, "", orphan.restore_hash);
2879
+ } catch (e) {
2880
+ log_warning(`C_YUI_SHELL: restoring '${orphan.restore_hash}' failed: ${e}`);
2881
+ }
2882
+ drop_orphan_back(null);
2883
+ };
2884
+ window.addEventListener("popstate", orphan.listener);
2885
+ __orphan_back__ = orphan;
2886
+ }
2887
+ }
2888
+ function drop_orphan_back(reason) {
2889
+ let orphan = __orphan_back__;
2890
+ if (!orphan) return;
2891
+ __orphan_back__ = null;
2892
+ window.removeEventListener("popstate", orphan.listener);
2893
+ if (reason) log_warning(`C_YUI_SHELL: a back() of a stopped shell is no longer waited for: ${reason}`);
2894
+ }
2895
+ /************************************************************
2896
+ * A shell that starts while a back() of a stopped one is in
2897
+ * flight waits for it as for one of its own: an overlay it
2898
+ * opens meanwhile gets its marker after the landing, and a
2899
+ * route it pushes runs after it. Pushed before, Chromium runs
2900
+ * the traversal from the new entry and Firefox drops it.
2901
+ ************************************************************/
2902
+ function adopt_orphan_back(gobj) {
2903
+ let orphan = __orphan_back__;
2904
+ if (!orphan) return;
2905
+ if (performance.now() - orphan.since > DEFERRED_ROUTE_WAIT_MS) {
2906
+ drop_orphan_back(`it did not land in ${DEFERRED_ROUTE_WAIT_MS} ms`);
2907
+ return;
2908
+ }
2909
+ __orphan_back__ = null;
2910
+ window.removeEventListener("popstate", orphan.listener);
2911
+ let priv = gobj.priv;
2912
+ priv.expected_pops = orphan.pops;
2913
+ priv.expected_pop_hash = orphan.hash;
2914
+ priv.restore_hash = orphan.restore_hash;
2915
+ priv.expected_pop_ids = orphan.ids;
2916
+ arm_back_wait(gobj);
2917
+ }
2918
+ /************************************************************
2919
+ * A reload is a shell going away with its overlays up, and
2920
+ * no stop: the entries it made stay in the session history,
2921
+ * and they are entries of the new document too (a Back onto
2922
+ * one is a popstate, not a load). Their keys are kept in the
2923
+ * tab's sessionStorage when the page goes, and the first
2924
+ * shell of the new document takes them off as a stop's.
2925
+ ************************************************************/
2926
+ var DEAD_ENTRIES_STORAGE_KEY = "yui_shell_dead_entries";
2927
+ var __dead_entries_kept__ = false;
2928
+ function keep_dead_entries_across_reload() {
2929
+ if (__dead_entries_kept__) return;
2930
+ __dead_entries_kept__ = true;
2931
+ let storage = null;
2932
+ try {
2933
+ storage = window.sessionStorage;
2934
+ } catch (e) {
2935
+ log_warning(`C_YUI_SHELL: no sessionStorage, a reload keeps its dead history entries: ${e}`);
2936
+ return;
2937
+ }
2938
+ if (!storage) return;
2939
+ let raw = null;
2940
+ try {
2941
+ raw = storage.getItem(DEAD_ENTRIES_STORAGE_KEY);
2942
+ storage.removeItem(DEAD_ENTRIES_STORAGE_KEY);
2943
+ } catch (e) {
2944
+ log_warning(`C_YUI_SHELL: reading the dead history entries of the last load failed: ${e}`);
2945
+ }
2946
+ if (raw) {
2947
+ let keys = null;
2948
+ try {
2949
+ keys = JSON.parse(raw);
2950
+ } catch (e) {
2951
+ log_warning(`C_YUI_SHELL: the dead history entries of the last load are not json: ${e}`);
2952
+ }
2953
+ if (Array.isArray(keys)) {
2954
+ for (let key of keys) if (typeof key === "string") __dead_entries__.add(key);
2955
+ }
2956
+ }
2957
+ window.addEventListener("pagehide", () => {
2958
+ let keys = new Set(__dead_entries__);
2959
+ for (let shell of __live_shells__) for (let key of shell.priv && shell.priv.own_entries || []) keys.add(key);
2960
+ try {
2961
+ if (keys.size > 0) storage.setItem(DEAD_ENTRIES_STORAGE_KEY, JSON.stringify([...keys]));
2962
+ else storage.removeItem(DEAD_ENTRIES_STORAGE_KEY);
2963
+ } catch (e) {
2964
+ log_warning(`C_YUI_SHELL: keeping the dead history entries for the next load failed: ${e}`);
2965
+ }
2966
+ });
2967
+ }
2968
+ function current_entry_key() {
2969
+ let nav = window.navigation;
2970
+ if (!nav || !nav.currentEntry || typeof nav.entries !== "function") return null;
2971
+ return nav.currentEntry.key || null;
2972
+ }
2973
+ var OWN_ENTRIES_PRUNE_AT = 64;
2974
+ function note_own_entry(gobj) {
2975
+ let priv = gobj.priv;
2976
+ let key = current_entry_key();
2977
+ if (!key || priv.own_entries.includes(key)) return;
2978
+ priv.own_entries.push(key);
2979
+ if (priv.own_entries.length > OWN_ENTRIES_PRUNE_AT) {
2980
+ let alive = new Set(window.navigation.entries().map((e) => e.key));
2981
+ priv.own_entries = priv.own_entries.filter((k) => alive.has(k));
2982
+ }
2983
+ }
2984
+ /************************************************************
2985
+ * Take off, with ONE history.go(-n), the dead entries a
2986
+ * stopped shell left under the current one (hand_over_history).
2987
+ * The walk stops at the first entry that is not dead, so it
2988
+ * never goes past an entry of the reader's. The traversal is
2989
+ * this shell's own (expected_pops): its overlays' markers and
2990
+ * the routes it pushes wait for the landing, and a position
2991
+ * the URL holds is put back on the entry it lands on, as for
2992
+ * any back() of ours (restore_hash). Returns true when it
2993
+ * went.
2994
+ ************************************************************/
2995
+ function retire_dead_entries(gobj) {
2996
+ let priv = gobj.priv;
2997
+ if (__dead_entries__.size === 0 || priv.expected_pops > 0 || !priv.popstate_handler || !current_entry_key()) return false;
2998
+ let nav = window.navigation;
2999
+ let entries = nav.entries();
3000
+ let index = nav.currentEntry.index;
3001
+ let alive = new Set(entries.map((e) => e.key));
3002
+ for (let key of __dead_entries__) if (!alive.has(key)) __dead_entries__.delete(key);
3003
+ let landing = index;
3004
+ while (landing > 0 && __dead_entries__.has(entries[landing].key)) landing--;
3005
+ let steps = index - landing;
3006
+ if (steps === 0) return false;
3007
+ let landing_hash = "";
3008
+ try {
3009
+ landing_hash = new URL(entries[landing].url).hash;
3010
+ } catch (e) {
3011
+ log_warning(`C_YUI_SHELL: the entry under the dead ones has no url: ${e}`);
3012
+ return false;
3013
+ }
3014
+ for (let i = landing + 1; i <= index; i++) __dead_entries__.delete(entries[i].key);
3015
+ priv.expected_pops++;
3016
+ priv.expected_pop_hash = landing_hash;
3017
+ priv.restore_hash = window.location.hash !== landing_hash ? window.location.hash : "";
3018
+ try {
3019
+ window.history.go(-steps);
3020
+ } catch (e) {
3021
+ priv.expected_pops--;
3022
+ priv.restore_hash = "";
3023
+ log_warning(`C_YUI_SHELL: retiring ${steps} dead history entries failed: ${e}`);
3024
+ return false;
3025
+ }
3026
+ clear_deferred_timer(gobj);
3027
+ arm_back_wait(gobj);
3028
+ return true;
3029
+ }
2821
3030
  function pop_escape(gobj, handler) {
2822
3031
  let priv = gobj.priv;
2823
3032
  if (!priv || !priv.escape_stack) return;
@@ -2929,6 +3138,7 @@ function push_overlay_marker(gobj, entry) {
2929
3138
  }
2930
3139
  try {
2931
3140
  window.history.pushState({ __yui_overlay__: entry.id }, "");
3141
+ note_own_entry(gobj);
2932
3142
  } catch (e) {
2933
3143
  let idx = priv.overlay_stack.indexOf(entry);
2934
3144
  if (idx >= 0) priv.overlay_stack.splice(idx, 1);
@@ -2956,6 +3166,10 @@ function defer_route(gobj, route) {
2956
3166
  let priv = gobj.priv;
2957
3167
  if (priv.deferred_route && priv.deferred_route !== route) log_warning(`C_YUI_SHELL: route '${priv.deferred_route}' waiting for a back() of ours is replaced by '${route}'`);
2958
3168
  priv.deferred_route = route;
3169
+ arm_back_wait(gobj);
3170
+ }
3171
+ function arm_back_wait(gobj) {
3172
+ let priv = gobj.priv;
2959
3173
  if (!priv.deferred_timer) priv.deferred_timer = window.setTimeout(() => {
2960
3174
  if (!gobj.priv) return;
2961
3175
  gobj.priv.deferred_timer = null;
@@ -9876,8 +10090,10 @@ function time_value_to_text(value, real_type) {
9876
10090
  * it had. Up to gobj-ui 7.26.46 both committed null: one
9877
10091
  * Backspace and Enter erased the stored time. To clear a time
9878
10092
  * on purpose, clear EVERY part of the box: an empty box
9879
- * commits null. (Inside the box Tab moves between its parts,
9880
- * as the browser does: it does not leave the cell.)
10093
+ * commits null. Inside the box the Left and Right arrows move
10094
+ * between its parts; Tab is the table's (Tabulator's navNext):
10095
+ * it leaves the cell and opens the editor of the next one, in
10096
+ * Chromium and Firefox alike.
9881
10097
  *
9882
10098
  * Copyright (c) 2026, ArtGins.
9883
10099
  * All Rights Reserved.
@@ -9913,6 +10129,7 @@ function form_time_cell_editor(real_type) {
9913
10129
  let attrs = params.elementAttributes;
9914
10130
  if (attrs && typeof attrs === "object") for (let key of Object.keys(attrs)) input.setAttribute(key, attrs[key]);
9915
10131
  input.value = original_text;
10132
+ let shown_text = input.value;
9916
10133
  onRendered(function() {
9917
10134
  if (cell.getType() === "cell") {
9918
10135
  input.focus({ preventScroll: true });
@@ -9928,7 +10145,7 @@ function form_time_cell_editor(real_type) {
9928
10145
  else input.setAttribute("aria-invalid", "true");
9929
10146
  return;
9930
10147
  }
9931
- if (input.value === original_text) {
10148
+ if (input.value === shown_text) {
9932
10149
  cancel();
9933
10150
  return;
9934
10151
  }
@@ -9942,9 +10159,11 @@ function form_time_cell_editor(real_type) {
9942
10159
  input.addEventListener("blur", function(e) {
9943
10160
  if (e.relatedTarget || e.rangeParent || e.explicitOriginalTarget !== input) commit(true);
9944
10161
  });
9945
- input.addEventListener("input", function() {
10162
+ let recheck = function() {
9946
10163
  if (!incomplete()) input.removeAttribute("aria-invalid");
9947
- });
10164
+ };
10165
+ input.addEventListener("input", recheck);
10166
+ input.addEventListener("keyup", recheck);
9948
10167
  input.addEventListener("keydown", function(e) {
9949
10168
  switch (e.key) {
9950
10169
  case "Enter":
@@ -10442,7 +10661,11 @@ function mt_writing$2(gobj, path) {
10442
10661
  if (path === "selectable") {
10443
10662
  let $container = gobj_read_attr(gobj, "$container");
10444
10663
  if (!$container) return;
10445
- for (let $table of $container.querySelectorAll(".yui-tabulator-table, .yui-tabulator-table-nested")) if ($table.tabulator) show_row_selection(gobj, $table.tabulator);
10664
+ let selectable = gobj_read_bool_attr(gobj, "selectable");
10665
+ for (let $table of $container.querySelectorAll(".yui-tabulator-table, .yui-tabulator-table-nested")) if ($table.tabulator) {
10666
+ show_row_selection(gobj, $table.tabulator);
10667
+ if (!selectable && $table.tabulator.initialized) $table.tabulator.deselectRow();
10668
+ }
10446
10669
  }
10447
10670
  }
10448
10671
  /************************************************************
@@ -11068,7 +11291,7 @@ function build_form(gobj) {
11068
11291
  ******************************************************************/
11069
11292
  function build_html_form(gobj, $form, prefix, template) {
11070
11293
  Object.entries(template).forEach(([key, value]) => {
11071
- const field_desc = template_get_field_desc(key, value);
11294
+ const field_desc = form_template_field_desc(key, value);
11072
11295
  if (!prefix && yui_icons_is_svg_field(gobj_read_str_attr(gobj, "topic_name"), field_desc.name)) field_desc.type = "svg";
11073
11296
  let html_field_conf = build_form_field_conf(gobj, field_desc);
11074
11297
  html_field_conf.name = field_desc.name;
@@ -12071,6 +12294,7 @@ function create_coordinates(gobj, attrs) {
12071
12294
  const latitude = position.coords.latitude;
12072
12295
  $input.value = `${position.coords.longitude}, ${latitude}`;
12073
12296
  $input.classList.remove("is-danger");
12297
+ $input.removeAttribute("aria-invalid");
12074
12298
  let $h = $input.closest(".xcontrol").parentNode.querySelector(".help");
12075
12299
  $h.textContent = "";
12076
12300
  $h.style.display = "none";
@@ -12091,7 +12315,9 @@ function create_coordinates(gobj, attrs) {
12091
12315
  default: errorMsg = t("unknown error");
12092
12316
  }
12093
12317
  $input.classList.add("is-danger");
12318
+ $input.setAttribute("aria-invalid", "true");
12094
12319
  let $h = $input.closest(".xcontrol").parentNode.querySelector(".help");
12320
+ describe_by_help($input, $h);
12095
12321
  $h.textContent = errorMsg;
12096
12322
  $h.style.display = "block";
12097
12323
  }
@@ -12327,7 +12553,7 @@ function column_title(field_desc) {
12327
12553
  function table_column_titles(template) {
12328
12554
  let titles = {};
12329
12555
  Object.entries(template || {}).forEach(([key, value]) => {
12330
- const field_desc = template_get_field_desc(key, value);
12556
+ const field_desc = form_template_field_desc(key, value);
12331
12557
  titles[field_desc.name] = column_title(field_desc);
12332
12558
  });
12333
12559
  return titles;
@@ -12340,7 +12566,7 @@ function template2columns(gobj, columns, template, sub_elements) {
12340
12566
  return gobj_read_bool_attr(gobj, "editable");
12341
12567
  }
12342
12568
  Object.entries(template).forEach(([key, value]) => {
12343
- const field_desc = template_get_field_desc(key, value);
12569
+ const field_desc = form_template_field_desc(key, value);
12344
12570
  let readonly = !field_desc.is_writable;
12345
12571
  let validator = [];
12346
12572
  let column = {
@@ -12510,6 +12736,21 @@ function template2columns(gobj, columns, template, sub_elements) {
12510
12736
  return columns;
12511
12737
  }
12512
12738
  /************************************************************
12739
+ * A field of the template. A dot-token spec that names a
12740
+ * `time` / `now` type and no real type ("time.writable") is
12741
+ * an epoch, as the real type of a treedb time column is
12742
+ * integer: template_get_field_desc() (gobj-js) gives every
12743
+ * spec without one `string`, and a `string` time column is
12744
+ * an ISO text (form_time_value.js). Since gobj-ui 7.26.47
12745
+ * such a field showed its epoch as no time, and a save of
12746
+ * any field wrote null over it.
12747
+ ************************************************************/
12748
+ function form_template_field_desc(key, value) {
12749
+ let field_desc = template_get_field_desc(key, value);
12750
+ if (is_string(value) && (field_desc.type === "time" || field_desc.type === "now") && !value.split(".").includes(field_desc.real_type)) field_desc.real_type = "integer";
12751
+ return field_desc;
12752
+ }
12753
+ /************************************************************
12513
12754
  * What is wrong with a field, in the APP's language.
12514
12755
  *
12515
12756
  * `input.validationMessage` is the BROWSER's sentence in the BROWSER's
@@ -12545,6 +12786,7 @@ function mark_field_validity($input) {
12545
12786
  let v = $input.validity;
12546
12787
  if ((!v || v.valid) && !$input.yui_json_error) {
12547
12788
  $input.classList.remove("is-danger");
12789
+ $input.removeAttribute("aria-invalid");
12548
12790
  if ($h) {
12549
12791
  $h.textContent = "";
12550
12792
  $h.removeAttribute("data-i18n");
@@ -12553,7 +12795,9 @@ function mark_field_validity($input) {
12553
12795
  return true;
12554
12796
  }
12555
12797
  $input.classList.add("is-danger");
12798
+ $input.setAttribute("aria-invalid", "true");
12556
12799
  if ($h) {
12800
+ describe_by_help($input, $h);
12557
12801
  let key = field_validation_key($input);
12558
12802
  if (key) $h.setAttribute("data-i18n", key);
12559
12803
  else $h.removeAttribute("data-i18n");
@@ -12562,6 +12806,15 @@ function mark_field_validity($input) {
12562
12806
  }
12563
12807
  return false;
12564
12808
  }
12809
+ var __help_seq__ = 0;
12810
+ function describe_by_help($input, $h) {
12811
+ if (!$h.id) $h.id = `yui-form-help-${++__help_seq__}`;
12812
+ let ids = ($input.getAttribute("aria-describedby") || "").split(/\s+/).filter(Boolean);
12813
+ if (!ids.includes($h.id)) {
12814
+ ids.push($h.id);
12815
+ $input.setAttribute("aria-describedby", ids.join(" "));
12816
+ }
12817
+ }
12565
12818
  /************************************************************
12566
12819
  *
12567
12820
  ************************************************************/
@@ -12747,11 +13000,13 @@ function clear_data(gobj, $form) {
12747
13000
  *
12748
13001
  ************************************************************/
12749
13002
  function clear_validation(gobj, $form) {
12750
- $form.querySelectorAll("input").forEach(($input) => {
13003
+ $form.querySelectorAll("input, .yui-form-data-input").forEach(($input) => {
12751
13004
  $input.classList.remove("is-danger");
13005
+ $input.removeAttribute("aria-invalid");
12752
13006
  });
12753
13007
  $form.querySelectorAll(".help").forEach(($input) => {
12754
13008
  $input.textContent = "";
13009
+ $input.removeAttribute("data-i18n");
12755
13010
  $input.style.display = "none";
12756
13011
  });
12757
13012
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
@@ -23448,12 +23703,12 @@ function restore_view_state(gobj) {
23448
23703
  let done = false;
23449
23704
  priv.restoring = true;
23450
23705
  try {
23451
- if (typeof state.zoom === "number" && state.zoom > 0) {
23706
+ if (Number.isFinite(state.zoom) && state.zoom > 0) {
23452
23707
  graph.zoomTo(state.zoom);
23453
23708
  priv.last_zoom = state.zoom;
23454
23709
  done = true;
23455
23710
  }
23456
- if (Array.isArray(state.position) && state.position.length >= 2) {
23711
+ if (Array.isArray(state.position) && state.position.length >= 2 && Number.isFinite(state.position[0]) && Number.isFinite(state.position[1])) {
23457
23712
  graph.translateTo([state.position[0], state.position[1]]);
23458
23713
  done = true;
23459
23714
  }
@@ -23481,12 +23736,31 @@ function save_view_state(gobj) {
23481
23736
  collapsed: priv.collapse_state || {},
23482
23737
  anchor: priv.anchor_state === "on" ? priv.anchor_name : ""
23483
23738
  };
23739
+ let camera = null;
23484
23740
  try {
23485
- state.zoom = graph.getZoom();
23486
- state.position = graph.getPosition();
23741
+ camera = camera_of(graph.getZoom(), graph.getPosition());
23487
23742
  } catch (e) {}
23743
+ if (!camera) {
23744
+ let old = load_view_state(gobj);
23745
+ camera = old ? camera_of(old.zoom, old.position) : null;
23746
+ }
23747
+ if (camera) {
23748
+ state.zoom = camera.zoom;
23749
+ state.position = camera.position;
23750
+ }
23488
23751
  kw_set_local_storage_value(view_store_key(gobj), state);
23489
23752
  }
23753
+ function camera_of(zoom, position) {
23754
+ if (!(Number.isFinite(zoom) && zoom > 0)) return null;
23755
+ if (!position || typeof position.length !== "number" || position.length < 2) return null;
23756
+ let x = position[0];
23757
+ let y = position[1];
23758
+ if (!Number.isFinite(x) || !Number.isFinite(y)) return null;
23759
+ return {
23760
+ zoom,
23761
+ position: [x, y]
23762
+ };
23763
+ }
23490
23764
  function load_view_state(gobj) {
23491
23765
  let state = kw_get_local_storage_value(view_store_key(gobj), null, false);
23492
23766
  return state && typeof state === "object" ? state : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.26.48",
3
+ "version": "7.26.50",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -39,7 +39,7 @@
39
39
  "devDependencies": {
40
40
  "@rollup/plugin-terser": "^1.0.0",
41
41
  "@vitest/coverage-v8": "^4.1.10",
42
- "@yuneta/gobj-js": "^7.26.22",
42
+ "@yuneta/gobj-js": "^7.26.27",
43
43
  "vite": "^8.3.3",
44
44
  "vitest": "^4.1.10"
45
45
  },