@yuneta/gobj-ui 7.26.42 → 7.26.43

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.
Files changed (47) hide show
  1. package/README.md +227 -36
  2. package/dist/gobj-ui.cjs.js +768 -191
  3. package/dist/gobj-ui.es.js +768 -191
  4. package/package.json +1 -1
  5. package/scripts/validate-locales.mjs +355 -63
  6. package/src/c_yui_form.js +261 -154
  7. package/src/c_yui_node.js +51 -7
  8. package/src/c_yui_schema_editor.js +49 -3
  9. package/src/c_yui_shell.css +4 -1
  10. package/src/c_yui_shell.js +28 -2
  11. package/src/c_yui_window.js +373 -62
  12. package/src/c_yui_window_manager.js +74 -2
  13. package/src/escape_taken.js +58 -0
  14. package/src/form_close_asks_for_edits.wiring.test.js +6 -3
  15. package/src/form_json_editor_names.js +3 -1
  16. package/src/form_json_editor_names.wiring.test.js +8 -4
  17. package/src/form_json_expand.wiring.test.js +6 -3
  18. package/src/form_json_field.wiring.test.js +8 -4
  19. package/src/form_label_i18n.wiring.test.js +10 -5
  20. package/src/form_table_edits_ask.wiring.test.js +18 -8
  21. package/src/form_table_rearm.wiring.test.js +13 -5
  22. package/src/form_table_rows.wiring.test.js +489 -0
  23. package/src/form_table_validator.wiring.test.js +8 -4
  24. package/src/form_template_field.wiring.test.js +6 -3
  25. package/src/g6_long_press_clock.test.js +8 -3
  26. package/src/i18n_key_functions.js +63 -25
  27. package/src/i18n_key_functions.test.js +230 -8
  28. package/src/modal_guard_back.wiring.test.js +53 -0
  29. package/src/named_controls.wiring.test.js +53 -13
  30. package/src/node_nav_events.wiring.test.js +93 -1
  31. package/src/schema_editor_diagram_click.wiring.test.js +277 -0
  32. package/src/shell_dialog_names.wiring.test.js +149 -0
  33. package/src/shell_escape_taken.wiring.test.js +142 -0
  34. package/src/shell_focus_trap.js +30 -2
  35. package/src/shell_focus_trap.test.js +90 -6
  36. package/src/shell_modals.js +90 -19
  37. package/src/table_editor_name.wiring.test.js +10 -5
  38. package/src/treedb_column_title.wiring.test.js +8 -4
  39. package/src/treedb_graph_writes.wiring.test.js +6 -3
  40. package/src/treedb_json_drill.wiring.test.js +6 -3
  41. package/src/uplot_add_serie.test.js +6 -3
  42. package/src/uplot_ink.test.js +8 -4
  43. package/src/window_dialog.wiring.test.js +486 -0
  44. package/src/window_dock_band.wiring.test.js +189 -0
  45. package/src/window_rect_rounding.wiring.test.js +121 -0
  46. package/src/yui_tabulator_i18n.js +31 -1
  47. package/src/yui_tabulator_i18n.test.js +46 -0
