@yuneta/gobj-ui 7.26.13 → 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
@@ -978,6 +978,7 @@ var PRIVATE_DATA$22 = {
978
978
  markers_after_hashchange: false,
979
979
  restore_hash: "",
980
980
  skip_hash: "",
981
+ deferred_route: "",
981
982
  popstate_handler: null,
982
983
  avatar_provider: null,
983
984
  avatar_nodes: [],
@@ -1093,6 +1094,13 @@ function mt_start$20(gobj) {
1093
1094
  } catch (e) {
1094
1095
  (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: overlay close on Back failed: ${e}`);
1095
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
+ }
1096
1104
  };
1097
1105
  window.addEventListener("popstate", priv.popstate_handler);
1098
1106
  }
@@ -1138,6 +1146,7 @@ function mt_stop$20(gobj) {
1138
1146
  priv.markers_after_hashchange = false;
1139
1147
  priv.restore_hash = "";
1140
1148
  priv.skip_hash = "";
1149
+ priv.deferred_route = "";
1141
1150
  if (priv.keydown_handler) {
1142
1151
  window.removeEventListener("keydown", priv.keydown_handler);
1143
1152
  priv.keydown_handler = null;
@@ -2573,6 +2582,11 @@ function push_pending_markers(gobj) {
2573
2582
  entry.hash = window.location.hash;
2574
2583
  push_overlay_marker(gobj, entry);
2575
2584
  }
2585
+ if (priv.deferred_route) {
2586
+ let route = priv.deferred_route;
2587
+ priv.deferred_route = "";
2588
+ yui_shell_navigate(gobj, route);
2589
+ }
2576
2590
  }
2577
2591
  function overlay_dismissed(gobj, entry) {
2578
2592
  let priv = gobj.priv;
@@ -2935,6 +2949,11 @@ function yui_shell_of(gobj) {
2935
2949
  ************************************************************/
2936
2950
  function yui_shell_navigate(shell_gobj, route, opts) {
2937
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
+ }
2938
2957
  let target_hash = route_to_hash(route);
2939
2958
  if (window.location.hash !== target_hash) {
2940
2959
  window.location.hash = target_hash;
@@ -4962,21 +4981,13 @@ function chip_lead(icon) {
4962
4981
  * trace dumps it), so the window travels in it as its FULL NAME,
4963
4982
  * which the trace can print, and the gobj is the event's src --
4964
4983
  * every sender is the window itself. Up to 7.26.9 the kw carried
4965
- * the gobj; that is still taken, with a warning, for this release.
4984
+ * the gobj; since 7.26.14 that is refused.
4966
4985
  ************************************************************/
4967
- var warned_gobj_in_kw = false;
4968
4986
  function window_of(gobj, event, kw, src) {
4969
4987
  let w = kw && kw.window;
4970
4988
  if ((0, _yuneta_gobj_js.is_gobj)(w)) {
4971
- if (!warned_gobj_in_kw) {
4972
- warned_gobj_in_kw = true;
4973
- (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`);
4974
- }
4975
- if (w !== src) {
4976
- (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)})`);
4977
- return null;
4978
- }
4979
- 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;
4980
4991
  }
4981
4992
  if (!(0, _yuneta_gobj_js.is_gobj)(src) || (0, _yuneta_gobj_js.gobj_full_name)(src) !== w) {
4982
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)})`);
@@ -60646,6 +60657,22 @@ function css_color_or_null(value) {
60646
60657
  * All Rights Reserved.
60647
60658
  ***********************************************************************/
60648
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
+ /***************************************************************
60649
60676
  * YuiToolbar — G6 Toolbar subclass that adds per-item className
60650
60677
  * and disabled support, plus three item kinds G6 does not have.
60651
60678
  *
@@ -60671,17 +60698,7 @@ function css_color_or_null(value) {
60671
60698
  ***************************************************************/
60672
60699
  var YuiToolbar = class extends _antv_g6.Toolbar {
60673
60700
  async getDOMContent() {
60674
- return (await this.options.getItems()).map((item) => {
60675
- if (item.separator) return `<div class="g6-toolbar-sep" aria-hidden="true"></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>`;
60679
- const disabled = item.disabled ? " disabled" : "";
60680
- const is_text = item.text !== void 0;
60681
- const kind_class = is_text ? " g6-toolbar-item-text" : "";
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>`;
60684
- }).join("");
60701
+ return (await this.options.getItems()).map(toolbar_item_html).join("");
60685
60702
  }
60686
60703
  };
60687
60704
  (0, _antv_g6.register)(_antv_g6.ExtensionCategory.PLUGIN, "yui-toolbar", YuiToolbar);
@@ -70876,6 +70893,19 @@ var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:.875rem; opacity:.8;";
70876
70893
  var LEGEND_MAIN_NAME_STYLE = LEGEND_NAME_STYLE + " font-weight:700;";
70877
70894
  var LEGEND_STAR_MAIN_STYLE = LEGEND_GLYPH_STYLE + " color:var(--bulma-warning-on-scheme, var(--bulma-warning, #ffdd57));";
70878
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
+ }
70879
70909
  function refresh_legend(gobj) {
70880
70910
  let priv = gobj.priv;
70881
70911
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
@@ -70898,14 +70928,7 @@ function refresh_legend(gobj) {
70898
70928
  controls.push(["span", {
70899
70929
  class: "GRAPH_LEGEND_SWATCH",
70900
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;" : "")
70901
- }], [
70902
- "span",
70903
- {
70904
- class: "GRAPH_LEGEND_NAME",
70905
- style: (is_main ? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) + (hidden ? " text-decoration:line-through; opacity:.6;" : "")
70906
- },
70907
- text_node(topic_name)
70908
- ], [
70931
+ }], legend_name_item(topic_name, is_main, hidden), [
70909
70932
  "span",
70910
70933
  {
70911
70934
  class: "GRAPH_LEGEND_COUNT",
@@ -973,6 +973,7 @@ var PRIVATE_DATA$22 = {
973
973
  markers_after_hashchange: false,
974
974
  restore_hash: "",
975
975
  skip_hash: "",
976
+ deferred_route: "",
976
977
  popstate_handler: null,
977
978
  avatar_provider: null,
978
979
  avatar_nodes: [],
@@ -1088,6 +1089,13 @@ function mt_start$20(gobj) {
1088
1089
  } catch (e) {
1089
1090
  log_warning(`C_YUI_SHELL: overlay close on Back failed: ${e}`);
1090
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
+ }
1091
1099
  };
1092
1100
  window.addEventListener("popstate", priv.popstate_handler);
1093
1101
  }
@@ -1133,6 +1141,7 @@ function mt_stop$20(gobj) {
1133
1141
  priv.markers_after_hashchange = false;
1134
1142
  priv.restore_hash = "";
1135
1143
  priv.skip_hash = "";
1144
+ priv.deferred_route = "";
1136
1145
  if (priv.keydown_handler) {
1137
1146
  window.removeEventListener("keydown", priv.keydown_handler);
1138
1147
  priv.keydown_handler = null;
@@ -2568,6 +2577,11 @@ function push_pending_markers(gobj) {
2568
2577
  entry.hash = window.location.hash;
2569
2578
  push_overlay_marker(gobj, entry);
2570
2579
  }
2580
+ if (priv.deferred_route) {
2581
+ let route = priv.deferred_route;
2582
+ priv.deferred_route = "";
2583
+ yui_shell_navigate(gobj, route);
2584
+ }
2571
2585
  }
2572
2586
  function overlay_dismissed(gobj, entry) {
2573
2587
  let priv = gobj.priv;
@@ -2930,6 +2944,11 @@ function yui_shell_of(gobj) {
2930
2944
  ************************************************************/
2931
2945
  function yui_shell_navigate(shell_gobj, route, opts) {
2932
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
+ }
2933
2952
  let target_hash = route_to_hash(route);
2934
2953
  if (window.location.hash !== target_hash) {
2935
2954
  window.location.hash = target_hash;
@@ -4957,21 +4976,13 @@ function chip_lead(icon) {
4957
4976
  * trace dumps it), so the window travels in it as its FULL NAME,
4958
4977
  * which the trace can print, and the gobj is the event's src --
4959
4978
  * every sender is the window itself. Up to 7.26.9 the kw carried
4960
- * the gobj; that is still taken, with a warning, for this release.
4979
+ * the gobj; since 7.26.14 that is refused.
4961
4980
  ************************************************************/
4962
- var warned_gobj_in_kw = false;
4963
4981
  function window_of(gobj, event, kw, src) {
4964
4982
  let w = kw && kw.window;
4965
4983
  if (is_gobj(w)) {
4966
- if (!warned_gobj_in_kw) {
4967
- warned_gobj_in_kw = true;
4968
- log_warning(`${gobj_short_name(gobj)}: ${event} carries the window gobj in its kw: send {window: gobj_full_name(window)} from the window`);
4969
- }
4970
- if (w !== src) {
4971
- 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)})`);
4972
- return null;
4973
- }
4974
- 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;
4975
4986
  }
4976
4987
  if (!is_gobj(src) || gobj_full_name(src) !== w) {
4977
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)})`);
@@ -60641,6 +60652,22 @@ function css_color_or_null(value) {
60641
60652
  * All Rights Reserved.
60642
60653
  ***********************************************************************/
60643
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
+ /***************************************************************
60644
60671
  * YuiToolbar — G6 Toolbar subclass that adds per-item className
60645
60672
  * and disabled support, plus three item kinds G6 does not have.
60646
60673
  *
@@ -60666,17 +60693,7 @@ function css_color_or_null(value) {
60666
60693
  ***************************************************************/
60667
60694
  var YuiToolbar = class extends Toolbar {
60668
60695
  async getDOMContent() {
60669
- return (await this.options.getItems()).map((item) => {
60670
- if (item.separator) return `<div class="g6-toolbar-sep" aria-hidden="true"></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>`;
60674
- const disabled = item.disabled ? " disabled" : "";
60675
- const is_text = item.text !== void 0;
60676
- const kind_class = is_text ? " g6-toolbar-item-text" : "";
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>`;
60679
- }).join("");
60696
+ return (await this.options.getItems()).map(toolbar_item_html).join("");
60680
60697
  }
