@yuneta/gobj-ui 7.27.31 → 7.27.33

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.
@@ -5,7 +5,7 @@ import { createJSONEditor } from "vanilla-jsoneditor";
5
5
  import { TabulatorFull } from "tabulator-tables";
6
6
  import * as maplibregl from "maplibre-gl";
7
7
  import uPlot from "uplot";
8
- import { BaseLayout, BrushSelect, CanvasEvent, Circle, CommonEvent, DragCanvas, EdgeEvent, ExtensionCategory, Graph, GraphEvent, HTML, HistoryEvent, NodeEvent, Polyline, Toolbar, ZoomCanvas, register } from "@antv/g6";
8
+ import { BaseLayout, BrushSelect, CanvasEvent, Circle, CommonEvent, DragCanvas, EdgeEvent, ExtensionCategory, Graph, GraphEvent, HTML, HistoryEvent, NodeEvent, Polyline, Toolbar, ZoomCanvas, getExtension, getExtensions, register } from "@antv/g6";
9
9
  //#region \0rolldown/runtime.js
10
10
  var __create = Object.create;
11
11
  var __defProp = Object.defineProperty;
@@ -1097,6 +1097,72 @@ function build_nav_map(input) {
1097
1097
  };
1098
1098
  }
1099
1099
  //#endregion
