cally 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cally.js +338 -341
- 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
|
*/
|
|
@@ -29,38 +29,38 @@ class ee {
|
|
|
29
29
|
return this.#e.add(t), () => this.#e.delete(t);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
const Mt = (e) => new
|
|
33
|
-
globalThis[
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
const { i: s, hooks: r } =
|
|
37
|
-
return o.value = e(o.value), o.effect = t, o.tag = n,
|
|
38
|
-
},
|
|
32
|
+
const Mt = (e) => new te(e), tt = Symbol.for("atomico.hooks");
|
|
33
|
+
globalThis[tt] = globalThis[tt] || {};
|
|
34
|
+
let k = globalThis[tt];
|
|
35
|
+
const ee = Symbol.for("Atomico.suspense"), At = Symbol.for("Atomico.effect"), ne = Symbol.for("Atomico.layoutEffect"), Ft = Symbol.for("Atomico.insertionEffect"), O = (e, t, n) => {
|
|
36
|
+
const { i: s, hooks: r } = k.c, o = r[s] = r[s] || {};
|
|
37
|
+
return o.value = e(o.value), o.effect = t, o.tag = n, k.c.i++, r[s].value;
|
|
38
|
+
}, se = (e) => O((t = Mt(e)) => t), _ = () => O((e = Mt(k.c.host)) => e), Rt = () => k.c.update, oe = (e, t, n = 0) => {
|
|
39
39
|
let s = {}, r = !1;
|
|
40
|
-
const o = () => r, c = (
|
|
40
|
+
const o = () => r, c = (i, f) => {
|
|
41
41
|
for (const d in s) {
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const l = s[d];
|
|
43
|
+
l.effect && l.tag === i && (l.value = l.effect(l.value, f));
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
return { load: (
|
|
47
|
-
|
|
46
|
+
return { load: (i) => {
|
|
47
|
+
k.c = { host: t, hooks: s, update: e, i: 0, id: n };
|
|
48
48
|
let f;
|
|
49
49
|
try {
|
|
50
|
-
r = !1, f =
|
|
50
|
+
r = !1, f = i();
|
|
51
51
|
} catch (d) {
|
|
52
|
-
if (d !==
|
|
52
|
+
if (d !== ee)
|
|
53
53
|
throw d;
|
|
54
54
|
r = !0;
|
|
55
55
|
} finally {
|
|
56
|
-
|
|
56
|
+
k.c = null;
|
|
57
57
|
}
|
|
58
58
|
return f;
|
|
59
|
-
}, cleanEffects: (
|
|
60
|
-
c(At,
|
|
59
|
+
}, cleanEffects: (i) => (c(Ft, i), () => (c(ne, i), () => {
|
|
60
|
+
c(At, i);
|
|
61
61
|
})), isSuspense: o };
|
|
62
|
-
},
|
|
63
|
-
function
|
|
62
|
+
}, M = Symbol.for;
|
|
63
|
+
function It(e, t) {
|
|
64
64
|
const n = e.length;
|
|
65
65
|
if (n !== t.length)
|
|
66
66
|
return !1;
|
|
@@ -71,8 +71,8 @@ function Ut(e, t) {
|
|
|
71
71
|
}
|
|
72
72
|
return !0;
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
function
|
|
74
|
+
const w = (e) => typeof e == "function", R = (e) => typeof e == "object", { isArray: re } = Array, et = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
|
|
75
|
+
function Ut(e, t) {
|
|
76
76
|
let n;
|
|
77
77
|
const s = (r) => {
|
|
78
78
|
let { length: o } = r;
|
|
@@ -81,17 +81,17 @@ function $t(e, t) {
|
|
|
81
81
|
if (u && Array.isArray(u))
|
|
82
82
|
s(u);
|
|
83
83
|
else {
|
|
84
|
-
const
|
|
85
|
-
if (u == null ||
|
|
84
|
+
const a = typeof u;
|
|
85
|
+
if (u == null || a === "function" || a === "boolean")
|
|
86
86
|
continue;
|
|
87
|
-
|
|
87
|
+
a === "string" || a === "number" ? (n == null && (n = ""), n += u) : (n != null && (t(n), n = null), t(u));
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
s(e), n != null && t(n);
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
class
|
|
93
|
+
const $t = (e, t, n) => (e.addEventListener(t, n), () => e.removeEventListener(t, n));
|
|
94
|
+
class Lt {
|
|
95
95
|
/**
|
|
96
96
|
*
|
|
97
97
|
* @param {HTMLElement} target
|
|
@@ -102,9 +102,9 @@ class _t {
|
|
|
102
102
|
this.message = n, this.target = t, this.value = s;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
class
|
|
105
|
+
class _t extends Lt {
|
|
106
106
|
}
|
|
107
|
-
class ce extends
|
|
107
|
+
class ce extends Lt {
|
|
108
108
|
}
|
|
109
109
|
const q = "Custom", ie = null, ae = { true: 1, "": 1, 1: 1 };
|
|
110
110
|
function le(e, t, n, s, r) {
|
|
@@ -112,30 +112,30 @@ function le(e, t, n, s, r) {
|
|
|
112
112
|
type: o,
|
|
113
113
|
reflect: c,
|
|
114
114
|
event: u,
|
|
115
|
-
value:
|
|
116
|
-
attr:
|
|
117
|
-
} = n?.name != q && R(n) && n != ie ? n : { type: n }, f = o?.name === q && o.map, d =
|
|
115
|
+
value: a,
|
|
116
|
+
attr: i = ue(t)
|
|
117
|
+
} = n?.name != q && R(n) && n != ie ? n : { type: n }, f = o?.name === q && o.map, d = a != null ? o == Function || !w(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
|
-
d && o != Boolean &&
|
|
127
|
-
const { error:
|
|
124
|
+
set(l) {
|
|
125
|
+
const m = this[t];
|
|
126
|
+
d && o != Boolean && l == null && (l = d());
|
|
127
|
+
const { error: v, value: p } = (f ? he : me)(
|
|
128
128
|
o,
|
|
129
|
-
|
|
129
|
+
l
|
|
130
130
|
);
|
|
131
|
-
if (
|
|
132
|
-
throw new
|
|
131
|
+
if (v && p != null)
|
|
132
|
+
throw new _t(
|
|
133
133
|
this,
|
|
134
134
|
`The value defined for prop '${t}' must be of type '${o.name}'`,
|
|
135
|
-
|
|
135
|
+
p
|
|
136
136
|
);
|
|
137
|
-
|
|
138
|
-
c && (this._ignoreAttr =
|
|
137
|
+
m != p && (this._props[t] = p ?? void 0, this.update(), u && jt(this, u), this.updated.then(() => {
|
|
138
|
+
c && (this._ignoreAttr = i, fe(this, o, i, this[t]), this._ignoreAttr = null);
|
|
139
139
|
}));
|
|
140
140
|
},
|
|
141
141
|
/**
|
|
@@ -144,9 +144,9 @@ function le(e, t, n, s, r) {
|
|
|
144
144
|
get() {
|
|
145
145
|
return this._props[t];
|
|
146
146
|
}
|
|
147
|
-
}), d && (r[t] = d()), s[
|
|
147
|
+
}), d && (r[t] = d()), s[i] = { prop: t, type: o };
|
|
148
148
|
}
|
|
149
|
-
const
|
|
149
|
+
const jt = (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
150
|
n,
|
|
151
151
|
t?.name === q && t?.serialize ? t?.serialize(s) : R(s) ? JSON.stringify(s) : t == Boolean ? "" : s
|
|
152
152
|
), de = (e, t) => e == Boolean ? !!ae[t] : e == Number ? Number(t) : e == String ? t : e == Array || e == Object ? JSON.parse(t) : e.name == q ? t : (
|
|
@@ -172,9 +172,9 @@ let ye = 0;
|
|
|
172
172
|
const pe = (e) => {
|
|
173
173
|
const t = (e?.dataset || {})?.hydrate || "";
|
|
174
174
|
return t || "c" + ye++;
|
|
175
|
-
},
|
|
175
|
+
}, j = (e, t = HTMLElement) => {
|
|
176
176
|
const n = {}, s = {}, r = "prototype" in t && t.prototype instanceof Element, o = r ? t : "base" in t ? t.base : HTMLElement, { props: c, styles: u } = r ? e : t;
|
|
177
|
-
class
|
|
177
|
+
class a extends o {
|
|
178
178
|
constructor() {
|
|
179
179
|
super(), this._setup(), this._render = () => e({ ...this._props });
|
|
180
180
|
for (const f in s)
|
|
@@ -192,35 +192,35 @@ const pe = (e) => {
|
|
|
192
192
|
this._props = {};
|
|
193
193
|
let f, d;
|
|
194
194
|
this.mounted = new Promise(
|
|
195
|
-
(
|
|
196
|
-
|
|
195
|
+
(h) => this.mount = () => {
|
|
196
|
+
h(), f != this.parentNode && (d != f ? this.unmounted.then(this.update) : this.update()), f = this.parentNode;
|
|
197
197
|
}
|
|
198
198
|
), this.unmounted = new Promise(
|
|
199
|
-
(
|
|
200
|
-
|
|
199
|
+
(h) => this.unmount = () => {
|
|
200
|
+
h(), (f != this.parentNode || !this.isConnected) && (l.cleanEffects(!0)()(), d = this.parentNode, f = 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, v = !0;
|
|
209
|
+
const p = et(this);
|
|
210
|
+
this.update = () => (m || (m = !0, this.updated = (this.updated || this.mounted).then(() => {
|
|
211
211
|
try {
|
|
212
|
-
const
|
|
213
|
-
return
|
|
214
|
-
|
|
212
|
+
const h = l.load(this._render), b = l.cleanEffects();
|
|
213
|
+
return h && //@ts-ignore
|
|
214
|
+
h.render(this, this.symbolId, p), m = !1, v && !l.isSuspense() && (v = !1, !p && be(this)), b();
|
|
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
|
+
(h) => {
|
|
223
|
+
h && h();
|
|
224
224
|
}
|
|
225
225
|
)), this.updated), this.update();
|
|
226
226
|
}
|
|
@@ -236,22 +236,22 @@ const pe = (e) => {
|
|
|
236
236
|
* @param {(string|null)} oldValue
|
|
237
237
|
* @param {(string|null)} value
|
|
238
238
|
*/
|
|
239
|
-
attributeChangedCallback(f, d,
|
|
239
|
+
attributeChangedCallback(f, d, l) {
|
|
240
240
|
if (n[f]) {
|
|
241
|
-
if (f === this._ignoreAttr || d ===
|
|
241
|
+
if (f === this._ignoreAttr || d === l)
|
|
242
242
|
return;
|
|
243
|
-
const { prop:
|
|
243
|
+
const { prop: m, type: v } = n[f];
|
|
244
244
|
try {
|
|
245
|
-
this[
|
|
245
|
+
this[m] = de(v, l);
|
|
246
246
|
} catch {
|
|
247
247
|
throw new ce(
|
|
248
248
|
this,
|
|
249
|
-
`The value defined as attr '${f}' cannot be parsed by type '${
|
|
250
|
-
|
|
249
|
+
`The value defined as attr '${f}' cannot be parsed by type '${v.name}'`,
|
|
250
|
+
l
|
|
251
251
|
);
|
|
252
252
|
}
|
|
253
253
|
} else
|
|
254
|
-
super.attributeChangedCallback(f, d,
|
|
254
|
+
super.attributeChangedCallback(f, d, l);
|
|
255
255
|
}
|
|
256
256
|
static get props() {
|
|
257
257
|
return { ...super.props, ...c };
|
|
@@ -263,32 +263,32 @@ const pe = (e) => {
|
|
|
263
263
|
return Object.keys(n).concat(f);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
return
|
|
266
|
+
return a;
|
|
267
267
|
};
|
|
268
268
|
function be(e) {
|
|
269
269
|
const { styles: t } = e.constructor, { shadowRoot: n } = e;
|
|
270
270
|
if (n && t.length) {
|
|
271
271
|
const s = [];
|
|
272
|
-
|
|
272
|
+
Ut(t, (r) => {
|
|
273
273
|
r && (r instanceof Element ? n.appendChild(r.cloneNode(!0)) : s.push(r));
|
|
274
274
|
}), s.length && (n.adoptedStyleSheets = s);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
const
|
|
278
|
-
|
|
277
|
+
const Yt = (e) => (t, n) => {
|
|
278
|
+
O(
|
|
279
279
|
/**
|
|
280
280
|
* Clean the effect hook
|
|
281
281
|
* @type {import("internal/hooks.js").CollectorEffect}
|
|
282
282
|
*/
|
|
283
|
-
([s, r] = []) => ((r || !r) && (r &&
|
|
283
|
+
([s, r] = []) => ((r || !r) && (r && It(r, n) ? s = s || !0 : (w(s) && s(), s = null)), [s, n]),
|
|
284
284
|
/**
|
|
285
285
|
* @returns {any}
|
|
286
286
|
*/
|
|
287
|
-
([s, r], o) => o ? (
|
|
287
|
+
([s, r], o) => o ? (w(s) && s(), []) : [s || t(), r],
|
|
288
288
|
e
|
|
289
289
|
);
|
|
290
|
-
},
|
|
291
|
-
class
|
|
290
|
+
}, $ = Yt(At), ge = Yt(Ft);
|
|
291
|
+
class Bt extends Array {
|
|
292
292
|
/**
|
|
293
293
|
*
|
|
294
294
|
* @param {any} initialState
|
|
@@ -318,41 +318,41 @@ class xt extends Array {
|
|
|
318
318
|
// this[2](nextState, this);
|
|
319
319
|
// }
|
|
320
320
|
}
|
|
321
|
-
const
|
|
322
|
-
const t =
|
|
323
|
-
return
|
|
324
|
-
(n = new
|
|
325
|
-
s =
|
|
321
|
+
const rt = (e) => {
|
|
322
|
+
const t = Rt();
|
|
323
|
+
return O(
|
|
324
|
+
(n = new Bt(e, (s, r, o) => {
|
|
325
|
+
s = w(s) ? s(r[0]) : s, s !== r[0] && (r[0] = s, o || t());
|
|
326
326
|
})) => n
|
|
327
327
|
);
|
|
328
|
-
},
|
|
329
|
-
const [n] =
|
|
328
|
+
}, T = (e, t) => {
|
|
329
|
+
const [n] = O(([s, r, o = 0] = []) => ((!r || r && !It(r, t)) && (s = e()), [s, t, o]));
|
|
330
330
|
return n;
|
|
331
|
-
},
|
|
332
|
-
const { current: t } =
|
|
331
|
+
}, ct = (e) => {
|
|
332
|
+
const { current: t } = _();
|
|
333
333
|
if (!(e in t))
|
|
334
|
-
throw new
|
|
334
|
+
throw new _t(
|
|
335
335
|
t,
|
|
336
336
|
`For useProp("${e}"), the prop does not exist on the host.`,
|
|
337
337
|
e
|
|
338
338
|
);
|
|
339
|
-
return
|
|
340
|
-
(n = new
|
|
341
|
-
s =
|
|
339
|
+
return O(
|
|
340
|
+
(n = new Bt(t[e], (s, r) => {
|
|
341
|
+
s = w(s) ? s(t[e]) : s, t[e] = s;
|
|
342
342
|
})) => (n[0] = t[e], n)
|
|
343
343
|
);
|
|
344
|
-
},
|
|
345
|
-
const n =
|
|
346
|
-
return n[e] || (n[e] = (s = t.detail) =>
|
|
344
|
+
}, C = (e, t = {}) => {
|
|
345
|
+
const n = _();
|
|
346
|
+
return n[e] || (n[e] = (s = t.detail) => jt(n.current, {
|
|
347
347
|
type: e,
|
|
348
348
|
...t,
|
|
349
349
|
detail: s
|
|
350
350
|
})), n[e];
|
|
351
|
-
},
|
|
352
|
-
globalThis[
|
|
351
|
+
}, nt = M("atomico/options");
|
|
352
|
+
globalThis[nt] = globalThis[nt] || {
|
|
353
353
|
sheet: !!document.adoptedStyleSheets
|
|
354
354
|
};
|
|
355
|
-
const
|
|
355
|
+
const qt = globalThis[nt], Ee = {
|
|
356
356
|
checked: 1,
|
|
357
357
|
value: 1,
|
|
358
358
|
selected: 1
|
|
@@ -372,18 +372,18 @@ const zt = globalThis[et], Ee = {
|
|
|
372
372
|
cloneNode: 1,
|
|
373
373
|
children: 1,
|
|
374
374
|
key: 1
|
|
375
|
-
},
|
|
376
|
-
class
|
|
375
|
+
}, B = {}, st = [];
|
|
376
|
+
class ot extends Text {
|
|
377
377
|
}
|
|
378
|
-
const Se =
|
|
378
|
+
const Se = M("atomico/id"), I = M("atomico/type"), Z = M("atomico/ref"), xt = M("atomico/vnode"), we = () => {
|
|
379
379
|
};
|
|
380
380
|
function Ce(e, t, n) {
|
|
381
|
-
return
|
|
381
|
+
return Ht(this, e, t, n);
|
|
382
382
|
}
|
|
383
|
-
const
|
|
384
|
-
const s = t ||
|
|
383
|
+
const zt = (e, t, ...n) => {
|
|
384
|
+
const s = t || B;
|
|
385
385
|
let { children: r } = s;
|
|
386
|
-
if (r = r ?? (n.length ? n :
|
|
386
|
+
if (r = r ?? (n.length ? n : st), e === we)
|
|
387
387
|
return r;
|
|
388
388
|
const o = e ? e instanceof Node ? 1 : (
|
|
389
389
|
//@ts-ignore
|
|
@@ -391,11 +391,11 @@ const Ht = (e, t, ...n) => {
|
|
|
391
391
|
) : 0;
|
|
392
392
|
if (o === !1 && e instanceof Function)
|
|
393
393
|
return e(
|
|
394
|
-
r !=
|
|
394
|
+
r != st ? { children: r, ...s } : s
|
|
395
395
|
);
|
|
396
|
-
const c =
|
|
396
|
+
const c = qt.render || Ce;
|
|
397
397
|
return {
|
|
398
|
-
[I]:
|
|
398
|
+
[I]: xt,
|
|
399
399
|
type: e,
|
|
400
400
|
props: s,
|
|
401
401
|
children: r,
|
|
@@ -414,9 +414,9 @@ const Ht = (e, t, ...n) => {
|
|
|
414
414
|
render: c
|
|
415
415
|
};
|
|
416
416
|
};
|
|
417
|
-
function
|
|
417
|
+
function Ht(e, t, n = Se, s, r) {
|
|
418
418
|
let o;
|
|
419
|
-
if (t && t[n] && t[n].vnode == e || e[I] !=
|
|
419
|
+
if (t && t[n] && t[n].vnode == e || e[I] != xt)
|
|
420
420
|
return t;
|
|
421
421
|
(e || !t) && (r = r || e.type == "svg", o = e.type != "host" && (e.raw == 1 ? (t && e.clone ? t[Z] : t) != e.type : e.raw == 2 ? !(t instanceof e.type) : t ? t[Z] || t.localName != e.type : !t), o && e.type != null && (e.raw == 1 && e.clone ? (s = !0, t = e.type.cloneNode(!0), t[Z] = e.type) : t = e.raw == 1 ? e.type : e.raw == 2 ? new e.type() : r ? document.createElementNS(
|
|
422
422
|
"http://www.w3.org/2000/svg",
|
|
@@ -425,37 +425,37 @@ function Kt(e, t, n = Se, s, r) {
|
|
|
425
425
|
e.type,
|
|
426
426
|
e.is ? { is: e.is } : void 0
|
|
427
427
|
)));
|
|
428
|
-
const c = t[n] ? t[n] :
|
|
429
|
-
let { fragment:
|
|
430
|
-
const { children: d =
|
|
428
|
+
const c = t[n] ? t[n] : B, { vnode: u = B, cycle: a = 0 } = c;
|
|
429
|
+
let { fragment: i, handlers: f } = c;
|
|
430
|
+
const { children: d = st, props: l = B } = u;
|
|
431
431
|
if (f = o ? {} : f || {}, e.static && !o)
|
|
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, f, r), 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
|
-
|
|
441
|
+
i,
|
|
442
|
+
m,
|
|
443
443
|
n,
|
|
444
444
|
// add support to foreignObject, children will escape from svg
|
|
445
|
-
!
|
|
445
|
+
!a && s,
|
|
446
446
|
r && e.type == "foreignObject" ? !1 : r
|
|
447
447
|
);
|
|
448
448
|
}
|
|
449
|
-
return t[n] = { vnode: e, handlers: f, fragment:
|
|
449
|
+
return t[n] = { vnode: e, handlers: f, fragment: i, cycle: a + 1 }, t;
|
|
450
450
|
}
|
|
451
451
|
function Te(e, t) {
|
|
452
|
-
const n = new
|
|
452
|
+
const n = new ot(""), s = new ot("");
|
|
453
453
|
let r;
|
|
454
454
|
if (e[t ? "prepend" : "append"](n), t) {
|
|
455
455
|
let { lastElementChild: o } = e;
|
|
456
456
|
for (; o; ) {
|
|
457
457
|
const { previousElementSibling: c } = o;
|
|
458
|
-
if (
|
|
458
|
+
if (et(o, !0) && !et(c, !0)) {
|
|
459
459
|
r = o;
|
|
460
460
|
break;
|
|
461
461
|
}
|
|
@@ -469,63 +469,63 @@ function Te(e, t) {
|
|
|
469
469
|
}
|
|
470
470
|
function Pe(e, t, n, s, r, o) {
|
|
471
471
|
e = e == null ? null : re(e) ? e : [e];
|
|
472
|
-
const c = t || Te(n, r), { markStart: u, markEnd:
|
|
472
|
+
const c = t || Te(n, r), { markStart: u, markEnd: a, keyes: i } = c;
|
|
473
473
|
let f;
|
|
474
|
-
const d =
|
|
475
|
-
let
|
|
476
|
-
if (e &&
|
|
477
|
-
if (typeof
|
|
474
|
+
const d = i && /* @__PURE__ */ new Set();
|
|
475
|
+
let l = u;
|
|
476
|
+
if (e && Ut(e, (m) => {
|
|
477
|
+
if (typeof m == "object" && !m[I])
|
|
478
478
|
return;
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
const
|
|
482
|
-
let
|
|
483
|
-
if (
|
|
484
|
-
|
|
479
|
+
const v = m[I] && m.key, p = i && v != null && i.get(v);
|
|
480
|
+
l != a && l === p ? d.delete(l) : l = l == a ? a : l.nextSibling;
|
|
481
|
+
const h = i ? p : l;
|
|
482
|
+
let b = h;
|
|
483
|
+
if (m[I])
|
|
484
|
+
b = Ht(m, h, s, r, o);
|
|
485
485
|
else {
|
|
486
|
-
const
|
|
487
|
-
!(
|
|
486
|
+
const A = m + "";
|
|
487
|
+
!(b instanceof Text) || b instanceof ot ? b = new Text(A) : b.data != A && (b.data = A);
|
|
488
488
|
}
|
|
489
|
-
|
|
490
|
-
}),
|
|
491
|
-
for (;
|
|
492
|
-
const
|
|
493
|
-
|
|
489
|
+
b != l && (i && d.delete(b), !h || i ? (n.insertBefore(b, l), i && l != a && d.add(l)) : h == a ? n.insertBefore(b, a) : (n.replaceChild(b, h), l = b)), v != null && (f = f || /* @__PURE__ */ new Map(), f.set(v, b));
|
|
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 d && d.forEach((
|
|
495
|
+
return d && d.forEach((m) => m.remove()), c.keyes = f, c;
|
|
496
496
|
}
|
|
497
497
|
function Ne(e, t, n, s, r) {
|
|
498
498
|
for (const o in t)
|
|
499
|
-
!(o in n) &&
|
|
499
|
+
!(o in n) && Dt(e, o, t[o], null, r, s);
|
|
500
500
|
for (const o in n)
|
|
501
|
-
|
|
501
|
+
Dt(e, o, t[o], n[o], r, s);
|
|
502
502
|
}
|
|
503
|
-
function
|
|
503
|
+
function Dt(e, t, n, s, r, o) {
|
|
504
504
|
if (t = t == "class" && !r ? "className" : t, n = n ?? null, s = s ?? null, t in e && Ee[t] && (n = e[t]), !(s === n || De[t] || t[0] == "_"))
|
|
505
|
-
if (t[0] == "o" && t[1] == "n" && (
|
|
505
|
+
if (t[0] == "o" && t[1] == "n" && (w(s) || w(n)))
|
|
506
506
|
ke(e, t.slice(2), s, o);
|
|
507
507
|
else if (t == "ref")
|
|
508
|
-
s && (
|
|
508
|
+
s && (w(s) ? s(e) : s.current = e);
|
|
509
509
|
else if (t == "style") {
|
|
510
510
|
const { style: c } = e;
|
|
511
511
|
n = n || "", s = s || "";
|
|
512
|
-
const u = R(n),
|
|
512
|
+
const u = R(n), a = R(s);
|
|
513
513
|
if (u)
|
|
514
|
-
for (const
|
|
515
|
-
if (
|
|
516
|
-
!(
|
|
514
|
+
for (const i in n)
|
|
515
|
+
if (a)
|
|
516
|
+
!(i in s) && St(c, i, null);
|
|
517
517
|
else
|
|
518
518
|
break;
|
|
519
|
-
if (
|
|
520
|
-
for (const
|
|
521
|
-
const f = s[
|
|
522
|
-
u && n[
|
|
519
|
+
if (a)
|
|
520
|
+
for (const i in s) {
|
|
521
|
+
const f = s[i];
|
|
522
|
+
u && n[i] === f || St(c, i, f);
|
|
523
523
|
}
|
|
524
524
|
else
|
|
525
525
|
c.cssText = s;
|
|
526
526
|
} else {
|
|
527
527
|
const c = t[0] == "$" ? t.slice(1) : t;
|
|
528
|
-
c === t && (!r && !ve[t] && t in e ||
|
|
528
|
+
c === t && (!r && !ve[t] && t in e || w(s) || w(n)) ? e[t] = s ?? "" : s == null ? e.removeAttribute(c) : e.setAttribute(
|
|
529
529
|
c,
|
|
530
530
|
R(s) ? JSON.stringify(s) : s
|
|
531
531
|
);
|
|
@@ -541,20 +541,20 @@ function ke(e, t, n, s) {
|
|
|
541
541
|
} else
|
|
542
542
|
s[t] && (e.removeEventListener(t, s), delete s[t]);
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function St(e, t, n) {
|
|
545
545
|
let s = "setProperty";
|
|
546
546
|
n == null && (s = "removeProperty", n = null), ~t.indexOf("-") ? e[s](t, n) : e[t] = n;
|
|
547
547
|
}
|
|
548
|
-
const
|
|
549
|
-
function
|
|
548
|
+
const wt = {};
|
|
549
|
+
function z(e, ...t) {
|
|
550
550
|
const n = (e.raw || e).reduce(
|
|
551
551
|
(s, r, o) => s + r + (t[o] || ""),
|
|
552
552
|
""
|
|
553
553
|
);
|
|
554
|
-
return
|
|
554
|
+
return wt[n] = wt[n] || Oe(n);
|
|
555
555
|
}
|
|
556
556
|
function Oe(e) {
|
|
557
|
-
if (
|
|
557
|
+
if (qt.sheet) {
|
|
558
558
|
const t = new CSSStyleSheet();
|
|
559
559
|
return t.replaceSync(e), t;
|
|
560
560
|
} else {
|
|
@@ -562,10 +562,10 @@ function Oe(e) {
|
|
|
562
562
|
return t.textContent = e, t;
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
const Me =
|
|
566
|
-
const n =
|
|
565
|
+
const Me = zt("host", { style: "display: contents" }), W = M("atomico/context"), Ae = (e, t) => {
|
|
566
|
+
const n = _();
|
|
567
567
|
ge(
|
|
568
|
-
() =>
|
|
568
|
+
() => $t(
|
|
569
569
|
n.current,
|
|
570
570
|
"ConnectContext",
|
|
571
571
|
/**
|
|
@@ -578,7 +578,7 @@ const Me = Ht("host", { style: "display: contents" }), W = A("atomico/context"),
|
|
|
578
578
|
[e]
|
|
579
579
|
);
|
|
580
580
|
}, Fe = (e) => {
|
|
581
|
-
const t =
|
|
581
|
+
const t = C("ConnectContext", {
|
|
582
582
|
bubbles: !0,
|
|
583
583
|
composed: !0
|
|
584
584
|
}), n = () => {
|
|
@@ -589,10 +589,10 @@ const Me = Ht("host", { style: "display: contents" }), W = A("atomico/context"),
|
|
|
589
589
|
o = c;
|
|
590
590
|
}
|
|
591
591
|
}), o;
|
|
592
|
-
}, [s, r] =
|
|
592
|
+
}, [s, r] = rt(
|
|
593
593
|
n
|
|
594
594
|
);
|
|
595
|
-
return
|
|
595
|
+
return $(() => {
|
|
596
596
|
s || (e[W] || (e[W] = customElements.whenDefined(
|
|
597
597
|
new e().localName
|
|
598
598
|
)), e[W].then(
|
|
@@ -600,14 +600,14 @@ const Me = Ht("host", { style: "display: contents" }), W = A("atomico/context"),
|
|
|
600
600
|
));
|
|
601
601
|
}, [e]), s;
|
|
602
602
|
}, Re = (e) => {
|
|
603
|
-
const t = Fe(e), n =
|
|
604
|
-
return
|
|
603
|
+
const t = Fe(e), n = Rt();
|
|
604
|
+
return $(() => {
|
|
605
605
|
if (t)
|
|
606
|
-
return
|
|
606
|
+
return $t(t, "UpdatedValue", n);
|
|
607
607
|
}, [t]), (t || e).value;
|
|
608
608
|
}, Ie = (e) => {
|
|
609
|
-
const t =
|
|
610
|
-
() => (Ae(t,
|
|
609
|
+
const t = j(
|
|
610
|
+
() => (Ae(t, _().current), Me),
|
|
611
611
|
{
|
|
612
612
|
props: {
|
|
613
613
|
value: {
|
|
@@ -619,28 +619,29 @@ const Me = Ht("host", { style: "display: contents" }), W = A("atomico/context"),
|
|
|
619
619
|
}
|
|
620
620
|
);
|
|
621
621
|
return t.value = e, t;
|
|
622
|
-
}, y = (e, t, n) => (t == null ? t = { key: n } : t.key = n,
|
|
623
|
-
function
|
|
624
|
-
|
|
622
|
+
}, y = (e, t, n) => (t == null ? t = { key: n } : t.key = n, zt(e, t)), U = y, Kt = z`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`, Jt = z`.vh{position:absolute;transform:scale(0)}`;
|
|
623
|
+
function it() {
|
|
624
|
+
const e = /* @__PURE__ */ new Date();
|
|
625
|
+
return new E(e.getFullYear(), e.getMonth() + 1, e.getDate());
|
|
625
626
|
}
|
|
626
|
-
function
|
|
627
|
-
const n =
|
|
628
|
-
return n.setUTCDate(n.getUTCDate() - r),
|
|
627
|
+
function at(e, t = 0) {
|
|
628
|
+
const n = S(e), s = n.getUTCDay(), r = (s < t ? 7 : 0) + s - t;
|
|
629
|
+
return n.setUTCDate(n.getUTCDate() - r), E.from(n);
|
|
629
630
|
}
|
|
630
|
-
function
|
|
631
|
-
return
|
|
631
|
+
function Zt(e, t = 0) {
|
|
632
|
+
return at(e, t).add({ days: 6 });
|
|
632
633
|
}
|
|
633
|
-
function
|
|
634
|
-
return
|
|
634
|
+
function Wt(e) {
|
|
635
|
+
return E.from(new Date(Date.UTC(e.year, e.month, 0)));
|
|
635
636
|
}
|
|
636
637
|
function H(e, t, n) {
|
|
637
|
-
return t &&
|
|
638
|
+
return t && E.compare(e, t) < 0 ? t : n && E.compare(e, n) > 0 ? n : e;
|
|
638
639
|
}
|
|
639
640
|
const Ue = { days: 1 };
|
|
640
641
|
function $e(e, t = 0) {
|
|
641
|
-
let n =
|
|
642
|
-
const s = Wt(
|
|
643
|
-
for (;
|
|
642
|
+
let n = at(e.toPlainDate(), t);
|
|
643
|
+
const s = Zt(Wt(e), t), r = [];
|
|
644
|
+
for (; E.compare(n, s) < 0; ) {
|
|
644
645
|
const o = [];
|
|
645
646
|
for (let c = 0; c < 7; c++)
|
|
646
647
|
o.push(n), n = n.add(Ue);
|
|
@@ -648,11 +649,11 @@ function $e(e, t = 0) {
|
|
|
648
649
|
}
|
|
649
650
|
return r;
|
|
650
651
|
}
|
|
651
|
-
function
|
|
652
|
+
function S(e) {
|
|
652
653
|
return new Date(Date.UTC(e.year, e.month - 1, e.day ?? 1));
|
|
653
654
|
}
|
|
654
655
|
const Le = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[0-1])$/, X = (e, t) => e.toString().padStart(t, "0");
|
|
655
|
-
class
|
|
656
|
+
class E {
|
|
656
657
|
constructor(t, n, s) {
|
|
657
658
|
this.year = t, this.month = n, this.day = s;
|
|
658
659
|
}
|
|
@@ -660,13 +661,13 @@ class v {
|
|
|
660
661
|
// i didn't want to get into more complex arithmetic since it get tricky fast
|
|
661
662
|
// this is enough to serve my needs and will still be a drop-in replacement when actual Temporal API lands
|
|
662
663
|
add(t) {
|
|
663
|
-
const n =
|
|
664
|
+
const n = S(this);
|
|
664
665
|
if ("days" in t)
|
|
665
|
-
return n.setUTCDate(this.day + t.days),
|
|
666
|
+
return n.setUTCDate(this.day + t.days), E.from(n);
|
|
666
667
|
let { year: s, month: r } = this;
|
|
667
668
|
"months" in t ? (r = this.month + t.months, n.setUTCMonth(r - 1)) : (s = this.year + t.years, n.setUTCFullYear(s));
|
|
668
|
-
const o =
|
|
669
|
-
return H(
|
|
669
|
+
const o = E.from(S({ year: s, month: r, day: 1 }));
|
|
670
|
+
return H(E.from(n), o, Wt(o));
|
|
670
671
|
}
|
|
671
672
|
toString() {
|
|
672
673
|
return `${X(this.year, 4)}-${X(this.month, 2)}-${X(this.day, 2)}`;
|
|
@@ -675,7 +676,7 @@ class v {
|
|
|
675
676
|
return new K(this.year, this.month);
|
|
676
677
|
}
|
|
677
678
|
equals(t) {
|
|
678
|
-
return
|
|
679
|
+
return E.compare(this, t) === 0;
|
|
679
680
|
}
|
|
680
681
|
static compare(t, n) {
|
|
681
682
|
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;
|
|
@@ -686,13 +687,13 @@ class v {
|
|
|
686
687
|
if (!n)
|
|
687
688
|
throw new TypeError(t);
|
|
688
689
|
const [, s, r, o] = n;
|
|
689
|
-
return new
|
|
690
|
+
return new E(
|
|
690
691
|
parseInt(s, 10),
|
|
691
692
|
parseInt(r, 10),
|
|
692
693
|
parseInt(o, 10)
|
|
693
694
|
);
|
|
694
695
|
}
|
|
695
|
-
return new
|
|
696
|
+
return new E(
|
|
696
697
|
t.getUTCFullYear(),
|
|
697
698
|
t.getUTCMonth() + 1,
|
|
698
699
|
t.getUTCDate()
|
|
@@ -704,14 +705,14 @@ class K {
|
|
|
704
705
|
this.year = t, this.month = n;
|
|
705
706
|
}
|
|
706
707
|
add(t) {
|
|
707
|
-
const n =
|
|
708
|
+
const n = S(this), s = (t.months ?? 0) + (t.years ?? 0) * 12;
|
|
708
709
|
return n.setUTCMonth(n.getUTCMonth() + s), new K(n.getUTCFullYear(), n.getUTCMonth() + 1);
|
|
709
710
|
}
|
|
710
711
|
equals(t) {
|
|
711
712
|
return this.year === t.year && this.month === t.month;
|
|
712
713
|
}
|
|
713
714
|
toPlainDate() {
|
|
714
|
-
return new
|
|
715
|
+
return new E(this.year, this.month, 1);
|
|
715
716
|
}
|
|
716
717
|
}
|
|
717
718
|
function x(e, t) {
|
|
@@ -721,37 +722,37 @@ function x(e, t) {
|
|
|
721
722
|
} catch {
|
|
722
723
|
}
|
|
723
724
|
}
|
|
724
|
-
function
|
|
725
|
-
const [t, n] =
|
|
726
|
-
return [
|
|
725
|
+
function P(e) {
|
|
726
|
+
const [t, n] = ct(e);
|
|
727
|
+
return [T(() => x(E, t), [t]), (o) => n(o?.toString())];
|
|
727
728
|
}
|
|
728
729
|
function _e(e) {
|
|
729
|
-
const [t = "", n] =
|
|
730
|
-
return [
|
|
731
|
-
const [o, c] = t.split("/"), u = x(
|
|
732
|
-
return u &&
|
|
730
|
+
const [t = "", n] = ct(e);
|
|
731
|
+
return [T(() => {
|
|
732
|
+
const [o, c] = t.split("/"), u = x(E, o), a = x(E, c);
|
|
733
|
+
return u && a ? [u, a] : [];
|
|
733
734
|
}, [t]), (o) => n(`${o[0]}/${o[1]}`)];
|
|
734
735
|
}
|
|
735
736
|
function je(e) {
|
|
736
|
-
const [t = "", n] =
|
|
737
|
-
return [
|
|
737
|
+
const [t = "", n] = ct(e);
|
|
738
|
+
return [T(() => {
|
|
738
739
|
const o = [];
|
|
739
740
|
for (const c of t.trim().split(/\s+/)) {
|
|
740
|
-
const u = x(
|
|
741
|
+
const u = x(E, c);
|
|
741
742
|
u && o.push(u);
|
|
742
743
|
}
|
|
743
744
|
return o;
|
|
744
745
|
}, [t]), (o) => n(o.join(" "))];
|
|
745
746
|
}
|
|
746
|
-
function
|
|
747
|
-
return
|
|
747
|
+
function L(e, t) {
|
|
748
|
+
return T(
|
|
748
749
|
() => new Intl.DateTimeFormat(t, { timeZone: "UTC", ...e }),
|
|
749
750
|
[t, e]
|
|
750
751
|
);
|
|
751
752
|
}
|
|
752
|
-
function
|
|
753
|
-
const s =
|
|
754
|
-
return
|
|
753
|
+
function Ct(e, t, n) {
|
|
754
|
+
const s = L(e, n);
|
|
755
|
+
return T(() => {
|
|
755
756
|
const r = [], o = /* @__PURE__ */ new Date();
|
|
756
757
|
for (var c = 0; c < 7; c++) {
|
|
757
758
|
const u = (o.getUTCDay() - t + 7) % 7;
|
|
@@ -760,120 +761,120 @@ function wt(e, t, n) {
|
|
|
760
761
|
return r;
|
|
761
762
|
}, [t, s]);
|
|
762
763
|
}
|
|
763
|
-
const
|
|
764
|
-
function
|
|
764
|
+
const Tt = (e, t, n) => H(e, t, n) === e, Pt = (e) => e.target.matches(":dir(ltr)"), Ye = { month: "long", day: "numeric" }, Be = { month: "long" }, qe = { weekday: "narrow" }, xe = { weekday: "long" }, G = { bubbles: !0 };
|
|
765
|
+
function ze({ props: e, context: t }) {
|
|
765
766
|
const { offset: n } = e, {
|
|
766
767
|
firstDayOfWeek: s,
|
|
767
768
|
isDateDisallowed: r,
|
|
768
769
|
min: o,
|
|
769
770
|
max: c,
|
|
770
771
|
page: u,
|
|
771
|
-
locale:
|
|
772
|
-
focusedDate:
|
|
773
|
-
} = t, f =
|
|
772
|
+
locale: a,
|
|
773
|
+
focusedDate: i
|
|
774
|
+
} = t, f = it(), d = Ct(xe, s, a), l = Ct(qe, s, a), m = L(Ye, a), v = L(Be, a), p = T(
|
|
774
775
|
() => u.start.add({ months: n }),
|
|
775
776
|
[u, n]
|
|
776
|
-
),
|
|
777
|
-
() => $e(
|
|
778
|
-
[
|
|
779
|
-
),
|
|
780
|
-
function
|
|
781
|
-
|
|
777
|
+
), h = T(
|
|
778
|
+
() => $e(p, s),
|
|
779
|
+
[p, s]
|
|
780
|
+
), b = C("focusday", G), A = C("selectday", G), Xt = C("hoverday", G);
|
|
781
|
+
function mt(g) {
|
|
782
|
+
b(H(g, o, c));
|
|
782
783
|
}
|
|
783
|
-
function
|
|
784
|
+
function Gt(g) {
|
|
784
785
|
let D;
|
|
785
786
|
switch (g.key) {
|
|
786
787
|
case "ArrowRight":
|
|
787
|
-
D =
|
|
788
|
+
D = i.add({ days: Pt(g) ? 1 : -1 });
|
|
788
789
|
break;
|
|
789
790
|
case "ArrowLeft":
|
|
790
|
-
D =
|
|
791
|
+
D = i.add({ days: Pt(g) ? -1 : 1 });
|
|
791
792
|
break;
|
|
792
793
|
case "ArrowDown":
|
|
793
|
-
D =
|
|
794
|
+
D = i.add({ days: 7 });
|
|
794
795
|
break;
|
|
795
796
|
case "ArrowUp":
|
|
796
|
-
D =
|
|
797
|
+
D = i.add({ days: -7 });
|
|
797
798
|
break;
|
|
798
799
|
case "PageUp":
|
|
799
|
-
D =
|
|
800
|
+
D = i.add(g.shiftKey ? { years: -1 } : { months: -1 });
|
|
800
801
|
break;
|
|
801
802
|
case "PageDown":
|
|
802
|
-
D =
|
|
803
|
+
D = i.add(g.shiftKey ? { years: 1 } : { months: 1 });
|
|
803
804
|
break;
|
|
804
805
|
case "Home":
|
|
805
|
-
D =
|
|
806
|
+
D = at(i, s);
|
|
806
807
|
break;
|
|
807
808
|
case "End":
|
|
808
|
-
D =
|
|
809
|
+
D = Zt(i, s);
|
|
809
810
|
break;
|
|
810
811
|
default:
|
|
811
812
|
return;
|
|
812
813
|
}
|
|
813
|
-
|
|
814
|
+
mt(D), g.preventDefault();
|
|
814
815
|
}
|
|
815
|
-
function
|
|
816
|
-
const D =
|
|
816
|
+
function Qt(g) {
|
|
817
|
+
const D = p.equals(g);
|
|
817
818
|
if (!t.showOutsideDays && !D)
|
|
818
819
|
return;
|
|
819
|
-
const
|
|
820
|
-
let
|
|
820
|
+
const Vt = g.equals(i), yt = g.equals(f), pt = S(g), Y = r?.(pt), bt = !Tt(g, o, c);
|
|
821
|
+
let gt = "", N;
|
|
821
822
|
if (t.type === "range") {
|
|
822
|
-
const [F, J] = t.value,
|
|
823
|
-
|
|
823
|
+
const [F, J] = t.value, Et = F?.equals(g), vt = J?.equals(g);
|
|
824
|
+
N = F && J && Tt(g, F, J), gt = `${Et ? "range-start" : ""} ${vt ? "range-end" : ""} ${N && !Et && !vt ? "range-inner" : ""}`;
|
|
824
825
|
} else
|
|
825
|
-
t.type === "multi" ?
|
|
826
|
+
t.type === "multi" ? N = t.value.some((F) => F.equals(g)) : N = t.value?.equals(g);
|
|
826
827
|
return {
|
|
827
828
|
part: `${`button day ${// we don't want outside days to ever be shown as selected
|
|
828
|
-
D ?
|
|
829
|
-
tabindex: D &&
|
|
830
|
-
disabled:
|
|
831
|
-
"aria-disabled":
|
|
832
|
-
"aria-pressed": D &&
|
|
833
|
-
"aria-current":
|
|
834
|
-
"aria-label":
|
|
835
|
-
onkeydown:
|
|
829
|
+
D ? N ? "selected" : "" : "outside"} ${Y ? "disallowed" : ""} ${yt ? "today" : ""}`} ${gt}`,
|
|
830
|
+
tabindex: D && Vt ? 0 : -1,
|
|
831
|
+
disabled: bt,
|
|
832
|
+
"aria-disabled": Y ? "true" : void 0,
|
|
833
|
+
"aria-pressed": D && N,
|
|
834
|
+
"aria-current": yt ? "date" : void 0,
|
|
835
|
+
"aria-label": m.format(pt),
|
|
836
|
+
onkeydown: Gt,
|
|
836
837
|
onclick() {
|
|
837
|
-
|
|
838
|
+
Y || A(g), mt(g);
|
|
838
839
|
},
|
|
839
840
|
onmouseover() {
|
|
840
|
-
!
|
|
841
|
+
!Y && !bt && Xt(g);
|
|
841
842
|
}
|
|
842
843
|
};
|
|
843
844
|
}
|
|
844
845
|
return {
|
|
845
|
-
weeks:
|
|
846
|
-
yearMonth:
|
|
846
|
+
weeks: h,
|
|
847
|
+
yearMonth: p,
|
|
847
848
|
daysLong: d,
|
|
848
|
-
daysShort:
|
|
849
|
-
formatter:
|
|
850
|
-
getDayProps:
|
|
849
|
+
daysShort: l,
|
|
850
|
+
formatter: v,
|
|
851
|
+
getDayProps: Qt
|
|
851
852
|
};
|
|
852
853
|
}
|
|
853
|
-
const Q =
|
|
854
|
+
const Q = it(), lt = Ie({
|
|
854
855
|
type: "date",
|
|
855
856
|
firstDayOfWeek: 1,
|
|
856
857
|
isDateDisallowed: () => !1,
|
|
857
858
|
focusedDate: Q,
|
|
858
859
|
page: { start: Q.toPlainYearMonth(), end: Q.toPlainYearMonth() }
|
|
859
860
|
});
|
|
860
|
-
customElements.define("calendar-month-ctx",
|
|
861
|
-
const He =
|
|
861
|
+
customElements.define("calendar-month-ctx", lt);
|
|
862
|
+
const He = j(
|
|
862
863
|
(e) => {
|
|
863
|
-
const t = Re(
|
|
864
|
+
const t = Re(lt), n = se(), s = ze({ props: e, context: t });
|
|
864
865
|
function r() {
|
|
865
866
|
n.current.querySelector("button[tabindex='0']")?.focus();
|
|
866
867
|
}
|
|
867
868
|
return /* @__PURE__ */ U("host", { shadowDom: !0, focus: r, children: [
|
|
868
|
-
/* @__PURE__ */ y("div", { id: "h", part: "heading", children: s.formatter.format(
|
|
869
|
+
/* @__PURE__ */ y("div", { id: "h", part: "heading", children: s.formatter.format(S(s.yearMonth)) }),
|
|
869
870
|
/* @__PURE__ */ U("table", { ref: n, "aria-labelledby": "h", part: "table", children: [
|
|
870
871
|
/* @__PURE__ */ y("thead", { children: /* @__PURE__ */ y("tr", { part: "tr head", children: s.daysLong.map((o, c) => /* @__PURE__ */ U("th", { part: "th", scope: "col", children: [
|
|
871
872
|
/* @__PURE__ */ y("span", { class: "vh", children: o }),
|
|
872
873
|
/* @__PURE__ */ y("span", { "aria-hidden": "true", children: s.daysShort[c] })
|
|
873
874
|
] })) }) }),
|
|
874
|
-
/* @__PURE__ */ y("tbody", { children: s.weeks.map((o, c) => /* @__PURE__ */ y("tr", { part: "tr week", children: o.map((u,
|
|
875
|
-
const
|
|
876
|
-
return /* @__PURE__ */ y("td", { part: "td", children:
|
|
875
|
+
/* @__PURE__ */ y("tbody", { children: s.weeks.map((o, c) => /* @__PURE__ */ y("tr", { part: "tr week", children: o.map((u, a) => {
|
|
876
|
+
const i = s.getDayProps(u);
|
|
877
|
+
return /* @__PURE__ */ y("td", { part: "td", children: i && /* @__PURE__ */ y("button", { ...i, children: u.day }) }, a);
|
|
877
878
|
}) }, c)) })
|
|
878
879
|
] })
|
|
879
880
|
] });
|
|
@@ -886,14 +887,14 @@ const He = _(
|
|
|
886
887
|
}
|
|
887
888
|
},
|
|
888
889
|
styles: [
|
|
890
|
+
Kt,
|
|
889
891
|
Jt,
|
|
890
|
-
|
|
891
|
-
B`: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,[aria-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}`
|
|
892
|
+
z`: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,[aria-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}`
|
|
892
893
|
]
|
|
893
894
|
}
|
|
894
895
|
);
|
|
895
896
|
customElements.define("calendar-month", He);
|
|
896
|
-
function
|
|
897
|
+
function Nt(e) {
|
|
897
898
|
return /* @__PURE__ */ y(
|
|
898
899
|
"button",
|
|
899
900
|
{
|
|
@@ -904,17 +905,17 @@ function Pt(e) {
|
|
|
904
905
|
}
|
|
905
906
|
);
|
|
906
907
|
}
|
|
907
|
-
function
|
|
908
|
-
const t =
|
|
908
|
+
function ut(e) {
|
|
909
|
+
const t = S(e.page.start), n = S(e.page.end);
|
|
909
910
|
return /* @__PURE__ */ U("div", { role: "group", "aria-labelledby": "h", part: "container", children: [
|
|
910
911
|
/* @__PURE__ */ y("div", { id: "h", class: "vh", "aria-live": "polite", "aria-atomic": "true", children: e.formatVerbose.formatRange(t, n) }),
|
|
911
912
|
/* @__PURE__ */ U("div", { part: "header", children: [
|
|
912
|
-
/* @__PURE__ */ y(
|
|
913
|
+
/* @__PURE__ */ y(Nt, { name: "previous", onclick: e.previous, children: "Previous" }),
|
|
913
914
|
/* @__PURE__ */ y("slot", { part: "heading", name: "heading", children: /* @__PURE__ */ y("div", { "aria-hidden": "true", children: e.format.formatRange(t, n) }) }),
|
|
914
|
-
/* @__PURE__ */ y(
|
|
915
|
+
/* @__PURE__ */ y(Nt, { name: "next", onclick: e.next, children: "Next" })
|
|
915
916
|
] }),
|
|
916
917
|
/* @__PURE__ */ y(
|
|
917
|
-
|
|
918
|
+
lt,
|
|
918
919
|
{
|
|
919
920
|
value: e,
|
|
920
921
|
onselectday: e.onSelect,
|
|
@@ -925,7 +926,7 @@ function lt(e) {
|
|
|
925
926
|
)
|
|
926
927
|
] });
|
|
927
928
|
}
|
|
928
|
-
const
|
|
929
|
+
const ft = {
|
|
929
930
|
value: {
|
|
930
931
|
type: String,
|
|
931
932
|
value: ""
|
|
@@ -968,12 +969,12 @@ const ut = {
|
|
|
968
969
|
type: String,
|
|
969
970
|
value: () => "months"
|
|
970
971
|
}
|
|
971
|
-
},
|
|
972
|
+
}, dt = [
|
|
973
|
+
Kt,
|
|
972
974
|
Jt,
|
|
973
|
-
|
|
974
|
-
B`: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}`
|
|
975
|
+
z`: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}`
|
|
975
976
|
], Ke = { year: "numeric" }, Je = { year: "numeric", month: "long" };
|
|
976
|
-
function
|
|
977
|
+
function V(e, t) {
|
|
977
978
|
return (t.year - e.year) * 12 + t.month - e.month;
|
|
978
979
|
}
|
|
979
980
|
const kt = (e, t) => (e = t === 12 ? new K(e.year, 1) : e, {
|
|
@@ -988,76 +989,72 @@ function Ze({
|
|
|
988
989
|
min: r,
|
|
989
990
|
goto: o
|
|
990
991
|
}) {
|
|
991
|
-
const c =
|
|
992
|
+
const c = e === "single" ? 1 : n, [u, a] = rt(
|
|
992
993
|
() => kt(t.toPlainYearMonth(), n)
|
|
993
|
-
), a = (
|
|
994
|
-
const
|
|
995
|
-
return
|
|
996
|
-
};
|
|
997
|
-
z(() => {
|
|
998
|
-
let i = u.start;
|
|
999
|
-
if (c.current && e === "single")
|
|
1000
|
-
i = t.toPlainYearMonth();
|
|
1001
|
-
else if (!a(t)) {
|
|
1002
|
-
const h = Nt(i, t.toPlainYearMonth()), E = Math.floor(h / n);
|
|
1003
|
-
i = i.add({ months: E * n });
|
|
1004
|
-
}
|
|
1005
|
-
c.current = !1, l(kt(i, n));
|
|
1006
|
-
}, [u.start, t, n, e]);
|
|
1007
|
-
const f = e === "single" ? 1 : n, d = (i) => () => {
|
|
1008
|
-
c.current = !0, o(t.add({ months: i }));
|
|
994
|
+
), i = (d) => a(kt(u.start.add({ months: d }), n)), f = (d) => {
|
|
995
|
+
const l = V(u.start, d.toPlainYearMonth());
|
|
996
|
+
return l >= 0 && l < n;
|
|
1009
997
|
};
|
|
1010
|
-
return {
|
|
998
|
+
return $(() => {
|
|
999
|
+
if (f(t))
|
|
1000
|
+
return;
|
|
1001
|
+
const d = V(t.toPlainYearMonth(), u.start);
|
|
1002
|
+
o(t.add({ months: d }));
|
|
1003
|
+
}, [u.start]), $(() => {
|
|
1004
|
+
if (f(t))
|
|
1005
|
+
return;
|
|
1006
|
+
const d = V(u.start, t.toPlainYearMonth());
|
|
1007
|
+
i(d === -1 ? -c : d === n ? c : Math.floor(d / n) * n);
|
|
1008
|
+
}, [t, c, n]), {
|
|
1011
1009
|
page: u,
|
|
1012
|
-
previous: r
|
|
1013
|
-
next: s
|
|
1010
|
+
previous: !r || !f(r) ? () => i(-c) : void 0,
|
|
1011
|
+
next: !s || !f(s) ? () => i(c) : void 0
|
|
1014
1012
|
};
|
|
1015
1013
|
}
|
|
1016
|
-
function
|
|
1014
|
+
function ht({
|
|
1017
1015
|
months: e,
|
|
1018
1016
|
pageBy: t,
|
|
1019
1017
|
locale: n,
|
|
1020
1018
|
focusedDate: s,
|
|
1021
1019
|
setFocusedDate: r
|
|
1022
1020
|
}) {
|
|
1023
|
-
const [o] =
|
|
1024
|
-
() => H(s ??
|
|
1021
|
+
const [o] = P("min"), [c] = P("max"), u = C("focusday"), a = C("change"), i = T(
|
|
1022
|
+
() => H(s ?? it(), o, c),
|
|
1025
1023
|
[s, o, c]
|
|
1026
1024
|
);
|
|
1027
|
-
function f(
|
|
1028
|
-
r(
|
|
1025
|
+
function f(h) {
|
|
1026
|
+
r(h), u(S(h));
|
|
1029
1027
|
}
|
|
1030
|
-
const { next: d, previous:
|
|
1028
|
+
const { next: d, previous: l, page: m } = Ze({
|
|
1031
1029
|
pageBy: t,
|
|
1032
|
-
focusedDate:
|
|
1030
|
+
focusedDate: i,
|
|
1033
1031
|
months: e,
|
|
1034
1032
|
min: o,
|
|
1035
1033
|
max: c,
|
|
1036
1034
|
goto: f
|
|
1037
|
-
}),
|
|
1038
|
-
function
|
|
1039
|
-
|
|
1035
|
+
}), v = _();
|
|
1036
|
+
function p() {
|
|
1037
|
+
v.current.querySelectorAll("calendar-month").forEach((h) => h.focus());
|
|
1040
1038
|
}
|
|
1041
|
-
const m = $(Ke, n), p = $(Je, n);
|
|
1042
1039
|
return {
|
|
1043
|
-
format:
|
|
1044
|
-
formatVerbose:
|
|
1045
|
-
page:
|
|
1046
|
-
focusedDate:
|
|
1047
|
-
dispatch:
|
|
1048
|
-
onFocus(
|
|
1049
|
-
|
|
1040
|
+
format: L(Ke, n),
|
|
1041
|
+
formatVerbose: L(Je, n),
|
|
1042
|
+
page: m,
|
|
1043
|
+
focusedDate: i,
|
|
1044
|
+
dispatch: a,
|
|
1045
|
+
onFocus(h) {
|
|
1046
|
+
h.stopPropagation(), f(h.detail), setTimeout(p);
|
|
1050
1047
|
},
|
|
1051
1048
|
min: o,
|
|
1052
1049
|
max: c,
|
|
1053
1050
|
next: d,
|
|
1054
|
-
previous:
|
|
1055
|
-
focus:
|
|
1051
|
+
previous: l,
|
|
1052
|
+
focus: p
|
|
1056
1053
|
};
|
|
1057
1054
|
}
|
|
1058
|
-
const We =
|
|
1055
|
+
const We = j(
|
|
1059
1056
|
(e) => {
|
|
1060
|
-
const [t, n] =
|
|
1057
|
+
const [t, n] = P("value"), [s = t, r] = P("focusedDate"), o = ht({
|
|
1061
1058
|
...e,
|
|
1062
1059
|
focusedDate: s,
|
|
1063
1060
|
setFocusedDate: r
|
|
@@ -1066,7 +1063,7 @@ const We = _(
|
|
|
1066
1063
|
n(u.detail), o.dispatch();
|
|
1067
1064
|
}
|
|
1068
1065
|
return /* @__PURE__ */ y("host", { shadowDom: !0, focus: o.focus, children: /* @__PURE__ */ y(
|
|
1069
|
-
|
|
1066
|
+
ut,
|
|
1070
1067
|
{
|
|
1071
1068
|
...e,
|
|
1072
1069
|
...o,
|
|
@@ -1076,68 +1073,68 @@ const We = _(
|
|
|
1076
1073
|
}
|
|
1077
1074
|
) });
|
|
1078
1075
|
},
|
|
1079
|
-
{ props:
|
|
1076
|
+
{ props: ft, styles: dt }
|
|
1080
1077
|
);
|
|
1081
1078
|
customElements.define("calendar-date", We);
|
|
1082
|
-
const Ot = (e, t) =>
|
|
1079
|
+
const Ot = (e, t) => E.compare(e, t) < 0 ? [e, t] : [t, e], Xe = j(
|
|
1083
1080
|
(e) => {
|
|
1084
|
-
const [t, n] = _e("value"), [s = t[0], r] =
|
|
1081
|
+
const [t, n] = _e("value"), [s = t[0], r] = P("focusedDate"), o = ht({
|
|
1085
1082
|
...e,
|
|
1086
1083
|
focusedDate: s,
|
|
1087
1084
|
setFocusedDate: r
|
|
1088
|
-
}), c =
|
|
1085
|
+
}), c = C("rangestart"), u = C("rangeend"), [a, i] = P(
|
|
1089
1086
|
"tentative"
|
|
1090
|
-
), [f, d] =
|
|
1091
|
-
|
|
1092
|
-
function
|
|
1093
|
-
o.onFocus(
|
|
1087
|
+
), [f, d] = rt();
|
|
1088
|
+
$(() => d(void 0), [a]);
|
|
1089
|
+
function l(h) {
|
|
1090
|
+
o.onFocus(h), m(h);
|
|
1094
1091
|
}
|
|
1095
|
-
function h
|
|
1096
|
-
|
|
1092
|
+
function m(h) {
|
|
1093
|
+
h.stopPropagation(), a && d(h.detail);
|
|
1097
1094
|
}
|
|
1098
|
-
function
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1095
|
+
function v(h) {
|
|
1096
|
+
const b = h.detail;
|
|
1097
|
+
h.stopPropagation(), a ? (n(Ot(a, b)), i(void 0), u(S(b)), o.dispatch()) : (i(b), c(S(b)));
|
|
1101
1098
|
}
|
|
1102
|
-
const
|
|
1099
|
+
const p = a ? Ot(a, f ?? a) : t;
|
|
1103
1100
|
return /* @__PURE__ */ y("host", { shadowDom: !0, focus: o.focus, children: /* @__PURE__ */ y(
|
|
1104
|
-
|
|
1101
|
+
ut,
|
|
1105
1102
|
{
|
|
1106
1103
|
...e,
|
|
1107
1104
|
...o,
|
|
1108
1105
|
type: "range",
|
|
1109
|
-
value:
|
|
1110
|
-
onFocus:
|
|
1111
|
-
onHover:
|
|
1112
|
-
onSelect:
|
|
1106
|
+
value: p,
|
|
1107
|
+
onFocus: l,
|
|
1108
|
+
onHover: m,
|
|
1109
|
+
onSelect: v
|
|
1113
1110
|
}
|
|
1114
1111
|
) });
|
|
1115
1112
|
},
|
|
1116
1113
|
{
|
|
1117
1114
|
props: {
|
|
1118
|
-
...
|
|
1115
|
+
...ft,
|
|
1119
1116
|
tentative: {
|
|
1120
1117
|
type: String,
|
|
1121
1118
|
value: ""
|
|
1122
1119
|
}
|
|
1123
1120
|
},
|
|
1124
|
-
styles:
|
|
1121
|
+
styles: dt
|
|
1125
1122
|
}
|
|
1126
1123
|
);
|
|
1127
1124
|
customElements.define("calendar-range", Xe);
|
|
1128
|
-
const Ge =
|
|
1125
|
+
const Ge = j(
|
|
1129
1126
|
(e) => {
|
|
1130
|
-
const [t, n] = je("value"), [s = t[0], r] =
|
|
1127
|
+
const [t, n] = je("value"), [s = t[0], r] = P("focusedDate"), o = ht({
|
|
1131
1128
|
...e,
|
|
1132
1129
|
focusedDate: s,
|
|
1133
1130
|
setFocusedDate: r
|
|
1134
1131
|
});
|
|
1135
1132
|
function c(u) {
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1133
|
+
const a = [...t], i = t.findIndex((f) => f.equals(u.detail));
|
|
1134
|
+
i < 0 ? a.push(u.detail) : a.splice(i, 1), n(a), o.dispatch();
|
|
1138
1135
|
}
|
|
1139
1136
|
return /* @__PURE__ */ y("host", { shadowDom: !0, focus: o.focus, children: /* @__PURE__ */ y(
|
|
1140
|
-
|
|
1137
|
+
ut,
|
|
1141
1138
|
{
|
|
1142
1139
|
...e,
|
|
1143
1140
|
...o,
|
|
@@ -1147,7 +1144,7 @@ const Ge = _(
|
|
|
1147
1144
|
}
|
|
1148
1145
|
) });
|
|
1149
1146
|
},
|
|
1150
|
-
{ props:
|
|
1147
|
+
{ props: ft, styles: dt }
|
|
1151
1148
|
);
|
|
1152
1149
|
customElements.define("calendar-multi", Ge);
|
|
1153
1150
|
export {
|