60681
60698
  };
60682
60699
  register(ExtensionCategory.PLUGIN, "yui-toolbar", YuiToolbar);
@@ -70871,6 +70888,19 @@ var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:.875rem; opacity:.8;";
70871
70888
  var LEGEND_MAIN_NAME_STYLE = LEGEND_NAME_STYLE + " font-weight:700;";
70872
70889
  var LEGEND_STAR_MAIN_STYLE = LEGEND_GLYPH_STYLE + " color:var(--bulma-warning-on-scheme, var(--bulma-warning, #ffdd57));";
70873
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
+ }
70874
70904
  function refresh_legend(gobj) {
70875
70905
  let priv = gobj.priv;
70876
70906
  let $container = gobj_read_attr(gobj, "$container");
@@ -70893,14 +70923,7 @@ function refresh_legend(gobj) {
70893
70923
  controls.push(["span", {
70894
70924
  class: "GRAPH_LEGEND_SWATCH",
70895
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;" : "")
70896
- }], [
70897
- "span",
70898
- {
70899
- class: "GRAPH_LEGEND_NAME",
70900
- style: (is_main ? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) + (hidden ? " text-decoration:line-through; opacity:.6;" : "")
70901
- },
70902
- text_node(topic_name)
70903
- ], [
70926
+ }], legend_name_item(topic_name, is_main, hidden), [
70904
70927
  "span",
70905
70928
  {
70906
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.13",
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
  },
@@ -179,6 +179,47 @@ import {yui_shell_show_error} from "./shell_modals.js";
179
179
  import {g6_event_kw} from "./g6_event_kw.js";
180
180
  import {css_color_or_null} from "./yui_data_color.js";
181
181
 
182
+ /***************************************************************
183
+ * The markup of one toolbar item. Everything that goes into it is
184
+ * escaped, the read-out branch too: its text, title and value are
185
+ * values (a zoom figure, a translated title), never markup.
186
+ ***************************************************************/
187
+ function toolbar_item_html(item)
188
+ {
189
+ if(item.separator) {
190
+ return `<div class="g6-toolbar-sep" aria-hidden="true"></div>`;
191
+ }
192
+
193
+ const extra_class = item.className ? ` ${escapeHtml(String(item.className))}` : '';
194
+ const title = escapeHtml(String(item.title ?? ''));
195
+
196
+ if(item.readout) {
197
+ return (
198
+ `<div class="g6-toolbar-readout${extra_class}"` +
199
+ ` title="${title}" aria-label="${title}">` +
200
+ `${escapeHtml(String(item.text ?? ''))}` +
201
+ `</div>`
202
+ );
203
+ }
204
+
205
+ const disabled = item.disabled ? ' disabled' : '';
206
+ const is_text = (item.text !== undefined);
207
+ const kind_class = is_text ? ' g6-toolbar-item-text' : '';
208
+ const body = is_text
209
+ ? `<span class="g6-toolbar-text">${escapeHtml(String(item.text))}</span>`
210
+ : `<svg aria-hidden="true" focusable="false">` +
211
+ `<use xlink:href="#${escapeHtml(String(item.id))}"></use>` +
212
+ `</svg>`;
213
+
214
+ return (
215
+ `<div class="g6-toolbar-item${kind_class}${extra_class}"` +
216
+ ` value="${escapeHtml(String(item.value))}" title="${title}"` +
217
+ ` aria-label="${title}"${disabled}>` +
218
+ `${body}` +
219
+ `</div>`
220
+ );
221
+ }
222
+
182
223
  /***************************************************************
183
224
  * YuiToolbar — G6 Toolbar subclass that adds per-item className
184
225
  * and disabled support, plus three item kinds G6 does not have.
@@ -208,43 +249,7 @@ class YuiToolbar extends Toolbar
208
249
  async getDOMContent()
209
250
  {
210
251
  const items = await this.options.getItems();
211
- return items.map((item) => {
212
- if(item.separator) {
213
- return `<div class="g6-toolbar-sep" aria-hidden="true"></div>`;
214
- }
215
-
216
- /* Everything that goes into this markup is escaped, the
217
- * read-out branch too: its text, title and value are values
218
- * (a zoom figure, a translated title), never markup. */
219
- const extra_class = item.className ? ` ${escapeHtml(String(item.className))}` : '';
220
- const title = escapeHtml(String(item.title ?? ''));
221
-
222
- if(item.readout) {
223
- return (
224
- `<div class="g6-toolbar-readout${extra_class}"` +
225
- ` title="${title}" aria-label="${title}">` +
226
- `${escapeHtml(String(item.text ?? ''))}` +
227
- `</div>`
228
- );
229
- }
230
-
231
- const disabled = item.disabled ? ' disabled' : '';
232
- const is_text = (item.text !== undefined);
233
- const kind_class = is_text ? ' g6-toolbar-item-text' : '';
234
- const body = is_text
235
- ? `<span class="g6-toolbar-text">${escapeHtml(String(item.text))}</span>`
236
- : `<svg aria-hidden="true" focusable="false">` +
237
- `<use xlink:href="#${escapeHtml(String(item.id))}"></use>` +
238
- `</svg>`;
239
-
240
- return (
241
- `<div class="g6-toolbar-item${kind_class}${extra_class}"` +
242
- ` value="${escapeHtml(String(item.value))}" title="${title}"` +
243
- ` aria-label="${title}"${disabled}>` +
244
- `${body}` +
245
- `</div>`
246
- );
247
- }).join('');
252
+ return items.map(toolbar_item_html).join('');
248
253
  }
