@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
@@ -2392,6 +2392,7 @@ function drain_overlays(gobj) {
2392
2392
  let kept = [];
2393
2393
  while (entries.length > 0) {
2394
2394
  let entry = entries.pop();
2395
+ if (entry.dismissed) continue;
2395
2396
  if (entry.keep_on_navigate) {
2396
2397
  kept.unshift(entry);
2397
2398
  continue;
@@ -2432,6 +2433,7 @@ function push_overlay_history(gobj, close, opts) {
2432
2433
  function overlay_dismissed(gobj, entry) {
2433
2434
  let priv = gobj.priv;
2434
2435
  if (!priv || !priv.overlay_stack || !entry) return;
2436
+ entry.dismissed = true;
2435
2437
  let idx = priv.overlay_stack.indexOf(entry);
2436
2438
  if (idx < 0) return;
2437
2439
  priv.overlay_stack.splice(idx, 1);
@@ -3030,6 +3032,35 @@ function yui_shell_close_dropdown(shell_gobj) {
3030
3032
  close_toolbar_dropdown(shell_gobj);
3031
3033
  }
3032
3034
  //#endregion
3035
+ //#region src/yui_text.js
3036
+ /***********************************************************************
3037
+ * yui_text.js
3038
+ *
3039
+ * DATA as text for createElement2().
3040
+ *
3041
+ * createElement2() takes a string content that starts with '<' for
3042
+ * MARKUP and parses it (that is how a component passes an inline
3043
+ * icon). So a value that came from outside -- a backend answer, a
3044
+ * treedb node, a name somebody typed, a frame of the traffic -- must
3045
+ * never go in as a bare string: "<img src=x onerror=...>" would run.
3046
+ * It goes in as a Text node, which is always text.
3047
+ *
3048
+ * Trimmed like createElement2() trims a string, so the change of
3049
+ * form does not change what is shown. A Text node under an
3050
+ * `i18n`/`data-i18n` element is still re-translated by
3051
+ * refresh_language(), which sets textContent.
3052
+ *
3053
+ * Copyright (c) 2026, ArtGins.
3054
+ * All Rights Reserved.
3055
+ ***********************************************************************/
3056
+ /************************************************************
3057
+ * A Text node with `value` as its text ("" for null/undefined).
3058
+ ************************************************************/
3059
+ function text_node(value) {
3060
+ if (value === null || value === void 0) return document.createTextNode("");
3061
+ return document.createTextNode(String(value).trim());
3062
+ }
3063
+ //#endregion
3033
3064
  //#region src/shell_modals.js
3034
3065
  /***********************************************************************
3035
3066
  * shell_modals.js
@@ -3142,7 +3173,7 @@ function show_notification(shell, kind, message, opts) {
3142
3173
  ...p_attrs,
3143
3174
  class: "TOAST_MSG"
3144
3175
  },
3145
- message
3176
+ typeof message === "string" ? text_node(message) : message
3146
3177
  ]]
3147
3178
  ]);
3148
3179
  $layer.appendChild($note);
@@ -3244,7 +3275,7 @@ function yui_shell_show_modal(shell, content, opts) {
3244
3275
  (title_prefix ? [[
3245
3276
  "span",
3246
3277
  { class: "MODAL_TITLE_PREFIX" },
3247
- title_prefix
3278
+ text_node(title_prefix)
3248
3279
  ]] : []).concat(title ? [[
3249
3280
  "span",
3250
3281
  {
@@ -3402,7 +3433,7 @@ function build_dialog(shell, message, buttons, opts) {
3402
3433
  class: "CONFIRM_MSG yui-confirm-msg",
3403
3434
  i18n: message
3404
3435
  },
3405
- message
3436
+ text_node(message)
3406
3437
  ]] : [message];
3407
3438
  let $footer_children = buttons.map((b) => {
3408
3439
  let cls = "CONFIRM_BTN button px-5";
@@ -3645,9 +3676,9 @@ var attrs_table$21 = [
3645
3676
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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"),
3646
3677
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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"),
3647
3678
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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"),
3648
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "focus", 0, null, "Brings focus to the element, can be a number or selector"),
3649
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "modal", 0, false, "Enable modal mode"),
3650
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "Close window on ESC if not modal"),
3679
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "focus", 0, null, "NOT implemented yet: would bring focus to the element, a number or a selector"),
3680
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "modal", 0, false, "NOT implemented yet: would enable modal mode"),
3681
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "NOT implemented yet: would close the window on ESC (Escape does nothing today)"),
3651
3682
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "back_dismissable", 0, true, "Browser Back closes this window (floating overlays only; ignored when it has a `manager`)"),
3652
3683
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keep_on_navigate", 0, false, "This window is a navigation PANEL: a route change does not close it"),
3653
3684
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "back_overlay", 0, null, "Internal: overlay-history entry (Back-button integration)"),
@@ -3806,7 +3837,7 @@ function build_default_header(gobj) {
3806
3837
  if (!(0, _yuneta_gobj_js.empty_string)(prefix)) items.push([
3807
3838
  "span",
3808
3839
  { class: "WINDOW_TITLE_PREFIX has-text-weight-semibold" },
3809
- document.createTextNode(String(prefix))
3840
+ text_node(prefix)
3810
3841
  ]);
3811
3842
  if (!(0, _yuneta_gobj_js.empty_string)(title)) items.push([
3812
3843
  "span",
@@ -4152,15 +4183,24 @@ function destroy_ui$13(gobj) {
4152
4183
  function register_back_overlay(gobj) {
4153
4184
  let shell = yui_shell_of(gobj);
4154
4185
  if (!shell) return;
4186
+ const rearm = function() {
4187
+ if (!(0, _yuneta_gobj_js.gobj_is_destroying)(gobj) && !(0, _yuneta_gobj_js.gobj_read_attr)(gobj, "back_overlay")) register_back_overlay(gobj);
4188
+ };
4155
4189
  let overlay = yui_shell_register_overlay(shell, function() {
4156
4190
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "back_overlay", null);
4157
- close_window(gobj);
4158
- if (!(0, _yuneta_gobj_js.gobj_is_destroying)(gobj) && !(0, _yuneta_gobj_js.gobj_read_attr)(gobj, "back_overlay")) register_back_overlay(gobj);
4191
+ const closing = close_window(gobj);
4192
+ if (closing.state === "vetoed") rearm();
4193
+ else if (closing.state === "asking") closing.answer.then(rearm);
4159
4194
  }, { keep_on_navigate: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "keep_on_navigate") });
4160
4195
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "back_overlay", overlay);
4161
4196
  }
4162
4197
  /************************************************************
4163
- *
4198
+ * Ask to close the window. Answers what happened:
4199
+ * {state: "closed"} the window is destroyed
4200
+ * {state: "vetoed"} a subscriber kept it open
4201
+ * {state: "asking", answer} a subscriber asked a question
4202
+ * first; `answer` resolves to
4203
+ * it once it is over
4164
4204
  ************************************************************/
4165
4205
  function close_window(gobj) {
4166
4206
  let kw_close = { abort_close: false };
@@ -4171,19 +4211,26 @@ function close_window(gobj) {
4171
4211
  if ((0, _yuneta_gobj_js.gobj_is_running)(gobj)) (0, _yuneta_gobj_js.gobj_stop)(gobj);
4172
4212
  (0, _yuneta_gobj_js.gobj_stop_children)(gobj);
4173
4213
  (0, _yuneta_gobj_js.gobj_destroy)(gobj);
4174
- } else if (kw_close.warning) yui_shell_confirm_yesnocancel(yui_shell_of(gobj), kw_close.warning, {
4175
- t: i18next.t,
4176
- yes_label: "yes",
4177
- no_label: "no",
4178
- cancel_label: "cancel"
4179
- }).then(function(answer) {
4180
- if (answer !== "yes") return;
4181
- if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
4182
- if (on_close) on_close();
4183
- if ((0, _yuneta_gobj_js.gobj_is_running)(gobj)) (0, _yuneta_gobj_js.gobj_stop)(gobj);
4184
- (0, _yuneta_gobj_js.gobj_stop_children)(gobj);
4185
- (0, _yuneta_gobj_js.gobj_destroy)(gobj);
4186
- });
4214
+ return { state: "closed" };
4215
+ }
4216
+ if (!kw_close.warning) return { state: "vetoed" };
4217
+ return {
4218
+ state: "asking",
4219
+ answer: yui_shell_confirm_yesnocancel(yui_shell_of(gobj), kw_close.warning, {
4220
+ t: i18next.t,
4221
+ yes_label: "yes",
4222
+ no_label: "no",
4223
+ cancel_label: "cancel"
4224
+ }).then(function(answer) {
4225
+ if (answer !== "yes") return answer;
4226
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return answer;
4227
+ if (on_close) on_close();
4228
+ if ((0, _yuneta_gobj_js.gobj_is_running)(gobj)) (0, _yuneta_gobj_js.gobj_stop)(gobj);
4229
+ (0, _yuneta_gobj_js.gobj_stop_children)(gobj);
4230
+ (0, _yuneta_gobj_js.gobj_destroy)(gobj);
4231
+ return answer;
4232
+ })
4233
+ };
4187
4234
  }
4188
4235
  /************************************************************
4189
4236
  *
@@ -4444,6 +4491,19 @@ function ac_refresh$11(gobj, event, kw, src) {
4444
4491
  *
4445
4492
  ************************************************************/
4446
4493
  function ac_show$15(gobj, event, kw, src) {
4494
+ let manager = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
4495
+ if (manager) {
4496
+ (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
4497
+ return 0;
4498
+ }
4499
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
4500
+ if (!$container) {
4501
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_SHOW without a container`);
4502
+ return -1;
4503
+ }
4504
+ $container.style.removeProperty("display");
4505
+ let $parent = $container.parentNode;
4506
+ if ($parent && $parent.lastChild !== $container) $parent.appendChild($container);
4447
4507
  return 0;
4448
4508
  }
4449
4509
  /************************************************************
@@ -4865,7 +4925,7 @@ function ac_register_window(gobj, event, kw, src) {
4865
4925
  if (prefix) label_items.push([
4866
4926
  "span",
4867
4927
  { class: "yui-dock-label-prefix" },
4868
- document.createTextNode(String(prefix))
4928
+ text_node(prefix)
4869
4929
  ]);
4870
4930
  if (title_key) label_items.push([
4871
4931
  "span",
@@ -4878,7 +4938,7 @@ function ac_register_window(gobj, event, kw, src) {
4878
4938
  if (label_items.length === 0) label_items.push([
4879
4939
  "span",
4880
4940
  { class: "yui-dock-label-kind" },
4881
- document.createTextNode(String(title))
4941
+ text_node(title)
4882
4942
  ]);
4883
4943
  let entry = {
4884
4944
  gobj: win,
@@ -8155,13 +8215,18 @@ function parse_json_field(value, type) {
8155
8215
  };
8156
8216
  }
8157
8217
  /************************************************************
8158
- * What a jsoneditor content ({text} or {json}) holds: the
8159
- * text as typed, or the tree-mode json.
8218
+ * What a jsoneditor content ({text} or {json}) holds, as TEXT:
8219
+ * the text as typed, or the tree-mode json serialized -- which is
8220
+ * what get_form_values() reads out of the editor too. Handing the
8221
+ * tree-mode value back as is made parse_json_field() parse a
8222
+ * string ROOT a second time: "123" was checked as the number 123,
8223
+ * and "abc" as a text that is no json.
8160
8224
  ************************************************************/
8161
8225
  function json_editor_value(content) {
8162
8226
  if (!content) return;
8163
8227
  if (content.text !== void 0) return content.text;
8164
- return content.json;
8228
+ if (content.json === void 0) return;
8229
+ return JSON.stringify(content.json);
8165
8230
  }
8166
8231
  //#endregion
8167
8232
  //#region src/c_yui_form.js
@@ -8210,7 +8275,11 @@ var attrs_table$17 = [
8210
8275
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "changes", 0, false, "Indicates if changes have been made"),
8211
8276
  (0, _yuneta_gobj_js.SDATA_END)()
8212
8277
  ];
8213
- var PRIVATE_DATA$17 = {};
8278
+ var PRIVATE_DATA$17 = {
8279
+ rearm_timer: null,
8280
+ tables: null,
8281
+ table_seq: 0
8282
+ };
8214
8283
  var __gclass__$17 = null;
8215
8284
  /***************************
8216
8285
  * Framework Methods
@@ -8224,6 +8293,7 @@ function mt_create$17(gobj) {
8224
8293
  (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
8225
8294
  let name = (0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj));
8226
8295
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "form_id", "form" + name);
8296
+ gobj.priv.tables = /* @__PURE__ */ new Map();
8227
8297
  build_ui$15(gobj);
8228
8298
  }
8229
8299
  /************************************************************
@@ -8277,26 +8347,30 @@ function set_changed_stated(gobj, changed) {
8277
8347
  enable($button_save, true, "MediumSeaGreen");
8278
8348
  enable($button_undo, true, "Magenta");
8279
8349
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8280
- if (isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8350
+ if ($table.tabulator && isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8281
8351
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
8282
- if (isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8352
+ if ($table_nested.tabulator && isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8283
8353
  });
8284
8354
  });
8285
8355
  } else {
8286
8356
  (0, _yuneta_gobj_js.gobj_write_bool_attr)(gobj, "changes", false);
8287
8357
  enable($button_save, false, OFF_COLOR);
8288
8358
  enable($button_undo, false, OFF_COLOR);
8289
- setTimeout(function() {
8290
- $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8291
- if (isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8292
- $table.tabulator.on("dataChanged", function(data) {
8359
+ if (gobj.priv.rearm_timer) clearTimeout(gobj.priv.rearm_timer);
8360
+ gobj.priv.rearm_timer = setTimeout(function() {
8361
+ gobj.priv.rearm_timer = null;
8362
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
8363
+ const rearm = (tabulator) => {
8364
+ if (!tabulator) return;
8365
+ if (isEventSet(tabulator, "dataChanged")) tabulator.off("dataChanged");
8366
+ tabulator.on("dataChanged", function(data) {
8293
8367
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
8294
8368
  });
8369
+ };
8370
+ $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8371
+ rearm($table.tabulator);
8295
8372
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
8296
- if (isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8297
- $table_nested.tabulator.on("dataChanged", function(data) {
8298
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
8299
- });
8373
+ rearm($table_nested.tabulator);
8300
8374
  });
8301
8375
  });
8302
8376
  }, 200);
@@ -8526,6 +8600,10 @@ function build_ui$15(gobj) {
8526
8600
  * Destroy UI
8527
8601
  ************************************************************/
8528
8602
  function destroy_ui$10(gobj) {
8603
+ if (gobj.priv && gobj.priv.rearm_timer) {
8604
+ clearTimeout(gobj.priv.rearm_timer);
8605
+ gobj.priv.rearm_timer = null;
8606
+ }
8529
8607
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
8530
8608
  if ($container) {
8531
8609
  destroy_widgets(gobj, $container);
@@ -8542,11 +8620,51 @@ function destroy_ui$10(gobj) {
8542
8620
  function cell_icon(icon_class, key) {
8543
8621
  let $i = document.createElement("i");
8544
8622
  $i.className = icon_class;
8623
+ $i.setAttribute("role", "button");
8624
+ $i.setAttribute("tabindex", "0");
8545
8625
  $i.setAttribute("title", (0, i18next.t)(key));
8626
+ $i.setAttribute("data-i18n-title", key);
8546
8627
  $i.setAttribute("aria-label", (0, i18next.t)(key));
8628
+ $i.setAttribute("data-i18n-aria-label", key);
8629
+ $i.addEventListener("keydown", function(evt) {
8630
+ if (evt.key === "Enter" || evt.key === " ") {
8631
+ evt.preventDefault();
8632
+ $i.click();
8633
+ }
8634
+ });
8547
8635
  return $i;
8548
8636
  }
8549
8637
  /************************************************************
8638
+ * The identity of a table element, for the kw of
8639
+ * EV_ADD_TABLE_ROW: a kw is plain json, and an element (with its
8640
+ * `.tabulator`, circular) broke the `machine` trace that dumps it.
8641
+ * Given on first use and kept on the element; the registry holds
8642
+ * it weakly, so a nested table re-built by its row formatter is
8643
+ * not kept alive by it.
8644
+ ************************************************************/
8645
+ function table_identity(gobj, $table) {
8646
+ if (!$table.yui_table_id) {
8647
+ let priv = gobj.priv;
8648
+ priv.table_seq += 1;
8649
+ $table.yui_table_id = `t${priv.table_seq}`;
8650
+ priv.tables.set($table.yui_table_id, new WeakRef($table));
8651
+ }
8652
+ return $table.yui_table_id;
8653
+ }
8654
+ /************************************************************
8655
+ * The element of a table identity, or null when it is gone.
8656
+ ************************************************************/
8657
+ function find_table(gobj, table_id) {
8658
+ let priv = gobj.priv;
8659
+ let ref = priv.tables ? priv.tables.get(table_id) : null;
8660
+ let $table = ref ? ref.deref() : null;
8661
+ if (!$table) {
8662
+ if (priv.tables) priv.tables.delete(table_id);
8663
+ return null;
8664
+ }
8665
+ return $table;
8666
+ }
8667
+ /************************************************************
8550
8668
  * Destroy the third-party widgets the form built. Removing
8551
8669
  * their DOM is not enough: Tom Select keeps listeners on
8552
8670
  * `document` and `window`, the jsoneditor is a live Svelte app
@@ -8557,7 +8675,10 @@ function cell_icon(icon_class, key) {
8557
8675
  function destroy_widgets(gobj, $container) {
8558
8676
  let destroy = (what, widget) => {
8559
8677
  try {
8560
- widget.destroy();
8678
+ let r = widget.destroy();
8679
+ if (r && typeof r.then === "function") r.catch((e) => {
8680
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
8681
+ });
8561
8682
  } catch (e) {
8562
8683
  (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
8563
8684
  }
@@ -8615,6 +8736,15 @@ function name_form_control($field, conf) {
8615
8736
  $ts.setAttribute("aria-label", (0, i18next.t)(key));
8616
8737
  $ts.setAttribute("data-i18n-aria-label", key);
8617
8738
  }
8739
+ let $clear = $field.querySelector(".ts-wrapper .clear-button");
8740
+ if ($clear) {
8741
+ const CLEAR_KEY = "remove all selected options";
8742
+ $clear.setAttribute("role", "button");
8743
+ $clear.setAttribute("title", (0, i18next.t)(CLEAR_KEY));
8744
+ $clear.setAttribute("data-i18n-title", CLEAR_KEY);
8745
+ $clear.setAttribute("aria-label", (0, i18next.t)(CLEAR_KEY));
8746
+ $clear.setAttribute("data-i18n-aria-label", CLEAR_KEY);
8747
+ }
8618
8748
  }
8619
8749
  function build_form(gobj) {
8620
8750
  let form_id = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "form_id");
@@ -8965,12 +9095,7 @@ function apply_form_mode(gobj, $form) {
8965
9095
  ******************************************************************/
8966
9096
  function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, name, label, label_i18n, placeholder, options, extras, readonly, required, hidden, default_value }) {
8967
9097
  let $element;
8968
- let kw_add_table_row = {
8969
- $row: null,
8970
- $table: null,
8971
- record: {},
8972
- loading: false
8973
- };
9098
+ let $add_table = null;
8974
9099
  switch (tag) {
8975
9100
  case "input":
8976
9101
  switch (inputType) {
@@ -8988,7 +9113,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8988
9113
  i18n: label_i18n || label,
8989
9114
  for: name
8990
9115
  },
8991
- label
9116
+ text_node(label)
8992
9117
  ]]
8993
9118
  ], [
8994
9119
  "div",
@@ -9021,7 +9146,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9021
9146
  i18n: label_i18n || label,
9022
9147
  for: name
9023
9148
  },
9024
- label
9149
+ text_node(label)
9025
9150
  ]]
9026
9151
  ], [
9027
9152
  "div",
@@ -9062,7 +9187,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9062
9187
  i18n: label_i18n || label,
9063
9188
  for: name
9064
9189
  },
9065
- label
9190
+ text_node(label)
9066
9191
  ]]
9067
9192
  ], [
9068
9193
  "div",
@@ -9093,7 +9218,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9093
9218
  i18n: label_i18n || label,
9094
9219
  for: name
9095
9220
  },
9096
- label
9221
+ text_node(label)
9097
9222
  ]]
9098
9223
  ], [
9099
9224
  "div",
@@ -9123,7 +9248,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9123
9248
  class: "label",
9124
9249
  i18n: label_i18n || label
9125
9250
  },
9126
- label
9251
+ text_node(label)
9127
9252
  ]]
9128
9253
  ], [
9129
9254
  "div",
@@ -9158,7 +9283,15 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9158
9283
  { click: function(evt) {
9159
9284
  evt.stopPropagation();
9160
9285
  evt.preventDefault();
9161
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", kw_add_table_row, gobj);
9286
+ if (!$add_table) {
9287
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: "add" of a field without a table`);
9288
+ return;
9289
+ }
9290
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
9291
+ table_id: table_identity(gobj, $add_table),
9292
+ record: {},
9293
+ loading: false
9294
+ }, gobj);
9162
9295
  } }
9163
9296
  ]]
