cally 0.5.3 → 0.6.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.d.ts CHANGED
@@ -79,6 +79,37 @@ export declare const CalendarMonth: Atomico<{
79
79
 
80
80
  export declare type CalendarMonthProps = ComponentProps<typeof CalendarMonth>;
81
81
 
82
+ export declare const CalendarMulti: Atomico<{
83
+ months: number;
84
+ value: string;
85
+ firstDayOfWeek: DaysOfWeek;
86
+ isDateDisallowed: (date: Date) => boolean;
87
+ min: string;
88
+ max: string;
89
+ locale: string | undefined;
90
+ focusedDate: string | undefined;
91
+ onFocusDay: (event: CustomEvent<Date>) => any;
92
+ showOutsideDays: boolean;
93
+ onChange: (event: Event) => any;
94
+ } & {}, {
95
+ months: number;
96
+ value: string;
97
+ firstDayOfWeek: DaysOfWeek;
98
+ isDateDisallowed: (date: Date) => boolean;
99
+ min: string;
100
+ max: string;
101
+ locale: string | undefined;
102
+ focusedDate: string | undefined;
103
+ onFocusDay: (event: CustomEvent<Date>) => any;
104
+ showOutsideDays: boolean;
105
+ onChange: (event: Event) => any;
106
+ } & {}, {
107
+ new (): HTMLElement;
108
+ prototype: HTMLElement;
109
+ }>;
110
+
111
+ export declare type CalendarMultiProps = ComponentProps<typeof CalendarMulti>;
112
+
82
113
  export declare const CalendarRange: Atomico<{
83
114
  months: number;
84
115
  value: string;
package/dist/cally.js CHANGED
@@ -29,38 +29,38 @@ class te {
29
29
  return this.#e.add(t), () => this.#e.delete(t);
30
30
  }
31
31
  }
32
- const Pt = (e) => new te(e), Q = Symbol.for("atomico.hooks");
33
- globalThis[Q] = globalThis[Q] || {};
34
- let N = globalThis[Q];
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
- const { i: s, hooks: o } = N.c, r = o[s] = o[s] || {};
37
- return r.value = e(r.value), r.effect = t, r.tag = n, N.c.i++, o[s].value;
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) => {
32
+ const At = (e) => new te(e), V = Symbol.for("atomico.hooks");
33
+ globalThis[V] = globalThis[V] || {};
34
+ let k = globalThis[V];
35
+ const ee = Symbol.for("Atomico.suspense"), Ft = Symbol.for("Atomico.effect"), ne = Symbol.for("Atomico.layoutEffect"), Rt = Symbol.for("Atomico.insertionEffect"), M = (e, t, n) => {
36
+ const { i: s, hooks: o } = k.c, r = o[s] = o[s] || {};
37
+ return r.value = e(r.value), r.effect = t, r.tag = n, k.c.i++, o[s].value;
38
+ }, se = (e) => M((t = At(e)) => t), L = () => M((e = At(k.c.host)) => e), It = () => k.c.update, oe = (e, t, n = 0) => {
39
39
  let s = {}, o = !1;
40
- const r = () => o, c = (i, u) => {
40
+ const r = () => o, c = (i, f) => {
41
41
  for (const d in s) {
42
42
  const l = s[d];
43
- l.effect && l.tag === i && (l.value = l.effect(l.value, u));
43
+ l.effect && l.tag === i && (l.value = l.effect(l.value, f));
44
44
  }
45
45
  };
46
46
  return { load: (i) => {
47
- N.c = { host: t, hooks: s, update: e, i: 0, id: n };
48
- let u;
47
+ k.c = { host: t, hooks: s, update: e, i: 0, id: n };
48
+ let f;
49
49
  try {
50
- o = !1, u = i();
50
+ o = !1, f = i();
51
51
  } catch (d) {
52
52
  if (d !== ee)
53
53
  throw d;
54
54
  o = !0;
55
55
  } finally {
56
- N.c = null;
56
+ k.c = null;
57
57
  }
58
- return u;
59
- }, cleanEffects: (i) => (c(kt, i), () => (c(ne, i), () => {
60
- c(Nt, i);
58
+ return f;
59
+ }, cleanEffects: (i) => (c(Rt, i), () => (c(ne, i), () => {
60
+ c(Ft, i);
61
61
  })), isSuspense: r };
62
- }, O = Symbol.for;
63
- function At(e, t) {
62
+ }, A = Symbol.for;
63
+ function $t(e, t) {
64
64
  const n = e.length;
65
65
  if (n !== t.length)
66
66
  return !1;
@@ -71,27 +71,27 @@ function At(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, V = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
75
- function Rt(e, t) {
74
+ const C = (e) => typeof e == "function", R = (e) => typeof e == "object", { isArray: re } = Array, tt = (e, t) => (t ? e instanceof HTMLStyleElement : !0) && "hydrate" in (e?.dataset || {});
75
+ function Ut(e, t) {
76
76
  let n;
77
77
  const s = (o) => {
78
78
  let { length: r } = o;
79
79
  for (let c = 0; c < r; c++) {
80
- const f = o[c];
81
- if (f && Array.isArray(f))
82
- s(f);
80
+ const u = o[c];
81
+ if (u && Array.isArray(u))
82
+ s(u);
83
83
  else {
84
- const a = typeof f;
85
- if (f == null || a === "function" || a === "boolean")
84
+ const a = typeof u;
85
+ if (u == null || a === "function" || a === "boolean")
86
86
  continue;
87
- a === "string" || a === "number" ? (n == null && (n = ""), n += f) : (n != null && (t(n), n = null), t(f));
87
+ a === "string" || a === "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 Mt = (e, t, n) => (e.addEventListener(t, n), () => e.removeEventListener(t, n));
94
- class Ft {
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,19 +102,19 @@ class Ft {
102
102
  this.message = n, this.target = t, this.value = s;
103
103
  }
104
104
  }
105
- class It extends Ft {
105
+ class jt extends _t {
106
106
  }
107
- class ce extends Ft {
107
+ class ce extends _t {
108
108
  }
109
- const j = "Custom", ie = null, ae = { true: 1, "": 1, 1: 1 };
109
+ const q = "Custom", ae = null, ie = { true: 1, "": 1, 1: 1 };
110
110
  function le(e, t, n, s, o) {
111
111
  const {
112
112
  type: r,
113
113
  reflect: c,
114
- event: f,
114
+ event: u,
115
115
  value: a,
116
116
  attr: i = ue(t)
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;
117
+ } = n?.name != q && R(n) && n != ae ? n : { type: n }, f = r?.name === q && r.map, d = a != null ? r == Function || !C(a) ? () => a : a : null;
118
118
  Object.defineProperty(e, t, {
119
119
  configurable: !0,
120
120
  /**
@@ -124,17 +124,17 @@ function le(e, t, n, s, o) {
124
124
  set(l) {
125
125
  const m = this[t];
126
126
  d && r != Boolean && l == null && (l = d());
127
- const { error: p, value: y } = (u ? he : me)(
127
+ const { error: p, value: y } = (f ? he : me)(
128
128
  r,
129
129
  l
130
130
  );
131
131
  if (p && y != null)
132
- throw new It(
132
+ throw new jt(
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 && $t(this, f), this.updated.then(() => {
137
+ m != y && (this._props[t] = y ?? void 0, this.update(), u && Yt(this, u), 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 $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(
149
+ const Yt = (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 === 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 : (
151
+ t?.name === q && t?.serialize ? t?.serialize(s) : R(s) ? JSON.stringify(s) : t == Boolean ? "" : s
152
+ ), de = (e, t) => e == Boolean ? !!ie[t] : e == Number ? Number(t) : e == String ? t : e == Array || e == Object ? JSON.parse(t) : e.name == q ? 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,32 +172,32 @@ let ye = 0;
172
172
  const pe = (e) => {
173
173
  const t = (e?.dataset || {})?.hydrate || "";
174
174
  return t || "c" + ye++;
175
- }, Y = (e, t = HTMLElement) => {
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;
175
+ }, _ = (e, t = HTMLElement) => {
176
+ const n = {}, s = {}, o = "prototype" in t && t.prototype instanceof Element, r = o ? t : "base" in t ? t.base : HTMLElement, { props: c, styles: u } = o ? e : t;
177
177
  class a extends r {
178
178
  constructor() {
179
179
  super(), this._setup(), this._render = () => e({ ...this._props });
180
- for (const u in s)
181
- this[u] = s[u];
180
+ for (const f in s)
181
+ this[f] = s[f];
182
182
  }
183
183
  /**
184
184
  * @returns {import("core").Sheets[]}
185
185
  */
186
186
  static get styles() {
187
- return [super.styles, f];
187
+ return [super.styles, u];
188
188
  }
189
189
  async _setup() {
190
190
  if (this._props)
191
191
  return;
192
192
  this._props = {};
193
- let u, d;
193
+ let f, d;
194
194
  this.mounted = new Promise(
195
195
  (E) => this.mount = () => {
196
- E(), u != this.parentNode && (d != u ? this.unmounted.then(this.update) : this.update()), u = this.parentNode;
196
+ E(), f != this.parentNode && (d != f ? this.unmounted.then(this.update) : this.update()), f = this.parentNode;
197
197
  }
198
198
  ), this.unmounted = new Promise(
199
199
  (E) => this.unmount = () => {
200
- E(), (u != this.parentNode || !this.isConnected) && (l.cleanEffects(!0)()(), d = this.parentNode, u = null);
200
+ E(), (f != this.parentNode || !this.isConnected) && (l.cleanEffects(!0)()(), d = this.parentNode, f = null);
201
201
  }
202
202
  ), this.symbolId = this.symbolId || Symbol(), this.symbolIdParent = Symbol();
203
203
  const l = oe(
@@ -206,7 +206,7 @@ const pe = (e) => {
206
206
  pe(this)
207
207
  );
208
208
  let m, p = !0;
209
- const y = V(this);
209
+ const y = tt(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();
@@ -236,31 +236,31 @@ const pe = (e) => {
236
236
  * @param {(string|null)} oldValue
237
237
  * @param {(string|null)} value
238
238
  */
239
- attributeChangedCallback(u, d, l) {
240
- if (n[u]) {
241
- if (u === this._ignoreAttr || d === l)
239
+ attributeChangedCallback(f, d, l) {
240
+ if (n[f]) {
241
+ if (f === this._ignoreAttr || d === l)
242
242
  return;
243
- const { prop: m, type: p } = n[u];
243
+ const { prop: m, type: p } = n[f];
244
244
  try {
245
245
  this[m] = de(p, l);
246
246
  } catch {
247
247
  throw new ce(
248
248
  this,
249
- `The value defined as attr '${u}' cannot be parsed by type '${p.name}'`,
249
+ `The value defined as attr '${f}' cannot be parsed by type '${p.name}'`,
250
250
  l
251
251
  );
252
252
  }
253
253
  } else
254
- super.attributeChangedCallback(u, d, l);
254
+ super.attributeChangedCallback(f, d, l);
255
255
  }
256
256
  static get props() {
257
257
  return { ...super.props, ...c };
258
258
  }
259
259
  static get observedAttributes() {
260
- const u = super.observedAttributes || [];
260
+ const f = super.observedAttributes || [];
261
261
  for (const d in c)
262
262
  le(this.prototype, d, c[d], n, s);
263
- return Object.keys(n).concat(u);
263
+ return Object.keys(n).concat(f);
264
264
  }
265
265
  }
266
266
  return a;
@@ -269,26 +269,26 @@ function be(e) {
269
269
  const { styles: t } = e.constructor, { shadowRoot: n } = e;
270
270
  if (n && t.length) {
271
271
  const s = [];
272
- Rt(t, (o) => {
272
+ Ut(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
  }
276
276
  }
277
- const Ut = (e) => (t, n) => {
278
- k(
277
+ const qt = (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, o] = []) => ((o || !o) && (o && At(o, n) ? s = s || !0 : (T(s) && s(), s = null)), [s, n]),
283
+ ([s, o] = []) => ((o || !o) && (o && $t(o, n) ? s = s || !0 : (C(s) && s(), s = null)), [s, n]),
284
284
  /**
285
285
  * @returns {any}
286
286
  */
287
- ([s, o], r) => r ? (T(s) && s(), []) : [s || t(), o],
287
+ ([s, o], r) => r ? (C(s) && s(), []) : [s || t(), o],
288
288
  e
289
289
  );
290
- }, ot = Ut(Nt), ge = Ut(kt);
291
- class Lt extends Array {
290
+ }, ot = qt(Ft), ge = qt(Rt);
291
+ class xt extends Array {
292
292
  /**
293
293
  *
294
294
  * @param {any} initialState
@@ -319,40 +319,40 @@ class Lt extends Array {
319
319
  // }
320
320
  }
321
321
  const rt = (e) => {
322
- const t = Ot();
323
- return k(
324
- (n = new Lt(e, (s, o, r) => {
325
- s = T(s) ? s(o[0]) : s, s !== o[0] && (o[0] = s, r || t());
322
+ const t = It();
323
+ return M(
324
+ (n = new xt(e, (s, o, r) => {
325
+ s = C(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 && !At(o, t)) && (s = e()), [s, t, r]));
329
+ const [n] = M(([s, o, r = 0] = []) => ((!o || o && !$t(o, t)) && (s = e()), [s, t, r]));
330
330
  return n;
331
- }, _t = (e) => {
332
- const { current: t } = U();
331
+ }, ct = (e) => {
332
+ const { current: t } = L();
333
333
  if (!(e in t))
334
- throw new It(
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 k(
340
- (n = new Lt(t[e], (s, o) => {
341
- s = T(s) ? s(t[e]) : s, t[e] = s;
339
+ return M(
340
+ (n = new xt(t[e], (s, o) => {
341
+ s = C(s) ? s(t[e]) : s, t[e] = s;
342
342
  })) => (n[0] = t[e], n)
343
343
  );
344
- }, C = (e, t = {}) => {
345
- const n = U();
346
- return n[e] || (n[e] = (s = t.detail) => $t(n.current, {
344
+ }, T = (e, t = {}) => {
345
+ const n = L();
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
- }, tt = O("atomico/options");
352
- globalThis[tt] = globalThis[tt] || {
351
+ }, et = A("atomico/options");
352
+ globalThis[et] = globalThis[et] || {
353
353
  sheet: !!document.adoptedStyleSheets
354
354
  };
355
- const jt = globalThis[tt], Ee = {
355
+ const Bt = globalThis[et], Ee = {
356
356
  checked: 1,
357
357
  value: 1,
358
358
  selected: 1
@@ -372,18 +372,18 @@ const jt = globalThis[tt], Ee = {
372
372
  cloneNode: 1,
373
373
  children: 1,
374
374
  key: 1
375
- }, _ = {}, et = [];
376
- class nt extends Text {
375
+ }, Y = {}, nt = [];
376
+ class st extends Text {
377
377
  }
378
- const we = O("atomico/id"), M = O("atomico/type"), J = O("atomico/ref"), Yt = O("atomico/vnode"), ve = () => {
378
+ const ve = A("atomico/id"), I = A("atomico/type"), Z = A("atomico/ref"), zt = A("atomico/vnode"), we = () => {
379
379
  };
380
- function Te(e, t, n) {
381
- return Bt(this, e, t, n);
380
+ function Ce(e, t, n) {
381
+ return Kt(this, e, t, n);
382
382
  }
383
- const xt = (e, t, ...n) => {
384
- const s = t || _;
383
+ const Ht = (e, t, ...n) => {
384
+ const s = t || Y;
385
385
  let { children: o } = s;
386
- if (o = o ?? (n.length ? n : et), e === ve)
386
+ if (o = o ?? (n.length ? n : nt), e === we)
387
387
  return o;
388
388
  const r = e ? e instanceof Node ? 1 : (
389
389
  //@ts-ignore
@@ -391,11 +391,11 @@ const xt = (e, t, ...n) => {
391
391
  ) : 0;
392
392
  if (r === !1 && e instanceof Function)
393
393
  return e(
394
- o != et ? { children: o, ...s } : s
394
+ o != nt ? { children: o, ...s } : s
395
395
  );
396
- const c = jt.render || Te;
396
+ const c = Bt.render || Ce;
397
397
  return {
398
- [M]: Yt,
398
+ [I]: zt,
399
399
  type: e,
400
400
  props: s,
401
401
  children: o,
@@ -414,24 +414,24 @@ const xt = (e, t, ...n) => {
414
414
  render: c
415
415
  };
416
416
  };
417
- function Bt(e, t, n = we, s, o) {
417
+ function Kt(e, t, n = ve, s, o) {
418
418
  let r;
419
- if (t && t[n] && t[n].vnode == e || e[M] != Yt)
419
+ if (t && t[n] && t[n].vnode == e || e[I] != zt)
420
420
  return t;
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(
421
+ (e || !t) && (o = o || e.type == "svg", r = 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), r && 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() : o ? 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] : _, { vnode: f = _, cycle: a = 0 } = c;
429
- let { fragment: i, handlers: u } = c;
430
- const { children: d = et, props: l = _ } = f;
431
- if (u = r ? {} : u || {}, e.static && !r)
428
+ const c = t[n] ? t[n] : Y, { vnode: u = Y, cycle: a = 0 } = c;
429
+ let { fragment: i, handlers: f } = c;
430
+ const { children: d = nt, props: l = Y } = u;
431
+ if (f = r ? {} : f || {}, e.static && !r)
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, u, o), e.children !== d) {
434
+ t.attachShadow({ mode: "open", ...e.shadow }), e.props != l && Ne(t, l, e.props, f, o), e.children !== d) {
435
435
  const m = e.shadow ? t.shadowRoot : t;
436
436
  i = Pe(
437
437
  e.children,
@@ -446,16 +446,16 @@ function Bt(e, t, n = we, s, o) {
446
446
  o && e.type == "foreignObject" ? !1 : o
447
447
  );
448
448
  }
449
- return t[n] = { vnode: e, handlers: u, fragment: i, cycle: a + 1 }, t;
449
+ return t[n] = { vnode: e, handlers: f, fragment: i, cycle: a + 1 }, t;
450
450
  }
451
- function Ce(e, t) {
452
- const n = new nt(""), s = new nt("");
451
+ function Te(e, t) {
452
+ const n = new st(""), s = new st("");
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 (V(r, !0) && !V(c, !0)) {
458
+ if (tt(r, !0) && !tt(c, !0)) {
459
459
  o = r;
460
460
  break;
461
461
  }
@@ -469,63 +469,63 @@ function Ce(e, t) {
469
469
  }
470
470
  function Pe(e, t, n, s, o, r) {
471
471
  e = e == null ? null : re(e) ? e : [e];
472
- const c = t || Ce(n, o), { markStart: f, markEnd: a, keyes: i } = c;
473
- let u;
472
+ const c = t || Te(n, o), { markStart: u, markEnd: a, keyes: i } = c;
473
+ let f;
474
474
  const d = i && /* @__PURE__ */ new Set();
475
- let l = f;
476
- if (e && Rt(e, (m) => {
477
- if (typeof m == "object" && !m[M])
475
+ let l = u;
476
+ if (e && Ut(e, (m) => {
477
+ if (typeof m == "object" && !m[I])
478
478
  return;
479
- const p = m[M] && m.key, y = i && p != null && i.get(p);
479
+ const p = m[I] && m.key, y = i && p != null && i.get(p);
480
480
  l != a && l === y ? d.delete(l) : l = l == a ? a : l.nextSibling;
481
481
  const E = i ? y : l;
482
482
  let h = E;
483
- if (m[M])
484
- h = Bt(m, E, s, o, r);
483
+ if (m[I])
484
+ h = Kt(m, E, s, o, r);
485
485
  else {
486
- const v = m + "";
487
- !(h instanceof Text) || h instanceof nt ? h = new Text(v) : h.data != v && (h.data = v);
486
+ const w = m + "";
487
+ !(h instanceof Text) || h instanceof st ? h = new Text(w) : h.data != w && (h.data = w);
488
488
  }
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));
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 && (f = f || /* @__PURE__ */ new Map(), f.set(p, h));
490
490
  }), l = l == a ? a : l.nextSibling, t && l != a)
491
491
  for (; l != a; ) {
492
492
  const m = l;
493
493
  l = l.nextSibling, m.remove();
494
494
  }
495
- return d && d.forEach((m) => m.remove()), c.keyes = u, c;
495
+ return d && d.forEach((m) => m.remove()), c.keyes = f, c;
496
496
  }
497
497
  function Ne(e, t, n, s, o) {
498
498
  for (const r in t)
499
- !(r in n) && pt(e, r, t[r], null, o, s);
499
+ !(r in n) && St(e, r, t[r], null, o, s);
500
500
  for (const r in n)
501
- pt(e, r, t[r], n[r], o, s);
501
+ St(e, r, t[r], n[r], o, s);
502
502
  }
503
- function pt(e, t, n, s, o, r) {
503
+ function St(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
- if (t[0] == "o" && t[1] == "n" && (T(s) || T(n)))
505
+ if (t[0] == "o" && t[1] == "n" && (C(s) || C(n)))
506
506
  ke(e, t.slice(2), s, r);
507
507
  else if (t == "ref")
508
- s && (T(s) ? s(e) : s.current = e);
508
+ s && (C(s) ? s(e) : s.current = e);
509
509
  else if (t == "style") {
510
510
  const { style: c } = e;
511
511
  n = n || "", s = s || "";
512
- const f = R(n), a = R(s);
513
- if (f)
512
+ const u = R(n), a = R(s);
513
+ if (u)
514
514
  for (const i in n)
515
515
  if (a)
516
- !(i in s) && bt(c, i, null);
516
+ !(i in s) && vt(c, i, null);
517
517
  else
518
518
  break;
519
519
  if (a)
520
520
  for (const i in s) {
521
- const u = s[i];
522
- f && n[i] === u || bt(c, i, u);
521
+ const f = s[i];
522
+ u && n[i] === f || vt(c, i, f);
523
523
  }
524
524
  else
525
525
  c.cssText = s;
526
526
  } else {
527
527
  const c = t[0] == "$" ? t.slice(1) : t;
528
- c === t && (!o && !De[t] && t in e || T(s) || T(n)) ? e[t] = s ?? "" : s == null ? e.removeAttribute(c) : e.setAttribute(
528
+ c === t && (!o && !De[t] && t in e || C(s) || C(n)) ? e[t] = s ?? "" : s == null ? e.removeAttribute(c) : e.setAttribute(
529
529
  c,
530
530
  R(s) ? JSON.stringify(s) : s
531
531
  );
@@ -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 bt(e, t, n) {
544
+ function vt(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 gt = {};
549
- function x(e, ...t) {
548
+ const wt = {};
549
+ function B(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 gt[n] = gt[n] || Oe(n);
554
+ return wt[n] = wt[n] || Oe(n);
555
555
  }
556
556
  function Oe(e) {
557
- if (jt.sheet) {
557
+ if (Bt.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 = xt("host", { style: "display: contents" }), Z = O("atomico/context"), Re = (e, t) => {
566
- const n = U();
565
+ const Me = Ht("host", { style: "display: contents" }), W = A("atomico/context"), Ae = (e, t) => {
566
+ const n = L();
567
567
  ge(
568
- () => Mt(
568
+ () => Lt(
569
569
  n.current,
570
570
  "ConnectContext",
571
571
  /**
@@ -577,8 +577,8 @@ const Ae = xt("host", { style: "display: contents" }), Z = O("atomico/context"),
577
577
  ),
578
578
  [e]
579
579
  );
580
- }, Me = (e) => {
581
- const t = C("ConnectContext", {
580
+ }, Fe = (e) => {
581
+ const t = T("ConnectContext", {
582
582
  bubbles: !0,
583
583
  composed: !0
584
584
  }), n = () => {
@@ -593,21 +593,21 @@ const Ae = xt("host", { style: "display: contents" }), Z = O("atomico/context"),
593
593
  n
594
594
  );
595
595
  return ot(() => {
596
- s || (e[Z] || (e[Z] = customElements.whenDefined(
596
+ s || (e[W] || (e[W] = customElements.whenDefined(
597
597
  new e().localName
598
- )), e[Z].then(
598
+ )), e[W].then(
599
599
  () => o(n)
600
600
  ));
601
601
  }, [e]), s;
602
- }, Fe = (e) => {
603
- const t = Me(e), n = Ot();
602
+ }, Re = (e) => {
603
+ const t = Fe(e), n = It();
604
604
  return ot(() => {
605
605
  if (t)
606
- return Mt(t, "UpdatedValue", n);
606
+ return Lt(t, "UpdatedValue", n);
607
607
  }, [t]), (t || e).value;
608
608
  }, Ie = (e) => {
609
- const t = Y(
610
- () => (Re(t, U().current), Ae),
609
+ const t = _(
610
+ () => (Ae(t, L().current), Me),
611
611
  {
612
612
  props: {
613
613
  value: {
@@ -619,27 +619,27 @@ const Ae = xt("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, 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
- function ct() {
622
+ }, b = (e, t, n) => (t == null ? t = { key: n } : t.key = n, Ht(e, t)), $ = b, Jt = B`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`, Zt = B`.vh{position:absolute;transform:scale(0)}`;
623
+ function at() {
624
624
  return D.from(/* @__PURE__ */ new Date());
625
625
  }
626
626
  function it(e, t = 0) {
627
- const n = w(e), s = n.getUTCDay(), o = (s < t ? 7 : 0) + s - t;
627
+ const n = v(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 Ht(e, t = 0) {
630
+ function Wt(e, t = 0) {
631
631
  return it(e, t).add({ days: 6 });
632
632
  }
633
- function Kt(e) {
633
+ function Xt(e) {
634
634
  return D.from(new Date(Date.UTC(e.year, e.month, 0)));
635
635
  }
636
- function B(e, t, n) {
636
+ function z(e, t, n) {
637
637
  return t && D.compare(e, t) < 0 ? t : n && D.compare(e, n) > 0 ? n : e;
638
638
  }
639
639
  const $e = { days: 1 };
640
640
  function Ue(e, t = 0) {
641
641
  let n = it(e.toPlainDate(), t);
642
- const s = Ht(Kt(e), t), o = [];
642
+ const s = Wt(Xt(e), t), o = [];
643
643
  for (; D.compare(n, s) < 0; ) {
644
644
  const r = [];
645
645
  for (let c = 0; c < 7; c++)
@@ -648,10 +648,10 @@ function Ue(e, t = 0) {
648
648
  }
649
649
  return o;
650
650
  }
651
- function w(e) {
651
+ function v(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])$/, W = (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])$/, X = (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;
@@ -660,19 +660,19 @@ class D {
660
660
  // i didn't want to get into more complex arithmetic since it get tricky fast
661
661
  // this is enough to serve my needs and will still be a drop-in replacement when actual Temporal API lands
662
662
  add(t) {
663
- const n = w(this);
663
+ const n = v(this);
664
664
  if ("days" in t)
665
665
  return n.setUTCDate(this.day + t.days), D.from(n);
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
- const r = D.from(w({ year: s, month: o, day: 1 }));
669
- return B(D.from(n), r, Kt(r));
668
+ const r = D.from(v({ year: s, month: o, day: 1 }));
669
+ return z(D.from(n), r, Xt(r));
670
670
  }
671
671
  toString() {
672
- return `${W(this.year, 4)}-${W(this.month, 2)}-${W(this.day, 2)}`;
672
+ return `${X(this.year, 4)}-${X(this.month, 2)}-${X(this.day, 2)}`;
673
673
  }
674
674
  toPlainYearMonth() {
675
- return new z(this.year, this.month);
675
+ return new H(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 z {
702
+ class H {
703
703
  constructor(t, n) {
704
704
  this.year = t, this.month = n;
705
705
  }
706
706
  add(t) {
707
- const n = w(this), s = (t.months ?? 0) + (t.years ?? 0) * 12;
708
- return n.setUTCMonth(n.getUTCMonth() + s), new z(n.getUTCFullYear(), n.getUTCMonth() + 1);
707
+ const n = v(this), s = (t.months ?? 0) + (t.years ?? 0) * 12;
708
+ return n.setUTCMonth(n.getUTCMonth() + s), new H(n.getUTCFullYear(), n.getUTCMonth() + 1);
709
709
  }
710
710
  equals(t) {
711
711
  return this.year === t.year && this.month === t.month;
@@ -714,74 +714,80 @@ class z {
714
714
  return new D(this.year, this.month, 1);
715
715
  }
716
716
  }
717
- function st(e, t) {
717
+ function x(e, t) {
718
718
  if (t)
719
719
  try {
720
720
  return e.from(t);
721
721
  } catch {
722
722
  }
723
723
  }
724
- function I(e) {
725
- const [t, n] = _t(e);
726
- return [P(() => st(D, t), [t]), (r) => n(r.toString())];
724
+ function O(e) {
725
+ const [t, n] = ct(e);
726
+ return [P(() => x(D, t), [t]), (r) => n(r.toString())];
727
727
  }
728
728
  function _e(e) {
729
- if (e) {
730
- const [t, n] = e.split("/"), s = st(D, t), o = st(D, n);
731
- if (s && o)
732
- return [s, o];
733
- }
734
- return [];
729
+ const [t = "", n] = ct(e);
730
+ return [P(() => {
731
+ const [r, c] = t.split("/"), u = x(D, r), a = x(D, c);
732
+ return u && a ? [u, a] : [];
733
+ }, [t]), (r) => n(`${r[0]}/${r[1]}`)];
735
734
  }
736
735
  function je(e) {
737
- const [t, n] = _t(e);
738
- return [P(() => _e(t), [t]), (r) => n(`${r[0]}/${r[1]}`)];
736
+ const [t = "", n] = ct(e);
737
+ return [P(() => {
738
+ const r = [];
739
+ for (const c of t.trim().split(/\s+/)) {
740
+ const u = x(D, c);
741
+ u && r.push(u);
742
+ }
743
+ return r;
744
+ }, [t]), (r) => n(r.join(" "))];
739
745
  }
740
- function $(e, t) {
746
+ function U(e, t) {
741
747
  return P(
742
748
  () => new Intl.DateTimeFormat(t, { timeZone: "UTC", ...e }),
743
749
  [t, e]
744
750
  );
745
751
  }
746
- function Et(e, t, n) {
747
- const s = $(e, n);
752
+ function Ct(e, t, n) {
753
+ const s = U(e, n);
748
754
  return P(() => {
749
755
  const o = [], r = /* @__PURE__ */ new Date();
750
756
  for (var c = 0; c < 7; c++) {
751
- const f = (r.getDay() - t + 7) % 7;
752
- o[f] = s.format(r), r.setDate(r.getDate() + 1);
757
+ const u = (r.getDay() - t + 7) % 7;
758
+ o[u] = s.format(r), r.setDate(r.getDate() + 1);
753
759
  }
754
760
  return o;
755
761
  }, [t, s]);
756
762
  }
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
- function qe({ props: e, context: t }) {
763
+ const Tt = (e, t, n) => z(e, t, n) === e, Pt = (e) => e.target.matches(":dir(ltr)"), Ye = { month: "long", day: "numeric" }, qe = { month: "long" }, xe = { weekday: "narrow" }, Be = { weekday: "long" }, G = { bubbles: !0 };
764
+ function ze({ props: e, context: t }) {
759
765
  const { offset: n } = e, {
760
766
  firstDayOfWeek: s,
761
767
  isDateDisallowed: o,
762
768
  min: r,
763
769
  max: c,
764
- page: f,
770
+ page: u,
765
771
  locale: a,
766
772
  focusedDate: i
767
- } = t, u = ct(), d = Et(ze, s, a), l = Et(Be, s, a), m = $(Ye, a), p = $(xe, a), y = P(
768
- () => f.start.add({ months: n }),
769
- [f, n]
773
+ } = t, f = at(), d = Ct(Be, s, a), l = Ct(xe, s, a), m = U(Ye, a), p = U(qe, a), y = P(
774
+ () => u.start.add({ months: n }),
775
+ [u, n]
770
776
  ), E = P(
771
777
  () => Ue(y, s),
772
778
  [y, s]
773
- ), h = C("focusday", X), v = C("selectday", X), q = C("hoverday", X);
774
- function lt(g) {
775
- h(B(g, r, c));
779
+ ), h = T("focusday", G), w = T("selectday", G), K = T("hoverday", G);
780
+ function mt(g) {
781
+ h(z(g, r, c));
776
782
  }
777
783
  function Gt(g) {
778
784
  let S;
779
785
  switch (g.key) {
780
786
  case "ArrowRight":
781
- S = i.add({ days: St(g) ? 1 : -1 });
787
+ S = i.add({ days: Pt(g) ? 1 : -1 });
782
788
  break;
783
789
  case "ArrowLeft":
784
- S = i.add({ days: St(g) ? -1 : 1 });
790
+ S = i.add({ days: Pt(g) ? -1 : 1 });
785
791
  break;
786
792
  case "ArrowDown":
787
793
  S = i.add({ days: 7 });
@@ -799,39 +805,39 @@ function qe({ props: e, context: t }) {
799
805
  S = it(i, s);
800
806
  break;
801
807
  case "End":
802
- S = Ht(i, s);
808
+ S = Wt(i, s);
803
809
  break;
804
810
  default:
805
811
  return;
806
812
  }
807
- lt(S), g.preventDefault();
813
+ mt(S), g.preventDefault();
808
814
  }
809
815
  function Qt(g) {
810
816
  const S = y.equals(g);
811
- if (!S && !t.showOutsideDays)
817
+ if (!t.showOutsideDays && !S)
812
818
  return;
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
- if ("highlightedRange" in t) {
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" : ""}`;
819
+ const Vt = g.equals(i), yt = g.equals(f), pt = v(g), j = o?.(pt), bt = !Tt(g, r, c);
820
+ let gt = "", N;
821
+ if (t.type === "range") {
822
+ const [F, J] = t.value, Et = F?.equals(g), Dt = J?.equals(g);
823
+ N = F && J && Tt(g, F, J), gt = `${Et ? "range-start" : ""} ${Dt ? "range-end" : ""} ${N && !Et && !Dt ? "range-inner" : ""}`;
818
824
  } else
819
- A = t.value?.equals(g);
825
+ t.type === "multi" ? N = t.value.some((F) => F.equals(g)) : N = t.value?.equals(g);
820
826
  return {
821
827
  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}`,
828
+ S ? N ? "selected" : "" : "outside"} ${j ? "disallowed" : ""} ${yt ? "today" : ""}`} ${gt}`,
823
829
  tabindex: S && Vt ? 0 : -1,
824
- disabled: dt,
825
- "aria-disabled": L ? "true" : void 0,
826
- "aria-pressed": S && A,
827
- "aria-current": ut ? "date" : void 0,
828
- "aria-label": m.format(ft),
830
+ disabled: bt,
831
+ "aria-disabled": j ? "true" : void 0,
832
+ "aria-pressed": S && N,
833
+ "aria-current": yt ? "date" : void 0,
834
+ "aria-label": m.format(pt),
829
835
  onkeydown: Gt,
830
836
  onclick() {
831
- L || v(g), lt(g);
837
+ j || w(g), mt(g);
832
838
  },
833
839
  onmouseover() {
834
- !L && !dt && q(g);
840
+ !j && !bt && K(g);
835
841
  }
836
842
  };
837
843
  }
@@ -844,29 +850,30 @@ function qe({ props: e, context: t }) {
844
850
  getDayProps: Qt
845
851
  };
846
852
  }
847
- const G = ct(), at = Ie({
853
+ const Q = at(), lt = Ie({
854
+ type: "date",
848
855
  firstDayOfWeek: 1,
849
856
  isDateDisallowed: () => !1,
850
- focusedDate: G,
851
- page: { start: G.toPlainYearMonth(), end: G.toPlainYearMonth() }
857
+ focusedDate: Q,
858
+ page: { start: Q.toPlainYearMonth(), end: Q.toPlainYearMonth() }
852
859
  });
853
- customElements.define("calendar-month-ctx", at);
854
- const He = Y(
860
+ customElements.define("calendar-month-ctx", lt);
861
+ const He = _(
855
862
  (e) => {
856
- const t = Fe(at), n = se(), s = qe({ props: e, context: t });
863
+ const t = Re(lt), n = se(), s = ze({ props: e, context: t });
857
864
  function o() {
858
865
  n.current.querySelector("button[tabindex='0']")?.focus();
859
866
  }
860
- return /* @__PURE__ */ F("host", { shadowDom: !0, focus: o, children: [
861
- /* @__PURE__ */ b("div", { id: "h", part: "heading", children: s.formatter.format(w(s.yearMonth)) }),
862
- /* @__PURE__ */ F("table", { ref: n, "aria-labelledby": "h", part: "table", children: [
863
- /* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { part: "tr head", children: s.daysLong.map((r, c) => /* @__PURE__ */ F("th", { part: "th", scope: "col", children: [
867
+ return /* @__PURE__ */ $("host", { shadowDom: !0, focus: o, children: [
868
+ /* @__PURE__ */ b("div", { id: "h", part: "heading", children: s.formatter.format(v(s.yearMonth)) }),
869
+ /* @__PURE__ */ $("table", { ref: n, "aria-labelledby": "h", part: "table", children: [
870
+ /* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { part: "tr head", children: s.daysLong.map((r, c) => /* @__PURE__ */ $("th", { part: "th", scope: "col", children: [
864
871
  /* @__PURE__ */ b("span", { class: "vh", children: r }),
865
872
  /* @__PURE__ */ b("span", { "aria-hidden": "true", children: s.daysShort[c] })
866
873
  ] })) }) }),
867
- /* @__PURE__ */ b("tbody", { children: s.weeks.map((r, c) => /* @__PURE__ */ b("tr", { part: "tr week", children: r.map((f, a) => {
868
- const i = s.getDayProps(f);
869
- return /* @__PURE__ */ b("td", { part: "td", children: i && /* @__PURE__ */ b("button", { ...i, children: f.day }) }, a);
874
+ /* @__PURE__ */ b("tbody", { children: s.weeks.map((r, c) => /* @__PURE__ */ b("tr", { part: "tr week", children: r.map((u, a) => {
875
+ const i = s.getDayProps(u);
876
+ return /* @__PURE__ */ b("td", { part: "td", children: i && /* @__PURE__ */ b("button", { ...i, children: u.day }) }, a);
870
877
  }) }, c)) })
871
878
  ] })
872
879
  ] });
@@ -879,14 +886,14 @@ const He = Y(
879
886
  }
880
887
  },
881
888
  styles: [
882
- zt,
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}`
889
+ Jt,
890
+ Zt,
891
+ B`: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}`
885
892
  ]
886
893
  }
887
894
  );
888
895
  customElements.define("calendar-month", He);
889
- function wt(e) {
896
+ function Nt(e) {
890
897
  return /* @__PURE__ */ b(
891
898
  "button",
892
899
  {
@@ -897,17 +904,17 @@ function wt(e) {
897
904
  }
898
905
  );
899
906
  }
900
- function Jt(e) {
901
- const t = w(e.page.start), n = w(e.page.end);
902
- return /* @__PURE__ */ F("div", { role: "group", "aria-labelledby": "h", part: "container", children: [
907
+ function ut(e) {
908
+ const t = v(e.page.start), n = v(e.page.end);
909
+ return /* @__PURE__ */ $("div", { role: "group", "aria-labelledby": "h", part: "container", children: [
903
910
  /* @__PURE__ */ b("div", { id: "h", class: "vh", "aria-live": "polite", "aria-atomic": "true", children: e.formatVerbose.formatRange(t, n) }),
904
- /* @__PURE__ */ F("div", { part: "header", children: [
905
- /* @__PURE__ */ b(wt, { name: "previous", onclick: e.previous, children: "Previous" }),
906
- /* @__PURE__ */ b("div", { part: "heading", "aria-hidden": "true", children: e.format.formatRange(t, n) }),
907
- /* @__PURE__ */ b(wt, { name: "next", onclick: e.next, children: "Next" })
911
+ /* @__PURE__ */ $("div", { part: "header", children: [
912
+ /* @__PURE__ */ b(Nt, { name: "previous", onclick: e.previous, children: "Previous" }),
913
+ /* @__PURE__ */ b("slot", { part: "heading", name: "heading", children: /* @__PURE__ */ b("div", { "aria-hidden": "true", children: e.format.formatRange(t, n) }) }),
914
+ /* @__PURE__ */ b(Nt, { name: "next", onclick: e.next, children: "Next" })
908
915
  ] }),
909
916
  /* @__PURE__ */ b(
910
- at,
917
+ lt,
911
918
  {
912
919
  value: e,
913
920
  onselectday: e.onSelect,
@@ -918,7 +925,7 @@ function Jt(e) {
918
925
  )
919
926
  ] });
920
927
  }
921
- const Zt = {
928
+ const ft = {
922
929
  value: {
923
930
  type: String,
924
931
  value: ""
@@ -957,55 +964,55 @@ const Zt = {
957
964
  value: () => {
958
965
  }
959
966
  }
960
- }, Wt = [
961
- zt,
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}`
967
+ }, dt = [
968
+ Jt,
969
+ Zt,
970
+ B`: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}`
964
971
  ], Ke = { year: "numeric" }, Je = { year: "numeric", month: "long" };
965
- function vt(e, t) {
972
+ function kt(e, t) {
966
973
  return (t.year - e.year) * 12 + t.month - e.month;
967
974
  }
968
- const Tt = (e, t) => (e = t === 12 ? new z(e.year, 1) : e, {
975
+ const Ot = (e, t) => (e = t === 12 ? new H(e.year, 1) : e, {
969
976
  start: e,
970
977
  end: e.add({ months: t - 1 })
971
978
  });
972
- function Xt({
979
+ function ht({
973
980
  months: e,
974
981
  locale: t,
975
982
  focusedDate: n,
976
983
  setFocusedDate: s
977
984
  }) {
978
- const [o] = I("min"), [r] = I("max"), c = C("focusday"), f = C("change"), a = P(
979
- () => B(n ?? ct(), o, r),
985
+ const [o] = O("min"), [r] = O("max"), c = T("focusday"), u = T("change"), a = P(
986
+ () => z(n ?? at(), o, r),
980
987
  [n, o, r]
981
- ), [i, u] = rt(
982
- () => Tt(a.toPlainYearMonth(), e)
988
+ ), [i, f] = rt(
989
+ () => Ot(a.toPlainYearMonth(), e)
983
990
  ), d = (h) => {
984
- const v = vt(i.start, h.toPlainYearMonth());
985
- return v >= 0 && v < e;
991
+ const w = kt(i.start, h.toPlainYearMonth());
992
+ return w >= 0 && w < e;
986
993
  };
987
994
  ot(() => {
988
995
  let h = i.start;
989
996
  if (!d(a)) {
990
- const v = vt(h, a.toPlainYearMonth()), q = Math.floor(v / e);
991
- h = h.add({ months: q * e });
997
+ const w = kt(h, a.toPlainYearMonth()), K = Math.floor(w / e);
998
+ h = h.add({ months: K * e });
992
999
  }
993
- u(Tt(h, e));
1000
+ f(Ot(h, e));
994
1001
  }, [a, e]);
995
- const l = U();
1002
+ const l = L();
996
1003
  function m() {
997
1004
  l.current.querySelectorAll("calendar-month").forEach((h) => h.focus());
998
1005
  }
999
1006
  function p(h) {
1000
- s(h), c(w(h));
1007
+ s(h), c(v(h));
1001
1008
  }
1002
- const y = $(Ke, t), E = $(Je, t);
1009
+ const y = U(Ke, t), E = U(Je, t);
1003
1010
  return {
1004
1011
  format: y,
1005
1012
  formatVerbose: E,
1006
1013
  page: i,
1007
1014
  focusedDate: a,
1008
- dispatch: f,
1015
+ dispatch: u,
1009
1016
  onFocus(h) {
1010
1017
  h.stopPropagation(), p(h.detail), setTimeout(m);
1011
1018
  },
@@ -1016,37 +1023,38 @@ function Xt({
1016
1023
  focus: m
1017
1024
  };
1018
1025
  }
1019
- const Ze = Y(
1026
+ const Ze = _(
1020
1027
  (e) => {
1021
- const [t, n] = I("value"), [s = t, o] = I("focusedDate"), r = Xt({
1028
+ const [t, n] = O("value"), [s = t, o] = O("focusedDate"), r = ht({
1022
1029
  ...e,
1023
1030
  focusedDate: s,
1024
1031
  setFocusedDate: o
1025
1032
  });
1026
- function c(f) {
1027
- n(f.detail), r.dispatch();
1033
+ function c(u) {
1034
+ n(u.detail), r.dispatch();
1028
1035
  }
1029
1036
  return /* @__PURE__ */ b("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ b(
1030
- Jt,
1037
+ ut,
1031
1038
  {
1032
1039
  ...e,
1033
1040
  ...r,
1041
+ type: "date",
1034
1042
  value: t,
1035
1043
  onSelect: c
1036
1044
  }
1037
1045
  ) });
1038
1046
  },
1039
- { props: Zt, styles: Wt }
1047
+ { props: ft, styles: dt }
1040
1048
  );
1041
1049
  customElements.define("calendar-date", Ze);
1042
- const Ct = (e, t) => D.compare(e, t) < 0 ? [e, t] : [t, e], We = Y(
1050
+ const Mt = (e, t) => D.compare(e, t) < 0 ? [e, t] : [t, e], We = _(
1043
1051
  (e) => {
1044
- const [t, n] = je("value"), [s = t[0], o] = I("focusedDate"), r = Xt({
1052
+ const [t, n] = _e("value"), [s = t[0], o] = O("focusedDate"), r = ht({
1045
1053
  ...e,
1046
1054
  focusedDate: s,
1047
1055
  setFocusedDate: o
1048
- }), c = C("rangestart"), f = C("rangeend"), [a, i] = rt();
1049
- function u(p) {
1056
+ }), c = T("rangestart"), u = T("rangeend"), [a, i] = rt();
1057
+ function f(p) {
1050
1058
  r.onFocus(p), d(p);
1051
1059
  }
1052
1060
  function d(p) {
@@ -1054,26 +1062,53 @@ const Ct = (e, t) => D.compare(e, t) < 0 ? [e, t] : [t, e], We = Y(
1054
1062
  }
1055
1063
  function l(p) {
1056
1064
  const y = p.detail;
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)));
1065
+ p.stopPropagation(), a ? (n(Mt(a.a, y)), i(void 0), u(v(y)), r.dispatch()) : (i({ a: y, b: y }), c(v(y)));
1058
1066
  }
1059
- const m = a ? Ct(a.a, a.b) : t;
1067
+ const m = a ? Mt(a.a, a.b) : t;
1060
1068
  return /* @__PURE__ */ b("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ b(
1061
- Jt,
1069
+ ut,
1062
1070
  {
1063
1071
  ...e,
1064
1072
  ...r,
1065
- highlightedRange: m,
1066
- onFocus: u,
1073
+ type: "range",
1074
+ value: m,
1075
+ onFocus: f,
1067
1076
  onHover: d,
1068
1077
  onSelect: l
1069
1078
  }
1070
1079
  ) });
1071
1080
  },
1072
- { props: Zt, styles: Wt }
1081
+ { props: ft, styles: dt }
1073
1082
  );
1074
1083
  customElements.define("calendar-range", We);
1084
+ const Xe = _(
1085
+ (e) => {
1086
+ const [t, n] = je("value"), [s = t[0], o] = O("focusedDate"), r = ht({
1087
+ ...e,
1088
+ focusedDate: s,
1089
+ setFocusedDate: o
1090
+ });
1091
+ function c(u) {
1092
+ const a = [...t], i = t.findIndex((f) => f.equals(u.detail));
1093
+ i < 0 ? a.push(u.detail) : a.splice(i, 1), n(a), r.dispatch();
1094
+ }
1095
+ return /* @__PURE__ */ b("host", { shadowDom: !0, focus: r.focus, children: /* @__PURE__ */ b(
1096
+ ut,
1097
+ {
1098
+ ...e,
1099
+ ...r,
1100
+ type: "multi",
1101
+ value: t,
1102
+ onSelect: c
1103
+ }
1104
+ ) });
1105
+ },
1106
+ { props: ft, styles: dt }
1107
+ );
1108
+ customElements.define("calendar-multi", Xe);
1075
1109
  export {
1076
1110
  Ze as CalendarDate,
1077
1111
  He as CalendarMonth,
1112
+ Xe as CalendarMulti,
1078
1113
  We as CalendarRange
1079
1114
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cally",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "small, feature-rich calendar components",
5
5
  "license": "MIT",
6
6
  "type": "module",