@jsenv/navi 0.27.11 → 0.27.13
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/dist/jsenv_navi.js +131 -70
- package/dist/jsenv_navi.js.map +18 -15
- package/package.json +2 -2
package/dist/jsenv_navi.js
CHANGED
|
@@ -32607,6 +32607,11 @@ const Time = props => {
|
|
|
32607
32607
|
...props
|
|
32608
32608
|
});
|
|
32609
32609
|
}
|
|
32610
|
+
if (type === "minute") {
|
|
32611
|
+
return jsx(TimeMinute, {
|
|
32612
|
+
...props
|
|
32613
|
+
});
|
|
32614
|
+
}
|
|
32610
32615
|
return jsx(TimeRelative, {
|
|
32611
32616
|
...props
|
|
32612
32617
|
});
|
|
@@ -32620,6 +32625,12 @@ const TimeDate = ({
|
|
|
32620
32625
|
...props
|
|
32621
32626
|
}) => {
|
|
32622
32627
|
const lang = locale || langSignal.value;
|
|
32628
|
+
if (children === undefined) {
|
|
32629
|
+
return jsx(TimeText, {
|
|
32630
|
+
...props,
|
|
32631
|
+
children: formatDatePlaceholder(lang)
|
|
32632
|
+
});
|
|
32633
|
+
}
|
|
32623
32634
|
const date = toDate(children, value => {
|
|
32624
32635
|
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
32625
32636
|
const d = new Date(`${value}T00:00:00`);
|
|
@@ -32627,33 +32638,32 @@ const TimeDate = ({
|
|
|
32627
32638
|
}
|
|
32628
32639
|
return null;
|
|
32629
32640
|
});
|
|
32641
|
+
if (!date) {
|
|
32642
|
+
return jsx(TimeText, {
|
|
32643
|
+
...props,
|
|
32644
|
+
children: String(children)
|
|
32645
|
+
});
|
|
32646
|
+
}
|
|
32647
|
+
const base = formatDay(date, lang, {
|
|
32648
|
+
long
|
|
32649
|
+
});
|
|
32630
32650
|
let text;
|
|
32631
|
-
|
|
32632
|
-
|
|
32633
|
-
|
|
32634
|
-
|
|
32635
|
-
|
|
32636
|
-
|
|
32637
|
-
const offset = getRelativeDay(date, {
|
|
32638
|
-
now
|
|
32639
|
-
});
|
|
32640
|
-
if (offset >= -1 && offset <= 1) {
|
|
32641
|
-
text = `${base} (${formatDayRelative(offset, lang)})`;
|
|
32642
|
-
} else {
|
|
32643
|
-
text = base;
|
|
32644
|
-
}
|
|
32651
|
+
if (dayLabel) {
|
|
32652
|
+
const offset = getRelativeDay(date, {
|
|
32653
|
+
now
|
|
32654
|
+
});
|
|
32655
|
+
if (offset >= -1 && offset <= 1) {
|
|
32656
|
+
text = `${base} (${formatDayRelative(offset, lang)})`;
|
|
32645
32657
|
} else {
|
|
32646
32658
|
text = base;
|
|
32647
32659
|
}
|
|
32648
|
-
const yyyy = date.getFullYear();
|
|
32649
|
-
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
32650
|
-
const dd = String(date.getDate()).padStart(2, "0");
|
|
32651
|
-
dateTime = `${yyyy}-${mm}-${dd}`;
|
|
32652
|
-
} else if (children === undefined) {
|
|
32653
|
-
text = formatDatePlaceholder(lang);
|
|
32654
32660
|
} else {
|
|
32655
|
-
text =
|
|
32661
|
+
text = base;
|
|
32656
32662
|
}
|
|
32663
|
+
const yyyy = date.getFullYear();
|
|
32664
|
+
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
32665
|
+
const dd = String(date.getDate()).padStart(2, "0");
|
|
32666
|
+
const dateTime = `${yyyy}-${mm}-${dd}`; // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time#datetime
|
|
32657
32667
|
return jsx(TimeText, {
|
|
32658
32668
|
dateTime: dateTime,
|
|
32659
32669
|
...props,
|
|
@@ -32666,6 +32676,12 @@ const TimeMonth = ({
|
|
|
32666
32676
|
...props
|
|
32667
32677
|
}) => {
|
|
32668
32678
|
const lang = locale || langSignal.value;
|
|
32679
|
+
if (children === undefined) {
|
|
32680
|
+
return jsx(TimeText, {
|
|
32681
|
+
...props,
|
|
32682
|
+
children: formatMonthPlaceholder(lang)
|
|
32683
|
+
});
|
|
32684
|
+
}
|
|
32669
32685
|
const date = toDate(children, value => {
|
|
32670
32686
|
if (/^\d{4}-\d{2}$/.test(value)) {
|
|
32671
32687
|
const d = new Date(`${value}-01T00:00:00`);
|
|
@@ -32673,18 +32689,16 @@ const TimeMonth = ({
|
|
|
32673
32689
|
}
|
|
32674
32690
|
return null;
|
|
32675
32691
|
});
|
|
32676
|
-
|
|
32677
|
-
|
|
32678
|
-
|
|
32679
|
-
|
|
32680
|
-
|
|
32681
|
-
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
32682
|
-
dateTime = `${yyyy}-${mm}`;
|
|
32683
|
-
} else if (children === undefined) {
|
|
32684
|
-
text = formatMonthPlaceholder(lang);
|
|
32685
|
-
} else {
|
|
32686
|
-
text = String(children);
|
|
32692
|
+
if (!date) {
|
|
32693
|
+
return jsx(TimeText, {
|
|
32694
|
+
...props,
|
|
32695
|
+
children: String(children)
|
|
32696
|
+
});
|
|
32687
32697
|
}
|
|
32698
|
+
const text = formatMonth(date, lang);
|
|
32699
|
+
const yyyy = date.getFullYear();
|
|
32700
|
+
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
32701
|
+
const dateTime = `${yyyy}-${mm}`; // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time#datetime
|
|
32688
32702
|
return jsx(TimeText, {
|
|
32689
32703
|
dateTime: dateTime,
|
|
32690
32704
|
...props,
|
|
@@ -32697,18 +32711,17 @@ const TimeWeek = ({
|
|
|
32697
32711
|
...props
|
|
32698
32712
|
}) => {
|
|
32699
32713
|
const lang = locale || langSignal.value;
|
|
32700
|
-
|
|
32701
|
-
|
|
32702
|
-
|
|
32703
|
-
|
|
32704
|
-
|
|
32705
|
-
} else {
|
|
32706
|
-
text = formatWeekPlaceholder(lang);
|
|
32714
|
+
if (children === undefined || children === null) {
|
|
32715
|
+
return jsx(TimeText, {
|
|
32716
|
+
...props,
|
|
32717
|
+
children: formatWeekPlaceholder(lang)
|
|
32718
|
+
});
|
|
32707
32719
|
}
|
|
32720
|
+
const dateTime = String(children);
|
|
32708
32721
|
return jsx(TimeText, {
|
|
32709
32722
|
dateTime: dateTime,
|
|
32710
32723
|
...props,
|
|
32711
|
-
children:
|
|
32724
|
+
children: dateTime
|
|
32712
32725
|
});
|
|
32713
32726
|
};
|
|
32714
32727
|
const TimeDatetime = ({
|
|
@@ -32717,17 +32730,21 @@ const TimeDatetime = ({
|
|
|
32717
32730
|
...props
|
|
32718
32731
|
}) => {
|
|
32719
32732
|
const lang = locale || langSignal.value;
|
|
32733
|
+
if (children === undefined) {
|
|
32734
|
+
return jsx(TimeText, {
|
|
32735
|
+
...props,
|
|
32736
|
+
children: formatDatetimePlaceholder(lang)
|
|
32737
|
+
});
|
|
32738
|
+
}
|
|
32720
32739
|
const date = toDate(children);
|
|
32721
|
-
|
|
32722
|
-
|
|
32723
|
-
|
|
32724
|
-
|
|
32725
|
-
|
|
32726
|
-
} else if (children === undefined) {
|
|
32727
|
-
text = formatDatetimePlaceholder(lang);
|
|
32728
|
-
} else {
|
|
32729
|
-
text = String(children);
|
|
32740
|
+
if (!date) {
|
|
32741
|
+
return jsx(TimeText, {
|
|
32742
|
+
...props,
|
|
32743
|
+
children: String(children)
|
|
32744
|
+
});
|
|
32730
32745
|
}
|
|
32746
|
+
const text = formatDatetime(date, lang);
|
|
32747
|
+
const dateTime = date.toISOString(); // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time#datetime
|
|
32731
32748
|
return jsx(TimeText, {
|
|
32732
32749
|
dateTime: dateTime,
|
|
32733
32750
|
...props,
|
|
@@ -32740,6 +32757,12 @@ const TimeTime = ({
|
|
|
32740
32757
|
...props
|
|
32741
32758
|
}) => {
|
|
32742
32759
|
const lang = locale || langSignal.value;
|
|
32760
|
+
if (children === undefined) {
|
|
32761
|
+
return jsx(TimeText, {
|
|
32762
|
+
...props,
|
|
32763
|
+
children: "--:--"
|
|
32764
|
+
});
|
|
32765
|
+
}
|
|
32743
32766
|
const date = toDate(children, value => {
|
|
32744
32767
|
if (/^\d{2}:\d{2}(?::\d{2})?$/.test(value)) {
|
|
32745
32768
|
const d = new Date(`1970-01-01T${value}`);
|
|
@@ -32747,18 +32770,52 @@ const TimeTime = ({
|
|
|
32747
32770
|
}
|
|
32748
32771
|
return null;
|
|
32749
32772
|
});
|
|
32750
|
-
|
|
32751
|
-
|
|
32752
|
-
|
|
32753
|
-
|
|
32754
|
-
|
|
32755
|
-
|
|
32756
|
-
|
|
32757
|
-
|
|
32758
|
-
|
|
32773
|
+
if (!date) {
|
|
32774
|
+
return jsx(TimeText, {
|
|
32775
|
+
...props,
|
|
32776
|
+
children: children
|
|
32777
|
+
});
|
|
32778
|
+
}
|
|
32779
|
+
const text = formatTime(date, lang);
|
|
32780
|
+
const hh = String(date.getHours()).padStart(2, "0");
|
|
32781
|
+
const mm = String(date.getMinutes()).padStart(2, "0");
|
|
32782
|
+
const dateTime = `${hh}:${mm}`; // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time#datetime
|
|
32783
|
+
return jsx(TimeText, {
|
|
32784
|
+
dateTime: dateTime,
|
|
32785
|
+
...props,
|
|
32786
|
+
children: text
|
|
32787
|
+
});
|
|
32788
|
+
};
|
|
32789
|
+
const TimeMinute = ({
|
|
32790
|
+
children,
|
|
32791
|
+
locale,
|
|
32792
|
+
...props
|
|
32793
|
+
}) => {
|
|
32794
|
+
const lang = locale || langSignal.value;
|
|
32795
|
+
if (children === undefined) {
|
|
32796
|
+
return jsx(TimeText, {
|
|
32797
|
+
...props,
|
|
32798
|
+
children: "--:--"
|
|
32799
|
+
});
|
|
32800
|
+
}
|
|
32801
|
+
let minutes;
|
|
32802
|
+
if (typeof children === "number") {
|
|
32803
|
+
minutes = children;
|
|
32759
32804
|
} else {
|
|
32760
|
-
|
|
32805
|
+
const childrenAsNumber = Number(children);
|
|
32806
|
+
if (isNaN(childrenAsNumber)) {
|
|
32807
|
+
return jsx(TimeText, {
|
|
32808
|
+
...props,
|
|
32809
|
+
children: children
|
|
32810
|
+
});
|
|
32811
|
+
}
|
|
32812
|
+
minutes = childrenAsNumber;
|
|
32761
32813
|
}
|
|
32814
|
+
const date = new Date(1970, 0, 1, Math.floor(minutes / 60), minutes % 60, 0);
|
|
32815
|
+
const hh = String(date.getHours()).padStart(2, "0");
|
|
32816
|
+
const mm = String(date.getMinutes()).padStart(2, "0");
|
|
32817
|
+
const dateTime = `${hh}:${mm}`;
|
|
32818
|
+
const text = formatTime(date, lang);
|
|
32762
32819
|
return jsx(TimeText, {
|
|
32763
32820
|
dateTime: dateTime,
|
|
32764
32821
|
...props,
|
|
@@ -32773,19 +32830,23 @@ const TimeRelative = ({
|
|
|
32773
32830
|
...props
|
|
32774
32831
|
}) => {
|
|
32775
32832
|
const lang = locale || langSignal.value;
|
|
32833
|
+
if (children === undefined) {
|
|
32834
|
+
return jsx(TimeText, {
|
|
32835
|
+
...props,
|
|
32836
|
+
children: "\u2013"
|
|
32837
|
+
});
|
|
32838
|
+
}
|
|
32776
32839
|
const date = toDate(children);
|
|
32777
|
-
|
|
32778
|
-
|
|
32779
|
-
|
|
32780
|
-
|
|
32781
|
-
|
|
32782
|
-
});
|
|
32783
|
-
dateTime = date.toISOString();
|
|
32784
|
-
} else if (children === undefined) {
|
|
32785
|
-
text = "–";
|
|
32786
|
-
} else {
|
|
32787
|
-
text = String(children);
|
|
32840
|
+
if (!date) {
|
|
32841
|
+
return jsx(TimeText, {
|
|
32842
|
+
...props,
|
|
32843
|
+
children: String(children)
|
|
32844
|
+
});
|
|
32788
32845
|
}
|
|
32846
|
+
const text = formatTimeRelative(date, eventDuration, lang, {
|
|
32847
|
+
bare
|
|
32848
|
+
});
|
|
32849
|
+
const dateTime = date.toISOString();
|
|
32789
32850
|
return jsx(TimeText, {
|
|
32790
32851
|
dateTime: dateTime,
|
|
32791
32852
|
...props,
|