cally 0.4.0 → 0.4.1

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 +67 -67
  2. package/package.json +2 -1
package/dist/cally.js CHANGED
@@ -37,17 +37,17 @@ const re = Symbol.for("Atomico.suspense"), Pt = Symbol.for("Atomico.effect"), ie
37
37
  return r.value = e(r.value), r.effect = t, r.tag = s, N.c.i++, o[n].value;
38
38
  }, ae = (e) => O((t = Nt(e)) => t), U = () => O((e = Nt(N.c.host)) => e), Ft = () => N.c.update, ce = (e, t, s = 0) => {
39
39
  let n = {}, o = !1;
40
- const r = () => o, i = (u, c) => {
40
+ const r = () => o, i = (l, c) => {
41
41
  for (const h in n) {
42
42
  const a = n[h];
43
- a.effect && a.tag === u && (a.value = a.effect(a.value, c));
43
+ a.effect && a.tag === l && (a.value = a.effect(a.value, c));
44
44
  }
45
45
  };
46
- return { load: (u) => {
46
+ return { load: (l) => {
47
47
  N.c = { host: t, hooks: n, update: e, i: 0, id: s };
48
48
  let c;
49
49
  try {
50
- o = !1, c = u();
50
+ o = !1, c = l();
51
51
  } catch (h) {
52
52
  if (h !== re)
53
53
  throw h;
@@ -56,8 +56,8 @@ const re = Symbol.for("Atomico.suspense"), Pt = Symbol.for("Atomico.effect"), ie
56
56
  N.c = null;
57
57
  }
58
58
  return c;
59
- }, cleanEffects: (u) => (i(Ot, u), () => (i(ie, u), () => {
60
- i(Pt, u);
59
+ }, cleanEffects: (l) => (i(Ot, l), () => (i(ie, l), () => {
60
+ i(Pt, l);
61
61
  })), isSuspense: r };
62
62
  }, F = Symbol.for;
63
63
  function Mt(e, t) {
@@ -71,7 +71,7 @@ function Mt(e, t) {
71
71
  }
72
72
  return !0;
73
73
  }
74
- const S = (e) => typeof e == "function", A = (e) => typeof e == "object", { isArray: le } = Array, et = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
74
+ const S = (e) => typeof e == "function", A = (e) => typeof e == "object", { isArray: ue } = Array, et = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
75
75
  function kt(e, t) {
76
76
  let s;
77
77
  const n = (o) => {
@@ -81,10 +81,10 @@ function kt(e, t) {
81
81
  if (f && Array.isArray(f))
82
82
  n(f);
83
83
  else {
84
- const l = typeof f;
85
- if (f == null || l === "function" || l === "boolean")
84
+ const u = typeof f;
85
+ if (f == null || u === "function" || u === "boolean")
86
86
  continue;
87
- l === "string" || l === "number" ? (s == null && (s = ""), s += f) : (s != null && (t(s), s = null), t(f));
87
+ u === "string" || u === "number" ? (s == null && (s = ""), s += f) : (s != null && (t(s), s = null), t(f));
88
88
  }
89
89
  }
90
90
  };
@@ -104,7 +104,7 @@ class Rt {
104
104
  }
105
105
  class It extends Rt {
106
106
  }
107
- class ue extends Rt {
107
+ class le extends Rt {
108
108
  }
109
109
  const L = "Custom", fe = null, de = { true: 1, "": 1, 1: 1 };
110
110
  function he(e, t, s, n, o) {
@@ -112,9 +112,9 @@ function he(e, t, s, n, o) {
112
112
  type: r,
113
113
  reflect: i,
114
114
  event: f,
115
- value: l,
116
- attr: u = me(t)
117
- } = s?.name != L && A(s) && s != fe ? s : { type: s }, c = r?.name === L && r.map, h = l != null ? r == Function || !S(l) ? () => l : l : null;
115
+ value: u,
116
+ attr: l = me(t)
117
+ } = s?.name != L && A(s) && s != fe ? s : { type: s }, c = r?.name === L && r.map, h = u != null ? r == Function || !S(u) ? () => u : u : null;
118
118
  Object.defineProperty(e, t, {
119
119
  configurable: !0,
120
120
  /**
@@ -135,7 +135,7 @@ function he(e, t, s, n, o) {
135
135
  D
136
136
  );
137
137
  d != D && (this._props[t] = D ?? void 0, this.update(), f && Ut(this, f), this.updated.then(() => {
138
- i && (this._ignoreAttr = u, ye(this, r, u, this[t]), this._ignoreAttr = null);
138
+ i && (this._ignoreAttr = l, ye(this, r, l, this[t]), this._ignoreAttr = null);
139
139
  }));
140
140
  },
141
141
  /**
@@ -144,7 +144,7 @@ function he(e, t, s, n, o) {
144
144
  get() {
145
145
  return this._props[t];
146
146
  }
147
- }), h && (o[t] = h()), n[u] = { prop: t, type: r };
147
+ }), h && (o[t] = h()), n[l] = { prop: t, type: r };
148
148
  }
149
149
  const Ut = (e, { type: t, base: s = CustomEvent, ...n }) => e.dispatchEvent(new s(t, n)), me = (e) => e.replace(/([A-Z])/g, "-$1").toLowerCase(), ye = (e, t, s, n) => n == null || t == Boolean && !n ? e.removeAttribute(s) : e.setAttribute(
150
150
  s,
@@ -174,7 +174,7 @@ const we = (e) => {
174
174
  return t || "c" + De++;
175
175
  }, $ = (e, t = HTMLElement) => {
176
176
  const s = {}, n = {}, o = "prototype" in t && t.prototype instanceof Element, r = o ? t : "base" in t ? t.base : HTMLElement, { props: i, styles: f } = o ? e : t;
177
- class l extends r {
177
+ class u extends r {
178
178
  constructor() {
179
179
  super(), this._setup(), this._render = () => e({ ...this._props });
180
180
  for (const c in n)
@@ -244,7 +244,7 @@ const we = (e) => {
244
244
  try {
245
245
  this[d] = be(y, a);
246
246
  } catch {
247
- throw new ue(
247
+ throw new le(
248
248
  this,
249
249
  `The value defined as attr '${c}' cannot be parsed by type '${y.name}'`,
250
250
  a
@@ -263,7 +263,7 @@ const we = (e) => {
263
263
  return Object.keys(s).concat(c);
264
264
  }
265
265
  }
266
- return l;
266
+ return u;
267
267
  };
268
268
  function Ee(e) {
269
269
  const { styles: t } = e.constructor, { shadowRoot: s } = e;
@@ -425,28 +425,28 @@ function qt(e, t, s = Ne, n, o) {
425
425
  e.type,
426
426
  e.is ? { is: e.is } : void 0
427
427
  )));
428
- const i = t[s] ? t[s] : _, { vnode: f = _, cycle: l = 0 } = i;
429
- let { fragment: u, handlers: c } = i;
428
+ const i = t[s] ? t[s] : _, { vnode: f = _, cycle: u = 0 } = i;
429
+ let { fragment: l, handlers: c } = i;
430
430
  const { children: h = st, props: a = _ } = f;
431
431
  if (c = r ? {} : c || {}, e.static && !r)
432
432
  return t;
433
433
  if (e.shadow && !t.shadowRoot && // @ts-ignore
434
434
  t.attachShadow({ mode: "open", ...e.shadow }), e.props != a && ke(t, a, e.props, c, o), e.children !== h) {
435
435
  const d = e.shadow ? t.shadowRoot : t;
436
- u = Me(
436
+ l = Me(
437
437
  e.children,
438
438
  /**
439
439
  * @todo for hydration use attribute and send childNodes
440
440
  */
441
- u,
441
+ l,
442
442
  d,
443
443
  s,
444
444
  // add support to foreignObject, children will escape from svg
445
- !l && n,
445
+ !u && n,
446
446
  o && e.type == "foreignObject" ? !1 : o
447
447
  );
448
448
  }
449
- return t[s] = { vnode: e, handlers: c, fragment: u, cycle: l + 1 }, t;
449
+ return t[s] = { vnode: e, handlers: c, fragment: l, cycle: u + 1 }, t;
450
450
  }
451
451
  function Fe(e, t) {
452
452
  const s = new ot(""), n = new ot("");
@@ -468,17 +468,17 @@ function Fe(e, t) {
468
468
  };
469
469
  }
470
470
  function Me(e, t, s, n, o, r) {
471
- e = e == null ? null : le(e) ? e : [e];
472
- const i = t || Fe(s, o), { markStart: f, markEnd: l, keyes: u } = i;
471
+ e = e == null ? null : ue(e) ? e : [e];
472
+ const i = t || Fe(s, o), { markStart: f, markEnd: u, keyes: l } = i;
473
473
  let c;
474
- const h = u && /* @__PURE__ */ new Set();
474
+ const h = l && /* @__PURE__ */ new Set();
475
475
  let a = f;
476
476
  if (e && kt(e, (d) => {
477
477
  if (typeof d == "object" && !d[R])
478
478
  return;
479
- const y = d[R] && d.key, D = u && y != null && u.get(y);
480
- a != l && a === D ? h.delete(a) : a = a == l ? l : a.nextSibling;
481
- const m = u ? D : a;
479
+ const y = d[R] && d.key, D = l && y != null && l.get(y);
480
+ a != u && a === D ? h.delete(a) : a = a == u ? u : a.nextSibling;
481
+ const m = l ? D : a;
482
482
  let w = m;
483
483
  if (d[R])
484
484
  w = qt(d, m, n, o, r);
@@ -486,9 +486,9 @@ function Me(e, t, s, n, o, r) {
486
486
  const M = d + "";
487
487
  !(w instanceof Text) || w instanceof ot ? w = new Text(M) : w.data != M && (w.data = M);
488
488
  }
489
- w != a && (u && h.delete(w), !m || u ? (s.insertBefore(w, a), u && a != l && h.add(a)) : m == l ? s.insertBefore(w, l) : (s.replaceChild(w, m), a = w)), y != null && (c = c || /* @__PURE__ */ new Map(), c.set(y, w));
490
- }), a = a == l ? l : a.nextSibling, t && a != l)
491
- for (; a != l; ) {
489
+ w != a && (l && h.delete(w), !m || l ? (s.insertBefore(w, a), l && a != u && h.add(a)) : m == u ? s.insertBefore(w, u) : (s.replaceChild(w, m), a = w)), y != null && (c = c || /* @__PURE__ */ new Map(), c.set(y, w));
490
+ }), a = a == u ? u : a.nextSibling, t && a != u)
491
+ for (; a != u; ) {
492
492
  const d = a;
493
493
  a = a.nextSibling, d.remove();
494
494
  }
@@ -509,17 +509,17 @@ function bt(e, t, s, n, o, r) {
509
509
  else if (t == "style") {
510
510
  const { style: i } = e;
511
511
  s = s || "", n = n || "";
512
- const f = A(s), l = A(n);
512
+ const f = A(s), u = A(n);
513
513
  if (f)
514
- for (const u in s)
515
- if (l)
516
- !(u in n) && pt(i, u, null);
514
+ for (const l in s)
515
+ if (u)
516
+ !(l in n) && pt(i, l, null);
517
517
  else
518
518
  break;
519
- if (l)
520
- for (const u in n) {
521
- const c = n[u];
522
- f && s[u] === c || pt(i, u, c);
519
+ if (u)
520
+ for (const l in n) {
521
+ const c = n[l];
522
+ f && s[l] === c || pt(i, l, c);
523
523
  }
524
524
  else
525
525
  i.cssText = n;
@@ -619,7 +619,7 @@ const Ie = jt("host", { style: "display: contents" }), G = F("atomico/context"),
619
619
  }
620
620
  );
621
621
  return t.value = e, t;
622
- }, b = (e, t, s) => (t == null ? t = { key: s } : t.key = s, jt(e, t)), I = b, zt = q`*,*:before,*:after{box-sizing:border-box}`, Bt = q`.vh{position:absolute;transform:scale(0)}`;
622
+ }, b = (e, t, s) => (t == null ? t = { key: s } : t.key = s, jt(e, t)), I = b, zt = q`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation}`, Bt = q`.vh{position:absolute;transform:scale(0)}`;
623
623
  function z() {
624
624
  const e = new Date(Date.now());
625
625
  return new g(e.getUTCFullYear(), e.getUTCMonth() + 1, e.getUTCDate());
@@ -631,7 +631,7 @@ function B(e, t = 0) {
631
631
  function Ht(e, t = 0) {
632
632
  return B(e, t).add({ days: 6 });
633
633
  }
634
- function lt(e) {
634
+ function ut(e) {
635
635
  return g.from(new Date(Date.UTC(e.year, e.month, 0)));
636
636
  }
637
637
  function Wt(e, t) {
@@ -657,7 +657,7 @@ function $e(e, t) {
657
657
  return s;
658
658
  }
659
659
  function je(e, t = 0) {
660
- const s = B(e.toPlainDate(), t), n = Ht(lt(e), t);
660
+ const s = B(e.toPlainDate(), t), n = Ht(ut(e), t);
661
661
  return $e(Ye(s, n), 7);
662
662
  }
663
663
  function qe(e, t, s) {
@@ -680,11 +680,11 @@ function He(e, t) {
680
680
  return g.from(new Date(Date.UTC(e.year, e.month - 1, t)));
681
681
  }
682
682
  function We(e, t) {
683
- const s = new g(t, e.month, 1), n = lt(s), o = e.toDate();
683
+ const s = new g(t, e.month, 1), n = ut(s), o = e.toDate();
684
684
  return o.setUTCFullYear(t), H(g.from(o), s, n);
685
685
  }
686
686
  function Ke(e, t) {
687
- const s = new g(e.year, t, 1), n = lt(s), o = e.toDate();
687
+ const s = new g(e.year, t, 1), n = ut(s), o = e.toDate();
688
688
  return o.setUTCMonth(t - 1), H(g.from(o), s, n);
689
689
  }
690
690
  function Dt(e, t) {
@@ -815,7 +815,7 @@ function Ge(e) {
815
815
  }
816
816
  const vt = (e) => e.target.matches(":dir(ltr)"), Qe = { month: "long", day: "numeric" }, Ve = { month: "long" }, V = { bubbles: !0 };
817
817
  function tn({ props: e, context: t }) {
818
- const { offset: s } = e, { firstDayOfWeek: n, isDateDisallowed: o, min: r, max: i, dateWindow: f, locale: l } = t, u = z(), c = St("long", n, l), h = St("narrow", n, l), a = Y(Qe, l), d = Y(Ve, l), { focusedDate: y } = f, D = P(
818
+ const { offset: s } = e, { firstDayOfWeek: n, isDateDisallowed: o, min: r, max: i, dateWindow: f, locale: u } = t, l = z(), c = St("long", n, u), h = St("narrow", n, u), a = Y(Qe, u), d = Y(Ve, u), { focusedDate: y } = f, D = P(
819
819
  () => f.start.add({ months: s }),
820
820
  [f, s]
821
821
  ), m = P(
@@ -858,7 +858,7 @@ function tn({ props: e, context: t }) {
858
858
  ft(E), p.preventDefault();
859
859
  }
860
860
  function ne(p) {
861
- const E = D.equals(p), se = p.equals(y), dt = p.equals(u), ht = p.toDate(), x = o?.(ht), mt = !rt(p, r, i);
861
+ const E = D.equals(p), se = p.equals(y), dt = p.equals(l), ht = p.toDate(), x = o?.(ht), mt = !rt(p, r, i);
862
862
  let k = !1, yt = !1, W = !1, K = !1;
863
863
  if ("highlightedRange" in t) {
864
864
  const [J, X] = t.highlightedRange;
@@ -935,15 +935,15 @@ class T {
935
935
  );
936
936
  }
937
937
  }
938
- const Tt = z(), ut = Le({
938
+ const Tt = z(), lt = Le({
939
939
  firstDayOfWeek: 0,
940
940
  isDateDisallowed: () => !1,
941
941
  dateWindow: new T(Tt.toPlainYearMonth(), { months: 1 }, Tt)
942
942
  });
943
- customElements.define("calendar-month-ctx", ut);
943
+ customElements.define("calendar-month-ctx", lt);
944
944
  const en = $(
945
945
  (e) => {
946
- const t = _e(ut), s = ae(), n = tn({ props: e, context: t });
946
+ const t = _e(lt), s = ae(), n = tn({ props: e, context: t });
947
947
  function o() {
948
948
  s.current.querySelector("button[tabindex='0']")?.focus();
949
949
  }
@@ -954,9 +954,9 @@ const en = $(
954
954
  /* @__PURE__ */ b("span", { class: "vh", children: r }),
955
955
  /* @__PURE__ */ b("span", { "aria-hidden": "true", children: n.dayNamesShort[i] })
956
956
  ] })) }) }),
957
- /* @__PURE__ */ b("tbody", { children: n.weeks.map((r, i) => /* @__PURE__ */ b("tr", { part: "tr week", children: r.map((f, l) => {
958
- const u = n.yearMonth.equals(f), c = t.showOutsideDays || u;
959
- return /* @__PURE__ */ b("td", { part: "td", children: c && /* @__PURE__ */ b("button", { ...n.getDayProps(f), children: f.day }) }, l);
957
+ /* @__PURE__ */ b("tbody", { children: n.weeks.map((r, i) => /* @__PURE__ */ b("tr", { part: "tr week", children: r.map((f, u) => {
958
+ const l = n.yearMonth.equals(f), c = t.showOutsideDays || l;
959
+ return /* @__PURE__ */ b("td", { part: "td", children: c && /* @__PURE__ */ b("button", { ...n.getDayProps(f), children: f.day }) }, u);
960
960
  }) }, i)) })
961
961
  ] })
962
962
  ] });
@@ -1002,7 +1002,7 @@ function Zt(e) {
1002
1002
  )
1003
1003
  ] }),
1004
1004
  /* @__PURE__ */ b(
1005
- ut,
1005
+ lt,
1006
1006
  {
1007
1007
  value: e,
1008
1008
  onselectday: e.onSelect,
@@ -1057,10 +1057,10 @@ function Vt({ months: e, locale: t }) {
1057
1057
  const m = z(), w = e === 12 ? new C(m.year, 1) : m.toPlainYearMonth();
1058
1058
  return new T(w, { months: e }, m);
1059
1059
  });
1060
- function l(m) {
1060
+ function u(m) {
1061
1061
  f(m), o(m.focusedDate.toDate());
1062
1062
  }
1063
- function u(m) {
1063
+ function l(m) {
1064
1064
  f(i.adjust(m));
1065
1065
  }
1066
1066
  const c = U();
@@ -1074,13 +1074,13 @@ function Vt({ months: e, locale: t }) {
1074
1074
  dateWindow: i,
1075
1075
  dispatch: r,
1076
1076
  handleFocus(m) {
1077
- m.stopPropagation(), u(m.detail), o(m.detail.toDate()), setTimeout(h);
1077
+ m.stopPropagation(), l(m.detail), o(m.detail.toDate()), setTimeout(h);
1078
1078
  },
1079
- setFocusedDate: u,
1079
+ setFocusedDate: l,
1080
1080
  min: s,
1081
1081
  max: n,
1082
- next: y ? () => l(i.next()) : void 0,
1083
- previous: D ? () => l(i.prev()) : void 0,
1082
+ next: y ? () => u(i.next()) : void 0,
1083
+ previous: D ? () => u(i.prev()) : void 0,
1084
1084
  focus: h
1085
1085
  };
1086
1086
  }
@@ -1113,10 +1113,10 @@ const Ct = (e, t) => g.compare(e, t) < 0 ? [e, t] : [t, e], rn = $(
1113
1113
  j(() => {
1114
1114
  t.length && !rt(n.dateWindow.focusedDate, t[0], t[1]) && n.setFocusedDate(t[1]);
1115
1115
  }, [t]);
1116
- async function l(a) {
1117
- n.handleFocus(a), u(a);
1116
+ async function u(a) {
1117
+ n.handleFocus(a), l(a);
1118
1118
  }
1119
- function u(a) {
1119
+ function l(a) {
1120
1120
  a.stopPropagation(), f((d) => d && { ...d, second: a.detail });
1121
1121
  }
1122
1122
  function c(a) {
@@ -1130,8 +1130,8 @@ const Ct = (e, t) => g.compare(e, t) < 0 ? [e, t] : [t, e], rn = $(
1130
1130
  ...e,
1131
1131
  ...n,
1132
1132
  highlightedRange: h,
1133
- onFocus: l,
1134
- onHover: u,
1133
+ onFocus: u,
1134
+ onHover: l,
1135
1135
  onSelect: c
1136
1136
  }
1137
1137
  ) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cally",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "small, feature-rich calendar components",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -48,6 +48,7 @@
48
48
  "@web/test-runner-playwright": "^0.11.0",
49
49
  "@web/test-runner-visual-regression": "^0.9.0",
50
50
  "astro": "^4.5.10",
51
+ "postcss-nesting": "^12.1.1",
51
52
  "prettier": "^3.2.5",
52
53
  "typescript": "^5.3.3",
53
54
  "vite": "^5.1.4",