create-fate 1.0.2 → 1.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fate",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Create a new fate app.",
5
5
  "homepage": "https://github.com/nkzw-tech/fate",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  "@nkzw/stack": "^2.3.2",
24
24
  "@radix-ui/react-slot": "^1.2.4",
25
25
  "@trpc/client": "^11.17.0",
26
- "@void/react": "^0.7.6",
26
+ "@void/react": "^0.7.13",
27
27
  "better-auth": "^1.6.9",
28
28
  "class-variance-authority": "^0.7.1",
29
29
  "clsx": "^2.1.1",
@@ -34,7 +34,7 @@
34
34
  "react-error-boundary": "^6.1.1",
35
35
  "react-fate": "latest",
36
36
  "tailwind-merge": "^3.5.0",
37
- "void": "^0.7.6"
37
+ "void": "^0.7.13"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@nkzw/babel-preset-fbtee": "^1.7.4",
@@ -22,7 +22,7 @@
22
22
  "@nkzw/define-env": "^1.1.0",
23
23
  "@nkzw/stack": "^2.3.2",
24
24
  "@radix-ui/react-slot": "^1.2.4",
25
- "@void/react": "^0.7.6",
25
+ "@void/react": "^0.7.13",
26
26
  "better-auth": "^1.6.9",
27
27
  "class-variance-authority": "^0.7.1",
28
28
  "clsx": "^2.1.1",
@@ -33,7 +33,7 @@
33
33
  "react-error-boundary": "^6.1.1",
34
34
  "react-fate": "latest",
35
35
  "tailwind-merge": "^3.5.0",
36
- "void": "^0.7.6"
36
+ "void": "^0.7.13"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@nkzw/babel-preset-fbtee": "^1.7.4",
@@ -23,7 +23,7 @@
23
23
  "@nkzw/stack": "^2.3.2",
24
24
  "@radix-ui/react-slot": "^1.2.4",
25
25
  "@trpc/client": "^11.17.0",
26
- "@void/react": "^0.7.6",
26
+ "@void/react": "^0.7.13",
27
27
  "better-auth": "^1.6.9",
28
28
  "class-variance-authority": "^0.7.1",
29
29
  "clsx": "^2.1.1",
@@ -34,7 +34,7 @@
34
34
  "react-error-boundary": "^6.1.1",
35
35
  "react-fate": "latest",
36
36
  "tailwind-merge": "^3.5.0",
37
- "void": "^0.7.6"
37
+ "void": "^0.7.13"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@nkzw/babel-preset-fbtee": "^1.7.4",
@@ -0,0 +1,9 @@
1
+ .fate/
2
+ .void/
3
+ .eslintcache
4
+ .pnpm-debug.log
5
+ node_modules/
6
+ coverage/
7
+ dist/
8
+ tsconfig.tsbuildinfo
9
+ vite.config.ts.timestamp-*
@@ -24,7 +24,7 @@
24
24
  "@nkzw/fate": "latest",
25
25
  "@nkzw/stack": "^2.3.2",
26
26
  "@radix-ui/react-slot": "^1.2.4",
27
- "@void/react": "^0.7.6",
27
+ "@void/react": "^0.7.13",
28
28
  "better-auth": "^1.6.9",
29
29
  "class-variance-authority": "^0.7.1",
30
30
  "clsx": "^2.1.1",
@@ -35,7 +35,7 @@
35
35
  "react-error-boundary": "^6.1.1",
36
36
  "react-fate": "latest",
37
37
  "tailwind-merge": "^3.5.0",
38
- "void": "^0.7.6",
38
+ "void": "^0.7.13",
39
39
  "void-fate": "latest",
40
40
  "zod": "^4.4.3"
41
41
  },
@@ -3,7 +3,7 @@ import { useRouter, useShared } from '@void/react';
3
3
  import { ExternalLinkIcon } from 'lucide-react';
4
4
  import { useActionState, useEffect, useState } from 'react';
5
5
  import type { SharedData } from '../src/lib/shared.ts';
6
- import { Button } from '../src/ui/Button.tsx';
6
+ import { AsyncButton } from '../src/ui/Button.tsx';
7
7
  import Card from '../src/ui/Card.tsx';
