@yuneta/gobj-ui 7.26.12 → 7.26.14

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 CHANGED
@@ -130,8 +130,18 @@ checkout and publish.
130
130
  npm install
131
131
  npm run build # vite -> dist/ (ES/CJS/UMD/IIFE, min + non-min)
132
132
  npm test # vitest (v2/main only; v1 has no test target)
133
+ npm run qa-history # the shell's browser history in REAL Chromium and Firefox
133
134
  ```
134
135
 
136
+ `npm run qa-history` (`scripts/qa-history.mjs`) starts the test-app's vite
137
+ dev server and drives its `/history` chapter: a panel with no dock and
138
+ `keep_on_navigate` over a view that writes its position with a `replace`.
139
+ Back must close the panel and keep the position, the panel's x must keep it,
140
+ and a dialog action that closes the panel and navigates in the same turn must
141
+ keep the navigation. The unit tests drive a MODEL of the history; this is the
142
+ check in the browsers themselves. Run it after any change to the overlay
143
+ history of `C_YUI_SHELL`. Playwright and its browsers come from the test-app.
144
+
135
145
  `dist/` is gitignored. v1 consumers get `dist/` from the **published** npm
136
146
  tarball; v2 consumers import source files by specifier, whether they resolve
137
147
  them from the checkout or from the tarball's `src/`. Rebuild `dist/` to
@@ -3359,8 +3369,12 @@ text is in the yunetas `CLAUDE.md` ("JS GUI conventions"); in short:
3359
3369
  children whose first item is a markup string (`list-head`: such a list is
3360
3370
  read as one description). A ternary, `||`/`&&`/`??` and a comma
3361
3371
  sequence (its last item) are checked branch by branch; a tag is matched
3362
- in any case. It CANNOT see: a variable or a function result that holds
3363
- a string (a helper that returns markup); a template whose head is an
3372
+ in any case; a pure string method over a static string
3373
+ (`'<b>s</b>'.toUpperCase()`) is still a `literal`. `.replace()` /
3374
+ `.replaceAll()` are NOT taken as keeping the head (they can remove it),
3375
+ so their result is not checked. It CANNOT see: a variable or a function
3376
+ result that holds a string (a helper that returns markup); the result of
3377
+ `.replace()`/`.replaceAll()`; a template whose head is an
3364
3378
  expression that is not a static string (`` `${prefix}<b>` ``); a
3365
3379
  description built piece by piece (`push()` into the content list); a
3366
3380
  computed tag with an attrs slot that is not an object literal; markup
@@ -974,6 +974,11 @@ 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: "",
981
+ deferred_route: "",
977
982
  popstate_handler: null,
978
983
  avatar_provider: null,
979
984
  avatar_nodes: [],
@@ -1021,48 +1026,81 @@ function mt_start$20(gobj) {
1021
1026
  build_toolbar$1(gobj, config);
1022
1027
  preinstantiate_eager_views(gobj);
1023
1028
  if ((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "use_hash")) {
1029
+ priv.last_hash = window.location.hash;
1024
1030
  priv.hash_handler = () => {
1025
1031
  let p = gobj.priv;
1026
- let dropped = false;
1027
- if (p && p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
1032
+ if (!p) return;
1033
+ let markers_now = p.markers_after_hashchange;
1034
+ p.markers_after_hashchange = false;
1035
+ if (p.skip_hash && window.location.hash === p.skip_hash) {
1036
+ p.skip_hash = "";
1037
+ p.last_hash = window.location.hash;
1038
+ if (markers_now) push_pending_markers(gobj);
1039
+ return;
1040
+ }
1041
+ p.skip_hash = "";
1042
+ if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
1028
1043
  drop_expected_pops(gobj);
1029
- dropped = true;
1044
+ markers_now = true;
1030
1045
  }
1031
1046
  let route = hash_to_route(window.location.hash);
1032
1047
  if (!(0, _yuneta_gobj_js.empty_string)(route)) navigate_to(gobj, route);
1033
- if (dropped) push_pending_markers(gobj);
1048
+ p.last_hash = window.location.hash;
1049
+ if (markers_now) push_pending_markers(gobj);
1034
1050
  };
1035
1051
  window.addEventListener("hashchange", priv.hash_handler);
1036
1052
  priv.popstate_handler = (ev) => {
1037
1053
  let p = gobj.priv;
1038
1054
  if (!p) return;
1055
+ let hash_moved = window.location.hash !== p.last_hash;
1039
1056
  if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
1040
1057
  drop_expected_pops(gobj);
1041
1058
  on_traversal(ev);
1042
- push_pending_markers(gobj);
1059
+ if (hash_moved) p.markers_after_hashchange = true;
1060
+ else push_pending_markers(gobj);
1061
+ p.last_hash = window.location.hash;
1043
1062
  return;
1044
1063
  }
1045
1064
  on_traversal(ev);
1065
+ if (!p.skip_hash) p.last_hash = window.location.hash;
1046
1066
  };
1047
1067
  let on_traversal = (ev) => {
1048
1068
  let p = gobj.priv;
1049
1069
  if (p.expected_pops > 0) {
1050
1070
  p.expected_pops--;
1051
- if (p.expected_pops === 0) push_pending_markers(gobj);
1071
+ if (p.expected_pops === 0) {
1072
+ if (p.restore_hash && p.restore_hash !== window.location.hash) try {
1073
+ window.history.replaceState(window.history.state, "", p.restore_hash);
1074
+ p.skip_hash = p.restore_hash;
1075
+ p.last_hash = p.restore_hash;
1076
+ } catch (e) {
1077
+ (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: restoring '${p.restore_hash}' failed: ${e}`);
1078
+ }
1079
+ p.restore_hash = "";
1080
+ push_pending_markers(gobj);
1081
+ }
1052
1082
  return;
