@dayflow/core 3.6.2 → 3.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/index.d.ts CHANGED
@@ -151,8 +151,9 @@ declare class CalendarRegistry {
151
151
  */
152
152
  getDefaultCalendar(): CalendarType;
153
153
  /**
154
- * Get the first writable (non-readOnly, non-subscription) calendar for event creation.
155
- * Prefers the default calendar; falls back to the first writable calendar.
154
+ * Get the first writable calendar for event creation.
155
+ * Prefers non-subscription calendars; falls back to non-readOnly subscription
156
+ * calendars (e.g. a writable Google Calendar sync).
156
157
  * Returns undefined if every calendar is read-only.
157
158
  */
158
159
  getDefaultWritableCalendar(): CalendarType | undefined;
@@ -505,7 +506,14 @@ interface CalendarView {
505
506
  config?: Record<string, unknown>;
506
507
  }
507
508
  type RangeChangeReason = 'initial' | 'navigation' | 'viewChange' | 'scroll';
508
- type EventChange = {
509
+ /**
510
+ * Source of an event mutation.
511
+ * - 'local': user-initiated change from the UI
512
+ * - 'remote': applied by an external sync engine (e.g. CalDAV); must not trigger write-back
513
+ * - 'drag' / 'resize': UI drag or resize interaction (pending → confirmed)
514
+ */
515
+ type EventMutationSource = 'local' | 'remote' | 'drag' | 'resize';
516
+ type RawEventChange = {
509
517
  type: 'create';
510
518
  event: Event;
511
519
  } | {
@@ -516,6 +524,19 @@ type EventChange = {
516
524
  type: 'delete';
517
525
  event: Event;
518
526
  };
527
+ type EventChange = RawEventChange & {
528
+ source: EventMutationSource;
529
+ };
530
+ /**
531
+ * Payload delivered to subscribeVisibleRangeChange listeners.
532
+ * Includes the view type so sync engines can scope their range queries correctly.
533
+ */
534
+ type VisibleRangePayload = {
535
+ start: Date;
536
+ end: Date;
537
+ reason: RangeChangeReason;
538
+ view: CalendarViewType;
539
+ };
519
540
  /**
520
541
  * Calendar callbacks interface
521
542
  * Defines calendar event callback functions
@@ -583,6 +604,15 @@ interface GridContextMenuSlotArgs {
583
604
  viewType?: ViewType;
584
605
  onClose: () => void;
585
606
  }
607
+ /** Args passed to the monthDateNumberContent slot renderer. */
608
+ interface MonthDateNumberSlotArgs {
609
+ date: Date;
610
+ day: number;
611
+ isToday: boolean;
612
+ belongsToCurrentMonth: boolean;
613
+ locale: string;
614
+ viewType: ViewType.MONTH;
615
+ }
586
616
  /**
587
617
  * Calendar application configuration
588
618
  * Used to initialize CalendarApp
@@ -654,6 +684,19 @@ interface ICalendarApp {
654
684
  getReadOnlyConfig: (id?: string) => ReadOnlyConfig;
655
685
  canMutateFromUI: (id?: string) => boolean;
656
686
  subscribe: (listener: (app: ICalendarApp) => void) => () => void;
687
+ /**
688
+ * Subscribe to visible range changes. Fires on navigation, view change, and scroll.
689
+ * The payload includes the current view so sync engines can scope range queries.
690
+ * Returns an unsubscribe function.
691
+ */
692
+ subscribeVisibleRangeChange: (listener: (payload: VisibleRangePayload) => void) => () => void;
693
+ /**
694
+ * Subscribe to all event mutations (create, update, delete).
695
+ * Each change includes a `source` field — remote sync engines should skip write-back
696
+ * when `source === 'remote'`.
697
+ * Returns an unsubscribe function.
698
+ */
699
+ subscribeEventChanges: (listener: (changes: EventChange[]) => void) => () => void;
657
700
  changeView: (view: CalendarViewType) => void;
658
701
  getCurrentView: () => CalendarView;
659
702
  getViewConfig: (viewType: CalendarViewType) => Record<string, unknown>;
@@ -671,11 +714,11 @@ interface ICalendarApp {
671
714
  updates: Partial<Event>;
672
715
  }>;
673
716
  delete?: string[];
674
- }, isPending?: boolean, source?: 'drag' | 'resize') => void;
717
+ }, isPending?: boolean, source?: EventMutationSource) => void;
675
718
  addEvent: (event: Event) => void;
