create-auto-app 1.33.0 → 1.35.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/package.json +2 -2
- package/templates/typical/.context/components-db.json +4006 -0
- package/templates/typical/.gitignore +1 -1
- package/templates/typical/auto.config.ts +85 -80
- package/templates/typical/client/.claude-auto/.claude.hooks.json +0 -28
- package/templates/typical/client/.gitignore +0 -4
- package/templates/typical/client/.storybook/main.ts +0 -66
- package/templates/typical/client/.storybook/manager-head.html +0 -154
- package/templates/typical/client/.storybook/manager.ts +0 -164
- package/templates/typical/client/.storybook/preview-head.html +0 -31
- package/templates/typical/client/.storybook/preview.tsx +0 -120
- package/templates/typical/client/codegen.ts +0 -17
- package/templates/typical/client/components.json +0 -29
- package/templates/typical/client/index.html +0 -12
- package/templates/typical/client/package.json +0 -69
- package/templates/typical/client/pnpm-lock.yaml +0 -7868
- package/templates/typical/client/public/blank.svg +0 -1
- package/templates/typical/client/public/mockServiceWorker.js +0 -336
- package/templates/typical/client/src/App.tsx +0 -29
- package/templates/typical/client/src/components/.gitkeep +0 -0
- package/templates/typical/client/src/components/ui/Accordion.stories.tsx +0 -47
- package/templates/typical/client/src/components/ui/Accordion.tsx +0 -51
- package/templates/typical/client/src/components/ui/Alert.stories.tsx +0 -27
- package/templates/typical/client/src/components/ui/Alert.tsx +0 -49
- package/templates/typical/client/src/components/ui/AlertDialog.stories.tsx +0 -65
- package/templates/typical/client/src/components/ui/AlertDialog.tsx +0 -163
- package/templates/typical/client/src/components/ui/AspectRatio.stories.tsx +0 -33
- package/templates/typical/client/src/components/ui/AspectRatio.tsx +0 -9
- package/templates/typical/client/src/components/ui/Avatar.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/Avatar.tsx +0 -87
- package/templates/typical/client/src/components/ui/Badge.stories.tsx +0 -36
- package/templates/typical/client/src/components/ui/Badge.tsx +0 -40
- package/templates/typical/client/src/components/ui/Breadcrumb.stories.tsx +0 -52
- package/templates/typical/client/src/components/ui/Breadcrumb.tsx +0 -92
- package/templates/typical/client/src/components/ui/Button.stories.tsx +0 -92
- package/templates/typical/client/src/components/ui/Button.tsx +0 -62
- package/templates/typical/client/src/components/ui/ButtonGroup.stories.tsx +0 -30
- package/templates/typical/client/src/components/ui/ButtonGroup.tsx +0 -75
- package/templates/typical/client/src/components/ui/Calendar.stories.tsx +0 -38
- package/templates/typical/client/src/components/ui/Calendar.tsx +0 -159
- package/templates/typical/client/src/components/ui/Card.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/Card.tsx +0 -56
- package/templates/typical/client/src/components/ui/Carousel.stories.tsx +0 -54
- package/templates/typical/client/src/components/ui/Carousel.tsx +0 -216
- package/templates/typical/client/src/components/ui/Chart.stories.tsx +0 -38
- package/templates/typical/client/src/components/ui/Chart.tsx +0 -296
- package/templates/typical/client/src/components/ui/Checkbox.stories.tsx +0 -31
- package/templates/typical/client/src/components/ui/Checkbox.tsx +0 -29
- package/templates/typical/client/src/components/ui/Collapsible.stories.tsx +0 -56
- package/templates/typical/client/src/components/ui/Collapsible.tsx +0 -15
- package/templates/typical/client/src/components/ui/Combobox.stories.tsx +0 -73
- package/templates/typical/client/src/components/ui/Combobox.tsx +0 -267
- package/templates/typical/client/src/components/ui/Command.stories.tsx +0 -69
- package/templates/typical/client/src/components/ui/Command.tsx +0 -137
- package/templates/typical/client/src/components/ui/ContextMenu.stories.tsx +0 -66
- package/templates/typical/client/src/components/ui/ContextMenu.tsx +0 -211
- package/templates/typical/client/src/components/ui/DesignSystem-Colors.mdx +0 -68
- package/templates/typical/client/src/components/ui/DesignSystem-Colors.stories.tsx +0 -117
- package/templates/typical/client/src/components/ui/DesignSystem-Layout.mdx +0 -64
- package/templates/typical/client/src/components/ui/DesignSystem-Layout.stories.tsx +0 -167
- package/templates/typical/client/src/components/ui/DesignSystem-Overview.stories.tsx +0 -748
- package/templates/typical/client/src/components/ui/DesignSystem-Typography.mdx +0 -31
- package/templates/typical/client/src/components/ui/DesignSystem-Typography.stories.tsx +0 -80
- package/templates/typical/client/src/components/ui/Dialog.stories.tsx +0 -72
- package/templates/typical/client/src/components/ui/Dialog.tsx +0 -136
- package/templates/typical/client/src/components/ui/Direction.stories.tsx +0 -36
- package/templates/typical/client/src/components/ui/Direction.tsx +0 -18
- package/templates/typical/client/src/components/ui/Drawer.stories.tsx +0 -68
- package/templates/typical/client/src/components/ui/Drawer.tsx +0 -106
- package/templates/typical/client/src/components/ui/DropdownMenu.stories.tsx +0 -72
- package/templates/typical/client/src/components/ui/DropdownMenu.tsx +0 -219
- package/templates/typical/client/src/components/ui/Empty.stories.tsx +0 -35
- package/templates/typical/client/src/components/ui/Empty.tsx +0 -85
- package/templates/typical/client/src/components/ui/Field.stories.tsx +0 -47
- package/templates/typical/client/src/components/ui/Field.tsx +0 -226
- package/templates/typical/client/src/components/ui/Form.stories.tsx +0 -44
- package/templates/typical/client/src/components/ui/Form.tsx +0 -136
- package/templates/typical/client/src/components/ui/HoverCard.stories.tsx +0 -47
- package/templates/typical/client/src/components/ui/HoverCard.tsx +0 -36
- package/templates/typical/client/src/components/ui/Input.stories.tsx +0 -38
- package/templates/typical/client/src/components/ui/Input.tsx +0 -21
- package/templates/typical/client/src/components/ui/InputGroup.stories.tsx +0 -50
- package/templates/typical/client/src/components/ui/InputGroup.tsx +0 -147
- package/templates/typical/client/src/components/ui/InputOTP.stories.tsx +0 -40
- package/templates/typical/client/src/components/ui/InputOTP.tsx +0 -68
- package/templates/typical/client/src/components/ui/Item.stories.tsx +0 -61
- package/templates/typical/client/src/components/ui/Item.tsx +0 -158
- package/templates/typical/client/src/components/ui/Kbd.stories.tsx +0 -54
- package/templates/typical/client/src/components/ui/Kbd.tsx +0 -18
- package/templates/typical/client/src/components/ui/Label.stories.tsx +0 -85
- package/templates/typical/client/src/components/ui/Label.tsx +0 -40
- package/templates/typical/client/src/components/ui/Menubar.stories.tsx +0 -76
- package/templates/typical/client/src/components/ui/Menubar.tsx +0 -236
- package/templates/typical/client/src/components/ui/NativeSelect.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/NativeSelect.tsx +0 -44
- package/templates/typical/client/src/components/ui/NavigationMenu.stories.tsx +0 -78
- package/templates/typical/client/src/components/ui/NavigationMenu.tsx +0 -142
- package/templates/typical/client/src/components/ui/Pagination.stories.tsx +0 -75
- package/templates/typical/client/src/components/ui/Pagination.tsx +0 -100
- package/templates/typical/client/src/components/ui/Popover.stories.tsx +0 -51
- package/templates/typical/client/src/components/ui/Popover.tsx +0 -52
- package/templates/typical/client/src/components/ui/Progress.stories.tsx +0 -28
- package/templates/typical/client/src/components/ui/Progress.tsx +0 -24
- package/templates/typical/client/src/components/ui/RadioGroup.stories.tsx +0 -48
- package/templates/typical/client/src/components/ui/RadioGroup.tsx +0 -31
- package/templates/typical/client/src/components/ui/Resizable.stories.tsx +0 -69
- package/templates/typical/client/src/components/ui/Resizable.tsx +0 -47
- package/templates/typical/client/src/components/ui/ScrollArea.stories.tsx +0 -43
- package/templates/typical/client/src/components/ui/ScrollArea.tsx +0 -46
- package/templates/typical/client/src/components/ui/Select.stories.tsx +0 -57
- package/templates/typical/client/src/components/ui/Select.tsx +0 -162
- package/templates/typical/client/src/components/ui/Separator.stories.tsx +0 -40
- package/templates/typical/client/src/components/ui/Separator.tsx +0 -26
- package/templates/typical/client/src/components/ui/Sheet.stories.tsx +0 -66
- package/templates/typical/client/src/components/ui/Sheet.tsx +0 -107
- package/templates/typical/client/src/components/ui/Sidebar.stories.tsx +0 -94
- package/templates/typical/client/src/components/ui/Sidebar.tsx +0 -675
- package/templates/typical/client/src/components/ui/Skeleton.stories.tsx +0 -38
- package/templates/typical/client/src/components/ui/Skeleton.tsx +0 -7
- package/templates/typical/client/src/components/ui/Slider.stories.tsx +0 -21
- package/templates/typical/client/src/components/ui/Slider.tsx +0 -54
- package/templates/typical/client/src/components/ui/Sonner.stories.tsx +0 -44
- package/templates/typical/client/src/components/ui/Sonner.tsx +0 -34
- package/templates/typical/client/src/components/ui/Spinner.stories.tsx +0 -23
- package/templates/typical/client/src/components/ui/Spinner.tsx +0 -9
- package/templates/typical/client/src/components/ui/Switch.stories.tsx +0 -35
- package/templates/typical/client/src/components/ui/Switch.tsx +0 -33
- package/templates/typical/client/src/components/ui/Table.stories.tsx +0 -65
- package/templates/typical/client/src/components/ui/Table.tsx +0 -75
- package/templates/typical/client/src/components/ui/Tabs.stories.tsx +0 -51
- package/templates/typical/client/src/components/ui/Tabs.tsx +0 -69
- package/templates/typical/client/src/components/ui/Textarea.stories.tsx +0 -24
- package/templates/typical/client/src/components/ui/Textarea.tsx +0 -18
- package/templates/typical/client/src/components/ui/Toast.stories.tsx +0 -112
- package/templates/typical/client/src/components/ui/Toast.tsx +0 -114
- package/templates/typical/client/src/components/ui/Toaster.tsx +0 -28
- package/templates/typical/client/src/components/ui/Toggle.stories.tsx +0 -40
- package/templates/typical/client/src/components/ui/Toggle.tsx +0 -41
- package/templates/typical/client/src/components/ui/ToggleGroup.stories.tsx +0 -58
- package/templates/typical/client/src/components/ui/ToggleGroup.tsx +0 -80
- package/templates/typical/client/src/components/ui/Tooltip.stories.tsx +0 -40
- package/templates/typical/client/src/components/ui/Tooltip.tsx +0 -42
- package/templates/typical/client/src/gql/execute.ts +0 -11
- package/templates/typical/client/src/gql/fragment-masking.ts +0 -83
- package/templates/typical/client/src/gql/gql.ts +0 -9
- package/templates/typical/client/src/gql/graphql.ts +0 -182
- package/templates/typical/client/src/gql/index.ts +0 -2
- package/templates/typical/client/src/graphql/mutations.ts +0 -0
- package/templates/typical/client/src/graphql/queries.ts +0 -0
- package/templates/typical/client/src/hooks/.gitkeep +0 -0
- package/templates/typical/client/src/hooks/use-mobile.ts +0 -19
- package/templates/typical/client/src/hooks/use-toast.ts +0 -186
- package/templates/typical/client/src/index.css +0 -121
- package/templates/typical/client/src/lib/utils.ts +0 -6
- package/templates/typical/client/src/main.tsx +0 -5
- package/templates/typical/client/tsconfig.app.json +0 -26
- package/templates/typical/client/tsconfig.json +0 -10
- package/templates/typical/client/tsconfig.staging.json +0 -8
- package/templates/typical/client/vite.config.ts +0 -50
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
export type Maybe<T> = T | null;
|
|
3
|
-
export type InputMaybe<T> = T | null | undefined;
|
|
4
|
-
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
5
|
-
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
|
6
|
-
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
|
7
|
-
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
|
|
8
|
-
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
|
|
9
|
-
/** All built-in and custom scalars, mapped to their actual values */
|
|
10
|
-
export type Scalars = {
|
|
11
|
-
ID: { input: string; output: string; }
|
|
12
|
-
String: { input: string; output: string; }
|
|
13
|
-
Boolean: { input: boolean; output: boolean; }
|
|
14
|
-
Int: { input: number; output: number; }
|
|
15
|
-
Float: { input: number; output: number; }
|
|
16
|
-
/** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.This scalar is serialized to a string in ISO 8601 format and parsed from a string in ISO 8601 format. */
|
|
17
|
-
DateTimeISO: { input: any; output: any; }
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type ActiveWorkoutView = {
|
|
21
|
-
__typename?: 'ActiveWorkoutView';
|
|
22
|
-
duration: Scalars['String']['output'];
|
|
23
|
-
exercises: Array<ActiveWorkoutViewExercises>;
|
|
24
|
-
sessionId: Scalars['String']['output'];
|
|
25
|
-
totalSets: Scalars['Float']['output'];
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type ActiveWorkoutViewExercises = {
|
|
29
|
-
__typename?: 'ActiveWorkoutViewExercises';
|
|
30
|
-
exerciseId: Scalars['String']['output'];
|
|
31
|
-
reps: Scalars['Float']['output'];
|
|
32
|
-
sets: Scalars['Float']['output'];
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type CalculateWorkoutStatsInput = {
|
|
36
|
-
sessionId: Scalars['String']['input'];
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export type CompleteWorkoutInput = {
|
|
40
|
-
endTime: Scalars['DateTimeISO']['input'];
|
|
41
|
-
sessionId: Scalars['String']['input'];
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type Mutation = {
|
|
45
|
-
__typename?: 'Mutation';
|
|
46
|
-
calculateWorkoutStats: MutationResponse;
|
|
47
|
-
completeWorkout: MutationResponse;
|
|
48
|
-
setFitnessGoal: MutationResponse;
|
|
49
|
-
startWorkout: MutationResponse;
|
|
50
|
-
updateGoalProgress: MutationResponse;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export type MutationCalculateWorkoutStatsArgs = {
|
|
55
|
-
input: CalculateWorkoutStatsInput;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export type MutationCompleteWorkoutArgs = {
|
|
60
|
-
input: CompleteWorkoutInput;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export type MutationSetFitnessGoalArgs = {
|
|
65
|
-
input: SetFitnessGoalInput;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export type MutationStartWorkoutArgs = {
|
|
70
|
-
input: StartWorkoutInput;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export type MutationUpdateGoalProgressArgs = {
|
|
75
|
-
input: UpdateGoalProgressInput;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export type MutationError = {
|
|
79
|
-
__typename?: 'MutationError';
|
|
80
|
-
message?: Maybe<Scalars['String']['output']>;
|
|
81
|
-
type: Scalars['String']['output'];
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export type MutationResponse = {
|
|
85
|
-
__typename?: 'MutationResponse';
|
|
86
|
-
error?: Maybe<MutationError>;
|
|
87
|
-
success: Scalars['Boolean']['output'];
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export type ProgressDashboardView = {
|
|
91
|
-
__typename?: 'ProgressDashboardView';
|
|
92
|
-
avgVolume: Scalars['Float']['output'];
|
|
93
|
-
goals: Array<ProgressDashboardViewGoals>;
|
|
94
|
-
totalWorkouts: Scalars['Float']['output'];
|
|
95
|
-
userId: Scalars['String']['output'];
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export type ProgressDashboardViewGoals = {
|
|
99
|
-
__typename?: 'ProgressDashboardViewGoals';
|
|
100
|
-
complete: Scalars['Boolean']['output'];
|
|
101
|
-
goalId: Scalars['String']['output'];
|
|
102
|
-
progress: Scalars['Float']['output'];
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export type Query = {
|
|
106
|
-
__typename?: 'Query';
|
|
107
|
-
activeWorkout: Array<ActiveWorkoutView>;
|
|
108
|
-
progressDashboard: Array<ProgressDashboardView>;
|
|
109
|
-
workoutHistory: Array<WorkoutHistoryView>;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
export type QueryActiveWorkoutArgs = {
|
|
114
|
-
userId?: InputMaybe<Scalars['ID']['input']>;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
export type QueryProgressDashboardArgs = {
|
|
119
|
-
userId?: InputMaybe<Scalars['ID']['input']>;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
export type QueryWorkoutHistoryArgs = {
|
|
124
|
-
input?: InputMaybe<Scalars['String']['input']>;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export type SetFitnessGoalInput = {
|
|
128
|
-
goalId: Scalars['String']['input'];
|
|
129
|
-
periodStart: Scalars['DateTimeISO']['input'];
|
|
130
|
-
target: Scalars['Float']['input'];
|
|
131
|
-
type: Scalars['String']['input'];
|
|
132
|
-
userId: Scalars['String']['input'];
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export type StartWorkoutExercisesInput = {
|
|
136
|
-
exerciseId: Scalars['String']['input'];
|
|
137
|
-
reps: Scalars['Float']['input'];
|
|
138
|
-
sets: Scalars['Float']['input'];
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export type StartWorkoutInput = {
|
|
142
|
-
exercises: Array<StartWorkoutExercisesInput>;
|
|
143
|
-
sessionId: Scalars['String']['input'];
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export type UpdateGoalProgressInput = {
|
|
147
|
-
addedVolume: Scalars['Float']['input'];
|
|
148
|
-
goalId: Scalars['String']['input'];
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export type WorkoutHistoryView = {
|
|
152
|
-
__typename?: 'WorkoutHistoryView';
|
|
153
|
-
sessions: Array<WorkoutHistoryViewSessions>;
|
|
154
|
-
userId: Scalars['String']['output'];
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
export type WorkoutHistoryViewSessions = {
|
|
158
|
-
__typename?: 'WorkoutHistoryViewSessions';
|
|
159
|
-
date: Scalars['DateTimeISO']['output'];
|
|
160
|
-
duration: Scalars['String']['output'];
|
|
161
|
-
sessionId: Scalars['String']['output'];
|
|
162
|
-
volume: Scalars['Float']['output'];
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export class TypedDocumentString<TResult, TVariables>
|
|
166
|
-
extends String
|
|
167
|
-
implements DocumentTypeDecoration<TResult, TVariables>
|
|
168
|
-
{
|
|
169
|
-
__apiType?: NonNullable<DocumentTypeDecoration<TResult, TVariables>['__apiType']>;
|
|
170
|
-
private value: string;
|
|
171
|
-
public __meta__?: Record<string, any> | undefined;
|
|
172
|
-
|
|
173
|
-
constructor(value: string, __meta__?: Record<string, any> | undefined) {
|
|
174
|
-
super(value);
|
|
175
|
-
this.value = value;
|
|
176
|
-
this.__meta__ = __meta__;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
override toString(): string & DocumentTypeDecoration<TResult, TVariables> {
|
|
180
|
-
return this.value;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
const MOBILE_BREAKPOINT = 768;
|
|
4
|
-
|
|
5
|
-
export function useIsMobile() {
|
|
6
|
-
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined);
|
|
7
|
-
|
|
8
|
-
React.useEffect(() => {
|
|
9
|
-
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
10
|
-
const onChange = () => {
|
|
11
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
12
|
-
};
|
|
13
|
-
mql.addEventListener('change', onChange);
|
|
14
|
-
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
15
|
-
return () => mql.removeEventListener('change', onChange);
|
|
16
|
-
}, []);
|
|
17
|
-
|
|
18
|
-
return !!isMobile;
|
|
19
|
-
}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
|
|
5
|
-
import type { ToastActionElement, ToastProps } from '@/components/ui/Toast';
|
|
6
|
-
|
|
7
|
-
const TOAST_LIMIT = 1;
|
|
8
|
-
const TOAST_REMOVE_DELAY = 1000000;
|
|
9
|
-
|
|
10
|
-
type ToasterToast = ToastProps & {
|
|
11
|
-
id: string;
|
|
12
|
-
title?: React.ReactNode;
|
|
13
|
-
description?: React.ReactNode;
|
|
14
|
-
action?: ToastActionElement;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const actionTypes = {
|
|
18
|
-
ADD_TOAST: 'ADD_TOAST',
|
|
19
|
-
UPDATE_TOAST: 'UPDATE_TOAST',
|
|
20
|
-
DISMISS_TOAST: 'DISMISS_TOAST',
|
|
21
|
-
REMOVE_TOAST: 'REMOVE_TOAST',
|
|
22
|
-
} as const;
|
|
23
|
-
|
|
24
|
-
let count = 0;
|
|
25
|
-
|
|
26
|
-
function genId() {
|
|
27
|
-
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
28
|
-
return count.toString();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type ActionType = typeof actionTypes;
|
|
32
|
-
|
|
33
|
-
type Action =
|
|
34
|
-
| {
|
|
35
|
-
type: ActionType['ADD_TOAST'];
|
|
36
|
-
toast: ToasterToast;
|
|
37
|
-
}
|
|
38
|
-
| {
|
|
39
|
-
type: ActionType['UPDATE_TOAST'];
|
|
40
|
-
toast: Partial<ToasterToast>;
|
|
41
|
-
}
|
|
42
|
-
| {
|
|
43
|
-
type: ActionType['DISMISS_TOAST'];
|
|
44
|
-
toastId?: ToasterToast['id'];
|
|
45
|
-
}
|
|
46
|
-
| {
|
|
47
|
-
type: ActionType['REMOVE_TOAST'];
|
|
48
|
-
toastId?: ToasterToast['id'];
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
interface State {
|
|
52
|
-
toasts: ToasterToast[];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();
|
|
56
|
-
|
|
57
|
-
const addToRemoveQueue = (toastId: string) => {
|
|
58
|
-
if (toastTimeouts.has(toastId)) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const timeout = setTimeout(() => {
|
|
63
|
-
toastTimeouts.delete(toastId);
|
|
64
|
-
dispatch({
|
|
65
|
-
type: 'REMOVE_TOAST',
|
|
66
|
-
toastId: toastId,
|
|
67
|
-
});
|
|
68
|
-
}, TOAST_REMOVE_DELAY);
|
|
69
|
-
|
|
70
|
-
toastTimeouts.set(toastId, timeout);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const reducer = (state: State, action: Action): State => {
|
|
74
|
-
switch (action.type) {
|
|
75
|
-
case 'ADD_TOAST':
|
|
76
|
-
return {
|
|
77
|
-
...state,
|
|
78
|
-
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
case 'UPDATE_TOAST':
|
|
82
|
-
return {
|
|
83
|
-
...state,
|
|
84
|
-
toasts: state.toasts.map((t) => (t.id === action.toast.id ? { ...t, ...action.toast } : t)),
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
case 'DISMISS_TOAST': {
|
|
88
|
-
const { toastId } = action;
|
|
89
|
-
|
|
90
|
-
if (toastId) {
|
|
91
|
-
addToRemoveQueue(toastId);
|
|
92
|
-
} else {
|
|
93
|
-
state.toasts.forEach((toast) => {
|
|
94
|
-
addToRemoveQueue(toast.id);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
...state,
|
|
100
|
-
toasts: state.toasts.map((t) =>
|
|
101
|
-
t.id === toastId || toastId === undefined
|
|
102
|
-
? {
|
|
103
|
-
...t,
|
|
104
|
-
open: false,
|
|
105
|
-
}
|
|
106
|
-
: t,
|
|
107
|
-
),
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
case 'REMOVE_TOAST':
|
|
111
|
-
if (action.toastId === undefined) {
|
|
112
|
-
return {
|
|
113
|
-
...state,
|
|
114
|
-
toasts: [],
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
...state,
|
|
119
|
-
toasts: state.toasts.filter((t) => t.id !== action.toastId),
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const listeners: Array<(state: State) => void> = [];
|
|
125
|
-
|
|
126
|
-
let memoryState: State = { toasts: [] };
|
|
127
|
-
|
|
128
|
-
function dispatch(action: Action) {
|
|
129
|
-
memoryState = reducer(memoryState, action);
|
|
130
|
-
listeners.forEach((listener) => {
|
|
131
|
-
listener(memoryState);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
type Toast = Omit<ToasterToast, 'id'>;
|
|
136
|
-
|
|
137
|
-
function toast({ ...props }: Toast) {
|
|
138
|
-
const id = genId();
|
|
139
|
-
|
|
140
|
-
const update = (props: ToasterToast) =>
|
|
141
|
-
dispatch({
|
|
142
|
-
type: 'UPDATE_TOAST',
|
|
143
|
-
toast: { ...props, id },
|
|
144
|
-
});
|
|
145
|
-
const dismiss = () => dispatch({ type: 'DISMISS_TOAST', toastId: id });
|
|
146
|
-
|
|
147
|
-
dispatch({
|
|
148
|
-
type: 'ADD_TOAST',
|
|
149
|
-
toast: {
|
|
150
|
-
...props,
|
|
151
|
-
id,
|
|
152
|
-
open: true,
|
|
153
|
-
onOpenChange: (open) => {
|
|
154
|
-
if (!open) dismiss();
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
id: id,
|
|
161
|
-
dismiss,
|
|
162
|
-
update,
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function useToast() {
|
|
167
|
-
const [state, setState] = React.useState<State>(memoryState);
|
|
168
|
-
|
|
169
|
-
React.useEffect(() => {
|
|
170
|
-
listeners.push(setState);
|
|
171
|
-
return () => {
|
|
172
|
-
const index = listeners.indexOf(setState);
|
|
173
|
-
if (index > -1) {
|
|
174
|
-
listeners.splice(index, 1);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
}, [state]);
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
...state,
|
|
181
|
-
toast,
|
|
182
|
-
dismiss: (toastId?: string) => dispatch({ type: 'DISMISS_TOAST', toastId }),
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export { useToast, toast };
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
@import "tw-animate-css";
|
|
3
|
-
|
|
4
|
-
@custom-variant dark (&:is(.dark *));
|
|
5
|
-
|
|
6
|
-
@theme inline {
|
|
7
|
-
--color-background: var(--background);
|
|
8
|
-
--color-foreground: var(--foreground);
|
|
9
|
-
--color-card: var(--card);
|
|
10
|
-
--color-card-foreground: var(--card-foreground);
|
|
11
|
-
--color-popover: var(--popover);
|
|
12
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
13
|
-
--color-primary: var(--primary);
|
|
14
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
15
|
-
--color-secondary: var(--secondary);
|
|
16
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
17
|
-
--color-muted: var(--muted);
|
|
18
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
19
|
-
--color-accent: var(--accent);
|
|
20
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
21
|
-
--color-destructive: var(--destructive);
|
|
22
|
-
--color-destructive-foreground: var(--destructive-foreground);
|
|
23
|
-
--color-border: var(--border);
|
|
24
|
-
--color-input: var(--input);
|
|
25
|
-
--color-ring: var(--ring);
|
|
26
|
-
--color-chart-1: var(--chart-1);
|
|
27
|
-
--color-chart-2: var(--chart-2);
|
|
28
|
-
--color-chart-3: var(--chart-3);
|
|
29
|
-
--color-chart-4: var(--chart-4);
|
|
30
|
-
--color-chart-5: var(--chart-5);
|
|
31
|
-
--color-sidebar: var(--sidebar);
|
|
32
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
33
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
34
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
35
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
36
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
37
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
38
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
39
|
-
--radius-sm: calc(var(--radius) - 4px);
|
|
40
|
-
--radius-md: calc(var(--radius) - 2px);
|
|
41
|
-
--radius-lg: var(--radius);
|
|
42
|
-
--radius-xl: calc(var(--radius) + 4px);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
:root {
|
|
46
|
-
--radius: 0.625rem;
|
|
47
|
-
--background: oklch(1 0 0);
|
|
48
|
-
--foreground: oklch(0.145 0 0);
|
|
49
|
-
--card: oklch(1 0 0);
|
|
50
|
-
--card-foreground: oklch(0.145 0 0);
|
|
51
|
-
--popover: oklch(1 0 0);
|
|
52
|
-
--popover-foreground: oklch(0.145 0 0);
|
|
53
|
-
--primary: oklch(0.205 0 0);
|
|
54
|
-
--primary-foreground: oklch(0.985 0 0);
|
|
55
|
-
--secondary: oklch(0.97 0 0);
|
|
56
|
-
--secondary-foreground: oklch(0.205 0 0);
|
|
57
|
-
--muted: oklch(0.97 0 0);
|
|
58
|
-
--muted-foreground: oklch(0.556 0 0);
|
|
59
|
-
--accent: oklch(0.97 0 0);
|
|
60
|
-
--accent-foreground: oklch(0.205 0 0);
|
|
61
|
-
--destructive: oklch(0.577 0.245 27.325);
|
|
62
|
-
--border: oklch(0.922 0 0);
|
|
63
|
-
--input: oklch(0.922 0 0);
|
|
64
|
-
--ring: oklch(0.708 0 0);
|
|
65
|
-
--chart-1: oklch(0.646 0.222 41.116);
|
|
66
|
-
--chart-2: oklch(0.6 0.118 184.704);
|
|
67
|
-
--chart-3: oklch(0.398 0.07 227.392);
|
|
68
|
-
--chart-4: oklch(0.828 0.189 84.429);
|
|
69
|
-
--chart-5: oklch(0.769 0.188 70.08);
|
|
70
|
-
--sidebar: oklch(0.985 0 0);
|
|
71
|
-
--sidebar-foreground: oklch(0.145 0 0);
|
|
72
|
-
--sidebar-primary: oklch(0.205 0 0);
|
|
73
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
74
|
-
--sidebar-accent: oklch(0.97 0 0);
|
|
75
|
-
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
76
|
-
--sidebar-border: oklch(0.922 0 0);
|
|
77
|
-
--sidebar-ring: oklch(0.708 0 0);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.dark {
|
|
81
|
-
--background: oklch(0.145 0 0);
|
|
82
|
-
--foreground: oklch(0.985 0 0);
|
|
83
|
-
--card: oklch(0.205 0 0);
|
|
84
|
-
--card-foreground: oklch(0.985 0 0);
|
|
85
|
-
--popover: oklch(0.205 0 0);
|
|
86
|
-
--popover-foreground: oklch(0.985 0 0);
|
|
87
|
-
--primary: oklch(0.922 0 0);
|
|
88
|
-
--primary-foreground: oklch(0.205 0 0);
|
|
89
|
-
--secondary: oklch(0.269 0 0);
|
|
90
|
-
--secondary-foreground: oklch(0.985 0 0);
|
|
91
|
-
--muted: oklch(0.269 0 0);
|
|
92
|
-
--muted-foreground: oklch(0.708 0 0);
|
|
93
|
-
--accent: oklch(0.269 0 0);
|
|
94
|
-
--accent-foreground: oklch(0.985 0 0);
|
|
95
|
-
--destructive: oklch(0.704 0.191 22.216);
|
|
96
|
-
--border: oklch(1 0 0 / 10%);
|
|
97
|
-
--input: oklch(1 0 0 / 15%);
|
|
98
|
-
--ring: oklch(0.556 0 0);
|
|
99
|
-
--chart-1: oklch(0.488 0.243 264.376);
|
|
100
|
-
--chart-2: oklch(0.696 0.17 162.48);
|
|
101
|
-
--chart-3: oklch(0.769 0.188 70.08);
|
|
102
|
-
--chart-4: oklch(0.627 0.265 303.9);
|
|
103
|
-
--chart-5: oklch(0.645 0.246 16.439);
|
|
104
|
-
--sidebar: oklch(0.205 0 0);
|
|
105
|
-
--sidebar-foreground: oklch(0.985 0 0);
|
|
106
|
-
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
107
|
-
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
108
|
-
--sidebar-accent: oklch(0.269 0 0);
|
|
109
|
-
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
110
|
-
--sidebar-border: oklch(1 0 0 / 10%);
|
|
111
|
-
--sidebar-ring: oklch(0.556 0 0);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
@layer base {
|
|
115
|
-
* {
|
|
116
|
-
@apply border-border outline-ring/50;
|
|
117
|
-
}
|
|
118
|
-
body {
|
|
119
|
-
@apply bg-background text-foreground;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"moduleResolution": "bundler",
|
|
9
|
-
"allowImportingTsExtensions": true,
|
|
10
|
-
"isolatedModules": true,
|
|
11
|
-
"moduleDetection": "force",
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"jsx": "react-jsx",
|
|
14
|
-
"strict": false,
|
|
15
|
-
"noUnusedLocals": false,
|
|
16
|
-
"noUnusedParameters": false,
|
|
17
|
-
"noFallthroughCasesInSwitch": true,
|
|
18
|
-
"noUncheckedSideEffectImports": true,
|
|
19
|
-
"baseUrl": ".",
|
|
20
|
-
"paths": {
|
|
21
|
-
"@/*": ["./src/*"]
|
|
22
|
-
},
|
|
23
|
-
"types": ["vite/client"]
|
|
24
|
-
},
|
|
25
|
-
"include": ["src"]
|
|
26
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import tailwindcss from '@tailwindcss/vite';
|
|
2
|
-
import react from '@vitejs/plugin-react-swc';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
import { defineConfig, type Plugin } from 'vite';
|
|
5
|
-
|
|
6
|
-
function iframeNavigationTracking(): Plugin {
|
|
7
|
-
return {
|
|
8
|
-
name: 'iframe-navigation-tracking',
|
|
9
|
-
transformIndexHtml(html) {
|
|
10
|
-
return html.replace(
|
|
11
|
-
'</head>',
|
|
12
|
-
`<script>
|
|
13
|
-
(function() {
|
|
14
|
-
if (window.parent === window) return;
|
|
15
|
-
function notify() {
|
|
16
|
-
window.parent.postMessage({ type: 'iframe-url-change', url: location.href }, '*');
|
|
17
|
-
}
|
|
18
|
-
var pushState = history.pushState;
|
|
19
|
-
var replaceState = history.replaceState;
|
|
20
|
-
history.pushState = function() {
|
|
21
|
-
pushState.apply(this, arguments);
|
|
22
|
-
notify();
|
|
23
|
-
};
|
|
24
|
-
history.replaceState = function() {
|
|
25
|
-
replaceState.apply(this, arguments);
|
|
26
|
-
notify();
|
|
27
|
-
};
|
|
28
|
-
window.addEventListener('popstate', notify);
|
|
29
|
-
window.addEventListener('hashchange', notify);
|
|
30
|
-
notify();
|
|
31
|
-
})();
|
|
32
|
-
</script>
|
|
33
|
-
</head>`,
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default defineConfig({
|
|
40
|
-
plugins: [react(), tailwindcss(), iframeNavigationTracking()],
|
|
41
|
-
resolve: {
|
|
42
|
-
alias: {
|
|
43
|
-
'@': resolve(__dirname, './src'),
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
server: {
|
|
47
|
-
port: 8080,
|
|
48
|
-
allowedHosts: ['.worker.on.auto', '.worker-dev.on.auto'],
|
|
49
|
-
},
|
|
50
|
-
});
|