@yuneta/gobj-ui 7.27.28 → 7.27.30

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.
@@ -1224,7 +1224,7 @@ function secondary_nav_renders(item, layout) {
1224
1224
  /***************************************************************
1225
1225
  * Constants
1226
1226
  ***************************************************************/
1227
- var GCLASS_NAME$22 = "C_YUI_SHELL";
1227
+ var GCLASS_NAME$23 = "C_YUI_SHELL";
1228
1228
  var __live_shells__ = [];
1229
1229
  var __retiring_shell__ = null;
1230
1230
  var __dead_entries__ = /* @__PURE__ */ new Set();
@@ -1251,7 +1251,7 @@ var LAYER_DEFS = [
1251
1251
  /***************************************************************
1252
1252
  * Attrs
1253
1253
  ***************************************************************/
1254
- var attrs_table$22 = [
1254
+ var attrs_table$23 = [
1255
1255
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
1256
1256
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "config", 0, null, "Shell declarative config (zones, menu, stages, toolbar)"),
1257
1257
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "default_route", 0, "", "Fallback route if hash is empty"),
@@ -1262,7 +1262,7 @@ var attrs_table$22 = [
1262
1262
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Root HTMLElement of the shell"),
1263
1263
  (0, _yuneta_gobj_js.SDATA_END)()
1264
1264
  ];
1265
- var PRIVATE_DATA$22 = {
1265
+ var PRIVATE_DATA$23 = {
1266
1266
  zones: {},
1267
1267
  layers: {},
1268
1268
  window_layer: null,
@@ -1305,14 +1305,14 @@ var PRIVATE_DATA$22 = {
1305
1305
  connected: null,
1306
1306
  active_dropdown: null
1307
1307
  };
1308
- var __gclass__$22 = null;
1308
+ var __gclass__$23 = null;
1309
1309
  /******************************
1310
1310
  * Framework Methods
1311
1311
  ******************************/
1312
1312
  /***************************************************************
1313
1313
  * Framework Method: Create
1314
1314
  ***************************************************************/
1315
- function mt_create$22(gobj) {
1315
+ function mt_create$23(gobj) {
1316
1316
  const subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
1317
1317
  if (subscriber) (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
1318
1318
  __live_shells__.push(gobj);
@@ -1322,7 +1322,7 @@ function mt_create$22(gobj) {
1322
1322
  /***************************************************************
1323
1323
  * Framework Method: Start
1324
1324
  ***************************************************************/
1325
- function mt_start$21(gobj) {
1325
+ function mt_start$22(gobj) {
1326
1326
  let config = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "config") || {};
1327
1327
  let priv = gobj.priv;
1328
1328
  if (!validate_config(config)) {
@@ -1466,7 +1466,7 @@ function mt_start$21(gobj) {
1466
1466
  /***************************************************************
1467
1467
  * Framework Method: Stop
1468
1468
  ***************************************************************/
1469
- function mt_stop$20(gobj) {
1469
+ function mt_stop$21(gobj) {
1470
1470
  let priv = gobj.priv;
1471
1471
  if (!priv) return 0;
1472
1472
  retire_overlays(gobj);
@@ -1530,7 +1530,7 @@ function mt_stop$20(gobj) {
1530
1530
  /***************************************************************
1531
1531
  * Framework Method: Destroy
1532
1532
  ***************************************************************/
1533
- function mt_destroy$22(gobj) {
1533
+ function mt_destroy$23(gobj) {
1534
1534
  retire_overlays(gobj);
1535
1535
  close_toolbar_dropdown(gobj);
1536
1536
  let live_idx = __live_shells__.indexOf(gobj);
@@ -3663,15 +3663,15 @@ function mt_publication_pre_filter(gobj, subs, event, kw) {
3663
3663
  if (!subscriber || !(0, _yuneta_gobj_js.gobj_has_event)(subscriber, event, 0)) return 0;
3664
3664
  return 1;
3665
3665
  }
3666
- var gmt$22 = {
3667
- mt_create: mt_create$22,
3668
- mt_start: mt_start$21,
3669
- mt_stop: mt_stop$20,
3670
- mt_destroy: mt_destroy$22,
3666
+ var gmt$23 = {
3667
+ mt_create: mt_create$23,
3668
+ mt_start: mt_start$22,
3669
+ mt_stop: mt_stop$21,
3670
+ mt_destroy: mt_destroy$23,
3671
3671
  mt_publication_pre_filter
3672
3672
  };
3673
- function create_gclass$22(gclass_name) {
3674
- if (__gclass__$22) {
3673
+ function create_gclass$23(gclass_name) {
3674
+ if (__gclass__$23) {
3675
3675
  (0, _yuneta_gobj_js.log_error)(`GClass ALREADY created: ${gclass_name}`);
3676
3676
  return -1;
3677
3677
  }
@@ -3714,12 +3714,12 @@ function create_gclass$22(gclass_name) {
3714
3714
  ["EV_ICONS_CHANGED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_PUBLIC_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
3715
3715
  ["EV_CONNECTION_STATE", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS]
3716
3716
  ];
3717
- __gclass__$22 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$22, 0, attrs_table$22, PRIVATE_DATA$22, 0, 0, 0, _yuneta_gobj_js.gclass_flag_t.gcflag_no_check_output_events);
3718
- if (!__gclass__$22) return -1;
3717
+ __gclass__$23 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$23, 0, attrs_table$23, PRIVATE_DATA$23, 0, 0, 0, _yuneta_gobj_js.gclass_flag_t.gcflag_no_check_output_events);
3718
+ if (!__gclass__$23) return -1;
3719
3719
  return 0;
3720
3720
  }
3721
3721
  function register_c_yui_shell() {
3722
- return create_gclass$22(GCLASS_NAME$22);
3722
+ return create_gclass$23(GCLASS_NAME$23);
3723
3723
  }
3724
3724
  /***************************************************************
3725
3725
  * Public helpers — exported alongside register_c_yui_shell().
@@ -3839,7 +3839,7 @@ function yui_shell_previous_route(shell_gobj) {
3839
3839
  function yui_shell_of(gobj) {
3840
3840
  let g = gobj;
3841
3841
  while (g) {
3842
- if ((0, _yuneta_gobj_js.gobj_gclass_name)(g) === GCLASS_NAME$22) return g;
3842
+ if ((0, _yuneta_gobj_js.gobj_gclass_name)(g) === GCLASS_NAME$23) return g;
3843
3843
  g = (0, _yuneta_gobj_js.gobj_parent)(g);
3844
3844
  }
3845
3845
  return __live_shells__.length > 0 ? __live_shells__[__live_shells__.length - 1] : null;
@@ -4340,6 +4340,9 @@ function yui_shell_popup_layer(shell) {
4340
4340
  let priv = shell.priv;
4341
4341
  return priv && priv.layers && priv.layers.popup || null;
4342
4342
  }
4343
+ function yui_shell_notification_layer(shell) {
4344
+ return notification_layer(shell) || null;
4345
+ }
4343
4346
  /***************************************************************
4344
4347
  * i18n bridge:
4345
4348
  * - `text` is rendered as the canonical English key.
@@ -4952,7 +4955,7 @@ function yui_shell_confirm_yesnocancel(shell, message, opts) {
4952
4955
  /***************************************************************
4953
4956
  * Constants
4954
4957
  ***************************************************************/
4955
- var GCLASS_NAME$21 = "C_YUI_WINDOW";
4958
+ var GCLASS_NAME$22 = "C_YUI_WINDOW";
4956
4959
  var WC_MIN = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><rect x=\"3\" y=\"11\" width=\"10\" height=\"1.6\" rx=\"0.8\" fill=\"currentColor\"/></svg>";
4957
4960
  var WC_MAX = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><rect x=\"3.3\" y=\"3.3\" width=\"9.4\" height=\"9.4\" rx=\"1.6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"/></svg>";
4958
4961
  var WC_RESTORE = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><rect x=\"5.2\" y=\"3\" width=\"7.8\" height=\"7.8\" rx=\"1.3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.4\"/><rect x=\"3\" y=\"5.2\" width=\"7.8\" height=\"7.8\" rx=\"1.3\" fill=\"var(--bulma-scheme-main)\" stroke=\"currentColor\" stroke-width=\"1.4\"/></svg>";
@@ -4965,7 +4968,7 @@ var __title_seq__ = 0;
4965
4968
  /***************************************************************
4966
4969
  * Data
4967
4970
  ***************************************************************/
4968
- var attrs_table$21 = [
4971
+ var attrs_table$22 = [
4969
4972
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
4970
4973
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$parent", 0, null, "$container will be appended to $parent if not null, else to the window layer of the shell (document.body while there is none), following the shell when it is destroyed or another is built"),
4971
4974
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "x", 0, "300", "X position"),
@@ -5003,7 +5006,7 @@ var attrs_table$21 = [
5003
5006
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "win_resize_handler", 0, null, "Internal: native window 'resize' listener"),
5004
5007
  (0, _yuneta_gobj_js.SDATA_END)()
5005
5008
  ];
5006
- var PRIVATE_DATA$21 = {
5009
+ var PRIVATE_DATA$22 = {
5007
5010
  prevSize: 0,
5008
5011
  placed_by_shell: false,
5009
5012
  back_shell: null,
@@ -5012,14 +5015,14 @@ var PRIVATE_DATA$21 = {
5012
5015
  release_focus: null,
5013
5016
  escape_order: 0
5014
5017
  };
5015
- var __gclass__$21 = null;
5018
+ var __gclass__$22 = null;
5016
5019
  /******************************
5017
5020
  * Framework Methods
5018
5021
  ******************************/
5019
5022
  /***************************************************************
5020
5023
  * Framework Method: Create
5021
5024
  ***************************************************************/
5022
- function mt_create$21(gobj) {
5025
+ function mt_create$22(gobj) {
5023
5026
  const subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
5024
5027
  if (subscriber) (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
5025
5028
  let window_id = "window-" + (0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_short_name)(gobj));
@@ -5082,7 +5085,7 @@ function mt_create$21(gobj) {
5082
5085
  * it could not be seen, and the next Tab gave it back to the
5083
5086
  * overlay; it opens under it now, and is there when it goes.
5084
5087
  ***************************************************************/
5085
- function mt_start$20(gobj) {
5088
+ function mt_start$21(gobj) {
5086
5089
  let priv = gobj.priv;
5087
5090
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
5088
5091
  if (!$container) {
@@ -5101,7 +5104,7 @@ function mt_start$20(gobj) {
5101
5104
  /***************************************************************
5102
5105
  * Framework Method: Destroy
5103
5106
  ***************************************************************/
5104
- function mt_destroy$21(gobj) {
5107
+ function mt_destroy$22(gobj) {
5105
5108
  let priv = gobj.priv;
5106
5109
  give_focus_back(gobj);
5107
5110
  yui_shell_unwatch_changes(gobj);
@@ -5385,7 +5388,7 @@ function resolve_manager(gobj) {
5385
5388
  if (typeof m === "string") {
5386
5389
  let name = m;
5387
5390
  m = (0, _yuneta_gobj_js.gobj_find_service)(name, false) || null;
5388
- if (!m) (0, _yuneta_gobj_js.log_warning)(`${GCLASS_NAME$21}: window manager '${name}' not found: no dock, no minimize`);
5391
+ if (!m) (0, _yuneta_gobj_js.log_warning)(`${GCLASS_NAME$22}: window manager '${name}' not found: no dock, no minimize`);
5389
5392
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "manager", m);
5390
5393
  }
5391
5394
  return m;
@@ -6136,7 +6139,7 @@ function ac_close(gobj, event, kw, src) {
6136
6139
  * still being built would sit under its first route. Back no
6137
6140
  * longer closes such a window; its ✕ does, as before 7.26.31.
6138
6141
  ************************************************************/
6139
- function ac_shell_changed$1(gobj, event, kw, src) {
6142
+ function ac_shell_changed$2(gobj, event, kw, src) {
6140
6143
  let priv = gobj.priv;
6141
6144
  let going = (0, _yuneta_gobj_js.gobj_is_destroying)(src);
6142
6145
  if (going && priv.back_shell === src) {
@@ -6162,16 +6165,16 @@ function ac_shell_changed$1(gobj, event, kw, src) {
6162
6165
  /***************************
6163
6166
  * FSM
6164
6167
  ***************************/
6165
- var gmt$21 = {
6166
- mt_create: mt_create$21,
6167
- mt_start: mt_start$20,
6168
- mt_destroy: mt_destroy$21
6168
+ var gmt$22 = {
6169
+ mt_create: mt_create$22,
6170
+ mt_start: mt_start$21,
6171
+ mt_destroy: mt_destroy$22
6169
6172
  };
6170
6173
  /***************************************************************
6171
6174
  * Create the GClass
6172
6175
  ***************************************************************/
6173
- function create_gclass$21(gclass_name) {
6174
- if (__gclass__$21) {
6176
+ function create_gclass$22(gclass_name) {
6177
+ if (__gclass__$22) {
6175
6178
  (0, _yuneta_gobj_js.log_error)(`GClass ALREADY created: ${gclass_name}`);
6176
6179
  return -1;
6177
6180
  }
@@ -6198,7 +6201,7 @@ function create_gclass$21(gclass_name) {
6198
6201
  ],
6199
6202
  [
6200
6203
  "EV_SHELL_CHANGED",
6201
- ac_shell_changed$1,
6204
+ ac_shell_changed$2,
6202
6205
  null
6203
6206
  ]
6204
6207
  ]]];
@@ -6212,15 +6215,15 @@ function create_gclass$21(gclass_name) {
6212
6215
  ["EV_CLOSE_WINDOW", 0],
6213
6216
  ["EV_SHELL_CHANGED", 0]
6214
6217
  ];
6215
- __gclass__$21 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$21, 0, attrs_table$21, PRIVATE_DATA$21, 0, 0, 0, 0);
6216
- if (!__gclass__$21) return -1;
6218
+ __gclass__$22 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$22, 0, attrs_table$22, PRIVATE_DATA$22, 0, 0, 0, 0);
6219
+ if (!__gclass__$22) return -1;
6217
6220
  return 0;
6218
6221
  }
6219
6222
  /***************************************************************
6220
6223
  * Register GClass
6221
6224
  ***************************************************************/
6222
6225
  function register_c_yui_window() {
6223
- return create_gclass$21(GCLASS_NAME$21);
6226
+ return create_gclass$22(GCLASS_NAME$22);
6224
6227
  }
6225
6228
  //#endregion
6226
6229
  //#region src/c_yui_window_manager.js
@@ -6267,14 +6270,14 @@ function register_c_yui_window() {
6267
6270
  /***************************************************************
6268
6271
  * Constants
6269
6272
  ***************************************************************/
6270
- var GCLASS_NAME$20 = "C_YUI_WINDOW_MANAGER";
6273
+ var GCLASS_NAME$21 = "C_YUI_WINDOW_MANAGER";
6271
6274
  var DOCK_Z = 1e6;
6272
6275
  var WC_X = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/></svg>";
6273
6276
  var __chip_seq__ = 0;
6274
6277
  /***************************************************************
6275
6278
  * Data
6276
6279
  ***************************************************************/
6277
- var attrs_table$20 = [
6280
+ var attrs_table$21 = [
6278
6281
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
6279
6282
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "dock_mode", 0, "floating", "floating | inline | responsive (floating on wide screens, inline on narrow)"),
6280
6283
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "dock_corner", 0, "bottom-left", "Floating placement: top-left | top-right | bottom-left | bottom-right"),
@@ -6284,20 +6287,20 @@ var attrs_table$20 = [
6284
6287
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Internal: the dock element"),
6285
6288
  (0, _yuneta_gobj_js.SDATA_END)()
6286
6289
  ];
6287
- var PRIVATE_DATA$20 = {
6290
+ var PRIVATE_DATA$21 = {
6288
6291
  windows: null,
6289
6292
  mql: null,
6290
6293
  mql_handler: null,
6291
6294
  lang_shell: null
6292
6295
  };
6293
- var __gclass__$20 = null;
6296
+ var __gclass__$21 = null;
6294
6297
  /******************************
6295
6298
  * Framework Methods
6296
6299
  ******************************/
6297
6300
  /***************************************************************
6298
6301
  * Framework Method: Create
6299
6302
  ***************************************************************/
6300
- function mt_create$20(gobj) {
6303
+ function mt_create$21(gobj) {
6301
6304
  let priv = gobj.priv;
6302
6305
  priv.windows = [];
6303
6306
  if (((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "dock_mode") || "floating") === "responsive") {
@@ -6310,14 +6313,14 @@ function mt_create$20(gobj) {
6310
6313
  }
6311
6314
  build_dock(gobj);
6312
6315
  yui_shell_watch_changes(gobj);
6313
- follow_language(gobj);
6316
+ follow_language$1(gobj);
6314
6317
  const subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
6315
6318
  if (subscriber) (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
6316
6319
  }
6317
6320
  /***************************************************************
6318
6321
  * Framework Method: Destroy
6319
6322
  ***************************************************************/
6320
- function mt_destroy$20(gobj) {
6323
+ function mt_destroy$21(gobj) {
6321
6324
  let priv = gobj.priv;
6322
6325
  yui_shell_unwatch_changes(gobj);
6323
6326
  if (priv.lang_shell) {
@@ -6343,7 +6346,7 @@ function mt_destroy$20(gobj) {
6343
6346
  * composed title, which no key carries: it is written again in
6344
6347
  * the new language (ac_language_changed).
6345
6348
  ************************************************************/
6346
- function follow_language(gobj) {
6349
+ function follow_language$1(gobj) {
6347
6350
  let priv = gobj.priv;
6348
6351
  let shell = yui_shell_of(gobj);
6349
6352
  if (shell && (0, _yuneta_gobj_js.gobj_is_destroying)(shell)) shell = null;
@@ -6854,9 +6857,9 @@ function ac_toggle_window(gobj, event, kw, src) {
6854
6857
  * logout, detached, until a window registered. Its language
6855
6858
  * is the new shell's too.
6856
6859
  ************************************************************/
6857
- function ac_shell_changed(gobj, event, kw, src) {
6860
+ function ac_shell_changed$1(gobj, event, kw, src) {
6858
6861
  apply_placement(gobj);
6859
- follow_language(gobj);
6862
+ follow_language$1(gobj);
6860
6863
  return 0;
6861
6864
  }
6862
6865
  /************************************************************
@@ -6868,7 +6871,7 @@ function ac_shell_changed(gobj, event, kw, src) {
6868
6871
  * language the window was opened in (a reader took the
6869
6872
  * aria-labelledby, which changed; the tooltip did not).
6870
6873
  ************************************************************/
6871
- function ac_language_changed$12(gobj, event, kw, src) {
6874
+ function ac_language_changed$13(gobj, event, kw, src) {
6872
6875
  let priv = gobj.priv;
6873
6876
  for (let entry of priv.windows) {
6874
6877
  if (!entry.title_prefix || !entry.$chip) continue;
@@ -6886,19 +6889,19 @@ function ac_language_changed$12(gobj, event, kw, src) {
6886
6889
  /***************************
6887
6890
  * FSM
6888
6891
  ***************************/
6889
- var gmt$20 = {
6890
- mt_create: mt_create$20,
6891
- mt_destroy: mt_destroy$20
6892
+ var gmt$21 = {
6893
+ mt_create: mt_create$21,
6894
+ mt_destroy: mt_destroy$21
6892
6895
  };
6893
6896
  /***************************************************************
6894
6897
  * Create the GClass
6895
6898
  ***************************************************************/
6896
- function create_gclass$20(gclass_name) {
6897
- if (__gclass__$20) {
6899
+ function create_gclass$21(gclass_name) {
6900
+ if (__gclass__$21) {
6898
6901
  (0, _yuneta_gobj_js.log_error)(`GClass ALREADY created: ${gclass_name}`);
6899
6902
  return -1;
6900
6903
  }
6901
- __gclass__$20 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, [
6904
+ __gclass__$21 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, [
6902
6905
  ["EV_REGISTER_WINDOW", 0],
6903
6906
  ["EV_UNREGISTER_WINDOW", 0],
6904
6907
  ["EV_MINIMIZE_WINDOW", 0],
@@ -6932,6 +6935,673 @@ function create_gclass$20(gclass_name) {
6932
6935
  ac_toggle_window,
6933
6936
  null
6934
6937
  ],
6938
+ [
6939
+ "EV_SHELL_CHANGED",
6940
+ ac_shell_changed$1,
6941
+ null
6942
+ ],
6943
+ [
6944
+ "EV_LANGUAGE_CHANGED",
6945
+ ac_language_changed$13,
6946
+ null
6947
+ ]
6948
+ ]]], gmt$21, 0, attrs_table$21, PRIVATE_DATA$21, 0, 0, 0, 0);
6949
+ if (!__gclass__$21) return -1;
6950
+ return 0;
6951
+ }
6952
+ /***************************************************************
6953
+ * Register GClass
6954
+ ***************************************************************/
6955
+ function register_c_yui_window_manager() {
6956
+ return create_gclass$21(GCLASS_NAME$21);
6957
+ }
6958
+ //#endregion
6959
+ //#region src/yui_build_stamp.js
6960
+ /***********************************************************************
6961
+ * yui_build_stamp.js
6962
+ *
6963
+ * Which build is this page, and which build does the server
6964
+ * hand out now.
6965
+ *
6966
+ * The build writes its own identity into index.html as
6967
+ *
6968
+ * <meta name="yuneta-build" content="<stamp>" data-version="<version>">
6969
+ *
6970
+ * (vite-plugin-yuneta-html.js, at build time only). The stamp is
6971
+ * a hash of the NAMES of every file of the bundle, and those
6972
+ * names carry the hash of their content: the same code built
6973
+ * twice gives the same stamp, and any change of a chunk, of a
6974
+ * lazy chunk or of a stylesheet gives another. A build date
6975
+ * would announce a "new version" after every rebuild of
6976
+ * unchanged code, and the deploy round rebuilds every app after
6977
+ * each publication of this library.
6978
+ *
6979
+ * The page that runs reads its stamp from its own DOM, where the
6980
+ * meta is never touched again; the deployed one is read from the
6981
+ * text of the same document fetched again. Pure functions: the
6982
+ * gclass that compares them is C_YUI_UPDATE_WATCH.
6983
+ *
6984
+ * Copyright (c) 2026, ArtGins.
6985
+ * All Rights Reserved.
6986
+ ***********************************************************************/
6987
+ var BUILD_META_NAME = "yuneta-build";
6988
+ /************************************************************
6989
+ * The build of the page that runs: {stamp, version}, or
6990
+ * null when its document carries no stamp (`vite dev`, or
6991
+ * an app built without the plugin).
6992
+ ************************************************************/
6993
+ function running_build(doc) {
6994
+ if (!doc || typeof doc.querySelector !== "function") return null;
6995
+ let $meta = doc.querySelector(`meta[name="${BUILD_META_NAME}"]`);
6996
+ if (!$meta) return null;
6997
+ let stamp = $meta.getAttribute("content") || "";
6998
+ if (!stamp) return null;
6999
+ return {
7000
+ stamp,
7001
+ version: $meta.getAttribute("data-version") || ""
7002
+ };
7003
+ }
7004
+ /************************************************************
7005
+ * The build named by the text of an index.html: {stamp,
7006
+ * version}, or null when the text carries no stamp -- an
7007
+ * error page, a captive portal, or a build older than the
7008
+ * stamp. Null is NOT "another build": a hotel wifi that
7009
+ * answers 200 with its own login page must not tell the
7010
+ * reader to reload into it.
7011
+ ************************************************************/
7012
+ function parse_build(html) {
7013
+ if (typeof html !== "string" || !html) return null;
7014
+ let metas = html.match(/<meta\b[^>]*>/gi) || [];
7015
+ for (let tag of metas) {
7016
+ if (read_html_attr(tag, "name") !== "yuneta-build") continue;
7017
+ let stamp = read_html_attr(tag, "content");
7018
+ if (!stamp) return null;
7019
+ return {
7020
+ stamp,
7021
+ version: read_html_attr(tag, "data-version")
7022
+ };
7023
+ }
7024
+ return null;
7025
+ }
7026
+ /************************************************************
7027
+ * The value of one attribute of one tag's text, quoted
7028
+ * with " or ' (the plugin writes ", a minifier may not).
7029
+ * The entities the plugin escapes are read back.
7030
+ ************************************************************/
7031
+ function read_html_attr(tag, name) {
7032
+ let re = new RegExp(`\\s${name}\\s*=\\s*("([^"]*)"|'([^']*)')`, "i");
7033
+ let m = tag.match(re);
7034
+ if (!m) return "";
7035
+ return (m[2] !== void 0 ? m[2] : m[3]).replace(/&quot;/g, "\"").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
7036
+ }
7037
+ /************************************************************
7038
+ * The url to ask for the deployed document: the page's own,
7039
+ * without its hash. Every route of these apps is a hash, so
7040
+ * this is the deploy root, whatever path the app is served
7041
+ * under.
7042
+ ************************************************************/
7043
+ function build_page_url(loc) {
7044
+ if (!loc) return "";
7045
+ return `${loc.origin || ""}${loc.pathname || "/"}${loc.search || ""}`;
7046
+ }
7047
+ //#endregion
7048
+ //#region src/c_yui_update_watch.js
7049
+ /***********************************************************************
7050
+ * c_yui_update_watch.js
7051
+ *
7052
+ * Is this page still running the build that is deployed?
7053
+ *
7054
+ * Every route of these apps is a hash: moving around reloads
7055
+ * nothing, and neither does a login or a logout. A page opened
7056
+ * before a deploy runs the old bundle until somebody reloads it
7057
+ * by hand, and the only symptom is that a fix "did not work" --
7058
+ * or worse: the deploy deleted the old lazy chunks, and the old
7059
+ * page breaks the first time it opens a view it had not loaded.
7060
+ *
7061
+ * This service compares the build of the page (yui_build_stamp.js,
7062
+ * the stamp the build writes into index.html) with the one the
7063
+ * server hands out now, fetching that same document with
7064
+ * `cache: "no-store"`. A difference is SAID, never acted on: a
7065
+ * bar with the new version, a reload button and a ✕. Reloading
7066
+ * is the reader's call -- they may be in the middle of something.
7067
+ *
7068
+ * When it asks (every one an event, through the FSM):
7069
+ * - at start;
7070
+ * - the tab comes back to the front, or the window gets the
7071
+ * focus (at most once each `min_interval_ms`);
7072
+ * - the browser is online again;
7073
+ * - a lazy chunk failed to load (`vite:preloadError`): the
7074
+ * symptom of exactly this, so it asks at once;
7075
+ * - every `period_ms`: a screen that is always in view (a
7076
+ * control room, a wall display) never gets the focus back.
7077
+ * A periodic query is a discarded pattern in Yuneta; THIS
7078
+ * one is a deliberate exception approved by the user
7079
+ * (2026-10-21), for every SPA. 0 turns it off;
7080
+ * - whenever the app sends EV_CHECK_BUILD -- on its backend's
7081
+ * EV_ON_OPEN, typically: a backend deploy often comes with
7082
+ * a deploy of the SPA.
7083
+ *
7084
+ * A build that comes back to the running one (a rollback) takes
7085
+ * the bar away again. A page with no stamp (`vite dev`) watches
7086
+ * nothing.
7087
+ *
7088
+ * The bar lives in the shell's notification layer, above its
7089
+ * dialogs; with no shell (the login, between a logout and the
7090
+ * next login) in document.body. It follows the shell across a
7091
+ * logout (yui_shell_watch_changes()), as the dock does.
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
+ *
7100
+ * Usage (an app, once, after creating the yuno):
7101
+ *
7102
+ * register_c_yui_update_watch();
7103
+ * const watch = gobj_create_service(
7104
+ * "__update_watch__", "C_YUI_UPDATE_WATCH", {}, yuno
7105
+ * );
7106
+ * gobj_start(watch);
7107
+ *
7108
+ * // on its backend's EV_ON_OPEN:
7109
+ * gobj_send_event(watch, "EV_CHECK_BUILD", {}, gobj);
7110
+ *
7111
+ * // the login's language switch (no shell yet):
7112
+ * switch_locale(locale);
7113
+ * yui_update_watch_language_changed();
7114
+ *
7115
+ * Input events:
7116
+ * EV_CHECK_BUILD {force?} ask the server (force skips
7117
+ * the minimum interval)
7118
+ * EV_RELOAD {} the bar's reload button
7119
+ * EV_DISMISS {} the bar's ✕: hidden for THIS
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())
7126
+ *
7127
+ * Output events (optional subscribers):
7128
+ * EV_NEW_BUILD {running, deployed, version}
7129
+ * EV_BUILD_CURRENT {running} the deployed build is the
7130
+ * running one again
7131
+ *
7132
+ * Copyright (c) 2026, ArtGins.
7133
+ * All Rights Reserved.
7134
+ ***********************************************************************/
7135
+ /***************************************************************
7136
+ * Constants
7137
+ ***************************************************************/
7138
+ var GCLASS_NAME$20 = "C_YUI_UPDATE_WATCH";
7139
+ /***************************************************************
7140
+ * Data
7141
+ ***************************************************************/
7142
+ var attrs_table$20 = [
7143
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
7144
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "min_interval_ms", 0, "60000", "Minimum time between two checks, except a forced one"),
7145
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "period_ms", 0, "3600000", "Periodic check, for a screen that never gets the focus back; 0 = off (user-approved exception to No polling)"),
7146
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_bar", 0, "1", "Show the bar; false leaves EV_NEW_BUILD to the app"),
7147
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "before_reload", 0, null, "fn() -> bool|Promise<bool>, asked before the reload; false vetoes it (unsaved edits)"),
7148
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$parent", 0, null, "Where the bar mounts (default: the shell's notification layer, document.body while there is none)"),
7149
+ (0, _yuneta_gobj_js.SDATA_END)()
7150
+ ];
7151
+ var PRIVATE_DATA$20 = {
7152
+ running: null,
7153
+ deployed: null,
7154
+ dismissed: "",
7155
+ in_flight: false,
7156
+ last_check: 0,
7157
+ failing: false,
7158
+ gobj_timer: null,
7159
+ $bar: null,
7160
+ lang_shell: null,
7161
+ dom_handlers: null
7162
+ };
7163
+ var __gclass__$20 = null;
7164
+ var __live_watches__ = [];
7165
+ /******************************
7166
+ * Framework Methods
7167
+ ******************************/
7168
+ /***************************************************************
7169
+ * Framework Method: Create
7170
+ ***************************************************************/
7171
+ function mt_create$20(gobj) {
7172
+ let priv = gobj.priv;
7173
+ priv.running = running_build(typeof document !== "undefined" ? document : null);
7174
+ priv.dom_handlers = [];
7175
+ __live_watches__.push(gobj);
7176
+ priv.gobj_timer = (0, _yuneta_gobj_js.gobj_create_pure_child)((0, _yuneta_gobj_js.gobj_name)(gobj), "C_TIMER", {}, gobj);
7177
+ yui_shell_watch_changes(gobj);
7178
+ follow_language(gobj);
7179
+ const subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
7180
+ if (subscriber) (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
7181
+ }
7182
+ /***************************************************************
7183
+ * Framework Method: Start
7184
+ ***************************************************************/
7185
+ function mt_start$20(gobj) {
7186
+ let priv = gobj.priv;
7187
+ (0, _yuneta_gobj_js.gobj_start)(priv.gobj_timer);
7188
+ if (!priv.running) {
7189
+ (0, _yuneta_gobj_js.log_info)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: this page carries no build stamp (vite dev?): nothing to watch`);
7190
+ return 0;
7191
+ }
7192
+ listen_dom(gobj, document, "visibilitychange", () => {
7193
+ if (document.visibilityState === "visible") (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHECK_BUILD", {}, gobj);
7194
+ });
7195
+ listen_dom(gobj, window, "focus", () => {
7196
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHECK_BUILD", {}, gobj);
7197
+ });
7198
+ listen_dom(gobj, window, "online", () => {
7199
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHECK_BUILD", { force: true }, gobj);
7200
+ });
7201
+ listen_dom(gobj, window, "vite:preloadError", () => {
7202
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHECK_BUILD", { force: true }, gobj);
7203
+ });
7204
+ let period = (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "period_ms");
7205
+ if (period > 0) (0, _yuneta_gobj_js.set_timeout_periodic)(priv.gobj_timer, period);
7206
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHECK_BUILD", { force: true }, gobj);
7207
+ return 0;
7208
+ }
7209
+ /***************************************************************
7210
+ * Framework Method: Stop
7211
+ ***************************************************************/
7212
+ function mt_stop$20(gobj) {
7213
+ let priv = gobj.priv;
7214
+ for (let [target, type, fn] of priv.dom_handlers) target.removeEventListener(type, fn);
7215
+ priv.dom_handlers = [];
7216
+ (0, _yuneta_gobj_js.clear_timeout)(priv.gobj_timer);
7217
+ if ((0, _yuneta_gobj_js.gobj_is_running)(priv.gobj_timer)) (0, _yuneta_gobj_js.gobj_stop)(priv.gobj_timer);
7218
+ }
7219
+ /***************************************************************
7220
+ * Framework Method: Destroy
7221
+ ***************************************************************/
7222
+ function mt_destroy$20(gobj) {
7223
+ let priv = gobj.priv;
7224
+ let idx = __live_watches__.indexOf(gobj);
7225
+ if (idx >= 0) __live_watches__.splice(idx, 1);
7226
+ yui_shell_unwatch_changes(gobj);
7227
+ if (priv.lang_shell) {
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);
7229
+ priv.lang_shell = null;
7230
+ }
7231
+ remove_bar(gobj);
7232
+ }
7233
+ /***************************
7234
+ * Local Methods
7235
+ ***************************/
7236
+ /************************************************************
7237
+ * Add a DOM listener, kept to be removed in mt_stop.
7238
+ ************************************************************/
7239
+ function listen_dom(gobj, target, type, fn) {
7240
+ target.addEventListener(type, fn);
7241
+ gobj.priv.dom_handlers.push([
7242
+ target,
7243
+ type,
7244
+ fn
7245
+ ]);
7246
+ }
7247
+ /************************************************************
7248
+ * Hear the language of the shell that holds the bar -- the
7249
+ * bar outlives a shell, so it follows them.
7250
+ ************************************************************/
7251
+ function follow_language(gobj) {
7252
+ let priv = gobj.priv;
7253
+ let shell = yui_shell_of(gobj);
7254
+ if (shell && (0, _yuneta_gobj_js.gobj_is_destroying)(shell)) shell = null;
7255
+ if (shell === priv.lang_shell) return;
7256
+ 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);
7257
+ priv.lang_shell = null;
7258
+ if (shell) {
7259
+ (0, _yuneta_gobj_js.gobj_subscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
7260
+ priv.lang_shell = shell;
7261
+ }
7262
+ }
7263
+ /************************************************************
7264
+ * Where the bar goes: the host's `$parent`, else the toasts'
7265
+ * layer of the live shell, else the body.
7266
+ ************************************************************/
7267
+ function bar_place(gobj) {
7268
+ let $parent = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "$parent");
7269
+ if ($parent) return $parent;
7270
+ let shell = yui_shell_of(gobj);
7271
+ if (shell && (0, _yuneta_gobj_js.gobj_is_destroying)(shell)) shell = null;
7272
+ return yui_shell_notification_layer(shell) || document.body;
7273
+ }
7274
+ /************************************************************
7275
+ * Show the bar for the deployed build, or move it to its
7276
+ * place. Not shown for a build the reader dismissed.
7277
+ ************************************************************/
7278
+ function show_bar(gobj) {
7279
+ let priv = gobj.priv;
7280
+ if (!(0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_bar")) return;
7281
+ if (!priv.deployed || priv.deployed.stamp === priv.dismissed) {
7282
+ remove_bar(gobj);
7283
+ return;
7284
+ }
7285
+ remove_bar(gobj);
7286
+ priv.$bar = (0, _yuneta_gobj_js.createElement2)([
7287
+ "div",
7288
+ {
7289
+ class: `C_YUI_UPDATE_WATCH UPDATE_BAR notification ${yui_tint("info")}`,
7290
+ role: "status"
7291
+ },
7292
+ [
7293
+ [
7294
+ "span",
7295
+ {
7296
+ class: "UPDATE_TEXT",
7297
+ i18n: "new version available"
7298
+ },
7299
+ (0, i18next.t)("new version available")
7300
+ ],
7301
+ [
7302
+ "span",
7303
+ { class: "UPDATE_VERSION" },
7304
+ text_node(priv.deployed.version)
7305
+ ],
7306
+ [
7307
+ "button",
7308
+ {
7309
+ class: "UPDATE_RELOAD button is-info",
7310
+ type: "button",
7311
+ i18n: "reload",
7312
+ title: (0, i18next.t)("reload"),
7313
+ "data-i18n-title": "reload",
7314
+ "aria-label": (0, i18next.t)("reload"),
7315
+ "data-i18n-aria-label": "reload"
7316
+ },
7317
+ (0, i18next.t)("reload"),
7318
+ { click: () => (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RELOAD", {}, gobj) }
7319
+ ],
7320
+ [
7321
+ "button",
7322
+ {
7323
+ class: "UPDATE_DISMISS delete",
7324
+ type: "button",
7325
+ title: (0, i18next.t)("close"),
7326
+ "data-i18n-title": "close",
7327
+ "aria-label": (0, i18next.t)("close"),
7328
+ "data-i18n-aria-label": "close"
7329
+ },
7330
+ null,
7331
+ { click: () => (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_DISMISS", {}, gobj) }
7332
+ ]
7333
+ ]
7334
+ ]);
7335
+ bar_place(gobj).appendChild(priv.$bar);
7336
+ }
7337
+ /************************************************************
7338
+ * Take the bar off the page.
7339
+ ************************************************************/
7340
+ function remove_bar(gobj) {
7341
+ let priv = gobj.priv;
7342
+ if (priv.$bar && priv.$bar.parentNode) priv.$bar.parentNode.removeChild(priv.$bar);
7343
+ priv.$bar = null;
7344
+ }
7345
+ /************************************************************
7346
+ * Ask the server which build it hands out. The answer comes
7347
+ * back as an event (a resolved promise is an OS notification).
7348
+ ************************************************************/
7349
+ function fetch_deployed_build(gobj) {
7350
+ let priv = gobj.priv;
7351
+ priv.in_flight = true;
7352
+ priv.last_check = performance.now();
7353
+ fetch(build_page_url(window.location), {
7354
+ cache: "no-store",
7355
+ credentials: "same-origin"
7356
+ }).then((response) => {
7357
+ if (!response.ok) throw { status: response.status };
7358
+ return response.text();
7359
+ }).then((html) => {
7360
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
7361
+ let deployed = parse_build(html);
7362
+ if (!deployed) {
7363
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHECK_FAILED", {
7364
+ reason: "the page served carries no build stamp",
7365
+ network: false
7366
+ }, gobj);
7367
+ return;
7368
+ }
7369
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_DEPLOYED_BUILD", deployed, gobj);
7370
+ }).catch((err) => {
7371
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
7372
+ let http = err && err.status;
7373
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHECK_FAILED", {
7374
+ reason: http ? `HTTP ${err.status}` : String(err && err.message || err),
7375
+ network: !http
7376
+ }, gobj);
7377
+ });
7378
+ }
7379
+ /***************************
7380
+ * Actions
7381
+ ***************************/
7382
+ /************************************************************
7383
+ * Ask the server, unless a question is out or the last one
7384
+ * is too recent (a focus and a visibilitychange come
7385
+ * together), or the browser says it is offline -- false is
7386
+ * the one answer of navigator.onLine that can be trusted.
7387
+ ************************************************************/
7388
+ function ac_check_build(gobj, event, kw, src) {
7389
+ let priv = gobj.priv;
7390
+ if (!priv.running) return 0;
7391
+ if (priv.in_flight) return 0;
7392
+ if (!kw.force) {
7393
+ let min_interval = (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "min_interval_ms");
7394
+ if (priv.last_check && performance.now() - priv.last_check < min_interval) return 0;
7395
+ }
7396
+ if (navigator.onLine === false) return 0;
7397
+ fetch_deployed_build(gobj);
7398
+ return 0;
7399
+ }
7400
+ /************************************************************
7401
+ * EV_TIMEOUT_PERIODIC -- the screen that never gets the
7402
+ * focus back asks too.
7403
+ ************************************************************/
7404
+ function ac_periodic(gobj, event, kw, src) {
7405
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHECK_BUILD", {}, gobj);
7406
+ return 0;
7407
+ }
7408
+ /************************************************************
7409
+ * The server answered with a build.
7410
+ ************************************************************/
7411
+ function ac_deployed_build(gobj, event, kw, src) {
7412
+ let priv = gobj.priv;
7413
+ priv.in_flight = false;
7414
+ if (priv.failing) {
7415
+ (0, _yuneta_gobj_js.log_info)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: the deployed build can be read again`);
7416
+ priv.failing = false;
7417
+ }
7418
+ let deployed = {
7419
+ stamp: kw.stamp,
7420
+ version: kw.version || ""
7421
+ };
7422
+ if (deployed.stamp === priv.running.stamp) {
7423
+ if ((0, _yuneta_gobj_js.gobj_current_state)(gobj) === "ST_STALE") {
7424
+ priv.deployed = null;
7425
+ remove_bar(gobj);
7426
+ (0, _yuneta_gobj_js.gobj_change_state)(gobj, "ST_CURRENT");
7427
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_BUILD_CURRENT", { running: priv.running.stamp });
7428
+ }
7429
+ return 0;
7430
+ }
7431
+ if (priv.deployed && priv.deployed.stamp === deployed.stamp) return 0;
7432
+ priv.deployed = deployed;
7433
+ (0, _yuneta_gobj_js.log_info)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a new build is deployed: ${deployed.version} ${deployed.stamp} (this page runs ${priv.running.version} ${priv.running.stamp})`);
7434
+ (0, _yuneta_gobj_js.gobj_change_state)(gobj, "ST_STALE");
7435
+ show_bar(gobj);
7436
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_NEW_BUILD", {
7437
+ running: priv.running.stamp,
7438
+ deployed: deployed.stamp,
7439
+ version: deployed.version
7440
+ });
7441
+ return 0;
7442
+ }
7443
+ /************************************************************
7444
+ * The server did not say. Offline is a normal state, so a
7445
+ * network failure is info; an answer that is not the app
7446
+ * (an HTTP error, a page with no stamp) is a warning. Both
7447
+ * are said on the transition only, not on every attempt.
7448
+ ************************************************************/
7449
+ function ac_check_failed(gobj, event, kw, src) {
7450
+ let priv = gobj.priv;
7451
+ priv.in_flight = false;
7452
+ if (priv.failing) return 0;
7453
+ priv.failing = true;
7454
+ let msg = `${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot read the deployed build: ${kw.reason}`;
7455
+ if (kw.network) (0, _yuneta_gobj_js.log_info)(msg);
7456
+ else (0, _yuneta_gobj_js.log_warning)(msg);
7457
+ return 0;
7458
+ }
7459
+ /************************************************************
7460
+ * The bar's reload button. The host may veto it (unsaved
7461
+ * edits): its answer comes back as an event.
7462
+ ************************************************************/
7463
+ function ac_reload(gobj, event, kw, src) {
7464
+ let before_reload = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "before_reload");
7465
+ if (typeof before_reload !== "function") {
7466
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RELOAD_ALLOWED", {}, gobj);
7467
+ return 0;
7468
+ }
7469
+ Promise.resolve().then(() => before_reload()).then((allowed) => {
7470
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
7471
+ if (allowed === false) {
7472
+ (0, _yuneta_gobj_js.log_info)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: the host vetoed the reload`);
7473
+ return;
7474
+ }
7475
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RELOAD_ALLOWED", {}, gobj);
7476
+ }, (err) => {
7477
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: before_reload() failed: ${err && err.message || err}`);
7478
+ });
7479
+ return 0;
7480
+ }
7481
+ /************************************************************
7482
+ * Load the deployed build. The hash stays: the reader comes
7483
+ * back to the same route.
7484
+ ************************************************************/
7485
+ function ac_reload_allowed(gobj, event, kw, src) {
7486
+ window.location.reload();
7487
+ return 0;
7488
+ }
7489
+ /************************************************************
7490
+ * The bar's ✕: hidden for this build; a later deploy shows
7491
+ * it again.
7492
+ ************************************************************/
7493
+ function ac_dismiss(gobj, event, kw, src) {
7494
+ let priv = gobj.priv;
7495
+ priv.dismissed = priv.deployed ? priv.deployed.stamp : "";
7496
+ remove_bar(gobj);
7497
+ return 0;
7498
+ }
7499
+ /************************************************************
7500
+ * EV_SHELL_CHANGED -- a shell was built, or is being
7501
+ * destroyed: the bar's place may have gone with it, or be in
7502
+ * the new one. Its language is the new shell's too.
7503
+ ************************************************************/
7504
+ function ac_shell_changed(gobj, event, kw, src) {
7505
+ let priv = gobj.priv;
7506
+ follow_language(gobj);
7507
+ if (priv.$bar) show_bar(gobj);
7508
+ return 0;
7509
+ }
7510
+ /************************************************************
7511
+ * EV_LANGUAGE_CHANGED -- from the shell that holds the bar.
7512
+ * Every text of the bar carries its key; it may live outside
7513
+ * the shell's container, where the app's refresh does not
7514
+ * reach.
7515
+ ************************************************************/
7516
+ function ac_language_changed$12(gobj, event, kw, src) {
7517
+ let priv = gobj.priv;
7518
+ if (priv.$bar) (0, _yuneta_gobj_js.refresh_language)(priv.$bar, i18next.t);
7519
+ return 0;
7520
+ }
7521
+ /***************************
7522
+ * FSM
7523
+ ***************************/
7524
+ var gmt$20 = {
7525
+ mt_create: mt_create$20,
7526
+ mt_start: mt_start$20,
7527
+ mt_stop: mt_stop$20,
7528
+ mt_destroy: mt_destroy$20
7529
+ };
7530
+ /***************************************************************
7531
+ * Create the GClass
7532
+ ***************************************************************/
7533
+ function create_gclass$20(gclass_name) {
7534
+ if (__gclass__$20) {
7535
+ (0, _yuneta_gobj_js.log_error)(`GClass ALREADY created: ${gclass_name}`);
7536
+ return -1;
7537
+ }
7538
+ const states = [["ST_CURRENT", [
7539
+ [
7540
+ "EV_CHECK_BUILD",
7541
+ ac_check_build,
7542
+ null
7543
+ ],
7544
+ [
7545
+ "EV_TIMEOUT_PERIODIC",
7546
+ ac_periodic,
7547
+ null
7548
+ ],
7549
+ [
7550
+ "EV_DEPLOYED_BUILD",
7551
+ ac_deployed_build,
7552
+ null
7553
+ ],
7554
+ [
7555
+ "EV_CHECK_FAILED",
7556
+ ac_check_failed,
7557
+ null
7558
+ ],
7559
+ [
7560
+ "EV_SHELL_CHANGED",
7561
+ ac_shell_changed,
7562
+ null
7563
+ ],
7564
+ [
7565
+ "EV_LANGUAGE_CHANGED",
7566
+ ac_language_changed$12,
7567
+ null
7568
+ ]
7569
+ ]], ["ST_STALE", [
7570
+ [
7571
+ "EV_CHECK_BUILD",
7572
+ ac_check_build,
7573
+ null
7574
+ ],
7575
+ [
7576
+ "EV_TIMEOUT_PERIODIC",
7577
+ ac_periodic,
7578
+ null
7579
+ ],
7580
+ [
7581
+ "EV_DEPLOYED_BUILD",
7582
+ ac_deployed_build,
7583
+ null
7584
+ ],
7585
+ [
7586
+ "EV_CHECK_FAILED",
7587
+ ac_check_failed,
7588
+ null
7589
+ ],
7590
+ [
7591
+ "EV_RELOAD",
7592
+ ac_reload,
7593
+ null
7594
+ ],
7595
+ [
7596
+ "EV_RELOAD_ALLOWED",
7597
+ ac_reload_allowed,
7598
+ null
7599
+ ],
7600
+ [
7601
+ "EV_DISMISS",
7602
+ ac_dismiss,
7603
+ null
7604
+ ],
6935
7605
  [
6936
7606
  "EV_SHELL_CHANGED",
6937
7607
  ac_shell_changed,
@@ -6942,16 +7612,47 @@ function create_gclass$20(gclass_name) {
6942
7612
  ac_language_changed$12,
6943
7613
  null
6944
7614
  ]
6945
- ]]], gmt$20, 0, attrs_table$20, PRIVATE_DATA$20, 0, 0, 0, 0);
7615
+ ]]];
7616
+ const event_types = [
7617
+ ["EV_CHECK_BUILD", 0],
7618
+ ["EV_TIMEOUT_PERIODIC", 0],
7619
+ ["EV_DEPLOYED_BUILD", 0],
7620
+ ["EV_CHECK_FAILED", 0],
7621
+ ["EV_RELOAD", 0],
7622
+ ["EV_RELOAD_ALLOWED", 0],
7623
+ ["EV_DISMISS", 0],
7624
+ ["EV_SHELL_CHANGED", 0],
7625
+ ["EV_LANGUAGE_CHANGED", 0],
7626
+ ["EV_NEW_BUILD", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
7627
+ ["EV_BUILD_CURRENT", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS]
7628
+ ];
7629
+ __gclass__$20 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$20, 0, attrs_table$20, PRIVATE_DATA$20, 0, 0, 0, 0);
6946
7630
  if (!__gclass__$20) return -1;
6947
7631
  return 0;
6948
7632
  }
6949
7633
  /***************************************************************
6950
7634
  * Register GClass
6951
7635
  ***************************************************************/
6952
- function register_c_yui_window_manager() {
7636
+ function register_c_yui_update_watch() {
6953
7637
  return create_gclass$20(GCLASS_NAME$20);
6954
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
+ }
6955
7656
  //#endregion
6956
7657
  //#region src/pager_helpers.js
6957
7658
  /***************************************************************
@@ -22576,7 +23277,8 @@ var PRIVATE_DATA$10 = {
22576
23277
  $raw: null,
22577
23278
  $raw_body: null,
22578
23279
  $search: null,
22579
- $mode_btns: null
23280
+ $mode_btns: null,
23281
+ lang_shell: null
22580
23282
  };
22581
23283
  var __gclass__$10 = null;
22582
23284
  /******************************
@@ -22602,12 +23304,21 @@ function mt_create$10(gobj) {
22602
23304
  * Framework Method: Start
22603
23305
  ***************************************************************/
22604
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
+ }
22605
23313
  render_view(gobj);
22606
23314
  }
22607
23315
  /***************************************************************
22608
23316
  * Framework Method: Stop
22609
23317
  ***************************************************************/
22610
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;
22611
23322
  teardown_graph_child(gobj);
22612
23323
  }
22613
23324
  /***************************************************************
@@ -24213,6 +24924,7 @@ function ac_language_changed$6(gobj, event, kw, src) {
24213
24924
  apply_view_mode(gobj);
24214
24925
  }
24215
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);
24216
24928
  return 0;
24217
24929
  }
24218
24930
  /************************************************************
@@ -51609,7 +52321,7 @@ function restore_view_state(gobj) {
51609
52321
  done = true;
51610
52322
  }
51611
52323
  if (position !== null) {
51612
- graph.translateTo(position);
52324
+ graph.translateTo(translate_of_position(graph, position, zoom !== null ? zoom : graph.getZoom()));
51613
52325
  done = true;
51614
52326
  }
51615
52327
  if (state.anchor) {
@@ -51627,6 +52339,11 @@ function restore_view_state(gobj) {
51627
52339
  yui_graph_update_zoom((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container"), priv.graph);
51628
52340
  return done;
51629
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
+ }
51630
52347
  function camera_shows_a_card(gobj, zoom, position) {
51631
52348
  let priv = gobj.priv;
51632
52349
  let graph = priv.graph;
@@ -51634,16 +52351,15 @@ function camera_shows_a_card(gobj, zoom, position) {
51634
52351
  if (!graph || !ids.length) return true;
51635
52352
  try {
51636
52353
  let size = graph.getSize();
51637
- let c = graph.getCanvasCenter();
51638
52354
  let z = zoom !== null ? zoom : graph.getZoom();
51639
- let t = position !== null ? position : graph.getPosition();
52355
+ let s = position !== null ? position : graph.getPosition();
51640
52356
  let w = size[0];
51641
52357
  let h = size[1];
51642
52358
  if (!(w > 0 && h > 0) || !(z > 0)) return true;
51643
52359
  for (let id of ids) {
51644
52360
  let n = graph.getElementPosition(id);
51645
- let vx = (n[0] - c[0]) * z + t[0] + c[0];
51646
- 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;
51647
52363
  if (vx >= 0 && vx <= w && vy >= 0 && vy <= h) return true;
51648
52364
  }
51649
52365
  } catch (e) {
@@ -51723,6 +52439,7 @@ var PRIVATE_DATA$9 = {
51723
52439
  trace_info: {},
51724
52440
  trace_pending: false,
51725
52441
  popover_mode: "",
52442
+ viewer_awaits: "",
51726
52443
  viewer_stale: "",
51727
52444
  view_refused: false
51728
52445
  };
@@ -54123,6 +54840,8 @@ function open_gclass_window(gobj, gclass, description, d) {
54123
54840
  let priv = gobj.priv;
54124
54841
  close_gclass_view(priv.gclass_view);
54125
54842
  priv.gclass_view = null;
54843
+ priv.viewer_awaits = "";
54844
+ priv.viewer_stale = "";
54126
54845
  let opts = {
54127
54846
  title_prefix: is_remote(gobj) ? (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "yuno_name") || "" : (0, _yuneta_gobj_js.gobj_yuno_name)() || "",
54128
54847
  current_state: d && d.state || "",
@@ -54195,10 +54914,16 @@ function ac_trace_info(gobj, event, kw, src) {
54195
54914
  let viewer = gclass_viewer_gobj(gobj);
54196
54915
  if (viewer) {
54197
54916
  let shown = (0, _yuneta_gobj_js.gobj_read_str_attr)(viewer, "gclass_name");
54917
+ if (priv.viewer_awaits === kw.gclass) {
54918
+ priv.viewer_awaits = "";
54919
+ if (priv.viewer_stale === shown && shown !== kw.gclass) {
54920
+ priv.viewer_stale = "";
54921
+ priv.viewer_awaits = shown;
54922
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
54923
+ }
54924
+ }
54198
54925
  if (shown === kw.gclass) (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
54199
- else if (priv.viewer_stale === shown) (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
54200
54926
  }
54201
- priv.viewer_stale = "";
54202
54927
  return 0;
54203
54928
  }
54204
54929
  /************************************************************
@@ -54211,13 +54936,14 @@ function gclass_viewer_gobj(gobj) {
54211
54936
  /************************************************************
54212
54937
  * What the gclass viewer needs to draw the traces of `gclass`
54213
54938
  * for every gobj of it: the levels the host read, and whether a
54214
- * set is still in flight. Plain json: it rides in a kw.
54939
+ * set that concerns it is still in flight. Plain json: it rides
54940
+ * in a kw.
54215
54941
  ************************************************************/
54216
54942
  function viewer_traces(gobj, gclass) {
54217
54943
  let priv = gobj.priv;
54218
54944
  return {
54219
54945
  info: priv.trace_info[gclass] || null,
54220
- pending: !!priv.trace_pending
54946
+ pending: !!priv.viewer_awaits
54221
54947
  };
54222
54948
  }
54223
54949
  /************************************************************
@@ -54301,8 +55027,11 @@ function set_trace_levels(gobj, target, scope, levels, set) {
54301
55027
  let viewer = gclass_viewer_gobj(gobj);
54302
55028
  if (viewer) {
54303
55029
  let shown = (0, _yuneta_gobj_js.gobj_read_str_attr)(viewer, "gclass_name");
54304
- if (scope === "global" && shown !== target.gclass) priv.viewer_stale = shown;
54305
- (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
55030
+ if (shown === target.gclass || scope === "global") {
55031
+ priv.viewer_awaits = target.gclass;
55032
+ priv.viewer_stale = shown !== target.gclass ? shown : "";
55033
+ (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
55034
+ }
54306
55035
  }
54307
55036
  (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_SET_TRACE_LEVEL", {
54308
55037
  scope,
@@ -88392,6 +89121,7 @@ exports.register_c_yui_treedb_graph = register_c_yui_treedb_graph;
88392
89121
  exports.register_c_yui_treedb_schema = register_c_yui_treedb_schema;
88393
89122
  exports.register_c_yui_treedb_topic_with_form = register_c_yui_treedb_topic_with_form;
88394
89123
  exports.register_c_yui_treedb_topics = register_c_yui_treedb_topics;
89124
+ exports.register_c_yui_update_watch = register_c_yui_update_watch;
88395
89125
  exports.register_c_yui_uplot = register_c_yui_uplot;
88396
89126
  exports.register_c_yui_window = register_c_yui_window;
88397
89127
  exports.register_c_yui_window_manager = register_c_yui_window_manager;
@@ -88460,6 +89190,7 @@ exports.yui_svg_icon_element = yui_svg_icon_element;
88460
89190
  exports.yui_svg_sanitize = yui_svg_sanitize;
88461
89191
  exports.yui_theme_now = yui_theme_now;
88462
89192
  exports.yui_toolbar = yui_toolbar;
89193
+ exports.yui_update_watch_language_changed = yui_update_watch_language_changed;
88463
89194
  exports.yui_user_icon_class = yui_user_icon_class;
88464
89195
  exports.yui_watch_theme = yui_watch_theme;
88465
89196