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