@rokoyfa/calendar 1.2.0 → 1.3.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.
- package/CHANGELOG.md +22 -0
- package/DEVELOPER_GUIDE.md +1045 -0
- package/README.md +41 -190
- package/api/openapi.yaml +395 -4
- package/demo/calendar.config.jsonc +183 -0
- package/demo/calendar.config.yaml +180 -0
- package/dist-lib/cdn/browser-BSbYkIQu.js +130 -0
- package/dist-lib/cdn/browser-BSbYkIQu.js.map +1 -0
- package/dist-lib/cdn/calendar-widget.js +14 -11
- package/dist-lib/cdn/calendar-widget.js.map +1 -1
- package/dist-lib/cdn/de-Dqga3QZG.js +2 -0
- package/dist-lib/cdn/de-Dqga3QZG.js.map +1 -0
- package/dist-lib/cdn/es-BWSfTMjh.js +2 -0
- package/dist-lib/cdn/es-BWSfTMjh.js.map +1 -0
- package/dist-lib/cdn/fr-N9gwLjVq.js +2 -0
- package/dist-lib/cdn/fr-N9gwLjVq.js.map +1 -0
- package/dist-lib/cdn/it-B5Ib2xLn.js +2 -0
- package/dist-lib/cdn/it-B5Ib2xLn.js.map +1 -0
- package/dist-lib/cdn/nl-CjI7Uc8l.js +2 -0
- package/dist-lib/cdn/nl-CjI7Uc8l.js.map +1 -0
- package/dist-lib/cdn/pl-FRu3yQhc.js +2 -0
- package/dist-lib/cdn/pl-FRu3yQhc.js.map +1 -0
- package/dist-lib/cdn/pt-DBKJ-3Is.js +2 -0
- package/dist-lib/cdn/pt-DBKJ-3Is.js.map +1 -0
- package/dist-lib/npm/{de-Cuz-uz3s.js → de-DhWrY8Ae.js} +111 -3
- package/dist-lib/npm/de-DhWrY8Ae.js.map +1 -0
- package/dist-lib/npm/{es-BnRzdU90.js → es-Bj8leuD5.js} +111 -3
- package/dist-lib/npm/es-Bj8leuD5.js.map +1 -0
- package/dist-lib/npm/{fr-B-nmvStg.js → fr-DzAFZ0jh.js} +111 -3
- package/dist-lib/npm/fr-DzAFZ0jh.js.map +1 -0
- package/dist-lib/npm/index.js +3876 -1400
- package/dist-lib/npm/index.js.map +1 -1
- package/dist-lib/npm/{it-DMTpE4GO.js → it-lEmGP5yo.js} +111 -3
- package/dist-lib/npm/it-lEmGP5yo.js.map +1 -0
- package/dist-lib/npm/{nl-DQkyEt9Z.js → nl-d1h63dvm.js} +111 -3
- package/dist-lib/npm/nl-d1h63dvm.js.map +1 -0
- package/dist-lib/npm/{pl-CcjU41yx.js → pl-DynFKadb.js} +111 -3
- package/dist-lib/npm/pl-DynFKadb.js.map +1 -0
- package/dist-lib/npm/{pt-Dulais2f.js → pt-foL7jDsE.js} +111 -3
- package/dist-lib/npm/pt-foL7jDsE.js.map +1 -0
- package/dist-lib/npm/types/components/Icons.d.ts +2 -0
- package/dist-lib/npm/types/config/routes.d.ts +1 -0
- package/dist-lib/npm/types/context/HostBridge.d.ts +38 -0
- package/dist-lib/npm/types/context/HostContext.d.ts +39 -2
- package/dist-lib/npm/types/data/restDataSource.d.ts +3 -1
- package/dist-lib/npm/types/data/tenantDataSource.d.ts +3 -1
- package/dist-lib/npm/types/data/types.d.ts +4 -1
- package/dist-lib/npm/types/features/attachments/components/AttachmentsField.d.ts +8 -0
- package/dist-lib/npm/types/features/attachments/hooks/useAttachments.d.ts +11 -0
- package/dist-lib/npm/types/features/attachments/index.d.ts +2 -0
- package/dist-lib/npm/types/features/authorization/components/account/DataExportSection.d.ts +1 -0
- package/dist-lib/npm/types/features/authorization/hooks/useAuth.d.ts +1 -0
- package/dist-lib/npm/types/features/authorization/index.d.ts +1 -0
- package/dist-lib/npm/types/features/authorization/repositories/HostTokenAuthRepository.d.ts +1 -0
- package/dist-lib/npm/types/features/authorization/repositories/RemoteAuthRepository.d.ts +1 -0
- package/dist-lib/npm/types/features/authorization/types/auth.d.ts +2 -0
- package/dist-lib/npm/types/features/calendar/components/Calendar.d.ts +7 -1
- package/dist-lib/npm/types/features/calendar/components/CalendarHeader.d.ts +3 -1
- package/dist-lib/npm/types/features/calendar/constants/views.d.ts +2 -2
- package/dist-lib/npm/types/features/calendar/hooks/useEventNavigation.d.ts +4 -0
- package/dist-lib/npm/types/features/calendar/hooks/useHostController.d.ts +2 -0
- package/dist-lib/npm/types/features/calendar/hooks/useLiveEvents.d.ts +11 -0
- package/dist-lib/npm/types/features/calendar/hooks/useSegmentAttributes.d.ts +2 -0
- package/dist-lib/npm/types/features/calendar/utils/eventLabels.d.ts +4 -0
- package/dist-lib/npm/types/features/calendars/components/settings/ShareSection.d.ts +4 -0
- package/dist-lib/npm/types/features/calendars/components/settings/TrashSection.d.ts +4 -0
- package/dist-lib/npm/types/features/calendars/index.d.ts +1 -1
- package/dist-lib/npm/types/features/calendars/repositories/RemoteCalendarRepository.d.ts +3 -0
- package/dist-lib/npm/types/features/calendars/types/calendar.d.ts +3 -0
- package/dist-lib/npm/types/features/calendars/utils/permissions.d.ts +4 -0
- package/dist-lib/npm/types/features/categories/components/CategoriesSection.d.ts +6 -0
- package/dist-lib/npm/types/features/categories/components/CategoryField.d.ts +9 -0
- package/dist-lib/npm/types/features/categories/components/CategoryFilterModal.d.ts +10 -0
- package/dist-lib/npm/types/features/categories/hooks/useCategories.d.ts +9 -0
- package/dist-lib/npm/types/features/categories/index.d.ts +4 -0
- package/dist-lib/npm/types/features/events/components/DeleteEventModal.d.ts +2 -1
- package/dist-lib/npm/types/features/events/components/EventModal.d.ts +11 -3
- package/dist-lib/npm/types/features/events/hooks/useEvents.d.ts +4 -1
- package/dist-lib/npm/types/features/events/index.d.ts +2 -2
- package/dist-lib/npm/types/features/events/utils/icalExchange.d.ts +4 -1
- package/dist-lib/npm/types/features/storage/index.d.ts +6 -1
- package/dist-lib/npm/types/features/storage/repositories/LocalCategoryRepository.d.ts +14 -0
- package/dist-lib/npm/types/features/storage/repositories/LocalEventRepository.d.ts +8 -2
- package/dist-lib/npm/types/features/storage/repositories/RemoteAttachmentRepository.d.ts +11 -0
- package/dist-lib/npm/types/features/storage/repositories/RemoteCategoryRepository.d.ts +10 -0
- package/dist-lib/npm/types/features/storage/repositories/RemoteChatRepository.d.ts +2 -1
- package/dist-lib/npm/types/features/storage/repositories/RemoteEventRepository.d.ts +9 -3
- package/dist-lib/npm/types/features/storage/repositories/RemoteSharedCalendarRepository.d.ts +9 -0
- package/dist-lib/npm/types/features/storage/types/storage.d.ts +30 -2
- package/dist-lib/npm/types/features/storage/utils/liveSocket.d.ts +10 -0
- package/dist-lib/npm/types/i18n/messages/en/calendar.d.ts +9 -0
- package/dist-lib/npm/types/i18n/messages/en/calendars.d.ts +44 -0
- package/dist-lib/npm/types/i18n/messages/en/core.d.ts +1 -0
- package/dist-lib/npm/types/i18n/messages/en/events.d.ts +37 -0
- package/dist-lib/npm/types/i18n/messages/en/index.d.ts +99 -1
- package/dist-lib/npm/types/i18n/messages/en/settings.d.ts +7 -0
- package/dist-lib/npm/types/i18n/messages/index.d.ts +99 -1
- package/dist-lib/npm/types/lib/CalendarWidget.d.ts +1 -1
- package/dist-lib/npm/types/lib/IsolatedRoot.d.ts +3 -1
- package/dist-lib/npm/types/lib/appearance.d.ts +3 -0
- package/dist-lib/npm/types/lib/config.d.ts +16 -27
- package/dist-lib/npm/types/lib/configFile.d.ts +6 -0
- package/dist-lib/npm/types/lib/defaults.d.ts +29 -1
- package/dist-lib/npm/types/lib/element.d.ts +15 -1
- package/dist-lib/npm/types/lib/handle.d.ts +15 -0
- package/dist-lib/npm/types/lib/index.d.ts +6 -2
- package/dist-lib/npm/types/lib/options.d.ts +47 -0
- package/dist-lib/npm/types/lib/useCalendarOptions.d.ts +11 -0
- package/dist-lib/npm/types/pages/SharedCalendarPage.d.ts +1 -0
- package/dist-lib/npm/types/utils/api.d.ts +1 -0
- package/dist-lib/npm/types/utils/appError.d.ts +1 -1
- package/dist-lib/npm/types/utils/attachment.d.ts +31 -0
- package/dist-lib/npm/types/utils/calendarView.d.ts +1 -0
- package/dist-lib/npm/types/utils/category.d.ts +18 -0
- package/dist-lib/npm/types/utils/conflict.d.ts +1 -0
- package/dist-lib/npm/types/utils/dataExport.d.ts +13 -0
- package/dist-lib/npm/types/utils/event.d.ts +6 -1
- package/dist-lib/npm/types/utils/eventChange.d.ts +13 -0
- package/dist-lib/npm/types/utils/ical.d.ts +6 -1
- package/dist-lib/npm/types/utils/sharedCalendar.d.ts +13 -0
- package/dist-lib/npm/types/utils/trash.d.ts +14 -0
- package/package.json +8 -2
- package/schema/calendar-config.schema.json +297 -0
- package/dist-lib/cdn/de-BjzK4Pgn.js +0 -2
- package/dist-lib/cdn/de-BjzK4Pgn.js.map +0 -1
- package/dist-lib/cdn/es-TA5DvEsw.js +0 -2
- package/dist-lib/cdn/es-TA5DvEsw.js.map +0 -1
- package/dist-lib/cdn/fr-Dx-nmhQ7.js +0 -2
- package/dist-lib/cdn/fr-Dx-nmhQ7.js.map +0 -1
- package/dist-lib/cdn/it-D_2eA3dT.js +0 -2
- package/dist-lib/cdn/it-D_2eA3dT.js.map +0 -1
- package/dist-lib/cdn/nl-dC1zae2Z.js +0 -2
- package/dist-lib/cdn/nl-dC1zae2Z.js.map +0 -1
- package/dist-lib/cdn/pl-9TYRPoy1.js +0 -2
- package/dist-lib/cdn/pl-9TYRPoy1.js.map +0 -1
- package/dist-lib/cdn/pt-CvBN-qx1.js +0 -2
- package/dist-lib/cdn/pt-CvBN-qx1.js.map +0 -1
- package/dist-lib/npm/de-Cuz-uz3s.js.map +0 -1
- package/dist-lib/npm/es-BnRzdU90.js.map +0 -1
- package/dist-lib/npm/fr-B-nmvStg.js.map +0 -1
- package/dist-lib/npm/it-DMTpE4GO.js.map +0 -1
- package/dist-lib/npm/nl-DQkyEt9Z.js.map +0 -1
- package/dist-lib/npm/pl-CcjU41yx.js.map +0 -1
- package/dist-lib/npm/pt-Dulais2f.js.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ParsedOptions } from './options.js';
|
|
2
|
+
export type ConfigFormat = 'json' | 'yaml';
|
|
3
|
+
export declare const getConfigFormat: (url: string, contentType: string | null) => ConfigFormat;
|
|
4
|
+
export declare const stripJsonComments: (source: string) => string;
|
|
5
|
+
export declare function parseConfigText(source: string, format: ConfigFormat): Promise<ParsedOptions>;
|
|
6
|
+
export declare function loadConfigFile(url: string, signal?: AbortSignal): Promise<ParsedOptions>;
|
|
@@ -1,11 +1,39 @@
|
|
|
1
|
+
import { type CalendarView } from '../utils/calendarView.js';
|
|
1
2
|
export declare const STORAGE_MODES: readonly ["local", "remote"];
|
|
2
3
|
export type StorageMode = (typeof STORAGE_MODES)[number];
|
|
3
4
|
export declare const HOLIDAY_SOURCES: readonly ["library", "backend"];
|
|
4
5
|
export type HolidaySource = (typeof HOLIDAY_SOURCES)[number];
|
|
5
|
-
export
|
|
6
|
+
export declare const DEFAULT_FEATURES: {
|
|
6
7
|
auth: boolean;
|
|
7
8
|
teams: boolean;
|
|
9
|
+
chat: boolean;
|
|
10
|
+
attendees: boolean;
|
|
11
|
+
recurrence: boolean;
|
|
12
|
+
reminders: boolean;
|
|
13
|
+
links: boolean;
|
|
14
|
+
mapLinks: boolean;
|
|
15
|
+
holidays: boolean;
|
|
16
|
+
search: boolean;
|
|
17
|
+
undo: boolean;
|
|
18
|
+
duplicate: boolean;
|
|
19
|
+
shortcuts: boolean;
|
|
20
|
+
subscriptions: boolean;
|
|
21
|
+
importExport: boolean;
|
|
22
|
+
emailNotifications: boolean;
|
|
23
|
+
timeZones: boolean;
|
|
24
|
+
customColors: boolean;
|
|
25
|
+
categories: boolean;
|
|
26
|
+
publicLinks: boolean;
|
|
27
|
+
attachments: boolean;
|
|
28
|
+
liveUpdates: boolean;
|
|
29
|
+
trash: boolean;
|
|
30
|
+
dataExport: boolean;
|
|
8
31
|
};
|
|
32
|
+
export type CalendarFeatures = typeof DEFAULT_FEATURES;
|
|
33
|
+
export type CalendarFeature = keyof CalendarFeatures;
|
|
34
|
+
export declare const FEATURE_NAMES: CalendarFeature[];
|
|
35
|
+
export declare const resolveFeatures: (features?: Partial<CalendarFeatures>) => CalendarFeatures;
|
|
36
|
+
export declare const resolveViews: (views: readonly CalendarView[] | undefined) => readonly CalendarView[];
|
|
9
37
|
export type CalendarConfig = {
|
|
10
38
|
storageMode: StorageMode;
|
|
11
39
|
apiBaseUrl: string;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { CalendarDataSource } from '../data/index.js';
|
|
2
2
|
import type { UserTokenProvider } from '../features/authorization/index.js';
|
|
3
|
+
import { type CalendarView } from '../utils/calendarView.js';
|
|
4
|
+
import { type CalendarConfigSource, type CalendarFeature, type CalendarState, type NewEventDraft } from './config.js';
|
|
3
5
|
import type { MessageOverrides } from '../i18n/index.js';
|
|
4
6
|
export declare const DEFAULT_ELEMENT_NAME = "calendar-widget";
|
|
7
|
+
export declare const toFeatureAttribute: (feature: CalendarFeature) => string;
|
|
5
8
|
export declare class CalendarElement extends HTMLElement {
|
|
6
9
|
#private;
|
|
7
|
-
static observedAttributes:
|
|
10
|
+
static observedAttributes: string[];
|
|
8
11
|
static readonly version: string;
|
|
9
12
|
get dataSource(): CalendarDataSource | undefined;
|
|
10
13
|
set dataSource(value: CalendarDataSource | undefined);
|
|
@@ -12,8 +15,19 @@ export declare class CalendarElement extends HTMLElement {
|
|
|
12
15
|
set getUserToken(value: UserTokenProvider | undefined);
|
|
13
16
|
get messages(): MessageOverrides | undefined;
|
|
14
17
|
set messages(value: MessageOverrides | undefined);
|
|
18
|
+
get config(): CalendarConfigSource | undefined;
|
|
19
|
+
set config(value: CalendarConfigSource | undefined);
|
|
15
20
|
connectedCallback(): void;
|
|
16
21
|
disconnectedCallback(): void;
|
|
17
22
|
attributeChangedCallback(): void;
|
|
23
|
+
getState(): CalendarState | null;
|
|
24
|
+
goToDate(date: string | Date): boolean;
|
|
25
|
+
setView(view: CalendarView): boolean;
|
|
26
|
+
next(): boolean;
|
|
27
|
+
previous(): boolean;
|
|
28
|
+
today(): boolean;
|
|
29
|
+
openEvent(eventId: string, date: string | Date): boolean;
|
|
30
|
+
createEvent(draft?: NewEventDraft): boolean;
|
|
31
|
+
refresh(): boolean;
|
|
18
32
|
}
|
|
19
33
|
export declare function defineCalendarElement(name?: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CalendarState, HostBridge, NewEventDraft } from '../context/HostBridge.js';
|
|
2
|
+
import { type CalendarView } from '../utils/calendarView.js';
|
|
3
|
+
export type CalendarHandle = {
|
|
4
|
+
getState: () => CalendarState | null;
|
|
5
|
+
goToDate: (date: string | Date) => boolean;
|
|
6
|
+
setView: (view: CalendarView) => boolean;
|
|
7
|
+
next: () => boolean;
|
|
8
|
+
previous: () => boolean;
|
|
9
|
+
today: () => boolean;
|
|
10
|
+
openEvent: (eventId: string, date: string | Date) => boolean;
|
|
11
|
+
createEvent: (draft?: NewEventDraft) => boolean;
|
|
12
|
+
refresh: () => boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const HANDLE_METHODS: readonly ["getState", "goToDate", "setView", "next", "previous", "today", "openEvent", "createEvent", "refresh"];
|
|
15
|
+
export declare const createCalendarHandle: (bridge: HostBridge) => CalendarHandle;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { CalendarWidget as Calendar } from './CalendarWidget.js';
|
|
2
2
|
export { VERSION } from './version.js';
|
|
3
3
|
export { CalendarElement, DEFAULT_ELEMENT_NAME, defineCalendarElement } from './element.js';
|
|
4
|
-
export
|
|
4
|
+
export { DEFAULT_FEATURES, FEATURE_NAMES, parseCalendarOptions } from './config.js';
|
|
5
|
+
export type { CalendarAppearance, CalendarConfigSource, CalendarHandle, CalendarState, NewEventDraft, CalendarFeature, CalendarFeatures, CalendarOptions, CalendarProps, CalendarRouting, HolidaySource, ParsedOptions, StorageMode, } from './config.js';
|
|
5
6
|
export type { DeletedEvent, EventCallbacks } from './eventCallbacks.js';
|
|
6
7
|
export type { HostTheme } from '../context/HostContext.js';
|
|
7
8
|
export type { CalendarView } from '../utils/calendarView.js';
|
|
@@ -10,8 +11,11 @@ export { localDataSource, restDataSource, TENANT_HEADER, tenantDataSource } from
|
|
|
10
11
|
export type { CalendarDataSource, DataRepositories, DataSession, DataSourceContext, RestDataSourceOptions, TenantDataSourceOptions, } from '../data/index.js';
|
|
11
12
|
export type { AuthMethod, AuthRepository, User, UserTokenProvider } from '../features/authorization/index.js';
|
|
12
13
|
export type { CalendarChanges, CalendarDraft, CalendarRepository, CalendarSummary, Invitation, PendingInvitation, TeamChanges, TeamInvitation, TeamMember, TeamRole, } from '../features/calendars/index.js';
|
|
13
|
-
export type { ColorRepository, EventQuery, EventRepository, EventSearchQuery, HolidayQuery, HolidayRepository, PreferencesRepository, } from '../features/storage/index.js';
|
|
14
|
+
export type { CategoryRepository, ChatRepository, SharedCalendarRepository, ColorRepository, EventQuery, EventRepository, EventSearchQuery, HolidayQuery, HolidayRepository, PreferencesRepository, } from '../features/storage/index.js';
|
|
14
15
|
export type { Attendee, AttendeeStatus, CalendarEvent, EventInput, EventLink } from '../utils/event.js';
|
|
16
|
+
export type { ChatEvent, ChatKey, ChatMessage, ChatPage, ChatUnread } from '../utils/chat.js';
|
|
17
|
+
export type { Category } from '../utils/category.js';
|
|
18
|
+
export type { SharedCalendar } from '../utils/sharedCalendar.js';
|
|
15
19
|
export type { Preferences } from '../utils/preferences.js';
|
|
16
20
|
export type { PublicHoliday } from '../utils/holidays.js';
|
|
17
21
|
export type { Recurrence } from '../utils/recurrence.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HostTheme } from '../context/HostContext.js';
|
|
2
|
+
import type { MessageOverrides } from '../i18n/index.js';
|
|
3
|
+
import { type CalendarView } from '../utils/calendarView.js';
|
|
4
|
+
import { type CalendarFeatures, type HolidaySource, type StorageMode } from './defaults.js';
|
|
5
|
+
export declare const ROUTING_MODES: readonly ["memory", "browser"];
|
|
6
|
+
export type CalendarRouting = (typeof ROUTING_MODES)[number];
|
|
7
|
+
export declare const HOST_THEMES: readonly ["light", "dark"];
|
|
8
|
+
export type CalendarOptions = {
|
|
9
|
+
tenant?: string;
|
|
10
|
+
storageMode?: StorageMode;
|
|
11
|
+
apiBaseUrl?: string;
|
|
12
|
+
apiTimeoutMs?: number;
|
|
13
|
+
features?: Partial<CalendarFeatures>;
|
|
14
|
+
views?: readonly CalendarView[];
|
|
15
|
+
routing?: CalendarRouting;
|
|
16
|
+
basename?: string;
|
|
17
|
+
initialPath?: string;
|
|
18
|
+
linkParam?: string | false;
|
|
19
|
+
locale?: string;
|
|
20
|
+
messages?: MessageOverrides;
|
|
21
|
+
theme?: HostTheme;
|
|
22
|
+
initialView?: CalendarView;
|
|
23
|
+
timeZone?: string;
|
|
24
|
+
holidays?: string;
|
|
25
|
+
holidaySource?: HolidaySource;
|
|
26
|
+
mapUrl?: string;
|
|
27
|
+
readOnly?: boolean;
|
|
28
|
+
appearance?: CalendarAppearance;
|
|
29
|
+
};
|
|
30
|
+
export type CalendarAppearance = {
|
|
31
|
+
accentColor?: string;
|
|
32
|
+
fontFamily?: string;
|
|
33
|
+
radius?: number;
|
|
34
|
+
density?: 'comfortable' | 'compact';
|
|
35
|
+
};
|
|
36
|
+
export declare const DENSITIES: readonly ["comfortable", "compact"];
|
|
37
|
+
export type CalendarOptionName = keyof CalendarOptions;
|
|
38
|
+
export type ParsedOptions = {
|
|
39
|
+
options: CalendarOptions;
|
|
40
|
+
issues: string[];
|
|
41
|
+
};
|
|
42
|
+
export declare const MAX_RADIUS = 24;
|
|
43
|
+
export declare const isCssColor: (value: unknown) => value is string;
|
|
44
|
+
export declare const isFontFamily: (value: unknown) => value is string;
|
|
45
|
+
export declare const OPTION_NAMES: CalendarOptionName[];
|
|
46
|
+
export declare function parseCalendarOptions(value: unknown): ParsedOptions;
|
|
47
|
+
export declare function mergeCalendarOptions(base: CalendarOptions, overrides: CalendarOptions): CalendarOptions;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CalendarOptions } from './options.js';
|
|
2
|
+
export type CalendarConfigSource = string | CalendarOptions;
|
|
3
|
+
export type ConfigState = {
|
|
4
|
+
status: 'ready';
|
|
5
|
+
options: CalendarOptions;
|
|
6
|
+
} | {
|
|
7
|
+
status: 'loading';
|
|
8
|
+
} | {
|
|
9
|
+
status: 'error';
|
|
10
|
+
};
|
|
11
|
+
export declare function useCalendarOptions(config: CalendarConfigSource | undefined): ConfigState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SharedCalendarPage(): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const ERROR_CODES: readonly ["unknown", "eventNotFound", "accountRequired", "saveEventsFailed", "savePreferencesFailed", "saveColorFailed", "saveDecisionFailed", "invalidLink", "invalidResetLink", "invalidCredentials", "emailTaken", "wrongCurrentPassword", "wrongPassword", "soleOwner", "unauthorized", "forbidden", "notFound", "serverError", "payloadTooLarge", "calendarNotFound", "teamNotFound", "memberNotFound", "invitationNotFound", "invitationExpired", "tooManyLoginAttempts", "seriesHasDetached", "selfInvite", "alreadyMember", "alreadyInvited", "personalTeam", "lastOwner", "alreadyOwner", "lastCalendar", "tooManyColors", "managedByHost", "unknownTenant", "originNotAllowed", "invalidUserToken"];
|
|
1
|
+
declare const ERROR_CODES: readonly ["unknown", "eventNotFound", "accountRequired", "saveEventsFailed", "savePreferencesFailed", "saveColorFailed", "saveCategoriesFailed", "categoryExists", "tooManyCategories", "categoryNotFound", "shareNotFound", "attachmentNotFound", "eventChanged", "seriesDeleted", "attachmentTooLarge", "tooManyAttachments", "saveDecisionFailed", "invalidLink", "invalidResetLink", "invalidCredentials", "emailTaken", "wrongCurrentPassword", "wrongPassword", "soleOwner", "unauthorized", "forbidden", "notFound", "serverError", "payloadTooLarge", "calendarNotFound", "teamNotFound", "memberNotFound", "invitationNotFound", "invitationExpired", "tooManyLoginAttempts", "seriesHasDetached", "selfInvite", "alreadyMember", "alreadyInvited", "personalTeam", "lastOwner", "alreadyOwner", "lastCalendar", "tooManyColors", "managedByHost", "unknownTenant", "originNotAllowed", "invalidUserToken"];
|
|
2
2
|
export declare const isErrorCode: (value: unknown) => value is ErrorCode;
|
|
3
3
|
export type ErrorCode = (typeof ERROR_CODES)[number];
|
|
4
4
|
export declare class AppError extends Error {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const MAX_ATTACHMENT_SIZE: number;
|
|
2
|
+
export declare const MAX_ATTACHMENTS = 20;
|
|
3
|
+
export declare const ATTACHMENT_NAME_MAX_LENGTH = 200;
|
|
4
|
+
export type Attachment = {
|
|
5
|
+
id: string;
|
|
6
|
+
eventId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
type: string;
|
|
9
|
+
size: number;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
uploadedBy: {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
} | null;
|
|
15
|
+
};
|
|
16
|
+
export type RejectedFile = {
|
|
17
|
+
name: string;
|
|
18
|
+
reason: 'tooLarge' | 'empty' | 'tooMany';
|
|
19
|
+
};
|
|
20
|
+
export declare const cleanFileName: (name: string) => string;
|
|
21
|
+
export declare const parseAttachment: (value: unknown) => Attachment | null;
|
|
22
|
+
export declare const parseAttachments: (value: unknown) => Attachment[];
|
|
23
|
+
export declare const checkFiles: <T extends {
|
|
24
|
+
name: string;
|
|
25
|
+
size: number;
|
|
26
|
+
}>(files: readonly T[], existing: number) => {
|
|
27
|
+
accepted: T[];
|
|
28
|
+
rejected: RejectedFile[];
|
|
29
|
+
};
|
|
30
|
+
export declare const formatFileSize: (bytes: number, locale?: string) => string;
|
|
31
|
+
export declare const saveBlob: (blob: Blob, name: string, root?: ParentNode & Node) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const CALENDAR_VIEWS: readonly ["day", "week", "month", "year"];
|
|
2
2
|
export type CalendarView = (typeof CALENDAR_VIEWS)[number];
|
|
3
3
|
export declare const isCalendarView: (value: unknown) => value is CalendarView;
|
|
4
|
+
export declare const nearestView: (wanted: CalendarView, enabled: readonly CalendarView[]) => CalendarView;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const CATEGORY_NAME_MAX_LENGTH = 40;
|
|
2
|
+
export declare const MAX_CATEGORIES = 30;
|
|
3
|
+
export declare const MAX_EVENT_CATEGORIES = 5;
|
|
4
|
+
export type Category = {
|
|
5
|
+
id: string;
|
|
6
|
+
calendarId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const UNCATEGORIZED = "";
|
|
10
|
+
export type CategoryFilter = ReadonlySet<string> | null;
|
|
11
|
+
export declare const parseCategory: (value: unknown) => Category | null;
|
|
12
|
+
export declare const parseCategories: (value: unknown) => Category[];
|
|
13
|
+
export declare const parseCategoryIds: (value: unknown) => string[];
|
|
14
|
+
export declare const normalizeCategoryName: (name: string) => string;
|
|
15
|
+
export declare const isCategoryNameTaken: (categories: readonly Category[], calendarId: string, name: string, ownId?: string) => boolean;
|
|
16
|
+
export declare const sortCategories: (categories: readonly Category[], locale?: string) => Category[];
|
|
17
|
+
export declare const matchesCategoryFilter: (categoryIds: readonly string[], known: ReadonlySet<string>, filter: CategoryFilter) => boolean;
|
|
18
|
+
export declare const toggleCategoryFilter: (filter: CategoryFilter, all: readonly string[], id: string) => CategoryFilter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isEventChanged: (error: unknown) => boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const LOCAL_EXPORT_FORMAT = "calendar-browser-export";
|
|
2
|
+
type ReadableStorage = Pick<Storage, 'length' | 'key' | 'getItem'>;
|
|
3
|
+
export declare const collectLocalData: (storage: ReadableStorage, exportedAt?: Date) => {
|
|
4
|
+
format: string;
|
|
5
|
+
version: number;
|
|
6
|
+
exportedAt: string;
|
|
7
|
+
data: {
|
|
8
|
+
[k: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const toJsonBlob: (value: unknown) => Blob;
|
|
12
|
+
export declare const exportFileName: (date: string) => string;
|
|
13
|
+
export {};
|
|
@@ -34,6 +34,7 @@ export type CalendarEvent = {
|
|
|
34
34
|
title: string;
|
|
35
35
|
location: string;
|
|
36
36
|
links: EventLink[];
|
|
37
|
+
categoryIds: string[];
|
|
37
38
|
startDate: string;
|
|
38
39
|
start: string;
|
|
39
40
|
endDate: string;
|
|
@@ -48,10 +49,13 @@ export type CalendarEvent = {
|
|
|
48
49
|
originalDate: string | null;
|
|
49
50
|
reminders: number[];
|
|
50
51
|
attendees: Attendee[];
|
|
52
|
+
attachmentCount: number;
|
|
53
|
+
version: number;
|
|
54
|
+
createdBy: string | null;
|
|
51
55
|
createdAt: string;
|
|
52
56
|
updatedAt: string;
|
|
53
57
|
};
|
|
54
|
-
declare const EVENT_INPUT_KEYS: readonly ["uid", "title", "location", "links", "startDate", "start", "endDate", "end", "allDay", "timeZone", "description", "color", "recurrence", "excludedDates", "seriesId", "originalDate", "reminders", "attendees"];
|
|
58
|
+
declare const EVENT_INPUT_KEYS: readonly ["uid", "title", "location", "links", "categoryIds", "startDate", "start", "endDate", "end", "allDay", "timeZone", "description", "color", "recurrence", "excludedDates", "seriesId", "originalDate", "reminders", "attendees"];
|
|
55
59
|
export type EventInput = Pick<CalendarEvent, (typeof EVENT_INPUT_KEYS)[number]>;
|
|
56
60
|
export declare const NO_SERIES_LINK: {
|
|
57
61
|
readonly seriesId: null;
|
|
@@ -69,6 +73,7 @@ export type SeriesRule = Pick<CalendarEvent, 'startDate' | 'recurrence' | 'exclu
|
|
|
69
73
|
export type EventValidationErrors = Partial<Record<Exclude<keyof EventInput, 'recurrence'>, string>> & {
|
|
70
74
|
recurrence?: RecurrenceValidationErrors;
|
|
71
75
|
};
|
|
76
|
+
export declare const isEventColor: (value: unknown) => value is EventColor;
|
|
72
77
|
export declare const getEventColorLabel: (color: EventColor, m: Messages) => string;
|
|
73
78
|
export declare const getEventColorAttributes: (color: EventColor, ...classNamesToMerge: ClassNameValue[]) => {
|
|
74
79
|
className?: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type EventChange = {
|
|
2
|
+
type: 'connected';
|
|
3
|
+
} | {
|
|
4
|
+
type: 'disconnected';
|
|
5
|
+
} | {
|
|
6
|
+
type: 'event.changed';
|
|
7
|
+
calendarId: string | null;
|
|
8
|
+
eventId: string | null;
|
|
9
|
+
version: number | null;
|
|
10
|
+
changedBy: string | null;
|
|
11
|
+
};
|
|
12
|
+
export declare const parseEventChange: (value: unknown) => EventChange | null;
|
|
13
|
+
export declare const ANY_EVENT_CHANGE: EventChange;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { type CalendarEvent, type EventInput } from './event.js';
|
|
2
|
-
export
|
|
2
|
+
export type ICalendarExportOptions = {
|
|
3
|
+
now?: Date;
|
|
4
|
+
categoryNames?: ReadonlyMap<string, string>;
|
|
5
|
+
};
|
|
6
|
+
export declare function toICalendar(events: readonly CalendarEvent[], calendarName: string, { now, categoryNames }?: ICalendarExportOptions): string;
|
|
3
7
|
export type ImportedEvent = {
|
|
4
8
|
input: EventInput;
|
|
5
9
|
recurrenceId: string | null;
|
|
10
|
+
categoryNames: string[];
|
|
6
11
|
};
|
|
7
12
|
export type ICalendarImport = {
|
|
8
13
|
events: ImportedEvent[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HostLinks } from '../context/HostContext.js';
|
|
2
|
+
import { type Category } from './category.js';
|
|
3
|
+
import { type EventColor } from './event.js';
|
|
4
|
+
export declare const SHARED_PATH = "/shared";
|
|
5
|
+
export type SharedCalendar = {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
color: EventColor;
|
|
9
|
+
categories: Category[];
|
|
10
|
+
};
|
|
11
|
+
export declare const parseSharedCalendar: (value: unknown) => SharedCalendar | null;
|
|
12
|
+
export declare const getSharedPath: (token: string) => string;
|
|
13
|
+
export declare const buildSharedLink: (token: string, links: HostLinks | undefined, pageUrl: string) => string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CalendarEvent } from './event.js';
|
|
2
|
+
export declare const TRASH_DAYS = 30;
|
|
3
|
+
export type TrashedEvent = {
|
|
4
|
+
event: CalendarEvent;
|
|
5
|
+
deletedAt: string;
|
|
6
|
+
deletedBy: string | null;
|
|
7
|
+
deletedByName: string | null;
|
|
8
|
+
expiresAt: string;
|
|
9
|
+
detachedCount: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const addTrashDays: (deletedAt: string, days?: number) => string;
|
|
12
|
+
export declare const parseTrashedEvent: (value: unknown) => TrashedEvent | null;
|
|
13
|
+
export declare const parseTrashedEvents: (value: unknown) => TrashedEvent[];
|
|
14
|
+
export declare const isExpired: (entry: Pick<TrashedEvent, "expiresAt">, now?: number) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokoyfa/calendar",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Embeddable calendar for React and any website: day, week, month and year views, recurring and all-day events, time zones, drag and drop, teams and eight languages, as a React component or a <calendar-widget> web component.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"calendar",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"./cdn": "./dist-lib/cdn/calendar-widget.js",
|
|
39
39
|
"./openapi.yaml": "./api/openapi.yaml",
|
|
40
|
+
"./config.schema.json": "./schema/calendar-config.schema.json",
|
|
40
41
|
"./package.json": "./package.json"
|
|
41
42
|
},
|
|
42
43
|
"jsdelivr": "./dist-lib/cdn/calendar-widget.js",
|
|
@@ -47,6 +48,10 @@
|
|
|
47
48
|
"files": [
|
|
48
49
|
"dist-lib",
|
|
49
50
|
"api/openapi.yaml",
|
|
51
|
+
"schema",
|
|
52
|
+
"demo/calendar.config.yaml",
|
|
53
|
+
"demo/calendar.config.jsonc",
|
|
54
|
+
"DEVELOPER_GUIDE.md",
|
|
50
55
|
"CHANGELOG.md"
|
|
51
56
|
],
|
|
52
57
|
"publishConfig": {
|
|
@@ -86,6 +91,7 @@
|
|
|
86
91
|
"vitest": "^5.1.0"
|
|
87
92
|
},
|
|
88
93
|
"dependencies": {
|
|
89
|
-
"date-holidays": "^3.39.1"
|
|
94
|
+
"date-holidays": "^3.39.1",
|
|
95
|
+
"yaml": "^2.9.1"
|
|
90
96
|
}
|
|
91
97
|
}
|