@yuneta/gobj-ui 7.26.7 → 7.26.8

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.
Files changed (39) hide show
  1. package/dist/gobj-ui.cjs.js +372 -175
  2. package/dist/gobj-ui.es.js +372 -175
  3. package/package.json +1 -1
  4. package/src/c_g6_nodes_tree.js +28 -24
  5. package/src/c_yui_form.js +197 -63
  6. package/src/c_yui_gclass.js +22 -21
  7. package/src/c_yui_gobj_tree_js.js +7 -7
  8. package/src/c_yui_json.js +7 -6
  9. package/src/c_yui_json_graph.js +8 -7
  10. package/src/c_yui_json_pad.js +2 -1
  11. package/src/c_yui_map.js +25 -1
  12. package/src/c_yui_nav.js +7 -6
  13. package/src/c_yui_schema_editor.js +3 -2
  14. package/src/c_yui_shell.js +7 -0
  15. package/src/c_yui_treedb_topic_with_form.js +22 -17
  16. package/src/c_yui_treedb_topics.js +8 -7
  17. package/src/c_yui_window.js +72 -31
  18. package/src/c_yui_window_manager.js +3 -2
  19. package/src/form_json_field.js +10 -3
  20. package/src/form_json_field.test.js +6 -0
  21. package/src/form_json_field.wiring.test.js +1 -1
  22. package/src/form_table_rearm.wiring.test.js +158 -0
  23. package/src/g6_event_kw.js +36 -0
  24. package/src/nav_cards_helpers.js +2 -1
  25. package/src/nav_cards_helpers.test.js +7 -3
  26. package/src/schema_to_c.js +10 -0
  27. package/src/schema_to_c.test.js +8 -1
  28. package/src/shell_modals.js +5 -3
  29. package/src/shell_route_map.js +12 -13
  30. package/src/treedb_topics_transport.wiring.test.js +26 -0
  31. package/src/vite_plugin_yuneta_html.test.js +79 -0
  32. package/src/window_show.wiring.test.js +83 -0
  33. package/src/window_veto_back.wiring.test.js +35 -0
  34. package/src/yui_dev.js +13 -11
  35. package/src/yui_frontend_view.js +4 -4
  36. package/src/yui_gclass_view.js +3 -3
  37. package/src/yui_text.js +31 -0
  38. package/src/yui_text.test.js +39 -0
  39. package/vite-plugin-yuneta-html.js +9 -4