249
254
  }
250
255
  register(ExtensionCategory.PLUGIN, 'yui-toolbar', YuiToolbar);
@@ -12431,4 +12436,7 @@ function register_c_g6_nodes_tree()
12431
12436
  return create_gclass(GCLASS_NAME);
12432
12437
  }
12433
12438
 
12434
- export { register_c_g6_nodes_tree };
12439
+ export {
12440
+ register_c_g6_nodes_tree,
12441
+ toolbar_item_html, // exported for its test
12442
+ };
@@ -4823,5 +4823,9 @@ export {
4823
4823
  register_c_yui_schema_editor,
4824
4824
  /* Exported for its test: the rule that decides whether a topic still
4825
4825
  * owes a version bump, which is asked in two places. */
4826
- topic_is_draft
4826
+ topic_is_draft,
4827
+ /* Exported for their test: the options and the value of a form
4828
+ * control are names from the schema, data, never markup. */
4829
+ select_input,
4830
+ textarea_input,
4827
4831
  };
@@ -176,6 +176,10 @@ let PRIVATE_DATA = {
176
176
  * that landing, which must not navigate. */
177
177
  restore_hash: "",
178
178
  skip_hash: "",
179
+ /* A route pushed (yui_shell_navigate) while a back() of ours was in
180
+ * flight: it is navigated once the back() is over, or the traversal
181
+ * would run from it and undo it. */
182
+ deferred_route: "",
179
183
  popstate_handler: null,
180
184
  /* Avatar item support — every toolbar item with type:"avatar"
181
185
  * registers its <span> here so refresh_avatars() can repaint
@@ -442,6 +446,21 @@ function mt_start(gobj)
442
446
  } catch(e) {
443
447
  log_warning(`C_YUI_SHELL: overlay close on Back failed: ${e}`);
444
448
  }
449
+ if(typeof top.below_hash === "string" && top.hash !== top.below_hash &&
450
+ window.location.hash === top.below_hash) {
451
+ /* A replace navigation had written the view's position
452
+ * on the marker, and stepping off it landed on the entry
453
+ * under it, on the old hash: put the position back, and
454
+ * let the hashchange of this landing pass -- Back closed
455
+ * the panel, it did not move the view. */
456
+ try {
457
+ window.history.replaceState(window.history.state, "", top.hash);
458
+ p.skip_hash = top.hash;
459
+ p.last_hash = top.hash;
460
+ } catch(e) {
461
+ log_warning(`C_YUI_SHELL: restoring '${top.hash}' failed: ${e}`);
462
+ }
463
+ }
445
464
  };
