@tanstack/cta-engine 0.14.3 → 0.15.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/dist/add-ons.js +5 -91
- package/dist/add-to-app.js +171 -0
- package/dist/config-file.js +34 -11
- package/dist/constants.js +0 -2
- package/dist/create-app.js +142 -451
- package/dist/custom-add-ons/add-on.js +175 -0
- package/dist/custom-add-ons/shared.js +116 -0
- package/dist/custom-add-ons/starter.js +84 -0
- package/dist/environment.js +67 -44
- package/dist/file-helpers.js +165 -0
- package/dist/frameworks.js +92 -0
- package/dist/index.js +18 -1
- package/dist/integrations/git.js +4 -0
- package/dist/integrations/shadcn.js +33 -0
- package/dist/options.js +9 -333
- package/dist/package-json.js +48 -0
- package/dist/package-manager.js +51 -6
- package/dist/registry.js +56 -0
- package/dist/special-steps/index.js +24 -0
- package/dist/special-steps/rimraf-node-modules.js +16 -0
- package/dist/template-file.js +112 -0
- package/dist/types/add-ons.d.ts +3 -8
- package/dist/types/add-to-app.d.ts +17 -0
- package/dist/types/config-file.d.ts +7 -4
- package/dist/types/constants.d.ts +0 -3
- package/dist/types/create-app.d.ts +1 -7
- package/dist/types/custom-add-ons/add-on.d.ts +69 -0
- package/dist/types/custom-add-ons/shared.d.ts +15 -0
- package/dist/types/custom-add-ons/starter.d.ts +7 -0
- package/dist/types/environment.d.ts +2 -1
- package/dist/types/file-helpers.d.ts +15 -0
- package/dist/types/frameworks.d.ts +7 -0
- package/dist/types/index.d.ts +21 -1
- package/dist/types/integrations/git.d.ts +2 -0
- package/dist/types/integrations/shadcn.d.ts +2 -0
- package/dist/types/options.d.ts +2 -6
- package/dist/types/package-json.d.ts +7 -0
- package/dist/types/package-manager.d.ts +18 -1
- package/dist/types/registry.d.ts +25 -0
- package/dist/types/special-steps/index.d.ts +2 -0
- package/dist/types/special-steps/rimraf-node-modules.d.ts +2 -0
- package/dist/types/template-file.d.ts +2 -0
- package/dist/types/types.d.ts +788 -85
- package/dist/types/utils.d.ts +5 -0
- package/dist/types.js +65 -1
- package/dist/utils.js +9 -0
- package/package.json +9 -12
- package/src/add-ons.ts +7 -123
- package/src/add-to-app.ts +276 -0
- package/src/config-file.ts +51 -20
- package/src/constants.ts +0 -5
- package/src/create-app.ts +180 -730
- package/src/custom-add-ons/add-on.ts +261 -0
- package/src/custom-add-ons/shared.ts +160 -0
- package/src/custom-add-ons/starter.ts +126 -0
- package/src/environment.ts +80 -45
- package/src/file-helpers.ts +235 -0
- package/src/frameworks.ts +134 -0
- package/src/index.ts +85 -1
- package/src/integrations/git.ts +7 -0
- package/src/integrations/shadcn.ts +54 -0
- package/src/options.ts +8 -409
- package/src/package-json.ts +69 -0
- package/src/package-manager.ts +80 -9
- package/src/registry.ts +92 -0
- package/src/special-steps/index.ts +36 -0
- package/src/special-steps/rimraf-node-modules.ts +25 -0
- package/src/template-file.ts +150 -0
- package/src/types.ts +175 -87
- package/src/utils.ts +17 -0
- package/tests/add-ons.test.ts +67 -0
- package/tests/add-to-app.test.ts +358 -0
- package/tests/config-file.test.ts +105 -0
- package/tests/create-app.test.ts +120 -0
- package/tests/custom-add-ons/add-on.test.ts +12 -0
- package/tests/custom-add-ons/shared.test.ts +253 -0
- package/tests/custom-add-ons/starter.test.ts +58 -0
- package/tests/environment.test.ts +115 -0
- package/tests/file-helper.test.ts +90 -0
- package/tests/frameworks.test.ts +95 -0
- package/tests/index.test.ts +9 -0
- package/tests/integrations/git.test.ts +20 -0
- package/tests/integrations/shadcn.test.ts +91 -0
- package/tests/options.test.ts +42 -0
- package/tests/package-json.test.ts +63 -0
- package/tests/package-manager.test.ts +154 -0
- package/tests/setupVitest.ts +6 -0
- package/tests/template-file.test.ts +178 -0
- package/tests/utils.test.ts +23 -0
- package/vitest.config.ts +21 -0
- package/dist/add.js +0 -125
- package/dist/cli.js +0 -132
- package/dist/custom-add-on.js +0 -254
- package/dist/file-helper.js +0 -18
- package/dist/mcp.js +0 -229
- package/dist/templates.js +0 -6
- package/dist/toolchain.js +0 -6
- package/dist/types/add.d.ts +0 -3
- package/dist/types/cli.d.ts +0 -7
- package/dist/types/custom-add-on.d.ts +0 -3
- package/dist/types/file-helper.d.ts +0 -2
- package/dist/types/mcp.d.ts +0 -7
- package/dist/types/templates.d.ts +0 -1
- package/dist/types/toolchain.d.ts +0 -3
- package/src/add.ts +0 -186
- package/src/cli.ts +0 -210
- package/src/custom-add-on.ts +0 -325
- package/src/file-helper.ts +0 -20
- package/src/mcp.ts +0 -302
- package/src/templates.ts +0 -7
- package/src/toolchain.ts +0 -7
- package/templates/react/add-on/clerk/README.md +0 -3
- package/templates/react/add-on/clerk/assets/_dot_env.local.append +0 -2
- package/templates/react/add-on/clerk/assets/src/integrations/clerk/header-user.tsx +0 -19
- package/templates/react/add-on/clerk/assets/src/integrations/clerk/provider.tsx +0 -18
- package/templates/react/add-on/clerk/assets/src/routes/demo.clerk.tsx +0 -20
- package/templates/react/add-on/clerk/info.json +0 -13
- package/templates/react/add-on/clerk/package.json +0 -5
- package/templates/react/add-on/convex/README.md +0 -4
- package/templates/react/add-on/convex/assets/_dot_cursorrules.append +0 -93
- package/templates/react/add-on/convex/assets/_dot_env.local.append +0 -3
- package/templates/react/add-on/convex/assets/convex/products.ts +0 -8
- package/templates/react/add-on/convex/assets/convex/schema.ts +0 -10
- package/templates/react/add-on/convex/assets/src/integrations/convex/provider.tsx +0 -20
- package/templates/react/add-on/convex/assets/src/routes/demo.convex.tsx +0 -33
- package/templates/react/add-on/convex/info.json +0 -13
- package/templates/react/add-on/convex/package.json +0 -6
- package/templates/react/add-on/form/assets/src/components/demo.FormComponents.tsx.ejs +0 -300
- package/templates/react/add-on/form/assets/src/hooks/demo.form-context.ts +0 -4
- package/templates/react/add-on/form/assets/src/hooks/demo.form.ts +0 -22
- package/templates/react/add-on/form/assets/src/routes/demo.form.address.tsx.ejs +0 -213
- package/templates/react/add-on/form/assets/src/routes/demo.form.simple.tsx.ejs +0 -77
- package/templates/react/add-on/form/info.json +0 -26
- package/templates/react/add-on/form/package.json +0 -6
- package/templates/react/add-on/module-federation/assets/module-federation.config.js.ejs +0 -31
- package/templates/react/add-on/module-federation/assets/src/demo-mf-component.tsx +0 -3
- package/templates/react/add-on/module-federation/assets/src/demo-mf-self-contained.tsx +0 -11
- package/templates/react/add-on/module-federation/info.json +0 -7
- package/templates/react/add-on/module-federation/package.json +0 -5
- package/templates/react/add-on/netlify/README.md +0 -11
- package/templates/react/add-on/netlify/info.json +0 -7
- package/templates/react/add-on/sentry/assets/_dot_cursorrules.append +0 -22
- package/templates/react/add-on/sentry/assets/_dot_env.local.append +0 -11
- package/templates/react/add-on/sentry/assets/src/app/global-middleware.ts +0 -11
- package/templates/react/add-on/sentry/assets/src/routes/demo.sentry.testing.tsx +0 -489
- package/templates/react/add-on/sentry/info.json +0 -14
- package/templates/react/add-on/sentry/package.json +0 -5
- package/templates/react/add-on/shadcn/README.md +0 -7
- package/templates/react/add-on/shadcn/assets/_dot_cursorrules.append +0 -7
- package/templates/react/add-on/shadcn/assets/components.json +0 -21
- package/templates/react/add-on/shadcn/assets/src/lib/utils.ts +0 -6
- package/templates/react/add-on/shadcn/assets/src/styles.css +0 -138
- package/templates/react/add-on/shadcn/info.json +0 -7
- package/templates/react/add-on/shadcn/package.json +0 -9
- package/templates/react/add-on/start/assets/_dot_gitignore.append +0 -2
- package/templates/react/add-on/start/assets/app.config.ts.ejs +0 -32
- package/templates/react/add-on/start/assets/src/api.ts +0 -6
- package/templates/react/add-on/start/assets/src/client.tsx.ejs +0 -33
- package/templates/react/add-on/start/assets/src/router.tsx.ejs +0 -48
- package/templates/react/add-on/start/assets/src/routes/api.demo-names.ts +0 -11
- package/templates/react/add-on/start/assets/src/routes/demo.start.api-request.tsx.ejs +0 -33
- package/templates/react/add-on/start/assets/src/routes/demo.start.server-funcs.tsx +0 -50
- package/templates/react/add-on/start/assets/src/ssr.tsx.ejs +0 -30
- package/templates/react/add-on/start/info.json +0 -18
- package/templates/react/add-on/start/package.json +0 -13
- package/templates/react/add-on/store/assets/src/lib/demo-store.ts +0 -13
- package/templates/react/add-on/store/assets/src/routes/demo.store.tsx.ejs +0 -75
- package/templates/react/add-on/store/info.json +0 -13
- package/templates/react/add-on/store/package.json +0 -6
- package/templates/react/add-on/t3env/README.md +0 -16
- package/templates/react/add-on/t3env/assets/src/env.ts +0 -39
- package/templates/react/add-on/t3env/info.json +0 -10
- package/templates/react/add-on/t3env/package.json +0 -6
- package/templates/react/add-on/tRPC/assets/src/integrations/trpc/init.ts +0 -9
- package/templates/react/add-on/tRPC/assets/src/integrations/trpc/react.ts +0 -4
- package/templates/react/add-on/tRPC/assets/src/integrations/trpc/router.ts +0 -18
- package/templates/react/add-on/tRPC/assets/src/routes/api.trpc.$.tsx +0 -16
- package/templates/react/add-on/tRPC/info.json +0 -9
- package/templates/react/add-on/tRPC/package.json +0 -9
- package/templates/react/add-on/table/assets/src/data/demo-table-data.ts +0 -50
- package/templates/react/add-on/table/assets/src/routes/demo.table.tsx.ejs +0 -373
- package/templates/react/add-on/table/info.json +0 -13
- package/templates/react/add-on/table/package.json +0 -7
- package/templates/react/add-on/tanstack-query/assets/src/integrations/tanstack-query/layout.tsx +0 -5
- package/templates/react/add-on/tanstack-query/assets/src/integrations/tanstack-query/root-provider.tsx.ejs +0 -70
- package/templates/react/add-on/tanstack-query/assets/src/routes/demo.tanstack-query.tsx.ejs +0 -53
- package/templates/react/add-on/tanstack-query/info.json +0 -13
- package/templates/react/add-on/tanstack-query/package.json +0 -6
- package/templates/react/base/README.md.ejs +0 -558
- package/templates/react/base/_dot_gitignore +0 -5
- package/templates/react/base/_dot_vscode/settings.biome.json +0 -38
- package/templates/react/base/_dot_vscode/settings.json +0 -11
- package/templates/react/base/index.html.ejs +0 -20
- package/templates/react/base/package.biome.json +0 -10
- package/templates/react/base/package.eslintprettier.json +0 -11
- package/templates/react/base/package.json +0 -30
- package/templates/react/base/package.ts.json +0 -7
- package/templates/react/base/package.tw.json +0 -6
- package/templates/react/base/public/favicon.ico +0 -0
- package/templates/react/base/public/logo192.png +0 -0
- package/templates/react/base/public/logo512.png +0 -0
- package/templates/react/base/public/manifest.json +0 -25
- package/templates/react/base/public/robots.txt +0 -3
- package/templates/react/base/src/App.css +0 -38
- package/templates/react/base/src/App.test.tsx.ejs +0 -10
- package/templates/react/base/src/App.tsx.ejs +0 -74
- package/templates/react/base/src/components/Header.tsx.ejs +0 -27
- package/templates/react/base/src/logo.svg +0 -44
- package/templates/react/base/src/reportWebVitals.ts.ejs +0 -28
- package/templates/react/base/src/styles.css.ejs +0 -15
- package/templates/react/base/toolchain/.prettierignore +0 -3
- package/templates/react/base/toolchain/biome.json +0 -31
- package/templates/react/base/toolchain/eslint.config.js +0 -5
- package/templates/react/base/toolchain/prettier.config.js +0 -10
- package/templates/react/base/tsconfig.json.ejs +0 -29
- package/templates/react/base/vite.config.js.ejs +0 -23
- package/templates/react/code-router/src/main.tsx.ejs +0 -92
- package/templates/react/example/tanchat/README.md +0 -37
- package/templates/react/example/tanchat/assets/_dot_env.local.append +0 -2
- package/templates/react/example/tanchat/assets/public/example-guitar-flowers.jpg +0 -0
- package/templates/react/example/tanchat/assets/public/example-guitar-motherboard.jpg +0 -0
- package/templates/react/example/tanchat/assets/public/example-guitar-racing.jpg +0 -0
- package/templates/react/example/tanchat/assets/public/example-guitar-steamer-trunk.jpg +0 -0
- package/templates/react/example/tanchat/assets/public/example-guitar-superhero.jpg +0 -0
- package/templates/react/example/tanchat/assets/public/example-guitar-traveling.jpg +0 -0
- package/templates/react/example/tanchat/assets/public/example-guitar-video-games.jpg +0 -0
- package/templates/react/example/tanchat/assets/src/components/example-AIAssistant.tsx +0 -173
- package/templates/react/example/tanchat/assets/src/components/example-GuitarRecommendation.tsx +0 -47
- package/templates/react/example/tanchat/assets/src/data/example-guitars.ts +0 -83
- package/templates/react/example/tanchat/assets/src/demo.index.css +0 -220
- package/templates/react/example/tanchat/assets/src/integrations/tanchat/header-user.tsx +0 -5
- package/templates/react/example/tanchat/assets/src/routes/api.messages.ts +0 -24
- package/templates/react/example/tanchat/assets/src/routes/api.sse.ts +0 -23
- package/templates/react/example/tanchat/assets/src/routes/example.chat.tsx +0 -159
- package/templates/react/example/tanchat/assets/src/routes/example.guitars/$guitarId.tsx +0 -50
- package/templates/react/example/tanchat/assets/src/routes/example.guitars/index.tsx +0 -54
- package/templates/react/example/tanchat/assets/src/store/example-assistant.ts +0 -3
- package/templates/react/example/tanchat/assets/src/utils/demo.ai.ts +0 -62
- package/templates/react/example/tanchat/assets/src/utils/demo.sse.ts +0 -31
- package/templates/react/example/tanchat/assets/src/utils/demo.tools.ts +0 -47
- package/templates/react/example/tanchat/info.json +0 -19
- package/templates/react/example/tanchat/package.json +0 -16
- package/templates/react/file-router/package.fr.json +0 -5
- package/templates/react/file-router/src/main.tsx.ejs +0 -55
- package/templates/react/file-router/src/routes/__root.tsx.ejs +0 -82
- package/templates/solid/add-on/form/assets/src/routes/demo.form.tsx.ejs +0 -352
- package/templates/solid/add-on/form/info.json +0 -13
- package/templates/solid/add-on/form/package.json +0 -5
- package/templates/solid/add-on/module-federation/assets/module-federation.config.js.ejs +0 -27
- package/templates/solid/add-on/module-federation/assets/src/demo-mf-component.tsx +0 -3
- package/templates/solid/add-on/module-federation/assets/src/demo-mf-self-contained.tsx +0 -9
- package/templates/solid/add-on/module-federation/info.json +0 -7
- package/templates/solid/add-on/module-federation/package.json +0 -5
- package/templates/solid/add-on/sentry/assets/_dot_cursorrules.append +0 -22
- package/templates/solid/add-on/sentry/assets/_dot_env.local.append +0 -2
- package/templates/solid/add-on/sentry/assets/src/routes/demo.sentry.bad-event-handler.tsx +0 -20
- package/templates/solid/add-on/sentry/info.json +0 -13
- package/templates/solid/add-on/sentry/package.json +0 -5
- package/templates/solid/add-on/solid-ui/README.md +0 -9
- package/templates/solid/add-on/solid-ui/assets/src/lib/utils.ts +0 -6
- package/templates/solid/add-on/solid-ui/assets/src/styles.css +0 -138
- package/templates/solid/add-on/solid-ui/assets/ui.config.json +0 -13
- package/templates/solid/add-on/solid-ui/info.json +0 -11
- package/templates/solid/add-on/solid-ui/package.json +0 -9
- package/templates/solid/add-on/start/assets/app.config.ts +0 -16
- package/templates/solid/add-on/start/assets/src/api.ts +0 -6
- package/templates/solid/add-on/start/assets/src/client.tsx +0 -7
- package/templates/solid/add-on/start/assets/src/router.tsx.ejs +0 -24
- package/templates/solid/add-on/start/assets/src/routes/demo.start.server-funcs.tsx +0 -49
- package/templates/solid/add-on/start/assets/src/ssr.tsx +0 -12
- package/templates/solid/add-on/start/info.json +0 -14
- package/templates/solid/add-on/start/package.json +0 -12
- package/templates/solid/add-on/store/assets/src/lib/demo-store.ts +0 -13
- package/templates/solid/add-on/store/assets/src/routes/demo.store.tsx.ejs +0 -77
- package/templates/solid/add-on/store/info.json +0 -13
- package/templates/solid/add-on/store/package.json +0 -6
- package/templates/solid/add-on/t3env/README.md +0 -16
- package/templates/solid/add-on/t3env/assets/src/env.ts +0 -39
- package/templates/solid/add-on/t3env/info.json +0 -10
- package/templates/solid/add-on/t3env/package.json +0 -6
- package/templates/solid/add-on/tanstack-query/assets/src/integrations/tanstack-query/header-user.tsx +0 -5
- package/templates/solid/add-on/tanstack-query/assets/src/integrations/tanstack-query/provider.tsx +0 -15
- package/templates/solid/add-on/tanstack-query/assets/src/routes/demo.tanstack-query.tsx +0 -30
- package/templates/solid/add-on/tanstack-query/info.json +0 -13
- package/templates/solid/add-on/tanstack-query/package.json +0 -6
- package/templates/solid/base/README.md.ejs +0 -215
- package/templates/solid/base/_dot_cursorrules.append +0 -35
- package/templates/solid/base/_dot_gitignore +0 -5
- package/templates/solid/base/_dot_vscode/settings.biome.json +0 -38
- package/templates/solid/base/_dot_vscode/settings.json +0 -11
- package/templates/solid/base/index.html.ejs +0 -20
- package/templates/solid/base/package.biome.json +0 -10
- package/templates/solid/base/package.eslintprettier.json +0 -11
- package/templates/solid/base/package.json +0 -23
- package/templates/solid/base/package.ts.json +0 -5
- package/templates/solid/base/package.tw.json +0 -6
- package/templates/solid/base/public/favicon.ico +0 -0
- package/templates/solid/base/public/logo192.png +0 -0
- package/templates/solid/base/public/logo512.png +0 -0
- package/templates/solid/base/public/manifest.json +0 -25
- package/templates/solid/base/public/robots.txt +0 -3
- package/templates/solid/base/src/App.css +0 -0
- package/templates/solid/base/src/App.tsx.ejs +0 -47
- package/templates/solid/base/src/components/Header.tsx.ejs +0 -26
- package/templates/solid/base/src/logo.svg +0 -120
- package/templates/solid/base/src/styles.css.ejs +0 -15
- package/templates/solid/base/toolchain/.prettierignore +0 -3
- package/templates/solid/base/toolchain/biome.json +0 -31
- package/templates/solid/base/toolchain/eslint.config.js +0 -5
- package/templates/solid/base/toolchain/prettier.config.js +0 -10
- package/templates/solid/base/tsconfig.json.ejs +0 -31
- package/templates/solid/base/vite.config.js.ejs +0 -22
- package/templates/solid/code-router/src/main.tsx.ejs +0 -71
- package/templates/solid/example/tanchat/README.md +0 -52
- package/templates/solid/example/tanchat/assets/ai-streaming-server/README.md +0 -110
- package/templates/solid/example/tanchat/assets/ai-streaming-server/_dot_env.example +0 -1
- package/templates/solid/example/tanchat/assets/ai-streaming-server/package.json +0 -26
- package/templates/solid/example/tanchat/assets/ai-streaming-server/src/index.ts +0 -102
- package/templates/solid/example/tanchat/assets/ai-streaming-server/tsconfig.json +0 -15
- package/templates/solid/example/tanchat/assets/src/components/demo.SettingsDialog.tsx +0 -149
- package/templates/solid/example/tanchat/assets/src/demo.index.css +0 -227
- package/templates/solid/example/tanchat/assets/src/lib/demo-store.ts +0 -13
- package/templates/solid/example/tanchat/assets/src/routes/example.chat.tsx +0 -435
- package/templates/solid/example/tanchat/assets/src/store/demo.hooks.ts +0 -17
- package/templates/solid/example/tanchat/assets/src/store/demo.store.ts +0 -133
- package/templates/solid/example/tanchat/info.json +0 -14
- package/templates/solid/example/tanchat/package.json +0 -7
- package/templates/solid/file-router/package.fr.json +0 -5
- package/templates/solid/file-router/src/main.tsx.ejs +0 -47
- package/templates/solid/file-router/src/routes/__root.tsx.ejs +0 -41
- package/templates/solid/file-router/src/routes/index.tsx +0 -43
- package/tests/cra.test.ts +0 -293
- package/tests/snapshots/cra/cr-js-npm.json +0 -33
- package/tests/snapshots/cra/cr-ts-npm.json +0 -34
- package/tests/snapshots/cra/cr-ts-start-npm.json +0 -38
- package/tests/snapshots/cra/fr-ts-npm.json +0 -34
- package/tests/snapshots/cra/fr-ts-tw-npm.json +0 -33
- package/tests/snapshots/cra/solid-cr-js-npm.json +0 -31
- package/tests/snapshots/cra/solid-cr-ts-npm.json +0 -32
- package/tests/snapshots/cra/solid-cr-ts-start-npm.json +0 -36
- package/tests/snapshots/cra/solid-fr-ts-npm.json +0 -33
- package/tests/snapshots/cra/solid-fr-ts-tw-npm.json +0 -32
- package/tests/test-utilities.ts +0 -87
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { <% if (fileRouter) { %>createFileRoute<% } else { %>createRoute<% } %> } from '@tanstack/react-router'
|
|
2
|
-
|
|
3
|
-
import { useAppForm } from '../hooks/demo.form'
|
|
4
|
-
|
|
5
|
-
<% if (codeRouter) { %>
|
|
6
|
-
import type { RootRoute } from '@tanstack/react-router'
|
|
7
|
-
<% } else { %>
|
|
8
|
-
export const Route = createFileRoute('/demo/form')({
|
|
9
|
-
component: AddressForm,
|
|
10
|
-
})
|
|
11
|
-
<% } %>
|
|
12
|
-
|
|
13
|
-
function AddressForm() {
|
|
14
|
-
const form = useAppForm({
|
|
15
|
-
defaultValues: {
|
|
16
|
-
fullName: '',
|
|
17
|
-
email: '',
|
|
18
|
-
address: {
|
|
19
|
-
street: '',
|
|
20
|
-
city: '',
|
|
21
|
-
state: '',
|
|
22
|
-
zipCode: '',
|
|
23
|
-
country: '',
|
|
24
|
-
},
|
|
25
|
-
phone: '',
|
|
26
|
-
},
|
|
27
|
-
validators: {
|
|
28
|
-
onBlur: ({ value }) => {
|
|
29
|
-
const errors = {
|
|
30
|
-
fields: {},
|
|
31
|
-
} as {
|
|
32
|
-
fields: Record<string, string>
|
|
33
|
-
}
|
|
34
|
-
if (value.fullName.trim().length === 0) {
|
|
35
|
-
errors.fields.fullName = 'Full name is required'
|
|
36
|
-
}
|
|
37
|
-
return errors
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
onSubmit: ({ value }) => {
|
|
41
|
-
console.log(value)
|
|
42
|
-
// Show success message
|
|
43
|
-
alert('Form submitted successfully!')
|
|
44
|
-
},
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<div
|
|
49
|
-
className="flex items-center justify-center min-h-screen bg-gradient-to-br from-purple-100 to-blue-100 p-4 text-white"
|
|
50
|
-
style={{
|
|
51
|
-
backgroundImage:
|
|
52
|
-
'radial-gradient(50% 50% at 5% 40%, #f4a460 0%, #8b4513 70%, #1a0f0a 100%)',
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
<div className="w-full max-w-2xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10">
|
|
56
|
-
<form
|
|
57
|
-
onSubmit={(e) => {
|
|
58
|
-
e.preventDefault()
|
|
59
|
-
e.stopPropagation()
|
|
60
|
-
form.handleSubmit()
|
|
61
|
-
}}
|
|
62
|
-
className="space-y-6"
|
|
63
|
-
>
|
|
64
|
-
<form.AppField name="fullName">
|
|
65
|
-
{(field) => <field.TextField label="Full Name" />}
|
|
66
|
-
</form.AppField>
|
|
67
|
-
|
|
68
|
-
<form.AppField
|
|
69
|
-
name="email"
|
|
70
|
-
validators={{
|
|
71
|
-
onBlur: ({ value }) => {
|
|
72
|
-
if (!value || value.trim().length === 0) {
|
|
73
|
-
return 'Email is required'
|
|
74
|
-
}
|
|
75
|
-
if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(value)) {
|
|
76
|
-
return 'Invalid email address'
|
|
77
|
-
}
|
|
78
|
-
return undefined
|
|
79
|
-
},
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
{(field) => <field.TextField label="Email" />}
|
|
83
|
-
</form.AppField>
|
|
84
|
-
|
|
85
|
-
<form.AppField
|
|
86
|
-
name="address.street"
|
|
87
|
-
validators={{
|
|
88
|
-
onBlur: ({ value }) => {
|
|
89
|
-
if (!value || value.trim().length === 0) {
|
|
90
|
-
return 'Street address is required'
|
|
91
|
-
}
|
|
92
|
-
return undefined
|
|
93
|
-
},
|
|
94
|
-
}}
|
|
95
|
-
>
|
|
96
|
-
{(field) => <field.TextField label="Street Address" />}
|
|
97
|
-
</form.AppField>
|
|
98
|
-
|
|
99
|
-
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
100
|
-
<form.AppField
|
|
101
|
-
name="address.city"
|
|
102
|
-
validators={{
|
|
103
|
-
onBlur: ({ value }) => {
|
|
104
|
-
if (!value || value.trim().length === 0) {
|
|
105
|
-
return 'City is required'
|
|
106
|
-
}
|
|
107
|
-
return undefined
|
|
108
|
-
},
|
|
109
|
-
}}
|
|
110
|
-
>
|
|
111
|
-
{(field) => <field.TextField label="City" />}
|
|
112
|
-
</form.AppField>
|
|
113
|
-
<form.AppField
|
|
114
|
-
name="address.state"
|
|
115
|
-
validators={{
|
|
116
|
-
onBlur: ({ value }) => {
|
|
117
|
-
if (!value || value.trim().length === 0) {
|
|
118
|
-
return 'State is required'
|
|
119
|
-
}
|
|
120
|
-
return undefined
|
|
121
|
-
},
|
|
122
|
-
}}
|
|
123
|
-
>
|
|
124
|
-
{(field) => <field.TextField label="State" />}
|
|
125
|
-
</form.AppField>
|
|
126
|
-
<form.AppField
|
|
127
|
-
name="address.zipCode"
|
|
128
|
-
validators={{
|
|
129
|
-
onBlur: ({ value }) => {
|
|
130
|
-
if (!value || value.trim().length === 0) {
|
|
131
|
-
return 'Zip code is required'
|
|
132
|
-
}
|
|
133
|
-
if (!/^\d{5}(-\d{4})?$/.test(value)) {
|
|
134
|
-
return 'Invalid zip code format'
|
|
135
|
-
}
|
|
136
|
-
return undefined
|
|
137
|
-
},
|
|
138
|
-
}}
|
|
139
|
-
>
|
|
140
|
-
{(field) => <field.TextField label="Zip Code" />}
|
|
141
|
-
</form.AppField>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
<form.AppField
|
|
145
|
-
name="address.country"
|
|
146
|
-
validators={{
|
|
147
|
-
onBlur: ({ value }) => {
|
|
148
|
-
if (!value || value.trim().length === 0) {
|
|
149
|
-
return 'Country is required'
|
|
150
|
-
}
|
|
151
|
-
return undefined
|
|
152
|
-
},
|
|
153
|
-
}}
|
|
154
|
-
>
|
|
155
|
-
{(field) => (
|
|
156
|
-
<field.Select
|
|
157
|
-
label="Country"
|
|
158
|
-
values={[
|
|
159
|
-
{ label: 'United States', value: 'US' },
|
|
160
|
-
{ label: 'Canada', value: 'CA' },
|
|
161
|
-
{ label: 'United Kingdom', value: 'UK' },
|
|
162
|
-
{ label: 'Australia', value: 'AU' },
|
|
163
|
-
{ label: 'Germany', value: 'DE' },
|
|
164
|
-
{ label: 'France', value: 'FR' },
|
|
165
|
-
{ label: 'Japan', value: 'JP' },
|
|
166
|
-
]}
|
|
167
|
-
placeholder="Select a country"
|
|
168
|
-
/>
|
|
169
|
-
)}
|
|
170
|
-
</form.AppField>
|
|
171
|
-
|
|
172
|
-
<form.AppField
|
|
173
|
-
name="phone"
|
|
174
|
-
validators={{
|
|
175
|
-
onBlur: ({ value }) => {
|
|
176
|
-
if (!value || value.trim().length === 0) {
|
|
177
|
-
return 'Phone number is required'
|
|
178
|
-
}
|
|
179
|
-
if (
|
|
180
|
-
!/^(\+\d{1,3})?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/.test(
|
|
181
|
-
value,
|
|
182
|
-
)
|
|
183
|
-
) {
|
|
184
|
-
return 'Invalid phone number format'
|
|
185
|
-
}
|
|
186
|
-
return undefined
|
|
187
|
-
},
|
|
188
|
-
}}
|
|
189
|
-
>
|
|
190
|
-
{(field) => (
|
|
191
|
-
<field.TextField label="Phone" placeholder="123-456-7890" />
|
|
192
|
-
)}
|
|
193
|
-
</form.AppField>
|
|
194
|
-
|
|
195
|
-
<div className="flex justify-end">
|
|
196
|
-
<form.AppForm>
|
|
197
|
-
<form.SubscribeButton label="Submit" />
|
|
198
|
-
</form.AppForm>
|
|
199
|
-
</div>
|
|
200
|
-
</form>
|
|
201
|
-
</div>
|
|
202
|
-
</div>
|
|
203
|
-
)
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
<% if (codeRouter) { %>
|
|
208
|
-
export default (parentRoute: RootRoute) => createRoute({
|
|
209
|
-
path: '/demo/form/address',
|
|
210
|
-
component: AddressForm,
|
|
211
|
-
getParentRoute: () => parentRoute,
|
|
212
|
-
})
|
|
213
|
-
<% } %>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { <% if (fileRouter) { %>createFileRoute<% } else { %>createRoute<% } %> } from '@tanstack/react-router'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { useAppForm } from '../hooks/demo.form'
|
|
5
|
-
|
|
6
|
-
<% if (codeRouter) { %>
|
|
7
|
-
import type { RootRoute } from '@tanstack/react-router'
|
|
8
|
-
<% } else { %>
|
|
9
|
-
export const Route = createFileRoute('/demo/form')({
|
|
10
|
-
component: SimpleForm,
|
|
11
|
-
})
|
|
12
|
-
<% } %>
|
|
13
|
-
|
|
14
|
-
const schema = z.object({
|
|
15
|
-
title: z.string().min(1, 'Title is required'),
|
|
16
|
-
description: z.string().min(1, 'Description is required'),
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
function SimpleForm() {
|
|
20
|
-
const form = useAppForm({
|
|
21
|
-
defaultValues: {
|
|
22
|
-
title: '',
|
|
23
|
-
description: '',
|
|
24
|
-
},
|
|
25
|
-
validators: {
|
|
26
|
-
onBlur: schema,
|
|
27
|
-
},
|
|
28
|
-
onSubmit: ({ value }) => {
|
|
29
|
-
console.log(value)
|
|
30
|
-
// Show success message
|
|
31
|
-
alert('Form submitted successfully!')
|
|
32
|
-
},
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<div
|
|
37
|
-
className="flex items-center justify-center min-h-screen bg-gradient-to-br from-purple-100 to-blue-100 p-4 text-white"
|
|
38
|
-
style={{
|
|
39
|
-
backgroundImage:
|
|
40
|
-
'radial-gradient(50% 50% at 5% 40%, #add8e6 0%, #0000ff 70%, #00008b 100%)',
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
<div className="w-full max-w-2xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10">
|
|
44
|
-
<form
|
|
45
|
-
onSubmit={(e) => {
|
|
46
|
-
e.preventDefault()
|
|
47
|
-
e.stopPropagation()
|
|
48
|
-
form.handleSubmit()
|
|
49
|
-
}}
|
|
50
|
-
className="space-y-6"
|
|
51
|
-
>
|
|
52
|
-
<form.AppField name="title">
|
|
53
|
-
{(field) => <field.TextField label="Title" />}
|
|
54
|
-
</form.AppField>
|
|
55
|
-
|
|
56
|
-
<form.AppField name="description">
|
|
57
|
-
{(field) => <field.TextArea label="Description" />}
|
|
58
|
-
</form.AppField>
|
|
59
|
-
|
|
60
|
-
<div className="flex justify-end">
|
|
61
|
-
<form.AppForm>
|
|
62
|
-
<form.SubscribeButton label="Submit" />
|
|
63
|
-
</form.AppForm>
|
|
64
|
-
</div>
|
|
65
|
-
</form>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
<% if (codeRouter) { %>
|
|
72
|
-
export default (parentRoute: RootRoute) => createRoute({
|
|
73
|
-
path: '/demo/form/simple',
|
|
74
|
-
component: SimpleForm,
|
|
75
|
-
getParentRoute: () => parentRoute,
|
|
76
|
-
})
|
|
77
|
-
<% } %>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Form",
|
|
3
|
-
"description": "TanStack Form",
|
|
4
|
-
"phase": "add-on",
|
|
5
|
-
"templates": ["file-router", "code-router"],
|
|
6
|
-
"link": "https://tanstack.com/form/latest",
|
|
7
|
-
"routes": [
|
|
8
|
-
{
|
|
9
|
-
"url": "/demo/form/simple",
|
|
10
|
-
"name": "Simple Form"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"url": "/demo/form/address",
|
|
14
|
-
"name": "Address Form"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"shadcnComponents": [
|
|
18
|
-
"button",
|
|
19
|
-
"select",
|
|
20
|
-
"input",
|
|
21
|
-
"textarea",
|
|
22
|
-
"slider",
|
|
23
|
-
"switch",
|
|
24
|
-
"label"
|
|
25
|
-
]
|
|
26
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import packageJSON from './package.json'
|
|
2
|
-
|
|
3
|
-
function remoteConfig(name, url) {
|
|
4
|
-
return {
|
|
5
|
-
type: 'module',
|
|
6
|
-
name,
|
|
7
|
-
entry: url,
|
|
8
|
-
entryGlobalName: 'remote',
|
|
9
|
-
shareScope: 'default',
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
filename: 'remoteEntry.js',
|
|
15
|
-
name: '<%= projectName %>',
|
|
16
|
-
exposes: {
|
|
17
|
-
'./DemoMfComponent': './src/demo-mf-component.tsx',
|
|
18
|
-
'./DemoMfSelfContained': './src/demo-mf-self-contained.tsx',
|
|
19
|
-
},
|
|
20
|
-
remotes: {},
|
|
21
|
-
shared: {
|
|
22
|
-
react: {
|
|
23
|
-
singleton: true,
|
|
24
|
-
requiredVersion: packageJSON.dependencies.react,
|
|
25
|
-
},
|
|
26
|
-
'react-dom': {
|
|
27
|
-
singleton: true,
|
|
28
|
-
requiredVersion: packageJSON.dependencies['react-dom'],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import ReactDOM from 'react-dom/client'
|
|
3
|
-
|
|
4
|
-
function App() {
|
|
5
|
-
return <div>Hello from self-contained module federation</div>
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function DemoMfSelfContained(rootElement: HTMLElement) {
|
|
9
|
-
const root = ReactDOM.createRoot(rootElement)
|
|
10
|
-
root.render(<App />)
|
|
11
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
We use Sentry for watching for errors in our deployed application, as well as for instrumentation of our application.
|
|
2
|
-
|
|
3
|
-
## Error collection
|
|
4
|
-
|
|
5
|
-
Error collection is automatic and configured in `src/router.tsx`.
|
|
6
|
-
|
|
7
|
-
## Instrumentation
|
|
8
|
-
|
|
9
|
-
We want our server functions instrumented. So if you see a function name like `createServerFn`, you can instrument it with Sentry. You'll need to import `Sentry`:
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
import * as Sentry from '@sentry/tanstackstart-react'
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
And then wrap the implementation of the server function with `Sentry.startSpan`, like so:
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
Sentry.startSpan({ name: 'Requesting all the pokemon' }, async () => {
|
|
19
|
-
// Some lengthy operation here
|
|
20
|
-
await fetch('https://api.pokemon.com/data/')
|
|
21
|
-
})
|
|
22
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Your Sentry DSN (from your Sentry account)
|
|
2
|
-
VITE_SENTRY_DSN=
|
|
3
|
-
|
|
4
|
-
# Your Sentry organization (from your Sentry account)
|
|
5
|
-
VITE_SENTRY_ORG=
|
|
6
|
-
|
|
7
|
-
# Your Sentry project (from your Sentry account)
|
|
8
|
-
VITE_SENTRY_PROJECT=
|
|
9
|
-
|
|
10
|
-
# Your Sentry authentication token (from your Sentry account)
|
|
11
|
-
SENTRY_AUTH_TOKEN=
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/tanstackstart-react";
|
|
2
|
-
import {
|
|
3
|
-
createMiddleware,
|
|
4
|
-
registerGlobalMiddleware,
|
|
5
|
-
} from "@tanstack/react-start";
|
|
6
|
-
|
|
7
|
-
registerGlobalMiddleware({
|
|
8
|
-
middleware: [
|
|
9
|
-
createMiddleware().server(Sentry.sentryGlobalServerMiddlewareHandler()),
|
|
10
|
-
],
|
|
11
|
-
});
|