8
8
  import H2 from '../src/ui/H2.tsx';
9
9
  import Input from '../src/ui/Input.tsx';
@@ -71,9 +71,9 @@ export default function LoginPage() {
71
71
  value={password}
72
72
  />
73
73
  <div>
74
- <Button type="submit" variant="outline">
74
+ <AsyncButton type="submit" variant="outline">
75
75
  Sign In
76
- </Button>
76
+ </AsyncButton>
77
77
  </div>
78
78
  </VStack>
79
79
  </Stack>
@@ -1,12 +1,6 @@
1
1
  import { Slot } from '@radix-ui/react-slot';
2
2
  import { cva, type VariantProps } from 'class-variance-authority';
3
- import {
4
- type ButtonHTMLAttributes,
5
- type MouseEvent,
6
- type ReactNode,
7
- useOptimistic,
8
- useTransition,
9
- } from 'react';
3
+ import { type ButtonHTMLAttributes, type ReactNode, useOptimistic, useTransition } from 'react';
10
4
  import { useFormStatus } from 'react-dom';
11
5
  import cx from '../lib/cx.tsx';
12
6
 
@@ -39,13 +33,41 @@ const buttonVariants = cva(
39
33
  const Button = ({
40
34
  action,
41
35
  asChild = false,
42
- children,
43
36
  className,
44
37
  disabled,
45
38
  onClick: initialOnClick,
39
+ size,
40
+ variant,
41
+ ...props
42
+ }: ButtonHTMLAttributes<HTMLButtonElement> &
43
+ VariantProps<typeof buttonVariants> & {
44
+ action?: () => void;
45
+ asChild?: boolean;
46
+ }) => {
47
+ const Component = asChild ? Slot : 'button';
48
+
49
+ const [isPending, startTransition] = useTransition();
50
+
51
+ const onClick = initialOnClick || (action ? () => startTransition(action) : undefined);
52
+
53
+ return (
54
+ <Component
55
+ className={cx(buttonVariants({ className, size, variant }))}
56
+ disabled={disabled !== undefined ? disabled : isPending}
57
+ onClick={onClick}
58
+ {...props}
59
+ />
60
+ );
61
+ };
62
+
63
+ const AsyncButton = ({
64
+ action,
65
+ asChild = false,
66
+ children,
67
+ className,
68
+ disabled,
46
69
  pendingPlaceholder = '...',
47
70
  size,
48
- type,
49
71
  variant,
50
72
  ...props
51
73
  }: ButtonHTMLAttributes<HTMLButtonElement> &
@@ -60,28 +82,22 @@ const Button = ({
60
82
  const [transitionIsPending, startTransition] = useTransition();
61
83
  const { pending: formIsPending } = useFormStatus();
62
84
 
63
- const onClick = (event: MouseEvent<HTMLButtonElement>) => {
64
- initialOnClick?.(event);
65
-
66
- if (!action || event.defaultPrevented) {
67
- return;
68
- }
69
-
70
- event.preventDefault();
71
- startTransition(async () => {
72
- setOptimisticIsPending(true);
73
- await action();
74
- });
75
- };
76
-
77
85
  const isPending = transitionIsPending || optimisticIsPending || formIsPending;
78
86
 
87
+ const onClick = action
88
+ ? () => {
89
+ startTransition(async () => {
90
+ setOptimisticIsPending(true);
91
+ await action();
92
+ });
93
+ }
94
+ : undefined;
95
+
79
96
  return (
80
97
  <Component
81
98
  className={cx(buttonVariants({ className, size, variant }))}
82
99
  disabled={disabled || isPending || undefined}
83
- onClick={initialOnClick || action ? onClick : undefined}
84
- type={type}
100
+ onClick={onClick}
85
101
  {...props}
86
102
  >
87
103
  {isPending ? pendingPlaceholder : children}
@@ -89,4 +105,4 @@ const Button = ({
89
105
  );
90
106
  };
91
107
 
92
- export { Button, buttonVariants };
108
+ export { AsyncButton, Button, buttonVariants };
@@ -9,29 +9,25 @@ import { voidPlugin } from 'void';
9
9
  const isTest = process.env.NODE_ENV === 'test' || process.env.VITEST;
10
10
 
11
11
  export default defineConfig({
12
+ optimizeDeps: {
13
+ exclude: ['@nkzw/fate/client', 'react-fate/client', 'void-fate/react'],
14
+ },
12
15
  environments: {
13
16
  void_worker: {
14
17
  optimizeDeps: {
15
- include: [
16
- '@nkzw/core/safeParse.js',
18
+ exclude: [
19
+ '@nkzw/fate/client',
20
+ '@nkzw/fate/server',
17
21
  '@nkzw/stack',
18
22
  '@radix-ui/react-slot',
19
23
  '@void/react',
20
24
  '@void/react/pages-server',
21
- 'better-auth',
22
- 'better-auth/adapters/drizzle',
23
- 'better-auth/plugins',
24
- 'class-variance-authority',
25
- 'clsx',
26
- 'drizzle-orm',
27
25
  'lucide-react',
28
- 'react',
29
26
  'react-error-boundary',
30
- 'react/jsx-dev-runtime',
31
- 'react/jsx-runtime',
32
- 'tailwind-merge',
33
- 'void/schema-d1',
34
- 'zod',
27
+ 'react-fate',
28
+ 'react-fate/client',
29
+ 'void-fate/react',
30
+ 'void-fate/server',
35
31
  ],
36
32
  },
37
33
  },
@@ -77,7 +73,6 @@ export default defineConfig({
77
73
  transport: 'void',
78
74
  }),
79
75
  ],
80
- resolve: { conditions: ['@nkzw/source'] },
81
76
  server: { port: 6001 },
82
77
  ssr: { noExternal: ['void-fate'] },
83
78
  });
@@ -1,23 +0,0 @@
1
- {
2
- "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
- "singleQuote": true,
4
- "experimentalSortImports": {
5
- "newlinesBetween": false,
6
- },
7
- "experimentalSortPackageJson": {
8
- "sortScripts": true,
9
- },
10
- "experimentalTailwindcss": {
11
- "stylesheet": "client/src/App.css",
12
- },
13
- "ignorePatterns": [
14
- "client/dist/",
15
- "client/index.html",
16
- "client/src/fate.ts",
17
- "client/src/translations/",
18
- "coverage/",
19
- "dist/",
20
- "pnpm-lock.yaml",
21
- "server/dist",
22
- ],
23
- }
@@ -1,23 +0,0 @@
1
- {
2
- "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
- "singleQuote": true,
4
- "experimentalSortImports": {
5
- "newlinesBetween": false,
6
- },
7
- "experimentalSortPackageJson": {
8
- "sortScripts": true,
9
- },
10
- "experimentalTailwindcss": {
11
- "stylesheet": "client/src/App.css",
12
- },
13
- "ignorePatterns": [
14
- "client/dist/",
15
- "client/index.html",
16
- "client/src/fate.ts",
17
- "client/src/translations/",
18
- "coverage/",
19
- "dist/",
20
- "pnpm-lock.yaml",
21
- "server/dist",
22
- ],
23
- }
@@ -1,23 +0,0 @@
1
- {
2
- "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
- "singleQuote": true,
4
- "experimentalSortImports": {
5
- "newlinesBetween": false,
6
- },
7
- "experimentalSortPackageJson": {
8
- "sortScripts": true,
9
- },
10
- "experimentalTailwindcss": {
11
- "stylesheet": "client/src/App.css",
12
- },
13
- "ignorePatterns": [
14
- "client/dist/",
15
- "client/index.html",
16
- "client/src/fate.ts",
17
- "client/src/translations/",
18
- "coverage/",
19
- "dist/",
20
- "pnpm-lock.yaml",
21
- "server/dist",
22
- ],
23
- }
@@ -1,14 +0,0 @@
1
- {
2
- "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
- "singleQuote": true,
4
- "experimentalSortImports": {
5
- "newlinesBetween": false,
6
- },
7
- "experimentalSortPackageJson": {
8
- "sortScripts": true,
9
- },
10
- "experimentalTailwindcss": {
11
- "stylesheet": "src/App.css",
12
- },
13
- "ignorePatterns": [".fate/", ".void/", "dist/", "node_modules/", "pnpm-lock.yaml"],
14
- }