@yuneta/gobj-ui 7.26.26 → 7.26.28

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 (44) hide show
  1. package/README.md +473 -19
  2. package/dist/gobj-ui.cjs.js +1100 -231
  3. package/dist/gobj-ui.es.js +1101 -232
  4. package/package.json +1 -1
  5. package/scripts/validate-locales.mjs +2334 -275
  6. package/src/c_g6_nodes_tree.js +1143 -260
  7. package/src/c_yui_form.js +11 -1
  8. package/src/c_yui_fsm_graph.js +5 -0
  9. package/src/c_yui_gclass.js +11 -0
  10. package/src/c_yui_gobj_tree_js.js +17 -0
  11. package/src/c_yui_json_graph.js +5 -0
  12. package/src/c_yui_nav.js +9 -6
  13. package/src/c_yui_pager.js +1 -1
  14. package/src/c_yui_period.js +11 -4
  15. package/src/c_yui_schema_editor.js +19 -7
  16. package/src/c_yui_shell.js +7 -7
  17. package/src/c_yui_treedb_graph.js +15 -6
  18. package/src/c_yui_treedb_schema.js +5 -0
  19. package/src/c_yui_treedb_topic_with_form.js +10 -10
  20. package/src/c_yui_treedb_topics.js +6 -6
  21. package/src/c_yui_window.js +2 -2
  22. package/src/c_yui_wizard.js +8 -1
  23. package/src/form_json_field.js +7 -0
  24. package/src/g6_canvas_tab_order.js +84 -0
  25. package/src/g6_canvas_tab_order.wiring.test.js +232 -0
  26. package/src/g6_nodes_tree_controls.test.js +547 -0
  27. package/src/g6_nodes_tree_focus.wiring.test.js +1360 -0
  28. package/src/g6_nodes_tree_i18n_keys.test.js +275 -0
  29. package/src/i18n_key_functions.js +146 -0
  30. package/src/i18n_key_functions.test.js +1204 -0
  31. package/src/lib_graph.js +38 -1
  32. package/src/nav_backbar_name.wiring.test.js +82 -0
  33. package/src/schema_flags.js +47 -0
  34. package/src/schema_import.js +7 -0
  35. package/src/shell_modals.js +20 -16
  36. package/src/shell_route_map.js +12 -2
  37. package/src/wizard_helpers.js +8 -0
  38. package/src/yui_dev.js +44 -33
  39. package/src/yui_dev_controls.test.js +174 -0
  40. package/src/yui_gclass_view.js +2 -2
  41. package/src/yui_graph_camera.js +1 -1
  42. package/src/yui_install.js +10 -8
  43. package/src/yui_table_select.js +2 -2
  44. package/src/yui_time.js +18 -3
@@ -326,7 +326,7 @@ export function yui_graph_update_anchor($container, state)
326
326
  $btn.classList.toggle('color_pending_state', state === "arming");
327
327
  $btn.setAttribute("aria-pressed", (state === "on")? "true": "false");
328
328
 
329
- let key = (state === "arming")? "click the element to centre on"
329
+ const key = (state === "arming")? "click the element to centre on"
330
330
  : (state === "on")? "centred: click to release"
331
331
  : "anchor view";
332
332
  $btn.setAttribute("title", t(key));
@@ -197,13 +197,15 @@ function yui_install_start_watch()
197
197
  /* The question and its answers when the app names none. They are i18n
198
198
  * KEYS, lower-case, and the ones every consumer already defines; the
199
199
  * question was "Install this app?" until 7.25.16, a key no locale
200
- * carries. Written as `i18n:` entries so the validate-locales script of
201
- * a consumer finds them when it scans this module. */
200
+ * carries. A consumer's validate-locales reads them where the dialog
201
+ * gets them (`DEFAULT_ASK.message`, a const it follows), and in
202
+ * YUI_INSTALL_I18N_KEYS, which a test holds to this table. */
202
203
  const DEFAULT_ASK = Object.freeze({
203
- message: Object.freeze({i18n: "install this app"}),
204
- yes: Object.freeze({i18n: "install"}),
205
- no: Object.freeze({i18n: "not now"})
204
+ message: "install this app",
205
+ yes: "install",
206
+ no: "not now"
206
207
  });
208
+ export const YUI_INSTALL_I18N_KEYS = ["install this app", "install", "not now"];
207
209
 
