@yuneta/gobj-ui 7.26.9 → 7.26.11

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.
@@ -1,4 +1,4 @@
1
- import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_event, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_is_identical, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, sprintf, str_in_list, template_get_field_desc, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
1
+ import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_event, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, html_markup, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_is_identical, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, sprintf, str_in_list, template_get_field_desc, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
2
2
  import i18next, { t } from "i18next";
3
3
  import TomSelect from "tom-select";
4
4
  import { createJSONEditor } from "vanilla-jsoneditor";
@@ -466,6 +466,59 @@ function resolve_route(item_index, route) {
466
466
  };
467
467
  }
468
468
  //#endregion
469
+ //#region src/yui_text.js
470
+ /***********************************************************************
471
+ * yui_text.js
472
+ *
473
+ * DATA as text for createElement2().
474
+ *
475
+ * createElement2() takes a string content that starts with '<' for
476
+ * MARKUP and parses it (that is how a component passes an inline
477
+ * icon). So a value that came from outside -- a backend answer, a
478
+ * treedb node, a name somebody typed, a frame of the traffic -- must
479
+ * never go in as a bare string: "<img src=x onerror=...>" would run.
480
+ * It goes in as a Text node, which is always text.
481
+ *
482
+ * Trimmed like createElement2() trims a string, so the change of
483
+ * form does not change what is shown. A Text node under an
484
+ * `i18n`/`data-i18n` element is still re-translated by
485
+ * refresh_language(), which sets textContent.
486
+ *
487
+ * Copyright (c) 2026, ArtGins.
488
+ * All Rights Reserved.
489
+ ***********************************************************************/
490
+ /************************************************************
491
+ * A Text node with `value` as its text ("" for null/undefined).
492
+ ************************************************************/
493
+ function text_node(value) {
494
+ if (value === null || value === void 0) return document.createTextNode("");
495
+ return document.createTextNode(String(value).trim());
496
+ }
497
+ /************************************************************
498
+ * A Tabulator `titleFormatter` that shows the column title as text.
499
+ *
500
+ * Tabulator puts a STRING title in with innerHTML, so a title taken
501
+ * from a schema (`header`, which the schema editor writes) is markup
502
+ * unless the column carries a formatter that returns a Node.
503
+ ************************************************************/
504
+ function text_title_formatter(cell) {
505
+ return text_node(cell.getValue());
506
+ }
507
+ /************************************************************
508
+ * A Tabulator `itemFormatter` for a `list` editor or header filter
509
+ * that shows each item's label as text.
510
+ *
511
+ * Tabulator appends what an itemFormatter returns only when it is an
512
+ * HTMLElement (a Text node would be innerHTML'd as "[object Text]"),
513
+ * and it puts a bare label in with innerHTML. A label taken from a
514
+ * schema (`enum_list`) is data, so it goes in a span, as text.
515
+ ************************************************************/
516
+ function text_list_item_formatter(label) {
517
+ const span = document.createElement("span");
518
+ span.textContent = label === null || label === void 0 ? "" : String(label);
519
+ return span;
520
+ }
521
+ //#endregion
469
522
  //#region src/route_map_model.js
