@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.
@@ -1,4 +1,4 @@
1
- import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_event, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, html_markup, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_is_identical, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_remove_local_storage_value, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, sprintf, str_in_list, template_get_field_desc, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
1
+ import { SDATA, SDATA_END, clean_name, clear_timeout, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_event, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, html_markup, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_is_identical, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_remove_local_storage_value, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_info, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, set_timeout_periodic, sprintf, str_in_list, template_get_field_desc, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
2
2
  import i18next, { t } from "i18next";
3
3
  import TomSelect from "tom-select";
4
4
  import { createJSONEditor } from "vanilla-jsoneditor";
@@ -1219,7 +1219,7 @@ function secondary_nav_renders(item, layout) {
1219
1219
  /***************************************************************
1220
1220
  * Constants
1221
1221
  ***************************************************************/
1222
- var GCLASS_NAME$22 = "C_YUI_SHELL";
1222
+ var GCLASS_NAME$23 = "C_YUI_SHELL";
1223
1223
  var __live_shells__ = [];
1224
1224
  var __retiring_shell__ = null;
1225
1225
  var __dead_entries__ = /* @__PURE__ */ new Set();
@@ -1246,7 +1246,7 @@ var LAYER_DEFS = [
1246
1246
  /***************************************************************
1247
1247
  * Attrs
1248
1248
  ***************************************************************/
1249
- var attrs_table$22 = [
1249
+ var attrs_table$23 = [
1250
1250
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
1251
1251
  SDATA(data_type_t.DTP_JSON, "config", 0, null, "Shell declarative config (zones, menu, stages, toolbar)"),
1252
1252
  SDATA(data_type_t.DTP_STRING, "default_route", 0, "", "Fallback route if hash is empty"),
@@ -1257,7 +1257,7 @@ var attrs_table$22 = [
1257
1257
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Root HTMLElement of the shell"),
1258
1258
  SDATA_END()
1259
1259
  ];
1260
- var PRIVATE_DATA$22 = {
1260
+ var PRIVATE_DATA$23 = {
1261
1261
  zones: {},
1262
1262
  layers: {},
1263
1263
  window_layer: null,
@@ -1300,14 +1300,14 @@ var PRIVATE_DATA$22 = {
1300
1300
  connected: null,
1301
1301
  active_dropdown: null
1302
1302
  };
1303
- var __gclass__$22 = null;
1303
+ var __gclass__$23 = null;
1304
1304
  /******************************
1305
1305
  * Framework Methods
1306
1306
  ******************************/
1307
1307
  /***************************************************************
1308
1308
  * Framework Method: Create
1309
1309
  ***************************************************************/
1310
- function mt_create$22(gobj) {
1310
+ function mt_create$23(gobj) {
1311
1311
  const subscriber = gobj_read_pointer_attr(gobj, "subscriber");
1312
1312
  if (subscriber) gobj_subscribe_event(gobj, null, {}, subscriber);
1313
1313
  __live_shells__.push(gobj);
@@ -1317,7 +1317,7 @@ function mt_create$22(gobj) {
1317
1317
  /***************************************************************
1318
1318
  * Framework Method: Start
1319
1319
  ***************************************************************/
1320
- function mt_start$21(gobj) {
1320
+ function mt_start$22(gobj) {
1321
1321
  let config = gobj_read_attr(gobj, "config") || {};
1322
1322
  let priv = gobj.priv;
1323
1323
  if (!validate_config(config)) {
@@ -1461,7 +1461,7 @@ function mt_start$21(gobj) {
1461
1461
  /***************************************************************
1462
1462
  * Framework Method: Stop
1463
1463
  ***************************************************************/
1464
- function mt_stop$20(gobj) {
1464
+ function mt_stop$21(gobj) {
1465
1465
  let priv = gobj.priv;
1466
1466
  if (!priv) return 0;
1467
1467
  retire_overlays(gobj);
@@ -1525,7 +1525,7 @@ function mt_stop$20(gobj) {
1525
1525
  /***************************************************************
1526
1526
  * Framework Method: Destroy
1527
1527
  ***************************************************************/
1528
- function mt_destroy$22(gobj) {
1528
+ function mt_destroy$23(gobj) {
1529
1529
  retire_overlays(gobj);
1530
1530
  close_toolbar_dropdown(gobj);
1531
1531
  let live_idx = __live_shells__.indexOf(gobj);
@@ -3658,15 +3658,15 @@ function mt_publication_pre_filter(gobj, subs, event, kw) {
3658
3658
  if (!subscriber || !gobj_has_event(subscriber, event, 0)) return 0;
3659
3659
  return 1;
3660
3660
  }
3661
- var gmt$22 = {
3662
- mt_create: mt_create$22,
3663
- mt_start: mt_start$21,
3664
- mt_stop: mt_stop$20,
3665
- mt_destroy: mt_destroy$22,
3661
+ var gmt$23 = {
3662
+ mt_create: mt_create$23,
3663
+ mt_start: mt_start$22,
3664
+ mt_stop: mt_stop$21,
3665
+ mt_destroy: mt_destroy$23,
3666
3666
  mt_publication_pre_filter
3667
3667
  };
3668
- function create_gclass$22(gclass_name) {
3669
- if (__gclass__$22) {
3668
+ function create_gclass$23(gclass_name) {
3669
+ if (__gclass__$23) {
3670
3670
  log_error(`GClass ALREADY created: ${gclass_name}`);
3671
3671
  return -1;
3672
3672
  }
@@ -3709,12 +3709,12 @@ function create_gclass$22(gclass_name) {
3709
3709
  ["EV_ICONS_CHANGED", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_PUBLIC_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
3710
3710
  ["EV_CONNECTION_STATE", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS]
3711
3711
  ];
3712
- __gclass__$22 = gclass_create(gclass_name, event_types, states, gmt$22, 0, attrs_table$22, PRIVATE_DATA$22, 0, 0, 0, gclass_flag_t.gcflag_no_check_output_events);
3713
- if (!__gclass__$22) return -1;
3712
+ __gclass__$23 = gclass_create(gclass_name, event_types, states, gmt$23, 0, attrs_table$23, PRIVATE_DATA$23, 0, 0, 0, gclass_flag_t.gcflag_no_check_output_events);
3713
+ if (!__gclass__$23) return -1;
3714
3714
  return 0;
3715
3715
  }
3716
3716
  function register_c_yui_shell() {
3717
- return create_gclass$22(GCLASS_NAME$22);
3717
+ return create_gclass$23(GCLASS_NAME$23);
3718
3718
  }
3719
3719
  /***************************************************************
3720
3720
  * Public helpers — exported alongside register_c_yui_shell().
@@ -3834,7 +3834,7 @@ function yui_shell_previous_route(shell_gobj) {
3834
3834
  function yui_shell_of(gobj) {
3835
3835
  let g = gobj;
3836
3836
  while (g) {
3837
- if (gobj_gclass_name(g) === GCLASS_NAME$22) return g;
3837
+ if (gobj_gclass_name(g) === GCLASS_NAME$23) return g;
3838
3838
  g = gobj_parent(g);
3839
3839
  }
3840
3840
  return __live_shells__.length > 0 ? __live_shells__[__live_shells__.length - 1] : null;
@@ -4335,6 +4335,9 @@ function yui_shell_popup_layer(shell) {
4335
4335
  let priv = shell.priv;
4336
4336
  return priv && priv.layers && priv.layers.popup || null;
4337
4337
  }
4338
+ function yui_shell_notification_layer(shell) {
4339
+ return notification_layer(shell) || null;
4340
+ }
4338
4341
  /***************************************************************
4339
4342
  * i18n bridge:
4340
4343
  * - `text` is rendered as the canonical English key.
@@ -4947,7 +4950,7 @@ function yui_shell_confirm_yesnocancel(shell, message, opts) {
4947
4950
  /***************************************************************
4948
4951
  * Constants
4949
4952
  ***************************************************************/
4950
- var GCLASS_NAME$21 = "C_YUI_WINDOW";
4953
+ var GCLASS_NAME$22 = "C_YUI_WINDOW";
4951
4954
  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>";
4952
4955
  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>";
4953
4956
  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>";
@@ -4960,7 +4963,7 @@ var __title_seq__ = 0;
4960
4963
  /***************************************************************
4961
4964
  * Data
4962
4965
  ***************************************************************/
4963
- var attrs_table$21 = [
4966
+ var attrs_table$22 = [
4964
4967
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
4965
4968
  SDATA(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"),
4966
4969
  SDATA(data_type_t.DTP_INTEGER, "x", 0, "300", "X position"),
@@ -4998,7 +5001,7 @@ var attrs_table$21 = [
4998
5001
  SDATA(data_type_t.DTP_POINTER, "win_resize_handler", 0, null, "Internal: native window 'resize' listener"),
4999
5002
  SDATA_END()
5000
5003
  ];
5001
- var PRIVATE_DATA$21 = {
5004
+ var PRIVATE_DATA$22 = {
5002
5005
  prevSize: 0,
5003
5006
  placed_by_shell: false,
5004
5007
  back_shell: null,
@@ -5007,14 +5010,14 @@ var PRIVATE_DATA$21 = {
5007
5010
  release_focus: null,
5008
5011
  escape_order: 0
5009
5012
  };
5010
- var __gclass__$21 = null;
5013
+ var __gclass__$22 = null;
5011
5014
  /******************************
5012
5015
  * Framework Methods
5013
5016
  ******************************/
5014
5017
  /***************************************************************
5015
5018
  * Framework Method: Create
5016
5019
  ***************************************************************/
5017
- function mt_create$21(gobj) {
5020
+ function mt_create$22(gobj) {
5018
5021
  const subscriber = gobj_read_pointer_attr(gobj, "subscriber");
5019
5022
  if (subscriber) gobj_subscribe_event(gobj, null, {}, subscriber);
5020
5023
  let window_id = "window-" + clean_name(gobj_short_name(gobj));
@@ -5077,7 +5080,7 @@ function mt_create$21(gobj) {
5077
5080
  * it could not be seen, and the next Tab gave it back to the
5078
5081
  * overlay; it opens under it now, and is there when it goes.
5079
5082
  ***************************************************************/
5080
- function mt_start$20(gobj) {
5083
+ function mt_start$21(gobj) {
5081
5084
  let priv = gobj.priv;
5082
5085
  let $container = gobj_read_attr(gobj, "$container");
5083
5086
  if (!$container) {
@@ -5096,7 +5099,7 @@ function mt_start$20(gobj) {
5096
5099
  /***************************************************************
5097
5100
  * Framework Method: Destroy
5098
5101
  ***************************************************************/
5099
- function mt_destroy$21(gobj) {
5102
+ function mt_destroy$22(gobj) {
5100
5103
  let priv = gobj.priv;
5101
5104
  give_focus_back(gobj);
5102
5105
  yui_shell_unwatch_changes(gobj);
@@ -5380,7 +5383,7 @@ function resolve_manager(gobj) {
5380
5383
  if (typeof m === "string") {
5381
5384
  let name = m;
5382
5385
  m = gobj_find_service(name, false) || null;
5383
- if (!m) log_warning(`${GCLASS_NAME$21}: window manager '${name}' not found: no dock, no minimize`);
5386
+ if (!m) log_warning(`${GCLASS_NAME$22}: window manager '${name}' not found: no dock, no minimize`);
5384
5387
  gobj_write_attr(gobj, "manager", m);
5385
5388
  }
5386
5389
  return m;
@@ -6131,7 +6134,7 @@ function ac_close(gobj, event, kw, src) {
6131
6134
  * still being built would sit under its first route. Back no
6132
6135
  * longer closes such a window; its ✕ does, as before 7.26.31.
6133
6136
  ************************************************************/
6134
- function ac_shell_changed$1(gobj, event, kw, src) {
6137
+ function ac_shell_changed$2(gobj, event, kw, src) {
6135
6138
  let priv = gobj.priv;
6136
6139
  let going = gobj_is_destroying(src);
6137
6140
  if (going && priv.back_shell === src) {
@@ -6157,16 +6160,16 @@ function ac_shell_changed$1(gobj, event, kw, src) {
6157
6160
  /***************************
6158
6161
  * FSM
6159
6162
  ***************************/
6160
- var gmt$21 = {
6161
- mt_create: mt_create$21,
6162
- mt_start: mt_start$20,
6163
- mt_destroy: mt_destroy$21
6163
+ var gmt$22 = {
6164
+ mt_create: mt_create$22,
6165
+ mt_start: mt_start$21,
6166
+ mt_destroy: mt_destroy$22
6164
6167
  };
6165
6168
  /***************************************************************
6166
6169
  * Create the GClass
6167
6170
  ***************************************************************/
6168
- function create_gclass$21(gclass_name) {
6169
- if (__gclass__$21) {
6171
+ function create_gclass$22(gclass_name) {
6172
+ if (__gclass__$22) {
6170
6173
  log_error(`GClass ALREADY created: ${gclass_name}`);
6171
6174
  return -1;
6172
6175
  }
@@ -6193,7 +6196,7 @@ function create_gclass$21(gclass_name) {
6193
6196
  ],
6194
6197
  [
6195
6198
  "EV_SHELL_CHANGED",
6196
- ac_shell_changed$1,
6199
+ ac_shell_changed$2,
6197
6200
  null
6198
6201
  ]
6199
6202
  ]]];
@@ -6207,15 +6210,15 @@ function create_gclass$21(gclass_name) {
6207
6210
  ["EV_CLOSE_WINDOW", 0],
6208
6211
  ["EV_SHELL_CHANGED", 0]
6209
6212
  ];
6210
- __gclass__$21 = gclass_create(gclass_name, event_types, states, gmt$21, 0, attrs_table$21, PRIVATE_DATA$21, 0, 0, 0, 0);
6211
- if (!__gclass__$21) return -1;
6213
+ __gclass__$22 = gclass_create(gclass_name, event_types, states, gmt$22, 0, attrs_table$22, PRIVATE_DATA$22, 0, 0, 0, 0);
6214
+ if (!__gclass__$22) return -1;
6212
6215
  return 0;
6213
6216
  }
6214
6217
  /***************************************************************
6215
6218
  * Register GClass
6216
6219
  ***************************************************************/
6217
6220
  function register_c_yui_window() {
6218
- return create_gclass$21(GCLASS_NAME$21);
6221
+ return create_gclass$22(GCLASS_NAME$22);
6219
6222
  }
6220
6223
  //#endregion
6221
6224
  //#region src/c_yui_window_manager.js
@@ -6262,14 +6265,14 @@ function register_c_yui_window() {
6262
6265
  /***************************************************************
6263
6266
  * Constants
6264
6267
  ***************************************************************/
6265
- var GCLASS_NAME$20 = "C_YUI_WINDOW_MANAGER";
6268
+ var GCLASS_NAME$21 = "C_YUI_WINDOW_MANAGER";
6266
6269
  var DOCK_Z = 1e6;
6267
6270
  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>";
6268
6271
  var __chip_seq__ = 0;
6269
6272
  /***************************************************************
6270
6273
  * Data
6271
6274
  ***************************************************************/
6272
- var attrs_table$20 = [
6275
+ var attrs_table$21 = [
6273
6276
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
6274
6277
  SDATA(data_type_t.DTP_STRING, "dock_mode", 0, "floating", "floating | inline | responsive (floating on wide screens, inline on narrow)"),
6275
6278
  SDATA(data_type_t.DTP_STRING, "dock_corner", 0, "bottom-left", "Floating placement: top-left | top-right | bottom-left | bottom-right"),
@@ -6279,20 +6282,20 @@ var attrs_table$20 = [
6279
6282
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Internal: the dock element"),
6280
6283
  SDATA_END()
6281
6284
  ];
6282
- var PRIVATE_DATA$20 = {
6285
+ var PRIVATE_DATA$21 = {
6283
6286
  windows: null,
6284
6287
  mql: null,
6285
6288
  mql_handler: null,
6286
6289
  lang_shell: null
6287
6290
  };
6288
- var __gclass__$20 = null;
6291
+ var __gclass__$21 = null;
6289
6292
  /******************************
6290
6293
  * Framework Methods
6291
6294
  ******************************/
6292
6295
  /***************************************************************
6293
6296
  * Framework Method: Create
6294
6297
  ***************************************************************/
6295
- function mt_create$20(gobj) {
6298
+ function mt_create$21(gobj) {
6296
6299
  let priv = gobj.priv;
6297
6300
  priv.windows = [];
6298
6301
  if ((gobj_read_attr(gobj, "dock_mode") || "floating") === "responsive") {
@@ -6305,14 +6308,14 @@ function mt_create$20(gobj) {
6305
6308
  }
6306
6309
  build_dock(gobj);
6307
6310
  yui_shell_watch_changes(gobj);
6308
- follow_language(gobj);
6311
+ follow_language$1(gobj);
6309
6312
  const subscriber = gobj_read_pointer_attr(gobj, "subscriber");
6310
6313
  if (subscriber) gobj_subscribe_event(gobj, null, {}, subscriber);
6311
6314
  }
6312
6315
  /***************************************************************
6313
6316
  * Framework Method: Destroy
6314
6317
  ***************************************************************/
6315
- function mt_destroy$20(gobj) {
6318
+ function mt_destroy$21(gobj) {
6316
6319
  let priv = gobj.priv;
6317
6320
  yui_shell_unwatch_changes(gobj);
6318
6321
  if (priv.lang_shell) {
@@ -6338,7 +6341,7 @@ function mt_destroy$20(gobj) {
6338
6341
  * composed title, which no key carries: it is written again in
6339
6342
  * the new language (ac_language_changed).
6340
6343
  ************************************************************/
6341
- function follow_language(gobj) {
6344
+ function follow_language$1(gobj) {
6342
6345
  let priv = gobj.priv;
6343
6346
  let shell = yui_shell_of(gobj);
6344
6347
  if (shell && gobj_is_destroying(shell)) shell = null;
@@ -6849,9 +6852,9 @@ function ac_toggle_window(gobj, event, kw, src) {
6849
6852
  * logout, detached, until a window registered. Its language
6850
6853
  * is the new shell's too.
6851
6854
  ************************************************************/
6852
- function ac_shell_changed(gobj, event, kw, src) {
6855
+ function ac_shell_changed$1(gobj, event, kw, src) {
6853
6856
  apply_placement(gobj);
6854
- follow_language(gobj);
6857
+ follow_language$1(gobj);
6855
6858
  return 0;
6856
6859
  }
6857
6860
  /************************************************************
@@ -6863,7 +6866,7 @@ function ac_shell_changed(gobj, event, kw, src) {
6863
6866
  * language the window was opened in (a reader took the
6864
6867
  * aria-labelledby, which changed; the tooltip did not).
6865
6868
  ************************************************************/
6866
- function ac_language_changed$12(gobj, event, kw, src) {
6869
+ function ac_language_changed$13(gobj, event, kw, src) {
6867
6870
  let priv = gobj.priv;
6868
6871
  for (let entry of priv.windows) {
6869
6872
  if (!entry.title_prefix || !entry.$chip) continue;
@@ -6881,19 +6884,19 @@ function ac_language_changed$12(gobj, event, kw, src) {
6881
6884
  /***************************
6882
6885
  * FSM
6883
6886
  ***************************/
6884
- var gmt$20 = {
6885
- mt_create: mt_create$20,
6886
- mt_destroy: mt_destroy$20
6887
+ var gmt$21 = {
6888
+ mt_create: mt_create$21,
6889
+ mt_destroy: mt_destroy$21
6887
6890
  };
6888
6891
  /***************************************************************
6889
6892
  * Create the GClass
6890
6893
  ***************************************************************/
6891
- function create_gclass$20(gclass_name) {
6892
- if (__gclass__$20) {
6894
+ function create_gclass$21(gclass_name) {
6895
+ if (__gclass__$21) {
6893
6896
  log_error(`GClass ALREADY created: ${gclass_name}`);
6894
6897
  return -1;
6895
6898
  }
6896
- __gclass__$20 = gclass_create(gclass_name, [
6899
+ __gclass__$21 = gclass_create(gclass_name, [
6897
6900
  ["EV_REGISTER_WINDOW", 0],
6898
6901
  ["EV_UNREGISTER_WINDOW", 0],
6899
6902
  ["EV_MINIMIZE_WINDOW", 0],
@@ -6927,6 +6930,673 @@ function create_gclass$20(gclass_name) {
6927
6930
  ac_toggle_window,
6928
6931
  null
6929
6932
  ],
6933
+ [
6934
+ "EV_SHELL_CHANGED",
6935
+ ac_shell_changed$1,
6936
+ null
6937
+ ],
6938
+ [
6939
+ "EV_LANGUAGE_CHANGED",
6940
+ ac_language_changed$13,
6941
+ null
6942
+ ]
6943
+ ]]], gmt$21, 0, attrs_table$21, PRIVATE_DATA$21, 0, 0, 0, 0);
6944
+ if (!__gclass__$21) return -1;
6945
+ return 0;
6946
+ }
6947
+ /***************************************************************
6948
+ * Register GClass
6949
+ ***************************************************************/
6950
+ function register_c_yui_window_manager() {
6951
+ return create_gclass$21(GCLASS_NAME$21);
6952
+ }
6953
+ //#endregion
6954
+ //#region src/yui_build_stamp.js
6955
+ /***********************************************************************
6956
+ * yui_build_stamp.js
6957
+ *
6958
+ * Which build is this page, and which build does the server
6959
+ * hand out now.
6960
+ *
6961
+ * The build writes its own identity into index.html as
6962
+ *
6963
+ * <meta name="yuneta-build" content="<stamp>" data-version="<version>">
6964
+ *
6965
+ * (vite-plugin-yuneta-html.js, at build time only). The stamp is
6966
+ * a hash of the NAMES of every file of the bundle, and those
6967
+ * names carry the hash of their content: the same code built
6968
+ * twice gives the same stamp, and any change of a chunk, of a
6969
+ * lazy chunk or of a stylesheet gives another. A build date
6970
+ * would announce a "new version" after every rebuild of
6971
+ * unchanged code, and the deploy round rebuilds every app after
6972
+ * each publication of this library.
6973
+ *
6974
+ * The page that runs reads its stamp from its own DOM, where the
6975
+ * meta is never touched again; the deployed one is read from the
6976
+ * text of the same document fetched again. Pure functions: the
6977
+ * gclass that compares them is C_YUI_UPDATE_WATCH.
6978
+ *
6979
+ * Copyright (c) 2026, ArtGins.
6980
+ * All Rights Reserved.
6981
+ ***********************************************************************/
6982
+ var BUILD_META_NAME = "yuneta-build";
6983
+ /************************************************************
6984
+ * The build of the page that runs: {stamp, version}, or
6985
+ * null when its document carries no stamp (`vite dev`, or
6986
+ * an app built without the plugin).
6987
+ ************************************************************/
6988
+ function running_build(doc) {
6989
+ if (!doc || typeof doc.querySelector !== "function") return null;
6990
+ let $meta = doc.querySelector(`meta[name="${BUILD_META_NAME}"]`);
6991
+ if (!$meta) return null;
6992
+ let stamp = $meta.getAttribute("content") || "";
6993
+ if (!stamp) return null;
6994
+ return {
6995
+ stamp,
6996
+ version: $meta.getAttribute("data-version") || ""
6997
+ };
6998
+ }
6999
+ /************************************************************
7000
+ * The build named by the text of an index.html: {stamp,
7001
+ * version}, or null when the text carries no stamp -- an
7002
+ * error page, a captive portal, or a build older than the
7003
+ * stamp. Null is NOT "another build": a hotel wifi that
7004
+ * answers 200 with its own login page must not tell the
7005
+ * reader to reload into it.
7006
+ ************************************************************/
7007
+ function parse_build(html) {
7008
+ if (typeof html !== "string" || !html) return null;
7009
+ let metas = html.match(/<meta\b[^>]*>/gi) || [];
7010
+ for (let tag of metas) {
7011
+ if (read_html_attr(tag, "name") !== "yuneta-build") continue;
7012
+ let stamp = read_html_attr(tag, "content");
7013
+ if (!stamp) return null;
7014
+ return {
7015
+ stamp,
7016
+ version: read_html_attr(tag, "data-version")
7017
+ };
7018
+ }
7019
+ return null;
7020
+ }
7021
+ /************************************************************
7022
+ * The value of one attribute of one tag's text, quoted
7023
+ * with " or ' (the plugin writes ", a minifier may not).
7024
+ * The entities the plugin escapes are read back.
7025
+ ************************************************************/
7026
+ function read_html_attr(tag, name) {
7027
+ let re = new RegExp(`\\s${name}\\s*=\\s*("([^"]*)"|'([^']*)')`, "i");
7028
+ let m = tag.match(re);
7029
+ if (!m) return "";
7030
+ return (m[2] !== void 0 ? m[2] : m[3]).replace(/&quot;/g, "\"").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
7031
+ }
7032
+ /************************************************************
7033
+ * The url to ask for the deployed document: the page's own,
7034
+ * without its hash. Every route of these apps is a hash, so
7035
+ * this is the deploy root, whatever path the app is served
7036
+ * under.
7037
+ ************************************************************/
7038
+ function build_page_url(loc) {
7039
+ if (!loc) return "";
7040
+ return `${loc.origin || ""}${loc.pathname || "/"}${loc.search || ""}`;
7041
+ }
7042
+ //#endregion
7043
+ //#region src/c_yui_update_watch.js
7044
+ /***********************************************************************
7045
+ * c_yui_update_watch.js
7046
+ *
7047
+ * Is this page still running the build that is deployed?
7048
+ *
7049
+ * Every route of these apps is a hash: moving around reloads
7050
+ * nothing, and neither does a login or a logout. A page opened
7051
+ * before a deploy runs the old bundle until somebody reloads it
7052
+ * by hand, and the only symptom is that a fix "did not work" --
7053
+ * or worse: the deploy deleted the old lazy chunks, and the old
7054
+ * page breaks the first time it opens a view it had not loaded.
7055
+ *
7056
+ * This service compares the build of the page (yui_build_stamp.js,
7057
+ * the stamp the build writes into index.html) with the one the
7058
+ * server hands out now, fetching that same document with
7059
+ * `cache: "no-store"`. A difference is SAID, never acted on: a
7060
+ * bar with the new version, a reload button and a ✕. Reloading
7061
+ * is the reader's call -- they may be in the middle of something.
7062
+ *
7063
+ * When it asks (every one an event, through the FSM):
7064
+ * - at start;
7065
+ * - the tab comes back to the front, or the window gets the
7066
+ * focus (at most once each `min_interval_ms`);
7067
+ * - the browser is online again;
7068
+ * - a lazy chunk failed to load (`vite:preloadError`): the
7069
+ * symptom of exactly this, so it asks at once;
7070
+ * - every `period_ms`: a screen that is always in view (a
7071
+ * control room, a wall display) never gets the focus back.
7072
+ * A periodic query is a discarded pattern in Yuneta; THIS
7073
+ * one is a deliberate exception approved by the user
7074
+ * (2026-10-21), for every SPA. 0 turns it off;
7075
+ * - whenever the app sends EV_CHECK_BUILD -- on its backend's
7076
+ * EV_ON_OPEN, typically: a backend deploy often comes with
7077
+ * a deploy of the SPA.
7078
+ *
7079
+ * A build that comes back to the running one (a rollback) takes
7080
+ * the bar away again. A page with no stamp (`vite dev`) watches
7081
+ * nothing.
7082
+ *
7083
+ * The bar lives in the shell's notification layer, above its
7084
+ * dialogs; with no shell (the login, between a logout and the
7085
+ * next login) in document.body. It follows the shell across a
7086
+ * logout (yui_shell_watch_changes()), as the dock does.
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
+ *
7095
+ * Usage (an app, once, after creating the yuno):
7096
+ *
7097
+ * register_c_yui_update_watch();
7098
+ * const watch = gobj_create_service(
7099
+ * "__update_watch__", "C_YUI_UPDATE_WATCH", {}, yuno
7100
+ * );
7101
+ * gobj_start(watch);
7102
+ *
7103
+ * // on its backend's EV_ON_OPEN:
7104
+ * gobj_send_event(watch, "EV_CHECK_BUILD", {}, gobj);
7105
+ *
7106
+ * // the login's language switch (no shell yet):
7107
+ * switch_locale(locale);
7108
+ * yui_update_watch_language_changed();
7109
+ *
7110
+ * Input events:
7111
+ * EV_CHECK_BUILD {force?} ask the server (force skips
7112
+ * the minimum interval)
7113
+ * EV_RELOAD {} the bar's reload button
7114
+ * EV_DISMISS {} the bar's ✕: hidden for THIS
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())
7121
+ *
7122
+ * Output events (optional subscribers):
7123
+ * EV_NEW_BUILD {running, deployed, version}
7124
+ * EV_BUILD_CURRENT {running} the deployed build is the
7125
+ * running one again
7126
+ *
7127
+ * Copyright (c) 2026, ArtGins.
7128
+ * All Rights Reserved.
7129
+ ***********************************************************************/
7130
+ /***************************************************************
7131
+ * Constants
7132
+ ***************************************************************/
7133
+ var GCLASS_NAME$20 = "C_YUI_UPDATE_WATCH";
7134
+ /***************************************************************
7135
+ * Data
7136
+ ***************************************************************/
7137
+ var attrs_table$20 = [
7138
+ SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
7139
+ SDATA(data_type_t.DTP_INTEGER, "min_interval_ms", 0, "60000", "Minimum time between two checks, except a forced one"),
7140
+ SDATA(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)"),
7141
+ SDATA(data_type_t.DTP_BOOLEAN, "with_bar", 0, "1", "Show the bar; false leaves EV_NEW_BUILD to the app"),
7142
+ SDATA(data_type_t.DTP_POINTER, "before_reload", 0, null, "fn() -> bool|Promise<bool>, asked before the reload; false vetoes it (unsaved edits)"),
7143
+ SDATA(data_type_t.DTP_POINTER, "$parent", 0, null, "Where the bar mounts (default: the shell's notification layer, document.body while there is none)"),
7144
+ SDATA_END()
7145
+ ];
7146
+ var PRIVATE_DATA$20 = {
7147
+ running: null,
7148
+ deployed: null,
7149
+ dismissed: "",
7150
+ in_flight: false,
7151
+ last_check: 0,
7152
+ failing: false,
7153
+ gobj_timer: null,
7154
+ $bar: null,
7155
+ lang_shell: null,
7156
+ dom_handlers: null
7157
+ };
7158
+ var __gclass__$20 = null;
7159
+ var __live_watches__ = [];
7160
+ /******************************
7161
+ * Framework Methods
7162
+ ******************************/
7163
+ /***************************************************************
7164
+ * Framework Method: Create
7165
+ ***************************************************************/
7166
+ function mt_create$20(gobj) {
7167
+ let priv = gobj.priv;
7168
+ priv.running = running_build(typeof document !== "undefined" ? document : null);
7169
+ priv.dom_handlers = [];
7170
+ __live_watches__.push(gobj);
7171
+ priv.gobj_timer = gobj_create_pure_child(gobj_name(gobj), "C_TIMER", {}, gobj);
7172
+ yui_shell_watch_changes(gobj);
7173
+ follow_language(gobj);
7174
+ const subscriber = gobj_read_pointer_attr(gobj, "subscriber");
7175
+ if (subscriber) gobj_subscribe_event(gobj, null, {}, subscriber);
7176
+ }
7177
+ /***************************************************************
7178
+ * Framework Method: Start
7179
+ ***************************************************************/
7180
+ function mt_start$20(gobj) {
7181
+ let priv = gobj.priv;
7182
+ gobj_start(priv.gobj_timer);
7183
+ if (!priv.running) {
7184
+ log_info(`${gobj_short_name(gobj)}: this page carries no build stamp (vite dev?): nothing to watch`);
7185
+ return 0;
7186
+ }
7187
+ listen_dom(gobj, document, "visibilitychange", () => {
7188
+ if (document.visibilityState === "visible") gobj_send_event(gobj, "EV_CHECK_BUILD", {}, gobj);
7189
+ });
7190
+ listen_dom(gobj, window, "focus", () => {
7191
+ gobj_send_event(gobj, "EV_CHECK_BUILD", {}, gobj);
7192
+ });
7193
+ listen_dom(gobj, window, "online", () => {
7194
+ gobj_send_event(gobj, "EV_CHECK_BUILD", { force: true }, gobj);
7195
+ });
7196
+ listen_dom(gobj, window, "vite:preloadError", () => {
7197
+ gobj_send_event(gobj, "EV_CHECK_BUILD", { force: true }, gobj);
7198
+ });
7199
+ let period = gobj_read_integer_attr(gobj, "period_ms");
7200
+ if (period > 0) set_timeout_periodic(priv.gobj_timer, period);
7201
+ gobj_send_event(gobj, "EV_CHECK_BUILD", { force: true }, gobj);
7202
+ return 0;
7203
+ }
7204
+ /***************************************************************
7205
+ * Framework Method: Stop
7206
+ ***************************************************************/
7207
+ function mt_stop$20(gobj) {
7208
+ let priv = gobj.priv;
7209
+ for (let [target, type, fn] of priv.dom_handlers) target.removeEventListener(type, fn);
7210
+ priv.dom_handlers = [];
7211
+ clear_timeout(priv.gobj_timer);
7212
+ if (gobj_is_running(priv.gobj_timer)) gobj_stop(priv.gobj_timer);
7213
+ }
7214
+ /***************************************************************
7215
+ * Framework Method: Destroy
7216
+ ***************************************************************/
7217
+ function mt_destroy$20(gobj) {
7218
+ let priv = gobj.priv;
7219
+ let idx = __live_watches__.indexOf(gobj);
7220
+ if (idx >= 0) __live_watches__.splice(idx, 1);
7221
+ yui_shell_unwatch_changes(gobj);
7222
+ if (priv.lang_shell) {
7223
+ if (!gobj_is_destroying(priv.lang_shell)) gobj_unsubscribe_event(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
7224
+ priv.lang_shell = null;
7225
+ }
7226
+ remove_bar(gobj);
7227
+ }
7228
+ /***************************
7229
+ * Local Methods
7230
+ ***************************/
7231
+ /************************************************************
7232
+ * Add a DOM listener, kept to be removed in mt_stop.
7233
+ ************************************************************/
7234
+ function listen_dom(gobj, target, type, fn) {
7235
+ target.addEventListener(type, fn);
7236
+ gobj.priv.dom_handlers.push([
7237
+ target,
7238
+ type,
7239
+ fn
7240
+ ]);
7241
+ }
7242
+ /************************************************************
7243
+ * Hear the language of the shell that holds the bar -- the
7244
+ * bar outlives a shell, so it follows them.
7245
+ ************************************************************/
7246
+ function follow_language(gobj) {
7247
+ let priv = gobj.priv;
7248
+ let shell = yui_shell_of(gobj);
7249
+ if (shell && gobj_is_destroying(shell)) shell = null;
7250
+ if (shell === priv.lang_shell) return;
7251
+ if (priv.lang_shell && !gobj_is_destroying(priv.lang_shell)) gobj_unsubscribe_event(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
7252
+ priv.lang_shell = null;
7253
+ if (shell) {
7254
+ gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
7255
+ priv.lang_shell = shell;
7256
+ }
7257
+ }
7258
+ /************************************************************
7259
+ * Where the bar goes: the host's `$parent`, else the toasts'
7260
+ * layer of the live shell, else the body.
7261
+ ************************************************************/
7262
+ function bar_place(gobj) {
7263
+ let $parent = gobj_read_pointer_attr(gobj, "$parent");
7264
+ if ($parent) return $parent;
7265
+ let shell = yui_shell_of(gobj);
7266
+ if (shell && gobj_is_destroying(shell)) shell = null;
7267
+ return yui_shell_notification_layer(shell) || document.body;
7268
+ }
7269
+ /************************************************************
7270
+ * Show the bar for the deployed build, or move it to its
7271
+ * place. Not shown for a build the reader dismissed.
7272
+ ************************************************************/
7273
+ function show_bar(gobj) {
7274
+ let priv = gobj.priv;
7275
+ if (!gobj_read_bool_attr(gobj, "with_bar")) return;
7276
+ if (!priv.deployed || priv.deployed.stamp === priv.dismissed) {
7277
+ remove_bar(gobj);
7278
+ return;
7279
+ }
7280
+ remove_bar(gobj);
7281
+ priv.$bar = createElement2([
7282
+ "div",
7283
+ {
7284
+ class: `C_YUI_UPDATE_WATCH UPDATE_BAR notification ${yui_tint("info")}`,
7285
+ role: "status"
7286
+ },
7287
+ [
7288
+ [
7289
+ "span",
7290
+ {
7291
+ class: "UPDATE_TEXT",
7292
+ i18n: "new version available"
7293
+ },
7294
+ t("new version available")
7295
+ ],
7296
+ [
7297
+ "span",
7298
+ { class: "UPDATE_VERSION" },
7299
+ text_node(priv.deployed.version)
7300
+ ],
7301
+ [
7302
+ "button",
7303
+ {
7304
+ class: "UPDATE_RELOAD button is-info",
7305
+ type: "button",
7306
+ i18n: "reload",
7307
+ title: t("reload"),
7308
+ "data-i18n-title": "reload",
7309
+ "aria-label": t("reload"),
7310
+ "data-i18n-aria-label": "reload"
7311
+ },
7312
+ t("reload"),
7313
+ { click: () => gobj_send_event(gobj, "EV_RELOAD", {}, gobj) }
7314
+ ],
7315
+ [
7316
+ "button",
7317
+ {
7318
+ class: "UPDATE_DISMISS delete",
7319
+ type: "button",
7320
+ title: t("close"),
7321
+ "data-i18n-title": "close",
7322
+ "aria-label": t("close"),
7323
+ "data-i18n-aria-label": "close"
7324
+ },
7325
+ null,
7326
+ { click: () => gobj_send_event(gobj, "EV_DISMISS", {}, gobj) }
7327
+ ]
7328
+ ]
7329
+ ]);
7330
+ bar_place(gobj).appendChild(priv.$bar);
7331
+ }
7332
+ /************************************************************
7333
+ * Take the bar off the page.
7334
+ ************************************************************/
7335
+ function remove_bar(gobj) {
7336
+ let priv = gobj.priv;
7337
+ if (priv.$bar && priv.$bar.parentNode) priv.$bar.parentNode.removeChild(priv.$bar);
7338
+ priv.$bar = null;
7339
+ }
7340
+ /************************************************************
7341
+ * Ask the server which build it hands out. The answer comes
7342
+ * back as an event (a resolved promise is an OS notification).
7343
+ ************************************************************/
7344
+ function fetch_deployed_build(gobj) {
7345
+ let priv = gobj.priv;
7346
+ priv.in_flight = true;
7347
+ priv.last_check = performance.now();
7348
+ fetch(build_page_url(window.location), {
7349
+ cache: "no-store",
7350
+ credentials: "same-origin"
7351
+ }).then((response) => {
7352
+ if (!response.ok) throw { status: response.status };
7353
+ return response.text();
7354
+ }).then((html) => {
7355
+ if (gobj_is_destroying(gobj)) return;
7356
+ let deployed = parse_build(html);
7357
+ if (!deployed) {
7358
+ gobj_send_event(gobj, "EV_CHECK_FAILED", {
7359
+ reason: "the page served carries no build stamp",
7360
+ network: false
7361
+ }, gobj);
7362
+ return;
7363
+ }
7364
+ gobj_send_event(gobj, "EV_DEPLOYED_BUILD", deployed, gobj);
7365
+ }).catch((err) => {
7366
+ if (gobj_is_destroying(gobj)) return;
7367
+ let http = err && err.status;
7368
+ gobj_send_event(gobj, "EV_CHECK_FAILED", {
7369
+ reason: http ? `HTTP ${err.status}` : String(err && err.message || err),
7370
+ network: !http
7371
+ }, gobj);
7372
+ });
7373
+ }
7374
+ /***************************
7375
+ * Actions
7376
+ ***************************/
7377
+ /************************************************************
7378
+ * Ask the server, unless a question is out or the last one
7379
+ * is too recent (a focus and a visibilitychange come
7380
+ * together), or the browser says it is offline -- false is
7381
+ * the one answer of navigator.onLine that can be trusted.
7382
+ ************************************************************/
7383
+ function ac_check_build(gobj, event, kw, src) {
7384
+ let priv = gobj.priv;
7385
+ if (!priv.running) return 0;
7386
+ if (priv.in_flight) return 0;
7387
+ if (!kw.force) {
7388
+ let min_interval = gobj_read_integer_attr(gobj, "min_interval_ms");
7389
+ if (priv.last_check && performance.now() - priv.last_check < min_interval) return 0;
7390
+ }
7391
+ if (navigator.onLine === false) return 0;
7392
+ fetch_deployed_build(gobj);
7393
+ return 0;
7394
+ }
7395
+ /************************************************************
7396
+ * EV_TIMEOUT_PERIODIC -- the screen that never gets the
7397
+ * focus back asks too.
7398
+ ************************************************************/
7399
+ function ac_periodic(gobj, event, kw, src) {
7400
+ gobj_send_event(gobj, "EV_CHECK_BUILD", {}, gobj);
7401
+ return 0;
7402
+ }
7403
+ /************************************************************
7404
+ * The server answered with a build.
7405
+ ************************************************************/
7406
+ function ac_deployed_build(gobj, event, kw, src) {
7407
+ let priv = gobj.priv;
7408
+ priv.in_flight = false;
7409
+ if (priv.failing) {
7410
+ log_info(`${gobj_short_name(gobj)}: the deployed build can be read again`);
7411
+ priv.failing = false;
7412
+ }
7413
+ let deployed = {
7414
+ stamp: kw.stamp,
7415
+ version: kw.version || ""
7416
+ };
7417
+ if (deployed.stamp === priv.running.stamp) {
7418
+ if (gobj_current_state(gobj) === "ST_STALE") {
7419
+ priv.deployed = null;
7420
+ remove_bar(gobj);
7421
+ gobj_change_state(gobj, "ST_CURRENT");
7422
+ gobj_publish_event(gobj, "EV_BUILD_CURRENT", { running: priv.running.stamp });
7423
+ }
7424
+ return 0;
7425
+ }
7426
+ if (priv.deployed && priv.deployed.stamp === deployed.stamp) return 0;
7427
+ priv.deployed = deployed;
7428
+ log_info(`${gobj_short_name(gobj)}: a new build is deployed: ${deployed.version} ${deployed.stamp} (this page runs ${priv.running.version} ${priv.running.stamp})`);
7429
+ gobj_change_state(gobj, "ST_STALE");
7430
+ show_bar(gobj);
7431
+ gobj_publish_event(gobj, "EV_NEW_BUILD", {
7432
+ running: priv.running.stamp,
7433
+ deployed: deployed.stamp,
7434
+ version: deployed.version
7435
+ });
7436
+ return 0;
7437
+ }
7438
+ /************************************************************
7439
+ * The server did not say. Offline is a normal state, so a
7440
+ * network failure is info; an answer that is not the app
7441
+ * (an HTTP error, a page with no stamp) is a warning. Both
7442
+ * are said on the transition only, not on every attempt.
7443
+ ************************************************************/
7444
+ function ac_check_failed(gobj, event, kw, src) {
7445
+ let priv = gobj.priv;
7446
+ priv.in_flight = false;
7447
+ if (priv.failing) return 0;
7448
+ priv.failing = true;
7449
+ let msg = `${gobj_short_name(gobj)}: cannot read the deployed build: ${kw.reason}`;
7450
+ if (kw.network) log_info(msg);
7451
+ else log_warning(msg);
7452
+ return 0;
7453
+ }
7454
+ /************************************************************
7455
+ * The bar's reload button. The host may veto it (unsaved
7456
+ * edits): its answer comes back as an event.
7457
+ ************************************************************/
7458
+ function ac_reload(gobj, event, kw, src) {
7459
+ let before_reload = gobj_read_pointer_attr(gobj, "before_reload");
7460
+ if (typeof before_reload !== "function") {
7461
+ gobj_send_event(gobj, "EV_RELOAD_ALLOWED", {}, gobj);
7462
+ return 0;
7463
+ }
7464
+ Promise.resolve().then(() => before_reload()).then((allowed) => {
7465
+ if (gobj_is_destroying(gobj)) return;
7466
+ if (allowed === false) {
7467
+ log_info(`${gobj_short_name(gobj)}: the host vetoed the reload`);
7468
+ return;
7469
+ }
7470
+ gobj_send_event(gobj, "EV_RELOAD_ALLOWED", {}, gobj);
7471
+ }, (err) => {
7472
+ log_error(`${gobj_short_name(gobj)}: before_reload() failed: ${err && err.message || err}`);
7473
+ });
7474
+ return 0;
7475
+ }
7476
+ /************************************************************
7477
+ * Load the deployed build. The hash stays: the reader comes
7478
+ * back to the same route.
7479
+ ************************************************************/
7480
+ function ac_reload_allowed(gobj, event, kw, src) {
7481
+ window.location.reload();
7482
+ return 0;
7483
+ }
7484
+ /************************************************************
7485
+ * The bar's ✕: hidden for this build; a later deploy shows
7486
+ * it again.
7487
+ ************************************************************/
7488
+ function ac_dismiss(gobj, event, kw, src) {
7489
+ let priv = gobj.priv;
7490
+ priv.dismissed = priv.deployed ? priv.deployed.stamp : "";
7491
+ remove_bar(gobj);
7492
+ return 0;
7493
+ }
7494
+ /************************************************************
7495
+ * EV_SHELL_CHANGED -- a shell was built, or is being
7496
+ * destroyed: the bar's place may have gone with it, or be in
7497
+ * the new one. Its language is the new shell's too.
7498
+ ************************************************************/
7499
+ function ac_shell_changed(gobj, event, kw, src) {
7500
+ let priv = gobj.priv;
7501
+ follow_language(gobj);
7502
+ if (priv.$bar) show_bar(gobj);
7503
+ return 0;
7504
+ }
7505
+ /************************************************************
7506
+ * EV_LANGUAGE_CHANGED -- from the shell that holds the bar.
7507
+ * Every text of the bar carries its key; it may live outside
7508
+ * the shell's container, where the app's refresh does not
7509
+ * reach.
7510
+ ************************************************************/
7511
+ function ac_language_changed$12(gobj, event, kw, src) {
7512
+ let priv = gobj.priv;
7513
+ if (priv.$bar) refresh_language(priv.$bar, t);
7514
+ return 0;
7515
+ }
7516
+ /***************************
7517
+ * FSM
7518
+ ***************************/
7519
+ var gmt$20 = {
7520
+ mt_create: mt_create$20,
7521
+ mt_start: mt_start$20,
7522
+ mt_stop: mt_stop$20,
7523
+ mt_destroy: mt_destroy$20
7524
+ };
7525
+ /***************************************************************
7526
+ * Create the GClass
7527
+ ***************************************************************/
7528
+ function create_gclass$20(gclass_name) {
7529
+ if (__gclass__$20) {
7530
+ log_error(`GClass ALREADY created: ${gclass_name}`);
7531
+ return -1;
7532
+ }
7533
+ const states = [["ST_CURRENT", [
7534
+ [
7535
+ "EV_CHECK_BUILD",
7536
+ ac_check_build,
7537
+ null
7538
+ ],
7539
+ [
7540
+ "EV_TIMEOUT_PERIODIC",
7541
+ ac_periodic,
7542
+ null
7543
+ ],
7544
+ [
7545
+ "EV_DEPLOYED_BUILD",
7546
+ ac_deployed_build,
7547
+ null
7548
+ ],
7549
+ [
7550
+ "EV_CHECK_FAILED",
7551
+ ac_check_failed,
7552
+ null
7553
+ ],
7554
+ [
7555
+ "EV_SHELL_CHANGED",
7556
+ ac_shell_changed,
7557
+ null
7558
+ ],
7559
+ [
7560
+ "EV_LANGUAGE_CHANGED",
7561
+ ac_language_changed$12,
7562
+ null
7563
+ ]
7564
+ ]], ["ST_STALE", [
7565
+ [
7566
+ "EV_CHECK_BUILD",
7567
+ ac_check_build,
7568
+ null
7569
+ ],
7570
+ [
7571
+ "EV_TIMEOUT_PERIODIC",
7572
+ ac_periodic,
7573
+ null
7574
+ ],
7575
+ [
7576
+ "EV_DEPLOYED_BUILD",
7577
+ ac_deployed_build,
7578
+ null
7579
+ ],
7580
+ [
7581
+ "EV_CHECK_FAILED",
7582
+ ac_check_failed,
7583
+ null
7584
+ ],
7585
+ [
7586
+ "EV_RELOAD",
7587
+ ac_reload,
7588
+ null
7589
+ ],
7590
+ [
7591
+ "EV_RELOAD_ALLOWED",
7592
+ ac_reload_allowed,
7593
+ null
7594
+ ],
7595
+ [
7596
+ "EV_DISMISS",
7597
+ ac_dismiss,
7598
+ null
7599
+ ],
6930
7600
  [
6931
7601
  "EV_SHELL_CHANGED",
6932
7602
  ac_shell_changed,
@@ -6937,16 +7607,47 @@ function create_gclass$20(gclass_name) {
6937
7607
  ac_language_changed$12,
6938
7608
  null
6939
7609
  ]
6940
- ]]], gmt$20, 0, attrs_table$20, PRIVATE_DATA$20, 0, 0, 0, 0);
7610
+ ]]];
7611
+ const event_types = [
7612
+ ["EV_CHECK_BUILD", 0],
7613
+ ["EV_TIMEOUT_PERIODIC", 0],
7614
+ ["EV_DEPLOYED_BUILD", 0],
7615
+ ["EV_CHECK_FAILED", 0],
7616
+ ["EV_RELOAD", 0],
7617
+ ["EV_RELOAD_ALLOWED", 0],
7618
+ ["EV_DISMISS", 0],
7619
+ ["EV_SHELL_CHANGED", 0],
7620
+ ["EV_LANGUAGE_CHANGED", 0],
7621
+ ["EV_NEW_BUILD", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
7622
+ ["EV_BUILD_CURRENT", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS]
7623
+ ];
7624
+ __gclass__$20 = gclass_create(gclass_name, event_types, states, gmt$20, 0, attrs_table$20, PRIVATE_DATA$20, 0, 0, 0, 0);
6941
7625
  if (!__gclass__$20) return -1;
6942
7626
  return 0;
6943
7627
  }
6944
7628
  /***************************************************************
6945
7629
  * Register GClass
6946
7630
  ***************************************************************/
6947
- function register_c_yui_window_manager() {
7631
+ function register_c_yui_update_watch() {
6948
7632
  return create_gclass$20(GCLASS_NAME$20);
6949
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
+ }
6950
7651
  //#endregion
6951
7652
  //#region src/pager_helpers.js
6952
7653
  /***************************************************************
@@ -22571,7 +23272,8 @@ var PRIVATE_DATA$10 = {
22571
23272
  $raw: null,
22572
23273
  $raw_body: null,
22573
23274
  $search: null,
22574
- $mode_btns: null
23275
+ $mode_btns: null,
23276
+ lang_shell: null
22575
23277
  };
22576
23278
  var __gclass__$10 = null;
22577
23279
  /******************************
@@ -22597,12 +23299,21 @@ function mt_create$10(gobj) {
22597
23299
  * Framework Method: Start
22598
23300
  ***************************************************************/
22599
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
+ }
22600
23308
  render_view(gobj);
22601
23309
  }
22602
23310
  /***************************************************************
22603
23311
  * Framework Method: Stop
22604
23312
  ***************************************************************/
22605
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;
22606
23317
  teardown_graph_child(gobj);
22607
23318
  }
22608
23319
  /***************************************************************
@@ -24208,6 +24919,7 @@ function ac_language_changed$6(gobj, event, kw, src) {
24208
24919
  apply_view_mode(gobj);
24209
24920
  }
24210
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);
24211
24923
  return 0;
24212
24924
  }
24213
24925
  /************************************************************
@@ -51604,7 +52316,7 @@ function restore_view_state(gobj) {
51604
52316
  done = true;
51605
52317
  }
51606
52318
  if (position !== null) {
51607
- graph.translateTo(position);
52319
+ graph.translateTo(translate_of_position(graph, position, zoom !== null ? zoom : graph.getZoom()));
51608
52320
  done = true;
51609
52321
  }
51610
52322
  if (state.anchor) {
@@ -51622,6 +52334,11 @@ function restore_view_state(gobj) {
51622
52334
  yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), priv.graph);
51623
52335
  return done;
51624
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
+ }
51625
52342
  function camera_shows_a_card(gobj, zoom, position) {
51626
52343
  let priv = gobj.priv;
51627
52344
  let graph = priv.graph;
@@ -51629,16 +52346,15 @@ function camera_shows_a_card(gobj, zoom, position) {
51629
52346
  if (!graph || !ids.length) return true;
51630
52347
  try {
51631
52348
  let size = graph.getSize();
51632
- let c = graph.getCanvasCenter();
51633
52349
  let z = zoom !== null ? zoom : graph.getZoom();
51634
- let t = position !== null ? position : graph.getPosition();
52350
+ let s = position !== null ? position : graph.getPosition();
51635
52351
  let w = size[0];
51636
52352
  let h = size[1];
51637
52353
  if (!(w > 0 && h > 0) || !(z > 0)) return true;
51638
52354
  for (let id of ids) {
51639
52355
  let n = graph.getElementPosition(id);
51640
- let vx = (n[0] - c[0]) * z + t[0] + c[0];
51641
- 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;
51642
52358
  if (vx >= 0 && vx <= w && vy >= 0 && vy <= h) return true;
51643
52359
  }
51644
52360
  } catch (e) {
@@ -51718,6 +52434,7 @@ var PRIVATE_DATA$9 = {
51718
52434
  trace_info: {},
51719
52435
  trace_pending: false,
51720
52436
  popover_mode: "",
52437
+ viewer_awaits: "",
51721
52438
  viewer_stale: "",
51722
52439
  view_refused: false
51723
52440
  };
@@ -54118,6 +54835,8 @@ function open_gclass_window(gobj, gclass, description, d) {
54118
54835
  let priv = gobj.priv;
54119
54836
  close_gclass_view(priv.gclass_view);
54120
54837
  priv.gclass_view = null;
54838
+ priv.viewer_awaits = "";
54839
+ priv.viewer_stale = "";
54121
54840
  let opts = {
54122
54841
  title_prefix: is_remote(gobj) ? gobj_read_str_attr(gobj, "yuno_name") || "" : gobj_yuno_name() || "",
54123
54842
  current_state: d && d.state || "",
@@ -54190,10 +54909,16 @@ function ac_trace_info(gobj, event, kw, src) {
54190
54909
  let viewer = gclass_viewer_gobj(gobj);
54191
54910
  if (viewer) {
54192
54911
  let shown = gobj_read_str_attr(viewer, "gclass_name");
54912
+ if (priv.viewer_awaits === kw.gclass) {
54913
+ priv.viewer_awaits = "";
54914
+ if (priv.viewer_stale === shown && shown !== kw.gclass) {
54915
+ priv.viewer_stale = "";
54916
+ priv.viewer_awaits = shown;
54917
+ gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
54918
+ }
54919
+ }
54193
54920
  if (shown === kw.gclass) gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
54194
- else if (priv.viewer_stale === shown) gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
54195
54921
  }
54196
- priv.viewer_stale = "";
54197
54922
  return 0;
54198
54923
  }
54199
54924
  /************************************************************
@@ -54206,13 +54931,14 @@ function gclass_viewer_gobj(gobj) {
54206
54931
  /************************************************************
54207
54932
  * What the gclass viewer needs to draw the traces of `gclass`
54208
54933
  * for every gobj of it: the levels the host read, and whether a
54209
- * set is still in flight. Plain json: it rides in a kw.
54934
+ * set that concerns it is still in flight. Plain json: it rides
54935
+ * in a kw.
54210
54936
  ************************************************************/
54211
54937
  function viewer_traces(gobj, gclass) {
54212
54938
  let priv = gobj.priv;
54213
54939
  return {
54214
54940
  info: priv.trace_info[gclass] || null,
54215
- pending: !!priv.trace_pending
54941
+ pending: !!priv.viewer_awaits
54216
54942
  };
54217
54943
  }
54218
54944
  /************************************************************
@@ -54296,8 +55022,11 @@ function set_trace_levels(gobj, target, scope, levels, set) {
54296
55022
  let viewer = gclass_viewer_gobj(gobj);
54297
55023
  if (viewer) {
54298
55024
  let shown = gobj_read_str_attr(viewer, "gclass_name");
54299
- if (scope === "global" && shown !== target.gclass) priv.viewer_stale = shown;
54300
- gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
55025
+ if (shown === target.gclass || scope === "global") {
55026
+ priv.viewer_awaits = target.gclass;
55027
+ priv.viewer_stale = shown !== target.gclass ? shown : "";
55028
+ gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
55029
+ }
54301
55030
  }
54302
55031
  gobj_publish_event(gobj, "EV_SET_TRACE_LEVEL", {
54303
55032
  scope,
@@ -88332,6 +89061,6 @@ function setup_json_pad(self) {
88332
89061
  return win;
88333
89062
  }
88334
89063
  //#endregion
88335
- 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_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 };
89064
+ 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 };
88336
89065
 
88337
89066
  //# sourceMappingURL=gobj-ui.es.js.map