1100
+ //#region src/yui_selector.js
1101
+ /***********************************************************************
1102
+ * yui_selector.js
1103
+ *
1104
+ * A NAME IS DATA, NOT A SELECTOR.
1105
+ *
1106
+ * A gobj name, a topic, a route, a key: any of them may hold a
1107
+ * character that means something to CSS. Pasted into a selector,
1108
+ * it changes what the selector says or breaks it:
1109
+ *
1110
+ * - `~ + > space` are combinators: `#a~b` is "a b after an #a",
1111
+ * and the lookup answers null;
1112
+ * - `.` `#` `:` `[` start another simple selector: `#a.b` is the
1113
+ * element #a with the class b;
1114
+ * - `%` `^` `"` `\` and the rest make it INVALID: querySelector
1115
+ * THROWS a SyntaxError, out of whatever action was running.
1116
+ *
1117
+ * REV-CLOUD V40.3.1: the gobj tree found its canvas with
1118
+ * `querySelector("#" + id)`, and gui_agent named the window
1119
+ * `node~key` -- every open logged "no canvas mount" and the
1120
+ * canvas never resized; a `^` in the key (`%5E`) threw out of
1121
+ * mt_start and left an orphan window behind it.
1122
+ *
1123
+ * So data reaches a selector in one of two ways only:
1124
+ *
1125
+ * find_by_id($root, id) the element below $root whose id is
1126
+ * `id` -- no selector is built at all.
1127
+ * It works in a tree that is not in the
1128
+ * document yet, where getElementById()
1129
+ * answers null.
1130
+ *
1131
+ * css_string(value) the value written inside a DOUBLE
1132
+ * quoted CSS string, for an attribute
1133
+ * selector:
1134
+ * '[data-x="' + css_string(v) + '"]'
1135
+ *
1136
+ * `CSS.escape()` is not used: it does not exist in node, where the
1137
+ * wiring tests run, and inside a quoted string only the quote, the
1138
+ * backslash and the control characters have to be escaped.
1139
+ *
1140
+ * Copyright (c) 2026, ArtGins.
1141
+ * All Rights Reserved.
1142
+ ***********************************************************************/
1143
+ /************************************************************
1144
+ * The element below `$root` (not `$root` itself, as with
1145
+ * querySelector) whose id is exactly `id`, or null.
1146
+ ************************************************************/
1147
+ function find_by_id($root, id) {
1148
+ if (!$root || typeof $root.querySelectorAll !== "function") return null;
1149
+ if (id === null || id === void 0 || id === "") return null;
1150
+ let wanted = String(id);
1151
+ for (let $el of $root.querySelectorAll("[id]")) if ($el.id === wanted) return $el;
1152
+ return null;
1153
+ }
1154
+ /************************************************************
1155
+ * `value` as the body of a double-quoted CSS string.
1156
+ *
1157
+ * The quote and the backslash take a backslash; a control
1158
+ * character (a newline ends a CSS string, it is a parse
1159
+ * error inside one) is written as its hex escape, which a
1160
+ * space ends so the next character is never read as hex.
1161
+ ************************************************************/
1162
+ function css_string(value) {
1163
+ return String(value).replace(/[\\"]/g, "\\$&").replace(/[\u0000-\u001f\u007f]/g, (c) => "\\" + c.charCodeAt(0).toString(16) + " ");
1164
+ }
1165
+ //#endregion
1100
1166
  //#region src/shell_section_index.js
1101
1167
  /***********************************************************************
1102
1168
  * shell_section_index.js
@@ -4179,7 +4245,7 @@ function yui_shell_set_connection_state(shell_gobj, connected) {
4179
4245
  function yui_shell_set_toolbar_item_icon(shell_gobj, item_id, icon_class) {
4180
4246
  let $container = gobj_read_attr(shell_gobj, "$container");
4181
4247
  if (!$container || empty_string(item_id) || empty_string(icon_class)) return;
4182
- let $i = $container.querySelector(`[data-toolbar-item-id="${item_id}"] .icon i`);
4248
+ let $i = $container.querySelector(`[data-toolbar-item-id="${css_string(item_id)}"] .icon i`);
4183
4249
  if ($i) $i.className = icon_class;
4184
4250
  }
4185
4251
  /************************************************************
@@ -4213,7 +4279,7 @@ function yui_shell_set_toolbar_item_badge(shell_gobj, item_id, value, tone) {
4213
4279
  if (!shell_gobj || !is_gobj(shell_gobj) || empty_string(item_id)) return;
4214
4280
  let $container = gobj_read_attr(shell_gobj, "$container");
4215
4281
  if (!$container) return;
4216
- let $badge = $container.querySelector(`[data-toolbar-item-id="${item_id}"] .yui-toolbar-badge`);
4282
+ let $badge = $container.querySelector(`[data-toolbar-item-id="${css_string(item_id)}"] .yui-toolbar-badge`);
4217
4283
  if (!$badge) return;
4218
4284
  let before = $badge.hasAttribute("hidden") ? "" : $badge.textContent;
4219
4285
  paint_badge($badge, value, tone);
@@ -12578,7 +12644,7 @@ function apply_form_mode(gobj, $form) {
12578
12644
  let mode = gobj_read_str_attr(gobj, "form_mode");
12579
12645
  if (empty_string(mode)) return;
12580
12646
  let pkey = gobj_read_str_attr(gobj, "pkey");
12581
- let $input = $form.querySelector(`[name="${pkey}"]`);
12647
+ let $input = $form.querySelector(`[name="${css_string(pkey)}"]`);
12582
12648
  if (!$input) {
12583
12649
  log_error(sprintf("%s: form_mode '%s' but form has no pkey field '%s'", gobj_short_name(gobj), mode, pkey));
12584
12650
  return;
@@ -13646,7 +13712,7 @@ function template2columns(gobj, columns, template, sub_elements) {
13646
13712
  hozAlign: "center",
13647
13713
  cellClick: function(evt, cell) {
13648
13714
  evt.stopPropagation();
13649
- let $extend = cell.getRow().getElement().querySelector(`[name="${field_desc.name}"]`);
13715
+ let $extend = cell.getRow().getElement().querySelector(`[name="${css_string(field_desc.name)}"]`);
13650
13716
  if (!$extend) {
13651
13717
  log_error(`${gobj_short_name(gobj)}: nested table '${field_desc.name}' not found in its row`);
13652
13718
  return;
@@ -17181,6 +17247,41 @@ function classify_press(press, x, y, t) {
17181
17247
  return "tap";
17182
17248
  }
17183
17249
  //#endregion
17250
+ //#region src/g6_replace_behavior.js
17251
+ /***********************************************************************
17252
+ * g6_replace_behavior.js
17253
+ *
17254
+ * Replace one of G6's built-in behaviors, without a warning on
17255
+ * every page load.
17256
+ *
17257
+ * gobj-ui replaces two built-ins on purpose (`drag-canvas` and
17258
+ * `zoom-canvas`, the touch round of 7.23.9), so that every graph
17259
+ * gets the fix without touching its behaviors list. G6's
17260
+ * `register()` warns whenever a type is registered again --
17261
+ * "The extension drag-canvas of behavior has been registered
17262
+ * before, and will be overridden" -- and its `print` is not
17263
+ * exported, so the warning cannot be muted. It went to the
17264
+ * console of every app that draws a graph, on every load.
17265
+ *
17266
+ * `getExtensions(category)` hands out G6's live registry, so the
17267
+ * replacement is written there. Whether it took is checked with
17268
+ * `getExtension()`: a G6 that hands out a copy one day gets the
17269
+ * replacement through `register()` -- with its warning, which
17270
+ * then says something -- instead of losing it in silence.
17271
+ *
17272
+ * Copyright (c) 2026, ArtGins.
17273
+ * All Rights Reserved.
17274
+ ***********************************************************************/
17275
+ /************************************************************
17276
+ * Make `Ctor` the behavior `type`, replacing the built-in.
17277
+ ************************************************************/
17278
+ function replace_g6_behavior(type, Ctor) {
17279
+ const category = ExtensionCategory.BEHAVIOR;
17280
+ const behaviors = getExtensions(category);
17281
+ if (behaviors && getExtension(category, type)) behaviors[type] = Ctor;
17282
+ if (getExtension(category, type) !== Ctor) register(category, type, Ctor);
17283
+ }
17284
+ //#endregion
17184
17285
  //#region src/g6_touch_gestures.js
17185
17286
  /***********************************************************************
17186
17287
  * g6_touch_gestures.js
@@ -17382,7 +17483,7 @@ var ZoomCanvasPinch = class extends ZoomCanvas {
17382
17483
  var __zoom_canvas_patched__ = false;
17383
17484
  function ensure_pinch_zoom_patch() {
17384
17485
  if (__zoom_canvas_patched__) return;
17385
- register(ExtensionCategory.BEHAVIOR, "zoom-canvas", ZoomCanvasPinch);
17486
+ replace_g6_behavior("zoom-canvas", ZoomCanvasPinch);
17386
17487
  __zoom_canvas_patched__ = true;
17387
17488
  }
17388
17489
  /***************************
@@ -17625,7 +17726,7 @@ var DragCanvasTouch = class extends DragCanvas {
17625
17726
  var __drag_canvas_patched__ = false;
17626
17727
  function ensure_drag_canvas_patch() {
17627
17728
  if (__drag_canvas_patched__) return;
17628
- register(ExtensionCategory.BEHAVIOR, "drag-canvas", DragCanvasTouch);
17729
+ replace_g6_behavior("drag-canvas", DragCanvasTouch);
17629
17730
  __drag_canvas_patched__ = true;
17630
17731
  }
17631
17732
  //#endregion
@@ -18069,7 +18170,7 @@ function build_ui$13(gobj) {
18069
18170
  ]]
18070
18171
  ]);
18071
18172
  gobj_write_attr(gobj, "$container", $container);
18072
- let $mount = $container.querySelector("#" + priv.canvas_id);
18173
+ let $mount = find_by_id($container, priv.canvas_id);
18073
18174
  if ($mount) {
18074
18175
  priv.fold_listener = function(evt) {
18075
18176
  let $handle = evt.target && evt.target.closest ? evt.target.closest("[data-fold-path]") : null;
@@ -18098,7 +18199,7 @@ function destroy_ui$8(gobj) {
18098
18199
  let priv = gobj.priv;
18099
18200
  let $container = gobj_read_attr(gobj, "$container");
18100
18201
  if (priv.fold_listener) {
18101
- let $mount = $container ? $container.querySelector("#" + priv.canvas_id) : null;
18202
+ let $mount = find_by_id($container, priv.canvas_id);
18102
18203
  if ($mount) for (let type of FOLD_SWALLOWED_EVENTS$1) $mount.removeEventListener(type, priv.fold_listener, true);
18103
18204
  priv.fold_listener = null;
18104
18205
  }
@@ -18239,7 +18340,7 @@ function make_toolbar$5(gobj) {
18239
18340
  function canvas_mount$2(gobj) {
18240
18341
  let $container = gobj_read_attr(gobj, "$container");
18241
18342
  if (!$container) return null;
18242
- return $container.querySelector("#" + gobj.priv.canvas_id);
18343
+ return find_by_id($container, gobj.priv.canvas_id);
18243
18344
  }
18244
18345
  /************************************************************
18245
18346
  * Build a G6 graph instance
@@ -19110,7 +19211,7 @@ function paint_anchor_mark$1(gobj) {
19110
19211
  if (!$container) return;
19111
19212
  for (let $card of $container.querySelectorAll(".JSON_CARD_ANCHORED")) $card.classList.remove("JSON_CARD_ANCHORED");
19112
19213
  if (priv.anchor_state !== "on" || !priv.anchor_path) return;
19113
- let $it = $container.querySelector(".JSON_CARD[data-json-path=\"" + CSS.escape(priv.anchor_path) + "\"]");
19214
+ let $it = $container.querySelector(".JSON_CARD[data-json-path=\"" + css_string(priv.anchor_path) + "\"]");
19114
19215
  if ($it) $it.classList.add("JSON_CARD_ANCHORED");
19115
19216
  }
19116
19217
  /************************************************************
@@ -22576,7 +22677,7 @@ function make_toolbar$3(gobj) {
22576
22677
  function canvas_mount$1(gobj) {
22577
22678
  let $container = gobj_read_attr(gobj, "$container");
22578
22679
  if (!$container) return null;
22579
- return $container.querySelector("#" + gobj_read_str_attr(gobj, "canvas_id"));
22680
+ return find_by_id($container, gobj_read_str_attr(gobj, "canvas_id"));
22580
22681
  }
22581
22682
  /************************************************************
22582
22683
  * Build the G6 graph instance.
@@ -52208,12 +52309,13 @@ function yui_graph_minimap_repaint(plugin) {
52208
52309
  * it WANTS and the host answers with the data:
52209
52310
  *
52210
52311
  * out EV_TREE_WANTED {} Refresh pressed
52211
- * in EV_LOAD_TREE {tree} the `view-gobj-tree` answer
52212
- * out EV_TRACE_INFO_WANTED {gclass} a card was opened
52312
+ * in EV_LOAD_TREE {tree, set_id} the `view-gobj-tree` answer
52313
+ * out EV_TRACE_INFO_WANTED {gclass, set_id} a card was opened
52213
52314
  * in EV_TRACE_INFO {gclass, gclass_levels, global_levels,
52214
- * gclass_on, global_on, error}
52315
+ * gclass_on, global_on, error, set_id}
52215
52316
  * out EV_SET_TRACE_LEVEL {scope: "gobj"|"gclass"|"global",
52216
- * gobj, gclass, levels: [...], set}
52317
+ * gobj, gclass, levels: [...], set,
52318
+ * set_id}
52217
52319
  * out EV_GCLASS_WANTED {gclass} the gclass button
52218
52320
  * in EV_GCLASS_DESCRIPTION {gclass, description}
52219
52321
  *
@@ -52223,6 +52325,14 @@ function yui_graph_minimap_repaint(plugin) {
52223
52325
  * trace info of `gclass` again: what the reader is on stays
52224
52326
  * open.
52225
52327
  *
52328
+ * `set_id` (7.27.33) numbers each set. A host that echoes
52329
+ * it says WHICH set an answer follows: the set_id of the
52330
+ * set in the two reads made after it (and in the answer of
52331
+ * a WANTED that carried one), null in any other answer. A
52332
+ * read asked BEFORE a set and answered after it then no
52333
+ * longer unlocks what the set locked. A host that leaves
52334
+ * it out is matched by gclass, as before.
52335
+ *
52226
52336
  * TRACES, in "remote": three scopes, each where it belongs.
52227
52337
  * The kernel's levels (`machine`, `create_delete`...; the
52228
52338
  * table gobj.c calls "global") are valid in all three, a
@@ -52437,6 +52547,9 @@ var PRIVATE_DATA$9 = {
52437
52547
  viewer_awaits: "",
52438
52548
  viewer_stale: "",
52439
52549
  set_in_flight: null,
52550
+ set_serial: 0,
52551
+ pending_set_id: 0,
52552
+ viewer_awaits_set: 0,
52440
52553
  view_refused: false
52441
52554
  };
52442
52555
  var __gclass__$9 = null;
@@ -53168,7 +53281,7 @@ function make_toolbar$1(gobj) {
53168
53281
  function canvas_mount(gobj) {
53169
53282
  let $container = gobj_read_attr(gobj, "$container");
53170
53283
  if (!$container) return null;
53171
- return $container.querySelector("#" + gobj.priv.canvas_id);
53284
+ return find_by_id($container, gobj.priv.canvas_id);
53172
53285
  }
53173
53286
  /************************************************************
53174
53287
  * Build a G6 graph instance
@@ -54642,7 +54755,7 @@ function paint_anchor_mark(gobj) {
54642
54755
  if (!$container) return;
54643
54756
  for (let $card of $container.querySelectorAll(".GOBJ_CARD_ANCHORED")) $card.classList.remove("GOBJ_CARD_ANCHORED");
54644
54757
  if (priv.anchor_state !== "on" || !priv.anchor_name) return;
54645
- let $it = $container.querySelector(".GOBJ_CARD[data-gobj-name=\"" + CSS.escape(priv.anchor_name) + "\"]");
54758
+ let $it = $container.querySelector(".GOBJ_CARD[data-gobj-name=\"" + css_string(priv.anchor_name) + "\"]");
54646
54759
  if ($it) $it.classList.add("GOBJ_CARD_ANCHORED");
54647
54760
  }
54648
54761
  /************************************************************
@@ -54882,7 +54995,7 @@ function ac_load_tree(gobj, event, kw, src) {
54882
54995
  }
54883
54996
  let first = !priv.remote_root;
54884
54997
  priv.remote_root = root;
54885
- priv.trace_pending = false;
54998
+ if (answers_set(kw, priv.pending_set_id)) priv.trace_pending = false;
54886
54999
  reload_keeping_popover(gobj, first ? {} : { preserve_view: true });
54887
55000
  return 0;
54888
55001
  }
@@ -54904,24 +55017,29 @@ function ac_trace_info(gobj, event, kw, src) {
54904
55017
  global_on: list(kw.global_on),
54905
55018
  error: kw.error || ""
54906
55019
  };
54907
- priv.trace_pending = false;
54908
- if (priv.set_in_flight && priv.set_in_flight.gclass === kw.gclass) priv.set_in_flight = null;
55020
+ if (answers_set(kw, priv.pending_set_id)) priv.trace_pending = false;
55021
+ if (priv.set_in_flight && priv.set_in_flight.gclass === kw.gclass && answers_set(kw, priv.set_in_flight.set_id)) priv.set_in_flight = null;
54909
55022
  let d = priv.popover_node;
54910
55023
  let root = priv.remote_root;
54911
55024
  if (priv.popover_mode === "node" && d && d.gclass === kw.gclass || priv.popover_mode === "yuno" && root && root.gclass === kw.gclass) render_current_popover(gobj);
54912
55025
  let viewer = gclass_viewer_gobj(gobj);
54913
55026
  if (viewer) {
54914
55027
  let shown = gobj_read_str_attr(viewer, "gclass_name");
54915
- if (priv.viewer_awaits === kw.gclass) {
55028
+ if (priv.viewer_awaits === kw.gclass && answers_set(kw, priv.viewer_awaits_set)) {
54916
55029
  priv.viewer_awaits = "";
54917
55030
  if (priv.viewer_stale === shown && shown !== kw.gclass) {
55031
+ let set_id = priv.viewer_awaits_set;
54918
55032
  priv.viewer_stale = "";
54919
55033
  priv.viewer_awaits = shown;
54920
55034
  priv.set_in_flight = {
54921
55035
  gclass: shown,
54922
- scope: "gclass"
55036
+ scope: "gclass",
55037
+ set_id
54923
55038
  };
54924
- gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
55039
+ gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", {
55040
+ gclass: shown,
55041
+ set_id
55042
+ });
54925
55043
  }
54926
55044
  }
54927
55045
  if (shown === kw.gclass) gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
@@ -54929,6 +55047,22 @@ function ac_trace_info(gobj, event, kw, src) {
54929
55047
  return 0;
54930
55048
  }
54931
55049
  /************************************************************
55050
+ * Is this answer (EV_LOAD_TREE, EV_TRACE_INFO) the one that
55051
+ * follows the set `set_id`?
55052
+ *
55053
+ * A host that echoes `set_id` says so itself: null for a read
55054
+ * that is no set's, which is a read asked BEFORE the set when
55055
+ * it arrives after it (REV-CLOUD V40.2: the card's own read,
55056
+ * answered after a tick, unlocked the block and showed the
55057
+ * levels before the set, enabled, for one round trip). A host
55058
+ * that leaves it out (before 7.27.33) cannot say: any answer
55059
+ * will do, and the caller matches by gclass.
55060
+ ************************************************************/
55061
+ function answers_set(kw, set_id) {
55062
+ if (!kw || kw.set_id === void 0) return true;
55063
+ return !!set_id && kw.set_id === set_id;
55064
+ }
55065
+ /************************************************************
54932
55066
  * The gclass viewer this view opened, while it is open.
54933
55067
  ************************************************************/
54934
55068
  function gclass_viewer_gobj(gobj) {
@@ -55024,11 +55158,14 @@ function ac_set_gclass_trace(gobj, event, kw, src) {
55024
55158
  }
55025
55159
  function set_trace_levels(gobj, target, scope, levels, set) {
55026
55160
  let priv = gobj.priv;
55161
+ let set_id = ++priv.set_serial;
55027
55162
  priv.trace_pending = true;
55163
+ priv.pending_set_id = set_id;
55028
55164
  render_current_popover(gobj);
55029
55165
  priv.set_in_flight = {
55030
55166
  gclass: target.gclass,
55031
- scope
55167
+ scope,
55168
+ set_id
55032
55169
  };
55033
55170
  let viewer = gclass_viewer_gobj(gobj);
55034
55171
  if (viewer) {
@@ -55040,13 +55177,15 @@ function set_trace_levels(gobj, target, scope, levels, set) {
55040
55177
  gobj: target.full_name || "",
55041
55178
  gclass: target.gclass,
55042
55179
  levels,
55043
- set
55180
+ set,
55181
+ set_id
55044
55182
  });
55045
55183
  }
55046
55184
  function lock_viewer_for_set(gobj, shown, set) {
55047
55185
  let priv = gobj.priv;
55048
55186
  if (!(shown === set.gclass || set.scope === "global")) return false;
55049
55187
  priv.viewer_awaits = set.gclass;
55188
+ priv.viewer_awaits_set = set.set_id;
55050
55189
  priv.viewer_stale = shown !== set.gclass ? shown : "";
55051
55190
  return true;
55052
55191
  }
@@ -55897,7 +56036,7 @@ function apply_active_route(gobj) {
55897
56036
  let $c = gobj_read_attr(gobj, "$container");
55898
56037
  let route = gobj_read_attr(gobj, "active_route") || "";
55899
56038
  if (!$c || empty_string(route)) return;
55900
- let $a = $c.querySelector(`a[data-route="${css_escape(route)}"]`);
56039
+ let $a = $c.querySelector(`a[data-route="${css_string(route)}"]`);
55901
56040
  if ($a) {
55902
56041
  let $li = $a.closest("li");
55903
56042
  if ($li) $li.classList.add("is-active");
@@ -56525,7 +56664,7 @@ function ac_set_item_badge(gobj, event, kw, src) {
56525
56664
  gobj_write_attr(gobj, "badges", badges);
56526
56665
  let $c = gobj_read_attr(gobj, "$container");
56527
56666
  if (!$c) return 0;
56528
- let $badges = $c.querySelectorAll(`[data-item-id="${css_escape(item_id)}"] .NAV_ITEM_BADGE`);
56667
+ let $badges = $c.querySelectorAll(`[data-item-id="${css_string(item_id)}"] .NAV_ITEM_BADGE`);
56529
56668
  for (let $badge of $badges) paint_badge($badge, badge, tone);
56530
56669
  return 0;
56531
56670
  }
@@ -56549,7 +56688,7 @@ function ac_route_changed(gobj, event, kw, src) {
56549
56688
  id_to_mark = parent_item ? parent_item.id : item && item.id;
56550
56689
  } else id_to_mark = item && item.id;
56551
56690
  if (!id_to_mark) return 0;
56552
- let $a = $c.querySelector(`[data-item-id="${css_escape(id_to_mark)}"]`);
56691
+ let $a = $c.querySelector(`[data-item-id="${css_string(id_to_mark)}"]`);
56553
56692
  if ($a) {
56554
56693
  let $li = $a.closest("li");
56555
56694
  if ($li) $li.classList.add("is-active");
@@ -56560,7 +56699,7 @@ function ac_route_changed(gobj, event, kw, src) {
56560
56699
  $c.querySelectorAll(".yui-accordion-head").forEach(($hd) => {
56561
56700
  let $body = $hd.nextElementSibling;
56562
56701
  if (!$body || !$body.classList.contains("yui-accordion-body")) return;
56563
- let contains_active = !!$body.querySelector(`[data-item-id="${css_escape(active_leaf_id)}"]`);
56702
+ let contains_active = !!$body.querySelector(`[data-item-id="${css_string(active_leaf_id)}"]`);
56564
56703
  $body.classList.toggle("is-hidden", !contains_active);
56565
56704
  $hd.classList.toggle("is-open", contains_active);
56566
56705
  $hd.setAttribute("aria-expanded", contains_active ? "true" : "false");
@@ -56568,9 +56707,6 @@ function ac_route_changed(gobj, event, kw, src) {
56568
56707
  }
56569
56708
  return 0;
56570
56709
  }
56571
- function css_escape(s) {
56572
- return String(s).replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
56573
- }
56574
56710
  /***************************************************************
56575
56711
  * FSM
56576
56712
  ***************************************************************/
@@ -59450,7 +59586,7 @@ function ac_show$5(gobj, event, kw, src) {
59450
59586
  }
59451
59587
  let $container = gobj_read_attr(gobj, "$container");
59452
59588
  let $current_item = gobj_read_attr(gobj, "$current_item");
59453
- let $a = $container.querySelector(`a[href="${href}"]`);
59589
+ let $a = $container.querySelector(`a[href="${css_string(href)}"]`);
59454
59590
  if ($a) {
59455
59591
  if ($current_item && $current_item !== $a.parentNode) {
59456
59592
  $current_item.classList.remove("is-active");
@@ -61485,7 +61621,7 @@ function build_ui$5(gobj) {
61485
61621
  [yui_toolbar_icon("yi-magnifying-glass")]
61486
61622
  ]]
61487
61623
  ]);
61488
- let $search_input = $search_box.querySelector(`#${search_id}`);
61624
+ let $search_input = find_by_id($search_box, search_id);
61489
61625
  attach_clear($search_box, $search_input);
61490
61626
  if ($search_input) $search_input.addEventListener("input", (event) => {
61491
61627
  gobj_send_event(gobj, "EV_SEARCH", { text: event.target.value.trim() }, gobj);
@@ -61645,7 +61781,7 @@ function build_ui$5(gobj) {
61645
61781
  });
61646
61782
  gobj_write_attr(gobj, "selection_bar", bar);
61647
61783
  bar.$el.style.flex = "none";
61648
- $container.insertBefore(bar.$el, $container.querySelector(`#${table_id}`));
61784
+ $container.insertBefore(bar.$el, find_by_id($container, table_id));
61649
61785
  }
61650
61786
  let $parent_filter = createElement2([
61651
61787
  "div",
@@ -61690,7 +61826,7 @@ function build_ui$5(gobj) {
61690
61826
  ]
61691
61827
  ]);
61692
61828
  gobj.priv.$parent_filter = $parent_filter;
61693
- $container.insertBefore($parent_filter, $container.querySelector(`#${table_id}`));
61829
+ $container.insertBefore($parent_filter, find_by_id($container, table_id));
61694
61830
  let $toolbar_slot = $container.querySelector(".toolbar_tabulator_table");
61695
61831
  if ($table_toolbar instanceof Element) $toolbar_slot.appendChild($table_toolbar);
61696
61832
  else $toolbar_slot.appendChild(createElement2(["div", {}]));
@@ -62137,7 +62273,7 @@ function create_tabulator(gobj) {
62137
62273
  autoResize: false
62138
62274
  });
62139
62275
  let $view_container = gobj_read_attr(gobj, "$container");
62140
- let $table_el = $view_container ? $view_container.querySelector(`#${table_id}`) : null;
62276
+ let $table_el = $view_container ? find_by_id($view_container, table_id) : null;
62141
62277
  if (!$table_el) {
62142
62278
  log_error(`${gobj_short_name(gobj)}: table element '#${table_id}' not found in $container`);
62143
62279
  return;
@@ -75838,7 +75974,7 @@ function mt_create$3(gobj) {
75838
75974
  if (gobj_read_bool_attr(gobj, "readonly") && priv.operation_mode === "edition") gobj_write_str_attr(gobj, "operation_mode", "reading");
75839
75975
  let canvas_id = clean_name(gobj_name(gobj)) + "-canvas";
75840
75976
  gobj_write_attr(gobj, "canvas_id", canvas_id);
75841
- let $container_canvas = build_ui$3(gobj).querySelector(`#${priv.canvas_id}`);
75977
+ let $container_canvas = find_by_id(build_ui$3(gobj), priv.canvas_id);
75842
75978
  priv.gobj_nodes_tree = gobj_create_service(`${gobj_name(gobj)}-g6`, "C_G6_NODES_TREE", {
75843
75979
  $container: $container_canvas,
75844
75980
  subscriber: gobj,
@@ -78546,6 +78682,7 @@ var __gclass__$2 = null;
78546
78682
  * Framework Methods
78547
78683
  ******************************/
78548
78684
  function mt_create$2(gobj) {
78685
+ ensure_drag_canvas_patch();
78549
78686
  ensure_pinch_zoom_patch();
78550
78687
  build_ui$2(gobj);
78551
78688
  let subscriber = gobj_read_pointer_attr(gobj, "subscriber");
@@ -82889,7 +83026,7 @@ function form_changes(initial, values) {
82889
83026
  function apply_form_changes(gobj, $form, changes) {
82890
83027
  for (let name of Object.keys(changes)) {
82891
83028
  if (name === "flag") continue;
82892
- let $control = $form.querySelector(`[data-name="${name}"]`);
83029
+ let $control = $form.querySelector(`[data-name="${css_string(name)}"]`);
82893
83030
  if (!$control) {
82894
83031
  log_warning(`${gobj_short_name(gobj)}: a change of '${name}' has no field in the form opened again: not put back`);
82895
83032
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.27.31",
3
+ "version": "7.27.33",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -44,6 +44,7 @@
44
44
  "@rollup/plugin-terser": "^1.0.2",
45
45
  "@vitest/coverage-v8": "^5.0.5",
46
46
  "@yuneta/gobj-js": "^7.27.0",
47
+ "jsdom": "^30.1.3",
47
48
  "vite": "^8.3.5",
48
49
  "vitest": "^5.0.5"
49
50
  },
package/src/c_yui_form.js CHANGED
@@ -102,6 +102,7 @@ import {
102
102
  import {form_time_cell_editor} from "./form_time_cell_editor.js";
103
103
  import {yui_tabulator_keep_edit_on_redraw, yui_tabulator_close_editor} from "./yui_tabulator_edit.js";
104
104
  import {safe_locale} from "./yui_date_text.js";
105
+ import {css_string} from "./yui_selector.js";
105
106
  import {parse_json_field, json_editor_value} from "./form_json_field.js";
106
107
  import {
107
108
  json_editor_menu_items,
@@ -1369,7 +1370,7 @@ function apply_form_mode(gobj, $form)
1369
1370
  }
1370
1371
 
1371
1372
  let pkey = gobj_read_str_attr(gobj, "pkey");
1372
- let $input = $form.querySelector(`[name="${pkey}"]`);
1373
+ let $input = $form.querySelector(`[name="${css_string(pkey)}"]`);
1373
1374
  if(!$input) {
1374
1375
  log_error(sprintf("%s: form_mode '%s' but form has no pkey field '%s'",
1375
1376
  gobj_short_name(gobj), mode, pkey
@@ -2720,7 +2721,7 @@ function template2columns(gobj, columns, template, sub_elements)
2720
2721
  cellClick: function(evt, cell) {
2721
2722
  evt.stopPropagation();
2722
2723
  let $row = cell.getRow().getElement();
2723
- let $extend = $row.querySelector(`[name="${field_desc.name}"]`);
2724
+ let $extend = $row.querySelector(`[name="${css_string(field_desc.name)}"]`);
2724
2725
  if(!$extend) {
2725
2726
  log_error(`${gobj_short_name(gobj)}: nested table '${field_desc.name}' not found in its row`);
2726
2727
  return;
@@ -72,6 +72,7 @@ import {yui_is_dark, yui_theme_now, yui_watch_theme} from "./yui_theme.js";
72
72
  import {ensure_drag_canvas_patch} from "./g6_drag_canvas_touch.js";
73
73
  import {ensure_pinch_zoom_patch} from "./g6_touch_gestures.js";
74
74
  import {keep_canvas_tab_order} from "./g6_canvas_tab_order.js";
75
+ import {find_by_id} from "./yui_selector.js";
75
76
 
76
77
  import {t} from "i18next";
77
78
 
@@ -360,7 +361,7 @@ function canvas_mount(gobj)
360
361
  if(!$container) {
361
362
  return null;
362
363
  }
363
- return $container.querySelector("#" + gobj_read_str_attr(gobj, "canvas_id"));
364
+ return find_by_id($container, gobj_read_str_attr(gobj, "canvas_id"));
364
365
  }
365
366
 
366
367
  /************************************************************