@rokoyfa/calendar 0.0.0-stage → 0.1.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 (218) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +194 -3
  4. package/api/openapi.yaml +911 -0
  5. package/dist-lib/cdn/calendar-widget.js +14 -0
  6. package/dist-lib/cdn/calendar-widget.js.map +1 -0
  7. package/dist-lib/npm/index.d.ts +1 -0
  8. package/dist-lib/npm/index.js +13055 -0
  9. package/dist-lib/npm/index.js.map +1 -0
  10. package/dist-lib/npm/types/components/Button.d.ts +17 -0
  11. package/dist-lib/npm/types/components/ChoiceChip.d.ts +13 -0
  12. package/dist-lib/npm/types/components/ConfirmModal.d.ts +11 -0
  13. package/dist-lib/npm/types/components/DateTimeField.d.ts +14 -0
  14. package/dist-lib/npm/types/components/Form.d.ts +8 -0
  15. package/dist-lib/npm/types/components/FormField.d.ts +10 -0
  16. package/dist-lib/npm/types/components/IconButton.d.ts +11 -0
  17. package/dist-lib/npm/types/components/Icons.d.ts +10 -0
  18. package/dist-lib/npm/types/components/Modal.d.ts +10 -0
  19. package/dist-lib/npm/types/components/NumberField.d.ts +12 -0
  20. package/dist-lib/npm/types/components/PageLayout.d.ts +13 -0
  21. package/dist-lib/npm/types/components/PageSection.d.ts +9 -0
  22. package/dist-lib/npm/types/components/PasswordField.d.ts +4 -0
  23. package/dist-lib/npm/types/components/SegmentedControl.d.ts +11 -0
  24. package/dist-lib/npm/types/components/SegmentedField.d.ts +11 -0
  25. package/dist-lib/npm/types/components/SelectField.d.ts +13 -0
  26. package/dist-lib/npm/types/components/StatusMessage.d.ts +13 -0
  27. package/dist-lib/npm/types/components/Stepper.d.ts +9 -0
  28. package/dist-lib/npm/types/components/Switch.d.ts +8 -0
  29. package/dist-lib/npm/types/components/Tabs.d.ts +14 -0
  30. package/dist-lib/npm/types/components/TeamsGate.d.ts +4 -0
  31. package/dist-lib/npm/types/components/TextField.d.ts +9 -0
  32. package/dist-lib/npm/types/config/calendars.d.ts +1 -0
  33. package/dist-lib/npm/types/config/routes.d.ts +17 -0
  34. package/dist-lib/npm/types/context/HostContext.d.ts +9 -0
  35. package/dist-lib/npm/types/context/RootElementContext.d.ts +2 -0
  36. package/dist-lib/npm/types/data/index.d.ts +4 -0
  37. package/dist-lib/npm/types/data/localDataSource.d.ts +3 -0
  38. package/dist-lib/npm/types/data/restDataSource.d.ts +11 -0
  39. package/dist-lib/npm/types/data/tenantDataSource.d.ts +10 -0
  40. package/dist-lib/npm/types/data/types.d.ts +21 -0
  41. package/dist-lib/npm/types/features/authorization/components/AccountMenu.d.ts +6 -0
  42. package/dist-lib/npm/types/features/authorization/components/AuthFields.d.ts +26 -0
  43. package/dist-lib/npm/types/features/authorization/components/AuthGate.d.ts +7 -0
  44. package/dist-lib/npm/types/features/authorization/components/ContinueLink.d.ts +1 -0
  45. package/dist-lib/npm/types/features/authorization/components/EmailVerificationBanner.d.ts +1 -0
  46. package/dist-lib/npm/types/features/authorization/components/ForgotPasswordPage.d.ts +1 -0
  47. package/dist-lib/npm/types/features/authorization/components/LoginPage.d.ts +1 -0
  48. package/dist-lib/npm/types/features/authorization/components/RegisterPage.d.ts +1 -0
  49. package/dist-lib/npm/types/features/authorization/components/ResendVerificationButton.d.ts +4 -0
  50. package/dist-lib/npm/types/features/authorization/components/ResetPasswordPage.d.ts +1 -0
  51. package/dist-lib/npm/types/features/authorization/components/VerifyEmailPage.d.ts +1 -0
  52. package/dist-lib/npm/types/features/authorization/components/account/AccountSettings.d.ts +1 -0
  53. package/dist-lib/npm/types/features/authorization/components/account/DeleteAccountSection.d.ts +1 -0
  54. package/dist-lib/npm/types/features/authorization/components/account/EmailSection.d.ts +4 -0
  55. package/dist-lib/npm/types/features/authorization/components/account/PasswordSection.d.ts +1 -0
  56. package/dist-lib/npm/types/features/authorization/components/account/ProfileSection.d.ts +4 -0
  57. package/dist-lib/npm/types/features/authorization/context/AuthContext.d.ts +2 -0
  58. package/dist-lib/npm/types/features/authorization/context/AuthProvider.d.ts +8 -0
  59. package/dist-lib/npm/types/features/authorization/hooks/useAuth.d.ts +18 -0
  60. package/dist-lib/npm/types/features/authorization/index.d.ts +14 -0
  61. package/dist-lib/npm/types/features/authorization/repositories/HostTokenAuthRepository.d.ts +18 -0
  62. package/dist-lib/npm/types/features/authorization/repositories/RemoteAuthRepository.d.ts +18 -0
  63. package/dist-lib/npm/types/features/authorization/types/auth.d.ts +52 -0
  64. package/dist-lib/npm/types/features/authorization/utils/validation.d.ts +22 -0
  65. package/dist-lib/npm/types/features/calendar/components/Calendar.d.ts +14 -0
  66. package/dist-lib/npm/types/features/calendar/components/CalendarHeader.d.ts +16 -0
  67. package/dist-lib/npm/types/features/calendar/components/DayColumn.d.ts +18 -0
  68. package/dist-lib/npm/types/features/calendar/components/EventBlock.d.ts +10 -0
  69. package/dist-lib/npm/types/features/calendar/components/EventChip.d.ts +8 -0
  70. package/dist-lib/npm/types/features/calendar/components/EventTitle.d.ts +8 -0
  71. package/dist-lib/npm/types/features/calendar/components/MiniMonth.d.ts +9 -0
  72. package/dist-lib/npm/types/features/calendar/components/MonthGrid.d.ts +8 -0
  73. package/dist-lib/npm/types/features/calendar/components/MonthView.d.ts +2 -0
  74. package/dist-lib/npm/types/features/calendar/components/NowIndicator.d.ts +6 -0
  75. package/dist-lib/npm/types/features/calendar/components/TimeColumn.d.ts +1 -0
  76. package/dist-lib/npm/types/features/calendar/components/TimeGridView.d.ts +2 -0
  77. package/dist-lib/npm/types/features/calendar/components/YearView.d.ts +2 -0
  78. package/dist-lib/npm/types/features/calendar/constants/grid.d.ts +4 -0
  79. package/dist-lib/npm/types/features/calendar/constants/views.d.ts +7 -0
  80. package/dist-lib/npm/types/features/calendar/context/EventSourcesContext.d.ts +3 -0
  81. package/dist-lib/npm/types/features/calendar/hooks/useCalendarView.d.ts +19 -0
  82. package/dist-lib/npm/types/features/calendar/hooks/useEventSource.d.ts +2 -0
  83. package/dist-lib/npm/types/features/calendar/hooks/useNow.d.ts +1 -0
  84. package/dist-lib/npm/types/features/calendar/hooks/useSlotSelection.d.ts +6 -0
  85. package/dist-lib/npm/types/features/calendar/index.d.ts +4 -0
  86. package/dist-lib/npm/types/features/calendar/types/editor.d.ts +5 -0
  87. package/dist-lib/npm/types/features/calendar/types/eventLayout.d.ts +14 -0
  88. package/dist-lib/npm/types/features/calendar/types/eventSource.d.ts +6 -0
  89. package/dist-lib/npm/types/features/calendar/types/view.d.ts +26 -0
  90. package/dist-lib/npm/types/features/calendar/utils/eventGeometry.d.ts +3 -0
  91. package/dist-lib/npm/types/features/calendar/utils/eventLabels.d.ts +15 -0
  92. package/dist-lib/npm/types/features/calendar/utils/layoutEvents.d.ts +3 -0
  93. package/dist-lib/npm/types/features/calendar/utils/segmentEvents.d.ts +5 -0
  94. package/dist-lib/npm/types/features/calendar/utils/slotSelection.d.ts +17 -0
  95. package/dist-lib/npm/types/features/calendars/components/ActiveCalendarIndicator.d.ts +1 -0
  96. package/dist-lib/npm/types/features/calendars/components/CalendarPreview.d.ts +4 -0
  97. package/dist-lib/npm/types/features/calendars/components/CalendarSettings.d.ts +1 -0
  98. package/dist-lib/npm/types/features/calendars/components/CalendarSwitcher.d.ts +1 -0
  99. package/dist-lib/npm/types/features/calendars/components/InvitationList.d.ts +1 -0
  100. package/dist-lib/npm/types/features/calendars/components/create/ColorStep.d.ts +7 -0
  101. package/dist-lib/npm/types/features/calendars/components/create/CreateCalendarPage.d.ts +1 -0
  102. package/dist-lib/npm/types/features/calendars/components/create/DetailsStep.d.ts +12 -0
  103. package/dist-lib/npm/types/features/calendars/components/create/MembersStep.d.ts +8 -0
  104. package/dist-lib/npm/types/features/calendars/components/create/ReviewStep.d.ts +4 -0
  105. package/dist-lib/npm/types/features/calendars/components/settings/CalendarSettingsPage.d.ts +1 -0
  106. package/dist-lib/npm/types/features/calendars/components/settings/DangerSection.d.ts +9 -0
  107. package/dist-lib/npm/types/features/calendars/components/settings/GeneralSection.d.ts +4 -0
  108. package/dist-lib/npm/types/features/calendars/components/settings/MembersSection.d.ts +11 -0
  109. package/dist-lib/npm/types/features/calendars/components/settings/TeamInvitationsSection.d.ts +12 -0
  110. package/dist-lib/npm/types/features/calendars/components/settings/TransferOwnershipModal.d.ts +8 -0
  111. package/dist-lib/npm/types/features/calendars/constants/calendars.d.ts +9 -0
  112. package/dist-lib/npm/types/features/calendars/context/CalendarsContext.d.ts +2 -0
  113. package/dist-lib/npm/types/features/calendars/context/CalendarsProvider.d.ts +8 -0
  114. package/dist-lib/npm/types/features/calendars/hooks/useCalendars.d.ts +1 -0
  115. package/dist-lib/npm/types/features/calendars/hooks/useTeam.d.ts +12 -0
  116. package/dist-lib/npm/types/features/calendars/index.d.ts +11 -0
  117. package/dist-lib/npm/types/features/calendars/repositories/LocalCalendarRepository.d.ts +20 -0
  118. package/dist-lib/npm/types/features/calendars/repositories/RemoteCalendarRepository.d.ts +23 -0
  119. package/dist-lib/npm/types/features/calendars/types/calendar.d.ts +91 -0
  120. package/dist-lib/npm/types/features/calendars/utils/draft.d.ts +7 -0
  121. package/dist-lib/npm/types/features/calendars/utils/permissions.d.ts +13 -0
  122. package/dist-lib/npm/types/features/events/components/ColorPicker.d.ts +7 -0
  123. package/dist-lib/npm/types/features/events/components/CustomColorSettings.d.ts +1 -0
  124. package/dist-lib/npm/types/features/events/components/DeleteEventModal.d.ts +8 -0
  125. package/dist-lib/npm/types/features/events/components/EventModal.d.ts +11 -0
  126. package/dist-lib/npm/types/features/events/components/RecurrenceFields.d.ts +9 -0
  127. package/dist-lib/npm/types/features/events/components/RecurrenceScopeModal.d.ts +8 -0
  128. package/dist-lib/npm/types/features/events/components/ScopeButtons.d.ts +10 -0
  129. package/dist-lib/npm/types/features/events/constants/colors.d.ts +3 -0
  130. package/dist-lib/npm/types/features/events/hooks/useCustomColors.d.ts +8 -0
  131. package/dist-lib/npm/types/features/events/hooks/useEvents.d.ts +15 -0
  132. package/dist-lib/npm/types/features/events/index.d.ts +5 -0
  133. package/dist-lib/npm/types/features/events/types/eventModal.d.ts +1 -0
  134. package/dist-lib/npm/types/features/events/utils/scopeOptions.d.ts +3 -0
  135. package/dist-lib/npm/types/features/events/utils/seriesActions.d.ts +4 -0
  136. package/dist-lib/npm/types/features/preferences/components/PreferencesSettings.d.ts +1 -0
  137. package/dist-lib/npm/types/features/preferences/context/PreferencesContext.d.ts +6 -0
  138. package/dist-lib/npm/types/features/preferences/context/PreferencesProvider.d.ts +4 -0
  139. package/dist-lib/npm/types/features/preferences/hooks/usePreferences.d.ts +1 -0
  140. package/dist-lib/npm/types/features/preferences/index.d.ts +3 -0
  141. package/dist-lib/npm/types/features/storage/components/LocalImportPrompt.d.ts +5 -0
  142. package/dist-lib/npm/types/features/storage/context/StorageContext.d.ts +2 -0
  143. package/dist-lib/npm/types/features/storage/context/StorageProvider.d.ts +8 -0
  144. package/dist-lib/npm/types/features/storage/hooks/useStorage.d.ts +7 -0
  145. package/dist-lib/npm/types/features/storage/index.d.ts +10 -0
  146. package/dist-lib/npm/types/features/storage/repositories/LocalColorRepository.d.ts +9 -0
  147. package/dist-lib/npm/types/features/storage/repositories/LocalEventRepository.d.ts +13 -0
  148. package/dist-lib/npm/types/features/storage/repositories/LocalPreferencesRepository.d.ts +8 -0
  149. package/dist-lib/npm/types/features/storage/repositories/RemoteColorRepository.d.ts +10 -0
  150. package/dist-lib/npm/types/features/storage/repositories/RemoteEventRepository.d.ts +12 -0
  151. package/dist-lib/npm/types/features/storage/repositories/RemotePreferencesRepository.d.ts +9 -0
  152. package/dist-lib/npm/types/features/storage/types/storage.d.ts +35 -0
  153. package/dist-lib/npm/types/features/storage/utils/copyEvents.d.ts +3 -0
  154. package/dist-lib/npm/types/features/storage/utils/localStorageList.d.ts +5 -0
  155. package/dist-lib/npm/types/features/storage/utils/localStorageValue.d.ts +9 -0
  156. package/dist-lib/npm/types/hooks/useArrowKeyNavigation.d.ts +6 -0
  157. package/dist-lib/npm/types/hooks/useAsyncAction.d.ts +6 -0
  158. package/dist-lib/npm/types/hooks/useAsyncResource.d.ts +9 -0
  159. package/dist-lib/npm/types/hooks/useForm.d.ts +21 -0
  160. package/dist-lib/npm/types/hooks/useFormState.d.ts +8 -0
  161. package/dist-lib/npm/types/hooks/useRequiredContext.d.ts +2 -0
  162. package/dist-lib/npm/types/hooks/useTabParam.d.ts +3 -0
  163. package/dist-lib/npm/types/i18n/I18nContext.d.ts +15 -0
  164. package/dist-lib/npm/types/i18n/I18nProvider.d.ts +7 -0
  165. package/dist-lib/npm/types/i18n/errorMessage.d.ts +2 -0
  166. package/dist-lib/npm/types/i18n/format.d.ts +28 -0
  167. package/dist-lib/npm/types/i18n/index.d.ts +8 -0
  168. package/dist-lib/npm/types/i18n/locale.d.ts +14 -0
  169. package/dist-lib/npm/types/i18n/messages/de/auth.d.ts +2 -0
  170. package/dist-lib/npm/types/i18n/messages/de/calendar.d.ts +3 -0
  171. package/dist-lib/npm/types/i18n/messages/de/calendars.d.ts +2 -0
  172. package/dist-lib/npm/types/i18n/messages/de/core.d.ts +7 -0
  173. package/dist-lib/npm/types/i18n/messages/de/events.d.ts +2 -0
  174. package/dist-lib/npm/types/i18n/messages/de/index.d.ts +2 -0
  175. package/dist-lib/npm/types/i18n/messages/de/settings.d.ts +2 -0
  176. package/dist-lib/npm/types/i18n/messages/de/storage.d.ts +2 -0
  177. package/dist-lib/npm/types/i18n/messages/en/auth.d.ts +97 -0
  178. package/dist-lib/npm/types/i18n/messages/en/calendar.d.ts +34 -0
  179. package/dist-lib/npm/types/i18n/messages/en/calendars.d.ts +177 -0
  180. package/dist-lib/npm/types/i18n/messages/en/core.d.ts +86 -0
  181. package/dist-lib/npm/types/i18n/messages/en/events.d.ts +42 -0
  182. package/dist-lib/npm/types/i18n/messages/en/index.d.ts +466 -0
  183. package/dist-lib/npm/types/i18n/messages/en/settings.d.ts +23 -0
  184. package/dist-lib/npm/types/i18n/messages/en/storage.d.ts +7 -0
  185. package/dist-lib/npm/types/i18n/messages/index.d.ts +4 -0
  186. package/dist-lib/npm/types/i18n/messages/types.d.ts +2 -0
  187. package/dist-lib/npm/types/i18n/useI18n.d.ts +3 -0
  188. package/dist-lib/npm/types/i18n/useLocaleGetter.d.ts +1 -0
  189. package/dist-lib/npm/types/i18n/weekInfo.d.ts +5 -0
  190. package/dist-lib/npm/types/lib/CalendarApp.d.ts +14 -0
  191. package/dist-lib/npm/types/lib/CalendarWidget.d.ts +2 -0
  192. package/dist-lib/npm/types/lib/IsolatedRoot.d.ts +9 -0
  193. package/dist-lib/npm/types/lib/config.d.ts +28 -0
  194. package/dist-lib/npm/types/lib/defaults.d.ts +13 -0
  195. package/dist-lib/npm/types/lib/element.d.ts +16 -0
  196. package/dist-lib/npm/types/lib/eventCallbacks.d.ts +11 -0
  197. package/dist-lib/npm/types/lib/index.d.ts +16 -0
  198. package/dist-lib/npm/types/lib/linkParam.d.ts +2 -0
  199. package/dist-lib/npm/types/lib/version.d.ts +1 -0
  200. package/dist-lib/npm/types/pages/CalendarPage.d.ts +1 -0
  201. package/dist-lib/npm/types/pages/SettingsPage.d.ts +1 -0
  202. package/dist-lib/npm/types/router.d.ts +7 -0
  203. package/dist-lib/npm/types/utils/api.d.ts +32 -0
  204. package/dist-lib/npm/types/utils/apiError.d.ts +26 -0
  205. package/dist-lib/npm/types/utils/appError.d.ts +10 -0
  206. package/dist-lib/npm/types/utils/calendarView.d.ts +3 -0
  207. package/dist-lib/npm/types/utils/classNames.d.ts +2 -0
  208. package/dist-lib/npm/types/utils/color.d.ts +5 -0
  209. package/dist-lib/npm/types/utils/date.d.ts +44 -0
  210. package/dist-lib/npm/types/utils/dom.d.ts +3 -0
  211. package/dist-lib/npm/types/utils/event.d.ts +74 -0
  212. package/dist-lib/npm/types/utils/number.d.ts +1 -0
  213. package/dist-lib/npm/types/utils/object.d.ts +3 -0
  214. package/dist-lib/npm/types/utils/preferences.d.ts +15 -0
  215. package/dist-lib/npm/types/utils/recurrence.d.ts +33 -0
  216. package/dist-lib/npm/types/utils/series.d.ts +9 -0
  217. package/dist-lib/npm/types/utils/validation.d.ts +6 -0
  218. package/package.json +82 -6
