@happyvertical/smrt-ui 0.54.2 → 0.54.4

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/AGENTS.md CHANGED
@@ -50,7 +50,7 @@ components are exempt — they *are* the primitives.
50
50
  | `./data` | `CollectionToolbar`, `CollectionList`/`ContentList`, `DataTable` and their types — a **component barrel**: it re-exports `.svelte` files, so a plain Node `import()` of it throws `ERR_UNKNOWN_FILE_EXTENSION` |
51
51
  | `./data-surface` | **Svelte-free**: registry contracts and shared protocol limits (`DATA_SURFACE_MAX_REQUEST_BYTES`, `DATA_SURFACE_IDENTIFIER_MAX_LENGTH`, …). Server adapters must import these from here, not from `./data` — a server entry that reaches the barrel breaks the `smrt` CLI's plain-Node `.smrt/register.js` load (issue #2924) |
52
52
  | `./layout` | `Container`, `Grid`, `Header`, `Footer`, `PageHeader`, `EmptyState`, … |
53
- | `./calendar` | `CalendarView` (time-zone-aware month grid + phone agenda) and its Svelte-free date model (`toEntries`, `layoutMonth`, `dateKeyInZone`, …); deprecated `Calendar`, `DayView` |
53
+ | `./calendar` | `CalendarView` (time-zone-aware month/week grids + phone agenda) and its Svelte-free date model (`toEntries`, `layoutMonth`, `layoutWeek`, `dateKeyInZone`, …); deprecated `Calendar`, `DayView` |
54
54
  | `./chat` | `MessageBubble`, `ReactionPicker`, `TypingIndicator` |
55
55
  | `./forms` | Provider-free fields, choice controls, sliders/ranges, combobox/listbox/multiselect/tags, date/time/file controls, `CameraCapture`/`SignaturePad` capture, plus the transport-neutral control interaction registry |