1053
1083
  }
1054
1084
  if (p.overlay_stack.length === 0) return;
1055
1085
  let top = p.overlay_stack[p.overlay_stack.length - 1];
1056
- if (top.marker_pending) return;
1057
- if (window.location.hash !== top.hash) return;
1086
+ if (top.marker_pending || top.no_marker) return;
1087
+ if (window.location.hash !== top.hash && window.location.hash !== top.below_hash) return;
1058
1088
  let st = ev && ev.state;
1059
1089
  if (st && st.__yui_overlay__ === top.id) return;
1090
+ if (st && st.__yui_overlay__ > top.id && !p.overlay_stack.some((e) => e.id === st.__yui_overlay__)) return;
1060
1091
  p.overlay_stack.pop();
1061
1092
  try {
1062
1093
  top.close();
1063
1094
  } catch (e) {
1064
1095
  (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: overlay close on Back failed: ${e}`);
1065
1096
  }
1097
+ if (typeof top.below_hash === "string" && top.hash !== top.below_hash && window.location.hash === top.below_hash) try {
1098
+ window.history.replaceState(window.history.state, "", top.hash);
1099
+ p.skip_hash = top.hash;
1100
+ p.last_hash = top.hash;
1101
+ } catch (e) {
1102
+ (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: restoring '${top.hash}' failed: ${e}`);
1103
+ }
1066
1104
  };
1067
1105
  window.addEventListener("popstate", priv.popstate_handler);
1068
1106
  }
@@ -1098,9 +1136,17 @@ function mt_stop$20(gobj) {
1098
1136
  window.removeEventListener("popstate", priv.popstate_handler);
1099
1137
  priv.popstate_handler = null;
1100
1138
  }
1139
+ for (let entry of priv.pending_markers) {
1140
+ entry.marker_pending = false;
1141
+ entry.no_marker = true;
1142
+ }
1101
1143
  priv.expected_pops = 0;
1102
1144
  priv.expected_pop_hash = "";
1103
1145
  priv.pending_markers = [];