9164
9297
  ]]
@@ -9214,7 +9347,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9214
9347
  i18n: label_i18n || label,
9215
9348
  for: name
9216
9349
  },
9217
- label
9350
+ text_node(label)
9218
9351
  ]]
9219
9352
  ], [
9220
9353
  "div",
@@ -9300,7 +9433,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9300
9433
  value: option,
9301
9434
  i18n: option
9302
9435
  },
9303
- document.createTextNode(String(option))
9436
+ text_node(option)
9304
9437
  ]),
9305
9438
  { "change": function(evt) {
9306
9439
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
@@ -9329,14 +9462,14 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9329
9462
  opts.map((option) => is_icon ? [
9330
9463
  "option",
9331
9464
  { value: option },
9332
- option
9465
+ text_node(option)
9333
9466
  ] : [
9334
9467
  "option",
9335
9468
  {
9336
9469
  value: option,
9337
9470
  i18n: option
9338
9471
  },
9339
- option
9472
+ text_node(option)
9340
9473
  ])
9341
9474
  ];
9342
9475
  $extend = (0, _yuneta_gobj_js.createElement2)(extend);
@@ -9389,7 +9522,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9389
9522
  }], [
9390
9523
  "span",
9391
9524
  { i18n: label_key },
9392
- label_key
9525
+ text_node(label_key)
9393
9526
  ]]