@@ -0,0 +1,32 @@
1
+ import { ApiError } from './apiError.js';
2
+ export type QueryValue = string | number | boolean | null | undefined;
3
+ export type QueryParams = Record<string, QueryValue | readonly QueryValue[]>;
4
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
5
+ export type ApiRequestOptions = {
6
+ query?: QueryParams;
7
+ body?: unknown;
8
+ headers?: HeadersInit;
9
+ signal?: AbortSignal;
10
+ timeoutMs?: number;
11
+ };
12
+ export type ApiClientOptions = {
13
+ baseUrl: string;
14
+ timeoutMs?: number;
15
+ credentials?: RequestCredentials;
16
+ headers?: HeadersInit;
17
+ getAccessToken?: () => string | null;
18
+ getLanguage?: () => string | null;
19
+ onUnauthorized?: (error: ApiError) => void;
20
+ };
21
+ export type ApiClient = {
22
+ request<T>(method: HttpMethod, path: string, options?: ApiRequestOptions): Promise<T>;
23
+ get<T>(path: string, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>;
24
+ post<T>(path: string, body?: unknown, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>;
25
+ put<T>(path: string, body?: unknown, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>;
26
+ patch<T>(path: string, body?: unknown, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>;
27
+ delete<T = void>(path: string, options?: Omit<ApiRequestOptions, 'body'>): Promise<T>;
28
+ };
29
+ export declare const buildQueryString: (query?: QueryParams) => string;
30
+ export declare const joinUrl: (baseUrl: string, path: string) => string;
31
+ export declare const encodePathSegment: (value: string | number) => string;
32
+ export declare function createApiClient({ baseUrl, timeoutMs: defaultTimeoutMs, credentials, headers: defaultHeaders, getAccessToken, getLanguage, onUnauthorized, }: ApiClientOptions): ApiClient;
@@ -0,0 +1,26 @@
1
+ import { type ErrorCode } from './appError.js';
2
+ export type ApiErrorKind = 'http' | 'timeout' | 'network' | 'aborted' | 'parse';
3
+ type ApiErrorOptions = {
4
+ kind: ApiErrorKind;
5
+ code?: ErrorCode;
6
+ status?: number | null;
7
+ body?: unknown;
8
+ cause?: unknown;
9
+ };
10
+ export declare const getServerMessage: (body: unknown) => string | null;
11
+ export declare const getServerCode: (body: unknown) => "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" | undefined;
12
+ export declare class ApiError extends Error {
13
+ readonly kind: ApiErrorKind;
14
+ readonly status: number | null;
15
+ readonly body: unknown;
16
+ readonly code: ErrorCode | null;
17
+ constructor(message: string, { kind, code, status, body, cause }: ApiErrorOptions);
18
+ get serverMessage(): string | null;
19
+ static fromResponse(status: number, body: unknown): ApiError;
20
+ static fromKind(kind: Exclude<ApiErrorKind, 'http'>, cause?: unknown): ApiError;
21
+ get isUnauthorized(): boolean;
22
+ get isNotFound(): boolean;
23
+ get isServerError(): boolean;
24
+ }
25
+ export declare const isApiError: (error: unknown) => error is ApiError;
26
+ export {};
@@ -0,0 +1,10 @@
1
+ export 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"];
2
+ export declare const isErrorCode: (value: unknown) => value is ErrorCode;
3
+ export type ErrorCode = (typeof ERROR_CODES)[number];
4
+ export declare class AppError extends Error {
5
+ readonly code: ErrorCode;
6
+ constructor(code: ErrorCode, options?: {
7
+ cause?: unknown;
8
+ });
9
+ }
10
+ export declare const isAppError: (error: unknown) => error is AppError;
@@ -0,0 +1,3 @@
1
+ export declare const CALENDAR_VIEWS: readonly ["day", "week", "month", "year"];
2
+ export type CalendarView = (typeof CALENDAR_VIEWS)[number];
3
+ export declare const isCalendarView: (value: unknown) => value is CalendarView;
@@ -0,0 +1,2 @@
1
+ export type ClassNameValue = string | false | null | undefined;
2
+ export declare const classNames: (...names: readonly ClassNameValue[]) => string;
@@ -0,0 +1,5 @@
1
+ export type HexColor = `#${string}`;
2
+ export declare const isHexColor: (value: unknown) => value is HexColor;
3
+ export declare const normalizeHexColor: (value: HexColor) => HexColor;
4
+ export declare const getRelativeLuminance: (color: HexColor) => number;
5
+ export declare const getReadableTextColor: (background: HexColor) => "#222222" | "#ffffff";
@@ -0,0 +1,44 @@
1
+ export declare const DAYS_PER_WEEK = 7;
2
+ export declare const HOURS_PER_DAY = 24;
3
+ export declare const MINUTES_PER_HOUR = 60;
4
+ export declare const MINUTES_PER_DAY: number;
5
+ export type DateRange = {
6
+ from: string;
7
+ to: string;
8
+ };
9
+ export declare const ISO_DATE_PATTERN: RegExp;
10
+ export declare const TIME_PATTERN: RegExp;
11
+ export declare const isISODate: (value: unknown) => value is string;
12
+ export declare const isTime: (value: unknown) => value is string;
13
+ export declare const toISODate: (date: Date) => string;
14
+ export declare const fromISODate: (isoDate: string) => Date;
15
+ export declare const minISODate: (a: string, b: string) => string;
16
+ export declare const maxISODate: (a: string, b: string) => string;
17
+ export declare const timeToMinutes: (time: string) => number;
18
+ export declare const minutesToTime: (totalMinutes: number) => string;
19
+ export declare const addDays: (date: Date, amount: number) => Date;
20
+ export declare const addDaysToISODate: (isoDate: string, amount: number) => string;
21
+ export declare const addMonthsToISODate: (isoDate: string, amount: number) => string;
22
+ export declare const startOfMonthISO: (isoDate: string) => string;
23
+ export declare const endOfMonthISO: (isoDate: string) => string;
24
+ export declare const startOfYearISO: (isoDate: string) => string;
25
+ export declare const endOfYearISO: (isoDate: string) => string;
26
+ export declare const isSameMonthISO: (a: string, b: string) => boolean;
27
+ export declare const listISODates: (from: string, to: string) => string[];
28
+ export declare const daysBetween: (fromIsoDate: string, toIsoDate: string) => number;
29
+ export declare const daysInMonth: (year: number, monthIndex: number) => number;
30
+ export declare const getWeekdayIndex: (date: Date) => number;
31
+ export declare const MONDAY = 1;
32
+ export declare const startOfWeek: (date: Date, firstDay?: number) => Date;
33
+ export declare const startOfWeekISO: (isoDate: string, firstDay?: number) => string;
34
+ export declare const endOfWeekISO: (isoDate: string, firstDay?: number) => string;
35
+ export declare const getMonthWeeks: (isoDate: string, firstDay?: number) => string[][];
36
+ export declare const isSameDay: (a: Date, b: Date) => boolean;
37
+ export declare const getWeekDays: (weekStart: Date) => Date[];
38
+ type WeekRule = {
39
+ firstDay: number;
40
+ minimalDays: number;
41
+ };
42
+ export declare const getWeekNumber: (date: Date, rule: WeekRule) => number;
43
+ export declare const getDayOfMonth: (isoDate: string) => number;
44
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const withoutPropagation: (action: () => void) => (event: {
2
+ stopPropagation: () => void;
3
+ }) => void;
@@ -0,0 +1,74 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { I18n, Messages } from '../i18n/index.js';
3
+ import { type ClassNameValue } from './classNames.js';
4
+ import { type HexColor } from './color.js';
5
+ import { type Recurrence, type RecurrenceValidationErrors } from './recurrence.js';
6
+ export declare const PRESET_EVENT_COLORS: readonly ["blue", "red", "green", "yellow"];
7
+ export type PresetEventColor = (typeof PRESET_EVENT_COLORS)[number];
8
+ export type EventColor = PresetEventColor | HexColor;
9
+ export declare const EVENT_TITLE_MAX_LENGTH = 100;
10
+ export declare const EVENT_DESCRIPTION_MAX_LENGTH = 2000;
11
+ export type CalendarEvent = {
12
+ id: string;
13
+ calendarId: string;
14
+ title: string;
15
+ startDate: string;
16
+ start: string;
17
+ endDate: string;
18
+ end: string;
19
+ description: string;
20
+ color: EventColor;
21
+ recurrence: Recurrence | null;
22
+ excludedDates: string[];
23
+ seriesId: string | null;
24
+ originalDate: string | null;
25
+ createdAt: string;
26
+ updatedAt: string;
27
+ };
28
+ declare const EVENT_INPUT_KEYS: readonly ["title", "startDate", "start", "endDate", "end", "description", "color", "recurrence", "excludedDates", "seriesId", "originalDate"];
29
+ export type EventInput = Pick<CalendarEvent, (typeof EVENT_INPUT_KEYS)[number]>;
30
+ export declare const NO_SERIES_LINK: {
31
+ readonly seriesId: null;
32
+ readonly originalDate: null;
33
+ };
34
+ export type EventOccurrence = CalendarEvent & {
35
+ occurrenceKey: string;
36
+ seriesStartDate: string;
37
+ };
38
+ export type EditScope = 'single' | 'following' | 'all';
39
+ export type EventPeriod = Pick<CalendarEvent, 'startDate' | 'start' | 'endDate' | 'end'>;
40
+ export type SeriesRule = Pick<CalendarEvent, 'startDate' | 'recurrence' | 'excludedDates'>;
41
+ export type EventValidationErrors = Partial<Record<Exclude<keyof EventInput, 'recurrence'>, string>> & {
42
+ recurrence?: RecurrenceValidationErrors;
43
+ };
44
+ export declare const isPresetEventColor: (value: unknown) => value is PresetEventColor;
45
+ export declare const isEventColor: (value: unknown) => value is EventColor;
46
+ export declare const getEventColorLabel: (color: EventColor, m: Messages) => string;
47
+ export declare const getEventColorAttributes: (color: EventColor, ...classNamesToMerge: ClassNameValue[]) => {
48
+ className?: string;
49
+ style?: CSSProperties;
50
+ };
51
+ export declare const parseCalendarEvent: (value: unknown) => CalendarEvent | null;
52
+ export type HourSlot = {
53
+ date: string;
54
+ hour: number;
55
+ };
56
+ export declare const createEventInputForSlots: (first: HourSlot, last: HourSlot) => EventInput;
57
+ export declare const createEventInput: (date: string, hour: number) => EventInput;
58
+ export declare const toEventInput: (event: CalendarEvent) => EventInput;
59
+ export declare const normalizeEventInput: (input: EventInput) => EventInput;
60
+ export declare const getEventDuration: (period: EventPeriod) => number;
61
+ export declare const isMultiDayEvent: ({ startDate, endDate }: Pick<EventPeriod, "startDate" | "endDate">) => boolean;
62
+ export declare const getSpanDays: ({ startDate, endDate }: Pick<EventPeriod, "startDate" | "endDate">) => number;
63
+ export declare const moveToStartDate: (period: Pick<EventPeriod, "startDate" | "endDate">, startDate: string) => {
64
+ startDate: string;
65
+ endDate: string;
66
+ };
67
+ export declare const getActiveOccurrenceDates: ({ startDate, recurrence, excludedDates }: SeriesRule, from: string, to: string) => string[];
68
+ export declare const eventOccursInRange: (event: CalendarEvent, from: string, to: string) => boolean;
69
+ export declare const toSeriesRule: (occurrence: EventOccurrence) => SeriesRule;
70
+ export declare const expandEvents: (events: readonly CalendarEvent[], from: string, to: string) => EventOccurrence[];
71
+ export declare const formatEventPeriod: (event: EventPeriod, { format }: Pick<I18n, "format">) => string;
72
+ export declare const validateEventInput: (input: EventInput, m: Messages) => EventValidationErrors;
73
+ export declare const hasValidationErrors: ({ recurrence, ...fields }: EventValidationErrors) => boolean;
74
+ export {};
@@ -0,0 +1 @@
1
+ export declare const isIntegerInRange: (value: unknown, min: number, max?: number) => value is number;
@@ -0,0 +1,3 @@
1
+ export declare const pick: <T extends object, K extends keyof T>(source: T, keys: readonly K[]) => Pick<T, K>;
2
+ export declare const isOneOf: <T extends string>(values: readonly T[], value: unknown) => value is T;
3
+ export declare const asRecord: (value: unknown) => Record<string, unknown>;
@@ -0,0 +1,15 @@
1
+ import { type LocaleChoice } from '../i18n/locale.js';
2
+ import { type CalendarView } from './calendarView.js';
3
+ export declare const THEMES: readonly ["system", "light", "dark"];
4
+ export type Theme = (typeof THEMES)[number];
5
+ export type Preferences = {
6
+ theme: Theme;
7
+ defaultView: CalendarView;
8
+ mobileDefaultView: CalendarView;
9
+ locale: LocaleChoice;
10
+ };
11
+ export declare const DEFAULT_PREFERENCES: Preferences;
12
+ export declare const COMPACT_MAX_WIDTH = 700;
13
+ export declare const isCompactWidth: (width: number) => boolean;
14
+ export declare const parsePreferences: (value: unknown) => Preferences;
15
+ export declare const getStartView: ({ defaultView, mobileDefaultView }: Preferences, isMobile: boolean) => "day" | "week" | "month" | "year";
@@ -0,0 +1,33 @@
1
+ import type { I18n, Messages } from '../i18n/index.js';
2
+ export declare const RECURRENCE_FREQUENCIES: readonly ["daily", "weekly", "monthly", "yearly"];
3
+ export type RecurrenceFrequency = (typeof RECURRENCE_FREQUENCIES)[number];
4
+ export declare const MONTHLY_MODES: readonly ["dayOfMonth", "weekdayOfMonth", "lastWeekdayOfMonth"];
5
+ export type MonthlyMode = (typeof MONTHLY_MODES)[number];
6
+ export type Recurrence = {
7
+ frequency: RecurrenceFrequency;
8
+ interval: number;
9
+ weekdays: number[];
10
+ monthlyMode: MonthlyMode;
11
+ until: string | null;
12
+ count: number | null;
13
+ };
14
+ export declare const RECURRENCE_INTERVAL_MAX = 99;
15
+ export declare const RECURRENCE_COUNT_MAX = 999;
16
+ export declare const getISODateWeekday: (isoDate: string) => number;
17
+ export declare const isInLastWeekOfMonth: (isoDate: string) => boolean;
18
+ export declare const isRecurrenceFrequency: (value: unknown) => value is RecurrenceFrequency;
19
+ export declare const isMonthlyMode: (value: unknown) => value is MonthlyMode;
20
+ export declare const createRecurrence: (frequency: RecurrenceFrequency, startDate: string) => Recurrence;
21
+ export declare const normalizeWeekdays: (weekdays: readonly number[]) => number[];
22
+ export declare const parseRecurrence: (value: unknown) => Recurrence | null;
23
+ export declare const isSameRecurrence: (a: Recurrence | null, b: Recurrence | null) => boolean;
24
+ export declare const shiftWeekdays: (weekdays: readonly number[], days: number) => number[];
25
+ export declare const adaptRecurrenceToStart: (recurrence: Recurrence | null, previousStart: string, nextStart: string) => Recurrence | null;
26
+ export declare const hasRecurrenceErrors: (errors: RecurrenceValidationErrors) => boolean;
27
+ export type RecurrenceValidationErrors = Partial<Record<'interval' | 'weekdays' | 'until' | 'count', string>>;
28
+ export declare const validateRecurrence: (recurrence: Recurrence, startDate: string, { validation }: Messages) => RecurrenceValidationErrors;
29
+ export declare const formatMonthlyMode: (mode: MonthlyMode, startDate: string, { m, format }: Pick<I18n, "m" | "format">) => string;
30
+ export declare const getMonthlyModeOptions: (startDate: string) => MonthlyMode[];
31
+ export declare const formatRecurrence: (recurrence: Recurrence, startDate: string, i18n: Pick<I18n, "m" | "format">) => string;
32
+ export declare function getOccurrenceDates(seriesStart: string, recurrence: Recurrence, windowStart: string, windowEnd: string): string[];
33
+ export declare const countOccurrencesBefore: (seriesStart: string, recurrence: Recurrence, date: string) => number;
@@ -0,0 +1,9 @@
1
+ import { type CalendarEvent, type EventInput, type SeriesRule } from './event.js';
2
+ export declare const hasEarlierOccurrences: (series: SeriesRule, date: string) => boolean;
3
+ export declare const getShift: (occurrenceDate: string, input: EventInput) => number;
4
+ export declare const isDetachedFrom: (event: CalendarEvent, date: string) => boolean;
5
+ export declare const excludeOccurrence: (series: CalendarEvent, occurrenceDate: string) => EventInput;
6
+ export declare const detachOccurrence: (series: CalendarEvent, occurrenceDate: string, input: EventInput) => EventInput;
7
+ export declare const changeWholeSeries: (series: CalendarEvent, occurrenceDate: string, input: EventInput) => EventInput;
8
+ export declare const truncateSeries: (series: CalendarEvent, occurrenceDate: string) => EventInput;
9
+ export declare const continueSeries: (series: CalendarEvent, occurrenceDate: string, input: EventInput) => EventInput;
@@ -0,0 +1,6 @@
1
+ import type { Messages } from '../i18n/index.js';
2
+ export type FieldErrors<T> = Partial<Record<keyof T, string>>;
3
+ export declare const hasFieldErrors: (errors: object) => boolean;
4
+ export declare const EMAIL_MAX_LENGTH = 254;
5
+ export declare const normalizeEmail: (email: string) => string;
6
+ export declare const validateEmail: (email: string, m: Messages) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,82 @@
1
- {
2
- "name": "@rokoyfa/calendar",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@rokoyfa/calendar",
3
+ "version": "0.1.0",
4
+ "description": "Embeddable calendar for React and any website: day, week, month and year views, recurring events, teams and English/German, as a React component or a <calendar-widget> web component.",
5
+ "keywords": [
6
+ "calendar",
7
+ "react",
8
+ "web-component",
9
+ "custom-element",
10
+ "scheduler",
11
+ "events",
12
+ "embeddable",
13
+ "widget",
14
+ "i18n"
15
+ ],
16
+ "license": "MIT",
17
+ "author": "Rokoyfa",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/Rokoyfa/Calendar.git"
21
+ },
22
+ "homepage": "https://github.com/Rokoyfa/Calendar#readme",
23
+ "bugs": {
24
+ "url": "https://github.com/Rokoyfa/Calendar/issues"
25
+ },
26
+ "type": "module",
27
+ "main": "./dist-lib/npm/index.js",
28
+ "module": "./dist-lib/npm/index.js",
29
+ "types": "./dist-lib/npm/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist-lib/npm/index.d.ts",
33
+ "import": "./dist-lib/npm/index.js"
34
+ },
35
+ "./cdn": "./dist-lib/cdn/calendar-widget.js",
36
+ "./openapi.yaml": "./api/openapi.yaml",
37
+ "./package.json": "./package.json"
38
+ },
39
+ "jsdelivr": "./dist-lib/cdn/calendar-widget.js",
40
+ "unpkg": "./dist-lib/cdn/calendar-widget.js",
41
+ "sideEffects": [
42
+ "./dist-lib/cdn/*"
43
+ ],
44
+ "files": [
45
+ "dist-lib",
46
+ "api/openapi.yaml",
47
+ "CHANGELOG.md"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "scripts": {
53
+ "dev": "vite",
54
+ "build": "tsc -b && vite build",
55
+ "lint": "eslint .",
56
+ "preview": "vite preview",
57
+ "build:lib": "node -e \"require('fs').rmSync('dist-lib',{recursive:true,force:true})\" && vite build -c vite.lib.config.ts && vite build -c vite.lib.config.ts --mode element && tsc -p tsconfig.lib.json && node scripts/collect-types.mjs",
58
+ "typecheck": "tsc -b",
59
+ "prepublishOnly": "npm run lint && npm run typecheck && npm run build:lib"
60
+ },
61
+ "peerDependencies": {
62
+ "react": "^19.0.0",
63
+ "react-dom": "^19.0.0"
64
+ },
65
+ "devDependencies": {
66
+ "@eslint/js": "^10.0.1",
67
+ "@types/node": "^24.19.2",
68
+ "@types/react": "^19.3.0",
69
+ "@types/react-dom": "^19.3.0",
70
+ "@vitejs/plugin-react": "^6.1.2",
71
+ "eslint": "^10.13.0",
72
+ "eslint-plugin-react-hooks": "^7.1.1",
73
+ "eslint-plugin-react-refresh": "^0.5.7",
74
+ "globals": "^17.13.0",
75
+ "react": "^19.3.1",
76
+ "react-dom": "^19.3.1",
77
+ "react-router": "^8.4.0",
78
+ "typescript": "~6.0.0",
79
+ "typescript-eslint": "^8.72.0",
80
+ "vite": "^8.3.5"
81
+ }
82
+ }