sveltekit-superforms
Advanced tools
Comparing version 2.22.1 to 2.23.0
@@ -19,3 +19,3 @@ import { createAdapter, createJsonSchema } from './adapters.js'; | ||
for (const error of result) { | ||
issues.push({ message: error.message, path: Array.from(error.path) }); | ||
issues.push({ message: error.problem, path: Array.from(error.path) }); | ||
} | ||
@@ -22,0 +22,0 @@ return { |
@@ -1,2 +0,1 @@ | ||
import type { JsonSchemaCallback } from '../types.js'; | ||
type YupParams = { | ||
@@ -6,59 +5,3 @@ addMethod: any; | ||
}; | ||
declare module 'yup' { | ||
interface ArraySchema<TIn, TContext, TDefault, TFlags> { | ||
example(example: any): this; | ||
examples(examples: any[]): this; | ||
description(description: string): this; | ||
jsonSchema(callback: JsonSchemaCallback): this; | ||
} | ||
interface BooleanSchema<TType, TContext, TDefault, TFlags> { | ||
example(example: any): this; | ||
examples(examples: any[]): this; | ||
description(description: string): this; | ||
jsonSchema(callback: JsonSchemaCallback): this; | ||
} | ||
interface DateSchema<TType, TContext, TDefault, TFlags> { | ||
example(example: any): this; | ||
examples(examples: any[]): this; | ||
description(description: string): this; | ||
jsonSchema(callback: JsonSchemaCallback): this; | ||
} | ||
interface LazySchema<TType, TContext, TDefault, TFlags> { | ||
example(example: any): this; | ||
examples(examples: any[]): this; | ||
description(description: string): this; | ||
jsonSchema(callback: JsonSchemaCallback): this; | ||
} | ||
interface MixedSchema<TType, TContext, TDefault, TFlags> { | ||
example(example: any): this; | ||
examples(examples: any[]): this; | ||
description(description: string): this; | ||
jsonSchema(callback: JsonSchemaCallback): this; | ||
} | ||
interface NumberSchema<TType, TContext, TDefault, TFlags> { | ||
example(example: any): this; | ||
examples(examples: any[]): this; | ||
description(description: string): this; | ||
jsonSchema(callback: JsonSchemaCallback): this; | ||
} | ||
interface ObjectSchema<TIn, TContext, TDefault, TFlags> { | ||
example(example: any): this; | ||
examples(examples: any[]): this; | ||
description(description: string): this; | ||
jsonSchema(callback: JsonSchemaCallback): this; | ||
} | ||
interface StringSchema<TType, TContext, TDefault, TFlags> { | ||
example(example: any): this; | ||
examples(examples: any[]): this; | ||
description(description: string): this; | ||
jsonSchema(callback: JsonSchemaCallback): this; | ||
} | ||
interface TupleSchema<TType, TContext, TDefault, TFlags> { | ||
example(example: any): this; | ||
examples(examples: any[]): this; | ||
description(description: string): this; | ||
jsonSchema(callback: JsonSchemaCallback): this; | ||
} | ||
} | ||
export declare function extendSchema(yup: YupParams): void; | ||
export {}; |
@@ -22,2 +22,3 @@ import { type Readable, type Updater, type Writable } from 'svelte/store'; | ||
taint?: TaintOption; | ||
step: number; | ||
}; | ||
@@ -31,2 +32,3 @@ export declare function booleanProxy<T extends Record<string, unknown>, Path extends FormPaths<T>>(form: Writable<T> | SuperForm<T>, path: Path, options?: Prettify<Pick<DefaultOptions, 'trueStringValue' | 'taint'>>): CorrectProxyType<boolean, string, T, Path>; | ||
taint?: TaintOption; | ||
step?: number; | ||
}): CorrectProxyType<Date, string, T, Path>; | ||
@@ -33,0 +35,0 @@ export declare function stringProxy<T extends Record<string, unknown>, Path extends FormPaths<T>>(form: Writable<T> | SuperForm<T>, path: Path, options: { |
@@ -9,3 +9,4 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
trueStringValue: 'true', | ||
dateFormat: 'iso' | ||
dateFormat: 'iso', | ||
step: 60 | ||
}; | ||
@@ -35,3 +36,4 @@ ///// Proxy functions /////////////////////////////////////////////// | ||
dateFormat: options?.format ?? 'iso', | ||
empty: options?.empty | ||
empty: options?.empty, | ||
step: options?.step ?? 60 | ||
}); | ||
@@ -178,4 +180,11 @@ } | ||
return !!stringValue; | ||
else if (type == 'date') | ||
return new Date(stringValue); | ||
else if (type == 'date') { | ||
if (stringValue.indexOf('-') === -1) { | ||
const utc = options.dateFormat.indexOf('utc') >= 0; | ||
const date = utc ? UTCDate(new Date()) : localDate(new Date()); | ||
return new Date(date + 'T' + stringValue + (utc ? 'Z' : '')); | ||
} | ||
else | ||
return new Date(stringValue); | ||
} | ||
const numberToConvert = options.delimiter | ||
@@ -236,17 +245,17 @@ ? stringValue.replace(options.delimiter, '.') | ||
case 'datetime': | ||
return date.toISOString().slice(0, 16); | ||
return date.toISOString().slice(0, options.step % 60 ? 19 : 16); | ||
case 'time': | ||
return date.toISOString().slice(11, 16); | ||
return date.toISOString().slice(11, options.step % 60 ? 19 : 16); | ||
case 'date-utc': | ||
return UTCDate(date); | ||
case 'datetime-utc': | ||
return UTCDate(date) + 'T' + UTCTime(date); | ||
return UTCDate(date) + 'T' + UTCTime(date, options.step); | ||
case 'time-utc': | ||
return UTCTime(date); | ||
return UTCTime(date, options.step); | ||
case 'date-local': | ||
return localDate(date); | ||
case 'datetime-local': | ||
return localDate(date) + 'T' + localTime(date); | ||
return localDate(date) + 'T' + localTime(date, options.step); | ||
case 'time-local': | ||
return localTime(date); | ||
return localTime(date, options.step); | ||
} | ||
@@ -456,4 +465,7 @@ } | ||
} | ||
function localTime(date) { | ||
return (String(date.getHours()).padStart(2, '0') + ':' + String(date.getMinutes()).padStart(2, '0')); | ||
function localTime(date, step) { | ||
return (String(date.getHours()).padStart(2, '0') + | ||
':' + | ||
String(date.getMinutes()).padStart(2, '0') + | ||
(step % 60 ? ':' + String(date.getSeconds()).padStart(2, '0') : '')); | ||
} | ||
@@ -467,6 +479,7 @@ function UTCDate(date) { | ||
} | ||
function UTCTime(date) { | ||
function UTCTime(date, step) { | ||
return (String(date.getUTCHours()).padStart(2, '0') + | ||
':' + | ||
String(date.getUTCMinutes()).padStart(2, '0')); | ||
String(date.getUTCMinutes()).padStart(2, '0') + | ||
(step % 60 ? ':' + String(date.getUTCSeconds()).padStart(2, '0') : '')); | ||
} | ||
@@ -473,0 +486,0 @@ /* |
@@ -26,16 +26,3 @@ /** @typedef {typeof __propDef.props} SuperDebugProps */ | ||
*/ | ||
export default class SuperDebug extends SvelteComponentTyped<{ | ||
data: unknown; | ||
status?: boolean | undefined; | ||
label?: string | undefined; | ||
display?: boolean | undefined; | ||
stringTruncate?: number | undefined; | ||
ref?: HTMLPreElement | undefined; | ||
promise?: boolean | undefined; | ||
raw?: boolean | undefined; | ||
functions?: boolean | undefined; | ||
theme?: "default" | "vscode" | undefined; | ||
collapsible?: boolean | undefined; | ||
collapsed?: boolean | undefined; | ||
}, { | ||
export default class SuperDebug extends SvelteComponentTyped<Record<string, never>, { | ||
[evt: string]: CustomEvent<any>; | ||
@@ -51,16 +38,3 @@ }, { | ||
declare const __propDef: { | ||
props: { | ||
data: unknown; | ||
status?: boolean | undefined; | ||
label?: string | undefined; | ||
display?: boolean | undefined; | ||
stringTruncate?: number | undefined; | ||
ref?: HTMLPreElement | undefined; | ||
promise?: boolean | undefined; | ||
raw?: boolean | undefined; | ||
functions?: boolean | undefined; | ||
theme?: "default" | "vscode" | undefined; | ||
collapsible?: boolean | undefined; | ||
collapsed?: boolean | undefined; | ||
}; | ||
props: Record<string, never>; | ||
events: { | ||
@@ -67,0 +41,0 @@ [evt: string]: CustomEvent<any>; |
{ | ||
"name": "sveltekit-superforms", | ||
"version": "2.22.1", | ||
"version": "2.23.0", | ||
"author": "Andreas Söderlund <ciscoheat@gmail.com> (https://blog.encodeart.dev)", | ||
@@ -46,7 +46,9 @@ "description": "Making SvelteKit forms a pleasure to use!", | ||
"types": "./dist/index.d.ts", | ||
"svelte": "./dist/index.js" | ||
"svelte": "./dist/index.js", | ||
"default": "./dist/index.js" | ||
}, | ||
"./client": { | ||
"types": "./dist/client/index.d.ts", | ||
"svelte": "./dist/client/index.js" | ||
"svelte": "./dist/client/index.js", | ||
"default": "./dist/client/index.js" | ||
}, | ||
@@ -59,7 +61,9 @@ "./client/SuperDebug.svelte": { | ||
"types": "./dist/server/index.d.ts", | ||
"svelte": "./dist/server/index.js" | ||
"svelte": "./dist/server/index.js", | ||
"default": "./dist/server/index.js" | ||
}, | ||
"./adapters": { | ||
"types": "./dist/adapters/index.d.ts", | ||
"svelte": "./dist/adapters/index.js" | ||
"svelte": "./dist/adapters/index.js", | ||
"default": "./dist/adapters/index.js" | ||
} | ||
@@ -96,3 +100,3 @@ }, | ||
"@typeschema/class-validator": "^0.3.0", | ||
"@vinejs/vine": "^1.8.0 || ^2.0.0", | ||
"@vinejs/vine": "^1.8.0 || ^2.0.0 || ^3.0.0", | ||
"arktype": ">=2.0.0-rc.23", | ||
@@ -106,3 +110,3 @@ "class-validator": "^0.14.1", | ||
"yup": "^1.4.0", | ||
"zod": "^3.23.8" | ||
"zod": "^3.24.1" | ||
}, | ||
@@ -150,13 +154,13 @@ "peerDependenciesMeta": { | ||
"@gcornut/valibot-json-schema": "^0.31.0", | ||
"@sinclair/typebox": "^0.34.11", | ||
"@sinclair/typebox": "^0.34.14", | ||
"@typeschema/class-validator": "^0.3.0", | ||
"@vinejs/vine": "^2.1.0", | ||
"arktype": "2.0.0-rc.26", | ||
"@vinejs/vine": "^3.0.0", | ||
"arktype": "^2.0.0", | ||
"class-validator": "^0.14.1", | ||
"effect": "^3.11.7", | ||
"effect": "^3.12.5", | ||
"joi": "^17.13.3", | ||
"json-schema-to-ts": "^3.1.1", | ||
"superstruct": "^2.0.2", | ||
"valibot": "^1.0.0-beta.9", | ||
"yup": "^1.5.0", | ||
"valibot": "1.0.0-beta.11", | ||
"yup": "^1.6.1", | ||
"zod": "^3.24.1", | ||
@@ -172,7 +176,7 @@ "zod-to-json-schema": "^3.24.1" | ||
"@sveltejs/adapter-auto": "^3.3.1", | ||
"@sveltejs/kit": "^2.11.1", | ||
"@sveltejs/kit": "^2.16.0", | ||
"@sveltejs/package": "^2.3.7", | ||
"@sveltejs/vite-plugin-svelte": "4.0.0-next.7", | ||
"@sveltejs/vite-plugin-svelte": "^4.0.4", | ||
"@types/json-schema": "^7.0.15", | ||
"@types/node": "^22.10.2", | ||
"@types/node": "^22.10.7", | ||
"@types/throttle-debounce": "^5.0.2", | ||
@@ -182,3 +186,3 @@ "@types/uuid": "^9.0.8", | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"@valibot/i18n": "^1.0.0-beta.1", | ||
"@valibot/i18n": "1.0.0-beta.2", | ||
"decimal.js": "^10.4.3", | ||
@@ -192,15 +196,15 @@ "eslint": "^8.57.1", | ||
"prettier": "^3.4.2", | ||
"prettier-plugin-svelte": "^3.3.2", | ||
"prettier-plugin-svelte": "^3.3.3", | ||
"publint": "^0.2.12", | ||
"sass": "^1.83.0", | ||
"svelte": "^5.13.0", | ||
"sass": "^1.83.4", | ||
"svelte": "^5.19.0", | ||
"svelte-check": "^3.8.6", | ||
"svelte-french-toast": "^1.2.0", | ||
"sveltekit-flash-message": "^2.4.4", | ||
"sveltekit-flash-message": "^2.4.5", | ||
"sveltekit-rate-limiter": "^0.6.1", | ||
"throttle-debounce": "^5.0.2", | ||
"tslib": "^2.8.1", | ||
"typescript": "^5.7.2", | ||
"typescript": "^5.7.3", | ||
"uuid": "^9.0.1", | ||
"vite": "^5.4.11", | ||
"vite": "^5.4.13", | ||
"vitest": "^1.6.0", | ||
@@ -207,0 +211,0 @@ "zod-i18n-map": "^2.27.0" |
Sorry, the diff of this file is not supported yet
292687
6234