1146
+ priv.markers_after_hashchange = false;
1147
+ priv.restore_hash = "";
1148
+ priv.skip_hash = "";
1149
+ priv.deferred_route = "";
1104
1150
  if (priv.keydown_handler) {
1105
1151
  window.removeEventListener("keydown", priv.keydown_handler);
1106
1152
  priv.keydown_handler = null;
@@ -1706,6 +1752,7 @@ function navigate_to(gobj, route, depth, no_drain) {
1706
1752
  let target_hash = route_to_hash(route);
1707
1753
  if (window.location.hash !== target_hash) try {
1708
1754
  window.history.replaceState(window.history.state, "", target_hash);
1755
+ priv.last_hash = target_hash;
1709
1756
  retag_overlay_hash(gobj, window.history.state, target_hash);
1710
1757
  } catch (e) {
1711
1758
  window.location.hash = target_hash;
@@ -2535,6 +2582,11 @@ function push_pending_markers(gobj) {
2535
2582
  entry.hash = window.location.hash;
2536
2583
  push_overlay_marker(gobj, entry);
2537
2584
  }
2585
+ if (priv.deferred_route) {
2586
+ let route = priv.deferred_route;
2587
+ priv.deferred_route = "";
2588
+ yui_shell_navigate(gobj, route);
2589
+ }
2538
2590
  }
2539
2591
  function overlay_dismissed(gobj, entry) {
2540
2592
  let priv = gobj.priv;
@@ -2543,11 +2595,12 @@ function overlay_dismissed(gobj, entry) {
2543
2595
  let idx = priv.overlay_stack.indexOf(entry);
2544
2596
  if (idx < 0) return;
2545
2597
  priv.overlay_stack.splice(idx, 1);
2546
- if (entry.marker_pending) return;
2598
+ if (entry.marker_pending || entry.no_marker) return;
2547
2599
  let st = window.history.state;
2548
2600
  if (st && st.__yui_overlay__ === entry.id) {
2549
2601
  priv.expected_pops++;
2550
2602
  priv.expected_pop_hash = typeof entry.below_hash === "string" ? entry.below_hash : window.location.hash;
2603
+ priv.restore_hash = window.location.hash !== priv.expected_pop_hash ? window.location.hash : "";
2551
2604
  try {
2552
2605
  window.history.back();
2553
2606
  } catch (e) {
@@ -2896,6 +2949,11 @@ function yui_shell_of(gobj) {
2896
2949
  ************************************************************/
2897
2950
  function yui_shell_navigate(shell_gobj, route, opts) {
2898
2951
  if (!(opts && opts.replace) && (0, _yuneta_gobj_js.gobj_read_attr)(shell_gobj, "use_hash")) {
2952
+ let priv = shell_gobj.priv;
2953
+ if (priv && priv.expected_pops > 0) {
2954
+ priv.deferred_route = route;
2955
+ return;
2956
+ }
2899
2957
  let target_hash = route_to_hash(route);
2900
2958
  if (window.location.hash !== target_hash) {
2901
2959
  window.location.hash = target_hash;
@@ -4923,21 +4981,13 @@ function chip_lead(icon) {
4923
4981
  * trace dumps it), so the window travels in it as its FULL NAME,
4924
4982
  * which the trace can print, and the gobj is the event's src --
4925
4983
  * every sender is the window itself. Up to 7.26.9 the kw carried
4926
- * the gobj; that is still taken, with a warning, for this release.
4984
+ * the gobj; since 7.26.14 that is refused.
4927
4985
  ************************************************************/
4928
- var warned_gobj_in_kw = false;
4929
4986
  function window_of(gobj, event, kw, src) {
4930
4987
  let w = kw && kw.window;
4931
4988
  if ((0, _yuneta_gobj_js.is_gobj)(w)) {
4932
- if (!warned_gobj_in_kw) {
4933
- warned_gobj_in_kw = true;
4934
- (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} carries the window gobj in its kw: send {window: gobj_full_name(window)} from the window`);
4935
- }
4936
- if (w !== src) {
4937
- (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event}: window '${(0, _yuneta_gobj_js.gobj_full_name)(w)}' is not the src of the event (${(0, _yuneta_gobj_js.is_gobj)(src) ? (0, _yuneta_gobj_js.gobj_full_name)(src) : String(src)})`);
4938
- return null;
4939
- }
4940
- return w;
4989
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} carries the window gobj in its kw: send {window: gobj_full_name(window)} from the window`);
4990
+ return null;
4941
4991
  }
4942
4992
  if (!(0, _yuneta_gobj_js.is_gobj)(src) || (0, _yuneta_gobj_js.gobj_full_name)(src) !== w) {
4943
4993
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event}: window '${w}' is not the src of the event (${(0, _yuneta_gobj_js.is_gobj)(src) ? (0, _yuneta_gobj_js.gobj_full_name)(src) : String(src)})`);
@@ -60607,6 +60657,22 @@ function css_color_or_null(value) {
60607
60657
  * All Rights Reserved.
60608
60658
  ***********************************************************************/
60609
60659
  /***************************************************************
60660
+ * The markup of one toolbar item. Everything that goes into it is
60661
+ * escaped, the read-out branch too: its text, title and value are
60662
+ * values (a zoom figure, a translated title), never markup.
60663
+ ***************************************************************/
60664
+ function toolbar_item_html(item) {
60665
+ if (item.separator) return `<div class="g6-toolbar-sep" aria-hidden="true"></div>`;
60666
+ const extra_class = item.className ? ` ${(0, _yuneta_gobj_js.escapeHtml)(String(item.className))}` : "";
60667
+ const title = (0, _yuneta_gobj_js.escapeHtml)(String(item.title ?? ""));
60668
+ 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>`;
60669
+ const disabled = item.disabled ? " disabled" : "";
60670
+ const is_text = item.text !== void 0;
60671
+ const kind_class = is_text ? " g6-toolbar-item-text" : "";
60672
+ 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>`;
60673
+ 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>`;
60674
+ }
60675
+ /***************************************************************
60610
60676
  * YuiToolbar — G6 Toolbar subclass that adds per-item className
60611
60677
  * and disabled support, plus three item kinds G6 does not have.
60612
60678
  *
@@ -60632,17 +60698,7 @@ function css_color_or_null(value) {
60632
60698
  ***************************************************************/
60633
60699
  var YuiToolbar = class extends _antv_g6.Toolbar {
60634
60700
  async getDOMContent() {
60635
- return (await this.options.getItems()).map((item) => {
60636
- if (item.separator) return `<div class="g6-toolbar-sep" aria-hidden="true"></div>`;
60637
- const extra_class = item.className ? ` ${(0, _yuneta_gobj_js.escapeHtml)(String(item.className))}` : "";
60638
- const title = (0, _yuneta_gobj_js.escapeHtml)(String(item.title ?? ""));
60639
- 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>`;
60640
- const disabled = item.disabled ? " disabled" : "";
60641
- const is_text = item.text !== void 0;
60642
- const kind_class = is_text ? " g6-toolbar-item-text" : "";
60643
- 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>`;
60644
- 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>`;
60645
- }).join("");
60701
+ return (await this.options.getItems()).map(toolbar_item_html).join("");
60646
60702
  }
60647
60703
  };
60648
60704
  (0, _antv_g6.register)(_antv_g6.ExtensionCategory.PLUGIN, "yui-toolbar", YuiToolbar);
@@ -70837,6 +70893,19 @@ var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:.875rem; opacity:.8;";
70837
70893
  var LEGEND_MAIN_NAME_STYLE = LEGEND_NAME_STYLE + " font-weight:700;";
70838
70894
  var LEGEND_STAR_MAIN_STYLE = LEGEND_GLYPH_STYLE + " color:var(--bulma-warning-on-scheme, var(--bulma-warning, #ffdd57));";
70839
70895
  var LEGEND_FOCUSED_STYLE = "box-shadow: inset 0 0 0 2px var(--bulma-text, #2e333d);";
70896
+ /************************************************************
70897
+ * The name of a topic in the legend: schema data, never markup.
70898
+ ************************************************************/
70899
+ function legend_name_item(topic_name, is_main, hidden) {
70900
+ return [
70901
+ "span",
70902
+ {
70903
+ class: "GRAPH_LEGEND_NAME",
70904
+ style: (is_main ? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) + (hidden ? " text-decoration:line-through; opacity:.6;" : "")
70905
+ },
70906
+ text_node(topic_name)
70907
+ ];
70908
+ }
70840
70909
  function refresh_legend(gobj) {
70841
70910
  let priv = gobj.priv;
70842
70911
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
@@ -70859,14 +70928,7 @@ function refresh_legend(gobj) {
70859
70928
  controls.push(["span", {
70860
70929
  class: "GRAPH_LEGEND_SWATCH",
70861
70930
  style: `display:inline-block; width:.8rem; height:.8rem; border-radius:3px; margin-right:.35rem; flex:0 0 auto; background:${entry.color || "#94a3b8"}; border:1px solid rgba(0,0,0,.25);` + (hidden ? "opacity:.35;" : "")
70862
- }], [
70863
- "span",
70864
- {
70865
- class: "GRAPH_LEGEND_NAME",
70866
- style: (is_main ? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) + (hidden ? " text-decoration:line-through; opacity:.6;" : "")
70867
- },
70868
- text_node(topic_name)
70869
- ], [
70931
+ }], legend_name_item(topic_name, is_main, hidden), [
70870
70932
  "span",
70871
70933
  {
70872
70934
  class: "GRAPH_LEGEND_COUNT",
@@ -969,6 +969,11 @@ 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: "",
976
+ deferred_route: "",
972
977
  popstate_handler: null,
973
978
  avatar_provider: null,
974
979
  avatar_nodes: [],
@@ -1016,48 +1021,81 @@ function mt_start$20(gobj) {
1016
1021
  build_toolbar$1(gobj, config);
1017
1022
  preinstantiate_eager_views(gobj);
1018
1023
  if (gobj_read_attr(gobj, "use_hash")) {
1024
+ priv.last_hash = window.location.hash;
1019
1025
  priv.hash_handler = () => {
1020
1026
  let p = gobj.priv;
1021
- let dropped = false;
1022
- if (p && p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
1027
+ if (!p) return;
1028
+ let markers_now = p.markers_after_hashchange;
1029
+ p.markers_after_hashchange = false;
1030
+ if (p.skip_hash && window.location.hash === p.skip_hash) {
1031
+ p.skip_hash = "";
1032
+ p.last_hash = window.location.hash;
1033
+ if (markers_now) push_pending_markers(gobj);
1034
+ return;
1035
+ }
1036
+ p.skip_hash = "";
1037
+ if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
1023
1038
  drop_expected_pops(gobj);
1024
- dropped = true;
1039
+ markers_now = true;
1025
1040
  }
1026
1041
  let route = hash_to_route(window.location.hash);
1027
1042
  if (!empty_string(route)) navigate_to(gobj, route);
1028
- if (dropped) push_pending_markers(gobj);
1043
+ p.last_hash = window.location.hash;
1044
+ if (markers_now) push_pending_markers(gobj);
1029
1045
  };
1030
1046
  window.addEventListener("hashchange", priv.hash_handler);
1031
1047
  priv.popstate_handler = (ev) => {
1032
1048
  let p = gobj.priv;
1033
1049
  if (!p) return;
1050
+ let hash_moved = window.location.hash !== p.last_hash;
1034
1051
  if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) {
1035
1052
  drop_expected_pops(gobj);
1036
1053
  on_traversal(ev);
1037
- push_pending_markers(gobj);
1054
+ if (hash_moved) p.markers_after_hashchange = true;
1055
+ else push_pending_markers(gobj);
1056
+ p.last_hash = window.location.hash;
1038
1057
  return;
1039
1058
  }
1040
1059
  on_traversal(ev);
1060
+ if (!p.skip_hash) p.last_hash = window.location.hash;
1041
1061
  };
1042
1062
  let on_traversal = (ev) => {
1043
1063
  let p = gobj.priv;
1044
1064
  if (p.expected_pops > 0) {
1045
1065
  p.expected_pops--;
1046
- if (p.expected_pops === 0) push_pending_markers(gobj);
1066
+ if (p.expected_pops === 0) {
1067
+ if (p.restore_hash && p.restore_hash !== window.location.hash) try {
1068
+ window.history.replaceState(window.history.state, "", p.restore_hash);
1069
+ p.skip_hash = p.restore_hash;
1070
+ p.last_hash = p.restore_hash;
1071
+ } catch (e) {
1072
+ log_warning(`C_YUI_SHELL: restoring '${p.restore_hash}' failed: ${e}`);
1073
+ }
1074
+ p.restore_hash = "";
1075
+ push_pending_markers(gobj);
1076
+ }
1047
1077
  return;
1048
1078
  }
1049
1079
  if (p.overlay_stack.length === 0) return;
1050
1080
  let top = p.overlay_stack[p.overlay_stack.length - 1];
1051
- if (top.marker_pending) return;
1052
- if (window.location.hash !== top.hash) return;
1081
+ if (top.marker_pending || top.no_marker) return;
1082
+ if (window.location.hash !== top.hash && window.location.hash !== top.below_hash) return;
1053
1083
  let st = ev && ev.state;
1054
1084
  if (st && st.__yui_overlay__ === top.id) return;
1085
+ if (st && st.__yui_overlay__ > top.id && !p.overlay_stack.some((e) => e.id === st.__yui_overlay__)) return;
1055
1086
  p.overlay_stack.pop();
1056
1087
  try {
1057
1088
  top.close();
1058
1089
  } catch (e) {
1059
1090
  log_warning(`C_YUI_SHELL: overlay close on Back failed: ${e}`);
1060
1091
  }
1092
+ if (typeof top.below_hash === "string" && top.hash !== top.below_hash && window.location.hash === top.below_hash) try {
1093
+ window.history.replaceState(window.history.state, "", top.hash);
1094
+ p.skip_hash = top.hash;
1095
+ p.last_hash = top.hash;
1096
+ } catch (e) {
1097
+ log_warning(`C_YUI_SHELL: restoring '${top.hash}' failed: ${e}`);
1098
+ }
1061
1099
  };
1062
1100
  window.addEventListener("popstate", priv.popstate_handler);
1063
1101
  }
@@ -1093,9 +1131,17 @@ function mt_stop$20(gobj) {
1093
1131
  window.removeEventListener("popstate", priv.popstate_handler);
1094
1132
  priv.popstate_handler = null;
1095
1133
  }
1134
+ for (let entry of priv.pending_markers) {
1135
+ entry.marker_pending = false;
1136
+ entry.no_marker = true;
1137
+ }
1096
1138
  priv.expected_pops = 0;
1097
1139
  priv.expected_pop_hash = "";
1098
1140
  priv.pending_markers = [];
1141
+ priv.markers_after_hashchange = false;
1142
+ priv.restore_hash = "";
1143
+ priv.skip_hash = "";
1144
+ priv.deferred_route = "";
1099
1145
  if (priv.keydown_handler) {
1100
1146
  window.removeEventListener("keydown", priv.keydown_handler);
1101
1147
  priv.keydown_handler = null;
@@ -1701,6 +1747,7 @@ function navigate_to(gobj, route, depth, no_drain) {
1701
1747
  let target_hash = route_to_hash(route);
1702
1748
  if (window.location.hash !== target_hash) try {
1703
1749
  window.history.replaceState(window.history.state, "", target_hash);
1750
+ priv.last_hash = target_hash;
1704
1751
  retag_overlay_hash(gobj, window.history.state, target_hash);
1705
1752
  } catch (e) {
1706
1753
  window.location.hash = target_hash;
@@ -2530,6 +2577,11 @@ function push_pending_markers(gobj) {
2530
2577
  entry.hash = window.location.hash;
2531
2578
  push_overlay_marker(gobj, entry);
2532
2579
  }
2580
+ if (priv.deferred_route) {
2581
+ let route = priv.deferred_route;
2582
+ priv.deferred_route = "";
2583
+ yui_shell_navigate(gobj, route);
2584
+ }
2533
2585
  }
2534
2586
  function overlay_dismissed(gobj, entry) {
2535
2587
  let priv = gobj.priv;
@@ -2538,11 +2590,12 @@ function overlay_dismissed(gobj, entry) {
2538
2590
  let idx = priv.overlay_stack.indexOf(entry);
2539
2591
  if (idx < 0) return;
2540
2592
  priv.overlay_stack.splice(idx, 1);
2541
- if (entry.marker_pending) return;
2593
+ if (entry.marker_pending || entry.no_marker) return;
2542
2594
  let st = window.history.state;
2543
2595
  if (st && st.__yui_overlay__ === entry.id) {
2544
2596
  priv.expected_pops++;
2545
2597
  priv.expected_pop_hash = typeof entry.below_hash === "string" ? entry.below_hash : window.location.hash;
2598
+ priv.restore_hash = window.location.hash !== priv.expected_pop_hash ? window.location.hash : "";
2546
2599
  try {
2547
2600
  window.history.back();
2548
2601
  } catch (e) {
@@ -2891,6 +2944,11 @@ function yui_shell_of(gobj) {
2891
2944
  ************************************************************/
2892
2945
  function yui_shell_navigate(shell_gobj, route, opts) {
2893
2946
  if (!(opts && opts.replace) && gobj_read_attr(shell_gobj, "use_hash")) {
2947
+ let priv = shell_gobj.priv;
2948
+ if (priv && priv.expected_pops > 0) {
2949
+ priv.deferred_route = route;
2950
+ return;
2951
+ }
2894
2952
  let target_hash = route_to_hash(route);
2895
2953
  if (window.location.hash !== target_hash) {
2896
2954
  window.location.hash = target_hash;
@@ -4918,21 +4976,13 @@ function chip_lead(icon) {
4918
4976
  * trace dumps it), so the window travels in it as its FULL NAME,
4919
4977
  * which the trace can print, and the gobj is the event's src --
4920
4978
  * every sender is the window itself. Up to 7.26.9 the kw carried
4921
- * the gobj; that is still taken, with a warning, for this release.
4979
+ * the gobj; since 7.26.14 that is refused.
4922
4980
  ************************************************************/
4923
- var warned_gobj_in_kw = false;
4924
4981
  function window_of(gobj, event, kw, src) {
4925
4982
  let w = kw && kw.window;
4926
4983
  if (is_gobj(w)) {
4927
- if (!warned_gobj_in_kw) {
4928
- warned_gobj_in_kw = true;
4929
- log_warning(`${gobj_short_name(gobj)}: ${event} carries the window gobj in its kw: send {window: gobj_full_name(window)} from the window`);
4930
- }
4931
- if (w !== src) {
4932
- log_error(`${gobj_short_name(gobj)}: ${event}: window '${gobj_full_name(w)}' is not the src of the event (${is_gobj(src) ? gobj_full_name(src) : String(src)})`);
4933
- return null;
4934
- }
4935
- return w;
4984
+ log_error(`${gobj_short_name(gobj)}: ${event} carries the window gobj in its kw: send {window: gobj_full_name(window)} from the window`);
4985
+ return null;
4936
4986
  }
4937
4987
  if (!is_gobj(src) || gobj_full_name(src) !== w) {
4938
4988
  log_error(`${gobj_short_name(gobj)}: ${event}: window '${w}' is not the src of the event (${is_gobj(src) ? gobj_full_name(src) : String(src)})`);
@@ -60602,6 +60652,22 @@ function css_color_or_null(value) {
60602
60652
  * All Rights Reserved.
60603
60653
  ***********************************************************************/
60604
60654
  /***************************************************************
60655
+ * The markup of one toolbar item. Everything that goes into it is
60656
+ * escaped, the read-out branch too: its text, title and value are
60657
+ * values (a zoom figure, a translated title), never markup.
60658
+ ***************************************************************/
60659
+ function toolbar_item_html(item) {
60660
+ if (item.separator) return `<div class="g6-toolbar-sep" aria-hidden="true"></div>`;
60661
+ const extra_class = item.className ? ` ${escapeHtml(String(item.className))}` : "";
60662
+ const title = escapeHtml(String(item.title ?? ""));
60663
+ if (item.readout) return `<div class="g6-toolbar-readout${extra_class}" title="${title}" aria-label="${title}">${escapeHtml(String(item.text ?? ""))}</div>`;
60664
+ const disabled = item.disabled ? " disabled" : "";
60665
+ const is_text = item.text !== void 0;
60666
+ const kind_class = is_text ? " g6-toolbar-item-text" : "";
60667
+ 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>`;
60668
+ return `<div class="g6-toolbar-item${kind_class}${extra_class}" value="${escapeHtml(String(item.value))}" title="${title}" aria-label="${title}"${disabled}>${body}</div>`;
60669
+ }
60670
+ /***************************************************************
60605
60671
  * YuiToolbar — G6 Toolbar subclass that adds per-item className
60606
60672
  * and disabled support, plus three item kinds G6 does not have.
60607
60673
  *
@@ -60627,17 +60693,7 @@ function css_color_or_null(value) {
60627
60693
  ***************************************************************/
60628
60694
  var YuiToolbar = class extends Toolbar {
60629
60695
  async getDOMContent() {
60630
- return (await this.options.getItems()).map((item) => {
60631
- if (item.separator) return `<div class="g6-toolbar-sep" aria-hidden="true"></div>`;
60632
- const extra_class = item.className ? ` ${escapeHtml(String(item.className))}` : "";
60633
- const title = escapeHtml(String(item.title ?? ""));
60634
- if (item.readout) return `<div class="g6-toolbar-readout${extra_class}" title="${title}" aria-label="${title}">${escapeHtml(String(item.text ?? ""))}</div>`;
60635
- const disabled = item.disabled ? " disabled" : "";
60636
- const is_text = item.text !== void 0;
60637
- const kind_class = is_text ? " g6-toolbar-item-text" : "";
60638
- 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>`;
60639
- return `<div class="g6-toolbar-item${kind_class}${extra_class}" value="${escapeHtml(String(item.value))}" title="${title}" aria-label="${title}"${disabled}>${body}</div>`;
60640
- }).join("");
60696
+ return (await this.options.getItems()).map(toolbar_item_html).join("");
60641
60697
  }
60642
60698
  };
60643
60699
  register(ExtensionCategory.PLUGIN, "yui-toolbar", YuiToolbar);
@@ -70832,6 +70888,19 @@ var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:.875rem; opacity:.8;";
70832
70888
  var LEGEND_MAIN_NAME_STYLE = LEGEND_NAME_STYLE + " font-weight:700;";
70833
70889
  var LEGEND_STAR_MAIN_STYLE = LEGEND_GLYPH_STYLE + " color:var(--bulma-warning-on-scheme, var(--bulma-warning, #ffdd57));";
70834
70890
  var LEGEND_FOCUSED_STYLE = "box-shadow: inset 0 0 0 2px var(--bulma-text, #2e333d);";
70891
+ /************************************************************
70892
+ * The name of a topic in the legend: schema data, never markup.
70893
+ ************************************************************/
70894
+ function legend_name_item(topic_name, is_main, hidden) {
70895
+ return [
70896
+ "span",
70897
+ {
70898
+ class: "GRAPH_LEGEND_NAME",
70899
+ style: (is_main ? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) + (hidden ? " text-decoration:line-through; opacity:.6;" : "")
70900
+ },
70901
+ text_node(topic_name)
70902
+ ];
70903
+ }
70835
70904
  function refresh_legend(gobj) {
70836
70905
  let priv = gobj.priv;
70837
70906
  let $container = gobj_read_attr(gobj, "$container");
@@ -70854,14 +70923,7 @@ function refresh_legend(gobj) {
70854
70923
  controls.push(["span", {
70855
70924
  class: "GRAPH_LEGEND_SWATCH",
70856
70925
  style: `display:inline-block; width:.8rem; height:.8rem; border-radius:3px; margin-right:.35rem; flex:0 0 auto; background:${entry.color || "#94a3b8"}; border:1px solid rgba(0,0,0,.25);` + (hidden ? "opacity:.35;" : "")
70857
- }], [
70858
- "span",
70859
- {
70860
- class: "GRAPH_LEGEND_NAME",
70861
- style: (is_main ? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) + (hidden ? " text-decoration:line-through; opacity:.6;" : "")
70862
- },
70863
- text_node(topic_name)
70864
- ], [
70926
+ }], legend_name_item(topic_name, is_main, hidden), [
70865
70927
  "span",
70866
70928
  {
70867
70929
  class: "GRAPH_LEGEND_COUNT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.26.12",
3
+ "version": "7.26.14",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -28,6 +28,7 @@
28
28
  "check-markup": "node scripts/check-markup-strings.mjs",
29
29
  "prebuild": "npm run check-markup",
30
30
  "pretest": "npm run check-markup",
31
+ "qa-history": "node scripts/qa-history.mjs",
31
32
  "deploy-round": "node scripts/deploy-round.mjs",
32
33
  "prepublishOnly": "npm run build"
33
34
  },
@@ -92,10 +92,19 @@ function starts_with_markup(s)
92
92
  }
93
93
 
94
94
  /* String methods that keep the head of their receiver (a markup head
95
- * stays a markup head through them). */
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. */
96
98
  const HEAD_KEEPING_METHODS = new Set([
97
99
  "trim", "trimStart", "trimEnd", "toString", "valueOf", "normalize",
98
- "toLowerCase", "toUpperCase", "replace", "replaceAll", "padEnd", "concat"
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"
99
108
  ]);
100
109
 
101
110
  function concat_parts(parts)
@@ -190,6 +199,9 @@ function leading(n)
190
199
  if(method === "concat") {
191
200
  return concat_parts([head, ...n.arguments.map(leading)]);
192
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
+ }
193
205
  /* The head is kept; the whole is no longer known to be static. */
194
206
  return {text: head.text, complete: false};
195
207
  }