@nomideusz/svelte-calendar 0.7.5 → 0.8.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.
Files changed (36) hide show
  1. package/README.md +19 -4
  2. package/dist/calendar/Calendar.svelte +364 -497
  3. package/dist/calendar/Calendar.svelte.d.ts +6 -2
  4. package/dist/core/clock.svelte.js +12 -5
  5. package/dist/core/locale.d.ts +4 -0
  6. package/dist/core/locale.js +4 -0
  7. package/dist/engine/view-state.svelte.d.ts +2 -2
  8. package/dist/engine/view-state.svelte.js +20 -0
  9. package/dist/headless/create-calendar.svelte.js +18 -2
  10. package/dist/headless/types.d.ts +6 -6
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.js +3 -0
  13. package/dist/primitives/DayHeader.svelte +9 -25
  14. package/dist/primitives/EmptySlot.svelte +15 -31
  15. package/dist/primitives/EventBlock.svelte +33 -61
  16. package/dist/primitives/NowIndicator.svelte +16 -42
  17. package/dist/primitives/TimeGutter.svelte +9 -23
  18. package/dist/views/agenda/Agenda.svelte +3 -10
  19. package/dist/views/agenda/AgendaDay.svelte +195 -167
  20. package/dist/views/agenda/AgendaWeek.svelte +141 -195
  21. package/dist/views/mobile/Mobile.svelte +3 -10
  22. package/dist/views/mobile/MobileDay.svelte +422 -266
  23. package/dist/views/mobile/MobileWeek.svelte +131 -186
  24. package/dist/views/month/MonthGrid.svelte +334 -0
  25. package/dist/views/month/MonthGrid.svelte.d.ts +15 -0
  26. package/dist/views/planner/Planner.svelte +3 -10
  27. package/dist/views/planner/PlannerDay.svelte +636 -546
  28. package/dist/views/planner/PlannerWeek.svelte +299 -412
  29. package/dist/views/shared/EventContent.svelte +16 -0
  30. package/dist/views/shared/EventContent.svelte.d.ts +9 -0
  31. package/dist/views/shared/context.svelte.d.ts +1 -0
  32. package/dist/views/shared/context.svelte.js +1 -0
  33. package/dist/widget/CalendarWidget.svelte +79 -116
  34. package/package.json +3 -2
  35. package/widget/svelte-calendar.css +321 -10
  36. package/widget/widget.js +1944 -1031
package/README.md CHANGED
@@ -31,18 +31,25 @@ That's it — 6 views (Day/Week × Planner, Agenda, Mobile), auto-coloring, drag
31
31
 
32
32
  ## Views
33
33
 
34
- Switch between **Planner** (time grid) and **Agenda** (list) in Day or Week mode:
34
+ Switch between **Planner** (time grid), **Agenda** (list) and the **Month** grid:
35
35
 
36
36
  ```svelte
37
37
  <Calendar {adapter} view="week-planner" /> <!-- default -->
38
38
  <Calendar {adapter} view="day-planner" />
39
39
  <Calendar {adapter} view="week-agenda" />
40
40
  <Calendar {adapter} view="day-agenda" />
41
+ <Calendar {adapter} view="month-grid" />
41
42
  ```
42
43
 
43
- Users can also switch via the built-in Day/Week pills.
44
+ Users can also switch via the built-in Day/Week/Month pills.
44
45
 
45
- Planner views are designed for direct manipulation: drag an event to another day or time and the calendar renders a ghost preview at the target position before committing the move.
46
+ Planner views are designed for direct manipulation:
47
+
48
+ - **Move** — drag an event to another day or time; a ghost previews the target before the move commits.
49
+ - **Resize** — drag an event's edge handles (`day-planner`: left/right, `day-mobile`: top/bottom) to change its duration; `minDuration`/`maxDuration` clamp at commit.
50
+ - **Drag-to-create** — press on empty canvas and sweep to draw a new event; a plain click still creates a default-length slot. Both fire `oneventcreate` with the final range, after blocked-slot and disabled-date validation.
51
+
52
+ The month grid lists events as chips per day with a "+N more" overflow; clicking a day fires `ondayclick(date)` — the natural month → day drill-down.
46
53
 
47
54
  Hide the pills when your app controls the view externally:
48
55
 
@@ -100,9 +107,15 @@ Agenda views keep their list-based layout on mobile; navigation stays in the cal
100
107
  oneventcreate={(range) => console.log('New slot', range.start, range.end)}
101
108
  oneventmove={(event, start, end) => console.log('Moved', event.title, start, end)}
102
109
  onviewchange={(viewId) => console.log('View', viewId)}
110
+ ondayclick={(date) => console.log('Day', date)}
111
+ onerror={(error) => console.error('Calendar', error)}
103
112
  />
104
113
  ```
105
114
 
115
+ `onerror` surfaces adapter load failures and rejected drag commits that would
116
+ otherwise only reach the console. Clicking an event also selects it — the
117
+ active event is highlighted across views.
118
+
106
119
  Set `readOnly` to disable drag, resize, and click-to-create:
107
120
 
108
121
  ```svelte
@@ -392,7 +405,9 @@ const events = [
392
405
 
393
406
  ### Custom Event Rendering
394
407
 
395
- Use the `event` snippet to fully control how events look:
408
+ Use the `event` snippet to replace the event *content* in every view (the
409
+ interactive shell — click, keyboard, drag, selection — stays intact). The
410
+ `empty` snippet replaces the day-agenda empty state:
396
411
 
397
412
  ```svelte
398
413
  <Calendar {adapter}>