470
523
  /***********************************************************************
471
524
  * route_map_model.js
@@ -914,6 +967,7 @@ var PRIVATE_DATA$22 = {
914
967
  overlay_stack: [],
915
968
  overlay_seq: 0,
916
969
  expected_pops: 0,
970
+ expected_pop_hash: "",
917
971
  pending_markers: [],
918
972
  popstate_handler: null,
919
973
  avatar_provider: null,
@@ -963,6 +1017,8 @@ function mt_start$20(gobj) {
963
1017
  preinstantiate_eager_views(gobj);
964
1018
  if (gobj_read_attr(gobj, "use_hash")) {
965
1019
  priv.hash_handler = () => {
1020
+ let p = gobj.priv;
1021
+ if (p && p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) drop_expected_pops(gobj);
966
1022
  let route = hash_to_route(window.location.hash);
967
1023
  if (!empty_string(route)) navigate_to(gobj, route);
968
1024
  };
@@ -970,6 +1026,7 @@ function mt_start$20(gobj) {
970
1026
  priv.popstate_handler = (ev) => {
971
1027
  let p = gobj.priv;
972
1028
  if (!p) return;
1029
+ if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) drop_expected_pops(gobj);
973
1030
  if (p.expected_pops > 0) {
974
1031
  p.expected_pops--;
975
1032
  if (p.expected_pops === 0) push_pending_markers(gobj);
@@ -1021,6 +1078,9 @@ function mt_stop$20(gobj) {
1021
1078
  window.removeEventListener("popstate", priv.popstate_handler);
1022
1079
  priv.popstate_handler = null;
1023
1080
  }
1081
+ priv.expected_pops = 0;
1082
+ priv.expected_pop_hash = "";
1083
+ priv.pending_markers = [];
1024
1084
  if (priv.keydown_handler) {
1025
1085
  window.removeEventListener("keydown", priv.keydown_handler);
1026
1086
  priv.keydown_handler = null;
@@ -1824,7 +1884,7 @@ function build_toolbar_action_item(gobj, it) {
1824
1884
  class: "yui-toolbar-item-label",
1825
1885
  i18n: it.name
1826
1886
  },
1827
- it.name
1887
+ text_node(it.name)
1828
1888
  ]);
1829
1889
  let aria_key = it.aria_label || it.name || it.id || "";
1830
1890
  let i18n_aria = it.aria_label || it.name;
@@ -2240,7 +2300,7 @@ function build_dropdown_row(gobj, sub, idx) {
2240
2300
  class: "yui-toolbar-dropdown-label",
2241
2301
  i18n: sub.name
2242
2302
  },
2243
- sub.name
2303
+ text_node(sub.name)
2244
2304
  ]);
2245
2305
  children.push([
2246
2306
  "span",
@@ -2438,6 +2498,14 @@ function push_overlay_marker(gobj, entry) {
2438
2498
  }
2439
2499
  return true;
2440
2500
  }
2501
+ function drop_expected_pops(gobj) {
2502
+ let priv = gobj.priv;
2503
+ if (!priv || priv.expected_pops === 0) return;
2504
+ log_warning(`C_YUI_SHELL: ${priv.expected_pops} history.back() of ours did not land on '${priv.expected_pop_hash}' (now '${window.location.hash}'), dropped`);
2505
+ priv.expected_pops = 0;
2506
+ priv.expected_pop_hash = "";
2507
+ push_pending_markers(gobj);
2508
+ }
2441
2509
  function push_pending_markers(gobj) {
2442
2510
  let priv = gobj.priv;
2443
2511
  let pending = priv.pending_markers.splice(0);
@@ -2459,6 +2527,7 @@ function overlay_dismissed(gobj, entry) {
2459
2527
  let st = window.history.state;
2460
2528
  if (st && st.__yui_overlay__ === entry.id) {
2461
2529
  priv.expected_pops++;
2530
+ priv.expected_pop_hash = window.location.hash;
2462
2531
  try {
2463
2532
  window.history.back();
2464
2533
  } catch (e) {
@@ -3051,45 +3120,6 @@ function yui_shell_close_dropdown(shell_gobj) {
3051
3120
  close_toolbar_dropdown(shell_gobj);
3052
3121
  }
3053
3122
  //#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
3093
3123
  //#region src/shell_modals.js
3094
3124
  /***********************************************************************
3095
3125
  * shell_modals.js
@@ -3735,11 +3765,11 @@ function mt_create$21(gobj) {
3735
3765
  let $c = gobj_read_attr(gobj, "$container");
3736
3766
  if ($c) $c.addEventListener("pointerdown", function() {
3737
3767
  let m = gobj_read_pointer_attr(gobj, "manager");
3738
- if (m) gobj_send_event(m, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
3768
+ if (m) gobj_send_event(m, "EV_FOCUS_WINDOW", { window: gobj_full_name(gobj) }, gobj);
3739
3769
  }, true);
3740
3770
  let chip_title = composed_title(gobj);
3741
3771
  gobj_send_event(manager, "EV_REGISTER_WINDOW", {
3742
- window: gobj,
3772
+ window: gobj_full_name(gobj),
3743
3773
  title: chip_title ? chip_title : gobj_short_name(gobj),
3744
3774
  title_key: gobj_read_str_attr(gobj, "title") || "",
3745
3775
  title_kind_text: empty_string(gobj_read_str_attr(gobj, "title")) ? "" : t(gobj_read_str_attr(gobj, "title")),
@@ -3758,7 +3788,7 @@ function mt_create$21(gobj) {
3758
3788
  ***************************************************************/
