@yuneta/gobj-ui 7.26.51 → 7.26.52
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.
- package/README.md +88 -2
- package/dist/gobj-ui.cjs.js +1267 -1025
- package/dist/gobj-ui.es.js +1258 -1017
- package/index.js +1 -0
- package/package.json +1 -1
- package/src/c_yui_form.js +48 -5
- package/src/c_yui_json.js +36 -3
- package/src/c_yui_treedb_topic_with_form.js +13 -28
- package/src/c_yui_uplot.js +51 -2
- package/src/fmt_date_time.test.js +138 -0
- package/src/form_table_rows.wiring.test.js +5 -4
- package/src/form_time_value.js +9 -6
- package/src/form_time_value.test.js +1 -1
- package/src/json_view_helpers.js +8 -3
- package/src/time_text.wiring.test.js +489 -0
- package/src/yui_time.js +37 -0
- package/src/yui_uplot_time.js +142 -0
package/dist/gobj-ui.es.js
CHANGED
|
@@ -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$
|
|
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$
|
|
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,450 +9676,1074 @@ function yui_icons_list() {
|
|
|
9676
9676
|
});
|
|
9677
9677
|
return list;
|
|
9678
9678
|
}
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
if (value === null) return "null";
|
|
9684
|
-
if (Array.isArray(value)) return "array";
|
|
9685
|
-
switch (typeof value) {
|
|
9686
|
-
case "string": return "string";
|
|
9687
|
-
case "number": return "number";
|
|
9688
|
-
case "boolean": return "boolean";
|
|
9689
|
-
case "object": return "object";
|
|
9690
|
-
default: return "unknown";
|
|
9691
|
-
}
|
|
9692
|
-
}
|
|
9693
|
-
/************************************************************
|
|
9694
|
-
* Detect a kw_collapse() sentinel.
|
|
9679
|
+
//#endregion
|
|
9680
|
+
//#region src/yui_time.js
|
|
9681
|
+
/***********************************************************************
|
|
9682
|
+
* yui_time.js
|
|
9695
9683
|
*
|
|
9696
|
-
*
|
|
9697
|
-
* { "__collapsed__": { "path": ..., "size": N } }
|
|
9698
|
-
* and an over-limit array with:
|
|
9699
|
-
* [ { "__collapsed__": { "path": ..., "size": N } } ]
|
|
9684
|
+
* Time, without a DOM: epochs, and the algebra of PERIODS.
|
|
9700
9685
|
*
|
|
9701
|
-
*
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9686
|
+
* Two things live here, and they are the two halves of every date
|
|
9687
|
+
* UI the projects keep rewriting:
|
|
9688
|
+
*
|
|
9689
|
+
* 1) EPOCH <-> the local wall clock. A timestamp travels in the
|
|
9690
|
+
* producer's own unit — seconds, or milliseconds when a topic
|
|
9691
|
+
* says so — and every conversion crosses that `ms` flag. Getting
|
|
9692
|
+
* it wrong puts the same instant on two different clocks in one
|
|
9693
|
+
* screen (it did: a picker asking "from 18:55" local returned
|
|
9694
|
+
* rows a table labelled 16:55).
|
|
9695
|
+
*
|
|
9696
|
+
* 2) The PERIOD. A period is not an enum of five names: it is a
|
|
9697
|
+
* BUCKET, and a bucket is `count` of a `unit`:
|
|
9698
|
+
*
|
|
9699
|
+
* {id: "day", unit: "day", count: 1}
|
|
9700
|
+
* {id: "week", unit: "week", count: 1} ISO, Mon-first
|
|
9701
|
+
* {id: "bimester", unit: "month", count: 2}
|
|
9702
|
+
* {id: "quarter", unit: "month", count: 3}
|
|
9703
|
+
* {id: "semester", unit: "month", count: 6}
|
|
9704
|
+
* {id: "decade", unit: "year", count: 10}
|
|
9705
|
+
* {id: "15min", unit: "minute", count: 15}
|
|
9706
|
+
*
|
|
9707
|
+
* Given that pair, ONE implementation answers every question a
|
|
9708
|
+
* date navigator asks — where does the bucket holding this
|
|
9709
|
+
* instant start and end, what is the previous/next one, what do
|
|
9710
|
+
* I call it — so an app that wants quarters declares a quarter
|
|
9711
|
+
* instead of asking for a new component.
|
|
9712
|
+
*
|
|
9713
|
+
* Buckets are ALIGNED, never "count back from now": months align to
|
|
9714
|
+
* the year (which is why 2, 3, 4, 6 and 12 fall on clean calendar
|
|
9715
|
+
* boundaries), weeks to Monday, hours to local midnight. "Last 7
|
|
9716
|
+
* days" is a different animal — a rolling window — and it is not a
|
|
9717
|
+
* period: see `rolling_bounds()`.
|
|
9718
|
+
*
|
|
9719
|
+
* Everything here is LOCAL time (the user reads a local clock) and
|
|
9720
|
+
* DST-safe: it never adds 86400000 ms to cross a day, it builds the
|
|
9721
|
+
* next date from calendar fields and lets the platform do it.
|
|
9722
|
+
*
|
|
9723
|
+
* Copyright (c) 2026, ArtGins.
|
|
9724
|
+
* All Rights Reserved.
|
|
9725
|
+
***********************************************************************/
|
|
9726
|
+
/***************************************************************
|
|
9727
|
+
* Constants
|
|
9728
|
+
***************************************************************/
|
|
9729
|
+
var MS_DAY = 864e5;
|
|
9730
|
+
var PERIOD_UNITS = [
|
|
9731
|
+
"minute",
|
|
9732
|
+
"hour",
|
|
9733
|
+
"day",
|
|
9734
|
+
"week",
|
|
9735
|
+
"month",
|
|
9736
|
+
"year"
|
|
9737
|
+
];
|
|
9738
|
+
var YUI_PERIODS = {
|
|
9739
|
+
minute: {
|
|
9740
|
+
id: "minute",
|
|
9741
|
+
unit: "minute",
|
|
9742
|
+
count: 1
|
|
9743
|
+
},
|
|
9744
|
+
"5min": {
|
|
9745
|
+
id: "5min",
|
|
9746
|
+
unit: "minute",
|
|
9747
|
+
count: 5
|
|
9748
|
+
},
|
|
9749
|
+
"15min": {
|
|
9750
|
+
id: "15min",
|
|
9751
|
+
unit: "minute",
|
|
9752
|
+
count: 15
|
|
9753
|
+
},
|
|
9754
|
+
hour: {
|
|
9755
|
+
id: "hour",
|
|
9756
|
+
unit: "hour",
|
|
9757
|
+
count: 1
|
|
9758
|
+
},
|
|
9759
|
+
day: {
|
|
9760
|
+
id: "day",
|
|
9761
|
+
unit: "day",
|
|
9762
|
+
count: 1
|
|
9763
|
+
},
|
|
9764
|
+
week: {
|
|
9765
|
+
id: "week",
|
|
9766
|
+
unit: "week",
|
|
9767
|
+
count: 1
|
|
9768
|
+
},
|
|
9769
|
+
fortnight: {
|
|
9770
|
+
id: "fortnight",
|
|
9771
|
+
unit: "week",
|
|
9772
|
+
count: 2
|
|
9773
|
+
},
|
|
9774
|
+
month: {
|
|
9775
|
+
id: "month",
|
|
9776
|
+
unit: "month",
|
|
9777
|
+
count: 1
|
|
9778
|
+
},
|
|
9779
|
+
bimester: {
|
|
9780
|
+
id: "bimester",
|
|
9781
|
+
unit: "month",
|
|
9782
|
+
count: 2
|
|
9783
|
+
},
|
|
9784
|
+
quarter: {
|
|
9785
|
+
id: "quarter",
|
|
9786
|
+
unit: "month",
|
|
9787
|
+
count: 3
|
|
9788
|
+
},
|
|
9789
|
+
semester: {
|
|
9790
|
+
id: "semester",
|
|
9791
|
+
unit: "month",
|
|
9792
|
+
count: 6
|
|
9793
|
+
},
|
|
9794
|
+
year: {
|
|
9795
|
+
id: "year",
|
|
9796
|
+
unit: "year",
|
|
9797
|
+
count: 1
|
|
9798
|
+
},
|
|
9799
|
+
decade: {
|
|
9800
|
+
id: "decade",
|
|
9801
|
+
unit: "year",
|
|
9802
|
+
count: 10
|
|
9715
9803
|
}
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9804
|
+
};
|
|
9805
|
+
var YUI_PERIODS_DEFAULT = [
|
|
9806
|
+
"hour",
|
|
9807
|
+
"day",
|
|
9808
|
+
"week",
|
|
9809
|
+
"month",
|
|
9810
|
+
"year"
|
|
9811
|
+
];
|
|
9812
|
+
var YUI_ROLLING = {
|
|
9813
|
+
"1h": {
|
|
9814
|
+
id: "1h",
|
|
9815
|
+
secs: 3600,
|
|
9816
|
+
label: "last hour"
|
|
9817
|
+
},
|
|
9818
|
+
"6h": {
|
|
9819
|
+
id: "6h",
|
|
9820
|
+
secs: 21600,
|
|
9821
|
+
label: "last 6h"
|
|
9822
|
+
},
|
|
9823
|
+
"24h": {
|
|
9824
|
+
id: "24h",
|
|
9825
|
+
secs: 86400,
|
|
9826
|
+
label: "last 24h"
|
|
9827
|
+
},
|
|
9828
|
+
"7d": {
|
|
9829
|
+
id: "7d",
|
|
9830
|
+
secs: 604800,
|
|
9831
|
+
label: "last 7 days"
|
|
9832
|
+
},
|
|
9833
|
+
"30d": {
|
|
9834
|
+
id: "30d",
|
|
9835
|
+
secs: 2592e3,
|
|
9836
|
+
label: "last 30 days"
|
|
9726
9837
|
}
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9838
|
+
};
|
|
9839
|
+
/***************************
|
|
9840
|
+
* Locale / i18n
|
|
9841
|
+
***************************/
|
|
9842
|
+
/***************************************************************
|
|
9843
|
+
* The locale to format with.
|
|
9844
|
+
*
|
|
9845
|
+
* NEVER at module top level, and never `navigator.language` raw:
|
|
9846
|
+
* Firefox can report the literal STRING "undefined", and every Intl
|
|
9847
|
+
* constructor throws RangeError on it — a module that built its
|
|
9848
|
+
* formatter on import took the whole bundle down with it (that is why
|
|
9849
|
+
* gui_agent refuses to import the gobj-ui barrel).
|
|
9850
|
+
***************************************************************/
|
|
9851
|
+
function safe_locale(locale) {
|
|
9852
|
+
if (typeof locale === "string" && locale && locale !== "undefined") return locale;
|
|
9853
|
+
let nav = typeof navigator !== "undefined" ? navigator.language : null;
|
|
9854
|
+
if (typeof nav === "string" && nav && nav !== "undefined") return nav;
|
|
9855
|
+
return "en";
|
|
9736
9856
|
}
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9857
|
+
/***************************************************************
|
|
9858
|
+
* Translate through the APP's translator when it gave us one, and
|
|
9859
|
+
* degrade to the key itself otherwise — interpolating `{{x}}` by hand,
|
|
9860
|
+
* so a label never renders raw mustaches at a caller that has no i18n.
|
|
9861
|
+
***************************************************************/
|
|
9862
|
+
function tr(t, key, params) {
|
|
9863
|
+
if (typeof t === "function") return t(key, params);
|
|
9864
|
+
let s = key;
|
|
9865
|
+
for (let k in params || {}) s = s.replaceAll(`{{${k}}}`, String(params[k]));
|
|
9866
|
+
return s;
|
|
9740
9867
|
}
|
|
9741
|
-
|
|
9742
|
-
*
|
|
9743
|
-
*
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
else return;
|
|
9868
|
+
/***************************************************************
|
|
9869
|
+
* Intl formatters, built PER CALL (see safe_locale). They are cheap
|
|
9870
|
+
* next to a repaint, and caching them would need a locale-change hook
|
|
9871
|
+
* the library has no business owning.
|
|
9872
|
+
***************************************************************/
|
|
9873
|
+
function fmt_intl(date, locale, opts) {
|
|
9874
|
+
try {
|
|
9875
|
+
return new Intl.DateTimeFormat(safe_locale(locale), opts).format(date);
|
|
9876
|
+
} catch (e) {
|
|
9877
|
+
return date.toDateString();
|
|
9752
9878
|
}
|
|
9753
|
-
return v;
|
|
9754
9879
|
}
|
|
9755
|
-
|
|
9756
|
-
*
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
*
|
|
9760
|
-
*
|
|
9761
|
-
|
|
9762
|
-
function
|
|
9763
|
-
if (
|
|
9764
|
-
|
|
9765
|
-
if (parent === null || parent === void 0 || typeof parent !== "object") return root;
|
|
9766
|
-
let last = segments[segments.length - 1];
|
|
9767
|
-
if (Array.isArray(parent)) parent[Number(last)] = new_value;
|
|
9768
|
-
else parent[last] = new_value;
|
|
9769
|
-
return root;
|
|
9880
|
+
/***************************
|
|
9881
|
+
* Epoch <-> clock
|
|
9882
|
+
***************************/
|
|
9883
|
+
/***************************************************************
|
|
9884
|
+
* Epoch in the producer's unit -> milliseconds, and back.
|
|
9885
|
+
* `ms` true means the value already IS milliseconds.
|
|
9886
|
+
***************************************************************/
|
|
9887
|
+
function epoch_to_ms(value, ms) {
|
|
9888
|
+
if (!value) return 0;
|
|
9889
|
+
return ms ? value : value * 1e3;
|
|
9770
9890
|
}
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
*
|
|
9775
|
-
* Collapsed (not-yet-loaded) subtrees can't be searched, so
|
|
9776
|
-
* they never match on content — only their key can match,
|
|
9777
|
-
* which the renderer checks separately.
|
|
9778
|
-
************************************************************/
|
|
9779
|
-
function subtree_matches(value, term) {
|
|
9780
|
-
if (!term) return true;
|
|
9781
|
-
if (is_collapsed(value)) return false;
|
|
9782
|
-
let type = json_type(value);
|
|
9783
|
-
if (type === "object") {
|
|
9784
|
-
for (let [k, v] of Object.entries(value)) {
|
|
9785
|
-
if (String(k).toLowerCase().includes(term)) return true;
|
|
9786
|
-
if (subtree_matches(v, term)) return true;
|
|
9787
|
-
}
|
|
9788
|
-
return false;
|
|
9789
|
-
}
|
|
9790
|
-
if (type === "array") {
|
|
9791
|
-
for (let v of value) if (subtree_matches(v, term)) return true;
|
|
9792
|
-
return false;
|
|
9793
|
-
}
|
|
9794
|
-
return String(value).toLowerCase().includes(term);
|
|
9891
|
+
function ms_to_epoch(value_ms, ms) {
|
|
9892
|
+
if (!value_ms) return 0;
|
|
9893
|
+
return ms ? value_ms : Math.floor(value_ms / 1e3);
|
|
9795
9894
|
}
|
|
9796
|
-
|
|
9797
|
-
*
|
|
9798
|
-
*
|
|
9799
|
-
*
|
|
9800
|
-
*
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
* only the long pair listed, `to_t` got its date and the
|
|
9808
|
-
* `fr_t` right above it did not, which reads as a broken
|
|
9809
|
-
* annotator rather than a missing name.
|
|
9810
|
-
************************************************************/
|
|
9811
|
-
var TIME_FIELDS = [
|
|
9812
|
-
"__t__",
|
|
9813
|
-
"__tm__",
|
|
9814
|
-
"t",
|
|
9815
|
-
"tm",
|
|
9816
|
-
"time",
|
|
9817
|
-
"from_t",
|
|
9818
|
-
"to_t",
|
|
9819
|
-
"from_tm",
|
|
9820
|
-
"to_tm",
|
|
9821
|
-
"fr_t",
|
|
9822
|
-
"fr_tm",
|
|
9823
|
-
"t_input",
|
|
9824
|
-
"t_output"
|
|
9825
|
-
];
|
|
9826
|
-
function is_time_field(field) {
|
|
9827
|
-
return TIME_FIELDS.indexOf(field) >= 0;
|
|
9895
|
+
/***************************************************************
|
|
9896
|
+
* The LOCAL wall-clock string an `<input type="datetime-local">` takes
|
|
9897
|
+
* ("YYYY-MM-DDTHH:MM:SS", which needs step=1 to keep the seconds), and
|
|
9898
|
+
* the parse back. Empty / unparseable -> 0, which is exactly how a
|
|
9899
|
+
* match condition reads an absent bound.
|
|
9900
|
+
***************************************************************/
|
|
9901
|
+
function epoch_to_local_input(value, ms) {
|
|
9902
|
+
if (!value) return "";
|
|
9903
|
+
let d = new Date(epoch_to_ms(value, ms));
|
|
9904
|
+
let pad = (n) => String(n).padStart(2, "0");
|
|
9905
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
9828
9906
|
}
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
function format_epoch(value) {
|
|
9835
|
-
if (typeof value !== "number" || !isFinite(value) || value <= 0) return null;
|
|
9836
|
-
let ms = Math.abs(value) < 0xe8d4a51000 ? value * 1e3 : value;
|
|
9837
|
-
let d = new Date(ms);
|
|
9838
|
-
if (isNaN(d.getTime())) return null;
|
|
9839
|
-
return d.toLocaleString();
|
|
9907
|
+
function local_input_to_epoch(v, ms) {
|
|
9908
|
+
if (!v) return 0;
|
|
9909
|
+
let parsed = Date.parse(v);
|
|
9910
|
+
if (Number.isNaN(parsed)) return 0;
|
|
9911
|
+
return ms_to_epoch(parsed, ms);
|
|
9840
9912
|
}
|
|
9841
|
-
|
|
9842
|
-
*
|
|
9843
|
-
*
|
|
9844
|
-
*
|
|
9845
|
-
*
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
function json_text_dump(root, max_chars) {
|
|
9850
|
-
let text;
|
|
9913
|
+
/***************************************************************
|
|
9914
|
+
* A timestamp for a table cell: the local wall clock, space-separated,
|
|
9915
|
+
* keeping the milliseconds when the producer bothered to send them (a
|
|
9916
|
+
* topic that sets sf_t_ms usually appends several records inside the
|
|
9917
|
+
* same second, and a column that hides that shows a column of ties).
|
|
9918
|
+
***************************************************************/
|
|
9919
|
+
function fmt_epoch(value, ms) {
|
|
9920
|
+
if (!value) return "";
|
|
9851
9921
|
try {
|
|
9852
|
-
|
|
9922
|
+
let s = epoch_to_local_input(value, ms).replace("T", " ");
|
|
9923
|
+
if (ms) s += `.${String(value % 1e3).padStart(3, "0")}`;
|
|
9924
|
+
return s;
|
|
9853
9925
|
} catch (e) {
|
|
9854
|
-
return
|
|
9855
|
-
text: "",
|
|
9856
|
-
capped: false,
|
|
9857
|
-
error: String(e)
|
|
9858
|
-
};
|
|
9926
|
+
return String(value);
|
|
9859
9927
|
}
|
|
9860
|
-
if (text === void 0) return {
|
|
9861
|
-
text: "",
|
|
9862
|
-
capped: false,
|
|
9863
|
-
error: "not representable as JSON"
|
|
9864
|
-
};
|
|
9865
|
-
if (typeof max_chars === "number" && max_chars > 0 && text.length > max_chars) return {
|
|
9866
|
-
text: text.slice(0, max_chars),
|
|
9867
|
-
capped: true
|
|
9868
|
-
};
|
|
9869
|
-
return {
|
|
9870
|
-
text,
|
|
9871
|
-
capped: false
|
|
9872
|
-
};
|
|
9873
9928
|
}
|
|
9874
|
-
|
|
9875
|
-
|
|
9929
|
+
var DATE_TIME_OPTIONS = {
|
|
9930
|
+
day: "numeric",
|
|
9931
|
+
month: "short",
|
|
9932
|
+
year: "numeric",
|
|
9933
|
+
hour: "2-digit",
|
|
9934
|
+
minute: "2-digit",
|
|
9935
|
+
second: "2-digit",
|
|
9936
|
+
hourCycle: "h23"
|
|
9937
|
+
};
|
|
9938
|
+
/***************************************************************
|
|
9939
|
+
* A moment as a VIEW shows it as text: the day, the month and the
|
|
9940
|
+
* year, then the clock of 24 hours with its seconds, in the APP's
|
|
9941
|
+
* language -- `locale` is the language t() answers in (the views
|
|
9942
|
+
* pass `i18next.language`), never the browser's:
|
|
9876
9943
|
*
|
|
9877
|
-
*
|
|
9878
|
-
*
|
|
9944
|
+
* fmt_date_time(d, "es") -> "14 oct 2026, 15:05:09"
|
|
9945
|
+
* fmt_date_time(d, "en") -> "Oct 14, 2026, 15:05:09"
|
|
9879
9946
|
*
|
|
9880
|
-
*
|
|
9881
|
-
*
|
|
9882
|
-
* document in the view you just left is the whole point of
|
|
9883
|
-
* remembering it. `fallback` is the floor.
|
|
9947
|
+
* "" for anything that is not a valid Date. A locale Intl refuses
|
|
9948
|
+
* gives the language-free "2026-10-14 15:05:09".
|
|
9884
9949
|
*
|
|
9885
|
-
*
|
|
9886
|
-
*
|
|
9887
|
-
*
|
|
9888
|
-
|
|
9889
|
-
function
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9950
|
+
* The time cells of C_YUI_FORM and C_YUI_TREEDB_TOPIC_WITH_FORM and
|
|
9951
|
+
* the reading C_YUI_JSON writes beside a time field all come from
|
|
9952
|
+
* here, so the same moment reads the same in the three.
|
|
9953
|
+
***************************************************************/
|
|
9954
|
+
function fmt_date_time(date, locale) {
|
|
9955
|
+
if (!(date instanceof Date) || isNaN(date.getTime())) return "";
|
|
9956
|
+
try {
|
|
9957
|
+
return new Intl.DateTimeFormat(safe_locale(locale), DATE_TIME_OPTIONS).format(date);
|
|
9958
|
+
} catch (e) {
|
|
9959
|
+
return epoch_to_local_input(date.getTime(), true).replace("T", " ");
|
|
9960
|
+
}
|
|
9894
9961
|
}
|
|
9895
|
-
|
|
9896
|
-
*
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
*
|
|
9900
|
-
*
|
|
9901
|
-
*
|
|
9902
|
-
*
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
* document, and printing `[object Object]` beside the size
|
|
9907
|
-
* would be worse than printing nothing.
|
|
9908
|
-
*
|
|
9909
|
-
* Cut at `max_chars`, because this rides on a row whose job
|
|
9910
|
-
* is to stay one line.
|
|
9911
|
-
************************************************************/
|
|
9912
|
-
function container_label(value, max_chars) {
|
|
9913
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) return "";
|
|
9914
|
-
if (!Object.prototype.hasOwnProperty.call(value, "id")) return "";
|
|
9915
|
-
let id = value.id;
|
|
9916
|
-
let t = typeof id;
|
|
9917
|
-
if (t !== "string" && t !== "number" && t !== "boolean") return "";
|
|
9918
|
-
let text = String(id).trim();
|
|
9919
|
-
if (text === "") return "";
|
|
9920
|
-
let cap = typeof max_chars === "number" && max_chars > 0 ? max_chars : 0;
|
|
9921
|
-
if (cap && text.length > cap) return text.slice(0, cap) + "…";
|
|
9922
|
-
return text;
|
|
9962
|
+
/***************************
|
|
9963
|
+
* Calendar atoms
|
|
9964
|
+
***************************/
|
|
9965
|
+
/***************************************************************
|
|
9966
|
+
* The day number of a date, counting local calendar days from
|
|
9967
|
+
* 1970-01-01. Built from the FIELDS (Date.UTC of y/m/d), never from
|
|
9968
|
+
* the timestamp: a DST day is 23 or 25 hours long, so dividing a local
|
|
9969
|
+
* epoch by 86400000 drifts a day twice a year.
|
|
9970
|
+
***************************************************************/
|
|
9971
|
+
function day_number(d) {
|
|
9972
|
+
return Math.floor(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()) / MS_DAY);
|
|
9923
9973
|
}
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
9927
|
-
function is_plain_object(v) {
|
|
9928
|
-
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
9974
|
+
function date_from_day_number(n) {
|
|
9975
|
+
let d = /* @__PURE__ */ new Date(n * MS_DAY);
|
|
9976
|
+
return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
|
|
9929
9977
|
}
|
|
9930
|
-
|
|
9931
|
-
*
|
|
9932
|
-
*
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
* say, and pushed everything below it one level down.
|
|
9939
|
-
*
|
|
9940
|
-
* An EMPTY container inside counts as content: `{0}` is
|
|
9941
|
-
* something the card has to show, and there is no child card
|
|
9942
|
-
* to show it instead.
|
|
9943
|
-
************************************************************/
|
|
9944
|
-
function is_pure_collection(value) {
|
|
9945
|
-
let entries = is_plain_object(value) ? Object.entries(value) : Array.isArray(value) ? value.map((v, i) => [i, v]) : [];
|
|
9946
|
-
if (entries.length === 0) return false;
|
|
9947
|
-
for (let [, v] of entries) if (!has_branch(v)) return false;
|
|
9948
|
-
return true;
|
|
9978
|
+
/***************************************************************
|
|
9979
|
+
* The Monday of the week a date falls in (ISO: the week starts on
|
|
9980
|
+
* Monday, and Sunday closes it).
|
|
9981
|
+
***************************************************************/
|
|
9982
|
+
function start_of_iso_week(d) {
|
|
9983
|
+
let day = d.getDay();
|
|
9984
|
+
let back = day === 0 ? 6 : day - 1;
|
|
9985
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate() - back);
|
|
9949
9986
|
}
|
|
9950
|
-
|
|
9951
|
-
*
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9987
|
+
/***************************************************************
|
|
9988
|
+
* The ISO week a date belongs to: {week, year}. The YEAR is the ISO
|
|
9989
|
+
* week-year, not the calendar year — 2026-12-31 lives in week 1 of
|
|
9990
|
+
* 2027, and a label that said "week 1 2026" would name a week six
|
|
9991
|
+
* months away.
|
|
9992
|
+
***************************************************************/
|
|
9993
|
+
function iso_week(d) {
|
|
9994
|
+
let monday = start_of_iso_week(d);
|
|
9995
|
+
let thursday = new Date(monday.getFullYear(), monday.getMonth(), monday.getDate() + 3);
|
|
9996
|
+
let jan1 = new Date(thursday.getFullYear(), 0, 1);
|
|
9997
|
+
return {
|
|
9998
|
+
week: Math.floor((day_number(thursday) - day_number(jan1)) / 7) + 1,
|
|
9999
|
+
year: thursday.getFullYear()
|
|
10000
|
+
};
|
|
9955
10001
|
}
|
|
9956
|
-
|
|
9957
|
-
*
|
|
9958
|
-
*
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
for (let v of entries) if (has_branch(v)) n++;
|
|
9964
|
-
return n;
|
|
10002
|
+
/***************************************************************
|
|
10003
|
+
* The index of the ISO week a date falls in, counting weeks from the
|
|
10004
|
+
* Monday of the epoch week. It is what aligns a MULTI-week bucket (a
|
|
10005
|
+
* fortnight) to a Monday instead of to whatever day 1970-01-01 was.
|
|
10006
|
+
***************************************************************/
|
|
10007
|
+
function week_index(d) {
|
|
10008
|
+
return Math.floor((day_number(start_of_iso_week(d)) + 3) / 7);
|
|
9965
10009
|
}
|
|
9966
|
-
|
|
9967
|
-
*
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
*
|
|
9971
|
-
*
|
|
10010
|
+
/***************************
|
|
10011
|
+
* Period algebra
|
|
10012
|
+
***************************/
|
|
10013
|
+
/***************************************************************
|
|
10014
|
+
* Normalize whatever a caller hands us into a spec: an id of the
|
|
10015
|
+
* catalog, or a spec of its own. Returns null for anything that is not
|
|
10016
|
+
* a bucket (a "span" / "custom" mode of a navigator has no algebra).
|
|
10017
|
+
***************************************************************/
|
|
10018
|
+
function period_spec(period) {
|
|
10019
|
+
if (!period) return null;
|
|
10020
|
+
let spec = typeof period === "string" ? YUI_PERIODS[period] : period;
|
|
10021
|
+
if (!spec || !spec.unit) return null;
|
|
10022
|
+
if (PERIOD_UNITS.indexOf(spec.unit) < 0) return null;
|
|
10023
|
+
let count = parseInt(spec.count, 10);
|
|
10024
|
+
if (!(count > 0)) count = 1;
|
|
10025
|
+
return {
|
|
10026
|
+
id: spec.id || spec.unit,
|
|
10027
|
+
unit: spec.unit,
|
|
10028
|
+
count
|
|
10029
|
+
};
|
|
10030
|
+
}
|
|
10031
|
+
/***************************************************************
|
|
10032
|
+
* The START of the bucket that holds `anchor_ms`, as a local Date.
|
|
9972
10033
|
*
|
|
9973
|
-
*
|
|
9974
|
-
*
|
|
10034
|
+
* Alignment is what makes a bucket a bucket. Each unit floors against
|
|
10035
|
+
* the natural origin of the unit above it, so the boundaries are the
|
|
10036
|
+
* ones a human already has in their head:
|
|
9975
10037
|
*
|
|
9976
|
-
*
|
|
9977
|
-
*
|
|
9978
|
-
*
|
|
10038
|
+
* minute -> the hour (a 15min bucket starts at :00/:15/:30/:45)
|
|
10039
|
+
* hour -> local midnight (a 6h bucket starts at 00/06/12/18)
|
|
10040
|
+
* day -> 1970-01-01 (count=1 is the plain day; a 10-day
|
|
10041
|
+
* bucket has no calendar origin to
|
|
10042
|
+
* align to, so it aligns to the epoch)
|
|
10043
|
+
* week -> the epoch week, Monday-first (ISO)
|
|
10044
|
+
* month -> January (which is why 2/3/4/6/12 give calendar
|
|
10045
|
+
* bimesters, quarters and semesters)
|
|
10046
|
+
* year -> year 0 (a decade starts at 2020, not 2021)
|
|
10047
|
+
***************************************************************/
|
|
10048
|
+
function period_start(period, anchor_ms) {
|
|
10049
|
+
let spec = period_spec(period);
|
|
10050
|
+
if (!spec) return null;
|
|
10051
|
+
let d = new Date(anchor_ms);
|
|
10052
|
+
let n = spec.count;
|
|
10053
|
+
switch (spec.unit) {
|
|
10054
|
+
case "minute": {
|
|
10055
|
+
let m = Math.floor(d.getMinutes() / n) * n;
|
|
10056
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), m);
|
|
10057
|
+
}
|
|
10058
|
+
case "hour": {
|
|
10059
|
+
let h = Math.floor(d.getHours() / n) * n;
|
|
10060
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), h);
|
|
10061
|
+
}
|
|
10062
|
+
case "day": return date_from_day_number(Math.floor(day_number(d) / n) * n);
|
|
10063
|
+
case "week": return date_from_day_number(Math.floor(week_index(d) / n) * n * 7 - 3);
|
|
10064
|
+
case "month": {
|
|
10065
|
+
let mi = d.getFullYear() * 12 + d.getMonth();
|
|
10066
|
+
let s = Math.floor(mi / n) * n;
|
|
10067
|
+
return new Date(Math.floor(s / 12), s % 12, 1);
|
|
10068
|
+
}
|
|
10069
|
+
case "year": {
|
|
10070
|
+
let y = Math.floor(d.getFullYear() / n) * n;
|
|
10071
|
+
return new Date(y, 0, 1);
|
|
10072
|
+
}
|
|
10073
|
+
default: return null;
|
|
10074
|
+
}
|
|
10075
|
+
}
|
|
10076
|
+
/***************************************************************
|
|
10077
|
+
* The start of the bucket `delta` buckets away (delta may be negative).
|
|
10078
|
+
* Calendar arithmetic, never millisecond arithmetic: `new Date(y, m+3, 1)`
|
|
10079
|
+
* overflows the year by itself, and stepping a day across a DST change
|
|
10080
|
+
* keeps landing on midnight.
|
|
10081
|
+
***************************************************************/
|
|
10082
|
+
function period_shift(period, anchor_ms, delta) {
|
|
10083
|
+
let spec = period_spec(period);
|
|
10084
|
+
if (!spec) return anchor_ms;
|
|
10085
|
+
let s = period_start(spec, anchor_ms);
|
|
10086
|
+
let step = spec.count * (delta || 0);
|
|
10087
|
+
switch (spec.unit) {
|
|
10088
|
+
case "minute": return new Date(s.getFullYear(), s.getMonth(), s.getDate(), s.getHours(), s.getMinutes() + step).getTime();
|
|
10089
|
+
case "hour": return new Date(s.getFullYear(), s.getMonth(), s.getDate(), s.getHours() + step).getTime();
|
|
10090
|
+
case "day": return new Date(s.getFullYear(), s.getMonth(), s.getDate() + step).getTime();
|
|
10091
|
+
case "week": return new Date(s.getFullYear(), s.getMonth(), s.getDate() + step * 7).getTime();
|
|
10092
|
+
case "month": return new Date(s.getFullYear(), s.getMonth() + step, 1).getTime();
|
|
10093
|
+
case "year": return new Date(s.getFullYear() + step, 0, 1).getTime();
|
|
10094
|
+
default: return anchor_ms;
|
|
10095
|
+
}
|
|
10096
|
+
}
|
|
10097
|
+
/***************************************************************
|
|
10098
|
+
* The bucket holding `anchor_ms`, as {from, to} in MILLISECONDS.
|
|
9979
10099
|
*
|
|
9980
|
-
*
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
10100
|
+
* `to` is INCLUSIVE — the last millisecond of the bucket, not the first
|
|
10101
|
+
* of the next one. Both ends of a match condition are inclusive, and an
|
|
10102
|
+
* exclusive end handed to one silently swallows the record that landed
|
|
10103
|
+
* exactly on the boundary.
|
|
10104
|
+
***************************************************************/
|
|
10105
|
+
function period_bounds(period, anchor_ms) {
|
|
10106
|
+
let spec = period_spec(period);
|
|
10107
|
+
if (!spec) return {
|
|
10108
|
+
from: 0,
|
|
10109
|
+
to: 0
|
|
10110
|
+
};
|
|
10111
|
+
return {
|
|
10112
|
+
from: period_start(spec, anchor_ms).getTime(),
|
|
10113
|
+
to: period_shift(spec, anchor_ms, 1) - 1
|
|
9987
10114
|
};
|
|
9988
|
-
let kind_a = kind_of(doc_a);
|
|
9989
|
-
if (kind_a === "scalar" || kind_a !== kind_of(doc_b)) {
|
|
9990
|
-
if (JSON.stringify(doc_a) === JSON.stringify(doc_b)) return [];
|
|
9991
|
-
return [{
|
|
9992
|
-
id: "",
|
|
9993
|
-
kind: "changed",
|
|
9994
|
-
from: doc_a,
|
|
9995
|
-
to: doc_b
|
|
9996
|
-
}];
|
|
9997
|
-
}
|
|
9998
|
-
let diff = flat_diff(json2flat(doc_a), json2flat(doc_b));
|
|
9999
|
-
let rows = [];
|
|
10000
|
-
for (const id of Object.keys(diff.added)) rows.push({
|
|
10001
|
-
id,
|
|
10002
|
-
kind: "added",
|
|
10003
|
-
to: diff.added[id]
|
|
10004
|
-
});
|
|
10005
|
-
for (const id of Object.keys(diff.removed)) rows.push({
|
|
10006
|
-
id,
|
|
10007
|
-
kind: "removed",
|
|
10008
|
-
from: diff.removed[id]
|
|
10009
|
-
});
|
|
10010
|
-
for (const id of Object.keys(diff.changed)) rows.push({
|
|
10011
|
-
id,
|
|
10012
|
-
kind: "changed",
|
|
10013
|
-
from: diff.changed[id].from,
|
|
10014
|
-
to: diff.changed[id].to
|
|
10015
|
-
});
|
|
10016
|
-
const collator = new Intl.Collator("en", { numeric: true });
|
|
10017
|
-
rows.sort((x, y) => collator.compare(x.id, y.id));
|
|
10018
|
-
return rows;
|
|
10019
10115
|
}
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
*
|
|
10116
|
+
/***************************************************************
|
|
10117
|
+
* The same bucket, in the unit the CONSUMER speaks (a tranger topic
|
|
10118
|
+
* keeps its timestamps in seconds, unless its system_flag says
|
|
10119
|
+
* milliseconds). This is the function a query builder calls.
|
|
10120
|
+
***************************************************************/
|
|
10121
|
+
function period_bounds_epoch(period, anchor_ms, ms) {
|
|
10122
|
+
let b = period_bounds(period, anchor_ms);
|
|
10123
|
+
if (!b.from) return {
|
|
10124
|
+
from: 0,
|
|
10125
|
+
to: 0
|
|
10126
|
+
};
|
|
10127
|
+
return {
|
|
10128
|
+
from: ms_to_epoch(b.from, ms),
|
|
10129
|
+
to: ms_to_epoch(b.to, ms)
|
|
10130
|
+
};
|
|
10131
|
+
}
|
|
10132
|
+
/***************************************************************
|
|
10133
|
+
* A ROLLING window: `secs` back from now. Not a bucket — it has no
|
|
10134
|
+
* previous and no next, it just ends at `now`.
|
|
10024
10135
|
*
|
|
10025
|
-
*
|
|
10026
|
-
*
|
|
10027
|
-
*
|
|
10028
|
-
|
|
10136
|
+
* The `to` end is left OPEN (0). An iterator with no upper bound keeps
|
|
10137
|
+
* matching the records that land while the card is on screen; pinning
|
|
10138
|
+
* it to "now" would freeze the window at the instant the user clicked.
|
|
10139
|
+
***************************************************************/
|
|
10140
|
+
function rolling_bounds(rolling, ms, now_ms) {
|
|
10141
|
+
let r = typeof rolling === "string" ? YUI_ROLLING[rolling] : rolling;
|
|
10142
|
+
if (!r || !r.secs) return {
|
|
10143
|
+
from: 0,
|
|
10144
|
+
to: 0
|
|
10145
|
+
};
|
|
10146
|
+
return {
|
|
10147
|
+
from: ms_to_epoch((now_ms === void 0 ? Date.now() : now_ms) - r.secs * 1e3, ms),
|
|
10148
|
+
to: 0
|
|
10149
|
+
};
|
|
10150
|
+
}
|
|
10151
|
+
/***************************************************************
|
|
10152
|
+
* Is this the LAST bucket — the one `now` falls in? It is what greys
|
|
10153
|
+
* out the "next" arrow, and what tells the navigator it is already home.
|
|
10154
|
+
***************************************************************/
|
|
10155
|
+
function is_current_period(period, anchor_ms, now_ms) {
|
|
10156
|
+
let spec = period_spec(period);
|
|
10157
|
+
if (!spec) return false;
|
|
10158
|
+
let now = now_ms === void 0 ? Date.now() : now_ms;
|
|
10159
|
+
let a = period_start(spec, anchor_ms);
|
|
10160
|
+
let b = period_start(spec, now);
|
|
10161
|
+
return !!a && !!b && a.getTime() === b.getTime();
|
|
10162
|
+
}
|
|
10163
|
+
/***************************************************************
|
|
10164
|
+
* Recognize the bucket a {from, to} pair came from, so a range that
|
|
10165
|
+
* travelled through a URL, a saved view or a backend answer comes back
|
|
10166
|
+
* as the period the user picked instead of as a hand-typed range.
|
|
10029
10167
|
*
|
|
10030
|
-
*
|
|
10031
|
-
*
|
|
10032
|
-
*
|
|
10168
|
+
* `from`/`to` are in the CONSUMER's unit (`ms`), and so is the
|
|
10169
|
+
* comparison — that is the whole trap: a bucket ends on the last
|
|
10170
|
+
* MILLISECOND (…23:59:59.999), and a consumer that keeps seconds stored
|
|
10171
|
+
* it truncated (…23:59:59). Comparing in milliseconds, a week saved by a
|
|
10172
|
+
* seconds-based topic came back as "no bucket at all", every time.
|
|
10033
10173
|
*
|
|
10034
|
-
*
|
|
10035
|
-
*
|
|
10036
|
-
*
|
|
10037
|
-
*
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10174
|
+
* Only an EXACT match counts: both ends must land on the bucket's own
|
|
10175
|
+
* boundaries, as that consumer would have written them. `candidates` are
|
|
10176
|
+
* ids/specs, tried in order. Returns {period, anchor} (anchor in ms) or
|
|
10177
|
+
* null.
|
|
10178
|
+
***************************************************************/
|
|
10179
|
+
function infer_period(from, to, candidates, ms) {
|
|
10180
|
+
if (!from || !to || to <= from) return null;
|
|
10181
|
+
let from_ms = epoch_to_ms(from, ms);
|
|
10182
|
+
for (let candidate of candidates || Object.keys(YUI_PERIODS)) {
|
|
10183
|
+
let spec = period_spec(candidate);
|
|
10184
|
+
if (!spec) continue;
|
|
10185
|
+
let b = period_bounds_epoch(spec, from_ms, ms);
|
|
10186
|
+
if (b.from === from && b.to === to) return {
|
|
10187
|
+
period: spec,
|
|
10188
|
+
anchor: from_ms
|
|
10189
|
+
};
|
|
10190
|
+
}
|
|
10191
|
+
return null;
|
|
10192
|
+
}
|
|
10193
|
+
/***************************
|
|
10194
|
+
* Period labels
|
|
10195
|
+
***************************/
|
|
10196
|
+
/***************************************************************
|
|
10197
|
+
* The name of a GRANULARITY (what the segmented control shows):
|
|
10198
|
+
* the spec's own id as an i18n key, so an app that declares
|
|
10199
|
+
* {id: "quarter"} gets "Trimestre" the moment it adds the key.
|
|
10200
|
+
***************************************************************/
|
|
10201
|
+
function period_name(period, t) {
|
|
10202
|
+
let spec = period_spec(period);
|
|
10203
|
+
if (!spec) return tr(t, String(period && period.id || period || ""));
|
|
10204
|
+
return tr(t, spec.id);
|
|
10205
|
+
}
|
|
10206
|
+
/***************************************************************
|
|
10207
|
+
* The name of the bucket a navigator is PARKED on: what goes between
|
|
10208
|
+
* the two arrows.
|
|
10048
10209
|
*
|
|
10049
|
-
*
|
|
10050
|
-
*
|
|
10051
|
-
*
|
|
10052
|
-
*
|
|
10053
|
-
*
|
|
10054
|
-
*
|
|
10210
|
+
* day -> "Today" / "Yesterday" / "13 jul 2026"
|
|
10211
|
+
* week -> "Week 27" (+ year when it is not this one)
|
|
10212
|
+
* month -> "July" (+ year when it is not this one)
|
|
10213
|
+
* quarter -> "Q3 2026" (unit month, count 3)
|
|
10214
|
+
* semester -> "H2 2026" (unit month, count 6)
|
|
10215
|
+
* year -> "2026"
|
|
10216
|
+
* decade -> "2020 – 2029"
|
|
10217
|
+
* any other -> the bucket's own edges: "1 jul – 31 aug 2026"
|
|
10055
10218
|
*
|
|
10056
|
-
*
|
|
10057
|
-
*
|
|
10058
|
-
|
|
10219
|
+
* The named ones are named because a range reads worse than a name;
|
|
10220
|
+
* everything an app invents falls back to the range, which is always
|
|
10221
|
+
* true and never wrong.
|
|
10222
|
+
***************************************************************/
|
|
10223
|
+
function period_label(period, anchor_ms, t, locale) {
|
|
10224
|
+
let spec = period_spec(period);
|
|
10225
|
+
if (!spec) return "";
|
|
10226
|
+
let loc = safe_locale(locale);
|
|
10227
|
+
let start = period_start(spec, anchor_ms);
|
|
10228
|
+
let end = new Date(period_bounds(spec, anchor_ms).to);
|
|
10229
|
+
let now = /* @__PURE__ */ new Date();
|
|
10230
|
+
let this_year = start.getFullYear() === now.getFullYear();
|
|
10231
|
+
if (spec.unit === "day" && spec.count === 1) {
|
|
10232
|
+
let diff = day_number(start) - day_number(now);
|
|
10233
|
+
if (diff === 0) return tr(t, "today");
|
|
10234
|
+
if (diff === -1) return tr(t, "yesterday");
|
|
10235
|
+
if (diff === 1) return tr(t, "tomorrow");
|
|
10236
|
+
return fmt_intl(start, loc, this_year ? {
|
|
10237
|
+
day: "numeric",
|
|
10238
|
+
month: "short"
|
|
10239
|
+
} : {
|
|
10240
|
+
day: "numeric",
|
|
10241
|
+
month: "short",
|
|
10242
|
+
year: "numeric"
|
|
10243
|
+
});
|
|
10244
|
+
}
|
|
10245
|
+
if (spec.unit === "hour" && spec.count === 1) {
|
|
10246
|
+
let hh = fmt_intl(start, loc, {
|
|
10247
|
+
hour: "2-digit",
|
|
10248
|
+
minute: "2-digit"
|
|
10249
|
+
});
|
|
10250
|
+
if (day_number(start) === day_number(now)) return hh;
|
|
10251
|
+
return `${hh} · ${fmt_intl(start, loc, {
|
|
10252
|
+
day: "numeric",
|
|
10253
|
+
month: "short"
|
|
10254
|
+
})}`;
|
|
10255
|
+
}
|
|
10256
|
+
if (spec.unit === "week" && spec.count === 1) {
|
|
10257
|
+
let away = week_index(start) - week_index(now);
|
|
10258
|
+
if (away === 0) return tr(t, "this week");
|
|
10259
|
+
if (away === -1) return tr(t, "last week");
|
|
10260
|
+
let w = iso_week(start);
|
|
10261
|
+
return w.year === now.getFullYear() ? tr(t, "week {{n}}", { n: w.week }) : tr(t, "week {{n}} {{y}}", {
|
|
10262
|
+
n: w.week,
|
|
10263
|
+
y: w.year
|
|
10264
|
+
});
|
|
10265
|
+
}
|
|
10266
|
+
if (spec.unit === "month" && spec.count === 1) return fmt_intl(start, loc, this_year ? { month: "long" } : {
|
|
10267
|
+
month: "long",
|
|
10268
|
+
year: "numeric"
|
|
10269
|
+
});
|
|
10270
|
+
if (spec.unit === "month" && (spec.count === 3 || spec.count === 6)) {
|
|
10271
|
+
let n = Math.floor(start.getMonth() / spec.count) + 1;
|
|
10272
|
+
return tr(t, spec.count === 3 ? "quarter {{n}} {{y}}" : "semester {{n}} {{y}}", {
|
|
10273
|
+
n,
|
|
10274
|
+
y: start.getFullYear()
|
|
10275
|
+
});
|
|
10276
|
+
}
|
|
10277
|
+
if (spec.unit === "year") {
|
|
10278
|
+
if (spec.count === 1) return String(start.getFullYear());
|
|
10279
|
+
return `${start.getFullYear()} – ${end.getFullYear()}`;
|
|
10280
|
+
}
|
|
10281
|
+
let opts = spec.unit === "minute" || spec.unit === "hour" ? {
|
|
10282
|
+
day: "numeric",
|
|
10283
|
+
month: "short",
|
|
10284
|
+
hour: "2-digit",
|
|
10285
|
+
minute: "2-digit"
|
|
10286
|
+
} : {
|
|
10287
|
+
day: "numeric",
|
|
10288
|
+
month: "short"
|
|
10289
|
+
};
|
|
10290
|
+
if (start.getFullYear() !== end.getFullYear()) {
|
|
10291
|
+
let y_opts = Object.assign({ year: "numeric" }, opts);
|
|
10292
|
+
return `${fmt_intl(start, loc, y_opts)} – ${fmt_intl(end, loc, y_opts)}`;
|
|
10293
|
+
}
|
|
10294
|
+
let span = `${fmt_intl(start, loc, opts)} – ${fmt_intl(end, loc, opts)}`;
|
|
10295
|
+
return this_year ? span : `${span} ${start.getFullYear()}`;
|
|
10296
|
+
}
|
|
10059
10297
|
/************************************************************
|
|
10060
|
-
*
|
|
10061
|
-
* WITH seconds: the input is built with `step: 1`, which is what
|
|
10062
|
-
* lets it hold them. Written as "YYYY-MM-DDTHH:mm" it lost them on
|
|
10063
|
-
* every save of any field.
|
|
10298
|
+
* JSON type discriminator (viewer vocabulary)
|
|
10064
10299
|
************************************************************/
|
|
10065
|
-
function
|
|
10066
|
-
if (
|
|
10067
|
-
|
|
10068
|
-
|
|
10300
|
+
function json_type(value) {
|
|
10301
|
+
if (value === null) return "null";
|
|
10302
|
+
if (Array.isArray(value)) return "array";
|
|
10303
|
+
switch (typeof value) {
|
|
10304
|
+
case "string": return "string";
|
|
10305
|
+
case "number": return "number";
|
|
10306
|
+
case "boolean": return "boolean";
|
|
10307
|
+
case "object": return "object";
|
|
10308
|
+
default: return "unknown";
|
|
10309
|
+
}
|
|
10069
10310
|
}
|
|
10070
10311
|
/************************************************************
|
|
10071
|
-
*
|
|
10312
|
+
* Detect a kw_collapse() sentinel.
|
|
10313
|
+
*
|
|
10314
|
+
* The kernel replaces an over-limit dict with:
|
|
10315
|
+
* { "__collapsed__": { "path": ..., "size": N } }
|
|
10316
|
+
* and an over-limit array with:
|
|
10317
|
+
* [ { "__collapsed__": { "path": ..., "size": N } } ]
|
|
10318
|
+
*
|
|
10319
|
+
* Returns { size, path, is_array } or null.
|
|
10072
10320
|
************************************************************/
|
|
10073
|
-
function
|
|
10074
|
-
if (!value)
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10321
|
+
function is_collapsed(value) {
|
|
10322
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
10323
|
+
let keys = Object.keys(value);
|
|
10324
|
+
if (keys.length === 1 && keys[0] === "__collapsed__") {
|
|
10325
|
+
let c = value.__collapsed__ || {};
|
|
10326
|
+
return {
|
|
10327
|
+
size: c.size,
|
|
10328
|
+
path: c.path,
|
|
10329
|
+
is_array: false
|
|
10330
|
+
};
|
|
10331
|
+
}
|
|
10332
|
+
return null;
|
|
10333
|
+
}
|
|
10334
|
+
if (Array.isArray(value) && value.length === 1) {
|
|
10335
|
+
let e = value[0];
|
|
10336
|
+
if (e && typeof e === "object" && !Array.isArray(e) && Object.keys(e).length === 1 && e.__collapsed__) {
|
|
10337
|
+
let c = e.__collapsed__ || {};
|
|
10338
|
+
return {
|
|
10339
|
+
size: c.size,
|
|
10340
|
+
path: c.path,
|
|
10341
|
+
is_array: true
|
|
10342
|
+
};
|
|
10343
|
+
}
|
|
10344
|
+
}
|
|
10345
|
+
return null;
|
|
10078
10346
|
}
|
|
10079
10347
|
/************************************************************
|
|
10080
|
-
*
|
|
10081
|
-
* none. A `string` column holds an ISO text, any other an epoch
|
|
10082
|
-
* in SECONDS. The form's time field and the cell editor of a
|
|
10083
|
-
* table read it here, so the two agree: up to gobj-ui 7.26.46 the
|
|
10084
|
-
* field read every column with parseInt -- an ISO text as the
|
|
10085
|
-
* year 2026 in SECONDS, in January 1970 -- and showed an empty
|
|
10086
|
-
* one as January 1970 too, which a save then wrote back as 0.
|
|
10348
|
+
* Join / split absolute path segments (kernel convention)
|
|
10087
10349
|
************************************************************/
|
|
10088
|
-
function
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10350
|
+
function seg_join(segments) {
|
|
10351
|
+
return segments.map(function(s) {
|
|
10352
|
+
return String(s);
|
|
10353
|
+
}).join("`");
|
|
10354
|
+
}
|
|
10355
|
+
function seg_split(path) {
|
|
10356
|
+
if (path === "" || path === null || path === void 0) return [];
|
|
10357
|
+
return path.split("`");
|
|
10092
10358
|
}
|
|
10093
10359
|
/************************************************************
|
|
10094
|
-
*
|
|
10095
|
-
*
|
|
10096
|
-
* other. Up to gobj-ui 7.26.46 the field wrote the epoch into a
|
|
10097
|
-
* `string` column too.
|
|
10360
|
+
* Walk a JSON tree by absolute segments; undefined if the
|
|
10361
|
+
* path does not resolve.
|
|
10098
10362
|
************************************************************/
|
|
10099
|
-
function
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10363
|
+
function get_by_segments(root, segments) {
|
|
10364
|
+
let v = root;
|
|
10365
|
+
for (let seg of segments) {
|
|
10366
|
+
if (v === null || v === void 0) return;
|
|
10367
|
+
if (Array.isArray(v)) v = v[Number(seg)];
|
|
10368
|
+
else if (typeof v === "object") v = v[seg];
|
|
10369
|
+
else return;
|
|
10370
|
+
}
|
|
10371
|
+
return v;
|
|
10104
10372
|
}
|
|
10105
10373
|
/************************************************************
|
|
10106
|
-
*
|
|
10107
|
-
*
|
|
10108
|
-
*
|
|
10109
|
-
*
|
|
10110
|
-
*
|
|
10374
|
+
* Set a value at absolute segments (mutates root).
|
|
10375
|
+
*
|
|
10376
|
+
* segments == [] means "replace the whole root" — the caller
|
|
10377
|
+
* must use the RETURNED value in that case (a primitive/array
|
|
10378
|
+
* root cannot be mutated in place).
|
|
10111
10379
|
************************************************************/
|
|
10112
|
-
function
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10380
|
+
function set_by_segments(root, segments, new_value) {
|
|
10381
|
+
if (segments.length === 0) return new_value;
|
|
10382
|
+
let parent = get_by_segments(root, segments.slice(0, -1));
|
|
10383
|
+
if (parent === null || parent === void 0 || typeof parent !== "object") return root;
|
|
10384
|
+
let last = segments[segments.length - 1];
|
|
10385
|
+
if (Array.isArray(parent)) parent[Number(last)] = new_value;
|
|
10386
|
+
else parent[last] = new_value;
|
|
10387
|
+
return root;
|
|
10116
10388
|
}
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
*
|
|
10121
|
-
*
|
|
10122
|
-
*
|
|
10389
|
+
/************************************************************
|
|
10390
|
+
* Does `value` (or any loaded descendant / its own key)
|
|
10391
|
+
* contain the lower-cased search term?
|
|
10392
|
+
*
|
|
10393
|
+
* Collapsed (not-yet-loaded) subtrees can't be searched, so
|
|
10394
|
+
* they never match on content — only their key can match,
|
|
10395
|
+
* which the renderer checks separately.
|
|
10396
|
+
************************************************************/
|
|
10397
|
+
function subtree_matches(value, term) {
|
|
10398
|
+
if (!term) return true;
|
|
10399
|
+
if (is_collapsed(value)) return false;
|
|
10400
|
+
let type = json_type(value);
|
|
10401
|
+
if (type === "object") {
|
|
10402
|
+
for (let [k, v] of Object.entries(value)) {
|
|
10403
|
+
if (String(k).toLowerCase().includes(term)) return true;
|
|
10404
|
+
if (subtree_matches(v, term)) return true;
|
|
10405
|
+
}
|
|
10406
|
+
return false;
|
|
10407
|
+
}
|
|
10408
|
+
if (type === "array") {
|
|
10409
|
+
for (let v of value) if (subtree_matches(v, term)) return true;
|
|
10410
|
+
return false;
|
|
10411
|
+
}
|
|
10412
|
+
return String(value).toLowerCase().includes(term);
|
|
10413
|
+
}
|
|
10414
|
+
/************************************************************
|
|
10415
|
+
* Fields whose numeric value is an epoch timestamp.
|
|
10416
|
+
*
|
|
10417
|
+
* THE ONE LIST. C_YUI_FORM's jsoneditor takes its
|
|
10418
|
+
* `timestampTag` from here: it used to carry its own copy,
|
|
10419
|
+
* and a copy is how the two stopped agreeing.
|
|
10420
|
+
*
|
|
10421
|
+
* TWO SPELLINGS, AND LAS DOS SON DEL BACKEND. timeranger2
|
|
10422
|
+
* writes `from_t`/`from_tm` in the match_cond of a query and
|
|
10423
|
+
* `fr_t`/`fr_tm` in the metadata of a topic and of a file --
|
|
10424
|
+
* which is what a Raw JSON of a treedb actually shows. With
|
|
10425
|
+
* only the long pair listed, `to_t` got its date and the
|
|
10426
|
+
* `fr_t` right above it did not, which reads as a broken
|
|
10427
|
+
* annotator rather than a missing name.
|
|
10428
|
+
************************************************************/
|
|
10429
|
+
var TIME_FIELDS = [
|
|
10430
|
+
"__t__",
|
|
10431
|
+
"__tm__",
|
|
10432
|
+
"t",
|
|
10433
|
+
"tm",
|
|
10434
|
+
"time",
|
|
10435
|
+
"from_t",
|
|
10436
|
+
"to_t",
|
|
10437
|
+
"from_tm",
|
|
10438
|
+
"to_tm",
|
|
10439
|
+
"fr_t",
|
|
10440
|
+
"fr_tm",
|
|
10441
|
+
"t_input",
|
|
10442
|
+
"t_output"
|
|
10443
|
+
];
|
|
10444
|
+
function is_time_field(field) {
|
|
10445
|
+
return TIME_FIELDS.indexOf(field) >= 0;
|
|
10446
|
+
}
|
|
10447
|
+
/************************************************************
|
|
10448
|
+
* Format an epoch value as a local wall-clock string, 24
|
|
10449
|
+
* hours, in the APP's language `locale` (fmt_date_time() of
|
|
10450
|
+
* yui_time.js, as the time cells of the forms and tables;
|
|
10451
|
+
* up to gobj-ui 7.26.51 it was toLocaleString(): the
|
|
10452
|
+
* browser's language, and 12 hours in English).
|
|
10453
|
+
* Accepts seconds or milliseconds; returns null when the
|
|
10454
|
+
* value is not a usable positive timestamp (0 == "unset").
|
|
10455
|
+
************************************************************/
|
|
10456
|
+
function format_epoch(value, locale) {
|
|
10457
|
+
if (typeof value !== "number" || !isFinite(value) || value <= 0) return null;
|
|
10458
|
+
let ms = Math.abs(value) < 0xe8d4a51000 ? value * 1e3 : value;
|
|
10459
|
+
let d = new Date(ms);
|
|
10460
|
+
if (isNaN(d.getTime())) return null;
|
|
10461
|
+
return fmt_date_time(d, locale);
|
|
10462
|
+
}
|
|
10463
|
+
/************************************************************
|
|
10464
|
+
* The text view's payload: the document as text, indented
|
|
10465
|
+
* four characters, cut at `max_chars`.
|
|
10466
|
+
*
|
|
10467
|
+
* Returns {text, capped}. `capped` is what the caller
|
|
10468
|
+
* announces under the dump — a cut that is not announced
|
|
10469
|
+
* reads as a document that ends there.
|
|
10470
|
+
************************************************************/
|
|
10471
|
+
function json_text_dump(root, max_chars) {
|
|
10472
|
+
let text;
|
|
10473
|
+
try {
|
|
10474
|
+
text = JSON.stringify(root, null, 4);
|
|
10475
|
+
} catch (e) {
|
|
10476
|
+
return {
|
|
10477
|
+
text: "",
|
|
10478
|
+
capped: false,
|
|
10479
|
+
error: String(e)
|
|
10480
|
+
};
|
|
10481
|
+
}
|
|
10482
|
+
if (text === void 0) return {
|
|
10483
|
+
text: "",
|
|
10484
|
+
capped: false,
|
|
10485
|
+
error: "not representable as JSON"
|
|
10486
|
+
};
|
|
10487
|
+
if (typeof max_chars === "number" && max_chars > 0 && text.length > max_chars) return {
|
|
10488
|
+
text: text.slice(0, max_chars),
|
|
10489
|
+
capped: true
|
|
10490
|
+
};
|
|
10491
|
+
return {
|
|
10492
|
+
text,
|
|
10493
|
+
capped: false
|
|
10494
|
+
};
|
|
10495
|
+
}
|
|
10496
|
+
/************************************************************
|
|
10497
|
+
* Which view a freshly mounted viewer opens on.
|
|
10498
|
+
*
|
|
10499
|
+
* Three answers, in order of authority: what the HOST asked
|
|
10500
|
+
* for, what the READER chose last time, and `fallback`.
|
|
10501
|
+
*
|
|
10502
|
+
* The host wins because a viewer mounted to show a graph has
|
|
10503
|
+
* to show one. The memory comes next, because reopening a
|
|
10504
|
+
* document in the view you just left is the whole point of
|
|
10505
|
+
* remembering it. `fallback` is the floor.
|
|
10506
|
+
*
|
|
10507
|
+
* Anything not in `modes` is treated as unsaid, which covers
|
|
10508
|
+
* an absent value, an empty one, and a stored string from an
|
|
10509
|
+
* older release that named a view no longer offered.
|
|
10510
|
+
************************************************************/
|
|
10511
|
+
function pick_view_mode(asked, remembered, modes, fallback) {
|
|
10512
|
+
let known = (m) => Array.isArray(modes) && modes.indexOf(m) >= 0;
|
|
10513
|
+
if (known(asked)) return asked;
|
|
10514
|
+
if (known(remembered)) return remembered;
|
|
10515
|
+
return fallback;
|
|
10516
|
+
}
|
|
10517
|
+
/************************************************************
|
|
10518
|
+
* The short label a container row carries beside its size.
|
|
10519
|
+
*
|
|
10520
|
+
* An array of dicts that carry an `id` is a list of RECORDS,
|
|
10521
|
+
* and a row that says only `2: {15}` makes you open all
|
|
10522
|
+
* fifteen fields of every one of them to find out WHICH
|
|
10523
|
+
* record it is. The id is the one field that answers that,
|
|
10524
|
+
* so the row says it without being opened.
|
|
10525
|
+
*
|
|
10526
|
+
* Only a SCALAR id, and only when it is really there: an `id`
|
|
10527
|
+
* that is itself a dict or a list is not a name, it is more
|
|
10528
|
+
* document, and printing `[object Object]` beside the size
|
|
10529
|
+
* would be worse than printing nothing.
|
|
10530
|
+
*
|
|
10531
|
+
* Cut at `max_chars`, because this rides on a row whose job
|
|
10532
|
+
* is to stay one line.
|
|
10533
|
+
************************************************************/
|
|
10534
|
+
function container_label(value, max_chars) {
|
|
10535
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return "";
|
|
10536
|
+
if (!Object.prototype.hasOwnProperty.call(value, "id")) return "";
|
|
10537
|
+
let id = value.id;
|
|
10538
|
+
let t = typeof id;
|
|
10539
|
+
if (t !== "string" && t !== "number" && t !== "boolean") return "";
|
|
10540
|
+
let text = String(id).trim();
|
|
10541
|
+
if (text === "") return "";
|
|
10542
|
+
let cap = typeof max_chars === "number" && max_chars > 0 ? max_chars : 0;
|
|
10543
|
+
if (cap && text.length > cap) return text.slice(0, cap) + "…";
|
|
10544
|
+
return text;
|
|
10545
|
+
}
|
|
10546
|
+
/************************************************************
|
|
10547
|
+
* A dict, in the JSON sense: not an array and not null.
|
|
10548
|
+
************************************************************/
|
|
10549
|
+
function is_plain_object(v) {
|
|
10550
|
+
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
10551
|
+
}
|
|
10552
|
+
/************************************************************
|
|
10553
|
+
* Does this container hold ONLY other containers?
|
|
10554
|
+
*
|
|
10555
|
+
* Such a value is not a thing, it is a LIST of things -- and a
|
|
10556
|
+
* list is fully described by the row that names it in its
|
|
10557
|
+
* parent, plus the edges to what it holds. Drawing it as a
|
|
10558
|
+
* card of its own put a node in the middle of the graph with no
|
|
10559
|
+
* data in it, saying nothing the parent's row did not already
|
|
10560
|
+
* say, and pushed everything below it one level down.
|
|
10561
|
+
*
|
|
10562
|
+
* An EMPTY container inside counts as content: `{0}` is
|
|
10563
|
+
* something the card has to show, and there is no child card
|
|
10564
|
+
* to show it instead.
|
|
10565
|
+
************************************************************/
|
|
10566
|
+
function is_pure_collection(value) {
|
|
10567
|
+
let entries = is_plain_object(value) ? Object.entries(value) : Array.isArray(value) ? value.map((v, i) => [i, v]) : [];
|
|
10568
|
+
if (entries.length === 0) return false;
|
|
10569
|
+
for (let [, v] of entries) if (!has_branch(v)) return false;
|
|
10570
|
+
return true;
|
|
10571
|
+
}
|
|
10572
|
+
/************************************************************
|
|
10573
|
+
* A value that gets a card, or children, of its own.
|
|
10574
|
+
************************************************************/
|
|
10575
|
+
function has_branch(value) {
|
|
10576
|
+
return is_plain_object(value) && Object.keys(value).length > 0 || Array.isArray(value) && value.length > 0;
|
|
10577
|
+
}
|
|
10578
|
+
/************************************************************
|
|
10579
|
+
* How many branches a container has, which is what the fold
|
|
10580
|
+
* chip counts.
|
|
10581
|
+
************************************************************/
|
|
10582
|
+
function count_branches(value) {
|
|
10583
|
+
let entries = is_plain_object(value) ? Object.values(value) : Array.isArray(value) ? value : [];
|
|
10584
|
+
let n = 0;
|
|
10585
|
+
for (let v of entries) if (has_branch(v)) n++;
|
|
10586
|
+
return n;
|
|
10587
|
+
}
|
|
10588
|
+
/************************************************************
|
|
10589
|
+
* What differs between two documents: one row per id of
|
|
10590
|
+
* their flat form (json2flat), sorted by id in natural order,
|
|
10591
|
+
* so `[2]` comes before `[10]`:
|
|
10592
|
+
*
|
|
10593
|
+
* [{id, kind: "added"|"removed"|"changed", from?, to?}]
|
|
10594
|
+
*
|
|
10595
|
+
* `from` is the first document's value and `to` the second's:
|
|
10596
|
+
* an added row has no `from`, a removed row no `to`.
|
|
10597
|
+
*
|
|
10598
|
+
* Two roots that are not containers of the same kind have no
|
|
10599
|
+
* ids in common to compare by: they are one value each, and
|
|
10600
|
+
* the row that says they differ has the empty id.
|
|
10601
|
+
*
|
|
10602
|
+
* Throws what json2flat throws (a document too deep).
|
|
10603
|
+
************************************************************/
|
|
10604
|
+
function json_diff_rows(doc_a, doc_b) {
|
|
10605
|
+
const kind_of = (v) => {
|
|
10606
|
+
if (Array.isArray(v)) return "array";
|
|
10607
|
+
if (v !== null && typeof v === "object") return "object";
|
|
10608
|
+
return "scalar";
|
|
10609
|
+
};
|
|
10610
|
+
let kind_a = kind_of(doc_a);
|
|
10611
|
+
if (kind_a === "scalar" || kind_a !== kind_of(doc_b)) {
|
|
10612
|
+
if (JSON.stringify(doc_a) === JSON.stringify(doc_b)) return [];
|
|
10613
|
+
return [{
|
|
10614
|
+
id: "",
|
|
10615
|
+
kind: "changed",
|
|
10616
|
+
from: doc_a,
|
|
10617
|
+
to: doc_b
|
|
10618
|
+
}];
|
|
10619
|
+
}
|
|
10620
|
+
let diff = flat_diff(json2flat(doc_a), json2flat(doc_b));
|
|
10621
|
+
let rows = [];
|
|
10622
|
+
for (const id of Object.keys(diff.added)) rows.push({
|
|
10623
|
+
id,
|
|
10624
|
+
kind: "added",
|
|
10625
|
+
to: diff.added[id]
|
|
10626
|
+
});
|
|
10627
|
+
for (const id of Object.keys(diff.removed)) rows.push({
|
|
10628
|
+
id,
|
|
10629
|
+
kind: "removed",
|
|
10630
|
+
from: diff.removed[id]
|
|
10631
|
+
});
|
|
10632
|
+
for (const id of Object.keys(diff.changed)) rows.push({
|
|
10633
|
+
id,
|
|
10634
|
+
kind: "changed",
|
|
10635
|
+
from: diff.changed[id].from,
|
|
10636
|
+
to: diff.changed[id].to
|
|
10637
|
+
});
|
|
10638
|
+
const collator = new Intl.Collator("en", { numeric: true });
|
|
10639
|
+
rows.sort((x, y) => collator.compare(x.id, y.id));
|
|
10640
|
+
return rows;
|
|
10641
|
+
}
|
|
10642
|
+
//#endregion
|
|
10643
|
+
//#region src/form_time_value.js
|
|
10644
|
+
/****************************************************************************
|
|
10645
|
+
* form_time_value.js
|
|
10646
|
+
*
|
|
10647
|
+
* A treedb `time` / `now` column is an epoch in SECONDS, and a form
|
|
10648
|
+
* shows it in a `datetime-local` input. These two convert between
|
|
10649
|
+
* them, and they must be each other's inverse: a writable time
|
|
10650
|
+
* column travels back on EVERY save of the record.
|
|
10651
|
+
*
|
|
10652
|
+
* KNOWN LIMIT -- the change of hour. A `datetime-local` holds a
|
|
10653
|
+
* LOCAL WALL time and no offset, and a wall time is not always
|
|
10654
|
+
* one instant:
|
|
10655
|
+
*
|
|
10656
|
+
* - the night the clocks go back (autumn), one hour happens
|
|
10657
|
+
* twice. "02:30" names two instants an hour apart, and
|
|
10658
|
+
* `new Date("YYYY-MM-DDT02:30:00")` answers the EARLIER one
|
|
10659
|
+
* (ECMAScript's "compatible" disambiguation). An epoch in the
|
|
10660
|
+
* SECOND pass of that hour is shown as 02:30 and comes back
|
|
10661
|
+
* one hour earlier. So neither the form's field nor the cell
|
|
10662
|
+
* editor reads a box that still shows what it was filled
|
|
10663
|
+
* with: they give back the value it was filled from (up to
|
|
10664
|
+
* gobj-ui 7.26.48 the cell, and 7.26.50 the field, wrote
|
|
10665
|
+
* -3600 s on a save of any field of the record).
|
|
10666
|
+
* - the night the clocks go forward (spring), one hour does not
|
|
10667
|
+
* exist. No epoch is shown in it, so nothing read comes back
|
|
10668
|
+
* wrong; a wall time TYPED in it is moved forward by the
|
|
10669
|
+
* browser.
|
|
10670
|
+
*
|
|
10671
|
+
* Not fixable here without the offset, which the input cannot
|
|
10672
|
+
* carry. What is safe: a read-only time column never goes back
|
|
10673
|
+
* (treedb_write_plan.js, col_goes_back_to_treedb), and a time
|
|
10674
|
+
* pkey2 goes back as the record had it, never through this
|
|
10675
|
+
* widget (instance_keys_of). A wall time TYPED inside the
|
|
10676
|
+
* repeated hour is the exposed case: it is the first pass.
|
|
10677
|
+
*
|
|
10678
|
+
* Copyright (c) 2026, ArtGins.
|
|
10679
|
+
* All Rights Reserved.
|
|
10680
|
+
****************************************************************************/
|
|
10681
|
+
/************************************************************
|
|
10682
|
+
* A Date -> the value of a `datetime-local` input, in local time,
|
|
10683
|
+
* WITH seconds: the input is built with `step: 1`, which is what
|
|
10684
|
+
* lets it hold them. Written as "YYYY-MM-DDTHH:mm" it lost them on
|
|
10685
|
+
* every save of any field.
|
|
10686
|
+
************************************************************/
|
|
10687
|
+
function date_to_datetime_local(value) {
|
|
10688
|
+
if (!(value instanceof Date) || isNaN(value.getTime())) return "";
|
|
10689
|
+
let pad = (n) => String(n).padStart(2, "0");
|
|
10690
|
+
return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}T${pad(value.getHours())}:${pad(value.getMinutes())}:${pad(value.getSeconds())}`;
|
|
10691
|
+
}
|
|
10692
|
+
/************************************************************
|
|
10693
|
+
* The value of a `datetime-local` input -> epoch in seconds
|
|
10694
|
+
************************************************************/
|
|
10695
|
+
function datetime_local_to_epoch(value) {
|
|
10696
|
+
if (!value) return null;
|
|
10697
|
+
const date = new Date(value);
|
|
10698
|
+
if (isNaN(date.getTime())) return null;
|
|
10699
|
+
return Math.floor(date.getTime() / 1e3);
|
|
10700
|
+
}
|
|
10701
|
+
/************************************************************
|
|
10702
|
+
* The value of a time column -> a Date, or null when it holds
|
|
10703
|
+
* none. A `string` column holds an ISO text, any other an epoch
|
|
10704
|
+
* in SECONDS. The form's time field and the cell editor of a
|
|
10705
|
+
* table read it here, so the two agree: up to gobj-ui 7.26.46 the
|
|
10706
|
+
* field read every column with parseInt -- an ISO text as the
|
|
10707
|
+
* year 2026 in SECONDS, in January 1970 -- and showed an empty
|
|
10708
|
+
* one as January 1970 too, which a save then wrote back as 0.
|
|
10709
|
+
************************************************************/
|
|
10710
|
+
function time_value_to_date(value, real_type) {
|
|
10711
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
10712
|
+
let date = real_type === "string" ? new Date(String(value)) : /* @__PURE__ */ new Date(Number(value) * 1e3);
|
|
10713
|
+
return isNaN(date.getTime()) ? null : date;
|
|
10714
|
+
}
|
|
10715
|
+
/************************************************************
|
|
10716
|
+
* An epoch in seconds (null: no time) -> the value of a time
|
|
10717
|
+
* column: an ISO text for a `string` column, the epoch for any
|
|
10718
|
+
* other. Up to gobj-ui 7.26.46 the field wrote the epoch into a
|
|
10719
|
+
* `string` column too.
|
|
10720
|
+
************************************************************/
|
|
10721
|
+
function epoch_to_time_value(epoch, real_type) {
|
|
10722
|
+
if (epoch === null || epoch === void 0) return null;
|
|
10723
|
+
if (typeof epoch !== "number" || !Number.isFinite(epoch)) return epoch;
|
|
10724
|
+
if (real_type === "string") return (/* @__PURE__ */ new Date(epoch * 1e3)).toISOString();
|
|
10725
|
+
return epoch;
|
|
10726
|
+
}
|
|
10727
|
+
/************************************************************
|
|
10728
|
+
* The value of a time column as a table cell shows it: the
|
|
10729
|
+
* local clock, 24 hours, in the APP's language `locale`
|
|
10730
|
+
* (fmt_date_time() of yui_time.js: es "14 oct 2026, 15:05:09").
|
|
10731
|
+
* Up to gobj-ui 7.26.51 the form wrote "2026-10-14 15:05:09" and
|
|
10732
|
+
* the treedb table "14 oct 2026, 03:05:09 p. m.", in the
|
|
10733
|
+
* browser's language. "" for no time; a value that is not one is
|
|
10734
|
+
* shown as it is, so the reader sees what the column holds.
|
|
10735
|
+
************************************************************/
|
|
10736
|
+
function time_value_to_text(value, real_type, locale) {
|
|
10737
|
+
let date = time_value_to_date(value, real_type);
|
|
10738
|
+
if (!date) return value === null || value === void 0 ? "" : String(value);
|
|
10739
|
+
return fmt_date_time(date, locale);
|
|
10740
|
+
}
|
|
10741
|
+
//#endregion
|
|
10742
|
+
//#region src/form_time_cell_editor.js
|
|
10743
|
+
/****************************************************************************
|
|
10744
|
+
* form_time_cell_editor.js
|
|
10745
|
+
*
|
|
10746
|
+
* The cell editor of a `time` / `now` column in a table of
|
|
10123
10747
|
* C_YUI_FORM: a `datetime-local` box, as the form's own time
|
|
10124
10748
|
* field, converting with the same helpers (form_time_value.js)
|
|
10125
10749
|
* -- an epoch in SECONDS for an integer column, an ISO text
|
|
@@ -12617,6 +13241,36 @@ function table_column_titles(template) {
|
|
|
12617
13241
|
});
|
|
12618
13242
|
return titles;
|
|
12619
13243
|
}
|
|
13244
|
+
var TIME_CELL_FORMATTERS = /* @__PURE__ */ new WeakSet();
|
|
13245
|
+
/******************************************************************
|
|
13246
|
+
* The formatter of a time cell: the local clock, 24 hours, in the
|
|
13247
|
+
* APP's language (fmt_date_time of yui_time.js, as the cells of
|
|
13248
|
+
* C_YUI_TREEDB_TOPIC_WITH_FORM): es "14 oct 2026, 15:05:09".
|
|
13249
|
+
******************************************************************/
|
|
13250
|
+
function time_cell_formatter(real_type) {
|
|
13251
|
+
let formatter = function(cell) {
|
|
13252
|
+
return text_node(time_value_to_text(cell.getValue(), real_type, safe_locale(i18next.language)));
|
|
13253
|
+
};
|
|
13254
|
+
TIME_CELL_FORMATTERS.add(formatter);
|
|
13255
|
+
return formatter;
|
|
13256
|
+
}
|
|
13257
|
+
/******************************************************************
|
|
13258
|
+
* Draw the time cells of a table again, in the current language.
|
|
13259
|
+
* Cell by cell, never a redraw of the rows: a row's formatter
|
|
13260
|
+
* builds its nested tables anew -- empty. A cell being edited is
|
|
13261
|
+
* its editor's; Tabulator formats it again when the editor closes.
|
|
13262
|
+
******************************************************************/
|
|
13263
|
+
function reformat_time_cells(tabulator) {
|
|
13264
|
+
for (let column of tabulator.getColumns()) {
|
|
13265
|
+
let formatter = column.getDefinition().formatter;
|
|
13266
|
+
if (!TIME_CELL_FORMATTERS.has(formatter)) continue;
|
|
13267
|
+
for (let cell of column.getCells()) {
|
|
13268
|
+
let $cell = cell.getElement();
|
|
13269
|
+
if ($cell.classList.contains("tabulator-editing")) continue;
|
|
13270
|
+
$cell.replaceChildren(formatter(cell));
|
|
13271
|
+
}
|
|
13272
|
+
}
|
|
13273
|
+
}
|
|
12620
13274
|
/******************************************************************
|
|
12621
13275
|
* Convert a template's items in tabulator columns
|
|
12622
13276
|
******************************************************************/
|
|
@@ -12729,9 +13383,7 @@ function template2columns(gobj, columns, template, sub_elements) {
|
|
|
12729
13383
|
case "time":
|
|
12730
13384
|
column.editor = form_time_cell_editor(field_desc.real_type);
|
|
12731
13385
|
column.editorParams = { verticalNavigation: "table" };
|
|
12732
|
-
column.formatter =
|
|
12733
|
-
return text_node(time_value_to_text(cell.getValue(), field_desc.real_type));
|
|
12734
|
-
};
|
|
13386
|
+
column.formatter = time_cell_formatter(field_desc.real_type);
|
|
12735
13387
|
break;
|
|
12736
13388
|
case "color":
|
|
12737
13389
|
column.editor = "input";
|
|
@@ -13712,7 +14364,7 @@ function ac_name_json_editors(gobj, event, kw, src) {
|
|
|
13712
14364
|
* in the old language until it draws it again, so each is told to
|
|
13713
14365
|
* (a new onRenderMenu), and the render names it again.
|
|
13714
14366
|
************************************************************/
|
|
13715
|
-
function ac_language_changed$
|
|
14367
|
+
function ac_language_changed$11(gobj, event, kw, src) {
|
|
13716
14368
|
let $container = gobj_read_attr(gobj, "$container");
|
|
13717
14369
|
if (!$container) return 0;
|
|
13718
14370
|
for (let $editor of $container.querySelectorAll(".jsoneditor")) {
|
|
@@ -13721,7 +14373,10 @@ function ac_language_changed$10(gobj, event, kw, src) {
|
|
|
13721
14373
|
}
|
|
13722
14374
|
for (let $table of $container.querySelectorAll(".yui-tabulator-table, .yui-tabulator-table-nested")) {
|
|
13723
14375
|
let tabulator = $table.tabulator;
|
|
13724
|
-
if (tabulator && tabulator.initialized && $table.template)
|
|
14376
|
+
if (tabulator && tabulator.initialized && $table.template) {
|
|
14377
|
+
yui_tabulator_relocalize(tabulator, t, table_column_titles($table.template));
|
|
14378
|
+
reformat_time_cells(tabulator);
|
|
14379
|
+
}
|
|
13725
14380
|
}
|
|
13726
14381
|
return 0;
|
|
13727
14382
|
}
|
|
@@ -13898,7 +14553,7 @@ function create_gclass$17(gclass_name) {
|
|
|
13898
14553
|
],
|
|
13899
14554
|
[
|
|
13900
14555
|
"EV_LANGUAGE_CHANGED",
|
|
13901
|
-
ac_language_changed$
|
|
14556
|
+
ac_language_changed$11,
|
|
13902
14557
|
null
|
|
13903
14558
|
]
|
|
13904
14559
|
]]];
|
|
@@ -14294,7 +14949,7 @@ function mt_create$16(gobj) {
|
|
|
14294
14949
|
* rewritten in place, and the map's locale with them so a
|
|
14295
14950
|
* control or a popup built later is right too.
|
|
14296
14951
|
***************************************************************/
|
|
14297
|
-
function ac_language_changed$
|
|
14952
|
+
function ac_language_changed$10(gobj, event, kw, src) {
|
|
14298
14953
|
let priv = gobj.priv;
|
|
14299
14954
|
if (priv.xmap) yui_maplibre_relocalize(priv.xmap, t);
|
|
14300
14955
|
return 0;
|
|
@@ -14862,7 +15517,7 @@ function create_gclass$16(gclass_name) {
|
|
|
14862
15517
|
], [["ST_IDLE", [
|
|
14863
15518
|
[
|
|
14864
15519
|
"EV_LANGUAGE_CHANGED",
|
|
14865
|
-
ac_language_changed$
|
|
15520
|
+
ac_language_changed$10,
|
|
14866
15521
|
null
|
|
14867
15522
|
],
|
|
14868
15523
|
[
|
|
@@ -15011,12 +15666,145 @@ function yui_uplot_axes(axes) {
|
|
|
15011
15666
|
});
|
|
15012
15667
|
}
|
|
15013
15668
|
//#endregion
|
|
15669
|
+
//#region src/yui_uplot_time.js
|
|
15670
|
+
/***********************************************************************
|
|
15671
|
+
* yui_uplot_time.js
|
|
15672
|
+
*
|
|
15673
|
+
* The texts uPlot writes for a moment -- the ticks of a time axis
|
|
15674
|
+
* and the reading of the legend -- in the APP's language, with a
|
|
15675
|
+
* clock of 24 hours, as every other time a gobj-ui view shows
|
|
15676
|
+
* (fmt_date_time of yui_time.js).
|
|
15677
|
+
*
|
|
15678
|
+
* uPlot writes them from templates of its own, in English and
|
|
15679
|
+
* 12 hours: "3pm", "3:05pm", "10/14" (month first), "Oct", and
|
|
15680
|
+
* "2026-10-14 3:05pm" in the legend. Its `fmtDate` option takes
|
|
15681
|
+
* the template and returns the function that writes a Date with
|
|
15682
|
+
* it; this one is given to it:
|
|
15683
|
+
*
|
|
15684
|
+
* legend "{YYYY}-{MM}-{DD} {h}:{mm}{aa}" -> fmt_date_time()
|
|
15685
|
+
* "14 oct 2026, 15:05:09"
|
|
15686
|
+
* "{h}{aa}" "3pm" -> "15:00"
|
|
15687
|
+
* "{h}:{mm}{aa}" "3:05pm" -> "15:05"
|
|
15688
|
+
* "{M}/{D}" "10/14" -> es "14/10", en "10/14"
|
|
15689
|
+
* "{M}/{D}/{YY}" "10/14/26"-> es "14/10/26", en "10/14/26"
|
|
15690
|
+
* "{MMM}" "Oct" -> es "oct", en "Oct"
|
|
15691
|
+
*
|
|
15692
|
+
* The language is asked for on every call, so a redraw after a
|
|
15693
|
+
* language change writes the new one (C_YUI_UPLOT redraws its
|
|
15694
|
+
* axes on EV_LANGUAGE_CHANGED).
|
|
15695
|
+
*
|
|
15696
|
+
* Copyright (c) 2026, ArtGins.
|
|
15697
|
+
* All Rights Reserved.
|
|
15698
|
+
***********************************************************************/
|
|
15699
|
+
var LEGEND_STAMP = "{YYYY}-{MM}-{DD} {h}:{mm}{aa}";
|
|
15700
|
+
var pad2 = (n) => String(n).padStart(2, "0");
|
|
15701
|
+
var __formatters__ = /* @__PURE__ */ new Map();
|
|
15702
|
+
function intl(locale, opts) {
|
|
15703
|
+
let key = locale + "|" + JSON.stringify(opts);
|
|
15704
|
+
let f = __formatters__.get(key);
|
|
15705
|
+
if (!f) {
|
|
15706
|
+
try {
|
|
15707
|
+
f = new Intl.DateTimeFormat(locale, opts);
|
|
15708
|
+
} catch (e) {
|
|
15709
|
+
f = new Intl.DateTimeFormat("en", opts);
|
|
15710
|
+
}
|
|
15711
|
+
__formatters__.set(key, f);
|
|
15712
|
+
}
|
|
15713
|
+
return f;
|
|
15714
|
+
}
|
|
15715
|
+
var WHOLE = [
|
|
15716
|
+
["{M}/{D}/{YY}", (d, loc) => intl(loc, {
|
|
15717
|
+
day: "numeric",
|
|
15718
|
+
month: "numeric",
|
|
15719
|
+
year: "2-digit"
|
|
15720
|
+
}).format(d)],
|
|
15721
|
+
["{M}/{D}", (d, loc) => intl(loc, {
|
|
15722
|
+
day: "numeric",
|
|
15723
|
+
month: "numeric"
|
|
15724
|
+
}).format(d)],
|
|
15725
|
+
["{h}{aa}", (d) => `${pad2(d.getHours())}:00`]
|
|
15726
|
+
];
|
|
15727
|
+
var TOKENS = {
|
|
15728
|
+
YYYY: (d) => String(d.getFullYear()),
|
|
15729
|
+
YY: (d) => String(d.getFullYear()).slice(2),
|
|
15730
|
+
MMMM: (d, loc) => intl(loc, { month: "long" }).format(d),
|
|
15731
|
+
MMM: (d, loc) => intl(loc, { month: "short" }).format(d),
|
|
15732
|
+
MM: (d) => pad2(d.getMonth() + 1),
|
|
15733
|
+
M: (d) => String(d.getMonth() + 1),
|
|
15734
|
+
DD: (d) => pad2(d.getDate()),
|
|
15735
|
+
D: (d) => String(d.getDate()),
|
|
15736
|
+
WWWW: (d, loc) => intl(loc, { weekday: "long" }).format(d),
|
|
15737
|
+
WWW: (d, loc) => intl(loc, { weekday: "short" }).format(d),
|
|
15738
|
+
HH: (d) => pad2(d.getHours()),
|
|
15739
|
+
H: (d) => String(d.getHours()),
|
|
15740
|
+
hh: (d) => pad2(d.getHours()),
|
|
15741
|
+
h: (d) => pad2(d.getHours()),
|
|
15742
|
+
AA: () => "",
|
|
15743
|
+
aa: () => "",
|
|
15744
|
+
a: () => "",
|
|
15745
|
+
mm: (d) => pad2(d.getMinutes()),
|
|
15746
|
+
m: (d) => String(d.getMinutes()),
|
|
15747
|
+
ss: (d) => pad2(d.getSeconds()),
|
|
15748
|
+
s: (d) => String(d.getSeconds()),
|
|
15749
|
+
fff: (d) => String(d.getMilliseconds()).padStart(3, "0")
|
|
15750
|
+
};
|
|
15751
|
+
/***************************************************************
|
|
15752
|
+
* A template -> its parts: literal text, or a function of
|
|
15753
|
+
* (date, locale).
|
|
15754
|
+
***************************************************************/
|
|
15755
|
+
function template_parts(tpl) {
|
|
15756
|
+
let parts = [];
|
|
15757
|
+
let rest = String(tpl);
|
|
15758
|
+
while (rest.length > 0) {
|
|
15759
|
+
let whole = WHOLE.find(([frag]) => rest.startsWith(frag));
|
|
15760
|
+
if (whole) {
|
|
15761
|
+
parts.push(whole[1]);
|
|
15762
|
+
rest = rest.slice(whole[0].length);
|
|
15763
|
+
continue;
|
|
15764
|
+
}
|
|
15765
|
+
let m = /^\{([a-z]+)\}/i.exec(rest);
|
|
15766
|
+
if (m && TOKENS[m[1]]) {
|
|
15767
|
+
parts.push(TOKENS[m[1]]);
|
|
15768
|
+
rest = rest.slice(m[0].length);
|
|
15769
|
+
continue;
|
|
15770
|
+
}
|
|
15771
|
+
let next = rest.indexOf("{", 1);
|
|
15772
|
+
let text = next < 0 ? rest : rest.slice(0, next);
|
|
15773
|
+
parts.push(text);
|
|
15774
|
+
rest = rest.slice(text.length);
|
|
15775
|
+
}
|
|
15776
|
+
return parts;
|
|
15777
|
+
}
|
|
15778
|
+
/***************************************************************
|
|
15779
|
+
* uPlot's `fmtDate` option. `get_locale` answers the app's
|
|
15780
|
+
* language at the moment of the call (the views pass
|
|
15781
|
+
* `() => i18next.language`).
|
|
15782
|
+
***************************************************************/
|
|
15783
|
+
function yui_uplot_fmt_date(get_locale) {
|
|
15784
|
+
let locale = () => safe_locale(typeof get_locale === "function" ? get_locale() : null);
|
|
15785
|
+
return function(tpl) {
|
|
15786
|
+
if (tpl === LEGEND_STAMP) return (date) => fmt_date_time(date, locale());
|
|
15787
|
+
let parts = template_parts(tpl);
|
|
15788
|
+
return function(date) {
|
|
15789
|
+
let loc = locale();
|
|
15790
|
+
let out = "";
|
|
15791
|
+
for (let part of parts) out += typeof part === "string" ? part : part(date, loc);
|
|
15792
|
+
return out;
|
|
15793
|
+
};
|
|
15794
|
+
};
|
|
15795
|
+
}
|
|
15796
|
+
//#endregion
|
|
15014
15797
|
//#region src/c_yui_uplot.js
|
|
15015
15798
|
/***********************************************************************
|
|
15016
15799
|
* c_yui_uplot.js
|
|
15017
15800
|
*
|
|
15018
15801
|
* Graphics, Charts with uPlot
|
|
15019
15802
|
*
|
|
15803
|
+
* A moment uPlot writes -- a tick of a time axis, the reading of
|
|
15804
|
+
* the legend -- is in the app's language with a clock of 24 hours
|
|
15805
|
+
* (yui_uplot_time.js), and is written again on the shell's
|
|
15806
|
+
* EV_LANGUAGE_CHANGED.
|
|
15807
|
+
*
|
|
15020
15808
|
* Copyright (c) 2025-2026, ArtGins.
|
|
15021
15809
|
* All Rights Reserved.
|
|
15022
15810
|
***********************************************************************/
|
|
@@ -15045,7 +15833,10 @@ var attrs_table$15 = [
|
|
|
15045
15833
|
SDATA(data_type_t.DTP_INTEGER, "timeout_idle", 0, 5, "Idle timeout (seconds)"),
|
|
15046
15834
|
SDATA_END()
|
|
15047
15835
|
];
|
|
15048
|
-
var PRIVATE_DATA$15 = {
|
|
15836
|
+
var PRIVATE_DATA$15 = {
|
|
15837
|
+
theme_observer: null,
|
|
15838
|
+
lang_shell: null
|
|
15839
|
+
};
|
|
15049
15840
|
var __gclass__$15 = null;
|
|
15050
15841
|
/******************************
|
|
15051
15842
|
* Framework Methods
|
|
@@ -15063,11 +15854,22 @@ function mt_create$15(gobj) {
|
|
|
15063
15854
|
/***************************************************************
|
|
15064
15855
|
* Framework Method: Start
|
|
15065
15856
|
***************************************************************/
|
|
15066
|
-
function mt_start$15(gobj) {
|
|
15857
|
+
function mt_start$15(gobj) {
|
|
15858
|
+
let priv = gobj.priv;
|
|
15859
|
+
let shell = yui_shell_of(gobj);
|
|
15860
|
+
if (shell) {
|
|
15861
|
+
gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
15862
|
+
priv.lang_shell = shell;
|
|
15863
|
+
}
|
|
15864
|
+
}
|
|
15067
15865
|
/***************************************************************
|
|
15068
15866
|
* Framework Method: Stop
|
|
15069
15867
|
***************************************************************/
|
|
15070
|
-
function mt_stop$15(gobj) {
|
|
15868
|
+
function mt_stop$15(gobj) {
|
|
15869
|
+
let priv = gobj.priv;
|
|
15870
|
+
if (priv.lang_shell && !gobj_is_destroying(priv.lang_shell)) gobj_unsubscribe_event(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
15871
|
+
priv.lang_shell = null;
|
|
15872
|
+
}
|
|
15071
15873
|
/***************************************************************
|
|
15072
15874
|
* Framework Method: Destroy
|
|
15073
15875
|
***************************************************************/
|
|
@@ -15105,7 +15907,8 @@ function build_ui$14(gobj) {
|
|
|
15105
15907
|
height: gobj_read_attr(gobj, "height"),
|
|
15106
15908
|
series: gobj_read_attr(gobj, "series"),
|
|
15107
15909
|
axes: yui_uplot_axes(gobj_read_attr(gobj, "axes")),
|
|
15108
|
-
scales: gobj_read_attr(gobj, "scales")
|
|
15910
|
+
scales: gobj_read_attr(gobj, "scales"),
|
|
15911
|
+
fmtDate: yui_uplot_fmt_date(() => i18next.language)
|
|
15109
15912
|
};
|
|
15110
15913
|
let uplot = new uPlot(uPlot_options, gobj_read_attr(gobj, "data"), $container);
|
|
15111
15914
|
gobj_write_attr(gobj, "uplot", uplot);
|
|
@@ -15227,6 +16030,22 @@ function ac_theme$4(gobj, event, kw, src) {
|
|
|
15227
16030
|
return 0;
|
|
15228
16031
|
}
|
|
15229
16032
|
/******************************************************
|
|
16033
|
+
* The language changed: the ticks of a time axis and the
|
|
16034
|
+
* reading of the legend ask for it when they are written,
|
|
16035
|
+
* so they are written again.
|
|
16036
|
+
******************************************************/
|
|
16037
|
+
function ac_language_changed$9(gobj, event, kw, src) {
|
|
16038
|
+
let uplot = gobj_read_attr(gobj, "uplot");
|
|
16039
|
+
if (!uplot) return 0;
|
|
16040
|
+
try {
|
|
16041
|
+
uplot.redraw(true, true);
|
|
16042
|
+
uplot.setLegend(null, false);
|
|
16043
|
+
} catch (e) {
|
|
16044
|
+
log_error(`${gobj_short_name(gobj)}: cannot redraw the chart: ${e}`);
|
|
16045
|
+
}
|
|
16046
|
+
return 0;
|
|
16047
|
+
}
|
|
16048
|
+
/******************************************************
|
|
15230
16049
|
*
|
|
15231
16050
|
******************************************************/
|
|
15232
16051
|
function ac_del_serie(gobj, event, kw, src) {
|
|
@@ -15274,7 +16093,8 @@ function create_gclass$15(gclass_name) {
|
|
|
15274
16093
|
["EV_ADD_SERIE", 0],
|
|
15275
16094
|
["EV_DEL_SERIE", 0],
|
|
15276
16095
|
["EV_CLEAR", 0],
|
|
15277
|
-
["EV_THEME", 0]
|
|
16096
|
+
["EV_THEME", 0],
|
|
16097
|
+
["EV_LANGUAGE_CHANGED", 0]
|
|
15278
16098
|
], [["ST_IDLE", [
|
|
15279
16099
|
[
|
|
15280
16100
|
"EV_LOAD_DATA",
|
|
@@ -15300,6 +16120,11 @@ function create_gclass$15(gclass_name) {
|
|
|
15300
16120
|
"EV_THEME",
|
|
15301
16121
|
ac_theme$4,
|
|
15302
16122
|
null
|
|
16123
|
+
],
|
|
16124
|
+
[
|
|
16125
|
+
"EV_LANGUAGE_CHANGED",
|
|
16126
|
+
ac_language_changed$9,
|
|
16127
|
+
null
|
|
15303
16128
|
]
|
|
15304
16129
|
]]], gmt$15, 0, attrs_table$15, PRIVATE_DATA$15, 0, 0, 0, 0);
|
|
15305
16130
|
if (!__gclass__$15) return -1;
|
|
@@ -18366,7 +19191,8 @@ var PRIVATE_DATA$13 = {
|
|
|
18366
19191
|
$search_ctl: null,
|
|
18367
19192
|
$expand_btn: null,
|
|
18368
19193
|
$collapse_btn: null,
|
|
18369
|
-
$mode_btns: null
|
|
19194
|
+
$mode_btns: null,
|
|
19195
|
+
lang_shell: null
|
|
18370
19196
|
};
|
|
18371
19197
|
var __gclass__$13 = null;
|
|
18372
19198
|
/******************************
|
|
@@ -18394,13 +19220,22 @@ function mt_create$13(gobj) {
|
|
|
18394
19220
|
* Framework Method: Start
|
|
18395
19221
|
***************************************************************/
|
|
18396
19222
|
function mt_start$13(gobj) {
|
|
18397
|
-
|
|
19223
|
+
let priv = gobj.priv;
|
|
19224
|
+
if (priv.root !== null) gobj_change_state(gobj, "ST_READY");
|
|
19225
|
+
let shell = yui_shell_of(gobj);
|
|
19226
|
+
if (shell) {
|
|
19227
|
+
gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
19228
|
+
priv.lang_shell = shell;
|
|
19229
|
+
}
|
|
18398
19230
|
render_view$1(gobj);
|
|
18399
19231
|
}
|
|
18400
19232
|
/***************************************************************
|
|
18401
19233
|
* Framework Method: Stop
|
|
18402
19234
|
***************************************************************/
|
|
18403
19235
|
function mt_stop$13(gobj) {
|
|
19236
|
+
let priv = gobj.priv;
|
|
19237
|
+
if (priv.lang_shell && !gobj_is_destroying(priv.lang_shell)) gobj_unsubscribe_event(priv.lang_shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
19238
|
+
priv.lang_shell = null;
|
|
18404
19239
|
teardown_graph_child$1(gobj);
|
|
18405
19240
|
}
|
|
18406
19241
|
/***************************************************************
|
|
@@ -19099,7 +19934,7 @@ function leaf_row(key, value, depth) {
|
|
|
19099
19934
|
text_node(text)
|
|
19100
19935
|
]);
|
|
19101
19936
|
if (key !== null && is_time_field(String(key))) {
|
|
19102
|
-
let wall = format_epoch(value);
|
|
19937
|
+
let wall = format_epoch(value, safe_locale(i18next.language));
|
|
19103
19938
|
if (wall) body.push([
|
|
19104
19939
|
"span",
|
|
19105
19940
|
{ class: "JSON_TIME is-size-7 yui-text-quiet ml-2" },
|
|
@@ -19350,6 +20185,12 @@ function ac_json_item_clicked(gobj, event, kw, src) {
|
|
|
19350
20185
|
}
|
|
19351
20186
|
/************************************************************
|
|
19352
20187
|
* EV_LANGUAGE_CHANGED — re-translate chrome + re-render
|
|
20188
|
+
*
|
|
20189
|
+
* Only the TREE is drawn again: it writes the reading of a
|
|
20190
|
+
* time field in the language of the moment it was drawn. The
|
|
20191
|
+
* text view carries its keys (refresh_language reaches them),
|
|
20192
|
+
* and loading the graph again would throw away the reader's
|
|
20193
|
+
* camera for nothing.
|
|
19353
20194
|
************************************************************/
|
|
19354
20195
|
function ac_language_changed$8(gobj, event, kw, src) {
|
|
19355
20196
|
let priv = gobj.priv;
|
|
@@ -19359,7 +20200,7 @@ function ac_language_changed$8(gobj, event, kw, src) {
|
|
|
19359
20200
|
if (priv.$search) priv.$search.setAttribute("placeholder", t("search"));
|
|
19360
20201
|
apply_view_mode$1(gobj);
|
|
19361
20202
|
}
|
|
19362
|
-
|
|
20203
|
+
if (current_view_mode$1(gobj) === "tree") render_tree(gobj);
|
|
19363
20204
|
return 0;
|
|
19364
20205
|
}
|
|
19365
20206
|
/************************************************************
|
|
@@ -33040,26 +33881,11 @@ function transform__treedb_value_2_table_value(gobj, col, value, row, field) {
|
|
|
33040
33881
|
switch (field_desc.real_type) {
|
|
33041
33882
|
case "string":
|
|
33042
33883
|
case "integer":
|
|
33043
|
-
value =
|
|
33044
|
-
if (
|
|
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([
|
|
33884
|
+
value = time_value_to_text(value, field_desc.real_type, safe_locale(i18next.language));
|
|
33885
|
+
if (value) value = createElement2([
|
|
33060
33886
|
"span",
|
|
33061
33887
|
{ class: "is-size-7" },
|
|
33062
|
-
|
|
33888
|
+
text_node(value)
|
|
33063
33889
|
]);
|
|
33064
33890
|
}
|
|
33065
33891
|
break;
|
|
@@ -82714,591 +83540,6 @@ function register_c_yui_schema_editor() {
|
|
|
82714
83540
|
return create_gclass$1(GCLASS_NAME$1);
|
|
82715
83541
|
}
|
|
82716
83542
|
//#endregion
|
|
82717
|
-
//#region src/yui_time.js
|
|
82718
|
-
/***********************************************************************
|
|
82719
|
-
* yui_time.js
|
|
82720
|
-
*
|
|
82721
|
-
* Time, without a DOM: epochs, and the algebra of PERIODS.
|
|
82722
|
-
*
|
|
82723
|
-
* Two things live here, and they are the two halves of every date
|
|
82724
|
-
* UI the projects keep rewriting:
|
|
82725
|
-
*
|
|
82726
|
-
* 1) EPOCH <-> the local wall clock. A timestamp travels in the
|
|
82727
|
-
* producer's own unit — seconds, or milliseconds when a topic
|
|
82728
|
-
* says so — and every conversion crosses that `ms` flag. Getting
|
|
82729
|
-
* it wrong puts the same instant on two different clocks in one
|
|
82730
|
-
* screen (it did: a picker asking "from 18:55" local returned
|
|
82731
|
-
* rows a table labelled 16:55).
|
|
82732
|
-
*
|
|
82733
|
-
* 2) The PERIOD. A period is not an enum of five names: it is a
|
|
82734
|
-
* BUCKET, and a bucket is `count` of a `unit`:
|
|
82735
|
-
*
|
|
82736
|
-
* {id: "day", unit: "day", count: 1}
|
|
82737
|
-
* {id: "week", unit: "week", count: 1} ISO, Mon-first
|
|
82738
|
-
* {id: "bimester", unit: "month", count: 2}
|
|
82739
|
-
* {id: "quarter", unit: "month", count: 3}
|
|
82740
|
-
* {id: "semester", unit: "month", count: 6}
|
|
82741
|
-
* {id: "decade", unit: "year", count: 10}
|
|
82742
|
-
* {id: "15min", unit: "minute", count: 15}
|
|
82743
|
-
*
|
|
82744
|
-
* Given that pair, ONE implementation answers every question a
|
|
82745
|
-
* date navigator asks — where does the bucket holding this
|
|
82746
|
-
* instant start and end, what is the previous/next one, what do
|
|
82747
|
-
* I call it — so an app that wants quarters declares a quarter
|
|
82748
|
-
* instead of asking for a new component.
|
|
82749
|
-
*
|
|
82750
|
-
* Buckets are ALIGNED, never "count back from now": months align to
|
|
82751
|
-
* the year (which is why 2, 3, 4, 6 and 12 fall on clean calendar
|
|
82752
|
-
* boundaries), weeks to Monday, hours to local midnight. "Last 7
|
|
82753
|
-
* days" is a different animal — a rolling window — and it is not a
|
|
82754
|
-
* period: see `rolling_bounds()`.
|
|
82755
|
-
*
|
|
82756
|
-
* Everything here is LOCAL time (the user reads a local clock) and
|
|
82757
|
-
* DST-safe: it never adds 86400000 ms to cross a day, it builds the
|
|
82758
|
-
* next date from calendar fields and lets the platform do it.
|
|
82759
|
-
*
|
|
82760
|
-
* Copyright (c) 2026, ArtGins.
|
|
82761
|
-
* All Rights Reserved.
|
|
82762
|
-
***********************************************************************/
|
|
82763
|
-
/***************************************************************
|
|
82764
|
-
* Constants
|
|
82765
|
-
***************************************************************/
|
|
82766
|
-
var MS_DAY = 864e5;
|
|
82767
|
-
var PERIOD_UNITS = [
|
|
82768
|
-
"minute",
|
|
82769
|
-
"hour",
|
|
82770
|
-
"day",
|
|
82771
|
-
"week",
|
|
82772
|
-
"month",
|
|
82773
|
-
"year"
|
|
82774
|
-
];
|
|
82775
|
-
var YUI_PERIODS = {
|
|
82776
|
-
minute: {
|
|
82777
|
-
id: "minute",
|
|
82778
|
-
unit: "minute",
|
|
82779
|
-
count: 1
|
|
82780
|
-
},
|
|
82781
|
-
"5min": {
|
|
82782
|
-
id: "5min",
|
|
82783
|
-
unit: "minute",
|
|
82784
|
-
count: 5
|
|
82785
|
-
},
|
|
82786
|
-
"15min": {
|
|
82787
|
-
id: "15min",
|
|
82788
|
-
unit: "minute",
|
|
82789
|
-
count: 15
|
|
82790
|
-
},
|
|
82791
|
-
hour: {
|
|
82792
|
-
id: "hour",
|
|
82793
|
-
unit: "hour",
|
|
82794
|
-
count: 1
|
|
82795
|
-
},
|
|
82796
|
-
day: {
|
|
82797
|
-
id: "day",
|
|
82798
|
-
unit: "day",
|
|
82799
|
-
count: 1
|
|
82800
|
-
},
|
|
82801
|
-
week: {
|
|
82802
|
-
id: "week",
|
|
82803
|
-
unit: "week",
|
|
82804
|
-
count: 1
|
|
82805
|
-
},
|
|
82806
|
-
fortnight: {
|
|
82807
|
-
id: "fortnight",
|
|
82808
|
-
unit: "week",
|
|
82809
|
-
count: 2
|
|
82810
|
-
},
|
|
82811
|
-
month: {
|
|
82812
|
-
id: "month",
|
|
82813
|
-
unit: "month",
|
|
82814
|
-
count: 1
|
|
82815
|
-
},
|
|
82816
|
-
bimester: {
|
|
82817
|
-
id: "bimester",
|
|
82818
|
-
unit: "month",
|
|
82819
|
-
count: 2
|
|
82820
|
-
},
|
|
82821
|
-
quarter: {
|
|
82822
|
-
id: "quarter",
|
|
82823
|
-
unit: "month",
|
|
82824
|
-
count: 3
|
|
82825
|
-
},
|
|
82826
|
-
semester: {
|
|
82827
|
-
id: "semester",
|
|
82828
|
-
unit: "month",
|
|
82829
|
-
count: 6
|
|
82830
|
-
},
|
|
82831
|
-
year: {
|
|
82832
|
-
id: "year",
|
|
82833
|
-
unit: "year",
|
|
82834
|
-
count: 1
|
|
82835
|
-
},
|
|
82836
|
-
decade: {
|
|
82837
|
-
id: "decade",
|
|
82838
|
-
unit: "year",
|
|
82839
|
-
count: 10
|
|
82840
|
-
}
|
|
82841
|
-
};
|
|
82842
|
-
var YUI_PERIODS_DEFAULT = [
|
|
82843
|
-
"hour",
|
|
82844
|
-
"day",
|
|
82845
|
-
"week",
|
|
82846
|
-
"month",
|
|
82847
|
-
"year"
|
|
82848
|
-
];
|
|
82849
|
-
var YUI_ROLLING = {
|
|
82850
|
-
"1h": {
|
|
82851
|
-
id: "1h",
|
|
82852
|
-
secs: 3600,
|
|
82853
|
-
label: "last hour"
|
|
82854
|
-
},
|
|
82855
|
-
"6h": {
|
|
82856
|
-
id: "6h",
|
|
82857
|
-
secs: 21600,
|
|
82858
|
-
label: "last 6h"
|
|
82859
|
-
},
|
|
82860
|
-
"24h": {
|
|
82861
|
-
id: "24h",
|
|
82862
|
-
secs: 86400,
|
|
82863
|
-
label: "last 24h"
|
|
82864
|
-
},
|
|
82865
|
-
"7d": {
|
|
82866
|
-
id: "7d",
|
|
82867
|
-
secs: 604800,
|
|
82868
|
-
label: "last 7 days"
|
|
82869
|
-
},
|
|
82870
|
-
"30d": {
|
|
82871
|
-
id: "30d",
|
|
82872
|
-
secs: 2592e3,
|
|
82873
|
-
label: "last 30 days"
|
|
82874
|
-
}
|
|
82875
|
-
};
|
|
82876
|
-
/***************************
|
|
82877
|
-
* Locale / i18n
|
|
82878
|
-
***************************/
|
|
82879
|
-
/***************************************************************
|
|
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
|
-
* Translate through the APP's translator when it gave us one, and
|
|
82896
|
-
* degrade to the key itself otherwise — interpolating `{{x}}` by hand,
|
|
82897
|
-
* so a label never renders raw mustaches at a caller that has no i18n.
|
|
82898
|
-
***************************************************************/
|
|
82899
|
-
function tr(t, key, params) {
|
|
82900
|
-
if (typeof t === "function") return t(key, params);
|
|
82901
|
-
let s = key;
|
|
82902
|
-
for (let k in params || {}) s = s.replaceAll(`{{${k}}}`, String(params[k]));
|
|
82903
|
-
return s;
|
|
82904
|
-
}
|
|
82905
|
-
/***************************************************************
|
|
82906
|
-
* Intl formatters, built PER CALL (see safe_locale). They are cheap
|
|
82907
|
-
* next to a repaint, and caching them would need a locale-change hook
|
|
82908
|
-
* the library has no business owning.
|
|
82909
|
-
***************************************************************/
|
|
82910
|
-
function fmt_intl(date, locale, opts) {
|
|
82911
|
-
try {
|
|
82912
|
-
return new Intl.DateTimeFormat(safe_locale(locale), opts).format(date);
|
|
82913
|
-
} catch (e) {
|
|
82914
|
-
return date.toDateString();
|
|
82915
|
-
}
|
|
82916
|
-
}
|
|
82917
|
-
/***************************
|
|
82918
|
-
* Epoch <-> clock
|
|
82919
|
-
***************************/
|
|
82920
|
-
/***************************************************************
|
|
82921
|
-
* Epoch in the producer's unit -> milliseconds, and back.
|
|
82922
|
-
* `ms` true means the value already IS milliseconds.
|
|
82923
|
-
***************************************************************/
|
|
82924
|
-
function epoch_to_ms(value, ms) {
|
|
82925
|
-
if (!value) return 0;
|
|
82926
|
-
return ms ? value : value * 1e3;
|
|
82927
|
-
}
|
|
82928
|
-
function ms_to_epoch(value_ms, ms) {
|
|
82929
|
-
if (!value_ms) return 0;
|
|
82930
|
-
return ms ? value_ms : Math.floor(value_ms / 1e3);
|
|
82931
|
-
}
|
|
82932
|
-
/***************************************************************
|
|
82933
|
-
* The LOCAL wall-clock string an `<input type="datetime-local">` takes
|
|
82934
|
-
* ("YYYY-MM-DDTHH:MM:SS", which needs step=1 to keep the seconds), and
|
|
82935
|
-
* the parse back. Empty / unparseable -> 0, which is exactly how a
|
|
82936
|
-
* match condition reads an absent bound.
|
|
82937
|
-
***************************************************************/
|
|
82938
|
-
function epoch_to_local_input(value, ms) {
|
|
82939
|
-
if (!value) return "";
|
|
82940
|
-
let d = new Date(epoch_to_ms(value, ms));
|
|
82941
|
-
let pad = (n) => String(n).padStart(2, "0");
|
|
82942
|
-
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
82943
|
-
}
|
|
82944
|
-
function local_input_to_epoch(v, ms) {
|
|
82945
|
-
if (!v) return 0;
|
|
82946
|
-
let parsed = Date.parse(v);
|
|
82947
|
-
if (Number.isNaN(parsed)) return 0;
|
|
82948
|
-
return ms_to_epoch(parsed, ms);
|
|
82949
|
-
}
|
|
82950
|
-
/***************************************************************
|
|
82951
|
-
* A timestamp for a table cell: the local wall clock, space-separated,
|
|
82952
|
-
* keeping the milliseconds when the producer bothered to send them (a
|
|
82953
|
-
* topic that sets sf_t_ms usually appends several records inside the
|
|
82954
|
-
* same second, and a column that hides that shows a column of ties).
|
|
82955
|
-
***************************************************************/
|
|
82956
|
-
function fmt_epoch(value, ms) {
|
|
82957
|
-
if (!value) return "";
|
|
82958
|
-
try {
|
|
82959
|
-
let s = epoch_to_local_input(value, ms).replace("T", " ");
|
|
82960
|
-
if (ms) s += `.${String(value % 1e3).padStart(3, "0")}`;
|
|
82961
|
-
return s;
|
|
82962
|
-
} catch (e) {
|
|
82963
|
-
return String(value);
|
|
82964
|
-
}
|
|
82965
|
-
}
|
|
82966
|
-
/***************************
|
|
82967
|
-
* Calendar atoms
|
|
82968
|
-
***************************/
|
|
82969
|
-
/***************************************************************
|
|
82970
|
-
* The day number of a date, counting local calendar days from
|
|
82971
|
-
* 1970-01-01. Built from the FIELDS (Date.UTC of y/m/d), never from
|
|
82972
|
-
* the timestamp: a DST day is 23 or 25 hours long, so dividing a local
|
|
82973
|
-
* epoch by 86400000 drifts a day twice a year.
|
|
82974
|
-
***************************************************************/
|
|
82975
|
-
function day_number(d) {
|
|
82976
|
-
return Math.floor(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()) / MS_DAY);
|
|
82977
|
-
}
|
|
82978
|
-
function date_from_day_number(n) {
|
|
82979
|
-
let d = /* @__PURE__ */ new Date(n * MS_DAY);
|
|
82980
|
-
return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
|
|
82981
|
-
}
|
|
82982
|
-
/***************************************************************
|
|
82983
|
-
* The Monday of the week a date falls in (ISO: the week starts on
|
|
82984
|
-
* Monday, and Sunday closes it).
|
|
82985
|
-
***************************************************************/
|
|
82986
|
-
function start_of_iso_week(d) {
|
|
82987
|
-
let day = d.getDay();
|
|
82988
|
-
let back = day === 0 ? 6 : day - 1;
|
|
82989
|
-
return new Date(d.getFullYear(), d.getMonth(), d.getDate() - back);
|
|
82990
|
-
}
|
|
82991
|
-
/***************************************************************
|
|
82992
|
-
* The ISO week a date belongs to: {week, year}. The YEAR is the ISO
|
|
82993
|
-
* week-year, not the calendar year — 2026-12-31 lives in week 1 of
|
|
82994
|
-
* 2027, and a label that said "week 1 2026" would name a week six
|
|
82995
|
-
* months away.
|
|
82996
|
-
***************************************************************/
|
|
82997
|
-
function iso_week(d) {
|
|
82998
|
-
let monday = start_of_iso_week(d);
|
|
82999
|
-
let thursday = new Date(monday.getFullYear(), monday.getMonth(), monday.getDate() + 3);
|
|
83000
|
-
let jan1 = new Date(thursday.getFullYear(), 0, 1);
|
|
83001
|
-
return {
|
|
83002
|
-
week: Math.floor((day_number(thursday) - day_number(jan1)) / 7) + 1,
|
|
83003
|
-
year: thursday.getFullYear()
|
|
83004
|
-
};
|
|
83005
|
-
}
|
|
83006
|
-
/***************************************************************
|
|
83007
|
-
* The index of the ISO week a date falls in, counting weeks from the
|
|
83008
|
-
* Monday of the epoch week. It is what aligns a MULTI-week bucket (a
|
|
83009
|
-
* fortnight) to a Monday instead of to whatever day 1970-01-01 was.
|
|
83010
|
-
***************************************************************/
|
|
83011
|
-
function week_index(d) {
|
|
83012
|
-
return Math.floor((day_number(start_of_iso_week(d)) + 3) / 7);
|
|
83013
|
-
}
|
|
83014
|
-
/***************************
|
|
83015
|
-
* Period algebra
|
|
83016
|
-
***************************/
|
|
83017
|
-
/***************************************************************
|
|
83018
|
-
* Normalize whatever a caller hands us into a spec: an id of the
|
|
83019
|
-
* catalog, or a spec of its own. Returns null for anything that is not
|
|
83020
|
-
* a bucket (a "span" / "custom" mode of a navigator has no algebra).
|
|
83021
|
-
***************************************************************/
|
|
83022
|
-
function period_spec(period) {
|
|
83023
|
-
if (!period) return null;
|
|
83024
|
-
let spec = typeof period === "string" ? YUI_PERIODS[period] : period;
|
|
83025
|
-
if (!spec || !spec.unit) return null;
|
|
83026
|
-
if (PERIOD_UNITS.indexOf(spec.unit) < 0) return null;
|
|
83027
|
-
let count = parseInt(spec.count, 10);
|
|
83028
|
-
if (!(count > 0)) count = 1;
|
|
83029
|
-
return {
|
|
83030
|
-
id: spec.id || spec.unit,
|
|
83031
|
-
unit: spec.unit,
|
|
83032
|
-
count
|
|
83033
|
-
};
|
|
83034
|
-
}
|
|
83035
|
-
/***************************************************************
|
|
83036
|
-
* The START of the bucket that holds `anchor_ms`, as a local Date.
|
|
83037
|
-
*
|
|
83038
|
-
* Alignment is what makes a bucket a bucket. Each unit floors against
|
|
83039
|
-
* the natural origin of the unit above it, so the boundaries are the
|
|
83040
|
-
* ones a human already has in their head:
|
|
83041
|
-
*
|
|
83042
|
-
* minute -> the hour (a 15min bucket starts at :00/:15/:30/:45)
|
|
83043
|
-
* hour -> local midnight (a 6h bucket starts at 00/06/12/18)
|
|
83044
|
-
* day -> 1970-01-01 (count=1 is the plain day; a 10-day
|
|
83045
|
-
* bucket has no calendar origin to
|
|
83046
|
-
* align to, so it aligns to the epoch)
|
|
83047
|
-
* week -> the epoch week, Monday-first (ISO)
|
|
83048
|
-
* month -> January (which is why 2/3/4/6/12 give calendar
|
|
83049
|
-
* bimesters, quarters and semesters)
|
|
83050
|
-
* year -> year 0 (a decade starts at 2020, not 2021)
|
|
83051
|
-
***************************************************************/
|
|
83052
|
-
function period_start(period, anchor_ms) {
|
|
83053
|
-
let spec = period_spec(period);
|
|
83054
|
-
if (!spec) return null;
|
|
83055
|
-
let d = new Date(anchor_ms);
|
|
83056
|
-
let n = spec.count;
|
|
83057
|
-
switch (spec.unit) {
|
|
83058
|
-
case "minute": {
|
|
83059
|
-
let m = Math.floor(d.getMinutes() / n) * n;
|
|
83060
|
-
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), m);
|
|
83061
|
-
}
|
|
83062
|
-
case "hour": {
|
|
83063
|
-
let h = Math.floor(d.getHours() / n) * n;
|
|
83064
|
-
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), h);
|
|
83065
|
-
}
|
|
83066
|
-
case "day": return date_from_day_number(Math.floor(day_number(d) / n) * n);
|
|
83067
|
-
case "week": return date_from_day_number(Math.floor(week_index(d) / n) * n * 7 - 3);
|
|
83068
|
-
case "month": {
|
|
83069
|
-
let mi = d.getFullYear() * 12 + d.getMonth();
|
|
83070
|
-
let s = Math.floor(mi / n) * n;
|
|
83071
|
-
return new Date(Math.floor(s / 12), s % 12, 1);
|
|
83072
|
-
}
|
|
83073
|
-
case "year": {
|
|
83074
|
-
let y = Math.floor(d.getFullYear() / n) * n;
|
|
83075
|
-
return new Date(y, 0, 1);
|
|
83076
|
-
}
|
|
83077
|
-
default: return null;
|
|
83078
|
-
}
|
|
83079
|
-
}
|
|
83080
|
-
/***************************************************************
|
|
83081
|
-
* The start of the bucket `delta` buckets away (delta may be negative).
|
|
83082
|
-
* Calendar arithmetic, never millisecond arithmetic: `new Date(y, m+3, 1)`
|
|
83083
|
-
* overflows the year by itself, and stepping a day across a DST change
|
|
83084
|
-
* keeps landing on midnight.
|
|
83085
|
-
***************************************************************/
|
|
83086
|
-
function period_shift(period, anchor_ms, delta) {
|
|
83087
|
-
let spec = period_spec(period);
|
|
83088
|
-
if (!spec) return anchor_ms;
|
|
83089
|
-
let s = period_start(spec, anchor_ms);
|
|
83090
|
-
let step = spec.count * (delta || 0);
|
|
83091
|
-
switch (spec.unit) {
|
|
83092
|
-
case "minute": return new Date(s.getFullYear(), s.getMonth(), s.getDate(), s.getHours(), s.getMinutes() + step).getTime();
|
|
83093
|
-
case "hour": return new Date(s.getFullYear(), s.getMonth(), s.getDate(), s.getHours() + step).getTime();
|
|
83094
|
-
case "day": return new Date(s.getFullYear(), s.getMonth(), s.getDate() + step).getTime();
|
|
83095
|
-
case "week": return new Date(s.getFullYear(), s.getMonth(), s.getDate() + step * 7).getTime();
|
|
83096
|
-
case "month": return new Date(s.getFullYear(), s.getMonth() + step, 1).getTime();
|
|
83097
|
-
case "year": return new Date(s.getFullYear() + step, 0, 1).getTime();
|
|
83098
|
-
default: return anchor_ms;
|
|
83099
|
-
}
|
|
83100
|
-
}
|
|
83101
|
-
/***************************************************************
|
|
83102
|
-
* The bucket holding `anchor_ms`, as {from, to} in MILLISECONDS.
|
|
83103
|
-
*
|
|
83104
|
-
* `to` is INCLUSIVE — the last millisecond of the bucket, not the first
|
|
83105
|
-
* of the next one. Both ends of a match condition are inclusive, and an
|
|
83106
|
-
* exclusive end handed to one silently swallows the record that landed
|
|
83107
|
-
* exactly on the boundary.
|
|
83108
|
-
***************************************************************/
|
|
83109
|
-
function period_bounds(period, anchor_ms) {
|
|
83110
|
-
let spec = period_spec(period);
|
|
83111
|
-
if (!spec) return {
|
|
83112
|
-
from: 0,
|
|
83113
|
-
to: 0
|
|
83114
|
-
};
|
|
83115
|
-
return {
|
|
83116
|
-
from: period_start(spec, anchor_ms).getTime(),
|
|
83117
|
-
to: period_shift(spec, anchor_ms, 1) - 1
|
|
83118
|
-
};
|
|
83119
|
-
}
|
|
83120
|
-
/***************************************************************
|
|
83121
|
-
* The same bucket, in the unit the CONSUMER speaks (a tranger topic
|
|
83122
|
-
* keeps its timestamps in seconds, unless its system_flag says
|
|
83123
|
-
* milliseconds). This is the function a query builder calls.
|
|
83124
|
-
***************************************************************/
|
|
83125
|
-
function period_bounds_epoch(period, anchor_ms, ms) {
|
|
83126
|
-
let b = period_bounds(period, anchor_ms);
|
|
83127
|
-
if (!b.from) return {
|
|
83128
|
-
from: 0,
|
|
83129
|
-
to: 0
|
|
83130
|
-
};
|
|
83131
|
-
return {
|
|
83132
|
-
from: ms_to_epoch(b.from, ms),
|
|
83133
|
-
to: ms_to_epoch(b.to, ms)
|
|
83134
|
-
};
|
|
83135
|
-
}
|
|
83136
|
-
/***************************************************************
|
|
83137
|
-
* A ROLLING window: `secs` back from now. Not a bucket — it has no
|
|
83138
|
-
* previous and no next, it just ends at `now`.
|
|
83139
|
-
*
|
|
83140
|
-
* The `to` end is left OPEN (0). An iterator with no upper bound keeps
|
|
83141
|
-
* matching the records that land while the card is on screen; pinning
|
|
83142
|
-
* it to "now" would freeze the window at the instant the user clicked.
|
|
83143
|
-
***************************************************************/
|
|
83144
|
-
function rolling_bounds(rolling, ms, now_ms) {
|
|
83145
|
-
let r = typeof rolling === "string" ? YUI_ROLLING[rolling] : rolling;
|
|
83146
|
-
if (!r || !r.secs) return {
|
|
83147
|
-
from: 0,
|
|
83148
|
-
to: 0
|
|
83149
|
-
};
|
|
83150
|
-
return {
|
|
83151
|
-
from: ms_to_epoch((now_ms === void 0 ? Date.now() : now_ms) - r.secs * 1e3, ms),
|
|
83152
|
-
to: 0
|
|
83153
|
-
};
|
|
83154
|
-
}
|
|
83155
|
-
/***************************************************************
|
|
83156
|
-
* Is this the LAST bucket — the one `now` falls in? It is what greys
|
|
83157
|
-
* out the "next" arrow, and what tells the navigator it is already home.
|
|
83158
|
-
***************************************************************/
|
|
83159
|
-
function is_current_period(period, anchor_ms, now_ms) {
|
|
83160
|
-
let spec = period_spec(period);
|
|
83161
|
-
if (!spec) return false;
|
|
83162
|
-
let now = now_ms === void 0 ? Date.now() : now_ms;
|
|
83163
|
-
let a = period_start(spec, anchor_ms);
|
|
83164
|
-
let b = period_start(spec, now);
|
|
83165
|
-
return !!a && !!b && a.getTime() === b.getTime();
|
|
83166
|
-
}
|
|
83167
|
-
/***************************************************************
|
|
83168
|
-
* Recognize the bucket a {from, to} pair came from, so a range that
|
|
83169
|
-
* travelled through a URL, a saved view or a backend answer comes back
|
|
83170
|
-
* as the period the user picked instead of as a hand-typed range.
|
|
83171
|
-
*
|
|
83172
|
-
* `from`/`to` are in the CONSUMER's unit (`ms`), and so is the
|
|
83173
|
-
* comparison — that is the whole trap: a bucket ends on the last
|
|
83174
|
-
* MILLISECOND (…23:59:59.999), and a consumer that keeps seconds stored
|
|
83175
|
-
* it truncated (…23:59:59). Comparing in milliseconds, a week saved by a
|
|
83176
|
-
* seconds-based topic came back as "no bucket at all", every time.
|
|
83177
|
-
*
|
|
83178
|
-
* Only an EXACT match counts: both ends must land on the bucket's own
|
|
83179
|
-
* boundaries, as that consumer would have written them. `candidates` are
|
|
83180
|
-
* ids/specs, tried in order. Returns {period, anchor} (anchor in ms) or
|
|
83181
|
-
* null.
|
|
83182
|
-
***************************************************************/
|
|
83183
|
-
function infer_period(from, to, candidates, ms) {
|
|
83184
|
-
if (!from || !to || to <= from) return null;
|
|
83185
|
-
let from_ms = epoch_to_ms(from, ms);
|
|
83186
|
-
for (let candidate of candidates || Object.keys(YUI_PERIODS)) {
|
|
83187
|
-
let spec = period_spec(candidate);
|
|
83188
|
-
if (!spec) continue;
|
|
83189
|
-
let b = period_bounds_epoch(spec, from_ms, ms);
|
|
83190
|
-
if (b.from === from && b.to === to) return {
|
|
83191
|
-
period: spec,
|
|
83192
|
-
anchor: from_ms
|
|
83193
|
-
};
|
|
83194
|
-
}
|
|
83195
|
-
return null;
|
|
83196
|
-
}
|
|
83197
|
-
/***************************
|
|
83198
|
-
* Period labels
|
|
83199
|
-
***************************/
|
|
83200
|
-
/***************************************************************
|
|
83201
|
-
* The name of a GRANULARITY (what the segmented control shows):
|
|
83202
|
-
* the spec's own id as an i18n key, so an app that declares
|
|
83203
|
-
* {id: "quarter"} gets "Trimestre" the moment it adds the key.
|
|
83204
|
-
***************************************************************/
|
|
83205
|
-
function period_name(period, t) {
|
|
83206
|
-
let spec = period_spec(period);
|
|
83207
|
-
if (!spec) return tr(t, String(period && period.id || period || ""));
|
|
83208
|
-
return tr(t, spec.id);
|
|
83209
|
-
}
|
|
83210
|
-
/***************************************************************
|
|
83211
|
-
* The name of the bucket a navigator is PARKED on: what goes between
|
|
83212
|
-
* the two arrows.
|
|
83213
|
-
*
|
|
83214
|
-
* day -> "Today" / "Yesterday" / "13 jul 2026"
|
|
83215
|
-
* week -> "Week 27" (+ year when it is not this one)
|
|
83216
|
-
* month -> "July" (+ year when it is not this one)
|
|
83217
|
-
* quarter -> "Q3 2026" (unit month, count 3)
|
|
83218
|
-
* semester -> "H2 2026" (unit month, count 6)
|
|
83219
|
-
* year -> "2026"
|
|
83220
|
-
* decade -> "2020 – 2029"
|
|
83221
|
-
* any other -> the bucket's own edges: "1 jul – 31 aug 2026"
|
|
83222
|
-
*
|
|
83223
|
-
* The named ones are named because a range reads worse than a name;
|
|
83224
|
-
* everything an app invents falls back to the range, which is always
|
|
83225
|
-
* true and never wrong.
|
|
83226
|
-
***************************************************************/
|
|
83227
|
-
function period_label(period, anchor_ms, t, locale) {
|
|
83228
|
-
let spec = period_spec(period);
|
|
83229
|
-
if (!spec) return "";
|
|
83230
|
-
let loc = safe_locale(locale);
|
|
83231
|
-
let start = period_start(spec, anchor_ms);
|
|
83232
|
-
let end = new Date(period_bounds(spec, anchor_ms).to);
|
|
83233
|
-
let now = /* @__PURE__ */ new Date();
|
|
83234
|
-
let this_year = start.getFullYear() === now.getFullYear();
|
|
83235
|
-
if (spec.unit === "day" && spec.count === 1) {
|
|
83236
|
-
let diff = day_number(start) - day_number(now);
|
|
83237
|
-
if (diff === 0) return tr(t, "today");
|
|
83238
|
-
if (diff === -1) return tr(t, "yesterday");
|
|
83239
|
-
if (diff === 1) return tr(t, "tomorrow");
|
|
83240
|
-
return fmt_intl(start, loc, this_year ? {
|
|
83241
|
-
day: "numeric",
|
|
83242
|
-
month: "short"
|
|
83243
|
-
} : {
|
|
83244
|
-
day: "numeric",
|
|
83245
|
-
month: "short",
|
|
83246
|
-
year: "numeric"
|
|
83247
|
-
});
|
|
83248
|
-
}
|
|
83249
|
-
if (spec.unit === "hour" && spec.count === 1) {
|
|
83250
|
-
let hh = fmt_intl(start, loc, {
|
|
83251
|
-
hour: "2-digit",
|
|
83252
|
-
minute: "2-digit"
|
|
83253
|
-
});
|
|
83254
|
-
if (day_number(start) === day_number(now)) return hh;
|
|
83255
|
-
return `${hh} · ${fmt_intl(start, loc, {
|
|
83256
|
-
day: "numeric",
|
|
83257
|
-
month: "short"
|
|
83258
|
-
})}`;
|
|
83259
|
-
}
|
|
83260
|
-
if (spec.unit === "week" && spec.count === 1) {
|
|
83261
|
-
let away = week_index(start) - week_index(now);
|
|
83262
|
-
if (away === 0) return tr(t, "this week");
|
|
83263
|
-
if (away === -1) return tr(t, "last week");
|
|
83264
|
-
let w = iso_week(start);
|
|
83265
|
-
return w.year === now.getFullYear() ? tr(t, "week {{n}}", { n: w.week }) : tr(t, "week {{n}} {{y}}", {
|
|
83266
|
-
n: w.week,
|
|
83267
|
-
y: w.year
|
|
83268
|
-
});
|
|
83269
|
-
}
|
|
83270
|
-
if (spec.unit === "month" && spec.count === 1) return fmt_intl(start, loc, this_year ? { month: "long" } : {
|
|
83271
|
-
month: "long",
|
|
83272
|
-
year: "numeric"
|
|
83273
|
-
});
|
|
83274
|
-
if (spec.unit === "month" && (spec.count === 3 || spec.count === 6)) {
|
|
83275
|
-
let n = Math.floor(start.getMonth() / spec.count) + 1;
|
|
83276
|
-
return tr(t, spec.count === 3 ? "quarter {{n}} {{y}}" : "semester {{n}} {{y}}", {
|
|
83277
|
-
n,
|
|
83278
|
-
y: start.getFullYear()
|
|
83279
|
-
});
|
|
83280
|
-
}
|
|
83281
|
-
if (spec.unit === "year") {
|
|
83282
|
-
if (spec.count === 1) return String(start.getFullYear());
|
|
83283
|
-
return `${start.getFullYear()} – ${end.getFullYear()}`;
|
|
83284
|
-
}
|
|
83285
|
-
let opts = spec.unit === "minute" || spec.unit === "hour" ? {
|
|
83286
|
-
day: "numeric",
|
|
83287
|
-
month: "short",
|
|
83288
|
-
hour: "2-digit",
|
|
83289
|
-
minute: "2-digit"
|
|
83290
|
-
} : {
|
|
83291
|
-
day: "numeric",
|
|
83292
|
-
month: "short"
|
|
83293
|
-
};
|
|
83294
|
-
if (start.getFullYear() !== end.getFullYear()) {
|
|
83295
|
-
let y_opts = Object.assign({ year: "numeric" }, opts);
|
|
83296
|
-
return `${fmt_intl(start, loc, y_opts)} – ${fmt_intl(end, loc, y_opts)}`;
|
|
83297
|
-
}
|
|
83298
|
-
let span = `${fmt_intl(start, loc, opts)} – ${fmt_intl(end, loc, opts)}`;
|
|
83299
|
-
return this_year ? span : `${span} ${start.getFullYear()}`;
|
|
83300
|
-
}
|
|
83301
|
-
//#endregion
|
|
83302
83543
|
//#region src/c_yui_period.js
|
|
83303
83544
|
/***********************************************************************
|
|
83304
83545
|
* c_yui_period.js
|
|
@@ -86235,6 +86476,6 @@ function setup_json_pad(self) {
|
|
|
86235
86476
|
return win;
|
|
86236
86477
|
}
|
|
86237
86478
|
//#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 };
|
|
86479
|
+
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
86480
|
|
|
86240
86481
|
//# sourceMappingURL=gobj-ui.es.js.map
|