@yuneta/gobj-ui 7.26.8 → 7.26.9

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.
@@ -177,6 +177,7 @@ import {yui_theme_now, yui_watch_theme} from "./yui_theme.js";
177
177
  import {yui_shell_of} from "./c_yui_shell.js";
178
178
  import {yui_shell_show_error} from "./shell_modals.js";
179
179
  import {g6_event_kw} from "./g6_event_kw.js";
180
+ import {css_color_or_null} from "./yui_data_color.js";
180
181
 
181
182
  /***************************************************************
182
183
  * YuiToolbar — G6 Toolbar subclass that adds per-item className
@@ -2295,6 +2296,23 @@ function topic_defaults_of(gobj, topic_name)
2295
2296
  topic_props.defaults : null;
2296
2297
  }
2297
2298
 
2299
+ /************************************************************
2300
+ * A colour read from DATA (a `__graphs__` record), or null.
2301
+ * It is written into a card's html (see yui_data_color.js): a
2302
+ * refused value logs, and the node wears the topic's colour.
2303
+ ************************************************************/
2304
+ function data_color(gobj, value)
2305
+ {
2306
+ if(value === undefined || value === null || value === "") {
2307
+ return null;
2308
+ }
2309
+ let color = css_color_or_null(value);
2310
+ if(!color) {
2311
+ log_warning(`${gobj_short_name(gobj)}: colour refused, not a css colour: ${JSON.stringify(value)}`);
2312
+ }
2313
+ return color;
2314
+ }
2315
+
2298
2316
  /************************************************************
2299
2317
  * What a node is PAINTED with: its own colours, then the
2300
2318
  * topic's default, then the topic's colour.
@@ -2312,8 +2330,10 @@ function node_paint_of(gobj, desc, geometry)
2312
2330
  {
2313
2331
  let defaults = topic_defaults_of(gobj, desc.topic_name);
2314
2332
  let g = is_object(geometry)? geometry : {};
2315
- let fill = g.fill || (defaults && defaults.fill) || desc.color;
2316
- let stroke = g.stroke || (defaults && defaults.stroke) || getStrokeColor(fill);
2333
+ let fill = data_color(gobj, g.fill) ||
2334
+ data_color(gobj, defaults && defaults.fill) || desc.color;
2335
+ let stroke = data_color(gobj, g.stroke) ||
2336
+ data_color(gobj, defaults && defaults.stroke) || getStrokeColor(fill);
2317
2337
  let line_width = g.lineWidth || (defaults && defaults.lineWidth) || 1;
2318
2338
  return {fill: fill, stroke: stroke, lineWidth: line_width};
2319
2339
  }
@@ -5275,7 +5295,9 @@ function select_node(gobj, node_id)
5275
5295
  history_pause(gobj);
5276
5296
  try {
5277
5297
  graph.setElementState(node_id, ['selected']);
5278
- } catch(e) {}
5298
+ } catch(e) {
5299
+ log_warning(`${gobj_short_name(gobj)}: node state not set: ${e}`);
5300
+ }
5279
5301
  priv._selected_node_id = node_id;
5280
5302
  paint_selection(gobj, [node_id]);
5281
5303
 
@@ -5319,7 +5341,9 @@ function deselect_node(gobj)
5319
5341
  states[id] = [];
5320
5342
  }
5321
5343
  graph.setElementState(states);
5322
- } catch(e) {}
5344
+ } catch(e) {
5345
+ log_warning(`${gobj_short_name(gobj)}: node states not cleared: ${e}`);
5346
+ }
5323
5347
  priv._selected_node_id = null;
5324
5348
  paint_selection(gobj, []);
5325
5349
 
@@ -6834,7 +6858,9 @@ function select_edge(gobj, edge_id)
6834
6858
  history_pause(gobj);
6835
6859
  try {
6836
6860
  graph.setElementState(edge_id, ['selected']);
6837
- } catch(e) {}
6861
+ } catch(e) {
6862
+ log_warning(`${gobj_short_name(gobj)}: edge state not set: ${e}`);
6863
+ }
6838
6864
 
6839
6865
  show_edge_icon(gobj);
6840
6866
 
@@ -6856,7 +6882,9 @@ function deselect_edge(gobj)
6856
6882
  history_pause(gobj);
6857
6883
  try {
6858
6884
  graph.setElementState(priv._selected_edge_id, []);
6859
- } catch(e) {}
6885
+ } catch(e) {
6886
+ log_warning(`${gobj_short_name(gobj)}: edge state not cleared: ${e}`);
6887
+ }
6860
6888
  priv._selected_edge_id = null;
6861
6889
 
6862
6890
  graph_draw(gobj).then(() => {
@@ -6995,7 +7023,9 @@ function show_edge_popover(gobj)
6995
7023
  history_pause(gobj);
6996
7024
  try {
6997
7025
  graph.setElementState(edge_id, []);
6998
- } catch(e) {}
7026
+ } catch(e) {
7027
+ log_warning(`${gobj_short_name(gobj)}: edge state not cleared for the style preview: ${e}`);
7028
+ }
6999
7029
  graph_draw(gobj).then(() => {
7000
7030
  history_resume(gobj);
7001
7031
  });
package/src/c_yui_form.js CHANGED
@@ -91,7 +91,7 @@ import "./tabulator.css";
91
91
  import {is_time_field} from "./json_view_helpers.js";
92
92
  import {date_to_datetime_local, datetime_local_to_epoch} from "./form_time_value.js";
93
93
  import {parse_json_field, json_editor_value} from "./form_json_field.js";
94
- import {text_node} from "./yui_text.js";
94
+ import {text_node, text_title_formatter} from "./yui_text.js";
95
95
  import { TabulatorFull as Tabulator } from "tabulator-tables"; // Import Full Tabulator JS
96
96
  // import { Tabulator } from "tabulator-tables"; // Import light Tabulator JS
97
97
 
@@ -521,6 +521,9 @@ function destroy_ui(gobj)
521
521
  let $container = gobj_read_attr(gobj, "$container");
522
522
  if($container) {
523
523
  destroy_widgets(gobj, $container);
524
+ if(gobj.priv && gobj.priv.tables) {
525
+ gobj.priv.tables.clear();
526
+ }
524
527
  if($container.parentNode) {
525
528
  $container.parentNode.removeChild($container);
526
529
  }
@@ -568,6 +571,13 @@ function table_identity(gobj, $table)
568
571
  {
569
572
  if(!$table.yui_table_id) {
570
573
  let priv = gobj.priv;
574
+ /* The entries of tables the collector already took go first: a
575
+ * nested table rebuilt by its row formatter leaves one behind. */
576
+ for(let [id, ref] of priv.tables) {
577
+ if(!ref.deref()) {
578
+ priv.tables.delete(id);
579
+ }
580
+ }
571
581
  priv.table_seq += 1;
