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