@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.
Files changed (160) hide show
  1. package/components/Popover/index.d.ts +3 -1
  2. package/index.js +1 -1
  3. package/index10.js +1 -1
  4. package/index10.mjs +1 -0
  5. package/index102.js +1 -1
  6. package/index102.mjs +3 -3
  7. package/index103.js +1 -1
  8. package/index103.mjs +1 -1
  9. package/index110.js +1 -1
  10. package/index110.mjs +2 -2
  11. package/index116.js +1 -1
  12. package/index116.mjs +9 -9
  13. package/index117.js +1 -1
  14. package/index117.mjs +9 -9
  15. package/index121.js +1 -1
  16. package/index121.mjs +2 -2
  17. package/index127.js +1 -1
  18. package/index127.mjs +46 -12
  19. package/index128.js +1 -1
  20. package/index128.mjs +241 -46
  21. package/index129.js +2 -1
  22. package/index129.mjs +13 -241
  23. package/index13.js +1 -1
  24. package/index13.mjs +9 -8
  25. package/index130.js +1 -2
  26. package/index130.mjs +29 -12
  27. package/index131.js +1 -1
  28. package/index131.mjs +11 -29
  29. package/index132.js +1 -1
  30. package/index132.mjs +2 -2
  31. package/index135.js +1 -1
  32. package/index135.mjs +196 -58
  33. package/index136.js +1 -1
  34. package/index136.mjs +60 -90
  35. package/index137.js +1 -1
  36. package/index137.mjs +140 -32
  37. package/index138.js +1 -1
  38. package/index138.mjs +114 -116
  39. package/index139.js +1 -1
  40. package/index139.mjs +217 -27
  41. package/index140.js +1 -1
  42. package/index140.mjs +188 -122
  43. package/index141.js +1 -1
  44. package/index141.mjs +67 -132
  45. package/index142.js +1 -1
  46. package/index142.mjs +258 -14
  47. package/index143.js +1 -1
  48. package/index143.mjs +92 -90
  49. package/index144.js +1 -1
  50. package/index144.mjs +172 -104
  51. package/index145.js +1 -1
  52. package/index145.mjs +84 -5
  53. package/index146.js +1 -1
  54. package/index146.mjs +58 -3
  55. package/index147.js +1 -1
  56. package/index147.mjs +123 -122
  57. package/index148.js +1 -1
  58. package/index148.mjs +113 -26
  59. package/index149.js +1 -1
  60. package/index149.mjs +119 -48
  61. package/index150.js +1 -1
  62. package/index150.mjs +72 -44
  63. package/index151.js +1 -1
  64. package/index151.mjs +107 -34
  65. package/index152.js +1 -1
  66. package/index152.mjs +50 -111
  67. package/index153.js +1 -1
  68. package/index153.mjs +93 -77
  69. package/index154.js +1 -1
  70. package/index154.mjs +70 -101
  71. package/index155.js +1 -1
  72. package/index155.mjs +57 -98
  73. package/index156.js +1 -1
  74. package/index156.mjs +92 -192
  75. package/index157.js +5 -1
  76. package/index157.mjs +75 -59
  77. package/index158.js +1 -1
  78. package/index158.mjs +1995 -125
  79. package/index159.js +1 -1
  80. package/index159.mjs +56 -116
  81. package/index160.js +1 -1
  82. package/index160.mjs +185 -214
  83. package/index161.js +1 -1
  84. package/index161.mjs +58 -187
  85. package/index162.js +1 -1
  86. package/index162.mjs +89 -64
  87. package/index163.js +1 -1
  88. package/index163.mjs +32 -257
  89. package/index164.js +1 -1
  90. package/index164.mjs +117 -93
  91. package/index165.js +1 -1
  92. package/index165.mjs +27 -174
  93. package/index166.js +1 -1
  94. package/index166.mjs +123 -83
  95. package/index167.js +1 -1
  96. package/index167.mjs +132 -56
  97. package/index168.js +1 -1
  98. package/index168.mjs +14 -126
  99. package/index169.js +1 -1
  100. package/index169.mjs +92 -113
  101. package/index170.js +1 -1
  102. package/index170.mjs +103 -119
  103. package/index171.js +1 -1
  104. package/index171.mjs +5 -72
  105. package/index172.js +1 -1
  106. package/index172.mjs +3 -110
  107. package/index173.js +1 -1
  108. package/index173.mjs +124 -51
  109. package/index174.js +1 -1
  110. package/index174.mjs +29 -93
  111. package/index175.js +1 -1
  112. package/index175.mjs +51 -70
  113. package/index176.js +1 -1
  114. package/index176.mjs +44 -56
  115. package/index177.js +1 -1
  116. package/index177.mjs +36 -98
  117. package/index178.js +1 -5
  118. package/index178.mjs +111 -78
  119. package/index179.js +1 -1
  120. package/index179.mjs +74 -2008
  121. package/index180.js +1 -1
  122. package/index180.mjs +99 -57
  123. package/index181.js +1 -1
  124. package/index181.mjs +98 -189
  125. package/index182.js +1 -1
  126. package/index182.mjs +130 -5
  127. package/index183.js +1 -1
  128. package/index183.mjs +172 -123
  129. package/index184.js +1 -1
  130. package/index184.mjs +8 -178
  131. package/index185.js +1 -1
  132. package/index185.mjs +3 -9
  133. package/index186.js +1 -1
  134. package/index186.mjs +36 -3
  135. package/index187.js +1 -1
  136. package/index187.mjs +5 -36
  137. package/index188.js +1 -1
  138. package/index188.mjs +29 -5
  139. package/index189.js +1 -1
  140. package/index189.mjs +6 -29
  141. package/index190.js +1 -1
  142. package/index190.mjs +5 -6
  143. package/index191.js +1 -1
  144. package/index191.mjs +1 -1
  145. package/index2.js +1 -1
  146. package/index2.mjs +44 -43
  147. package/index23.js +1 -1
  148. package/index23.mjs +39 -38
  149. package/index24.js +1 -1
  150. package/index24.mjs +40 -39
  151. package/index6.js +1 -1
  152. package/index6.mjs +34 -34
  153. package/index88.js +1 -1
  154. package/index88.mjs +16 -13
  155. package/index98.js +1 -1
  156. package/index98.mjs +3 -3
  157. package/index99.js +1 -1
  158. package/index99.mjs +1 -1
  159. package/package.json +1 -1
  160. package/theme/DatePicker/index.d.ts +3 -2