3759
3789
  function mt_destroy$21(gobj) {
3760
3790
  let manager = gobj_read_pointer_attr(gobj, "manager");
3761
- if (manager) gobj_send_event(manager, "EV_UNREGISTER_WINDOW", { window: gobj }, gobj);
3791
+ if (manager) gobj_send_event(manager, "EV_UNREGISTER_WINDOW", { window: gobj_full_name(gobj) }, gobj);
3762
3792
  let back_overlay = gobj_read_attr(gobj, "back_overlay");
3763
3793
  if (back_overlay) {
3764
3794
  let shell = yui_shell_of(gobj);
@@ -3855,7 +3885,7 @@ function build_default_header(gobj) {
3855
3885
  if (icon.charAt(0) === "<") items.push([
3856
3886
  "span",
3857
3887
  { class: "icon" },
3858
- icon
3888
+ html_markup(icon)
3859
3889
  ]);
3860
3890
  else items.push([
3861
3891
  "span",
@@ -3926,7 +3956,7 @@ function do_minimize(gobj) {
3926
3956
  log_error(`${gobj_short_name(gobj)}: minimize without a window manager`);
3927
3957
  return;
3928
3958
  }
3929
- gobj_send_event(manager, "EV_MINIMIZE_WINDOW", { window: gobj }, gobj);
3959
+ gobj_send_event(manager, "EV_MINIMIZE_WINDOW", { window: gobj_full_name(gobj) }, gobj);
3930
3960
  }
3931
3961
  /************************************************************
3932
3962
  * Build UI
@@ -4027,7 +4057,7 @@ function build_ui$18(gobj) {
4027
4057
  "data-i18n-aria-label": "minimize",
4028
4058
  style: gobj_read_bool_attr(gobj, "showMin") && gobj_read_pointer_attr(gobj, "manager") ? "" : "display:none;"
4029
4059
  },
4030
- WC_MIN,
4060
+ html_markup(WC_MIN),
4031
4061
  { click: (evt) => {
4032
4062
  evt.stopPropagation();
4033
4063
  do_minimize(gobj);
@@ -4044,7 +4074,7 @@ function build_ui$18(gobj) {
4044
4074
  "data-i18n-aria-label": "maximize",
4045
4075
  style: gobj_read_bool_attr(gobj, "showMax") ? "" : "display:none;"
4046
4076
  },
4047
- WC_MAX,
4077
+ html_markup(WC_MAX),
4048
4078
  { click: (evt) => {
4049
4079
  evt.stopPropagation();
4050
4080
  toggle(gobj);
@@ -4060,7 +4090,7 @@ function build_ui$18(gobj) {
4060
4090
  "aria-label": t("close"),
4061
4091
  "data-i18n-aria-label": "close"
4062
4092
  },
4063
- WC_CLOSE,
4093
+ html_markup(WC_CLOSE),
4064
4094
  { click: (evt) => {
4065
4095
  evt.stopPropagation();
4066
4096
  gobj_send_event(gobj, "EV_CLOSE_WINDOW", {}, gobj);
@@ -4135,7 +4165,7 @@ function build_ui$18(gobj) {
4135
4165
  [[
4136
4166
  "span",
4137
4167
  { style: "display:inline-block;height:1.4em; width:1.4em;" },
4138
- "<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>"
4168
+ html_markup("<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>")
4139
4169
  ]],
4140
4170
  { pointerdown: (evt) => {
4141
4171
  rsStart(gobj, evt);
@@ -4165,7 +4195,7 @@ function build_ui$18(gobj) {
4165
4195
  [[
4166
4196
  "span",
4167
4197
  { style: "display:inline-block;height:1.4em; width:1.4em;" },
4168
- "<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>"
4198
+ html_markup("<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>")
4169
4199
  ]],
4170
4200
  { pointerdown: (evt) => {
4171
4201
  rsStart(gobj, evt);
@@ -4522,7 +4552,7 @@ function ac_refresh$11(gobj, event, kw, src) {
4522
4552
  function ac_show$15(gobj, event, kw, src) {
4523
4553
  let manager = gobj_read_pointer_attr(gobj, "manager");
4524
4554
  if (manager) {
4525
- gobj_send_event(manager, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
4555
+ gobj_send_event(manager, "EV_FOCUS_WINDOW", { window: gobj_full_name(gobj) }, gobj);
4526
4556
  return 0;
4527
4557
  }
4528
4558
  let $container = gobj_read_attr(gobj, "$container");
@@ -4860,7 +4890,7 @@ function chip_lead(icon) {
4860
4890
  if (icon.charAt(0) === "<") return [
4861
4891
  "span",
4862
4892
  { class: "yui-dock-icon" },
4863
- icon
4893
+ html_markup(icon)
4864
4894
  ];
4865
4895
  return [
4866
4896
  "span",
@@ -4869,6 +4899,33 @@ function chip_lead(icon) {
4869
4899
  ];
4870
4900
  }
4871
4901
  /************************************************************
4902
+ * The window an event is about. A kw is plain json (the machine
4903
+ * trace dumps it), so the window travels in it as its FULL NAME,
4904
+ * which the trace can print, and the gobj is the event's src --
4905
+ * every sender is the window itself. Up to 7.26.9 the kw carried
4906
+ * the gobj; that is still taken, with a warning, for this release.
4907
+ ************************************************************/
4908
+ var warned_gobj_in_kw = false;
4909
+ function window_of(gobj, event, kw, src) {
4910
+ let w = kw && kw.window;
4911
+ if (is_gobj(w)) {
4912
+ if (!warned_gobj_in_kw) {
4913
+ warned_gobj_in_kw = true;
4914
+ log_warning(`${gobj_short_name(gobj)}: ${event} carries the window gobj in its kw: send {window: gobj_full_name(window)} from the window`);
4915
+ }
4916
+ if (w !== src) {
4917
+ log_error(`${gobj_short_name(gobj)}: ${event}: window '${gobj_full_name(w)}' is not the src of the event (${is_gobj(src) ? gobj_full_name(src) : String(src)})`);
4918
+ return null;
4919
+ }
4920
+ return w;
4921
+ }
4922
+ if (!is_gobj(src) || gobj_full_name(src) !== w) {
4923
+ log_error(`${gobj_short_name(gobj)}: ${event}: window '${w}' is not the src of the event (${is_gobj(src) ? gobj_full_name(src) : String(src)})`);
4924
+ return null;
4925
+ }
4926
+ return src;
4927
+ }
4928
+ /************************************************************
4872
4929
  * Find a registry entry by its window gobj.
4873
4930
  ************************************************************/
4874
4931
  function find_entry(priv, win) {
@@ -4943,8 +5000,9 @@ function on_chip_click(gobj, entry) {
4943
5000
  ************************************************************/
4944
5001
  function ac_register_window(gobj, event, kw, src) {
4945
5002
  let priv = gobj.priv;
4946
- let win = kw.window;
4947
- if (!win || find_entry(priv, win)) return 0;
5003
+ let win = window_of(gobj, event, kw, src);
5004
+ if (!win) return -1;
5005
+ if (find_entry(priv, win)) return 0;
4948
5006
  apply_placement(gobj);
4949
5007
  let title = kw.title || gobj_name(win) || "window";
4950
5008
  let title_key = kw.title_key || "";
@@ -4999,7 +5057,7 @@ function ac_register_window(gobj, event, kw, src) {
4999
5057
  "aria-label": t("close"),
5000
5058
  "data-i18n-aria-label": "close"
5001
5059
  },
5002
- WC_X,
5060
+ html_markup(WC_X),
5003
5061
  { click: (evt) => {
5004
5062
  evt.stopPropagation();
5005
5063
  gobj_send_event(entry.gobj, "EV_CLOSE_WINDOW", {}, gobj);
@@ -5034,7 +5092,9 @@ function ac_register_window(gobj, event, kw, src) {
5034
5092
  ************************************************************/
5035
5093
  function ac_unregister_window(gobj, event, kw, src) {
5036
5094
  let priv = gobj.priv;
5037
- let entry = find_entry(priv, kw.window);
5095
+ let win = window_of(gobj, event, kw, src);
5096
+ if (!win) return -1;
5097
+ let entry = find_entry(priv, win);
5038
5098
  if (!entry) return 0;
5039
5099
  if (entry.$chip && entry.$chip.parentNode) entry.$chip.parentNode.removeChild(entry.$chip);
5040
5100
  priv.windows = priv.windows.filter((e) => e !== entry);
@@ -5045,7 +5105,9 @@ function ac_unregister_window(gobj, event, kw, src) {
5045
5105
  * EV_MINIMIZE_WINDOW { window }
5046
5106
  ************************************************************/
5047
5107
  function ac_minimize_window(gobj, event, kw, src) {
5048
- let entry = find_entry(gobj.priv, kw.window);
5108
+ let win = window_of(gobj, event, kw, src);
5109
+ if (!win) return -1;
5110
+ let entry = find_entry(gobj.priv, win);
5049
5111
  if (entry) minimize_entry(gobj, entry);
5050
5112
  return 0;
5051
5113
  }
@@ -5053,7 +5115,9 @@ function ac_minimize_window(gobj, event, kw, src) {
5053
5115
  * EV_FOCUS_WINDOW { window }
5054
5116
  ************************************************************/
5055
5117
  function ac_focus_window(gobj, event, kw, src) {
5056
- let entry = find_entry(gobj.priv, kw.window);
5118
+ let win = window_of(gobj, event, kw, src);
5119
+ if (!win) return -1;
5120
+ let entry = find_entry(gobj.priv, win);
5057
5121
  if (entry) focus_entry(gobj, entry);
5058
5122
  return 0;
5059
5123
  }
@@ -8440,7 +8504,7 @@ function toolbar_button$1(gobj, name) {
8440
8504
  [[
8441
8505
  "span",
8442
8506
  { class: "icon m-0" },
8443
- "<i class=\"yi-floppy-disk\"></i>"
8507
+ html_markup("<i class=\"yi-floppy-disk\"></i>")
8444
8508
  ], [
8445
8509
  "span",
8446
8510
  {
@@ -8467,7 +8531,7 @@ function toolbar_button$1(gobj, name) {
8467
8531
  [[
8468
8532
  "span",
8469
8533
  { class: "icon m-0" },
8470
- "<i class=\"yi-arrow-rotate-left\"></i>"
8534
+ html_markup("<i class=\"yi-arrow-rotate-left\"></i>")
8471
8535
  ], [
8472
8536
  "span",
8473
8537
  {
@@ -8493,7 +8557,7 @@ function toolbar_button$1(gobj, name) {
8493
8557
  [[
8494
8558
  "span",
8495
8559
  { class: "icon m-0" },
8496
- "<i class=\"yi-broom-wide\"></i>"
8560
+ html_markup("<i class=\"yi-broom-wide\"></i>")
8497
8561
  ], [
8498
8562
  "span",
8499
8563
  {
@@ -8519,7 +8583,7 @@ function toolbar_button$1(gobj, name) {
8519
8583
  [[
8520
8584
  "span",
8521
8585
  { class: "icon m-0" },
8522
- "<i class=\"yi-copy\"></i>"
8586
+ html_markup("<i class=\"yi-copy\"></i>")
8523
8587
  ], [
8524
8588
  "span",
8525
8589
  {
@@ -8545,7 +8609,7 @@ function toolbar_button$1(gobj, name) {
8545
8609
  [[
8546
8610
  "span",
8547
8611
  { class: "icon m-0" },
8548
- "<i class=\"yi-paste\"></i>"
8612
+ html_markup("<i class=\"yi-paste\"></i>")
8549
8613
  ], [
8550
8614
  "span",
8551
8615
  {
@@ -9317,7 +9381,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9317
9381
  [[
9318
9382
  "span",
9319
9383
  { class: "icon m-0" },
9320
- "<i class=\"yi-plus\"></i>"
9384
+ html_markup("<i class=\"yi-plus\"></i>")
9321
9385
  ], [
9322
9386
  "span",
9323
9387
  {
@@ -9871,7 +9935,7 @@ function create_coordinates(gobj, attrs) {
9871
9935
  ], [
9872
9936
  "span",
9873
9937
  { class: "icon is-left is-clickable" },
9874
- "<i class=\"yi-location-crosshairs\"></i>",
9938
+ html_markup("<i class=\"yi-location-crosshairs\"></i>"),
9875
9939
  { "click": function(evt) {
9876
9940
  evt.stopPropagation();
9877
9941
  getLocation(gobj, this.closest(".control").querySelector("input"));
@@ -10019,7 +10083,7 @@ function template2columns(gobj, columns, template, sub_elements) {
10019
10083
  break;
10020
10084
  case "enum":
10021
10085
  column.editor = "list";
10022
- column.editorParams = {};
10086
+ column.editorParams = { itemFormatter: text_list_item_formatter };
10023
10087
  switch (field_desc.real_type) {
10024
10088
  case "string":
10025
10089
  case "object":
@@ -15920,7 +15984,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15920
15984
  else if (err) children.push([
15921
15985
  "span",
15922
15986
  { class: "JSON_STUB_ERR has-text-danger is-size-7 ml-2" },
15923
- String(err.error)
15987
+ text_node(err.error)
15924
15988
  ]);
15925
15989
  let attrs = {
15926
15990
  class: "JSON_ROW JSON_COLLAPSED" + (is_pending ? " is-pending" : ""),
@@ -18905,7 +18969,7 @@ function render_raw(gobj) {
18905
18969
  if (dump.error) children.push([
18906
18970
  "div",
18907
18971
  { class: "GCLASS_RAW_ERROR has-text-danger is-size-7 p-2" },
18908
- dump.error
18972
+ text_node(dump.error)
18909
18973
  ]);
18910
18974
  let $body = createElement2([
18911
18975
  "div",
@@ -19362,7 +19426,7 @@ function build_methods(model) {
19362
19426
  model.methods.map((m) => [
19363
19427
  "span",
19364
19428
  row_attrs(m, { class: "GCLASS_CHIP GCLASS_METHOD" }),
19365
- m
19429
+ text_node(m)
19366
19430
  ])
19367
19431
  ]);
19368
19432
  if (model.internal_methods.length) {
@@ -19380,7 +19444,7 @@ function build_methods(model) {
19380
19444
  model.internal_methods.map((m) => [
19381
19445
  "span",
19382
19446
  row_attrs(m, { class: "GCLASS_CHIP GCLASS_METHOD" }),
19383
- m
19447
+ text_node(m)
19384
19448
  ])
19385
19449
  ]);
19386
19450
  }
@@ -29160,7 +29224,10 @@ function create_tabulator(gobj) {
29160
29224
  break;
29161
29225
  case "enum":
29162
29226
  colDef.editor = "list";
29163
- colDef.editorParams = { values: field_desc.enum_list || [] };
29227
+ colDef.editorParams = {
29228
+ values: field_desc.enum_list || [],
29229
+ itemFormatter: text_list_item_formatter
29230
+ };
29164
29231
  break;
29165
29232
  case "integer":
29166
29233
  case "real":
@@ -29204,7 +29271,8 @@ function create_tabulator(gobj) {
29204
29271
  colDef.headerFilter = "list";
29205
29272
  colDef.headerFilterParams = {
29206
29273
  values: field_desc.enum_list || [],
29207
- clearable: true
29274
+ clearable: true,
29275
+ itemFormatter: text_list_item_formatter
29208
29276
  };
29209
29277
  break;
29210
29278
  case "fkey":
@@ -29614,7 +29682,7 @@ function icon_formatter(cell) {
29614
29682
  class: "ICON_CELL_UNKNOWN is-size-7 yui-text-quiet",
29615
29683
  title: name
29616
29684
  },
29617
- name
29685
+ text_node(name)
29618
29686
  ]);
29619
29687
  return createElement2(["span", {
29620
29688
  class: `ICON_CELL ${name}`,
@@ -60552,7 +60620,7 @@ var YuiToolbar = class extends Toolbar {
60552
60620
  const disabled = item.disabled ? " disabled" : "";
60553
60621
  const is_text = item.text !== void 0;
60554
60622
  const kind_class = is_text ? " g6-toolbar-item-text" : "";
60555
- const body = is_text ? `<span class="g6-toolbar-text">${item.text}</span>` : `<svg aria-hidden="true" focusable="false"><use xlink:href="#${item.id}"></use></svg>`;
60623
+ const body = is_text ? `<span class="g6-toolbar-text">${escapeHtml(String(item.text))}</span>` : `<svg aria-hidden="true" focusable="false"><use xlink:href="#${item.id}"></use></svg>`;
60556
60624
  return `<div class="g6-toolbar-item${kind_class}${extra_class}" value="${item.value}" title="${title}" aria-label="${title}"${disabled}>${body}</div>`;
60557
60625
  }).join("");
60558
60626
  }
@@ -61782,10 +61850,17 @@ function topic_defaults_of(gobj, topic_name) {
61782
61850
  * It is written into a card's html (see yui_data_color.js): a
61783
61851
  * refused value logs, and the node wears the topic's colour.
61784
61852
  ************************************************************/
61853
+ var refused_colors_logged = /* @__PURE__ */ new Set();
61785
61854
  function data_color(gobj, value) {
61786
61855
  if (value === void 0 || value === null || value === "") return null;
61787
61856
  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)}`);
61857
+ if (!color) {
61858
+ let key = `${gobj_short_name(gobj)}\u0000${String(value)}`;
61859
+ if (!refused_colors_logged.has(key) && refused_colors_logged.size < 200) {
61860
+ refused_colors_logged.add(key);
61861
+ log_warning(`${gobj_short_name(gobj)}: colour refused, not a css colour: ${JSON.stringify(value)}`);
61862
+ }
61863
+ }
61789
61864
  return color;
61790
61865
  }
61791
61866
  /************************************************************
@@ -66269,7 +66344,7 @@ function build_context_menu_items(gobj, e) {
66269
66344
  ************************************************************/
66270
66345
  function ctx_item(icon_id, label, value) {
66271
66346
  return {
66272
- name: `<svg style="width:1em;height:1em;vertical-align:-0.125em;margin-right:8px;pointer-events:none;fill:currentColor"><use href="#${icon_id}"></use></svg>${label}`,
66347
+ name: `<svg style="width:1em;height:1em;vertical-align:-0.125em;margin-right:8px;pointer-events:none;fill:currentColor"><use href="#${icon_id}"></use></svg>${escapeHtml(String(label))}`,
66273
66348
  value
66274
66349
  };
66275
66350
  }
@@ -75732,7 +75807,7 @@ function select_input(name, value, options) {
75732
75807
  value: `${option}`,
75733
75808
  selected: `${option}` === `${value}` ? "selected" : void 0
75734
75809
  }),
75735
- `${option}`
75810
+ text_node(`${option}`)
75736
75811
  ];
75737
75812
  });
75738
75813
  return [
@@ -75754,7 +75829,7 @@ function textarea_input(name, value, rows, placeholder) {
75754
75829
  rows: `${rows || 3}`,
75755
75830
  placeholder: placeholder || ""
75756
75831
  },
75757
- value === void 0 || value === null ? "" : `${value}`
75832
+ text_node(value === void 0 || value === null ? "" : `${value}`)
75758
75833
  ];
75759
75834
  }
75760
75835
  /***************************************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.26.9",
3
+ "version": "7.26.11",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -18,25 +18,30 @@
18
18
  "dist/gobj-ui.cjs.js",
19
19
  "index.js",
20
20
  "src/",
21
- "vite-plugin-yuneta-html.js"
21
+ "vite-plugin-yuneta-html.js",
22
+ "scripts/check-markup-strings.mjs"
22
23
  ],
23
24
  "description": "Yuneta UI Library — the active line: declarative shell (C_YUI_SHELL+NAV+PAGER+WIZARD) + windows, TreeDB views, forms, charts and maps. Consumed from the npm registry by the Yuneta SPAs (gui_agent, gui_treedb, wattyzer, yunovatios). The frozen legacy GClass GUI stack (C_YUI_MAIN/TABS/ROUTING) lives on the v1 branch, npm dist-tag 'legacy' (consumed by estadodelaire and hidraulia).",
24
25
  "scripts": {
25
26
  "build": "vite build",
26
27
  "test": "vitest run",
28
+ "check-markup": "node scripts/check-markup-strings.mjs",
29
+ "prebuild": "npm run check-markup",
30
+ "pretest": "npm run check-markup",
27
31
  "deploy-round": "node scripts/deploy-round.mjs",
28
32
  "prepublishOnly": "npm run build"
29
33
  },
30
34
  "devDependencies": {
31
35
  "@rollup/plugin-terser": "^1.0.0",
32
36
  "@vitest/coverage-v8": "^4.1.10",
33
- "@yuneta/gobj-js": "^7.26.2",
37
+ "@yuneta/gobj-js": "^7.26.3",
38
+ "acorn": "^8.19.0",
34
39
  "vite": "^8.3.3",
35
40
  "vitest": "^4.1.10"
36
41
  },
37
42
  "peerDependencies": {
38
43
  "@antv/g6": "^5.1.0",
39
- "@yuneta/gobj-js": "^7.22.2",
44
+ "@yuneta/gobj-js": "^7.26.3",
40
45
  "bulma": "^1.0.4",
41
46
  "i18next": "^26.3.6",
42
47
  "maplibre-gl": "^6.11.2",