cally 0.5.2 → 0.5.3

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.
Files changed (2) hide show
  1. package/dist/cally.js +137 -136
  2. package/package.json +1 -1
package/dist/cally.js CHANGED
@@ -29,13 +29,13 @@ class te {
29
29
  return this.#e.add(t), () => this.#e.delete(t);
30
30
  }
31
31
  }
32
- const Ct = (e) => new te(e), Q = Symbol.for("atomico.hooks");
32
+ const Pt = (e) => new te(e), Q = Symbol.for("atomico.hooks");
33
33
  globalThis[Q] = globalThis[Q] || {};
34
34
  let N = globalThis[Q];
35
- const ee = Symbol.for("Atomico.suspense"), Pt = Symbol.for("Atomico.effect"), ne = Symbol.for("Atomico.layoutEffect"), Nt = Symbol.for("Atomico.insertionEffect"), k = (e, t, n) => {
35
+ const ee = Symbol.for("Atomico.suspense"), Nt = Symbol.for("Atomico.effect"), ne = Symbol.for("Atomico.layoutEffect"), kt = Symbol.for("Atomico.insertionEffect"), k = (e, t, n) => {
36
36
  const { i: s, hooks: o } = N.c, r = o[s] = o[s] || {};
37
37
  return r.value = e(r.value), r.effect = t, r.tag = n, N.c.i++, o[s].value;
38
- }, se = (e) => k((t = Ct(e)) => t), $ = () => k((e = Ct(N.c.host)) => e), kt = () => N.c.update, oe = (e, t, n = 0) => {
38
+ }, se = (e) => k((t = Pt(e)) => t), U = () => k((e = Pt(N.c.host)) => e), Ot = () => N.c.update, oe = (e, t, n = 0) => {
39
39
  let s = {}, o = !1;
40
40
  const r = () => o, c = (i, u) => {
41
41
  for (const d in s) {
@@ -56,11 +56,11 @@ const ee = Symbol.for("Atomico.suspense"), Pt = Symbol.for("Atomico.effect"), ne
56
56
  N.c = null;
57
57
  }
58
58
  return u;
59
- }, cleanEffects: (i) => (c(Nt, i), () => (c(ne, i), () => {
60
- c(Pt, i);
59
+ }, cleanEffects: (i) => (c(kt, i), () => (c(ne, i), () => {
60
+ c(Nt, i);
61
61
  })), isSuspense: r };
62
62
  }, O = Symbol.for;
63
- function Ot(e, t) {
63
+ function At(e, t) {
64
64
  const n = e.length;
65
65
  if (n !== t.length)
66
66
  return !1;
@@ -72,7 +72,7 @@ function Ot(e, t) {
72
72
  return !0;
73
73
  }
74
74
  const T = (e) => typeof e == "function", R = (e) => typeof e == "object", { isArray: re } = Array, V = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
75
- function At(e, t) {
75
+ function Rt(e, t) {
76
76
  let n;
77
77
  const s = (o) => {
78
78
  let { length: r } = o;
@@ -90,8 +90,8 @@ function At(e, t) {
90
90
  };
91
91
  s(e), n != null && t(n);
92
92
  }
93
- const Rt = (e, t, n) => (e.addEventListener(t, n), () => e.removeEventListener(t, n));
94
- class Mt {
93
+ const Mt = (e, t, n) => (e.addEventListener(t, n), () => e.removeEventListener(t, n));
94
+ class Ft {
95
95
  /**
96
96
  *
97
97
  * @param {HTMLElement} target
@@ -102,11 +102,11 @@ class Mt {
102
102
  this.message = n, this.target = t, this.value = s;
103
103
  }
104
104
  }
105
- class Ft extends Mt {
105
+ class It extends Ft {
106
106
  }
107
- class ce extends Mt {
107
+ class ce extends Ft {
108
108
  }
109
- const _ = "Custom", ie = null, ae = { true: 1, "": 1, 1: 1 };
109
+ const j = "Custom", ie = null, ae = { true: 1, "": 1, 1: 1 };
110
110
  function le(e, t, n, s, o) {
111
111
  const {
112
112
  type: r,
@@ -114,7 +114,7 @@ function le(e, t, n, s, o) {
114
114
  event: f,
115
115
  value: a,
116
116
  attr: i = ue(t)
117
- } = n?.name != _ && R(n) && n != ie ? n : { type: n }, u = r?.name === _ && r.map, d = a != null ? r == Function || !T(a) ? () => a : a : null;
117
+ } = n?.name != j && R(n) && n != ie ? n : { type: n }, u = r?.name === j && r.map, d = a != null ? r == Function || !T(a) ? () => a : a : null;
118
118
  Object.defineProperty(e, t, {
119
119
  configurable: !0,
120
120
  /**
@@ -129,12 +129,12 @@ function le(e, t, n, s, o) {
129
129
  l
130
130
  );
131
131
  if (p && y != null)
132
- throw new Ft(
132
+ throw new It(
133
133
  this,
134
134
  `The value defined for prop '${t}' must be of type '${r.name}'`,
135
135
  y
136
136
  );
137
- m != y && (this._props[t] = y ?? void 0, this.update(), f && It(this, f), this.updated.then(() => {
137
+ m != y && (this._props[t] = y ?? void 0, this.update(), f && $t(this, f), this.updated.then(() => {
138
138
  c && (this._ignoreAttr = i, fe(this, r, i, this[t]), this._ignoreAttr = null);
139
139
  }));
140
140
  },
@@ -146,10 +146,10 @@ function le(e, t, n, s, o) {
146
146
  }
147
147
  }), d && (o[t] = d()), s[i] = { prop: t, type: r };
148
148
  }
149
- const It = (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 $t = (e, { type: t, base: n = CustomEvent, ...s }) => e.dispatchEvent(new n(t, s)), ue = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), fe = (e, t, n, s) => s == null || t == Boolean && !s ? e.removeAttribute(n) : e.setAttribute(
150
150
  n,
151
- t?.name === _ && 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 == _ ? t : (
151
+ t?.name === j && 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 == j ? t : (
153
153
  // TODO: If when defining reflect the prop can also be of type string?
154
154
  new e(t)
155
155
  ), he = ({ map: e }, t) => {
@@ -172,7 +172,7 @@ let ye = 0;
172
172
  const pe = (e) => {
173
173
  const t = (e?.dataset || {})?.hydrate || "";
174
174
  return t || "c" + ye++;
175
- }, j = (e, t = HTMLElement) => {
175
+ }, Y = (e, t = HTMLElement) => {
176
176
  const n = {}, s = {}, o = "prototype" in t && t.prototype instanceof Element, r = o ? t : "base" in t ? t.base : HTMLElement, { props: c, styles: f } = o ? e : t;
177
177
  class a extends r {
178
178
  constructor() {
@@ -269,7 +269,7 @@ function be(e) {
269
269
  const { styles: t } = e.constructor, { shadowRoot: n } = e;
270
270
  if (n && t.length) {
271
271
  const s = [];
272
- At(t, (o) => {
272
+ Rt(t, (o) => {
273
273
  o && (o instanceof Element ? n.appendChild(o.cloneNode(!0)) : s.push(o));
274
274
  }), s.length && (n.adoptedStyleSheets = s);
275
275
  }
@@ -280,15 +280,15 @@ const Ut = (e) => (t, n) => {
280
280
  * Clean the effect hook
281
281
  * @type {import("internal/hooks.js").CollectorEffect}
282
282
  */
283
- ([s, o] = []) => ((o || !o) && (o && Ot(o, n) ? s = s || !0 : (T(s) && s(), s = null)), [s, n]),
283
+ ([s, o] = []) => ((o || !o) && (o && At(o, n) ? s = s || !0 : (T(s) && s(), s = null)), [s, n]),
284
284
  /**
285
285
  * @returns {any}
286
286
  */
287
287
  ([s, o], r) => r ? (T(s) && s(), []) : [s || t(), o],
288
288
  e
289
289
  );
290
- }, ot = Ut(Pt), ge = Ut(Nt);
291
- class $t extends Array {
290
+ }, ot = Ut(Nt), ge = Ut(kt);
291
+ class Lt extends Array {
292
292
  /**
293
293
  *
294
294
  * @param {any} initialState
@@ -319,31 +319,31 @@ class $t extends Array {
319
319
  // }
320
320
  }
321
321
  const rt = (e) => {
322
- const t = kt();
322
+ const t = Ot();
323
323
  return k(
324
- (n = new $t(e, (s, o, r) => {
324
+ (n = new Lt(e, (s, o, r) => {
325
325
  s = T(s) ? s(o[0]) : s, s !== o[0] && (o[0] = s, r || t());
326
326
  })) => n
327
327
  );
328
328
  }, P = (e, t) => {
329
- const [n] = k(([s, o, r = 0] = []) => ((!o || o && !Ot(o, t)) && (s = e()), [s, t, r]));
329
+ const [n] = k(([s, o, r = 0] = []) => ((!o || o && !At(o, t)) && (s = e()), [s, t, r]));
330
330
  return n;
331
- }, Lt = (e) => {
332
- const { current: t } = $();
331
+ }, _t = (e) => {
332
+ const { current: t } = U();
333
333
  if (!(e in t))
334
- throw new Ft(
334
+ throw new It(
335
335
  t,
336
336
  `For useProp("${e}"), the prop does not exist on the host.`,
337
337
  e
338
338
  );
339
339
  return k(
340
- (n = new $t(t[e], (s, o) => {
340
+ (n = new Lt(t[e], (s, o) => {
341
341
  s = T(s) ? s(t[e]) : s, t[e] = s;
342
342
  })) => (n[0] = t[e], n)
343
343
  );
344
344
  }, C = (e, t = {}) => {
345
- const n = $();
346
- return n[e] || (n[e] = (s = t.detail) => It(n.current, {
345
+ const n = U();
346
+ return n[e] || (n[e] = (s = t.detail) => $t(n.current, {
347
347
  type: e,
348
348
  ...t,
349
349
  detail: s
@@ -352,7 +352,7 @@ const rt = (e) => {
352
352
  globalThis[tt] = globalThis[tt] || {
353
353
  sheet: !!document.adoptedStyleSheets
354
354
  };
355
- const _t = globalThis[tt], Ee = {
355
+ const jt = globalThis[tt], Ee = {
356
356
  checked: 1,
357
357
  value: 1,
358
358
  selected: 1
@@ -372,16 +372,16 @@ const _t = globalThis[tt], Ee = {
372
372
  cloneNode: 1,
373
373
  children: 1,
374
374
  key: 1
375
- }, L = {}, et = [];
375
+ }, _ = {}, et = [];
376
376
  class nt extends Text {
377
377
  }
378
- const we = O("atomico/id"), M = O("atomico/type"), J = O("atomico/ref"), jt = O("atomico/vnode"), ve = () => {
378
+ const we = O("atomico/id"), M = O("atomico/type"), J = O("atomico/ref"), Yt = O("atomico/vnode"), ve = () => {
379
379
  };
380
380
  function Te(e, t, n) {
381
- return xt(this, e, t, n);
381
+ return Bt(this, e, t, n);
382
382
  }
383
- const Yt = (e, t, ...n) => {
384
- const s = t || L;
383
+ const xt = (e, t, ...n) => {
384
+ const s = t || _;
385
385
  let { children: o } = s;
386
386
  if (o = o ?? (n.length ? n : et), e === ve)
387
387
  return o;
@@ -393,9 +393,9 @@ const Yt = (e, t, ...n) => {
393
393
  return e(
394
394
  o != et ? { children: o, ...s } : s
395
395
  );
396
- const c = _t.render || Te;
396
+ const c = jt.render || Te;
397
397
  return {
398
- [M]: jt,
398
+ [M]: Yt,
399
399
  type: e,
400
400
  props: s,
401
401
  children: o,
@@ -414,9 +414,9 @@ const Yt = (e, t, ...n) => {
414
414
  render: c
415
415
  };
416
416
  };
417
- function xt(e, t, n = we, s, o) {
417
+ function Bt(e, t, n = we, s, o) {
418
418
  let r;
419
- if (t && t[n] && t[n].vnode == e || e[M] != jt)
419
+ if (t && t[n] && t[n].vnode == e || e[M] != Yt)
420
420
  return t;
421
421
  (e || !t) && (o = o || e.type == "svg", r = e.type != "host" && (e.raw == 1 ? (t && e.clone ? t[J] : t) != e.type : e.raw == 2 ? !(t instanceof e.type) : t ? t[J] || t.localName != e.type : !t), r && e.type != null && (e.raw == 1 && e.clone ? (s = !0, t = e.type.cloneNode(!0), t[J] = e.type) : t = e.raw == 1 ? e.type : e.raw == 2 ? new e.type() : o ? document.createElementNS(
422
422
  "http://www.w3.org/2000/svg",
@@ -425,9 +425,9 @@ function xt(e, t, n = we, s, o) {
425
425
  e.type,
426
426
  e.is ? { is: e.is } : void 0
427
427
  )));
428
- const c = t[n] ? t[n] : L, { vnode: f = L, cycle: a = 0 } = c;
428
+ const c = t[n] ? t[n] : _, { vnode: f = _, cycle: a = 0 } = c;
429
429
  let { fragment: i, handlers: u } = c;
430
- const { children: d = et, props: l = L } = f;
430
+ const { children: d = et, props: l = _ } = f;
431
431
  if (u = r ? {} : u || {}, e.static && !r)
432
432
  return t;
433
433
  if (e.shadow && !t.shadowRoot && // @ts-ignore
@@ -473,7 +473,7 @@ function Pe(e, t, n, s, o, r) {
473
473
  let u;
474
474
  const d = i && /* @__PURE__ */ new Set();
475
475
  let l = f;
476
- if (e && At(e, (m) => {
476
+ if (e && Rt(e, (m) => {
477
477
  if (typeof m == "object" && !m[M])
478
478
  return;
479
479
  const p = m[M] && m.key, y = i && p != null && i.get(p);
@@ -481,7 +481,7 @@ function Pe(e, t, n, s, o, r) {
481
481
  const E = i ? y : l;
482
482
  let h = E;
483
483
  if (m[M])
484
- h = xt(m, E, s, o, r);
484
+ h = Bt(m, E, s, o, r);
485
485
  else {
486
486
  const v = m + "";
487
487
  !(h instanceof Text) || h instanceof nt ? h = new Text(v) : h.data != v && (h.data = v);
@@ -496,11 +496,11 @@ function Pe(e, t, n, s, o, r) {
496
496
  }
497
497
  function Ne(e, t, n, s, o) {
498
498
  for (const r in t)
499
- !(r in n) && yt(e, r, t[r], null, o, s);
499
+ !(r in n) && pt(e, r, t[r], null, o, s);
500
500
  for (const r in n)
501
- yt(e, r, t[r], n[r], o, s);
501
+ pt(e, r, t[r], n[r], o, s);
502
502
  }
503
- function yt(e, t, n, s, o, r) {
503
+ function pt(e, t, n, s, o, r) {
504
504
  if (t = t == "class" && !o ? "className" : t, n = n ?? null, s = s ?? null, t in e && Ee[t] && (n = e[t]), !(s === n || Se[t] || t[0] == "_"))
505
505
  if (t[0] == "o" && t[1] == "n" && (T(s) || T(n)))
506
506
  ke(e, t.slice(2), s, r);
@@ -513,13 +513,13 @@ function yt(e, t, n, s, o, r) {
513
513
  if (f)
514
514
  for (const i in n)
515
515
  if (a)
516
- !(i in s) && pt(c, i, null);
516
+ !(i in s) && bt(c, i, null);
517
517
  else
518
518
  break;
519
519
  if (a)
520
520
  for (const i in s) {
521
521
  const u = s[i];
522
- f && n[i] === u || pt(c, i, u);
522
+ f && n[i] === u || bt(c, i, u);
523
523
  }
524
524
  else
525
525
  c.cssText = s;
@@ -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 pt(e, t, n) {
544
+ function bt(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 bt = {};
549
- function Y(e, ...t) {
548
+ const gt = {};
549
+ function x(e, ...t) {
550
550
  const n = (e.raw || e).reduce(
551
551
  (s, o, r) => s + o + (t[r] || ""),
552
552
  ""
553
553
  );
554
- return bt[n] = bt[n] || Oe(n);
554
+ return gt[n] = gt[n] || Oe(n);
555
555
  }
556
556
  function Oe(e) {
557
- if (_t.sheet) {
557
+ if (jt.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 Ae = Yt("host", { style: "display: contents" }), Z = O("atomico/context"), Re = (e, t) => {
566
- const n = $();
565
+ const Ae = xt("host", { style: "display: contents" }), Z = O("atomico/context"), Re = (e, t) => {
566
+ const n = U();
567
567
  ge(
568
- () => Rt(
568
+ () => Mt(
569
569
  n.current,
570
570
  "ConnectContext",
571
571
  /**
@@ -600,14 +600,14 @@ const Ae = Yt("host", { style: "display: contents" }), Z = O("atomico/context"),
600
600
  ));
601
601
  }, [e]), s;
602
602
  }, Fe = (e) => {
603
- const t = Me(e), n = kt();
603
+ const t = Me(e), n = Ot();
604
604
  return ot(() => {
605
605
  if (t)
606
- return Rt(t, "UpdatedValue", n);
606
+ return Mt(t, "UpdatedValue", n);
607
607
  }, [t]), (t || e).value;
608
608
  }, Ie = (e) => {
609
- const t = j(
610
- () => (Re(t, $().current), Ae),
609
+ const t = Y(
610
+ () => (Re(t, U().current), Ae),
611
611
  {
612
612
  props: {
613
613
  value: {
@@ -619,7 +619,7 @@ const Ae = Yt("host", { style: "display: contents" }), Z = O("atomico/context"),
619
619
  }
620
620
  );
621
621
  return t.value = e, t;
622
- }, b = (e, t, n) => (t == null ? t = { key: n } : t.key = n, Yt(e, t)), F = b, Bt = Y`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`, zt = Y`.vh{position:absolute;transform:scale(0)}`;
622
+ }, b = (e, t, n) => (t == null ? t = { key: n } : t.key = n, xt(e, t)), F = b, zt = x`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`, qt = x`.vh{position:absolute;transform:scale(0)}`;
623
623
  function ct() {
624
624
  return D.from(/* @__PURE__ */ new Date());
625
625
  }
@@ -627,23 +627,23 @@ function it(e, t = 0) {
627
627
  const n = w(e), s = n.getUTCDay(), o = (s < t ? 7 : 0) + s - t;
628
628
  return n.setUTCDate(n.getUTCDate() - o), D.from(n);
629
629
  }
630
- function qt(e, t = 0) {
630
+ function Ht(e, t = 0) {
631
631
  return it(e, t).add({ days: 6 });
632
632
  }
633
- function Ht(e) {
633
+ function Kt(e) {
634
634
  return D.from(new Date(Date.UTC(e.year, e.month, 0)));
635
635
  }
636
- function x(e, t, n) {
636
+ function B(e, t, n) {
637
637
  return t && D.compare(e, t) < 0 ? t : n && D.compare(e, n) > 0 ? n : e;
638
638
  }
639
- const Ue = { days: 1 };
640
- function $e(e, t = 0) {
639
+ const $e = { days: 1 };
640
+ function Ue(e, t = 0) {
641
641
  let n = it(e.toPlainDate(), t);
642
- const s = qt(Ht(e), t), o = [];
642
+ const s = Ht(Kt(e), t), o = [];
643
643
  for (; D.compare(n, s) < 0; ) {
644
644
  const r = [];
645
645
  for (let c = 0; c < 7; c++)
646
- r.push(n), n = n.add(Ue);
646
+ r.push(n), n = n.add($e);
647
647
  o.push(r);
648
648
  }
649
649
  return o;
@@ -666,13 +666,13 @@ class D {
666
666
  let { year: s, month: o } = this;
667
667
  "months" in t ? (o = this.month + t.months, n.setUTCMonth(o - 1)) : (s = this.year + t.years, n.setUTCFullYear(s));
668
668
  const r = D.from(w({ year: s, month: o, day: 1 }));
669
- return x(D.from(n), r, Ht(r));
669
+ return B(D.from(n), r, Kt(r));
670
670
  }
671
671
  toString() {
672
672
  return `${W(this.year, 4)}-${W(this.month, 2)}-${W(this.day, 2)}`;
673
673
  }
674
674
  toPlainYearMonth() {
675
- return new B(this.year, this.month);
675
+ return new z(this.year, this.month);
676
676
  }
677
677
  equals(t) {
678
678
  return D.compare(this, t) === 0;
@@ -699,13 +699,13 @@ class D {
699
699
  );
700
700
  }
701
701
  }
702
- class B {
702
+ class z {
703
703
  constructor(t, n) {
704
704
  this.year = t, this.month = n;
705
705
  }
706
706
  add(t) {
707
707
  const n = w(this), s = (t.months ?? 0) + (t.years ?? 0) * 12;
708
- return n.setUTCMonth(n.getUTCMonth() + s), new B(n.getUTCFullYear(), n.getUTCMonth() + 1);
708
+ return n.setUTCMonth(n.getUTCMonth() + s), new z(n.getUTCFullYear(), n.getUTCMonth() + 1);
709
709
  }
710
710
  equals(t) {
711
711
  return this.year === t.year && this.month === t.month;
@@ -722,7 +722,7 @@ function st(e, t) {
722
722
  }
723
723
  }
724
724
  function I(e) {
725
- const [t, n] = Lt(e);
725
+ const [t, n] = _t(e);
726
726
  return [P(() => st(D, t), [t]), (r) => n(r.toString())];
727
727
  }
728
728
  function _e(e) {
@@ -734,17 +734,17 @@ function _e(e) {
734
734
  return [];
735
735
  }
736
736
  function je(e) {
737
- const [t, n] = Lt(e);
737
+ const [t, n] = _t(e);
738
738
  return [P(() => _e(t), [t]), (r) => n(`${r[0]}/${r[1]}`)];
739
739
  }
740
- function U(e, t) {
740
+ function $(e, t) {
741
741
  return P(
742
742
  () => new Intl.DateTimeFormat(t, { timeZone: "UTC", ...e }),
743
743
  [t, e]
744
744
  );
745
745
  }
746
- function gt(e, t, n) {
747
- const s = U(e, n);
746
+ function Et(e, t, n) {
747
+ const s = $(e, n);
748
748
  return P(() => {
749
749
  const o = [], r = /* @__PURE__ */ new Date();
750
750
  for (var c = 0; c < 7; c++) {
@@ -754,7 +754,7 @@ function gt(e, t, n) {
754
754
  return o;
755
755
  }, [t, s]);
756
756
  }
757
- const Et = (e, t, n) => x(e, t, n) === e, Dt = (e) => e.target.matches(":dir(ltr)"), Ye = { month: "long", day: "numeric" }, xe = { month: "long" }, Be = { weekday: "narrow" }, ze = { weekday: "long" }, X = { bubbles: !0 };
757
+ const Dt = (e, t, n) => B(e, t, n) === e, St = (e) => e.target.matches(":dir(ltr)"), Ye = { month: "long", day: "numeric" }, xe = { month: "long" }, Be = { weekday: "narrow" }, ze = { weekday: "long" }, X = { bubbles: !0 };
758
758
  function qe({ props: e, context: t }) {
759
759
  const { offset: n } = e, {
760
760
  firstDayOfWeek: s,
@@ -764,24 +764,24 @@ function qe({ props: e, context: t }) {
764
764
  page: f,
765
765
  locale: a,
766
766
  focusedDate: i
767
- } = t, u = ct(), d = gt(ze, s, a), l = gt(Be, s, a), m = U(Ye, a), p = U(xe, a), y = P(
767
+ } = t, u = ct(), d = Et(ze, s, a), l = Et(Be, s, a), m = $(Ye, a), p = $(xe, a), y = P(
768
768
  () => f.start.add({ months: n }),
769
769
  [f, n]
770
770
  ), E = P(
771
- () => $e(y, s),
771
+ () => Ue(y, s),
772
772
  [y, s]
773
- ), h = C("focusday", X), v = C("selectday", X), z = C("hoverday", X);
773
+ ), h = C("focusday", X), v = C("selectday", X), q = C("hoverday", X);
774
774
  function lt(g) {
775
- h(x(g, r, c));
775
+ h(B(g, r, c));
776
776
  }
777
- function Xt(g) {
777
+ function Gt(g) {
778
778
  let S;
779
779
  switch (g.key) {
780
780
  case "ArrowRight":
781
- S = i.add({ days: Dt(g) ? 1 : -1 });
781
+ S = i.add({ days: St(g) ? 1 : -1 });
782
782
  break;
783
783
  case "ArrowLeft":
784
- S = i.add({ days: Dt(g) ? -1 : 1 });
784
+ S = i.add({ days: St(g) ? -1 : 1 });
785
785
  break;
786
786
  case "ArrowDown":
787
787
  S = i.add({ days: 7 });
@@ -799,38 +799,39 @@ function qe({ props: e, context: t }) {
799
799
  S = it(i, s);
800
800
  break;
801
801
  case "End":
802
- S = qt(i, s);
802
+ S = Ht(i, s);
803
803
  break;
804
804
  default:
805
805
  return;
806
806
  }
807
807
  lt(S), g.preventDefault();
808
808
  }
809
- function Gt(g) {
809
+ function Qt(g) {
810
810
  const S = y.equals(g);
811
811
  if (!S && !t.showOutsideDays)
812
812
  return;
813
- const Qt = g.equals(i), Vt = g.equals(u), ut = w(g), q = o?.(ut), ft = !Et(g, r, c);
814
- let dt = "", A;
813
+ const Vt = g.equals(i), ut = g.equals(u), ft = w(g), L = o?.(ft), dt = !Dt(g, r, c);
814
+ let ht = "", A;
815
815
  if ("highlightedRange" in t) {
816
- const [H, K] = t.highlightedRange, ht = H?.equals(g), mt = K?.equals(g);
817
- A = H && K && Et(g, H, K), dt = `${ht ? "range-start" : ""} ${mt ? "range-end" : ""} ${A && !ht && !mt ? "range-inner" : ""}`;
816
+ const [H, K] = t.highlightedRange, mt = H?.equals(g), yt = K?.equals(g);
817
+ A = H && K && Dt(g, H, K), ht = `${mt ? "range-start" : ""} ${yt ? "range-end" : ""} ${A && !mt && !yt ? "range-inner" : ""}`;
818
818
  } else
819
819
  A = t.value?.equals(g);
820
820
  return {
821
- part: `button day ${S ? A ? "selected" : "" : "outside"} ${dt}`,
822
- tabindex: S && Qt ? 0 : -1,
823
- disabled: ft,
824
- "aria-disabled": q ? "true" : void 0,
821
+ part: `${`button day ${// we don't want outside days to ever be shown as selected
822
+ S ? A ? "selected" : "" : "outside"} ${L ? "disallowed" : ""} ${ut ? "today" : ""}`} ${ht}`,
823
+ tabindex: S && Vt ? 0 : -1,
824
+ disabled: dt,
825
+ "aria-disabled": L ? "true" : void 0,
825
826
  "aria-pressed": S && A,
826
- "aria-current": Vt ? "date" : void 0,
827
- "aria-label": m.format(ut),
828
- onkeydown: Xt,
827
+ "aria-current": ut ? "date" : void 0,
828
+ "aria-label": m.format(ft),
829
+ onkeydown: Gt,
829
830
  onclick() {
830
- q || v(g), lt(g);
831
+ L || v(g), lt(g);
831
832
  },
832
833
  onmouseover() {
833
- !q && !ft && z(g);
834
+ !L && !dt && q(g);
834
835
  }
835
836
  };
836
837
  }
@@ -840,7 +841,7 @@ function qe({ props: e, context: t }) {
840
841
  daysLong: d,
841
842
  daysShort: l,
842
843
  formatter: p,
843
- getDayProps: Gt
844
+ getDayProps: Qt
844
845
  };
845
846
  }
846
847
  const G = ct(), at = Ie({
@@ -850,7 +851,7 @@ const G = ct(), at = Ie({
850
851
  page: { start: G.toPlainYearMonth(), end: G.toPlainYearMonth() }
851
852
  });
852
853
  customElements.define("calendar-month-ctx", at);
853
- const He = j(
854
+ const He = Y(
854
855
  (e) => {
855
856
  const t = Fe(at), n = se(), s = qe({ props: e, context: t });
856
857
  function o() {
@@ -878,14 +879,14 @@ const He = j(
878
879
  }
879
880
  },
880
881
  styles: [
881
- Bt,
882
882
  zt,
883
- Y`: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)){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}`
883
+ qt,
884
+ x`: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)){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}`
884
885
  ]
885
886
  }
886
887
  );
887
888
  customElements.define("calendar-month", He);
888
- function St(e) {
889
+ function wt(e) {
889
890
  return /* @__PURE__ */ b(
890
891
  "button",
891
892
  {
@@ -896,14 +897,14 @@ function St(e) {
896
897
  }
897
898
  );
898
899
  }
899
- function Kt(e) {
900
+ function Jt(e) {
900
901
  const t = w(e.page.start), n = w(e.page.end);
901
902
  return /* @__PURE__ */ F("div", { role: "group", "aria-labelledby": "h", part: "container", children: [
902
903
  /* @__PURE__ */ b("div", { id: "h", class: "vh", "aria-live": "polite", "aria-atomic": "true", children: e.formatVerbose.formatRange(t, n) }),
903
904
  /* @__PURE__ */ F("div", { part: "header", children: [
904
- /* @__PURE__ */ b(St, { name: "previous", onclick: e.previous, children: "Previous" }),
905
+ /* @__PURE__ */ b(wt, { name: "previous", onclick: e.previous, children: "Previous" }),
905
906
  /* @__PURE__ */ b("div", { part: "heading", "aria-hidden": "true", children: e.format.formatRange(t, n) }),
906
- /* @__PURE__ */ b(St, { name: "next", onclick: e.next, children: "Next" })
907
+ /* @__PURE__ */ b(wt, { name: "next", onclick: e.next, children: "Next" })
907
908
  ] }),
908
909
  /* @__PURE__ */ b(
909
910
  at,
@@ -917,7 +918,7 @@ function Kt(e) {
917
918
  )
918
919
  ] });
919
920
  }
920
- const Jt = {
921
+ const Zt = {
921
922
  value: {
922
923
  type: String,
923
924
  value: ""
@@ -956,49 +957,49 @@ const Jt = {
956
957
  value: () => {
957
958
  }
958
959
  }
959
- }, Zt = [
960
- Bt,
960
+ }, Wt = [
961
961
  zt,
962
- Y`: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}`
962
+ qt,
963
+ x`: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}`
963
964
  ], Ke = { year: "numeric" }, Je = { year: "numeric", month: "long" };
964
- function wt(e, t) {
965
+ function vt(e, t) {
965
966
  return (t.year - e.year) * 12 + t.month - e.month;
966
967
  }
967
- const vt = (e, t) => (e = t === 12 ? new B(e.year, 1) : e, {
968
+ const Tt = (e, t) => (e = t === 12 ? new z(e.year, 1) : e, {
968
969
  start: e,
969
970
  end: e.add({ months: t - 1 })
970
971
  });
971
- function Wt({
972
+ function Xt({
972
973
  months: e,
973
974
  locale: t,
974
975
  focusedDate: n,
975
976
  setFocusedDate: s
976
977
  }) {
977
978
  const [o] = I("min"), [r] = I("max"), c = C("focusday"), f = C("change"), a = P(
978
- () => x(n ?? ct(), o, r),
979
+ () => B(n ?? ct(), o, r),
979
980
  [n, o, r]
980
981
  ), [i, u] = rt(
981
- () => vt(a.toPlainYearMonth(), e)
982
+ () => Tt(a.toPlainYearMonth(), e)
982
983
  ), d = (h) => {
983
- const v = wt(i.start, h.toPlainYearMonth());
984
+ const v = vt(i.start, h.toPlainYearMonth());
984
985
  return v >= 0 && v < e;
985
986
  };
986
987
  ot(() => {
987
988
  let h = i.start;
988
989
  if (!d(a)) {
989
- const v = wt(h, a.toPlainYearMonth()), z = Math.floor(v / e);
990
- h = h.add({ months: z * e });
990
+ const v = vt(h, a.toPlainYearMonth()), q = Math.floor(v / e);
991
+ h = h.add({ months: q * e });
991
992
  }
992
- u(vt(h, e));
993
+ u(Tt(h, e));
993
994
  }, [a, e]);
994
- const l = $();
995
+ const l = U();
995
996
  function m() {
996
997
  l.current.querySelectorAll("calendar-month").forEach((h) => h.focus());
997
998
  }
998
999
  function p(h) {
999
1000
  s(h), c(w(h));
1000
1001
  }
1001
- const y = U(Ke, t), E = U(Je, t);
1002
+ const y = $(Ke, t), E = $(Je, t);
1002
1003
  return {
1003
1004
  format: y,
1004
1005
  formatVerbose: E,
@@ -1015,9 +1016,9 @@ function Wt({
1015
1016
  focus: m
1016
1017
  };
1017
1018
  }
1018
- const Ze = j(
1019
+ const Ze = Y(
1019
1020
  (e) => {
1020
- const [t, n] = I("value"), [s = t, o] = I("focusedDate"), r = Wt({
1021
+ const [t, n] = I("value"), [s = t, o] = I("focusedDate"), r = Xt({
1021
1022
  ...e,
1022
1023
  focusedDate: s,
1023
1024
  setFocusedDate: o
@@ -1026,7 +1027,7 @@ const Ze = j(
1026
1027
  n(f.detail), r.dispatch();
1027
1028
  }
1028
1029
  return /* @__PURE__ */ b("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ b(
1029
- Kt,
1030
+ Jt,
1030
1031
  {
1031
1032
  ...e,
1032
1033
  ...r,
@@ -1035,12 +1036,12 @@ const Ze = j(
1035
1036
  }
1036
1037
  ) });
1037
1038
  },
1038
- { props: Jt, styles: Zt }
1039
+ { props: Zt, styles: Wt }
1039
1040
  );
1040
1041
  customElements.define("calendar-date", Ze);
1041
- const Tt = (e, t) => D.compare(e, t) < 0 ? [e, t] : [t, e], We = j(
1042
+ const Ct = (e, t) => D.compare(e, t) < 0 ? [e, t] : [t, e], We = Y(
1042
1043
  (e) => {
1043
- const [t, n] = je("value"), [s = t[0], o] = I("focusedDate"), r = Wt({
1044
+ const [t, n] = je("value"), [s = t[0], o] = I("focusedDate"), r = Xt({
1044
1045
  ...e,
1045
1046
  focusedDate: s,
1046
1047
  setFocusedDate: o
@@ -1053,11 +1054,11 @@ const Tt = (e, t) => D.compare(e, t) < 0 ? [e, t] : [t, e], We = j(
1053
1054
  }
1054
1055
  function l(p) {
1055
1056
  const y = p.detail;
1056
- p.stopPropagation(), a ? (n(Tt(a.a, y)), i(void 0), f(w(y)), r.dispatch()) : (i({ a: y, b: y }), c(w(y)));
1057
+ p.stopPropagation(), a ? (n(Ct(a.a, y)), i(void 0), f(w(y)), r.dispatch()) : (i({ a: y, b: y }), c(w(y)));
1057
1058
  }
1058
- const m = a ? Tt(a.a, a.b) : t;
1059
+ const m = a ? Ct(a.a, a.b) : t;
1059
1060
  return /* @__PURE__ */ b("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ b(
1060
- Kt,
1061
+ Jt,
1061
1062
  {
1062
1063
  ...e,
1063
1064
  ...r,
@@ -1068,7 +1069,7 @@ const Tt = (e, t) => D.compare(e, t) < 0 ? [e, t] : [t, e], We = j(
1068
1069
  }
1069
1070
  ) });
1070
1071
  },
1071
- { props: Jt, styles: Zt }
1072
+ { props: Zt, styles: Wt }
1072
1073
  );
1073
1074
  customElements.define("calendar-range", We);
1074
1075
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cally",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "small, feature-rich calendar components",
5
5
  "license": "MIT",
6
6
  "type": "module",