@yuneta/gobj-ui 7.26.7 → 7.26.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +53 -0
  2. package/dist/gobj-ui.cjs.js +534 -232
  3. package/dist/gobj-ui.es.js +534 -232
  4. package/package.json +2 -2
  5. package/src/c_g6_nodes_tree.js +65 -31
  6. package/src/c_yui_form.js +230 -63
  7. package/src/c_yui_gclass.js +23 -22
  8. package/src/c_yui_gobj_tree_js.js +13 -9
  9. package/src/c_yui_json.js +7 -6
  10. package/src/c_yui_json_graph.js +8 -7
  11. package/src/c_yui_json_pad.js +2 -1
  12. package/src/c_yui_map.js +25 -1
  13. package/src/c_yui_nav.js +9 -8
  14. package/src/c_yui_schema_editor.js +25 -24
  15. package/src/c_yui_shell.js +64 -3
  16. package/src/c_yui_treedb_topic_with_form.js +26 -21
  17. package/src/c_yui_treedb_topics.js +17 -16
  18. package/src/c_yui_window.js +73 -32
  19. package/src/c_yui_window_manager.js +3 -2
  20. package/src/form_json_field.js +10 -3
  21. package/src/form_json_field.test.js +6 -0
  22. package/src/form_json_field.wiring.test.js +1 -1
  23. package/src/form_table_rearm.wiring.test.js +158 -0
  24. package/src/form_toolbar_plan.js +5 -5
  25. package/src/g6_event_kw.js +36 -0
  26. package/src/map_stop_windows.wiring.test.js +112 -0
  27. package/src/nav_cards_helpers.js +2 -1
  28. package/src/nav_cards_helpers.test.js +7 -3
  29. package/src/overlay_marker_after_back.wiring.test.js +212 -0
  30. package/src/schema_to_c.js +10 -0
  31. package/src/schema_to_c.test.js +8 -1
  32. package/src/shell_modals.js +7 -5
  33. package/src/shell_route_map.js +12 -13
  34. package/src/treedb_topics_transport.wiring.test.js +26 -0
  35. package/src/vite_plugin_yuneta_html.test.js +94 -0
  36. package/src/window_show.wiring.test.js +83 -0
  37. package/src/window_veto_back.wiring.test.js +35 -0
  38. package/src/yui_asset.js +3 -2
  39. package/src/yui_data_color.js +33 -0
  40. package/src/yui_data_color.test.js +27 -0
  41. package/src/yui_dev.js +15 -13
  42. package/src/yui_frontend_view.js +4 -4
  43. package/src/yui_gclass_view.js +3 -3
  44. package/src/yui_text.js +43 -0
  45. package/src/yui_text.test.js +67 -0
  46. package/vite-plugin-yuneta-html.js +24 -5
