@yuneta/gobj-ui 7.27.29 → 7.27.31

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
@@ -609,8 +609,11 @@ active child is the one already hanging in its body.
609
609
  **A content shown again is told so** (7.27.21+). A node keeps the content it
610
610
  built, as the shell keeps a `keep_alive` view, so a content that reads its data
611
611
  only when it is created declares `EV_VIEW_SHOWN` and reads it again there: the
612
- node sends it when it comes back to that content, and forwards the shell's down
613
- its path when the whole tree is shown again (SHELL.md §4).
612
+ node sends it, with kw `{route}`, when it comes back to that content. That also
613
+ covers the whole tree shown again by the shell, because every node on the path
614
+ comes back with the shell's route change, so the node itself does not declare
615
+ `EV_VIEW_SHOWN` and the shell does not tell the tree a second time (7.27.30+).
616
+ Once per showing (SHELL.md §4).
614
617
 
615
618
  **The tree is a contract, not runtime state.** Once published, a node's path
616
619
  is a url a client may have bookmarked, scripted, or been sold as another door
@@ -3784,6 +3787,21 @@ if(update_watch) {
3784
3787
  `document.body` when there is no shell. It follows the shell across a logout.
3785
3788
  The ✕ hides it for that build only, and a later deploy shows it again. A
3786
3789
  rollback to the running build takes it away.
3790
+ - **Its language** follows the live shell's `EV_LANGUAGE_CHANGED`
3791
+ (`yui_shell_language_changed()`). On the login there is no shell to publish
3792
+ it, so the app's login language switch calls
3793
+ **`yui_update_watch_language_changed()`** after switching its i18next
3794
+ (7.27.30+). It sends `EV_LANGUAGE_CHANGED` to every live watch, so the bar
3795
+ is re-translated through the watch's FSM. With a shell up too, the second
3796
+ refresh is harmless:
3797
+
3798
+ ```js
3799
+ import {yui_update_watch_language_changed} from "@yuneta/gobj-ui/src/c_yui_update_watch.js";
3800
+
3801
+ // the login's language button, after switching the i18next language:
3802
+ switch_locale(locale);
3803
+ yui_update_watch_language_changed(); // or (gobj), the gobj that switched
3804
+ ```
3787
3805
  - **Attributes**: `min_interval_ms`, `period_ms` (0 = off), `with_bar`
3788
3806
  (false: no bar, the app listens to `EV_NEW_BUILD`), `$parent`, and
3789
3807
  `before_reload`, a function that can veto the reload when there are unsaved
@@ -4431,7 +4449,12 @@ its third number, in the same edit), installs, builds, deploys
4431
4449
  and reads back the bundle each host serves (`--check` only reads back,
4432
4450
  `--only <name>` does one app, `--no-wait` skips the registry). The private
4433
4451
  consumers are listed in `~/.yuneta/gobj-ui-consumers.json` (see
4434
- `scripts/gobj-ui-consumers.example.json`); the demo (`test-app/`) is built in.
4452
+ `scripts/gobj-ui-consumers.example.json`). The round commits nothing: each
4453
+ app's commit carries its `package.json` and the `package-lock.json` the
4454
+ install rewrote (every app commits its lockfile, and a fresh checkout installs
4455
+ with `npm ci`). The demo is the one exception (below).
4456
+
4457
+ The demo (`test-app/`) is built in.
4435
4458
  It is built from the working trees of this repo and of the sibling `gobj-js`
4436
4459
  (`test-app/vite.config.js` bundles `../../gobj-js/src`), so it goes out only
