@yuneta/gobj-ui 7.26.51 → 7.26.53

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.
@@ -6852,7 +6852,7 @@ function ac_shell_changed(gobj, event, kw, src) {
6852
6852
  * language the window was opened in (a reader took the
6853
6853
  * aria-labelledby, which changed; the tooltip did not).
6854
6854
  ************************************************************/
6855
- function ac_language_changed$11(gobj, event, kw, src) {
6855
+ function ac_language_changed$12(gobj, event, kw, src) {
6856
6856
  let priv = gobj.priv;
6857
6857
  for (let entry of priv.windows) {
6858
6858
  if (!entry.title_prefix || !entry.$chip) continue;
@@ -6923,7 +6923,7 @@ function create_gclass$20(gclass_name) {
6923
6923
  ],
6924
6924
  [
6925
6925
  "EV_LANGUAGE_CHANGED",
6926
- ac_language_changed$11,
6926
+ ac_language_changed$12,
6927
6927
  null
6928
6928
  ]
6929
6929
  ]]], gmt$20, 0, attrs_table$20, PRIVATE_DATA$20, 0, 0, 0, 0);
@@ -9676,6 +9676,71 @@ function yui_icons_list() {
9676
9676
  });
9677
9677
  return list;
9678
9678
  }
9679
+ //#endregion
9680
+ //#region src/yui_date_text.js
9681
+ /***********************************************************************
9682
+ * yui_date_text.js
9683
+ *
9684
+ * A moment as a VIEW shows it as text, and the locale to show it
9685
+ * in. A module of its own, with no i18n key, on purpose: the views
9686
+ * that show a time (C_YUI_FORM, C_YUI_TREEDB_TOPIC_WITH_FORM,
9687
+ * C_YUI_JSON, C_YUI_UPLOT) import it, and validate-locales follows
9688
+ * the modules an app mounts -- importing yui_time.js for this made
9689
+ * every app that shows a time owe the keys of the period picker
9690
+ * (gobj-ui 7.26.52). yui_time.js re-exports both.
9691
+ *
9692
+ * Copyright (c) 2026, ArtGins.
9693
+ * All Rights Reserved.
9694
+ ***********************************************************************/
9695
+ /***************************************************************
9696
+ * The locale to format with.
9697
+ *
9698
+ * NEVER at module top level, and never `navigator.language` raw:
9699
+ * Firefox can report the literal STRING "undefined", and every Intl
9700
+ * constructor throws RangeError on it — a module that built its
9701
+ * formatter on import took the whole bundle down with it (that is why
9702
+ * gui_agent refuses to import the gobj-ui barrel).
9703
+ ***************************************************************/
9704
+ function safe_locale(locale) {
9705
+ if (typeof locale === "string" && locale && locale !== "undefined") return locale;
9706
+ let nav = typeof navigator !== "undefined" ? navigator.language : null;
9707
+ if (typeof nav === "string" && nav && nav !== "undefined") return nav;
9708
+ return "en";
9709
+ }
9710
+ var DATE_TIME_OPTIONS = {
9711
+ day: "numeric",
9712
+ month: "short",
9713
+ year: "numeric",
9714
+ hour: "2-digit",
9715
+ minute: "2-digit",
9716
+ second: "2-digit",
9717
+ hourCycle: "h23"
9718
+ };
9719
+ /***************************************************************
9720
+ * A moment as a VIEW shows it as text: the day, the month and the
9721
+ * year, then the clock of 24 hours with its seconds, in the APP's
9722
+ * language -- `locale` is the language t() answers in (the views
9723
+ * pass `i18next.language`), never the browser's:
9724
+ *
9725
+ * fmt_date_time(d, "es") -> "14 oct 2026, 15:05:09"
9726
+ * fmt_date_time(d, "en") -> "Oct 14, 2026, 15:05:09"
9727
+ *
9728
+ * "" for anything that is not a valid Date. A locale Intl refuses
9729
+ * gives the language-free "2026-10-14 15:05:09".
9730
+ *
9731
+ * The time cells of C_YUI_FORM and C_YUI_TREEDB_TOPIC_WITH_FORM and
9732
+ * the reading C_YUI_JSON writes beside a time field all come from
9733
+ * here, so the same moment reads the same in the three.
9734
+ ***************************************************************/
9735
+ function fmt_date_time(date, locale) {
9736
+ if (!(date instanceof Date) || isNaN(date.getTime())) return "";
9737
+ try {
9738
+ return new Intl.DateTimeFormat(safe_locale(locale), DATE_TIME_OPTIONS).format(date);
9739
+ } catch (e) {
9740
+ let pad = (n) => String(n).padStart(2, "0");
9741
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
9742
+ }
9743
+ }
9679
9744
  /************************************************************
9680
9745
  * JSON type discriminator (viewer vocabulary)
9681
9746
  ************************************************************/