572
582
  $table.yui_table_id = `t${priv.table_seq}`;
573
583
  priv.tables.set($table.yui_table_id, new WeakRef($table));
@@ -616,11 +626,17 @@ function destroy_widgets(gobj, $container)
616
626
  log_warning(`${gobj_short_name(gobj)}: cannot destroy ${what}: ${e}`);
617
627
  }
618
628
  };
629
+ let forget = ($el) => {
630
+ if($el.yui_table_id && gobj.priv && gobj.priv.tables) {
631
+ gobj.priv.tables.delete($el.yui_table_id);
632
+ }
633
+ };
619
634
  $container.querySelectorAll('.yui-tabulator-table-nested').forEach(($el) => {
620
635
  if($el.tabulator) {
621
636
  destroy("nested table", $el.tabulator);
622
637
  $el.tabulator = null;
623
638
  }
639
+ forget($el);
624
640
  });
625
641
  $container.querySelectorAll('.yui-form-data-input').forEach(($el) => {
626
642
  if($el.tom_select) {
@@ -635,6 +651,7 @@ function destroy_widgets(gobj, $container)
635
651
  destroy("table", $el.tabulator);
636
652
  $el.tabulator = null;
637
653
  }
654
+ forget($el);
638
655
  });
639
656
  }
640
657
 
