@webamoki/web-svelte 0.1.1 → 0.3.1

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 (40) hide show
  1. package/README.md +4 -55
  2. package/dist/components/form/FieldWrapper.svelte +6 -0
  3. package/dist/components/form/FieldWrapper.svelte.d.ts +5 -0
  4. package/dist/components/form/fields/ChoiceField.svelte +44 -0
  5. package/dist/components/form/fields/ChoiceField.svelte.d.ts +27 -0
  6. package/dist/components/form/fields/ChoiceMultiField.svelte +46 -0
  7. package/dist/components/form/fields/ChoiceMultiField.svelte.d.ts +27 -0
  8. package/dist/components/form/fields/WeekdayChoiceField.svelte +41 -0
  9. package/dist/components/form/fields/WeekdayChoiceField.svelte.d.ts +27 -0
  10. package/dist/components/form/fields/WeekdayChoiceMultiField.svelte +41 -0
  11. package/dist/components/form/fields/WeekdayChoiceMultiField.svelte.d.ts +27 -0
  12. package/dist/components/index.d.ts +7 -1
  13. package/dist/components/index.js +7 -1
  14. package/dist/components/showcase/CodeBlock.svelte +52 -0
  15. package/dist/components/showcase/CodeBlock.svelte.d.ts +30 -0
  16. package/dist/components/showcase/Container.svelte +13 -0
  17. package/dist/components/showcase/Container.svelte.d.ts +24 -0
  18. package/dist/components/showcase/Preview.svelte +6 -0
  19. package/dist/components/showcase/Preview.svelte.d.ts +26 -0
  20. package/dist/components/showcase/Sidebar.svelte +6 -0
  21. package/dist/components/showcase/Sidebar.svelte.d.ts +26 -0
  22. package/dist/components/showcase/SidebarLink.svelte +7 -0
  23. package/dist/components/showcase/SidebarLink.svelte.d.ts +20 -0
  24. package/dist/components/ui/choice/Choice.svelte +27 -0
  25. package/dist/components/ui/choice/Choice.svelte.d.ts +29 -0
  26. package/dist/components/ui/choice/ChoiceInternal.svelte +57 -0
  27. package/dist/components/ui/choice/ChoiceInternal.svelte.d.ts +34 -0
  28. package/dist/components/ui/choice/ChoiceMulti.svelte +55 -0
  29. package/dist/components/ui/choice/ChoiceMulti.svelte.d.ts +30 -0
  30. package/dist/components/ui/choice/WeekdayChoice.svelte +28 -0
  31. package/dist/components/ui/choice/WeekdayChoice.svelte.d.ts +13 -0
  32. package/dist/components/ui/choice/WeekdayChoiceMulti.svelte +29 -0
  33. package/dist/components/ui/choice/WeekdayChoiceMulti.svelte.d.ts +14 -0
  34. package/dist/highlight.d.ts +1 -0
  35. package/dist/highlight.js +9 -0
  36. package/dist/utils/datetime/index.d.ts +168 -0
  37. package/dist/utils/datetime/index.js +322 -0
  38. package/dist/utils/index.d.ts +1 -1
  39. package/dist/utils/index.js +1 -2
  40. package/package.json +7 -3
