@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.
package/README.md CHANGED
@@ -13,12 +13,17 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
13
13
  > routing contract (URL = source of truth, push/replace history, the
14
14
  > position/preference/transient litmus).
15
15
  >
16
- > **Peer floors today** (`package.json`): `@yuneta/gobj-js` `^7.22.2`,
16
+ > **Peer floors today** (`package.json`): `@yuneta/gobj-js` `^7.26.3`,
17
17
  > `@antv/g6` `^5.1.0`, `bulma` `^1.0.4`, `i18next` `^26.3.6`, `maplibre-gl`
18
18
  > `^6.11.2`, `tabulator-tables` `^6.5.3`, `tom-select` `^2.6.2`, `uplot`
19
19
  > `^1.6.32`, `vanilla-jsoneditor` `^3.13.0`. The notices below say when and why
20
20
  > each floor moved; the list above is what a consumer must meet now.
21
21
  >
22
+ > **BREAKING (7.26.10):** the peer floor of `@yuneta/gobj-js` rose to
23
+ > `^7.26.3`. The library passes its markup through `html_markup()`, which first
24
+ > ships in that gobj-js. A consumer locked on an older gobj-js gets `ERESOLVE`:
25
+ > raise both in the same change. See the CHANGELOG entry.
26
+ >
22
27
  > **BREAKING (7.23.172):** the peer floor of `@yuneta/gobj-js` rose to
23
28
  > `^7.22.0`. The Developer window turns the runtime's trace bits on and off and
24
29
  > never reads a message to decide what to show; it needs the trace API of that
@@ -3322,6 +3327,48 @@ text is in the yunetas `CLAUDE.md` ("JS GUI conventions"); in short:
3322
3327
  columns.push({field: "x", title: header, titleFormatter: text_title_formatter});
