lovable-stack 1.0.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/README.md +0 -0
- package/bin/index.js +13 -0
- package/package.json +15 -0
- package/template/bun.lock +1040 -0
- package/template/components.json +22 -0
- package/template/eslint.config.js +23 -0
- package/template/index.html +20 -0
- package/template/package.json +82 -0
- package/template/postcss.config.js +6 -0
- package/template/public/favicon.svg +1 -0
- package/template/public/robots copy.txt +38 -0
- package/template/public/robots.txt +38 -0
- package/template/public/site.webmanifest +12 -0
- package/template/public/sitemap.xml +9 -0
- package/template/src/App.css +0 -0
- package/template/src/App.tsx +16 -0
- package/template/src/assets/react.svg +1 -0
- package/template/src/components/ui/accordion.tsx +55 -0
- package/template/src/components/ui/alert-dialog.tsx +139 -0
- package/template/src/components/ui/alert.tsx +59 -0
- package/template/src/components/ui/aspect-ratio.tsx +5 -0
- package/template/src/components/ui/avatar.tsx +50 -0
- package/template/src/components/ui/badge.tsx +36 -0
- package/template/src/components/ui/breadcrumb.tsx +115 -0
- package/template/src/components/ui/button.tsx +57 -0
- package/template/src/components/ui/calendar.tsx +213 -0
- package/template/src/components/ui/card.tsx +76 -0
- package/template/src/components/ui/carousel.tsx +260 -0
- package/template/src/components/ui/chart.tsx +367 -0
- package/template/src/components/ui/checkbox.tsx +28 -0
- package/template/src/components/ui/collapsible.tsx +11 -0
- package/template/src/components/ui/command.tsx +153 -0
- package/template/src/components/ui/context-menu.tsx +198 -0
- package/template/src/components/ui/dialog.tsx +122 -0
- package/template/src/components/ui/drawer.tsx +118 -0
- package/template/src/components/ui/dropdown-menu.tsx +199 -0
- package/template/src/components/ui/form.tsx +178 -0
- package/template/src/components/ui/hover-card.tsx +29 -0
- package/template/src/components/ui/input-otp.tsx +69 -0
- package/template/src/components/ui/input.tsx +22 -0
- package/template/src/components/ui/label.tsx +24 -0
- package/template/src/components/ui/menubar.tsx +256 -0
- package/template/src/components/ui/navigation-menu.tsx +128 -0
- package/template/src/components/ui/pagination.tsx +118 -0
- package/template/src/components/ui/popover.tsx +31 -0
- package/template/src/components/ui/progress.tsx +28 -0
- package/template/src/components/ui/radio-group.tsx +42 -0
- package/template/src/components/ui/resizable.tsx +45 -0
- package/template/src/components/ui/scroll-area.tsx +46 -0
- package/template/src/components/ui/select.tsx +159 -0
- package/template/src/components/ui/separator.tsx +29 -0
- package/template/src/components/ui/sheet.tsx +140 -0
- package/template/src/components/ui/sidebar.tsx +771 -0
- package/template/src/components/ui/skeleton.tsx +15 -0
- package/template/src/components/ui/slider.tsx +26 -0
- package/template/src/components/ui/sonner.tsx +31 -0
- package/template/src/components/ui/switch.tsx +27 -0
- package/template/src/components/ui/table.tsx +120 -0
- package/template/src/components/ui/tabs.tsx +53 -0
- package/template/src/components/ui/textarea.tsx +22 -0
- package/template/src/components/ui/toast.tsx +127 -0
- package/template/src/components/ui/toaster.tsx +33 -0
- package/template/src/components/ui/toggle-group.tsx +59 -0
- package/template/src/components/ui/toggle.tsx +45 -0
- package/template/src/components/ui/tooltip.tsx +30 -0
- package/template/src/hooks/use-mobile.tsx +19 -0
- package/template/src/hooks/use-toast.ts +186 -0
- package/template/src/index.css +43 -0
- package/template/src/lib/utils.ts +6 -0
- package/template/src/main.tsx +5 -0
- package/template/tailwind.config.ts +0 -0
- package/template/tsconfig.app.json +42 -0
- package/template/tsconfig.json +27 -0
- package/template/tsconfig.node.json +27 -0
- package/template/vercel.json +5 -0
- package/template/vite.config.ts +12 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import type { ToastActionElement, ToastProps } from "@/components/ui/toast";
|
|
4
|
+
|
|
5
|
+
const TOAST_LIMIT = 1;
|
|
6
|
+
const TOAST_REMOVE_DELAY = 1000000;
|
|
7
|
+
|
|
8
|
+
type ToasterToast = ToastProps & {
|
|
9
|
+
id: string;
|
|
10
|
+
title?: React.ReactNode;
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
action?: ToastActionElement;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const actionTypes = {
|
|
16
|
+
ADD_TOAST: "ADD_TOAST",
|
|
17
|
+
UPDATE_TOAST: "UPDATE_TOAST",
|
|
18
|
+
DISMISS_TOAST: "DISMISS_TOAST",
|
|
19
|
+
REMOVE_TOAST: "REMOVE_TOAST",
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
let count = 0;
|
|
23
|
+
|
|
24
|
+
function genId() {
|
|
25
|
+
count = (count + 1) % Number.MAX_SAFE_INTEGER;
|
|
26
|
+
return count.toString();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type ActionType = typeof actionTypes;
|
|
30
|
+
|
|
31
|
+
type Action =
|
|
32
|
+
| {
|
|
33
|
+
type: ActionType["ADD_TOAST"];
|
|
34
|
+
toast: ToasterToast;
|
|
35
|
+
}
|
|
36
|
+
| {
|
|
37
|
+
type: ActionType["UPDATE_TOAST"];
|
|
38
|
+
toast: Partial<ToasterToast>;
|
|
39
|
+
}
|
|
40
|
+
| {
|
|
41
|
+
type: ActionType["DISMISS_TOAST"];
|
|
42
|
+
toastId?: ToasterToast["id"];
|
|
43
|
+
}
|
|
44
|
+
| {
|
|
45
|
+
type: ActionType["REMOVE_TOAST"];
|
|
46
|
+
toastId?: ToasterToast["id"];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
interface State {
|
|
50
|
+
toasts: ToasterToast[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();
|
|
54
|
+
|
|
55
|
+
const addToRemoveQueue = (toastId: string) => {
|
|
56
|
+
if (toastTimeouts.has(toastId)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const timeout = setTimeout(() => {
|
|
61
|
+
toastTimeouts.delete(toastId);
|
|
62
|
+
dispatch({
|
|
63
|
+
type: "REMOVE_TOAST",
|
|
64
|
+
toastId: toastId,
|
|
65
|
+
});
|
|
66
|
+
}, TOAST_REMOVE_DELAY);
|
|
67
|
+
|
|
68
|
+
toastTimeouts.set(toastId, timeout);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const reducer = (state: State, action: Action): State => {
|
|
72
|
+
switch (action.type) {
|
|
73
|
+
case "ADD_TOAST":
|
|
74
|
+
return {
|
|
75
|
+
...state,
|
|
76
|
+
toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
case "UPDATE_TOAST":
|
|
80
|
+
return {
|
|
81
|
+
...state,
|
|
82
|
+
toasts: state.toasts.map((t) => (t.id === action.toast.id ? { ...t, ...action.toast } : t)),
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
case "DISMISS_TOAST": {
|
|
86
|
+
const { toastId } = action;
|
|
87
|
+
|
|
88
|
+
// ! Side effects ! - This could be extracted into a dismissToast() action,
|
|
89
|
+
// but I'll keep it here for simplicity
|
|
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 };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
/* Minimal resets only - no custom themes per requirements */
|
|
6
|
+
@layer base {
|
|
7
|
+
* {
|
|
8
|
+
scroll-behavior: smooth;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
body {
|
|
12
|
+
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@layer utilities {
|
|
17
|
+
.animate-fade-in {
|
|
18
|
+
animation: fadeIn 0.5s ease-out forwards;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.animate-slide-up {
|
|
22
|
+
animation: slideUp 0.6s ease-out forwards;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.animate-pulse-soft {
|
|
26
|
+
animation: pulseSoft 2s ease-in-out infinite;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@keyframes fadeIn {
|
|
31
|
+
from { opacity: 0; }
|
|
32
|
+
to { opacity: 1; }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@keyframes slideUp {
|
|
36
|
+
from { opacity: 0; transform: translateY(20px); }
|
|
37
|
+
to { opacity: 1; transform: translateY(0); }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@keyframes pulseSoft {
|
|
41
|
+
0%, 100% { opacity: 1; }
|
|
42
|
+
50% { opacity: 0.7; }
|
|
43
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2022",
|
|
5
|
+
"useDefineForClassFields": true,
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2022",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
11
|
+
"module": "ESNext",
|
|
12
|
+
"types": [
|
|
13
|
+
"vite/client"
|
|
14
|
+
],
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
/* Bundler mode */
|
|
17
|
+
"moduleResolution": "bundler",
|
|
18
|
+
"allowImportingTsExtensions": true,
|
|
19
|
+
"verbatimModuleSyntax": true,
|
|
20
|
+
"moduleDetection": "force",
|
|
21
|
+
"noEmit": true,
|
|
22
|
+
"jsx": "react-jsx",
|
|
23
|
+
/* Linting */
|
|
24
|
+
"strict": true,
|
|
25
|
+
"noUnusedLocals": true,
|
|
26
|
+
"noUnusedParameters": true,
|
|
27
|
+
"erasableSyntaxOnly": true,
|
|
28
|
+
"noFallthroughCasesInSwitch": true,
|
|
29
|
+
"noUncheckedSideEffectImports": true,
|
|
30
|
+
"baseUrl": ".",
|
|
31
|
+
"paths": {
|
|
32
|
+
"@/*": [
|
|
33
|
+
"src/*"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
"include": [
|
|
39
|
+
"src"
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [],
|
|
3
|
+
"references": [
|
|
4
|
+
{
|
|
5
|
+
"path": "./tsconfig.app.json"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"path": "./tsconfig.node.json"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"compilerOptions": {
|
|
12
|
+
"baseUrl": ".",
|
|
13
|
+
"paths": {
|
|
14
|
+
"@/*": [
|
|
15
|
+
"./src/*"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"allowJs": true,
|
|
20
|
+
"noImplicitAny": false,
|
|
21
|
+
"noUnusedLocals": false,
|
|
22
|
+
"isolatedModules": true,
|
|
23
|
+
"verbatimModuleSyntax": true,
|
|
24
|
+
"noUnusedParameters": false,
|
|
25
|
+
"strictNullChecks": false
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
"include": ["vite.config.ts"]
|
|
27
|
+
}
|