446
465
  window.addEventListener("popstate", priv.popstate_handler);
447
466
  }
@@ -522,6 +541,7 @@ function mt_stop(gobj)
522
541
  priv.markers_after_hashchange = false;
523
542
  priv.restore_hash = "";
524
543
  priv.skip_hash = "";
544
+ priv.deferred_route = "";
525
545
  if(priv.keydown_handler) {
526
546
  window.removeEventListener("keydown", priv.keydown_handler);
527
547
  priv.keydown_handler = null;
@@ -2813,6 +2833,11 @@ function push_pending_markers(gobj)
2813
2833
  entry.hash = window.location.hash;
2814
2834
  push_overlay_marker(gobj, entry); // Error already logged
2815
2835
  }
2836
+ if(priv.deferred_route) {
2837
+ let route = priv.deferred_route;
2838
+ priv.deferred_route = "";
2839
+ yui_shell_navigate(gobj, route);
2840
+ }
2816
2841
  }
2817
2842
 
2818
2843
  function overlay_dismissed(gobj, entry)
@@ -3674,6 +3699,16 @@ function yui_shell_zone(shell_gobj, zone_id)
3674
3699
  function yui_shell_navigate(shell_gobj, route, opts)
3675
3700
  {
3676
3701
  if(!(opts && opts.replace) && gobj_read_attr(shell_gobj, "use_hash")) {
3702
+ let priv = shell_gobj.priv;
3703
+ if(priv && priv.expected_pops > 0) {
3704
+ /* A back() of ours is in flight (an overlay closed in this
3705
+ * same turn, e.g. a dialog's action that closes it and then
3706
+ * navigates): a push now lands BEFORE the traversal, which
3707
+ * then runs from it and undoes it (and in Firefox lands on
3708
+ * the closed overlay's marker). Navigate once it is over. */
3709
+ priv.deferred_route = route;
3710
+ return;
3711
+ }
3677
3712
  let target_hash = route_to_hash(route);
3678
3713
  if(window.location.hash !== target_hash) {
3679
3714
  /* Push a real history entry; the hashchange handler mounts. */
@@ -3025,6 +3025,17 @@ const LEGEND_STAR_MAIN_STYLE = LEGEND_GLYPH_STYLE +
3025
3025
  * outside the box is clipped by its neighbours. */
3026
3026
  const LEGEND_FOCUSED_STYLE = 'box-shadow: inset 0 0 0 2px var(--bulma-text, #2e333d);';
3027
3027
 
3028
+ /************************************************************
3029
+ * The name of a topic in the legend: schema data, never markup.
3030
+ ************************************************************/
3031
+ function legend_name_item(topic_name, is_main, hidden)
3032
+ {
3033
+ return ['span', {class: 'GRAPH_LEGEND_NAME',
3034
+ style: (is_main? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) +
3035
+ (hidden? ' text-decoration:line-through; opacity:.6;' : '')},
3036
+ text_node(topic_name)];
3037
+ }
3038
+
3028
3039
  function refresh_legend(gobj)
3029
3040
  {
3030
3041
  let priv = gobj.priv;
@@ -3082,10 +3093,7 @@ function refresh_legend(gobj)
3082
3093
  `background:${entry.color || "#94a3b8"}; ` +
3083
3094
  `border:1px solid rgba(0,0,0,.25);` +
3084
3095
  (hidden? 'opacity:.35;' : '')}],
3085
- ['span', {class: 'GRAPH_LEGEND_NAME',
3086
- style: (is_main? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) +
3087
- (hidden? ' text-decoration:line-through; opacity:.6;' : '')},
3088
- text_node(topic_name)], // schema data, never markup
3096
+ legend_name_item(topic_name, is_main, hidden),
3089
3097
  ['span', {class: 'GRAPH_LEGEND_COUNT',
3090
3098
  style: LEGEND_COUNT_STYLE},
3091
3099
  hidden? `${entry.total}` : `${entry.visible}/${entry.total}`]
@@ -3874,4 +3882,7 @@ function register_c_yui_treedb_graph()
3874
3882
  return create_gclass(GCLASS_NAME);
3875
3883
  }
3876
3884
 
3877
- export { register_c_yui_treedb_graph };
3885
+ export {
3886
+ register_c_yui_treedb_graph,
3887
+ legend_name_item, // exported for its test
3888
+ };
@@ -5563,4 +5563,9 @@ function register_c_yui_treedb_topic_with_form()
5563
5563
  return create_gclass(GCLASS_NAME);
5564
5564
  }
