@webamoki/web-svelte 1.2.2 → 2.0.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/README.md +3 -1
- package/dist/components/showcase/CodeBlock.svelte +1 -1
- package/dist/{components → shared/components}/form/Button.svelte +2 -2
- package/dist/{components → shared/components}/form/Button.svelte.d.ts +2 -2
- package/dist/{components → shared/components}/form/Errors.svelte +1 -1
- package/dist/{components → shared/components}/form/FieldWrapper.svelte +1 -1
- package/dist/{components → shared/components}/form/fields/ChoiceMultiField.svelte +3 -1
- package/dist/{components → shared/components}/form/fields/DateField.svelte +2 -2
- package/dist/{components → shared/components}/form/fields/MessageField.svelte +2 -2
- package/dist/{components → shared/components}/form/fields/NumberField.svelte +2 -2
- package/dist/{components → shared/components}/form/fields/PasswordField.svelte +2 -2
- package/dist/{components → shared/components}/form/fields/SelectField.svelte +3 -3
- package/dist/{components → shared/components}/form/fields/SelectMultiField.svelte +3 -3
- package/dist/{components → shared/components}/form/fields/TextField.svelte +2 -2
- package/dist/{components → shared/components}/form/fields/TextFieldNullable.svelte +2 -2
- package/dist/{components → shared/components}/form/fields/TimeField.svelte +2 -2
- package/dist/{components → shared/components}/ui/choice/ChoiceInternal.svelte +1 -1
- package/dist/{components → shared/components}/ui/choice/WeekdayChoice.svelte +6 -3
- package/dist/{components → shared/components}/ui/choice/WeekdayChoice.svelte.d.ts +1 -1
- package/dist/{components → shared/components}/ui/choice/WeekdayChoiceMulti.svelte +6 -3
- package/dist/{components → shared/components}/ui/choice/WeekdayChoiceMulti.svelte.d.ts +1 -1
- package/dist/{components → shared/components}/ui/context-menu/ContextMenuContent.svelte +1 -1
- package/dist/{components → shared/components}/ui/context-menu/ContextMenuItem.svelte +1 -1
- package/dist/{components → shared/components}/ui/search/SearchBar.svelte +2 -2
- package/dist/{utils/types → shared/utils}/arktype.d.ts +4 -12
- package/dist/shared/utils/arktype.js +40 -0
- package/dist/shared/utils/datetime/datetime.spec.d.ts +1 -0
- package/dist/shared/utils/datetime/datetime.spec.js +768 -0
- package/dist/{utils → shared/utils}/datetime/index.d.ts +22 -14
- package/dist/{utils → shared/utils}/datetime/index.js +44 -32
- package/dist/{utils → shared/utils}/email/README.md +5 -5
- package/dist/{utils → shared/utils}/email/ses.js +17 -9
- package/dist/shared/utils/email/ses.test.d.ts +1 -0
- package/dist/shared/utils/email/ses.test.js +335 -0
- package/dist/shared/utils/functional/index.d.ts +2 -0
- package/dist/shared/utils/functional/index.js +2 -0
- package/dist/shared/utils/functional/result.d.ts +72 -0
- package/dist/shared/utils/functional/result.js +86 -0
- package/dist/shared/utils/functional/result.spec.d.ts +1 -0
- package/dist/shared/utils/functional/result.spec.js +96 -0
- package/dist/shared/utils/remote.d.ts +28 -0
- package/dist/shared/utils/remote.js +74 -0
- package/dist/{utils/search.d.ts → shared/utils/string.d.ts} +1 -0
- package/dist/{utils/search.js → shared/utils/string.js} +13 -4
- package/package.json +28 -33
- package/dist/utils/email/aws-signer.d.ts +0 -17
- package/dist/utils/email/aws-signer.js +0 -83
- package/dist/utils/string.d.ts +0 -1
- package/dist/utils/string.js +0 -4
- package/dist/utils/types/arktype.js +0 -92
- package/dist/utils/types/consts.d.ts +0 -5
- package/dist/utils/types/consts.js +0 -5
- package/dist/utils/types/db.d.ts +0 -57
- package/dist/utils/types/db.js +0 -34
- /package/dist/{components → shared/components}/form/Errors.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/FieldWrapper.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/Form.svelte +0 -0
- /package/dist/{components → shared/components}/form/Form.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/IconInputWrapper.svelte +0 -0
- /package/dist/{components → shared/components}/form/IconInputWrapper.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/ChoiceField.svelte +0 -0
- /package/dist/{components → shared/components}/form/fields/ChoiceField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/ChoiceMultiField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/DateField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/HexColorField.svelte +0 -0
- /package/dist/{components → shared/components}/form/fields/HexColorField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/MessageField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/NumberField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/PasswordField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/SelectField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/SelectMultiField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/TextField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/TextFieldNullable.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/TimeField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/WeekdayChoiceField.svelte +0 -0
- /package/dist/{components → shared/components}/form/fields/WeekdayChoiceField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/fields/WeekdayChoiceMultiField.svelte +0 -0
- /package/dist/{components → shared/components}/form/fields/WeekdayChoiceMultiField.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/form/index.d.ts +0 -0
- /package/dist/{components → shared/components}/form/index.js +0 -0
- /package/dist/{components → shared/components}/ui/choice/Choice.svelte +0 -0
- /package/dist/{components → shared/components}/ui/choice/Choice.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/choice/ChoiceInternal.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/choice/ChoiceMulti.svelte +0 -0
- /package/dist/{components → shared/components}/ui/choice/ChoiceMulti.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/ContextMenu.svelte +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/ContextMenu.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/ContextMenuContent.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/ContextMenuItem.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/ContextMenuSeparator.svelte +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/ContextMenuSeparator.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/ContextMenuTrigger.svelte +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/ContextMenuTrigger.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/context-menu-state.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/context-menu/context-menu-state.svelte.js +0 -0
- /package/dist/{components → shared/components}/ui/drag-drop/Draggable.svelte +0 -0
- /package/dist/{components → shared/components}/ui/drag-drop/Draggable.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/drag-drop/Dropzone.svelte +0 -0
- /package/dist/{components → shared/components}/ui/drag-drop/Dropzone.svelte.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/drag-drop/drag-manager.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/drag-drop/drag-manager.js +0 -0
- /package/dist/{components → shared/components}/ui/index.d.ts +0 -0
- /package/dist/{components → shared/components}/ui/index.js +0 -0
- /package/dist/{components → shared/components}/ui/search/SearchBar.svelte.d.ts +0 -0
- /package/dist/{server → shared/server}/form-handler.d.ts +0 -0
- /package/dist/{server → shared/server}/form-handler.js +0 -0
- /package/dist/{server → shared/server}/form-processor.d.ts +0 -0
- /package/dist/{server → shared/server}/form-processor.js +0 -0
- /package/dist/{utils → shared/utils}/email/index.d.ts +0 -0
- /package/dist/{utils → shared/utils}/email/index.js +0 -0
- /package/dist/{utils → shared/utils}/email/ses.d.ts +0 -0
- /package/dist/{utils → shared/utils}/form/index.d.ts +0 -0
- /package/dist/{utils → shared/utils}/form/index.js +0 -0
- /package/dist/{utils → shared/utils}/form/virtual-form.d.ts +0 -0
- /package/dist/{utils → shared/utils}/form/virtual-form.js +0 -0
- /package/dist/{highlight.d.ts → utils/highlight.d.ts} +0 -0
- /package/dist/{highlight.js → utils/highlight.js} +0 -0
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ pnpm dev
|
|
|
73
73
|
|
|
74
74
|
---
|
|
75
75
|
|
|
76
|
-
## Versioning & Releases
|
|
76
|
+
## 🔖 Versioning & Releases
|
|
77
77
|
|
|
78
78
|
We use **Semantic Versioning** managed automatically by `semantic-release`.
|
|
79
79
|
|
|
@@ -121,6 +121,8 @@ ci: blah // No versioning - not standard
|
|
|
121
121
|
|
|
122
122
|
### Breaking Changes
|
|
123
123
|
|
|
124
|
+
Commits with a breaking change automatically trigger a `major` version bump.
|
|
125
|
+
|
|
124
126
|
For breaking changes, you must append `!` before the colon in the commit header as such:
|
|
125
127
|
|
|
126
128
|
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ButtonProps } from '
|
|
2
|
+
import type { ButtonProps } from '../../../shadcn/components/ui/button/index.js';
|
|
3
3
|
|
|
4
|
-
import { Button } from '
|
|
4
|
+
import { Button } from '../../../shadcn/components/ui/button/index.js';
|
|
5
5
|
import Loader2Icon from '@lucide/svelte/icons/loader-2';
|
|
6
6
|
|
|
7
7
|
type Props = ButtonProps & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ButtonProps } from '
|
|
2
|
-
import { Button } from '
|
|
1
|
+
import type { ButtonProps } from '../../../shadcn/components/ui/button/index.js';
|
|
2
|
+
import { Button } from '../../../shadcn/components/ui/button/index.js';
|
|
3
3
|
type Props = ButtonProps & {
|
|
4
4
|
class?: string;
|
|
5
5
|
loading?: boolean;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
19
19
|
import type { FormPath } from 'sveltekit-superforms';
|
|
20
20
|
|
|
21
|
-
import { cn } from '
|
|
21
|
+
import { cn } from '../../../shadcn/utils.js';
|
|
22
22
|
import {
|
|
23
23
|
Control,
|
|
24
24
|
type ControlAttrs,
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
>
|
|
5
5
|
import type { FormPath } from 'sveltekit-superforms';
|
|
6
6
|
|
|
7
|
-
import ChoiceMulti, {
|
|
7
|
+
import ChoiceMulti, {
|
|
8
|
+
type ChoiceMultiProps
|
|
9
|
+
} from '../../ui/choice/ChoiceMulti.svelte';
|
|
8
10
|
|
|
9
11
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
10
12
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { FormPath } from 'sveltekit-superforms';
|
|
4
4
|
|
|
5
|
+
import { Input } from '../../../../shadcn/components/ui/input/index.js';
|
|
6
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
5
7
|
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
6
|
-
import { Input } from '../../../shadcn/components/ui/input/index.js';
|
|
7
|
-
import { cn } from '../../../shadcn/utils.js';
|
|
8
8
|
import { CalendarDate } from '@internationalized/date';
|
|
9
9
|
|
|
10
10
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { FormPath } from 'sveltekit-superforms';
|
|
4
4
|
|
|
5
|
+
import { Textarea } from '../../../../shadcn/components/ui/textarea/index.js';
|
|
6
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
5
7
|
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
6
|
-
import { Textarea } from '../../../shadcn/components/ui/textarea/index.js';
|
|
7
|
-
import { cn } from '../../../shadcn/utils.js';
|
|
8
8
|
|
|
9
9
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
10
10
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { FormPath } from 'sveltekit-superforms';
|
|
4
4
|
|
|
5
|
+
import { Input } from '../../../../shadcn/components/ui/input/index.js';
|
|
6
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
5
7
|
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
6
|
-
import { Input } from '../../../shadcn/components/ui/input/index.js';
|
|
7
|
-
import { cn } from '../../../shadcn/utils.js';
|
|
8
8
|
|
|
9
9
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
10
10
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { FormPath } from 'sveltekit-superforms';
|
|
4
4
|
|
|
5
|
+
import { Input } from '../../../../shadcn/components/ui/input/index.js';
|
|
6
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
5
7
|
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
6
|
-
import { Input } from '../../../shadcn/components/ui/input/index.js';
|
|
7
|
-
import { cn } from '../../../shadcn/utils.js';
|
|
8
8
|
import { Eye, EyeOff } from '@lucide/svelte';
|
|
9
9
|
|
|
10
10
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import type { Component } from 'svelte';
|
|
6
6
|
import type { FormPath } from 'sveltekit-superforms';
|
|
7
7
|
|
|
8
|
-
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
9
8
|
import {
|
|
10
9
|
Select,
|
|
11
10
|
SelectContent,
|
|
@@ -13,8 +12,9 @@
|
|
|
13
12
|
SelectItem,
|
|
14
13
|
SelectLabel,
|
|
15
14
|
SelectTrigger
|
|
16
|
-
} from '
|
|
17
|
-
import { cn } from '
|
|
15
|
+
} from '../../../../shadcn/components/ui/select/index.js';
|
|
16
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
17
|
+
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
18
18
|
|
|
19
19
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
20
20
|
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import type { Component } from 'svelte';
|
|
6
6
|
import type { FormPath } from 'sveltekit-superforms';
|
|
7
7
|
|
|
8
|
-
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
9
8
|
import {
|
|
10
9
|
Select,
|
|
11
10
|
SelectContent,
|
|
@@ -13,8 +12,9 @@
|
|
|
13
12
|
SelectItem,
|
|
14
13
|
SelectLabel,
|
|
15
14
|
SelectTrigger
|
|
16
|
-
} from '
|
|
17
|
-
import { cn } from '
|
|
15
|
+
} from '../../../../shadcn/components/ui/select/index.js';
|
|
16
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
17
|
+
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
18
18
|
|
|
19
19
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
20
20
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { FormPath } from 'sveltekit-superforms';
|
|
4
4
|
|
|
5
|
+
import { Input } from '../../../../shadcn/components/ui/input/index.js';
|
|
6
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
5
7
|
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
6
|
-
import { Input } from '../../../shadcn/components/ui/input/index.js';
|
|
7
|
-
import { cn } from '../../../shadcn/utils.js';
|
|
8
8
|
|
|
9
9
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
10
10
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { FormPath } from 'sveltekit-superforms';
|
|
4
4
|
|
|
5
|
-
import { Input } from '
|
|
6
|
-
import { cn } from '
|
|
5
|
+
import { Input } from '../../../../shadcn/components/ui/input/index.js';
|
|
6
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
7
7
|
|
|
8
8
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
9
9
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Component } from 'svelte';
|
|
3
3
|
import type { FormPath } from 'sveltekit-superforms';
|
|
4
4
|
|
|
5
|
+
import { Input } from '../../../../shadcn/components/ui/input/index.js';
|
|
6
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
5
7
|
import IconInputWrapper from '../IconInputWrapper.svelte';
|
|
6
|
-
import { Input } from '../../../shadcn/components/ui/input/index.js';
|
|
7
|
-
import { cn } from '../../../shadcn/utils.js';
|
|
8
8
|
import { Time } from '@internationalized/date';
|
|
9
9
|
|
|
10
10
|
import FieldWrapper, { type FieldWrapperProps } from '../FieldWrapper.svelte';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import type { FormAttrs } from '../../form/FieldWrapper.svelte';
|
|
19
19
|
import type { Snippet } from 'svelte';
|
|
20
20
|
|
|
21
|
-
import { cn } from '
|
|
21
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
22
22
|
|
|
23
23
|
interface Props extends ChoiceInternalProps<V, I, K> {
|
|
24
24
|
handleItemClick: (item: I) => void;
|
|
@@ -12,9 +12,12 @@
|
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<script lang="ts">
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import {
|
|
16
|
+
type Day,
|
|
17
|
+
Days,
|
|
18
|
+
formatDayLetter,
|
|
19
|
+
formatDayShort
|
|
20
|
+
} from '../../../utils/datetime/index.js';
|
|
18
21
|
import { identity } from 'ramda';
|
|
19
22
|
|
|
20
23
|
import Choice from './Choice.svelte';
|
|
@@ -8,7 +8,7 @@ export interface WeekdayChoiceProps {
|
|
|
8
8
|
value?: Day;
|
|
9
9
|
vertical?: boolean;
|
|
10
10
|
}
|
|
11
|
-
import type
|
|
11
|
+
import { type Day } from '../../../utils/datetime/index.js';
|
|
12
12
|
declare const WeekdayChoice: import("svelte").Component<WeekdayChoiceProps, {}, "value">;
|
|
13
13
|
type WeekdayChoice = ReturnType<typeof WeekdayChoice>;
|
|
14
14
|
export default WeekdayChoice;
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<script lang="ts">
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
import {
|
|
19
|
+
type Day,
|
|
20
|
+
Days,
|
|
21
|
+
formatDayLetter,
|
|
22
|
+
formatDayShort
|
|
23
|
+
} from '../../../utils/datetime/index.js';
|
|
21
24
|
|
|
22
25
|
import ChoiceMulti from './ChoiceMulti.svelte';
|
|
23
26
|
|
|
@@ -9,7 +9,7 @@ export interface WeekdayChoiceMultiProps {
|
|
|
9
9
|
value: Day[];
|
|
10
10
|
vertical?: boolean;
|
|
11
11
|
}
|
|
12
|
-
import type
|
|
12
|
+
import { type Day } from '../../../utils/datetime/index.js';
|
|
13
13
|
declare const WeekdayChoiceMulti: import("svelte").Component<WeekdayChoiceMultiProps, {}, "value">;
|
|
14
14
|
type WeekdayChoiceMulti = ReturnType<typeof WeekdayChoiceMulti>;
|
|
15
15
|
export default WeekdayChoiceMulti;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import Input from '
|
|
3
|
-
import { cn } from '
|
|
2
|
+
import Input from '../../../../shadcn/components/ui/input/input.svelte';
|
|
3
|
+
import { cn } from '../../../../shadcn/utils.js';
|
|
4
4
|
import { Search } from '@lucide/svelte';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import type { Type } from 'arktype';
|
|
2
2
|
import { CalendarDate as calendarImport, Time as timeImport } from '@internationalized/date';
|
|
3
|
-
|
|
3
|
+
export declare const IntegerId: import("arktype/internal/variants/number.ts").NumberType<number, {}>;
|
|
4
4
|
export declare const Phone: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
5
|
-
|
|
6
|
-
export declare function trimTo(typeTo: Type<string>): import("arktype/internal/variants/object.ts").ObjectType<(In: string) => import("arktype/internal/attributes.ts").To<string>, {}>;
|
|
5
|
+
export declare const HexColor: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
7
6
|
export declare const Day: import("arktype/internal/variants/string.ts").StringType<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", {}>;
|
|
8
|
-
export type Day = (typeof Days)[number];
|
|
9
7
|
export declare const Time: import("arktype/internal/variants/object.ts").ObjectType<timeImport, {}>;
|
|
10
8
|
export declare const CalendarDate: import("arktype/internal/variants/object.ts").ObjectType<calendarImport, {}>;
|
|
11
|
-
|
|
12
|
-
export declare
|
|
13
|
-
export declare const Name: import("arktype/internal/variants/object.ts").ObjectType<(In: string) => import("arktype").Out<string>, {}>;
|
|
14
|
-
export declare const FirstName: import("arktype/internal/variants/object.ts").ObjectType<(In: string) => import("arktype").Out<string>, {}>;
|
|
15
|
-
export declare const LastName: import("arktype/internal/variants/object.ts").ObjectType<(In: string) => import("arktype").Out<string>, {}>;
|
|
16
|
-
export declare const Id: import("arktype/internal/variants/number.ts").NumberType<number, {}>;
|
|
17
|
-
export declare const Password: import("arktype/internal/variants/string.ts").StringType<string, {}>;
|
|
18
|
-
export declare const Duration: import("arktype/internal/variants/number.ts").NumberType<number, {}>;
|
|
9
|
+
/** Type string which is trimmed before narrowing the type checking */
|
|
10
|
+
export declare function trimTo(typeTo: Type<string>): import("arktype/internal/variants/object.ts").ObjectType<(In: string) => import("arktype/internal/attributes.ts").To<string>, {}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CalendarDate as calendarImport, Time as timeImport } from '@internationalized/date';
|
|
2
|
+
import { type } from 'arktype';
|
|
3
|
+
import { Days } from './datetime/index.js';
|
|
4
|
+
// Useful common types
|
|
5
|
+
export const IntegerId = type('number.integer >= 0');
|
|
6
|
+
// Phone arktype: allows "+", digits, and spaces only
|
|
7
|
+
export const Phone = type('string').narrow((value, ctx) => {
|
|
8
|
+
if (!/^[+0-9 ]+$/.test(value)) {
|
|
9
|
+
return ctx.reject({
|
|
10
|
+
problem: 'invalid phone number. Only +, digits, and spaces are allowed.'
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
});
|
|
15
|
+
export const HexColor = type('string').narrow((value, ctx) => {
|
|
16
|
+
// Regex explanation:
|
|
17
|
+
// ^ : start of string
|
|
18
|
+
// [0-9A-Fa-f]{3} : three hex digits (short form)
|
|
19
|
+
// ([0-9A-Fa-f]{3})? : optional three more digits (long form #RRGGBB)
|
|
20
|
+
// $ : end of string
|
|
21
|
+
if (!/^[0-9A-Fa-f]{3}([0-9A-Fa-f]{3})?$/.test(value)) {
|
|
22
|
+
return ctx.reject({
|
|
23
|
+
problem: 'invalid hex color value'
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
});
|
|
28
|
+
// Datetime types
|
|
29
|
+
export const Day = type.enumerated(...Days);
|
|
30
|
+
export const Time = type.instanceOf(timeImport).configure({
|
|
31
|
+
problem: () => 'invalid time'
|
|
32
|
+
});
|
|
33
|
+
export const CalendarDate = type.instanceOf(calendarImport).configure({
|
|
34
|
+
problem: () => 'invalid date'
|
|
35
|
+
});
|
|
36
|
+
// Arktype utilities
|
|
37
|
+
/** Type string which is trimmed before narrowing the type checking */
|
|
38
|
+
export function trimTo(typeTo) {
|
|
39
|
+
return type('string.trim').to(typeTo);
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|