@@ -914,6 +914,7 @@ var PRIVATE_DATA$22 = {
914
914
  overlay_stack: [],
915
915
  overlay_seq: 0,
916
916
  expected_pops: 0,
917
+ pending_markers: [],
917
918
  popstate_handler: null,
918
919
  avatar_provider: null,
919
920
  avatar_nodes: [],
@@ -971,6 +972,7 @@ function mt_start$20(gobj) {
971
972
  if (!p) return;
972
973
  if (p.expected_pops > 0) {
973
974
  p.expected_pops--;
975
+ if (p.expected_pops === 0) push_pending_markers(gobj);
974
976
  return;
975
977
  }
976
978
  if (p.overlay_stack.length === 0) return;
@@ -2387,6 +2389,7 @@ function drain_overlays(gobj) {
2387
2389
  let kept = [];
2388
2390
  while (entries.length > 0) {
2389
2391
  let entry = entries.pop();
2392
+ if (entry.dismissed) continue;
2390
2393
  if (entry.keep_on_navigate) {
2391
2394
  kept.unshift(entry);
2392
2395
  continue;
@@ -2415,21 +2418,44 @@ function push_overlay_history(gobj, close, opts) {
2415
2418
  keep_on_navigate: !!(opts && opts.keep_on_navigate)
2416
2419
  };
2417
2420
  priv.overlay_stack.push(entry);
2421
+ if (priv.expected_pops > 0) {
2422
+ entry.marker_pending = true;
2423
+ priv.pending_markers.push(entry);
2424
+ return entry;
2425
+ }
2426
+ if (!push_overlay_marker(gobj, entry)) return null;
2427
+ return entry;
2428
+ }
2429
+ function push_overlay_marker(gobj, entry) {
2430
+ let priv = gobj.priv;
2418
2431
  try {
2419
2432
  window.history.pushState({ __yui_overlay__: entry.id }, "");
2420
2433
  } catch (e) {
2421
- priv.overlay_stack.pop();
2434
+ let idx = priv.overlay_stack.indexOf(entry);
2435
+ if (idx >= 0) priv.overlay_stack.splice(idx, 1);
2422
2436
  log_warning(`C_YUI_SHELL: overlay pushState failed: ${e}`);
2423
- return null;
2437
+ return false;
2438
+ }
2439
+ return true;
2440
+ }
2441
+ function push_pending_markers(gobj) {
2442
+ let priv = gobj.priv;
2443
+ let pending = priv.pending_markers.splice(0);
2444
+ for (let entry of pending) {
2445
+ entry.marker_pending = false;
2446
+ if (entry.dismissed || priv.overlay_stack.indexOf(entry) < 0) continue;
2447
+ entry.hash = window.location.hash;
2448
+ push_overlay_marker(gobj, entry);
2424
2449
  }
2425
- return entry;
2426
2450
  }
2427
2451
  function overlay_dismissed(gobj, entry) {
2428
2452
  let priv = gobj.priv;
2429
2453
  if (!priv || !priv.overlay_stack || !entry) return;
2454
+ entry.dismissed = true;
2430
2455
  let idx = priv.overlay_stack.indexOf(entry);
2431
2456
  if (idx < 0) return;
2432
2457
  priv.overlay_stack.splice(idx, 1);
2458
+ if (entry.marker_pending) return;
2433
2459
  let st = window.history.state;
2434
2460
  if (st && st.__yui_overlay__ === entry.id) {
2435
2461
  priv.expected_pops++;
@@ -3025,6 +3051,45 @@ function yui_shell_close_dropdown(shell_gobj) {
3025
3051
  close_toolbar_dropdown(shell_gobj);
3026
3052
  }
3027
3053
  //#endregion
3054
+ //#region src/yui_text.js
3055
+ /***********************************************************************
3056
+ * yui_text.js
3057
+ *
3058
+ * DATA as text for createElement2().
3059
+ *
3060
+ * createElement2() takes a string content that starts with '<' for
3061
+ * MARKUP and parses it (that is how a component passes an inline
3062
+ * icon). So a value that came from outside -- a backend answer, a
3063
+ * treedb node, a name somebody typed, a frame of the traffic -- must
3064
+ * never go in as a bare string: "<img src=x onerror=...>" would run.
3065
+ * It goes in as a Text node, which is always text.
3066
+ *
3067
+ * Trimmed like createElement2() trims a string, so the change of
3068
+ * form does not change what is shown. A Text node under an
3069
+ * `i18n`/`data-i18n` element is still re-translated by
3070
+ * refresh_language(), which sets textContent.
3071
+ *
3072
+ * Copyright (c) 2026, ArtGins.
3073
+ * All Rights Reserved.
3074
+ ***********************************************************************/
3075
+ /************************************************************
3076
+ * A Text node with `value` as its text ("" for null/undefined).
3077
+ ************************************************************/
3078
+ function text_node(value) {
3079
+ if (value === null || value === void 0) return document.createTextNode("");
3080
+ return document.createTextNode(String(value).trim());
3081
+ }
3082
+ /************************************************************
3083
+ * A Tabulator `titleFormatter` that shows the column title as text.
3084
+ *
3085
+ * Tabulator puts a STRING title in with innerHTML, so a title taken
3086
+ * from a schema (`header`, which the schema editor writes) is markup
3087
+ * unless the column carries a formatter that returns a Node.
3088
+ ************************************************************/
3089
+ function text_title_formatter(cell) {
3090
+ return text_node(cell.getValue());
3091
+ }
3092
+ //#endregion
3028
3093
  //#region src/shell_modals.js
3029
3094
  /***********************************************************************
3030
3095
  * shell_modals.js
@@ -3137,7 +3202,7 @@ function show_notification(shell, kind, message, opts) {
3137
3202
  ...p_attrs,
3138
3203
  class: "TOAST_MSG"
3139
3204
  },
3140
- message
3205
+ typeof message === "string" ? text_node(message) : message
3141
3206
  ]]
3142
3207
  ]);
3143
3208
  $layer.appendChild($note);
@@ -3239,14 +3304,14 @@ function yui_shell_show_modal(shell, content, opts) {
3239
3304
  (title_prefix ? [[
3240
3305
  "span",
3241
3306
  { class: "MODAL_TITLE_PREFIX" },
3242
- title_prefix
3307
+ text_node(title_prefix)
3243
3308
  ]] : []).concat(title ? [[
3244
3309
  "span",
3245
3310
  {
3246
3311
  class: "MODAL_TITLE_KIND",
3247
3312
  i18n: title
3248
3313
  },
3249
- title
3314
+ text_node(title)
3250
3315
  ]] : [])
3251
3316
  ],
3252
3317
  [
@@ -3397,7 +3462,7 @@ function build_dialog(shell, message, buttons, opts) {
3397
3462
  class: "CONFIRM_MSG yui-confirm-msg",
3398
3463
  i18n: message
3399
3464
  },
3400
- message
3465
+ text_node(message)
3401
3466
  ]] : [message];
3402
3467
  let $footer_children = buttons.map((b) => {
3403
3468
  let cls = "CONFIRM_BTN button px-5";
@@ -3435,7 +3500,7 @@ function build_dialog(shell, message, buttons, opts) {
3435
3500
  class: "CONFIRM_TITLE yui-confirm-title has-text-centered",
3436
3501
  i18n: title
3437
3502
  },
3438
- title
3503
+ text_node(title)
3439
3504
  ]);
3440
3505
  $card_children.push(["button", {
3441
3506
  class: "CONFIRM_CLOSE delete yui-confirm-x",
@@ -3640,9 +3705,9 @@ var attrs_table$21 = [
3640
3705
  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
3706
  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
3707
  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"),
3708
+ SDATA(data_type_t.DTP_POINTER, "focus", 0, null, "NOT implemented yet: would bring focus to the element, a number or a selector"),
3709
+ SDATA(data_type_t.DTP_BOOLEAN, "modal", 0, false, "NOT implemented yet: would enable modal mode"),
3710
+ SDATA(data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "NOT implemented yet: would close the window on ESC (Escape does nothing today)"),
3646
3711
  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
3712
  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
3713
  SDATA(data_type_t.DTP_POINTER, "back_overlay", 0, null, "Internal: overlay-history entry (Back-button integration)"),
@@ -3801,7 +3866,7 @@ function build_default_header(gobj) {
3801
3866
  if (!empty_string(prefix)) items.push([
3802
3867
  "span",
3803
3868
  { class: "WINDOW_TITLE_PREFIX has-text-weight-semibold" },
3804
- document.createTextNode(String(prefix))
3869
+ text_node(prefix)
3805
3870
  ]);
3806
3871
  if (!empty_string(title)) items.push([
3807
3872
  "span",
@@ -3809,7 +3874,7 @@ function build_default_header(gobj) {
3809
3874
  class: "WINDOW_TITLE_KIND has-text-weight-semibold",
3810
3875
  i18n: title
3811
3876
  },
3812
- title
3877
+ text_node(title)
3813
3878
  ]);
3814
3879
  return createElement2([
3815
3880
  "span",
@@ -4147,15 +4212,24 @@ function destroy_ui$13(gobj) {
4147
4212
  function register_back_overlay(gobj) {
4148
4213
  let shell = yui_shell_of(gobj);
4149
4214
  if (!shell) return;
4215
+ const rearm = function() {
4216
+ if (!gobj_is_destroying(gobj) && !gobj_read_attr(gobj, "back_overlay")) register_back_overlay(gobj);
4217
+ };
4150
4218
  let overlay = yui_shell_register_overlay(shell, function() {
4151
4219
  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);
4220
+ const closing = close_window(gobj);
4221
+ if (closing.state === "vetoed") rearm();
4222
+ else if (closing.state === "asking") closing.answer.then(rearm);
4154
4223
  }, { keep_on_navigate: gobj_read_bool_attr(gobj, "keep_on_navigate") });
4155
4224
  gobj_write_attr(gobj, "back_overlay", overlay);
4156
4225
  }
4157
4226
  /************************************************************
4158
- *
4227
+ * Ask to close the window. Answers what happened:
4228
+ * {state: "closed"} the window is destroyed
4229
+ * {state: "vetoed"} a subscriber kept it open
4230
+ * {state: "asking", answer} a subscriber asked a question
4231
+ * first; `answer` resolves to
4232
+ * it once it is over
4159
4233
  ************************************************************/
4160
4234
  function close_window(gobj) {
4161
4235
  let kw_close = { abort_close: false };
@@ -4166,19 +4240,26 @@ function close_window(gobj) {
4166
4240
  if (gobj_is_running(gobj)) gobj_stop(gobj);
4167
4241
  gobj_stop_children(gobj);
4168
4242
  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
- });
4243
+ return { state: "closed" };
4244
+ }
4245
+ if (!kw_close.warning) return { state: "vetoed" };
4246
+ return {
4247
+ state: "asking",
4248
+ answer: yui_shell_confirm_yesnocancel(yui_shell_of(gobj), kw_close.warning, {
4249
+ t,
4250
+ yes_label: "yes",
4251
+ no_label: "no",
4252
+ cancel_label: "cancel"
4253
+ }).then(function(answer) {
4254
+ if (answer !== "yes") return answer;
4255
+ if (gobj_is_destroying(gobj)) return answer;
4256
+ if (on_close) on_close();
4257
+ if (gobj_is_running(gobj)) gobj_stop(gobj);
4258
+ gobj_stop_children(gobj);
4259
+ gobj_destroy(gobj);
4260
+ return answer;
4261
+ })
4262
+ };
4182
4263
  }
4183
4264
  /************************************************************
4184
4265
  *
@@ -4439,6 +4520,19 @@ function ac_refresh$11(gobj, event, kw, src) {
4439
4520
  *
4440
4521
  ************************************************************/
4441
4522
  function ac_show$15(gobj, event, kw, src) {
4523
+ let manager = gobj_read_pointer_attr(gobj, "manager");
4524
+ if (manager) {
4525
+ gobj_send_event(manager, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
4526
+ return 0;
4527
+ }
4528
+ let $container = gobj_read_attr(gobj, "$container");
4529
+ if (!$container) {
4530
+ log_error(`${gobj_short_name(gobj)}: EV_SHOW without a container`);
4531
+ return -1;
4532
+ }
4533
+ $container.style.removeProperty("display");
4534
+ let $parent = $container.parentNode;
4535
+ if ($parent && $parent.lastChild !== $container) $parent.appendChild($container);
4442
4536
  return 0;
4443
4537
  }
4444
4538
  /************************************************************
@@ -4860,7 +4954,7 @@ function ac_register_window(gobj, event, kw, src) {
4860
4954
  if (prefix) label_items.push([
4861
4955
  "span",
4862
4956
  { class: "yui-dock-label-prefix" },
4863
- document.createTextNode(String(prefix))
4957
+ text_node(prefix)
4864
4958
  ]);
4865
4959
  if (title_key) label_items.push([
4866
4960
  "span",
@@ -4873,7 +4967,7 @@ function ac_register_window(gobj, event, kw, src) {
4873
4967
  if (label_items.length === 0) label_items.push([
4874
4968
  "span",
4875
4969
  { class: "yui-dock-label-kind" },
4876
- document.createTextNode(String(title))
4970
+ text_node(title)
4877
4971
  ]);
4878
4972
  let entry = {
4879
4973
  gobj: win,
@@ -6544,12 +6638,12 @@ function yui_asset_element(answer, opts = {}) {
6544
6638
  const children = [[
6545
6639
  "span",
6546
6640
  { class: "ASSET_OTHER_TYPE" },
6547
- String(answer.content_type || "?")
6641
+ text_node(answer.content_type || "?")
6548
6642
  ]];
6549
6643
  if (opts.detail) children.push([
6550
6644
  "span",
6551
6645
  { class: "ASSET_OTHER_DETAIL" },
6552
- String(opts.detail)
6646
+ text_node(opts.detail)
6553
6647
  ]);
6554
6648
  const $card = createElement2([
6555
6649
  "div",
@@ -8150,13 +8244,18 @@ function parse_json_field(value, type) {
8150
8244
  };
8151
8245
  }
8152
8246
  /************************************************************
8153
- * What a jsoneditor content ({text} or {json}) holds: the
8154
- * text as typed, or the tree-mode json.
8247
+ * What a jsoneditor content ({text} or {json}) holds, as TEXT:
8248
+ * the text as typed, or the tree-mode json serialized -- which is
8249
+ * what get_form_values() reads out of the editor too. Handing the
8250
+ * tree-mode value back as is made parse_json_field() parse a
8251
+ * string ROOT a second time: "123" was checked as the number 123,
8252
+ * and "abc" as a text that is no json.
8155
8253
  ************************************************************/
8156
8254
  function json_editor_value(content) {
8157
8255
  if (!content) return;
8158
8256
  if (content.text !== void 0) return content.text;
8159
- return content.json;
8257
+ if (content.json === void 0) return;
8258
+ return JSON.stringify(content.json);
8160
8259
  }
8161
8260
  //#endregion
8162
8261
  //#region src/c_yui_form.js
@@ -8205,7 +8304,11 @@ var attrs_table$17 = [
8205
8304
  SDATA(data_type_t.DTP_BOOLEAN, "changes", 0, false, "Indicates if changes have been made"),
8206
8305
  SDATA_END()
8207
8306
  ];
8208
- var PRIVATE_DATA$17 = {};
8307
+ var PRIVATE_DATA$17 = {
8308
+ rearm_timer: null,
8309
+ tables: null,
8310
+ table_seq: 0
8311
+ };
8209
8312
  var __gclass__$17 = null;
8210
8313
  /***************************
8211
8314
  * Framework Methods
@@ -8219,6 +8322,7 @@ function mt_create$17(gobj) {
8219
8322
  gobj_subscribe_event(gobj, null, {}, subscriber);
8220
8323
  let name = clean_name(gobj_name(gobj));
8221
8324
  gobj_write_attr(gobj, "form_id", "form" + name);
8325
+ gobj.priv.tables = /* @__PURE__ */ new Map();
8222
8326
  build_ui$15(gobj);
8223
8327
  }
8224
8328
  /************************************************************
@@ -8272,26 +8376,30 @@ function set_changed_stated(gobj, changed) {
8272
8376
  enable($button_save, true, "MediumSeaGreen");
8273
8377
  enable($button_undo, true, "Magenta");
8274
8378
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8275
- if (isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8379
+ if ($table.tabulator && isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8276
8380
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
8277
- if (isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8381
+ if ($table_nested.tabulator && isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8278
8382
  });
8279
8383
  });
8280
8384
  } else {
8281
8385
  gobj_write_bool_attr(gobj, "changes", false);
8282
8386
  enable($button_save, false, OFF_COLOR);
8283
8387
  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) {
8388
+ if (gobj.priv.rearm_timer) clearTimeout(gobj.priv.rearm_timer);
8389
+ gobj.priv.rearm_timer = setTimeout(function() {
8390
+ gobj.priv.rearm_timer = null;
8391
+ if (gobj_is_destroying(gobj)) return;
8392
+ const rearm = (tabulator) => {
8393
+ if (!tabulator) return;
8394
+ if (isEventSet(tabulator, "dataChanged")) tabulator.off("dataChanged");
8395
+ tabulator.on("dataChanged", function(data) {
8288
8396
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
8289
8397
  });
8398
+ };
8399
+ $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8400
+ rearm($table.tabulator);
8290
8401
  $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
- });
8402
+ rearm($table_nested.tabulator);
8295
8403
  });
8296
8404
  });
8297
8405
  }, 200);
@@ -8521,9 +8629,14 @@ function build_ui$15(gobj) {
8521
8629
  * Destroy UI
8522
8630
  ************************************************************/
8523
8631
  function destroy_ui$10(gobj) {
8632
+ if (gobj.priv && gobj.priv.rearm_timer) {
8633
+ clearTimeout(gobj.priv.rearm_timer);
8634
+ gobj.priv.rearm_timer = null;
8635
+ }
8524
8636
  let $container = gobj_read_attr(gobj, "$container");
8525
8637
  if ($container) {
8526
8638
  destroy_widgets(gobj, $container);
8639
+ if (gobj.priv && gobj.priv.tables) gobj.priv.tables.clear();
8527
8640
  if ($container.parentNode) $container.parentNode.removeChild($container);
8528
8641
  gobj_write_attr(gobj, "$container", null);
8529
8642
  }
@@ -8537,11 +8650,52 @@ function destroy_ui$10(gobj) {
8537
8650
  function cell_icon(icon_class, key) {
8538
8651
  let $i = document.createElement("i");
8539
8652
  $i.className = icon_class;
8653
+ $i.setAttribute("role", "button");
8654
+ $i.setAttribute("tabindex", "0");
8540
8655
  $i.setAttribute("title", t(key));
8656
+ $i.setAttribute("data-i18n-title", key);
8541
8657
  $i.setAttribute("aria-label", t(key));
8658
+ $i.setAttribute("data-i18n-aria-label", key);
8659
+ $i.addEventListener("keydown", function(evt) {
8660
+ if (evt.key === "Enter" || evt.key === " ") {
8661
+ evt.preventDefault();
8662
+ $i.click();
8663
+ }
8664
+ });
8542
8665
  return $i;
8543
8666
  }
8544
8667
  /************************************************************
8668
+ * The identity of a table element, for the kw of
8669
+ * EV_ADD_TABLE_ROW: a kw is plain json, and an element (with its
8670
+ * `.tabulator`, circular) broke the `machine` trace that dumps it.
8671
+ * Given on first use and kept on the element; the registry holds
8672
+ * it weakly, so a nested table re-built by its row formatter is
8673
+ * not kept alive by it.
8674
+ ************************************************************/
8675
+ function table_identity(gobj, $table) {
8676
+ if (!$table.yui_table_id) {
8677
+ let priv = gobj.priv;
8678
+ for (let [id, ref] of priv.tables) if (!ref.deref()) priv.tables.delete(id);
8679
+ priv.table_seq += 1;
8680
+ $table.yui_table_id = `t${priv.table_seq}`;
8681
+ priv.tables.set($table.yui_table_id, new WeakRef($table));
8682
+ }
8683
+ return $table.yui_table_id;
8684
+ }
8685
+ /************************************************************
8686
+ * The element of a table identity, or null when it is gone.
8687
+ ************************************************************/
8688
+ function find_table(gobj, table_id) {
8689
+ let priv = gobj.priv;
8690
+ let ref = priv.tables ? priv.tables.get(table_id) : null;
8691
+ let $table = ref ? ref.deref() : null;
8692
+ if (!$table) {
8693
+ if (priv.tables) priv.tables.delete(table_id);
8694
+ return null;
8695
+ }
8696
+ return $table;
8697
+ }
8698
+ /************************************************************
8545
8699
  * Destroy the third-party widgets the form built. Removing
8546
8700
  * their DOM is not enough: Tom Select keeps listeners on
8547
8701
  * `document` and `window`, the jsoneditor is a live Svelte app
@@ -8552,16 +8706,23 @@ function cell_icon(icon_class, key) {
8552
8706
  function destroy_widgets(gobj, $container) {
8553
8707
  let destroy = (what, widget) => {
8554
8708
  try {
8555
- widget.destroy();
8709
+ let r = widget.destroy();
8710
+ if (r && typeof r.then === "function") r.catch((e) => {
8711
+ log_warning(`${gobj_short_name(gobj)}: cannot destroy ${what}: ${e}`);
8712
+ });
8556
8713
  } catch (e) {
8557
8714
  log_warning(`${gobj_short_name(gobj)}: cannot destroy ${what}: ${e}`);
8558
8715
  }
8559
8716
  };
8717
+ let forget = ($el) => {
8718
+ if ($el.yui_table_id && gobj.priv && gobj.priv.tables) gobj.priv.tables.delete($el.yui_table_id);
8719
+ };
8560
8720
  $container.querySelectorAll(".yui-tabulator-table-nested").forEach(($el) => {
8561
8721
  if ($el.tabulator) {
8562
8722
  destroy("nested table", $el.tabulator);
8563
8723
  $el.tabulator = null;
8564
8724
  }
8725
+ forget($el);
8565
8726
  });
8566
8727
  $container.querySelectorAll(".yui-form-data-input").forEach(($el) => {
8567
8728
  if ($el.tom_select) {
@@ -8576,6 +8737,7 @@ function destroy_widgets(gobj, $container) {
8576
8737
  destroy("table", $el.tabulator);
8577
8738
  $el.tabulator = null;
8578
8739
  }
8740
+ forget($el);
8579
8741
  });
8580
8742
  }
8581
8743
  /******************************************************************
@@ -8610,6 +8772,25 @@ function name_form_control($field, conf) {
8610
8772
  $ts.setAttribute("aria-label", t(key));
8611
8773
  $ts.setAttribute("data-i18n-aria-label", key);
8612
8774
  }
8775
+ let $clear = $field.querySelector(".ts-wrapper .clear-button");
8776
+ if ($clear) {
8777
+ const CLEAR_KEY = "remove all selected options";
8778
+ $clear.setAttribute("role", "button");
8779
+ $clear.setAttribute("tabindex", "0");
8780
+ if (!$clear.yui_keys_wired) {
8781
+ $clear.yui_keys_wired = true;
8782
+ $clear.addEventListener("keydown", function(evt) {
8783
+ if (evt.key === "Enter" || evt.key === " ") {
8784
+ evt.preventDefault();
8785
+ $clear.click();
8786
+ }
8787
+ });
8788
+ }
8789
+ $clear.setAttribute("title", t(CLEAR_KEY));
8790
+ $clear.setAttribute("data-i18n-title", CLEAR_KEY);
8791
+ $clear.setAttribute("aria-label", t(CLEAR_KEY));
8792
+ $clear.setAttribute("data-i18n-aria-label", CLEAR_KEY);
8793
+ }
8613
8794
  }
8614
8795
  function build_form(gobj) {
8615
8796
  let form_id = gobj_read_str_attr(gobj, "form_id");
@@ -8960,12 +9141,7 @@ function apply_form_mode(gobj, $form) {
8960
9141
  ******************************************************************/
8961
9142
  function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, name, label, label_i18n, placeholder, options, extras, readonly, required, hidden, default_value }) {
8962
9143
  let $element;
8963
- let kw_add_table_row = {
8964
- $row: null,
8965
- $table: null,
8966
- record: {},
8967
- loading: false
8968
- };
9144
+ let $add_table = null;
8969
9145
  switch (tag) {
8970
9146
  case "input":
8971
9147
  switch (inputType) {
@@ -8983,7 +9159,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8983
9159
  i18n: label_i18n || label,
8984
9160
  for: name
8985
9161
  },
8986
- label
9162
+ text_node(label)
8987
9163
  ]]
8988
9164
  ], [
8989
9165
  "div",
@@ -9016,7 +9192,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9016
9192
  i18n: label_i18n || label,
9017
9193
  for: name
9018
9194
  },
9019
- label
9195
+ text_node(label)
9020
9196
  ]]
9021
9197
  ], [
9022
9198
  "div",
@@ -9057,7 +9233,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9057
9233
  i18n: label_i18n || label,
9058
9234
  for: name
9059
9235
  },