676
719
  /** Add events from external sources (like subscriptions) without persisting to main DB */
677
720
  addExternalEvents: (calendarId: string, events: Event[]) => void;
678
- updateEvent: (id: string, event: Partial<Event>, isPending?: boolean, source?: 'drag' | 'resize') => Promise<void>;
721
+ updateEvent: (id: string, event: Partial<Event>, isPending?: boolean, source?: EventMutationSource) => Promise<void>;
679
722
  deleteEvent: (id: string) => Promise<void>;
680
723
  getEvents: () => Event[];
681
724
  getAllEvents: () => Event[];
@@ -700,6 +743,8 @@ interface ICalendarApp {
700
743
  dismissUI: () => void;
701
744
  getPlugin: <T = unknown>(name: string) => T | undefined;
702
745
  hasPlugin: (name: string) => boolean;
746
+ getPluginConfig: (pluginName: string) => Record<string, unknown>;
747
+ updatePluginConfig: (pluginName: string, config: Record<string, unknown>) => void;
703
748
  getCalendarHeaderConfig: () => boolean;
704
749
  triggerRender: () => void;
705
750
  getCalendarRegistry: () => CalendarRegistry;
@@ -730,11 +775,11 @@ interface UseCalendarAppReturn {
730
775
  updates: Partial<Event>;
731
776
  }>;
732
777
  delete?: string[];
733
- }, isPending?: boolean, source?: 'drag' | 'resize') => void;
778
+ }, isPending?: boolean, source?: EventMutationSource) => void;
734
779
  changeView: (view: CalendarViewType) => void;
735
780
  setCurrentDate: (date: Date) => void;
736
781
  addEvent: (event: Event) => void;
737
- updateEvent: (id: string, event: Partial<Event>, isPending?: boolean, source?: 'drag' | 'resize') => Promise<void>;
782
+ updateEvent: (id: string, event: Partial<Event>, isPending?: boolean, source?: EventMutationSource) => Promise<void>;
738
783
  deleteEvent: (id: string) => Promise<void>;
739
784
  goToToday: () => void;
740
785
  goToPrevious: () => void;
@@ -1675,6 +1720,8 @@ declare class CalendarApp implements ICalendarApp {
1675
1720
  constructor(config: CalendarAppConfig);
1676
1721
  private static resolveLocale;
1677
1722
  subscribe: (listener: (app: ICalendarApp) => void) => (() => void);
1723
+ subscribeVisibleRangeChange: (listener: (payload: VisibleRangePayload) => void) => (() => void);
1724
+ subscribeEventChanges: (listener: (changes: EventChange[]) => void) => (() => void);
1678
1725
  private notify;
1679
1726
  triggerRender: () => void;
1680
1727
  changeView: (view: CalendarViewType) => void;
@@ -1697,10 +1744,10 @@ declare class CalendarApp implements ICalendarApp {
1697
1744
  updates: Partial<Event>;
1698
1745
  }>;
1699
1746
  delete?: string[];
1700
- }, isPending?: boolean, source?: "drag" | "resize") => void;
1747
+ }, isPending?: boolean, source?: EventMutationSource) => void;
1701
1748
  addEvent: (event: Event) => void;
1702
1749
  addExternalEvents: (calendarId: string, events: Event[]) => void;
1703
- updateEvent: (id: string, eventUpdate: Partial<Event>, isPending?: boolean, source?: "drag" | "resize") => Promise<void>;
1750
+ updateEvent: (id: string, eventUpdate: Partial<Event>, isPending?: boolean, source?: EventMutationSource) => Promise<void>;
1704
1751
  deleteEvent: (id: string) => Promise<void>;
1705
1752
  getAllEvents: () => Event[];
1706
1753
  getEvents: () => Event[];
@@ -3265,22 +3312,22 @@ declare const EventLayoutCalculator: {
3265
3312
  calculateDayEventLayouts(dayEvents: Event[], params?: LayoutCalculationParams): Map<string, EventLayout>;
3266
3313
  };
3267
3314
 
