@webamoki/web-svelte 0.5.28 → 0.5.29

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.
@@ -1,6 +1,7 @@
1
1
  import { Type } from 'arktype';
2
2
  import { Days } from '../datetime/index.js';
3
3
  import { Time as timeImport, CalendarDate as calendarImport } from '@internationalized/date';
4
+ export declare const Phone: import("arktype/internal/variants/string.ts").StringType<string, {}>;
4
5
  /** Type string which is trimmed before narrowing the type checking */
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>, {}>;
6
7
  export declare const Day: import("arktype/internal/variants/string.ts").StringType<"Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday", {}>;
@@ -3,6 +3,15 @@ import { Days } from '../datetime/index.js';
3
3
  import { Time as timeImport, CalendarDate as calendarImport } from '@internationalized/date';
4
4
  import { EMAIL_MAX, FIRST_NAME_MAX, LAST_NAME_MAX, NAME_MAX } from './consts.js';
5
5
  import { toTitleCase } from '../string.js';
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
+ });
6
15
  /** Type string which is trimmed before narrowing the type checking */
7
16
  export function trimTo(typeTo) {
8
17
  return type('string.trim').to(typeTo);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.5.28",
6
+ "version": "0.5.29",
7
7
  "license": "MIT",
8
8
  "files": [
9
9
  "dist",