Comparing version 0.4.0 to 0.4.1
@@ -40,13 +40,13 @@ class oe { | ||
let n = {}, o = !1; | ||
const r = () => o, i = (u, c) => { | ||
const r = () => o, i = (l, c) => { | ||
for (const h in n) { | ||
const a = n[h]; | ||
a.effect && a.tag === u && (a.value = a.effect(a.value, c)); | ||
a.effect && a.tag === l && (a.value = a.effect(a.value, c)); | ||
} | ||
}; | ||
return { load: (u) => { | ||
return { load: (l) => { | ||
N.c = { host: t, hooks: n, update: e, i: 0, id: s }; | ||
let c; | ||
try { | ||
o = !1, c = u(); | ||
o = !1, c = l(); | ||
} catch (h) { | ||
@@ -60,4 +60,4 @@ if (h !== re) | ||
return c; | ||
}, cleanEffects: (u) => (i(Ot, u), () => (i(ie, u), () => { | ||
i(Pt, u); | ||
}, cleanEffects: (l) => (i(Ot, l), () => (i(ie, l), () => { | ||
i(Pt, l); | ||
})), isSuspense: r }; | ||
@@ -76,3 +76,3 @@ }, F = Symbol.for; | ||
} | ||
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 || {}); | ||
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 || {}); | ||
function kt(e, t) { | ||
@@ -87,6 +87,6 @@ let s; | ||
else { | ||
const l = typeof f; | ||
if (f == null || l === "function" || l === "boolean") | ||
const u = typeof f; | ||
if (f == null || u === "function" || u === "boolean") | ||
continue; | ||
l === "string" || l === "number" ? (s == null && (s = ""), s += f) : (s != null && (t(s), s = null), t(f)); | ||
u === "string" || u === "number" ? (s == null && (s = ""), s += f) : (s != null && (t(s), s = null), t(f)); | ||
} | ||
@@ -111,3 +111,3 @@ } | ||
} | ||
class ue extends Rt { | ||
class le extends Rt { | ||
} | ||
@@ -120,5 +120,5 @@ const L = "Custom", fe = null, de = { true: 1, "": 1, 1: 1 }; | ||
event: f, | ||
value: l, | ||
attr: u = me(t) | ||
} = 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; | ||
value: u, | ||
attr: l = me(t) | ||
} = 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; | ||
Object.defineProperty(e, t, { | ||
@@ -144,3 +144,3 @@ configurable: !0, | ||
d != D && (this._props[t] = D ?? void 0, this.update(), f && Ut(this, f), this.updated.then(() => { | ||
i && (this._ignoreAttr = u, ye(this, r, u, this[t]), this._ignoreAttr = null); | ||
i && (this._ignoreAttr = l, ye(this, r, l, this[t]), this._ignoreAttr = null); | ||
})); | ||
@@ -154,3 +154,3 @@ }, | ||
} | ||
}), h && (o[t] = h()), n[u] = { prop: t, type: r }; | ||
}), h && (o[t] = h()), n[l] = { prop: t, type: r }; | ||
} | ||
@@ -185,3 +185,3 @@ 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( | ||
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; | ||
class l extends r { | ||
class u extends r { | ||
constructor() { | ||
@@ -256,3 +256,3 @@ super(), this._setup(), this._render = () => e({ ...this._props }); | ||
} catch { | ||
throw new ue( | ||
throw new le( | ||
this, | ||
@@ -276,3 +276,3 @@ `The value defined as attr '${c}' cannot be parsed by type '${y.name}'`, | ||
} | ||
return l; | ||
return u; | ||
}; | ||
@@ -439,4 +439,4 @@ function Ee(e) { | ||
))); | ||
const i = t[s] ? t[s] : _, { vnode: f = _, cycle: l = 0 } = i; | ||
let { fragment: u, handlers: c } = i; | ||
const i = t[s] ? t[s] : _, { vnode: f = _, cycle: u = 0 } = i; | ||
let { fragment: l, handlers: c } = i; | ||
const { children: h = st, props: a = _ } = f; | ||
@@ -448,3 +448,3 @@ if (c = r ? {} : c || {}, e.static && !r) | ||
const d = e.shadow ? t.shadowRoot : t; | ||
u = Me( | ||
l = Me( | ||
e.children, | ||
@@ -454,11 +454,11 @@ /** | ||
*/ | ||
u, | ||
l, | ||
d, | ||
s, | ||
// add support to foreignObject, children will escape from svg | ||
!l && n, | ||
!u && n, | ||
o && e.type == "foreignObject" ? !1 : o | ||
); | ||
} | ||
return t[s] = { vnode: e, handlers: c, fragment: u, cycle: l + 1 }, t; | ||
return t[s] = { vnode: e, handlers: c, fragment: l, cycle: u + 1 }, t; | ||
} | ||
@@ -485,6 +485,6 @@ function Fe(e, t) { | ||
function Me(e, t, s, n, o, r) { | ||
e = e == null ? null : le(e) ? e : [e]; | ||
const i = t || Fe(s, o), { markStart: f, markEnd: l, keyes: u } = i; | ||
e = e == null ? null : ue(e) ? e : [e]; | ||
const i = t || Fe(s, o), { markStart: f, markEnd: u, keyes: l } = i; | ||
let c; | ||
const h = u && /* @__PURE__ */ new Set(); | ||
const h = l && /* @__PURE__ */ new Set(); | ||
let a = f; | ||
@@ -494,5 +494,5 @@ if (e && kt(e, (d) => { | ||
return; | ||
const y = d[R] && d.key, D = u && y != null && u.get(y); | ||
a != l && a === D ? h.delete(a) : a = a == l ? l : a.nextSibling; | ||
const m = u ? D : a; | ||
const y = d[R] && d.key, D = l && y != null && l.get(y); | ||
a != u && a === D ? h.delete(a) : a = a == u ? u : a.nextSibling; | ||
const m = l ? D : a; | ||
let w = m; | ||
@@ -505,5 +505,5 @@ if (d[R]) | ||
} | ||
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)); | ||
}), a = a == l ? l : a.nextSibling, t && a != l) | ||
for (; a != l; ) { | ||
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)); | ||
}), a = a == u ? u : a.nextSibling, t && a != u) | ||
for (; a != u; ) { | ||
const d = a; | ||
@@ -529,13 +529,13 @@ a = a.nextSibling, d.remove(); | ||
s = s || "", n = n || ""; | ||
const f = A(s), l = A(n); | ||
const f = A(s), u = A(n); | ||
if (f) | ||
for (const u in s) | ||
if (l) | ||
!(u in n) && pt(i, u, null); | ||
for (const l in s) | ||
if (u) | ||
!(l in n) && pt(i, l, null); | ||
else | ||
break; | ||
if (l) | ||
for (const u in n) { | ||
const c = n[u]; | ||
f && s[u] === c || pt(i, u, c); | ||
if (u) | ||
for (const l in n) { | ||
const c = n[l]; | ||
f && s[l] === c || pt(i, l, c); | ||
} | ||
@@ -640,3 +640,3 @@ else | ||
return t.value = e, t; | ||
}, 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)}`; | ||
}, 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)}`; | ||
function z() { | ||
@@ -653,3 +653,3 @@ const e = new Date(Date.now()); | ||
} | ||
function lt(e) { | ||
function ut(e) { | ||
return g.from(new Date(Date.UTC(e.year, e.month, 0))); | ||
@@ -680,3 +680,3 @@ } | ||
function je(e, t = 0) { | ||
const s = B(e.toPlainDate(), t), n = Ht(lt(e), t); | ||
const s = B(e.toPlainDate(), t), n = Ht(ut(e), t); | ||
return $e(Ye(s, n), 7); | ||
@@ -704,7 +704,7 @@ } | ||
function We(e, t) { | ||
const s = new g(t, e.month, 1), n = lt(s), o = e.toDate(); | ||
const s = new g(t, e.month, 1), n = ut(s), o = e.toDate(); | ||
return o.setUTCFullYear(t), H(g.from(o), s, n); | ||
} | ||
function Ke(e, t) { | ||
const s = new g(e.year, t, 1), n = lt(s), o = e.toDate(); | ||
const s = new g(e.year, t, 1), n = ut(s), o = e.toDate(); | ||
return o.setUTCMonth(t - 1), H(g.from(o), s, n); | ||
@@ -840,3 +840,3 @@ } | ||
function tn({ props: e, context: t }) { | ||
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( | ||
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( | ||
() => f.start.add({ months: s }), | ||
@@ -884,3 +884,3 @@ [f, s] | ||
function ne(p) { | ||
const E = D.equals(p), se = p.equals(y), dt = p.equals(u), ht = p.toDate(), x = o?.(ht), mt = !rt(p, r, i); | ||
const E = D.equals(p), se = p.equals(y), dt = p.equals(l), ht = p.toDate(), x = o?.(ht), mt = !rt(p, r, i); | ||
let k = !1, yt = !1, W = !1, K = !1; | ||
@@ -962,3 +962,3 @@ if ("highlightedRange" in t) { | ||
} | ||
const Tt = z(), ut = Le({ | ||
const Tt = z(), lt = Le({ | ||
firstDayOfWeek: 0, | ||
@@ -968,6 +968,6 @@ isDateDisallowed: () => !1, | ||
}); | ||
customElements.define("calendar-month-ctx", ut); | ||
customElements.define("calendar-month-ctx", lt); | ||
const en = $( | ||
(e) => { | ||
const t = _e(ut), s = ae(), n = tn({ props: e, context: t }); | ||
const t = _e(lt), s = ae(), n = tn({ props: e, context: t }); | ||
function o() { | ||
@@ -983,5 +983,5 @@ s.current.querySelector("button[tabindex='0']")?.focus(); | ||
] })) }) }), | ||
/* @__PURE__ */ b("tbody", { children: n.weeks.map((r, i) => /* @__PURE__ */ b("tr", { part: "tr week", children: r.map((f, l) => { | ||
const u = n.yearMonth.equals(f), c = t.showOutsideDays || u; | ||
return /* @__PURE__ */ b("td", { part: "td", children: c && /* @__PURE__ */ b("button", { ...n.getDayProps(f), children: f.day }) }, l); | ||
/* @__PURE__ */ b("tbody", { children: n.weeks.map((r, i) => /* @__PURE__ */ b("tr", { part: "tr week", children: r.map((f, u) => { | ||
const l = n.yearMonth.equals(f), c = t.showOutsideDays || l; | ||
return /* @__PURE__ */ b("td", { part: "td", children: c && /* @__PURE__ */ b("button", { ...n.getDayProps(f), children: f.day }) }, u); | ||
}) }, i)) }) | ||
@@ -1032,3 +1032,3 @@ ] }) | ||
/* @__PURE__ */ b( | ||
ut, | ||
lt, | ||
{ | ||
@@ -1088,6 +1088,6 @@ value: e, | ||
}); | ||
function l(m) { | ||
function u(m) { | ||
f(m), o(m.focusedDate.toDate()); | ||
} | ||
function u(m) { | ||
function l(m) { | ||
f(i.adjust(m)); | ||
@@ -1106,9 +1106,9 @@ } | ||
handleFocus(m) { | ||
m.stopPropagation(), u(m.detail), o(m.detail.toDate()), setTimeout(h); | ||
m.stopPropagation(), l(m.detail), o(m.detail.toDate()), setTimeout(h); | ||
}, | ||
setFocusedDate: u, | ||
setFocusedDate: l, | ||
min: s, | ||
max: n, | ||
next: y ? () => l(i.next()) : void 0, | ||
previous: D ? () => l(i.prev()) : void 0, | ||
next: y ? () => u(i.next()) : void 0, | ||
previous: D ? () => u(i.prev()) : void 0, | ||
focus: h | ||
@@ -1146,6 +1146,6 @@ }; | ||
}, [t]); | ||
async function l(a) { | ||
n.handleFocus(a), u(a); | ||
async function u(a) { | ||
n.handleFocus(a), l(a); | ||
} | ||
function u(a) { | ||
function l(a) { | ||
a.stopPropagation(), f((d) => d && { ...d, second: a.detail }); | ||
@@ -1164,4 +1164,4 @@ } | ||
highlightedRange: h, | ||
onFocus: l, | ||
onHover: u, | ||
onFocus: u, | ||
onHover: l, | ||
onSelect: c | ||
@@ -1168,0 +1168,0 @@ } |
{ | ||
"name": "cally", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "small, feature-rich calendar components", | ||
@@ -51,2 +51,3 @@ "license": "MIT", | ||
"astro": "^4.5.10", | ||
"postcss-nesting": "^12.1.1", | ||
"prettier": "^3.2.5", | ||
@@ -53,0 +54,0 @@ "typescript": "^5.3.3", |
51262
16