@@ -131,6 +131,14 @@ function yui_tint(colour) {
131
131
  * - restores focus to whatever element had it before
132
132
  * activation when release() runs.
133
133
  *
134
+ * Only a control that is DRAWN counts: focus() on one that is
135
+ * not (display:none) does nothing. The adaptive dialog's back
136
+ * arrow is the first control of every dialog and is hidden on a
137
+ * laptop: up to 7.26.42 the trap gave it the focus on activation
138
+ * (so the focus stayed outside the dialog), and every Tab after
139
+ * that wrapped to it, did nothing and was prevented -- the
140
+ * keyboard never got into the dialog.
141
+ *
134
142
  * Pure module — no gobj / Yuneta dependencies. The optional
135
143
  * second argument lets callers inject a mock document object
136
144
  * for unit tests.
@@ -140,6 +148,14 @@ function yui_tint(colour) {
140
148
  ***********************************************************************/
141
149
  var FOCUSABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
142
150
  var __trap_stack__ = [];
151
+ function is_drawn(el) {
152
+ if (typeof el.checkVisibility === "function") return el.checkVisibility();
153
+ if (typeof el.getClientRects === "function") return el.getClientRects().length > 0;
154
+ return true;
155
+ }
156
+ function focusables_of($panel) {
157
+ return Array.from($panel.querySelectorAll(FOCUSABLE_SELECTOR)).filter(is_drawn);
158
+ }
143
159
  /***************************************************************
144
160
  * Activate the focus-trap on $panel.
145
161
  *
@@ -157,7 +173,7 @@ function activate_focus_trap_on($panel, doc) {
157
173
  let trap = function(ev) {
158
174
  if (ev.key !== "Tab" && ev.keyCode !== 9) return;
159
175
  if (__trap_stack__[__trap_stack__.length - 1] !== trap) return;
160
- let nodes = $panel.querySelectorAll(FOCUSABLE_SELECTOR);
176
+ let nodes = focusables_of($panel);
161
177
  if (nodes.length === 0) return;
162
178
  let first = nodes[0];
163
179
  let last = nodes[nodes.length - 1];
@@ -174,7 +190,7 @@ function activate_focus_trap_on($panel, doc) {
174
190
  };
175
191
  doc.addEventListener("keydown", trap, true);
176
192
  __trap_stack__.push(trap);
177
- let firstFocusable = $panel.querySelector(FOCUSABLE_SELECTOR);
193
+ let firstFocusable = focusables_of($panel)[0];
178
194
  if (firstFocusable && typeof firstFocusable.focus === "function") firstFocusable.focus();
179
195
  return function release_focus_trap() {
180
196
  if (released) return;
@@ -262,6 +278,51 @@ function bulma_hidden_class(bp) {
262
278
  return "";
263
279
  }
264
280
  //#endregion
281
+ //#region src/escape_taken.js
282
+ /***********************************************************************
283
+ * escape_taken.js
284
+ *
285
+ * Whose is an Escape? The overlay around the focus (a window, the
286
+ * shell's dialog on top) closes with it -- unless what the key was
287
+ * typed in took it first:
288
+ *
289
+ * - a handler used it and said so (`preventDefault()`): Tom
290
+ * Select closing its list, the json editor its search box;
291
+ * - an input method is composing (the key cancels the
292
+ * composition);
293
+ * - the element it was typed in is no longer in the document:
294
+ * an inline editor closed with it. Tabulator cancels a cell
295
+ * edit on Escape by removing the box, and says nothing else
296
+ * -- so this is the only trace the key leaves;
297
+ * - it was typed in a search box that holds text: the browser
298
+ * clears the box with it (a default action, not a
299
+ * preventDefault() anyone can see -- and taking the key would
300
+ * prevent it). An empty one gives it on;
301
+ * - it was typed in a text editor (a textarea, a
302
+ * contenteditable): what is being written there is not lost
303
+ * to a key that also means "stop" inside the editor. The
304
+ * overlay is one Tab away.
305
+ *
306
+ * Pure module: an event in, a boolean out.
307
+ *
308
+ * Copyright (c) 2026, ArtGins.
309
+ * All Rights Reserved.
310
+ ***********************************************************************/
311
+ /***************************************************************
312
+ * True when the Escape `evt` belongs to what it was typed in,
313
+ * and not to the overlay around it.
314
+ ***************************************************************/
315
+ function escape_is_taken(evt) {
316
+ if (!evt) return false;
317
+ if (evt.defaultPrevented || evt.isComposing) return true;
318
+ let target = evt.target;
319
+ if (!target || target.nodeType !== 1) return false;
320
+ if (target.isConnected === false) return true;
321
+ if (target.tagName === "INPUT" && target.type === "search" && target.value) return true;
322
+ if (target.tagName === "TEXTAREA" || target.isContentEditable === true) return true;
323
+ return false;
324
+ }
325
+ //#endregion
265
326
  //#region src/shell_toolbar_helpers.js
266
327
  var TOOLBAR_ACTION_TYPES = [
267
328
  "navigate",
@@ -1214,7 +1275,7 @@ function mt_create$22(gobj) {
1214
1275
  /***************************************************************
1215
1276
  * Framework Method: Start
1216
1277
  ***************************************************************/
1217
- function mt_start$20(gobj) {
1278
+ function mt_start$21(gobj) {
1218
1279
  let config = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "config") || {};
1219
1280
  let priv = gobj.priv;
1220
1281
  if (!validate_config(config)) {
@@ -1318,6 +1379,7 @@ function mt_start$20(gobj) {
1318
1379
  priv.keydown_handler = (ev) => {
1319
1380
  if (ev.key !== "Escape" && ev.keyCode !== 27) return;
1320
1381
  if (priv.escape_stack.length === 0) return;
1382
+ if (escape_is_taken(ev)) return;
1321
1383
  let top = priv.escape_stack[priv.escape_stack.length - 1];
1322
1384
  ev.preventDefault();
1323
1385
  ev.stopPropagation();
@@ -2302,13 +2364,17 @@ function refresh_avatars(gobj) {
2302
2364
  * Wire an optional secondary (right-click) action on a
2303
2365
  * toolbar item. Same action shape as `action`; used e.g. by
2304
2366
  * the connection indicator to open a dev panel on right-click.
2367
+ * The item goes along whole, with the secondary action in place
2368
+ * of its own: a menu it opens is named as its trigger is (up to
2369
+ * 7.26.42 it went as `{id, action}`, and the menu was named by
2370
+ * the raw id whatever the item declared).
2305
2371
  ************************************************************/
2306
2372
  function attach_context_action(gobj, $item, it) {
2307
2373
  if (!it || !it.context_action) return;
2308
2374
  $item.addEventListener("contextmenu", (ev) => {
2309
2375
  ev.preventDefault();
2310
2376
  handle_toolbar_action(gobj, {
2311
- id: it.id,
2377
+ ...it,
2312
2378
  action: it.context_action
2313
2379
  }, $item);
2314
2380
  });
@@ -3211,7 +3277,7 @@ function mt_publication_pre_filter(gobj, subs, event, kw) {
3211
3277
  }
3212
3278
  var gmt$22 = {
3213
3279
  mt_create: mt_create$22,
3214
- mt_start: mt_start$20,
3280
+ mt_start: mt_start$21,
3215
3281
  mt_stop: mt_stop$20,
3216
3282
  mt_destroy: mt_destroy$22,
3217
3283
  mt_publication_pre_filter
@@ -3404,6 +3470,16 @@ function yui_shell_window_layer(shell_gobj) {
3404
3470
  return priv.window_layer || priv.layers && priv.layers.overlay || null;
3405
3471
  }
3406
3472
  /************************************************************
3473
+ * The DOM where a MODAL C_YUI_WINDOW lives when its host names
3474
+ * no `$parent`: the shell's dialog layer, with the dialogs of
3475
+ * shell_modals.js -- above the drawer, the dock and every other
3476
+ * window, below the toasts. Null with no shell.
3477
+ ************************************************************/
3478
+ function yui_shell_modal_layer(shell_gobj) {
3479
+ if (!shell_gobj || !shell_gobj.priv || !shell_gobj.priv.layers) return null;
3480
+ return shell_gobj.priv.layers.modal || null;
3481
+ }
3482
+ /************************************************************
3407
3483
  * Put a window on top of the others: the next number of ONE
3408
3484
  * counter, the same for a window of the dock and for a floating
3409
3485
  * one.
@@ -3828,6 +3904,14 @@ function modal_layer(shell) {
3828
3904
  let priv = shell.priv;
3829
3905
  return priv && priv.layers && priv.layers.modal;
3830
3906
  }
3907
+ var __opened_by_shell__ = /* @__PURE__ */ new WeakMap();
3908
+ function note_opened(shell) {
3909
+ __opened_by_shell__.set(shell, opened_count(shell) + 1);
3910
+ }
3911
+ function opened_count(shell) {
3912
+ return __opened_by_shell__.get(shell) || 0;
3913
+ }
3914
+ var __dialog_seq__ = 0;
3831
3915
  function yui_shell_popup_layer(shell) {
3832
3916
  if (!shell) return null;
3833
3917
  let priv = shell.priv;
@@ -3962,18 +4046,43 @@ function yui_shell_show_modal(shell, content, opts) {
3962
4046
  (0, _yuneta_gobj_js.log_warning)("yui_shell_show_modal: shell has no modal layer");
3963
4047
  return { close: () => {} };
3964
4048
  }
4049
+ let label_id = `yui-modal-${++__dialog_seq__}`;
3965
4050
  let inner = typeof content === "string" ? [
3966
4051
  "div",
3967
4052
  { class: "box" },
3968
4053
  [[
3969
4054
  "p",
3970
- { i18n: content },
4055
+ {
4056
+ class: "MODAL_MESSAGE",
4057
+ id: `${label_id}-msg`,
4058
+ i18n: content
4059
+ },
3971
4060
  content
3972
4061
  ]]
3973
4062
  ] : null;
3974
4063
  let dialog = !!(opts && opts.dialog);
3975
4064
  let title = opts && opts.title || "";
3976
4065
  let title_prefix = opts && opts.title_prefix || "";
4066
+ let title_halves = (title_prefix ? [[
4067
+ "span",
4068
+ {
4069
+ class: "MODAL_TITLE_PREFIX",
4070
+ id: `${label_id}-prefix`
4071
+ },
4072
+ text_node(title_prefix)
4073
+ ]] : []).concat(title ? [[
4074
+ "span",
4075
+ {
4076
+ class: "MODAL_TITLE_KIND",
4077
+ id: `${label_id}-kind`,
4078
+ i18n: title
4079
+ },
4080
+ text_node(title)
4081
+ ]] : []);
4082
+ let label_ids = [];
4083
+ if (title_prefix) label_ids.push(`${label_id}-prefix`);
4084
+ if (title) label_ids.push(`${label_id}-kind`);
4085
+ if (label_ids.length === 0 && inner) label_ids.push(`${label_id}-msg`);
3977
4086
  let with_close = !(opts && opts.with_close_button === false);
3978
4087
  let modal_children;
3979
4088
  if (dialog) {
@@ -3999,18 +4108,7 @@ function yui_shell_show_modal(shell, content, opts) {
3999
4108
  [
4000
4109
  "span",
4001
4110
  { class: "MODAL_TITLE yui-dialog-title" },
4002
- (title_prefix ? [[
4003
- "span",
4004
- { class: "MODAL_TITLE_PREFIX" },
4005
- text_node(title_prefix)
4006
- ]] : []).concat(title ? [[
4007
- "span",
4008
- {
4009
- class: "MODAL_TITLE_KIND",
4010
- i18n: title
4011
- },
4012
- text_node(title)
4013
- ]] : [])
4111
+ title_halves
4014
4112
  ],
4015
4113
  [
4016
4114
  "button",
@@ -4038,6 +4136,11 @@ function yui_shell_show_modal(shell, content, opts) {
4038
4136
  { class: "MODAL_CONTENT modal-content" },
4039
4137
  inner ? [inner] : []
4040
4138
  ]];
4139
+ if (title_halves.length > 0) modal_children.unshift([
4140
+ "span",
4141
+ { class: "MODAL_TITLE is-sr-only" },
4142
+ title_halves
4143
+ ]);
4041
4144
  if (with_close) modal_children.push(["button", {
4042
4145
  class: "MODAL_CLOSE modal-close is-large",
4043
4146
  title: (0, i18next.t)("close"),
@@ -4048,16 +4151,20 @@ function yui_shell_show_modal(shell, content, opts) {
4048
4151
  }
4049
4152
  let logical = opts && opts.logical_class || "";
4050
4153
  let wide = !!(opts && opts.wide);
4154
+ let modal_attrs = {
4155
+ class: "MODAL" + (logical ? " " + logical : "") + " modal yui-modal" + (dialog ? " yui-dialog" : "") + (dialog && wide ? " yui-dialog-wide" : "") + " is-active",
4156
+ role: "dialog",
4157
+ "aria-modal": "true"
4158
+ };
4159
+ if (label_ids.length > 0) modal_attrs["aria-labelledby"] = label_ids.join(" ");
4160
+ else (0, _yuneta_gobj_js.log_warning)(`yui_shell_show_modal: a dialog with no title and no message has no name for a reader` + (logical ? ` (${logical})` : "") + `: give it opts.title`);
4051
4161
  let $modal = (0, _yuneta_gobj_js.createElement2)([
4052
4162
  "div",
4053
- {
4054
- class: "MODAL" + (logical ? " " + logical : "") + " modal yui-modal" + (dialog ? " yui-dialog" : "") + (dialog && wide ? " yui-dialog-wide" : "") + " is-active",
4055
- role: "dialog",
4056
- "aria-modal": "true"
4057
- },
4163
+ modal_attrs,
4058
4164
  modal_children
4059
4165
  ]);
4060
4166
  $layer.appendChild($modal);
4167
+ note_opened(shell);
4061
4168
  if (!inner && content && typeof content.appendChild !== "undefined") (dialog ? $modal.querySelector(".yui-dialog-body") : $modal.querySelector(".modal-content")).appendChild(content);
4062
4169
  maybe_apply_translator($modal, opts);
4063
4170
  let closed = false;
@@ -4086,6 +4193,7 @@ function yui_shell_show_modal(shell, content, opts) {
4086
4193
  let guarded_close = function(on_veto) {
4087
4194
  if (closed) return;
4088
4195
  let allow = true;
4196
+ let opened_before = opened_count(shell);
4089
4197
  if (opts && typeof opts.before_close === "function") try {
4090
4198
  allow = opts.before_close();
4091
4199
  } catch (e) {
@@ -4101,6 +4209,7 @@ function yui_shell_show_modal(shell, content, opts) {
4101
4209
  do_close();
4102
4210
  return;
4103
4211
  }
4212
+ if (answer === void 0 && !closed && opened_count(shell) === opened_before) (0, _yuneta_gobj_js.log_warning)("yui_shell_show_modal: before_close settled with undefined and asked nothing: the modal stays open (only true closes it)");
4104
4213
  vetoed();
4105
4214
  }, function(e) {
4106
4215
  (0, _yuneta_gobj_js.log_warning)(`yui_shell_show_modal: before_close rejected: ${e}`);
@@ -4208,10 +4317,12 @@ function build_dialog(shell, message, buttons, opts) {
4208
4317
  "aria-hidden": "true"
4209
4318
  }]]
4210
4319
  ]];
4320
+ let label_id = `yui-confirm-${++__dialog_seq__}`;
4211
4321
  if (!(0, _yuneta_gobj_js.empty_string)(title)) $card_children.push([
4212
4322
  "p",
4213
4323
  {
4214
4324
  class: "CONFIRM_TITLE yui-confirm-title has-text-centered",
4325
+ id: `${label_id}-title`,
4215
4326
  i18n: title
4216
4327
  },
4217
4328
  text_node(title)
@@ -4224,21 +4335,28 @@ function build_dialog(shell, message, buttons, opts) {
4224
4335
  "data-i18n-aria-label": "close"
4225
4336
  }], [
4226
4337
  "section",
4227
- { class: "CONFIRM_BODY modal-card-body has-text-centered" },
4338
+ {
4339
+ class: "CONFIRM_BODY modal-card-body has-text-centered",
4340
+ id: `${label_id}-body`
4341
+ },
4228
4342
  $body_children
4229
4343
  ], [
4230
4344
  "footer",
4231
4345
  { class: "CONFIRM_FOOT modal-card-foot" },
4232
4346
  $footer_children
4233
4347
  ]);
4234
- let logical = opts && opts.logical_class ? " " + opts.logical_class : "";
4348
+ let confirm_attrs = {
4349
+ class: `CONFIRM${opts && opts.logical_class ? " " + opts.logical_class : ""} modal yui-modal yui-confirm is-active is-${type}`,
4350
+ role: "dialog",
4351
+ "aria-modal": "true"
4352
+ };
4353
+ if (!(0, _yuneta_gobj_js.empty_string)(title)) {
4354
+ confirm_attrs["aria-labelledby"] = `${label_id}-title`;
4355
+ confirm_attrs["aria-describedby"] = `${label_id}-body`;
4356
+ } else confirm_attrs["aria-labelledby"] = `${label_id}-body`;
4235
4357
  let $modal = (0, _yuneta_gobj_js.createElement2)([
4236
4358
  "div",
4237
- {
4238
- class: `CONFIRM${logical} modal yui-modal yui-confirm is-active is-${type}`,
4239
- role: "dialog",
4240
- "aria-modal": "true"
4241
- },
4359
+ confirm_attrs,
4242
4360
  [["div", { class: "CONFIRM_BACKDROP modal-background" }], [
4243
4361
  "div",
4244
4362
  { class: "CONFIRM_CARD modal-card" },
@@ -4246,6 +4364,7 @@ function build_dialog(shell, message, buttons, opts) {
4246
4364
  ]]
4247
4365
  ]);
4248
4366
  $layer.appendChild($modal);
4367
+ note_opened(shell);
4249
4368
  maybe_apply_translator($modal, opts);
4250
4369
  return new Promise((resolve) => {
4251
4370
  let resolved = false;
@@ -4380,6 +4499,30 @@ function yui_shell_confirm_yesnocancel(shell, message, opts) {
4380
4499
  *
4381
4500
  * Window - position fixed
4382
4501
  *
4502
+ * A window is a DIALOG for the keyboard and for a reader:
4503
+ *
4504
+ * - it says so (`role="dialog"`) and is named by its title
4505
+ * (`aria-labelledby` on its two halves, the kind half carrying
4506
+ * its key, so the name changes language with it);
4507
+ * - when it starts in answer to the reader (a press, a key) it
4508
+ * takes the focus (`focus`: an element, a selector, a number;
4509
+ * by default the window itself, which is focusable with
4510
+ * tabindex=-1) -- not one the app restores on its own at start
4511
+ * up -- and when it goes it gives the focus back to where it
4512
+ * came from, if the focus was in it;
4513
+ * - Escape closes it (`keyboard`) the way its ✕ does, through
4514
+ * EV_CLOSE_WINDOW, so EV_WINDOW_TO_CLOSE can still veto or
4515
+ * ask; not an Escape that what it was typed in took first
4516
+ * (escape_is_taken());
4517
+ * - a `modal` one blocks the rest of the app: it hangs over a
4518
+ * backdrop in the shell's dialog layer (above the dock, the
4519
+ * drawer, every other window), a press outside it does
4520
+ * nothing, Tab stays inside (activate_focus_trap_on(), the
4521
+ * trap of the shell's dialogs), and it never goes to the dock.
4522
+ *
4523
+ * Up to 7.26.42 `focus`, `modal` and `keyboard` were declared and
4524
+ * did nothing.
4525
+ *
4383
4526
  * Copyright (c) 2025-2026, ArtGins.
4384
4527
  * All Rights Reserved.
4385
4528
  ***********************************************************************/
@@ -4392,6 +4535,10 @@ var WC_MAX = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><rect x=\"3.3\" y=
4392
4535
  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>";
4393
4536
  var WC_CLOSE = "<svg viewBox=\"0 0 16 16\" aria-hidden=\"true\"><path d=\"M4 4 L12 12 M12 4 L4 12\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\"/></svg>";
4394
4537
  var MOBILE_MAX = 768;
4538
+ var DOCK_INSET_TOP = "var(--yui-dock-inset-top, 0px)";
4539
+ var DOCK_INSET_BOTTOM = "var(--yui-dock-inset-bottom, 0px)";
4540
+ var MODAL_WINDOW_Z = 40;
4541
+ var __title_seq__ = 0;
4395
4542
  /***************************************************************
4396
4543
  * Data
4397
4544
  ***************************************************************/
@@ -4422,9 +4569,9 @@ var attrs_table$21 = [
4422
4569
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "title_prefix", 0, "", "Optional DATA half of the title (a topic/service/marker name), shown before `title` and never translated. Use it instead of composing `${name} · ${t(key)}` into `title`, which cannot re-translate"),
4423
4570
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "title", 0, "", "Window title, an i18n KEY: painted in the title bar (unless `header` overrides it) and on the dock chip. Pass the key, not t(key), or it cannot re-translate"),
4424
4571
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "icon", 0, "", "Window icon (by window type), leading the title bar and the dock chip: a yi-* class name or inline SVG"),
4425
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "focus", 0, null, "NOT implemented yet: would bring focus to the element, a number or a selector"),
4426
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "modal", 0, false, "NOT implemented yet: would enable modal mode"),
4427
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "NOT implemented yet: would close the window on ESC (Escape does nothing today)"),
4572
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "focus", 0, null, "What takes the focus when the window starts in answer to the reader (a press, a key; a window the app restores on its own leaves the focus in the page, a modal one takes it always): an element of the window, a CSS selector looked up in it, or a number (the n-th control of the body, from 0). Null: the window itself. The focus goes back where it came from when the window goes, if it was in the window"),
4573
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "modal", 0, false, "Block the rest of the app while the window is open: a backdrop in the shell's dialog layer (above the dock, the drawer, every other window), a press outside does nothing, Tab stays inside, aria-modal. A modal window never goes to the dock: `manager` is ignored"),
4574
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "Escape closes the window the way its ✕ does (EV_WINDOW_TO_CLOSE can veto or ask), when the focus is in it -- not an Escape that what it was typed in took first: a handler that used it, a cell editor that closed with it, a textarea or a contenteditable"),
4428
4575
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "back_dismissable", 0, true, "Browser Back closes this window (floating overlays only; ignored when it has a `manager`)"),
4429
4576
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keep_on_navigate", 0, false, "This window is a navigation PANEL: a route change does not close it"),
4430
4577
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "back_overlay", 0, null, "Internal: overlay-history entry (Back-button integration)"),
@@ -4436,7 +4583,10 @@ var attrs_table$21 = [
4436
4583
  var PRIVATE_DATA$21 = {
4437
4584
  prevSize: 0,
4438
4585
  placed_by_shell: false,
4439
- back_shell: null
4586
+ back_shell: null,
4587
+ opener: null,
4588
+ $lock: null,
4589
+ release_focus: null
4440
4590
  };
4441
4591
  var __gclass__$21 = null;
4442
4592
  /******************************
@@ -4450,6 +4600,10 @@ function mt_create$21(gobj) {
4450
4600
  if (subscriber) (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
4451
4601
  let window_id = "window-" + (0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_short_name)(gobj));
4452
4602
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "window_id", window_id);
4603
+ if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "modal") && (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager")) {
4604
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a modal window does not go to the dock: its manager is ignored`);
4605
+ (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "manager", null);
4606
+ }
4453
4607
  let manager = resolve_manager(gobj);
4454
4608
  build_ui$18(gobj);
4455
4609
  yui_shell_watch_changes(gobj);
@@ -4485,13 +4639,41 @@ function mt_create$21(gobj) {
4485
4639
  window.addEventListener("resize", on_win_resize);
4486
4640
  }
4487
4641
  /***************************************************************
4642
+ * Framework Method: Start
4643
+ *
4644
+ * The window takes the focus when it STARTS, not when it is
4645
+ * created: a host fills the body between the two (the json pad,
4646
+ * the frontend view), and `focus` may name what it put there.
4647
+ *
4648
+ * Only a window the READER opened takes it (opened_by_the_reader()).
4649
+ * One the app opens on its own -- the Developer window restored at
4650
+ * start up from the last session -- leaves the focus in the page:
4651
+ * the first Tab of a keyboard reader landed in a window they had
4652
+ * not opened. A modal window takes it all the same: nothing else
4653
+ * can be used while it is up.
4654
+ ***************************************************************/
4655
+ function mt_start$20(gobj) {
4656
+ let priv = gobj.priv;
4657
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
4658
+ if (!$container) {
4659
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: started without a container`);
4660
+ return;
4661
+ }
4662
+ let active = document.activeElement;
4663
+ if (active && active !== document.body && !$container.contains(active)) priv.opener = active;
4664
+ let modal = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "modal");
4665
+ if (modal && !priv.release_focus) priv.release_focus = activate_focus_trap_on($container);
4666
+ if (modal || opened_by_the_reader()) focus_target(gobj, $container).focus();
4667
+ }
4668
+ /***************************************************************
4488
4669
  * Framework Method: Destroy
4489
4670
  ***************************************************************/
4490
4671
  function mt_destroy$21(gobj) {
4491
4672
  let priv = gobj.priv;
4673
+ give_focus_back(gobj);
4492
4674
  yui_shell_unwatch_changes(gobj);
4493
4675
  let manager = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
4494
- if (manager) (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_UNREGISTER_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
4676
+ if (manager && !(0, _yuneta_gobj_js.gobj_is_destroying)(manager)) (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_UNREGISTER_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
4495
4677
  let back_overlay = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "back_overlay");
4496
4678
  if (back_overlay) {
4497
4679
  if (priv.back_shell) yui_shell_overlay_dismissed(priv.back_shell, back_overlay);
@@ -4526,9 +4708,12 @@ function ensure_window_style() {
4526
4708
  .yui-window-title .icon { flex: 0 0 auto; }
4527
4709
  .yui-window-title svg { width: 14px; height: 14px; display: block; }
4528
4710
  /* Separator between the data half and the translated kind half. CSS,
4529
- * not a text node: createElement2 trims text nodes and eats the spaces. */
4711
+ * not a text node: createElement2 trims text nodes and eats the spaces.
4712
+ * Decorative ("/ ''"): the halves NAME the window, and a reader read
4713
+ * the dot into the kind half ("#1 ·demo window"). */
4530
4714
  .WINDOW_TITLE_PREFIX + .WINDOW_TITLE_KIND::before {
4531
4715
  content: "·";
4716
+ content: "·" / "";
4532
4717
  padding: 0 0.4em;
4533
4718
  color: var(--bulma-text-weak);
4534
4719
  }
@@ -4542,6 +4727,13 @@ function ensure_window_style() {
4542
4727
  .yui-wc svg { width: 15px; height: 15px; display: block; }
4543
4728
  .yui-window-resize { color: var(--bulma-text-weak); opacity: 0.55; }
4544
4729
  .yui-window-resize:hover { opacity: 1; color: var(--bulma-text); }
4730
+ /* A modal window over its backdrop: the backdrop of a Bulma .modal,
4731
+ * which the shell's dialogs wear (its variable lives on .modal). */
4732
+ .yui-window-lock { position: fixed; inset: 0; }
4733
+ .yui-window-backdrop {
4734
+ position: absolute; inset: 0;
4735
+ background-color: hsla(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-invert-l), 0.86);
4736
+ }
4545
4737
  @media (max-width: ${MOBILE_MAX}px) {
4546
4738
  .C_YUI_WINDOW.is-mobile-sheet { border-radius: 0 !important; box-shadow: none !important; }
4547
4739
  .C_YUI_WINDOW.is-mobile-sheet .yui-window-resize { display: none !important; }
@@ -4577,12 +4769,19 @@ function ensure_window_style() {
4577
4769
  * refresh_language() re-translates just that one. The separator is
4578
4770
  * CSS (::before), never a text node: createElement2 TRIMS text nodes
4579
4771
  * and would eat the spaces around it.
4772
+ *
4773
+ * The same halves NAME the window: aria-labelledby lists them
4774
+ * (`<id>-prefix`, `<id>-kind`), so a reader joins them with a space
4775
+ * and leaves out the CSS separator, and the kind half changes
4776
+ * language. Under a `header` of the caller's the node is still
4777
+ * built, `hidden` (is-sr-only, no icon): a header is a toolbar more
4778
+ * often than a title, and the name of a dialog is its title.
4580
4779
  ************************************************************/
4581
- function build_default_header(gobj) {
4780
+ function build_title_node(gobj, id, hidden) {
4582
4781
  let title = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title");
4583
4782
  let prefix = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title_prefix");
4584
4783
  if ((0, _yuneta_gobj_js.empty_string)(title) && (0, _yuneta_gobj_js.empty_string)(prefix)) return null;
4585
- let icon = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "icon");
4784
+ let icon = hidden ? "" : (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "icon");
4586
4785
  let items = [];
4587
4786
  if (!(0, _yuneta_gobj_js.empty_string)(icon)) {
4588
4787
  if (icon.charAt(0) === "<") items.push([
@@ -4598,20 +4797,27 @@ function build_default_header(gobj) {
4598
4797
  }
4599
4798
  if (!(0, _yuneta_gobj_js.empty_string)(prefix)) items.push([
4600
4799
  "span",
4601
- { class: "WINDOW_TITLE_PREFIX has-text-weight-semibold" },
4800
+ {
4801
+ class: "WINDOW_TITLE_PREFIX has-text-weight-semibold",
4802
+ id: `${id}-prefix`
4803
+ },
4602
4804
  text_node(prefix)
4603
4805
  ]);
4604
4806
  if (!(0, _yuneta_gobj_js.empty_string)(title)) items.push([
4605
4807
  "span",
4606
4808
  {
4607
4809
  class: "WINDOW_TITLE_KIND has-text-weight-semibold",
4810
+ id: `${id}-kind`,
4608
4811
  i18n: title
4609
4812
  },
4610
4813
  text_node(title)
4611
4814
  ]);
4612
4815
  return (0, _yuneta_gobj_js.createElement2)([
4613
4816
  "span",
4614
- { class: "WINDOW_TITLE yui-window-title icon-text ml-1" },
4817
+ {
4818
+ id,
4819
+ class: hidden ? "WINDOW_TITLE is-sr-only" : "WINDOW_TITLE yui-window-title icon-text ml-1"
4820
+ },
4615
4821
  items
4616
4822
  ]);
4617
4823
  }
@@ -4628,6 +4834,106 @@ function composed_title(gobj) {
4628
4834
  return (0, _yuneta_gobj_js.empty_string)(prefix) ? kind : prefix;
4629
4835
  }
4630
4836
  /************************************************************
4837
+ * Is the window opening in answer to the reader -- a press, a
4838
+ * key (the browser's user activation)? Not one the app restores
4839
+ * at start up. A browser that cannot say is taken at its word
4840
+ * that the reader asked.
4841
+ ************************************************************/
4842
+ function opened_by_the_reader() {
4843
+ let ua = typeof navigator !== "undefined" ? navigator.userActivation : null;
4844
+ if (!ua) return true;
4845
+ return !!ua.isActive;
4846
+ }
4847
+ /************************************************************
4848
+ * What takes the focus when the window starts (`focus`): an
4849
+ * element of the window, a selector looked up in it, or the
4850
+ * n-th control of the body. Null, or one that names nothing
4851
+ * (said): the window itself.
4852
+ ************************************************************/
4853
+ function focus_target(gobj, $container) {
4854
+ let focus = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "focus");
4855
+ if (focus === null || focus === void 0) return $container;
4856
+ let $target = null;
4857
+ if (typeof focus === "number") {
4858
+ let $body = $container.querySelector(".WINDOW_BODY");
4859
+ $target = ($body ? $body.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])") : [])[focus] || null;
4860
+ } else if (typeof focus === "string") $target = $container.querySelector(focus);
4861
+ else if (focus && typeof focus.focus === "function" && $container.contains(focus)) $target = focus;
4862
+ if (!$target) {
4863
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: focus '${String(focus)}' names nothing in the window: the window takes it`);
4864
+ return $container;
4865
+ }
4866
+ return $target;
4867
+ }
4868
+ /************************************************************
4869
+ * The window goes: the focus goes back where it came from --
4870
+ * if it was in the window, or lost with what the window held
4871
+ * (a child torn down first takes its focused element with
4872
+ * it). A focus the reader has put elsewhere stays there. A
4873
+ * modal window's trap gives it back itself.
4874
+ ************************************************************/
4875
+ function give_focus_back(gobj) {
4876
+ let priv = gobj.priv;
4877
+ let opener = priv.opener;
4878
+ priv.opener = null;
4879
+ if (priv.release_focus) {
4880
+ let release = priv.release_focus;
4881
+ priv.release_focus = null;
4882
+ release();
4883
+ return;
4884
+ }
4885
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
4886
+ let active = document.activeElement;
4887
+ if (!(!active || active === document.body) && !($container && $container.contains(active))) return;
4888
+ if (opener && opener.isConnected !== false && typeof opener.focus === "function") opener.focus();
4889
+ }
4890
+ /************************************************************
4891
+ * A window that fills the screen -- the sheet of a phone, a
4892
+ * maximized one -- fills it but for the band a floating dock
4893
+ * keeps (DOCK_INSET_*). CSS, so the band moves with the dock
4894
+ * and no one has to tell the window.
4895
+ ************************************************************/
4896
+ function fill_work_area($container) {
4897
+ let vw = window.innerWidth || document.documentElement.offsetWidth;
4898
+ let vh = window.innerHeight || document.documentElement.offsetHeight;
4899
+ $container.style.left = "0px";
4900
+ $container.style.top = DOCK_INSET_TOP;
4901
+ $container.style.width = vw + "px";
4902
+ $container.style.height = `calc(${vh}px - ${DOCK_INSET_TOP} - ${DOCK_INSET_BOTTOM})`;
4903
+ return {
4904
+ x: 0,
4905
+ y: 0,
4906
+ width: vw,
4907
+ height: vh
4908
+ };
4909
+ }
4910
+ /************************************************************
4911
+ * What is placed in the DOM, and removed from it: the window,
4912
+ * or the lock that holds a modal one over its backdrop.
4913
+ ************************************************************/
4914
+ function window_root(gobj) {
4915
+ return gobj.priv.$lock || (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
4916
+ }
4917
+ /************************************************************
4918
+ * An Escape typed in the window. The callback only decides
4919
+ * whether the key is the window's -- not when `keyboard` is
4920
+ * off, nor one that what it was typed in took -- and sends
4921
+ * the event: the close is the ✕'s, in the action.
4922
+ ************************************************************/
4923
+ function on_escape_key(gobj, evt) {
4924
+ if (evt.key !== "Escape" && evt.keyCode !== 27) return;
4925
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj) || !(0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "keyboard")) return;
4926
+ if (escape_is_taken(evt)) {
4927
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
4928
+ let active = document.activeElement;
4929
+ if (evt.target && evt.target.isConnected === false && $container && (!active || active === document.body)) $container.focus();
4930
+ return;
4931
+ }
4932
+ evt.preventDefault();
4933
+ evt.stopPropagation();
4934
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CLOSE_WINDOW", { key: "Escape" }, gobj);
4935
+ }
4936
+ /************************************************************
4631
4937
  * Below the mobile breakpoint the window is a full-screen
4632
4938
  * sheet (no float / drag / resize).
4633
4939
  ************************************************************/
@@ -4669,14 +4975,18 @@ function build_ui$18(gobj) {
4669
4975
  let mobile = is_mobile$4();
4670
4976
  let header = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "header");
4671
4977
  if ((0, _yuneta_gobj_js.is_gobj)(header)) header = (0, _yuneta_gobj_js.gobj_read_attr)(header, "$container");
4672
- if (!header) header = build_default_header(gobj);
4978
+ let title_id = `yui-window-title-${++__title_seq__}`;
4979
+ let $title = build_title_node(gobj, title_id, !!header);
4980
+ let $hidden_title = header ? $title : null;
4981
+ if (!header) header = $title;
4982
+ let modal = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "modal");
4673
4983
  let body = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "body");
4674
4984
  if ((0, _yuneta_gobj_js.is_gobj)(body)) body = (0, _yuneta_gobj_js.gobj_read_attr)(body, "$container");
4675
4985
  let footer = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "footer");
4676
4986
  if ((0, _yuneta_gobj_js.is_gobj)(footer)) footer = (0, _yuneta_gobj_js.gobj_read_attr)(footer, "$container");
4677
4987
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "auto_save_size_and_position")) {
4678
4988
  if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) {
4679
- let rect = (0, _yuneta_gobj_js.kw_get_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`);
4989
+ let rect = whole_rect((0, _yuneta_gobj_js.kw_get_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`));
4680
4990
  if (rect) {
4681
4991
  rect.x = rect.x < 0 ? 0 : rect.x;
4682
4992
  rect.y = rect.y < 0 ? 0 : rect.y;
@@ -4715,12 +5025,21 @@ function build_ui$18(gobj) {
4715
5025
  };
4716
5026
  Object.assign(window_style, (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "window_style"));
4717
5027
  let logical = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "logical_class");
5028
+ let dialog_attrs = {
5029
+ role: "dialog",
5030
+ tabindex: "-1"
5031
+ };
5032
+ let label_ids = [];
5033
+ if (!(0, _yuneta_gobj_js.empty_string)((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title_prefix"))) label_ids.push(`${title_id}-prefix`);
5034
+ if (!(0, _yuneta_gobj_js.empty_string)((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title"))) label_ids.push(`${title_id}-kind`);
5035
+ if (label_ids.length > 0) dialog_attrs["aria-labelledby"] = label_ids.join(" ");
5036
+ if (modal) dialog_attrs["aria-modal"] = "true";
4718
5037
  let $container = (0, _yuneta_gobj_js.createElement2)([
4719
5038
  "div",
4720
- {
5039
+ Object.assign({
4721
5040
  class: "C_YUI_WINDOW" + (logical ? " " + logical : "") + " strong-shadow is-flex is-flex-direction-column" + (mobile ? " is-mobile-sheet" : ""),
4722
5041
  style: window_style
4723
- },
5042
+ }, dialog_attrs),
4724
5043
  [
4725
5044
  [
4726
5045
  "div",
@@ -4880,6 +5199,11 @@ function build_ui$18(gobj) {
4880
5199
  ]
4881
5200
  ]);
4882
5201
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", $container);
5202
+ if ($hidden_title) $container.insertBefore($hidden_title, $container.firstChild);
5203
+ $container.addEventListener("keydown", function(evt) {
5204
+ on_escape_key(gobj, evt);
5205
+ });
5206
+ if (mobile) fill_work_area($container);
4883
5207
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "resizable") && !(0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "showFooter")) {
4884
5208
  let $resizable_btn = (0, _yuneta_gobj_js.createElement2)([
4885
5209
  "div",
@@ -4907,10 +5231,29 @@ function build_ui$18(gobj) {
4907
5231
  $container.appendChild($resizable_btn);
4908
5232
  }
4909
5233
  (0, _yuneta_gobj_js.refresh_language)($container, i18next.t);
5234
+ if (modal) {
5235
+ let $lock = (0, _yuneta_gobj_js.createElement2)([
5236
+ "div",
5237
+ {
5238
+ class: "WINDOW_MODAL_LOCK yui-window-lock",
5239
+ style: `z-index:${MODAL_WINDOW_Z};`
5240
+ },
5241
+ [[
5242
+ "div",
5243
+ { class: "WINDOW_MODAL_BACKDROP yui-window-backdrop" },
5244
+ [],
5245
+ { mousedown: (evt) => {
5246
+ evt.preventDefault();
5247
+ } }
5248
+ ]]
5249
+ ]);
5250
+ $lock.appendChild($container);
5251
+ gobj.priv.$lock = $lock;
5252
+ }
4910
5253
  let $parent = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$parent");
4911
5254
  gobj.priv.placed_by_shell = !$parent;
4912
5255
  if (!$parent) $parent = window_place(gobj);
4913
- $parent.appendChild($container);
5256
+ $parent.appendChild(window_root(gobj));
4914
5257
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "openMaximized")) max$2(gobj);
4915
5258
  else if (!mobile) {
4916
5259
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "content_size")) $container.style.height = "auto";
@@ -4926,11 +5269,10 @@ function build_ui$18(gobj) {
4926
5269
  * Destroy UI
4927
5270
  ************************************************************/
4928
5271
  function destroy_ui$13(gobj) {
4929
- let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
4930
- if ($container) {
4931
- if ($container.parentNode) $container.parentNode.removeChild($container);
4932
- (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", null);
4933
- }
5272
+ let $root = window_root(gobj);
5273
+ if ($root && $root.parentNode) $root.parentNode.removeChild($root);
5274
+ gobj.priv.$lock = null;
5275
+ (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", null);
4934
5276
  }
4935
5277
  /************************************************************
4936
5278
  * Register this floating window in the shell's overlay history,
@@ -5021,9 +5363,16 @@ function close_window(gobj) {
5021
5363
  * The place is the shell's, and a window parented to the app
5022
5364
  * outlives it: ac_shell_changed() moves it when a shell goes or
5023
5365
  * comes.
5366
+ *
5367
+ * A MODAL window lives in the shell's dialog layer instead, with
5368
+ * its backdrop: it blocks the drawer, the dock and every other
5369
+ * window, and a question it asks (a dialog of the same layer)
5370
+ * opens above it.
5024
5371
  ************************************************************/
5025
5372
  function window_place(gobj) {
5026
- return yui_shell_window_layer(yui_shell_of(gobj)) || document.body;
5373
+ let shell = yui_shell_of(gobj);
5374
+ if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "modal")) return yui_shell_modal_layer(shell) || document.body;
5375
+ return yui_shell_window_layer(shell) || document.body;
5027
5376
  }
5028
5377
  /************************************************************
5029
5378
  *
@@ -5039,12 +5388,7 @@ function max$2(gobj) {
5039
5388
  let priv = gobj.priv;
5040
5389
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
5041
5390
  priv.prevSize = $container.getBoundingClientRect();
5042
- let rect = do_fix_dimension_to_screen(gobj, 0, 0, 1e4, 1e4);
5043
- if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "center")) rect = do_center(gobj, rect.x, rect.y, rect.width, rect.height);
5044
- $container.style.left = parseInt(rect.x) + "px";
5045
- $container.style.top = parseInt(rect.y) + "px";
5046
- $container.style.width = parseInt(rect.width) + "px";
5047
- $container.style.height = parseInt(rect.height) + "px";
5391
+ let rect = fill_work_area($container);
5048
5392
  (0, _yuneta_gobj_js.gobj_write_bool_attr)(gobj, "maximized", true);
5049
5393
  set_max_icon(gobj, true);
5050
5394
  return rect;
@@ -5082,6 +5426,27 @@ function min$1(gobj) {
5082
5426
  return rect;
5083
5427
  }
5084
5428
  /************************************************************
5429
+ * The rect of a window in whole pixels: x, y, width and height
5430
+ * are DTP_INTEGER, and getBoundingClientRect() answers fractions
5431
+ * under a zoom or a device pixel ratio (an integer attr refuses
5432
+ * 2.5, as in C). Also a rect saved with fractions before. null
5433
+ * when it is not a rect of four numbers.
5434
+ ************************************************************/
5435
+ function whole_rect(rect) {
5436
+ if (!rect || typeof rect !== "object") return null;
5437
+ let whole = {};
5438
+ for (const key of [
5439
+ "x",
5440
+ "y",
5441
+ "width",
5442
+ "height"
5443
+ ]) {
5444
+ if (typeof rect[key] !== "number" || !Number.isFinite(rect[key])) return null;
5445
+ whole[key] = Math.round(rect[key]);
5446
+ }
5447
+ return whole;
5448
+ }
5449
+ /************************************************************
5085
5450
  * handlers moving
5086
5451
  ************************************************************/
5087
5452
  function mvStart(gobj, evt) {
@@ -5116,17 +5481,13 @@ function mvStart(gobj, evt) {
5116
5481
  $container.style.transition = "none";
5117
5482
  $container.style.transform = "translate3d(0px, 0px, 0px)";
5118
5483
  let rect = $container.getBoundingClientRect();
5119
- (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "x", rect.x);
5120
- (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "y", rect.y);
5121
- (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "width", rect.width);
5122
- (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "height", rect.height);
5484
+ let whole = whole_rect(rect);
5485
+ (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "x", whole.x);
5486
+ (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "y", whole.y);
5487
+ (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "width", whole.width);
5488
+ (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "height", whole.height);
5123
5489
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "auto_save_size_and_position")) {
5124
- if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) (0, _yuneta_gobj_js.kw_set_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`, {
5125
- x: rect.x,
5126
- y: rect.y,
5127
- width: rect.width,
5128
- height: rect.height
5129
- });
5490
+ if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) (0, _yuneta_gobj_js.kw_set_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`, whole);
5130
5491
  }
5131
5492
  (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_WINDOW_MOVED", { rect });
5132
5493
  }
@@ -5169,17 +5530,13 @@ function rsStart(gobj, evt) {
5169
5530
  $container.style.width = rect.width + "px";
5170
5531
  $container.style.height = rect.height + "px";
5171
5532
  }
5172
- (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "x", rect.x);
5173
- (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "y", rect.y);
5174
- (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "width", rect.width);
5175
- (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "height", rect.height);
5533
+ let whole = whole_rect(rect);
5534
+ (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "x", whole.x);
5535
+ (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "y", whole.y);
5536
+ (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "width", whole.width);
5537
+ (0, _yuneta_gobj_js.gobj_write_integer_attr)(gobj, "height", whole.height);
5176
5538
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "auto_save_size_and_position")) {
5177
- if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) (0, _yuneta_gobj_js.kw_set_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`, {
5178
- x: rect.x,
5179
- y: rect.y,
5180
- width: rect.width,
5181
- height: rect.height
5182
- });
5539
+ if ((0, _yuneta_gobj_js.gobj_is_service)(gobj)) (0, _yuneta_gobj_js.kw_set_local_storage_value)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-rect`, whole);
5183
5540
  }
5184
5541
  (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_WINDOW_RESIZED", { rect });
5185
5542
  }
@@ -5246,22 +5603,12 @@ function handleResize(gobj) {
5246
5603
  if (!$container) return;
5247
5604
  if (is_mobile$4()) {
5248
5605
  $container.classList.add("is-mobile-sheet");
5249
- let vw = window.innerWidth || document.documentElement.offsetWidth;
5250
- let vh = window.innerHeight || document.documentElement.offsetHeight;
5251
- $container.style.left = "0px";
5252
- $container.style.top = "0px";
5253
- $container.style.width = vw + "px";
5254
- $container.style.height = vh + "px";
5606
+ fill_work_area($container);
5255
5607
  return;
5256
5608
  }
5257
5609
  $container.classList.remove("is-mobile-sheet");
5258
5610
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "maximized") === true) {
5259
- let r = do_fix_dimension_to_screen(gobj, 0, 0, 1e4, 1e4);
5260
- if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "center")) r = do_center(gobj, r.x, r.y, r.width, r.height);
5261
- $container.style.left = parseInt(r.x) + "px";
5262
- $container.style.top = parseInt(r.y) + "px";
5263
- $container.style.width = parseInt(r.width) + "px";
5264
- $container.style.height = parseInt(r.height) + "px";
5611
+ fill_work_area($container);
5265
5612
  return;
5266
5613
  }
5267
5614
  let rect = do_fix_dimension_to_screen(gobj, (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "x"), (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "y"), (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "width"), (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "height"));
@@ -5352,7 +5699,8 @@ function ac_shell_changed$1(gobj, event, kw, src) {
5352
5699
  priv.placed_by_shell = true;
5353
5700
  }
5354
5701
  let $place = window_place(gobj);
5355
- if ($container.parentNode !== $place) $place.appendChild($container);
5702
+ let $root = window_root(gobj);
5703
+ if ($root.parentNode !== $place) $place.appendChild($root);
5356
5704
  return 0;
5357
5705
  }
5358
5706
  /***************************
@@ -5360,6 +5708,7 @@ function ac_shell_changed$1(gobj, event, kw, src) {
5360
5708
  ***************************/
5361
5709
  var gmt$21 = {
5362
5710
  mt_create: mt_create$21,
5711
+ mt_start: mt_start$20,
5363
5712
  mt_destroy: mt_destroy$21
5364
5713
  };
5365
5714
  /***************************************************************
@@ -5447,6 +5796,15 @@ function register_c_yui_window() {
5447
5796
  * (`responsive_query`) — so on mobile it lives above
5448
5797
  * the bottom menu instead of covering it.
5449
5798
  *
5799
+ * A FLOATING dock that shows says the band it keeps at the top or
5800
+ * the foot of the viewport: `--yui-dock-inset-top` /
5801
+ * `--yui-dock-inset-bottom` on the root element (publish_dock_band).
5802
+ * A window that fills the screen -- the sheet of a phone, a
5803
+ * maximized one -- leaves that band free. It used to go under the
5804
+ * dock: at a bottom corner the dock covered its foot, at a top
5805
+ * corner its ✕ and its minimize (a 'responsive' dock with no
5806
+ * `inline_selector` floats on a phone too).
5807
+ *
5450
5808
  * Copyright (c) 2026, ArtGins.
5451
5809
  * All Rights Reserved.
5452
5810
  ***********************************************************************/
@@ -5516,6 +5874,7 @@ function mt_destroy$20(gobj) {
5516
5874
  priv.mql_handler = null;
5517
5875
  }
5518
5876
  destroy_dock(gobj);
5877
+ publish_dock_band(gobj);
5519
5878
  }
5520
5879
  /***************************
5521
5880
  * Local Methods
@@ -5620,8 +5979,10 @@ function ensure_dock_style() {
5620
5979
  .yui-dock-label { flex: 0 0 auto; }
5621
5980
  /* Split label halves (prefix = DATA, kind = translatable). The
5622
5981
  * separator is CSS, never a text node — same rule as the window
5623
- * title bar (createElement2 trims text nodes). */
5624
- .yui-dock-label .yui-dock-label-prefix + .yui-dock-label-kind::before { content: " \\00b7 "; }
5982
+ * title bar (createElement2 trims text nodes). Decorative ("/ ''"):
5983
+ * the halves NAME the toggle (aria-labelledby), and a reader read
5984
+ * the dot into the kind half ("#1 ·demo window"). */
5985
+ .yui-dock-label .yui-dock-label-prefix + .yui-dock-label-kind::before { content: " \\00b7 "; content: " \\00b7 " / ""; }
5625
5986
  .yui-dock-close {
5626
5987
  width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
5627
5988
  padding: 0; margin-left: 1px; border: 0; border-radius: 4px;
@@ -5693,6 +6054,32 @@ function apply_placement(gobj) {
5693
6054
  ]) $dock.classList.toggle(`yui-dock--${c}`, !inline && c === corner);
5694
6055
  let target = inline ? $inline : (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$parent") || dock_place(gobj);
5695
6056
  if ($dock.parentNode !== target) target.appendChild($dock);
6057
+ publish_dock_band(gobj);
6058
+ }
6059
+ /************************************************************
6060
+ * Say the band the dock keeps over the windows: a FLOATING
6061
+ * dock that shows takes the top or the foot of the viewport,
6062
+ * from its edge to its far side. A window that fills the
6063
+ * screen leaves it free (C_YUI_WINDOW's fill_work_area()). An
6064
+ * inline dock keeps none: it is in the layout. Nor does an
6065
+ * empty one, or one that is not drawn.
6066
+ ************************************************************/
6067
+ function publish_dock_band(gobj) {
6068
+ let $dock = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
6069
+ let top = 0;
6070
+ let bottom = 0;
6071
+ if ($dock && $dock.parentNode && $dock.classList.contains("yui-dock--floating") && !$dock.classList.contains("is-empty")) {
6072
+ let r = $dock.getBoundingClientRect();
6073
+ if (r.height > 0) {
6074
+ if (((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "dock_corner") || "bottom-left").indexOf("top") === 0) top = Math.ceil(r.bottom);
6075
+ else bottom = Math.ceil((window.innerHeight || 0) - r.top);
6076
+ }
6077
+ }
6078
+ let style = document.documentElement.style;
6079
+ if (top > 0) style.setProperty("--yui-dock-inset-top", `${top}px`);
6080
+ else style.removeProperty("--yui-dock-inset-top");
6081
+ if (bottom > 0) style.setProperty("--yui-dock-inset-bottom", `${bottom}px`);
6082
+ else style.removeProperty("--yui-dock-inset-bottom");
5696
6083
  }
5697
6084
  /************************************************************
5698
6085
  * Where the FLOATING dock lives when the app names no
@@ -5782,6 +6169,7 @@ function sync_dock_visibility(gobj) {
5782
6169
  let priv = gobj.priv;
5783
6170
  let $dock = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
5784
6171
  if ($dock) $dock.classList.toggle("is-empty", priv.windows.length === 0);
6172
+ publish_dock_band(gobj);
5785
6173
  }
5786
6174
  /************************************************************
5787
6175
  * Mark one entry active (raised), the rest inactive.
@@ -5820,10 +6208,17 @@ function minimize_entry(gobj, entry) {
5820
6208
  /************************************************************
5821
6209
  * Dock chip click: taskbar toggle — restore+focus a
5822
6210
  * minimized/inactive window, minimize the active one.
6211
+ *
6212
+ * The window brought back takes the keyboard focus too: the
6213
+ * reader pressed its chip to go there, and a window is heard
6214
+ * (Escape, Tab) only with the focus in it.
5823
6215
  ************************************************************/
5824
6216
  function on_chip_click(gobj, entry) {
5825
- if (entry.minimized || !entry.$chip.classList.contains("is-active")) focus_entry(gobj, entry);
5826
- else minimize_entry(gobj, entry);
6217
+ if (entry.minimized || !entry.$chip.classList.contains("is-active")) {
6218
+ focus_entry(gobj, entry);
6219
+ let $win = (0, _yuneta_gobj_js.gobj_read_attr)(entry.gobj, "$container");
6220
+ if ($win) $win.focus();
6221
+ } else minimize_entry(gobj, entry);
5827
6222
  }
5828
6223
  /***************************
5829
6224
  * Actions
@@ -5952,7 +6347,13 @@ function ac_minimize_window(gobj, event, kw, src) {
5952
6347
  let win = window_of(gobj, event, kw, src);
5953
6348
  if (!win) return -1;
5954
6349
  let entry = find_entry(gobj.priv, win);
5955
- if (entry) minimize_entry(gobj, entry);
6350
+ if (entry) {
6351
+ let $win = (0, _yuneta_gobj_js.gobj_read_attr)(win, "$container");
6352
+ let had_focus = !!($win && $win.contains(document.activeElement));
6353
+ minimize_entry(gobj, entry);
6354
+ let $toggle = had_focus && entry.$chip ? entry.$chip.querySelector(".DOCK_CHIP_TOGGLE") : null;
6355
+ if ($toggle) $toggle.focus();
6356
+ }
5956
6357
  return 0;
5957
6358
  }
5958
6359
  /************************************************************
@@ -7246,6 +7647,10 @@ function register_c_yui_wizard() {
7246
7647
  *
7247
7648
  * yui_tabulator_relocalize(table, t, {device_id: t("device id")});
7248
7649
  *
7650
+ * A column GROUP is bound by field too, and Tabulator gives it none:
7651
+ * give it one (`{title, field: "sizes", columns: [...]}`, no row reads
7652
+ * it) and its title goes in the same object. One without is said.
7653
+ *
7249
7654
  * Every key carries an English `defaultValue`, so an app that does not
7250
7655
  * define it renders exactly what Tabulator rendered before — the
7251
7656
  * keys are an OPPORTUNITY to translate, never a requirement.
@@ -7405,6 +7810,22 @@ function yui_tabulator_name_editor(column_def, name_of) {
7405
7810
  };
7406
7811
  }
7407
7812
  /***************************************************************
7813
+ * A column GROUP whose title cannot change language, said.
7814
+ *
7815
+ * Tabulator binds a column's title to the locale by its `field`, and
7816
+ * a group has none: its title stays in the language the table was
7817
+ * built in. Given a `field` (no row reads a group's), a group is
7818
+ * bound like any other column, and its title goes in `titles`.
7819
+ ***************************************************************/
7820
+ function say_groups_without_field(columns) {
7821
+ for (let column of columns || []) {
7822
+ let def = column.getDefinition() || {};
7823
+ if (!Array.isArray(def.columns)) continue;
7824
+ if (!def.field) (0, _yuneta_gobj_js.log_warning)(`yui_tabulator_relocalize: column group '${def.title}' has no field: its title stays in the language it was built in`);
7825
+ say_groups_without_field(column.getSubColumns());
7826
+ }
7827
+ }
7828
+ /***************************************************************
7408
7829
  * yui_tabulator_relocalize() -- see "Put an EXISTING table in the
7409
7830
  * current language" above.
7410
7831
  *
@@ -7413,14 +7834,19 @@ function yui_tabulator_name_editor(column_def, name_of) {
7413
7834
  * (`columns`), where Tabulator binds each column's title: setLocale()
7414
7835
  * draws them again without rebuilding a column -- updateDefinition()
7415
7836
  * re-renders every row, and a row whose formatter builds something (a
7416
- * nested table) builds it anew. A field left out keeps its title.
7837
+ * nested table) builds it anew. A field left out keeps its title. A
7838
+ * column GROUP is bound only if it has a `field` of its own: one
7839
+ * without is said (say_groups_without_field).
7417
7840
  ***************************************************************/
7418
7841
  function yui_tabulator_relocalize(table, t, titles) {
7419
7842
  if (!table) return;
7420
7843
  try {
7421
7844
  let name = next_lang_name();
7422
7845
  let strings = tabulator_strings(t);
7423
- if (titles && typeof titles === "object") strings.columns = Object.assign({}, titles);
7846
+ if (titles && typeof titles === "object") {
7847
+ strings.columns = Object.assign({}, titles);
7848
+ say_groups_without_field(table.getColumns(true));
7849
+ }
7424
7850
  table.options.langs = table.options.langs || {};
7425
7851
  table.options.langs[name] = strings;
7426
7852
  let localize = table.modules && table.modules.localize;
@@ -9347,7 +9773,9 @@ function json_editor_value(content) {
9347
9773
  * Not reached, because the editor gives them no hook: its search
9348
9774
  * box, its repair messages, the tip at the foot of the context
9349
9775
  * menu, and its modals (sort, transform). They stay in its
9350
- * English.
9776
+ * English. vanilla-jsoneditor (3.13.0) has no i18n option: they
9777
+ * are literals inside its Svelte components, and the only way to
9778
+ * them would be rewriting its DOM by its English words.
9351
9779
  *
9352
9780
  * Copyright (c) 2026, ArtGins.
9353
9781
  * All Rights Reserved.
@@ -9989,11 +10417,11 @@ function cell_icon(icon_class, key) {
9989
10417
  }
9990
10418
  /************************************************************
9991
10419
  * The identity of a table element, for the kw of
9992
- * EV_ADD_TABLE_ROW: a kw is plain json, and an element (with its
9993
- * `.tabulator`, circular) broke the `machine` trace that dumps it.
9994
- * Given on first use and kept on the element; the registry holds
9995
- * it weakly, so a nested table re-built by its row formatter is
9996
- * not kept alive by it.
10420
+ * EV_ADD_TABLE_ROW and EV_LOAD_TABLE_ROWS: a kw is plain json,
10421
+ * and an element (with its `.tabulator`, circular) broke the
10422
+ * `machine` trace that dumps it. Given on first use and kept on
10423
+ * the element; the registry holds it weakly, so a nested table
10424
+ * whose row is gone is not kept alive by it.
9997
10425
  ************************************************************/
9998
10426
  function table_identity(gobj, $table) {
9999
10427
  if (!$table.yui_table_id) {
@@ -10019,6 +10447,53 @@ function find_table(gobj, table_id) {
10019
10447
  return $table;
10020
10448
  }
10021
10449
  /************************************************************
10450
+ * Destroy one third-party widget, saying why it could not be.
10451
+ ************************************************************/
10452
+ function destroy_widget(gobj, what, widget) {
10453
+ try {
10454
+ let r = widget.destroy();
10455
+ if (r && typeof r.then === "function") r.catch((e) => {
10456
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
10457
+ });
10458
+ } catch (e) {
10459
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
10460
+ }
10461
+ }
10462
+ /************************************************************
10463
+ * A table element that is gone: its identity is no table now,
10464
+ * and what was waiting to be loaded in it never will be.
10465
+ ************************************************************/
10466
+ function forget_table(gobj, $table) {
10467
+ $table.yui_pending_rows = null;
10468
+ if ($table.yui_table_id && gobj.priv && gobj.priv.tables) gobj.priv.tables.delete($table.yui_table_id);
10469
+ }
10470
+ /************************************************************
10471
+ * Destroy the nested tables a row of a table built (its row
10472
+ * formatter keeps them on the row's element), theirs first.
10473
+ * Tabulator takes the row's DOM away when the row goes -- a
10474
+ * reload, an undo, a deleted row -- and destroys nothing in it:
10475
+ * each nested table stayed in Tabulator's registry, with its
10476
+ * observers, for the life of the page.
10477
+ ************************************************************/
10478
+ function destroy_row_tables(gobj, $row) {
10479
+ let nested = $row.yui_nested || [];
10480
+ $row.yui_nested = null;
10481
+ for (let $nested of nested) {
10482
+ if ($nested.tabulator) {
10483
+ destroy_rows_tables(gobj, $nested.tabulator);
10484
+ destroy_widget(gobj, "nested table", $nested.tabulator);
10485
+ $nested.tabulator = null;
10486
+ }
10487
+ forget_table(gobj, $nested);
10488
+ }
10489
+ }
10490
+ /************************************************************
10491
+ * Destroy the nested tables of every row of a table.
10492
+ ************************************************************/
10493
+ function destroy_rows_tables(gobj, tabulator) {
10494
+ for (let row of tabulator.getRows()) destroy_row_tables(gobj, row.getElement());
10495
+ }
10496
+ /************************************************************
10022
10497
  * Destroy the third-party widgets the form built. Removing
10023
10498
  * their DOM is not enough: Tom Select keeps listeners on
10024
10499
  * `document` and `window`, the jsoneditor is a live Svelte app
@@ -10027,40 +10502,21 @@ function find_table(gobj, table_id) {
10027
10502
  * first: their parent's destroy drops the rows they hang from.
10028
10503
  ************************************************************/
10029
10504
  function destroy_widgets(gobj, $container) {
10030
- let destroy = (what, widget) => {
10031
- try {
10032
- let r = widget.destroy();
10033
- if (r && typeof r.then === "function") r.catch((e) => {
10034
- (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
10035
- });
10036
- } catch (e) {
10037
- (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
10038
- }
10039
- };
10040
- let forget = ($el) => {
10041
- if ($el.yui_table_id && gobj.priv && gobj.priv.tables) gobj.priv.tables.delete($el.yui_table_id);
10042
- };
10043
- $container.querySelectorAll(".yui-tabulator-table-nested").forEach(($el) => {
10044
- if ($el.tabulator) {
10045
- destroy("nested table", $el.tabulator);
10046
- $el.tabulator = null;
10047
- }
10048
- forget($el);
10049
- });
10050
10505
  $container.querySelectorAll(".yui-form-data-input").forEach(($el) => {
10051
10506
  if ($el.tom_select) {
10052
- destroy("select", $el.tom_select);
10507
+ destroy_widget(gobj, "select", $el.tom_select);
10053
10508
  $el.tom_select = null;
10054
10509
  }
10055
10510
  if ($el.jsoneditor) {
10056
- destroy("json editor", $el.jsoneditor);
10511
+ destroy_widget(gobj, "json editor", $el.jsoneditor);
10057
10512
  $el.jsoneditor = null;
10058
10513
  }
10059
10514
  if ($el.tabulator) {
10060
- destroy("table", $el.tabulator);
10515
+ destroy_rows_tables(gobj, $el.tabulator);
10516
+ destroy_widget(gobj, "table", $el.tabulator);
10061
10517
  $el.tabulator = null;
10518
+ forget_table(gobj, $el);
10062
10519
  }
10063
- forget($el);
10064
10520
  });
10065
10521
  }
10066
10522
  /******************************************************************
@@ -10740,8 +11196,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
10740
11196
  }
10741
11197
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
10742
11198
  table_id: table_identity(gobj, $add_table),
10743
- record: {},
10744
- loading: false
11199
+ record: {}
10745
11200
  }, gobj);
10746
11201
  } }
10747
11202
  ]]
@@ -11295,6 +11750,19 @@ function create_coordinates(gobj, attrs) {
11295
11750
  }
11296
11751
  /******************************************************************
11297
11752
  * Create tabulator
11753
+ *
11754
+ * A row builds its nested tables the first time it is drawn, each
11755
+ * loaded from the row's own data, and keeps them on its element
11756
+ * (`yui_nested`) until the row goes (destroy_row_tables). A row
11757
+ * drawn AGAIN -- a forced redraw, a column rebuilt -- has its
11758
+ * children taken off by Tabulator before its formatter runs: they
11759
+ * are put back as they are. Built anew, they came back empty, and
11760
+ * the old ones stayed alive in Tabulator's registry.
11761
+ *
11762
+ * A load that comes before the table is built waits for its
11763
+ * `tableBuilt`, ONE per table (`yui_pending_rows`): a later load
11764
+ * replaces it, a clear drops it. Each load used to hang a listener
11765
+ * of its own, so two loads before the build drew the rows twice.
11298
11766
  ******************************************************************/
11299
11767
  function create_tabulator$1(gobj, $extend, name, template) {
11300
11768
  function get_selectable_state(row) {
@@ -11314,6 +11782,13 @@ function create_tabulator$1(gobj, $extend, name, template) {
11314
11782
  let sub_elements = [];
11315
11783
  tabulator_settings.columns = template2columns(gobj, columns, template, sub_elements);
11316
11784
  if (sub_elements.length > 0) tabulator_settings.rowFormatter = function(row) {
11785
+ let $row = row.getElement();
11786
+ if ($row.yui_nested) {
11787
+ for (let $nested of $row.yui_nested) $row.appendChild($nested);
11788
+ return;
11789
+ }
11790
+ $row.yui_nested = [];
11791
+ let data = row.getData() || {};
11317
11792
  for (let sub_element of sub_elements) {
11318
11793
  let extend = ["div", {
11319
11794
  class: "yui-tabulator-table-nested pl-6 is-bordered is-striped",
@@ -11321,7 +11796,10 @@ function create_tabulator$1(gobj, $extend, name, template) {
11321
11796
  }];
11322
11797
  let $extend = (0, _yuneta_gobj_js.createElement2)(extend);
11323
11798
  $extend.tabulator = create_tabulator$1(gobj, $extend, sub_element.name, sub_element.template);
11324
- row.getElement().appendChild($extend);
11799
+ $row.appendChild($extend);
11800
+ $row.yui_nested.push($extend);
11801
+ let rows = data[sub_element.name];
11802
+ load_tabulator_data(gobj, $extend, (0, _yuneta_gobj_js.is_array)(rows) ? rows : []);
11325
11803
  }
11326
11804
  };
11327
11805
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_delete_row_btn")) columns.push({
@@ -11353,6 +11831,18 @@ function create_tabulator$1(gobj, $extend, name, template) {
11353
11831
  if (gobj.priv.loading_rows > 0) return;
11354
11832
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
11355
11833
  });
11834
+ $extend.yui_pending_rows = null;
11835
+ tabulator.on("tableBuilt", function() {
11836
+ let rows = $extend.yui_pending_rows;
11837
+ $extend.yui_pending_rows = null;
11838
+ if (rows && !(0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LOAD_TABLE_ROWS", {
11839
+ table_id: table_identity(gobj, $extend),
11840
+ rows
11841
+ }, gobj);
11842
+ });
11843
+ tabulator.on("rowDeleted", function(row) {
11844
+ destroy_row_tables(gobj, row.getElement());
11845
+ });
11356
11846
  tabulator.on("renderComplete", function() {
11357
11847
  yui_tabulator_name_row_selects(tabulator, i18next.t);
11358
11848
  });
@@ -11443,8 +11933,7 @@ function template2columns(gobj, columns, template, sub_elements) {
11443
11933
  }
11444
11934
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
11445
11935
  table_id: table_identity(gobj, $extend),
11446
- record: {},
11447
- loading: false
11936
+ record: {}
11448
11937
  }, gobj);
11449
11938
  }
11450
11939
  });
@@ -11672,6 +12161,21 @@ function getInputValue($input) {
11672
12161
  else return $input.value;
11673
12162
  }
11674
12163
  /************************************************************
12164
+ * The rows of a table as the form saves them: copies, each with
12165
+ * the rows of the nested tables its row holds. A row's
12166
+ * getData() is the row's OWN object: handed out in the save, a
12167
+ * later edit wrote into what the host had been given.
12168
+ ************************************************************/
12169
+ function table_values(tabulator) {
12170
+ let value = [];
12171
+ for (let row of tabulator.getRows()) {
12172
+ let d = (0, _yuneta_gobj_js.json_deep_copy)(row.getData());
12173
+ for (let $nested of row.getElement().yui_nested || []) if ($nested.tabulator) d[$nested.getAttribute("name")] = table_values($nested.tabulator);
12174
+ value.push(d);
12175
+ }
12176
+ return value;
12177
+ }
12178
+ /************************************************************
11675
12179
  * Function to get input value based on its type
11676
12180
  ************************************************************/
11677
12181
  function get_form_values(gobj, $form) {
@@ -11725,18 +12229,7 @@ function get_form_values(gobj, $form) {
11725
12229
  break;
11726
12230
  case "table":
11727
12231
  let template = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "template");
11728
- if (!(0, _yuneta_gobj_js.empty_string)(name) && (0, _yuneta_gobj_js.kw_has_key)(template, name)) {
11729
- value = [];
11730
- let rows = $input.tabulator.getRows();
11731
- for (let row of rows) {
11732
- let d = row.getData();
11733
- value.push(d);
11734
- row.getElement().querySelectorAll(".yui-tabulator-table-nested").forEach(($nested) => {
11735
- let name_n = $nested.getAttribute("name");
11736
- d[name_n] = $nested.tabulator.getData();
11737
- });
11738
- }
11739
- }
12232
+ if (!(0, _yuneta_gobj_js.empty_string)(name) && (0, _yuneta_gobj_js.kw_has_key)(template, name)) value = table_values($input.tabulator);
11740
12233
  break;
11741
12234
  case "coordinates":
11742
12235
  if ($input.tagName !== "INPUT") $input = $input.querySelector("input");
@@ -11753,7 +12246,10 @@ function get_form_values(gobj, $form) {
11753
12246
  return record;
11754
12247
  }
11755
12248
  /************************************************************
11756
- *
12249
+ * Empty the form. A table not built yet has no rows to clear
12250
+ * but may have a load waiting for its build: it is dropped too,
12251
+ * or the rows cleared here came back when the table was built.
12252
+ * The nested tables go with the rows that hold them.
11757
12253
  ************************************************************/
11758
12254
  function clear_data(gobj, $form) {
11759
12255
  let pkey = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "pkey");
@@ -11786,10 +12282,11 @@ function clear_data(gobj, $form) {
11786
12282
  if ($file.yui_file_render) $file.yui_file_render();
11787
12283
  });
11788
12284
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
11789
- if ($table.tabulator.initialized) $table.tabulator.clearData();
11790
- $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
11791
- if ($table_nested.tabulator.initialized) $table_nested.tabulator.clearData();
11792
- });
12285
+ $table.yui_pending_rows = null;
12286
+ if ($table.tabulator.initialized) {
12287
+ destroy_rows_tables(gobj, $table.tabulator);
12288
+ $table.tabulator.clearData();
12289
+ }
11793
12290
  });
11794
12291
  }
11795
12292
  /************************************************************
@@ -11914,27 +12411,35 @@ function set_form_values(gobj, template, $form, record) {
11914
12411
  return modified;
11915
12412
  }
11916
12413
  /************************************************************
11917
- * loading data from backend to tabulator,
11918
- * check if the table is built
12414
+ * Load the rows of a record in a table: all of them at once
12415
+ * (EV_LOAD_TABLE_ROWS), now if the table is built, else when it
12416
+ * is (create_tabulator's `tableBuilt`).
11919
12417
  ************************************************************/
11920
12418
  function load_tabulator_data(gobj, $table, value) {
11921
- if (!value) {
12419
+ if (!(0, _yuneta_gobj_js.is_array)(value)) {
11922
12420
  (0, _yuneta_gobj_js.log_error)((0, _yuneta_gobj_js.sprintf)("%s: no data to load_tabulator_data()", (0, _yuneta_gobj_js.gobj_short_name)(gobj)));
11923
12421
  return;
11924
12422
  }
11925
- let tabulator = $table.tabulator;
11926
- if (tabulator.initialized) for (let row of value) (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
12423
+ if (!$table.tabulator.initialized) {
12424
+ $table.yui_pending_rows = value.length > 0 ? value : null;
12425
+ return;
12426
+ }
12427
+ $table.yui_pending_rows = null;
12428
+ if (value.length === 0) return;
12429
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_LOAD_TABLE_ROWS", {
11927
12430
  table_id: table_identity(gobj, $table),
11928
- record: row,
11929
- loading: true
12431
+ rows: value
11930
12432
  }, gobj);
11931
- else tabulator.on("tableBuilt", function() {
11932
- for (let row of value) (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
11933
- table_id: table_identity(gobj, $table),
11934
- record: row,
11935
- loading: true
11936
- }, gobj);
11937
- });
12433
+ }
12434
+ /************************************************************
12435
+ * Redraw a table once what was added to it is drawn: the
12436
+ * "double scrollbar" Tabulator leaves when its rows grow.
12437
+ ************************************************************/
12438
+ function redraw_table_later(gobj, $table) {
12439
+ setTimeout(function() {
12440
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
12441
+ if ($table && $table.tabulator) $table.tabulator.redraw();
12442
+ }, 30);
11938
12443
  }
11939
12444
  /************************************************************
11940
12445
  * Convert a record column value from backend
@@ -12242,8 +12747,16 @@ function ac_set_file_preview(gobj, event, kw, src) {
12242
12747
  return 0;
12243
12748
  }
12244
12749
  /************************************************************
12245
- * From internal form button for new rows
12246
- * or from load_tabulator_data() to load data from backend
12750
+ * From the add button of a table, outer or nested: the
12751
+ * reader's new row. A change of the reader's (`dataChanged`).
12752
+ * Tabulator keeps the object it is given and writes the
12753
+ * reader's edits into it: it is given a copy. A row added to a
12754
+ * nested table makes the row it lives in grow: the outer table
12755
+ * is the one redrawn.
12756
+ * {
12757
+ * table_id: the table (table_identity())
12758
+ * record: the new row, {} from the button
12759
+ * }
12247
12760
  ************************************************************/
12248
12761
  function ac_add_table_row(gobj, event, kw, src) {
12249
12762
  let table_id = kw.table_id;
@@ -12253,34 +12766,59 @@ function ac_add_table_row(gobj, event, kw, src) {
12253
12766
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_ADD_TABLE_ROW to a table that is gone: '${table_id}'`);
12254
12767
  return -1;
12255
12768
  }
12256
- let record = kw.record;
12257
- let loading = kw.loading;
12769
+ tabulator.addRow((0, _yuneta_gobj_js.json_deep_copy)((0, _yuneta_gobj_js.is_object)(kw.record) ? kw.record : {})).catch(function(error) {
12770
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot add a table row: ${error}`);
12771
+ });
12772
+ redraw_table_later(gobj, $table.closest(".yui-tabulator-table"));
12773
+ return 0;
12774
+ }
12775
+ /************************************************************
12776
+ * From load_tabulator_data(): the rows of the record a table
12777
+ * shows, all of them in ONE call and one redraw. A row at a time
12778
+ * redrew every row of the table after each one: 300 rows took
12779
+ * 20 s, 300 with a nested table each 39 s.
12780
+ *
12781
+ * Tabulator keeps the objects it is given (Row.setData() copies
12782
+ * nothing) and a cell edit writes into them: handed the
12783
+ * `record`'s own, an edit wrote into the record, and Undo --
12784
+ * which loads the record again -- loaded the edit. It is given
12785
+ * a copy.
12786
+ *
12787
+ * And it says `dataChanged` INSIDE addData(), synchronously,
12788
+ * once per row: rows the FORM loads are muted there, whenever
12789
+ * they land -- also from a `tableBuilt` that comes after the
12790
+ * load returned, which is why no timer can tell them from the
12791
+ * reader's.
12792
+ * {
12793
+ * table_id: the table (table_identity())
12794
+ * rows: [record, ...]
12795
+ * }
12796
+ ************************************************************/
12797
+ function ac_load_table_rows(gobj, event, kw, src) {
12798
+ let table_id = kw.table_id;
12799
+ let $table = find_table(gobj, table_id);
12800
+ let tabulator = $table ? $table.tabulator : null;
12801
+ if (!tabulator) {
12802
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_LOAD_TABLE_ROWS to a table that is gone: '${table_id}'`);
12803
+ return -1;
12804
+ }
12805
+ if (!(0, _yuneta_gobj_js.is_array)(kw.rows)) {
12806
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_LOAD_TABLE_ROWS without rows: '${table_id}'`);
12807
+ return -1;
12808
+ }
12809
+ if (kw.rows.length === 0) return 0;
12810
+ let rows = (0, _yuneta_gobj_js.json_deep_copy)(kw.rows);
12258
12811
  let added;