5565
5565
 
5566
- export { register_c_yui_treedb_topic_with_form };
5566
+ export {
5567
+ register_c_yui_treedb_topic_with_form,
5568
+ /* Exported for its test: an icon cell shows a name that fails the
5569
+ * check as text, never as markup (it is a value of the record). */
5570
+ icon_formatter,
5571
+ };
@@ -35,7 +35,6 @@ import {
35
35
  data_type_t,
36
36
  gclass_create,
37
37
  log_error,
38
- log_warning,
39
38
  is_gobj,
40
39
  gobj_full_name,
41
40
  gobj_short_name,
@@ -350,31 +349,19 @@ function chip_lead(icon)
350
349
  * trace dumps it), so the window travels in it as its FULL NAME,
351
350
  * which the trace can print, and the gobj is the event's src --
352
351
  * every sender is the window itself. Up to 7.26.9 the kw carried
353
- * the gobj; that is still taken, with a warning, for this release.
352
+ * the gobj; since 7.26.14 that is refused.
354
353
  ************************************************************/
355
- let warned_gobj_in_kw = false;
356
-
357
354
  function window_of(gobj, event, kw, src)
358
355
  {
359
356
  let w = kw && kw.window;
360
357
  if(is_gobj(w)) {
361
- if(!warned_gobj_in_kw) {
362
- warned_gobj_in_kw = true;
363
- log_warning(
364
- `${gobj_short_name(gobj)}: ${event} carries the window gobj ` +
365
- `in its kw: send {window: gobj_full_name(window)} from the window`
366
- );
367
- }
368
- if(w !== src) {
369
- /* Only the window speaks for itself, in either form. */
370
- log_error(
371
- `${gobj_short_name(gobj)}: ${event}: window ` +
372
- `'${gobj_full_name(w)}' is not the src of the event ` +
373
- `(${is_gobj(src) ? gobj_full_name(src) : String(src)})`
374
- );
375
- return null;
376
- }
377
- return w;
358
+ /* The gobj in the kw was accepted up to 7.26.13 (with a warning
359
+ * since 7.26.10). A kw is plain json: refused. */
360
+ log_error(
361
+ `${gobj_short_name(gobj)}: ${event} carries the window gobj in ` +
362
+ `its kw: send {window: gobj_full_name(window)} from the window`
363
+ );
364
+ return null;
378
365
  }
379
366
  if(!is_gobj(src) || gobj_full_name(src) !== w) {
380
367
  log_error(
@@ -0,0 +1,174 @@
1
+ /***********************************************************************
2
+ * data_as_text.wiring.test.js
3
+ *
4
+ * Values that come from a backend, a schema or a record are
5
+ * DATA: they are shown as text, never parsed as markup. One case
6
+ * per sink fixed in the review of 2026-10-10 (yunovatios
7
+ * REV-CLOUD.md V3.1 #1, #2, #4, #5 and V4.2): each one is fed a
8
+ * markup string and must show it, with no element created.
9
+ *
10
+ * Copyright (c) 2026, ArtGins.
11
+ * All Rights Reserved.
12
+ ***********************************************************************/
13
+ import {describe, test, expect, beforeAll} from "vitest";
14
+ import {install_dom_double} from "../test/dom_double.js";
15
+
16
+ install_dom_double();
17
+
18
+ if(typeof globalThis.ResizeObserver === "undefined") {
19
+ globalThis.ResizeObserver = class {
20
+ observe() {
21
+ }
22
+ unobserve() {
23
+ }
24
+ disconnect() {
25
+ }
26
+ };
27
+ }
28
+ if(typeof globalThis.matchMedia === "undefined") {
29
+ globalThis.matchMedia = () => ({matches: false, addEventListener() {}, removeEventListener() {}});
30
+ }
31
+
32
+ const {
33
+ SDATA, SDATA_END, data_type_t, gclass_create, gobj_write_attr,
34
+ gobj_start_up, gobj_create_yuno, gobj_create,
35
+ gobj_start, gobj_read_attr, gobj_send_event,
36
+ createElement2,
37
+ set_log_callback,
38
+ } = await import("@yuneta/gobj-js");
39
+
40
+ const EVIL = '<img src=x onerror="window.__pwned=1">';
41
+ let yuno = null;
42
+
43
+ beforeAll(async () => {
44
+ const i18next = (await import("i18next")).default;
45
+ await i18next.init({lng: "en", resources: {}});
46
+ gobj_start_up(null, null, null, null, null, null, null);
47
+ set_log_callback(() => {});
48
+ gclass_create("C_TEST_TEXT_HOST", [], [["ST_IDLE", []]], {}, 0, [SDATA_END()], {}, 0, 0, 0, 0);
49
+ gclass_create(
50
+ "C_TEST_TEXT_JSON_HOST",
51
+ [["EV_EXPAND_PATH", 0]],
52
+ [["ST_IDLE", [["EV_EXPAND_PATH", () => 0, null]]]],
53
+ {}, 0, [SDATA_END()], {}, 0, 0, 0, 0
54
+ );
55
+ gclass_create(
56
+ "C_TEST_TEXT_VIEW", [], [["ST_IDLE", []]], {
57
+ mt_create: (gobj) => {
58
+ gobj_write_attr(gobj, "$container", document.createElement("div"));
59
+ }
60
+ }, 0, [
61
+ SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "view root"),
62
+ SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "subscriber"),
63
+ SDATA_END()
64
+ ], {}, 0, 0, 0, 0
65
+ );
66
+ yuno = gobj_create_yuno("data_text_yuno", "C_TEST_TEXT_HOST", {});
67
+ gobj_start(yuno);
68
+ });
69
+
70
+ /* What a reader sees, and no element built from the data. */
71
+ function expect_text($el, text)
72
+ {
73
+ expect($el.textContent.includes(text)).toBe(true);
74
+ expect($el.querySelector("img")).toBe(null);
75
+ }
76
+
77
+ describe("data is text, not markup", () => {
78
+ test("V3.1 #1: an icon cell with a name that fails the check", async () => {
79
+ const {icon_formatter} = await import("./c_yui_treedb_topic_with_form.js");
80
+ const $cell = icon_formatter({getValue: () => EVIL});
81
+ expect_text($cell, EVIL);
82
+ });
83
+
84
+ test("V3.1 #2: the schema editor's select options and textarea value", async () => {
85
+ const {select_input, textarea_input} = await import("./c_yui_schema_editor.js");
86
+ const $select = createElement2(select_input("topic", "x", [EVIL, "ok"]));
87
+ expect_text($select, EVIL);
88
+ expect($select.querySelectorAll("option").length).toBe(2);
89
+ const $area = createElement2(textarea_input("desc", EVIL, 3, ""));
90
+ expect_text($area, EVIL);
91
+ });
92
+
93
+ test("V3.1 #4: the error of a subtree the JSON viewer could not load", async () => {
94
+ const {register_c_yui_json} = await import("./c_yui_json.js");
95
+ register_c_yui_json();
96
+ const host = gobj_create("json_text_host", "C_TEST_TEXT_JSON_HOST", {}, yuno);
97
+ gobj_start(host);
98
+ const viewer = gobj_create("json_text", "C_YUI_JSON", {view_mode: "tree"}, host);
99
+ gobj_start(viewer);
100
+ gobj_send_event(viewer, "EV_SET_JSON",
101
+ {json: {a: {__collapsed__: {size: 3, path: "a"}}}}, host);
102
+ gobj_send_event(viewer, "EV_SUBTREE_ERROR", {path: "a", error: EVIL}, host);
103
+ const $c = gobj_read_attr(viewer, "$container");
104
+ const $err = $c.querySelector(".JSON_STUB_ERR");
105
+ expect($err).not.toBe(null);
106
+ expect_text($err, EVIL);
107
+ });
108
+
109
+ test("V3.1 #5: the shell's toolbar label and dropdown label", async () => {
110
+ const {register_c_yui_shell} = await import("./c_yui_shell.js");
111
+ register_c_yui_shell();
112
+ const config = {
113
+ shell: {
114
+ zones: {top: {host: "toolbar"}, center: {host: "stage.main"}},
115
+ stages: {main: {zone: "center", default_route: "/home"}}
116
+ },
117
+ toolbar: {
118
+ zone: "top",
119
+ items: [
120
+ {id: "plain", name: EVIL,
121
+ action: {type: "event", event: "EV_TEXT_PLAIN"}},
122
+ {id: "menu", name: "menu",
123
+ action: {type: "dropdown", items: [
124
+ {id: "sub", name: EVIL,
125
+ action: {type: "event", event: "EV_TEXT_SUB"}}
126
+ ]}}
127
+ ]
128
+ },
129
+ menu: {
130
+ primary: {items: [{id: "home", route: "/home",
131
+ target: {stage: "main", gclass: "C_TEST_TEXT_VIEW", kw: {}}}]}
132
+ }
133
+ };
134
+ const shell = gobj_create("text_shell", "C_YUI_SHELL", {config: config}, yuno);
135
+ gobj_start(shell);
136
+ const $c = gobj_read_attr(shell, "$container");
137
+
138
+ const $label = $c.querySelector('[data-toolbar-item-id="plain"] .yui-toolbar-item-label');
139
+ expect($label).not.toBe(null);
140
+ expect_text($label, EVIL);
141
+
142
+ const $menu = $c.querySelector('[data-toolbar-item-id="menu"]');
143
+ expect($menu).not.toBe(null);
144
+ $menu.click();
145
+ const $sub = document.querySelector(".yui-toolbar-dropdown-label");
146
+ expect($sub).not.toBe(null);
147
+ expect_text($sub, EVIL);
148
+ });
149
+
150
+ test("V4.2: a topic name in the treedb graph legend", async () => {
151
+ const {legend_name_item} = await import("./c_yui_treedb_graph.js");
152
+ for(const [is_main, hidden] of [[false, false], [true, false], [false, true]]) {
153
+ const $name = createElement2(legend_name_item(EVIL, is_main, hidden));
154
+ expect($name.textContent).toBe(EVIL);
155
+ expect($name.querySelector("img")).toBe(null);
156
+ }
157
+ });
158
+
159
+ test("V4.2: the G6 toolbar escapes what it puts in its markup", async () => {
160
+ const {toolbar_item_html} = await import("./c_g6_nodes_tree.js");
161
+ const items = [
162
+ {readout: true, text: EVIL, title: EVIL, className: EVIL},
163
+ {id: EVIL, value: EVIL, title: EVIL},
164
+ {text: EVIL, value: "v", title: "t"},
165
+ ];
166
+ for(const item of items) {
167
+ const html = toolbar_item_html(item);
168
+ expect(html.includes("<img")).toBe(false);
169
+ const $box = document.createElement("div");
170
+ $box.innerHTML = html;
171
+ expect($box.querySelector("img")).toBe(null);
172
+ }
173
+ });
174
+ });
@@ -60,4 +60,43 @@ describe("C_YUI_GCLASS header", () => {
60
60
  expect($c.querySelector(".GCLASS_CURRENT").textContent).toBe(EVIL);
61
61
  expect($c.querySelector("img")).toBe(null);
62
62
  });
63
+
64
+ test("the method chips are text (V3.1 #4)", () => {
65
+ const view = gobj_create("gclass_methods_text", "C_YUI_GCLASS", {
66
+ description: {id: "C_X", gcflag: [], attrs: [], commands: [],
67
+ gclass_methods: [EVIL], internal_methods: [EVIL],
68
+ FSM: {events: [], states: {}}},
69
+ }, yuno);
70
+ gobj_start(view);
71
+ const $c = gobj_read_attr(view, "$container");
72
+ const chips = $c.querySelectorAll(".GCLASS_METHOD");
73
+ expect(chips.length).toBe(2);
74
+ for(const chip of chips) {
75
+ expect(chip.textContent).toBe(EVIL);
76
+ }
77
+ expect($c.querySelector("img")).toBe(null);
78
+ });
79
+
80
+ test("the error of the raw dump is text (V3.1 #4)", () => {
81
+ const description = {
82
+ id: "C_X", gcflag: [], attrs: [], commands: [],
83
+ gclass_methods: [], internal_methods: [],
84
+ FSM: {events: [], states: {}},
85
+ toJSON() {
86
+ /* A bare string thrown is what reaches the screen as is:
87
+ * String() of an Error starts with "Error:", never "<". */
88
+ throw EVIL;
89
+ },
90
+ };
91
+ const view = gobj_create("gclass_raw_error_text", "C_YUI_GCLASS", {
92
+ description: description, view_mode: "raw",
93
+ }, yuno);
94
+ gobj_start(view);
95
+ const $c = gobj_read_attr(view, "$container");
96
+ const $err = $c.querySelector(".GCLASS_RAW_ERROR");
97
+ expect($err).not.toBe(null);
98
+ expect($err.textContent.includes(EVIL)).toBe(true);
99
+ expect($c.querySelector("img")).toBe(null);
100
+ });
63
101
  });