@@ -2387,6 +2387,7 @@ function drain_overlays(gobj) {
2387
2387
  let kept = [];
2388
2388
  while (entries.length > 0) {
2389
2389
  let entry = entries.pop();
2390
+ if (entry.dismissed) continue;
2390
2391
  if (entry.keep_on_navigate) {
2391
2392
  kept.unshift(entry);
2392
2393
  continue;
@@ -2427,6 +2428,7 @@ function push_overlay_history(gobj, close, opts) {
2427
2428
  function overlay_dismissed(gobj, entry) {
2428
2429
  let priv = gobj.priv;
2429
2430
  if (!priv || !priv.overlay_stack || !entry) return;
2431
+ entry.dismissed = true;
2430
2432
  let idx = priv.overlay_stack.indexOf(entry);
2431
2433
  if (idx < 0) return;
2432
2434
  priv.overlay_stack.splice(idx, 1);
@@ -3025,6 +3027,35 @@ function yui_shell_close_dropdown(shell_gobj) {
3025
3027
  close_toolbar_dropdown(shell_gobj);
3026
3028
  }
3027
3029
  //#endregion
3030
+ //#region src/yui_text.js
3031
+ /***********************************************************************
3032
+ * yui_text.js
3033
+ *
3034
+ * DATA as text for createElement2().
3035
+ *
3036
+ * createElement2() takes a string content that starts with '<' for
3037
+ * MARKUP and parses it (that is how a component passes an inline
3038
+ * icon). So a value that came from outside -- a backend answer, a
3039
+ * treedb node, a name somebody typed, a frame of the traffic -- must
3040
+ * never go in as a bare string: "<img src=x onerror=...>" would run.
3041
+ * It goes in as a Text node, which is always text.
3042
+ *
3043
+ * Trimmed like createElement2() trims a string, so the change of
3044
+ * form does not change what is shown. A Text node under an
3045
+ * `i18n`/`data-i18n` element is still re-translated by
3046
+ * refresh_language(), which sets textContent.
3047
+ *
3048
+ * Copyright (c) 2026, ArtGins.
3049
+ * All Rights Reserved.
3050
+ ***********************************************************************/
3051
+ /************************************************************
3052
+ * A Text node with `value` as its text ("" for null/undefined).
3053
+ ************************************************************/
3054
+ function text_node(value) {
3055
+ if (value === null || value === void 0) return document.createTextNode("");
3056
+ return document.createTextNode(String(value).trim());
3057
+ }
3058
+ //#endregion
3028
3059
  //#region src/shell_modals.js
3029
3060
  /***********************************************************************
3030
3061
  * shell_modals.js
@@ -3137,7 +3168,7 @@ function show_notification(shell, kind, message, opts) {
3137
3168
  ...p_attrs,
3138
3169
  class: "TOAST_MSG"
3139
3170
  },
3140
- message
3171
+ typeof message === "string" ? text_node(message) : message
3141
3172
  ]]
3142
3173
  ]);
3143
3174
  $layer.appendChild($note);
@@ -3239,7 +3270,7 @@ function yui_shell_show_modal(shell, content, opts) {
3239
3270
  (title_prefix ? [[
3240
3271
  "span",
3241
3272
  { class: "MODAL_TITLE_PREFIX" },
3242
- title_prefix
3273
+ text_node(title_prefix)
3243
3274
  ]] : []).concat(title ? [[
3244
3275
  "span",
3245
3276
  {
@@ -3397,7 +3428,7 @@ function build_dialog(shell, message, buttons, opts) {
3397
3428
  class: "CONFIRM_MSG yui-confirm-msg",
3398
3429
  i18n: message
3399
3430
  },
3400
- message
3431
+ text_node(message)
3401
3432
  ]] : [message];
3402
3433
  let $footer_children = buttons.map((b) => {
3403
3434
  let cls = "CONFIRM_BTN button px-5";
@@ -3640,9 +3671,9 @@ var attrs_table$21 = [
3640
3671
  SDATA(data_type_t.DTP_STRING, "title_prefix", 0, "", "Optional DATA half of the title (a topic/service/marker name), shown before `title` and never translated. Use it instead of composing `${name} · ${t(key)}` into `title`, which cannot re-translate"),
3641
3672
  SDATA(data_type_t.DTP_STRING, "title", 0, "", "Window title, an i18n KEY: painted in the title bar (unless `header` overrides it) and on the dock chip. Pass the key, not t(key), or it cannot re-translate"),
3642
3673
  SDATA(data_type_t.DTP_STRING, "icon", 0, "", "Window icon (by window type), leading the title bar and the dock chip: a yi-* class name or inline SVG"),
3643
- SDATA(data_type_t.DTP_POINTER, "focus", 0, null, "Brings focus to the element, can be a number or selector"),
3644
- SDATA(data_type_t.DTP_BOOLEAN, "modal", 0, false, "Enable modal mode"),
3645
- SDATA(data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "Close window on ESC if not modal"),
3674
+ SDATA(data_type_t.DTP_POINTER, "focus", 0, null, "NOT implemented yet: would bring focus to the element, a number or a selector"),
3675
+ SDATA(data_type_t.DTP_BOOLEAN, "modal", 0, false, "NOT implemented yet: would enable modal mode"),
3676
+ SDATA(data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "NOT implemented yet: would close the window on ESC (Escape does nothing today)"),
3646
3677
  SDATA(data_type_t.DTP_BOOLEAN, "back_dismissable", 0, true, "Browser Back closes this window (floating overlays only; ignored when it has a `manager`)"),
3647
3678
  SDATA(data_type_t.DTP_BOOLEAN, "keep_on_navigate", 0, false, "This window is a navigation PANEL: a route change does not close it"),
3648
3679
  SDATA(data_type_t.DTP_POINTER, "back_overlay", 0, null, "Internal: overlay-history entry (Back-button integration)"),
@@ -3801,7 +3832,7 @@ function build_default_header(gobj) {
3801
3832
  if (!empty_string(prefix)) items.push([
3802
3833
  "span",
3803
3834
  { class: "WINDOW_TITLE_PREFIX has-text-weight-semibold" },
3804
- document.createTextNode(String(prefix))
3835
+ text_node(prefix)
3805
3836
  ]);
3806
3837
  if (!empty_string(title)) items.push([
3807
3838
  "span",
@@ -4147,15 +4178,24 @@ function destroy_ui$13(gobj) {
4147
4178
  function register_back_overlay(gobj) {
4148
4179
  let shell = yui_shell_of(gobj);
4149
4180
  if (!shell) return;
4181
+ const rearm = function() {
4182
+ if (!gobj_is_destroying(gobj) && !gobj_read_attr(gobj, "back_overlay")) register_back_overlay(gobj);
4183
+ };
4150
4184
  let overlay = yui_shell_register_overlay(shell, function() {
4151
4185
  gobj_write_attr(gobj, "back_overlay", null);
4152
- close_window(gobj);
4153
- if (!gobj_is_destroying(gobj) && !gobj_read_attr(gobj, "back_overlay")) register_back_overlay(gobj);
4186
+ const closing = close_window(gobj);
4187
+ if (closing.state === "vetoed") rearm();
4188
+ else if (closing.state === "asking") closing.answer.then(rearm);
4154
4189
  }, { keep_on_navigate: gobj_read_bool_attr(gobj, "keep_on_navigate") });
4155
4190
  gobj_write_attr(gobj, "back_overlay", overlay);
4156
4191
  }
4157
4192
  /************************************************************
4158
- *
4193
+ * Ask to close the window. Answers what happened:
4194
+ * {state: "closed"} the window is destroyed
4195
+ * {state: "vetoed"} a subscriber kept it open
4196
+ * {state: "asking", answer} a subscriber asked a question
4197
+ * first; `answer` resolves to
4198
+ * it once it is over
4159
4199
  ************************************************************/
4160
4200
  function close_window(gobj) {
4161
4201
  let kw_close = { abort_close: false };
@@ -4166,19 +4206,26 @@ function close_window(gobj) {
4166
4206
  if (gobj_is_running(gobj)) gobj_stop(gobj);
4167
4207
  gobj_stop_children(gobj);
4168
4208
  gobj_destroy(gobj);
4169
- } else if (kw_close.warning) yui_shell_confirm_yesnocancel(yui_shell_of(gobj), kw_close.warning, {
4170
- t,
4171
- yes_label: "yes",
4172
- no_label: "no",
4173
- cancel_label: "cancel"
4174
- }).then(function(answer) {
4175
- if (answer !== "yes") return;
4176
- if (gobj_is_destroying(gobj)) return;
4177
- if (on_close) on_close();
4178
- if (gobj_is_running(gobj)) gobj_stop(gobj);
4179
- gobj_stop_children(gobj);
4180
- gobj_destroy(gobj);
4181
- });
4209
+ return { state: "closed" };
4210
+ }
4211
+ if (!kw_close.warning) return { state: "vetoed" };
4212
+ return {
4213
+ state: "asking",
4214
+ answer: yui_shell_confirm_yesnocancel(yui_shell_of(gobj), kw_close.warning, {
4215
+ t,
4216
+ yes_label: "yes",
4217
+ no_label: "no",
4218
+ cancel_label: "cancel"
4219
+ }).then(function(answer) {
4220
+ if (answer !== "yes") return answer;
4221
+ if (gobj_is_destroying(gobj)) return answer;
4222
+ if (on_close) on_close();
4223
+ if (gobj_is_running(gobj)) gobj_stop(gobj);
4224
+ gobj_stop_children(gobj);
4225
+ gobj_destroy(gobj);
4226
+ return answer;
4227
+ })
4228
+ };
4182
4229
  }
4183
4230
  /************************************************************
4184
4231
  *
@@ -4439,6 +4486,19 @@ function ac_refresh$11(gobj, event, kw, src) {
4439
4486
  *
4440
4487
  ************************************************************/
4441
4488
  function ac_show$15(gobj, event, kw, src) {
4489
+ let manager = gobj_read_pointer_attr(gobj, "manager");
4490
+ if (manager) {
4491
+ gobj_send_event(manager, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
4492
+ return 0;
4493
+ }
4494
+ let $container = gobj_read_attr(gobj, "$container");
4495
+ if (!$container) {
4496
+ log_error(`${gobj_short_name(gobj)}: EV_SHOW without a container`);
4497
+ return -1;
4498
+ }
4499
+ $container.style.removeProperty("display");
4500
+ let $parent = $container.parentNode;
4501
+ if ($parent && $parent.lastChild !== $container) $parent.appendChild($container);
4442
4502
  return 0;
4443
4503
  }
4444
4504
  /************************************************************
@@ -4860,7 +4920,7 @@ function ac_register_window(gobj, event, kw, src) {
4860
4920
  if (prefix) label_items.push([
4861
4921
  "span",
4862
4922
  { class: "yui-dock-label-prefix" },
4863
- document.createTextNode(String(prefix))
4923
+ text_node(prefix)
4864
4924
  ]);
4865
4925
  if (title_key) label_items.push([
4866
4926
  "span",
@@ -4873,7 +4933,7 @@ function ac_register_window(gobj, event, kw, src) {
4873
4933
  if (label_items.length === 0) label_items.push([
4874
4934
  "span",
4875
4935
  { class: "yui-dock-label-kind" },
4876
- document.createTextNode(String(title))
4936
+ text_node(title)
4877
4937
  ]);
4878
4938
  let entry = {
4879
4939
  gobj: win,
@@ -8150,13 +8210,18 @@ function parse_json_field(value, type) {
8150
8210
  };
8151
8211
  }
8152
8212
  /************************************************************
8153
- * What a jsoneditor content ({text} or {json}) holds: the
8154
- * text as typed, or the tree-mode json.
8213
+ * What a jsoneditor content ({text} or {json}) holds, as TEXT:
8214
+ * the text as typed, or the tree-mode json serialized -- which is
8215
+ * what get_form_values() reads out of the editor too. Handing the
8216
+ * tree-mode value back as is made parse_json_field() parse a
8217
+ * string ROOT a second time: "123" was checked as the number 123,
8218
+ * and "abc" as a text that is no json.
8155
8219
  ************************************************************/
8156
8220
  function json_editor_value(content) {
8157
8221
  if (!content) return;
8158
8222
  if (content.text !== void 0) return content.text;
8159
- return content.json;
8223
+ if (content.json === void 0) return;
8224
+ return JSON.stringify(content.json);
8160
8225
  }
8161
8226
  //#endregion
8162
8227
  //#region src/c_yui_form.js
@@ -8205,7 +8270,11 @@ var attrs_table$17 = [
8205
8270
  SDATA(data_type_t.DTP_BOOLEAN, "changes", 0, false, "Indicates if changes have been made"),
8206
8271
  SDATA_END()
8207
8272
  ];
8208
- var PRIVATE_DATA$17 = {};
8273
+ var PRIVATE_DATA$17 = {
8274
+ rearm_timer: null,
8275
+ tables: null,
8276
+ table_seq: 0
8277
+ };
8209
8278
  var __gclass__$17 = null;
8210
8279
  /***************************
8211
8280
  * Framework Methods
@@ -8219,6 +8288,7 @@ function mt_create$17(gobj) {
8219
8288
  gobj_subscribe_event(gobj, null, {}, subscriber);
8220
8289
  let name = clean_name(gobj_name(gobj));
8221
8290
  gobj_write_attr(gobj, "form_id", "form" + name);
8291
+ gobj.priv.tables = /* @__PURE__ */ new Map();
8222
8292
  build_ui$15(gobj);
8223
8293
  }
8224
8294
  /************************************************************
@@ -8272,26 +8342,30 @@ function set_changed_stated(gobj, changed) {
8272
8342
  enable($button_save, true, "MediumSeaGreen");
8273
8343
  enable($button_undo, true, "Magenta");
8274
8344
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8275
- if (isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8345
+ if ($table.tabulator && isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8276
8346
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
8277
- if (isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8347
+ if ($table_nested.tabulator && isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8278
8348
  });
8279
8349
  });
8280
8350
  } else {
8281
8351
  gobj_write_bool_attr(gobj, "changes", false);
8282
8352
  enable($button_save, false, OFF_COLOR);
8283
8353
  enable($button_undo, false, OFF_COLOR);
8284
- setTimeout(function() {
8285
- $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8286
- if (isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8287
- $table.tabulator.on("dataChanged", function(data) {
8354
+ if (gobj.priv.rearm_timer) clearTimeout(gobj.priv.rearm_timer);
8355
+ gobj.priv.rearm_timer = setTimeout(function() {
8356
+ gobj.priv.rearm_timer = null;
8357
+ if (gobj_is_destroying(gobj)) return;
8358
+ const rearm = (tabulator) => {
8359
+ if (!tabulator) return;
8360
+ if (isEventSet(tabulator, "dataChanged")) tabulator.off("dataChanged");
8361
+ tabulator.on("dataChanged", function(data) {
8288
8362
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
8289
8363
  });
8364
+ };
8365
+ $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8366
+ rearm($table.tabulator);
8290
8367
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
8291
- if (isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8292
- $table_nested.tabulator.on("dataChanged", function(data) {
8293
- gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
8294
- });
8368
+ rearm($table_nested.tabulator);
8295
8369
  });
8296
8370
  });
8297
8371
  }, 200);
@@ -8521,6 +8595,10 @@ function build_ui$15(gobj) {
8521
8595
  * Destroy UI
8522
8596
  ************************************************************/
8523
8597
  function destroy_ui$10(gobj) {
8598
+ if (gobj.priv && gobj.priv.rearm_timer) {
8599
+ clearTimeout(gobj.priv.rearm_timer);
8600
+ gobj.priv.rearm_timer = null;
8601
+ }
8524
8602
  let $container = gobj_read_attr(gobj, "$container");
8525
8603
  if ($container) {
8526
8604
  destroy_widgets(gobj, $container);
@@ -8537,11 +8615,51 @@ function destroy_ui$10(gobj) {
8537
8615
  function cell_icon(icon_class, key) {
8538
8616
  let $i = document.createElement("i");
8539
8617
  $i.className = icon_class;
8618
+ $i.setAttribute("role", "button");
8619
+ $i.setAttribute("tabindex", "0");
8540
8620
  $i.setAttribute("title", t(key));
8621
+ $i.setAttribute("data-i18n-title", key);
8541
8622
  $i.setAttribute("aria-label", t(key));
8623
+ $i.setAttribute("data-i18n-aria-label", key);
8624
+ $i.addEventListener("keydown", function(evt) {
8625
+ if (evt.key === "Enter" || evt.key === " ") {
8626
+ evt.preventDefault();
8627
+ $i.click();
8628
+ }
8629
+ });
8542
8630
  return $i;
8543
8631
  }
8544
8632
  /************************************************************
8633
+ * The identity of a table element, for the kw of
8634
+ * EV_ADD_TABLE_ROW: a kw is plain json, and an element (with its
8635
+ * `.tabulator`, circular) broke the `machine` trace that dumps it.
8636
+ * Given on first use and kept on the element; the registry holds
8637
+ * it weakly, so a nested table re-built by its row formatter is
8638
+ * not kept alive by it.
8639
+ ************************************************************/
8640
+ function table_identity(gobj, $table) {
8641
+ if (!$table.yui_table_id) {
8642
+ let priv = gobj.priv;
8643
+ priv.table_seq += 1;
8644
+ $table.yui_table_id = `t${priv.table_seq}`;
8645
+ priv.tables.set($table.yui_table_id, new WeakRef($table));
8646
+ }
8647
+ return $table.yui_table_id;
8648
+ }
8649
+ /************************************************************
8650
+ * The element of a table identity, or null when it is gone.
8651
+ ************************************************************/
8652
+ function find_table(gobj, table_id) {
8653
+ let priv = gobj.priv;
8654
+ let ref = priv.tables ? priv.tables.get(table_id) : null;
8655
+ let $table = ref ? ref.deref() : null;
8656
+ if (!$table) {
8657
+ if (priv.tables) priv.tables.delete(table_id);
8658
+ return null;
8659
+ }
8660
+ return $table;
8661
+ }
8662
+ /************************************************************
8545
8663
  * Destroy the third-party widgets the form built. Removing
8546
8664
  * their DOM is not enough: Tom Select keeps listeners on
8547
8665
  * `document` and `window`, the jsoneditor is a live Svelte app
@@ -8552,7 +8670,10 @@ function cell_icon(icon_class, key) {
8552
8670
  function destroy_widgets(gobj, $container) {
8553
8671
  let destroy = (what, widget) => {
8554
8672
  try {
8555
- widget.destroy();
8673
+ let r = widget.destroy();
8674
+ if (r && typeof r.then === "function") r.catch((e) => {
8675
+ log_warning(`${gobj_short_name(gobj)}: cannot destroy ${what}: ${e}`);
8676
+ });
8556
8677
  } catch (e) {
8557
8678
  log_warning(`${gobj_short_name(gobj)}: cannot destroy ${what}: ${e}`);
8558
8679
  }
@@ -8610,6 +8731,15 @@ function name_form_control($field, conf) {
8610
8731
  $ts.setAttribute("aria-label", t(key));
8611
8732
  $ts.setAttribute("data-i18n-aria-label", key);
8612
8733
  }
8734
+ let $clear = $field.querySelector(".ts-wrapper .clear-button");
8735
+ if ($clear) {
8736
+ const CLEAR_KEY = "remove all selected options";
8737
+ $clear.setAttribute("role", "button");
8738
+ $clear.setAttribute("title", t(CLEAR_KEY));
8739
+ $clear.setAttribute("data-i18n-title", CLEAR_KEY);
8740
+ $clear.setAttribute("aria-label", t(CLEAR_KEY));
8741
+ $clear.setAttribute("data-i18n-aria-label", CLEAR_KEY);
8742
+ }
8613
8743
  }
8614
8744
  function build_form(gobj) {
8615
8745
  let form_id = gobj_read_str_attr(gobj, "form_id");
@@ -8960,12 +9090,7 @@ function apply_form_mode(gobj, $form) {
8960
9090
  ******************************************************************/
8961
9091
  function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, name, label, label_i18n, placeholder, options, extras, readonly, required, hidden, default_value }) {
8962
9092
  let $element;
8963
- let kw_add_table_row = {
8964
- $row: null,
8965
- $table: null,
8966
- record: {},
8967
- loading: false
8968
- };
9093
+ let $add_table = null;
8969
9094
  switch (tag) {
8970
9095
  case "input":
8971
9096
  switch (inputType) {
@@ -8983,7 +9108,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8983
9108
  i18n: label_i18n || label,
8984
9109
  for: name
8985
9110
  },
8986
- label
9111
+ text_node(label)
8987
9112
  ]]
8988
9113
  ], [
8989
9114
  "div",
@@ -9016,7 +9141,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9016
9141
  i18n: label_i18n || label,
9017
9142
  for: name
9018
9143
  },
9019
- label
9144
+ text_node(label)
9020
9145
  ]]
9021
9146
  ], [
9022
9147
  "div",
@@ -9057,7 +9182,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9057
9182
  i18n: label_i18n || label,
9058
9183
  for: name
9059
9184
  },
9060
- label
9185
+ text_node(label)
9061
9186
  ]]