12259
- if (loading) gobj.priv.loading_rows++;
12812
+ gobj.priv.loading_rows++;
12260
12813
  try {
12261
- added = tabulator.addRow(record);
12814
+ added = tabulator.addData(rows);
12262
12815
  } finally {
12263
- if (loading) gobj.priv.loading_rows--;
12264
- }
12265
- added.then(function(row) {
12266
- if (loading) {
12267
- let template = $table.template;
12268
- Object.entries(template).forEach(([key, template_value]) => {
12269
- if ((0, _yuneta_gobj_js.str_in_list)(template_value.flag, "table")) {
12270
- let $table_nested = row.getElement().querySelector(`.yui-tabulator-table-nested[name="${key}"]`);
12271
- if ($table_nested) load_tabulator_data(gobj, $table_nested, record[key]);
12272
- else (0, _yuneta_gobj_js.log_error)((0, _yuneta_gobj_js.sprintf)("%s: nested table not found '%s'", (0, _yuneta_gobj_js.gobj_short_name)(gobj), key));
12273
- }
12274
- });
12275
- }
12276
- }).catch(function(error) {
12277
- (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot add a table row: ${error}`);
12816
+ gobj.priv.loading_rows--;
12817
+ }
12818
+ added.catch(function(error) {
12819
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot load the rows of a table: ${error}`);
12278
12820
  });