9060
- label
9236
+ text_node(label)
9061
9237
  ]]
9062
9238
  ], [
9063
9239
  "div",
@@ -9088,7 +9264,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9088
9264
  i18n: label_i18n || label,
9089
9265
  for: name
9090
9266
  },
9091
- label
9267
+ text_node(label)
9092
9268
  ]]
9093
9269
  ], [
9094
9270
  "div",
@@ -9118,7 +9294,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9118
9294
  class: "label",
9119
9295
  i18n: label_i18n || label
9120
9296
  },
9121
- label
9297
+ text_node(label)
9122
9298
  ]]
9123
9299
  ], [
9124
9300
  "div",
@@ -9153,7 +9329,15 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9153
9329
  { click: function(evt) {
9154
9330
  evt.stopPropagation();
9155
9331
  evt.preventDefault();
9156
- gobj_send_event(gobj, "EV_ADD_TABLE_ROW", kw_add_table_row, gobj);
9332
+ if (!$add_table) {
9333
+ log_error(`${gobj_short_name(gobj)}: "add" of a field without a table`);
9334
+ return;
9335
+ }
9336
+ gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
9337
+ table_id: table_identity(gobj, $add_table),
9338
+ record: {},
9339
+ loading: false
9340
+ }, gobj);
9157
9341
  } }
9158
9342
  ]]
9159
9343
  ]]
@@ -9209,7 +9393,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9209
9393
  i18n: label_i18n || label,
9210
9394
  for: name
9211
9395
  },
9212
- label
9396
+ text_node(label)
9213
9397
  ]]
9214
9398
  ], [
9215
9399
  "div",
@@ -9295,7 +9479,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9295
9479
  value: option,
9296
9480
  i18n: option
9297
9481
  },
9298
- document.createTextNode(String(option))
9482
+ text_node(option)
9299
9483
  ]),
9300
9484
  { "change": function(evt) {
9301
9485
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
@@ -9324,14 +9508,14 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9324
9508
  opts.map((option) => is_icon ? [
9325
9509
  "option",
9326
9510
  { value: option },
9327
- option
9511
+ text_node(option)
9328
9512
  ] : [
9329
9513
  "option",
9330
9514
  {
9331
9515
  value: option,
9332
9516
  i18n: option
9333
9517
  },
9334
- option
9518
+ text_node(option)
9335
9519
  ])
9336
9520
  ];
9337
9521
  $extend = createElement2(extend);
@@ -9384,7 +9568,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9384
9568
  }], [
9385
9569
  "span",
9386
9570
  { i18n: label_key },
9387
- label_key
9571
+ text_node(label_key)
9388
9572
  ]]
9389
9573
  ]);
9390
9574
  $control.appendChild($extend);
@@ -9436,7 +9620,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9436
9620
  }]);
9437
9621
  $control.appendChild($extend);
9438
9622
  $extend.tabulator = create_tabulator$1(gobj, $extend, name, options);
9439
- kw_add_table_row["$table"] = $extend;
9623
+ $add_table = $extend;
9440
9624
  break;
