From 790f8d4c55d21826b873f185080b110c7dc7121a Mon Sep 17 00:00:00 2001 From: Hunter Johnston <64506580+huntabyte@users.noreply.github.com> Date: Mon, 19 Feb 2024 21:02:56 -0500 Subject: [PATCH] feat: library rewrite & Superforms v2 support (#131) Co-authored-by: AdrianGonz97 <31664583+AdrianGonz97@users.noreply.github.com> --- .changeset/curvy-stingrays-compare.md | 5 + .github/workflows/release.yml | 64 +- .gitignore | 90 +- .npmrc | 2 - .prettierrc | 12 - LICENSE | 21 + README.md | 118 +- components.json | 13 - content/api-reference/common-types.md | 75 - content/api-reference/form-control.md | 18 - content/api-reference/form-field.md | 241 - content/api-reference/form-root.md | 359 - content/api-reference/get-form-field.md | 187 - content/api-reference/get-form.md | 98 - content/headless-usage.md | 302 - content/introduction.md | 189 - content/options.md | 103 - content/quick-start.md | 199 - content/styling.md | 18 - mdsvex.config.js | 159 - other/setupTest.ts | 89 - package.json | 118 +- .../formsnap/.eslintignore | 4 - packages/formsnap/.eslintrc.cjs | 40 + packages/formsnap/.gitignore | 12 + packages/formsnap/.npmrc | 1 + packages/formsnap/.prettierignore | 4 + packages/formsnap/.prettierrc | 15 + .../formsnap/CHANGELOG.md | 0 packages/formsnap/LICENSE | 21 + packages/formsnap/README.md | 116 + packages/formsnap/package.json | 76 + packages/formsnap/playwright.config.ts | 12 + packages/formsnap/postcss.config.cjs | 13 + {src => packages/formsnap/src}/app.d.ts | 1 + {src => packages/formsnap/src}/app.html | 7 +- packages/formsnap/src/app.pcss | 4 + packages/formsnap/src/index.test.ts | 7 + packages/formsnap/src/lib/attrs.types.ts | 188 + .../src/lib/components/control.svelte | 77 + .../src/lib/components/description.svelte | 45 + .../src/lib/components/element-field.svelte | 90 + .../src/lib/components/field-errors.svelte | 60 + .../formsnap/src/lib/components/field.svelte | 72 + .../src/lib/components/fieldset.svelte | 56 + packages/formsnap/src/lib/components/index.ts | 9 + .../formsnap/src/lib/components/label.svelte | 46 + .../formsnap/src/lib/components/legend.svelte | 40 + packages/formsnap/src/lib/components/types.ts | 358 + packages/formsnap/src/lib/context.ts | 117 + packages/formsnap/src/lib/index.ts | 39 + packages/formsnap/src/lib/internal/types.ts | 10 + .../src/lib/internal/utils/attributes.ts | 58 + .../formsnap/src/lib/internal/utils/errors.ts | 13 + .../formsnap/src/lib/internal/utils/id.ts | 5 + .../formsnap/src/lib/internal/utils/index.ts | 3 + packages/formsnap/src/routes/+layout.svelte | 5 + .../formsnap/static}/favicon.png | Bin packages/formsnap/svelte.config.js | 18 + packages/formsnap/tailwind.config.cjs | 12 + packages/formsnap/tests/test.ts | 6 + .../formsnap/tsconfig.json | 3 +- packages/formsnap/typedoc.config.cjs | 6 + packages/formsnap/vite.config.ts | 10 + playwright.config.ts | 13 - pnpm-lock.yaml | 5318 +++++++++------ pnpm-workspace.yaml | 3 + .prettierignore => sites/docs/.eslintignore | 4 - .eslintrc.cjs => sites/docs/.eslintrc.cjs | 39 +- sites/docs/.gitignore | 14 + sites/docs/.npmrc | 1 + sites/docs/.prettierignore | 4 + sites/docs/.prettierrc | 14 + sites/docs/LICENSE | 21 + sites/docs/README.md | 1 + sites/docs/components.json | 13 + sites/docs/content/components/control.md | 111 + sites/docs/content/components/description.md | 83 + .../docs/content/components/element-field.md | 140 + sites/docs/content/components/field-errors.md | 139 + sites/docs/content/components/field.md | 86 + sites/docs/content/components/fieldset.md | 135 + sites/docs/content/components/label.md | 74 + sites/docs/content/components/legend.md | 58 + sites/docs/content/composition/aschild.md | 39 + .../content/composition/get-form-control.md | 57 + .../content/composition/get-form-field.md | 72 + sites/docs/content/index.md | 144 + sites/docs/content/quick-start.md | 279 + sites/docs/content/recipes/bits-ui-select.md | 249 + sites/docs/content/recipes/checkbox-groups.md | 323 + .../docs/content/recipes/custom-components.md | 5 + sites/docs/content/recipes/dynamic-fields.md | 313 + sites/docs/content/recipes/multiple-select.md | 252 + sites/docs/content/styling.md | 52 + .../docs/contentlayer.config.js | 24 +- sites/docs/mdsx.config.js | 128 + sites/docs/package.json | 84 + sites/docs/pnpm-lock.yaml | 5824 +++++++++++++++++ .../docs/postcss.config.cjs | 4 +- sites/docs/src/app.d.ts | 13 + sites/docs/src/app.html | 12 + {src => sites/docs/src}/index.test.ts | 0 sites/docs/src/lib/components/callout.svelte | 33 + .../lib}/components/copy-code-button.svelte | 4 +- .../lib/components/dev/tw-indicator.svelte | 17 + .../examples/bits-ui-multi-select.svelte | 81 + .../components/examples/bits-ui-select.svelte | 83 + .../components/examples/checkbox-group.svelte | 73 + .../components/examples/dynamic-fields.svelte | 94 + .../examples/multiple-select.svelte | 95 + .../src/lib/components/feature-card.svelte | 19 + .../docs/src/lib/components/icon-grid.svelte | 20 + sites/docs/src/lib/components/index.ts | 8 + .../layout/footer/footer-icons.svelte | 29 + .../components/layout/footer/footer.svelte | 17 + sites/docs/src/lib/components/layout/index.ts | 2 + .../layout/mobile-nav/mobile-nav-item.svelte | 36 + .../layout/mobile-nav/mobile-nav-link.svelte | 31 + .../layout/mobile-nav/mobile-nav.svelte | 62 + .../src/lib/components/layout/navbar/index.ts | 1 + .../layout/navbar/navbar-icons.svelte | 31 + .../layout/navbar/navbar-logo.svelte | 14 + .../layout/navbar/navbar-nav.svelte | 29 + .../components/layout/navbar/navbar.svelte | 13 + .../layout/navbar/theme-dropdown.svelte | 24 + .../components/layout/page-header/index.ts | 4 + .../page-header-description.svelte | 6 +- .../page-header/page-header-heading.svelte | 4 +- .../page-header/page-header-tagline.svelte | 4 +- .../layout/page-header/page-header.svelte | 14 + .../lib/components/layout/sidebar/index.ts | 1 + .../layout/sidebar/sidebar-nav-item.svelte | 56 + .../layout/sidebar/sidebar-nav.svelte | 12 + .../components/layout/sidebar/sidebar.svelte | 13 + .../src/lib/components/layout/toc/index.ts | 1 + .../layout/toc/table-of-contents.svelte | 38 + .../src/lib/components/layout/toc/tree.svelte | 72 + .../src/lib/components/loading-card.svelte | 22 + .../lib/components/logos/formsnap-dark.svelte | 49 + .../components/logos/formsnap-light.svelte | 49 + sites/docs/src/lib/components/logos/index.ts | 4 + .../components/logos/svecosystem-dark.svelte | 66 + .../components/logos/svecosystem-light.svelte | 66 + .../src/lib}/components/markdown/a.svelte | 2 +- .../components/markdown/blockquote.svelte | 2 +- .../lib/components/markdown/blueprint.svelte | 6 +- .../src/lib}/components/markdown/code.svelte | 2 +- .../src/lib}/components/markdown/h1.svelte | 2 +- .../src/lib}/components/markdown/h2.svelte | 4 +- .../src/lib/components/markdown/h3.svelte | 13 + .../src/lib}/components/markdown/h4.svelte | 2 +- .../src/lib}/components/markdown/h5.svelte | 2 +- .../src/lib}/components/markdown/h6.svelte | 2 +- .../src/lib}/components/markdown/hr.svelte | 2 +- .../src/lib}/components/markdown/img.svelte | 2 +- .../src/lib}/components/markdown/index.ts | 0 .../src/lib}/components/markdown/li.svelte | 2 +- .../src/lib}/components/markdown/ol.svelte | 2 +- .../src/lib}/components/markdown/p.svelte | 2 +- .../src/lib/components/markdown/pre.svelte | 11 + .../src/lib}/components/markdown/table.svelte | 2 +- .../src/lib}/components/markdown/td.svelte | 2 +- .../src/lib}/components/markdown/th.svelte | 2 +- .../src/lib}/components/markdown/tr.svelte | 2 +- .../src/lib}/components/markdown/ul.svelte | 2 +- sites/docs/src/lib/components/metadata.svelte | 35 + sites/docs/src/lib/components/step.svelte | 10 + sites/docs/src/lib/components/steps.svelte | 3 + sites/docs/src/lib/components/tabs/index.ts | 7 + .../src/lib/components/tabs/tabs-item.svelte | 20 + .../docs/src/lib/components/tabs/tabs.svelte | 23 + .../ui/alert/alert-description.svelte | 4 +- .../components/ui/alert/alert-title.svelte | 6 +- .../src/lib}/components/ui/alert/alert.svelte | 6 +- .../docs/src/lib/components/ui/alert/index.ts | 36 + .../lib}/components/ui/button/button.svelte | 13 +- .../src/lib/components/ui/button/index.ts | 50 + .../components/ui/card/card-content.svelte | 13 + .../ui/card/card-description.svelte | 13 + .../lib/components/ui/card/card-footer.svelte | 13 + .../lib/components/ui/card/card-header.svelte | 4 +- .../lib/components/ui/card/card-title.svelte | 21 + .../src/lib/components/ui/card/card.svelte | 4 +- .../docs/src/lib/components/ui/card/index.ts | 24 + .../components/ui/checkbox/checkbox.svelte | 34 + .../src/lib}/components/ui/checkbox/index.ts | 2 +- .../ui/collapsible/collapsible-content.svelte | 15 + .../lib/components/ui/collapsible/index.ts | 15 + .../dropdown-menu-checkbox-item.svelte | 35 + .../dropdown-menu-content.svelte | 27 + .../dropdown-menu/dropdown-menu-item.svelte | 31 + .../dropdown-menu/dropdown-menu-label.svelte | 19 + .../dropdown-menu-radio-group.svelte | 11 + .../dropdown-menu-radio-item.svelte | 35 + .../dropdown-menu-separator.svelte | 14 + .../dropdown-menu-shortcut.svelte | 13 + .../dropdown-menu-sub-content.svelte | 30 + .../dropdown-menu-sub-trigger.svelte | 32 + .../lib/components/ui/dropdown-menu/index.ts | 48 + .../lib/components/ui/form/form-button.svelte | 9 + .../components/ui/form/form-control.svelte | 15 + .../ui/form/form-description.svelte | 15 + .../ui/form/form-field-errors.svelte | 14 + .../lib/components/ui/form/form-label.svelte | 21 + .../docs/src/lib/components/ui/form/index.ts | 28 + .../src/lib}/components/ui/input/index.ts | 4 +- .../src/lib}/components/ui/input/input.svelte | 8 +- .../docs/src/lib/components/ui/label/index.ts | 10 + .../src/lib/components/ui/label/label.svelte | 21 + .../lib/components/ui/radio-group/index.ts | 15 + .../ui/radio-group/radio-group-item.svelte | 28 + .../ui/radio-group/radio-group.svelte | 14 + .../src/lib}/components/ui/select/index.ts | 8 +- .../ui/select/select-content.svelte | 13 +- .../components/ui/select/select-item.svelte | 19 +- .../components/ui/select/select-label.svelte | 7 +- .../ui/select/select-separator.svelte | 2 +- .../ui/select/select-trigger.svelte | 27 + .../src/lib/components/ui/separator/index.ts | 7 + .../components/ui/separator/separator.svelte | 22 + .../src/lib/components/ui/skeleton/index.ts | 7 + .../components/ui/skeleton/skeleton.svelte | 11 + .../src/lib/components/ui/slider/index.ts | 7 + .../lib/components/ui/slider/slider.svelte | 27 + .../src/lib/components/ui/sonner/index.ts | 1 + .../lib/components/ui/sonner/sonner.svelte | 21 + .../src/lib/components/ui/switch/index.ts | 7 + .../lib/components/ui/switch/switch.svelte | 25 + .../docs/src/lib/components/ui/tabs/index.ts | 18 + .../components/ui/tabs/tabs-content.svelte | 21 + .../lib/components/ui/tabs/tabs-list.svelte | 19 + .../components/ui/tabs/tabs-trigger.svelte | 23 + .../src/lib/components/ui/textarea/index.ts | 28 + .../components/ui/textarea/textarea.svelte | 31 + .../src/lib/components/ui/toggle/index.ts | 30 + .../lib/components/ui/toggle/toggle.svelte | 26 + {src => sites/docs/src/lib}/config/index.ts | 0 sites/docs/src/lib/config/navigation.ts | 159 + sites/docs/src/lib/config/site.ts | 23 + .../docs/src/lib/icons/github-icon.svelte | 0 sites/docs/src/lib/icons/index.ts | 31 + sites/docs/src/lib/icons/markdown-icon.svelte | 10 + sites/docs/src/lib/icons/shadcn-icon.svelte | 23 + sites/docs/src/lib/icons/xcom-icon.svelte | 11 + sites/docs/src/lib/index.ts | 1 + .../docs/src/lib/styles/app.pcss | 42 +- sites/docs/src/lib/styles/markdown.pcss | 114 + .../lib}/styles/themes/tokyo-night-light.json | 4 +- .../lib}/styles/themes/tokyo-night-storm.json | 2 +- .../docs/src/lib/utils/browser.ts | 0 sites/docs/src/lib/utils/contextify.ts | 17 + .../docs/src/lib}/utils/copy-code.ts | 4 +- sites/docs/src/lib/utils/docs.ts | 77 + {src => sites/docs/src/lib}/utils/index.ts | 3 +- {src => sites/docs/src/lib}/utils/styles.ts | 4 +- sites/docs/src/routes/+layout.svelte | 21 + sites/docs/src/routes/+page.svelte | 74 + sites/docs/src/routes/docs/+layout.svelte | 22 + sites/docs/src/routes/docs/+page.svelte | 21 + sites/docs/src/routes/docs/+page.ts | 11 + .../src/routes/docs/[...slug]/+page.server.ts | 67 + .../src/routes/docs/[...slug]/+page.svelte | 21 + .../docs/src}/routes/docs/[...slug]/+page.ts | 5 +- .../docs/examples/basic/+page.server.ts | 23 + .../routes/docs/examples/basic/+page.svelte | 77 + .../src/routes/docs/examples/basic/schema.ts | 15 + .../docs/examples/bits-multi/+page.server.ts | 23 + .../docs/examples/bits-multi/+page.svelte | 73 + .../docs/examples/profile/+page.server.ts | 23 + .../routes/docs/examples/profile/+page.svelte | 100 + .../docs/examples/select/+page.server.ts | 23 + .../routes/docs/examples/select/+page.svelte | 62 + .../examples/shadcn-svelte/+page.server.ts | 23 + .../docs/examples/shadcn-svelte/+page.svelte | 121 + .../docs/examples/shadcn-svelte/schema.ts | 25 + .../routes/docs/examples/urls/+page.server.ts | 23 + .../routes/docs/examples/urls/+page.svelte | 8 + .../src/routes/docs/examples/urls/schema.ts | 6 + sites/docs/static/android-chrome-192x192.png | Bin 0 -> 10444 bytes sites/docs/static/android-chrome-512x512.png | Bin 0 -> 18022 bytes sites/docs/static/apple-touch-icon.png | Bin 0 -> 9223 bytes sites/docs/static/favicon-16x16.png | Bin 0 -> 451 bytes sites/docs/static/favicon-32x32.png | Bin 0 -> 1040 bytes sites/docs/static/favicon.ico | Bin 0 -> 15406 bytes sites/docs/static/logo-dark.svg | 12 + sites/docs/static/logo-light.svg | 12 + sites/docs/static/logo.svg | 4 + sites/docs/static/og.png | Bin 0 -> 888600 bytes sites/docs/static/site.webmanifest | 11 + .../docs/svelte.config.js | 15 +- sites/docs/tailwind.config.js | 89 + sites/docs/tsconfig.json | 19 + vite.config.ts => sites/docs/vite.config.ts | 21 +- src/components/api-section.svelte | 26 - src/components/callout.svelte | 17 - src/components/component-preview.svelte | 51 - src/components/icons/aria.svelte | 5 - src/components/icons/arrow-square-out.svelte | 5 - src/components/icons/bold.svelte | 5 - src/components/icons/caret-right.svelte | 5 - src/components/icons/caret-up-down.svelte | 5 - src/components/icons/check.svelte | 5 - src/components/icons/copy-simple.svelte | 5 - src/components/icons/index.ts | 17 - src/components/icons/moon-stars.svelte | 5 - src/components/icons/npm.svelte | 6 - src/components/icons/pnpm.svelte | 6 - src/components/icons/square-half.svelte | 5 - src/components/icons/sun-dim.svelte | 5 - src/components/icons/sun.svelte | 5 - src/components/icons/tailwind.svelte | 6 - src/components/icons/warning-diamond.svelte | 11 - src/components/icons/x-com.svelte | 9 - src/components/icons/yarn.svelte | 6 - src/components/index.ts | 14 - src/components/light-switch/index.ts | 1 - .../light-switch/light-switch.svelte | 58 - src/components/light-switch/light-switch.ts | 87 - .../light-switch/local-storage-store.ts | 81 - src/components/markdown/h3.svelte | 10 - src/components/markdown/pre.svelte | 17 - src/components/navigation/index.ts | 3 - src/components/navigation/main-nav.svelte | 0 src/components/navigation/mobile-link.svelte | 19 - src/components/navigation/mobile-nav.svelte | 54 - .../navigation/sidebar-nav-items.svelte | 43 - src/components/navigation/sidebar-nav.svelte | 20 - src/components/page-header/index.ts | 4 - .../page-header-description.svelte | 12 - src/components/site-footer.svelte | 22 - src/components/site-header.svelte | 52 - src/components/steps.svelte | 3 - src/components/tailwind-indicator.svelte | 10 - .../ui/accordion/accordion-content.svelte | 26 - .../ui/accordion/accordion-item.svelte | 14 - .../ui/accordion/accordion-trigger.svelte | 26 - src/components/ui/accordion/index.ts | 17 - src/components/ui/alert/index.ts | 32 - src/components/ui/button/index.ts | 48 - src/components/ui/checkbox/checkbox.svelte | 34 - .../ui/select/select-trigger.svelte | 24 - src/components/ui/select/select.svelte | 12 - src/components/ui/sheet/index.ts | 55 - src/components/ui/sheet/sheet-content.svelte | 27 - .../ui/sheet/sheet-description.svelte | 13 - src/components/ui/sheet/sheet-overlay.svelte | 17 - src/components/ui/sheet/sheet-portal.svelte | 13 - src/components/ui/sheet/sheet-title.svelte | 16 - src/components/ui/textarea/index.ts | 11 - src/components/ui/textarea/textarea.svelte | 46 - src/config/navigation.ts | 91 - src/config/site.ts | 12 - src/lib/components/form-checkbox.svelte | 14 - src/lib/components/form-control.svelte | 32 - src/lib/components/form-description.svelte | 17 - src/lib/components/form-field.svelte | 70 - src/lib/components/form-input.svelte | 14 - src/lib/components/form-label.svelte | 16 - src/lib/components/form-radio.svelte | 14 - src/lib/components/form-select.svelte | 16 - src/lib/components/form-textarea.svelte | 14 - src/lib/components/form-validation.svelte | 22 - src/lib/components/form.svelte | 332 - src/lib/components/index.ts | 25 - src/lib/helpers/get-cleansed-errors.ts | 5 - src/lib/helpers/get-form-control.ts | 7 - src/lib/helpers/get-form-field.ts | 8 - src/lib/helpers/get-form-schema.ts | 14 - src/lib/helpers/get-form.ts | 12 - src/lib/helpers/index.ts | 5 - src/lib/index.ts | 5 - src/lib/internal/callbacks.ts | 30 - src/lib/internal/derived.ts | 88 - src/lib/internal/dom.ts | 7 - src/lib/internal/events.ts | 58 - src/lib/internal/form-field/create-actions.ts | 278 - src/lib/internal/form-field/create-control.ts | 8 - src/lib/internal/form-field/create-field.ts | 92 - .../internal/form-field/create-handlers.ts | 34 - src/lib/internal/form-field/create-ids.ts | 18 - src/lib/internal/form-field/index.ts | 6 - src/lib/internal/form-field/types.ts | 181 - src/lib/internal/form/index.ts | 11 - src/lib/internal/index.ts | 13 - src/lib/internal/is.ts | 23 - src/lib/internal/style.ts | 16 - src/lib/internal/super-form-patch.ts | 343 - src/lib/internal/types.ts | 103 - src/lib/types.ts | 83 - src/routes/+layout.svelte | 22 - src/routes/+page.ts | 6 - src/routes/docs/+layout.svelte | 19 - src/routes/docs/+page.ts | 6 - src/routes/docs/[...slug]/+page.svelte | 36 - .../custom-and-formsnap/+page.server.ts | 9 - .../examples/custom-and-formsnap/+page.svelte | 107 - .../custom-and-formsnap/custom-thing.svelte | 9 - .../examples/native-elements/+page.server.ts | 22 - .../examples/native-elements/+page.svelte | 130 - src/routes/examples/schemas.ts | 56 - src/routes/examples/sink/+page.server.ts | 23 - src/routes/examples/sink/+page.svelte | 72 - src/routes/examples/sink/DateInput.svelte | 29 - src/routes/test/a/+page.server.ts | 23 - src/routes/test/a/+page.svelte | 154 - src/styles/markdown.postcss | 101 - src/utils/docs.ts | 50 - tailwind.config.ts | 80 - tests/a.spec.ts | 38 - 410 files changed, 17931 insertions(+), 8868 deletions(-) create mode 100644 .changeset/curvy-stingrays-compare.md delete mode 100644 .npmrc delete mode 100644 .prettierrc create mode 100644 LICENSE delete mode 100644 components.json delete mode 100644 content/api-reference/common-types.md delete mode 100644 content/api-reference/form-control.md delete mode 100644 content/api-reference/form-field.md delete mode 100644 content/api-reference/form-root.md delete mode 100644 content/api-reference/get-form-field.md delete mode 100644 content/api-reference/get-form.md delete mode 100644 content/headless-usage.md delete mode 100644 content/introduction.md delete mode 100644 content/options.md delete mode 100644 content/quick-start.md delete mode 100644 content/styling.md delete mode 100644 mdsvex.config.js delete mode 100644 other/setupTest.ts rename .eslintignore => packages/formsnap/.eslintignore (81%) create mode 100644 packages/formsnap/.eslintrc.cjs create mode 100644 packages/formsnap/.gitignore create mode 100644 packages/formsnap/.npmrc create mode 100644 packages/formsnap/.prettierignore create mode 100644 packages/formsnap/.prettierrc rename CHANGELOG.md => packages/formsnap/CHANGELOG.md (100%) create mode 100644 packages/formsnap/LICENSE create mode 100644 packages/formsnap/README.md create mode 100644 packages/formsnap/package.json create mode 100644 packages/formsnap/playwright.config.ts create mode 100644 packages/formsnap/postcss.config.cjs rename {src => packages/formsnap/src}/app.d.ts (89%) rename {src => packages/formsnap/src}/app.html (61%) create mode 100644 packages/formsnap/src/app.pcss create mode 100644 packages/formsnap/src/index.test.ts create mode 100644 packages/formsnap/src/lib/attrs.types.ts create mode 100644 packages/formsnap/src/lib/components/control.svelte create mode 100644 packages/formsnap/src/lib/components/description.svelte create mode 100644 packages/formsnap/src/lib/components/element-field.svelte create mode 100644 packages/formsnap/src/lib/components/field-errors.svelte create mode 100644 packages/formsnap/src/lib/components/field.svelte create mode 100644 packages/formsnap/src/lib/components/fieldset.svelte create mode 100644 packages/formsnap/src/lib/components/index.ts create mode 100644 packages/formsnap/src/lib/components/label.svelte create mode 100644 packages/formsnap/src/lib/components/legend.svelte create mode 100644 packages/formsnap/src/lib/components/types.ts create mode 100644 packages/formsnap/src/lib/context.ts create mode 100644 packages/formsnap/src/lib/index.ts create mode 100644 packages/formsnap/src/lib/internal/types.ts create mode 100644 packages/formsnap/src/lib/internal/utils/attributes.ts create mode 100644 packages/formsnap/src/lib/internal/utils/errors.ts create mode 100644 packages/formsnap/src/lib/internal/utils/id.ts create mode 100644 packages/formsnap/src/lib/internal/utils/index.ts create mode 100644 packages/formsnap/src/routes/+layout.svelte rename {static => packages/formsnap/static}/favicon.png (100%) create mode 100644 packages/formsnap/svelte.config.js create mode 100644 packages/formsnap/tailwind.config.cjs create mode 100644 packages/formsnap/tests/test.ts rename tsconfig.json => packages/formsnap/tsconfig.json (82%) create mode 100644 packages/formsnap/typedoc.config.cjs create mode 100644 packages/formsnap/vite.config.ts delete mode 100644 playwright.config.ts create mode 100644 pnpm-workspace.yaml rename .prettierignore => sites/docs/.eslintignore (81%) rename .eslintrc.cjs => sites/docs/.eslintrc.cjs (75%) create mode 100644 sites/docs/.gitignore create mode 100644 sites/docs/.npmrc create mode 100644 sites/docs/.prettierignore create mode 100644 sites/docs/.prettierrc create mode 100644 sites/docs/LICENSE create mode 100644 sites/docs/README.md create mode 100644 sites/docs/components.json create mode 100644 sites/docs/content/components/control.md create mode 100644 sites/docs/content/components/description.md create mode 100644 sites/docs/content/components/element-field.md create mode 100644 sites/docs/content/components/field-errors.md create mode 100644 sites/docs/content/components/field.md create mode 100644 sites/docs/content/components/fieldset.md create mode 100644 sites/docs/content/components/label.md create mode 100644 sites/docs/content/components/legend.md create mode 100644 sites/docs/content/composition/aschild.md create mode 100644 sites/docs/content/composition/get-form-control.md create mode 100644 sites/docs/content/composition/get-form-field.md create mode 100644 sites/docs/content/index.md create mode 100644 sites/docs/content/quick-start.md create mode 100644 sites/docs/content/recipes/bits-ui-select.md create mode 100644 sites/docs/content/recipes/checkbox-groups.md create mode 100644 sites/docs/content/recipes/custom-components.md create mode 100644 sites/docs/content/recipes/dynamic-fields.md create mode 100644 sites/docs/content/recipes/multiple-select.md create mode 100644 sites/docs/content/styling.md rename contentlayer.config.js => sites/docs/contentlayer.config.js (74%) create mode 100644 sites/docs/mdsx.config.js create mode 100644 sites/docs/package.json create mode 100644 sites/docs/pnpm-lock.yaml rename postcss.config.cjs => sites/docs/postcss.config.cjs (77%) create mode 100644 sites/docs/src/app.d.ts create mode 100644 sites/docs/src/app.html rename {src => sites/docs/src}/index.test.ts (100%) create mode 100644 sites/docs/src/lib/components/callout.svelte rename {src => sites/docs/src/lib}/components/copy-code-button.svelte (85%) create mode 100644 sites/docs/src/lib/components/dev/tw-indicator.svelte create mode 100644 sites/docs/src/lib/components/examples/bits-ui-multi-select.svelte create mode 100644 sites/docs/src/lib/components/examples/bits-ui-select.svelte create mode 100644 sites/docs/src/lib/components/examples/checkbox-group.svelte create mode 100644 sites/docs/src/lib/components/examples/dynamic-fields.svelte create mode 100644 sites/docs/src/lib/components/examples/multiple-select.svelte create mode 100644 sites/docs/src/lib/components/feature-card.svelte create mode 100644 sites/docs/src/lib/components/icon-grid.svelte create mode 100644 sites/docs/src/lib/components/index.ts create mode 100644 sites/docs/src/lib/components/layout/footer/footer-icons.svelte create mode 100644 sites/docs/src/lib/components/layout/footer/footer.svelte create mode 100644 sites/docs/src/lib/components/layout/index.ts create mode 100644 sites/docs/src/lib/components/layout/mobile-nav/mobile-nav-item.svelte create mode 100644 sites/docs/src/lib/components/layout/mobile-nav/mobile-nav-link.svelte create mode 100644 sites/docs/src/lib/components/layout/mobile-nav/mobile-nav.svelte create mode 100644 sites/docs/src/lib/components/layout/navbar/index.ts create mode 100644 sites/docs/src/lib/components/layout/navbar/navbar-icons.svelte create mode 100644 sites/docs/src/lib/components/layout/navbar/navbar-logo.svelte create mode 100644 sites/docs/src/lib/components/layout/navbar/navbar-nav.svelte create mode 100644 sites/docs/src/lib/components/layout/navbar/navbar.svelte create mode 100644 sites/docs/src/lib/components/layout/navbar/theme-dropdown.svelte create mode 100644 sites/docs/src/lib/components/layout/page-header/index.ts rename src/components/page-header/page-header.svelte => sites/docs/src/lib/components/layout/page-header/page-header-description.svelte (50%) rename {src/components => sites/docs/src/lib/components/layout}/page-header/page-header-heading.svelte (51%) rename {src/components => sites/docs/src/lib/components/layout}/page-header/page-header-tagline.svelte (59%) create mode 100644 sites/docs/src/lib/components/layout/page-header/page-header.svelte create mode 100644 sites/docs/src/lib/components/layout/sidebar/index.ts create mode 100644 sites/docs/src/lib/components/layout/sidebar/sidebar-nav-item.svelte create mode 100644 sites/docs/src/lib/components/layout/sidebar/sidebar-nav.svelte create mode 100644 sites/docs/src/lib/components/layout/sidebar/sidebar.svelte create mode 100644 sites/docs/src/lib/components/layout/toc/index.ts create mode 100644 sites/docs/src/lib/components/layout/toc/table-of-contents.svelte create mode 100644 sites/docs/src/lib/components/layout/toc/tree.svelte create mode 100644 sites/docs/src/lib/components/loading-card.svelte create mode 100644 sites/docs/src/lib/components/logos/formsnap-dark.svelte create mode 100644 sites/docs/src/lib/components/logos/formsnap-light.svelte create mode 100644 sites/docs/src/lib/components/logos/index.ts create mode 100644 sites/docs/src/lib/components/logos/svecosystem-dark.svelte create mode 100644 sites/docs/src/lib/components/logos/svecosystem-light.svelte rename {src => sites/docs/src/lib}/components/markdown/a.svelte (91%) rename {src => sites/docs/src/lib}/components/markdown/blockquote.svelte (83%) rename src/components/markdown/layout.svelte => sites/docs/src/lib/components/markdown/blueprint.svelte (81%) rename {src => sites/docs/src/lib}/components/markdown/code.svelte (88%) rename {src => sites/docs/src/lib}/components/markdown/h1.svelte (83%) rename {src => sites/docs/src/lib}/components/markdown/h2.svelte (53%) create mode 100644 sites/docs/src/lib/components/markdown/h3.svelte rename {src => sites/docs/src/lib}/components/markdown/h4.svelte (84%) rename {src => sites/docs/src/lib}/components/markdown/h5.svelte (84%) rename {src => sites/docs/src/lib}/components/markdown/h6.svelte (84%) rename {src => sites/docs/src/lib}/components/markdown/hr.svelte (80%) rename {src => sites/docs/src/lib}/components/markdown/img.svelte (89%) rename {src => sites/docs/src/lib}/components/markdown/index.ts (100%) rename {src => sites/docs/src/lib}/components/markdown/li.svelte (81%) rename {src => sites/docs/src/lib}/components/markdown/ol.svelte (82%) rename {src => sites/docs/src/lib}/components/markdown/p.svelte (83%) create mode 100644 sites/docs/src/lib/components/markdown/pre.svelte rename {src => sites/docs/src/lib}/components/markdown/table.svelte (85%) rename {src => sites/docs/src/lib}/components/markdown/td.svelte (86%) rename {src => sites/docs/src/lib}/components/markdown/th.svelte (86%) rename {src => sites/docs/src/lib}/components/markdown/tr.svelte (82%) rename {src => sites/docs/src/lib}/components/markdown/ul.svelte (82%) create mode 100644 sites/docs/src/lib/components/metadata.svelte create mode 100644 sites/docs/src/lib/components/step.svelte create mode 100644 sites/docs/src/lib/components/steps.svelte create mode 100644 sites/docs/src/lib/components/tabs/index.ts create mode 100644 sites/docs/src/lib/components/tabs/tabs-item.svelte create mode 100644 sites/docs/src/lib/components/tabs/tabs.svelte rename src/components/ui/sheet/sheet-header.svelte => sites/docs/src/lib/components/ui/alert/alert-description.svelte (62%) rename {src => sites/docs/src/lib}/components/ui/alert/alert-title.svelte (69%) rename {src => sites/docs/src/lib}/components/ui/alert/alert.svelte (69%) create mode 100644 sites/docs/src/lib/components/ui/alert/index.ts rename {src => sites/docs/src/lib}/components/ui/button/button.svelte (64%) create mode 100644 sites/docs/src/lib/components/ui/button/index.ts create mode 100644 sites/docs/src/lib/components/ui/card/card-content.svelte create mode 100644 sites/docs/src/lib/components/ui/card/card-description.svelte create mode 100644 sites/docs/src/lib/components/ui/card/card-footer.svelte rename src/components/ui/alert/alert-description.svelte => sites/docs/src/lib/components/ui/card/card-header.svelte (70%) create mode 100644 sites/docs/src/lib/components/ui/card/card-title.svelte rename src/components/ui/sheet/sheet-footer.svelte => sites/docs/src/lib/components/ui/card/card.svelte (66%) create mode 100644 sites/docs/src/lib/components/ui/card/index.ts create mode 100644 sites/docs/src/lib/components/ui/checkbox/checkbox.svelte rename {src => sites/docs/src/lib}/components/ui/checkbox/index.ts (76%) create mode 100644 sites/docs/src/lib/components/ui/collapsible/collapsible-content.svelte create mode 100644 sites/docs/src/lib/components/ui/collapsible/index.ts create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte create mode 100644 sites/docs/src/lib/components/ui/dropdown-menu/index.ts create mode 100644 sites/docs/src/lib/components/ui/form/form-button.svelte create mode 100644 sites/docs/src/lib/components/ui/form/form-control.svelte create mode 100644 sites/docs/src/lib/components/ui/form/form-description.svelte create mode 100644 sites/docs/src/lib/components/ui/form/form-field-errors.svelte create mode 100644 sites/docs/src/lib/components/ui/form/form-label.svelte create mode 100644 sites/docs/src/lib/components/ui/form/index.ts rename {src => sites/docs/src/lib}/components/ui/input/index.ts (87%) rename {src => sites/docs/src/lib}/components/ui/input/input.svelte (52%) create mode 100644 sites/docs/src/lib/components/ui/label/index.ts create mode 100644 sites/docs/src/lib/components/ui/label/label.svelte create mode 100644 sites/docs/src/lib/components/ui/radio-group/index.ts create mode 100644 sites/docs/src/lib/components/ui/radio-group/radio-group-item.svelte create mode 100644 sites/docs/src/lib/components/ui/radio-group/radio-group.svelte rename {src => sites/docs/src/lib}/components/ui/select/index.ts (91%) rename {src => sites/docs/src/lib}/components/ui/select/select-content.svelte (77%) rename {src => sites/docs/src/lib}/components/ui/select/select-item.svelte (60%) rename {src => sites/docs/src/lib}/components/ui/select/select-label.svelte (63%) rename {src => sites/docs/src/lib}/components/ui/select/select-separator.svelte (88%) create mode 100644 sites/docs/src/lib/components/ui/select/select-trigger.svelte create mode 100644 sites/docs/src/lib/components/ui/separator/index.ts create mode 100644 sites/docs/src/lib/components/ui/separator/separator.svelte create mode 100644 sites/docs/src/lib/components/ui/skeleton/index.ts create mode 100644 sites/docs/src/lib/components/ui/skeleton/skeleton.svelte create mode 100644 sites/docs/src/lib/components/ui/slider/index.ts create mode 100644 sites/docs/src/lib/components/ui/slider/slider.svelte create mode 100644 sites/docs/src/lib/components/ui/sonner/index.ts create mode 100644 sites/docs/src/lib/components/ui/sonner/sonner.svelte create mode 100644 sites/docs/src/lib/components/ui/switch/index.ts create mode 100644 sites/docs/src/lib/components/ui/switch/switch.svelte create mode 100644 sites/docs/src/lib/components/ui/tabs/index.ts create mode 100644 sites/docs/src/lib/components/ui/tabs/tabs-content.svelte create mode 100644 sites/docs/src/lib/components/ui/tabs/tabs-list.svelte create mode 100644 sites/docs/src/lib/components/ui/tabs/tabs-trigger.svelte create mode 100644 sites/docs/src/lib/components/ui/textarea/index.ts create mode 100644 sites/docs/src/lib/components/ui/textarea/textarea.svelte create mode 100644 sites/docs/src/lib/components/ui/toggle/index.ts create mode 100644 sites/docs/src/lib/components/ui/toggle/toggle.svelte rename {src => sites/docs/src/lib}/config/index.ts (100%) create mode 100644 sites/docs/src/lib/config/navigation.ts create mode 100644 sites/docs/src/lib/config/site.ts rename src/components/icons/github.svelte => sites/docs/src/lib/icons/github-icon.svelte (100%) create mode 100644 sites/docs/src/lib/icons/index.ts create mode 100644 sites/docs/src/lib/icons/markdown-icon.svelte create mode 100644 sites/docs/src/lib/icons/shadcn-icon.svelte create mode 100644 sites/docs/src/lib/icons/xcom-icon.svelte create mode 100644 sites/docs/src/lib/index.ts rename src/styles/app.postcss => sites/docs/src/lib/styles/app.pcss (76%) create mode 100644 sites/docs/src/lib/styles/markdown.pcss rename {src => sites/docs/src/lib}/styles/themes/tokyo-night-light.json (99%) rename {src => sites/docs/src/lib}/styles/themes/tokyo-night-storm.json (99%) rename src/utils/is.ts => sites/docs/src/lib/utils/browser.ts (100%) create mode 100644 sites/docs/src/lib/utils/contextify.ts rename {src => sites/docs/src/lib}/utils/copy-code.ts (86%) create mode 100644 sites/docs/src/lib/utils/docs.ts rename {src => sites/docs/src/lib}/utils/index.ts (53%) rename {src => sites/docs/src/lib}/utils/styles.ts (97%) create mode 100644 sites/docs/src/routes/+layout.svelte create mode 100644 sites/docs/src/routes/+page.svelte create mode 100644 sites/docs/src/routes/docs/+layout.svelte create mode 100644 sites/docs/src/routes/docs/+page.svelte create mode 100644 sites/docs/src/routes/docs/+page.ts create mode 100644 sites/docs/src/routes/docs/[...slug]/+page.server.ts create mode 100644 sites/docs/src/routes/docs/[...slug]/+page.svelte rename {src => sites/docs/src}/routes/docs/[...slug]/+page.ts (73%) create mode 100644 sites/docs/src/routes/docs/examples/basic/+page.server.ts create mode 100644 sites/docs/src/routes/docs/examples/basic/+page.svelte create mode 100644 sites/docs/src/routes/docs/examples/basic/schema.ts create mode 100644 sites/docs/src/routes/docs/examples/bits-multi/+page.server.ts create mode 100644 sites/docs/src/routes/docs/examples/bits-multi/+page.svelte create mode 100644 sites/docs/src/routes/docs/examples/profile/+page.server.ts create mode 100644 sites/docs/src/routes/docs/examples/profile/+page.svelte create mode 100644 sites/docs/src/routes/docs/examples/select/+page.server.ts create mode 100644 sites/docs/src/routes/docs/examples/select/+page.svelte create mode 100644 sites/docs/src/routes/docs/examples/shadcn-svelte/+page.server.ts create mode 100644 sites/docs/src/routes/docs/examples/shadcn-svelte/+page.svelte create mode 100644 sites/docs/src/routes/docs/examples/shadcn-svelte/schema.ts create mode 100644 sites/docs/src/routes/docs/examples/urls/+page.server.ts create mode 100644 sites/docs/src/routes/docs/examples/urls/+page.svelte create mode 100644 sites/docs/src/routes/docs/examples/urls/schema.ts create mode 100644 sites/docs/static/android-chrome-192x192.png create mode 100644 sites/docs/static/android-chrome-512x512.png create mode 100644 sites/docs/static/apple-touch-icon.png create mode 100644 sites/docs/static/favicon-16x16.png create mode 100644 sites/docs/static/favicon-32x32.png create mode 100644 sites/docs/static/favicon.ico create mode 100644 sites/docs/static/logo-dark.svg create mode 100644 sites/docs/static/logo-light.svg create mode 100644 sites/docs/static/logo.svg create mode 100644 sites/docs/static/og.png create mode 100644 sites/docs/static/site.webmanifest rename svelte.config.js => sites/docs/svelte.config.js (71%) create mode 100644 sites/docs/tailwind.config.js create mode 100644 sites/docs/tsconfig.json rename vite.config.ts => sites/docs/vite.config.ts (58%) delete mode 100644 src/components/api-section.svelte delete mode 100644 src/components/callout.svelte delete mode 100644 src/components/component-preview.svelte delete mode 100644 src/components/icons/aria.svelte delete mode 100644 src/components/icons/arrow-square-out.svelte delete mode 100644 src/components/icons/bold.svelte delete mode 100644 src/components/icons/caret-right.svelte delete mode 100644 src/components/icons/caret-up-down.svelte delete mode 100644 src/components/icons/check.svelte delete mode 100644 src/components/icons/copy-simple.svelte delete mode 100644 src/components/icons/index.ts delete mode 100644 src/components/icons/moon-stars.svelte delete mode 100644 src/components/icons/npm.svelte delete mode 100644 src/components/icons/pnpm.svelte delete mode 100644 src/components/icons/square-half.svelte delete mode 100644 src/components/icons/sun-dim.svelte delete mode 100644 src/components/icons/sun.svelte delete mode 100644 src/components/icons/tailwind.svelte delete mode 100644 src/components/icons/warning-diamond.svelte delete mode 100644 src/components/icons/x-com.svelte delete mode 100644 src/components/icons/yarn.svelte delete mode 100644 src/components/index.ts delete mode 100644 src/components/light-switch/index.ts delete mode 100644 src/components/light-switch/light-switch.svelte delete mode 100644 src/components/light-switch/light-switch.ts delete mode 100644 src/components/light-switch/local-storage-store.ts delete mode 100644 src/components/markdown/h3.svelte delete mode 100644 src/components/markdown/pre.svelte delete mode 100644 src/components/navigation/index.ts delete mode 100644 src/components/navigation/main-nav.svelte delete mode 100644 src/components/navigation/mobile-link.svelte delete mode 100644 src/components/navigation/mobile-nav.svelte delete mode 100644 src/components/navigation/sidebar-nav-items.svelte delete mode 100644 src/components/navigation/sidebar-nav.svelte delete mode 100644 src/components/page-header/index.ts delete mode 100644 src/components/page-header/page-header-description.svelte delete mode 100644 src/components/site-footer.svelte delete mode 100644 src/components/site-header.svelte delete mode 100644 src/components/steps.svelte delete mode 100644 src/components/tailwind-indicator.svelte delete mode 100644 src/components/ui/accordion/accordion-content.svelte delete mode 100644 src/components/ui/accordion/accordion-item.svelte delete mode 100644 src/components/ui/accordion/accordion-trigger.svelte delete mode 100644 src/components/ui/accordion/index.ts delete mode 100644 src/components/ui/alert/index.ts delete mode 100644 src/components/ui/button/index.ts delete mode 100644 src/components/ui/checkbox/checkbox.svelte delete mode 100644 src/components/ui/select/select-trigger.svelte delete mode 100644 src/components/ui/select/select.svelte delete mode 100644 src/components/ui/sheet/index.ts delete mode 100644 src/components/ui/sheet/sheet-content.svelte delete mode 100644 src/components/ui/sheet/sheet-description.svelte delete mode 100644 src/components/ui/sheet/sheet-overlay.svelte delete mode 100644 src/components/ui/sheet/sheet-portal.svelte delete mode 100644 src/components/ui/sheet/sheet-title.svelte delete mode 100644 src/components/ui/textarea/index.ts delete mode 100644 src/components/ui/textarea/textarea.svelte delete mode 100644 src/config/navigation.ts delete mode 100644 src/config/site.ts delete mode 100644 src/lib/components/form-checkbox.svelte delete mode 100644 src/lib/components/form-control.svelte delete mode 100644 src/lib/components/form-description.svelte delete mode 100644 src/lib/components/form-field.svelte delete mode 100644 src/lib/components/form-input.svelte delete mode 100644 src/lib/components/form-label.svelte delete mode 100644 src/lib/components/form-radio.svelte delete mode 100644 src/lib/components/form-select.svelte delete mode 100644 src/lib/components/form-textarea.svelte delete mode 100644 src/lib/components/form-validation.svelte delete mode 100644 src/lib/components/form.svelte delete mode 100644 src/lib/components/index.ts delete mode 100644 src/lib/helpers/get-cleansed-errors.ts delete mode 100644 src/lib/helpers/get-form-control.ts delete mode 100644 src/lib/helpers/get-form-field.ts delete mode 100644 src/lib/helpers/get-form-schema.ts delete mode 100644 src/lib/helpers/get-form.ts delete mode 100644 src/lib/helpers/index.ts delete mode 100644 src/lib/index.ts delete mode 100644 src/lib/internal/callbacks.ts delete mode 100644 src/lib/internal/derived.ts delete mode 100644 src/lib/internal/dom.ts delete mode 100644 src/lib/internal/events.ts delete mode 100644 src/lib/internal/form-field/create-actions.ts delete mode 100644 src/lib/internal/form-field/create-control.ts delete mode 100644 src/lib/internal/form-field/create-field.ts delete mode 100644 src/lib/internal/form-field/create-handlers.ts delete mode 100644 src/lib/internal/form-field/create-ids.ts delete mode 100644 src/lib/internal/form-field/index.ts delete mode 100644 src/lib/internal/form-field/types.ts delete mode 100644 src/lib/internal/form/index.ts delete mode 100644 src/lib/internal/index.ts delete mode 100644 src/lib/internal/is.ts delete mode 100644 src/lib/internal/style.ts delete mode 100644 src/lib/internal/super-form-patch.ts delete mode 100644 src/lib/internal/types.ts delete mode 100644 src/lib/types.ts delete mode 100644 src/routes/+layout.svelte delete mode 100644 src/routes/+page.ts delete mode 100644 src/routes/docs/+layout.svelte delete mode 100644 src/routes/docs/+page.ts delete mode 100644 src/routes/docs/[...slug]/+page.svelte delete mode 100644 src/routes/examples/custom-and-formsnap/+page.server.ts delete mode 100644 src/routes/examples/custom-and-formsnap/+page.svelte delete mode 100644 src/routes/examples/custom-and-formsnap/custom-thing.svelte delete mode 100644 src/routes/examples/native-elements/+page.server.ts delete mode 100644 src/routes/examples/native-elements/+page.svelte delete mode 100644 src/routes/examples/schemas.ts delete mode 100644 src/routes/examples/sink/+page.server.ts delete mode 100644 src/routes/examples/sink/+page.svelte delete mode 100644 src/routes/examples/sink/DateInput.svelte delete mode 100644 src/routes/test/a/+page.server.ts delete mode 100644 src/routes/test/a/+page.svelte delete mode 100644 src/styles/markdown.postcss delete mode 100644 src/utils/docs.ts delete mode 100644 tailwind.config.ts delete mode 100644 tests/a.spec.ts diff --git a/.changeset/curvy-stingrays-compare.md b/.changeset/curvy-stingrays-compare.md new file mode 100644 index 0000000..8566956 --- /dev/null +++ b/.changeset/curvy-stingrays-compare.md @@ -0,0 +1,5 @@ +--- +"formsnap": minor +--- + +Rewrite entire library - see https://formsnap.dev diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5573585..ea29eb5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,41 +1,41 @@ name: Release on: - push: - branches: - - main + push: + branches: + - main concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: - release: - permissions: - contents: write # to create release (changesets/action) - pull-requests: write # to create pull request (changesets/action) - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits - fetch-depth: 0 - - uses: pnpm/action-setup@v2.2.4 - with: - version: 8.6.3 - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: "18.x" - cache: pnpm + release: + permissions: + contents: write # to create release (changesets/action) + pull-requests: write # to create pull request (changesets/action) + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits + fetch-depth: 0 + - uses: pnpm/action-setup@v2.2.4 + with: + version: 8.6.3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "18.x" + cache: pnpm - - run: pnpm install --frozen-lockfile + - run: pnpm install --frozen-lockfile - - name: Create Release Pull Request or Publish to npm - id: changesets - uses: changesets/action@v1 - with: - publish: pnpm release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + publish: pnpm release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 3db54ec..2fa206c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,78 @@ -.DS_Store node_modules -/build -/dist -/.svelte-kit -/package -.cache +.DS_Store +.AppleDouble +.LSOverride + +dist + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files .env -.env.* -!.env.example -vite.config.js.timestamp-* -vite.config.ts.timestamp-* -.contentlayer -.contentlayer/* -.vercel -dist \ No newline at end of file +.env.development.local +.env.test.local +.env.production.local +.env.local + +sites/docs/.vercel +packages/formsnap/doc \ No newline at end of file diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 0c05da4..0000000 --- a/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -engine-strict=true -resolution-mode=highest diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index b81d727..0000000 --- a/.prettierrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "useTabs": true, - "singleQuote": false, - "trailingComma": "none", - "printWidth": 100, - "plugins": ["prettier-plugin-svelte"], - "pluginSearchDirs": ["."], - "overrides": [ - { "files": "*.svelte", "options": { "parser": "svelte" } }, - { "files": "*.md", "options": { "parser": "markdown", "printWidth": 85 } } - ] -} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..da4cc1f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Hunter Johnston + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index af25783..2a1b756 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,12 @@ The goal of this library is to make working with the already incredible [sveltek ## Installation ```bash -npm i formsnap sveltekit-superforms zod +npm i formsnap sveltekit-superforms ``` ## Usage -You'll handle the initial Superforms setup just as you normally would, where you define a schema and return the form from your load function. The magic happens once you have access to that form inside of your page component. +You'll handle the initial Superforms setup just as you normally would, where you define a schema and return the form from your load function. #### 1. Define a Zod schema @@ -20,9 +20,9 @@ import { z } from "zod"; export const settingsFormSchema = z.object({ email: z.string().email(), bio: z.string().max(250).optional(), - language: z.enum(["en", "es", "fr"]), marketingEmails: z.boolean().default(true), - theme: z.enum(["light", "dark"]).default("light") + language: z.enum(["en", "es", "fr"]).default(["en"]), + theme: z.enum(["light", "dark"]).default(["light"]), }); ``` @@ -30,13 +30,14 @@ export const settingsFormSchema = z.object({ ```ts // +page.server.ts -import { superValidate } from "sveltekit-superforms/server"; +import { superValidate } from "sveltekit-superforms"; +import { zod } from "sveltekit-superforms/adapters"; import type { PageServerLoad } from "./$types"; import { settingsFormSchema } from "./schemas"; export const load: PageServerLoad = async () => { return { - form: await superValidate(settingsFormSchema) + form: await superValidate(zod(settingsFormSchema)), }; }; ``` @@ -45,54 +46,71 @@ export const load: PageServerLoad = async () => { ```svelte - - - Email - - - - - Bio - - - - - Language - - - - - - - - - - Receive marketing emails from us - - - - - Light - - - - - Dark - - +
+ + + + + + We'll provide critical updates about your account via email. + + + + + + +