cally 0.5.0 → 0.5.2

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 +60 -60
  2. package/package.json +1 -1
package/dist/cally.js CHANGED
@@ -29,9 +29,9 @@ class te {
29
29
  return this.#e.add(t), () => this.#e.delete(t);
30
30
  }
31
31
  }
32
- const Ct = (e) => new te(e), X = Symbol.for("atomico.hooks");
33
- globalThis[X] = globalThis[X] || {};
34
- let N = globalThis[X];
32
+ const Ct = (e) => new te(e), Q = Symbol.for("atomico.hooks");
33
+ globalThis[Q] = globalThis[Q] || {};
34
+ let N = globalThis[Q];
35
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) => {
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;
@@ -71,7 +71,7 @@ function Ot(e, t) {
71
71
  }
72
72
  return !0;
73
73
  }
74
- const T = (e) => typeof e == "function", R = (e) => typeof e == "object", { isArray: re } = Array, G = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
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
75
  function At(e, t) {
76
76
  let n;
77
77
  const s = (o) => {
@@ -206,7 +206,7 @@ const pe = (e) => {
206
206
  pe(this)
207
207
  );
208
208
  let m, p = !0;
209
- const y = G(this);
209
+ const y = V(this);
210
210
  this.update = () => (m || (m = !0, this.updated = (this.updated || this.mounted).then(() => {
211
211
  try {
212
212
  const E = l.load(this._render), h = l.cleanEffects();
@@ -287,7 +287,7 @@ const Ut = (e) => (t, n) => {
287
287
  ([s, o], r) => r ? (T(s) && s(), []) : [s || t(), o],
288
288
  e
289
289
  );
290
- }, nt = Ut(Pt), ge = Ut(Nt);
290
+ }, ot = Ut(Pt), ge = Ut(Nt);
291
291
  class $t extends Array {
292
292
  /**
293
293
  *
@@ -318,7 +318,7 @@ class $t extends Array {
318
318
  // this[2](nextState, this);
319
319
  // }
320
320
  }
321
- const st = (e) => {
321
+ const rt = (e) => {
322
322
  const t = kt();
323
323
  return k(
324
324
  (n = new $t(e, (s, o, r) => {
@@ -348,11 +348,11 @@ const st = (e) => {
348
348
  ...t,
349
349
  detail: s
350
350
  })), n[e];
351
- }, Q = O("atomico/options");
352
- globalThis[Q] = globalThis[Q] || {
351
+ }, tt = O("atomico/options");
352
+ globalThis[tt] = globalThis[tt] || {
353
353
  sheet: !!document.adoptedStyleSheets
354
354
  };
355
- const _t = globalThis[Q], Ee = {
355
+ const _t = globalThis[tt], Ee = {
356
356
  checked: 1,
357
357
  value: 1,
358
358
  selected: 1
@@ -372,10 +372,10 @@ const _t = globalThis[Q], Ee = {
372
372
  cloneNode: 1,
373
373
  children: 1,
374
374
  key: 1
375
- }, L = {}, V = [];
376
- class tt extends Text {
375
+ }, L = {}, et = [];
376
+ class nt extends Text {
377
377
  }
378
- const we = O("atomico/id"), M = O("atomico/type"), H = O("atomico/ref"), jt = O("atomico/vnode"), ve = () => {
378
+ const we = O("atomico/id"), M = O("atomico/type"), J = O("atomico/ref"), jt = O("atomico/vnode"), ve = () => {
379
379
  };
380
380
  function Te(e, t, n) {
381
381
  return xt(this, e, t, n);
@@ -383,7 +383,7 @@ function Te(e, t, n) {
383
383
  const Yt = (e, t, ...n) => {
384
384
  const s = t || L;
385
385
  let { children: o } = s;
386
- if (o = o ?? (n.length ? n : V), e === ve)
386
+ if (o = o ?? (n.length ? n : et), e === ve)
387
387
  return o;
388
388
  const r = e ? e instanceof Node ? 1 : (
389
389
  //@ts-ignore
@@ -391,7 +391,7 @@ const Yt = (e, t, ...n) => {
391
391
  ) : 0;
392
392
  if (r === !1 && e instanceof Function)
393
393
  return e(
394
- o != V ? { children: o, ...s } : s
394
+ o != et ? { children: o, ...s } : s
395
395
  );
396
396
  const c = _t.render || Te;
397
397
  return {
@@ -418,7 +418,7 @@ function xt(e, t, n = we, s, o) {
418
418
  let r;
419
419
  if (t && t[n] && t[n].vnode == e || e[M] != jt)
420
420
  return t;
421
- (e || !t) && (o = o || e.type == "svg", r = e.type != "host" && (e.raw == 1 ? (t && e.clone ? t[H] : t) != e.type : e.raw == 2 ? !(t instanceof e.type) : t ? t[H] || t.localName != e.type : !t), r && e.type != null && (e.raw == 1 && e.clone ? (s = !0, t = e.type.cloneNode(!0), t[H] = e.type) : t = e.raw == 1 ? e.type : e.raw == 2 ? new e.type() : o ? document.createElementNS(
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",
423
423
  e.type
424
424
  ) : document.createElement(
@@ -427,7 +427,7 @@ function xt(e, t, n = we, s, o) {
427
427
  )));
428
428
  const c = t[n] ? t[n] : L, { vnode: f = L, cycle: a = 0 } = c;
429
429
  let { fragment: i, handlers: u } = c;
430
- const { children: d = V, props: l = L } = f;
430
+ const { children: d = et, props: l = L } = f;
431
431
  if (u = r ? {} : u || {}, e.static && !r)
432
432
  return t;
433
433
  if (e.shadow && !t.shadowRoot && // @ts-ignore
@@ -449,13 +449,13 @@ function xt(e, t, n = we, s, o) {
449
449
  return t[n] = { vnode: e, handlers: u, fragment: i, cycle: a + 1 }, t;
450
450
  }
451
451
  function Ce(e, t) {
452
- const n = new tt(""), s = new tt("");
452
+ const n = new nt(""), s = new nt("");
453
453
  let o;
454
454
  if (e[t ? "prepend" : "append"](n), t) {
455
455
  let { lastElementChild: r } = e;
456
456
  for (; r; ) {
457
457
  const { previousElementSibling: c } = r;
458
- if (G(r, !0) && !G(c, !0)) {
458
+ if (V(r, !0) && !V(c, !0)) {
459
459
  o = r;
460
460
  break;
461
461
  }
@@ -484,7 +484,7 @@ function Pe(e, t, n, s, o, r) {
484
484
  h = xt(m, E, s, o, r);
485
485
  else {
486
486
  const v = m + "";
487
- !(h instanceof Text) || h instanceof tt ? h = new Text(v) : h.data != v && (h.data = v);
487
+ !(h instanceof Text) || h instanceof nt ? h = new Text(v) : h.data != v && (h.data = v);
488
488
  }
489
489
  h != l && (i && d.delete(h), !E || i ? (n.insertBefore(h, l), i && l != a && d.add(l)) : E == a ? n.insertBefore(h, a) : (n.replaceChild(h, E), l = h)), p != null && (u = u || /* @__PURE__ */ new Map(), u.set(p, h));
490
490
  }), l = l == a ? a : l.nextSibling, t && l != a)
@@ -562,7 +562,7 @@ function Oe(e) {
562
562
  return t.textContent = e, t;
563
563
  }
564
564
  }
565
- const Ae = Yt("host", { style: "display: contents" }), K = O("atomico/context"), Re = (e, t) => {
565
+ const Ae = Yt("host", { style: "display: contents" }), Z = O("atomico/context"), Re = (e, t) => {
566
566
  const n = $();
567
567
  ge(
568
568
  () => Rt(
@@ -589,19 +589,19 @@ const Ae = Yt("host", { style: "display: contents" }), K = O("atomico/context"),
589
589
  r = c;
590
590
  }
591
591
  }), r;
592
- }, [s, o] = st(
592
+ }, [s, o] = rt(
593
593
  n
594
594
  );
595
- return nt(() => {
596
- s || (e[K] || (e[K] = customElements.whenDefined(
595
+ return ot(() => {
596
+ s || (e[Z] || (e[Z] = customElements.whenDefined(
597
597
  new e().localName
598
- )), e[K].then(
598
+ )), e[Z].then(
599
599
  () => o(n)
600
600
  ));
601
601
  }, [e]), s;
602
602
  }, Fe = (e) => {
603
603
  const t = Me(e), n = kt();
604
- return nt(() => {
604
+ return ot(() => {
605
605
  if (t)
606
606
  return Rt(t, "UpdatedValue", n);
607
607
  }, [t]), (t || e).value;
@@ -620,15 +620,15 @@ const Ae = Yt("host", { style: "display: contents" }), K = O("atomico/context"),
620
620
  );
621
621
  return t.value = e, t;
622
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)}`;
623
- function ot() {
623
+ function ct() {
624
624
  return D.from(/* @__PURE__ */ new Date());
625
625
  }
626
- function rt(e, t = 0) {
626
+ 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
630
  function qt(e, t = 0) {
631
- return rt(e, t).add({ days: 6 });
631
+ return it(e, t).add({ days: 6 });
632
632
  }
633
633
  function Ht(e) {
634
634
  return D.from(new Date(Date.UTC(e.year, e.month, 0)));
@@ -638,7 +638,7 @@ function x(e, t, n) {
638
638
  }
639
639
  const Ue = { days: 1 };
640
640
  function $e(e, t = 0) {
641
- let n = rt(e.toPlainDate(), t);
641
+ let n = it(e.toPlainDate(), t);
642
642
  const s = qt(Ht(e), t), o = [];
643
643
  for (; D.compare(n, s) < 0; ) {
644
644
  const r = [];
@@ -651,7 +651,7 @@ function $e(e, t = 0) {
651
651
  function w(e) {
652
652
  return new Date(Date.UTC(e.year, e.month - 1, e.day ?? 1));
653
653
  }
654
- const Le = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[0-1])$/, J = (e, t) => e.toString().padStart(t, "0");
654
+ const Le = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[0-1])$/, W = (e, t) => e.toString().padStart(t, "0");
655
655
  class D {
656
656
  constructor(t, n, s) {
657
657
  this.year = t, this.month = n, this.day = s;
@@ -669,7 +669,7 @@ class D {
669
669
  return x(D.from(n), r, Ht(r));
670
670
  }
671
671
  toString() {
672
- return `${J(this.year, 4)}-${J(this.month, 2)}-${J(this.day, 2)}`;
672
+ return `${W(this.year, 4)}-${W(this.month, 2)}-${W(this.day, 2)}`;
673
673
  }
674
674
  toPlainYearMonth() {
675
675
  return new B(this.year, this.month);
@@ -714,7 +714,7 @@ class B {
714
714
  return new D(this.year, this.month, 1);
715
715
  }
716
716
  }
717
- function et(e, t) {
717
+ function st(e, t) {
718
718
  if (t)
719
719
  try {
720
720
  return e.from(t);
@@ -723,11 +723,11 @@ function et(e, t) {
723
723
  }
724
724
  function I(e) {
725
725
  const [t, n] = Lt(e);
726
- return [P(() => et(D, t), [t]), (r) => n(r.toString())];
726
+ return [P(() => st(D, t), [t]), (r) => n(r.toString())];
727
727
  }
728
728
  function _e(e) {
729
729
  if (e) {
730
- const [t, n] = e.split("/"), s = et(D, t), o = et(D, n);
730
+ const [t, n] = e.split("/"), s = st(D, t), o = st(D, n);
731
731
  if (s && o)
732
732
  return [s, o];
733
733
  }
@@ -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" }, Z = { bubbles: !0 };
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 };
758
758
  function qe({ props: e, context: t }) {
759
759
  const { offset: n } = e, {
760
760
  firstDayOfWeek: s,
@@ -764,14 +764,14 @@ function qe({ props: e, context: t }) {
764
764
  page: f,
765
765
  locale: a,
766
766
  focusedDate: i
767
- } = t, u = ot(), 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 = gt(ze, s, a), l = gt(Be, s, a), m = U(Ye, a), p = U(xe, a), y = P(
768
768
  () => f.start.add({ months: n }),
769
769
  [f, n]
770
770
  ), E = P(
771
771
  () => $e(y, s),
772
772
  [y, s]
773
- ), h = C("focusday", Z), v = C("selectday", Z), z = C("hoverday", Z);
774
- function it(g) {
773
+ ), h = C("focusday", X), v = C("selectday", X), z = C("hoverday", X);
774
+ function lt(g) {
775
775
  h(x(g, r, c));
776
776
  }
777
777
  function Xt(g) {
@@ -796,7 +796,7 @@ function qe({ props: e, context: t }) {
796
796
  S = i.add(g.shiftKey ? { years: 1 } : { months: 1 });
797
797
  break;
798
798
  case "Home":
799
- S = rt(i, s);
799
+ S = it(i, s);
800
800
  break;
801
801
  case "End":
802
802
  S = qt(i, s);
@@ -804,33 +804,33 @@ function qe({ props: e, context: t }) {
804
804
  default:
805
805
  return;
806
806
  }
807
- it(S), g.preventDefault();
807
+ lt(S), g.preventDefault();
808
808
  }
809
809
  function Gt(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), at = w(g), q = o?.(at), lt = !Et(g, r, c);
814
- let ut = "", A;
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;
815
815
  if ("highlightedRange" in t) {
816
- const [ft, dt] = t.highlightedRange, ht = ft?.equals(g), mt = dt?.equals(g);
817
- A = Et(g, ft, dt), ut = `${ht ? "range-start" : ""} ${mt ? "range-end" : ""} ${A && !ht && !mt ? "range-inner" : ""}`;
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" : ""}`;
818
818
  } else
819
819
  A = t.value?.equals(g);
820
820
  return {
821
- part: `button day ${S && A ? "selected" : ""} ${ut}`,
821
+ part: `button day ${S ? A ? "selected" : "" : "outside"} ${dt}`,
822
822
  tabindex: S && Qt ? 0 : -1,
823
- disabled: lt,
823
+ disabled: ft,
824
824
  "aria-disabled": q ? "true" : void 0,
825
825
  "aria-pressed": S && A,
826
826
  "aria-current": Vt ? "date" : void 0,
827
- "aria-label": m.format(at),
827
+ "aria-label": m.format(ut),
828
828
  onkeydown: Xt,
829
829
  onclick() {
830
- q || v(g), it(g);
830
+ q || v(g), lt(g);
831
831
  },
832
832
  onmouseover() {
833
- !q && !lt && z(g);
833
+ !q && !ft && z(g);
834
834
  }
835
835
  };
836
836
  }
@@ -843,16 +843,16 @@ function qe({ props: e, context: t }) {
843
843
  getDayProps: Gt
844
844
  };
845
845
  }
846
- const W = ot(), ct = Ie({
846
+ const G = ct(), at = Ie({
847
847
  firstDayOfWeek: 1,
848
848
  isDateDisallowed: () => !1,
849
- focusedDate: W,
850
- page: { start: W.toPlainYearMonth(), end: W.toPlainYearMonth() }
849
+ focusedDate: G,
850
+ page: { start: G.toPlainYearMonth(), end: G.toPlainYearMonth() }
851
851
  });
852
- customElements.define("calendar-month-ctx", ct);
852
+ customElements.define("calendar-month-ctx", at);
853
853
  const He = j(
854
854
  (e) => {
855
- const t = Fe(ct), n = se(), s = qe({ props: e, context: t });
855
+ const t = Fe(at), n = se(), s = qe({ props: e, context: t });
856
856
  function o() {
857
857
  n.current.querySelector("button[tabindex='0']")?.focus();
858
858
  }
@@ -906,7 +906,7 @@ function Kt(e) {
906
906
  /* @__PURE__ */ b(St, { name: "next", onclick: e.next, children: "Next" })
907
907
  ] }),
908
908
  /* @__PURE__ */ b(
909
- ct,
909
+ at,
910
910
  {
911
911
  value: e,
912
912
  onselectday: e.onSelect,
@@ -975,15 +975,15 @@ function Wt({
975
975
  setFocusedDate: s
976
976
  }) {
977
977
  const [o] = I("min"), [r] = I("max"), c = C("focusday"), f = C("change"), a = P(
978
- () => x(n ?? ot(), o, r),
978
+ () => x(n ?? ct(), o, r),
979
979
  [n, o, r]
980
- ), [i, u] = st(
980
+ ), [i, u] = rt(
981
981
  () => vt(a.toPlainYearMonth(), e)
982
982
  ), d = (h) => {
983
983
  const v = wt(i.start, h.toPlainYearMonth());
984
984
  return v >= 0 && v < e;
985
985
  };
986
- nt(() => {
986
+ ot(() => {
987
987
  let h = i.start;
988
988
  if (!d(a)) {
989
989
  const v = wt(h, a.toPlainYearMonth()), z = Math.floor(v / e);
@@ -1044,7 +1044,7 @@ const Tt = (e, t) => D.compare(e, t) < 0 ? [e, t] : [t, e], We = j(
1044
1044
  ...e,
1045
1045
  focusedDate: s,
1046
1046
  setFocusedDate: o
1047
- }), c = C("rangestart"), f = C("rangeend"), [a, i] = st();
1047
+ }), c = C("rangestart"), f = C("rangeend"), [a, i] = rt();
1048
1048
  function u(p) {
1049
1049
  r.onFocus(p), d(p);
1050
1050
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cally",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "small, feature-rich calendar components",
5
5
  "license": "MIT",
6
6
  "type": "module",