9441
9625
  case "coordinates": {
9442
9626
  let attrs = {
@@ -9786,6 +9970,7 @@ function template2columns(gobj, columns, template, sub_elements) {
9786
9970
  let column = {
9787
9971
  field: field_desc.name,
9788
9972
  title: t(field_desc.header || field_desc.name),
9973
+ titleFormatter: text_title_formatter,
9789
9974
  editable: get_editable_state,
9790
9975
  editor: false,
9791
9976
  headerWordWrap: true,
@@ -9819,11 +10004,13 @@ function template2columns(gobj, columns, template, sub_elements) {
9819
10004
  hozAlign: "center",
9820
10005
  cellClick: function(evt, cell) {
9821
10006
  evt.stopPropagation();
9822
- let $row = cell.getRow().getElement();
9823
- let $extend = $row.querySelector(`[name="${field_desc.name}"]`);
10007
+ let $extend = cell.getRow().getElement().querySelector(`[name="${field_desc.name}"]`);
10008
+ if (!$extend) {
10009
+ log_error(`${gobj_short_name(gobj)}: nested table '${field_desc.name}' not found in its row`);
10010
+ return;
10011
+ }
9824
10012
  gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
9825
- $row,
9826
- $table: $extend,
10013
+ table_id: table_identity(gobj, $extend),
9827
10014
  record: {},
9828
10015
  loading: false
9829
10016
  }, gobj);
@@ -9956,12 +10143,22 @@ function template2columns(gobj, columns, template, sub_elements) {
9956
10143
  * out-of-range number is more precise than anything generic here.
9957
10144
  ************************************************************/
9958
10145
  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");
10146
+ let key = field_validation_key($input);
10147
+ if (key) return t(key);
9962
10148
  return $input.validationMessage;
9963
10149
  }
9964
10150
  /************************************************************
10151
+ * The i18n key of the message, when the message is ours ("" when
10152
+ * it is the browser's): written as the help line's data-i18n, so
10153
+ * a language change re-translates the line on screen.
10154
+ ************************************************************/
10155
+ function field_validation_key($input) {
10156
+ if ($input.yui_json_error) return $input.yui_json_error;
10157
+ let v = $input.validity;
10158
+ if (v && v.valueMissing) return "this field is required";
10159
+ return "";
10160
+ }
10161
+ /************************************************************
9965
10162
  * Mark a field as wrong, or clear the mark. One place: the same
9966
10163
  * three lines lived in the `invalid` and `blur` handlers of every
9967
10164
  * field kind.
@@ -9973,12 +10170,16 @@ function mark_field_validity($input) {
9973
10170
  $input.classList.remove("is-danger");
9974
10171
  if ($h) {
9975
10172
  $h.textContent = "";
10173
+ $h.removeAttribute("data-i18n");
9976
10174
  $h.style.display = "none";
9977
10175
  }
9978
10176
  return true;
9979
10177
  }
9980
10178
  $input.classList.add("is-danger");
9981
10179
  if ($h) {
10180
+ let key = field_validation_key($input);
10181
+ if (key) $h.setAttribute("data-i18n", key);
10182
+ else $h.removeAttribute("data-i18n");
9982
10183
  $h.textContent = field_validation_message($input);
9983
10184
  $h.style.display = "block";
9984
10185
  }
@@ -10272,15 +10473,13 @@ function load_tabulator_data(gobj, $table, value) {
10272
10473
  }
10273
10474
  let tabulator = $table.tabulator;
10274
10475
  if (tabulator.initialized) for (let row of value) gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
10275
- $row: null,
10276
- $table,
10476
+ table_id: table_identity(gobj, $table),
10277
10477
  record: row,
10278
10478
  loading: true
10279
10479
  }, gobj);
10280
10480
  else tabulator.on("tableBuilt", function() {
10281
10481
  for (let row of value) gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
10282
- $row: null,
10283
- $table,
10482
+ table_id: table_identity(gobj, $table),
10284
10483
  record: row,
10285
10484
  loading: true
10286
10485
  }, gobj);
@@ -10380,11 +10579,16 @@ function treedb_value_2_form_value(gobj, field_desc, value) {
10380
10579
  /************************************************************
10381
10580
  * A json field's value, parsed. validate_form() refuses a field
10382
10581
  * that does not parse, so reaching the error here is a path that
10383
- * skipped it: logged, never quiet.
10582
+ * skipped it: logged, and the value is handed on AS IT IS. An
10583
+ * empty `{}` / `[]` in its place is a value nobody wrote, and
10584
+ * saved it wipes the column.
10384
10585
  ************************************************************/
10385
10586
  function parse_json_value(gobj, field_desc, value) {
10386
10587
  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`);
10588
+ if (r.error) {
10589
+ log_error(`${gobj_short_name(gobj)}: field '${field_desc.name}' (${field_desc.type}) holds no valid json, handed on as it is`);
10590
+ return value;
10591
+ }
10388
10592
  return r.value;
10389
10593
  }
10390
10594
  /************************************************************
@@ -10445,7 +10649,9 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10445
10649
  value = parseInt(value) || 0;
10446
10650
  break;
10447
10651
  case "object":
10448
- case "dict": break;
10652
+ case "dict":
10653
+ value = parse_json_value(gobj, field_desc, value);
10654
+ break;
10449
10655
  case "array":
10450
10656
  case "list":
10451
10657
  value = parse_json_value(gobj, field_desc, value);
@@ -10581,9 +10787,13 @@ function ac_set_file_preview(gobj, event, kw, src) {
10581
10787
  * or from load_tabulator_data() to load data from backend
10582
10788
  ************************************************************/
10583
10789
  function ac_add_table_row(gobj, event, kw, src) {
10584
- let $row = kw["$row"];
10585
- let $table = kw.$table;
10586
- let tabulator = $table.tabulator;
10790
+ let table_id = kw.table_id;
10791
+ let $table = find_table(gobj, table_id);
10792
+ let tabulator = $table ? $table.tabulator : null;
10793
+ if (!tabulator) {
10794
+ log_error(`${gobj_short_name(gobj)}: EV_ADD_TABLE_ROW to a table that is gone: '${table_id}'`);
10795
+ return -1;
10796
+ }
10587
10797
  let record = kw.record;
10588
10798
  let loading = kw.loading;
10589
10799
  tabulator.addRow(record).then(function(row) {
@@ -10601,10 +10811,9 @@ function ac_add_table_row(gobj, event, kw, src) {
10601
10811
  log_error(`${gobj_short_name(gobj)}: cannot add a table row: ${error}`);
10602
10812
  });
10603
10813
  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();
10814
+ if (gobj_is_destroying(gobj)) return;
10815
+ let $target = loading ? $table : $table.closest(".yui-tabulator-table");
10816
+ if ($target && $target.tabulator) $target.tabulator.redraw();
10608
10817
  }, 30);
10609
10818
  return 0;
10610
10819
  }
@@ -11218,10 +11427,22 @@ function mt_start$16(gobj) {
11218
11427
  function mt_stop$16(gobj) {
11219
11428
  let shell = yui_shell_of(gobj);
11220
11429
  if (shell) gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
11430
+ retire_marker_windows(gobj);
11221
11431
  gobj_stop_children(gobj);
11222
11432
  return 0;
11223
11433
  }
11224
11434
  /***************************************************************
11435
+ * Destroy the windows the markers opened.
11436
+ ***************************************************************/
11437
+ function retire_marker_windows(gobj) {
11438
+ let windows = gobj_match_children(gobj, { __gclass_name__: "C_YUI_WINDOW" }) || [];
11439
+ for (let win of windows) {
11440
+ if (gobj_is_running(win)) gobj_stop(win);
11441
+ gobj_stop_children(win);
11442
+ gobj_destroy(win);
11443
+ }
11444
+ }
11445
+ /***************************************************************
11225
11446
  * Framework Method: Destroy
11226
11447
  ***************************************************************/
11227
11448
  function mt_destroy$16(gobj) {
@@ -13302,6 +13523,41 @@ function ensure_drag_canvas_patch() {
13302
13523
  __drag_canvas_patched__ = true;
13303
13524
  }
13304
13525
  //#endregion
13526
+ //#region src/g6_event_kw.js
13527
+ /***********************************************************************
13528
+ * g6_event_kw.js
13529
+ *
13530
+ * The kw an FSM event carries for a G6 pointer event: an identity
13531
+ * and three scalars, never the event. Shared by the three graphs
13532
+ * (C_G6_NODES_TREE, C_YUI_JSON_GRAPH, C_YUI_GOBJ_TREE_JS), which
13533
+ * each had a copy.
13534
+ *
13535
+ * Copyright (c) 2026, ArtGins.
13536
+ * All Rights Reserved.
13537
+ ***********************************************************************/
13538
+ /************************************************************
13539
+ * A G6 event, as PLAIN JSON.
13540
+ *
13541
+ * A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
13542
+ * G6 / @antv/g event is circular: serializing one THROWS, so the
13543
+ * first thing a kw carrying `evt` breaks is the trace the FSM
13544
+ * exists to feed. It also drags a live graph element into a
13545
+ * message that may be read after that element is gone.
13546
+ *
13547
+ * What the actions read of it is an id and three scalars. The
13548
+ * event itself never leaves the callback that received it.
13549
+ ************************************************************/
13550
+ function g6_event_kw(evt) {
13551
+ let target = evt && evt.target ? evt.target : null;
13552
+ let client = evt && evt.client ? evt.client : null;
13553
+ return {
13554
+ id: target && target.id ? String(target.id) : "",
13555
+ shift: !!(evt && evt.shiftKey),
13556
+ client_x: client && typeof client.x === "number" ? client.x : 0,
13557
+ client_y: client && typeof client.y === "number" ? client.y : 0
13558
+ };
13559
+ }
13560
+ //#endregion
13305
13561
  //#region src/c_yui_json_graph.js
13306
13562
  /***********************************************************************
13307
13563
  * c_yui_json_graph.js
@@ -13806,12 +14062,7 @@ function build_graph$4(gobj) {
13806
14062
  });
13807
14063
  if (priv.theme) graph.setTheme(priv.theme);
13808
14064
  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);
14065
+ gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
13815
14066
  });
13816
14067
  graph.on("aftertransform", () => {
13817
14068
  yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), priv.graph);
@@ -14746,7 +14997,9 @@ function ac_node_click$4(gobj, event, kw, src) {
14746
14997
  let nodedata;
14747
14998
  try {
14748
14999
  nodedata = graph.getNodeData(node_id);
14749
- } catch (e) {}
15000
+ } catch (e) {
15001
+ log_warning(`${gobj_short_name(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
15002
+ }
14750
15003
  if (priv.anchor_state === "arming") {
14751
15004
  priv.anchor_id = node_id;
14752
15005
  priv.anchor_path = nodedata && nodedata.data ? nodedata.data.path : "";
@@ -15631,7 +15884,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15631
15884
  let key_spec = key === null || key === "" ? null : [
15632
15885
  "span",
15633
15886
  { class: "JSON_KEY" },
15634
- String(key)
15887
+ text_node(key)
15635
15888
  ];
15636
15889
  let stub_text = (info.is_array ? "[" : "{") + (size !== void 0 ? String(size) : "?") + (info.is_array ? "]" : "}");
15637
15890
  let children = [];
@@ -15646,7 +15899,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15646
15899
  children.push([
15647
15900
  "span",
15648
15901
  { class: "JSON_STUB" },
15649
- stub_text
15902
+ text_node(stub_text)
15650
15903
  ]);
15651
15904
  children.push([
15652
15905
  "span",
@@ -15710,7 +15963,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15710
15963
  body.push([
15711
15964
  "span",
15712
15965
  { class: "JSON_KEY" },
15713
- String(key)
15966
+ text_node(key)
15714
15967
  ]);
15715
15968
  body.push([
15716
15969
  "span",
@@ -15727,7 +15980,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15727
15980
  if (label) body.push([
15728
15981
  "span",
15729
15982
  { class: "JSON_SUMMARY_ID ml-2" },
15730
- label
15983
+ text_node(label)
15731
15984
  ]);
15732
15985
  return [
15733
15986
  "div",
@@ -15773,7 +16026,7 @@ function leaf_row(key, value, depth) {
15773
16026
  body.push([
15774
16027
  "span",
15775
16028
  { class: "JSON_KEY" },
15776
- String(key)
16029
+ text_node(key)
15777
16030
  ]);
15778
16031
  body.push([
15779
16032
  "span",
@@ -15784,7 +16037,7 @@ function leaf_row(key, value, depth) {
15784
16037
  body.push([
15785
16038
  "span",
15786
16039
  { class: "JSON_VALUE JSON_TYPE_" + type.toUpperCase() },
15787
- text
16040
+ text_node(text)
15788
16041
  ]);
15789
16042
  if (key !== null && is_time_field(String(key))) {
15790
16043
  let wall = format_epoch(value);
@@ -16832,7 +17085,7 @@ function render_diff(gobj) {
16832
17085
  [
16833
17086
  "td",
16834
17087
  { class: "JSON_PAD_DIFF_PATH" },
16835
- row.id
17088
+ text_node(row.id)
16836
17089
  ],
16837
17090
  value_cell("JSON_PAD_DIFF_FROM", row, "from"),
16838
17091
  value_cell("JSON_PAD_DIFF_TO", row, "to")
@@ -18639,7 +18892,7 @@ function render_raw(gobj) {
18639
18892
  let children = [[
18640
18893
  "pre",
18641
18894
  { class: "GCLASS_RAW_BODY" },
18642
- dump.text
18895
+ document.createTextNode(String(dump.text))
18643
18896
  ]];
18644
18897
  if (dump.capped) children.push([
18645
18898
  "div",
@@ -18756,7 +19009,7 @@ function build_head(gobj, model) {
18756
19009
  for (let flag of model.gcflag) items.push([
18757
19010
  "span",
18758
19011
  { class: "GCLASS_CHIP GCLASS_GCFLAG" },
18759
- flag
19012
+ text_node(flag)
18760
19013
  ]);
18761
19014
  let current = gobj_read_str_attr(gobj, "current_state");
18762
19015
  if (current) items.push([
@@ -18919,7 +19172,7 @@ function flag_chips(flags) {
18919
19172
  return [
18920
19173
  "span",
18921
19174
  { class: cls },
18922
- flag
19175
+ text_node(flag)
18923
19176
  ];
18924
19177
  });
18925
19178
  }
@@ -18936,12 +19189,12 @@ function build_attrs(attrs) {
18936
19189
  [
18937
19190
  "td",
18938
19191
  { class: "GCLASS_CELL_KEY" },
18939
- a.id
19192
+ text_node(a.id)
18940
19193
  ],
18941
19194
  [
18942
19195
  "td",
18943
19196
  { class: "GCLASS_CELL_TYPE" },
18944
- a.type
19197
+ text_node(a.type)
18945
19198
  ],
18946
19199
  [
18947
19200
  "td",
@@ -18951,12 +19204,12 @@ function build_attrs(attrs) {
18951
19204
  [
18952
19205
  "td",
18953
19206
  { class: "GCLASS_CELL_DEFAULT" },
18954
- document.createTextNode(String(a.default_value ?? ""))
19207
+ text_node(a.default_value)
18955
19208
  ],
18956
19209
  [
18957
19210
  "td",
18958
19211
  { class: "GCLASS_CELL_DESC" },
18959
- document.createTextNode(String(a.description ?? ""))
19212
+ text_node(a.description)
18960
19213
  ]
18961
19214
  ]
18962
19215
  ];
@@ -19024,7 +19277,7 @@ function build_commands(commands) {
19024
19277
  [[
19025
19278
  "td",
19026
19279
  { colspan: "2" },
19027
- c.label
19280
+ text_node(c.label)
19028
19281
  ]]
19029
19282
  ]);
19030
19283
  continue;
@@ -19032,12 +19285,12 @@ function build_commands(commands) {
19032
19285
  let name_items = [[
19033
19286
  "span",
19034
19287
  { class: "GCLASS_CMD_NAME" },
19035
- c.id
19288
+ text_node(c.id)
19036
19289
  ]];
19037
19290
  for (let alias of c.alias) name_items.push([
19038
19291
  "span",
19039
19292
  { class: "GCLASS_CHIP GCLASS_ALIAS" },
19040
- alias
19293
+ text_node(alias)
19041
19294
  ]);
19042
19295
  name_items = name_items.concat(flag_chips(c.flags));
19043
19296
  rows.push([
@@ -19050,7 +19303,7 @@ function build_commands(commands) {
19050
19303
  ], [
19051
19304
  "td",
19052
19305
  { class: "GCLASS_CELL_DESC" },
19053
- c.description
19306
+ text_node(c.description)
19054
19307
  ]]
19055
19308
  ]);
19056
19309
  for (let p of c.parameters) rows.push([
@@ -19068,18 +19321,18 @@ function build_commands(commands) {
19068
19321
  [
19069
19322
  "span",
19070
19323
  { class: "GCLASS_PARAM_NAME" },
19071
- p.id
19324
+ text_node(p.id)
19072
19325
  ],
19073
19326
  [
19074
19327
  "span",
19075
19328
  { class: "GCLASS_PARAM_TYPE" },
19076
- p.type
19329
+ text_node(p.type)
19077
19330
  ]
19078
19331
  ].concat(flag_chips(p.flags))
19079
19332
  ], [
19080
19333
  "td",
19081
19334
  { class: "GCLASS_CELL_DESC" },
19082
- p.description
19335
+ text_node(p.description)
19083
19336
  ]]
19084
19337
  ]);
19085
19338
  }
@@ -19155,11 +19408,11 @@ function build_traces(levels) {
19155
19408
  [[
19156
19409
  "td",
19157
19410
  { class: "GCLASS_CELL_KEY" },
19158
- l.id
19411
+ text_node(l.id)
19159
19412
  ], [
19160
19413
  "td",
19161
19414
  { class: "GCLASS_CELL_DESC" },
19162
- l.description
19415
+ text_node(l.description)
19163
19416
  ]]
19164
19417
  ];
19165
19418
  })
@@ -19196,7 +19449,7 @@ function build_machine(gobj, fsm) {
19196
19449
  let items = [[
19197
19450
  "span",
19198
19451
  { class: "GCLASS_MX_STATE_NAME" },
19199
- state.name
19452
+ text_node(state.name)
19200
19453
  ]];
19201
19454
  if (state.name === current) cls += " is-current";
19202
19455
  if (unreachable.has(state.name)) {
@@ -19226,7 +19479,7 @@ function build_machine(gobj, fsm) {
19226
19479
  [[
19227
19480
  "span",
19228
19481
  {},
19229
- row.event
19482
+ text_node(row.event)
19230
19483
  ]].concat(event_flag_chips(row.flags))
19231
19484
  ]];
19232
19485
  row.cells.forEach(function(cell, i) {
@@ -19248,7 +19501,7 @@ function build_machine(gobj, fsm) {
19248
19501
  if (cell.action) items.push([
19249
19502
  "span",
19250
19503
  { class: "GCLASS_MX_ACTION" },
19251
- cell.action
19504
+ text_node(cell.action)
19252
19505
  ]);
19253
19506
  else if (cell.has_action) items.push([
19254
19507
  "span",
@@ -19277,7 +19530,7 @@ function build_machine(gobj, fsm) {
19277
19530
  items.push([
19278
19531
  "span",
19279
19532
  { class: "GCLASS_MX_NEXT" },
19280
- cell.next_state
19533
+ text_node(cell.next_state)
19281
19534
  ]);
19282
19535
  }
19283
19536
  cells.push([
@@ -19329,7 +19582,7 @@ function build_machine(gobj, fsm) {
19329
19582
  [[
19330
19583
  "span",
19331
19584
  { class: "GCLASS_CHIP GCLASS_PUB_EVENT" },
19332
- p.event
19585
+ text_node(p.event)
19333
19586
  ]].concat(event_flag_chips(p.flags))
19334
19587
  ];
19335
19588
  })
@@ -19449,7 +19702,7 @@ function event_flag_chips(flags) {
19449
19702
  return [
19450
19703
  "span",
19451
19704
  { class: cls },
19452
- flag.replace("EVF_", "")
19705
+ text_node(flag.replace("EVF_", ""))
19453
19706
  ];
19454
19707
  });
19455
19708
  }
@@ -21242,12 +21495,7 @@ function build_graph$2(gobj) {
21242
21495
  save_view_state(gobj);
21243
21496
  });
21244
21497
  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);
21498
+ gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
21251
21499
  });
21252
21500
  graph.on(CanvasEvent.CLICK, (evt) => {
21253
21501
  hide_popover(gobj);
@@ -21626,14 +21874,18 @@ function restore_view_anchored(gobj, anchor) {
21626
21874
  if (!new_node_id) return;
21627
21875
  if (typeof anchor.zoom === "number" && anchor.zoom > 0) try {
21628
21876
  graph.zoomTo(anchor.zoom);
21629
- } catch (e) {}
21877
+ } catch (e) {
21878
+ log_warning(`${gobj_short_name(gobj)}: zoom not restored: ${e}`);
21879
+ }
21630
21880
  try {
21631
21881
  let canvas_pos = graph.getElementPosition(new_node_id);
21632
21882
  let vp = graph.getViewportByCanvas([canvas_pos[0], canvas_pos[1]]);
21633
21883
  let dx = anchor.viewport_x - vp[0];
21634
21884
  let dy = anchor.viewport_y - vp[1];
21635
21885
  graph.translateBy([dx, dy]);
21636
- } catch (e) {}
21886
+ } catch (e) {
21887
+ log_warning(`${gobj_short_name(gobj)}: anchor node not put back at its screen spot: ${e}`);
21888
+ }
21637
21889
  }
21638
21890
  /************************************************************
21639
21891
  * Capture the current screen position + zoom of a node,
@@ -22264,7 +22516,9 @@ function ac_node_click$3(gobj, event, kw, src) {
22264
22516
  if (!node_data) try {
22265
22517
  let nd = graph.getNodeData(node_id);
22266
22518
  if (nd && nd.data) node_data = nd.data;
22267
- } catch (e) {}
22519
+ } catch (e) {
22520
+ log_warning(`${gobj_short_name(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
22521
+ }
22268
22522
  if (!node_data) return 0;
22269
22523
  if (priv.anchor_state === "arming") {
22270
22524
  priv.anchor_id = node_id;
@@ -22795,7 +23049,7 @@ function card_descriptor(it, show_label) {
22795
23049
  class: "yui-nav-label",
22796
23050
  i18n: label
22797
23051
  },
22798
- label
23052
+ text_node(label)
22799
23053
  ]);
22800
23054
  let a_attrs = {
22801
23055
  class: "yui-nav-item yui-nav-card",
@@ -23161,7 +23415,7 @@ function render_tabs(gobj, items) {
23161
23415
  if (show_label && !empty_string(it.name)) children.push([
23162
23416
  "span",
23163
23417
  { i18n: it.name },
23164
- it.name
23418
+ text_node(it.name)
23165
23419
  ]);
23166
23420
  if (it.closable) children.push([
23167
23421
  "span",
@@ -23261,7 +23515,7 @@ function render_breadcrumb(gobj, items) {
23261
23515
  class: "yui-nav-label",
23262
23516
  i18n: label
23263
23517
  },
23264
- label
23518
+ text_node(label)
23265
23519
  ]);
23266
23520
  }
23267
23521
  let a_attrs = {
@@ -23328,7 +23582,7 @@ function render_backbar(gobj) {
23328
23582
  ], [
23329
23583
  "span",
23330
23584
  label_attrs,
23331
- label
23585
+ text_node(label)
23332
23586
  ]]
23333
23587
  ]
23334
23588
  ]);
@@ -23376,7 +23630,7 @@ function render_submenu(gobj, items) {
23376
23630
  class: "menu-label",
23377
23631
  i18n: nav_label
23378
23632
  } : { class: "menu-label" },
23379
- nav_label || "—"
23633
+ text_node(nav_label || "—")
23380
23634
  ], [
23381
23635
  "ul",
23382
23636
  { class: "menu-list" },
@@ -23413,7 +23667,7 @@ function render_accordion(gobj, items) {
23413
23667
  let $hdr = createElement2([
23414
23668
  "button",
23415
23669
  head_attrs,
23416
- head_text
23670
+ text_node(head_text)
23417
23671
  ]);
23418
23672
  $container.appendChild($hdr);
23419
23673
  let $ul = createElement2(["ul", {
@@ -23453,7 +23707,7 @@ function item_li(gobj, it, opts) {
23453
23707
  [
23454
23708
  "span",
23455
23709
  span_attrs,
23456
- label
23710
+ text_node(label)
23457
23711
  ]
23458
23712
  ];
23459
23713
  }
@@ -23474,7 +23728,7 @@ function item_li(gobj, it, opts) {
23474
23728
  class: "yui-nav-label",
23475
23729
  i18n: label
23476
23730
  },
23477
- label
23731
+ text_node(label)
23478
23732
  ] : null;
23479
23733
  let a_class = "yui-nav-item";
23480
23734
  if (stacked || icon_pos === "top" || icon_pos === "bottom") a_class += " yui-nav-stacked";
@@ -23531,7 +23785,7 @@ function item_iconbar(gobj, it, opts) {
23531
23785
  class: "yui-nav-label is-size-7",
23532
23786
  i18n: label
23533
23787
  },
23534
- label
23788
+ text_node(label)
23535
23789
  ] : null;
23536
23790
  let children = [];
23537
23791
  if (icon_pos === "bottom") {
@@ -23746,12 +24000,12 @@ function render_node(node) {
23746
24000
  class: "ROUTEMAP_NAME",
23747
24001
  i18n: node.label
23748
24002
  },
23749
- node.label
24003
+ text_node(node.label)
23750
24004
  ]);
23751
24005
  if (node.route) row.push([
23752
24006
  "code",
23753
24007
  { class: "ROUTEMAP_ROUTE" },
23754
- node.route
24008
+ text_node(node.route)
23755
24009
  ]);
23756
24010
  if (node.gclass) row.push([
23757
24011
  "span",
@@ -23765,7 +24019,7 @@ function render_node(node) {
23765
24019
  if (node.event) row.push([
23766
24020
  "span",
23767
24021
  { class: "ROUTEMAP_EVENT" },
23768
- node.event
24022
+ text_node(node.event)
23769
24023
  ]);
23770
24024
  if (node.ref) row.push([
23771
24025
  "span",
@@ -24981,7 +25235,7 @@ function build_ui$6(gobj) {
24981
25235
  ], [
24982
25236
  "span",
24983
25237
  { class: "TREEDB_TOPICS_SOURCE_URL" },
24984
- source_url
25238
+ text_node(source_url)
24985
25239
  ]]
24986
25240
  ],
24987
25241
  ...graph_items,
@@ -25152,7 +25406,7 @@ function add_tab(gobj, gobj2, id, text, icon) {
25152
25406
  i18n: text,
25153
25407
  class: ""
25154
25408
  },
25155
- text
25409
+ text_node(text)
25156
25410
  ]));
25157
25411
  refresh_language($a, t);
25158
25412
  $a.addEventListener("click", function(ev) {
@@ -25235,7 +25489,7 @@ function topic_card_meta(desc) {
25235
25489
  title: t("version"),
25236
25490
  "data-i18n-title": "version"
25237
25491
  },
25238
- `v${desc.topic_version}`
25492
+ text_node(`v${desc.topic_version}`)
25239
25493
  ]);
25240
25494
  head.push([
25241
25495
  "span",
@@ -25243,7 +25497,7 @@ function topic_card_meta(desc) {
25243
25497
  [[
25244
25498
  "span",
25245
25499
  {},
25246
- `${n_cols}`
25500
+ text_node(n_cols)
25247
25501
  ], [
25248
25502
  "span",
25249
25503
  { i18n: "columns" },
@@ -25274,7 +25528,7 @@ function topic_card_meta(desc) {
25274
25528
  ], [
25275
25529
  "span",
25276
25530
  { class: "TREEDB_TOPIC_CARD_REL_LIST" },
25277
- list
25531
+ text_node(list)
25278
25532
  ]]
25279
25533
  ]);
25280
25534
  }
@@ -25306,7 +25560,7 @@ function topic_card_meta(desc) {
25306
25560
  [
25307
25561
  "span",
25308
25562
  { class: "TREEDB_TOPIC_CARD_REL_LIST" },
25309
- list
25563
+ text_node(list)
25310
25564
  ]
25311
25565
  ]
25312
25566
  ];
@@ -25349,7 +25603,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25349
25603
  class: "yui-nav-label",
25350
25604
  i18n: text
25351
25605
  },
25352
- text
25606
+ text_node(text)
25353
25607
  ]]
25354
25608
  ]);
25355
25609
  $card.addEventListener("click", function(ev) {
@@ -25378,7 +25632,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25378
25632
  class: "TREEDB_TOPIC_CARD_NAME",
25379
25633
  i18n: text
25380
25634
  },
25381
- text
25635
+ text_node(text)
25382
25636
  ],
25383
25637
  ...topic_card_meta(desc),
25384
25638
  [
@@ -25584,7 +25838,7 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25584
25838
  if (desc.topic_version !== void 0 && desc.topic_version !== null && desc.topic_version !== "") push_meta("version", [
25585
25839
  "span",
25586
25840
  { class: "tag is-info" },
25587
- `${desc.topic_version}`
25841
+ text_node(desc.topic_version)
25588
25842
  ]);
25589
25843
  let sf_names = system_flag_names(desc.system_flag);
25590
25844
  if (sf_names.length > 0) push_meta("system", [
@@ -25595,7 +25849,7 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25595
25849
  if (pkey) push_meta("pkey", [
25596
25850
  "code",
25597
25851
  {},
25598
- pkey
25852
+ text_node(pkey)
25599
25853
  ]);
25600
25854
  if (pkey2s.length > 0) push_meta("pkey2s", [
25601
25855
  "span",
@@ -25603,13 +25857,13 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25603
25857
  pkey2s.map((name) => [
25604
25858
  "span",
25605
25859
  { class: "tag is-warning" },
25606
- name
25860
+ text_node(name)
25607
25861
  ])
25608
25862
  ]);
25609
25863
  push_meta("tkey", tkey ? [
25610
25864
  "code",
25611
25865
  {},
25612
- tkey
25866
+ text_node(tkey)
25613
25867
  ] : [
25614
25868
  "span",
25615
25869
  {
@@ -25639,18 +25893,18 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25639
25893
  [[
25640
25894
  "code",
25641
25895
  is_key ? { class: "has-text-weight-bold" } : {},
25642
- `${col.id}`
25896
+ text_node(col.id)
25643
25897
  ]]
25644
25898
  ],
25645
25899
  [
25646
25900
  "td",
25647
25901
  {},
25648
- `${type}`
25902
+ text_node(type)
25649
25903
  ],
25650
25904
  [
25651
25905
  "td",
25652
25906
  is_key ? { class: "has-text-weight-semibold" } : {},
25653
- `${rel}`
25907
+ text_node(rel)
25654
25908
  ]
25655
25909
  ]
25656
25910
  ]);
@@ -25672,7 +25926,7 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25672
25926
  ], [
25673
25927
  "span",
25674
25928
  { i18n: `${topic}` },
25675
- `${topic}`
25929
+ text_node(topic)
25676
25930
  ]]
25677
25931
  ]]
25678
25932
  ],
@@ -28832,7 +29086,7 @@ function col_title_formatter(gobj, col) {
28832
29086
  return createElement2([
28833
29087
  "span",
28834
29088
  attrs,
28835
- text
29089
+ text_node(text)
28836
29090
  ]);
28837
29091
  };
28838
29092
  }
@@ -29331,7 +29585,7 @@ function file_cell_formatter(cell, formatterParams, onRendered) {
29331
29585
  const children = [["span", { class: "FILE_CELL_ICON icon yi-eye" }], [
29332
29586
  "span",
29333
29587
  { class: "FILE_CELL_ID" },
29334
- yui_file_id_label(ids[0])
29588
+ text_node(yui_file_id_label(ids[0]))
29335
29589
  ]];
29336
29590
  if (ids.length > 1) children.push([
29337
29591
  "span",
@@ -29420,7 +29674,7 @@ function build_json_cell_preview(value) {
29420
29674
  [["span", { class: "JSON_CELL_ICON icon yi-eye" }], [
29421
29675
  "span",
29422
29676
  { class: "JSON_CELL_PREVIEW" },
29423
- text
29677
+ text_node(text)
29424
29678
  ]]
29425
29679
  ]);
29426
29680
  }
@@ -30033,7 +30287,7 @@ function open_cell_file_dialog(gobj, row_id, col_id) {
30033
30287
  [[
30034
30288
  "span",
30035
30289
  { class: "CELL_FILE_ID" },
30036
- id
30290
+ text_node(id)
30037
30291
  ]]
30038
30292
  ]]
30039
30293
  ]));
@@ -30092,7 +30346,7 @@ function fill_cell_file_slot(gobj, pend, answer, error) {
30092
30346
  if (meta) $caption.appendChild(createElement2([
30093
30347
  "span",
30094
30348
  { class: "CELL_FILE_META" },
30095
- meta
30349
+ text_node(meta)
30096
30350
  ]));
30097
30351
  let $open = yui_asset_open_link(answer);
30098
30352
  if ($open) $caption.appendChild($open);
@@ -30169,7 +30423,7 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook) {
30169
30423
  [[
30170
30424
  "span",
30171
30425
  { i18n: tg.topic_name },
30172
- tg.topic_name
30426
+ text_node(tg.topic_name)
30173
30427
  ]],
30174
30428
  { click: () => {
30175
30429
  gobj_send_event(gobj, "EV_CHOOSE_LINKED", {
@@ -30420,8 +30674,8 @@ function transform__form_value_2_treedb_value(gobj, col, value, operation) {
30420
30674
  case "coordinates":
30421
30675
  case "blob": {
30422
30676
  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;
30677
+ if (r.error) log_error(`${gobj_short_name(gobj)}: column '${col.id}' (${field_desc.type}) holds no valid json, handed on as it is`);
30678
+ else value = r.value;
30425
30679
  break;
30426
30680
  }
30427
30681
  case "enum":
@@ -31265,7 +31519,7 @@ function build_delete_question(gobj, records) {
31265
31519
  ], [
31266
31520
  "strong",
31267
31521
  {},
31268
- String(one[pkey])
31522
+ text_node(one[pkey])
31269
31523
  ]]
31270
31524
  ]);
31271
31525
  else lines.push([
@@ -31510,7 +31764,7 @@ function ac_open_columns(gobj, event, kw, src) {
31510
31764
  [$cb, [
31511
31765
  "span",
31512
31766
  { class: "ml-2" },
31513
- column.getDefinition().title || field
31767
+ text_node(column.getDefinition().title || field)
31514
31768
  ]]
31515
31769
  ]));
31516
31770
  }
@@ -60201,6 +60455,34 @@ function ensure_brush_select_owned() {
60201
60455
  __brush_select_registered__ = true;
60202
60456
  }
60203
60457
  //#endregion
60458
+ //#region src/yui_data_color.js
60459
+ /***********************************************************************
60460
+ * yui_data_color.js
60461
+ *
60462
+ * A colour read from DATA, checked before it goes into markup.
60463
+ *
60464
+ * A card of the treedb graph is html, and the colour a user gave it
60465
+ * (a `__graphs__` record) is written into its `style="..."`. A value
60466
+ * like `red" onmouseover="...` would leave the attribute and run.
60467
+ * Only the plain colour syntaxes pass -- hex, the rgb()/hsl()
60468
+ * functions, a name -- and the browser, where it can, also checks
60469
+ * that it is a colour.
60470
+ *
60471
+ * Copyright (c) 2026, ArtGins.
60472
+ * All Rights Reserved.
60473
+ ***********************************************************************/
60474
+ var DATA_COLOR_RE = /^(#[0-9a-f]{3,8}|(rgb|rgba|hsl|hsla)\([0-9.,%\s/+-]+\)|[a-z]+)$/i;
60475
+ /************************************************************
60476
+ * `value` when it is a css colour, else null.
60477
+ ************************************************************/
60478
+ function css_color_or_null(value) {
60479
+ if (typeof value !== "string" || !DATA_COLOR_RE.test(value)) return null;
60480
+ if (typeof CSS !== "undefined" && CSS && typeof CSS.supports === "function") {
60481
+ if (!CSS.supports("color", value)) return null;
60482
+ }
60483
+ return value;
60484
+ }
60485
+ //#endregion
60204
60486
  //#region src/c_g6_nodes_tree.js
60205
60487
  /***********************************************************************
60206
60488
  * c_g6_nodes_tree.js
@@ -60418,6 +60700,7 @@ var attrs_table$4 = [
60418
60700
  SDATA_END()
60419
60701
  ];
60420
60702
  var PRIVATE_DATA$4 = {
60703
+ _drag_unwire: null,
60421
60704
  anchor_id: "",
60422
60705
  anchor_state: "off",
60423
60706
  last_zoom: 1,
@@ -60577,6 +60860,10 @@ function mt_stop$4(gobj) {
60577
60860
  function mt_destroy$4(gobj) {
60578
60861
  let priv = gobj.priv;
60579
60862
  uninstall_fold_listener(gobj);
60863
+ if (priv._drag_unwire) {
60864
+ priv._drag_unwire();
60865
+ priv._drag_unwire = null;
60866
+ }
60580
60867
  if (priv._on_pointerdown_focus) {
60581
60868
  priv.$container.removeEventListener("pointerdown", priv._on_pointerdown_focus, true);
60582
60869
  priv._on_pointerdown_focus = null;
@@ -60732,28 +61019,6 @@ function build_graph$1(gobj) {
60732
61019
  });
60733
61020
  }
60734
61021
  /************************************************************
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
61022
  * Configure G6 event handlers
60758
61023
  ************************************************************/
60759
61024
  function configure_events(gobj) {
@@ -61513,6 +61778,17 @@ function topic_defaults_of(gobj, topic_name) {
61513
61778
  return is_object(topic_props) && is_object(topic_props.defaults) ? topic_props.defaults : null;
61514
61779
  }
61515
61780
  /************************************************************
61781
+ * A colour read from DATA (a `__graphs__` record), or null.
61782
+ * It is written into a card's html (see yui_data_color.js): a
61783
+ * refused value logs, and the node wears the topic's colour.
61784
+ ************************************************************/
61785
+ function data_color(gobj, value) {
61786
+ if (value === void 0 || value === null || value === "") return null;
61787
+ let color = css_color_or_null(value);
61788
+ if (!color) log_warning(`${gobj_short_name(gobj)}: colour refused, not a css colour: ${JSON.stringify(value)}`);
61789
+ return color;
61790
+ }
61791
+ /************************************************************
61516
61792
  * What a node is PAINTED with: its own colours, then the
61517
61793
  * topic's default, then the topic's colour.
61518
61794
  *
@@ -61528,10 +61804,10 @@ function topic_defaults_of(gobj, topic_name) {
61528
61804
  function node_paint_of(gobj, desc, geometry) {
61529
61805
  let defaults = topic_defaults_of(gobj, desc.topic_name);
61530
61806
  let g = is_object(geometry) ? geometry : {};
61531
- let fill = g.fill || defaults && defaults.fill || desc.color;
61807
+ let fill = data_color(gobj, g.fill) || data_color(gobj, defaults && defaults.fill) || desc.color;
61532
61808
  return {
61533
61809
  fill,
61534
- stroke: g.stroke || defaults && defaults.stroke || getStrokeColor(fill),
61810
+ stroke: data_color(gobj, g.stroke) || data_color(gobj, defaults && defaults.stroke) || getStrokeColor(fill),
61535
61811
  lineWidth: g.lineWidth || defaults && defaults.lineWidth || 1
61536
61812
  };
61537
61813
  }
@@ -63490,7 +63766,9 @@ function select_node(gobj, node_id) {
63490
63766
  history_pause(gobj);
63491
63767
  try {
63492
63768
  graph.setElementState(node_id, ["selected"]);
63493
- } catch (e) {}
63769
+ } catch (e) {
63770
+ log_warning(`${gobj_short_name(gobj)}: node state not set: ${e}`);
63771
+ }
63494
63772
  priv._selected_node_id = node_id;
63495
63773
  paint_selection(gobj, [node_id]);
63496
63774
  show_resize_handles(gobj);
@@ -63516,7 +63794,9 @@ function deselect_node(gobj) {
63516
63794
  let states = {};
63517
63795
  for (let id of clearing) states[id] = [];
63518
63796
  graph.setElementState(states);
63519
- } catch (e) {}
63797
+ } catch (e) {
63798
+ log_warning(`${gobj_short_name(gobj)}: node states not cleared: ${e}`);
63799
+ }
63520
63800
  priv._selected_node_id = null;
63521
63801
  paint_selection(gobj, []);
63522
63802
  graph_draw(gobj).then(() => {
@@ -63728,6 +64008,11 @@ function start_node_resize(gobj, e, mx, my) {
63728
64008
  document.addEventListener("pointermove", onPointerMove);
63729
64009
  document.addEventListener("pointerup", onPointerUp);
63730
64010
  document.addEventListener("pointercancel", onPointerCancel);
64011
+ gobj.priv._drag_unwire = function() {
64012
+ document.removeEventListener("pointermove", onPointerMove);
64013
+ document.removeEventListener("pointerup", onPointerUp);
64014
+ document.removeEventListener("pointercancel", onPointerCancel);
64015
+ };
63731
64016
  }
63732
64017
  /************************************************************
63733
64018
  * Port selection and individual port resizing
@@ -64343,6 +64628,11 @@ function start_link_drag(gobj, e) {
64343
64628
  document.addEventListener("pointermove", onPointerMove);
64344
64629
  document.addEventListener("pointerup", onPointerUp);
64345
64630
  document.addEventListener("pointercancel", onPointerCancel);
64631
+ gobj.priv._drag_unwire = function() {
64632
+ document.removeEventListener("pointermove", onPointerMove);
64633
+ document.removeEventListener("pointerup", onPointerUp);
64634
+ document.removeEventListener("pointercancel", onPointerCancel);
64635
+ };
64346
64636
  }
64347
64637
  /************************************************************
64348
64638
  * Find if a canvas point hits a valid hook port during
@@ -64561,6 +64851,11 @@ function start_port_resize(gobj, e) {
64561
64851
  document.addEventListener("pointermove", onPointerMove);
64562
64852
  document.addEventListener("pointerup", onPointerUp);
64563
64853
  document.addEventListener("pointercancel", onPointerCancel);
64854
+ gobj.priv._drag_unwire = function() {
64855
+ document.removeEventListener("pointermove", onPointerMove);
64856
+ document.removeEventListener("pointerup", onPointerUp);
64857
+ document.removeEventListener("pointercancel", onPointerCancel);
64858
+ };
64564
64859
  }
64565
64860
  /************************************************************
64566
64861
  * Edge selection: show a floating properties icon near
@@ -64574,7 +64869,9 @@ function select_edge(gobj, edge_id) {
64574
64869
  history_pause(gobj);
64575
64870
  try {
64576
64871
  graph.setElementState(edge_id, ["selected"]);
64577
- } catch (e) {}
64872
+ } catch (e) {
64873
+ log_warning(`${gobj_short_name(gobj)}: edge state not set: ${e}`);
64874
+ }
64578
64875
  show_edge_icon(gobj);
64579
64876
  graph_draw(gobj).then(() => {
64580
64877
  history_resume(gobj);
@@ -64590,7 +64887,9 @@ function deselect_edge(gobj) {
64590
64887
  history_pause(gobj);
64591
64888
  try {
64592
64889
  graph.setElementState(priv._selected_edge_id, []);
64593
- } catch (e) {}
64890
+ } catch (e) {
64891
+ log_warning(`${gobj_short_name(gobj)}: edge state not cleared: ${e}`);
64892
+ }
64594
64893
  priv._selected_edge_id = null;
64595
64894
  graph_draw(gobj).then(() => {
64596
64895
  history_resume(gobj);
@@ -64680,7 +64979,9 @@ function show_edge_popover(gobj) {
64680
64979
  history_pause(gobj);
64681
64980
  try {
64682
64981
  graph.setElementState(edge_id, []);
64683
- } catch (e) {}
64982
+ } catch (e) {
64983
+ log_warning(`${gobj_short_name(gobj)}: edge state not cleared for the style preview: ${e}`);
64984
+ }
64684
64985
  graph_draw(gobj).then(() => {
64685
64986
  history_resume(gobj);
64686
64987
  });
@@ -72735,6 +73036,7 @@ var JSON_SHORT_ESCAPES = {
72735
73036
  "\f": "f"
72736
73037
  };
72737
73038
  function json_control(ch) {
73039
+ if (ch === "\0") return "\\\\ufffd";
72738
73040
  let short = JSON_SHORT_ESCAPES[ch];
72739
73041
  if (short) return C_BACKSLASH + short;
72740
73042
  return "\\\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0");
@@ -74336,7 +74638,7 @@ function show_notice(gobj, key, detail, detail_is_key) {
74336
74638
  $notice.appendChild(createElement2([
74337
74639
  "span",
74338
74640
  attrs,
74339
- detail_is_key ? t(`${detail}`) : `${detail}`
74641
+ text_node(detail_is_key ? t(`${detail}`) : `${detail}`)
74340
74642
  ]));
74341
74643
  }
74342
74644
  }
@@ -74430,7 +74732,7 @@ function render_toolbar(gobj) {
74430
74732
  $trail.push([
74431
74733
  "span",
74432
74734
  { class: "SCHEMA_CRUMB_TREEDB" },
74433
- priv.treedb_id
74735
+ text_node(priv.treedb_id)
74434
74736
  ]);
74435
74737
  }
74436
74738
  if (priv.topic_name) {
@@ -74442,7 +74744,7 @@ function render_toolbar(gobj) {
74442
74744
  $trail.push([
74443
74745
  "span",
74444
74746
  { class: "SCHEMA_CRUMB_TOPIC" },
74445
- priv.topic_name
74747
+ text_node(priv.topic_name)
74446
74748
  ]);
74447
74749
  }
74448
74750
  if (priv.diagram) {
@@ -74571,7 +74873,7 @@ function open_card(gobj, logical, title, icon, tags, event, kw) {
74571
74873
  ], [
74572
74874
  "span",
74573
74875
  { class: "ml-1" },
74574
- `${tag.text}`
74876
+ text_node(tag.text)
74575
74877
  ]] : `${tag.text}`
74576
74878
  ];
74577
74879
  });
@@ -74598,7 +74900,7 @@ function open_card(gobj, logical, title, icon, tags, event, kw) {
74598
74900
  ], [
74599
74901
  "span",
74600
74902
  { class: `${logical}_NAME has-text-weight-semibold` },
74601
- `${title}`
74903
+ text_node(title)
74602
74904
  ]]
74603
74905
  ], [
74604
74906
  "div",
@@ -74705,7 +75007,7 @@ function render_topics(gobj, $body) {
74705
75007
  [
74706
75008
  "span",
74707
75009
  { class: "has-text-weight-semibold" },
74708
- `${topic.name}`
75010
+ text_node(topic.name)
74709
75011
  ],
74710
75012
  topic.system_topic ? [
74711
75013
  "span",
@@ -74739,7 +75041,7 @@ function render_topics(gobj, $body) {
74739
75041
  [[
74740
75042
  "code",
74741
75043
  {},
74742
- `${topic.id}`
75044
+ text_node(topic.id)
74743
75045
  ]]
74744
75046
  ] : [
74745
75047
  "span",
@@ -74754,13 +75056,13 @@ function render_topics(gobj, $body) {
74754
75056
  [[
74755
75057
  "code",
74756
75058
  {},
74757
- `${topic.pkey || "id"}`
75059
+ text_node(topic.pkey || "id")
74758
75060
  ]]
74759
75061
  ],
74760
75062
  [
74761
75063
  "td",
74762
75064
  { class: "SCHEMA_TOPIC_COLS has-text-right" },
74763
- `${topic.cols.length}`
75065
+ text_node(topic.cols.length)
74764
75066
  ],
74765
75067
  [
74766
75068
  "td",
@@ -74768,7 +75070,7 @@ function render_topics(gobj, $body) {
74768
75070
  [[
74769
75071
  "span",
74770
75072
  { class: `tag ${pending ? "is-warning" : "is-info"} is-light` },
74771
- `${topic.topic_version === void 0 ? "?" : topic.topic_version}`
75073
+ text_node(topic.topic_version === void 0 ? "?" : topic.topic_version)
74772
75074
  ]]
74773
75075
  ],
74774
75076
  [
@@ -75044,7 +75346,7 @@ function column_row(gobj, topic, col, index, readonly, twice) {
75044
75346
  return [
75045
75347
  "span",
75046
75348
  { class: `SCHEMA_COL_FLAG tag ${yui_tint(flag_style(flag))}`.trimEnd() },
75047
- `${flag}`
75349
+ text_node(flag)
75048
75350
  ];
75049
75351
  });
75050
75352
  let link = "";
@@ -75080,7 +75382,7 @@ function column_row(gobj, topic, col, index, readonly, twice) {
75080
75382
  [
75081
75383
  "code",
75082
75384
  {},
75083
- `${col.name}`
75385
+ text_node(col.name)
75084
75386
  ],
75085
75387
  ambiguous ? [
75086
75388
  "span",
@@ -75088,7 +75390,7 @@ function column_row(gobj, topic, col, index, readonly, twice) {
75088
75390
  [[
75089
75391
  "code",
75090
75392
  {},
75091
- `${col.id}`
75393
+ text_node(col.id)
75092
75394
  ]]
75093
75395
  ] : [
75094
75396
  "span",
@@ -75112,7 +75414,7 @@ function column_row(gobj, topic, col, index, readonly, twice) {
75112
75414
  [
75113
75415
  "td",
75114
75416
  { class: "SCHEMA_COL_HEADER" },
75115
- `${record.header || ""}`
75417
+ text_node(record.header || "")
75116
75418
  ],
75117
75419
  [
75118
75420
  "td",
@@ -75120,7 +75422,7 @@ function column_row(gobj, topic, col, index, readonly, twice) {
75120
75422
  [[
75121
75423
  "code",
75122
75424
  {},
75123
- `${record.type || ""}`
75425
+ text_node(record.type || "")
75124
75426
  ]]
75125
75427
  ],
75126
75428
  [
@@ -75138,7 +75440,7 @@ function column_row(gobj, topic, col, index, readonly, twice) {
75138
75440
  [
75139
75441
  "td",
75140
75442
  { class: "SCHEMA_COL_LINK" },
75141
- `${link}`
75443
+ text_node(link)
75142
75444
  ],
75143
75445
  [
75144
75446
  "td",
@@ -75549,7 +75851,7 @@ function flags_field(gobj, type, current) {
75549
75851
  })], [
75550
75852
  "span",
75551
75853
  { class: "SCHEMA_FLAG_NAME ml-1" },
75552
- `${flag.name}`
75854
+ text_node(flag.name)
75553
75855
  ]]
75554
75856
  ];
75555
75857
  });
@@ -75886,12 +76188,12 @@ function open_report(gobj, findings, treedb_id) {
75886
76188
  [
75887
76189
  "td",
75888
76190
  { class: "SCHEMA_REPORT_TOPIC" },
75889
- `${finding.topic || ""}`
76191
+ text_node(finding.topic || "")
75890
76192
  ],
75891
76193
  [
75892
76194
  "td",
75893
76195
  { class: "SCHEMA_REPORT_COL" },
75894
- `${finding.col || ""}`
76196
+ text_node(finding.col || "")
75895
76197
  ],
75896
76198
  [
75897
76199
  "td",
@@ -75899,7 +76201,7 @@ function open_report(gobj, findings, treedb_id) {
75899
76201
  [[
75900
76202
  "code",
75901
76203
  {},
75902
- `${finding.detail || ""}`
76204
+ text_node(finding.detail || "")
75903
76205
  ]]
75904
76206
  ]
75905
76207
  ]
@@ -76335,7 +76637,7 @@ function render_import_plan(gobj, plan) {
76335
76637
  ], [
76336
76638
  "code",
76337
76639
  { class: "ml-2" },
76338
- `${what}`
76640
+ text_node(what)
76339
76641
  ]]
76340
76642
  ];
76341
76643
  });
@@ -76354,7 +76656,7 @@ function render_import_plan(gobj, plan) {
76354
76656
  [
76355
76657
  "span",
76356
76658
  { class: "ml-1" },
76357
- `${plan.writes.length}`
76659
+ text_node(plan.writes.length)
76358
76660
  ],
76359
76661
  [
76360
76662
  "span",
@@ -76367,7 +76669,7 @@ function render_import_plan(gobj, plan) {
76367
76669
  [
76368
76670
  "span",
76369
76671
  { class: "ml-1 has-text-weight-bold" },
76370
- `${deletes.length}`
76672
+ text_node(deletes.length)
76371
76673
  ]
76372
76674
  ]
76373
76675
  ], [
@@ -76409,7 +76711,7 @@ function open_orphans(gobj) {
76409
76711
  [[
76410
76712
  "code",
76411
76713
  {},
76412
- `${entry.id}`
76714
+ text_node(entry.id)
76413
76715
  ]]
76414
76716
  ],
76415
76717
  [
@@ -80288,7 +80590,7 @@ function traffic_scalar_row(key, value) {
80288
80590
  let val_children = [[
80289
80591
  "span",
80290
80592
  { class: "TRAFFIC_VAL " + cls },
80291
- text
80593
+ text_node(text)
80292
80594
  ]];
80293
80595
  if (key in TRAFFIC_TS_FIELDS && typeof value === "number") {
80294
80596
  let iso = traffic_iso(value);
@@ -80310,7 +80612,7 @@ function traffic_scalar_row(key, value) {
80310
80612
  [
80311
80613
  "span",
80312
80614
  { class: "TRAFFIC_KEY" },
80313
- key + ":"
80615
+ text_node(key + ":")
80314
80616
  ],
80315
80617
  [
80316
80618
  "span",
@@ -80405,7 +80707,7 @@ function traffic_value_node(key, value) {
80405
80707
  [
80406
80708
  "span",
80407
80709
  { class: "TRAFFIC_KEY" },
80408
- key + ":"
80710
+ text_node(key + ":")
80409
80711
  ],
80410
80712
  [
80411
80713
  "span",
@@ -80421,7 +80723,7 @@ function traffic_value_node(key, value) {
80421
80723
  ]] : object_preview_parts(value, count).map((t) => [
80422
80724
  "span",
80423
80725
  { class: "TRAFFIC_PREV " + t.cls },
80424
- t.text
80726
+ text_node(t.text)
80425
80727
  ]);
80426
80728
  return [
80427
80729
  "details",
@@ -80438,7 +80740,7 @@ function traffic_value_node(key, value) {
80438
80740
  [
80439
80741
  "span",
80440
80742
  { class: "TRAFFIC_NEST_KEY" },
80441
- key
80743
+ text_node(key)
80442
80744
  ],
80443
80745
  [
80444
80746
  "span",
@@ -80473,17 +80775,17 @@ function event_spans(e) {
80473
80775
  ], [
80474
80776
  "span",
80475
80777
  { class: "TRAFFIC_EVENT" },
80476
- e.event
80778
+ text_node(e.event)
80477
80779
  ]];
80478
80780
  if (e.command) spans.push([
80479
80781
  "span",
80480
80782
  { class: "TRAFFIC_CMD" },
80481
- e.command
80783
+ text_node(e.command)
80482
80784
  ]);
80483
80785
  if (e.title) spans.push([
80484
80786
  "span",
80485
80787
  { class: "TRAFFIC_SRC" },
80486
- e.title
80788
+ text_node(e.title)
80487
80789
  ]);
80488
80790
  return spans;
80489
80791
  }
@@ -80563,7 +80865,7 @@ function render_full(e) {
80563
80865
  ], [
80564
80866
  "pre",
80565
80867
  { class: "TRAFFIC_FULL" },
80566
- text
80868
+ document.createTextNode(String(text))
80567
80869
  ]];
80568
80870
  return createElement2([
80569
80871
  "div",