@@ -690,6 +707,18 @@ function name_form_control($field, conf)
690
707
  if($clear) {
691
708
  const CLEAR_KEY = "remove all selected options";
692
709
  $clear.setAttribute("role", "button");
710
+ /* A button a keyboard can reach and press: a key press clicks
711
+ * it, so it reaches Tom Select's own click handler. */
712
+ $clear.setAttribute("tabindex", "0");
713
+ if(!$clear.yui_keys_wired) {
714
+ $clear.yui_keys_wired = true;
715
+ $clear.addEventListener("keydown", function(evt) {
716
+ if(evt.key === "Enter" || evt.key === " ") {
717
+ evt.preventDefault();
718
+ $clear.click();
719
+ }
720
+ });
721
+ }
693
722
  $clear.setAttribute("title", t(CLEAR_KEY));
694
723
  $clear.setAttribute("data-i18n-title", CLEAR_KEY);
695
724
  $clear.setAttribute("aria-label", t(CLEAR_KEY));
@@ -2206,6 +2235,7 @@ function template2columns(gobj, columns, template, sub_elements)
2206
2235
  let column = {
2207
2236
  field: field_desc.name,
2208
2237
  title: t(field_desc.header || field_desc.name),
2238
+ titleFormatter: text_title_formatter,
2209
2239
  editable: get_editable_state,
2210
2240
  editor: false,
2211
2241
  headerWordWrap: true,
@@ -3568,11 +3598,14 @@ function ac_add_table_row(gobj, event, kw, src)
3568
3598
  if(gobj_is_destroying(gobj)) {
3569
3599
  return; // the form went in the meantime: nothing to redraw
3570
3600
  }
3571
- /* The table itself, or -- for a nested one -- the table of the
3572
- * row it lives in. Re-checked: it may be destroyed by now. */
3573
- let $outer = $table.closest('.yui-tabulator-table');
3574
- if($outer && $outer.tabulator) {
3575
- $outer.tabulator.redraw(); /* Delete double scrollbar */
3601
+ /* A row LOADED redraws the table that took it, nested or not; a
3602
+ * row ADDED by hand to a nested table redraws the table of the
3603
+ * row the nested one lives in, which is what grew (closest()
3604
+ * is the table itself for an outer one). Re-checked: it may be
3605
+ * destroyed by now. */
3606
+ let $target = loading? $table : $table.closest('.yui-tabulator-table');
3607
+ if($target && $target.tabulator) {
3608
+ $target.tabulator.redraw(); /* Delete double scrollbar */
3576
3609
  }
3577
3610
  }, 30);
3578
3611
 
@@ -1070,7 +1070,7 @@ function event_flag_chips(flags)
1070
1070
  } else {
1071
1071
  cls += ' is-public';
1072
1072
  }
1073
- return ['span', {class: cls}, flag.replace("EVF_", "")];
1073
+ return ['span', {class: cls}, text_node(flag.replace("EVF_", ""))];
1074
1074
  });
1075
1075
  }
1076
1076
 
@@ -1756,7 +1756,9 @@ function restore_view_anchored(gobj, anchor)
1756
1756
  if(typeof anchor.zoom === "number" && anchor.zoom > 0) {
1757
1757
  try {
1758
1758
  graph.zoomTo(anchor.zoom);
1759
- } catch(e) {}
1759
+ } catch(e) {
1760
+ log_warning(`${gobj_short_name(gobj)}: zoom not restored: ${e}`);
1761
+ }
1760
1762
  }
1761
1763
 