102
+
@@ -50,6 +50,48 @@ function url_hash(url)
50
50
  url.slice(url.indexOf("#")) : null;
51
51
  }
52
52
 
53
+ /* The model's own writes of the fragment: never a "link". */
54
+ function set_hash(h)
55
+ {
56
+ if(session.raw_hash_set) {
57
+ session.raw_hash_set(h);
58
+ } else {
59
+ window.location.hash = h;
60
+ }
61
+ }
62
+
63
+ /* As a browser does with `location.hash = x` -- what the push of
64
+ * yui_shell_navigate() does: a new entry, popstate, then the queued
65
+ * hashchange. Opt-in, and undone by links_on_hash_assign_off(): the
66
+ * other tests assign the hash to set their page up. */
67
+ function links_on_hash_assign()
68
+ {
69
+ let raw = window.location.hash;
70
+ session.raw_hash_set = (h) => {
71
+ raw = h;
72
+ };
73
+ Object.defineProperty(window.location, "hash", {
74
+ configurable: true,
75
+ get() {
76
+ return raw;
77
+ },
78
+ set(v) {
79
+ if(v === raw) {
80
+ return;
81
+ }
82
+ link_to(v);
83
+ }
84
+ });
85
+ }
86
+
87
+ function links_on_hash_assign_off()
88
+ {
89
+ const h = window.location.hash;
90
+ delete window.location.hash;
91
+ session.raw_hash_set = null;
92
+ window.location.hash = h;
93
+ }
94
+
53
95
  function install_history_model()
