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