1762
1764
  /*
@@ -1768,7 +1770,9 @@ function restore_view_anchored(gobj, anchor)
1768
1770
  let dx = anchor.viewport_x - vp[0];
1769
1771
  let dy = anchor.viewport_y - vp[1];
1770
1772
  graph.translateBy([dx, dy]);
1771
- } catch(e) {}
1773
+ } catch(e) {
1774
+ log_warning(`${gobj_short_name(gobj)}: anchor node not put back at its screen spot: ${e}`);
1775
+ }
1772
1776
  }
1773
1777
 
1774
1778
  /************************************************************
package/src/c_yui_nav.js CHANGED
@@ -597,7 +597,7 @@ function render_submenu(gobj, items)
597
597
  return createElement2(
598
598
  ["aside", {class: "menu p-2"},
599
599
  [
600
- ["p", heading_attrs, heading_text],
600
+ ["p", heading_attrs, text_node(heading_text)],
601
601
  ["ul", {class: "menu-list"}, lis]
602
602
  ]
603
603
  ]
@@ -639,7 +639,7 @@ function render_accordion(gobj, items)
639
639
  head_attrs["aria-label"] = head_text;
640
640
  head_attrs["data-i18n-aria-label"] = head_text;
641
641
  }
642
- let $hdr = createElement2(["button", head_attrs, head_text]);
642
+ let $hdr = createElement2(["button", head_attrs, text_node(head_text)]);
643
643
  $container.appendChild($hdr);
644
644
 
645
645
  let $ul = createElement2(
@@ -1029,7 +1029,7 @@ function show_notice(gobj, key, detail, detail_is_key)
1029
1029
  attrs.i18n = `${detail}`;
1030
1030
  }
1031
1031
  $notice.appendChild(createElement2(
1032
- ["span", attrs, detail_is_key ? t(`${detail}`) : `${detail}`]
1032
+ ["span", attrs, text_node(detail_is_key ? t(`${detail}`) : `${detail}`)]
1033
1033
  ));
1034
1034
  }
1035
1035
  }
@@ -1273,7 +1273,7 @@ function open_card(gobj, logical, title, icon, tags, event, kw)
1273
1273
  return ["span", {class: `${logical}_TAG tag ${tag.style || ""}`.trimEnd()},
1274
1274
  tag.i18n
1275
1275
  ? [["span", {i18n: tag.i18n}, t(tag.i18n)],
1276
- ["span", {class: "ml-1"}, `${tag.text}`]]
1276
+ ["span", {class: "ml-1"}, text_node(tag.text)]]
1277
1277
  : `${tag.text}`];
1278
1278
  });
1279
1279
 
@@ -1282,7 +1282,7 @@ function open_card(gobj, logical, title, icon, tags, event, kw)
1282
1282
  ["p", {class: `${logical}_TITLE is-flex is-align-items-center`,
1283
1283
  style: "gap:.4rem;"}, [
1284
1284
  ["span", {class: "icon"}, [["i", {class: icon}]]],
1285
- ["span", {class: `${logical}_NAME has-text-weight-semibold`}, `${title}`]
1285
+ ["span", {class: `${logical}_NAME has-text-weight-semibold`}, text_node(title)]
1286
1286
  ]],
1287
1287
  ["div", {class: `${logical}_TAGS tags mt-2`, style: "gap:.25rem;"}, $tags]
1288
1288
  ]]
@@ -1385,7 +1385,7 @@ function render_topics(gobj, $body)
1385
1385
 
1386
1386
  $rows.push(["tr", {class: "SCHEMA_TOPIC_ROW", role: "button", tabindex: "0"}, [
1387
1387
  ["td", {class: "SCHEMA_TOPIC_NAME"}, [
1388
- ["span", {class: "has-text-weight-semibold"}, `${topic.name}`],
1388
+ ["span", {class: "has-text-weight-semibold"}, text_node(topic.name)],
1389
1389
  topic.system_topic
1390
1390
  ? ["span", {class: "SCHEMA_TOPIC_SYSTEM tag ml-2",
1391
1391
  i18n: "system"}, t("system")]
@@ -1399,14 +1399,14 @@ function render_topics(gobj, $body)
1399
1399
  : ["span", {}, ""],
1400
1400
  ambiguous
1401
1401
  ? ["div", {class: "SCHEMA_TOPIC_ID is-size-7 yui-text-quiet"},
1402
- [["code", {}, `${topic.id}`]]]
1402
+ [["code", {}, text_node(topic.id)]]]
1403
1403
  : ["span", {}, ""]
1404
1404
  ]],
1405
- ["td", {class: "SCHEMA_TOPIC_PKEY"}, [["code", {}, `${topic.pkey || "id"}`]]],
1406
- ["td", {class: "SCHEMA_TOPIC_COLS has-text-right"}, `${topic.cols.length}`],
1405
+ ["td", {class: "SCHEMA_TOPIC_PKEY"}, [["code", {}, text_node(topic.pkey || "id")]]],
1406
+ ["td", {class: "SCHEMA_TOPIC_COLS has-text-right"}, text_node(topic.cols.length)],
1407
1407
  ["td", {class: "SCHEMA_TOPIC_VERSION"}, [
1408
1408
  ["span", {class: `tag ${pending ? "is-warning" : "is-info"} is-light`},
1409
- `${topic.topic_version === undefined ? "?" : topic.topic_version}`]
1409
+ text_node(topic.topic_version === undefined ? "?" : topic.topic_version)]
1410
1410
  ]],
1411
1411
  ["td", {class: "SCHEMA_TOPIC_ACTIONS has-text-right"}, $actions]
1412
1412
  ], {
@@ -1616,7 +1616,7 @@ function column_row(gobj, topic, col, index, readonly, twice)
1616
1616
  * open_card(). It is why 'writable', 'image', 'wild' and every
1617
1617
  * other unstyled flag rendered as an empty pill. */
1618
1618
  return ["span", {class: `SCHEMA_COL_FLAG tag ${yui_tint(flag_style(flag))}`.trimEnd()},
1619
- `${flag}`];
1619
+ text_node(flag)];
1620
1620
  });
1621
1621
 