@@ -9827,16 +9892,20 @@ function is_time_field(field) {
9827
9892
  return TIME_FIELDS.indexOf(field) >= 0;
9828
9893
  }
9829
9894
  /************************************************************
9830
- * Format an epoch value as a local wall-clock string.
9895
+ * Format an epoch value as a local wall-clock string, 24
9896
+ * hours, in the APP's language `locale` (fmt_date_time() of
9897
+ * yui_time.js, as the time cells of the forms and tables;
9898
+ * up to gobj-ui 7.26.51 it was toLocaleString(): the
9899
+ * browser's language, and 12 hours in English).
9831
9900
  * Accepts seconds or milliseconds; returns null when the
9832
9901
  * value is not a usable positive timestamp (0 == "unset").
9833
9902
  ************************************************************/
9834
- function format_epoch(value) {
9903
+ function format_epoch(value, locale) {
9835
9904
  if (typeof value !== "number" || !isFinite(value) || value <= 0) return null;
9836
9905
  let ms = Math.abs(value) < 0xe8d4a51000 ? value * 1e3 : value;
9837
9906
  let d = new Date(ms);
9838
9907
  if (isNaN(d.getTime())) return null;
9839
- return d.toLocaleString();
9908
+ return fmt_date_time(d, locale);
9840
9909
  }
9841
9910
  /************************************************************
9842
9911
  * The text view's payload: the document as text, indented
@@ -10104,15 +10173,17 @@ function epoch_to_time_value(epoch, real_type) {
10104
10173
  }
10105
10174
  /************************************************************
10106
10175
  * The value of a time column as a table cell shows it: the
10107
- * local clock the editor opens on, "YYYY-MM-DD HH:mm:ss", as
10108
- * fmt_epoch() of yui_time.js writes a timestamp in a table. ""
10109
- * for no time; a value that is not one is shown as it is, so the
10110
- * reader sees what the column holds.
10111
- ************************************************************/
10112
- function time_value_to_text(value, real_type) {
10176
+ * local clock, 24 hours, in the APP's language `locale`
10177
+ * (fmt_date_time() of yui_time.js: es "14 oct 2026, 15:05:09").
10178
+ * Up to gobj-ui 7.26.51 the form wrote "2026-10-14 15:05:09" and
10179
+ * the treedb table "14 oct 2026, 03:05:09 p. m.", in the
10180
+ * browser's language. "" for no time; a value that is not one is
10181
+ * shown as it is, so the reader sees what the column holds.
10182
+ ************************************************************/
10183
+ function time_value_to_text(value, real_type, locale) {
10113
10184
  let date = time_value_to_date(value, real_type);
10114
10185
  if (!date) return value === null || value === void 0 ? "" : String(value);
10115
- return date_to_datetime_local(date).replace("T", " ");
10186
+ return fmt_date_time(date, locale);
10116
10187
  }
10117
10188
  //#endregion
10118
10189
  //#region src/form_time_cell_editor.js
@@ -12617,6 +12688,36 @@ function table_column_titles(template) {
12617
12688
  });
12618
12689
  return titles;
12619
12690
  }
12691
+ var TIME_CELL_FORMATTERS = /* @__PURE__ */ new WeakSet();
12692
+ /******************************************************************
12693
+ * The formatter of a time cell: the local clock, 24 hours, in the
12694
+ * APP's language (fmt_date_time of yui_time.js, as the cells of
12695
+ * C_YUI_TREEDB_TOPIC_WITH_FORM): es "14 oct 2026, 15:05:09".
12696
+ ******************************************************************/
12697
+ function time_cell_formatter(real_type) {
12698
+ let formatter = function(cell) {
12699
+ return text_node(time_value_to_text(cell.getValue(), real_type, safe_locale(i18next.language)));
12700
+ };
12701
+ TIME_CELL_FORMATTERS.add(formatter);
12702
+ return formatter;
12703
+ }
12704
+ /******************************************************************
12705
+ * Draw the time cells of a table again, in the current language.
12706
+ * Cell by cell, never a redraw of the rows: a row's formatter
12707
+ * builds its nested tables anew -- empty. A cell being edited is
12708
+ * its editor's; Tabulator formats it again when the editor closes.
12709
+ ******************************************************************/
12710
+ function reformat_time_cells(tabulator) {
12711
+ for (let column of tabulator.getColumns()) {
12712
+ let formatter = column.getDefinition().formatter;
12713
+ if (!TIME_CELL_FORMATTERS.has(formatter)) continue;
12714
+ for (let cell of column.getCells()) {
12715
+ let $cell = cell.getElement();
12716
+ if ($cell.classList.contains("tabulator-editing")) continue;
12717
+ $cell.replaceChildren(formatter(cell));
12718
+ }
12719
+ }
12720
+ }
12620
12721
  /******************************************************************
12621
12722
  * Convert a template's items in tabulator columns
12622
12723
  ******************************************************************/
