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