1622
1622
  /* An unset `blob` column comes back as `{}`, which is an object and
@@ -1646,22 +1646,22 @@ function column_row(gobj, topic, col, index, readonly, twice)
1646
1646
  readonly ? [] : [["span", {class: "icon yui-text-quiet"},
1647
1647
  [["i", {class: "yi-grip-vertical"}]]]]],
1648
1648
  ["td", {class: "SCHEMA_COL_NAME"}, [
1649
- ["code", {}, `${col.name}`],
1649
+ ["code", {}, text_node(col.name)],
1650
1650
  ambiguous
1651
1651
  ? ["span", {class: "SCHEMA_COL_ID is-size-7 yui-text-quiet ml-2"},
1652
- [["code", {}, `${col.id}`]]]
1652
+ [["code", {}, text_node(col.id)]]]
1653
1653
  : ["span", {}, ""],
1654
1654
  is_pkey
1655
1655
  ? ["span", {class: "SCHEMA_COL_PKEY tag is-info is-light ml-2",
1656
1656
  i18n: "pkey"}, t("pkey")]
1657
1657
  : ["span", {}, ""]
1658
1658
  ]],
1659
- ["td", {class: "SCHEMA_COL_HEADER"}, `${record.header || ""}`],
1660
- ["td", {class: "SCHEMA_COL_TYPE"}, [["code", {}, `${record.type || ""}`]]],
1659
+ ["td", {class: "SCHEMA_COL_HEADER"}, text_node(record.header || "")],
1660
+ ["td", {class: "SCHEMA_COL_TYPE"}, [["code", {}, text_node(record.type || "")]]],
1661
1661
  ["td", {class: "SCHEMA_COL_FLAGS"}, [
1662
1662
  ["div", {class: "tags", style: "gap:.2rem;"}, $flags]
1663
1663
  ]],
1664
- ["td", {class: "SCHEMA_COL_LINK"}, `${link}`],
1664
+ ["td", {class: "SCHEMA_COL_LINK"}, text_node(link)],
1665
1665
  ["td", {class: "SCHEMA_COL_ACTIONS has-text-right"}, $actions]
1666
1666
  ]]
1667
1667
  );
@@ -2116,7 +2116,7 @@ function flags_field(gobj, type, current)
2116
2116
  ["input", el_attrs({type: "checkbox", class: "SCHEMA_FLAG_BOX",
2117
2117
  "data-flag": flag.name,
2118
2118
  checked: flag.on ? "checked" : undefined})],
2119
- ["span", {class: "SCHEMA_FLAG_NAME ml-1"}, `${flag.name}`]
2119
+ ["span", {class: "SCHEMA_FLAG_NAME ml-1"}, text_node(flag.name)]
2120
2120
  ]];
2121
2121
  });
2122
2122
 
@@ -2389,9 +2389,9 @@ function open_report(gobj, findings, treedb_id)
2389
2389
  " is-light", i18n: finding.severity}, t(finding.severity)]
2390
2390
  ]],
2391
2391
  ["td", {class: "SCHEMA_REPORT_WHAT", i18n: finding.code}, t(finding.code)],
2392
- ["td", {class: "SCHEMA_REPORT_TOPIC"}, `${finding.topic || ""}`],
2393
- ["td", {class: "SCHEMA_REPORT_COL"}, `${finding.col || ""}`],
2394
- ["td", {class: "SCHEMA_REPORT_DETAIL"}, [["code", {}, `${finding.detail || ""}`]]]
2392
+ ["td", {class: "SCHEMA_REPORT_TOPIC"}, text_node(finding.topic || "")],
2393
+ ["td", {class: "SCHEMA_REPORT_COL"}, text_node(finding.col || "")],
2394
+ ["td", {class: "SCHEMA_REPORT_DETAIL"}, [["code", {}, text_node(finding.detail || "")]]]
2395
2395
  ]];
2396
2396
  });
2397
2397
 
@@ -2664,7 +2664,7 @@ function render_import_plan(gobj, plan)
2664
2664
  return ["li", {class: `SCHEMA_IMPORT_LINE SCHEMA_IMPORT_${write.op.toUpperCase()}`}, [
2665
2665
  ["span", {class: `tag is-light ${write.op === "delete" ? "is-danger" : "is-info"}`,
2666
2666
  i18n: write.op}, t(write.op)],
2667
- ["code", {class: "ml-2"}, `${what}`]
2667
+ ["code", {class: "ml-2"}, text_node(what)]
2668
2668
  ]];
2669
2669
  });
2670
2670
 
@@ -2672,9 +2672,9 @@ function render_import_plan(gobj, plan)
2672
2672
  ["div", {class: "SCHEMA_IMPORT_SUMMARY"}, [
2673
2673
  ["p", {class: "SCHEMA_IMPORT_COUNT is-size-7 yui-text-quiet mb-2"}, [
2674
2674
  ["span", {i18n: "writes"}, t("writes")],
2675
- ["span", {class: "ml-1"}, `${plan.writes.length}`],
2675
+ ["span", {class: "ml-1"}, text_node(plan.writes.length)],
2676
2676
  ["span", {class: "ml-3", i18n: "deletions"}, t("deletions")],
2677
- ["span", {class: "ml-1 has-text-weight-bold"}, `${deletes.length}`]
2677
+ ["span", {class: "ml-1 has-text-weight-bold"}, text_node(deletes.length)]
2678
2678
  ]],
2679
2679
  ["ul", {class: "SCHEMA_IMPORT_LINES is-size-7",
2680
2680
  style: "max-height:14rem; overflow:auto;"}, $lines]
@@ -2699,7 +2699,7 @@ function open_orphans(gobj)
2699
2699
  let row = (kind, entry) => {
2700
2700
  return ["tr", {class: "SCHEMA_ORPHAN_ROW"}, [
2701
2701
  ["td", {class: "SCHEMA_ORPHAN_KIND", i18n: kind}, t(kind)],
2702
- ["td", {class: "SCHEMA_ORPHAN_ID"}, [["code", {}, `${entry.id}`]]],
2702
+ ["td", {class: "SCHEMA_ORPHAN_ID"}, [["code", {}, text_node(entry.id)]]],
2703
2703
  ["td", {class: "SCHEMA_ORPHAN_ACTIONS has-text-right"},
2704
2704
  readonly ? [] : [row_icon(gobj, "SCHEMA_ORPHAN_DELETE", "yi-trash", "delete",
2705
2705
  "EV_DELETE_ORPHAN", {kind: kind, id: entry.id, model_gen: priv.model_gen})]]
@@ -155,6 +155,9 @@ let PRIVATE_DATA = {
155
155
  /* Count of history.back() calls WE issued to retire a dismissed
156
156
  * overlay; the popstate they trigger is expected and ignored. */