9394
9527
  ]);
9395
9528
  $control.appendChild($extend);
@@ -9441,7 +9574,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9441
9574
  }]);
9442
9575
  $control.appendChild($extend);
9443
9576
  $extend.tabulator = create_tabulator$1(gobj, $extend, name, options);
9444
- kw_add_table_row["$table"] = $extend;
9577
+ $add_table = $extend;
9445
9578
  break;
9446
9579
  case "coordinates": {
9447
9580
  let attrs = {
@@ -9824,11 +9957,13 @@ function template2columns(gobj, columns, template, sub_elements) {
9824
9957
  hozAlign: "center",
9825
9958
  cellClick: function(evt, cell) {
9826
9959
  evt.stopPropagation();
9827
- let $row = cell.getRow().getElement();
9828
- let $extend = $row.querySelector(`[name="${field_desc.name}"]`);
9960
+ let $extend = cell.getRow().getElement().querySelector(`[name="${field_desc.name}"]`);
9961
+ if (!$extend) {
9962
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: nested table '${field_desc.name}' not found in its row`);
9963
+ return;
9964
+ }
9829
9965
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
9830
- $row,
9831
- $table: $extend,
9966
+ table_id: table_identity(gobj, $extend),
9832
9967
  record: {},
9833
9968
  loading: false
9834
9969
  }, gobj);
@@ -9961,12 +10096,22 @@ function template2columns(gobj, columns, template, sub_elements) {
9961
10096
  * out-of-range number is more precise than anything generic here.
9962
10097
  ************************************************************/
9963
10098
  function field_validation_message($input) {
9964
- if ($input.yui_json_error) return (0, i18next.t)($input.yui_json_error);
9965
- let v = $input.validity;
9966
- if (v && v.valueMissing) return (0, i18next.t)("this field is required");
10099
+ let key = field_validation_key($input);
10100
+ if (key) return (0, i18next.t)(key);
9967
10101
  return $input.validationMessage;
9968
10102
  }
9969
10103
  /************************************************************
10104
+ * The i18n key of the message, when the message is ours ("" when
10105
+ * it is the browser's): written as the help line's data-i18n, so
10106
+ * a language change re-translates the line on screen.
10107
+ ************************************************************/
10108
+ function field_validation_key($input) {
10109
+ if ($input.yui_json_error) return $input.yui_json_error;
10110
+ let v = $input.validity;
10111
+ if (v && v.valueMissing) return "this field is required";
10112
+ return "";
10113
+ }
10114
+ /************************************************************
9970
10115
  * Mark a field as wrong, or clear the mark. One place: the same
9971
10116
  * three lines lived in the `invalid` and `blur` handlers of every
9972
10117
  * field kind.
@@ -9978,12 +10123,16 @@ function mark_field_validity($input) {
9978
10123
  $input.classList.remove("is-danger");
9979
10124
  if ($h) {
9980
10125
  $h.textContent = "";
10126
+ $h.removeAttribute("data-i18n");
9981
10127
  $h.style.display = "none";
9982
10128
  }
9983
10129
  return true;
9984
10130
  }
9985
10131
  $input.classList.add("is-danger");
9986
10132
  if ($h) {
10133
+ let key = field_validation_key($input);
10134
+ if (key) $h.setAttribute("data-i18n", key);
10135
+ else $h.removeAttribute("data-i18n");
9987
10136
  $h.textContent = field_validation_message($input);
9988
10137
  $h.style.display = "block";
9989
10138
  }
@@ -10277,15 +10426,13 @@ function load_tabulator_data(gobj, $table, value) {
10277
10426
  }
10278
10427
  let tabulator = $table.tabulator;
10279
10428
  if (tabulator.initialized) for (let row of value) (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
10280
- $row: null,
10281
- $table,
10429
+ table_id: table_identity(gobj, $table),
10282
10430
  record: row,
10283
10431
  loading: true
10284
10432
  }, gobj);
10285
10433
  else tabulator.on("tableBuilt", function() {
10286
10434
  for (let row of value) (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
10287
- $row: null,
10288
- $table,
10435
+ table_id: table_identity(gobj, $table),
10289
10436
  record: row,
10290
10437
  loading: true
10291
10438
  }, gobj);
@@ -10385,11 +10532,16 @@ function treedb_value_2_form_value(gobj, field_desc, value) {
10385
10532
  /************************************************************
10386
10533
  * A json field's value, parsed. validate_form() refuses a field
10387
10534
  * that does not parse, so reaching the error here is a path that
10388
- * skipped it: logged, never quiet.
10535
+ * skipped it: logged, and the value is handed on AS IT IS. An
10536
+ * empty `{}` / `[]` in its place is a value nobody wrote, and
10537
+ * saved it wipes the column.
10389
10538
  ************************************************************/
10390
10539
  function parse_json_value(gobj, field_desc, value) {
10391
10540
  let r = parse_json_field(value, field_desc.type);
10392
- if (r.error) (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: field '${field_desc.name}' (${field_desc.type}) holds no valid json, stored as empty`);
10541
+ if (r.error) {
10542
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: field '${field_desc.name}' (${field_desc.type}) holds no valid json, handed on as it is`);
10543
+ return value;
10544
+ }
10393
10545
  return r.value;
10394
10546
  }
10395
10547
  /************************************************************
@@ -10450,7 +10602,9 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10450
10602
  value = parseInt(value) || 0;
10451
10603
  break;
10452
10604
  case "object":
10453
- case "dict": break;
10605
+ case "dict":
10606
+ value = parse_json_value(gobj, field_desc, value);
10607
+ break;
10454
10608
  case "array":
10455
10609
  case "list":
10456
10610
  value = parse_json_value(gobj, field_desc, value);
@@ -10586,9 +10740,13 @@ function ac_set_file_preview(gobj, event, kw, src) {
10586
10740
  * or from load_tabulator_data() to load data from backend
10587
10741
  ************************************************************/
10588
10742
  function ac_add_table_row(gobj, event, kw, src) {
10589
- let $row = kw["$row"];
10590
- let $table = kw.$table;
10591
- let tabulator = $table.tabulator;
10743
+ let table_id = kw.table_id;
10744
+ let $table = find_table(gobj, table_id);
10745
+ let tabulator = $table ? $table.tabulator : null;
10746
+ if (!tabulator) {
10747
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_ADD_TABLE_ROW to a table that is gone: '${table_id}'`);
10748
+ return -1;
10749
+ }
10592
10750
  let record = kw.record;
10593
10751
  let loading = kw.loading;
10594
10752
  tabulator.addRow(record).then(function(row) {
@@ -10606,10 +10764,9 @@ function ac_add_table_row(gobj, event, kw, src) {
10606
10764
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot add a table row: ${error}`);
10607
10765
  });
10608
10766
  setTimeout(function() {
10609
- if ($row) {
10610
- let $tabulator = $row.closest(".yui-tabulator-table");
10611
- if ($tabulator && $tabulator.tabulator) $tabulator.tabulator.redraw();
10612
- } else tabulator.redraw();
10767
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
10768
+ let $outer = $table.closest(".yui-tabulator-table");
10769
+ if ($outer && $outer.tabulator) $outer.tabulator.redraw();
10613
10770
  }, 30);
10614
10771
  return 0;
10615
10772
  }
@@ -11223,10 +11380,22 @@ function mt_start$16(gobj) {
11223
11380
  function mt_stop$16(gobj) {
11224
11381
  let shell = yui_shell_of(gobj);
11225
11382
  if (shell) (0, _yuneta_gobj_js.gobj_unsubscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
11383
+ retire_marker_windows(gobj);
11226
11384
  (0, _yuneta_gobj_js.gobj_stop_children)(gobj);
11227
11385
  return 0;
11228
11386
  }
11229
11387
  /***************************************************************
11388
+ * Destroy the windows the markers opened.
11389
+ ***************************************************************/
11390
+ function retire_marker_windows(gobj) {
11391
+ let windows = (0, _yuneta_gobj_js.gobj_match_children)(gobj, { __gclass_name__: "C_YUI_WINDOW" }) || [];
11392
+ for (let win of windows) {
11393
+ if ((0, _yuneta_gobj_js.gobj_is_running)(win)) (0, _yuneta_gobj_js.gobj_stop)(win);
11394
+ (0, _yuneta_gobj_js.gobj_stop_children)(win);
11395
+ (0, _yuneta_gobj_js.gobj_destroy)(win);
11396
+ }
11397
+ }
11398
+ /***************************************************************
11230
11399
  * Framework Method: Destroy
11231
11400
  ***************************************************************/
11232
11401
  function mt_destroy$16(gobj) {
@@ -13307,6 +13476,41 @@ function ensure_drag_canvas_patch() {
13307
13476
  __drag_canvas_patched__ = true;
13308
13477
  }
13309
13478
  //#endregion
13479
+ //#region src/g6_event_kw.js
13480
+ /***********************************************************************
13481
+ * g6_event_kw.js
13482
+ *
13483
+ * The kw an FSM event carries for a G6 pointer event: an identity
13484
+ * and three scalars, never the event. Shared by the three graphs
13485
+ * (C_G6_NODES_TREE, C_YUI_JSON_GRAPH, C_YUI_GOBJ_TREE_JS), which
13486
+ * each had a copy.
13487
+ *
13488
+ * Copyright (c) 2026, ArtGins.
13489
+ * All Rights Reserved.
13490
+ ***********************************************************************/
13491
+ /************************************************************
13492
+ * A G6 event, as PLAIN JSON.
13493
+ *
13494
+ * A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
13495
+ * G6 / @antv/g event is circular: serializing one THROWS, so the
13496
+ * first thing a kw carrying `evt` breaks is the trace the FSM
13497
+ * exists to feed. It also drags a live graph element into a
13498
+ * message that may be read after that element is gone.
13499
+ *
13500
+ * What the actions read of it is an id and three scalars. The
13501
+ * event itself never leaves the callback that received it.
13502
+ ************************************************************/
13503
+ function g6_event_kw(evt) {
13504
+ let target = evt && evt.target ? evt.target : null;
13505
+ let client = evt && evt.client ? evt.client : null;
13506
+ return {
13507
+ id: target && target.id ? String(target.id) : "",
13508
+ shift: !!(evt && evt.shiftKey),
13509
+ client_x: client && typeof client.x === "number" ? client.x : 0,
13510
+ client_y: client && typeof client.y === "number" ? client.y : 0
13511
+ };
13512
+ }
13513
+ //#endregion
13310
13514
  //#region src/c_yui_json_graph.js
13311
13515
  /***********************************************************************
13312
13516
  * c_yui_json_graph.js
@@ -13811,12 +14015,7 @@ function build_graph$4(gobj) {
13811
14015
  });
13812
14016
  if (priv.theme) graph.setTheme(priv.theme);
13813
14017
  graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
13814
- let client = evt && evt.client ? evt.client : null;
13815
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", {
13816
- id: evt && evt.target && evt.target.id ? String(evt.target.id) : "",
13817
- client_x: client && typeof client.x === "number" ? client.x : 0,
13818
- client_y: client && typeof client.y === "number" ? client.y : 0
13819
- }, gobj);
14018
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
13820
14019
  });
13821
14020
  graph.on("aftertransform", () => {
13822
14021
  yui_graph_update_zoom((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container"), priv.graph);
@@ -14751,7 +14950,9 @@ function ac_node_click$4(gobj, event, kw, src) {
14751
14950
  let nodedata;
14752
14951
  try {
14753
14952
  nodedata = graph.getNodeData(node_id);
14754
- } catch (e) {}
14953
+ } catch (e) {
14954
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
14955
+ }
14755
14956
  if (priv.anchor_state === "arming") {
14756
14957
  priv.anchor_id = node_id;
14757
14958
  priv.anchor_path = nodedata && nodedata.data ? nodedata.data.path : "";
@@ -15636,7 +15837,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15636
15837
  let key_spec = key === null || key === "" ? null : [
15637
15838
  "span",
15638
15839
  { class: "JSON_KEY" },
15639
- String(key)
15840
+ text_node(key)
15640
15841
  ];
15641
15842
  let stub_text = (info.is_array ? "[" : "{") + (size !== void 0 ? String(size) : "?") + (info.is_array ? "]" : "}");
15642
15843
  let children = [];
@@ -15651,7 +15852,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15651
15852
  children.push([
15652
15853
  "span",
15653
15854
  { class: "JSON_STUB" },
15654
- stub_text
15855
+ text_node(stub_text)
15655
15856
  ]);
15656
15857
  children.push([
15657
15858
  "span",
@@ -15715,7 +15916,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15715
15916
  body.push([
15716
15917
  "span",
15717
15918
  { class: "JSON_KEY" },
15718
- String(key)
15919
+ text_node(key)
15719
15920
  ]);
15720
15921
  body.push([
15721
15922
  "span",
@@ -15732,7 +15933,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15732
15933
  if (label) body.push([
15733
15934
  "span",
15734
15935
  { class: "JSON_SUMMARY_ID ml-2" },
15735
- label
15936
+ text_node(label)
15736
15937
  ]);
15737
15938
  return [
15738
15939
  "div",
@@ -15778,7 +15979,7 @@ function leaf_row(key, value, depth) {
15778
15979
  body.push([
15779
15980
  "span",
15780
15981
  { class: "JSON_KEY" },
15781
- String(key)
15982
+ text_node(key)
15782
15983
  ]);
15783
15984
  body.push([
15784
15985
  "span",
@@ -15789,7 +15990,7 @@ function leaf_row(key, value, depth) {
15789
15990
  body.push([
15790
15991
  "span",
15791
15992
  { class: "JSON_VALUE JSON_TYPE_" + type.toUpperCase() },
15792
- text
15993
+ text_node(text)
15793
15994
  ]);
15794
15995
  if (key !== null && is_time_field(String(key))) {
15795
15996
  let wall = format_epoch(value);
@@ -16837,7 +17038,7 @@ function render_diff(gobj) {
16837
17038
  [
16838
17039
  "td",
16839
17040
  { class: "JSON_PAD_DIFF_PATH" },
16840
- row.id
17041
+ text_node(row.id)
16841
17042
  ],
16842
17043
  value_cell("JSON_PAD_DIFF_FROM", row, "from"),
16843
17044
  value_cell("JSON_PAD_DIFF_TO", row, "to")
@@ -18644,7 +18845,7 @@ function render_raw(gobj) {
18644
18845
  let children = [[
18645
18846
  "pre",
18646
18847
  { class: "GCLASS_RAW_BODY" },
18647
- dump.text
18848
+ document.createTextNode(String(dump.text))
18648
18849
  ]];
18649
18850
  if (dump.capped) children.push([
18650
18851
  "div",
@@ -18761,7 +18962,7 @@ function build_head(gobj, model) {
18761
18962
  for (let flag of model.gcflag) items.push([
18762
18963
  "span",
18763
18964
  { class: "GCLASS_CHIP GCLASS_GCFLAG" },
18764
- flag
18965
+ text_node(flag)
18765
18966
  ]);
18766
18967
  let current = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "current_state");
18767
18968
  if (current) items.push([
@@ -18924,7 +19125,7 @@ function flag_chips(flags) {
18924
19125
  return [
18925
19126
  "span",
18926
19127
  { class: cls },
18927
- flag
19128
+ text_node(flag)
18928
19129
  ];
18929
19130
  });
18930
19131
  }
@@ -18941,12 +19142,12 @@ function build_attrs(attrs) {
18941
19142
  [
18942
19143
  "td",
18943
19144
  { class: "GCLASS_CELL_KEY" },
18944
- a.id
19145
+ text_node(a.id)
18945
19146
  ],
18946
19147
  [
18947
19148
  "td",
18948
19149
  { class: "GCLASS_CELL_TYPE" },
18949
- a.type
19150
+ text_node(a.type)
18950
19151
  ],
18951
19152
  [
18952
19153
  "td",
@@ -18956,12 +19157,12 @@ function build_attrs(attrs) {
18956
19157
  [
18957
19158
  "td",
18958
19159
  { class: "GCLASS_CELL_DEFAULT" },
18959
- document.createTextNode(String(a.default_value ?? ""))
19160
+ text_node(a.default_value)
18960
19161
  ],
18961
19162
  [
18962
19163
  "td",
18963
19164
  { class: "GCLASS_CELL_DESC" },
18964
- document.createTextNode(String(a.description ?? ""))
19165
+ text_node(a.description)
18965
19166
  ]
18966
19167
  ]
18967
19168
  ];
@@ -19029,7 +19230,7 @@ function build_commands(commands) {
19029
19230
  [[
19030
19231
  "td",
19031
19232
  { colspan: "2" },
19032
- c.label
19233
+ text_node(c.label)
19033
19234
  ]]
19034
19235
  ]);
19035
19236
  continue;
@@ -19037,12 +19238,12 @@ function build_commands(commands) {
19037
19238
  let name_items = [[
19038
19239
  "span",
19039
19240
  { class: "GCLASS_CMD_NAME" },
19040
- c.id
19241
+ text_node(c.id)
19041
19242
  ]];
19042
19243
  for (let alias of c.alias) name_items.push([
19043
19244
  "span",
19044
19245
  { class: "GCLASS_CHIP GCLASS_ALIAS" },
19045
- alias
19246
+ text_node(alias)
19046
19247
  ]);
19047
19248
  name_items = name_items.concat(flag_chips(c.flags));
19048
19249
  rows.push([
@@ -19055,7 +19256,7 @@ function build_commands(commands) {
19055
19256
  ], [
19056
19257
  "td",
19057
19258
  { class: "GCLASS_CELL_DESC" },
19058
- c.description
19259
+ text_node(c.description)
19059
19260
  ]]
19060
19261
  ]);
19061
19262
  for (let p of c.parameters) rows.push([
@@ -19073,18 +19274,18 @@ function build_commands(commands) {
19073
19274
  [
19074
19275
  "span",
19075
19276
  { class: "GCLASS_PARAM_NAME" },
19076
- p.id
19277
+ text_node(p.id)
19077
19278
  ],
19078
19279
  [
19079
19280
  "span",
19080
19281
  { class: "GCLASS_PARAM_TYPE" },
19081
- p.type
19282
+ text_node(p.type)
19082
19283
  ]
19083
19284
  ].concat(flag_chips(p.flags))
19084
19285
  ], [
19085
19286
  "td",
19086
19287
  { class: "GCLASS_CELL_DESC" },
19087
- p.description
19288
+ text_node(p.description)
19088
19289
  ]]
19089
19290
  ]);
19090
19291
  }
@@ -19160,11 +19361,11 @@ function build_traces(levels) {
19160
19361
  [[
19161
19362
  "td",
19162
19363
  { class: "GCLASS_CELL_KEY" },
19163
- l.id
19364
+ text_node(l.id)
19164
19365
  ], [
19165
19366
  "td",
19166
19367
  { class: "GCLASS_CELL_DESC" },
19167
- l.description
19368
+ text_node(l.description)
19168
19369
  ]]
19169
19370
  ];
19170
19371
  })
@@ -19201,7 +19402,7 @@ function build_machine(gobj, fsm) {
19201
19402
  let items = [[
19202
19403
  "span",
19203
19404
  { class: "GCLASS_MX_STATE_NAME" },
19204
- state.name
19405
+ text_node(state.name)
19205
19406
  ]];
19206
19407
  if (state.name === current) cls += " is-current";
19207
19408
  if (unreachable.has(state.name)) {
@@ -19231,7 +19432,7 @@ function build_machine(gobj, fsm) {
19231
19432
  [[
19232
19433
  "span",
19233
19434
  {},
19234
- row.event
19435
+ text_node(row.event)
19235
19436
  ]].concat(event_flag_chips(row.flags))
19236
19437
  ]];
19237
19438
  row.cells.forEach(function(cell, i) {
@@ -19253,7 +19454,7 @@ function build_machine(gobj, fsm) {
19253
19454
  if (cell.action) items.push([
19254
19455
  "span",
19255
19456
  { class: "GCLASS_MX_ACTION" },
19256
- cell.action
19457
+ text_node(cell.action)
19257
19458
  ]);
19258
19459
  else if (cell.has_action) items.push([
19259
19460
  "span",
@@ -19282,7 +19483,7 @@ function build_machine(gobj, fsm) {
19282
19483
  items.push([
19283
19484
  "span",
19284
19485
  { class: "GCLASS_MX_NEXT" },
19285
- cell.next_state
19486
+ text_node(cell.next_state)
19286
19487
  ]);
19287
19488
  }
19288
19489
  cells.push([
@@ -19334,7 +19535,7 @@ function build_machine(gobj, fsm) {
19334
19535
  [[
19335
19536
  "span",
19336
19537
  { class: "GCLASS_CHIP GCLASS_PUB_EVENT" },
19337
- p.event
19538
+ text_node(p.event)
19338
19539
  ]].concat(event_flag_chips(p.flags))
19339
19540
  ];
19340
19541
  })
@@ -21247,12 +21448,7 @@ function build_graph$2(gobj) {
21247
21448
  save_view_state(gobj);
21248
21449
  });
21249
21450
  graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
21250
- let client = evt && evt.client ? evt.client : null;
21251
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", {
21252
- id: evt && evt.target && evt.target.id ? String(evt.target.id) : "",
21253
- client_x: client && typeof client.x === "number" ? client.x : 0,
21254
- client_y: client && typeof client.y === "number" ? client.y : 0
21255
- }, gobj);
21451
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
21256
21452
  });
21257
21453
  graph.on(_antv_g6.CanvasEvent.CLICK, (evt) => {
21258
21454
  hide_popover(gobj);
@@ -22269,7 +22465,9 @@ function ac_node_click$3(gobj, event, kw, src) {
22269
22465
  if (!node_data) try {
22270
22466
  let nd = graph.getNodeData(node_id);
22271
22467
  if (nd && nd.data) node_data = nd.data;
22272
- } catch (e) {}
22468
+ } catch (e) {
22469
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
22470
+ }
22273
22471
  if (!node_data) return 0;
22274
22472
  if (priv.anchor_state === "arming") {
22275
22473
  priv.anchor_id = node_id;
@@ -22800,7 +22998,7 @@ function card_descriptor(it, show_label) {
22800
22998
  class: "yui-nav-label",
22801
22999
  i18n: label
22802
23000
  },
22803
- label
23001
+ text_node(label)
22804
23002
  ]);
22805
23003
  let a_attrs = {
22806
23004
  class: "yui-nav-item yui-nav-card",
@@ -23166,7 +23364,7 @@ function render_tabs(gobj, items) {
23166
23364
  if (show_label && !(0, _yuneta_gobj_js.empty_string)(it.name)) children.push([
23167
23365
  "span",
23168
23366
  { i18n: it.name },
23169
- it.name
23367
+ text_node(it.name)
23170
23368
  ]);
23171
23369
  if (it.closable) children.push([
23172
23370
  "span",
@@ -23266,7 +23464,7 @@ function render_breadcrumb(gobj, items) {
23266
23464
  class: "yui-nav-label",
23267
23465
  i18n: label
23268
23466
  },
23269
- label
23467
+ text_node(label)
23270
23468
  ]);
23271
23469
  }
23272
23470
  let a_attrs = {
@@ -23333,7 +23531,7 @@ function render_backbar(gobj) {
23333
23531
  ], [
23334
23532
  "span",
23335
23533
  label_attrs,
23336
- label
23534
+ text_node(label)
23337
23535
  ]]
23338
23536
  ]
23339
23537
  ]);
@@ -23458,7 +23656,7 @@ function item_li(gobj, it, opts) {
23458
23656
  [
23459
23657
  "span",
23460
23658
  span_attrs,
23461
- label
23659
+ text_node(label)
23462
23660
  ]
23463
23661
  ];
23464
23662
  }
@@ -23479,7 +23677,7 @@ function item_li(gobj, it, opts) {
23479
23677
  class: "yui-nav-label",
23480
23678
  i18n: label
23481
23679
  },
23482
- label
23680
+ text_node(label)
23483
23681
  ] : null;
23484
23682
  let a_class = "yui-nav-item";
23485
23683
  if (stacked || icon_pos === "top" || icon_pos === "bottom") a_class += " yui-nav-stacked";
@@ -23536,7 +23734,7 @@ function item_iconbar(gobj, it, opts) {
23536
23734
  class: "yui-nav-label is-size-7",
23537
23735
  i18n: label
23538
23736
  },
23539
- label
23737
+ text_node(label)
23540
23738
  ] : null;
23541
23739
  let children = [];
23542
23740
  if (icon_pos === "bottom") {
@@ -23751,12 +23949,12 @@ function render_node(node) {
23751
23949
  class: "ROUTEMAP_NAME",
23752
23950
  i18n: node.label
23753
23951
  },
23754
- node.label
23952
+ text_node(node.label)
23755
23953
  ]);
23756
23954
  if (node.route) row.push([
23757
23955
  "code",
23758
23956
  { class: "ROUTEMAP_ROUTE" },
23759
- node.route
23957
+ text_node(node.route)
23760
23958
  ]);
23761
23959
  if (node.gclass) row.push([
23762
23960
  "span",
@@ -23770,7 +23968,7 @@ function render_node(node) {
23770
23968
  if (node.event) row.push([
23771
23969
  "span",
23772
23970
  { class: "ROUTEMAP_EVENT" },
23773
- node.event
23971
+ text_node(node.event)
23774
23972
  ]);
23775
23973
  if (node.ref) row.push([
23776
23974
  "span",
@@ -24986,7 +25184,7 @@ function build_ui$6(gobj) {
24986
25184
  ], [
24987
25185
  "span",
24988
25186
  { class: "TREEDB_TOPICS_SOURCE_URL" },
24989
- source_url
25187
+ text_node(source_url)
24990
25188
  ]]
24991
25189
  ],
24992
25190
  ...graph_items,
@@ -25157,7 +25355,7 @@ function add_tab(gobj, gobj2, id, text, icon) {
25157
25355
  i18n: text,
25158
25356
  class: ""
25159
25357
  },
25160
- text
25358
+ text_node(text)
25161
25359
  ]));
25162
25360
  (0, _yuneta_gobj_js.refresh_language)($a, i18next.t);
25163
25361
  $a.addEventListener("click", function(ev) {
@@ -25354,7 +25552,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25354
25552
  class: "yui-nav-label",
25355
25553
  i18n: text
25356
25554
  },
25357
- text
25555
+ text_node(text)
25358
25556
  ]]
25359
25557
  ]);
25360
25558
  $card.addEventListener("click", function(ev) {
@@ -25383,7 +25581,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25383
25581
  class: "TREEDB_TOPIC_CARD_NAME",
25384
25582
  i18n: text
25385
25583
  },
25386
- text
25584
+ text_node(text)
25387
25585
  ],
25388
25586
  ...topic_card_meta(desc),
25389
25587
  [
@@ -25600,7 +25798,7 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25600
25798
  if (pkey) push_meta("pkey", [
25601
25799
  "code",
25602
25800
  {},
25603
- pkey
25801
+ text_node(pkey)
25604
25802
  ]);
25605
25803
  if (pkey2s.length > 0) push_meta("pkey2s", [
25606
25804
  "span",
@@ -25608,13 +25806,13 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25608
25806
  pkey2s.map((name) => [
25609
25807
  "span",
25610
25808
  { class: "tag is-warning" },
25611
- name
25809
+ text_node(name)
25612
25810
  ])
25613
25811
  ]);
25614
25812
  push_meta("tkey", tkey ? [
25615
25813
  "code",
25616
25814
  {},
25617
- tkey
25815
+ text_node(tkey)
25618
25816
  ] : [
25619
25817
  "span",
25620
25818
  {
@@ -29425,7 +29623,7 @@ function build_json_cell_preview(value) {
29425
29623
  [["span", { class: "JSON_CELL_ICON icon yi-eye" }], [
29426
29624
  "span",
29427
29625
  { class: "JSON_CELL_PREVIEW" },
29428
- text
29626
+ text_node(text)
29429
29627
  ]]
29430
29628
  ]);
29431
29629
  }
@@ -30038,7 +30236,7 @@ function open_cell_file_dialog(gobj, row_id, col_id) {
30038
30236
  [[
30039
30237
  "span",
30040
30238
  { class: "CELL_FILE_ID" },
30041
- id
30239
+ text_node(id)
30042
30240
  ]]
30043
30241
  ]]
30044
30242
  ]));
@@ -30097,7 +30295,7 @@ function fill_cell_file_slot(gobj, pend, answer, error) {
30097
30295
  if (meta) $caption.appendChild((0, _yuneta_gobj_js.createElement2)([
30098
30296
  "span",
30099
30297
  { class: "CELL_FILE_META" },
30100
- meta
30298
+ text_node(meta)
30101
30299
  ]));
30102
30300
  let $open = yui_asset_open_link(answer);
30103
30301
  if ($open) $caption.appendChild($open);
@@ -30174,7 +30372,7 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook) {
30174
30372
  [[
30175
30373
  "span",
30176
30374
  { i18n: tg.topic_name },
30177
- tg.topic_name
30375
+ text_node(tg.topic_name)
30178
30376
  ]],
30179
30377
  { click: () => {
30180
30378
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHOOSE_LINKED", {
@@ -30425,8 +30623,8 @@ function transform__form_value_2_treedb_value(gobj, col, value, operation) {
30425
30623
  case "coordinates":
30426
30624
  case "blob": {
30427
30625
  let r = parse_json_field(value, field_desc.type);
30428
- if (r.error) (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: column '${col.id}' (${field_desc.type}) holds no valid json, taken as empty`);
30429
- value = r.value;
30626
+ if (r.error) (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: column '${col.id}' (${field_desc.type}) holds no valid json, handed on as it is`);
30627
+ else value = r.value;
30430
30628
  break;
30431
30629
  }
30432
30630
  case "enum":
@@ -60423,6 +60621,7 @@ var attrs_table$4 = [
60423
60621
  (0, _yuneta_gobj_js.SDATA_END)()
60424
60622
  ];
60425
60623
  var PRIVATE_DATA$4 = {
60624
+ _drag_unwire: null,
60426
60625
  anchor_id: "",
60427
60626
  anchor_state: "off",
60428
60627
  last_zoom: 1,
@@ -60582,6 +60781,10 @@ function mt_stop$4(gobj) {
60582
60781
  function mt_destroy$4(gobj) {
60583
60782
  let priv = gobj.priv;
60584
60783
  uninstall_fold_listener(gobj);
60784
+ if (priv._drag_unwire) {
60785
+ priv._drag_unwire();
60786
+ priv._drag_unwire = null;
60787
+ }
60585
60788
  if (priv._on_pointerdown_focus) {
60586
60789
  priv.$container.removeEventListener("pointerdown", priv._on_pointerdown_focus, true);
60587
60790
  priv._on_pointerdown_focus = null;
@@ -60737,28 +60940,6 @@ function build_graph$1(gobj) {
60737
60940
  });
60738
60941
  }
60739
60942
  /************************************************************
60740
- * A G6 event, as PLAIN JSON.
60741
- *
60742
- * A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
60743
- * G6 / @antv/g event is circular: serializing one THROWS, so the
60744
- * first thing a kw carrying `evt` breaks is the trace the FSM
60745
- * exists to feed. It also drags a live graph element into a
60746
- * message that may be read after that element is gone.
60747
- *
60748
- * What the actions read of it is an id and three scalars. The
60749
- * event itself never leaves the callback that received it.
60750
- ************************************************************/
60751
- function g6_event_kw(evt) {
60752
- let target = evt && evt.target ? evt.target : null;
60753
- let client = evt && evt.client ? evt.client : null;
60754
- return {
60755
- id: target && target.id ? String(target.id) : "",
60756
- shift: !!(evt && evt.shiftKey),
60757
- client_x: client && typeof client.x === "number" ? client.x : 0,
60758
- client_y: client && typeof client.y === "number" ? client.y : 0
60759
- };
60760
- }
60761
- /************************************************************
60762
60943
  * Configure G6 event handlers
60763
60944
  ************************************************************/
60764
60945
  function configure_events(gobj) {
@@ -63733,6 +63914,11 @@ function start_node_resize(gobj, e, mx, my) {
63733
63914
  document.addEventListener("pointermove", onPointerMove);
63734
63915
  document.addEventListener("pointerup", onPointerUp);
63735
63916
  document.addEventListener("pointercancel", onPointerCancel);
63917
+ gobj.priv._drag_unwire = function() {
63918
+ document.removeEventListener("pointermove", onPointerMove);
63919
+ document.removeEventListener("pointerup", onPointerUp);
63920
+ document.removeEventListener("pointercancel", onPointerCancel);
63921
+ };
63736
63922
  }
63737
63923
  /************************************************************
63738
63924
  * Port selection and individual port resizing
@@ -64348,6 +64534,11 @@ function start_link_drag(gobj, e) {
64348
64534
  document.addEventListener("pointermove", onPointerMove);
64349
64535
  document.addEventListener("pointerup", onPointerUp);
64350
64536
  document.addEventListener("pointercancel", onPointerCancel);
64537
+ gobj.priv._drag_unwire = function() {
64538
+ document.removeEventListener("pointermove", onPointerMove);
64539
+ document.removeEventListener("pointerup", onPointerUp);
64540
+ document.removeEventListener("pointercancel", onPointerCancel);
64541
+ };
64351
64542
  }
64352
64543
  /************************************************************
64353
64544
  * Find if a canvas point hits a valid hook port during
@@ -64566,6 +64757,11 @@ function start_port_resize(gobj, e) {
64566
64757
  document.addEventListener("pointermove", onPointerMove);
64567
64758
  document.addEventListener("pointerup", onPointerUp);
64568
64759
  document.addEventListener("pointercancel", onPointerCancel);
64760
+ gobj.priv._drag_unwire = function() {
64761
+ document.removeEventListener("pointermove", onPointerMove);
64762
+ document.removeEventListener("pointerup", onPointerUp);
64763
+ document.removeEventListener("pointercancel", onPointerCancel);
64764
+ };
64569
64765
  }
64570
64766
  /************************************************************
64571
64767
  * Edge selection: show a floating properties icon near
@@ -72740,6 +72936,7 @@ var JSON_SHORT_ESCAPES = {
72740
72936
  "\f": "f"
72741
72937
  };
72742
72938
  function json_control(ch) {
72939
+ if (ch === "\0") return "\\\\ufffd";
72743
72940
  let short = JSON_SHORT_ESCAPES[ch];
72744
72941
  if (short) return C_BACKSLASH + short;
72745
72942
  return "\\\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0");
@@ -74435,7 +74632,7 @@ function render_toolbar(gobj) {
74435
74632
  $trail.push([
74436
74633
  "span",
74437
74634
  { class: "SCHEMA_CRUMB_TREEDB" },
74438
- priv.treedb_id
74635
+ text_node(priv.treedb_id)
74439
74636
  ]);
74440
74637
  }
74441
74638
  if (priv.topic_name) {
@@ -74447,7 +74644,7 @@ function render_toolbar(gobj) {
74447
74644
  $trail.push([
74448
74645
  "span",
74449
74646
  { class: "SCHEMA_CRUMB_TOPIC" },
74450
- priv.topic_name
74647
+ text_node(priv.topic_name)
74451
74648
  ]);
74452
74649
  }
74453
74650
  if (priv.diagram) {
@@ -80293,7 +80490,7 @@ function traffic_scalar_row(key, value) {
80293
80490
  let val_children = [[
80294
80491
  "span",
80295
80492
  { class: "TRAFFIC_VAL " + cls },
80296
- text
80493
+ text_node(text)
80297
80494
  ]];
80298
80495
  if (key in TRAFFIC_TS_FIELDS && typeof value === "number") {
80299
80496
  let iso = traffic_iso(value);
@@ -80426,7 +80623,7 @@ function traffic_value_node(key, value) {
80426
80623
  ]] : object_preview_parts(value, count).map((t) => [
80427
80624
  "span",
80428
80625
  { class: "TRAFFIC_PREV " + t.cls },
80429
- t.text
80626
+ text_node(t.text)
80430
80627
  ]);
80431
80628
  return [
80432
80629
  "details",
@@ -80443,7 +80640,7 @@ function traffic_value_node(key, value) {
80443
80640
  [
80444
80641
  "span",
80445
80642
  { class: "TRAFFIC_NEST_KEY" },
80446
- key
80643
+ text_node(key)
80447
80644
  ],
80448
80645
  [
80449
80646
  "span",
@@ -80478,17 +80675,17 @@ function event_spans(e) {
80478
80675
  ], [
80479
80676
  "span",
80480
80677
  { class: "TRAFFIC_EVENT" },
80481
- e.event
80678
+ text_node(e.event)
80482
80679
  ]];
80483
80680
  if (e.command) spans.push([
80484
80681
  "span",
80485
80682
  { class: "TRAFFIC_CMD" },
80486
- e.command
80683
+ text_node(e.command)
80487
80684
  ]);
80488
80685
  if (e.title) spans.push([
80489
80686
  "span",
80490
80687
  { class: "TRAFFIC_SRC" },
80491
- e.title
80688
+ text_node(e.title)
80492
80689
  ]);
80493
80690
  return spans;
80494
80691
  }
@@ -80568,7 +80765,7 @@ function render_full(e) {
80568
80765
  ], [
80569
80766
  "pre",
80570
80767
  { class: "TRAFFIC_FULL" },
80571
- text
80768
+ document.createTextNode(String(text))
80572
80769
  ]];
80573
80770
  return (0, _yuneta_gobj_js.createElement2)([
80574
80771
  "div",