scale-stack 0.0.1-alpha.2 → 0.0.2
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/CHANGELOG.md +34 -0
- package/README.md +67 -5
- package/dist/index.js +4081 -106
- package/package.json +7 -2
- package/templates/ai-chat/chat-panel.tsx.ejs +70 -0
- package/templates/ai-chat/layout.tsx.ejs +35 -0
- package/templates/ai-chat/page.tsx.ejs +37 -0
- package/templates/ai-chat/route.ts.ejs +68 -0
- package/templates/ai-chat/use-chat.ts.ejs +26 -0
- package/templates/analytics/analytics-provider.tsx.ejs +32 -0
- package/templates/analytics/analytics.ts.ejs +40 -0
- package/templates/auth/auth-client.ts.ejs +7 -0
- package/templates/auth/auth.ts.ejs +45 -0
- package/templates/auth/route.ts.ejs +4 -0
- package/templates/auth/sign-in-page.tsx.ejs +122 -0
- package/templates/auth/sign-up-page.tsx.ejs +137 -0
- package/templates/auth/unauthorized.tsx.ejs +28 -0
- package/templates/core/layout.tsx.ejs +46 -0
- package/templates/core/loading.tsx.ejs +7 -0
- package/templates/core/next.config.ts.ejs +33 -0
- package/templates/error-handling/catch-all-not-found-page.tsx.ejs +5 -0
- package/templates/error-handling/error.tsx.ejs +33 -0
- package/templates/error-handling/global-error.tsx.ejs +32 -0
- package/templates/error-handling/not-found.tsx.ejs +28 -0
- package/templates/eslint-prettier/.prettierignore.ejs +29 -0
- package/templates/eslint-prettier/eslint.config.mjs.ejs +31 -0
- package/templates/form-handling/dashboard-page.tsx.ejs +39 -0
- package/templates/form-handling/example-form-action.ts.ejs +50 -0
- package/templates/form-handling/example-form-schema.ts.ejs +87 -0
- package/templates/form-handling/example-form.tsx.ejs +428 -0
- package/templates/i18n/ar.json.ejs +77 -0
- package/templates/i18n/en.json.ejs +77 -0
- package/templates/i18n/locale-layout.tsx.ejs +81 -0
- package/templates/i18n/navigation.ts.ejs +5 -0
- package/templates/i18n/next-intl.d.ts.ejs +9 -0
- package/templates/i18n/request.ts.ejs +15 -0
- package/templates/i18n/routing.ts.ejs +7 -0
- package/templates/orm/prisma.config.ts.ejs +12 -0
- package/templates/orm/prisma.ts.ejs +17 -0
- package/templates/orm/schema.prisma.ejs +8 -0
- package/templates/pre-commit/prek.toml.ejs +35 -0
- package/templates/proxy/proxy.ts.ejs +81 -0
- package/templates/server-actions/safe-action.ts.ejs +51 -0
- package/templates/ui/client-side-wrappers.tsx.ejs +19 -0
- package/templates/ui/page.tsx.ejs +117 -0
- package/templates/utility-libs/date-fns.SKILL.md.ejs +34 -0
- package/templates/utility-libs/motion.SKILL.md.ejs +234 -0
- package/templates/utility-libs/ts-pattern.SKILL.md.ejs +44 -0
- package/templates/utility-libs/usehooks.SKILL.md.ejs +38 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: usehooks
|
|
3
|
+
description: Use @uidotdev/usehooks for common React hooks in this project. Use when adding client-side hooks for browser state, media queries, local storage, timers, events, clipboard, network state, or DOM measurements.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# useHooks
|
|
7
|
+
|
|
8
|
+
## Instructions
|
|
9
|
+
|
|
10
|
+
- Import hooks from `@uidotdev/usehooks`.
|
|
11
|
+
- Use these hooks only from Client Components or other client-only hooks. Add `"use client"` where the component uses browser APIs.
|
|
12
|
+
- Prefer existing useHooks utilities before writing one-off hooks for common browser behavior.
|
|
13
|
+
- Keep server data fetching out of these hooks. Use framework data-fetching patterns for server data and useHooks for client/browser state.
|
|
14
|
+
- Check SSR behavior before use. For browser-only values, handle the initial render state deliberately.
|
|
15
|
+
|
|
16
|
+
## Common Patterns
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
"use client";
|
|
20
|
+
|
|
21
|
+
import { useMediaQuery } from "@uidotdev/usehooks";
|
|
22
|
+
|
|
23
|
+
export function ResponsiveSidebar() {
|
|
24
|
+
const isDesktop = useMediaQuery("(min-width: 1024px)");
|
|
25
|
+
return isDesktop ? <aside /> : null;
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
"use client";
|
|
31
|
+
|
|
32
|
+
import { useLocalStorage } from "@uidotdev/usehooks";
|
|
33
|
+
|
|
34
|
+
export function ThemeToggle() {
|
|
35
|
+
const [theme, setTheme] = useLocalStorage("theme", "system");
|
|
36
|
+
return <button onClick={() => setTheme("dark")}>{theme}</button>;
|
|
37
|
+
}
|
|
38
|
+
```
|