3323
3328
  ```
3324
3329
 
3330
+ - **Markup is said out loud: `html_markup()`.** Deliberate markup (an icon,
3331
+ an svg) goes into a description wrapped in `html_markup()` (gobj-js
3332
+ 7.26.3+), never as a bare string, in the content slot or in a list of
3333
+ children:
3334
+
3335
+ ```js
3336
+ import {html_markup} from "@yuneta/gobj-js";
3337
+ createElement2(["span", {class: "icon"}, html_markup('<i class="yi-copy"></i>')]);
3338
+ ```
3339
+
3340
+ This library passes every markup it builds through `html_markup()`, so it
3341
+ renders the same with **`set_strings_are_text(true)`** (gobj-js), the mode in
3342
+ which a plain string is ALWAYS text and a datum that starts with `<` can no
3343
+ longer run. The test-app runs in that mode. An app turns it on at startup,
3344
+ before it builds anything, once its own code is migrated:
3345
+
3346
+ 1. Run the static check on the app's sources, from the published package
3347
+ (7.26.11+ ships the script):
3348
+ `node node_modules/@yuneta/gobj-ui/scripts/check-markup-strings.mjs src`
3349
+ — usually from the app's `prebuild`. It imports `acorn`, which the APP
3350
+ must declare as a devDependency (npm does not install a dependency's
3351
+ devDependencies). It lists a markup string literal in a description
3352
+ (`literal`, wrap it in `html_markup()`), markup built with values
3353
+ (`built`: a template, a `+` or a `.concat()`; build the element with
3354
+ `createElement2()` and pass the value as text), a markup string in a list
3355
+ of children (`in-list`, which is text since gobj-js 7.26.2) and a list of
3356
+ children whose first item is a markup string (`list-head`: such a list is
3357
+ read as one description). A ternary or `||`/`&&` is checked branch by
3358
+ branch. It CANNOT see: a variable or a function result that holds a
3359
+ string; a description built piece by piece (`push()` into the content
3360
+ list); a computed tag with an attrs slot that is not an object literal;
3361
+ markup given to `innerHTML` or to a widget (Tabulator, G6). Step 3 is
3362
+ the check for those.
3363
+ 2. Call `set_strings_are_text(true)` before the first `createElement2()`.
3364
+ 3. Walk the app and read the console: each string that starts with `<` is
3365
+ logged once (*"use html_markup() if it is markup"*). A logged string is
3366
+ either a deliberate markup not migrated yet (wrap it) or a datum that
3367
+ used to run as html (keep it as text).
3368
+
3369
+ `npm run check-markup` runs the check here, and `prebuild` / `pretest` run
3370
+ it, so a new markup literal fails the build.
3371
+
3325
3372
  ### `index.html`: title, metadata and the Content-Security-Policy
3326
3373
 
3327
3374
  The vite plugin `yunetaHtmlPlugin` (`vite-plugin-yuneta-html.js`) fills
@@ -471,6 +471,59 @@ function resolve_route(item_index, route) {
471
471
  };
472
472
  }
473
473
  //#endregion
474
+ //#region src/yui_text.js
475
+ /***********************************************************************
476
+ * yui_text.js
477
+ *
478
+ * DATA as text for createElement2().
479
+ *
480
+ * createElement2() takes a string content that starts with '<' for
481
+ * MARKUP and parses it (that is how a component passes an inline
482
+ * icon). So a value that came from outside -- a backend answer, a
483
+ * treedb node, a name somebody typed, a frame of the traffic -- must
484
+ * never go in as a bare string: "<img src=x onerror=...>" would run.
485
+ * It goes in as a Text node, which is always text.
486
+ *
487
+ * Trimmed like createElement2() trims a string, so the change of
488
+ * form does not change what is shown. A Text node under an
489
+ * `i18n`/`data-i18n` element is still re-translated by
490
+ * refresh_language(), which sets textContent.
491
+ *
492
+ * Copyright (c) 2026, ArtGins.
493
+ * All Rights Reserved.
494
+ ***********************************************************************/
495
+ /************************************************************
496
+ * A Text node with `value` as its text ("" for null/undefined).
497
+ ************************************************************/
498
+ function text_node(value) {
499
+ if (value === null || value === void 0) return document.createTextNode("");
500
+ return document.createTextNode(String(value).trim());
501
+ }
502
+ /************************************************************
503
+ * A Tabulator `titleFormatter` that shows the column title as text.
504
+ *
505
+ * Tabulator puts a STRING title in with innerHTML, so a title taken
506
+ * from a schema (`header`, which the schema editor writes) is markup
507
+ * unless the column carries a formatter that returns a Node.
508
+ ************************************************************/
509
+ function text_title_formatter(cell) {
510
+ return text_node(cell.getValue());
511
+ }
512
+ /************************************************************
513
+ * A Tabulator `itemFormatter` for a `list` editor or header filter
514
+ * that shows each item's label as text.
515
+ *
516
+ * Tabulator appends what an itemFormatter returns only when it is an
517
+ * HTMLElement (a Text node would be innerHTML'd as "[object Text]"),
518
+ * and it puts a bare label in with innerHTML. A label taken from a
519
+ * schema (`enum_list`) is data, so it goes in a span, as text.
520
+ ************************************************************/
521
+ function text_list_item_formatter(label) {
522
+ const span = document.createElement("span");
523
+ span.textContent = label === null || label === void 0 ? "" : String(label);
524
+ return span;
525
+ }
526
+ //#endregion
474
527
  //#region src/route_map_model.js
475
528
  /***********************************************************************
476
529
  * route_map_model.js
@@ -919,6 +972,7 @@ var PRIVATE_DATA$22 = {
919
972
  overlay_stack: [],
920
973
  overlay_seq: 0,
921
974
  expected_pops: 0,
975
+ expected_pop_hash: "",
922
976
  pending_markers: [],
923
977
  popstate_handler: null,
924
978
  avatar_provider: null,
@@ -968,6 +1022,8 @@ function mt_start$20(gobj) {
968
1022
  preinstantiate_eager_views(gobj);
969
1023
  if ((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "use_hash")) {
970
1024
  priv.hash_handler = () => {
1025
+ let p = gobj.priv;
1026
+ if (p && p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) drop_expected_pops(gobj);
971
1027
  let route = hash_to_route(window.location.hash);
972
1028
  if (!(0, _yuneta_gobj_js.empty_string)(route)) navigate_to(gobj, route);
973
1029
  };
@@ -975,6 +1031,7 @@ function mt_start$20(gobj) {
975
1031
  priv.popstate_handler = (ev) => {
976
1032
  let p = gobj.priv;
977
1033
  if (!p) return;
1034
+ if (p.expected_pops > 0 && window.location.hash !== p.expected_pop_hash) drop_expected_pops(gobj);
978
1035
  if (p.expected_pops > 0) {
979
1036
  p.expected_pops--;
980
1037
  if (p.expected_pops === 0) push_pending_markers(gobj);
@@ -1026,6 +1083,9 @@ function mt_stop$20(gobj) {
1026
1083
  window.removeEventListener("popstate", priv.popstate_handler);
1027
1084
  priv.popstate_handler = null;
1028
1085
  }
1086
+ priv.expected_pops = 0;
1087
+ priv.expected_pop_hash = "";
1088
+ priv.pending_markers = [];
1029
1089
  if (priv.keydown_handler) {
1030
1090
  window.removeEventListener("keydown", priv.keydown_handler);
1031
1091
  priv.keydown_handler = null;
@@ -1829,7 +1889,7 @@ function build_toolbar_action_item(gobj, it) {
1829
1889
  class: "yui-toolbar-item-label",
1830
1890
  i18n: it.name
1831
1891
  },
1832
- it.name
1892
+ text_node(it.name)
1833
1893
  ]);
1834
1894
  let aria_key = it.aria_label || it.name || it.id || "";
1835
1895
  let i18n_aria = it.aria_label || it.name;
@@ -2245,7 +2305,7 @@ function build_dropdown_row(gobj, sub, idx) {
2245
2305
  class: "yui-toolbar-dropdown-label",
2246
2306
  i18n: sub.name
2247
2307
  },
2248
- sub.name
2308
+ text_node(sub.name)
2249
2309
  ]);
2250
2310
  children.push([
2251
2311
  "span",
@@ -2443,6 +2503,14 @@ function push_overlay_marker(gobj, entry) {
2443
2503
  }
2444
2504
  return true;
2445
2505
  }
2506
+ function drop_expected_pops(gobj) {
2507
+ let priv = gobj.priv;
2508
+ if (!priv || priv.expected_pops === 0) return;
2509
+ (0, _yuneta_gobj_js.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`);
2510
+ priv.expected_pops = 0;
2511
+ priv.expected_pop_hash = "";
2512
+ push_pending_markers(gobj);
2513
+ }
2446
2514
  function push_pending_markers(gobj) {
2447
2515
  let priv = gobj.priv;
2448
2516
  let pending = priv.pending_markers.splice(0);
@@ -2464,6 +2532,7 @@ function overlay_dismissed(gobj, entry) {
2464
2532
  let st = window.history.state;
2465
2533
  if (st && st.__yui_overlay__ === entry.id) {
2466
2534
  priv.expected_pops++;
2535
+ priv.expected_pop_hash = window.location.hash;
2467
2536
  try {
2468
2537
  window.history.back();
2469
2538
  } catch (e) {
@@ -3056,45 +3125,6 @@ function yui_shell_close_dropdown(shell_gobj) {
3056
3125
  close_toolbar_dropdown(shell_gobj);
3057
3126
  }
3058
3127
  //#endregion
3059
- //#region src/yui_text.js
3060
- /***********************************************************************
3061
- * yui_text.js
3062
- *
3063
- * DATA as text for createElement2().
3064
- *
3065
- * createElement2() takes a string content that starts with '<' for
3066
- * MARKUP and parses it (that is how a component passes an inline
3067
- * icon). So a value that came from outside -- a backend answer, a
3068
- * treedb node, a name somebody typed, a frame of the traffic -- must
3069
- * never go in as a bare string: "<img src=x onerror=...>" would run.
3070
- * It goes in as a Text node, which is always text.
3071
- *
3072
- * Trimmed like createElement2() trims a string, so the change of
3073
- * form does not change what is shown. A Text node under an
3074
- * `i18n`/`data-i18n` element is still re-translated by
3075
- * refresh_language(), which sets textContent.
3076
- *
3077
- * Copyright (c) 2026, ArtGins.
3078
- * All Rights Reserved.
3079
- ***********************************************************************/
3080
- /************************************************************
3081
- * A Text node with `value` as its text ("" for null/undefined).
3082
- ************************************************************/
3083
- function text_node(value) {
3084
- if (value === null || value === void 0) return document.createTextNode("");
3085
- return document.createTextNode(String(value).trim());
3086
- }
3087
- /************************************************************
3088
- * A Tabulator `titleFormatter` that shows the column title as text.
3089
- *
3090
- * Tabulator puts a STRING title in with innerHTML, so a title taken
3091
- * from a schema (`header`, which the schema editor writes) is markup
3092
- * unless the column carries a formatter that returns a Node.
3093
- ************************************************************/
3094
- function text_title_formatter(cell) {
3095
- return text_node(cell.getValue());
3096
- }
3097
- //#endregion
3098
3128
  //#region src/shell_modals.js
3099
3129
  /***********************************************************************
3100
3130
  * shell_modals.js
@@ -3740,11 +3770,11 @@ function mt_create$21(gobj) {
3740
3770
  let $c = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
3741
3771
  if ($c) $c.addEventListener("pointerdown", function() {
3742
3772
  let m = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
3743
- if (m) (0, _yuneta_gobj_js.gobj_send_event)(m, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
3773
+ if (m) (0, _yuneta_gobj_js.gobj_send_event)(m, "EV_FOCUS_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
3744
3774
  }, true);
3745
3775
  let chip_title = composed_title(gobj);
3746
3776
  (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_REGISTER_WINDOW", {
3747
- window: gobj,
3777
+ window: (0, _yuneta_gobj_js.gobj_full_name)(gobj),
3748
3778
  title: chip_title ? chip_title : (0, _yuneta_gobj_js.gobj_short_name)(gobj),
3749
3779
  title_key: (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title") || "",
3750
3780
  title_kind_text: (0, _yuneta_gobj_js.empty_string)((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title")) ? "" : (0, i18next.t)((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title")),
@@ -3763,7 +3793,7 @@ function mt_create$21(gobj) {
3763
3793
  ***************************************************************/
3764
3794
  function mt_destroy$21(gobj) {
3765
3795
  let manager = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
3766
- if (manager) (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_UNREGISTER_WINDOW", { window: gobj }, gobj);
3796
+ if (manager) (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_UNREGISTER_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
3767
3797
  let back_overlay = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "back_overlay");
3768
3798
  if (back_overlay) {
3769
3799
  let shell = yui_shell_of(gobj);
@@ -3860,7 +3890,7 @@ function build_default_header(gobj) {
3860
3890
  if (icon.charAt(0) === "<") items.push([
3861
3891
  "span",
3862
3892
  { class: "icon" },
3863
- icon
3893
+ (0, _yuneta_gobj_js.html_markup)(icon)
3864
3894
  ]);
3865
3895
  else items.push([
3866
3896
  "span",
@@ -3931,7 +3961,7 @@ function do_minimize(gobj) {
3931
3961
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: minimize without a window manager`);
3932
3962
  return;
3933
3963
  }
3934
- (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_MINIMIZE_WINDOW", { window: gobj }, gobj);
3964
+ (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_MINIMIZE_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
3935
3965
  }
3936
3966
  /************************************************************
3937
3967
  * Build UI
@@ -4032,7 +4062,7 @@ function build_ui$18(gobj) {
4032
4062
  "data-i18n-aria-label": "minimize",
4033
4063
  style: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "showMin") && (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager") ? "" : "display:none;"
4034
4064
  },
4035
- WC_MIN,
4065
+ (0, _yuneta_gobj_js.html_markup)(WC_MIN),
4036
4066
  { click: (evt) => {
4037
4067
  evt.stopPropagation();
4038
4068
  do_minimize(gobj);
@@ -4049,7 +4079,7 @@ function build_ui$18(gobj) {
4049
4079
  "data-i18n-aria-label": "maximize",
4050
4080
  style: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "showMax") ? "" : "display:none;"
4051
4081
  },
4052
- WC_MAX,
4082
+ (0, _yuneta_gobj_js.html_markup)(WC_MAX),
4053
4083
  { click: (evt) => {
4054
4084
  evt.stopPropagation();
4055
4085
  toggle(gobj);
@@ -4065,7 +4095,7 @@ function build_ui$18(gobj) {
4065
4095
  "aria-label": (0, i18next.t)("close"),
4066
4096
  "data-i18n-aria-label": "close"
4067
4097
  },
4068
- WC_CLOSE,
4098
+ (0, _yuneta_gobj_js.html_markup)(WC_CLOSE),
4069
4099
  { click: (evt) => {
4070
4100
  evt.stopPropagation();
4071
4101
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CLOSE_WINDOW", {}, gobj);
@@ -4140,7 +4170,7 @@ function build_ui$18(gobj) {
4140
4170
  [[
4141
4171
  "span",
4142
4172
  { style: "display:inline-block;height:1.4em; width:1.4em;" },
4143
- "<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>"
4173
+ (0, _yuneta_gobj_js.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>")
4144
4174
  ]],
4145
4175
  { pointerdown: (evt) => {
4146
4176
  rsStart(gobj, evt);
@@ -4170,7 +4200,7 @@ function build_ui$18(gobj) {
4170
4200
  [[
4171
4201
  "span",
4172
4202
  { style: "display:inline-block;height:1.4em; width:1.4em;" },
4173
- "<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>"
4203
+ (0, _yuneta_gobj_js.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>")
4174
4204
  ]],
4175
4205
  { pointerdown: (evt) => {
4176
4206
  rsStart(gobj, evt);
@@ -4527,7 +4557,7 @@ function ac_refresh$11(gobj, event, kw, src) {
4527
4557
  function ac_show$15(gobj, event, kw, src) {
4528
4558
  let manager = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
4529
4559
  if (manager) {
4530
- (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
4560
+ (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_FOCUS_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
4531
4561
  return 0;
4532
4562
  }
4533
4563
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
@@ -4865,7 +4895,7 @@ function chip_lead(icon) {
4865
4895
  if (icon.charAt(0) === "<") return [
4866
4896
  "span",
4867
4897
  { class: "yui-dock-icon" },
4868
- icon
4898
+ (0, _yuneta_gobj_js.html_markup)(icon)
4869
4899
  ];
4870
4900
  return [
4871
4901
  "span",
@@ -4874,6 +4904,33 @@ function chip_lead(icon) {
4874
4904
  ];
4875
4905
  }
4876
4906
  /************************************************************
4907
+ * The window an event is about. A kw is plain json (the machine
4908
+ * trace dumps it), so the window travels in it as its FULL NAME,
4909
+ * which the trace can print, and the gobj is the event's src --
4910
+ * every sender is the window itself. Up to 7.26.9 the kw carried
4911
+ * the gobj; that is still taken, with a warning, for this release.
4912
+ ************************************************************/
4913
+ var warned_gobj_in_kw = false;
4914
+ function window_of(gobj, event, kw, src) {
4915
+ let w = kw && kw.window;
4916
+ if ((0, _yuneta_gobj_js.is_gobj)(w)) {
4917
+ if (!warned_gobj_in_kw) {
4918
+ warned_gobj_in_kw = true;
4919
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} carries the window gobj in its kw: send {window: gobj_full_name(window)} from the window`);
4920
+ }
4921
+ if (w !== src) {
4922
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event}: window '${(0, _yuneta_gobj_js.gobj_full_name)(w)}' is not the src of the event (${(0, _yuneta_gobj_js.is_gobj)(src) ? (0, _yuneta_gobj_js.gobj_full_name)(src) : String(src)})`);
4923
+ return null;
4924
+ }
4925
+ return w;
4926
+ }
4927
+ if (!(0, _yuneta_gobj_js.is_gobj)(src) || (0, _yuneta_gobj_js.gobj_full_name)(src) !== w) {
4928
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event}: window '${w}' is not the src of the event (${(0, _yuneta_gobj_js.is_gobj)(src) ? (0, _yuneta_gobj_js.gobj_full_name)(src) : String(src)})`);
4929
+ return null;
4930
+ }
4931
+ return src;
4932
+ }
4933
+ /************************************************************
4877
4934
  * Find a registry entry by its window gobj.
4878
4935
  ************************************************************/
4879
4936
  function find_entry(priv, win) {
@@ -4948,8 +5005,9 @@ function on_chip_click(gobj, entry) {
4948
5005
  ************************************************************/
4949
5006
  function ac_register_window(gobj, event, kw, src) {
4950
5007
  let priv = gobj.priv;
4951
- let win = kw.window;
4952
- if (!win || find_entry(priv, win)) return 0;
5008
+ let win = window_of(gobj, event, kw, src);
5009
+ if (!win) return -1;
5010
+ if (find_entry(priv, win)) return 0;
4953
5011
  apply_placement(gobj);
4954
5012
  let title = kw.title || (0, _yuneta_gobj_js.gobj_name)(win) || "window";
4955
5013
  let title_key = kw.title_key || "";
@@ -5004,7 +5062,7 @@ function ac_register_window(gobj, event, kw, src) {
5004
5062
  "aria-label": (0, i18next.t)("close"),
5005
5063
  "data-i18n-aria-label": "close"
5006
5064
  },
5007
- WC_X,
5065
+ (0, _yuneta_gobj_js.html_markup)(WC_X),
5008
5066
  { click: (evt) => {
5009
5067
  evt.stopPropagation();
5010
5068
  (0, _yuneta_gobj_js.gobj_send_event)(entry.gobj, "EV_CLOSE_WINDOW", {}, gobj);
@@ -5039,7 +5097,9 @@ function ac_register_window(gobj, event, kw, src) {
5039
5097
  ************************************************************/
5040
5098
  function ac_unregister_window(gobj, event, kw, src) {
5041
5099
  let priv = gobj.priv;
5042
- let entry = find_entry(priv, kw.window);
5100
+ let win = window_of(gobj, event, kw, src);
5101
+ if (!win) return -1;
5102
+ let entry = find_entry(priv, win);
5043
5103
  if (!entry) return 0;
5044
5104
  if (entry.$chip && entry.$chip.parentNode) entry.$chip.parentNode.removeChild(entry.$chip);
5045
5105
  priv.windows = priv.windows.filter((e) => e !== entry);
@@ -5050,7 +5110,9 @@ function ac_unregister_window(gobj, event, kw, src) {
5050
5110
  * EV_MINIMIZE_WINDOW { window }
5051
5111
  ************************************************************/
5052
5112
  function ac_minimize_window(gobj, event, kw, src) {
5053
- let entry = find_entry(gobj.priv, kw.window);
5113
+ let win = window_of(gobj, event, kw, src);
5114
+ if (!win) return -1;
5115
+ let entry = find_entry(gobj.priv, win);
5054
5116
  if (entry) minimize_entry(gobj, entry);
5055
5117
  return 0;
5056
5118
  }
@@ -5058,7 +5120,9 @@ function ac_minimize_window(gobj, event, kw, src) {
5058
5120
  * EV_FOCUS_WINDOW { window }
5059
5121
  ************************************************************/
5060
5122
  function ac_focus_window(gobj, event, kw, src) {
5061
- let entry = find_entry(gobj.priv, kw.window);
5123
+ let win = window_of(gobj, event, kw, src);
5124
+ if (!win) return -1;
5125
+ let entry = find_entry(gobj.priv, win);
5062
5126
  if (entry) focus_entry(gobj, entry);
5063
5127
  return 0;
5064
5128
  }
@@ -8445,7 +8509,7 @@ function toolbar_button$1(gobj, name) {
8445
8509
  [[
8446
8510
  "span",
8447
8511
  { class: "icon m-0" },
8448
- "<i class=\"yi-floppy-disk\"></i>"
8512
+ (0, _yuneta_gobj_js.html_markup)("<i class=\"yi-floppy-disk\"></i>")
8449
8513
  ], [
8450
8514
  "span",
8451
8515
  {
@@ -8472,7 +8536,7 @@ function toolbar_button$1(gobj, name) {
8472
8536
  [[
8473
8537
  "span",
8474
8538
  { class: "icon m-0" },
8475
- "<i class=\"yi-arrow-rotate-left\"></i>"
8539
+ (0, _yuneta_gobj_js.html_markup)("<i class=\"yi-arrow-rotate-left\"></i>")
8476
8540
  ], [
8477
8541
  "span",
8478
8542
  {
@@ -8498,7 +8562,7 @@ function toolbar_button$1(gobj, name) {
8498
8562
  [[
8499
8563
  "span",
8500
8564
  { class: "icon m-0" },
8501
- "<i class=\"yi-broom-wide\"></i>"
8565
+ (0, _yuneta_gobj_js.html_markup)("<i class=\"yi-broom-wide\"></i>")
8502
8566
  ], [
8503
8567
  "span",
8504
8568
  {
@@ -8524,7 +8588,7 @@ function toolbar_button$1(gobj, name) {
8524
8588
  [[
8525
8589
  "span",
8526
8590
  { class: "icon m-0" },
8527
- "<i class=\"yi-copy\"></i>"
8591
+ (0, _yuneta_gobj_js.html_markup)("<i class=\"yi-copy\"></i>")
8528
8592
  ], [
8529
8593
  "span",
8530
8594
  {
@@ -8550,7 +8614,7 @@ function toolbar_button$1(gobj, name) {
8550
8614
  [[
8551
8615
  "span",
8552
8616
  { class: "icon m-0" },
8553
- "<i class=\"yi-paste\"></i>"
8617
+ (0, _yuneta_gobj_js.html_markup)("<i class=\"yi-paste\"></i>")
8554
8618
  ], [
8555
8619
  "span",
8556
8620
  {
@@ -9322,7 +9386,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9322
9386
  [[
9323
9387
  "span",
9324
9388
  { class: "icon m-0" },
9325
- "<i class=\"yi-plus\"></i>"
9389
+ (0, _yuneta_gobj_js.html_markup)("<i class=\"yi-plus\"></i>")
9326
9390
  ], [
9327
9391
  "span",
9328
9392
  {
@@ -9876,7 +9940,7 @@ function create_coordinates(gobj, attrs) {
9876
9940
  ], [
9877
9941
  "span",
9878
9942
  { class: "icon is-left is-clickable" },
9879
- "<i class=\"yi-location-crosshairs\"></i>",
9943
+ (0, _yuneta_gobj_js.html_markup)("<i class=\"yi-location-crosshairs\"></i>"),
9880
9944
  { "click": function(evt) {
9881
9945
  evt.stopPropagation();
9882
9946
  getLocation(gobj, this.closest(".control").querySelector("input"));
@@ -10024,7 +10088,7 @@ function template2columns(gobj, columns, template, sub_elements) {
10024
10088
  break;
10025
10089
  case "enum":
10026
10090
  column.editor = "list";
10027
- column.editorParams = {};
10091
+ column.editorParams = { itemFormatter: text_list_item_formatter };
10028
10092
  switch (field_desc.real_type) {
10029
10093
  case "string":
10030
10094
  case "object":
@@ -15925,7 +15989,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15925
15989
  else if (err) children.push([
15926
15990
  "span",
15927
15991
  { class: "JSON_STUB_ERR has-text-danger is-size-7 ml-2" },
15928
- String(err.error)
15992
+ text_node(err.error)
15929
15993
  ]);
15930
15994
  let attrs = {
15931
15995
  class: "JSON_ROW JSON_COLLAPSED" + (is_pending ? " is-pending" : ""),
@@ -18910,7 +18974,7 @@ function render_raw(gobj) {
18910
18974
  if (dump.error) children.push([
18911
18975
  "div",
18912
18976
  { class: "GCLASS_RAW_ERROR has-text-danger is-size-7 p-2" },
18913
- dump.error
18977
+ text_node(dump.error)
18914
18978
  ]);
18915
18979
  let $body = (0, _yuneta_gobj_js.createElement2)([
18916
18980
  "div",
@@ -19367,7 +19431,7 @@ function build_methods(model) {
19367
19431
  model.methods.map((m) => [
19368
19432
  "span",
19369
19433
  row_attrs(m, { class: "GCLASS_CHIP GCLASS_METHOD" }),
19370
- m
19434
+ text_node(m)
19371
19435
  ])
19372
19436
  ]);
19373
19437
  if (model.internal_methods.length) {
@@ -19385,7 +19449,7 @@ function build_methods(model) {
19385
19449
  model.internal_methods.map((m) => [
19386
19450
  "span",
19387
19451
  row_attrs(m, { class: "GCLASS_CHIP GCLASS_METHOD" }),
19388
- m
19452
+ text_node(m)
19389
19453
  ])
19390
19454
  ]);
19391
19455
  }
@@ -29165,7 +29229,10 @@ function create_tabulator(gobj) {
29165
29229
  break;
29166
29230
  case "enum":
29167
29231
  colDef.editor = "list";
29168
- colDef.editorParams = { values: field_desc.enum_list || [] };
29232
+ colDef.editorParams = {
29233
+ values: field_desc.enum_list || [],
29234
+ itemFormatter: text_list_item_formatter
29235
+ };
29169
29236
  break;
29170
29237
  case "integer":
29171
29238
  case "real":
@@ -29209,7 +29276,8 @@ function create_tabulator(gobj) {
29209
29276
  colDef.headerFilter = "list";
29210
29277
  colDef.headerFilterParams = {
29211
29278
  values: field_desc.enum_list || [],
29212
- clearable: true
29279
+ clearable: true,
29280
+ itemFormatter: text_list_item_formatter
29213
29281
  };
29214
29282
  break;
29215
29283
  case "fkey":
@@ -29619,7 +29687,7 @@ function icon_formatter(cell) {
29619
29687
  class: "ICON_CELL_UNKNOWN is-size-7 yui-text-quiet",
29620
29688
  title: name
29621
29689
  },
29622
- name
29690
+ text_node(name)
29623
29691
  ]);
29624
29692
  return (0, _yuneta_gobj_js.createElement2)(["span", {
29625
29693
  class: `ICON_CELL ${name}`,
@@ -60557,7 +60625,7 @@ var YuiToolbar = class extends _antv_g6.Toolbar {
60557
60625
  const disabled = item.disabled ? " disabled" : "";
60558
60626
  const is_text = item.text !== void 0;
60559
60627
  const kind_class = is_text ? " g6-toolbar-item-text" : "";
60560
- 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>`;
60628
+ const body = is_text ? `<span class="g6-toolbar-text">${(0, _yuneta_gobj_js.escapeHtml)(String(item.text))}</span>` : `<svg aria-hidden="true" focusable="false"><use xlink:href="#${item.id}"></use></svg>`;
60561
60629
  return `<div class="g6-toolbar-item${kind_class}${extra_class}" value="${item.value}" title="${title}" aria-label="${title}"${disabled}>${body}</div>`;
60562
60630
  }).join("");
60563
60631
  }
@@ -61787,10 +61855,17 @@ function topic_defaults_of(gobj, topic_name) {
61787
61855
  * It is written into a card's html (see yui_data_color.js): a
61788
61856
  * refused value logs, and the node wears the topic's colour.
61789
61857
  ************************************************************/
61858
+ var refused_colors_logged = /* @__PURE__ */ new Set();
61790
61859
  function data_color(gobj, value) {
61791
61860
  if (value === void 0 || value === null || value === "") return null;
61792
61861
  let color = css_color_or_null(value);
61793
- if (!color) (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: colour refused, not a css colour: ${JSON.stringify(value)}`);
61862
+ if (!color) {
61863
+ let key = `${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}\u0000${String(value)}`;
61864
+ if (!refused_colors_logged.has(key) && refused_colors_logged.size < 200) {
61865
+ refused_colors_logged.add(key);
61866
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: colour refused, not a css colour: ${JSON.stringify(value)}`);
61867
+ }
61868
+ }
61794
61869
  return color;
61795
61870
  }
61796
61871
  /************************************************************
@@ -66274,7 +66349,7 @@ function build_context_menu_items(gobj, e) {
66274
66349
  ************************************************************/
66275
66350
  function ctx_item(icon_id, label, value) {
66276
66351
  return {
66277
- 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}`,
66352
+ 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>${(0, _yuneta_gobj_js.escapeHtml)(String(label))}`,
66278
66353
  value
66279
66354
  };
66280
66355
  }
@@ -75737,7 +75812,7 @@ function select_input(name, value, options) {
75737
75812
  value: `${option}`,
75738
75813
  selected: `${option}` === `${value}` ? "selected" : void 0
75739
75814
  }),
75740
- `${option}`
75815
+ text_node(`${option}`)
75741
75816
  ];
75742
75817
  });
75743
75818
  return [
@@ -75759,7 +75834,7 @@ function textarea_input(name, value, rows, placeholder) {
75759
75834
  rows: `${rows || 3}`,
75760
75835
  placeholder: placeholder || ""
75761
75836
  },
75762
- value === void 0 || value === null ? "" : `${value}`
75837
+ text_node(value === void 0 || value === null ? "" : `${value}`)
75763
75838
  ];
75764
75839
  }
75765
75840
  /***************************************************************