157
157
  expected_pops: 0,
158
+ /* Overlays registered while one of those history.back() calls is
159
+ * still in flight: their marker is pushed once it has landed. */
160
+ pending_markers: [],
158
161
  popstate_handler: null,
159
162
  /* Avatar item support — every toolbar item with type:"avatar"
160
163
  * registers its <span> here so refresh_avatars() can repaint
@@ -278,6 +281,9 @@ function mt_start(gobj)
278
281
  /* A history.back() we issued to retire a dismissed
279
282
  * overlay — the teardown already happened. */
280
283
  p.expected_pops--;
284
+ if(p.expected_pops === 0) {
285
+ push_pending_markers(gobj);
286
+ }
281
287
  return;
282
288
  }
283
289
  if(p.overlay_stack.length === 0) {
@@ -2603,16 +2609,60 @@ function push_overlay_history(gobj, close, opts)
2603
2609
  * dock-managed window registers no overlay at all. */
2604
2610
  keep_on_navigate: !!(opts && opts.keep_on_navigate) };
2605
2611
  priv.overlay_stack.push(entry);
2612
+
2613
+ /* A history.back() of ours still in flight (an overlay closed by a
2614
+ * button, and this one opened in the same turn: a window that takes
2615
+ * its entry back when its question is answered, a dialog that opens
2616
+ * another). back() is ASYNCHRONOUS and pushState is not, so a marker
2617
+ * pushed now lands BEFORE the traversal, which then runs from it:
2618
+ * the marker is left orphaned ahead of the old one, and the pop we
2619
+ * counted is the user's next Back. The marker waits for the landing. */
2620
+ if(priv.expected_pops > 0) {
2621
+ entry.marker_pending = true;
2622
+ priv.pending_markers.push(entry);
2623
+ return entry;
2624
+ }
2625
+ if(!push_overlay_marker(gobj, entry)) {
2626
+ return null; // Error already logged
2627
+ }
2628
+ return entry;
2629
+ }
2630
+
2631
+ function push_overlay_marker(gobj, entry)
2632
+ {
2633
+ let priv = gobj.priv;
2606
2634
  try {
2607
2635
  window.history.pushState({ __yui_overlay__: entry.id }, "");
2608
2636
  } catch(e) {
2609
2637
  /* pushState failed (rare): drop the entry so overlay_dismissed
2610
2638
  * won't later history.back() past a real route. */
2611
- priv.overlay_stack.pop();
2639
+ let idx = priv.overlay_stack.indexOf(entry);
2640
+ if(idx >= 0) {
2641
+ priv.overlay_stack.splice(idx, 1);
2642
+ }
2612
2643
  log_warning(`C_YUI_SHELL: overlay pushState failed: ${e}`);
2613
- return null;
2644
+ return false;
2645
+ }
2646
+ return true;
2647
+ }
2648
+
2649
+ /* The history.back() calls of ours have all landed: push the markers of
2650
+ * the overlays registered meanwhile, in their order. One closed in the
2651
+ * meantime (dismissed, drained, or no longer on the stack) has none. */
2652
+ function push_pending_markers(gobj)
2653
+ {
2654
+ let priv = gobj.priv;
2655
+ let pending = priv.pending_markers.splice(0);
2656
+ for(let entry of pending) {
2657
+ entry.marker_pending = false;
2658
+ if(entry.dismissed || priv.overlay_stack.indexOf(entry) < 0) {
2659
+ continue;
2660
+ }
2661
+ /* The traversal was same-hash, but a route may have moved
2662
+ * meanwhile: the marker lives on the hash it is pushed on. */
2663
+ entry.hash = window.location.hash;
2664
+ push_overlay_marker(gobj, entry); // Error already logged
2614
2665
  }
2615
- return entry;
2616
2666
  }