9062
9187
  ], [
9063
9188
  "div",
@@ -9088,7 +9213,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9088
9213
  i18n: label_i18n || label,
9089
9214
  for: name
9090
9215
  },
9091
- label
9216
+ text_node(label)
9092
9217
  ]]
9093
9218
  ], [
9094
9219
  "div",
@@ -9118,7 +9243,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9118
9243
  class: "label",
9119
9244
  i18n: label_i18n || label
9120
9245
  },
9121
- label
9246
+ text_node(label)
9122
9247
  ]]
9123
9248
  ], [
9124
9249
  "div",
@@ -9153,7 +9278,15 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9153
9278
  { click: function(evt) {
9154
9279
  evt.stopPropagation();
9155
9280
  evt.preventDefault();
9156
- gobj_send_event(gobj, "EV_ADD_TABLE_ROW", kw_add_table_row, gobj);
9281
+ if (!$add_table) {
9282
+ log_error(`${gobj_short_name(gobj)}: "add" of a field without a table`);
9283
+ return;
9284
+ }
9285
+ gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
9286
+ table_id: table_identity(gobj, $add_table),
9287
+ record: {},
9288
+ loading: false
9289
+ }, gobj);
9157
9290
  } }
9158
9291
  ]]
9159
9292
  ]]
@@ -9209,7 +9342,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9209
9342
  i18n: label_i18n || label,