54
96
  {
55
97
  session.entries = [{state: null, hash: window.location.hash}];
@@ -64,7 +106,7 @@ function install_history_model()
64
106
  pushState(state, title, url) {
65
107
  const h = url_hash(url);
66
108
  if(h !== null) {
67
- window.location.hash = h;
109
+ set_hash(h);
68
110
  }
69
111
  session.entries.splice(session.index + 1);
70
112
  session.entries.push({state: state, hash: window.location.hash});
@@ -73,7 +115,7 @@ function install_history_model()
73
115
  replaceState(state, title, url) {
74
116
  const h = url_hash(url);
75
117
  if(h !== null) {
76
- window.location.hash = h;
118
+ set_hash(h);
77
119
  }
78
120
  session.entries[session.index] = {state: state, hash: window.location.hash};
79
121
  },
@@ -112,7 +154,7 @@ function traverse_to(index)
112
154
  {
113
155
  const left = window.location.hash;
114
156
  session.index = index;
115
- window.location.hash = session.entries[index].hash;
157
+ set_hash(session.entries[index].hash);
116
158
  fire_popstate();
117
159
  if(session.entries[index].hash !== left) {
118
160
  queue_hashchange();
@@ -126,7 +168,7 @@ function link_to(hash)
126
168
  session.entries.splice(session.index + 1);
127
169
  session.entries.push({state: null, hash: hash});
128
170
  session.index++;
129
- window.location.hash = hash;
171
+ set_hash(hash);
130
172
  fire_popstate();
131
173
  queue_hashchange();
132
174
  }
@@ -224,6 +266,9 @@ function routed_shell(name, app)
224
266
  /* A test leaves no shell listening and no queued hashchange behind: the
225
267
  * next test's shell would otherwise hear the previous test's traversal. */
226
268
  afterEach(async () => {
269
+ if(session.raw_hash_set) {
270
+ links_on_hash_assign_off(); // a test that failed half-way
271
+ }
227
272
  await next_task();
228
273
  await next_task();
229
274
  for(const sh of shells.splice(0)) {
@@ -484,8 +529,40 @@ describe("a routed shell, a realistic history (V5)", () => {
484
529
 
485
530
  user_back();
486
531
  await next_task();
532
+ await next_task();
487
533
  expect(closed).toBe(1);
488
534
  expect(shell.priv.overlay_stack).toEqual([]);
535
+ /* Back closed the panel; it did not move the view. */
536
+ expect(window.location.hash).toBe("#/home/pos");
537
+ expect(gobj_read_attr(shell, "current_route")).toBe("/home/pos");
538
+ });
539
+
540
+ test("a dialog's action that closes it and navigates in the same turn: the navigation survives", async () => {
541
+ const app = gobj_create("vapp_go", "C_TEST_MARKER_APP", {}, yuno);
542
+ gobj_start(app);
543
+ window.location.hash = "#/home";
544
+ install_history_model();
545
+ const shell = routed_shell("vshell_go", app);
546
+ const {yui_shell_register_overlay, yui_shell_overlay_dismissed, yui_shell_navigate} =
547
+ await import("./c_yui_shell.js");
548
+ const entry = yui_shell_register_overlay(shell, () => {});
549
+ await next_task();
550
+ links_on_hash_assign();
551
+
552
+ yui_shell_overlay_dismissed(shell, entry); // the close: a back() of ours
553
+ yui_shell_navigate(shell, "/prev"); // and the navigation, same turn
554
+ for(let i = 0; i < 4; i++) {
555
+ await next_task();
556
+ }
557
+ expect(shell.priv.expected_pops).toBe(0);
558
+ expect(window.location.hash).toBe("#/prev");
559
+ expect(gobj_read_attr(shell, "current_route")).toBe("/prev");
560
+ expect(window.history.state).toBe(null); // no marker left
561
+
562
+ user_back();
563
+ await next_task();
564
+ await next_task();
565
+ expect(window.location.hash).toBe("#/home"); // not swallowed
489
566
  });
490
567
 
491
568
  test("a button close after a replace navigation keeps the position", async () => {
@@ -98,12 +98,12 @@ describe("EV_SHOW", () => {
98
98
  expect($w.style.getPropertyValue("display")).toBe("");
99
99
  expect(errors().some((m) => m.includes("is not the src"))).toBe(true);
100
100
 
101
- /* The old form (the gobj in the kw) still works, with a warning. */
101
+ /* The old form (the gobj in the kw) is refused since 7.26.14,
102
+ * even from the window itself. */
102
103
  logged.length = 0;
103
104
  gobj_send_event(dock, "EV_MINIMIZE_WINDOW", {window: w}, w);
104
- expect($w.style.getPropertyValue("display")).toBe("none");
105
- expect(errors()).toEqual([]);
106
- expect(logged.some((l) => l.level === "warning" && l.msg.includes("gobj_full_name"))).toBe(true);
105
+ expect($w.style.getPropertyValue("display")).toBe("");
106
+ expect(errors().some((m) => m.includes("carries the window gobj"))).toBe(true);
107
107
  });
108
108
 
109
109
  test("with plain strings as TEXT (set_strings_are_text) the controls are still svg", () => {
@@ -148,7 +148,7 @@ describe("EV_SHOW", () => {
148
148
  /* The OLD form (the gobj in the kw), sent by another gobj. */
149
149
  logged.length = 0;
150
150
  gobj_send_event(dock, ev, {window: w}, other);
151
- expect(errors().some((m) => m.includes("is not the src"))).toBe(true);
151
+ expect(errors().some((m) => m.includes("carries the window gobj"))).toBe(true);
152
152
  }
153
153
  expect(dock.priv.windows.length).toBe(n_windows); // nothing unregistered
154
154
  expect(dock.priv.windows.some((e) => e.gobj === other)).toBe(false); // nothing registered