12279
- setTimeout(function() {
12280
- if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
12281
- let $target = loading ? $table : $table.closest(".yui-tabulator-table");
12282
- if ($target && $target.tabulator) $target.tabulator.redraw();
12283
- }, 30);
12821
+ redraw_table_later(gobj, $table);
12284
12822
  return 0;
12285
12823
  }
12286
12824
  /************************************************************
@@ -12470,6 +13008,11 @@ function create_gclass$17(gclass_name) {
12470
13008
  ac_add_table_row,
12471
13009
  null
12472
13010
  ],
13011
+ [
13012
+ "EV_LOAD_TABLE_ROWS",
13013
+ ac_load_table_rows,
13014
+ null
13015
+ ],
12473
13016
  [
12474
13017
  "EV_RECORD_CHANGED",
12475
13018
  ac_record_changed,
@@ -12542,6 +13085,7 @@ function create_gclass$17(gclass_name) {
12542
13085
  ["EV_UNDO_RECORD", 0],
12543
13086
  ["EV_CLEAR_RECORD", 0],
12544
13087
  ["EV_ADD_TABLE_ROW", 0],
13088
+ ["EV_LOAD_TABLE_ROWS", 0],
12545
13089
  ["EV_RECORD_CHANGED", 0],
12546
13090
  ["EV_COPY_RECORD", 0],
12547
13091
  ["EV_PASTE_RECORD", 0],
@@ -76845,6 +77389,7 @@ var PRIVATE_DATA$1 = {
76845
77389
  host_ids: null,
76846
77390
  order_undo: null,
76847
77391
  diagram_gobj: null,
77392
+ retired_diagrams: null,
76848
77393
  dialog: null,
76849
77394
  dialog_gen: 0,
76850
77395
  dialog_kind: "",
@@ -76881,6 +77426,7 @@ function mt_create$1(gobj) {
76881
77426
  priv.host_drafts = {};
76882
77427
  priv.host_ids = {};
76883
77428
  priv.save_queue = [];
77429
+ priv.retired_diagrams = [];
76884
77430
  build_ui$1(gobj);
76885
77431
  let subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
76886
77432
  if (!subscriber) subscriber = (0, _yuneta_gobj_js.gobj_parent)(gobj);
@@ -76902,6 +77448,7 @@ function mt_stop$1(gobj) {
76902
77448
  if (shell) (0, _yuneta_gobj_js.gobj_unsubscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
76903
77449
  close_dialog(gobj);
76904
77450
  destroy_diagram(gobj);
77451
+ destroy_retired_diagrams(gobj);
76905
77452
  }
76906
77453
  /***************************************************************
76907
77454
  * Framework Method: Destroy
@@ -78417,12 +78964,29 @@ function render_diagram(gobj) {
78417
78964
  (0, _yuneta_gobj_js.gobj_start)(diagram);
78418
78965
  (0, _yuneta_gobj_js.gobj_send_event)(diagram, "EV_SHOW", {}, gobj);
78419
78966
  }
78967
+ /***************************************************************
78968
+ * The drawing leaves the screen at once and is destroyed on the
78969
+ * next turn (EV_DESTROY_DIAGRAMS). It can be leaving because of
78970
+ * its own node click, which it publishes from inside G6's dispatch
78971
+ * of that click: stopped there, the gobj went from under its own
78972
+ * publication and the G6 graph from under its own event.
78973
+ ***************************************************************/
78420
78974
  function destroy_diagram(gobj) {
78421
78975
  let priv = gobj.priv;
78422
78976
  if (!priv.diagram_gobj) return;
78423
- (0, _yuneta_gobj_js.gobj_stop)(priv.diagram_gobj);
78424
- (0, _yuneta_gobj_js.gobj_destroy)(priv.diagram_gobj);
78977
+ let diagram = priv.diagram_gobj;
78425
78978
  priv.diagram_gobj = null;
78979
+ let $d = (0, _yuneta_gobj_js.gobj_read_attr)(diagram, "$container");
78980
+ if ($d && $d.parentNode) $d.parentNode.removeChild($d);
78981
+ priv.retired_diagrams.push(diagram);
78982
+ if (priv.retired_diagrams.length === 1) (0, _yuneta_gobj_js.gobj_post_event)(gobj, "EV_DESTROY_DIAGRAMS", {}, gobj);
78983
+ }
78984
+ function destroy_retired_diagrams(gobj) {
78985
+ let priv = gobj.priv;
78986
+ for (let diagram of priv.retired_diagrams.splice(0)) {
78987
+ if ((0, _yuneta_gobj_js.gobj_is_running)(diagram)) (0, _yuneta_gobj_js.gobj_stop)(diagram);
78988
+ (0, _yuneta_gobj_js.gobj_destroy)(diagram);
78989
+ }
78426
78990
  }