9210
9343
  for: name
9211
9344
  },
9212
- label
9345
+ text_node(label)
9213
9346
  ]]
9214
9347
  ], [
9215
9348
  "div",
@@ -9295,7 +9428,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9295
9428
  value: option,
9296
9429
  i18n: option
9297
9430
  },
9298
- document.createTextNode(String(option))
9431
+ text_node(option)
9299
9432
  ]),
9300
9433
  { "change": function(evt) {
9301
9434
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
@@ -9324,14 +9457,14 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9324
9457
  opts.map((option) => is_icon ? [
9325
9458
  "option",
9326
9459
  { value: option },
9327
- option
9460
+ text_node(option)
9328
9461
  ] : [
9329
9462
  "option",
9330
9463
  {
9331
9464
  value: option,
9332
9465
  i18n: option
9333
9466
  },
9334
- option
9467
+ text_node(option)
9335
9468
  ])
9336
9469
  ];
9337
9470
  $extend = createElement2(extend);
@@ -9384,7 +9517,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9384
9517
  }], [
9385
9518
  "span",
9386
9519
  { i18n: label_key },
9387
- label_key
9520
+ text_node(label_key)
9388
9521
  ]]
9389
9522
  ]);
9390
9523
  $control.appendChild($extend);
@@ -9436,7 +9569,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9436
9569
  }]);
9437
9570
  $control.appendChild($extend);
9438
9571
  $extend.tabulator = create_tabulator$1(gobj, $extend, name, options);
9439
- kw_add_table_row["$table"] = $extend;
9572
+ $add_table = $extend;
9440
9573
  break;
