@okam/stack-ui 1.30.0 → 1.30.1
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/components/Popover/index.d.ts +3 -1
- package/index.js +1 -1
- package/index10.js +1 -1
- package/index10.mjs +1 -0
- package/index102.js +1 -1
- package/index102.mjs +3 -3
- package/index103.js +1 -1
- package/index103.mjs +1 -1
- package/index110.js +1 -1
- package/index110.mjs +2 -2
- package/index116.js +1 -1
- package/index116.mjs +9 -9
- package/index117.js +1 -1
- package/index117.mjs +9 -9
- package/index121.js +1 -1
- package/index121.mjs +2 -2
- package/index127.js +1 -1
- package/index127.mjs +46 -12
- package/index128.js +1 -1
- package/index128.mjs +241 -46
- package/index129.js +2 -1
- package/index129.mjs +13 -241
- package/index13.js +1 -1
- package/index13.mjs +9 -8
- package/index130.js +1 -2
- package/index130.mjs +29 -12
- package/index131.js +1 -1
- package/index131.mjs +11 -29
- package/index132.js +1 -1
- package/index132.mjs +2 -2
- package/index135.js +1 -1
- package/index135.mjs +196 -58
- package/index136.js +1 -1
- package/index136.mjs +60 -90
- package/index137.js +1 -1
- package/index137.mjs +140 -32
- package/index138.js +1 -1
- package/index138.mjs +114 -116
- package/index139.js +1 -1
- package/index139.mjs +217 -27
- package/index140.js +1 -1
- package/index140.mjs +188 -122
- package/index141.js +1 -1
- package/index141.mjs +67 -132
- package/index142.js +1 -1
- package/index142.mjs +258 -14
- package/index143.js +1 -1
- package/index143.mjs +92 -90
- package/index144.js +1 -1
- package/index144.mjs +172 -104
- package/index145.js +1 -1
- package/index145.mjs +84 -5
- package/index146.js +1 -1
- package/index146.mjs +58 -3
- package/index147.js +1 -1
- package/index147.mjs +123 -122
- package/index148.js +1 -1
- package/index148.mjs +113 -26
- package/index149.js +1 -1
- package/index149.mjs +119 -48
- package/index150.js +1 -1
- package/index150.mjs +72 -44
- package/index151.js +1 -1
- package/index151.mjs +107 -34
- package/index152.js +1 -1
- package/index152.mjs +50 -111
- package/index153.js +1 -1
- package/index153.mjs +93 -77
- package/index154.js +1 -1
- package/index154.mjs +70 -101
- package/index155.js +1 -1
- package/index155.mjs +57 -98
- package/index156.js +1 -1
- package/index156.mjs +92 -192
- package/index157.js +5 -1
- package/index157.mjs +75 -59
- package/index158.js +1 -1
- package/index158.mjs +1995 -125
- package/index159.js +1 -1
- package/index159.mjs +56 -116
- package/index160.js +1 -1
- package/index160.mjs +185 -214
- package/index161.js +1 -1
- package/index161.mjs +58 -187
- package/index162.js +1 -1
- package/index162.mjs +89 -64
- package/index163.js +1 -1
- package/index163.mjs +32 -257
- package/index164.js +1 -1
- package/index164.mjs +117 -93
- package/index165.js +1 -1
- package/index165.mjs +27 -174
- package/index166.js +1 -1
- package/index166.mjs +123 -83
- package/index167.js +1 -1
- package/index167.mjs +132 -56
- package/index168.js +1 -1
- package/index168.mjs +14 -126
- package/index169.js +1 -1
- package/index169.mjs +92 -113
- package/index170.js +1 -1
- package/index170.mjs +103 -119
- package/index171.js +1 -1
- package/index171.mjs +5 -72
- package/index172.js +1 -1
- package/index172.mjs +3 -110
- package/index173.js +1 -1
- package/index173.mjs +124 -51
- package/index174.js +1 -1
- package/index174.mjs +29 -93
- package/index175.js +1 -1
- package/index175.mjs +51 -70
- package/index176.js +1 -1
- package/index176.mjs +44 -56
- package/index177.js +1 -1
- package/index177.mjs +36 -98
- package/index178.js +1 -5
- package/index178.mjs +111 -78
- package/index179.js +1 -1
- package/index179.mjs +74 -2008
- package/index180.js +1 -1
- package/index180.mjs +99 -57
- package/index181.js +1 -1
- package/index181.mjs +98 -189
- package/index182.js +1 -1
- package/index182.mjs +130 -5
- package/index183.js +1 -1
- package/index183.mjs +172 -123
- package/index184.js +1 -1
- package/index184.mjs +8 -178
- package/index185.js +1 -1
- package/index185.mjs +3 -9
- package/index186.js +1 -1
- package/index186.mjs +36 -3
- package/index187.js +1 -1
- package/index187.mjs +5 -36
- package/index188.js +1 -1
- package/index188.mjs +29 -5
- package/index189.js +1 -1
- package/index189.mjs +6 -29
- package/index190.js +1 -1
- package/index190.mjs +5 -6
- package/index191.js +1 -1
- package/index191.mjs +1 -1
- package/index2.js +1 -1
- package/index2.mjs +44 -43
- package/index23.js +1 -1
- package/index23.mjs +39 -38
- package/index24.js +1 -1
- package/index24.mjs +40 -39
- package/index6.js +1 -1
- package/index6.mjs +34 -34
- package/index88.js +1 -1
- package/index88.mjs +16 -13
- package/index98.js +1 -1
- package/index98.mjs +3 -3
- package/index99.js +1 -1
- package/index99.mjs +1 -1
- package/package.json +1 -1
- package/theme/DatePicker/index.d.ts +3 -2
package/index165.mjs
CHANGED
|
@@ -1,177 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
let r = null;
|
|
29
|
-
function c(e) {
|
|
30
|
-
const a = r;
|
|
31
|
-
a.length !== 0 && (a.innerHTML = "", a.innerHTML = e);
|
|
32
|
-
}
|
|
33
|
-
function T(e) {
|
|
34
|
-
const a = () => Math.round(16 * Math.random()).toString(16);
|
|
35
|
-
return "x".repeat(e).replace(/x/g, a);
|
|
36
|
-
}
|
|
37
|
-
function p(e) {
|
|
38
|
-
e = n(e), e.forEach((a) => {
|
|
39
|
-
a.setAttribute("tabIndex", "0");
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function b(e) {
|
|
43
|
-
e = n(e), e.forEach((a) => {
|
|
44
|
-
a.setAttribute("tabIndex", "-1");
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
function m(e, a) {
|
|
48
|
-
e = n(e), e.forEach((t) => {
|
|
49
|
-
t.setAttribute("role", a);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function h(e, a) {
|
|
53
|
-
e = n(e), e.forEach((t) => {
|
|
54
|
-
t.setAttribute("aria-roledescription", a);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function P(e, a) {
|
|
58
|
-
e = n(e), e.forEach((t) => {
|
|
59
|
-
t.setAttribute("aria-controls", a);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function f(e, a) {
|
|
63
|
-
e = n(e), e.forEach((t) => {
|
|
64
|
-
t.setAttribute("aria-label", a);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function D(e, a) {
|
|
68
|
-
e = n(e), e.forEach((t) => {
|
|
69
|
-
t.setAttribute("id", a);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function N(e, a) {
|
|
73
|
-
e = n(e), e.forEach((t) => {
|
|
74
|
-
t.setAttribute("aria-live", a);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function y(e) {
|
|
78
|
-
e = n(e), e.forEach((a) => {
|
|
79
|
-
a.setAttribute("aria-disabled", !0);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
function M(e) {
|
|
83
|
-
e = n(e), e.forEach((a) => {
|
|
84
|
-
a.setAttribute("aria-disabled", !1);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
function d(e) {
|
|
88
|
-
if (e.keyCode !== 13 && e.keyCode !== 32) return;
|
|
89
|
-
const a = i.params.a11y, t = e.target;
|
|
90
|
-
i.pagination && i.pagination.el && (t === i.pagination.el || i.pagination.el.contains(e.target)) && !e.target.matches(v(i.params.pagination.bulletClass)) || (i.navigation && i.navigation.nextEl && t === i.navigation.nextEl && (i.isEnd && !i.params.loop || i.slideNext(), i.isEnd ? c(a.lastSlideMessage) : c(a.nextSlideMessage)), i.navigation && i.navigation.prevEl && t === i.navigation.prevEl && (i.isBeginning && !i.params.loop || i.slidePrev(), i.isBeginning ? c(a.firstSlideMessage) : c(a.prevSlideMessage)), i.pagination && t.matches(v(i.params.pagination.bulletClass)) && t.click());
|
|
91
|
-
}
|
|
92
|
-
function B() {
|
|
93
|
-
if (i.params.loop || i.params.rewind || !i.navigation) return;
|
|
94
|
-
const {
|
|
95
|
-
nextEl: e,
|
|
96
|
-
prevEl: a
|
|
97
|
-
} = i.navigation;
|
|
98
|
-
a && (i.isBeginning ? (y(a), b(a)) : (M(a), p(a))), e && (i.isEnd ? (y(e), b(e)) : (M(e), p(e)));
|
|
99
|
-
}
|
|
100
|
-
function x() {
|
|
101
|
-
return i.pagination && i.pagination.bullets && i.pagination.bullets.length;
|
|
102
|
-
}
|
|
103
|
-
function L() {
|
|
104
|
-
return x() && i.params.pagination.clickable;
|
|
105
|
-
}
|
|
106
|
-
function F() {
|
|
107
|
-
const e = i.params.a11y;
|
|
108
|
-
x() && i.pagination.bullets.forEach((a) => {
|
|
109
|
-
i.params.pagination.clickable && (p(a), i.params.pagination.renderBullet || (m(a, "button"), f(a, e.paginationBulletMessage.replace(/\{\{index\}\}/, q(a) + 1)))), a.matches(v(i.params.pagination.bulletActiveClass)) ? a.setAttribute("aria-current", "true") : a.removeAttribute("aria-current");
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
const A = (e, a, t) => {
|
|
113
|
-
p(e), e.tagName !== "BUTTON" && (m(e, "button"), e.addEventListener("keydown", d)), f(e, t), P(e, a);
|
|
114
|
-
}, k = () => {
|
|
115
|
-
i.a11y.clicked = !0;
|
|
116
|
-
}, w = () => {
|
|
117
|
-
requestAnimationFrame(() => {
|
|
118
|
-
requestAnimationFrame(() => {
|
|
119
|
-
i.destroyed || (i.a11y.clicked = !1);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
}, S = (e) => {
|
|
123
|
-
if (i.a11y.clicked) return;
|
|
124
|
-
const a = e.target.closest(`.${i.params.slideClass}, swiper-slide`);
|
|
125
|
-
if (!a || !i.slides.includes(a)) return;
|
|
126
|
-
const t = i.slides.indexOf(a) === i.activeIndex, s = i.params.watchSlidesProgress && i.visibleSlides && i.visibleSlides.includes(a);
|
|
127
|
-
t || s || e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents || (i.isHorizontal() ? i.el.scrollLeft = 0 : i.el.scrollTop = 0, i.slideTo(i.slides.indexOf(a), 0));
|
|
128
|
-
}, C = () => {
|
|
129
|
-
const e = i.params.a11y;
|
|
130
|
-
e.itemRoleDescriptionMessage && h(i.slides, e.itemRoleDescriptionMessage), e.slideRole && m(i.slides, e.slideRole);
|
|
131
|
-
const a = i.slides.length;
|
|
132
|
-
e.slideLabelMessage && i.slides.forEach((t, s) => {
|
|
133
|
-
const E = i.params.loop ? parseInt(t.getAttribute("data-swiper-slide-index"), 10) : s, l = e.slideLabelMessage.replace(/\{\{index\}\}/, E + 1).replace(/\{\{slidesLength\}\}/, a);
|
|
134
|
-
f(t, l);
|
|
135
|
-
});
|
|
136
|
-
}, O = () => {
|
|
137
|
-
const e = i.params.a11y;
|
|
138
|
-
i.el.append(r);
|
|
139
|
-
const a = i.el;
|
|
140
|
-
e.containerRoleDescriptionMessage && h(a, e.containerRoleDescriptionMessage), e.containerMessage && f(a, e.containerMessage);
|
|
141
|
-
const t = i.wrapperEl, s = e.id || t.getAttribute("id") || `swiper-wrapper-${T(16)}`, E = i.params.autoplay && i.params.autoplay.enabled ? "off" : "polite";
|
|
142
|
-
D(t, s), N(t, E), C();
|
|
143
|
-
let {
|
|
144
|
-
nextEl: l,
|
|
145
|
-
prevEl: g
|
|
146
|
-
} = i.navigation ? i.navigation : {};
|
|
147
|
-
l = n(l), g = n(g), l && l.forEach((u) => A(u, s, e.nextSlideMessage)), g && g.forEach((u) => A(u, s, e.prevSlideMessage)), L() && n(i.pagination.el).forEach((H) => {
|
|
148
|
-
H.addEventListener("keydown", d);
|
|
149
|
-
}), i.el.addEventListener("focus", S, !0), i.el.addEventListener("pointerdown", k, !0), i.el.addEventListener("pointerup", w, !0);
|
|
150
|
-
};
|
|
151
|
-
function G() {
|
|
152
|
-
r && r.remove();
|
|
153
|
-
let {
|
|
154
|
-
nextEl: e,
|
|
155
|
-
prevEl: a
|
|
156
|
-
} = i.navigation ? i.navigation : {};
|
|
157
|
-
e = n(e), a = n(a), e && e.forEach((t) => t.removeEventListener("keydown", d)), a && a.forEach((t) => t.removeEventListener("keydown", d)), L() && n(i.pagination.el).forEach((s) => {
|
|
158
|
-
s.removeEventListener("keydown", d);
|
|
159
|
-
}), i.el.removeEventListener("focus", S, !0), i.el.removeEventListener("pointerdown", k, !0), i.el.removeEventListener("pointerup", w, !0);
|
|
160
|
-
}
|
|
161
|
-
o("beforeInit", () => {
|
|
162
|
-
r = U("span", i.params.a11y.notificationClass), r.setAttribute("aria-live", "assertive"), r.setAttribute("aria-atomic", "true");
|
|
163
|
-
}), o("afterInit", () => {
|
|
164
|
-
i.params.a11y.enabled && O();
|
|
165
|
-
}), o("slidesLengthChange snapGridLengthChange slidesGridLengthChange", () => {
|
|
166
|
-
i.params.a11y.enabled && C();
|
|
167
|
-
}), o("fromEdge toEdge afterInit lock unlock", () => {
|
|
168
|
-
i.params.a11y.enabled && B();
|
|
169
|
-
}), o("paginationUpdate", () => {
|
|
170
|
-
i.params.a11y.enabled && F();
|
|
171
|
-
}), o("destroy", () => {
|
|
172
|
-
i.params.a11y.enabled && G();
|
|
173
|
-
});
|
|
1
|
+
import { useState as C, useRef as $, useEffect as S, useCallback as V } from "react";
|
|
2
|
+
function w(o, d, c) {
|
|
3
|
+
let [p, s] = C(o || d), u = $(o !== void 0), e = o !== void 0;
|
|
4
|
+
S(() => {
|
|
5
|
+
let t = u.current;
|
|
6
|
+
t !== e && console.warn(`WARN: A component changed from ${t ? "controlled" : "uncontrolled"} to ${e ? "controlled" : "uncontrolled"}.`), u.current = e;
|
|
7
|
+
}, [
|
|
8
|
+
e
|
|
9
|
+
]);
|
|
10
|
+
let n = e ? o : p, b = V((t, ...i) => {
|
|
11
|
+
let f = (r, ...l) => {
|
|
12
|
+
c && (Object.is(n, r) || c(r, ...l)), e || (n = r);
|
|
13
|
+
};
|
|
14
|
+
typeof t == "function" ? (console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), s((l, ...m) => {
|
|
15
|
+
let a = t(e ? n : l, ...m);
|
|
16
|
+
return f(a, ...i), e ? l : a;
|
|
17
|
+
})) : (e || s(t), f(t, ...i));
|
|
18
|
+
}, [
|
|
19
|
+
e,
|
|
20
|
+
n,
|
|
21
|
+
c
|
|
22
|
+
]);
|
|
23
|
+
return [
|
|
24
|
+
n,
|
|
25
|
+
b
|
|
26
|
+
];
|
|
174
27
|
}
|
|
175
28
|
export {
|
|
176
|
-
|
|
29
|
+
w as useControlledState
|
|
177
30
|
};
|
package/index166.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index167.js"),l=require("./index132.js"),d=require("./index168.js"),f=require("./index169.js"),u=require("./index170.js"),y=require("./index171.js");function m(s){let t=typeof s[0]=="object"?s.shift():new f.GregorianCalendar,e;if(typeof s[0]=="string")e=s.shift();else{let a=t.getEras();e=a[a.length-1]}let r=s.shift(),n=s.shift(),h=s.shift();return[t,e,r,n,h]}var p=new WeakMap;class c{copy(){return this.era?new c(this.calendar,this.era,this.year,this.month,this.day):new c(this.calendar,this.year,this.month,this.day)}add(t){return i.add(this,t)}subtract(t){return i.subtract(this,t)}set(t){return i.set(this,t)}cycle(t,e,r){return i.cycleDate(this,t,e,r)}toDate(t){return u.toDate(this,t)}toString(){return d.dateToString(this)}compare(t){return l.compareDate(this,t)}constructor(...t){y._class_private_field_init(this,p,{writable:!0,value:void 0});let[e,r,n,h,a]=m(t);this.calendar=e,this.era=r,this.year=n,this.month=h,this.day=a,i.constrain(this)}}var v=new WeakMap;class o{copy(){return this.era?new o(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new o(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return i.add(this,t)}subtract(t){return i.subtract(this,t)}set(t){return i.set(i.setTime(this,t),t)}cycle(t,e,r){switch(t){case"era":case"year":case"month":case"day":return i.cycleDate(this,t,e,r);default:return i.cycleTime(this,t,e,r)}}toDate(t,e){return u.toDate(this,t,e)}toString(){return d.dateTimeToString(this)}compare(t){let e=l.compareDate(this,t);return e===0?l.compareTime(this,u.toCalendarDateTime(t)):e}constructor(...t){y._class_private_field_init(this,v,{writable:!0,value:void 0});let[e,r,n,h,a]=m(t);this.calendar=e,this.era=r,this.year=n,this.month=h,this.day=a,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,i.constrain(this)}}exports.CalendarDate=c;exports.CalendarDateTime=o;
|
package/index166.mjs
CHANGED
|
@@ -1,87 +1,127 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
import { add as n, subtract as o, set as $, cycleDate as f, constrain as l, setTime as b, cycleTime as x } from "./index167.mjs";
|
|
2
|
+
import { compareDate as m, compareTime as v } from "./index132.mjs";
|
|
3
|
+
import { dateToString as w, dateTimeToString as D } from "./index168.mjs";
|
|
4
|
+
import { GregorianCalendar as T } from "./index169.mjs";
|
|
5
|
+
import { toDate as u, toCalendarDateTime as C } from "./index170.mjs";
|
|
6
|
+
import { _class_private_field_init as p } from "./index171.mjs";
|
|
7
|
+
function y(r) {
|
|
8
|
+
let t = typeof r[0] == "object" ? r.shift() : new T(), e;
|
|
9
|
+
if (typeof r[0] == "string") e = r.shift();
|
|
10
|
+
else {
|
|
11
|
+
let s = t.getEras();
|
|
12
|
+
e = s[s.length - 1];
|
|
13
|
+
}
|
|
14
|
+
let a = r.shift(), i = r.shift(), h = r.shift();
|
|
15
|
+
return [
|
|
16
|
+
t,
|
|
17
|
+
e,
|
|
18
|
+
a,
|
|
19
|
+
i,
|
|
20
|
+
h
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
var S = /* @__PURE__ */ new WeakMap();
|
|
24
|
+
class d {
|
|
25
|
+
/** Returns a copy of this date. */
|
|
26
|
+
copy() {
|
|
27
|
+
return this.era ? new d(this.calendar, this.era, this.year, this.month, this.day) : new d(this.calendar, this.year, this.month, this.day);
|
|
28
|
+
}
|
|
29
|
+
/** Returns a new `CalendarDate` with the given duration added to it. */
|
|
30
|
+
add(t) {
|
|
31
|
+
return n(this, t);
|
|
32
|
+
}
|
|
33
|
+
/** Returns a new `CalendarDate` with the given duration subtracted from it. */
|
|
34
|
+
subtract(t) {
|
|
35
|
+
return o(this, t);
|
|
36
|
+
}
|
|
37
|
+
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
38
|
+
set(t) {
|
|
39
|
+
return $(this, t);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
|
|
43
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
44
|
+
*/
|
|
45
|
+
cycle(t, e, a) {
|
|
46
|
+
return f(this, t, e, a);
|
|
47
|
+
}
|
|
48
|
+
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
|
|
49
|
+
toDate(t) {
|
|
50
|
+
return u(this, t);
|
|
51
|
+
}
|
|
52
|
+
/** Converts the date to an ISO 8601 formatted string. */
|
|
53
|
+
toString() {
|
|
54
|
+
return w(this);
|
|
55
|
+
}
|
|
56
|
+
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
57
|
+
compare(t) {
|
|
58
|
+
return m(this, t);
|
|
59
|
+
}
|
|
60
|
+
constructor(...t) {
|
|
61
|
+
p(this, S, {
|
|
62
|
+
writable: !0,
|
|
63
|
+
value: void 0
|
|
64
|
+
});
|
|
65
|
+
let [e, a, i, h, s] = y(t);
|
|
66
|
+
this.calendar = e, this.era = a, this.year = i, this.month = h, this.day = s, l(this);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
var k = /* @__PURE__ */ new WeakMap();
|
|
70
|
+
class c {
|
|
71
|
+
/** Returns a copy of this date. */
|
|
72
|
+
copy() {
|
|
73
|
+
return this.era ? new c(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond) : new c(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
74
|
+
}
|
|
75
|
+
/** Returns a new `CalendarDateTime` with the given duration added to it. */
|
|
76
|
+
add(t) {
|
|
77
|
+
return n(this, t);
|
|
78
|
+
}
|
|
79
|
+
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
|
|
80
|
+
subtract(t) {
|
|
81
|
+
return o(this, t);
|
|
82
|
+
}
|
|
83
|
+
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
84
|
+
set(t) {
|
|
85
|
+
return $(b(this, t), t);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
|
|
89
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
90
|
+
*/
|
|
91
|
+
cycle(t, e, a) {
|
|
92
|
+
switch (t) {
|
|
93
|
+
case "era":
|
|
94
|
+
case "year":
|
|
95
|
+
case "month":
|
|
96
|
+
case "day":
|
|
97
|
+
return f(this, t, e, a);
|
|
98
|
+
default:
|
|
99
|
+
return x(this, t, e, a);
|
|
70
100
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
}
|
|
102
|
+
/** Converts the date to a native JavaScript Date object in the given time zone. */
|
|
103
|
+
toDate(t, e) {
|
|
104
|
+
return u(this, t, e);
|
|
105
|
+
}
|
|
106
|
+
/** Converts the date to an ISO 8601 formatted string. */
|
|
107
|
+
toString() {
|
|
108
|
+
return D(this);
|
|
109
|
+
}
|
|
110
|
+
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
111
|
+
compare(t) {
|
|
112
|
+
let e = m(this, t);
|
|
113
|
+
return e === 0 ? v(this, C(t)) : e;
|
|
114
|
+
}
|
|
115
|
+
constructor(...t) {
|
|
116
|
+
p(this, k, {
|
|
117
|
+
writable: !0,
|
|
118
|
+
value: void 0
|
|
119
|
+
});
|
|
120
|
+
let [e, a, i, h, s] = y(t);
|
|
121
|
+
this.calendar = e, this.era = a, this.year = i, this.month = h, this.day = s, this.hour = t.shift() || 0, this.minute = t.shift() || 0, this.second = t.shift() || 0, this.millisecond = t.shift() || 0, l(this);
|
|
122
|
+
}
|
|
84
123
|
}
|
|
85
124
|
export {
|
|
86
|
-
|
|
125
|
+
d as CalendarDate,
|
|
126
|
+
c as CalendarDateTime
|
|
87
127
|
};
|
package/index167.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function $(n,e){let r=n.copy(),a="hour"in r?Y(r,e):0;f(r,e.years||0),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,n),r.month+=e.months||0,s(r),M(r),r.day+=(e.weeks||0)*7,r.day+=e.days||0,r.day+=a,b(r),r.calendar.balanceDate&&r.calendar.balanceDate(r),r.year<1&&(r.year=1,r.month=1,r.day=1);let c=r.calendar.getYearsInEra(r);if(r.year>c){var d,h;let o=(d=(h=r.calendar).isInverseEra)===null||d===void 0?void 0:d.call(h,r);r.year=c,r.month=o?1:r.calendar.getMonthsInYear(r),r.day=o?1:r.calendar.getDaysInMonth(r)}r.month<1&&(r.month=1,r.day=1);let l=r.calendar.getMonthsInYear(r);return r.month>l&&(r.month=l,r.day=r.calendar.getDaysInMonth(r)),r.day=Math.max(1,Math.min(r.calendar.getDaysInMonth(r),r.day)),r}function f(n,e){var r,a;!((r=(a=n.calendar).isInverseEra)===null||r===void 0)&&r.call(a,n)&&(e=-e),n.year+=e}function s(n){for(;n.month<1;)f(n,-1),n.month+=n.calendar.getMonthsInYear(n);let e=0;for(;n.month>(e=n.calendar.getMonthsInYear(n));)n.month-=e,f(n,1)}function b(n){for(;n.day<1;)n.month--,s(n),n.day+=n.calendar.getDaysInMonth(n);for(;n.day>n.calendar.getDaysInMonth(n);)n.day-=n.calendar.getDaysInMonth(n),n.month++,s(n)}function M(n){n.month=Math.max(1,Math.min(n.calendar.getMonthsInYear(n),n.month)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day))}function y(n){n.calendar.constrainDate&&n.calendar.constrainDate(n),n.year=Math.max(1,Math.min(n.calendar.getYearsInEra(n),n.year)),M(n)}function u(n){let e={};for(let r in n)typeof n[r]=="number"&&(e[r]=-n[r]);return e}function g(n,e){return $(n,u(e))}function I(n,e){let r=n.copy();return e.era!=null&&(r.era=e.era),e.year!=null&&(r.year=e.year),e.month!=null&&(r.month=e.month),e.day!=null&&(r.day=e.day),y(r),r}function x(n,e){let r=n.copy();return e.hour!=null&&(r.hour=e.hour),e.minute!=null&&(r.minute=e.minute),e.second!=null&&(r.second=e.second),e.millisecond!=null&&(r.millisecond=e.millisecond),m(r),r}function D(n){n.second+=Math.floor(n.millisecond/1e3),n.millisecond=i(n.millisecond,1e3),n.minute+=Math.floor(n.second/60),n.second=i(n.second,60),n.hour+=Math.floor(n.minute/60),n.minute=i(n.minute,60);let e=Math.floor(n.hour/24);return n.hour=i(n.hour,24),e}function m(n){n.millisecond=Math.max(0,Math.min(n.millisecond,1e3)),n.second=Math.max(0,Math.min(n.second,59)),n.minute=Math.max(0,Math.min(n.minute,59)),n.hour=Math.max(0,Math.min(n.hour,23))}function i(n,e){let r=n%e;return r<0&&(r+=e),r}function Y(n,e){return n.hour+=e.hours||0,n.minute+=e.minutes||0,n.second+=e.seconds||0,n.millisecond+=e.milliseconds||0,D(n)}function w(n,e,r,a){let c=n.copy();switch(e){case"era":{let l=n.calendar.getEras(),o=l.indexOf(n.era);if(o<0)throw new Error("Invalid era: "+n.era);o=t(o,r,0,l.length-1,a==null?void 0:a.round),c.era=l[o],y(c);break}case"year":var d,h;!((d=(h=c.calendar).isInverseEra)===null||d===void 0)&&d.call(h,c)&&(r=-r),c.year=t(n.year,r,-1/0,9999,a==null?void 0:a.round),c.year===-1/0&&(c.year=1),c.calendar.balanceYearMonth&&c.calendar.balanceYearMonth(c,n);break;case"month":c.month=t(n.month,r,1,n.calendar.getMonthsInYear(n),a==null?void 0:a.round);break;case"day":c.day=t(n.day,r,1,n.calendar.getDaysInMonth(n),a==null?void 0:a.round);break;default:throw new Error("Unsupported field "+e)}return n.calendar.balanceDate&&n.calendar.balanceDate(c),y(c),c}function k(n,e,r,a){let c=n.copy();switch(e){case"hour":{let d=n.hour,h=0,l=23;if((a==null?void 0:a.hourCycle)===12){let o=d>=12;h=o?12:0,l=o?23:11}c.hour=t(d,r,h,l,a==null?void 0:a.round);break}case"minute":c.minute=t(n.minute,r,0,59,a==null?void 0:a.round);break;case"second":c.second=t(n.second,r,0,59,a==null?void 0:a.round);break;case"millisecond":c.millisecond=t(n.millisecond,r,0,999,a==null?void 0:a.round);break;default:throw new Error("Unsupported field "+e)}return c}function t(n,e,r,a,c=!1){if(c){n+=Math.sign(e),n<r&&(n=a);let d=Math.abs(e);e>0?n=Math.ceil(n/d)*d:n=Math.floor(n/d)*d,n>a&&(n=r)}else n+=e,n<r?n=a-(r-n-1):n>a&&(n=r+(n-a-1));return n}exports.add=$;exports.constrain=y;exports.constrainTime=m;exports.cycleDate=w;exports.cycleTime=k;exports.invertDuration=u;exports.set=I;exports.setTime=x;exports.subtract=g;
|