@dayflow/core 3.4.0 → 3.4.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 DayFlow Contributors
3
+ Copyright (c) 2025 Jayce Li
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as preact from 'preact';
2
- import { ComponentChildren, AnyComponent, h, RefObject, JSX } from 'preact';
2
+ import { ComponentChildren, AnyComponent, RefObject, JSX } from 'preact';
3
3
  import { Temporal } from 'temporal-polyfill';
4
4
  import * as preact_compat from 'preact/compat';
5
5
  export { createPortal } from 'preact/compat';
@@ -149,6 +149,12 @@ declare class CalendarRegistry {
149
149
  * Get the default calendar type
150
150
  */
151
151
  getDefaultCalendar(): CalendarType;
152
+ /**
153
+ * Get the first writable (non-readOnly, non-subscription) calendar for event creation.
154
+ * Prefers the default calendar; falls back to the first writable calendar.
155
+ * Returns undefined if every calendar is read-only.
156
+ */
157
+ getDefaultWritableCalendar(): CalendarType | undefined;
152
158
  /**
153
159
  * Set the current theme
154
160
  */
@@ -532,7 +538,7 @@ interface CalendarCallbacks {
532
538
  interface CalendarHeaderProps {
533
539
  calendar: ICalendarApp;
534
540
  switcherMode?: ViewSwitcherMode;
535
- onAddCalendar?: (e: h.JSX.TargetedMouseEvent<HTMLElement> | h.JSX.TargetedTouchEvent<HTMLElement>) => void;
541
+ onAddCalendar?: (e: MouseEvent | TouchEvent | any) => void;
536
542
  onSearchChange?: (value: string) => void;
537
543
  /** Triggered when search icon is clicked (typically on mobile) */
538
544
  onSearchClick?: () => void;
@@ -552,6 +558,17 @@ interface EventContentSlotArgs {
552
558
  isDragging: boolean;
553
559
  layout?: EventLayout;
554
560
  }
561
+ /** Args passed to the eventContextMenu slot renderer. */
562
+ interface EventContextMenuSlotArgs {
563
+ event: Event;
564
+ onClose: () => void;
565
+ }
566
+ /** Args passed to the gridContextMenu slot renderer. */
567
+ interface GridContextMenuSlotArgs {
568
+ date: Date;
569
+ viewType?: ViewType;
570
+ onClose: () => void;
571
+ }
555
572
  /**
556
573
  * Calendar application configuration
557
574
  * Used to initialize CalendarApp
@@ -573,7 +590,7 @@ interface CalendarAppConfig {
573
590
  defaultCalendar?: string;
574
591
  theme?: ThemeConfig;
575
592
  useEventDetailDialog?: boolean;
576
- useCalendarHeader?: boolean | ((props: CalendarHeaderProps) => TNode);
593
+ useCalendarHeader?: boolean;
577
594
  customMobileEventRenderer?: MobileEventRenderer;
578
595
  locale?: string | Locale;
579
596
  readOnly?: boolean | ReadOnlyConfig;
@@ -666,7 +683,7 @@ interface ICalendarApp {
666
683
  dismissUI: () => void;
667
684
  getPlugin: <T = unknown>(name: string) => T | undefined;
668
685
  hasPlugin: (name: string) => boolean;
669
- getCalendarHeaderConfig: () => boolean | ((props: CalendarHeaderProps) => TNode);
686
+ getCalendarHeaderConfig: () => boolean;
670
687
  triggerRender: () => void;
671
688
  getCalendarRegistry: () => CalendarRegistry;
672
689
  getUseEventDetailDialog: () => boolean;
@@ -1093,7 +1110,7 @@ interface EventDetailPanelProps {
1093
1110
  /** Whether the event is all-day */
1094
1111
  isAllDay: boolean;
1095
1112
  /** Event visibility state */
1096
- eventVisibility: 'visible' | 'sticky-top' | 'sticky-bottom';
1113
+ eventVisibility: 'visible' | 'sticky-top' | 'sticky-bottom' | 'sticky-left' | 'sticky-right';
1097
1114
  /** Calendar container reference */
1098
1115
  calendarRef: RefObject<HTMLDivElement>;
1099
1116
  /** Selected event element reference */
@@ -1592,7 +1609,7 @@ declare class CalendarApp implements ICalendarApp {
1592
1609
  getCalendarRegistry: () => CalendarRegistry;
1593
1610
  getUseEventDetailDialog: () => boolean;
1594
1611
  getCustomMobileEventRenderer: () => MobileEventRenderer | undefined;
1595
- getCalendarHeaderConfig: () => boolean | ((props: CalendarHeaderProps) => TNode);
1612
+ getCalendarHeaderConfig: () => boolean;
1596
1613
  get timeZone(): string;
1597
1614
  setOverrides: (overrides: string[]) => void;
1598
1615
  updateConfig: (config: Partial<CalendarAppConfig>) => void;
@@ -1609,6 +1626,7 @@ declare class CustomRenderingStore {
1609
1626
  private renderings;
1610
1627
  private overrides;
1611
1628
  private listeners;
1629
+ private overrideListeners;
1612
1630
  constructor(initialOverrides?: string[]);
1613
1631
  /**
1614
1632
  * Register a new custom rendering placeholder.
@@ -1633,7 +1651,13 @@ declare class CustomRenderingStore {
1633
1651
  * Called by the framework adapter (React/Vue/etc.)
1634
1652
  */
1635
1653
  subscribe(listener: CustomRenderingListener): () => void;
1654
+ /**
1655
+ * Subscribe only to override changes (setOverrides calls).
1656
+ * Used by ContentSlot components to avoid re-rendering on every register/unregister.
1657
+ */
1658
+ subscribeToOverrides(listener: () => void): () => void;
1636
1659
  private notify;
1660
+ private notifyOverrides;
1637
1661
  }
1638
1662
 
1639
1663
  declare class CalendarRenderer {
@@ -2805,6 +2829,29 @@ declare const restoreTimedDragFromAllDayTransition: ({ wasOriginallyAllDay, mous
2805
2829
 
2806
2830
  declare function normalizeTimeZoneValue(timeZone?: TimeZoneValue): string | undefined;
2807
2831
 
2832
+ type SyncableCalendarAppConfig = Pick<CalendarAppConfig, 'allDaySortComparator' | 'calendars' | 'customMobileEventRenderer' | 'locale' | 'readOnly' | 'switcherMode' | 'theme' | 'timeZone' | 'useCalendarHeader' | 'useEventDetailDialog' | 'views'>;
2833
+ type CalendarAppConfigSyncSnapshot = {
2834
+ callbacks: CalendarAppConfig['callbacks'];
2835
+ syncableConfig: SyncableCalendarAppConfig;
2836
+ };
2837
+ type CalendarAppConfigUpdater = {
2838
+ updateConfig: (config: Partial<CalendarAppConfig>) => void;
2839
+ };
2840
+ declare function pickSyncableConfig(config: CalendarAppConfig): SyncableCalendarAppConfig;
2841
+ declare function createConfigSyncSnapshot(config: CalendarAppConfig): CalendarAppConfigSyncSnapshot;
2842
+ declare function getCallbackConfigUpdate(previous: CalendarAppConfig['callbacks'], next: CalendarAppConfig['callbacks']): Pick<CalendarAppConfig, 'callbacks'> | null;
2843
+ declare function getSyncConfigUpdates(previous: SyncableCalendarAppConfig, next: SyncableCalendarAppConfig): Partial<CalendarAppConfig>;
2844
+ declare function syncCalendarAppConfig(app: CalendarAppConfigUpdater, previousSnapshot: CalendarAppConfigSyncSnapshot, config: CalendarAppConfig): CalendarAppConfigSyncSnapshot;
2845
+
2846
+ type CalendarAppConfigGetter = () => CalendarAppConfig;
2847
+ declare function createNormalizedCalendarAppConfigGetter(getConfig: CalendarAppConfigGetter): () => CalendarAppConfig;
2848
+
2849
+ type ViewConfigComparison = {
2850
+ hasChanges: boolean;
2851
+ requiresRender: boolean;
2852
+ };
2853
+ declare const compareViews: (previousView: CalendarView | undefined, nextView: CalendarView) => ViewConfigComparison;
2854
+
2808
2855
  interface SubscribeResult {
2809
2856
  calendar: CalendarType;
2810
2857
  events: Event[];
@@ -3203,5 +3250,5 @@ declare const sidebarHeaderToggle = "df-sidebar-header-toggle flex h-8 w-8 items
3203
3250
  */
3204
3251
  declare const sidebarHeaderTitle = "df-sidebar-header-title text-sm font-semibold text-gray-700 dark:text-gray-200";
3205
3252
 
3206
- export { AlertCircle, AudioLines, BlossomColorPicker, CalendarApp, CalendarEvent, CalendarRegistry, CalendarRenderer, Check, ChevronDown, ChevronRight, ChevronsUpDown, ContentSlot, ContextMenu, ContextMenuColorPicker, ContextMenuItem, ContextMenuLabel, ContextMenuSeparator, CreateCalendarDialog, CustomRenderingStore, RangePicker as DayflowRangePicker, DefaultColorPicker, DefaultEventDetailDialog, DefaultEventDetailPanel, EventContextMenu, GridContextMenu, LAYOUT_CONFIG, LOCALES, Loader2, LoadingButton, LocaleContext, LocaleProvider, MiniCalendar, PanelRightClose, PanelRightOpen, Plus, TIME_STEP, TimeZone, VIRTUAL_MONTH_SCROLL_CONFIG, ViewType, WeekDataCache, addDays, buildParseRegExp, calculateDayIndex, calendarPickerDropdown, cancelButton, capitalize, clipboardStore, compareAllDayDisplayPriority, conditionalTheme, convertDateEvent, convertDateEventWithTimeZone, convertToDayFlowEvent, createAllDayDisplayComparator, createAllDayEvent, createDateWithHour, createDayView, createEvent, createEventWithDate, createEventWithPlainDateTime, createEventWithRealDate, createEventWithZonedDateTime, createEvents, createEventsPlugin, createMonthView, createStandardViews, createTemporalWithHour, createTimedEvent, createTimezoneEvent, createTimezoneEvents, createWeekView, createYearView, dateToPlainDate, dateToPlainDateTime, dateToZonedDateTime, daysBetween, daysDifference, downloadICS, en, escapeICSValue, extractHourFromDate, extractHourFromTemporal, extractVEvents, foldLine, formatDate, formatDateConsistent, formatDateToICSTimestamp, formatEventTimeRange, formatICSDate, formatMonthYear, formatProperty, formatTemporal, formatTime, generateDayData, generateICS, generateSecondaryTimeSlots, generateUniKey, generateVEvent, generateWeekData, generateWeekRange, generateWeeksData, getAllDayEventsForDay, getAllDayRangeMetrics, getCalendarColorsForHex, getCurrentWeekDates, getDateByDayIndex, getDateObj, getDayIndexByDate, getEndOfDay, getEndOfTemporal, getEventBgColor, getEventEndHour, getEventTextColor, getEventsForDay, getEventsForWeek, getIntlLabel, getLineColor, getMonthLabels, getMonthYearOfWeek, getNextHourRangeInTimeZone, getNowInTimeZone, getPlainDate, getSearchHeaderInfo, getSelectedBgColor, getStartOfDay, getStartOfTemporal, getTestEvents, getTimezoneDisplayLabel, getTodayInTimeZone, getWeekDaysLabels, getWeekNumber, getWeekRange, getZoneId, groupSearchResults, hasEventChanged, importICSFile, isDate, isDeepEqual, isEventDeepEqual, isEventInWeek, isMultiDayEvent, isMultiDayTemporalEvent, isPlainDate, isPlainDateTime, isSameDay, isSamePlainDate, isSameTemporal, isValidLocale, isZonedDateTime, mergeClasses, mergeFormatTemplate, monthNames, normalizeCssWidth, normalizeDate, normalizeLocale, normalizeTimeZoneValue, normalizeToZoned, now, pad, pad2, parseICS, parseICSDate, parseTemporalString, parseVEventLines, plainDateTimeToDate, plainDateToDate, recalculateEventDays, registerDragImplementation, registerLocale, registerSidebarImplementation, resolveAppliedTheme, restoreTimedDragFromAllDayTransition, restoreVisualEventToCanonical, restoreVisualTimedTemporalToCanonical, roundToTimeStep, scrollbarTakesSpace, setHourInTemporal, shortMonthNames, sidebarContainer, sidebarHeader, sidebarHeaderTitle, sidebarHeaderToggle, sortAllDayByTitle, subscribeCalendar, t, temporalToDate, temporalToVisualDate, temporalToVisualTemporal, themeClasses, themeCn, today, unescapeICSValue, updateEventDateAndDay, updateEventWithRealDate, useDragForView, useLocale, useSidebarBridge, weekDays, weekDaysFullName, zonedDateTimeToDate };
3207
- export type { AllDaySortComparator, BalanceStrategy, BaseViewProps, CalendarAppConfig, CalendarAppState, CalendarCallbacks, CalendarColors, CalendarConfig, CalendarEventProps, CalendarHeaderProps, CalendarPlugin, CalendarType, CalendarView, CalendarViewType, CalendarsConfig, ColorPickerProps, CreateCalendarDialogColorPickerProps, CreateCalendarDialogProps, CreateEventParams, CreateTimezoneEventParams, CustomRendering, DayData, DayViewConfig, DayViewProps, DragConfig, DragHookOptions, DragHookReturn, DragIndicatorProps, DragIndicatorRenderer, DragIntegrationProps, DragPluginConfig, DragRef, DragService, Event, EventChange, EventContentSlotArgs, EventDetailContentProps, EventDetailContentRenderer, EventDetailDialogProps, EventDetailDialogRenderer, EventDetailPanelProps, EventDetailPanelRenderer, EventDetailPosition, EventGroup, EventLayout, EventRelations, EventsPluginConfig, EventsService, ICSDateParams, ICSExportOptions, ICSImportOptions, ICSImportResult, ICSParseError, ICSVEvent, ICalendarApp, Locale, LocaleCode, LocaleContextValue, LocaleDict, LocaleMessages, LocaleProviderProps, MobileEventProps, MobileEventRenderer, Mode, MonthDragState, MonthEventDragState, MonthScrollConfig, MonthViewConfig, MonthViewProps, NestedLayer, RangeChangeReason, RangePickerProps, ReadOnlyConfig, SidebarBridgeReturn, SidebarHeaderSlotArgs, SpecialLayoutRule, SubscribeResult, SubtreeAnalysis, SupportedLang, 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, ViewFactory, ViewFactoryConfig, VirtualItem, VirtualScrollIntegrationProps, VirtualWeekItem, WeekDayDragState, WeekViewConfig, WeekViewProps, WeeksData, YearViewConfig, YearViewProps, ZonedRange, useDragProps, useDragReturn };
3253
+ export { AlertCircle, AudioLines, BlossomColorPicker, CalendarApp, CalendarEvent, CalendarRegistry, CalendarRenderer, Check, ChevronDown, ChevronRight, ChevronsUpDown, ContentSlot, ContextMenu, ContextMenuColorPicker, ContextMenuItem, ContextMenuLabel, ContextMenuSeparator, CreateCalendarDialog, CustomRenderingStore, RangePicker as DayflowRangePicker, DefaultColorPicker, DefaultEventDetailDialog, DefaultEventDetailPanel, EventContextMenu, GridContextMenu, LAYOUT_CONFIG, LOCALES, Loader2, LoadingButton, LocaleContext, LocaleProvider, MiniCalendar, PanelRightClose, PanelRightOpen, Plus, TIME_STEP, TimeZone, VIRTUAL_MONTH_SCROLL_CONFIG, ViewType, WeekDataCache, addDays, buildParseRegExp, calculateDayIndex, calendarPickerDropdown, cancelButton, capitalize, clipboardStore, compareAllDayDisplayPriority, compareViews, conditionalTheme, convertDateEvent, convertDateEventWithTimeZone, convertToDayFlowEvent, createAllDayDisplayComparator, createAllDayEvent, createConfigSyncSnapshot, createDateWithHour, createDayView, createEvent, createEventWithDate, createEventWithPlainDateTime, createEventWithRealDate, createEventWithZonedDateTime, createEvents, createEventsPlugin, createMonthView, createNormalizedCalendarAppConfigGetter, createStandardViews, createTemporalWithHour, createTimedEvent, createTimezoneEvent, createTimezoneEvents, createWeekView, createYearView, dateToPlainDate, dateToPlainDateTime, dateToZonedDateTime, daysBetween, daysDifference, downloadICS, en, escapeICSValue, extractHourFromDate, extractHourFromTemporal, extractVEvents, foldLine, formatDate, formatDateConsistent, formatDateToICSTimestamp, formatEventTimeRange, formatICSDate, formatMonthYear, formatProperty, formatTemporal, formatTime, generateDayData, generateICS, generateSecondaryTimeSlots, generateUniKey, generateVEvent, generateWeekData, generateWeekRange, generateWeeksData, getAllDayEventsForDay, getAllDayRangeMetrics, getCalendarColorsForHex, getCallbackConfigUpdate, getCurrentWeekDates, getDateByDayIndex, getDateObj, getDayIndexByDate, getEndOfDay, getEndOfTemporal, getEventBgColor, getEventEndHour, getEventTextColor, getEventsForDay, getEventsForWeek, getIntlLabel, getLineColor, getMonthLabels, getMonthYearOfWeek, getNextHourRangeInTimeZone, getNowInTimeZone, getPlainDate, getSearchHeaderInfo, getSelectedBgColor, getStartOfDay, getStartOfTemporal, getSyncConfigUpdates, getTestEvents, getTimezoneDisplayLabel, getTodayInTimeZone, getWeekDaysLabels, getWeekNumber, getWeekRange, getZoneId, groupSearchResults, hasEventChanged, importICSFile, isDate, isDeepEqual, isEventDeepEqual, isEventInWeek, isMultiDayEvent, isMultiDayTemporalEvent, isPlainDate, isPlainDateTime, isSameDay, isSamePlainDate, isSameTemporal, isValidLocale, isZonedDateTime, mergeClasses, mergeFormatTemplate, monthNames, normalizeCssWidth, normalizeDate, normalizeLocale, normalizeTimeZoneValue, normalizeToZoned, now, pad, pad2, parseICS, parseICSDate, parseTemporalString, 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, themeClasses, themeCn, today, unescapeICSValue, updateEventDateAndDay, updateEventWithRealDate, useDragForView, useLocale, useSidebarBridge, weekDays, weekDaysFullName, zonedDateTimeToDate };
3254
+ export type { AllDaySortComparator, BalanceStrategy, BaseViewProps, CalendarAppConfig, CalendarAppConfigSyncSnapshot, CalendarAppState, CalendarCallbacks, CalendarColors, CalendarConfig, CalendarEventProps, CalendarHeaderProps, CalendarPlugin, CalendarType, CalendarView, CalendarViewType, CalendarsConfig, ColorPickerProps, 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, GridContextMenuSlotArgs, ICSDateParams, ICSExportOptions, ICSImportOptions, ICSImportResult, ICSParseError, ICSVEvent, ICalendarApp, Locale, LocaleCode, LocaleContextValue, LocaleDict, LocaleMessages, LocaleProviderProps, MobileEventProps, MobileEventRenderer, Mode, MonthDragState, MonthEventDragState, MonthScrollConfig, MonthViewConfig, MonthViewProps, NestedLayer, RangeChangeReason, RangePickerProps, 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, YearViewConfig, YearViewProps, ZonedRange, useDragProps, useDragReturn };