@webamoki/web-svelte 0.8.0 → 1.0.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.
- package/README.md +83 -3
- package/dist/components/form/Button.svelte +24 -23
- package/dist/components/form/Button.svelte.d.ts +2 -2
- package/dist/components/form/Errors.svelte +13 -13
- package/dist/components/form/FieldWrapper.svelte +57 -55
- package/dist/components/form/FieldWrapper.svelte.d.ts +4 -4
- package/dist/components/form/Form.svelte +18 -14
- package/dist/components/form/Form.svelte.d.ts +31 -22
- package/dist/components/form/IconInputWrapper.svelte +30 -29
- package/dist/components/form/IconInputWrapper.svelte.d.ts +7 -7
- package/dist/components/form/fields/ChoiceField.svelte +45 -43
- package/dist/components/form/fields/ChoiceField.svelte.d.ts +28 -23
- package/dist/components/form/fields/ChoiceMultiField.svelte +44 -42
- package/dist/components/form/fields/ChoiceMultiField.svelte.d.ts +28 -23
- package/dist/components/form/fields/DateField.svelte +42 -40
- package/dist/components/form/fields/DateField.svelte.d.ts +29 -22
- package/dist/components/form/fields/HexColorField.svelte +21 -19
- package/dist/components/form/fields/HexColorField.svelte.d.ts +24 -19
- package/dist/components/form/fields/MessageField.svelte +39 -60
- package/dist/components/form/fields/MessageField.svelte.d.ts +33 -24
- package/dist/components/form/fields/NumberField.svelte +38 -36
- package/dist/components/form/fields/NumberField.svelte.d.ts +32 -23
- package/dist/components/form/fields/PasswordField.svelte +45 -39
- package/dist/components/form/fields/PasswordField.svelte.d.ts +28 -21
- package/dist/components/form/fields/SelectField.svelte +84 -79
- package/dist/components/form/fields/SelectField.svelte.d.ts +39 -26
- package/dist/components/form/fields/SelectMultiField.svelte +90 -85
- package/dist/components/form/fields/SelectMultiField.svelte.d.ts +38 -25
- package/dist/components/form/fields/TextField.svelte +31 -29
- package/dist/components/form/fields/TextField.svelte.d.ts +32 -23
- package/dist/components/form/fields/TextFieldNullable.svelte +49 -47
- package/dist/components/form/fields/TextFieldNullable.svelte.d.ts +32 -23
- package/dist/components/form/fields/TimeField.svelte +66 -64
- package/dist/components/form/fields/TimeField.svelte.d.ts +33 -24
- package/dist/components/form/fields/WeekdayChoiceField.svelte +37 -35
- package/dist/components/form/fields/WeekdayChoiceField.svelte.d.ts +27 -22
- package/dist/components/form/fields/WeekdayChoiceMultiField.svelte +37 -35
- package/dist/components/form/fields/WeekdayChoiceMultiField.svelte.d.ts +27 -22
- package/dist/components/showcase/CodeBlock.svelte +41 -41
- package/dist/components/showcase/Container.svelte +7 -7
- package/dist/components/showcase/Preview.svelte +4 -4
- package/dist/components/showcase/Sidebar.svelte +4 -4
- package/dist/components/showcase/SidebarLink.svelte +3 -3
- package/dist/components/ui/choice/Choice.svelte +25 -25
- package/dist/components/ui/choice/Choice.svelte.d.ts +7 -7
- package/dist/components/ui/choice/ChoiceInternal.svelte +73 -72
- package/dist/components/ui/choice/ChoiceInternal.svelte.d.ts +9 -9
- package/dist/components/ui/choice/ChoiceMulti.svelte +59 -56
- package/dist/components/ui/choice/ChoiceMulti.svelte.d.ts +7 -7
- package/dist/components/ui/choice/WeekdayChoice.svelte +22 -21
- package/dist/components/ui/choice/WeekdayChoice.svelte.d.ts +6 -6
- package/dist/components/ui/choice/WeekdayChoiceMulti.svelte +24 -22
- package/dist/components/ui/choice/WeekdayChoiceMulti.svelte.d.ts +6 -6
- package/dist/components/ui/context-menu/ContextMenu.svelte +51 -50
- package/dist/components/ui/context-menu/ContextMenu.svelte.d.ts +1 -1
- package/dist/components/ui/context-menu/ContextMenuContent.svelte +92 -91
- package/dist/components/ui/context-menu/ContextMenuItem.svelte +26 -25
- package/dist/components/ui/context-menu/ContextMenuItem.svelte.d.ts +1 -1
- package/dist/components/ui/context-menu/ContextMenuTrigger.svelte +16 -15
- package/dist/components/ui/context-menu/context-menu-state.svelte.d.ts +3 -3
- package/dist/components/ui/context-menu/context-menu-state.svelte.js +15 -15
- package/dist/components/ui/drag-drop/Draggable.svelte +73 -72
- package/dist/components/ui/drag-drop/Draggable.svelte.d.ts +2 -2
- package/dist/components/ui/drag-drop/Dropzone.svelte +56 -54
- package/dist/components/ui/drag-drop/Dropzone.svelte.d.ts +3 -3
- package/dist/components/ui/drag-drop/drag-manager.d.ts +2 -2
- package/dist/components/ui/drag-drop/drag-manager.js +9 -9
- package/dist/components/ui/index.d.ts +2 -2
- package/dist/components/ui/index.js +5 -5
- package/dist/components/ui/search/SearchBar.svelte +18 -18
- package/dist/components/ui/search/SearchBar.svelte.d.ts +2 -2
- package/dist/highlight.js +2 -2
- package/dist/server/form-handler.d.ts +12 -12
- package/dist/server/form-handler.js +17 -17
- package/dist/server/form-processor.d.ts +1 -1
- package/dist/server/form-processor.js +0 -1
- package/dist/shadcn/components/ui/button/button.svelte +72 -71
- package/dist/shadcn/components/ui/button/button.svelte.d.ts +23 -23
- package/dist/shadcn/components/ui/button/index.d.ts +1 -1
- package/dist/shadcn/components/ui/button/index.js +2 -2
- package/dist/shadcn/components/ui/input/index.d.ts +1 -1
- package/dist/shadcn/components/ui/input/index.js +2 -2
- package/dist/shadcn/components/ui/input/input.svelte +35 -32
- package/dist/shadcn/components/ui/input/input.svelte.d.ts +2 -2
- package/dist/shadcn/components/ui/select/index.d.ts +6 -6
- package/dist/shadcn/components/ui/select/index.js +7 -7
- package/dist/shadcn/components/ui/select/select-content.svelte +35 -34
- package/dist/shadcn/components/ui/select/select-content.svelte.d.ts +1 -1
- package/dist/shadcn/components/ui/select/select-group-heading.svelte +15 -14
- package/dist/shadcn/components/ui/select/select-group.svelte +2 -2
- package/dist/shadcn/components/ui/select/select-item.svelte +31 -31
- package/dist/shadcn/components/ui/select/select-label.svelte +14 -13
- package/dist/shadcn/components/ui/select/select-label.svelte.d.ts +1 -1
- package/dist/shadcn/components/ui/select/select-scroll-down-button.svelte +13 -13
- package/dist/shadcn/components/ui/select/select-scroll-up-button.svelte +13 -13
- package/dist/shadcn/components/ui/select/select-separator.svelte +13 -12
- package/dist/shadcn/components/ui/select/select-trigger.svelte +26 -26
- package/dist/shadcn/components/ui/select/select-trigger.svelte.d.ts +2 -2
- package/dist/shadcn/components/ui/separator/separator.svelte +14 -14
- package/dist/shadcn/components/ui/textarea/textarea.svelte +22 -21
- package/dist/shadcn/components/ui/textarea/textarea.svelte.d.ts +1 -1
- package/dist/shadcn/utils.d.ts +4 -4
- package/dist/utils/datetime/index.d.ts +66 -66
- package/dist/utils/datetime/index.js +124 -124
- package/dist/utils/email/README.md +60 -60
- package/dist/utils/email/aws-signer.d.ts +1 -1
- package/dist/utils/email/aws-signer.js +39 -39
- package/dist/utils/email/ses.d.ts +8 -8
- package/dist/utils/email/ses.js +9 -9
- package/dist/utils/form/index.d.ts +11 -11
- package/dist/utils/form/index.js +23 -24
- package/dist/utils/form/virtual-form.d.ts +5 -5
- package/dist/utils/form/virtual-form.js +58 -58
- package/dist/utils/search.d.ts +1 -1
- package/dist/utils/search.js +22 -22
- package/dist/utils/types/arktype.d.ts +2 -2
- package/dist/utils/types/arktype.js +3 -3
- package/dist/utils/types/db.d.ts +2 -1
- package/dist/utils/types/db.js +7 -7
- package/package.json +47 -32
|
@@ -1,72 +1,74 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { cn } from '../../../shadcn/utils.js';
|
|
5
|
-
import { Time } from '@internationalized/date';
|
|
6
|
-
import type { Component } from 'svelte';
|
|
7
|
-
import type { FormPath } from 'sveltekit-superforms';
|
|
8
|
-
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
1
|
+
<script generics="T extends Record<string, unknown>, U extends FormPath<T>, M" lang="ts">
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import type { FormPath } from 'sveltekit-superforms';
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
placeholder?: string;
|
|
15
|
-
icon?: Component;
|
|
16
|
-
}
|
|
17
|
-
let {
|
|
18
|
-
value = $bindable(),
|
|
19
|
-
class: className,
|
|
20
|
-
step,
|
|
21
|
-
placeholder,
|
|
22
|
-
icon,
|
|
23
|
-
...fieldProps
|
|
24
|
-
}: Props = $props();
|
|
25
|
-
// Getter: format Time as string depending on step
|
|
26
|
-
function get(): string {
|
|
27
|
-
if (!value) return '00:00:00';
|
|
28
|
-
const hh = String(value.hour).padStart(2, '0');
|
|
29
|
-
const mm = String(value.minute).padStart(2, '0');
|
|
5
|
+
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
6
|
+
import { Input } from '../../../shadcn/components/ui/input/index.js';
|
|
7
|
+
import { cn } from '../../../shadcn/utils.js';
|
|
8
|
+
import { Time } from '@internationalized/date';
|
|
30
9
|
|
|
31
|
-
|
|
32
|
-
if (!step || Number(step) < 60) {
|
|
33
|
-
const ss = String(value.second).padStart(2, '0');
|
|
34
|
-
return `${hh}:${mm}:${ss}`;
|
|
35
|
-
}
|
|
10
|
+
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
36
11
|
|
|
37
|
-
|
|
38
|
-
|
|
12
|
+
interface Props extends FieldWrapperProps<T, U, M> {
|
|
13
|
+
class?: string;
|
|
14
|
+
icon?: Component;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
step?: HTMLInputElement['step'];
|
|
17
|
+
value?: Time;
|
|
18
|
+
}
|
|
19
|
+
let {
|
|
20
|
+
class: className,
|
|
21
|
+
icon,
|
|
22
|
+
placeholder,
|
|
23
|
+
step,
|
|
24
|
+
value = $bindable(),
|
|
25
|
+
...fieldProps
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
// Getter: format Time as string depending on step
|
|
28
|
+
function get(): string {
|
|
29
|
+
if (!value) return '00:00:00';
|
|
30
|
+
const hh = String(value.hour).padStart(2, '0');
|
|
31
|
+
const mm = String(value.minute).padStart(2, '0');
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
33
|
+
// If step < 60, include seconds
|
|
34
|
+
if (!step || Number(step) < 60) {
|
|
35
|
+
const ss = String(value.second).padStart(2, '0');
|
|
36
|
+
return `${hh}:${mm}:${ss}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return `${hh}:${mm}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Setter: parse string into Time depending on step
|
|
43
|
+
function set(raw: string) {
|
|
44
|
+
if (!raw) {
|
|
45
|
+
value = undefined;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const parts = raw.split(':').map(Number);
|
|
49
|
+
if (parts.length === 2) {
|
|
50
|
+
const [hh, mm] = parts;
|
|
51
|
+
value = new Time(hh, mm);
|
|
52
|
+
} else if (parts.length === 3) {
|
|
53
|
+
const [hh, mm, ss] = parts;
|
|
54
|
+
value = new Time(hh, mm, ss);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
55
57
|
</script>
|
|
56
58
|
|
|
57
59
|
<FieldWrapper {...fieldProps}>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
{#snippet formElem(props)}
|
|
61
|
+
<IconInputWrapper {icon}>
|
|
62
|
+
{#snippet children({ class: iconClass })}
|
|
63
|
+
<Input
|
|
64
|
+
class={cn(iconClass, className)}
|
|
65
|
+
{placeholder}
|
|
66
|
+
{step}
|
|
67
|
+
type="time"
|
|
68
|
+
bind:value={get, set}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
{/snippet}
|
|
72
|
+
</IconInputWrapper>
|
|
73
|
+
{/snippet}
|
|
72
74
|
</FieldWrapper>
|
|
@@ -1,34 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export default TimeField;
|
|
2
|
+
type TimeField<T extends Record<string, unknown>, U extends FormPath<T>, M> = SvelteComponent<Props, {}, {}> & {
|
|
3
|
+
$$bindings?: "value" | undefined;
|
|
4
|
+
} & {};
|
|
5
|
+
declare const TimeField: $$IsomorphicComponent;
|
|
6
|
+
import { FormPath } from 'sveltekit-superforms';
|
|
7
|
+
type Props = FieldWrapperProps<T, U, M> & {
|
|
8
|
+
class?: string | undefined;
|
|
9
|
+
icon?: Component<any, any, string> | undefined;
|
|
10
|
+
placeholder?: string | undefined;
|
|
11
|
+
step?: string | undefined;
|
|
12
|
+
value?: Time | undefined;
|
|
13
|
+
};
|
|
14
|
+
interface $$IsomorphicComponent {
|
|
15
|
+
new <T extends Record<string, unknown>, U extends FormPath<T>, M>(options: import("svelte").ComponentConstructorOptions<ReturnType<__sveltets_Render<T, U, M>["props"]>>): import("svelte").SvelteComponent<ReturnType<__sveltets_Render<T, U, M>["props"]>, ReturnType<__sveltets_Render<T, U, M>["events"]>, ReturnType<__sveltets_Render<T, U, M>["slots"]>> & {
|
|
16
|
+
$$bindings?: ReturnType<__sveltets_Render<T, U, M>["bindings"]>;
|
|
17
|
+
} & ReturnType<__sveltets_Render<T, U, M>["exports"]>;
|
|
18
|
+
<T extends Record<string, unknown>, U extends FormPath<T>, M>(internal: unknown, props: ReturnType<__sveltets_Render<T, U, M>["props"]> & {}): ReturnType<__sveltets_Render<T, U, M>["exports"]>;
|
|
19
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>["bindings"]>;
|
|
20
|
+
}
|
|
21
|
+
declare class __sveltets_Render<T extends Record<string, unknown>, U extends FormPath<T>, M> {
|
|
22
|
+
props(): ReturnType<typeof $$render<T, U, M>>["props"];
|
|
23
|
+
events(): ReturnType<typeof $$render<T, U, M>>["events"];
|
|
24
|
+
slots(): ReturnType<typeof $$render<T, U, M>>["slots"];
|
|
25
|
+
bindings(): "value";
|
|
26
|
+
exports(): {};
|
|
27
|
+
}
|
|
5
28
|
declare function $$render<T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
|
|
6
29
|
props: FieldWrapperProps<T, U, M> & {
|
|
7
|
-
value?: Time;
|
|
8
30
|
class?: string;
|
|
9
|
-
step?: HTMLInputElement["step"];
|
|
10
|
-
placeholder?: string;
|
|
11
31
|
icon?: Component;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
step?: HTMLInputElement["step"];
|
|
34
|
+
value?: Time;
|
|
12
35
|
};
|
|
13
36
|
exports: {};
|
|
14
37
|
bindings: "value";
|
|
15
38
|
slots: {};
|
|
16
39
|
events: {};
|
|
17
40
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
slots(): ReturnType<typeof $$render<T, U, M>>['slots'];
|
|
22
|
-
bindings(): "value";
|
|
23
|
-
exports(): {};
|
|
24
|
-
}
|
|
25
|
-
interface $$IsomorphicComponent {
|
|
26
|
-
new <T extends Record<string, unknown>, U extends FormPath<T>, M>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T, U, M>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T, U, M>['props']>, ReturnType<__sveltets_Render<T, U, M>['events']>, ReturnType<__sveltets_Render<T, U, M>['slots']>> & {
|
|
27
|
-
$$bindings?: ReturnType<__sveltets_Render<T, U, M>['bindings']>;
|
|
28
|
-
} & ReturnType<__sveltets_Render<T, U, M>['exports']>;
|
|
29
|
-
<T extends Record<string, unknown>, U extends FormPath<T>, M>(internal: unknown, props: ReturnType<__sveltets_Render<T, U, M>['props']> & {}): ReturnType<__sveltets_Render<T, U, M>['exports']>;
|
|
30
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>['bindings']>;
|
|
31
|
-
}
|
|
32
|
-
declare const TimeField: $$IsomorphicComponent;
|
|
33
|
-
type TimeField<T extends Record<string, unknown>, U extends FormPath<T>, M> = InstanceType<typeof TimeField<T, U, M>>;
|
|
34
|
-
export default TimeField;
|
|
41
|
+
import { FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
42
|
+
import { Component } from 'svelte';
|
|
43
|
+
import { Time } from '@internationalized/date';
|
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
type WeekdayChoiceProps
|
|
4
|
-
} from '../../ui/choice/WeekdayChoice.svelte';
|
|
5
|
-
import type { FormPath } from 'sveltekit-superforms';
|
|
6
|
-
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
1
|
+
<script generics="T extends Record<string, unknown>, U extends FormPath<T>, M" lang="ts">
|
|
2
|
+
import type { FormPath } from 'sveltekit-superforms';
|
|
7
3
|
|
|
8
|
-
|
|
4
|
+
import WeekdayChoice, {
|
|
5
|
+
type WeekdayChoiceProps
|
|
6
|
+
} from '../../ui/choice/WeekdayChoice.svelte';
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
onChange,
|
|
12
|
-
vertical,
|
|
13
|
-
value = $bindable(undefined),
|
|
14
|
-
letterLabels,
|
|
15
|
-
longLabels,
|
|
8
|
+
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
16
9
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
type Props = FieldWrapperProps<T, U, M> & WeekdayChoiceProps & { class?: string };
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
class: className,
|
|
14
|
+
description,
|
|
15
|
+
disabled,
|
|
16
|
+
form,
|
|
17
|
+
label,
|
|
18
|
+
|
|
19
|
+
letterLabels,
|
|
20
|
+
longLabels,
|
|
21
|
+
name,
|
|
22
|
+
onChange,
|
|
23
|
+
readonly,
|
|
24
|
+
value = $bindable(undefined),
|
|
25
|
+
vertical
|
|
26
|
+
}: Props = $props();
|
|
25
27
|
</script>
|
|
26
28
|
|
|
27
|
-
<FieldWrapper {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
<FieldWrapper {name} class={className} {description} {form} {label}>
|
|
30
|
+
{#snippet formElem(props)}
|
|
31
|
+
<WeekdayChoice
|
|
32
|
+
{disabled}
|
|
33
|
+
{letterLabels}
|
|
34
|
+
{longLabels}
|
|
35
|
+
{onChange}
|
|
36
|
+
{readonly}
|
|
37
|
+
{vertical}
|
|
38
|
+
bind:value
|
|
39
|
+
{...props}
|
|
40
|
+
class="w-full"
|
|
41
|
+
/>
|
|
42
|
+
{/snippet}
|
|
41
43
|
</FieldWrapper>
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default WeekdayChoiceField;
|
|
2
|
+
type WeekdayChoiceField<T extends Record<string, unknown>, U extends FormPath<T>, M> = SvelteComponent<Props, {}, {}> & {
|
|
3
|
+
$$bindings?: "value" | undefined;
|
|
4
|
+
} & {};
|
|
5
|
+
declare const WeekdayChoiceField: $$IsomorphicComponent;
|
|
6
|
+
import { FormPath } from 'sveltekit-superforms';
|
|
7
|
+
type Props = FieldWrapperProps<T, U, M> & WeekdayChoiceProps & {
|
|
8
|
+
class?: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
interface $$IsomorphicComponent {
|
|
11
|
+
new <T extends Record<string, unknown>, U extends FormPath<T>, M>(options: import("svelte").ComponentConstructorOptions<ReturnType<__sveltets_Render<T, U, M>["props"]>>): import("svelte").SvelteComponent<ReturnType<__sveltets_Render<T, U, M>["props"]>, ReturnType<__sveltets_Render<T, U, M>["events"]>, ReturnType<__sveltets_Render<T, U, M>["slots"]>> & {
|
|
12
|
+
$$bindings?: ReturnType<__sveltets_Render<T, U, M>["bindings"]>;
|
|
13
|
+
} & ReturnType<__sveltets_Render<T, U, M>["exports"]>;
|
|
14
|
+
<T extends Record<string, unknown>, U extends FormPath<T>, M>(internal: unknown, props: ReturnType<__sveltets_Render<T, U, M>["props"]> & {}): ReturnType<__sveltets_Render<T, U, M>["exports"]>;
|
|
15
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>["bindings"]>;
|
|
16
|
+
}
|
|
17
|
+
declare class __sveltets_Render<T extends Record<string, unknown>, U extends FormPath<T>, M> {
|
|
18
|
+
props(): ReturnType<typeof $$render<T, U, M>>["props"];
|
|
19
|
+
events(): ReturnType<typeof $$render<T, U, M>>["events"];
|
|
20
|
+
slots(): ReturnType<typeof $$render<T, U, M>>["slots"];
|
|
21
|
+
bindings(): "value";
|
|
22
|
+
exports(): {};
|
|
23
|
+
}
|
|
4
24
|
declare function $$render<T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
|
|
5
|
-
props: {
|
|
25
|
+
props: FieldWrapperProps<T, U, M> & WeekdayChoiceProps & {
|
|
6
26
|
class?: string;
|
|
7
|
-
}
|
|
27
|
+
};
|
|
8
28
|
exports: {};
|
|
9
29
|
bindings: "value";
|
|
10
30
|
slots: {};
|
|
11
31
|
events: {};
|
|
12
32
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
events(): ReturnType<typeof $$render<T, U, M>>['events'];
|
|
16
|
-
slots(): ReturnType<typeof $$render<T, U, M>>['slots'];
|
|
17
|
-
bindings(): "value";
|
|
18
|
-
exports(): {};
|
|
19
|
-
}
|
|
20
|
-
interface $$IsomorphicComponent {
|
|
21
|
-
new <T extends Record<string, unknown>, U extends FormPath<T>, M>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T, U, M>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T, U, M>['props']>, ReturnType<__sveltets_Render<T, U, M>['events']>, ReturnType<__sveltets_Render<T, U, M>['slots']>> & {
|
|
22
|
-
$$bindings?: ReturnType<__sveltets_Render<T, U, M>['bindings']>;
|
|
23
|
-
} & ReturnType<__sveltets_Render<T, U, M>['exports']>;
|
|
24
|
-
<T extends Record<string, unknown>, U extends FormPath<T>, M>(internal: unknown, props: ReturnType<__sveltets_Render<T, U, M>['props']> & {}): ReturnType<__sveltets_Render<T, U, M>['exports']>;
|
|
25
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>['bindings']>;
|
|
26
|
-
}
|
|
27
|
-
declare const WeekdayChoiceField: $$IsomorphicComponent;
|
|
28
|
-
type WeekdayChoiceField<T extends Record<string, unknown>, U extends FormPath<T>, M> = InstanceType<typeof WeekdayChoiceField<T, U, M>>;
|
|
29
|
-
export default WeekdayChoiceField;
|
|
33
|
+
import { FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
34
|
+
import { WeekdayChoiceProps } from '../../ui/choice/WeekdayChoice.svelte';
|
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { FormPath } from 'sveltekit-superforms';
|
|
5
|
-
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
1
|
+
<script generics="T extends Record<string, unknown>, U extends FormPath<T>, M" lang="ts">
|
|
2
|
+
import type { WeekdayChoiceMultiProps } from '../../ui/choice/WeekdayChoiceMulti.svelte';
|
|
3
|
+
import type { FormPath } from 'sveltekit-superforms';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
onAdd,
|
|
10
|
-
onRemove,
|
|
11
|
-
vertical,
|
|
12
|
-
value = $bindable([]),
|
|
13
|
-
letterLabels,
|
|
14
|
-
longLabels,
|
|
5
|
+
import WeekdayChoiceMulti from '../../ui/choice/WeekdayChoiceMulti.svelte';
|
|
15
6
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
8
|
+
|
|
9
|
+
type Props = FieldWrapperProps<T, U, M> & WeekdayChoiceMultiProps & { class?: string };
|
|
10
|
+
let {
|
|
11
|
+
class: className,
|
|
12
|
+
description,
|
|
13
|
+
disabled,
|
|
14
|
+
form,
|
|
15
|
+
label,
|
|
16
|
+
letterLabels,
|
|
17
|
+
|
|
18
|
+
longLabels,
|
|
19
|
+
name,
|
|
20
|
+
onAdd,
|
|
21
|
+
onRemove,
|
|
22
|
+
readonly,
|
|
23
|
+
value = $bindable([]),
|
|
24
|
+
vertical
|
|
25
|
+
}: Props = $props();
|
|
24
26
|
</script>
|
|
25
27
|
|
|
26
|
-
<FieldWrapper {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
<FieldWrapper {name} class={className} {description} {form} {label}>
|
|
29
|
+
{#snippet formElem(props)}
|
|
30
|
+
<WeekdayChoiceMulti
|
|
31
|
+
{disabled}
|
|
32
|
+
{letterLabels}
|
|
33
|
+
{longLabels}
|
|
34
|
+
{onAdd}
|
|
35
|
+
{onRemove}
|
|
36
|
+
{readonly}
|
|
37
|
+
{vertical}
|
|
38
|
+
{...props}
|
|
39
|
+
bind:value
|
|
40
|
+
/>
|
|
41
|
+
{/snippet}
|
|
40
42
|
</FieldWrapper>
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default WeekdayChoiceMultiField;
|
|
2
|
+
type WeekdayChoiceMultiField<T extends Record<string, unknown>, U extends FormPath<T>, M> = SvelteComponent<Props, {}, {}> & {
|
|
3
|
+
$$bindings?: "value" | undefined;
|
|
4
|
+
} & {};
|
|
5
|
+
declare const WeekdayChoiceMultiField: $$IsomorphicComponent;
|
|
6
|
+
import { FormPath } from 'sveltekit-superforms';
|
|
7
|
+
type Props = FieldWrapperProps<T, U, M> & WeekdayChoiceMultiProps & {
|
|
8
|
+
class?: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
interface $$IsomorphicComponent {
|
|
11
|
+
new <T extends Record<string, unknown>, U extends FormPath<T>, M>(options: import("svelte").ComponentConstructorOptions<ReturnType<__sveltets_Render<T, U, M>["props"]>>): import("svelte").SvelteComponent<ReturnType<__sveltets_Render<T, U, M>["props"]>, ReturnType<__sveltets_Render<T, U, M>["events"]>, ReturnType<__sveltets_Render<T, U, M>["slots"]>> & {
|
|
12
|
+
$$bindings?: ReturnType<__sveltets_Render<T, U, M>["bindings"]>;
|
|
13
|
+
} & ReturnType<__sveltets_Render<T, U, M>["exports"]>;
|
|
14
|
+
<T extends Record<string, unknown>, U extends FormPath<T>, M>(internal: unknown, props: ReturnType<__sveltets_Render<T, U, M>["props"]> & {}): ReturnType<__sveltets_Render<T, U, M>["exports"]>;
|
|
15
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>["bindings"]>;
|
|
16
|
+
}
|
|
17
|
+
declare class __sveltets_Render<T extends Record<string, unknown>, U extends FormPath<T>, M> {
|
|
18
|
+
props(): ReturnType<typeof $$render<T, U, M>>["props"];
|
|
19
|
+
events(): ReturnType<typeof $$render<T, U, M>>["events"];
|
|
20
|
+
slots(): ReturnType<typeof $$render<T, U, M>>["slots"];
|
|
21
|
+
bindings(): "value";
|
|
22
|
+
exports(): {};
|
|
23
|
+
}
|
|
4
24
|
declare function $$render<T extends Record<string, unknown>, U extends FormPath<T>, M>(): {
|
|
5
|
-
props: {
|
|
25
|
+
props: FieldWrapperProps<T, U, M> & WeekdayChoiceMultiProps & {
|
|
6
26
|
class?: string;
|
|
7
|
-
}
|
|
27
|
+
};
|
|
8
28
|
exports: {};
|
|
9
29
|
bindings: "value";
|
|
10
30
|
slots: {};
|
|
11
31
|
events: {};
|
|
12
32
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
events(): ReturnType<typeof $$render<T, U, M>>['events'];
|
|
16
|
-
slots(): ReturnType<typeof $$render<T, U, M>>['slots'];
|
|
17
|
-
bindings(): "value";
|
|
18
|
-
exports(): {};
|
|
19
|
-
}
|
|
20
|
-
interface $$IsomorphicComponent {
|
|
21
|
-
new <T extends Record<string, unknown>, U extends FormPath<T>, M>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T, U, M>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T, U, M>['props']>, ReturnType<__sveltets_Render<T, U, M>['events']>, ReturnType<__sveltets_Render<T, U, M>['slots']>> & {
|
|
22
|
-
$$bindings?: ReturnType<__sveltets_Render<T, U, M>['bindings']>;
|
|
23
|
-
} & ReturnType<__sveltets_Render<T, U, M>['exports']>;
|
|
24
|
-
<T extends Record<string, unknown>, U extends FormPath<T>, M>(internal: unknown, props: ReturnType<__sveltets_Render<T, U, M>['props']> & {}): ReturnType<__sveltets_Render<T, U, M>['exports']>;
|
|
25
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>['bindings']>;
|
|
26
|
-
}
|
|
27
|
-
declare const WeekdayChoiceMultiField: $$IsomorphicComponent;
|
|
28
|
-
type WeekdayChoiceMultiField<T extends Record<string, unknown>, U extends FormPath<T>, M> = InstanceType<typeof WeekdayChoiceMultiField<T, U, M>>;
|
|
29
|
-
export default WeekdayChoiceMultiField;
|
|
33
|
+
import { FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
34
|
+
import { WeekdayChoiceMultiProps } from '../../ui/choice/WeekdayChoiceMulti.svelte';
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { highlight } from '../../highlight.js';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
export let language: string = 'svelte';
|
|
6
|
+
export let theme: string = 'nord';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
let highlightedCode = '';
|
|
9
|
+
let codeBlock: HTMLDivElement;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
onMount(async () => {
|
|
12
|
+
const code = codeBlock.textContent || '';
|
|
13
|
+
const lines = code.split('\n');
|
|
14
|
+
const firstLine = lines.find((line) => line.trim() !== '');
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
// Dedent the code first
|
|
17
|
+
let dedentedCode = '';
|
|
18
|
+
if (firstLine) {
|
|
19
|
+
const leadingSpaces = firstLine.match(/^\s*/)?.[0].length || 0;
|
|
20
|
+
dedentedCode = lines
|
|
21
|
+
.map((line) => line.slice(leadingSpaces))
|
|
22
|
+
.join('\n')
|
|
23
|
+
.trim();
|
|
24
|
+
} else {
|
|
25
|
+
dedentedCode = code.trim();
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
// Add tabs to each line and spacing above/below
|
|
29
|
+
const spacedCode =
|
|
30
|
+
'\n' +
|
|
31
|
+
dedentedCode
|
|
32
|
+
.split('\n')
|
|
33
|
+
.map((line) => `\t${line}`)
|
|
34
|
+
.join('\n') +
|
|
35
|
+
'\n\n';
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
highlightedCode = await highlight(spacedCode, language, theme);
|
|
38
|
+
});
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<div class="overflow-hidden rounded-b-xl border bg-gray-900">
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
<div class="border-b border-gray-800 bg-gray-800 px-4 py-2 text-sm font-medium text-gray-200">
|
|
43
|
+
Code
|
|
44
|
+
</div>
|
|
45
|
+
<div bind:this={codeBlock} style="display: none;" class="overflow-x-auto text-sm">
|
|
46
|
+
<slot />
|
|
47
|
+
</div>
|
|
48
|
+
<div class="overflow-x-auto text-sm">
|
|
49
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
|
50
|
+
{@html highlightedCode}
|
|
51
|
+
</div>
|
|
52
52
|
</div>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export let title: string;
|
|
3
|
+
export let description: string;
|
|
4
|
+
let id = title.toLowerCase().replace(/\s+/g, '-');
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<section {id} class="mx-auto mb-12 w-full max-w-screen px-4">
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
<h2 class="mb-4 text-2xl font-semibold text-gray-800">{title}</h2>
|
|
9
|
+
<p class="mb-6 text-gray-600">{description}</p>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
<slot name="preview" />
|
|
12
|
+
<slot name="code" />
|
|
13
13
|
</section>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div class="rounded-t-xl border bg-white shadow-sm">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div class="border-b bg-gray-50 px-4 py-2 text-sm font-medium text-gray-700">Preview</div>
|
|
3
|
+
<div class="p-6">
|
|
4
|
+
<slot />
|
|
5
|
+
</div>
|
|
6
6
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<aside class="sticky top-0 hidden h-screen w-64 overflow-y-auto border-r bg-white p-6 lg:block">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<h2 class="mb-4 text-xl font-bold text-gray-900">Components</h2>
|
|
3
|
+
<nav class="space-y-2">
|
|
4
|
+
<slot />
|
|
5
|
+
</nav>
|
|
6
6
|
</aside>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
2
|
+
export let title: string;
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
let id = title.toLowerCase().replace(/\s+/g, '-');
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<a
|
|
7
|
+
<a class="block text-gray-600 hover:text-gray-900" href="#{id}">{title}</a>
|