4437
4460
  when each is a clean tree of its own (untracked files count; a copy with no
@@ -4439,7 +4462,11 @@ when each is a clean tree of its own (untracked files count; a copy with no
4439
4462
  holds on the remote; otherwise it is `NOT DEPLOYED`, with the reason, and the
4440
4463
  round exits 1 (since `7.26.55`, the sibling `gobj-js` since `7.26.57`; up to
4441
4464
  `7.26.54` any copy of the repo, on any commit, deployed the public demo). The
4442
- demo's target is named `test-app` (`--only test-app`).
4465
+ demo's target is named `test-app` (`--only test-app`). The round does not
4466
+ install it, and its `package-lock.json` is not in git, on purpose
4467
+ (`test-app/.gitignore` lists it): its two Yuneta dependencies are `file:`
4468
+ links to those working trees, which a lockfile cannot pin, and the lockfile
4469
+ would change with every version of gobj-ui or gobj-js.
4443
4470
 
4444
4471
  An app whose range cannot be raised safely is refused and left as it was --
4445
4472
  every package.json of it, since all are checked before any is written: a
@@ -7090,6 +7090,13 @@ function build_page_url(loc) {
7090
7090
  * next login) in document.body. It follows the shell across a
7091
7091
  * logout (yui_shell_watch_changes()), as the dock does.
7092
7092
  *
7093
+ * Its language: it hears the live shell's EV_LANGUAGE_CHANGED
7094
+ * (yui_shell_language_changed()). With NO shell there is nobody
7095
+ * to publish that, so an app whose login switches language
7096
+ * calls yui_update_watch_language_changed() after switching its
7097
+ * i18next -- it sends EV_LANGUAGE_CHANGED to every live watch.
7098
+ * Calling it with a shell up too is harmless.
7099
+ *
7093
7100
  * Usage (an app, once, after creating the yuno):
7094
7101
  *
7095
7102
  * register_c_yui_update_watch();
@@ -7101,12 +7108,21 @@ function build_page_url(loc) {
7101
7108
  * // on its backend's EV_ON_OPEN:
7102
7109
  * gobj_send_event(watch, "EV_CHECK_BUILD", {}, gobj);
7103
7110
  *
7111
+ * // the login's language switch (no shell yet):
7112
+ * switch_locale(locale);
7113
+ * yui_update_watch_language_changed();
7114
+ *
7104
7115
  * Input events:
7105
7116
  * EV_CHECK_BUILD {force?} ask the server (force skips
7106
7117
  * the minimum interval)
7107
7118
  * EV_RELOAD {} the bar's reload button
7108
7119
  * EV_DISMISS {} the bar's ✕: hidden for THIS
7109
7120
  * build, a later one shows it
7121
+ * EV_LANGUAGE_CHANGED {} the app's language changed:
7122
+ * the bar is re-translated
7123
+ * (the live shell publishes it;
7124
+ * with no shell,
7125
+ * yui_update_watch_language_changed())
7110
7126
  *
7111
7127
  * Output events (optional subscribers):
7112
7128
  * EV_NEW_BUILD {running, deployed, version}
@@ -7145,6 +7161,7 @@ var PRIVATE_DATA$20 = {
7145
7161
  dom_handlers: null
7146
7162
  };
7147
7163
  var __gclass__$20 = null;
7164
+ var __live_watches__ = [];
7148
7165
  /******************************
7149
7166
  * Framework Methods
7150
7167
  ******************************/
@@ -7155,6 +7172,7 @@ function mt_create$20(gobj) {
7155
7172
  let priv = gobj.priv;
7156
7173
  priv.running = running_build(typeof document !== "undefined" ? document : null);
7157
7174
  priv.dom_handlers = [];
7175
+ __live_watches__.push(gobj);
7158
7176
  priv.gobj_timer = (0, _yuneta_gobj_js.gobj_create_pure_child)((0, _yuneta_gobj_js.gobj_name)(gobj), "C_TIMER", {}, gobj);
7159
7177
  yui_shell_watch_changes(gobj);
7160
7178
  follow_language(gobj);
@@ -7203,6 +7221,8 @@ function mt_stop$20(gobj) {
7203
7221
  ***************************************************************/
7204
7222
  function mt_destroy$20(gobj) {
7205
7223
  let priv = gobj.priv;
7224
+ let idx = __live_watches__.indexOf(gobj);
7225
+ if (idx >= 0) __live_watches__.splice(idx, 1);
7206
7226
  yui_shell_unwatch_changes(gobj);
7207
7227
  if (priv.lang_shell) {
7208
7228
  if (!(0, _yuneta_gobj_js.gobj_is_destroying)(priv.lang_shell)) (0, _yuneta_gobj_js.gobj_unsubscribe_event)(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
@@ -7616,6 +7636,23 @@ function create_gclass$20(gclass_name) {
7616
7636
  function register_c_yui_update_watch() {
7617
7637
  return create_gclass$20(GCLASS_NAME$20);
7618
7638
  }
7639
+ /***************************************************************
7640
+ * The app switched its language (call it AFTER switching the
7641
+ * i18next): every live watch re-translates its bar.
7642
+ *
7643
+ * For the screens with no shell -- the login, the gap between a
7644
+ * logout and the next login -- where nobody publishes the
7645
+ * shell's EV_LANGUAGE_CHANGED that the watch hears otherwise.
7646
+ * It is an EVENT to each watch, so the switch is in its
7647
+ * machine trace. `src`: the gobj that switched, if the caller
7648
+ * has one.
7649
+ ***************************************************************/
7650
+ function yui_update_watch_language_changed(src) {
7651
+ for (let watch of __live_watches__.slice()) {
7652
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(watch)) continue;
7653
+ (0, _yuneta_gobj_js.gobj_send_event)(watch, "EV_LANGUAGE_CHANGED", {}, src || watch);
7654
+ }
7655
+ }
7619
7656
  //#endregion
7620
7657
  //#region src/pager_helpers.js
7621
7658
  /***************************************************************
@@ -23240,7 +23277,8 @@ var PRIVATE_DATA$10 = {
23240
23277
  $raw: null,
23241
23278
  $raw_body: null,
23242
23279
  $search: null,
23243
- $mode_btns: null
23280
+ $mode_btns: null,
23281
+ lang_shell: null
23244
23282
  };
23245
23283
  var __gclass__$10 = null;
23246
23284
  /******************************
@@ -23266,12 +23304,21 @@ function mt_create$10(gobj) {
23266
23304
  * Framework Method: Start
23267
23305
  ***************************************************************/
23268
23306
  function mt_start$10(gobj) {
23307
+ let priv = gobj.priv;
23308
+ let shell = yui_shell_of(gobj);
23309
+ if (shell) {
23310
+ (0, _yuneta_gobj_js.gobj_subscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
23311
+ priv.lang_shell = shell;
23312
+ }
23269
23313
  render_view(gobj);
23270
23314
  }
23271
23315
  /***************************************************************
23272
23316
  * Framework Method: Stop
23273
23317
  ***************************************************************/
23274
23318
  function mt_stop$10(gobj) {
23319
+ let priv = gobj.priv;
23320
+ if (priv.lang_shell && !(0, _yuneta_gobj_js.gobj_is_destroying)(priv.lang_shell)) (0, _yuneta_gobj_js.gobj_unsubscribe_event)(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
23321
+ priv.lang_shell = null;
23275
23322
  teardown_graph_child(gobj);
23276
23323
  }
23277
23324
  /***************************************************************
@@ -24877,6 +24924,7 @@ function ac_language_changed$6(gobj, event, kw, src) {
24877
24924
  apply_view_mode(gobj);
24878
24925
  }
24879
24926
  render_view(gobj);
24927
+ if (priv.graph_gobj && (0, _yuneta_gobj_js.gobj_is_running)(priv.graph_gobj)) (0, _yuneta_gobj_js.gobj_send_event)(priv.graph_gobj, "EV_LANGUAGE_CHANGED", {}, gobj);
24880
24928
  return 0;
24881
24929
  }
24882
24930
  /************************************************************
@@ -52273,7 +52321,7 @@ function restore_view_state(gobj) {
52273
52321
  done = true;
52274
52322
  }
52275
52323
  if (position !== null) {
52276
- graph.translateTo(position);
52324
+ graph.translateTo(translate_of_position(graph, position, zoom !== null ? zoom : graph.getZoom()));
52277
52325
  done = true;
52278
52326
  }
52279
52327
  if (state.anchor) {
@@ -52291,6 +52339,11 @@ function restore_view_state(gobj) {
52291
52339
  yui_graph_update_zoom((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container"), priv.graph);
52292
52340
  return done;
52293
52341
  }
52342
+ function translate_of_position(graph, position, zoom) {
52343
+ let z = zoom > 0 ? zoom : 1;
52344
+ let c = graph.getCanvasCenter();
52345
+ return [(position[0] + c[0]) * z - c[0], (position[1] + c[1]) * z - c[1]];
52346
+ }
52294
52347
  function camera_shows_a_card(gobj, zoom, position) {
52295
52348
  let priv = gobj.priv;
52296
52349
  let graph = priv.graph;
@@ -52298,16 +52351,15 @@ function camera_shows_a_card(gobj, zoom, position) {
52298
52351
  if (!graph || !ids.length) return true;
52299
52352
  try {
52300
52353
  let size = graph.getSize();
52301
- let c = graph.getCanvasCenter();
52302
52354
  let z = zoom !== null ? zoom : graph.getZoom();
52303
- let t = position !== null ? position : graph.getPosition();
52355
+ let s = position !== null ? position : graph.getPosition();
52304
52356
  let w = size[0];
52305
52357
  let h = size[1];
52306
52358
  if (!(w > 0 && h > 0) || !(z > 0)) return true;
52307
52359
  for (let id of ids) {
52308
52360
  let n = graph.getElementPosition(id);
52309
- let vx = (n[0] - c[0]) * z + t[0] + c[0];
52310
- let vy = (n[1] - c[1]) * z + t[1] + c[1];
52361
+ let vx = (n[0] + s[0]) * z;
52362
+ let vy = (n[1] + s[1]) * z;
52311
52363
  if (vx >= 0 && vx <= w && vy >= 0 && vy <= h) return true;
52312
52364
  }
52313
52365
  } catch (e) {
@@ -52387,7 +52439,9 @@ var PRIVATE_DATA$9 = {
52387
52439
  trace_info: {},
52388
52440
  trace_pending: false,
52389
52441
  popover_mode: "",
52442
+ viewer_awaits: "",
52390
52443
  viewer_stale: "",
52444
+ set_in_flight: null,
52391
52445
  view_refused: false
52392
52446
  };
52393
52447
  var __gclass__$9 = null;
@@ -54787,6 +54841,9 @@ function open_gclass_window(gobj, gclass, description, d) {
54787
54841
  let priv = gobj.priv;
54788
54842
  close_gclass_view(priv.gclass_view);
54789
54843
  priv.gclass_view = null;
54844
+ priv.viewer_awaits = "";
54845
+ priv.viewer_stale = "";
54846
+ if (priv.set_in_flight) lock_viewer_for_set(gobj, gclass, priv.set_in_flight);
54790
54847
  let opts = {
54791
54848
  title_prefix: is_remote(gobj) ? (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "yuno_name") || "" : (0, _yuneta_gobj_js.gobj_yuno_name)() || "",
54792
54849
  current_state: d && d.state || "",
@@ -54853,16 +54910,27 @@ function ac_trace_info(gobj, event, kw, src) {
54853
54910
  error: kw.error || ""
54854
54911
  };
54855
54912
  priv.trace_pending = false;
54913
+ if (priv.set_in_flight && priv.set_in_flight.gclass === kw.gclass) priv.set_in_flight = null;
54856
54914
  let d = priv.popover_node;
54857
54915
  let root = priv.remote_root;
54858
54916
  if (priv.popover_mode === "node" && d && d.gclass === kw.gclass || priv.popover_mode === "yuno" && root && root.gclass === kw.gclass) render_current_popover(gobj);
54859
54917
  let viewer = gclass_viewer_gobj(gobj);
54860
54918
  if (viewer) {
54861
54919
  let shown = (0, _yuneta_gobj_js.gobj_read_str_attr)(viewer, "gclass_name");
54920
+ if (priv.viewer_awaits === kw.gclass) {
54921
+ priv.viewer_awaits = "";
54922
+ if (priv.viewer_stale === shown && shown !== kw.gclass) {
54923
+ priv.viewer_stale = "";
54924
+ priv.viewer_awaits = shown;
54925
+ priv.set_in_flight = {
54926
+ gclass: shown,
54927
+ scope: "gclass"
54928
+ };
54929
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
54930
+ }
54931
+ }
54862
54932
  if (shown === kw.gclass) (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
54863
- else if (priv.viewer_stale === shown) (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
54864
54933
  }
54865
- priv.viewer_stale = "";
54866
54934
  return 0;
54867
54935
  }
54868
54936
  /************************************************************
@@ -54875,13 +54943,14 @@ function gclass_viewer_gobj(gobj) {
54875
54943
  /************************************************************
54876
54944
  * What the gclass viewer needs to draw the traces of `gclass`
54877
54945
  * for every gobj of it: the levels the host read, and whether a
54878
- * set is still in flight. Plain json: it rides in a kw.
54946
+ * set that concerns it is still in flight. Plain json: it rides
54947
+ * in a kw.
54879
54948
  ************************************************************/
54880
54949
  function viewer_traces(gobj, gclass) {
54881
54950
  let priv = gobj.priv;
54882
54951
  return {
54883
54952
  info: priv.trace_info[gclass] || null,
54884
- pending: !!priv.trace_pending
54953
+ pending: !!priv.viewer_awaits
54885
54954
  };
54886
54955
  }
54887
54956
  /************************************************************
@@ -54962,11 +55031,14 @@ function set_trace_levels(gobj, target, scope, levels, set) {
54962
55031
  let priv = gobj.priv;
54963
55032
  priv.trace_pending = true;
54964
55033
  render_current_popover(gobj);
55034
+ priv.set_in_flight = {
55035
+ gclass: target.gclass,
55036
+ scope
55037
+ };
54965
55038
  let viewer = gclass_viewer_gobj(gobj);
54966
55039
  if (viewer) {
54967
55040
  let shown = (0, _yuneta_gobj_js.gobj_read_str_attr)(viewer, "gclass_name");
54968
- if (scope === "global" && shown !== target.gclass) priv.viewer_stale = shown;
54969
- (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
55041
+ if (lock_viewer_for_set(gobj, shown, priv.set_in_flight)) (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
54970
55042
  }
54971
55043
  (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_SET_TRACE_LEVEL", {
54972
55044
  scope,
@@ -54976,6 +55048,13 @@ function set_trace_levels(gobj, target, scope, levels, set) {
54976
55048
  set
54977
55049
  });
54978
55050
  }
55051
+ function lock_viewer_for_set(gobj, shown, set) {
55052
+ let priv = gobj.priv;
55053
+ if (!(shown === set.gclass || set.scope === "global")) return false;
55054
+ priv.viewer_awaits = set.gclass;
55055
+ priv.viewer_stale = shown !== set.gclass ? shown : "";
55056
+ return true;
55057
+ }
54979
55058
  /************************************************************
54980
55059
  * The toolbar's "traces of the yuno": the popover shows the
54981
55060
  * yuno's scope, read from the answer for the root's gclass.
@@ -89125,6 +89204,7 @@ exports.yui_svg_icon_element = yui_svg_icon_element;
89125
89204
  exports.yui_svg_sanitize = yui_svg_sanitize;
89126
89205
  exports.yui_theme_now = yui_theme_now;
89127
89206
  exports.yui_toolbar = yui_toolbar;
89207
+ exports.yui_update_watch_language_changed = yui_update_watch_language_changed;
89128
89208
  exports.yui_user_icon_class = yui_user_icon_class;
89129
89209
  exports.yui_watch_theme = yui_watch_theme;
89130
89210
 
@@ -7085,6 +7085,13 @@ function build_page_url(loc) {
7085
7085
  * next login) in document.body. It follows the shell across a
7086
7086
  * logout (yui_shell_watch_changes()), as the dock does.
7087
7087
  *
7088
+ * Its language: it hears the live shell's EV_LANGUAGE_CHANGED
7089
+ * (yui_shell_language_changed()). With NO shell there is nobody
7090
+ * to publish that, so an app whose login switches language
7091
+ * calls yui_update_watch_language_changed() after switching its
7092
+ * i18next -- it sends EV_LANGUAGE_CHANGED to every live watch.
7093
+ * Calling it with a shell up too is harmless.
7094
+ *
7088
7095
  * Usage (an app, once, after creating the yuno):
7089
7096
  *
7090
7097
  * register_c_yui_update_watch();
@@ -7096,12 +7103,21 @@ function build_page_url(loc) {
7096
7103
  * // on its backend's EV_ON_OPEN:
7097
7104
  * gobj_send_event(watch, "EV_CHECK_BUILD", {}, gobj);
7098
7105
  *
7106
+ * // the login's language switch (no shell yet):
7107
+ * switch_locale(locale);
7108
+ * yui_update_watch_language_changed();
7109
+ *
7099
7110
  * Input events:
7100
7111
  * EV_CHECK_BUILD {force?} ask the server (force skips
7101
7112
  * the minimum interval)
7102
7113
  * EV_RELOAD {} the bar's reload button
7103
7114
  * EV_DISMISS {} the bar's ✕: hidden for THIS
7104
7115
  * build, a later one shows it
7116
+ * EV_LANGUAGE_CHANGED {} the app's language changed:
7117
+ * the bar is re-translated
7118
+ * (the live shell publishes it;
7119
+ * with no shell,
7120
+ * yui_update_watch_language_changed())
7105
7121
  *
7106
7122
  * Output events (optional subscribers):
7107
7123
  * EV_NEW_BUILD {running, deployed, version}
@@ -7140,6 +7156,7 @@ var PRIVATE_DATA$20 = {
7140
7156
  dom_handlers: null
7141
7157
  };
7142
7158
  var __gclass__$20 = null;
7159
+ var __live_watches__ = [];
7143
7160
  /******************************
7144
7161
  * Framework Methods
7145
7162
  ******************************/
@@ -7150,6 +7167,7 @@ function mt_create$20(gobj) {
7150
7167
  let priv = gobj.priv;
7151
7168
  priv.running = running_build(typeof document !== "undefined" ? document : null);
7152
7169
  priv.dom_handlers = [];
7170
+ __live_watches__.push(gobj);
7153
7171
  priv.gobj_timer = gobj_create_pure_child(gobj_name(gobj), "C_TIMER", {}, gobj);
7154
7172
  yui_shell_watch_changes(gobj);
7155
7173
  follow_language(gobj);
@@ -7198,6 +7216,8 @@ function mt_stop$20(gobj) {
7198
7216
  ***************************************************************/
7199
7217
  function mt_destroy$20(gobj) {
7200
7218
  let priv = gobj.priv;
7219
+ let idx = __live_watches__.indexOf(gobj);
7220
+ if (idx >= 0) __live_watches__.splice(idx, 1);
7201
7221
  yui_shell_unwatch_changes(gobj);
7202
7222
  if (priv.lang_shell) {
7203
7223
  if (!gobj_is_destroying(priv.lang_shell)) gobj_unsubscribe_event(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
@@ -7611,6 +7631,23 @@ function create_gclass$20(gclass_name) {
7611
7631
  function register_c_yui_update_watch() {
7612
7632
  return create_gclass$20(GCLASS_NAME$20);
7613
7633
  }
7634
+ /***************************************************************
7635
+ * The app switched its language (call it AFTER switching the
7636
+ * i18next): every live watch re-translates its bar.
7637
+ *
7638
+ * For the screens with no shell -- the login, the gap between a
7639
+ * logout and the next login -- where nobody publishes the
7640
+ * shell's EV_LANGUAGE_CHANGED that the watch hears otherwise.
7641
+ * It is an EVENT to each watch, so the switch is in its
7642
+ * machine trace. `src`: the gobj that switched, if the caller
7643
+ * has one.
7644
+ ***************************************************************/
7645
+ function yui_update_watch_language_changed(src) {
7646
+ for (let watch of __live_watches__.slice()) {
7647
+ if (gobj_is_destroying(watch)) continue;
7648
+ gobj_send_event(watch, "EV_LANGUAGE_CHANGED", {}, src || watch);
7649
+ }
7650
+ }
7614
7651
  //#endregion
7615
7652
  //#region src/pager_helpers.js
7616
7653
  /***************************************************************
@@ -23235,7 +23272,8 @@ var PRIVATE_DATA$10 = {
23235
23272
  $raw: null,
23236
23273
  $raw_body: null,
23237
23274
  $search: null,
23238
- $mode_btns: null
23275
+ $mode_btns: null,
23276
+ lang_shell: null
23239
23277
  };
23240
23278
  var __gclass__$10 = null;
23241
23279
  /******************************
@@ -23261,12 +23299,21 @@ function mt_create$10(gobj) {
23261
23299
  * Framework Method: Start
23262
23300
  ***************************************************************/
23263
23301
  function mt_start$10(gobj) {
23302
+ let priv = gobj.priv;
23303
+ let shell = yui_shell_of(gobj);
23304
+ if (shell) {
23305
+ gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
23306
+ priv.lang_shell = shell;
23307
+ }
23264
23308
  render_view(gobj);
23265
23309
  }
23266
23310
  /***************************************************************
23267
23311
  * Framework Method: Stop
23268
23312
  ***************************************************************/
23269
23313
  function mt_stop$10(gobj) {
23314
+ let priv = gobj.priv;
23315
+ if (priv.lang_shell && !gobj_is_destroying(priv.lang_shell)) gobj_unsubscribe_event(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
23316
+ priv.lang_shell = null;
23270
23317
  teardown_graph_child(gobj);
23271
23318
  }
23272
23319
  /***************************************************************
@@ -24872,6 +24919,7 @@ function ac_language_changed$6(gobj, event, kw, src) {
24872
24919
  apply_view_mode(gobj);
24873
24920
  }
24874
24921
  render_view(gobj);
24922
+ if (priv.graph_gobj && gobj_is_running(priv.graph_gobj)) gobj_send_event(priv.graph_gobj, "EV_LANGUAGE_CHANGED", {}, gobj);
24875
24923
  return 0;
24876
24924
  }
24877
24925
  /************************************************************
@@ -52268,7 +52316,7 @@ function restore_view_state(gobj) {
52268
52316
  done = true;
52269
52317
  }
52270
52318
  if (position !== null) {
52271
- graph.translateTo(position);
52319
+ graph.translateTo(translate_of_position(graph, position, zoom !== null ? zoom : graph.getZoom()));
52272
52320
  done = true;
52273
52321
  }
52274
52322
  if (state.anchor) {
@@ -52286,6 +52334,11 @@ function restore_view_state(gobj) {
52286
52334
  yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), priv.graph);
52287
52335
  return done;
52288
52336
  }
52337
+ function translate_of_position(graph, position, zoom) {
52338
+ let z = zoom > 0 ? zoom : 1;
52339
+ let c = graph.getCanvasCenter();
52340
+ return [(position[0] + c[0]) * z - c[0], (position[1] + c[1]) * z - c[1]];
52341
+ }
52289
52342
  function camera_shows_a_card(gobj, zoom, position) {
52290
52343
  let priv = gobj.priv;
52291
52344
  let graph = priv.graph;
@@ -52293,16 +52346,15 @@ function camera_shows_a_card(gobj, zoom, position) {
52293
52346
  if (!graph || !ids.length) return true;
52294
52347
  try {
52295
52348
  let size = graph.getSize();
52296
- let c = graph.getCanvasCenter();
52297
52349
  let z = zoom !== null ? zoom : graph.getZoom();
52298
- let t = position !== null ? position : graph.getPosition();
52350
+ let s = position !== null ? position : graph.getPosition();
52299
52351
  let w = size[0];
52300
52352
  let h = size[1];
52301
52353
  if (!(w > 0 && h > 0) || !(z > 0)) return true;
52302
52354
  for (let id of ids) {
52303
52355
  let n = graph.getElementPosition(id);
52304
- let vx = (n[0] - c[0]) * z + t[0] + c[0];
52305
- let vy = (n[1] - c[1]) * z + t[1] + c[1];
52356
+ let vx = (n[0] + s[0]) * z;
52357
+ let vy = (n[1] + s[1]) * z;
52306
52358
  if (vx >= 0 && vx <= w && vy >= 0 && vy <= h) return true;
52307
52359
  }
52308
52360
  } catch (e) {
@@ -52382,7 +52434,9 @@ var PRIVATE_DATA$9 = {
52382
52434
  trace_info: {},
52383
52435
  trace_pending: false,
52384
52436
  popover_mode: "",
52437
+ viewer_awaits: "",
52385
52438
  viewer_stale: "",
52439
+ set_in_flight: null,
52386
52440
  view_refused: false
52387
52441
  };
52388
52442
  var __gclass__$9 = null;
@@ -54782,6 +54836,9 @@ function open_gclass_window(gobj, gclass, description, d) {
54782
54836
  let priv = gobj.priv;
54783
54837
  close_gclass_view(priv.gclass_view);
54784
54838
  priv.gclass_view = null;
54839
+ priv.viewer_awaits = "";
54840
+ priv.viewer_stale = "";
54841
+ if (priv.set_in_flight) lock_viewer_for_set(gobj, gclass, priv.set_in_flight);
54785
54842
  let opts = {
54786
54843
  title_prefix: is_remote(gobj) ? gobj_read_str_attr(gobj, "yuno_name") || "" : gobj_yuno_name() || "",
54787
54844
  current_state: d && d.state || "",
@@ -54848,16 +54905,27 @@ function ac_trace_info(gobj, event, kw, src) {
54848
54905
  error: kw.error || ""
54849
54906
  };
54850
54907
  priv.trace_pending = false;
54908
+ if (priv.set_in_flight && priv.set_in_flight.gclass === kw.gclass) priv.set_in_flight = null;
54851
54909
  let d = priv.popover_node;
54852
54910
  let root = priv.remote_root;
54853
54911
  if (priv.popover_mode === "node" && d && d.gclass === kw.gclass || priv.popover_mode === "yuno" && root && root.gclass === kw.gclass) render_current_popover(gobj);
54854
54912
  let viewer = gclass_viewer_gobj(gobj);
54855
54913
  if (viewer) {
54856
54914
  let shown = gobj_read_str_attr(viewer, "gclass_name");
54915
+ if (priv.viewer_awaits === kw.gclass) {
54916
+ priv.viewer_awaits = "";
54917
+ if (priv.viewer_stale === shown && shown !== kw.gclass) {
54918
+ priv.viewer_stale = "";
54919
+ priv.viewer_awaits = shown;
54920
+ priv.set_in_flight = {
54921
+ gclass: shown,
54922
+ scope: "gclass"
54923
+ };
54924
+ gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
54925
+ }
54926
+ }
54857
54927
  if (shown === kw.gclass) gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
54858
- else if (priv.viewer_stale === shown) gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
54859
54928
  }
54860
- priv.viewer_stale = "";
54861
54929
  return 0;
54862
54930
  }
54863
54931
  /************************************************************
@@ -54870,13 +54938,14 @@ function gclass_viewer_gobj(gobj) {
54870
54938
  /************************************************************
54871
54939
  * What the gclass viewer needs to draw the traces of `gclass`
54872
54940
  * for every gobj of it: the levels the host read, and whether a
54873
- * set is still in flight. Plain json: it rides in a kw.
54941
+ * set that concerns it is still in flight. Plain json: it rides
54942
+ * in a kw.
54874
54943
  ************************************************************/
54875
54944
  function viewer_traces(gobj, gclass) {
54876
54945
  let priv = gobj.priv;
54877
54946
  return {
54878
54947
  info: priv.trace_info[gclass] || null,
54879
- pending: !!priv.trace_pending
54948
+ pending: !!priv.viewer_awaits
54880
54949
  };
54881
54950
  }
54882
54951
  /************************************************************
@@ -54957,11 +55026,14 @@ function set_trace_levels(gobj, target, scope, levels, set) {
54957
55026
  let priv = gobj.priv;
54958
55027
  priv.trace_pending = true;
54959
55028
  render_current_popover(gobj);
55029
+ priv.set_in_flight = {
55030
+ gclass: target.gclass,
55031
+ scope
55032
+ };
54960
55033
  let viewer = gclass_viewer_gobj(gobj);
54961
55034
  if (viewer) {
54962
55035
  let shown = gobj_read_str_attr(viewer, "gclass_name");
54963
- if (scope === "global" && shown !== target.gclass) priv.viewer_stale = shown;
54964
- gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
55036
+ if (lock_viewer_for_set(gobj, shown, priv.set_in_flight)) gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
54965
55037
  }
54966
55038
  gobj_publish_event(gobj, "EV_SET_TRACE_LEVEL", {
54967
55039
  scope,
@@ -54971,6 +55043,13 @@ function set_trace_levels(gobj, target, scope, levels, set) {
54971
55043
  set
54972
55044
  });
54973
55045
  }
55046
+ function lock_viewer_for_set(gobj, shown, set) {
55047
+ let priv = gobj.priv;
55048
+ if (!(shown === set.gclass || set.scope === "global")) return false;
55049
+ priv.viewer_awaits = set.gclass;
55050
+ priv.viewer_stale = shown !== set.gclass ? shown : "";
55051
+ return true;
55052
+ }
54974
55053
  /************************************************************
54975
55054
  * The toolbar's "traces of the yuno": the popover shows the
54976
55055
  * yuno's scope, read from the answer for the root's gclass.
@@ -88996,6 +89075,6 @@ function setup_json_pad(self) {
88996
89075
  return win;
88997
89076
  }
88998
89077
  //#endregion
88999
- export { EditControl, ICONS_TOPIC, MarkerControl, USER_ICON_PREFIX, YUI_FILE_ACCEPT, YUI_PERIODS, YUI_PERIODS_DEFAULT, YUI_ROLLING, addClasses, apply_dev_traces, attach_clear, build_dev_panel, dev_window_was_open, disableElements, enableElements, epoch_to_local_input, epoch_to_ms, expose_view_container, fmt_date_time, fmt_epoch, getStrokeColor, infer_period, info_traffic, inject_svg_icons, is_current_period, iso_week, local_input_to_epoch, ms_to_epoch, period_bounds, period_bounds_epoch, period_label, period_name, period_shift, period_spec, period_start, refresh_clear, register_c_g6_nodes_tree, register_c_yui_form, register_c_yui_fsm_graph, register_c_yui_gclass, register_c_yui_gobj_tree_js, register_c_yui_json, register_c_yui_json_graph, register_c_yui_json_pad, register_c_yui_map, register_c_yui_nav, register_c_yui_pager, register_c_yui_period, register_c_yui_schema_editor, register_c_yui_service_view, register_c_yui_shell, register_c_yui_treedb_graph, register_c_yui_treedb_schema, register_c_yui_treedb_topic_with_form, register_c_yui_treedb_topics, register_c_yui_update_watch, register_c_yui_uplot, register_c_yui_window, register_c_yui_window_manager, register_c_yui_wizard, removeChildElements, removeClasses, rolling_bounds, safe_locale, set_active_state, set_cancel_state, set_pressed_state, set_submit_state, setup_dev, setup_frontend_view, setup_json_pad, toggleClasses, yui_array_buffer_to_base64, yui_asset_element, yui_asset_id, yui_asset_ids, yui_asset_missing, yui_asset_src, yui_file_control, yui_file_id_label, yui_file_read, yui_file_sha256, yui_file_size_label, yui_files_manifest, yui_icon_is_defined, yui_icons_list, yui_icons_put_user, yui_icons_remove_user, yui_icons_set_user, yui_is_dark, yui_mount_service_view, yui_shell_close_drawer, yui_shell_close_dropdown, yui_shell_confirm_danger, yui_shell_confirm_ok, yui_shell_confirm_yesno, yui_shell_confirm_yesnocancel, yui_shell_escape_order, yui_shell_navigate, yui_shell_open_drawer, yui_shell_overlay_dismissed, yui_shell_pop_escape, yui_shell_push_escape, yui_shell_refresh_avatars, yui_shell_register_event_handler, yui_shell_register_overlay, yui_shell_set_avatar_provider, yui_shell_set_connection_state, yui_shell_set_nav_item_badge, yui_shell_set_sub_routes, yui_shell_set_toolbar_item_badge, yui_shell_set_toolbar_item_icon, yui_shell_set_translator, yui_shell_show_error, yui_shell_show_info, yui_shell_show_modal, yui_shell_show_route_map, yui_shell_show_warning, yui_shell_toggle_drawer, yui_shell_unpark_route, yui_svg_icon_element, yui_svg_sanitize, yui_theme_now, yui_toolbar, yui_user_icon_class, yui_watch_theme };
89078
+ export { EditControl, ICONS_TOPIC, MarkerControl, USER_ICON_PREFIX, YUI_FILE_ACCEPT, YUI_PERIODS, YUI_PERIODS_DEFAULT, YUI_ROLLING, addClasses, apply_dev_traces, attach_clear, build_dev_panel, dev_window_was_open, disableElements, enableElements, epoch_to_local_input, epoch_to_ms, expose_view_container, fmt_date_time, fmt_epoch, getStrokeColor, infer_period, info_traffic, inject_svg_icons, is_current_period, iso_week, local_input_to_epoch, ms_to_epoch, period_bounds, period_bounds_epoch, period_label, period_name, period_shift, period_spec, period_start, refresh_clear, register_c_g6_nodes_tree, register_c_yui_form, register_c_yui_fsm_graph, register_c_yui_gclass, register_c_yui_gobj_tree_js, register_c_yui_json, register_c_yui_json_graph, register_c_yui_json_pad, register_c_yui_map, register_c_yui_nav, register_c_yui_pager, register_c_yui_period, register_c_yui_schema_editor, register_c_yui_service_view, register_c_yui_shell, register_c_yui_treedb_graph, register_c_yui_treedb_schema, register_c_yui_treedb_topic_with_form, register_c_yui_treedb_topics, register_c_yui_update_watch, register_c_yui_uplot, register_c_yui_window, register_c_yui_window_manager, register_c_yui_wizard, removeChildElements, removeClasses, rolling_bounds, safe_locale, set_active_state, set_cancel_state, set_pressed_state, set_submit_state, setup_dev, setup_frontend_view, setup_json_pad, toggleClasses, yui_array_buffer_to_base64, yui_asset_element, yui_asset_id, yui_asset_ids, yui_asset_missing, yui_asset_src, yui_file_control, yui_file_id_label, yui_file_read, yui_file_sha256, yui_file_size_label, yui_files_manifest, yui_icon_is_defined, yui_icons_list, yui_icons_put_user, yui_icons_remove_user, yui_icons_set_user, yui_is_dark, yui_mount_service_view, yui_shell_close_drawer, yui_shell_close_dropdown, yui_shell_confirm_danger, yui_shell_confirm_ok, yui_shell_confirm_yesno, yui_shell_confirm_yesnocancel, yui_shell_escape_order, yui_shell_navigate, yui_shell_open_drawer, yui_shell_overlay_dismissed, yui_shell_pop_escape, yui_shell_push_escape, yui_shell_refresh_avatars, yui_shell_register_event_handler, yui_shell_register_overlay, yui_shell_set_avatar_provider, yui_shell_set_connection_state, yui_shell_set_nav_item_badge, yui_shell_set_sub_routes, yui_shell_set_toolbar_item_badge, yui_shell_set_toolbar_item_icon, yui_shell_set_translator, yui_shell_show_error, yui_shell_show_info, yui_shell_show_modal, yui_shell_show_route_map, yui_shell_show_warning, yui_shell_toggle_drawer, yui_shell_unpark_route, yui_svg_icon_element, yui_svg_sanitize, yui_theme_now, yui_toolbar, yui_update_watch_language_changed, yui_user_icon_class, yui_watch_theme };
89000
89079
 
89001
89080
  //# sourceMappingURL=gobj-ui.es.js.map
package/index.js CHANGED
@@ -20,7 +20,7 @@
20
20
  */
21
21
  export { register_c_yui_window } from "./src/c_yui_window.js";
22
22
  export { register_c_yui_window_manager } from "./src/c_yui_window_manager.js";
23
- export { register_c_yui_update_watch } from "./src/c_yui_update_watch.js";
23
+ export { register_c_yui_update_watch, yui_update_watch_language_changed } from "./src/c_yui_update_watch.js";
24
24
  export { register_c_yui_pager } from "./src/c_yui_pager.js";
25
25
  export { register_c_yui_wizard } from "./src/c_yui_wizard.js";
26
26
  export { register_c_yui_form } from "./src/c_yui_form.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.27.29",
3
+ "version": "7.27.31",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -41,7 +41,7 @@
41
41
  "acorn": "^8.19.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@rollup/plugin-terser": "^1.0.0",
44
+ "@rollup/plugin-terser": "^1.0.2",
45
45
  "@vitest/coverage-v8": "^5.0.5",
46
46
  "@yuneta/gobj-js": "^7.27.0",
47
47
  "vite": "^8.3.5",