@@ -0,0 +1,27 @@
1
+ <script lang="ts" module>
2
+ export interface ChoiceProps<V, K extends string | number | symbol>
3
+ extends ChoiceInternalProps<V, K> {
4
+ value?: V;
5
+ onChange?: (value: V) => void;
6
+ }
7
+ </script>
8
+
9
+ <script lang="ts" generics="V, K extends string | number | symbol">
10
+ import ChoiceInternal, {
11
+ type ChoiceInternalProps as ChoiceInternalProps
12
+ } from './ChoiceInternal.svelte';
13
+
14
+ let { value = $bindable(undefined), onChange, ...props }: ChoiceProps<V, K> = $props();
15
+
16
+ function handleItemClick(item: V) {
17
+ value = item;
18
+ // Trigger event
19
+ onChange?.(item);
20
+ }
21
+
22
+ function isActive(item: V) {
23
+ return value === item;
24
+ }
25
+ </script>
26
+
27
+ <ChoiceInternal {handleItemClick} {isActive} {...props} />
@@ -0,0 +1,29 @@
1
+ export interface ChoiceProps<V, K extends string | number | symbol> extends ChoiceInternalProps<V, K> {
2
+ value?: V;
3
+ onChange?: (value: V) => void;
4
+ }
5
+ import { type ChoiceInternalProps as ChoiceInternalProps } from './ChoiceInternal.svelte';
6
+ declare function $$render<V, K extends string | number | symbol>(): {
7
+ props: ChoiceProps<V, K>;
8
+ exports: {};
9
+ bindings: "value";
10
+ slots: {};
11
+ events: {};
12
+ };
13
+ declare class __sveltets_Render<V, K extends string | number | symbol> {
14
+ props(): ReturnType<typeof $$render<V, K>>['props'];
15
+ events(): ReturnType<typeof $$render<V, K>>['events'];
16
+ slots(): ReturnType<typeof $$render<V, K>>['slots'];
17
+ bindings(): "value";
18
+ exports(): {};
19
+ }
20
+ interface $$IsomorphicComponent {
21
+ new <V, K extends string | number | symbol>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<V, K>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<V, K>['props']>, ReturnType<__sveltets_Render<V, K>['events']>, ReturnType<__sveltets_Render<V, K>['slots']>> & {
22
+ $$bindings?: ReturnType<__sveltets_Render<V, K>['bindings']>;
23
+ } & ReturnType<__sveltets_Render<V, K>['exports']>;
24
+ <V, K extends string | number | symbol>(internal: unknown, props: ReturnType<__sveltets_Render<V, K>['props']> & {}): ReturnType<__sveltets_Render<V, K>['exports']>;
25
+ z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
26
+ }
27
+ declare const Choice: $$IsomorphicComponent;
28
+ type Choice<V, K extends string | number | symbol> = InstanceType<typeof Choice<V, K>>;
29
+ export default Choice;
@@ -0,0 +1,57 @@
1
+ <script lang="ts" module>
2
+ export interface ChoiceInternalProps<T, K extends string | number | symbol>
3
+ extends Partial<FormAttrs> {
4
+ items: readonly T[];
5
+ getKey: (item: T) => K;
6
+ getLabel: (item: T) => string;
7
+ vertical?: boolean;
8
+ }
9
+ </script>
10
+
11
+ <script lang="ts" generics="T, K extends string | number | symbol">
12
+ import type { FormAttrs } from '../../form/FieldWrapper.svelte';
13
+ import { cn } from '../../../shadcn/utils.js';
14
+
15
+ interface Props extends ChoiceInternalProps<T, K> {
16
+ handleItemClick: (item: T) => void;
17
+ isActive: (item: T) => boolean;
18
+ }
19
+
20
+ let {
21
+ items = [],
22
+ getKey,
23
+ getLabel,
24
+ vertical,
25
+ handleItemClick,
26
+ isActive,
27
+ disabled,
28
+ readonly,
29
+ 'aria-invalid': ariaInvalid,
30
+ ...control
31
+ }: Props = $props();
32
+ </script>
33
+
34
+ <div
35
+ {...control}
36
+ class={cn(
37
+ 'w-fit rounded-lg border border-border bg-muted p-1 text-sm leading-[0.01em] font-semibold shadow-inner',
38
+ 'grid gap-1',
39
+ vertical ? 'grid-flow-row auto-rows-fr' : 'auto-cols-fr grid-flow-col',
40
+ disabled || readonly ? 'pointer-events-none' : 'cursor-pointer',
41
+ disabled && 'opacity-50',
42
+ ariaInvalid && 'border-destructive'
43
+ )}
44
+ >
45
+ {#each items as item (getKey(item))}
46
+ <button
47
+ type="button"
48
+ onclick={() => {
49
+ if (disabled || readonly) return;
50
+ handleItemClick(item);
51
+ }}
52
+ data-state={isActive(item) ? 'active' : 'inactive'}
53
+ class="h-8 cursor-pointer rounded-lg bg-transparent p-2 text-muted-foreground hover:text-foreground hover:outline-2 focus-visible:outline-ring data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm"
54
+ >{getLabel(item)}
55
+ </button>
56
+ {/each}
57
+ </div>
@@ -0,0 +1,34 @@
1
+ export interface ChoiceInternalProps<T, K extends string | number | symbol> extends Partial<FormAttrs> {
2
+ items: readonly T[];
3
+ getKey: (item: T) => K;
4
+ getLabel: (item: T) => string;
5
+ vertical?: boolean;
6
+ }
7
+ import type { FormAttrs } from '../../form/FieldWrapper.svelte';
8
+ declare function $$render<T, K extends string | number | symbol>(): {
9
+ props: ChoiceInternalProps<T, K> & {
10
+ handleItemClick: (item: T) => void;
11
+ isActive: (item: T) => boolean;
12
+ };
13
+ exports: {};
14
+ bindings: "";
15
+ slots: {};
16
+ events: {};
17
+ };
18
+ declare class __sveltets_Render<T, K extends string | number | symbol> {
19
+ props(): ReturnType<typeof $$render<T, K>>['props'];
20
+ events(): ReturnType<typeof $$render<T, K>>['events'];
21
+ slots(): ReturnType<typeof $$render<T, K>>['slots'];
22
+ bindings(): "";
23
+ exports(): {};
24
+ }
25
+ interface $$IsomorphicComponent {
26
+ new <T, K extends string | number | symbol>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T, K>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T, K>['props']>, ReturnType<__sveltets_Render<T, K>['events']>, ReturnType<__sveltets_Render<T, K>['slots']>> & {
27
+ $$bindings?: ReturnType<__sveltets_Render<T, K>['bindings']>;
28
+ } & ReturnType<__sveltets_Render<T, K>['exports']>;
29
+ <T, K extends string | number | symbol>(internal: unknown, props: ReturnType<__sveltets_Render<T, K>['props']> & {}): ReturnType<__sveltets_Render<T, K>['exports']>;
30
+ z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
31
+ }
32
+ declare const ChoiceInternal: $$IsomorphicComponent;
33
+ type ChoiceInternal<T, K extends string | number | symbol> = InstanceType<typeof ChoiceInternal<T, K>>;
34
+ export default ChoiceInternal;
@@ -0,0 +1,55 @@
1
+ <script lang="ts" module>
2
+ export interface ChoiceMultiProps<V, K extends string | number | symbol>
3
+ extends ChoiceInternalProps<V, K> {
4
+ value: V[];
5
+ onAdd?: (value: V) => void;
6
+ onRemove?: (value: V) => void;
7
+ }
8
+ </script>
9
+
10
+ <script lang="ts" generics="V, K extends string | number | symbol">
11
+ import ChoiceInternal, { type ChoiceInternalProps } from './ChoiceInternal.svelte';
12
+ import * as sorted from 'sorted-array-functions';
13
+
14
+ let {
15
+ value = $bindable([]),
16
+ onAdd,
17
+ onRemove,
18
+ items,
19
+ ...props
20
+ }: ChoiceMultiProps<V, K> = $props();
21
+
22
+ const valueIndex = new Map<V, number>(items.map((item, index) => [item, index] as const));
23
+
24
+ function compareItems(a: V, b: V) {
25
+ const index1 = valueIndex.get(a);
26
+ if (index1 === undefined) return 1;
27
+ const index2 = valueIndex.get(b);
28
+ if (index2 === undefined) return -1;
29
+
30
+ return Math.sign(index1 - index2) as -1 | 0 | 1;
31
+ }
32
+
33
+ function contains(item: V) {
34
+ // Sorted contains function
35
+ return sorted.has(value, item, compareItems);
36
+ }
37
+
38
+ function handleItemClick(item: V) {
39
+ // Toggle add or remove
40
+ if (!contains(item)) {
41
+ sorted.add(value, item, compareItems);
42
+ // Trigger event
43
+ onAdd?.(item);
44
+ } else {
45
+ sorted.remove(value, item, compareItems);
46
+ // Trigger event
47
+ onRemove?.(item);
48
+ }
49
+
50
+ // Re-assign value to trigger state update
51
+ value = value;
52
+ }
53
+ </script>
54
+
55
+ <ChoiceInternal {handleItemClick} isActive={contains} {items} {...props} />
@@ -0,0 +1,30 @@
1
+ export interface ChoiceMultiProps<V, K extends string | number | symbol> extends ChoiceInternalProps<V, K> {
2
+ value: V[];
3
+ onAdd?: (value: V) => void;
4
+ onRemove?: (value: V) => void;
5
+ }
6
+ import { type ChoiceInternalProps } from './ChoiceInternal.svelte';
7
+ declare function $$render<V, K extends string | number | symbol>(): {
8
+ props: ChoiceMultiProps<V, K>;
9
+ exports: {};
10
+ bindings: "value";
11
+ slots: {};
12
+ events: {};
13
+ };
14
+ declare class __sveltets_Render<V, K extends string | number | symbol> {
15
+ props(): ReturnType<typeof $$render<V, K>>['props'];
16
+ events(): ReturnType<typeof $$render<V, K>>['events'];
17
+ slots(): ReturnType<typeof $$render<V, K>>['slots'];
18
+ bindings(): "value";
19
+ exports(): {};
20
+ }
21
+ interface $$IsomorphicComponent {
22
+ new <V, K extends string | number | symbol>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<V, K>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<V, K>['props']>, ReturnType<__sveltets_Render<V, K>['events']>, ReturnType<__sveltets_Render<V, K>['slots']>> & {
23
+ $$bindings?: ReturnType<__sveltets_Render<V, K>['bindings']>;
24
+ } & ReturnType<__sveltets_Render<V, K>['exports']>;
25
+ <V, K extends string | number | symbol>(internal: unknown, props: ReturnType<__sveltets_Render<V, K>['props']> & {}): ReturnType<__sveltets_Render<V, K>['exports']>;
26
+ z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
27
+ }
28
+ declare const ChoiceMulti: $$IsomorphicComponent;
29
+ type ChoiceMulti<V, K extends string | number | symbol> = InstanceType<typeof ChoiceMulti<V, K>>;
30
+ export default ChoiceMulti;
@@ -0,0 +1,28 @@
1
+ <script lang="ts" module>
2
+ export interface WeekdayChoiceProps {
3
+ value?: Day;
4
+ onChange?: (value: Day) => void;
5
+ vertical?: boolean;
6
+ longLabels?: boolean;
7
+ letterLabels?: boolean;
8
+ disabled?: boolean | null;
9
+ readonly?: boolean | null;
10
+ }
11
+ </script>
12
+
13
+ <script lang="ts">
14
+ import { Days, formatDayLetter, formatDayShort, type Day } from '../../../utils/index.js';
15
+ import { identity } from 'ramda';
16
+
17
+ import Choice from './Choice.svelte';
18
+
19
+ let { value = $bindable(undefined), ...props }: WeekdayChoiceProps = $props();
20
+
21
+ let getLabel = $derived.by(() => {
22
+ if (props.longLabels) return identity;
23
+ if (props.letterLabels) return formatDayLetter;
24
+ return formatDayShort;
25
+ });
26
+ </script>
27
+
28
+ <Choice items={Days} bind:value {getLabel} getKey={identity} {...props} />
@@ -0,0 +1,13 @@
1
+ export interface WeekdayChoiceProps {
2
+ value?: Day;
3
+ onChange?: (value: Day) => void;
4
+ vertical?: boolean;
5
+ longLabels?: boolean;
6
+ letterLabels?: boolean;
7
+ disabled?: boolean | null;
8
+ readonly?: boolean | null;
9
+ }
10
+ import { type Day } from '../../../utils/index.js';
11
+ declare const WeekdayChoice: import("svelte").Component<WeekdayChoiceProps, {}, "value">;
12
+ type WeekdayChoice = ReturnType<typeof WeekdayChoice>;
13
+ export default WeekdayChoice;
@@ -0,0 +1,29 @@
1
+ <script lang="ts" module>
2
+ import { identity } from 'ramda';
3
+
4
+ export interface WeekdayChoiceMultiProps {
5
+ value: Day[];
6
+ onAdd?: (value: Day) => void;
7
+ onRemove?: (value: Day) => void;
8
+ vertical?: boolean;
9
+ longLabels?: boolean;
10
+ letterLabels?: boolean;
11
+ disabled?: boolean | null;
12
+ readonly?: boolean | null;
13
+ }
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ import ChoiceMulti from './ChoiceMulti.svelte';
18
+ import { Days, formatDayLetter, formatDayShort, type Day } from '../../../utils/index.js';
19
+
20
+ let { value = $bindable([]), ...props }: WeekdayChoiceMultiProps = $props();
21
+
22
+ let getLabel = $derived.by(() => {
23
+ if (props.longLabels) return identity;
24
+ if (props.letterLabels) return formatDayLetter;
25
+ return formatDayShort;
26
+ });
27
+ </script>
28
+
29
+ <ChoiceMulti items={Days} bind:value {getLabel} getKey={identity} {...props} />
@@ -0,0 +1,14 @@
1
+ export interface WeekdayChoiceMultiProps {
2
+ value: Day[];
3
+ onAdd?: (value: Day) => void;
4
+ onRemove?: (value: Day) => void;
5
+ vertical?: boolean;
6
+ longLabels?: boolean;
7
+ letterLabels?: boolean;
8
+ disabled?: boolean | null;
9
+ readonly?: boolean | null;
10
+ }
11
+ import { type Day } from '../../../utils/index.js';
12
+ declare const WeekdayChoiceMulti: import("svelte").Component<WeekdayChoiceMultiProps, {}, "value">;
13
+ type WeekdayChoiceMulti = ReturnType<typeof WeekdayChoiceMulti>;
14
+ export default WeekdayChoiceMulti;
@@ -0,0 +1 @@
1
+ export declare function highlight(code: string, lang?: string, theme?: string): Promise<string>;
@@ -0,0 +1,9 @@
1
+ import { bundledLanguages, bundledThemes, createHighlighter } from 'shiki';
2
+ const highlighterPromise = createHighlighter({
3
+ themes: Object.keys(bundledThemes), // all bundled themes
4
+ langs: Object.keys(bundledLanguages) // all bundled languages
5
+ });
6
+ export async function highlight(code, lang = 'svelte', theme = 'nord') {
7
+ const highlighter = await highlighterPromise;
8
+ return highlighter.codeToHtml(code, { lang, theme });
9
+ }
@@ -0,0 +1,168 @@
1
+ import { CalendarDate, Time, ZonedDateTime, type DateDuration } from '@internationalized/date';
2
+ export declare const Days: readonly ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
3
+ export type Day = (typeof Days)[number];
4
+ export declare const Day: import("arktype/internal/methods/string.ts").StringType<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", {}>;
5
+ /**
6
+ * Gets the day of the week for a given date.
7
+ * @param date - The date to get the day of the week for.
8
+ * @returns The day of the week
9
+ */
10
+ export declare function getDayOfDate(date: CalendarDate): Day;
11
+ /**
12
+ * Checks if a given date is a specific day of the week.
13
+ * @param date - The date to check.
14
+ * @param dayOfWeek - The day of the week to check against.
15
+ * @returns True if the date is the specified day, false otherwise.
16
+ */
17
+ export declare function isDateDay(date: CalendarDate, dayOfWeek: Day): boolean;
18
+ /**
19
+ * Checks if a given date is today.
20
+ * @param date - The date to check.
21
+ * @returns True if the date is today, false otherwise.
22
+ */
23
+ export declare function isDateToday(date: CalendarDate, timezone: string): boolean;
24
+ /**
25
+ * Calculates the age from a date of birth.
26
+ * @param dob - The date of birth.
27
+ * @returns The age in years.
28
+ * @throws Error if the date of birth is in the future.
29
+ */
30
+ export declare function ageFromDob(dob: CalendarDate, timezone: string): number;
31
+ /**
32
+ * Gets the date of the next occurrence of a day of the week.
33
+ * @param dayOfWeek - The day of the week to get the next occurrence for.
34
+ * @param startDate - The date to check from. Inclusive.
35
+ * @returns The date of the next occurrence of the specified day.
36
+ */
37
+ export declare function getNextDateOfDay(dayOfWeek: Day, startDate: CalendarDate): CalendarDate;
38
+ /**
39
+ * Gets the most recent occurrence of a day of the week.
40
+ * @param dayOfWeek - The day of the week
41
+ * @param startDate - The date to check from. Inclusive.
42
+ * @returns The most recent date for the specified day.
43
+ * @throws An error if the day of the week is invalid.
44
+ */
45
+ export declare function getLastDateOfDay(dayOfWeek: Day, startDate: CalendarDate): CalendarDate;
46
+ /**
47
+ * Gets an array of the last dates of the day of the week.
48
+ * @param dayOfWeek - The day of the week.
49
+ * @param count - The number of dates to get.
50
+ * @param startDate - The date to check from. Inclusive.
51
+ * @returns The array of dates from oldest to most recent.
52
+ * @throws An error if the day of the week is invalid.
53
+ */
54
+ export declare function getLastDatesOfDay(dayOfWeek: Day, count: number, startDate: CalendarDate): CalendarDate[];
55
+ /**
56
+ * Gets an array of dates of the last few months (first day) from a date.
57
+ * @param count - The number of months to get.
58
+ * @param startDate - The date to start from (defaults to today).
59
+ * @returns The array of dates from oldest to most recent.
60
+ */
61
+ export declare function getLastMonths(count: number, startDate: CalendarDate): CalendarDate[];
62
+ /**
63
+ * Checks if two time ranges overlap, boundaries are not considered overlapping.
64
+ * @param start1 - The start time of the first range.
65
+ * @param end1 - The end time of the first range.
66
+ * @param start2 - The start time of the second range.
67
+ * @param end2 - The end time of the second range.
68
+ * @returns True if the ranges overlap, false otherwise.
69
+ */
70
+ export declare function checkOverlap(start1: Time, end1: Time, start2: Time, end2: Time): boolean;
71
+ /**
72
+ * Determines if the given dates are within the given duration of each other.
73
+ * @param date1 - The first date in order.
74
+ * @param date2 - The second date in order.
75
+ * @param duration - The duration to check against. Inclusive of boundaries.
76
+ * @returns True if the dates are within duration, false otherwise.
77
+ */
78
+ export declare function datesWithin(date1: CalendarDate, date2: CalendarDate, duration: DateDuration): boolean;
79
+ /**
80
+ * Calculates the difference in weeks between two dates.
81
+ * @param date1 - The first date in order.
82
+ * @param date2 - The second date in order.
83
+ */
84
+ export declare function dateDiffWeeks(date1: CalendarDate, date2: CalendarDate): number;
85
+ /**
86
+ * Formats a day of the week.
87
+ * @param day - The day of the week to format.
88
+ * @example "Monday" -> "Mon"
89
+ * @returns Formatted string of the day of the week.
90
+ */
91
+ export declare function formatDayShort(day: Day): string;
92
+ /**
93
+ * Formats a day of the week.
94
+ * @param day - The day of the week to format.
95
+ * @example "Monday" -> "M"
96
+ * @returns Formatted letter of the day of the week.
97
+ */
98
+ export declare function formatDayLetter(day: Day): string;
99
+ /**
100
+ * @param date The CalendarDate object to format.
101
+ * @returns string of date in shortened format
102
+ * @example "Oct 5"
103
+ */
104
+ export declare function formatDateShort(date: CalendarDate): string;
105
+ /**
106
+ * @param date The CalendarDate object to format.
107
+ * @returns The formatted date string.
108
+ * @example "5 Oct 2023"
109
+ */
110
+ export declare function formatDateFull(date: CalendarDate): string;
111
+ /**
112
+ * ISO format
113
+ * @param date The CalendarDate object to format.
114
+ * @returns The formatted date string in YYYY-MM-DD format.
115
+ * @example "2023-10-05"
116
+ */
117
+ export declare function formatDateISO(date: CalendarDate): string;
118
+ /**
119
+ * @param date The CalendarDate object to format.
120
+ * @returns The formatted date string in dd/mm/yyyy format.
121
+ * @example "05/10/2023"
122
+ */
123
+ export declare function formatDateNum(date: CalendarDate): string;
124
+ /**
125
+ * Formats the month only.
126
+ * @param date - The date to format.
127
+ * @returns The formatted month string.
128
+ * @example "Oct"
129
+ */
130
+ export declare function formatMonth(date: CalendarDate): string;
131
+ /**
132
+ * Gives time in HH:MM format
133
+ * @param time
134
+ * @returns string of time in that format
135
+ */
136
+ export declare function formatTimeShort(time: Time): string;
137
+ /**
138
+ * Gives time in HH:MM:SS format
139
+ * @param time
140
+ * @returns string of time in that format
141
+ */
142
+ export declare function formatTimeFull(time: Time): string;
143
+ /**
144
+ * Calculates the end time given a starting time and duration.
145
+ * @param timeStart starting time
146
+ * @param durationMinutes duration in minutes
147
+ * @returns end time in HH:MM format
148
+ */
149
+ export declare function formatTimeEnd(timeStart: Time, durationMinutes: number): string;
150
+ /**
151
+ * Formats a full date and time.
152
+ * @param datetime The ZonedDateTime object to format.
153
+ * @returns The formatted date and time string.
154
+ * @example "05/10/2023 14:30:00"
155
+ */
156
+ export declare function formatAbsolute(datetime: ZonedDateTime): string;
157
+ /**
158
+ * Unfreezes a CalendarDate object from a snapshot.
159
+ * @param raw - The snapshot of the CalendarDate object.
160
+ * @returns The unfrozen CalendarDate object.
161
+ */
162
+ export declare function unfreezeDate(raw: $state.Snapshot<CalendarDate>): CalendarDate;
163
+ /**
164
+ * Unfreezes a Time object from a snapshot.
165
+ * @param raw - The snapshot of the Time object.
166
+ * @returns The unfrozen Time object.
167
+ */
168
+ export declare function unfreezeTime(raw: $state.Snapshot<Time>): Time;