78427
78991
  /***************************
78428
78992
  * The forms
@@ -80411,6 +80975,13 @@ function ac_node_click(gobj, event, kw, src) {
80411
80975
  go(gobj, gobj.priv.treedb_id, topic, false, true);
80412
80976
  return reload_after_move(gobj);
80413
80977
  }
80978
+ /***************************************************************
80979
+ * The drawings left on the previous turn (destroy_diagram()).
80980
+ ***************************************************************/
80981
+ function ac_destroy_diagrams(gobj, event, kw, src) {
80982
+ destroy_retired_diagrams(gobj);
80983
+ return 0;
80984
+ }
80414
80985
  function ac_show_orphans(gobj, event, kw, src) {
80415
80986
  if (reload_first(gobj, event)) return -1;
80416
80987
  open_orphans(gobj);
@@ -81055,6 +81626,11 @@ function create_gclass$1(gclass_name) {
81055
81626
  "EV_EXPORT_VIEW",
81056
81627
  ac_export_view,
81057
81628
  null
81629
+ ],
81630
+ [
81631
+ "EV_DESTROY_DIAGRAMS",
81632
+ ac_destroy_diagrams,
81633
+ null
81058
81634
  ]
81059
81635
  ];
81060
81636
  const TREEDB_WIDE = [
@@ -81272,6 +81848,7 @@ function create_gclass$1(gclass_name) {
81272
81848
  ["EV_APPLY_IMPORT", 0],
81273
81849
  ["EV_CONFIRMED", 0],
81274
81850
  ["EV_NODE_CLICK", 0],
81851
+ ["EV_DESTROY_DIAGRAMS", 0],
81275
81852
  ["EV_POSITION_CHANGED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
81276
81853
  ["EV_RECORD_WRITTEN", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
81277
81854
  ["EV_SCHEMA_CHECKED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS]