sveltekit-superforms
Advanced tools
Comparing version 2.0.0-alpha.53 to 2.0.0
@@ -147,3 +147,3 @@ /// <reference types="svelte" /> | ||
enhance: (el: HTMLFormElement, events?: SuperFormEvents<T, M>) => ReturnType<typeof enhance>; | ||
isTainted: (path?: FormPath<T> | TaintedFields<T>) => boolean; | ||
isTainted: (path?: FormPath<T> | TaintedFields<T> | boolean) => boolean; | ||
reset: (options?: ResetOptions<T>) => void; | ||
@@ -150,0 +150,0 @@ capture: Capture<T, M>; |
@@ -344,12 +344,6 @@ import { derived, get, readonly, writable } from 'svelte/store'; | ||
const result = await Form_validate({ adapter }); | ||
// TODO: Add option for always setting result.data | ||
// TODO: Add option for always setting result.data? | ||
if (result.valid && (event.immediate || event.type != 'input')) { | ||
Form.set(result.data, { taint: 'ignore' }); | ||
} | ||
/* | ||
if (force) { | ||
Errors.set(result.errors); | ||
return result; | ||
} | ||
*/ | ||
// Wait for tainted, so object errors can be displayed | ||
@@ -589,2 +583,4 @@ await tick(); | ||
function Tainted_isTainted(path) { | ||
if (typeof path === 'boolean') | ||
return path; | ||
if (typeof path === 'object') | ||
@@ -591,0 +587,0 @@ return Tainted__isObjectTainted(path); |
@@ -55,5 +55,3 @@ import { SchemaError } from '../errors.js'; | ||
return undefined; | ||
// TODO: Use the first value of the union as default? | ||
throw new SchemaError('Unions must have a default value, or exactly one of the union types must have.', path); | ||
//return _defaultValues(info.union[0], isOptional, path); | ||
} | ||
@@ -103,3 +101,2 @@ } | ||
} | ||
// TODO: Handle conversion better, since it also depends on other props in the schema. (see schemaTypes) | ||
function formatDefaultValue(type, value) { | ||
@@ -106,0 +103,0 @@ switch (type) { |
359
package.json
{ | ||
"name": "sveltekit-superforms", | ||
"version": "2.0.0-alpha.53", | ||
"author": "Andreas Söderlund <ciscoheat@gmail.com> (https://blog.encodeart.dev)", | ||
"description": "Making SvelteKit forms a pleasure to use!", | ||
"keywords": [ | ||
"sveltekit", | ||
"svelte", | ||
"form", | ||
"validation", | ||
"zod", | ||
"forms" | ||
], | ||
"license": "MIT", | ||
"homepage": "https://superforms.rocks", | ||
"bugs": "https://github.com/ciscoheat/sveltekit-superforms/issues", | ||
"repository": { | ||
"url": "https://github.com/ciscoheat/sveltekit-superforms" | ||
}, | ||
"funding": [ | ||
{ | ||
"type": "github", | ||
"url": "https://github.com/sponsors/ciscoheat" | ||
}, | ||
{ | ||
"type": "ko-fi", | ||
"url": "https://ko-fi.com/ciscoheat" | ||
}, | ||
{ | ||
"type": "paypal", | ||
"url": "https://www.paypal.com/donate/?hosted_button_id=NY7F5ALHHSVQS" | ||
} | ||
], | ||
"scripts": { | ||
"alpha:bump": "npm version prerelease", | ||
"alpha:pub": "npm publish --tag alpha", | ||
"dev": "vite dev", | ||
"build": "vite build && npm run package", | ||
"preview": "vite preview", | ||
"package": "svelte-kit sync && svelte-package && publint", | ||
"prepublishOnly": "npm run test && npm run check && npm run package", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
"test": "vitest run", | ||
"lint": "prettier --check . && eslint .", | ||
"format": "prettier --write .", | ||
"preinstall": "npx only-allow pnpm" | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"svelte": "./dist/index.js" | ||
}, | ||
"./client": { | ||
"types": "./dist/client/index.d.ts", | ||
"svelte": "./dist/client/index.js" | ||
}, | ||
"./client/SuperDebug.svelte": { | ||
"types": "./dist/client/SuperDebug.svelte.d.ts", | ||
"svelte": "./dist/client/SuperDebug.svelte" | ||
}, | ||
"./server": { | ||
"types": "./dist/server/index.d.ts", | ||
"svelte": "./dist/server/index.js" | ||
}, | ||
"./adapters": { | ||
"types": "./dist/adapters/index.d.ts", | ||
"svelte": "./dist/adapters/index.js" | ||
} | ||
}, | ||
"typesVersions": { | ||
">4.0": { | ||
"index.d.ts": [ | ||
"./dist/index.d.ts" | ||
], | ||
"server": [ | ||
"./dist/server/index.d.ts" | ||
], | ||
"client": [ | ||
"./dist/client/index.d.ts" | ||
], | ||
"client/SuperDebug.svelte": [ | ||
"./dist/client/SuperDebug.svelte.d.ts" | ||
], | ||
"adapters": [ | ||
"./dist/adapters/index.d.ts" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"!dist/**/*.test.*", | ||
"!dist/**/*.spec.*" | ||
], | ||
"peerDependencies": { | ||
"@sinclair/typebox": "^0.32.13", | ||
"@sveltejs/kit": "1.x || 2.x", | ||
"arktype": "1.0.29-alpha", | ||
"joi": "^17.12.1", | ||
"superstruct": "^1.0.3", | ||
"svelte": "3.x || 4.x || >=5.0.0-next.51", | ||
"valibot": "^0.28.1", | ||
"yup": "^1.3.3", | ||
"zod": "^3.22.4" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@sinclair/typebox": { | ||
"optional": true | ||
}, | ||
"arktype": { | ||
"optional": true | ||
}, | ||
"joi": { | ||
"optional": true | ||
}, | ||
"superstruct": { | ||
"optional": true | ||
}, | ||
"valibot": { | ||
"optional": true | ||
}, | ||
"yup": { | ||
"optional": true | ||
}, | ||
"zod": { | ||
"optional": true | ||
} | ||
}, | ||
"optionalDependencies": { | ||
"@gcornut/valibot-json-schema": "^0.0.22", | ||
"@sinclair/typebox": "^0.32.13", | ||
"@sodaru/yup-to-json-schema": "^2.0.1", | ||
"arktype": "1.0.29-alpha", | ||
"joi": "^17.12.1", | ||
"superstruct": "^1.0.3", | ||
"valibot": "^0.28.1", | ||
"yup": "^1.3.3", | ||
"zod": "^3.22.4", | ||
"zod-to-json-schema": "^3.22.4" | ||
}, | ||
"dependencies": { | ||
"devalue": "^4.3.2", | ||
"just-clone": "^6.2.0", | ||
"memoize-weak": "^1.0.2", | ||
"ts-deepmerge": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/adapter-auto": "^3.1.1", | ||
"@sveltejs/kit": "^2.5.0", | ||
"@sveltejs/package": "^2.2.6", | ||
"@sveltejs/vite-plugin-svelte": "^3.0.2", | ||
"@types/json-schema": "^7.0.15", | ||
"@types/throttle-debounce": "^5.0.2", | ||
"@types/uuid": "^9.0.8", | ||
"@typescript-eslint/eslint-plugin": "^6.21.0", | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-dci-lint": "^0.3.1", | ||
"eslint-plugin-svelte": "2.36.0-next.5", | ||
"json-schema-to-ts": "^3.0.0", | ||
"only-allow": "^1.2.1", | ||
"prettier": "^3.2.5", | ||
"prettier-plugin-svelte": "^3.1.2", | ||
"publint": "^0.2.7", | ||
"sass": "^1.70.0", | ||
"svelte": "5.0.0-next.52", | ||
"svelte-check": "^3.6.4", | ||
"sveltekit-flash-message": "^2.4.1", | ||
"sveltekit-rate-limiter": "^0.4.3", | ||
"throttle-debounce": "^5.0.0", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.3.3", | ||
"uuid": "^9.0.1", | ||
"vite": "^5.1.0", | ||
"vitest": "^1.2.2" | ||
}, | ||
"svelte": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"type": "module" | ||
} | ||
"name": "sveltekit-superforms", | ||
"version": "2.0.0", | ||
"author": "Andreas Söderlund <ciscoheat@gmail.com> (https://blog.encodeart.dev)", | ||
"description": "Making SvelteKit forms a pleasure to use!", | ||
"keywords": [ | ||
"sveltekit", | ||
"svelte", | ||
"form", | ||
"validation", | ||
"zod", | ||
"forms" | ||
], | ||
"license": "MIT", | ||
"homepage": "https://superforms.rocks", | ||
"bugs": "https://github.com/ciscoheat/sveltekit-superforms/issues", | ||
"repository": { | ||
"url": "https://github.com/ciscoheat/sveltekit-superforms" | ||
}, | ||
"funding": [ | ||
{ | ||
"type": "github", | ||
"url": "https://github.com/sponsors/ciscoheat" | ||
}, | ||
{ | ||
"type": "ko-fi", | ||
"url": "https://ko-fi.com/ciscoheat" | ||
}, | ||
{ | ||
"type": "paypal", | ||
"url": "https://www.paypal.com/donate/?hosted_button_id=NY7F5ALHHSVQS" | ||
} | ||
], | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"svelte": "./dist/index.js" | ||
}, | ||
"./client": { | ||
"types": "./dist/client/index.d.ts", | ||
"svelte": "./dist/client/index.js" | ||
}, | ||
"./client/SuperDebug.svelte": { | ||
"types": "./dist/client/SuperDebug.svelte.d.ts", | ||
"svelte": "./dist/client/SuperDebug.svelte" | ||
}, | ||
"./server": { | ||
"types": "./dist/server/index.d.ts", | ||
"svelte": "./dist/server/index.js" | ||
}, | ||
"./adapters": { | ||
"types": "./dist/adapters/index.d.ts", | ||
"svelte": "./dist/adapters/index.js" | ||
} | ||
}, | ||
"typesVersions": { | ||
">4.0": { | ||
"index.d.ts": [ | ||
"./dist/index.d.ts" | ||
], | ||
"server": [ | ||
"./dist/server/index.d.ts" | ||
], | ||
"client": [ | ||
"./dist/client/index.d.ts" | ||
], | ||
"client/SuperDebug.svelte": [ | ||
"./dist/client/SuperDebug.svelte.d.ts" | ||
], | ||
"adapters": [ | ||
"./dist/adapters/index.d.ts" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"!dist/**/*.test.*", | ||
"!dist/**/*.spec.*" | ||
], | ||
"peerDependencies": { | ||
"@sinclair/typebox": "^0.32.13", | ||
"@sveltejs/kit": "1.x || 2.x", | ||
"arktype": "1.0.29-alpha", | ||
"joi": "^17.12.1", | ||
"superstruct": "^1.0.3", | ||
"svelte": "3.x || 4.x || >=5.0.0-next.51", | ||
"valibot": "^0.28.1", | ||
"yup": "^1.3.3", | ||
"zod": "^3.22.4" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@sinclair/typebox": { | ||
"optional": true | ||
}, | ||
"arktype": { | ||
"optional": true | ||
}, | ||
"joi": { | ||
"optional": true | ||
}, | ||
"superstruct": { | ||
"optional": true | ||
}, | ||
"valibot": { | ||
"optional": true | ||
}, | ||
"yup": { | ||
"optional": true | ||
}, | ||
"zod": { | ||
"optional": true | ||
} | ||
}, | ||
"optionalDependencies": { | ||
"@gcornut/valibot-json-schema": "^0.0.22", | ||
"@sinclair/typebox": "^0.32.13", | ||
"@sodaru/yup-to-json-schema": "^2.0.1", | ||
"arktype": "1.0.29-alpha", | ||
"joi": "^17.12.1", | ||
"superstruct": "^1.0.3", | ||
"valibot": "^0.28.1", | ||
"yup": "^1.3.3", | ||
"zod": "^3.22.4", | ||
"zod-to-json-schema": "^3.22.4" | ||
}, | ||
"dependencies": { | ||
"devalue": "^4.3.2", | ||
"just-clone": "^6.2.0", | ||
"memoize-weak": "^1.0.2", | ||
"ts-deepmerge": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/adapter-auto": "^3.1.1", | ||
"@sveltejs/kit": "^2.5.0", | ||
"@sveltejs/package": "^2.2.6", | ||
"@sveltejs/vite-plugin-svelte": "^3.0.2", | ||
"@types/json-schema": "^7.0.15", | ||
"@types/throttle-debounce": "^5.0.2", | ||
"@types/uuid": "^9.0.8", | ||
"@typescript-eslint/eslint-plugin": "^6.21.0", | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-dci-lint": "^0.3.1", | ||
"eslint-plugin-svelte": "2.36.0-next.5", | ||
"json-schema-to-ts": "^3.0.0", | ||
"only-allow": "^1.2.1", | ||
"prettier": "^3.2.5", | ||
"prettier-plugin-svelte": "^3.1.2", | ||
"publint": "^0.2.7", | ||
"sass": "^1.70.0", | ||
"svelte": "5.0.0-next.52", | ||
"svelte-check": "^3.6.4", | ||
"sveltekit-flash-message": "^2.4.1", | ||
"sveltekit-rate-limiter": "^0.4.3", | ||
"throttle-debounce": "^5.0.0", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.3.3", | ||
"uuid": "^9.0.1", | ||
"vite": "^5.1.0", | ||
"vitest": "^1.2.2" | ||
}, | ||
"svelte": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"type": "module", | ||
"scripts": { | ||
"alpha:bump": "npm version prerelease", | ||
"alpha:pub": "npm publish --tag alpha", | ||
"dev": "vite dev", | ||
"build": "vite build && npm run package", | ||
"preview": "vite preview", | ||
"package": "svelte-kit sync && svelte-package && publint", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
"test": "vitest run", | ||
"lint": "prettier --check . && eslint .", | ||
"format": "prettier --write .", | ||
"preinstall": "npx only-allow pnpm" | ||
} | ||
} |
<p align="center"> | ||
<img src="https://github.com/ciscoheat/sveltekit-superforms/raw/main/logo.svg" width="150px" align="center" alt="Superforms logo" /> | ||
<h1 align="center">Superforms 💥</h1> | ||
<p align="center">Making SvelteKit forms a pleasure to use!</p> | ||
</p> | ||
@@ -9,3 +10,3 @@ | ||
<br /> | ||
<a href="https://discord.gg/AptebvVuhB">Discord</a> | ||
<a href="https://discord.gg/g5GHjGtU2W">Discord</a> | ||
<span> • </span> | ||
@@ -21,21 +22,19 @@ <a href="https://superforms.rocks/api">API</a> | ||
<p align="center">Making SvelteKit forms a pleasure to use!</p> | ||
# Feature list | ||
- Server- and client-side validation with your favorite validation libraries, and more to come: 💥 **Arktype** 💥 **Joi** 💥 **TypeBox** 💥 **Valibot** 💥 **Yup** 💥 **Zod** 💥 | ||
- Seamless merging of `PageData` and `ActionData` - Forget about which one to use and how, just focus on your form data. | ||
- Server- and client-side validation with any of your favorite validation libraries, with more to come: 💥 **Arktype** 💥 **Joi** 💥 **TypeBox** 💥 **Valibot** 💥 **Yup** 💥 **Zod** 💥 | ||
- [Auto-centering and auto-focusing](https://superforms.rocks/concepts/error-handling#usage-client) on invalid form fields. | ||
- [Tainted form detection](https://superforms.rocks/concepts/tainted), prevents the user from losing data if navigating away from an unsaved form. | ||
- No JavaScript required as default, but full support for [progressive enhancement](https://superforms.rocks/concepts/enhance). | ||
- Automatically coerces the string data from `FormData` into correct types. | ||
- For advanced data structures, forget about the limitations of `FormData` - [Send your forms as devalued JSON](https://superforms.rocks/concepts/nested-data), transparently. | ||
- [Auto-centering and focusing](https://superforms.rocks/concepts/error-handling#usage-client) on invalid form fields. | ||
- [Tainted form detection](https://superforms.rocks/concepts/tainted), prevents the user from losing data if navigating away from an unsaved form. Or use [snapshots](https://superforms.rocks/concepts/snapshots) to save the form state. | ||
- Automatically coerces the `FormData` into correct types. | ||
- For advanced data structures, forget about the limitations of `FormData` - Use [nested data structures](https://superforms.rocks/concepts/nested-data) transparently. | ||
- Generates [default form values](https://superforms.rocks/default-values) from validation schemas. | ||
- Support for [nested data structures](https://superforms.rocks/concepts/nested-data), [snapshots](https://superforms.rocks/concepts/snapshots) and [multiple forms](https://superforms.rocks/concepts/multiple-forms) on the same page. | ||
- Handles [multiple forms](https://superforms.rocks/concepts/multiple-forms) on the same page. | ||
- Works both on the server and with [single-page applications](https://superforms.rocks/concepts/spa) (SPA)! | ||
- [Proxy objects](https://superforms.rocks/concepts/proxy-objects) for handling data conversions to string and back again. | ||
- Realtime [client-side validation](https://superforms.rocks/concepts/client-validation) for immediate feedback. | ||
- Realtime [client-side validation](https://superforms.rocks/concepts/client-validation) for the best possible UX. | ||
- Create loading spinners easily with three [auto-updating timers](https://superforms.rocks/concepts/timers), based on human perception research. | ||
- Hook into [a number of events](https://superforms.rocks/concepts/events) for full control over the validation data and the `ActionResult`, with a possibility to cancel the update at every step. | ||
- Complete customization with a [huge list of options](https://superforms.rocks/api#superformform-options). | ||
- No JavaScript required as default, but full support for [progressive enhancement](https://superforms.rocks/concepts/enhance). | ||
- Comes with a Super Debugging Svelte Component: [SuperDebug](https://superforms.rocks/super-debug). | ||
@@ -49,10 +48,10 @@ | ||
# Contributing | ||
# Help & support | ||
General feedback, feature requests, bug reports, PR:s, are very welcome as a Github [issue](https://github.com/ciscoheat/sveltekit-superforms/issues) or on the [Discord server](https://discord.gg/AptebvVuhB)! | ||
- If you're using Superforms in non-profit circumstances, support is completely free; a star on [Github](https://github.com/ciscoheat/sveltekit-superforms) is more than enough to show your appreciation. Join the [#free-support](https://discord.gg/8X9Wfb2wbz) channel on Discord and ask away! | ||
- If you're making or aiming to make money on your project, a donation proportional to the current profit of the project or the company you work for, will give you a month of commercial support. Donate with one of the options [on the website](https://superforms.rocks/support#commercial-support), then ask in the [#commercial-support](https://discord.gg/m6hUXE4eNQ) channel on Discord. | ||
# Help & support | ||
# Contributing | ||
- If you're using Superforms in non-profit circumstances, support is completely free; a star on [Github](https://github.com/ciscoheat/sveltekit-superforms) is more than enough to show your appreciation. Join the #free-support channel on Discord and ask away! | ||
- If you're making or aiming to make money on your project, a donation proportional to the current profit of the project or the company you work for, will give you a month of commercial support. Donate with one of the options [on the website](https://superforms.rocks/support#commercial-support), then ask in the #commercial-support channel on Discord. | ||
General feedback, feature requests, bug reports, PR:s, are very welcome as a Github [issue](https://github.com/ciscoheat/sveltekit-superforms/issues) or on the [Discord server](https://discord.gg/g5GHjGtU2W)! | ||
@@ -59,0 +58,0 @@ # Donating |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
243653
5181
60