package/index165.mjs CHANGED
@@ -1,177 +1,30 @@
1
- import { c as v } from "./index186.mjs";
2
- import { c as U, g as q, m as n } from "./index184.mjs";
3
- function K(R) {
4
- let {
5
- swiper: i,
6
- extendParams: I,
7
- on: o
8
- } = R;
9
- I({
10
- a11y: {
11
- enabled: !0,
12
- notificationClass: "swiper-notification",
13
- prevSlideMessage: "Previous slide",
14
- nextSlideMessage: "Next slide",
15
- firstSlideMessage: "This is the first slide",
16
- lastSlideMessage: "This is the last slide",
17
- paginationBulletMessage: "Go to slide {{index}}",
18
- slideLabelMessage: "{{index}} / {{slidesLength}}",
19
- containerMessage: null,
20
- containerRoleDescriptionMessage: null,
21
- itemRoleDescriptionMessage: null,
22
- slideRole: "group",
23
- id: null
24
- }
25
- }), i.a11y = {
26
- clicked: !1
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
- K as default
29
+ w as useControlledState
177
30
  };
package/index166.js CHANGED
@@ -1 +1 @@
1
- "use strict";const h=require("./index183.js");function $(w){let{swiper:e,extendParams:S,on:c}=w;S({history:{enabled:!1,root:"",replaceState:!1,key:"slides",keepQuery:!1}});let d=!1,o={};const u=t=>t.toString().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,""),f=t=>{const l=h.a();let r;t?r=new URL(t):r=l.location;const a=r.pathname.slice(1).split("/").filter(i=>i!==""),n=a.length,s=a[n-2],p=a[n-1];return{key:s,value:p}},m=(t,l)=>{const r=h.a();if(!d||!e.params.history.enabled)return;let a;e.params.url?a=new URL(e.params.url):a=r.location;const n=e.slides[l];let s=u(n.getAttribute("data-history"));if(e.params.history.root.length>0){let i=e.params.history.root;i[i.length-1]==="/"&&(i=i.slice(0,i.length-1)),s=`${i}/${t?`${t}/`:""}${s}`}else a.pathname.includes(t)||(s=`${t?`${t}/`:""}${s}`);e.params.history.keepQuery&&(s+=a.search);const p=r.history.state;p&&p.value===s||(e.params.history.replaceState?r.history.replaceState({value:s},null,s):r.history.pushState({value:s},null,s))},g=(t,l,r)=>{if(l)for(let a=0,n=e.slides.length;a<n;a+=1){const s=e.slides[a];if(u(s.getAttribute("data-history"))===l){const i=e.getSlideIndex(s);e.slideTo(i,t,r)}}else e.slideTo(0,t,r)},y=()=>{o=f(e.params.url),g(e.params.speed,o.value,!1)},v=()=>{const t=h.a();if(e.params.history){if(!t.history||!t.history.pushState){e.params.history.enabled=!1,e.params.hashNavigation.enabled=!0;return}if(d=!0,o=f(e.params.url),!o.key&&!o.value){e.params.history.replaceState||t.addEventListener("popstate",y);return}g(0,o.value,e.params.runCallbacksOnInit),e.params.history.replaceState||t.addEventListener("popstate",y)}},b=()=>{const t=h.a();e.params.history.replaceState||t.removeEventListener("popstate",y)};c("init",()=>{e.params.history.enabled&&v()}),c("destroy",()=>{e.params.history.enabled&&b()}),c("transitionEnd _freeModeNoMomentumRelease",()=>{d&&m(e.params.history.key,e.activeIndex)}),c("slideChange",()=>{d&&e.params.cssMode&&m(e.params.history.key,e.activeIndex)})}module.exports=$;
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 { a as h } from "./index183.mjs";
2
- function x(w) {
3
- let {
4
- swiper: e,
5
- extendParams: S,
6
- on: c
7
- } = w;
8
- S({
9
- history: {
10
- enabled: !1,
11
- root: "",
12
- replaceState: !1,
13
- key: "slides",
14
- keepQuery: !1
15
- }
16
- });
17
- let d = !1, o = {};
18
- const y = (t) => t.toString().replace(/\s+/g, "-").replace(/[^\w-]+/g, "").replace(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, ""), u = (t) => {
19
- const l = h();
20
- let r;
21
- t ? r = new URL(t) : r = l.location;
22
- const a = r.pathname.slice(1).split("/").filter((i) => i !== ""), n = a.length, s = a[n - 2], p = a[n - 1];
23
- return {
24
- key: s,
25
- value: p
26
- };
27
- }, m = (t, l) => {
28
- const r = h();
29
- if (!d || !e.params.history.enabled) return;
30
- let a;
31
- e.params.url ? a = new URL(e.params.url) : a = r.location;
32
- const n = e.slides[l];
33
- let s = y(n.getAttribute("data-history"));
34
- if (e.params.history.root.length > 0) {
35
- let i = e.params.history.root;
36
- i[i.length - 1] === "/" && (i = i.slice(0, i.length - 1)), s = `${i}/${t ? `${t}/` : ""}${s}`;
37
- } else a.pathname.includes(t) || (s = `${t ? `${t}/` : ""}${s}`);
38
- e.params.history.keepQuery && (s += a.search);
39
- const p = r.history.state;
40
- p && p.value === s || (e.params.history.replaceState ? r.history.replaceState({
41
- value: s
42
- }, null, s) : r.history.pushState({
43
- value: s
44
- }, null, s));
45
- }, g = (t, l, r) => {
46
- if (l)
47
- for (let a = 0, n = e.slides.length; a < n; a += 1) {
48
- const s = e.slides[a];
49
- if (y(s.getAttribute("data-history")) === l) {
50
- const i = e.getSlideIndex(s);
51
- e.slideTo(i, t, r);
52
- }
53
- }
54
- else
55
- e.slideTo(0, t, r);
56
- }, f = () => {
57
- o = u(e.params.url), g(e.params.speed, o.value, !1);
58
- }, v = () => {
59
- const t = h();
60
- if (e.params.history) {
61
- if (!t.history || !t.history.pushState) {
62
- e.params.history.enabled = !1, e.params.hashNavigation.enabled = !0;
63
- return;
64
- }
65
- if (d = !0, o = u(e.params.url), !o.key && !o.value) {
66
- e.params.history.replaceState || t.addEventListener("popstate", f);
67
- return;
68
- }
69
- g(0, o.value, e.params.runCallbacksOnInit), e.params.history.replaceState || t.addEventListener("popstate", f);
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
- }, b = () => {
72
- const t = h();
73
- e.params.history.replaceState || t.removeEventListener("popstate", f);
74
- };
75
- c("init", () => {
76
- e.params.history.enabled && v();
77
- }), c("destroy", () => {
78
- e.params.history.enabled && b();
79
- }), c("transitionEnd _freeModeNoMomentumRelease", () => {
80
- d && m(e.params.history.key, e.activeIndex);
81
- }), c("slideChange", () => {
82
- d && e.params.cssMode && m(e.params.history.key, e.activeIndex);
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
- x as default
125
+ d as CalendarDate,
126
+ c as CalendarDateTime
87
127
  };
package/index167.js CHANGED
@@ -1 +1 @@
1
- "use strict";const p=require("./index183.js"),S=require("./index184.js");function x(u){let{swiper:e,extendParams:v,emit:l,on:n}=u,r=!1;const h=p.g(),i=p.a();v({hashNavigation:{enabled:!1,replaceState:!1,watchState:!1,getSlideIndex(a,t){if(e.virtual&&e.params.virtual.enabled){const s=e.slides.filter(f=>f.getAttribute("data-hash")===t)[0];return s?parseInt(s.getAttribute("data-swiper-slide-index"),10):0}return e.getSlideIndex(S.e(e.slidesEl,`.${e.params.slideClass}[data-hash="${t}"], swiper-slide[data-hash="${t}"]`)[0])}}});const o=()=>{l("hashChange");const a=h.location.hash.replace("#",""),t=e.virtual&&e.params.virtual.enabled?e.slidesEl.querySelector(`[data-swiper-slide-index="${e.activeIndex}"]`):e.slides[e.activeIndex],s=t?t.getAttribute("data-hash"):"";if(a!==s){const d=e.params.hashNavigation.getSlideIndex(e,a);if(typeof d>"u"||Number.isNaN(d))return;e.slideTo(d)}},c=()=>{if(!r||!e.params.hashNavigation.enabled)return;const a=e.virtual&&e.params.virtual.enabled?e.slidesEl.querySelector(`[data-swiper-slide-index="${e.activeIndex}"]`):e.slides[e.activeIndex],t=a?a.getAttribute("data-hash")||a.getAttribute("data-history"):"";e.params.hashNavigation.replaceState&&i.history&&i.history.replaceState?(i.history.replaceState(null,null,`#${t}`||""),l("hashSet")):(h.location.hash=t||"",l("hashSet"))},g=()=>{if(!e.params.hashNavigation.enabled||e.params.history&&e.params.history.enabled)return;r=!0;const a=h.location.hash.replace("#","");if(a){const s=e.params.hashNavigation.getSlideIndex(e,a);e.slideTo(s||0,0,e.params.runCallbacksOnInit,!0)}e.params.hashNavigation.watchState&&i.addEventListener("hashchange",o)},m=()=>{e.params.hashNavigation.watchState&&i.removeEventListener("hashchange",o)};n("init",()=>{e.params.hashNavigation.enabled&&g()}),n("destroy",()=>{e.params.hashNavigation.enabled&&m()}),n("transitionEnd _freeModeNoMomentumRelease",()=>{r&&c()}),n("slideChange",()=>{r&&e.params.cssMode&&c()})}module.exports=x;
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;