56
56
  | `./form-retry` | **Svelte-free** form retry (#3291): submission key, in-flight refusal, conditional reset, opt-in restore-after-reload, browser `runOnce()` digest. Also re-exported from `./forms`. Framework-free TS typed structurally against SvelteKit's `SubmitFunction` — never import `@sveltejs/kit` here. Guide: `docs/content/form-retry.md` |
package/README.md CHANGED
@@ -182,7 +182,7 @@ constrained to where that cannot cost a neighbour a click:
182
182
 
183
183
  ## Calendar
184
184
 
185
- `CalendarView` (`@happyvertical/smrt-ui/calendar`) is a generic month grid
185
+ `CalendarView` (`@happyvertical/smrt-ui/calendar`) provides generic month and week grids
186
186
  with a phone agenda:
187
187
 
188
188
  ```svelte
@@ -220,10 +220,19 @@ with a phone agenda:
220
220
  month's days (44px targets, arrow keys) above a day-by-day list. `auto`
221
221
  (default) uses the agenda below 48rem, matching AdminShell's phone
222
222
  breakpoint. No modals.
223
+ - **Week view**: pass `mode="week"` and `date="2026-09-29"` to show the seven
224
+ days containing that date. `onNavigate` reports `{ year, month, date }`, where
225
+ `date` is the first day of the week. Previous/next and PageUp/PageDown move
226
+ one week; Today uses `timeZone`. Use `mode="auto" autoMode="week"` for a week
227
+ grid above 48rem and that week's agenda below it (the default `autoMode`
228
+ remains `month`). The week title uses the requested locale's date range.
229
+ Bands, overflow, day links, selection and keyboard grid behavior match month
230
+ mode. Handle `onNavigate` with `if (next.date) week = next.date` to retain the
231
+ controlled date in a page or URL.
223
232
  - **URL state**: `year` + `month` (1-12) and `selectedDate` (`YYYY-MM-DD`) are
224
233
  controlled when passed; changes are reported via `onNavigate` and
225
234
  `onSelectDate`, so a page can keep them in its URL.
226
- - The Svelte-free date model (`toEntries`, `layoutMonth`, `dateKeyInZone`,
235
+ - The Svelte-free date model (`toEntries`, `layoutMonth`, `layoutWeek`, `weekKeys`, `dateKeyInZone`,
227
236
  `monthWeeks`, `shiftMonth`, …) is exported from the same subpath for
228
237
  server-side range queries and tests.
229
238
 
@@ -1,11 +1,13 @@
1
1
  <script lang="ts">
2
2
  /**
3
- * CalendarView — a generic month calendar with a phone agenda.
3
+ * CalendarView — generic month and week grids with a phone agenda.
4
4
  *
5
5
  * - `month` mode: a month grid (`role="grid"`, roving focus, arrow keys).
6
6
  * All-day and multi-day items render as bands across the days they cover;
7
7
  * a day that has more than fits shows "+N more", which opens the day in a
8
8
  * panel under the grid (never a modal) or follows `dayHref`.
9
+ * - `week` mode: one seven-day grid controlled by `date`. In `auto`,
10
+ * `autoMode="week"` selects a week grid with its seven-day phone agenda.
9
11
  * - `agenda` mode: a scrollable strip of the month's days above a day-by-day
10
12
  * list. `auto` (default) uses the agenda below 48rem, the grid above.
11
13
  *
@@ -26,11 +28,13 @@ import {
26
28
  type CalendarItem,
27
29
  type CalendarMode,
28
30
  type CalendarMonth,
31
+ type CalendarNavigation,
29
32
  defaultTimeZone,
30
33
  defaultWeekStart,
31
34
  entriesOnDay,
32
35
  formatKey,
33
36
  layoutMonth,
37
+ layoutWeek,
34
38
  monthKeys,
35
39
  monthOfKey,
36
40
  monthWeeks,
@@ -41,6 +45,7 @@ import {
41
45
  toEntries,
42
46
  toneFor,
43
47
  weekdayOfKey,
48
+ weekKeys,
44
49
  } from './calendar-model.js';
45
50
 
46
51
  export interface Props {
@@ -50,6 +55,10 @@ export interface Props {
50
55
  year?: number;
51
56
  /** Visible month, 1-12 (controlled together with `year`). */
52
57
  month?: number;
58
+ /** A YYYY-MM-DD date in the visible week (controlled). */
59
+ date?: string;
60
+ /** Desktop grid in auto mode; defaults to month. */
61
+ autoMode?: 'month' | 'week';
53
62
  /** Selected day as `YYYY-MM-DD` (controlled). */
54
63
  selectedDate?: string | null;
55
64
  /** IANA time zone every day is computed in. Defaults to the browser's. */
@@ -60,9 +69,9 @@ export interface Props {
60
69
  weekStartsOn?: number;
61
70
  /** `auto` switches to the agenda below 48rem. */
62
71
  mode?: CalendarMode;
63
- /** Rows per day in the month grid, including band rows. */
72
+ /** Rows per day in either grid, including band rows. */
64
73
  maxPerDay?: number;
65
- /** Heading level of the month title. */
74
+ /** Heading level of the visible period title. */
66
75
  headingLevel?: 2 | 3 | 4;
67
76
  /**
68
77
  * "Now", for today highlighting (tests, server rendering). Without it the
@@ -72,8 +81,8 @@ export interface Props {
72
81
  * (or `now`) so the server and the browser pick the same month.
73
82
  */
74
83
  now?: Date;
75
- /** Called when the visible month changes (prev/next/today/keyboard). */
76
- onNavigate?: (month: CalendarMonth) => void;
84
+ /** Reports month navigation, or week navigation with its first date key. */
85
+ onNavigate?: (period: CalendarNavigation) => void;
77
86
  /** Called when a day is selected. */
78
87
  onSelectDate?: (date: string) => void;
79
88
  /** Called when an item is activated (also for items with `href`). */
@@ -90,6 +99,8 @@ let {
90
99
  items = [],
91
100
  year,
92
101
  month,
102
+ date,
103
+ autoMode = 'month',
93
104
  selectedDate = null,
94
105
  timeZone: timeZoneProp,
95
106
  locale: localeProp,
@@ -155,13 +166,30 @@ let current = $derived<CalendarMonth>(
155
166
  ? monthOfKey(selectedDate)
156
167
  : monthOfKey(fallbackKey),
157
168
  );
169
+ const isWeek = $derived(
170
+ mode === 'week' || (mode === 'auto' && autoMode === 'week'),
171
+ );
172
+ let currentDate = $derived(
173
+ date ??
174
+ selectedDate ??
175
+ (year !== undefined && month !== undefined
176
+ ? formatKey(year, month, 1)
177
+ : fallbackKey),
178
+ );
179
+ const visibleWeekKeys = $derived(weekKeys(currentDate, weekStartsOn));
158
180
  let selected = $derived<string | null>(selectedDate ?? null);
159
181
  let focusKey = $derived(
160
- selected && sameMonth(selected, current)
161
- ? selected
162
- : today && sameMonth(today, current)
163
- ? today
164
- : formatKey(current.year, current.month, 1),
182
+ isWeek
183
+ ? selected && visibleWeekKeys.includes(selected)
184
+ ? selected
185
+ : visibleWeekKeys.includes(today)
186
+ ? today
187
+ : visibleWeekKeys[0]
188
+ : selected && sameMonth(selected, current)
189
+ ? selected
190
+ : today && sameMonth(today, current)
191
+ ? today
192
+ : formatKey(current.year, current.month, 1),
165
193
  );
166
194
 
167
195
  let isPhone = $state(false);
@@ -175,7 +203,7 @@ $effect(() => {
175
203
  query.addEventListener('change', onChange);
176
204
  return () => query.removeEventListener('change', onChange);
177
205
  });
178
- const view = $derived(mode === 'auto' ? (isPhone ? 'agenda' : 'month') : mode);
206
+ const view = $derived(mode === 'auto' ? (isPhone ? 'agenda' : autoMode) : mode);
179
207
 
180
208
  let root: HTMLElement | undefined = $state();
181
209
 
@@ -187,9 +215,11 @@ const entries = $derived(
187
215
  ),
188
216
  );
189
217
  const weeks = $derived(
190
- layoutMonth(current, entries, { weekStartsOn, maxPerDay }),
218
+ isWeek
219
+ ? [layoutWeek(currentDate, entries, { weekStartsOn, maxPerDay })]
220
+ : layoutMonth(current, entries, { weekStartsOn, maxPerDay }),
191
221
  );
192
- const daysOfMonth = $derived(monthKeys(current));
222
+ const daysOfMonth = $derived(isWeek ? visibleWeekKeys : monthKeys(current));
193
223
  const agendaDays = $derived(
194
224
  daysOfMonth
195
225
  .map((key) => ({ key, entries: entriesOnDay(entries, key) }))
@@ -202,11 +232,18 @@ const selectedEntries = $derived(
202
232
  // ---- Intl formatting (all in `timeZone` / `locale`) ----
203
233
 
204
234
  const monthTitle = $derived(
205
- new Intl.DateTimeFormat(locale, {
206
- month: 'long',
207
- year: 'numeric',
208
- timeZone: 'UTC',
209
- }).format(Date.UTC(current.year, current.month - 1, 15)),
235
+ isWeek
236
+ ? new Intl.DateTimeFormat(locale, {
237
+ month: 'short',
238
+ day: 'numeric',
239
+ year: 'numeric',
240
+ timeZone: 'UTC',
241
+ }).formatRange(keyDate(visibleWeekKeys[0]), keyDate(visibleWeekKeys[6]))
242
+ : new Intl.DateTimeFormat(locale, {
243
+ month: 'long',
244
+ year: 'numeric',
245
+ timeZone: 'UTC',
246
+ }).format(Date.UTC(current.year, current.month - 1, 15)),
210
247
  );
211
248
  const longDateFormat = $derived(
212
249
  new Intl.DateTimeFormat(locale, {
@@ -302,10 +339,24 @@ function navigate(next: CalendarMonth): void {
302
339
  onNavigate?.(next);
303
340
  }
304
341
 
342
+ function navigateWeek(key: string): void {
343
+ currentDate = key;
344
+ current = monthOfKey(key);
345
+ const first = weekKeys(key, weekStartsOn)[0];
346
+ onNavigate?.({ ...monthOfKey(first), date: first });
347
+ }
348
+
349
+ function stepPeriod(delta: number): void {
350
+ if (isWeek) navigateWeek(addDays(currentDate, delta * 7));
351
+ else navigate(shiftMonth(current, delta));
352
+ }
353
+
305
354
  function goToday(): void {
306
355
  const key = today || todayKey(timeZone);
307
356
  const target = monthOfKey(key);
308
- if (target.year !== current.year || target.month !== current.month) {
357
+ if (isWeek) {
358
+ navigateWeek(key);
359
+ } else if (target.year !== current.year || target.month !== current.month) {
309
360
  navigate(target);
310
361
  }
311
362
  focusKey = key;
@@ -348,7 +399,9 @@ async function revealAgendaDay(key: string): Promise<void> {
348
399
  }
349
400
 
350
401
  function moveFocus(key: string): void {
351
- if (!sameMonth(key, current)) navigate(monthOfKey(key));
402
+ if (isWeek) {
403
+ if (!visibleWeekKeys.includes(key)) navigateWeek(key);
404
+ } else if (!sameMonth(key, current)) navigate(monthOfKey(key));
352
405
  focusKey = key;
353
406
  void focusDay(key);
354
407
  }
@@ -379,10 +432,10 @@ function onGridKeydown(event: KeyboardEvent): void {
379
432
  next = addDays(key, 6 - column);
380
433
  break;
381
434
  case 'PageUp':
382
- next = addMonthsToKey(key, -1);
435
+ next = isWeek ? addDays(key, -7) : addMonthsToKey(key, -1);
383
436
  break;
384
437
  case 'PageDown':
385
- next = addMonthsToKey(key, 1);
438
+ next = isWeek ? addDays(key, 7) : addMonthsToKey(key, 1);
386
439
  break;
387
440
  default:
388
441
  return;
@@ -493,8 +546,8 @@ $effect(() => {
493
546
  <button
494
547
  type="button"
495
548
  class="cv-icon-btn"
496
- aria-label={t(M['ui.calendar.previous_month'])}
497
- onclick={() => navigate(shiftMonth(current, -1))}
549
+ aria-label={t(M[isWeek ? 'ui.calendar.previous_week' : 'ui.calendar.previous_month'])}
550
+ onclick={() => stepPeriod(-1)}
498
551
  >
499
552
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" aria-hidden="true">
500
553
  <path d="M12 15L7 10L12 5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
@@ -506,8 +559,8 @@ $effect(() => {
506
559
  <button
507
560
  type="button"
508
561
  class="cv-icon-btn"
509
- aria-label={t(M['ui.calendar.next_month'])}
510
- onclick={() => navigate(shiftMonth(current, 1))}
562
+ aria-label={t(M[isWeek ? 'ui.calendar.next_week' : 'ui.calendar.next_month'])}
563
+ onclick={() => stepPeriod(1)}
511
564
  >
512
565
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" aria-hidden="true">
513
566
  <path d="M8 5L13 10L8 15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
@@ -516,7 +569,7 @@ $effect(() => {
516
569
  </div>
517
570
  </header>
518
571
 
519
- {#if view === 'month'}
572
+ {#if view === 'month' || view === 'week'}
520
573
  <div
521
574
  class="cv-grid"
522
575
  role="grid"
@@ -544,7 +597,7 @@ $effect(() => {
544
597
  {@const href = dayHref?.(day.key)}
545
598
  <div
546
599
  class="cv-day"
547
- class:cv-day--out={!day.inMonth}
600
+ class:cv-day--out={!isWeek && !day.inMonth}
548
601
  class:cv-day--today={day.key === today}
549
602
  class:cv-day--selected={day.key === selected}
550
603
  role="gridcell"
@@ -676,7 +729,7 @@ $effect(() => {
676
729
  {/each}
677
730
  </div>
678
731
 
679
- {#if selected && !dayHref && sameMonth(selected, current)}
732
+ {#if selected && !dayHref && (isWeek ? visibleWeekKeys.includes(selected) : sameMonth(selected, current))}
680
733
  <section class="cv-day-panel" aria-labelledby="cv-day-{uid}">
681
734
  <div class="cv-day-panel-head">
682
735
  <h3 class="cv-day-title" id="cv-day-{uid}">{longDate(selected)}</h3>
@@ -732,7 +785,7 @@ $effect(() => {
732
785
  </div>
733
786
 
734
787
  {#if agendaDays.length === 0}
735
- <p class="cv-empty">{t(M['ui.calendar.nothing_month'])}</p>
788
+ <p class="cv-empty">{t(M[isWeek ? 'ui.calendar.nothing_week' : 'ui.calendar.nothing_month'])}</p>
736
789
  {:else}
737
790
  <ol class="cv-agenda">
738
791
  {#each agendaDays as day (day.key)}
@@ -1,10 +1,12 @@
1
1
  /**
2
- * CalendarView — a generic month calendar with a phone agenda.
2
+ * CalendarView — generic month and week grids with a phone agenda.
3
3
  *
4
4
  * - `month` mode: a month grid (`role="grid"`, roving focus, arrow keys).
5
5
  * All-day and multi-day items render as bands across the days they cover;
6
6
  * a day that has more than fits shows "+N more", which opens the day in a
7
7
  * panel under the grid (never a modal) or follows `dayHref`.
8
+ * - `week` mode: one seven-day grid controlled by `date`. In `auto`,
9
+ * `autoMode="week"` selects a week grid with its seven-day phone agenda.
8
10
  * - `agenda` mode: a scrollable strip of the month's days above a day-by-day
9
11
  * list. `auto` (default) uses the agenda below 48rem, the grid above.
10
12
  *
@@ -15,7 +17,7 @@
15
17
  * so a page can keep them in its URL.
16
18
  */
17
19
  import type { Snippet } from 'svelte';
18
- import { type CalendarItem, type CalendarMode, type CalendarMonth } from './calendar-model.js';
20
+ import { type CalendarItem, type CalendarMode, type CalendarNavigation } from './calendar-model.js';
19
21
  export interface Props {
20
22
  /** Items to show. */
21
23
  items?: CalendarItem[];
@@ -23,6 +25,10 @@ export interface Props {
23
25
  year?: number;
24
26
  /** Visible month, 1-12 (controlled together with `year`). */
25
27
  month?: number;
28
+ /** A YYYY-MM-DD date in the visible week (controlled). */
29
+ date?: string;
30
+ /** Desktop grid in auto mode; defaults to month. */
31
+ autoMode?: 'month' | 'week';
26
32
  /** Selected day as `YYYY-MM-DD` (controlled). */
27
33
  selectedDate?: string | null;
28
34
  /** IANA time zone every day is computed in. Defaults to the browser's. */
@@ -33,9 +39,9 @@ export interface Props {
33
39
  weekStartsOn?: number;
34
40
  /** `auto` switches to the agenda below 48rem. */
35
41
  mode?: CalendarMode;
36
- /** Rows per day in the month grid, including band rows. */
42
+ /** Rows per day in either grid, including band rows. */
37
43
  maxPerDay?: number;
38
- /** Heading level of the month title. */
44
+ /** Heading level of the visible period title. */
39
45
  headingLevel?: 2 | 3 | 4;
40
46
  /**
41
47
  * "Now", for today highlighting (tests, server rendering). Without it the
@@ -45,8 +51,8 @@ export interface Props {
45
51
  * (or `now`) so the server and the browser pick the same month.
46
52
  */
47
53
  now?: Date;
48
- /** Called when the visible month changes (prev/next/today/keyboard). */
49
- onNavigate?: (month: CalendarMonth) => void;
54
+ /** Reports month navigation, or week navigation with its first date key. */
55
+ onNavigate?: (period: CalendarNavigation) => void;
50
56
  /** Called when a day is selected. */
51
57
  onSelectDate?: (date: string) => void;
52
58
  /** Called when an item is activated (also for items with `href`). */
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarView.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/CalendarView.svelte.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAItC,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAgBnB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,KAAK;IACpB,qBAAqB;IACrB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,wEAAwE;IACxE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5C,qCAAqC;IACrC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,qEAAqE;IACrE,YAAY,CAAC,E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,MAAM,CAAC;IACtB,iDAAiD;IACjD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,4EAA4E;IAC5E,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAClD,qCAAqC;IACrC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,kEAAkE;IAClE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/C,kEAAkE;IAClE,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACxD,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqlBD,QAAA,MAAM,YAAY,2CAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
@@ -43,8 +43,13 @@ export interface CalendarMonth {
43
43
  year: number;
44
44
  month: number;
45
45
  }
46
- /** Month grid, agenda list, or month grid above 48rem and agenda below. */
47
- export type CalendarMode = 'auto' | 'month' | 'agenda';
46
+ /** Navigation state; week navigation also reports its first date key. */
47
+ export interface CalendarNavigation extends CalendarMonth {
48
+ /** First date of the visible week, present for week navigation. */
49
+ date?: string;
50
+ }
51
+ /** Month/week grid, agenda, or a responsive grid with a phone agenda. */
52
+ export type CalendarMode = 'auto' | 'month' | 'week' | 'agenda';
48
53
  /** An item projected onto calendar day keys. */
49
54
  export interface CalendarEntry {
50
55
  item: CalendarItem;
@@ -175,4 +180,11 @@ export declare function layoutMonth(value: CalendarMonth, entries: readonly Cale
175
180
  weekStartsOn: number;
176
181
  maxPerDay: number;
177
182
  }): CalendarWeek[];
183
+ /** Seven date keys containing `date`, starting on `weekStartsOn` (0 = Sunday). */
184
+ export declare function weekKeys(date: string, weekStartsOn: number): string[];
185
+ /** Lay out one week using the same band lanes and overflow budget as a month. */
186
+ export declare function layoutWeek(date: string, entries: readonly CalendarEntry[], options: {
187
+ weekStartsOn: number;
188
+ maxPerDay: number;
189
+ }): CalendarWeek;
178
190
  //# sourceMappingURL=calendar-model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-model.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/calendar-model.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wEAAwE;AACxE,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,WAAW,GACX,UAAU,GACV,SAAS,GACT,SAAS,GACT,OAAO,GACP,SAAS,CAAC;AAEd,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,IAAI,GAAG,MAAM,CAAC;IACrB;;;;OAIG;IACH,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3B,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;C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E;AAED,uBAAuB;AACvB,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAExD;AAED,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQjE;AAED,sCAAsC;AACtC,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,EAAE,CAKxD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,aAAa,EACpB,YAAY,EAAE,MAAM,GACnB,MAAM,EAAE,EAAE,CAcZ;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAYnE;AAED,yEAAyE;AACzE,wBAAgB,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAMxD;AAMD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,SAAS,YAAY,EAAE,EAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,GACvC,aAAa,EAAE,CAsDjB;AAUD,gFAAgF;AAChF,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,GAAG,EAAE,MAAM,GACV,aAAa,EAAE,CAMjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACnD,YAAY,EAAE,CA2EhB"}
1
+ {"version":3,"file":"calendar-model.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/calendar-model.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wEAAwE;AACxE,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,WAAW,G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AgB,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAMxD;AAMD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,SAAS,YAAY,EAAE,EAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,GACvC,aAAa,EAAE,CAsDjB;AAUD,gFAAgF;AAChF,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,GAAG,EAAE,MAAM,GACV,aAAa,EAAE,CAMjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACnD,YAAY,EAAE,CAOhB;AAED,kFAAkF;AAClF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAGrE;AAED,iFAAiF;AACjF,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACnD,YAAY,CAOd"}
@@ -293,10 +293,22 @@ export function entriesOnDay(entries, key) {
293
293
  * @returns Week rows
294
294
  */
295
295
  export function layoutMonth(value, entries, options) {
296
- const maxPerDay = Math.max(1, Math.floor(options.maxPerDay));
296
+ return layoutWeeks(monthWeeks(value, options.weekStartsOn), value, entries, options.maxPerDay);
297
+ }
298
+ /** Seven date keys containing `date`, starting on `weekStartsOn` (0 = Sunday). */
299
+ export function weekKeys(date, weekStartsOn) {
300
+ const first = addDays(date, -((weekdayOfKey(date) - weekStartsOn + 7) % 7));
301
+ return Array.from({ length: 7 }, (_, index) => addDays(first, index));
302
+ }
303
+ /** Lay out one week using the same band lanes and overflow budget as a month. */
304
+ export function layoutWeek(date, entries, options) {
305
+ return layoutWeeks([weekKeys(date, options.weekStartsOn)], monthOfKey(date), entries, options.maxPerDay)[0];
306
+ }
307
+ function layoutWeeks(weeks, value, entries, rowBudget) {
308
+ const maxPerDay = Math.max(1, Math.floor(rowBudget));
297
309
  const bands = entries.filter((entry) => entry.band);
298
310
  const timed = entries.filter((entry) => !entry.band);
299
- return monthWeeks(value, options.weekStartsOn).map((keys) => {
311
+ return weeks.map((keys) => {
300
312
  const weekStart = keys[0];
301
313
  const weekEnd = keys[6];
302
314
  const hidden = new Map();
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Calendar components.
3
3
  *
4
- * `CalendarView` is the generic, time-zone-aware month grid + phone agenda.
4
+ * `CalendarView` is the generic, time-zone-aware month/week grids + phone agenda.
5
5
  * `Calendar` and `DayView` are deprecated: they compute days in the browser
6
6
  * zone, print English-only names, hard-code game/meeting/event item types
7
7
  * and `/events/y/m/d` links. Migrate to `CalendarView` (see the package
@@ -10,8 +10,8 @@
10
10
  /** @deprecated Use `CalendarView`; see the smrt-ui README "Calendar" migration note. */
11
11
  export { default as Calendar } from './Calendar.svelte';
12
12
  export { default as CalendarView } from './CalendarView.svelte';
13
- export type { CalendarBandSegment, CalendarDayCell, CalendarEntry, CalendarItem, CalendarMode, CalendarMonth, CalendarTone, CalendarWeek, } from './calendar-model.js';
14
- export { addDays, addMonthsToKey, dateKeyInZone, defaultTimeZone, defaultWeekStart, entriesOnDay, formatKey, isDateKey, layoutMonth, monthKeys, monthOfKey, monthWeeks, parseKey, shiftMonth, todayKey, toEntries, toneFor, weekdayOfKey, } from './calendar-model.js';
13
+ export type { CalendarBandSegment, CalendarDayCell, CalendarEntry, CalendarItem, CalendarMode, CalendarMonth, CalendarNavigation, CalendarTone, CalendarWeek, } from './calendar-model.js';
14
+ export { addDays, addMonthsToKey, dateKeyInZone, defaultTimeZone, defaultWeekStart, entriesOnDay, formatKey, isDateKey, layoutMonth, layoutWeek, monthKeys, monthOfKey, monthWeeks, parseKey, shiftMonth, todayKey, toEntries, toneFor, weekdayOfKey, weekKeys, } from './calendar-model.js';
15
15
  /** @deprecated Use `CalendarView` (agenda mode or its day panel); see the smrt-ui README. */
16
16
  export { default as DayView } from './DayView.svelte';
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wFAAwF;AACxF,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,OAAO,EACP,cAAc,EACd,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,OAAO,EACP,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,6FAA6F;AAC7F,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wFAAwF;AACxF,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,OAAO,EACP,cAAc,EACd,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,OAAO,EACP,YAAY,EACZ,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,6FAA6F;AAC7F,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Calendar components.
3
3
  *
4
- * `CalendarView` is the generic, time-zone-aware month grid + phone agenda.
4
+ * `CalendarView` is the generic, time-zone-aware month/week grids + phone agenda.
5
5
  * `Calendar` and `DayView` are deprecated: they compute days in the browser
6
6
  * zone, print English-only names, hard-code game/meeting/event item types
7
7
  * and `/events/y/m/d` links. Migrate to `CalendarView` (see the package
@@ -10,6 +10,6 @@
10
10
  /** @deprecated Use `CalendarView`; see the smrt-ui README "Calendar" migration note. */
11
11
  export { default as Calendar } from './Calendar.svelte';
12
12
  export { default as CalendarView } from './CalendarView.svelte';
13
- export { addDays, addMonthsToKey, dateKeyInZone, defaultTimeZone, defaultWeekStart, entriesOnDay, formatKey, isDateKey, layoutMonth, monthKeys, monthOfKey, monthWeeks, parseKey, shiftMonth, todayKey, toEntries, toneFor, weekdayOfKey, } from './calendar-model.js';
13
+ export { addDays, addMonthsToKey, dateKeyInZone, defaultTimeZone, defaultWeekStart, entriesOnDay, formatKey, isDateKey, layoutMonth, layoutWeek, monthKeys, monthOfKey, monthWeeks, parseKey, shiftMonth, todayKey, toEntries, toneFor, weekdayOfKey, weekKeys, } from './calendar-model.js';
14
14
  /** @deprecated Use `CalendarView` (agenda mode or its day panel); see the smrt-ui README. */
15
15
  export { default as DayView } from './DayView.svelte';
@@ -11,6 +11,9 @@ export declare const M: {
11
11
  readonly 'ui.calendar.next_month': "ui.calendar.next_month";
12
12
  readonly 'ui.calendar.select_month': "ui.calendar.select_month";
13
13
  readonly 'ui.calendar.select_year': "ui.calendar.select_year";
14
+ readonly 'ui.calendar.previous_week': "ui.calendar.previous_week";
15
+ readonly 'ui.calendar.next_week': "ui.calendar.next_week";
16
+ readonly 'ui.calendar.nothing_week': "ui.calendar.nothing_week";
14
17
  readonly 'ui.calendar.today': "ui.calendar.today";
15
18
  readonly 'ui.calendar.more': "ui.calendar.more";
16
19
  readonly 'ui.calendar.more_short': "ui.calendar.more_short";
@@ -1 +1 @@
1
- {"version":3,"file":"strings.ui.d.ts","sourceRoot":"","sources":["../../src/i18n/strings.ui.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgKZ,CAAC"}
1
+ {"version":3,"file":"strings.ui.d.ts","sourceRoot":"","sources":["../../src/i18n/strings.ui.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmKZ,CAAC"}
@@ -14,6 +14,9 @@ export const M = defineMessages({
14
14
  'ui.calendar.select_month': 'Select month',
15
15
  'ui.calendar.select_year': 'Select year',
16
16
  // calendar/CalendarView.svelte
17
+ 'ui.calendar.previous_week': 'Previous week',
18
+ 'ui.calendar.next_week': 'Next week',
19
+ 'ui.calendar.nothing_week': 'Nothing scheduled this week',
17
20
  'ui.calendar.today': 'Today',
18
21
  'ui.calendar.more': '+{count} more',
19
22
  'ui.calendar.more_short': '+{count}',
@@ -93,6 +93,7 @@ const items: CalendarItem[] = [
93
93
  options={[
94
94
  { value: 'auto', label: 'Auto' },
95
95
  { value: 'month', label: 'Month' },
96
+ { value: 'week', label: 'Week' },
96
97
  { value: 'agenda', label: 'Agenda' },
97
98
  ]}
98
99
  onvaluechange={(value) => (mode = value as CalendarMode)}
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarPreview.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/playground/CalendarPreview.svelte.ts"],"names":[],"mappings":"AA6GA,QAAA,MAAM,eAAe,2DAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"CalendarPreview.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/playground/CalendarPreview.svelte.ts"],"names":[],"mappings":"AA8GA,QAAA,MAAM,eAAe,2DAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-ui",
3
- "version": "0.54.2",
3
+ "version": "0.54.4",
4
4
  "smrtJsdoc": "strict",
5
5
  "description": "Domain-agnostic Svelte 5 UI runtime for SMRT: primitives, i18n client, theme system, and module UI registry",
6
6
  "type": "module",
@@ -134,7 +134,7 @@
134
134
  "access": "public"
135
135
  },
136
136
  "dependencies": {
137
- "@happyvertical/smrt-types": "0.54.2",
137
+ "@happyvertical/smrt-types": "0.54.4",
138
138
  "esm-env": "^1.2.2"
139
139
  },
140
140
  "peerDependencies": {