3268
- interface IconProps {
3315
+ interface IconProps extends Record<string, any> {
3269
3316
  className?: string;
3270
3317
  width?: number;
3271
3318
  height?: number;
3272
3319
  title?: string;
3273
3320
  }
3274
- declare const ChevronRight: ({ className, width, height, }: IconProps) => preact.JSX.Element;
3275
- declare const ChevronDown: ({ className, width, height, }: IconProps) => preact.JSX.Element;
3276
- declare const Plus: ({ className, width, height }: IconProps) => preact.JSX.Element;
3277
- declare const Check: ({ className, width, height }: IconProps) => preact.JSX.Element;
3278
- declare const ChevronsUpDown: ({ className, width, height, }: IconProps) => preact.JSX.Element;
3279
- declare const Loader2: ({ className, width, height }: IconProps) => preact.JSX.Element;
3280
- declare const PanelRightClose: ({ className, width, height, }: IconProps) => preact.JSX.Element;
3281
- declare const PanelRightOpen: ({ className, width, height, }: IconProps) => preact.JSX.Element;
3282
- declare const AudioLines: ({ className, width, height, }: IconProps) => preact.JSX.Element;
3283
- declare const AlertCircle: ({ className, width, height, }: IconProps) => preact.JSX.Element;
3321
+ declare const ChevronRight: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3322
+ declare const ChevronDown: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3323
+ declare const Plus: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3324
+ declare const Check: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3325
+ declare const ChevronsUpDown: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3326
+ declare const Loader2: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3327
+ declare const PanelRightClose: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3328
+ declare const PanelRightOpen: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3329
+ declare const AudioLines: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3330
+ declare const AlertCircle: ({ className, width, height, ...props }: IconProps) => preact.JSX.Element;
3284
3331
 
3285
3332
  /**
3286
3333
  * Cancel button
@@ -3308,4 +3355,4 @@ declare const sidebarHeaderToggle = "df-sidebar-toggle";
3308
3355
  declare const sidebarHeaderTitle = "df-sidebar-header-title";
3309
3356
 
3310
3357
  export { AlertCircle, AudioLines, BlossomColorPicker, CalendarApp, _default as CalendarEvent, CalendarRegistry, CalendarRenderer, Check, ChevronDown, ChevronRight, ChevronsUpDown, ContentSlot, CreateCalendarDialog, CustomRenderingStore, DefaultColorPicker, DefaultEventDetailDialog, DefaultEventDetailPanel, EventContextMenu, EventLayoutCalculator, GridContextMenu, LAYOUT_CONFIG, LOCALES, Loader2, LoadingButton, LocaleContext, LocaleProvider, MiniCalendar, PanelRightClose, PanelRightOpen, Plus, TIME_STEP, TimeZone, VIRTUAL_MONTH_SCROLL_CONFIG, ViewType, WeekDataCache, addDays, analyzeMultiDayEventsForRow, buildColorBarGradient, buildDiagonalColorBarGradient, buildDiagonalPatternBackground, buildFixedWeekMonthsData, calculateDayIndex, calendarPickerDropdown, cancelButton, capitalize, clipboardStore, compareAllDayDisplayPriority, compareViews, convertToDayFlowEvent, createAgendaView, createAllDayDisplayComparator, createAllDayEvent, createConfigSyncSnapshot, createDateWithHour, createDayView, createEvent, createEventWithDate, createEventWithPlainDateTime, createEventWithRealDate, createEventWithZonedDateTime, createEvents, createEventsPlugin, createMonthView, createNormalizedCalendarAppConfigGetter, createStandardViews, createTemporalWithHour, createTimezoneEvent, createTimezoneEvents, createWeekView, createYearView, dateToPlainDate, dateToPlainDateTime, dateToZonedDateTime, daysBetween, daysDifference, downloadICS, en, escapeICSValue, extractHourFromDate, extractHourFromTemporal, extractVEvents, foldLine, formatDate, formatDateConsistent, formatDateToICSTimestamp, formatEventTimeRange, formatICSDate, formatMonthYear, formatProperty, formatTime, generateDayData, generateICS, generateSecondaryTimeSlots, generateUniKey, generateVEvent, generateWeekData, generateWeekRange, generateWeeksData, getAllDayEventsForDay, getAllDayRangeMetrics, getCalendarColorsForHex, getCalendarEventBgColors, getCalendarLineColors, getCallbackConfigUpdate, getCurrentWeekDates, getDateByDayIndex, getDateObj, getDayIndexByDate, getEndOfDay, getEndOfTemporal, getEventBgColor, getEventEndHour, getEventIcon, getEventTextColor, getEventsForDay, getEventsForWeek, getFixedWeekTotalColumns, getIntlLabel, getLineColor, getMonthLabels, getMonthYearOfWeek, getNextHourRangeInTimeZone, getNowInTimeZone, getPlainDate, getPrimaryCalendarId, getSearchHeaderInfo, getSelectedBgColor, getStartOfDay, getStartOfTemporal, getSyncConfigUpdates, getTestEvents, getTimezoneDisplayLabel, getTodayInTimeZone, getWeekDaysLabels, getWeekNumber, getWeekRange, groupDaysIntoRows, groupSearchResults, hasEventChanged, importICSFile, isDate, isDeepEqual, isEventDeepEqual, isEventInWeek, isMultiDayEvent, isMultiDayTemporalEvent, isPlainDate, isPlainDateTime, isSameDay, isSamePlainDate, isSameTemporal, isValidLocale, isZonedDateTime, monthNames, normalizeCssWidth, normalizeDate, normalizeLocale, normalizeTimeZoneValue, now, pad2, parseICS, parseICSDate, parseVEventLines, pickSyncableConfig, plainDateTimeToDate, plainDateToDate, recalculateEventDays, registerDragImplementation, registerLocale, registerSidebarImplementation, resolveAppliedTheme, restoreTimedDragFromAllDayTransition, restoreVisualEventToCanonical, restoreVisualTimedTemporalToCanonical, roundToTimeStep, scrollbarTakesSpace, setHourInTemporal, shortMonthNames, sidebarContainer, sidebarHeader, sidebarHeaderTitle, sidebarHeaderToggle, sortAllDayByTitle, subscribeCalendar, syncCalendarAppConfig, t, temporalToDate, temporalToVisualDate, temporalToVisualTemporal, today, unescapeICSValue, updateEventDateAndDay, updateEventWithRealDate, useDragForView, useLocale, useSidebarBridge, weekDays, weekDaysFullName, zonedDateTimeToDate };
3311
- export type { AgendaViewConfig, AgendaViewProps, AllDaySortComparator, BalanceStrategy, BaseViewProps, CalendarAppConfig, CalendarAppConfigSyncSnapshot, CalendarAppState, CalendarCallbacks, CalendarColors, CalendarConfig, CalendarEventProps, CalendarHeaderProps, CalendarPlugin, CalendarSearchEvent, CalendarSearchProps, CalendarType, CalendarView, CalendarViewType, CalendarsConfig, ColorPickerProps, CreateAllDayEventDateInput, CreateAllDayEventParams, CreateCalendarDialogColorPickerProps, CreateCalendarDialogProps, CreateEventParams, CreateTimezoneEventParams, CustomRendering, DayData, DayViewConfig, DayViewProps, DragConfig, DragHookOptions, DragHookReturn, DragIndicatorProps, DragIndicatorRenderer, DragIntegrationProps, DragPluginConfig, DragRef, DragService, Event, EventChange, EventContentSlotArgs, EventContextMenuSlotArgs, EventDetailContentProps, EventDetailContentRenderer, EventDetailDialogProps, EventDetailDialogRenderer, EventDetailPanelProps, EventDetailPanelRenderer, EventDetailPosition, EventGroup, EventLayout, EventRelations, EventsPluginConfig, EventsService, FixedWeekMonthData, GridContextMenuSlotArgs, ICSDateParams, ICSExportOptions, ICSImportOptions, ICSImportResult, ICSParseError, ICSVEvent, ICalendarApp, Locale, LocaleCode, LocaleContextValue, LocaleDict, LocaleMessages, LocaleProviderProps, MobileEventProps, Mode, MonthDragState, MonthEventDragState, MonthEventSegment, MonthScrollConfig, MonthViewConfig, MonthViewProps, NestedLayer, RangeChangeReason, ReadOnlyConfig, SidebarBridgeReturn, SidebarHeaderSlotArgs, SpecialLayoutRule, SubscribeResult, SubtreeAnalysis, SupportedLang, SyncableCalendarAppConfig, TComponent, TNode, ThemeColors, ThemeConfig, ThemeMode, TimeZoneValue, TitleBarSlotProps, TransferOperation, TranslationKey, UnifiedDragRef, UseCalendarAppReturn, UseCalendarReturn, UseDragCommonReturn, UseDragHandlersParams, UseDragHandlersReturn, UseDragManagerReturn, UseDragStateReturn, UseMonthDragParams, UseMonthDragReturn, UseVirtualMonthScrollProps, UseVirtualMonthScrollReturn, UseVirtualScrollProps, UseVirtualScrollReturn, UseWeekDayDragParams, UseWeekDayDragReturn, ViewAdapterProps, ViewConfigComparison, ViewFactory, ViewFactoryConfig, VirtualItem, VirtualScrollIntegrationProps, VirtualWeekItem, WeekDayDragState, WeekViewConfig, WeekViewProps, WeeksData, YearMultiDaySegment, YearViewConfig, YearViewProps, useDragProps, useDragReturn };
3358
+ export type { AgendaViewConfig, AgendaViewProps, AllDaySortComparator, BalanceStrategy, BaseViewProps, CalendarAppConfig, CalendarAppConfigSyncSnapshot, CalendarAppState, CalendarCallbacks, CalendarColors, CalendarConfig, CalendarEventProps, CalendarHeaderProps, CalendarPlugin, CalendarSearchEvent, CalendarSearchProps, CalendarType, CalendarView, CalendarViewType, CalendarsConfig, ColorPickerProps, CreateAllDayEventDateInput, CreateAllDayEventParams, CreateCalendarDialogColorPickerProps, CreateCalendarDialogProps, CreateEventParams, CreateTimezoneEventParams, CustomRendering, DayData, DayViewConfig, DayViewProps, DragConfig, DragHookOptions, DragHookReturn, DragIndicatorProps, DragIndicatorRenderer, DragIntegrationProps, DragPluginConfig, DragRef, DragService, Event, EventChange, EventContentSlotArgs, EventContextMenuSlotArgs, EventDetailContentProps, EventDetailContentRenderer, EventDetailDialogProps, EventDetailDialogRenderer, EventDetailPanelProps, EventDetailPanelRenderer, EventDetailPosition, EventGroup, EventLayout, EventMutationSource, EventRelations, EventsPluginConfig, EventsService, FixedWeekMonthData, GridContextMenuSlotArgs, ICSDateParams, ICSExportOptions, ICSImportOptions, ICSImportResult, ICSParseError, ICSVEvent, ICalendarApp, Locale, LocaleCode, LocaleContextValue, LocaleDict, LocaleMessages, LocaleProviderProps, MobileEventProps, Mode, MonthDateNumberSlotArgs, MonthDragState, MonthEventDragState, MonthEventSegment, MonthScrollConfig, MonthViewConfig, MonthViewProps, NestedLayer, RangeChangeReason, RawEventChange, ReadOnlyConfig, SidebarBridgeReturn, SidebarHeaderSlotArgs, SpecialLayoutRule, SubscribeResult, SubtreeAnalysis, SupportedLang, SyncableCalendarAppConfig, TComponent, TNode, ThemeColors, ThemeConfig, ThemeMode, TimeZoneValue, TitleBarSlotProps, TransferOperation, TranslationKey, UnifiedDragRef, UseCalendarAppReturn, UseCalendarReturn, UseDragCommonReturn, UseDragHandlersParams, UseDragHandlersReturn, UseDragManagerReturn, UseDragStateReturn, UseMonthDragParams, UseMonthDragReturn, UseVirtualMonthScrollProps, UseVirtualMonthScrollReturn, UseVirtualScrollProps, UseVirtualScrollReturn, UseWeekDayDragParams, UseWeekDayDragReturn, ViewAdapterProps, ViewConfigComparison, ViewFactory, ViewFactoryConfig, VirtualItem, VirtualScrollIntegrationProps, VirtualWeekItem, VisibleRangePayload, WeekDayDragState, WeekViewConfig, WeekViewProps, WeeksData, YearMultiDaySegment, YearViewConfig, YearViewProps, useDragProps, useDragReturn };