208
210
  function yui_install_ask_once(shell, opts)
209
211
  {
@@ -224,10 +226,10 @@ function yui_install_ask_once(shell, opts)
224
226
  S.asking = true;
225
227
  kw_set_local_storage_value(ASKED_KEY, true);
226
228
 
227
- yui_shell_confirm_yesno(shell, opts.message || DEFAULT_ASK.message.i18n, {
229
+ yui_shell_confirm_yesno(shell, opts.message || DEFAULT_ASK.message, {
228
230
  t: opts.t,
229
- yes_label: opts.yes_label || DEFAULT_ASK.yes.i18n,
230
- no_label: opts.no_label || DEFAULT_ASK.no.i18n
231
+ yes_label: opts.yes_label || DEFAULT_ASK.yes,
232
+ no_label: opts.no_label || DEFAULT_ASK.no
231
233
  }).then(function(yes) {
232
234
  S.asking = false;
233
235
  if(yes) {
@@ -234,7 +234,6 @@ function yui_selection_bar(t, opts)
234
234
  }
235
235
  }]
236
236
  );
237
- $clear._yui_label = "clear selection";
238
237
 
239
238
  /* NOT `is-flex` in the class list: Bulma's helpers all carry
240
239
  * `!important`, so `is-flex` and `is-hidden` would fight as equals and
@@ -260,7 +259,8 @@ function yui_selection_bar(t, opts)
260
259
  $count.textContent = t("{{n}} selected", {n: count});
261
260
  for(let $b of $buttons.concat([$clear])) {
262
261
  let $label = label_of($b);
263
- let key = $b._yui_label;
262
+ /* A literal, where validate-locales reads it; an action's key is the HOST's */
263
+ const key = ($b === $clear)? "clear selection" : $b._yui_label;
264
264
  if($label && key) {
265
265
  $label.textContent = t(key);
266
266
  }
package/src/yui_time.js CHANGED
@@ -90,6 +90,21 @@ const YUI_ROLLING = {
90
90
  "30d": {id: "30d", secs: 30 * 24 * 3600, label: "last 30 days"}
91
91
  };
92
92
 
93
+ /* The keys that reach t() as data, where no scan of the source reads
94
+ * them: the id of every granularity of YUI_PERIODS (period_name), the
95
+ * label of every window of YUI_ROLLING (C_YUI_PERIOD), and the bucket
96
+ * labels period_label() picks by variable. Published for a consumer's
97
+ * validate-locales, which asks the app's locales for every key of an
98
+ * exported `*_I18N_KEYS` array -- the whole catalog, because which of
99
+ * it a period control offers is the HOST's data. A period or a window
100
+ * added to the catalog adds its key here (a test checks it). */
101
+ export const YUI_TIME_I18N_KEYS = [
102
+ "minute", "5min", "15min", "hour", "day", "week", "fortnight",
103
+ "month", "bimester", "quarter", "semester", "year", "decade",
104
+ "last hour", "last 6h", "last 24h", "last 7 days", "last 30 days",
105
+ "quarter {{n}} {{y}}", "semester {{n}} {{y}}"
106
+ ];
107
+
93
108
 
94
109
  /***************************
95
110
  * Locale / i18n
@@ -529,9 +544,9 @@ function period_name(period, t)
529
544
  {
530
545
  let spec = period_spec(period);
531
546
  if(!spec) {
532
- return tr(t, String((period && period.id) || period || ""));
547
+ return tr(t, /* i18n: data */ String((period && period.id) || period || ""));
533
548
  }
534
- return tr(t, spec.id);
549
+ return tr(t, /* i18n: YUI_TIME_I18N_KEYS */ spec.id);
535
550
  }
536
551
 
537
552
  /***************************************************************
@@ -610,7 +625,7 @@ function period_label(period, anchor_ms, t, locale)
610
625
 
611
626
  if(spec.unit === "month" && (spec.count === 3 || spec.count === 6)) {
612
627
  let n = Math.floor(start.getMonth() / spec.count) + 1;
613
- let key = (spec.count === 3) ? "quarter {{n}} {{y}}" : "semester {{n}} {{y}}";
628
+ const key = (spec.count === 3) ? "quarter {{n}} {{y}}" : "semester {{n}} {{y}}";
614
629
  return tr(t, key, {n: n, y: start.getFullYear()});
615
630
  }
616
631