2617
2667
 
2618
2668
  function overlay_dismissed(gobj, entry)
@@ -2631,6 +2681,10 @@ function overlay_dismissed(gobj, entry)
2631
2681
  return;
2632
2682
  }
2633
2683
  priv.overlay_stack.splice(idx, 1);
2684
+ if(entry.marker_pending) {
2685
+ /* Its marker was never pushed: there is nothing to retire. */
2686
+ return;
2687
+ }
2634
2688
  /* Retire the synthetic browser entry ONLY when it is the CURRENT
2635
2689
  * one — its state marker is live — so history.back() steps off it
2636
2690
  * invisibly (same hash, no route change). In every other case the
@@ -1147,7 +1147,7 @@ function col_title_formatter(gobj, col)
1147
1147
  if(t(col.id, {defaultValue: NO_I18N}) !== NO_I18N) {
1148
1148
  attrs.i18n = col.id;
1149
1149
  }
1150
- return createElement2(['span', attrs, text]);
1150
+ return createElement2(['span', attrs, text_node(text)]);
1151
1151
  };
1152
1152
  }
1153
1153
 
@@ -2045,7 +2045,7 @@ function file_cell_formatter(cell, formatterParams, onRendered)
2045
2045
  }
2046
2046
  const children = [
2047
2047
  ['span', {class: 'FILE_CELL_ICON icon yi-eye'}],
2048
- ['span', {class: 'FILE_CELL_ID'}, yui_file_id_label(ids[0])]
2048
+ ['span', {class: 'FILE_CELL_ID'}, text_node(yui_file_id_label(ids[0]))]
2049
2049
  ];
2050
2050
  if(ids.length > 1) {
2051
2051
  children.push(['span', {class: 'FILE_CELL_MORE'}, `+${ids.length - 1}`]);
@@ -4814,7 +4814,7 @@ function build_delete_question(gobj, records)
4814
4814
  if(one && one[pkey] !== undefined && one[pkey] !== null) {
4815
4815
  lines.push(["p", {class: "DELETE_ASK_WHAT", style: ROW}, [
4816
4816
  ["span", {i18n: "delete"}, t("delete")],
4817
- ["strong", {}, String(one[pkey])]
4817
+ ["strong", {}, text_node(one[pkey])]
4818
4818
  ]]);
4819
4819
  } else {
4820
4820
  lines.push(["p", {class: "DELETE_ASK_WHAT", style: ROW}, [
@@ -5069,7 +5069,7 @@ function ac_open_columns(gobj, event, kw, src)
5069
5069
  $list.appendChild(createElement2(
5070
5070
  ['label', {class: 'checkbox is-block mb-1 TREEDB_COLUMN_ITEM'}, [
5071
5071
  $cb,
5072
- ['span', {class: 'ml-2'}, column.getDefinition().title || field]
5072
+ ['span', {class: 'ml-2'}, text_node(column.getDefinition().title || field)]
5073
5073
  ]]
5074
5074
  ));
5075
5075
  }
@@ -765,10 +765,10 @@ function topic_card_meta(desc)
765
765
  if(desc.topic_version !== undefined && desc.topic_version !== null && desc.topic_version !== "") {
766
766
  head.push(['span', {class: 'TREEDB_TOPIC_CARD_VERSION',
767
767
  title: t('version'), 'data-i18n-title': 'version'},
768
- `v${desc.topic_version}`]);
768
+ text_node(`v${desc.topic_version}`)]);
769
769
  }
770
770
  head.push(['span', {class: 'TREEDB_TOPIC_CARD_COLS'}, [
771
- ['span', {}, `${n_cols}`],
771
+ ['span', {}, text_node(n_cols)],
772
772
  ['span', {i18n: 'columns'}, 'columns']
773
773
  ]]);
774
774
  meta.push(['div', {class: 'TREEDB_TOPIC_CARD_META'}, head]);
@@ -780,7 +780,7 @@ function topic_card_meta(desc)
780
780
  let list = pkey2s.join(", ");
781
781
  meta.push(['div', {class: 'TREEDB_TOPIC_CARD_REL TREEDB_TOPIC_CARD_PKEY2S', title: list}, [
782
782
  ['span', {class: 'TREEDB_TOPIC_CARD_REL_LABEL', i18n: 'pkey2s'}, 'pkey2s'],
783
- ['span', {class: 'TREEDB_TOPIC_CARD_REL_LIST'}, list]
783
+ ['span', {class: 'TREEDB_TOPIC_CARD_REL_LIST'}, text_node(list)]
784
784
  ]]);
785
785
  }
786
786
 
@@ -789,7 +789,7 @@ function topic_card_meta(desc)
789
789
  return ['div', {class: `TREEDB_TOPIC_CARD_REL ${cls}`, title: list}, [
790
790
  ['span', {class: 'TREEDB_TOPIC_CARD_REL_ARROW', 'aria-hidden': 'true'}, arrow],
791
791
  ['span', {class: 'TREEDB_TOPIC_CARD_REL_LABEL', i18n: key}, key],
792
- ['span', {class: 'TREEDB_TOPIC_CARD_REL_LIST'}, list]
792
+ ['span', {class: 'TREEDB_TOPIC_CARD_REL_LIST'}, text_node(list)]
793
793
  ]];
794
794
  };
795
795
  if(parents.length) {
@@ -1163,7 +1163,7 @@ function build_topic_info_panel(gobj, $info, topic, desc)
1163
1163
  );
1164
1164
  };
1165
1165
  if(desc.topic_version !== undefined && desc.topic_version !== null && desc.topic_version !== "") {
1166
- push_meta("version", ["span", {class: "tag is-info"}, `${desc.topic_version}`]);
1166
+ push_meta("version", ["span", {class: "tag is-info"}, text_node(desc.topic_version)]);
1167
1167
  }
1168
1168
  let sf_names = system_flag_names(desc.system_flag);
1169
1169
  if(sf_names.length > 0) {
@@ -1200,9 +1200,9 @@ function build_topic_info_panel(gobj, $info, topic, desc)
1200
1200
  let is_key = roles.length > 0;
1201
1201
  $rows.push(
1202
1202
  ["tr", is_key ? {class: "TREEDB_TOPIC_INFO_KEY_COL"} : {}, [
1203
- ["td", {}, [["code", is_key ? {class: "has-text-weight-bold"} : {}, `${col.id}`]]],
1204
- ["td", {}, `${type}`],
1205
- ["td", is_key ? {class: "has-text-weight-semibold"} : {}, `${rel}`]
1203
+ ["td", {}, [["code", is_key ? {class: "has-text-weight-bold"} : {}, text_node(col.id)]]],
1204
+ ["td", {}, text_node(type)],
1205
+ ["td", is_key ? {class: "has-text-weight-semibold"} : {}, text_node(rel)]
1206
1206
  ]]
1207
1207
  );
1208
1208
  }
@@ -1212,7 +1212,7 @@ function build_topic_info_panel(gobj, $info, topic, desc)
1212
1212
  ["h3", {class: "TREEDB_TOPIC_INFO_TITLE title is-5"}, [
1213
1213
  ["span", {class: "icon-text"}, [
1214
1214
  ["span", {class: "icon"}, [["i", {class: "yi-circle-info"}]]],
1215
- ["span", {i18n: `${topic}`}, `${topic}`]
1215
+ ["span", {i18n: `${topic}`}, text_node(topic)]
1216
1216
  ]]
1217
1217
  ]],
1218
1218
  ["table", {class: "table is-narrow TREEDB_TOPIC_INFO_META mb-4"}, [
@@ -347,7 +347,7 @@ function build_default_header(gobj)
347
347
  if(!empty_string(title)) {
348
348
  items.push(
349
349
  ['span', {class: 'WINDOW_TITLE_KIND has-text-weight-semibold',
350
- i18n: title}, title]
350
+ i18n: title}, text_node(title)]
351
351
  );
352
352
  }
353
353
 
@@ -64,11 +64,11 @@ function plan_toolbar(wanted)
64
64
  }
65
65
  }
66
66
 
67
- /* Con un solo grupo, repartir con `space-between` deja el boton
68
- * pegado a un borde y el hueco entero al otro lado: un dialogo de
69
- * una accion se ve mejor centrado. Lo decide aqui y no el CSS de
70
- * quien llama, porque la clase que lo reparte es un helper de Bulma
71
- * y esos llevan `!important`: una regla de app no puede ganarles. */
67
+ /* With one group only, `space-between` puts the button against one
68
+ * edge and the whole gap on the other side: a dialog of one action
69
+ * looks better centred. It is decided here and not in the caller's
70
+ * CSS, because the class that spreads them is a Bulma helper, and
71
+ * those carry `!important`: an app rule cannot win over them. */
72
72
  const single_group = (left.length === 0) !== (right.length === 0);
73
73
 
74
74
  return {left, right, unknown, single_group};