@nomideusz/svelte-calendar 0.6.0 → 0.6.3
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/adapters/recurring.d.ts +7 -0
- package/dist/adapters/recurring.js +4 -3
- package/dist/calendar/Calendar.svelte +776 -767
- package/dist/calendar/Calendar.svelte.d.ts +2 -2
- package/dist/primitives/DayHeader.svelte +103 -103
- package/dist/primitives/EmptySlot.svelte +105 -105
- package/dist/primitives/EventBlock.svelte +312 -312
- package/dist/primitives/NowIndicator.svelte +178 -178
- package/dist/primitives/TimeGutter.svelte +104 -104
- package/dist/theme/presets.js +36 -36
- package/dist/views/agenda/AgendaDay.svelte +1073 -1055
- package/dist/views/agenda/AgendaWeek.svelte +934 -924
- package/dist/views/mobile/Mobile.svelte +17 -17
- package/dist/views/mobile/MobileDay.svelte +702 -665
- package/dist/views/mobile/MobileWeek.svelte +461 -456
- package/dist/views/planner/PlannerDay.svelte +1129 -1091
- package/dist/views/planner/PlannerWeek.svelte +949 -945
- package/dist/widget/CalendarWidget.svelte +142 -142
- package/package.json +1 -1
|
@@ -63,6 +63,13 @@ export interface RecurringEvent {
|
|
|
63
63
|
export interface RecurringAdapterOptions {
|
|
64
64
|
/** Start weeks on Monday (default: true) */
|
|
65
65
|
mondayStart?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Custom color palette for auto-coloring events.
|
|
68
|
+
* Pass `generatePalette('#yourAccent')` to get theme-harmonious colors,
|
|
69
|
+
* or provide your own array of hex strings.
|
|
70
|
+
* Defaults to the built-in vivid palette.
|
|
71
|
+
*/
|
|
72
|
+
palette?: string[];
|
|
66
73
|
}
|
|
67
74
|
/**
|
|
68
75
|
* Create a CalendarAdapter that projects recurring events onto concrete
|
|
@@ -230,8 +230,9 @@ const PALETTE = VIVID_PALETTE;
|
|
|
230
230
|
* Read-only by default — create/update/delete throw.
|
|
231
231
|
*/
|
|
232
232
|
export function createRecurringAdapter(schedule, options = {}) {
|
|
233
|
-
const { mondayStart = true } = options;
|
|
234
|
-
|
|
233
|
+
const { mondayStart = true, palette } = options;
|
|
234
|
+
const colors = palette?.length ? palette : PALETTE;
|
|
235
|
+
// Auto-color: assign from palette by category/title
|
|
235
236
|
const colorAssignments = new Map();
|
|
236
237
|
let colorIndex = 0;
|
|
237
238
|
for (const rec of schedule) {
|
|
@@ -239,7 +240,7 @@ export function createRecurringAdapter(schedule, options = {}) {
|
|
|
239
240
|
continue;
|
|
240
241
|
const key = rec.category ?? rec.title;
|
|
241
242
|
if (!colorAssignments.has(key)) {
|
|
242
|
-
colorAssignments.set(key,
|
|
243
|
+
colorAssignments.set(key, colors[colorIndex % colors.length]);
|
|
243
244
|
colorIndex++;
|
|
244
245
|
}
|
|
245
246
|
}
|