cally 0.4.2 → 0.5.0
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 +2 -2
- package/dist/cally.d.ts +4 -0
- package/dist/cally.js +561 -629
- package/package.json +1 -1
package/dist/cally.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class te {
|
|
2
2
|
/**
|
|
3
3
|
* @type {T}
|
|
4
4
|
*/
|
|
@@ -20,7 +20,7 @@ class oe {
|
|
|
20
20
|
* @param {T} value
|
|
21
21
|
*/
|
|
22
22
|
set current(t) {
|
|
23
|
-
this.#t != t && (this.#t = t, this.#e.forEach((
|
|
23
|
+
this.#t != t && (this.#t = t, this.#e.forEach((n) => n(t)));
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* @type {import("hooks").Ref["on"]}
|
|
@@ -29,113 +29,113 @@ class oe {
|
|
|
29
29
|
return this.#e.add(t), () => this.#e.delete(t);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
globalThis[
|
|
34
|
-
let N = globalThis[
|
|
35
|
-
const
|
|
36
|
-
const { i:
|
|
37
|
-
return r.value = e(r.value), r.effect = t, r.tag =
|
|
38
|
-
},
|
|
39
|
-
let
|
|
40
|
-
const r = () => o,
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
|
|
32
|
+
const Ct = (e) => new te(e), X = Symbol.for("atomico.hooks");
|
|
33
|
+
globalThis[X] = globalThis[X] || {};
|
|
34
|
+
let N = globalThis[X];
|
|
35
|
+
const ee = Symbol.for("Atomico.suspense"), Pt = Symbol.for("Atomico.effect"), ne = Symbol.for("Atomico.layoutEffect"), Nt = Symbol.for("Atomico.insertionEffect"), k = (e, t, n) => {
|
|
36
|
+
const { i: s, hooks: o } = N.c, r = o[s] = o[s] || {};
|
|
37
|
+
return r.value = e(r.value), r.effect = t, r.tag = n, N.c.i++, o[s].value;
|
|
38
|
+
}, se = (e) => k((t = Ct(e)) => t), $ = () => k((e = Ct(N.c.host)) => e), kt = () => N.c.update, oe = (e, t, n = 0) => {
|
|
39
|
+
let s = {}, o = !1;
|
|
40
|
+
const r = () => o, c = (i, u) => {
|
|
41
|
+
for (const d in s) {
|
|
42
|
+
const l = s[d];
|
|
43
|
+
l.effect && l.tag === i && (l.value = l.effect(l.value, u));
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
return { load: (
|
|
47
|
-
N.c = { host: t, hooks:
|
|
48
|
-
let
|
|
46
|
+
return { load: (i) => {
|
|
47
|
+
N.c = { host: t, hooks: s, update: e, i: 0, id: n };
|
|
48
|
+
let u;
|
|
49
49
|
try {
|
|
50
|
-
o = !1,
|
|
51
|
-
} catch (
|
|
52
|
-
if (
|
|
53
|
-
throw
|
|
50
|
+
o = !1, u = i();
|
|
51
|
+
} catch (d) {
|
|
52
|
+
if (d !== ee)
|
|
53
|
+
throw d;
|
|
54
54
|
o = !0;
|
|
55
55
|
} finally {
|
|
56
56
|
N.c = null;
|
|
57
57
|
}
|
|
58
|
-
return
|
|
59
|
-
}, cleanEffects: (
|
|
60
|
-
|
|
58
|
+
return u;
|
|
59
|
+
}, cleanEffects: (i) => (c(Nt, i), () => (c(ne, i), () => {
|
|
60
|
+
c(Pt, i);
|
|
61
61
|
})), isSuspense: r };
|
|
62
|
-
},
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
62
|
+
}, O = Symbol.for;
|
|
63
|
+
function Ot(e, t) {
|
|
64
|
+
const n = e.length;
|
|
65
|
+
if (n !== t.length)
|
|
66
66
|
return !1;
|
|
67
|
-
for (let
|
|
68
|
-
let o = e[
|
|
67
|
+
for (let s = 0; s < n; s++) {
|
|
68
|
+
let o = e[s], r = t[s];
|
|
69
69
|
if (o !== r)
|
|
70
70
|
return !1;
|
|
71
71
|
}
|
|
72
72
|
return !0;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
function
|
|
76
|
-
let
|
|
77
|
-
const
|
|
74
|
+
const T = (e) => typeof e == "function", R = (e) => typeof e == "object", { isArray: re } = Array, G = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
|
|
75
|
+
function At(e, t) {
|
|
76
|
+
let n;
|
|
77
|
+
const s = (o) => {
|
|
78
78
|
let { length: r } = o;
|
|
79
|
-
for (let
|
|
80
|
-
const f = o[
|
|
79
|
+
for (let c = 0; c < r; c++) {
|
|
80
|
+
const f = o[c];
|
|
81
81
|
if (f && Array.isArray(f))
|
|
82
|
-
|
|
82
|
+
s(f);
|
|
83
83
|
else {
|
|
84
|
-
const
|
|
85
|
-
if (f == null ||
|
|
84
|
+
const a = typeof f;
|
|
85
|
+
if (f == null || a === "function" || a === "boolean")
|
|
86
86
|
continue;
|
|
87
|
-
|
|
87
|
+
a === "string" || a === "number" ? (n == null && (n = ""), n += f) : (n != null && (t(n), n = null), t(f));
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
s(e), n != null && t(n);
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
class
|
|
93
|
+
const Rt = (e, t, n) => (e.addEventListener(t, n), () => e.removeEventListener(t, n));
|
|
94
|
+
class Mt {
|
|
95
95
|
/**
|
|
96
96
|
*
|
|
97
97
|
* @param {HTMLElement} target
|
|
98
98
|
* @param {string} message
|
|
99
99
|
* @param {string} value
|
|
100
100
|
*/
|
|
101
|
-
constructor(t,
|
|
102
|
-
this.message =
|
|
101
|
+
constructor(t, n, s) {
|
|
102
|
+
this.message = n, this.target = t, this.value = s;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
class
|
|
105
|
+
class Ft extends Mt {
|
|
106
106
|
}
|
|
107
|
-
class
|
|
107
|
+
class ce extends Mt {
|
|
108
108
|
}
|
|
109
|
-
const
|
|
110
|
-
function
|
|
109
|
+
const _ = "Custom", ie = null, ae = { true: 1, "": 1, 1: 1 };
|
|
110
|
+
function le(e, t, n, s, o) {
|
|
111
111
|
const {
|
|
112
112
|
type: r,
|
|
113
|
-
reflect:
|
|
113
|
+
reflect: c,
|
|
114
114
|
event: f,
|
|
115
|
-
value:
|
|
116
|
-
attr:
|
|
117
|
-
} =
|
|
115
|
+
value: a,
|
|
116
|
+
attr: i = ue(t)
|
|
117
|
+
} = n?.name != _ && R(n) && n != ie ? n : { type: n }, u = r?.name === _ && r.map, d = a != null ? r == Function || !T(a) ? () => a : a : null;
|
|
118
118
|
Object.defineProperty(e, t, {
|
|
119
119
|
configurable: !0,
|
|
120
120
|
/**
|
|
121
121
|
* @this {import("dom").AtomicoThisInternal}
|
|
122
122
|
* @param {any} newValue
|
|
123
123
|
*/
|
|
124
|
-
set(
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
const { error:
|
|
124
|
+
set(l) {
|
|
125
|
+
const m = this[t];
|
|
126
|
+
d && r != Boolean && l == null && (l = d());
|
|
127
|
+
const { error: p, value: y } = (u ? he : me)(
|
|
128
128
|
r,
|
|
129
|
-
|
|
129
|
+
l
|
|
130
130
|
);
|
|
131
|
-
if (
|
|
132
|
-
throw new
|
|
131
|
+
if (p && y != null)
|
|
132
|
+
throw new Ft(
|
|
133
133
|
this,
|
|
134
134
|
`The value defined for prop '${t}' must be of type '${r.name}'`,
|
|
135
|
-
|
|
135
|
+
y
|
|
136
136
|
);
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
m != y && (this._props[t] = y ?? void 0, this.update(), f && It(this, f), this.updated.then(() => {
|
|
138
|
+
c && (this._ignoreAttr = i, fe(this, r, i, this[t]), this._ignoreAttr = null);
|
|
139
139
|
}));
|
|
140
140
|
},
|
|
141
141
|
/**
|
|
@@ -144,21 +144,21 @@ function he(e, t, s, n, o) {
|
|
|
144
144
|
get() {
|
|
145
145
|
return this._props[t];
|
|
146
146
|
}
|
|
147
|
-
}),
|
|
147
|
+
}), d && (o[t] = d()), s[i] = { prop: t, type: r };
|
|
148
148
|
}
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
t?.name ===
|
|
152
|
-
),
|
|
149
|
+
const It = (e, { type: t, base: n = CustomEvent, ...s }) => e.dispatchEvent(new n(t, s)), ue = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), fe = (e, t, n, s) => s == null || t == Boolean && !s ? e.removeAttribute(n) : e.setAttribute(
|
|
150
|
+
n,
|
|
151
|
+
t?.name === _ && t?.serialize ? t?.serialize(s) : R(s) ? JSON.stringify(s) : t == Boolean ? "" : s
|
|
152
|
+
), de = (e, t) => e == Boolean ? !!ae[t] : e == Number ? Number(t) : e == String ? t : e == Array || e == Object ? JSON.parse(t) : e.name == _ ? t : (
|
|
153
153
|
// TODO: If when defining reflect the prop can also be of type string?
|
|
154
154
|
new e(t)
|
|
155
|
-
),
|
|
155
|
+
), he = ({ map: e }, t) => {
|
|
156
156
|
try {
|
|
157
157
|
return { value: e(t), error: !1 };
|
|
158
158
|
} catch {
|
|
159
159
|
return { value: t, error: !0 };
|
|
160
160
|
}
|
|
161
|
-
},
|
|
161
|
+
}, me = (e, t) => e == null || t == null ? { value: t, error: !1 } : e != String && t === "" ? { value: void 0, error: !1 } : e == Object || e == Array || e == Symbol ? {
|
|
162
162
|
value: t,
|
|
163
163
|
error: {}.toString.call(t) !== `[object ${e.name}]`
|
|
164
164
|
} : t instanceof e ? {
|
|
@@ -168,17 +168,17 @@ const Ut = (e, { type: t, base: s = CustomEvent, ...n }) => e.dispatchEvent(new
|
|
|
168
168
|
value: t,
|
|
169
169
|
error: e == Number ? typeof t != "number" ? !0 : Number.isNaN(t) : e == String ? typeof t != "string" : typeof t != "boolean"
|
|
170
170
|
} : { value: t, error: !0 };
|
|
171
|
-
let
|
|
172
|
-
const
|
|
171
|
+
let ye = 0;
|
|
172
|
+
const pe = (e) => {
|
|
173
173
|
const t = (e?.dataset || {})?.hydrate || "";
|
|
174
|
-
return t || "c" +
|
|
175
|
-
},
|
|
176
|
-
const
|
|
177
|
-
class
|
|
174
|
+
return t || "c" + ye++;
|
|
175
|
+
}, j = (e, t = HTMLElement) => {
|
|
176
|
+
const n = {}, s = {}, o = "prototype" in t && t.prototype instanceof Element, r = o ? t : "base" in t ? t.base : HTMLElement, { props: c, styles: f } = o ? e : t;
|
|
177
|
+
class a extends r {
|
|
178
178
|
constructor() {
|
|
179
179
|
super(), this._setup(), this._render = () => e({ ...this._props });
|
|
180
|
-
for (const
|
|
181
|
-
this[
|
|
180
|
+
for (const u in s)
|
|
181
|
+
this[u] = s[u];
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* @returns {import("core").Sheets[]}
|
|
@@ -190,37 +190,37 @@ const we = (e) => {
|
|
|
190
190
|
if (this._props)
|
|
191
191
|
return;
|
|
192
192
|
this._props = {};
|
|
193
|
-
let
|
|
193
|
+
let u, d;
|
|
194
194
|
this.mounted = new Promise(
|
|
195
|
-
(
|
|
196
|
-
|
|
195
|
+
(E) => this.mount = () => {
|
|
196
|
+
E(), u != this.parentNode && (d != u ? this.unmounted.then(this.update) : this.update()), u = this.parentNode;
|
|
197
197
|
}
|
|
198
198
|
), this.unmounted = new Promise(
|
|
199
|
-
(
|
|
200
|
-
|
|
199
|
+
(E) => this.unmount = () => {
|
|
200
|
+
E(), (u != this.parentNode || !this.isConnected) && (l.cleanEffects(!0)()(), d = this.parentNode, u = null);
|
|
201
201
|
}
|
|
202
202
|
), this.symbolId = this.symbolId || Symbol(), this.symbolIdParent = Symbol();
|
|
203
|
-
const
|
|
203
|
+
const l = oe(
|
|
204
204
|
() => this.update(),
|
|
205
205
|
this,
|
|
206
|
-
|
|
206
|
+
pe(this)
|
|
207
207
|
);
|
|
208
|
-
let
|
|
209
|
-
const
|
|
210
|
-
this.update = () => (
|
|
208
|
+
let m, p = !0;
|
|
209
|
+
const y = G(this);
|
|
210
|
+
this.update = () => (m || (m = !0, this.updated = (this.updated || this.mounted).then(() => {
|
|
211
211
|
try {
|
|
212
|
-
const
|
|
213
|
-
return
|
|
214
|
-
|
|
212
|
+
const E = l.load(this._render), h = l.cleanEffects();
|
|
213
|
+
return E && //@ts-ignore
|
|
214
|
+
E.render(this, this.symbolId, y), m = !1, p && !l.isSuspense() && (p = !1, !y && be(this)), h();
|
|
215
215
|
} finally {
|
|
216
|
-
|
|
216
|
+
m = !1;
|
|
217
217
|
}
|
|
218
218
|
}).then(
|
|
219
219
|
/**
|
|
220
220
|
* @param {import("internal/hooks.js").CleanUseEffects} [cleanUseEffect]
|
|
221
221
|
*/
|
|
222
|
-
(
|
|
223
|
-
|
|
222
|
+
(E) => {
|
|
223
|
+
E && E();
|
|
224
224
|
}
|
|
225
225
|
)), this.updated), this.update();
|
|
226
226
|
}
|
|
@@ -236,74 +236,74 @@ const we = (e) => {
|
|
|
236
236
|
* @param {(string|null)} oldValue
|
|
237
237
|
* @param {(string|null)} value
|
|
238
238
|
*/
|
|
239
|
-
attributeChangedCallback(
|
|
240
|
-
if (
|
|
241
|
-
if (
|
|
239
|
+
attributeChangedCallback(u, d, l) {
|
|
240
|
+
if (n[u]) {
|
|
241
|
+
if (u === this._ignoreAttr || d === l)
|
|
242
242
|
return;
|
|
243
|
-
const { prop:
|
|
243
|
+
const { prop: m, type: p } = n[u];
|
|
244
244
|
try {
|
|
245
|
-
this[
|
|
245
|
+
this[m] = de(p, l);
|
|
246
246
|
} catch {
|
|
247
|
-
throw new
|
|
247
|
+
throw new ce(
|
|
248
248
|
this,
|
|
249
|
-
`The value defined as attr '${
|
|
250
|
-
|
|
249
|
+
`The value defined as attr '${u}' cannot be parsed by type '${p.name}'`,
|
|
250
|
+
l
|
|
251
251
|
);
|
|
252
252
|
}
|
|
253
253
|
} else
|
|
254
|
-
super.attributeChangedCallback(
|
|
254
|
+
super.attributeChangedCallback(u, d, l);
|
|
255
255
|
}
|
|
256
256
|
static get props() {
|
|
257
|
-
return { ...super.props, ...
|
|
257
|
+
return { ...super.props, ...c };
|
|
258
258
|
}
|
|
259
259
|
static get observedAttributes() {
|
|
260
|
-
const
|
|
261
|
-
for (const
|
|
262
|
-
|
|
263
|
-
return Object.keys(
|
|
260
|
+
const u = super.observedAttributes || [];
|
|
261
|
+
for (const d in c)
|
|
262
|
+
le(this.prototype, d, c[d], n, s);
|
|
263
|
+
return Object.keys(n).concat(u);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
return
|
|
266
|
+
return a;
|
|
267
267
|
};
|
|
268
|
-
function
|
|
269
|
-
const { styles: t } = e.constructor, { shadowRoot:
|
|
270
|
-
if (
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
o && (o instanceof Element ?
|
|
274
|
-
}),
|
|
268
|
+
function be(e) {
|
|
269
|
+
const { styles: t } = e.constructor, { shadowRoot: n } = e;
|
|
270
|
+
if (n && t.length) {
|
|
271
|
+
const s = [];
|
|
272
|
+
At(t, (o) => {
|
|
273
|
+
o && (o instanceof Element ? n.appendChild(o.cloneNode(!0)) : s.push(o));
|
|
274
|
+
}), s.length && (n.adoptedStyleSheets = s);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
const
|
|
278
|
-
|
|
277
|
+
const Ut = (e) => (t, n) => {
|
|
278
|
+
k(
|
|
279
279
|
/**
|
|
280
280
|
* Clean the effect hook
|
|
281
281
|
* @type {import("internal/hooks.js").CollectorEffect}
|
|
282
282
|
*/
|
|
283
|
-
([
|
|
283
|
+
([s, o] = []) => ((o || !o) && (o && Ot(o, n) ? s = s || !0 : (T(s) && s(), s = null)), [s, n]),
|
|
284
284
|
/**
|
|
285
285
|
* @returns {any}
|
|
286
286
|
*/
|
|
287
|
-
([
|
|
287
|
+
([s, o], r) => r ? (T(s) && s(), []) : [s || t(), o],
|
|
288
288
|
e
|
|
289
289
|
);
|
|
290
|
-
},
|
|
291
|
-
class
|
|
290
|
+
}, nt = Ut(Pt), ge = Ut(Nt);
|
|
291
|
+
class $t extends Array {
|
|
292
292
|
/**
|
|
293
293
|
*
|
|
294
294
|
* @param {any} initialState
|
|
295
295
|
* @param {(nextState: any, state:any[], mount: boolean )=>void} mapState
|
|
296
296
|
*/
|
|
297
|
-
constructor(t,
|
|
298
|
-
let
|
|
297
|
+
constructor(t, n) {
|
|
298
|
+
let s = !0;
|
|
299
299
|
const o = (r) => {
|
|
300
300
|
try {
|
|
301
|
-
|
|
301
|
+
n(r, this, s);
|
|
302
302
|
} finally {
|
|
303
|
-
|
|
303
|
+
s = !1;
|
|
304
304
|
}
|
|
305
305
|
};
|
|
306
|
-
super(void 0, o,
|
|
306
|
+
super(void 0, o, n), o(t);
|
|
307
307
|
}
|
|
308
308
|
/**
|
|
309
309
|
* The following code allows a mutable approach to useState
|
|
@@ -318,45 +318,45 @@ class _t extends Array {
|
|
|
318
318
|
// this[2](nextState, this);
|
|
319
319
|
// }
|
|
320
320
|
}
|
|
321
|
-
const
|
|
322
|
-
const t =
|
|
323
|
-
return
|
|
324
|
-
(
|
|
325
|
-
|
|
326
|
-
})) =>
|
|
321
|
+
const st = (e) => {
|
|
322
|
+
const t = kt();
|
|
323
|
+
return k(
|
|
324
|
+
(n = new $t(e, (s, o, r) => {
|
|
325
|
+
s = T(s) ? s(o[0]) : s, s !== o[0] && (o[0] = s, r || t());
|
|
326
|
+
})) => n
|
|
327
327
|
);
|
|
328
328
|
}, P = (e, t) => {
|
|
329
|
-
const [
|
|
330
|
-
return
|
|
329
|
+
const [n] = k(([s, o, r = 0] = []) => ((!o || o && !Ot(o, t)) && (s = e()), [s, t, r]));
|
|
330
|
+
return n;
|
|
331
331
|
}, Lt = (e) => {
|
|
332
|
-
const { current: t } =
|
|
332
|
+
const { current: t } = $();
|
|
333
333
|
if (!(e in t))
|
|
334
|
-
throw new
|
|
334
|
+
throw new Ft(
|
|
335
335
|
t,
|
|
336
336
|
`For useProp("${e}"), the prop does not exist on the host.`,
|
|
337
337
|
e
|
|
338
338
|
);
|
|
339
|
-
return
|
|
340
|
-
(
|
|
341
|
-
|
|
342
|
-
})) => (
|
|
339
|
+
return k(
|
|
340
|
+
(n = new $t(t[e], (s, o) => {
|
|
341
|
+
s = T(s) ? s(t[e]) : s, t[e] = s;
|
|
342
|
+
})) => (n[0] = t[e], n)
|
|
343
343
|
);
|
|
344
|
-
},
|
|
345
|
-
const
|
|
346
|
-
return
|
|
344
|
+
}, C = (e, t = {}) => {
|
|
345
|
+
const n = $();
|
|
346
|
+
return n[e] || (n[e] = (s = t.detail) => It(n.current, {
|
|
347
347
|
type: e,
|
|
348
348
|
...t,
|
|
349
|
-
detail:
|
|
350
|
-
})),
|
|
351
|
-
},
|
|
352
|
-
globalThis[
|
|
349
|
+
detail: s
|
|
350
|
+
})), n[e];
|
|
351
|
+
}, Q = O("atomico/options");
|
|
352
|
+
globalThis[Q] = globalThis[Q] || {
|
|
353
353
|
sheet: !!document.adoptedStyleSheets
|
|
354
354
|
};
|
|
355
|
-
const
|
|
355
|
+
const _t = globalThis[Q], Ee = {
|
|
356
356
|
checked: 1,
|
|
357
357
|
value: 1,
|
|
358
358
|
selected: 1
|
|
359
|
-
},
|
|
359
|
+
}, De = {
|
|
360
360
|
list: 1,
|
|
361
361
|
type: 1,
|
|
362
362
|
size: 1,
|
|
@@ -366,24 +366,24 @@ const Yt = globalThis[nt], ve = {
|
|
|
366
366
|
src: 1,
|
|
367
367
|
href: 1,
|
|
368
368
|
slot: 1
|
|
369
|
-
},
|
|
369
|
+
}, Se = {
|
|
370
370
|
shadowDom: 1,
|
|
371
371
|
staticNode: 1,
|
|
372
372
|
cloneNode: 1,
|
|
373
373
|
children: 1,
|
|
374
374
|
key: 1
|
|
375
|
-
},
|
|
376
|
-
class
|
|
375
|
+
}, L = {}, V = [];
|
|
376
|
+
class tt extends Text {
|
|
377
377
|
}
|
|
378
|
-
const
|
|
378
|
+
const we = O("atomico/id"), M = O("atomico/type"), H = O("atomico/ref"), jt = O("atomico/vnode"), ve = () => {
|
|
379
379
|
};
|
|
380
|
-
function
|
|
381
|
-
return
|
|
380
|
+
function Te(e, t, n) {
|
|
381
|
+
return xt(this, e, t, n);
|
|
382
382
|
}
|
|
383
|
-
const
|
|
384
|
-
const
|
|
385
|
-
let { children: o } =
|
|
386
|
-
if (o = o ?? (
|
|
383
|
+
const Yt = (e, t, ...n) => {
|
|
384
|
+
const s = t || L;
|
|
385
|
+
let { children: o } = s;
|
|
386
|
+
if (o = o ?? (n.length ? n : V), e === ve)
|
|
387
387
|
return o;
|
|
388
388
|
const r = e ? e instanceof Node ? 1 : (
|
|
389
389
|
//@ts-ignore
|
|
@@ -391,170 +391,170 @@ const jt = (e, t, ...s) => {
|
|
|
391
391
|
) : 0;
|
|
392
392
|
if (r === !1 && e instanceof Function)
|
|
393
393
|
return e(
|
|
394
|
-
o !=
|
|
394
|
+
o != V ? { children: o, ...s } : s
|
|
395
395
|
);
|
|
396
|
-
const
|
|
396
|
+
const c = _t.render || Te;
|
|
397
397
|
return {
|
|
398
|
-
[
|
|
398
|
+
[M]: jt,
|
|
399
399
|
type: e,
|
|
400
|
-
props:
|
|
400
|
+
props: s,
|
|
401
401
|
children: o,
|
|
402
|
-
key:
|
|
402
|
+
key: s.key,
|
|
403
403
|
// key for lists by keys
|
|
404
404
|
// define if the node declares its shadowDom
|
|
405
|
-
shadow:
|
|
405
|
+
shadow: s.shadowDom,
|
|
406
406
|
// allows renderings to run only once
|
|
407
|
-
static:
|
|
407
|
+
static: s.staticNode,
|
|
408
408
|
// defines whether the type is a childNode `1` or a constructor `2`
|
|
409
409
|
raw: r,
|
|
410
410
|
// defines whether to use the second parameter for document.createElement
|
|
411
|
-
is:
|
|
411
|
+
is: s.is,
|
|
412
412
|
// clone the node if it comes from a reference
|
|
413
|
-
clone:
|
|
414
|
-
render:
|
|
413
|
+
clone: s.cloneNode,
|
|
414
|
+
render: c
|
|
415
415
|
};
|
|
416
416
|
};
|
|
417
|
-
function
|
|
417
|
+
function xt(e, t, n = we, s, o) {
|
|
418
418
|
let r;
|
|
419
|
-
if (t && t[
|
|
419
|
+
if (t && t[n] && t[n].vnode == e || e[M] != jt)
|
|
420
420
|
return t;
|
|
421
|
-
(e || !t) && (o = o || e.type == "svg", r = e.type != "host" && (e.raw == 1 ? (t && e.clone ? t[
|
|
421
|
+
(e || !t) && (o = o || e.type == "svg", r = e.type != "host" && (e.raw == 1 ? (t && e.clone ? t[H] : t) != e.type : e.raw == 2 ? !(t instanceof e.type) : t ? t[H] || t.localName != e.type : !t), r && e.type != null && (e.raw == 1 && e.clone ? (s = !0, t = e.type.cloneNode(!0), t[H] = e.type) : t = e.raw == 1 ? e.type : e.raw == 2 ? new e.type() : o ? document.createElementNS(
|
|
422
422
|
"http://www.w3.org/2000/svg",
|
|
423
423
|
e.type
|
|
424
424
|
) : document.createElement(
|
|
425
425
|
e.type,
|
|
426
426
|
e.is ? { is: e.is } : void 0
|
|
427
427
|
)));
|
|
428
|
-
const
|
|
429
|
-
let { fragment:
|
|
430
|
-
const { children:
|
|
431
|
-
if (
|
|
428
|
+
const c = t[n] ? t[n] : L, { vnode: f = L, cycle: a = 0 } = c;
|
|
429
|
+
let { fragment: i, handlers: u } = c;
|
|
430
|
+
const { children: d = V, props: l = L } = f;
|
|
431
|
+
if (u = r ? {} : u || {}, e.static && !r)
|
|
432
432
|
return t;
|
|
433
433
|
if (e.shadow && !t.shadowRoot && // @ts-ignore
|
|
434
|
-
t.attachShadow({ mode: "open", ...e.shadow }), e.props !=
|
|
435
|
-
const
|
|
436
|
-
|
|
434
|
+
t.attachShadow({ mode: "open", ...e.shadow }), e.props != l && Ne(t, l, e.props, u, o), e.children !== d) {
|
|
435
|
+
const m = e.shadow ? t.shadowRoot : t;
|
|
436
|
+
i = Pe(
|
|
437
437
|
e.children,
|
|
438
438
|
/**
|
|
439
439
|
* @todo for hydration use attribute and send childNodes
|
|
440
440
|
*/
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
441
|
+
i,
|
|
442
|
+
m,
|
|
443
|
+
n,
|
|
444
444
|
// add support to foreignObject, children will escape from svg
|
|
445
|
-
!
|
|
445
|
+
!a && s,
|
|
446
446
|
o && e.type == "foreignObject" ? !1 : o
|
|
447
447
|
);
|
|
448
448
|
}
|
|
449
|
-
return t[
|
|
449
|
+
return t[n] = { vnode: e, handlers: u, fragment: i, cycle: a + 1 }, t;
|
|
450
450
|
}
|
|
451
|
-
function
|
|
452
|
-
const
|
|
451
|
+
function Ce(e, t) {
|
|
452
|
+
const n = new tt(""), s = new tt("");
|
|
453
453
|
let o;
|
|
454
|
-
if (e[t ? "prepend" : "append"](
|
|
454
|
+
if (e[t ? "prepend" : "append"](n), t) {
|
|
455
455
|
let { lastElementChild: r } = e;
|
|
456
456
|
for (; r; ) {
|
|
457
|
-
const { previousElementSibling:
|
|
458
|
-
if (
|
|
457
|
+
const { previousElementSibling: c } = r;
|
|
458
|
+
if (G(r, !0) && !G(c, !0)) {
|
|
459
459
|
o = r;
|
|
460
460
|
break;
|
|
461
461
|
}
|
|
462
|
-
r =
|
|
462
|
+
r = c;
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
return o ? o.before(
|
|
466
|
-
markStart:
|
|
467
|
-
markEnd:
|
|
465
|
+
return o ? o.before(s) : e.append(s), {
|
|
466
|
+
markStart: n,
|
|
467
|
+
markEnd: s
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
e = e == null ? null :
|
|
472
|
-
const
|
|
473
|
-
let
|
|
474
|
-
const
|
|
475
|
-
let
|
|
476
|
-
if (e &&
|
|
477
|
-
if (typeof
|
|
470
|
+
function Pe(e, t, n, s, o, r) {
|
|
471
|
+
e = e == null ? null : re(e) ? e : [e];
|
|
472
|
+
const c = t || Ce(n, o), { markStart: f, markEnd: a, keyes: i } = c;
|
|
473
|
+
let u;
|
|
474
|
+
const d = i && /* @__PURE__ */ new Set();
|
|
475
|
+
let l = f;
|
|
476
|
+
if (e && At(e, (m) => {
|
|
477
|
+
if (typeof m == "object" && !m[M])
|
|
478
478
|
return;
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
const
|
|
482
|
-
let
|
|
483
|
-
if (
|
|
484
|
-
|
|
479
|
+
const p = m[M] && m.key, y = i && p != null && i.get(p);
|
|
480
|
+
l != a && l === y ? d.delete(l) : l = l == a ? a : l.nextSibling;
|
|
481
|
+
const E = i ? y : l;
|
|
482
|
+
let h = E;
|
|
483
|
+
if (m[M])
|
|
484
|
+
h = xt(m, E, s, o, r);
|
|
485
485
|
else {
|
|
486
|
-
const
|
|
487
|
-
!(
|
|
486
|
+
const v = m + "";
|
|
487
|
+
!(h instanceof Text) || h instanceof tt ? h = new Text(v) : h.data != v && (h.data = v);
|
|
488
488
|
}
|
|
489
|
-
|
|
490
|
-
}),
|
|
491
|
-
for (;
|
|
492
|
-
const
|
|
493
|
-
|
|
489
|
+
h != l && (i && d.delete(h), !E || i ? (n.insertBefore(h, l), i && l != a && d.add(l)) : E == a ? n.insertBefore(h, a) : (n.replaceChild(h, E), l = h)), p != null && (u = u || /* @__PURE__ */ new Map(), u.set(p, h));
|
|
490
|
+
}), l = l == a ? a : l.nextSibling, t && l != a)
|
|
491
|
+
for (; l != a; ) {
|
|
492
|
+
const m = l;
|
|
493
|
+
l = l.nextSibling, m.remove();
|
|
494
494
|
}
|
|
495
|
-
return
|
|
495
|
+
return d && d.forEach((m) => m.remove()), c.keyes = u, c;
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function Ne(e, t, n, s, o) {
|
|
498
498
|
for (const r in t)
|
|
499
|
-
!(r in
|
|
500
|
-
for (const r in
|
|
501
|
-
|
|
499
|
+
!(r in n) && yt(e, r, t[r], null, o, s);
|
|
500
|
+
for (const r in n)
|
|
501
|
+
yt(e, r, t[r], n[r], o, s);
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
if (t = t == "class" && !o ? "className" : t,
|
|
505
|
-
if (t[0] == "o" && t[1] == "n" && (
|
|
506
|
-
|
|
503
|
+
function yt(e, t, n, s, o, r) {
|
|
504
|
+
if (t = t == "class" && !o ? "className" : t, n = n ?? null, s = s ?? null, t in e && Ee[t] && (n = e[t]), !(s === n || Se[t] || t[0] == "_"))
|
|
505
|
+
if (t[0] == "o" && t[1] == "n" && (T(s) || T(n)))
|
|
506
|
+
ke(e, t.slice(2), s, r);
|
|
507
507
|
else if (t == "ref")
|
|
508
|
-
|
|
508
|
+
s && (T(s) ? s(e) : s.current = e);
|
|
509
509
|
else if (t == "style") {
|
|
510
|
-
const { style:
|
|
511
|
-
|
|
512
|
-
const f =
|
|
510
|
+
const { style: c } = e;
|
|
511
|
+
n = n || "", s = s || "";
|
|
512
|
+
const f = R(n), a = R(s);
|
|
513
513
|
if (f)
|
|
514
|
-
for (const
|
|
515
|
-
if (
|
|
516
|
-
!(
|
|
514
|
+
for (const i in n)
|
|
515
|
+
if (a)
|
|
516
|
+
!(i in s) && pt(c, i, null);
|
|
517
517
|
else
|
|
518
518
|
break;
|
|
519
|
-
if (
|
|
520
|
-
for (const
|
|
521
|
-
const
|
|
522
|
-
f &&
|
|
519
|
+
if (a)
|
|
520
|
+
for (const i in s) {
|
|
521
|
+
const u = s[i];
|
|
522
|
+
f && n[i] === u || pt(c, i, u);
|
|
523
523
|
}
|
|
524
524
|
else
|
|
525
|
-
|
|
525
|
+
c.cssText = s;
|
|
526
526
|
} else {
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
527
|
+
const c = t[0] == "$" ? t.slice(1) : t;
|
|
528
|
+
c === t && (!o && !De[t] && t in e || T(s) || T(n)) ? e[t] = s ?? "" : s == null ? e.removeAttribute(c) : e.setAttribute(
|
|
529
|
+
c,
|
|
530
|
+
R(s) ? JSON.stringify(s) : s
|
|
531
531
|
);
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
function
|
|
535
|
-
if (
|
|
536
|
-
if (!
|
|
537
|
-
const o =
|
|
538
|
-
e.addEventListener(t,
|
|
534
|
+
function ke(e, t, n, s) {
|
|
535
|
+
if (s.handleEvent || (s.handleEvent = (o) => s[o.type].call(e, o)), n) {
|
|
536
|
+
if (!s[t]) {
|
|
537
|
+
const o = n.capture || n.once || n.passive ? Object.assign({}, n) : null;
|
|
538
|
+
e.addEventListener(t, s, o);
|
|
539
539
|
}
|
|
540
|
-
|
|
540
|
+
s[t] = n;
|
|
541
541
|
} else
|
|
542
|
-
|
|
542
|
+
s[t] && (e.removeEventListener(t, s), delete s[t]);
|
|
543
543
|
}
|
|
544
|
-
function pt(e, t,
|
|
545
|
-
let
|
|
546
|
-
|
|
544
|
+
function pt(e, t, n) {
|
|
545
|
+
let s = "setProperty";
|
|
546
|
+
n == null && (s = "removeProperty", n = null), ~t.indexOf("-") ? e[s](t, n) : e[t] = n;
|
|
547
547
|
}
|
|
548
|
-
const
|
|
549
|
-
function
|
|
550
|
-
const
|
|
551
|
-
(
|
|
548
|
+
const bt = {};
|
|
549
|
+
function Y(e, ...t) {
|
|
550
|
+
const n = (e.raw || e).reduce(
|
|
551
|
+
(s, o, r) => s + o + (t[r] || ""),
|
|
552
552
|
""
|
|
553
553
|
);
|
|
554
|
-
return
|
|
554
|
+
return bt[n] = bt[n] || Oe(n);
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
if (
|
|
556
|
+
function Oe(e) {
|
|
557
|
+
if (_t.sheet) {
|
|
558
558
|
const t = new CSSStyleSheet();
|
|
559
559
|
return t.replaceSync(e), t;
|
|
560
560
|
} else {
|
|
@@ -562,52 +562,52 @@ function Re(e) {
|
|
|
562
562
|
return t.textContent = e, t;
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
const
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
() =>
|
|
569
|
-
|
|
565
|
+
const Ae = Yt("host", { style: "display: contents" }), K = O("atomico/context"), Re = (e, t) => {
|
|
566
|
+
const n = $();
|
|
567
|
+
ge(
|
|
568
|
+
() => Rt(
|
|
569
|
+
n.current,
|
|
570
570
|
"ConnectContext",
|
|
571
571
|
/**
|
|
572
572
|
* @param {CustomEvent<import("context").DetailConnectContext>} event
|
|
573
573
|
*/
|
|
574
|
-
(
|
|
575
|
-
e ===
|
|
574
|
+
(s) => {
|
|
575
|
+
e === s.detail.id && (s.stopPropagation(), s.detail.connect(t));
|
|
576
576
|
}
|
|
577
577
|
),
|
|
578
578
|
[e]
|
|
579
579
|
);
|
|
580
|
-
},
|
|
581
|
-
const t =
|
|
580
|
+
}, Me = (e) => {
|
|
581
|
+
const t = C("ConnectContext", {
|
|
582
582
|
bubbles: !0,
|
|
583
583
|
composed: !0
|
|
584
|
-
}),
|
|
584
|
+
}), n = () => {
|
|
585
585
|
let r;
|
|
586
586
|
return t({
|
|
587
587
|
id: e,
|
|
588
|
-
connect(
|
|
589
|
-
r =
|
|
588
|
+
connect(c) {
|
|
589
|
+
r = c;
|
|
590
590
|
}
|
|
591
591
|
}), r;
|
|
592
|
-
}, [
|
|
593
|
-
|
|
592
|
+
}, [s, o] = st(
|
|
593
|
+
n
|
|
594
594
|
);
|
|
595
|
-
return
|
|
596
|
-
|
|
595
|
+
return nt(() => {
|
|
596
|
+
s || (e[K] || (e[K] = customElements.whenDefined(
|
|
597
597
|
new e().localName
|
|
598
|
-
)), e[
|
|
599
|
-
() => o(
|
|
598
|
+
)), e[K].then(
|
|
599
|
+
() => o(n)
|
|
600
600
|
));
|
|
601
|
-
}, [e]),
|
|
602
|
-
},
|
|
603
|
-
const t =
|
|
604
|
-
return
|
|
601
|
+
}, [e]), s;
|
|
602
|
+
}, Fe = (e) => {
|
|
603
|
+
const t = Me(e), n = kt();
|
|
604
|
+
return nt(() => {
|
|
605
605
|
if (t)
|
|
606
|
-
return
|
|
606
|
+
return Rt(t, "UpdatedValue", n);
|
|
607
607
|
}, [t]), (t || e).value;
|
|
608
|
-
},
|
|
609
|
-
const t =
|
|
610
|
-
() => (
|
|
608
|
+
}, Ie = (e) => {
|
|
609
|
+
const t = j(
|
|
610
|
+
() => (Re(t, $().current), Ae),
|
|
611
611
|
{
|
|
612
612
|
props: {
|
|
613
613
|
value: {
|
|
@@ -619,345 +619,254 @@ const Ie = jt("host", { style: "display: contents" }), G = F("atomico/context"),
|
|
|
619
619
|
}
|
|
620
620
|
);
|
|
621
621
|
return t.value = e, t;
|
|
622
|
-
}, b = (e, t,
|
|
623
|
-
function
|
|
624
|
-
|
|
625
|
-
return new g(e.getUTCFullYear(), e.getUTCMonth() + 1, e.getUTCDate());
|
|
626
|
-
}
|
|
627
|
-
function B(e, t = 0) {
|
|
628
|
-
const s = e.toDate(), n = s.getUTCDay(), o = (n < t ? 7 : 0) + n - t;
|
|
629
|
-
return s.setUTCDate(s.getUTCDate() - o), g.from(s);
|
|
630
|
-
}
|
|
631
|
-
function Ht(e, t = 0) {
|
|
632
|
-
return B(e, t).add({ days: 6 });
|
|
633
|
-
}
|
|
634
|
-
function ut(e) {
|
|
635
|
-
return g.from(new Date(Date.UTC(e.year, e.month, 0)));
|
|
636
|
-
}
|
|
637
|
-
function Wt(e, t) {
|
|
638
|
-
const s = e.toDate(), n = t.toDate();
|
|
639
|
-
return s < n ? -1 : s > n ? 1 : 0;
|
|
640
|
-
}
|
|
641
|
-
function H(e, t, s) {
|
|
642
|
-
return t && g.compare(e, t) < 0 ? t : s && g.compare(e, s) > 0 ? s : e;
|
|
643
|
-
}
|
|
644
|
-
function rt(e, t, s) {
|
|
645
|
-
return H(e, t, s) === e;
|
|
646
|
-
}
|
|
647
|
-
function Ye(e, t) {
|
|
648
|
-
const s = { days: 1 }, n = [e];
|
|
649
|
-
for (; !e.equals(t); )
|
|
650
|
-
e = e.add(s), n.push(e);
|
|
651
|
-
return n;
|
|
652
|
-
}
|
|
653
|
-
function $e(e, t) {
|
|
654
|
-
const s = [];
|
|
655
|
-
for (let n = 0; n < e.length; n += t)
|
|
656
|
-
s.push(e.slice(n, n + t));
|
|
657
|
-
return s;
|
|
622
|
+
}, b = (e, t, n) => (t == null ? t = { key: n } : t.key = n, Yt(e, t)), F = b, Bt = Y`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`, zt = Y`.vh{position:absolute;transform:scale(0)}`;
|
|
623
|
+
function ot() {
|
|
624
|
+
return D.from(/* @__PURE__ */ new Date());
|
|
658
625
|
}
|
|
659
|
-
function
|
|
660
|
-
const
|
|
661
|
-
return
|
|
662
|
-
}
|
|
663
|
-
function qe(e, t, s) {
|
|
664
|
-
const n = [], o = { weekday: e }, r = B(z(), t).toDate(), i = new Intl.DateTimeFormat(s, o);
|
|
665
|
-
for (let f = 0; f < 7; f++)
|
|
666
|
-
n[f] = i.format(r), r.setDate(r.getDate() + 1);
|
|
667
|
-
return n;
|
|
626
|
+
function rt(e, t = 0) {
|
|
627
|
+
const n = w(e), s = n.getUTCDay(), o = (s < t ? 7 : 0) + s - t;
|
|
628
|
+
return n.setUTCDate(n.getUTCDate() - o), D.from(n);
|
|
668
629
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
if (Kt in e)
|
|
672
|
-
return { years: -e.years };
|
|
673
|
-
if (Jt in e)
|
|
674
|
-
return { months: -e.months };
|
|
675
|
-
if (Zt in e)
|
|
676
|
-
return { days: -e.days };
|
|
677
|
-
throw new TypeError();
|
|
630
|
+
function qt(e, t = 0) {
|
|
631
|
+
return rt(e, t).add({ days: 6 });
|
|
678
632
|
}
|
|
679
|
-
function
|
|
680
|
-
return
|
|
633
|
+
function Ht(e) {
|
|
634
|
+
return D.from(new Date(Date.UTC(e.year, e.month, 0)));
|
|
681
635
|
}
|
|
682
|
-
function
|
|
683
|
-
|
|
684
|
-
return o.setUTCFullYear(t), H(g.from(o), s, n);
|
|
636
|
+
function x(e, t, n) {
|
|
637
|
+
return t && D.compare(e, t) < 0 ? t : n && D.compare(e, n) > 0 ? n : e;
|
|
685
638
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
639
|
+
const Ue = { days: 1 };
|
|
640
|
+
function $e(e, t = 0) {
|
|
641
|
+
let n = rt(e.toPlainDate(), t);
|
|
642
|
+
const s = qt(Ht(e), t), o = [];
|
|
643
|
+
for (; D.compare(n, s) < 0; ) {
|
|
644
|
+
const r = [];
|
|
645
|
+
for (let c = 0; c < 7; c++)
|
|
646
|
+
r.push(n), n = n.add(Ue);
|
|
647
|
+
o.push(r);
|
|
648
|
+
}
|
|
649
|
+
return o;
|
|
689
650
|
}
|
|
690
|
-
function
|
|
691
|
-
return
|
|
651
|
+
function w(e) {
|
|
652
|
+
return new Date(Date.UTC(e.year, e.month - 1, e.day ?? 1));
|
|
692
653
|
}
|
|
693
|
-
const
|
|
694
|
-
class
|
|
695
|
-
constructor(t,
|
|
696
|
-
this.year = t, this.month =
|
|
654
|
+
const Le = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[0-1])$/, J = (e, t) => e.toString().padStart(t, "0");
|
|
655
|
+
class D {
|
|
656
|
+
constructor(t, n, s) {
|
|
657
|
+
this.year = t, this.month = n, this.day = s;
|
|
697
658
|
}
|
|
659
|
+
// this is an incomplete implementation that only handles arithmetic on a single unit at a time.
|
|
660
|
+
// i didn't want to get into more complex arithmetic since it get tricky fast
|
|
661
|
+
// this is enough to serve my needs and will still be a drop-in replacement when actual Temporal API lands
|
|
698
662
|
add(t) {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
663
|
+
const n = w(this);
|
|
664
|
+
if ("days" in t)
|
|
665
|
+
return n.setUTCDate(this.day + t.days), D.from(n);
|
|
666
|
+
let { year: s, month: o } = this;
|
|
667
|
+
"months" in t ? (o = this.month + t.months, n.setUTCMonth(o - 1)) : (s = this.year + t.years, n.setUTCFullYear(s));
|
|
668
|
+
const r = D.from(w({ year: s, month: o, day: 1 }));
|
|
669
|
+
return x(D.from(n), r, Ht(r));
|
|
703
670
|
}
|
|
704
671
|
toString() {
|
|
705
|
-
return `${
|
|
706
|
-
}
|
|
707
|
-
toDate() {
|
|
708
|
-
return new Date(Date.UTC(this.year, this.month - 1, this.day, 0, 0, 0));
|
|
672
|
+
return `${J(this.year, 4)}-${J(this.month, 2)}-${J(this.day, 2)}`;
|
|
709
673
|
}
|
|
710
674
|
toPlainYearMonth() {
|
|
711
|
-
return new
|
|
675
|
+
return new B(this.year, this.month);
|
|
712
676
|
}
|
|
713
677
|
equals(t) {
|
|
714
|
-
return
|
|
678
|
+
return D.compare(this, t) === 0;
|
|
715
679
|
}
|
|
716
|
-
static compare(t,
|
|
717
|
-
return
|
|
680
|
+
static compare(t, n) {
|
|
681
|
+
return t.year < n.year ? -1 : t.year > n.year ? 1 : t.month < n.month ? -1 : t.month > n.month ? 1 : t.day < n.day ? -1 : t.day > n.day ? 1 : 0;
|
|
718
682
|
}
|
|
719
683
|
static from(t) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
}
|
|
733
|
-
static fromDate(t) {
|
|
734
|
-
return new g(
|
|
684
|
+
if (typeof t == "string") {
|
|
685
|
+
const n = t.match(Le);
|
|
686
|
+
if (!n)
|
|
687
|
+
throw new TypeError(t);
|
|
688
|
+
const [, s, o, r] = n;
|
|
689
|
+
return new D(
|
|
690
|
+
parseInt(s, 10),
|
|
691
|
+
parseInt(o, 10),
|
|
692
|
+
parseInt(r, 10)
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
return new D(
|
|
735
696
|
t.getUTCFullYear(),
|
|
736
697
|
t.getUTCMonth() + 1,
|
|
737
698
|
t.getUTCDate()
|
|
738
699
|
);
|
|
739
700
|
}
|
|
740
701
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
function Et(e, t) {
|
|
745
|
-
const s = e.toDate();
|
|
746
|
-
return s.setUTCMonth(s.getUTCMonth() + t), new C(s.getUTCFullYear(), s.getUTCMonth() + 1);
|
|
747
|
-
}
|
|
748
|
-
class C {
|
|
749
|
-
constructor(t, s) {
|
|
750
|
-
this.year = t, this.month = s;
|
|
702
|
+
class B {
|
|
703
|
+
constructor(t, n) {
|
|
704
|
+
this.year = t, this.month = n;
|
|
751
705
|
}
|
|
752
706
|
add(t) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
subtract(t) {
|
|
756
|
-
return Et(this, -wt(t));
|
|
757
|
-
}
|
|
758
|
-
toDate() {
|
|
759
|
-
return new Date(Date.UTC(this.year, this.month - 1, 1));
|
|
707
|
+
const n = w(this), s = (t.months ?? 0) + (t.years ?? 0) * 12;
|
|
708
|
+
return n.setUTCMonth(n.getUTCMonth() + s), new B(n.getUTCFullYear(), n.getUTCMonth() + 1);
|
|
760
709
|
}
|
|
761
710
|
equals(t) {
|
|
762
711
|
return this.year === t.year && this.month === t.month;
|
|
763
712
|
}
|
|
764
713
|
toPlainDate() {
|
|
765
|
-
return new
|
|
766
|
-
}
|
|
767
|
-
static compare(t, s) {
|
|
768
|
-
const n = t instanceof g ? t.toPlainYearMonth() : t, o = s instanceof g ? s.toPlainYearMonth() : s;
|
|
769
|
-
return Wt(n, o);
|
|
714
|
+
return new D(this.year, this.month, 1);
|
|
770
715
|
}
|
|
771
716
|
}
|
|
772
|
-
function
|
|
717
|
+
function et(e, t) {
|
|
773
718
|
if (t)
|
|
774
719
|
try {
|
|
775
720
|
return e.from(t);
|
|
776
721
|
} catch {
|
|
777
722
|
}
|
|
778
723
|
}
|
|
779
|
-
function
|
|
780
|
-
const [t,
|
|
781
|
-
return [P(() =>
|
|
724
|
+
function I(e) {
|
|
725
|
+
const [t, n] = Lt(e);
|
|
726
|
+
return [P(() => et(D, t), [t]), (r) => n(r.toString())];
|
|
782
727
|
}
|
|
783
|
-
function
|
|
728
|
+
function _e(e) {
|
|
784
729
|
if (e) {
|
|
785
|
-
const [t,
|
|
786
|
-
if (
|
|
787
|
-
return [
|
|
730
|
+
const [t, n] = e.split("/"), s = et(D, t), o = et(D, n);
|
|
731
|
+
if (s && o)
|
|
732
|
+
return [s, o];
|
|
788
733
|
}
|
|
789
734
|
return [];
|
|
790
735
|
}
|
|
791
|
-
function
|
|
792
|
-
|
|
793
|
-
}
|
|
794
|
-
function Xe(e) {
|
|
795
|
-
const [t, s] = Lt(e);
|
|
796
|
-
return [P(() => Je(t), [t]), (r) => s(Ze(r[0], r[1]))];
|
|
736
|
+
function je(e) {
|
|
737
|
+
const [t, n] = Lt(e);
|
|
738
|
+
return [P(() => _e(t), [t]), (r) => n(`${r[0]}/${r[1]}`)];
|
|
797
739
|
}
|
|
798
|
-
function
|
|
740
|
+
function U(e, t) {
|
|
799
741
|
return P(
|
|
800
742
|
() => new Intl.DateTimeFormat(t, { timeZone: "UTC", ...e }),
|
|
801
743
|
[t, e]
|
|
802
744
|
);
|
|
803
745
|
}
|
|
804
|
-
function
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
[
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
return t;
|
|
746
|
+
function gt(e, t, n) {
|
|
747
|
+
const s = U(e, n);
|
|
748
|
+
return P(() => {
|
|
749
|
+
const o = [], r = /* @__PURE__ */ new Date();
|
|
750
|
+
for (var c = 0; c < 7; c++) {
|
|
751
|
+
const f = (r.getDay() - t + 7) % 7;
|
|
752
|
+
o[f] = s.format(r), r.setDate(r.getDate() + 1);
|
|
753
|
+
}
|
|
754
|
+
return o;
|
|
755
|
+
}, [t, s]);
|
|
815
756
|
}
|
|
816
|
-
const
|
|
817
|
-
function
|
|
818
|
-
const { offset:
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
757
|
+
const Et = (e, t, n) => x(e, t, n) === e, Dt = (e) => e.target.matches(":dir(ltr)"), Ye = { month: "long", day: "numeric" }, xe = { month: "long" }, Be = { weekday: "narrow" }, ze = { weekday: "long" }, Z = { bubbles: !0 };
|
|
758
|
+
function qe({ props: e, context: t }) {
|
|
759
|
+
const { offset: n } = e, {
|
|
760
|
+
firstDayOfWeek: s,
|
|
761
|
+
isDateDisallowed: o,
|
|
762
|
+
min: r,
|
|
763
|
+
max: c,
|
|
764
|
+
page: f,
|
|
765
|
+
locale: a,
|
|
766
|
+
focusedDate: i
|
|
767
|
+
} = t, u = ot(), d = gt(ze, s, a), l = gt(Be, s, a), m = U(Ye, a), p = U(xe, a), y = P(
|
|
768
|
+
() => f.start.add({ months: n }),
|
|
769
|
+
[f, n]
|
|
770
|
+
), E = P(
|
|
771
|
+
() => $e(y, s),
|
|
772
|
+
[y, s]
|
|
773
|
+
), h = C("focusday", Z), v = C("selectday", Z), z = C("hoverday", Z);
|
|
774
|
+
function it(g) {
|
|
775
|
+
h(x(g, r, c));
|
|
827
776
|
}
|
|
828
|
-
function
|
|
829
|
-
let
|
|
830
|
-
switch (
|
|
777
|
+
function Xt(g) {
|
|
778
|
+
let S;
|
|
779
|
+
switch (g.key) {
|
|
831
780
|
case "ArrowRight":
|
|
832
|
-
|
|
781
|
+
S = i.add({ days: Dt(g) ? 1 : -1 });
|
|
833
782
|
break;
|
|
834
783
|
case "ArrowLeft":
|
|
835
|
-
|
|
784
|
+
S = i.add({ days: Dt(g) ? -1 : 1 });
|
|
836
785
|
break;
|
|
837
786
|
case "ArrowDown":
|
|
838
|
-
|
|
787
|
+
S = i.add({ days: 7 });
|
|
839
788
|
break;
|
|
840
789
|
case "ArrowUp":
|
|
841
|
-
|
|
790
|
+
S = i.add({ days: -7 });
|
|
842
791
|
break;
|
|
843
792
|
case "PageUp":
|
|
844
|
-
|
|
793
|
+
S = i.add(g.shiftKey ? { years: -1 } : { months: -1 });
|
|
845
794
|
break;
|
|
846
795
|
case "PageDown":
|
|
847
|
-
|
|
796
|
+
S = i.add(g.shiftKey ? { years: 1 } : { months: 1 });
|
|
848
797
|
break;
|
|
849
798
|
case "Home":
|
|
850
|
-
|
|
799
|
+
S = rt(i, s);
|
|
851
800
|
break;
|
|
852
801
|
case "End":
|
|
853
|
-
|
|
802
|
+
S = qt(i, s);
|
|
854
803
|
break;
|
|
855
804
|
default:
|
|
856
805
|
return;
|
|
857
806
|
}
|
|
858
|
-
|
|
807
|
+
it(S), g.preventDefault();
|
|
859
808
|
}
|
|
860
|
-
function
|
|
861
|
-
const
|
|
862
|
-
|
|
809
|
+
function Gt(g) {
|
|
810
|
+
const S = y.equals(g);
|
|
811
|
+
if (!S && !t.showOutsideDays)
|
|
812
|
+
return;
|
|
813
|
+
const Qt = g.equals(i), Vt = g.equals(u), at = w(g), q = o?.(at), lt = !Et(g, r, c);
|
|
814
|
+
let ut = "", A;
|
|
863
815
|
if ("highlightedRange" in t) {
|
|
864
|
-
const [
|
|
865
|
-
|
|
816
|
+
const [ft, dt] = t.highlightedRange, ht = ft?.equals(g), mt = dt?.equals(g);
|
|
817
|
+
A = Et(g, ft, dt), ut = `${ht ? "range-start" : ""} ${mt ? "range-end" : ""} ${A && !ht && !mt ? "range-inner" : ""}`;
|
|
866
818
|
} else
|
|
867
|
-
|
|
819
|
+
A = t.value?.equals(g);
|
|
868
820
|
return {
|
|
869
|
-
part:
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
"range-end": K,
|
|
878
|
-
"range-inner": yt && k && !W && !K
|
|
879
|
-
}),
|
|
880
|
-
tabindex: E && se ? 0 : -1,
|
|
881
|
-
disabled: mt,
|
|
882
|
-
"aria-disabled": x ? "true" : void 0,
|
|
883
|
-
"aria-pressed": E && k,
|
|
884
|
-
"aria-current": dt ? "date" : void 0,
|
|
885
|
-
"aria-label": a.format(ht),
|
|
886
|
-
onkeydown: ee,
|
|
821
|
+
part: `button day ${S && A ? "selected" : ""} ${ut}`,
|
|
822
|
+
tabindex: S && Qt ? 0 : -1,
|
|
823
|
+
disabled: lt,
|
|
824
|
+
"aria-disabled": q ? "true" : void 0,
|
|
825
|
+
"aria-pressed": S && A,
|
|
826
|
+
"aria-current": Vt ? "date" : void 0,
|
|
827
|
+
"aria-label": m.format(at),
|
|
828
|
+
onkeydown: Xt,
|
|
887
829
|
onclick() {
|
|
888
|
-
|
|
830
|
+
q || v(g), it(g);
|
|
889
831
|
},
|
|
890
832
|
onmouseover() {
|
|
891
|
-
!
|
|
833
|
+
!q && !lt && z(g);
|
|
892
834
|
}
|
|
893
835
|
};
|
|
894
836
|
}
|
|
895
837
|
return {
|
|
896
|
-
weeks:
|
|
897
|
-
yearMonth:
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
getDayProps:
|
|
838
|
+
weeks: E,
|
|
839
|
+
yearMonth: y,
|
|
840
|
+
daysLong: d,
|
|
841
|
+
daysShort: l,
|
|
842
|
+
formatter: p,
|
|
843
|
+
getDayProps: Gt
|
|
902
844
|
};
|
|
903
845
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
this.start = t, this.duration = s, this.focusedDate = n, this.end = t.add({ months: s.months - 1 });
|
|
907
|
-
}
|
|
908
|
-
end;
|
|
909
|
-
contains(t) {
|
|
910
|
-
return C.compare(t, this.start) >= 0 && C.compare(t, this.end) <= 0;
|
|
911
|
-
}
|
|
912
|
-
adjust(t) {
|
|
913
|
-
const { start: s, duration: n } = this, o = C.compare(s, t) > 0;
|
|
914
|
-
let r = new T(s, n, t);
|
|
915
|
-
for (; !r.contains(t); )
|
|
916
|
-
r = new T(
|
|
917
|
-
o ? r.start.subtract(n) : r.start.add(n),
|
|
918
|
-
n,
|
|
919
|
-
t
|
|
920
|
-
);
|
|
921
|
-
return r;
|
|
922
|
-
}
|
|
923
|
-
next() {
|
|
924
|
-
return new T(
|
|
925
|
-
this.start.add(this.duration),
|
|
926
|
-
this.duration,
|
|
927
|
-
this.focusedDate.add(this.duration)
|
|
928
|
-
);
|
|
929
|
-
}
|
|
930
|
-
prev() {
|
|
931
|
-
return new T(
|
|
932
|
-
this.start.subtract(this.duration),
|
|
933
|
-
this.duration,
|
|
934
|
-
this.focusedDate.subtract(this.duration)
|
|
935
|
-
);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
const Tt = z(), lt = Le({
|
|
939
|
-
firstDayOfWeek: 0,
|
|
846
|
+
const W = ot(), ct = Ie({
|
|
847
|
+
firstDayOfWeek: 1,
|
|
940
848
|
isDateDisallowed: () => !1,
|
|
941
|
-
|
|
849
|
+
focusedDate: W,
|
|
850
|
+
page: { start: W.toPlainYearMonth(), end: W.toPlainYearMonth() }
|
|
942
851
|
});
|
|
943
|
-
customElements.define("calendar-month-ctx",
|
|
944
|
-
const
|
|
852
|
+
customElements.define("calendar-month-ctx", ct);
|
|
853
|
+
const He = j(
|
|
945
854
|
(e) => {
|
|
946
|
-
const t =
|
|
855
|
+
const t = Fe(ct), n = se(), s = qe({ props: e, context: t });
|
|
947
856
|
function o() {
|
|
948
|
-
|
|
857
|
+
n.current.querySelector("button[tabindex='0']")?.focus();
|
|
949
858
|
}
|
|
950
|
-
return /* @__PURE__ */
|
|
951
|
-
/* @__PURE__ */ b("div", { id: "
|
|
952
|
-
/* @__PURE__ */
|
|
953
|
-
/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { part: "tr head", children:
|
|
859
|
+
return /* @__PURE__ */ F("host", { shadowDom: !0, focus: o, children: [
|
|
860
|
+
/* @__PURE__ */ b("div", { id: "h", part: "heading", children: s.formatter.format(w(s.yearMonth)) }),
|
|
861
|
+
/* @__PURE__ */ F("table", { ref: n, "aria-labelledby": "h", part: "table", children: [
|
|
862
|
+
/* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { part: "tr head", children: s.daysLong.map((r, c) => /* @__PURE__ */ F("th", { part: "th", scope: "col", children: [
|
|
954
863
|
/* @__PURE__ */ b("span", { class: "vh", children: r }),
|
|
955
|
-
/* @__PURE__ */ b("span", { "aria-hidden": "true", children:
|
|
864
|
+
/* @__PURE__ */ b("span", { "aria-hidden": "true", children: s.daysShort[c] })
|
|
956
865
|
] })) }) }),
|
|
957
|
-
/* @__PURE__ */ b("tbody", { children:
|
|
958
|
-
const
|
|
959
|
-
return /* @__PURE__ */ b("td", { part: "td", children:
|
|
960
|
-
}) },
|
|
866
|
+
/* @__PURE__ */ b("tbody", { children: s.weeks.map((r, c) => /* @__PURE__ */ b("tr", { part: "tr week", children: r.map((f, a) => {
|
|
867
|
+
const i = s.getDayProps(f);
|
|
868
|
+
return /* @__PURE__ */ b("td", { part: "td", children: i && /* @__PURE__ */ b("button", { ...i, children: f.day }) }, a);
|
|
869
|
+
}) }, c)) })
|
|
961
870
|
] })
|
|
962
871
|
] });
|
|
963
872
|
},
|
|
@@ -969,40 +878,35 @@ const en = $(
|
|
|
969
878
|
}
|
|
970
879
|
},
|
|
971
880
|
styles: [
|
|
972
|
-
zt,
|
|
973
881
|
Bt,
|
|
974
|
-
|
|
882
|
+
zt,
|
|
883
|
+
Y`:host{--color-accent: black;--color-text-on-accent: white;display:flex;flex-direction:column;gap:.25rem;text-align:center;inline-size:fit-content}table{border-collapse:collapse;font-size:.875rem}th{font-weight:700;block-size:2.25rem}td{padding-inline:0}button{color:inherit;font-size:inherit;background:transparent;border:0;font-variant-numeric:tabular-nums;block-size:2.25rem;inline-size:2.25rem}button:hover:where(:not(:disabled)){background:#0000000d}button:is([aria-pressed=true],:focus-visible){background:var(--color-accent);color:var(--color-text-on-accent)}button:focus-visible{outline:1px solid var(--color-text-on-accent);outline-offset:-2px}button:disabled,:host::part(outside),:host::part(disallowed){cursor:default;opacity:.5}`
|
|
975
884
|
]
|
|
976
885
|
}
|
|
977
886
|
);
|
|
978
|
-
customElements.define("calendar-month",
|
|
979
|
-
function
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
onclick: e.next,
|
|
999
|
-
"aria-disabled": e.next ? null : "true",
|
|
1000
|
-
children: /* @__PURE__ */ b("slot", { name: "next", children: "Next" })
|
|
1001
|
-
}
|
|
1002
|
-
)
|
|
887
|
+
customElements.define("calendar-month", He);
|
|
888
|
+
function St(e) {
|
|
889
|
+
return /* @__PURE__ */ b(
|
|
890
|
+
"button",
|
|
891
|
+
{
|
|
892
|
+
part: `button ${e.name} ${e.onclick ? "" : "disabled"}`,
|
|
893
|
+
onclick: e.onclick,
|
|
894
|
+
"aria-disabled": e.onclick ? null : "true",
|
|
895
|
+
children: /* @__PURE__ */ b("slot", { name: e.name, children: e.children })
|
|
896
|
+
}
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
function Kt(e) {
|
|
900
|
+
const t = w(e.page.start), n = w(e.page.end);
|
|
901
|
+
return /* @__PURE__ */ F("div", { role: "group", "aria-labelledby": "h", part: "container", children: [
|
|
902
|
+
/* @__PURE__ */ b("div", { id: "h", class: "vh", "aria-live": "polite", "aria-atomic": "true", children: e.formatVerbose.formatRange(t, n) }),
|
|
903
|
+
/* @__PURE__ */ F("div", { part: "header", children: [
|
|
904
|
+
/* @__PURE__ */ b(St, { name: "previous", onclick: e.previous, children: "Previous" }),
|
|
905
|
+
/* @__PURE__ */ b("div", { part: "heading", "aria-hidden": "true", children: e.format.formatRange(t, n) }),
|
|
906
|
+
/* @__PURE__ */ b(St, { name: "next", onclick: e.next, children: "Next" })
|
|
1003
907
|
] }),
|
|
1004
908
|
/* @__PURE__ */ b(
|
|
1005
|
-
|
|
909
|
+
ct,
|
|
1006
910
|
{
|
|
1007
911
|
value: e,
|
|
1008
912
|
onselectday: e.onSelect,
|
|
@@ -1013,7 +917,7 @@ function Xt(e) {
|
|
|
1013
917
|
)
|
|
1014
918
|
] });
|
|
1015
919
|
}
|
|
1016
|
-
const
|
|
920
|
+
const Jt = {
|
|
1017
921
|
value: {
|
|
1018
922
|
type: String,
|
|
1019
923
|
value: ""
|
|
@@ -1036,7 +940,7 @@ const Gt = {
|
|
|
1036
940
|
},
|
|
1037
941
|
showOutsideDays: {
|
|
1038
942
|
type: Boolean,
|
|
1039
|
-
value:
|
|
943
|
+
value: !1
|
|
1040
944
|
},
|
|
1041
945
|
locale: {
|
|
1042
946
|
type: String,
|
|
@@ -1046,101 +950,129 @@ const Gt = {
|
|
|
1046
950
|
months: {
|
|
1047
951
|
type: Number,
|
|
1048
952
|
value: 1
|
|
953
|
+
},
|
|
954
|
+
focusedDate: {
|
|
955
|
+
type: String,
|
|
956
|
+
value: () => {
|
|
957
|
+
}
|
|
1049
958
|
}
|
|
1050
|
-
},
|
|
1051
|
-
zt,
|
|
959
|
+
}, Zt = [
|
|
1052
960
|
Bt,
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
961
|
+
zt,
|
|
962
|
+
Y`:host{display:block;inline-size:fit-content}[role=group]{display:flex;flex-direction:column;gap:1em}:host::part(header){display:flex;align-items:center;justify-content:space-between}:host::part(heading){font-weight:700;font-size:1.25em}button{display:flex;align-items:center;justify-content:center}button[aria-disabled]{cursor:default;opacity:.5}`
|
|
963
|
+
], Ke = { year: "numeric" }, Je = { year: "numeric", month: "long" };
|
|
964
|
+
function wt(e, t) {
|
|
965
|
+
return (t.year - e.year) * 12 + t.month - e.month;
|
|
966
|
+
}
|
|
967
|
+
const vt = (e, t) => (e = t === 12 ? new B(e.year, 1) : e, {
|
|
968
|
+
start: e,
|
|
969
|
+
end: e.add({ months: t - 1 })
|
|
970
|
+
});
|
|
971
|
+
function Wt({
|
|
972
|
+
months: e,
|
|
973
|
+
locale: t,
|
|
974
|
+
focusedDate: n,
|
|
975
|
+
setFocusedDate: s
|
|
976
|
+
}) {
|
|
977
|
+
const [o] = I("min"), [r] = I("max"), c = C("focusday"), f = C("change"), a = P(
|
|
978
|
+
() => x(n ?? ot(), o, r),
|
|
979
|
+
[n, o, r]
|
|
980
|
+
), [i, u] = st(
|
|
981
|
+
() => vt(a.toPlainYearMonth(), e)
|
|
982
|
+
), d = (h) => {
|
|
983
|
+
const v = wt(i.start, h.toPlainYearMonth());
|
|
984
|
+
return v >= 0 && v < e;
|
|
985
|
+
};
|
|
986
|
+
nt(() => {
|
|
987
|
+
let h = i.start;
|
|
988
|
+
if (!d(a)) {
|
|
989
|
+
const v = wt(h, a.toPlainYearMonth()), z = Math.floor(v / e);
|
|
990
|
+
h = h.add({ months: z * e });
|
|
991
|
+
}
|
|
992
|
+
u(vt(h, e));
|
|
993
|
+
}, [a, e]);
|
|
994
|
+
const l = $();
|
|
995
|
+
function m() {
|
|
996
|
+
l.current.querySelectorAll("calendar-month").forEach((h) => h.focus());
|
|
1065
997
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
c.current.querySelectorAll("calendar-month").forEach((m) => m.focus());
|
|
998
|
+
function p(h) {
|
|
999
|
+
s(h), c(w(h));
|
|
1069
1000
|
}
|
|
1070
|
-
const
|
|
1001
|
+
const y = U(Ke, t), E = U(Je, t);
|
|
1071
1002
|
return {
|
|
1072
|
-
format:
|
|
1073
|
-
formatVerbose:
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1003
|
+
format: y,
|
|
1004
|
+
formatVerbose: E,
|
|
1005
|
+
page: i,
|
|
1006
|
+
focusedDate: a,
|
|
1007
|
+
dispatch: f,
|
|
1008
|
+
onFocus(h) {
|
|
1009
|
+
h.stopPropagation(), p(h.detail), setTimeout(m);
|
|
1078
1010
|
},
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
focus: h
|
|
1011
|
+
min: o,
|
|
1012
|
+
max: r,
|
|
1013
|
+
next: r == null || !d(r) ? () => p(a.add({ months: e })) : void 0,
|
|
1014
|
+
previous: o == null || !d(o) ? () => p(a.add({ months: -e })) : void 0,
|
|
1015
|
+
focus: m
|
|
1085
1016
|
};
|
|
1086
1017
|
}
|
|
1087
|
-
const
|
|
1018
|
+
const Ze = j(
|
|
1088
1019
|
(e) => {
|
|
1089
|
-
const [t,
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1020
|
+
const [t, n] = I("value"), [s = t, o] = I("focusedDate"), r = Wt({
|
|
1021
|
+
...e,
|
|
1022
|
+
focusedDate: s,
|
|
1023
|
+
setFocusedDate: o
|
|
1024
|
+
});
|
|
1025
|
+
function c(f) {
|
|
1026
|
+
n(f.detail), r.dispatch();
|
|
1095
1027
|
}
|
|
1096
|
-
return /* @__PURE__ */ b("host", { shadowDom: !0, focus:
|
|
1097
|
-
|
|
1028
|
+
return /* @__PURE__ */ b("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ b(
|
|
1029
|
+
Kt,
|
|
1098
1030
|
{
|
|
1099
1031
|
...e,
|
|
1100
|
-
...
|
|
1032
|
+
...r,
|
|
1101
1033
|
value: t,
|
|
1102
|
-
|
|
1103
|
-
onSelect: o
|
|
1034
|
+
onSelect: c
|
|
1104
1035
|
}
|
|
1105
1036
|
) });
|
|
1106
1037
|
},
|
|
1107
|
-
{ props:
|
|
1038
|
+
{ props: Jt, styles: Zt }
|
|
1108
1039
|
);
|
|
1109
|
-
customElements.define("calendar-date",
|
|
1110
|
-
const
|
|
1040
|
+
customElements.define("calendar-date", Ze);
|
|
1041
|
+
const Tt = (e, t) => D.compare(e, t) < 0 ? [e, t] : [t, e], We = j(
|
|
1111
1042
|
(e) => {
|
|
1112
|
-
const [t,
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1043
|
+
const [t, n] = je("value"), [s = t[0], o] = I("focusedDate"), r = Wt({
|
|
1044
|
+
...e,
|
|
1045
|
+
focusedDate: s,
|
|
1046
|
+
setFocusedDate: o
|
|
1047
|
+
}), c = C("rangestart"), f = C("rangeend"), [a, i] = st();
|
|
1048
|
+
function u(p) {
|
|
1049
|
+
r.onFocus(p), d(p);
|
|
1118
1050
|
}
|
|
1119
|
-
function
|
|
1120
|
-
|
|
1051
|
+
function d(p) {
|
|
1052
|
+
p.stopPropagation(), i((y) => y && { ...y, b: p.detail });
|
|
1121
1053
|
}
|
|
1122
|
-
function
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1054
|
+
function l(p) {
|
|
1055
|
+
const y = p.detail;
|
|
1056
|
+
p.stopPropagation(), a ? (n(Tt(a.a, y)), i(void 0), f(w(y)), r.dispatch()) : (i({ a: y, b: y }), c(w(y)));
|
|
1125
1057
|
}
|
|
1126
|
-
const
|
|
1127
|
-
return /* @__PURE__ */ b("host", { shadowDom: !0, focus:
|
|
1128
|
-
|
|
1058
|
+
const m = a ? Tt(a.a, a.b) : t;
|
|
1059
|
+
return /* @__PURE__ */ b("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ b(
|
|
1060
|
+
Kt,
|
|
1129
1061
|
{
|
|
1130
1062
|
...e,
|
|
1131
|
-
...
|
|
1132
|
-
highlightedRange:
|
|
1063
|
+
...r,
|
|
1064
|
+
highlightedRange: m,
|
|
1133
1065
|
onFocus: u,
|
|
1134
|
-
onHover:
|
|
1135
|
-
onSelect:
|
|
1066
|
+
onHover: d,
|
|
1067
|
+
onSelect: l
|
|
1136
1068
|
}
|
|
1137
1069
|
) });
|
|
1138
1070
|
},
|
|
1139
|
-
{ props:
|
|
1071
|
+
{ props: Jt, styles: Zt }
|
|
1140
1072
|
);
|
|
1141
|
-
customElements.define("calendar-range",
|
|
1073
|
+
customElements.define("calendar-range", We);
|
|
1142
1074
|
export {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1075
|
+
Ze as CalendarDate,
|
|
1076
|
+
He as CalendarMonth,
|
|
1077
|
+
We as CalendarRange
|
|
1146
1078
|
};
|