@@ -12729,9 +12830,7 @@ function template2columns(gobj, columns, template, sub_elements) {
12729
12830
  case "time":
12730
12831
  column.editor = form_time_cell_editor(field_desc.real_type);
12731
12832
  column.editorParams = { verticalNavigation: "table" };
12732
- column.formatter = function(cell) {
12733
- return text_node(time_value_to_text(cell.getValue(), field_desc.real_type));
12734
- };
12833
+ column.formatter = time_cell_formatter(field_desc.real_type);
12735
12834
  break;
12736
12835
  case "color":
12737
12836
  column.editor = "input";
@@ -13712,7 +13811,7 @@ function ac_name_json_editors(gobj, event, kw, src) {
13712
13811
  * in the old language until it draws it again, so each is told to
13713
13812
  * (a new onRenderMenu), and the render names it again.
13714
13813
  ************************************************************/
13715
- function ac_language_changed$10(gobj, event, kw, src) {
13814
+ function ac_language_changed$11(gobj, event, kw, src) {
13716
13815
  let $container = gobj_read_attr(gobj, "$container");
13717
13816
  if (!$container) return 0;
13718
13817
  for (let $editor of $container.querySelectorAll(".jsoneditor")) {
@@ -13721,7 +13820,10 @@ function ac_language_changed$10(gobj, event, kw, src) {
13721
13820
  }
13722
13821
  for (let $table of $container.querySelectorAll(".yui-tabulator-table, .yui-tabulator-table-nested")) {
13723
13822
  let tabulator = $table.tabulator;
13724
- if (tabulator && tabulator.initialized && $table.template) yui_tabulator_relocalize(tabulator, t, table_column_titles($table.template));
13823
+ if (tabulator && tabulator.initialized && $table.template) {
13824
+ yui_tabulator_relocalize(tabulator, t, table_column_titles($table.template));
13825
+ reformat_time_cells(tabulator);
13826
+ }
13725
13827
  }
13726
13828
  return 0;
13727
13829
  }
@@ -13898,7 +14000,7 @@ function create_gclass$17(gclass_name) {
13898
14000
  ],
13899
14001
  [
13900
14002
  "EV_LANGUAGE_CHANGED",
13901
- ac_language_changed$10,
14003
+ ac_language_changed$11,
13902
14004
  null
13903
14005
  ]
13904
14006
  ]]];
@@ -14294,7 +14396,7 @@ function mt_create$16(gobj) {
14294
14396
  * rewritten in place, and the map's locale with them so a
14295
14397
  * control or a popup built later is right too.
14296
14398
  ***************************************************************/
14297
- function ac_language_changed$9(gobj, event, kw, src) {
14399
+ function ac_language_changed$10(gobj, event, kw, src) {
14298
14400
  let priv = gobj.priv;
14299
14401
  if (priv.xmap) yui_maplibre_relocalize(priv.xmap, t);
14300
14402
  return 0;
@@ -14862,7 +14964,7 @@ function create_gclass$16(gclass_name) {
14862
14964
  ], [["ST_IDLE", [
14863
14965
  [
14864
14966
  "EV_LANGUAGE_CHANGED",
14865
- ac_language_changed$9,
14967
+ ac_language_changed$10,
14866
14968
  null
14867
14969
  ],
14868
14970
  [
@@ -15011,12 +15113,145 @@ function yui_uplot_axes(axes) {
15011
15113
  });
15012
15114
  }
15013
15115
  //#endregion
15116
+ //#region src/yui_uplot_time.js
15117
+ /***********************************************************************
15118
+ * yui_uplot_time.js
15119
+ *
15120
+ * The texts uPlot writes for a moment -- the ticks of a time axis
15121
+ * and the reading of the legend -- in the APP's language, with a
15122
+ * clock of 24 hours, as every other time a gobj-ui view shows
15123
+ * (fmt_date_time of yui_time.js).
15124
+ *
15125
+ * uPlot writes them from templates of its own, in English and
15126
+ * 12 hours: "3pm", "3:05pm", "10/14" (month first), "Oct", and
15127
+ * "2026-10-14 3:05pm" in the legend. Its `fmtDate` option takes
15128
+ * the template and returns the function that writes a Date with
15129
+ * it; this one is given to it:
15130
+ *
15131
+ * legend "{YYYY}-{MM}-{DD} {h}:{mm}{aa}" -> fmt_date_time()
15132
+ * "14 oct 2026, 15:05:09"
15133
+ * "{h}{aa}" "3pm" -> "15:00"
15134
+ * "{h}:{mm}{aa}" "3:05pm" -> "15:05"
15135
+ * "{M}/{D}" "10/14" -> es "14/10", en "10/14"
15136
+ * "{M}/{D}/{YY}" "10/14/26"-> es "14/10/26", en "10/14/26"
15137
+ * "{MMM}" "Oct" -> es "oct", en "Oct"
15138
+ *
15139
+ * The language is asked for on every call, so a redraw after a
15140
+ * language change writes the new one (C_YUI_UPLOT redraws its
15141
+ * axes on EV_LANGUAGE_CHANGED).
15142
+ *
15143
+ * Copyright (c) 2026, ArtGins.
15144
+ * All Rights Reserved.
15145
+ ***********************************************************************/
15146
+ var LEGEND_STAMP = "{YYYY}-{MM}-{DD} {h}:{mm}{aa}";
15147
+ var pad2 = (n) => String(n).padStart(2, "0");
15148
+ var __formatters__ = /* @__PURE__ */ new Map();
15149
+ function intl(locale, opts) {
15150
+ let key = locale + "|" + JSON.stringify(opts);
15151
+ let f = __formatters__.get(key);
15152
+ if (!f) {
15153
+ try {
15154
+ f = new Intl.DateTimeFormat(locale, opts);
15155
+ } catch (e) {
15156
+ f = new Intl.DateTimeFormat("en", opts);
15157
+ }
15158
+ __formatters__.set(key, f);
15159
+ }
15160
+ return f;
15161
+ }
15162
+ var WHOLE = [
15163
+ ["{M}/{D}/{YY}", (d, loc) => intl(loc, {
15164
+ day: "numeric",
15165
+ month: "numeric",
15166
+ year: "2-digit"
15167
+ }).format(d)],
15168
+ ["{M}/{D}", (d, loc) => intl(loc, {
15169
+ day: "numeric",
15170
+ month: "numeric"
15171
+ }).format(d)],
15172
+ ["{h}{aa}", (d) => `${pad2(d.getHours())}:00`]
15173
+ ];
15174
+ var TOKENS = {
15175
+ YYYY: (d) => String(d.getFullYear()),
15176
+ YY: (d) => String(d.getFullYear()).slice(2),
15177
+ MMMM: (d, loc) => intl(loc, { month: "long" }).format(d),
15178
+ MMM: (d, loc) => intl(loc, { month: "short" }).format(d),
15179
+ MM: (d) => pad2(d.getMonth() + 1),
15180
+ M: (d) => String(d.getMonth() + 1),
15181
+ DD: (d) => pad2(d.getDate()),
15182
+ D: (d) => String(d.getDate()),
15183
+ WWWW: (d, loc) => intl(loc, { weekday: "long" }).format(d),
15184
+ WWW: (d, loc) => intl(loc, { weekday: "short" }).format(d),
15185
+ HH: (d) => pad2(d.getHours()),
15186
+ H: (d) => String(d.getHours()),
15187
+ hh: (d) => pad2(d.getHours()),
15188
+ h: (d) => pad2(d.getHours()),
15189
+ AA: () => "",
15190
+ aa: () => "",
15191
+ a: () => "",
15192
+ mm: (d) => pad2(d.getMinutes()),
15193
+ m: (d) => String(d.getMinutes()),
15194
+ ss: (d) => pad2(d.getSeconds()),
15195
+ s: (d) => String(d.getSeconds()),
15196
+ fff: (d) => String(d.getMilliseconds()).padStart(3, "0")
15197
+ };
15198
+ /***************************************************************
15199
+ * A template -> its parts: literal text, or a function of
15200
+ * (date, locale).
15201
+ ***************************************************************/
15202
+ function template_parts(tpl) {
15203
+ let parts = [];
15204
+ let rest = String(tpl);
15205
+ while (rest.length > 0) {
15206
+ let whole = WHOLE.find(([frag]) => rest.startsWith(frag));
15207
+ if (whole) {
15208
+ parts.push(whole[1]);
15209
+ rest = rest.slice(whole[0].length);
15210
+ continue;
15211
+ }
15212
+ let m = /^\{([a-z]+)\}/i.exec(rest);
15213
+ if (m && TOKENS[m[1]]) {
15214
+ parts.push(TOKENS[m[1]]);
15215
+ rest = rest.slice(m[0].length);
15216
+ continue;
15217
+ }
15218
+ let next = rest.indexOf("{", 1);
15219
+ let text = next < 0 ? rest : rest.slice(0, next);
15220
+ parts.push(text);
15221
+ rest = rest.slice(text.length);
15222
+ }
15223
+ return parts;
15224
+ }
15225
+ /***************************************************************
15226
+ * uPlot's `fmtDate` option. `get_locale` answers the app's
15227
+ * language at the moment of the call (the views pass
15228
+ * `() => i18next.language`).
15229
+ ***************************************************************/
15230
+ function yui_uplot_fmt_date(get_locale) {
15231
+ let locale = () => safe_locale(typeof get_locale === "function" ? get_locale() : null);
15232
+ return function(tpl) {
15233
+ if (tpl === LEGEND_STAMP) return (date) => fmt_date_time(date, locale());
15234
+ let parts = template_parts(tpl);
15235
+ return function(date) {
15236
+ let loc = locale();
15237
+ let out = "";
15238
+ for (let part of parts) out += typeof part === "string" ? part : part(date, loc);
15239
+ return out;
15240
+ };
15241
+ };
15242
+ }
15243
+ //#endregion
15014
15244
  //#region src/c_yui_uplot.js
15015
15245
  /***********************************************************************
15016
15246
  * c_yui_uplot.js
15017
15247
  *
15018
15248
  * Graphics, Charts with uPlot
15019
15249
  *
15250
+ * A moment uPlot writes -- a tick of a time axis, the reading of
15251
+ * the legend -- is in the app's language with a clock of 24 hours
15252
+ * (yui_uplot_time.js), and is written again on the shell's
15253
+ * EV_LANGUAGE_CHANGED.
15254
+ *
15020
15255
  * Copyright (c) 2025-2026, ArtGins.
15021
15256
  * All Rights Reserved.
15022
15257
  ***********************************************************************/
@@ -15045,7 +15280,10 @@ var attrs_table$15 = [
15045
15280
  SDATA(data_type_t.DTP_INTEGER, "timeout_idle", 0, 5, "Idle timeout (seconds)"),
15046
15281
  SDATA_END()
15047
15282
  ];
15048
- var PRIVATE_DATA$15 = { theme_observer: null };
15283
+ var PRIVATE_DATA$15 = {
15284
+ theme_observer: null,
15285
+ lang_shell: null
15286
+ };
15049
15287
  var __gclass__$15 = null;
15050
15288
  /******************************
15051
15289
  * Framework Methods
@@ -15063,11 +15301,22 @@ function mt_create$15(gobj) {
15063
15301
  /***************************************************************
15064
15302
  * Framework Method: Start
15065
15303
  ***************************************************************/
15066
- function mt_start$15(gobj) {}
15304
+ function mt_start$15(gobj) {
15305
+ let priv = gobj.priv;
15306
+ let shell = yui_shell_of(gobj);
15307
+ if (shell) {
15308
+ gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
15309
+ priv.lang_shell = shell;
15310
+ }
15311
+ }
15067
15312
  /***************************************************************
15068
15313
  * Framework Method: Stop
15069
15314
  ***************************************************************/
15070
- function mt_stop$15(gobj) {}
15315
+ function mt_stop$15(gobj) {
15316
+ let priv = gobj.priv;
15317
+ if (priv.lang_shell && !gobj_is_destroying(priv.lang_shell)) gobj_unsubscribe_event(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
15318
+ priv.lang_shell = null;
15319
+ }
15071
15320
  /***************************************************************
15072
15321
  * Framework Method: Destroy
15073
15322
  ***************************************************************/
@@ -15105,7 +15354,8 @@ function build_ui$14(gobj) {
15105
15354
  height: gobj_read_attr(gobj, "height"),
15106
15355
  series: gobj_read_attr(gobj, "series"),
15107
15356
  axes: yui_uplot_axes(gobj_read_attr(gobj, "axes")),
15108
- scales: gobj_read_attr(gobj, "scales")
15357
+ scales: gobj_read_attr(gobj, "scales"),
15358
+ fmtDate: yui_uplot_fmt_date(() => i18next.language)
15109
15359
  };
15110
15360
  let uplot = new uPlot(uPlot_options, gobj_read_attr(gobj, "data"), $container);
15111
15361
  gobj_write_attr(gobj, "uplot", uplot);
@@ -15227,6 +15477,22 @@ function ac_theme$4(gobj, event, kw, src) {
15227
15477
  return 0;
15228
15478
  }
15229
15479
  /******************************************************
15480
+ * The language changed: the ticks of a time axis and the
15481
+ * reading of the legend ask for it when they are written,
15482
+ * so they are written again.
15483
+ ******************************************************/
15484
+ function ac_language_changed$9(gobj, event, kw, src) {
15485
+ let uplot = gobj_read_attr(gobj, "uplot");
15486
+ if (!uplot) return 0;
15487
+ try {
15488
+ uplot.redraw(true, true);
15489
+ uplot.setLegend(null, false);
15490
+ } catch (e) {
15491
+ log_error(`${gobj_short_name(gobj)}: cannot redraw the chart: ${e}`);
15492
+ }
15493
+ return 0;
15494
+ }
15495
+ /******************************************************
15230
15496
  *
15231
15497
  ******************************************************/
15232
15498
  function ac_del_serie(gobj, event, kw, src) {
@@ -15274,7 +15540,8 @@ function create_gclass$15(gclass_name) {
15274
15540
  ["EV_ADD_SERIE", 0],
15275
15541
  ["EV_DEL_SERIE", 0],
15276
15542
  ["EV_CLEAR", 0],
15277
- ["EV_THEME", 0]
15543
+ ["EV_THEME", 0],
15544
+ ["EV_LANGUAGE_CHANGED", 0]
15278
15545
  ], [["ST_IDLE", [
15279
15546
  [
15280
15547
  "EV_LOAD_DATA",
@@ -15300,6 +15567,11 @@ function create_gclass$15(gclass_name) {
15300
15567
  "EV_THEME",
15301
15568
  ac_theme$4,
15302
15569
  null
15570
+ ],
15571
+ [
15572
+ "EV_LANGUAGE_CHANGED",
15573
+ ac_language_changed$9,
15574
+ null
15303
15575
  ]
15304
15576
  ]]], gmt$15, 0, attrs_table$15, PRIVATE_DATA$15, 0, 0, 0, 0);
15305
15577
  if (!__gclass__$15) return -1;
@@ -18366,7 +18638,8 @@ var PRIVATE_DATA$13 = {
18366
18638
  $search_ctl: null,
18367
18639
  $expand_btn: null,
18368
18640
  $collapse_btn: null,
18369
- $mode_btns: null
18641
+ $mode_btns: null,
18642
+ lang_shell: null
18370
18643
  };
18371
18644
  var __gclass__$13 = null;
18372
18645
  /******************************
@@ -18394,13 +18667,22 @@ function mt_create$13(gobj) {
18394
18667
  * Framework Method: Start
18395
18668
  ***************************************************************/
18396
18669
  function mt_start$13(gobj) {
18397
- if (gobj.priv.root !== null) gobj_change_state(gobj, "ST_READY");
18670
+ let priv = gobj.priv;
18671
+ if (priv.root !== null) gobj_change_state(gobj, "ST_READY");
18672
+ let shell = yui_shell_of(gobj);
18673
+ if (shell) {
18674
+ gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
18675
+ priv.lang_shell = shell;
18676
+ }
18398
18677
  render_view$1(gobj);
18399
18678
  }
18400
18679
  /***************************************************************
18401
18680
  * Framework Method: Stop
18402
18681
  ***************************************************************/
18403
18682
  function mt_stop$13(gobj) {
18683
+ let priv = gobj.priv;
18684
+ if (priv.lang_shell && !gobj_is_destroying(priv.lang_shell)) gobj_unsubscribe_event(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
18685
+ priv.lang_shell = null;
18404
18686
  teardown_graph_child$1(gobj);
18405
18687
  }
18406
18688
  /***************************************************************
@@ -19099,7 +19381,7 @@ function leaf_row(key, value, depth) {
19099
19381
  text_node(text)
19100
19382
  ]);
19101
19383
  if (key !== null && is_time_field(String(key))) {
19102
- let wall = format_epoch(value);
19384
+ let wall = format_epoch(value, safe_locale(i18next.language));
19103
19385
  if (wall) body.push([
19104
19386
  "span",
19105
19387
  { class: "JSON_TIME is-size-7 yui-text-quiet ml-2" },
@@ -19350,6 +19632,12 @@ function ac_json_item_clicked(gobj, event, kw, src) {
19350
19632
  }
19351
19633
  /************************************************************
19352
19634
  * EV_LANGUAGE_CHANGED — re-translate chrome + re-render
19635
+ *
19636
+ * Only the TREE is drawn again: it writes the reading of a
19637
+ * time field in the language of the moment it was drawn. The
19638
+ * text view carries its keys (refresh_language reaches them),
19639
+ * and loading the graph again would throw away the reader's
19640
+ * camera for nothing.
19353
19641
  ************************************************************/
19354
19642
  function ac_language_changed$8(gobj, event, kw, src) {
19355
19643
  let priv = gobj.priv;
@@ -19359,7 +19647,7 @@ function ac_language_changed$8(gobj, event, kw, src) {
19359
19647
  if (priv.$search) priv.$search.setAttribute("placeholder", t("search"));
19360
19648
  apply_view_mode$1(gobj);
19361
19649
  }
19362
- render_view$1(gobj);
19650
+ if (current_view_mode$1(gobj) === "tree") render_tree(gobj);
19363
19651
  return 0;
19364
19652
  }
19365
19653
  /************************************************************
@@ -33040,26 +33328,11 @@ function transform__treedb_value_2_table_value(gobj, col, value, row, field) {
33040
33328
  switch (field_desc.real_type) {
33041
33329
  case "string":
33042
33330
  case "integer":
33043
- value = time_value_to_date(value, field_desc.real_type);
33044
- if (!value) {
33045
- value = "";
33046
- break;
33047
- }
33048
- const rawLocale = navigator.language;
33049
- const userLocale = typeof rawLocale === "string" && rawLocale && rawLocale !== "undefined" ? rawLocale : void 0;
33050
- const formatter = new Intl.DateTimeFormat(userLocale, {
33051
- day: "numeric",
33052
- month: "short",
33053
- year: "numeric",
33054
- hour: "2-digit",
33055
- minute: "2-digit",
33056
- second: "2-digit",
33057
- hour12: true
33058
- });
33059
- value = createElement2([
33331
+ value = time_value_to_text(value, field_desc.real_type, safe_locale(i18next.language));
33332
+ if (value) value = createElement2([
33060
33333
  "span",
33061
33334
  { class: "is-size-7" },
33062
- formatter.format(value)
33335
+ text_node(value)
33063
33336
  ]);
33064
33337
  }
33065
33338
  break;
@@ -82877,21 +83150,6 @@ var YUI_ROLLING = {
82877
83150
  * Locale / i18n
82878
83151
  ***************************/
82879
83152
  /***************************************************************
82880
- * The locale to format with.
82881
- *
82882
- * NEVER at module top level, and never `navigator.language` raw:
82883
- * Firefox can report the literal STRING "undefined", and every Intl
82884
- * constructor throws RangeError on it — a module that built its
82885
- * formatter on import took the whole bundle down with it (that is why
82886
- * gui_agent refuses to import the gobj-ui barrel).
82887
- ***************************************************************/
82888
- function safe_locale(locale) {
82889
- if (typeof locale === "string" && locale && locale !== "undefined") return locale;
82890
- let nav = typeof navigator !== "undefined" ? navigator.language : null;
82891
- if (typeof nav === "string" && nav && nav !== "undefined") return nav;
82892
- return "en";
82893
- }
82894
- /***************************************************************
82895
83153
  * Translate through the APP's translator when it gave us one, and
82896
83154
  * degrade to the key itself otherwise — interpolating `{{x}}` by hand,
82897
83155
  * so a label never renders raw mustaches at a caller that has no i18n.
@@ -86235,6 +86493,6 @@ function setup_json_pad(self) {
86235
86493
  return win;
86236
86494
  }
86237
86495
  //#endregion
86238
- export { EditControl, ICONS_TOPIC, MarkerControl, USER_ICON_PREFIX, YUI_FILE_ACCEPT, YUI_PERIODS, YUI_PERIODS_DEFAULT, YUI_ROLLING, addClasses, apply_dev_traces, attach_clear, build_dev_panel, dev_window_was_open, disableElements, enableElements, epoch_to_local_input, epoch_to_ms, expose_view_container, fmt_epoch, getStrokeColor, infer_period, info_traffic, inject_svg_icons, is_current_period, iso_week, local_input_to_epoch, ms_to_epoch, period_bounds, period_bounds_epoch, period_label, period_name, period_shift, period_spec, period_start, refresh_clear, register_c_g6_nodes_tree, register_c_yui_form, register_c_yui_fsm_graph, register_c_yui_gclass, register_c_yui_gobj_tree_js, register_c_yui_json, register_c_yui_json_graph, register_c_yui_json_pad, register_c_yui_map, register_c_yui_nav, register_c_yui_pager, register_c_yui_period, register_c_yui_schema_editor, register_c_yui_service_view, register_c_yui_shell, register_c_yui_treedb_graph, register_c_yui_treedb_schema, register_c_yui_treedb_topic_with_form, register_c_yui_treedb_topics, register_c_yui_uplot, register_c_yui_window, register_c_yui_window_manager, register_c_yui_wizard, removeChildElements, removeClasses, rolling_bounds, safe_locale, set_active_state, set_cancel_state, set_pressed_state, set_submit_state, setup_dev, setup_frontend_view, setup_json_pad, toggleClasses, yui_array_buffer_to_base64, yui_asset_element, yui_asset_id, yui_asset_ids, yui_asset_missing, yui_asset_src, yui_file_control, yui_file_id_label, yui_file_read, yui_file_sha256, yui_file_size_label, yui_files_manifest, yui_icon_is_defined, yui_icons_list, yui_icons_put_user, yui_icons_remove_user, yui_icons_set_user, yui_is_dark, yui_mount_service_view, yui_shell_close_drawer, yui_shell_close_dropdown, yui_shell_confirm_danger, yui_shell_confirm_ok, yui_shell_confirm_yesno, yui_shell_confirm_yesnocancel, yui_shell_escape_order, yui_shell_navigate, yui_shell_open_drawer, yui_shell_overlay_dismissed, yui_shell_pop_escape, yui_shell_push_escape, yui_shell_refresh_avatars, yui_shell_register_event_handler, yui_shell_register_overlay, yui_shell_set_avatar_provider, yui_shell_set_connection_state, yui_shell_set_nav_item_badge, yui_shell_set_sub_routes, yui_shell_set_toolbar_item_badge, yui_shell_set_toolbar_item_icon, yui_shell_set_translator, yui_shell_show_error, yui_shell_show_info, yui_shell_show_modal, yui_shell_show_route_map, yui_shell_show_warning, yui_shell_toggle_drawer, yui_shell_unpark_route, yui_svg_icon_element, yui_svg_sanitize, yui_theme_now, yui_toolbar, yui_user_icon_class, yui_watch_theme };
86496
+ export { EditControl, ICONS_TOPIC, MarkerControl, USER_ICON_PREFIX, YUI_FILE_ACCEPT, YUI_PERIODS, YUI_PERIODS_DEFAULT, YUI_ROLLING, addClasses, apply_dev_traces, attach_clear, build_dev_panel, dev_window_was_open, disableElements, enableElements, epoch_to_local_input, epoch_to_ms, expose_view_container, fmt_date_time, fmt_epoch, getStrokeColor, infer_period, info_traffic, inject_svg_icons, is_current_period, iso_week, local_input_to_epoch, ms_to_epoch, period_bounds, period_bounds_epoch, period_label, period_name, period_shift, period_spec, period_start, refresh_clear, register_c_g6_nodes_tree, register_c_yui_form, register_c_yui_fsm_graph, register_c_yui_gclass, register_c_yui_gobj_tree_js, register_c_yui_json, register_c_yui_json_graph, register_c_yui_json_pad, register_c_yui_map, register_c_yui_nav, register_c_yui_pager, register_c_yui_period, register_c_yui_schema_editor, register_c_yui_service_view, register_c_yui_shell, register_c_yui_treedb_graph, register_c_yui_treedb_schema, register_c_yui_treedb_topic_with_form, register_c_yui_treedb_topics, register_c_yui_uplot, register_c_yui_window, register_c_yui_window_manager, register_c_yui_wizard, removeChildElements, removeClasses, rolling_bounds, safe_locale, set_active_state, set_cancel_state, set_pressed_state, set_submit_state, setup_dev, setup_frontend_view, setup_json_pad, toggleClasses, yui_array_buffer_to_base64, yui_asset_element, yui_asset_id, yui_asset_ids, yui_asset_missing, yui_asset_src, yui_file_control, yui_file_id_label, yui_file_read, yui_file_sha256, yui_file_size_label, yui_files_manifest, yui_icon_is_defined, yui_icons_list, yui_icons_put_user, yui_icons_remove_user, yui_icons_set_user, yui_is_dark, yui_mount_service_view, yui_shell_close_drawer, yui_shell_close_dropdown, yui_shell_confirm_danger, yui_shell_confirm_ok, yui_shell_confirm_yesno, yui_shell_confirm_yesnocancel, yui_shell_escape_order, yui_shell_navigate, yui_shell_open_drawer, yui_shell_overlay_dismissed, yui_shell_pop_escape, yui_shell_push_escape, yui_shell_refresh_avatars, yui_shell_register_event_handler, yui_shell_register_overlay, yui_shell_set_avatar_provider, yui_shell_set_connection_state, yui_shell_set_nav_item_badge, yui_shell_set_sub_routes, yui_shell_set_toolbar_item_badge, yui_shell_set_toolbar_item_icon, yui_shell_set_translator, yui_shell_show_error, yui_shell_show_info, yui_shell_show_modal, yui_shell_show_route_map, yui_shell_show_warning, yui_shell_toggle_drawer, yui_shell_unpark_route, yui_svg_icon_element, yui_svg_sanitize, yui_theme_now, yui_toolbar, yui_user_icon_class, yui_watch_theme };
86239
86497
 
86240
86498
  //# sourceMappingURL=gobj-ui.es.js.map
package/index.js CHANGED
@@ -107,6 +107,7 @@ export {
107
107
  epoch_to_local_input,
108
108
  local_input_to_epoch,
109
109
  fmt_epoch,
110
+ fmt_date_time,
110
111
  iso_week,
111
112
  period_spec,
112
113
  period_start,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.26.51",
3
+ "version": "7.26.53",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",