9441
9574
  case "coordinates": {
9442
9575
  let attrs = {
@@ -9819,11 +9952,13 @@ function template2columns(gobj, columns, template, sub_elements) {
9819
9952
  hozAlign: "center",
9820
9953
  cellClick: function(evt, cell) {
9821
9954
  evt.stopPropagation();
9822
- let $row = cell.getRow().getElement();
9823
- let $extend = $row.querySelector(`[name="${field_desc.name}"]`);
9955
+ let $extend = cell.getRow().getElement().querySelector(`[name="${field_desc.name}"]`);
9956
+ if (!$extend) {
9957
+ log_error(`${gobj_short_name(gobj)}: nested table '${field_desc.name}' not found in its row`);
9958
+ return;
9959
+ }
9824
9960
  gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
9825
- $row,
9826
- $table: $extend,
9961
+ table_id: table_identity(gobj, $extend),
9827
9962
  record: {},
9828
9963
  loading: false
9829
9964
  }, gobj);
@@ -9956,12 +10091,22 @@ function template2columns(gobj, columns, template, sub_elements) {
9956
10091
  * out-of-range number is more precise than anything generic here.
9957
10092
  ************************************************************/
9958
10093
  function field_validation_message($input) {
9959
- if ($input.yui_json_error) return t($input.yui_json_error);
9960
- let v = $input.validity;
9961
- if (v && v.valueMissing) return t("this field is required");
10094
+ let key = field_validation_key($input);
10095
+ if (key) return t(key);
9962
10096
  return $input.validationMessage;
9963
10097
  }
9964
10098
  /************************************************************
10099
+ * The i18n key of the message, when the message is ours ("" when
10100
+ * it is the browser's): written as the help line's data-i18n, so
10101
+ * a language change re-translates the line on screen.
10102
+ ************************************************************/
10103
+ function field_validation_key($input) {
10104
+ if ($input.yui_json_error) return $input.yui_json_error;
10105
+ let v = $input.validity;
10106
+ if (v && v.valueMissing) return "this field is required";
10107
+ return "";
10108
+ }
10109
+ /************************************************************
9965
10110
  * Mark a field as wrong, or clear the mark. One place: the same
9966
10111
  * three lines lived in the `invalid` and `blur` handlers of every
9967
10112
  * field kind.
@@ -9973,12 +10118,16 @@ function mark_field_validity($input) {
9973
10118
  $input.classList.remove("is-danger");
9974
10119
  if ($h) {
9975
10120
  $h.textContent = "";
10121
+ $h.removeAttribute("data-i18n");
9976
10122
  $h.style.display = "none";
9977
10123
  }
9978
10124
  return true;
9979
10125
  }
9980
10126
  $input.classList.add("is-danger");
9981
10127
  if ($h) {
10128
+ let key = field_validation_key($input);
10129
+ if (key) $h.setAttribute("data-i18n", key);
10130
+ else $h.removeAttribute("data-i18n");
9982
10131
  $h.textContent = field_validation_message($input);
9983
10132
  $h.style.display = "block";
9984
10133
  }
@@ -10272,15 +10421,13 @@ function load_tabulator_data(gobj, $table, value) {
10272
10421
  }
10273
10422
  let tabulator = $table.tabulator;
10274
10423
  if (tabulator.initialized) for (let row of value) gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
10275
- $row: null,
10276
- $table,
10424
+ table_id: table_identity(gobj, $table),
10277
10425
  record: row,
10278
10426
  loading: true
10279
10427
  }, gobj);
10280
10428
  else tabulator.on("tableBuilt", function() {
10281
10429
  for (let row of value) gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
10282
- $row: null,
10283
- $table,
10430
+ table_id: table_identity(gobj, $table),
10284
10431
  record: row,
10285
10432
  loading: true
10286
10433
  }, gobj);
@@ -10380,11 +10527,16 @@ function treedb_value_2_form_value(gobj, field_desc, value) {
10380
10527
  /************************************************************
10381
10528
  * A json field's value, parsed. validate_form() refuses a field
10382
10529
  * that does not parse, so reaching the error here is a path that
10383
- * skipped it: logged, never quiet.
10530
+ * skipped it: logged, and the value is handed on AS IT IS. An
10531
+ * empty `{}` / `[]` in its place is a value nobody wrote, and
10532
+ * saved it wipes the column.
10384
10533
  ************************************************************/
10385
10534
  function parse_json_value(gobj, field_desc, value) {
10386
10535
  let r = parse_json_field(value, field_desc.type);
10387
- if (r.error) log_error(`${gobj_short_name(gobj)}: field '${field_desc.name}' (${field_desc.type}) holds no valid json, stored as empty`);
10536
+ if (r.error) {
10537
+ log_error(`${gobj_short_name(gobj)}: field '${field_desc.name}' (${field_desc.type}) holds no valid json, handed on as it is`);
10538
+ return value;
10539
+ }
10388
10540
  return r.value;
10389
10541
  }
10390
10542
  /************************************************************
@@ -10445,7 +10597,9 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10445
10597
  value = parseInt(value) || 0;
10446
10598
  break;
10447
10599
  case "object":
10448
- case "dict": break;
10600
+ case "dict":
10601
+ value = parse_json_value(gobj, field_desc, value);
10602
+ break;
10449
10603
  case "array":
10450
10604
  case "list":
10451
10605
  value = parse_json_value(gobj, field_desc, value);
@@ -10581,9 +10735,13 @@ function ac_set_file_preview(gobj, event, kw, src) {
10581
10735
  * or from load_tabulator_data() to load data from backend
10582
10736
  ************************************************************/
10583
10737
  function ac_add_table_row(gobj, event, kw, src) {
10584
- let $row = kw["$row"];
10585
- let $table = kw.$table;
10586
- let tabulator = $table.tabulator;
10738
+ let table_id = kw.table_id;
10739
+ let $table = find_table(gobj, table_id);
10740
+ let tabulator = $table ? $table.tabulator : null;
10741
+ if (!tabulator) {
10742
+ log_error(`${gobj_short_name(gobj)}: EV_ADD_TABLE_ROW to a table that is gone: '${table_id}'`);
10743
+ return -1;
10744
+ }
10587
10745
  let record = kw.record;
10588
10746
  let loading = kw.loading;
10589
10747
  tabulator.addRow(record).then(function(row) {
@@ -10601,10 +10759,9 @@ function ac_add_table_row(gobj, event, kw, src) {
10601
10759
  log_error(`${gobj_short_name(gobj)}: cannot add a table row: ${error}`);
10602
10760
  });
10603
10761
  setTimeout(function() {
10604
- if ($row) {
10605
- let $tabulator = $row.closest(".yui-tabulator-table");
10606
- if ($tabulator && $tabulator.tabulator) $tabulator.tabulator.redraw();
10607
- } else tabulator.redraw();
10762
+ if (gobj_is_destroying(gobj)) return;
10763
+ let $outer = $table.closest(".yui-tabulator-table");
10764
+ if ($outer && $outer.tabulator) $outer.tabulator.redraw();
10608
10765
  }, 30);
10609
10766
  return 0;
10610
10767
  }
@@ -11218,10 +11375,22 @@ function mt_start$16(gobj) {
11218
11375
  function mt_stop$16(gobj) {
11219
11376
  let shell = yui_shell_of(gobj);
11220
11377
  if (shell) gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
11378
+ retire_marker_windows(gobj);
11221
11379
  gobj_stop_children(gobj);
11222
11380
  return 0;
11223
11381
  }
11224
11382
  /***************************************************************
11383
+ * Destroy the windows the markers opened.
11384
+ ***************************************************************/
11385
+ function retire_marker_windows(gobj) {
11386
+ let windows = gobj_match_children(gobj, { __gclass_name__: "C_YUI_WINDOW" }) || [];
11387
+ for (let win of windows) {
11388
+ if (gobj_is_running(win)) gobj_stop(win);
11389
+ gobj_stop_children(win);
11390
+ gobj_destroy(win);
11391
+ }
11392
+ }
11393
+ /***************************************************************
11225
11394
  * Framework Method: Destroy
11226
11395
  ***************************************************************/
11227
11396
  function mt_destroy$16(gobj) {
@@ -13302,6 +13471,41 @@ function ensure_drag_canvas_patch() {
13302
13471
  __drag_canvas_patched__ = true;
13303
13472
  }
13304
13473
  //#endregion
13474
+ //#region src/g6_event_kw.js
13475
+ /***********************************************************************
13476
+ * g6_event_kw.js
13477
+ *
13478
+ * The kw an FSM event carries for a G6 pointer event: an identity
13479
+ * and three scalars, never the event. Shared by the three graphs
13480
+ * (C_G6_NODES_TREE, C_YUI_JSON_GRAPH, C_YUI_GOBJ_TREE_JS), which
13481
+ * each had a copy.
13482
+ *
13483
+ * Copyright (c) 2026, ArtGins.
13484
+ * All Rights Reserved.
13485
+ ***********************************************************************/
13486
+ /************************************************************
13487
+ * A G6 event, as PLAIN JSON.
13488
+ *
13489
+ * A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
13490
+ * G6 / @antv/g event is circular: serializing one THROWS, so the
13491
+ * first thing a kw carrying `evt` breaks is the trace the FSM
13492
+ * exists to feed. It also drags a live graph element into a
13493
+ * message that may be read after that element is gone.
13494
+ *
13495
+ * What the actions read of it is an id and three scalars. The
13496
+ * event itself never leaves the callback that received it.
13497
+ ************************************************************/
13498
+ function g6_event_kw(evt) {
13499
+ let target = evt && evt.target ? evt.target : null;
13500
+ let client = evt && evt.client ? evt.client : null;
13501
+ return {
13502
+ id: target && target.id ? String(target.id) : "",
13503
+ shift: !!(evt && evt.shiftKey),
13504
+ client_x: client && typeof client.x === "number" ? client.x : 0,
13505
+ client_y: client && typeof client.y === "number" ? client.y : 0
13506
+ };
13507
+ }
13508
+ //#endregion
13305
13509
  //#region src/c_yui_json_graph.js
13306
13510
  /***********************************************************************
13307
13511
  * c_yui_json_graph.js
@@ -13806,12 +14010,7 @@ function build_graph$4(gobj) {
13806
14010
  });
13807
14011
  if (priv.theme) graph.setTheme(priv.theme);
13808
14012
  graph.on(NodeEvent.CLICK, (evt) => {
13809
- let client = evt && evt.client ? evt.client : null;
13810
- gobj_send_event(gobj, "EV_NODE_CLICK", {
13811
- id: evt && evt.target && evt.target.id ? String(evt.target.id) : "",
13812
- client_x: client && typeof client.x === "number" ? client.x : 0,
13813
- client_y: client && typeof client.y === "number" ? client.y : 0
13814
- }, gobj);
14013
+ gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
13815
14014
  });
13816
14015
  graph.on("aftertransform", () => {
13817
14016
  yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), priv.graph);
@@ -14746,7 +14945,9 @@ function ac_node_click$4(gobj, event, kw, src) {
14746
14945
  let nodedata;
14747
14946
  try {
14748
14947
  nodedata = graph.getNodeData(node_id);
14749
- } catch (e) {}
14948
+ } catch (e) {
14949
+ log_warning(`${gobj_short_name(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
14950
+ }
14750
14951
  if (priv.anchor_state === "arming") {
14751
14952
  priv.anchor_id = node_id;
14752
14953
  priv.anchor_path = nodedata && nodedata.data ? nodedata.data.path : "";
@@ -15631,7 +15832,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15631
15832
  let key_spec = key === null || key === "" ? null : [
15632
15833
  "span",
15633
15834
  { class: "JSON_KEY" },
15634
- String(key)
15835
+ text_node(key)
15635
15836
  ];
15636
15837
  let stub_text = (info.is_array ? "[" : "{") + (size !== void 0 ? String(size) : "?") + (info.is_array ? "]" : "}");
15637
15838
  let children = [];
@@ -15646,7 +15847,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15646
15847
  children.push([
15647
15848
  "span",
15648
15849
  { class: "JSON_STUB" },
15649
- stub_text
15850
+ text_node(stub_text)
15650
15851
  ]);
15651
15852
  children.push([
15652
15853
  "span",
@@ -15710,7 +15911,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15710
15911
  body.push([
15711
15912
  "span",
15712
15913
  { class: "JSON_KEY" },
15713
- String(key)
15914
+ text_node(key)
15714
15915
  ]);
15715
15916
  body.push([
15716
15917
  "span",
@@ -15727,7 +15928,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15727
15928
  if (label) body.push([
15728
15929
  "span",
15729
15930
  { class: "JSON_SUMMARY_ID ml-2" },
15730
- label
15931
+ text_node(label)
15731
15932
  ]);
15732
15933
  return [
15733
15934
  "div",
@@ -15773,7 +15974,7 @@ function leaf_row(key, value, depth) {
15773
15974
  body.push([
15774
15975
  "span",
15775
15976
  { class: "JSON_KEY" },
15776
- String(key)
15977
+ text_node(key)
15777
15978
  ]);
15778
15979
  body.push([
15779
15980
  "span",
@@ -15784,7 +15985,7 @@ function leaf_row(key, value, depth) {
15784
15985
  body.push([
15785
15986
  "span",
15786
15987
  { class: "JSON_VALUE JSON_TYPE_" + type.toUpperCase() },
15787
- text
15988
+ text_node(text)
15788
15989
  ]);
15789
15990
  if (key !== null && is_time_field(String(key))) {
15790
15991
  let wall = format_epoch(value);
@@ -16832,7 +17033,7 @@ function render_diff(gobj) {
16832
17033
  [
16833
17034
  "td",
16834
17035
  { class: "JSON_PAD_DIFF_PATH" },
16835
- row.id
17036
+ text_node(row.id)
16836
17037
  ],
16837
17038
  value_cell("JSON_PAD_DIFF_FROM", row, "from"),
16838
17039
  value_cell("JSON_PAD_DIFF_TO", row, "to")
@@ -18639,7 +18840,7 @@ function render_raw(gobj) {
18639
18840
  let children = [[
18640
18841
  "pre",
18641
18842
  { class: "GCLASS_RAW_BODY" },
18642
- dump.text
18843
+ document.createTextNode(String(dump.text))
18643
18844
  ]];
18644
18845
  if (dump.capped) children.push([
18645
18846
  "div",
@@ -18756,7 +18957,7 @@ function build_head(gobj, model) {
18756
18957
  for (let flag of model.gcflag) items.push([
18757
18958
  "span",
18758
18959
  { class: "GCLASS_CHIP GCLASS_GCFLAG" },
18759
- flag
18960
+ text_node(flag)
18760
18961
  ]);
18761
18962
  let current = gobj_read_str_attr(gobj, "current_state");
18762
18963
  if (current) items.push([
@@ -18919,7 +19120,7 @@ function flag_chips(flags) {
18919
19120
  return [
18920
19121
  "span",
18921
19122
  { class: cls },
18922
- flag
19123
+ text_node(flag)
18923
19124
  ];
18924
19125
  });
18925
19126
  }
@@ -18936,12 +19137,12 @@ function build_attrs(attrs) {
18936
19137
  [
18937
19138
  "td",
18938
19139
  { class: "GCLASS_CELL_KEY" },
18939
- a.id
19140
+ text_node(a.id)
18940
19141
  ],
18941
19142
  [
18942
19143
  "td",
18943
19144
  { class: "GCLASS_CELL_TYPE" },
18944
- a.type
19145
+ text_node(a.type)
18945
19146
  ],
18946
19147
  [
18947
19148
  "td",
@@ -18951,12 +19152,12 @@ function build_attrs(attrs) {
18951
19152
  [
18952
19153
  "td",
18953
19154
  { class: "GCLASS_CELL_DEFAULT" },
18954
- document.createTextNode(String(a.default_value ?? ""))
19155
+ text_node(a.default_value)
18955
19156
  ],
18956
19157
  [
18957
19158
  "td",
18958
19159
  { class: "GCLASS_CELL_DESC" },
18959
- document.createTextNode(String(a.description ?? ""))
19160
+ text_node(a.description)
18960
19161
  ]
18961
19162
  ]
18962
19163
  ];
@@ -19024,7 +19225,7 @@ function build_commands(commands) {
19024
19225
  [[
19025
19226
  "td",
19026
19227
  { colspan: "2" },
19027
- c.label
19228
+ text_node(c.label)
19028
19229
  ]]
19029
19230
  ]);
19030
19231
  continue;
@@ -19032,12 +19233,12 @@ function build_commands(commands) {
19032
19233
  let name_items = [[
19033
19234
  "span",
19034
19235
  { class: "GCLASS_CMD_NAME" },
19035
- c.id
19236
+ text_node(c.id)
19036
19237
  ]];
19037
19238
  for (let alias of c.alias) name_items.push([
19038
19239
  "span",
19039
19240
  { class: "GCLASS_CHIP GCLASS_ALIAS" },
19040
- alias
19241
+ text_node(alias)
19041
19242
  ]);
19042
19243
  name_items = name_items.concat(flag_chips(c.flags));
19043
19244
  rows.push([
@@ -19050,7 +19251,7 @@ function build_commands(commands) {
19050
19251
  ], [
19051
19252
  "td",
19052
19253
  { class: "GCLASS_CELL_DESC" },
19053
- c.description
19254
+ text_node(c.description)
19054
19255
  ]]
19055
19256
  ]);
19056
19257
  for (let p of c.parameters) rows.push([
@@ -19068,18 +19269,18 @@ function build_commands(commands) {
19068
19269
  [
19069
19270
  "span",
19070
19271
  { class: "GCLASS_PARAM_NAME" },
19071
- p.id
19272
+ text_node(p.id)
19072
19273
  ],
19073
19274
  [
19074
19275
  "span",
19075
19276
  { class: "GCLASS_PARAM_TYPE" },
19076
- p.type
19277
+ text_node(p.type)
19077
19278
  ]
19078
19279
  ].concat(flag_chips(p.flags))
19079
19280
  ], [
19080
19281
  "td",
19081
19282
  { class: "GCLASS_CELL_DESC" },
19082
- p.description
19283
+ text_node(p.description)
19083
19284
  ]]
19084
19285
  ]);
19085
19286
  }
@@ -19155,11 +19356,11 @@ function build_traces(levels) {
19155
19356
  [[
19156
19357
  "td",
19157
19358
  { class: "GCLASS_CELL_KEY" },
19158
- l.id
19359
+ text_node(l.id)
19159
19360
  ], [
19160
19361
  "td",
19161
19362
  { class: "GCLASS_CELL_DESC" },
19162
- l.description
19363
+ text_node(l.description)
19163
19364
  ]]
19164
19365
  ];
19165
19366
  })
@@ -19196,7 +19397,7 @@ function build_machine(gobj, fsm) {
19196
19397
  let items = [[
19197
19398
  "span",
19198
19399
  { class: "GCLASS_MX_STATE_NAME" },
19199
- state.name
19400
+ text_node(state.name)
19200
19401
  ]];
19201
19402
  if (state.name === current) cls += " is-current";
19202
19403
  if (unreachable.has(state.name)) {
@@ -19226,7 +19427,7 @@ function build_machine(gobj, fsm) {
19226
19427
  [[
19227
19428
  "span",
19228
19429
  {},
19229
- row.event
19430
+ text_node(row.event)
19230
19431
  ]].concat(event_flag_chips(row.flags))
19231
19432
  ]];
19232
19433
  row.cells.forEach(function(cell, i) {
@@ -19248,7 +19449,7 @@ function build_machine(gobj, fsm) {
19248
19449
  if (cell.action) items.push([
19249
19450
  "span",
19250
19451
  { class: "GCLASS_MX_ACTION" },
19251
- cell.action
19452
+ text_node(cell.action)
19252
19453
  ]);
19253
19454
  else if (cell.has_action) items.push([
19254
19455
  "span",
@@ -19277,7 +19478,7 @@ function build_machine(gobj, fsm) {
19277
19478
  items.push([
19278
19479
  "span",
19279
19480
  { class: "GCLASS_MX_NEXT" },
19280
- cell.next_state
19481
+ text_node(cell.next_state)
19281
19482
  ]);
19282
19483
  }
19283
19484
  cells.push([
@@ -19329,7 +19530,7 @@ function build_machine(gobj, fsm) {
19329
19530
  [[
19330
19531
  "span",
19331
19532
  { class: "GCLASS_CHIP GCLASS_PUB_EVENT" },
19332
- p.event
19533
+ text_node(p.event)
19333
19534
  ]].concat(event_flag_chips(p.flags))
19334
19535
  ];
19335
19536
  })
@@ -21242,12 +21443,7 @@ function build_graph$2(gobj) {
21242
21443
  save_view_state(gobj);
21243
21444
  });
21244
21445
  graph.on(NodeEvent.CLICK, (evt) => {
21245
- let client = evt && evt.client ? evt.client : null;
21246
- gobj_send_event(gobj, "EV_NODE_CLICK", {
21247
- id: evt && evt.target && evt.target.id ? String(evt.target.id) : "",
21248
- client_x: client && typeof client.x === "number" ? client.x : 0,
21249
- client_y: client && typeof client.y === "number" ? client.y : 0
21250
- }, gobj);
21446
+ gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
21251
21447
  });
21252
21448
  graph.on(CanvasEvent.CLICK, (evt) => {
21253
21449
  hide_popover(gobj);
@@ -22264,7 +22460,9 @@ function ac_node_click$3(gobj, event, kw, src) {
22264
22460
  if (!node_data) try {
22265
22461
  let nd = graph.getNodeData(node_id);
22266
22462
  if (nd && nd.data) node_data = nd.data;
22267
- } catch (e) {}
22463
+ } catch (e) {
22464
+ log_warning(`${gobj_short_name(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
22465
+ }
22268
22466
  if (!node_data) return 0;
22269
22467
  if (priv.anchor_state === "arming") {
22270
22468
  priv.anchor_id = node_id;
@@ -22795,7 +22993,7 @@ function card_descriptor(it, show_label) {
22795
22993
  class: "yui-nav-label",
22796
22994
  i18n: label
22797
22995
  },
22798
- label
22996
+ text_node(label)
22799
22997
  ]);
22800
22998
  let a_attrs = {
22801
22999
  class: "yui-nav-item yui-nav-card",
@@ -23161,7 +23359,7 @@ function render_tabs(gobj, items) {
23161
23359
  if (show_label && !empty_string(it.name)) children.push([
23162
23360
  "span",
23163
23361
  { i18n: it.name },
23164
- it.name
23362
+ text_node(it.name)
23165
23363
  ]);
23166
23364
  if (it.closable) children.push([
23167
23365
  "span",
@@ -23261,7 +23459,7 @@ function render_breadcrumb(gobj, items) {
23261
23459
  class: "yui-nav-label",
23262
23460
  i18n: label
23263
23461
  },
23264
- label
23462
+ text_node(label)
23265
23463
  ]);
23266
23464
  }
23267
23465
  let a_attrs = {
@@ -23328,7 +23526,7 @@ function render_backbar(gobj) {
23328
23526
  ], [
23329
23527
  "span",
23330
23528
  label_attrs,
23331
- label
23529
+ text_node(label)
23332
23530
  ]]
23333
23531
  ]
23334
23532
  ]);
@@ -23453,7 +23651,7 @@ function item_li(gobj, it, opts) {
23453
23651
  [
23454
23652
  "span",
23455
23653
  span_attrs,
23456
- label
23654
+ text_node(label)
23457
23655
  ]
23458
23656
  ];
23459
23657
  }
@@ -23474,7 +23672,7 @@ function item_li(gobj, it, opts) {
23474
23672
  class: "yui-nav-label",
23475
23673
  i18n: label
23476
23674
  },
23477
- label
23675
+ text_node(label)
23478
23676
  ] : null;
23479
23677
  let a_class = "yui-nav-item";
23480
23678
  if (stacked || icon_pos === "top" || icon_pos === "bottom") a_class += " yui-nav-stacked";
@@ -23531,7 +23729,7 @@ function item_iconbar(gobj, it, opts) {
23531
23729
  class: "yui-nav-label is-size-7",
23532
23730
  i18n: label
23533
23731
  },
23534
- label
23732
+ text_node(label)
23535
23733
  ] : null;
23536
23734
  let children = [];
23537
23735
  if (icon_pos === "bottom") {
@@ -23746,12 +23944,12 @@ function render_node(node) {
23746
23944
  class: "ROUTEMAP_NAME",
23747
23945
  i18n: node.label
23748
23946
  },
23749
- node.label
23947
+ text_node(node.label)
23750
23948
  ]);
23751
23949
  if (node.route) row.push([
23752
23950
  "code",
23753
23951
  { class: "ROUTEMAP_ROUTE" },
23754
- node.route
23952
+ text_node(node.route)
23755
23953
  ]);
23756
23954
  if (node.gclass) row.push([
23757
23955
  "span",
@@ -23765,7 +23963,7 @@ function render_node(node) {
23765
23963
  if (node.event) row.push([
23766
23964
  "span",
23767
23965
  { class: "ROUTEMAP_EVENT" },
23768
- node.event
23966
+ text_node(node.event)
23769
23967
  ]);
23770
23968
  if (node.ref) row.push([
23771
23969
  "span",
@@ -24981,7 +25179,7 @@ function build_ui$6(gobj) {
24981
25179
  ], [
24982
25180
  "span",
24983
25181
  { class: "TREEDB_TOPICS_SOURCE_URL" },
24984
- source_url
25182
+ text_node(source_url)
24985
25183
  ]]
24986
25184
  ],
24987
25185
  ...graph_items,
@@ -25152,7 +25350,7 @@ function add_tab(gobj, gobj2, id, text, icon) {
25152
25350
  i18n: text,
25153
25351
  class: ""
25154
25352
  },
25155
- text
25353
+ text_node(text)
25156
25354
  ]));
25157
25355
  refresh_language($a, t);
25158
25356
  $a.addEventListener("click", function(ev) {
@@ -25349,7 +25547,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25349
25547
  class: "yui-nav-label",
25350
25548
  i18n: text
25351
25549
  },
25352
- text
25550
+ text_node(text)
25353
25551
  ]]
25354
25552
  ]);
25355
25553
  $card.addEventListener("click", function(ev) {
@@ -25378,7 +25576,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25378
25576
  class: "TREEDB_TOPIC_CARD_NAME",
25379
25577
  i18n: text
25380
25578
  },
25381
- text
25579
+ text_node(text)
25382
25580
  ],
25383
25581
  ...topic_card_meta(desc),
25384
25582
  [
@@ -25595,7 +25793,7 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25595
25793
  if (pkey) push_meta("pkey", [
25596
25794
  "code",
25597
25795
  {},
25598
- pkey
25796
+ text_node(pkey)
25599
25797
  ]);
25600
25798
  if (pkey2s.length > 0) push_meta("pkey2s", [
25601
25799
  "span",
@@ -25603,13 +25801,13 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25603
25801
  pkey2s.map((name) => [
25604
25802
  "span",
25605
25803
  { class: "tag is-warning" },
25606
- name
25804
+ text_node(name)
25607
25805
  ])
25608
25806
  ]);
25609
25807
  push_meta("tkey", tkey ? [
25610
25808
  "code",
25611
25809
  {},
25612
- tkey
25810
+ text_node(tkey)
25613
25811
  ] : [
25614
25812
  "span",
25615
25813
  {
@@ -29420,7 +29618,7 @@ function build_json_cell_preview(value) {
29420
29618
  [["span", { class: "JSON_CELL_ICON icon yi-eye" }], [
29421
29619
  "span",
29422
29620
  { class: "JSON_CELL_PREVIEW" },
29423
- text
29621
+ text_node(text)
29424
29622
  ]]
29425
29623
  ]);
29426
29624
  }
@@ -30033,7 +30231,7 @@ function open_cell_file_dialog(gobj, row_id, col_id) {
30033
30231
  [[
30034
30232
  "span",
30035
30233
  { class: "CELL_FILE_ID" },
30036
- id
30234
+ text_node(id)
30037
30235
  ]]
30038
30236
  ]]
30039
30237
  ]));
@@ -30092,7 +30290,7 @@ function fill_cell_file_slot(gobj, pend, answer, error) {
30092
30290
  if (meta) $caption.appendChild(createElement2([
30093
30291
  "span",
30094
30292
  { class: "CELL_FILE_META" },
30095
- meta
30293
+ text_node(meta)
30096
30294
  ]));
30097
30295
  let $open = yui_asset_open_link(answer);
30098
30296
  if ($open) $caption.appendChild($open);
@@ -30169,7 +30367,7 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook) {
30169
30367
  [[
30170
30368
  "span",
30171
30369
  { i18n: tg.topic_name },
30172
- tg.topic_name
30370
+ text_node(tg.topic_name)
30173
30371
  ]],
30174
30372
  { click: () => {
30175
30373
  gobj_send_event(gobj, "EV_CHOOSE_LINKED", {
@@ -30420,8 +30618,8 @@ function transform__form_value_2_treedb_value(gobj, col, value, operation) {
30420
30618
  case "coordinates":
30421
30619
  case "blob": {
30422
30620
  let r = parse_json_field(value, field_desc.type);
30423
- if (r.error) log_warning(`${gobj_short_name(gobj)}: column '${col.id}' (${field_desc.type}) holds no valid json, taken as empty`);
30424
- value = r.value;
30621
+ if (r.error) log_error(`${gobj_short_name(gobj)}: column '${col.id}' (${field_desc.type}) holds no valid json, handed on as it is`);
30622
+ else value = r.value;
30425
30623
  break;
30426
30624
  }
30427
30625
  case "enum":
@@ -60418,6 +60616,7 @@ var attrs_table$4 = [
60418
60616
  SDATA_END()
60419
60617
  ];
60420
60618
  var PRIVATE_DATA$4 = {
60619
+ _drag_unwire: null,
60421
60620
  anchor_id: "",
60422
60621
  anchor_state: "off",
60423
60622
  last_zoom: 1,
@@ -60577,6 +60776,10 @@ function mt_stop$4(gobj) {
60577
60776
  function mt_destroy$4(gobj) {
60578
60777
  let priv = gobj.priv;
60579
60778
  uninstall_fold_listener(gobj);
60779
+ if (priv._drag_unwire) {
60780
+ priv._drag_unwire();
60781
+ priv._drag_unwire = null;
60782
+ }
60580
60783
  if (priv._on_pointerdown_focus) {
60581
60784
  priv.$container.removeEventListener("pointerdown", priv._on_pointerdown_focus, true);
60582
60785
  priv._on_pointerdown_focus = null;
@@ -60732,28 +60935,6 @@ function build_graph$1(gobj) {
60732
60935
  });
60733
60936
  }
60734
60937
  /************************************************************
60735
- * A G6 event, as PLAIN JSON.
60736
- *
60737
- * A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
60738
- * G6 / @antv/g event is circular: serializing one THROWS, so the
60739
- * first thing a kw carrying `evt` breaks is the trace the FSM
60740
- * exists to feed. It also drags a live graph element into a
60741
- * message that may be read after that element is gone.
60742
- *
60743
- * What the actions read of it is an id and three scalars. The
60744
- * event itself never leaves the callback that received it.
60745
- ************************************************************/
60746
- function g6_event_kw(evt) {
60747
- let target = evt && evt.target ? evt.target : null;
60748
- let client = evt && evt.client ? evt.client : null;
60749
- return {
60750
- id: target && target.id ? String(target.id) : "",
60751
- shift: !!(evt && evt.shiftKey),
60752
- client_x: client && typeof client.x === "number" ? client.x : 0,
60753
- client_y: client && typeof client.y === "number" ? client.y : 0
60754
- };
60755
- }
60756
- /************************************************************
60757
60938
  * Configure G6 event handlers
60758
60939
  ************************************************************/
60759
60940
  function configure_events(gobj) {
@@ -63728,6 +63909,11 @@ function start_node_resize(gobj, e, mx, my) {
63728
63909
  document.addEventListener("pointermove", onPointerMove);
63729
63910
  document.addEventListener("pointerup", onPointerUp);
63730
63911
  document.addEventListener("pointercancel", onPointerCancel);
63912
+ gobj.priv._drag_unwire = function() {
63913
+ document.removeEventListener("pointermove", onPointerMove);
63914
+ document.removeEventListener("pointerup", onPointerUp);
63915
+ document.removeEventListener("pointercancel", onPointerCancel);
63916
+ };
63731
63917
  }
63732
63918
  /************************************************************
63733
63919
  * Port selection and individual port resizing
@@ -64343,6 +64529,11 @@ function start_link_drag(gobj, e) {
64343
64529
  document.addEventListener("pointermove", onPointerMove);
64344
64530
  document.addEventListener("pointerup", onPointerUp);
64345
64531
  document.addEventListener("pointercancel", onPointerCancel);
64532
+ gobj.priv._drag_unwire = function() {
64533
+ document.removeEventListener("pointermove", onPointerMove);
64534
+ document.removeEventListener("pointerup", onPointerUp);
64535
+ document.removeEventListener("pointercancel", onPointerCancel);
64536
+ };
64346
64537
  }
64347
64538
  /************************************************************
64348
64539
  * Find if a canvas point hits a valid hook port during
@@ -64561,6 +64752,11 @@ function start_port_resize(gobj, e) {
64561
64752
  document.addEventListener("pointermove", onPointerMove);
64562
64753
  document.addEventListener("pointerup", onPointerUp);
64563
64754
  document.addEventListener("pointercancel", onPointerCancel);
64755
+ gobj.priv._drag_unwire = function() {
64756
+ document.removeEventListener("pointermove", onPointerMove);
64757
+ document.removeEventListener("pointerup", onPointerUp);
64758
+ document.removeEventListener("pointercancel", onPointerCancel);
64759
+ };
64564
64760
  }
64565
64761
  /************************************************************
64566
64762
  * Edge selection: show a floating properties icon near
@@ -72735,6 +72931,7 @@ var JSON_SHORT_ESCAPES = {
72735
72931
  "\f": "f"
72736
72932
  };
72737
72933
  function json_control(ch) {
72934
+ if (ch === "\0") return "\\\\ufffd";
72738
72935
  let short = JSON_SHORT_ESCAPES[ch];
72739
72936
  if (short) return C_BACKSLASH + short;
72740
72937
  return "\\\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0");
@@ -74430,7 +74627,7 @@ function render_toolbar(gobj) {
74430
74627
  $trail.push([
74431
74628
  "span",
74432
74629
  { class: "SCHEMA_CRUMB_TREEDB" },
74433
- priv.treedb_id
74630
+ text_node(priv.treedb_id)
74434
74631
  ]);
74435
74632
  }
74436
74633
  if (priv.topic_name) {
@@ -74442,7 +74639,7 @@ function render_toolbar(gobj) {
74442
74639
  $trail.push([
74443
74640
  "span",
74444
74641
  { class: "SCHEMA_CRUMB_TOPIC" },
74445
- priv.topic_name
74642
+ text_node(priv.topic_name)
74446
74643
  ]);
74447
74644
  }
74448
74645
  if (priv.diagram) {
@@ -80288,7 +80485,7 @@ function traffic_scalar_row(key, value) {
80288
80485
  let val_children = [[
80289
80486
  "span",
80290
80487
  { class: "TRAFFIC_VAL " + cls },
80291
- text
80488
+ text_node(text)
80292
80489
  ]];
80293
80490
  if (key in TRAFFIC_TS_FIELDS && typeof value === "number") {
80294
80491
  let iso = traffic_iso(value);
@@ -80421,7 +80618,7 @@ function traffic_value_node(key, value) {
80421
80618
  ]] : object_preview_parts(value, count).map((t) => [
80422
80619
  "span",
80423
80620
  { class: "TRAFFIC_PREV " + t.cls },
80424
- t.text
80621
+ text_node(t.text)
80425
80622
  ]);
80426
80623
  return [
80427
80624
  "details",
@@ -80438,7 +80635,7 @@ function traffic_value_node(key, value) {
80438
80635
  [
80439
80636
  "span",
80440
80637
  { class: "TRAFFIC_NEST_KEY" },
80441
- key
80638
+ text_node(key)
80442
80639
  ],
80443
80640
  [
80444
80641
  "span",
@@ -80473,17 +80670,17 @@ function event_spans(e) {
80473
80670
  ], [
80474
80671
  "span",
80475
80672
  { class: "TRAFFIC_EVENT" },
80476
- e.event
80673
+ text_node(e.event)
80477
80674
  ]];
80478
80675
  if (e.command) spans.push([
80479
80676
  "span",
80480
80677
  { class: "TRAFFIC_CMD" },
80481
- e.command
80678
+ text_node(e.command)
80482
80679
  ]);
80483
80680
  if (e.title) spans.push([
80484
80681
  "span",
80485
80682
  { class: "TRAFFIC_SRC" },
80486
- e.title
80683
+ text_node(e.title)
80487
80684
  ]);
80488
80685
  return spans;
80489
80686
  }
@@ -80563,7 +80760,7 @@ function render_full(e) {
80563
80760
  ], [
80564
80761
  "pre",
80565
80762
  { class: "TRAFFIC_FULL" },
80566
- text
80763
+ document.createTextNode(String(text))
80567
80764
  ]];
80568
80765
  return createElement2([
80569
80766
  "div",