@onexapis/cli 1.1.37 → 1.1.38
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/cli.js +688 -454
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +681 -449
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +343 -256
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +339 -253
- package/dist/index.mjs.map +1 -1
- package/dist/preview/preview-app.tsx +5 -13
- package/package.json +8 -4
- package/templates/default/bundle-entry.ts +0 -5
- package/templates/default/index.ts +1 -21
- package/templates/default/sections-registry.ts +0 -28
- package/templates/default/theme.layout.ts +2 -53
- package/templates/default/AUTH_AND_PROFILE.md +0 -167
- package/templates/default/LAYOUT.md +0 -195
- package/templates/default/hooks/index.ts +0 -26
- package/templates/default/hooks/use-forgot-password-form.ts +0 -90
- package/templates/default/hooks/use-login-form.ts +0 -102
- package/templates/default/hooks/use-profile-form.ts +0 -255
- package/templates/default/hooks/use-register-form.ts +0 -154
- package/templates/default/hooks/use-verify-code-form.ts +0 -224
- package/templates/default/pages/forgot-password.ts +0 -41
- package/templates/default/pages/login.ts +0 -41
- package/templates/default/pages/profile.ts +0 -39
- package/templates/default/pages/register.ts +0 -41
- package/templates/default/pages/verify-code.ts +0 -41
- package/templates/default/sections/auth-forgot-password/auth-forgot-password-default.tsx +0 -192
- package/templates/default/sections/auth-forgot-password/auth-forgot-password.schema.ts +0 -150
- package/templates/default/sections/auth-forgot-password/index.ts +0 -14
- package/templates/default/sections/auth-login/auth-login-default.tsx +0 -238
- package/templates/default/sections/auth-login/auth-login.schema.ts +0 -171
- package/templates/default/sections/auth-login/index.ts +0 -14
- package/templates/default/sections/auth-register/auth-register-default.tsx +0 -327
- package/templates/default/sections/auth-register/auth-register.schema.ts +0 -188
- package/templates/default/sections/auth-register/index.ts +0 -14
- package/templates/default/sections/auth-verify-code/auth-verify-code-default.tsx +0 -209
- package/templates/default/sections/auth-verify-code/auth-verify-code.schema.ts +0 -150
- package/templates/default/sections/auth-verify-code/index.ts +0 -14
- package/templates/default/sections/footer/footer-default.tsx +0 -214
- package/templates/default/sections/footer/footer.schema.ts +0 -170
- package/templates/default/sections/footer/index.ts +0 -14
- package/templates/default/sections/header/header-default.tsx +0 -322
- package/templates/default/sections/header/header.schema.ts +0 -168
- package/templates/default/sections/header/index.ts +0 -14
- package/templates/default/sections/profile/index.ts +0 -14
- package/templates/default/sections/profile/profile-default.tsx +0 -522
- package/templates/default/sections/profile/profile.schema.ts +0 -228
|
@@ -455,14 +455,6 @@ function PreviewApp() {
|
|
|
455
455
|
>("disconnected");
|
|
456
456
|
const [error, setError] = useState<string | null>(null);
|
|
457
457
|
const wsRef = useRef<WebSocket | null>(null);
|
|
458
|
-
const [isEditing, setIsEditing] = useState(() => {
|
|
459
|
-
if (typeof window !== "undefined") {
|
|
460
|
-
return (
|
|
461
|
-
new URLSearchParams(window.location.search).get("editing") === "true"
|
|
462
|
-
);
|
|
463
|
-
}
|
|
464
|
-
return false;
|
|
465
|
-
});
|
|
466
458
|
|
|
467
459
|
// Load theme bundle
|
|
468
460
|
const loadTheme = useCallback(async (timestamp?: number) => {
|
|
@@ -709,7 +701,7 @@ function PreviewApp() {
|
|
|
709
701
|
section={section}
|
|
710
702
|
schema={schema}
|
|
711
703
|
template={template}
|
|
712
|
-
isEditing={
|
|
704
|
+
isEditing={false}
|
|
713
705
|
data={sectionData}
|
|
714
706
|
/>
|
|
715
707
|
);
|
|
@@ -720,16 +712,16 @@ function PreviewApp() {
|
|
|
720
712
|
{/* Inject theme CSS variables (Gap 2) */}
|
|
721
713
|
{themeCSS && <style dangerouslySetInnerHTML={{ __html: themeCSS }} />}
|
|
722
714
|
|
|
723
|
-
{/* Header
|
|
724
|
-
{headerSections.length > 0 &&
|
|
715
|
+
{/* Header (Gap 1) */}
|
|
716
|
+
{headerSections.length > 0 && (
|
|
725
717
|
<header>{headerSections.map(renderSection)}</header>
|
|
726
718
|
)}
|
|
727
719
|
|
|
728
720
|
{/* Page sections */}
|
|
729
721
|
<main>{pageSections.map(renderSection)}</main>
|
|
730
722
|
|
|
731
|
-
{/* Footer
|
|
732
|
-
{footerSections.length > 0 &&
|
|
723
|
+
{/* Footer (Gap 1) */}
|
|
724
|
+
{footerSections.length > 0 && (
|
|
733
725
|
<footer>{footerSections.map(renderSection)}</footer>
|
|
734
726
|
)}
|
|
735
727
|
</>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onexapis/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.38",
|
|
4
4
|
"description": "CLI tool for OneX theme development - scaffolds themes using @onexapis/core",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -50,13 +50,14 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@aws-sdk/client-s3": "^3.470.0",
|
|
53
|
-
"@onexapis/core": "^1.0.
|
|
53
|
+
"@onexapis/core": "^1.0.7",
|
|
54
54
|
"@tanstack/react-query": "^5.90.16",
|
|
55
55
|
"adm-zip": "^0.5.16",
|
|
56
56
|
"archiver": "^7.0.1",
|
|
57
57
|
"chalk": "^5.3.0",
|
|
58
58
|
"chokidar": "^4.0.0",
|
|
59
59
|
"commander": "^12.1.0",
|
|
60
|
+
"cross-spawn": "^7.0.6",
|
|
60
61
|
"dotenv": "^17.3.1",
|
|
61
62
|
"ejs": "^3.1.10",
|
|
62
63
|
"esbuild": "^0.25.0",
|
|
@@ -69,17 +70,20 @@
|
|
|
69
70
|
"node-fetch": "^3.3.2",
|
|
70
71
|
"open": "^10.1.0",
|
|
71
72
|
"ora": "^8.0.1",
|
|
72
|
-
"
|
|
73
|
+
"postcss": "^8.4.0",
|
|
74
|
+
"semver": "^7.7.4",
|
|
73
75
|
"tailwindcss": "^3.4.0",
|
|
74
|
-
"
|
|
76
|
+
"ws": "^8.18.0"
|
|
75
77
|
},
|
|
76
78
|
"devDependencies": {
|
|
77
79
|
"@types/adm-zip": "^0.5.7",
|
|
78
80
|
"@types/archiver": "^7.0.0",
|
|
81
|
+
"@types/cross-spawn": "^6.0.6",
|
|
79
82
|
"@types/ejs": "^3.1.5",
|
|
80
83
|
"@types/fs-extra": "^11.0.4",
|
|
81
84
|
"@types/inquirer": "^9.0.7",
|
|
82
85
|
"@types/node-fetch": "^2.6.13",
|
|
86
|
+
"@types/semver": "^7.7.1",
|
|
83
87
|
"@types/ws": "^8.5.0",
|
|
84
88
|
"tsup": "^8.5.1",
|
|
85
89
|
"typescript": "^5.9.3"
|
|
@@ -16,8 +16,3 @@ export { default as layoutConfig } from "./theme.layout";
|
|
|
16
16
|
export { default as homePageConfig } from "./pages/home";
|
|
17
17
|
export { default as aboutPageConfig } from "./pages/about";
|
|
18
18
|
export { default as showcasePageConfig } from "./pages/showcase";
|
|
19
|
-
export { default as loginPageConfig } from "./pages/login";
|
|
20
|
-
export { default as registerPageConfig } from "./pages/register";
|
|
21
|
-
export { default as forgotPasswordPageConfig } from "./pages/forgot-password";
|
|
22
|
-
export { default as verifyCodePageConfig } from "./pages/verify-code";
|
|
23
|
-
export { default as profilePageConfig } from "./pages/profile";
|
|
@@ -14,33 +14,13 @@ export { default as layoutConfig, simpleLayoutConfig } from "./theme.layout";
|
|
|
14
14
|
export { default as homePageConfig } from "./pages/home";
|
|
15
15
|
export { default as aboutPageConfig } from "./pages/about";
|
|
16
16
|
export { default as showcasePageConfig } from "./pages/showcase";
|
|
17
|
-
export { default as loginPageConfig } from "./pages/login";
|
|
18
|
-
export { default as registerPageConfig } from "./pages/register";
|
|
19
|
-
export { default as forgotPasswordPageConfig } from "./pages/forgot-password";
|
|
20
|
-
export { default as verifyCodePageConfig } from "./pages/verify-code";
|
|
21
|
-
export { default as profilePageConfig } from "./pages/profile";
|
|
22
17
|
|
|
23
18
|
// Page map for dynamic access
|
|
24
19
|
export const pages = {
|
|
25
20
|
home: () => import("./pages/home").then((m) => m.default),
|
|
26
21
|
about: () => import("./pages/about").then((m) => m.default),
|
|
27
22
|
showcase: () => import("./pages/showcase").then((m) => m.default),
|
|
28
|
-
login: () => import("./pages/login").then((m) => m.default),
|
|
29
|
-
register: () => import("./pages/register").then((m) => m.default),
|
|
30
|
-
"forgot-password": () =>
|
|
31
|
-
import("./pages/forgot-password").then((m) => m.default),
|
|
32
|
-
"verify-code": () => import("./pages/verify-code").then((m) => m.default),
|
|
33
|
-
profile: () => import("./pages/profile").then((m) => m.default),
|
|
34
23
|
};
|
|
35
24
|
|
|
36
25
|
// Page slugs (for discovery)
|
|
37
|
-
export const pageList = [
|
|
38
|
-
"home",
|
|
39
|
-
"about",
|
|
40
|
-
"showcase",
|
|
41
|
-
"login",
|
|
42
|
-
"register",
|
|
43
|
-
"forgot-password",
|
|
44
|
-
"verify-code",
|
|
45
|
-
"profile",
|
|
46
|
-
] as const;
|
|
26
|
+
export const pageList = ["home", "about", "showcase"] as const;
|
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
* Auto-discovery entry point for all sections
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
// Header (layout)
|
|
7
|
-
export { default as HeaderDefault } from "./sections/header/header-default";
|
|
8
|
-
export { headerSchema } from "./sections/header/header.schema";
|
|
9
|
-
|
|
10
|
-
// Footer (layout)
|
|
11
|
-
export { default as FooterDefault } from "./sections/footer/footer-default";
|
|
12
|
-
export { footerSchema } from "./sections/footer/footer.schema";
|
|
13
|
-
|
|
14
6
|
// Hero
|
|
15
7
|
export { default as HeroDefault } from "./sections/hero/hero-default";
|
|
16
8
|
export { heroSchema } from "./sections/hero/hero.schema";
|
|
@@ -38,23 +30,3 @@ export { ctaSchema } from "./sections/cta/cta.schema";
|
|
|
38
30
|
// Stats (block-based)
|
|
39
31
|
export { default as StatsDefault } from "./sections/stats/stats-default";
|
|
40
32
|
export { statsSchema } from "./sections/stats/stats.schema";
|
|
41
|
-
|
|
42
|
-
// Auth Login
|
|
43
|
-
export { default as AuthLoginDefault } from "./sections/auth-login/auth-login-default";
|
|
44
|
-
export { authLoginSchema } from "./sections/auth-login/auth-login.schema";
|
|
45
|
-
|
|
46
|
-
// Auth Register
|
|
47
|
-
export { default as AuthRegisterDefault } from "./sections/auth-register/auth-register-default";
|
|
48
|
-
export { authRegisterSchema } from "./sections/auth-register/auth-register.schema";
|
|
49
|
-
|
|
50
|
-
// Auth Forgot Password
|
|
51
|
-
export { default as AuthForgotPasswordDefault } from "./sections/auth-forgot-password/auth-forgot-password-default";
|
|
52
|
-
export { authForgotPasswordSchema } from "./sections/auth-forgot-password/auth-forgot-password.schema";
|
|
53
|
-
|
|
54
|
-
// Auth Verify Code
|
|
55
|
-
export { default as AuthVerifyCodeDefault } from "./sections/auth-verify-code/auth-verify-code-default";
|
|
56
|
-
export { authVerifyCodeSchema } from "./sections/auth-verify-code/auth-verify-code.schema";
|
|
57
|
-
|
|
58
|
-
// Profile
|
|
59
|
-
export { default as ProfileDefault } from "./sections/profile/profile-default";
|
|
60
|
-
export { profileSchema } from "./sections/profile/profile.schema";
|
|
@@ -9,59 +9,8 @@ export const simpleLayoutConfig: ThemeLayoutConfig = {
|
|
|
9
9
|
id: "my-simple",
|
|
10
10
|
name: "My My Simple Theme",
|
|
11
11
|
version: "1.0.0",
|
|
12
|
-
headerSections: [
|
|
13
|
-
|
|
14
|
-
id: "global-header-1",
|
|
15
|
-
type: "my-simple-header",
|
|
16
|
-
template: "default",
|
|
17
|
-
order: 0,
|
|
18
|
-
enabled: true,
|
|
19
|
-
settings: {
|
|
20
|
-
logoText: "My Site",
|
|
21
|
-
sticky: true,
|
|
22
|
-
autoHide: true,
|
|
23
|
-
scrollThreshold: 10,
|
|
24
|
-
showShadowOnScroll: true,
|
|
25
|
-
transparentOnTop: false,
|
|
26
|
-
headerHeight: "16",
|
|
27
|
-
navigationItems: JSON.stringify([
|
|
28
|
-
{ label: "Home", href: "/" },
|
|
29
|
-
{ label: "About", href: "/about" },
|
|
30
|
-
{ label: "Showcase", href: "/showcase" },
|
|
31
|
-
]),
|
|
32
|
-
ctaText: "Contact",
|
|
33
|
-
ctaLink: "#contact",
|
|
34
|
-
backgroundColor: "#FFFFFF",
|
|
35
|
-
textColor: "#111827",
|
|
36
|
-
primaryColor: "#2563EB",
|
|
37
|
-
},
|
|
38
|
-
components: [],
|
|
39
|
-
blocks: [],
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
footerSections: [
|
|
43
|
-
{
|
|
44
|
-
id: "global-footer-1",
|
|
45
|
-
type: "my-simple-footer",
|
|
46
|
-
template: "default",
|
|
47
|
-
order: 0,
|
|
48
|
-
enabled: true,
|
|
49
|
-
settings: {
|
|
50
|
-
companyName: "My Site",
|
|
51
|
-
description: "A clean and minimal theme for your website.",
|
|
52
|
-
showAboutColumn: true,
|
|
53
|
-
aboutColumnTitle: "About",
|
|
54
|
-
showLinksColumn: true,
|
|
55
|
-
linksColumnTitle: "Quick Links",
|
|
56
|
-
copyrightText: "My Site. All rights reserved.",
|
|
57
|
-
backgroundColor: "#111827",
|
|
58
|
-
textColor: "#9CA3AF",
|
|
59
|
-
primaryColor: "#FFFFFF",
|
|
60
|
-
},
|
|
61
|
-
components: [],
|
|
62
|
-
blocks: [],
|
|
63
|
-
},
|
|
64
|
-
],
|
|
12
|
+
headerSections: [],
|
|
13
|
+
footerSections: [],
|
|
65
14
|
globalSettings: {
|
|
66
15
|
primaryColor: "#3B82F6",
|
|
67
16
|
secondaryColor: "#8B5CF6",
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
# Authentication & Profile — Default Theme
|
|
2
|
-
|
|
3
|
-
This document covers the built-in authentication and profile sections included in the default theme template.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
When you initialize a theme with `onexthm init`, it comes with 5 auth/profile sections and their corresponding hooks ready to use:
|
|
8
|
-
|
|
9
|
-
| Section | Path | Description |
|
|
10
|
-
| -------------------- | ------------------ | -------------------------------------------- |
|
|
11
|
-
| Auth Login | `/login` | Username/email + password sign-in |
|
|
12
|
-
| Auth Register | `/register` | Email, username, password, confirm password |
|
|
13
|
-
| Auth Forgot Password | `/forgot-password` | Request verification code via email/username |
|
|
14
|
-
| Auth Verify Code | `/verify-code` | 6-digit OTP input with resend + countdown |
|
|
15
|
-
| Profile | `/profile` | View/edit profile + change password |
|
|
16
|
-
|
|
17
|
-
## Architecture
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
Theme Section (UI only)
|
|
21
|
-
└── Theme Hook (form state, validation)
|
|
22
|
-
└── useAuth() from @onexapis/core/hooks (Zustand store)
|
|
23
|
-
└── AuthService (API calls)
|
|
24
|
-
└── ApiClient (HTTP client with token management)
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Hooks
|
|
28
|
-
|
|
29
|
-
All hooks live in `hooks/` and use `useAuth` from `@onexapis/core/hooks`:
|
|
30
|
-
|
|
31
|
-
| Hook | Uses | Manages |
|
|
32
|
-
| ----------------------- | ------------------------------------------------------------- | ---------------------------------------------------- |
|
|
33
|
-
| `useLoginForm` | `useAuth().login()` | Username, password, show/hide toggle, validation |
|
|
34
|
-
| `useRegisterForm` | `useAuth().signup()` | Email, username, password, confirm, validation |
|
|
35
|
-
| `useForgotPasswordForm` | `useAuth().forgotPassword()` | Username/email input, validation |
|
|
36
|
-
| `useVerifyCodeForm` | `useAuth().verifyCode()`, `verifyCodeReset()`, `resendCode()` | 6-digit OTP, auto-focus, paste, countdown |
|
|
37
|
-
| `useProfileForm` | `useAuth().updateProfile()`, `changePassword()`, `logout()` | Profile fields, dirty tracking, change password form |
|
|
38
|
-
|
|
39
|
-
### API Endpoints
|
|
40
|
-
|
|
41
|
-
The `AuthService` in `@onexapis/core` handles all API calls:
|
|
42
|
-
|
|
43
|
-
| Action | Method | Endpoint |
|
|
44
|
-
| ------------------- | ------ | ----------------------------------- |
|
|
45
|
-
| Login | POST | `/auth/login` |
|
|
46
|
-
| Register | POST | `/auth/register` |
|
|
47
|
-
| Forgot Password | POST | `/auth/forgot` |
|
|
48
|
-
| Verify Code | POST | `/auth/confirm` |
|
|
49
|
-
| Verify Code (reset) | POST | `/auth/confirm_reset_password_code` |
|
|
50
|
-
| Resend Code | POST | `/auth/resend_code` |
|
|
51
|
-
| Reset Password | POST | `/auth/new_password` |
|
|
52
|
-
| Change Password | POST | `/auth/change_password` |
|
|
53
|
-
| Get User Info | GET | `/auth/user_info` |
|
|
54
|
-
| Update Profile | POST | `/auth/user_info` |
|
|
55
|
-
|
|
56
|
-
### Token Handling
|
|
57
|
-
|
|
58
|
-
- **IdToken** → `Authorization: Bearer {IdToken}` header
|
|
59
|
-
- **AccessToken** → `?access_token={AccessToken}` query parameter
|
|
60
|
-
- **Tokens stored** in `localStorage` under key `auth_tokens`
|
|
61
|
-
- **Signup** auto-injects `company_id` (from `initializeOnex()` config) and `is_customer: true`
|
|
62
|
-
|
|
63
|
-
## Editable Settings
|
|
64
|
-
|
|
65
|
-
All sections expose these layout settings via the editor sidebar:
|
|
66
|
-
|
|
67
|
-
| Setting | Type | Default | Description |
|
|
68
|
-
| ------------------ | ------ | --------- | ------------------------------------ |
|
|
69
|
-
| `backgroundColor` | color | `#F9FAFB` | Page background |
|
|
70
|
-
| `cardBackground` | color | `#FFFFFF` | Card/form container background |
|
|
71
|
-
| `primaryColor` | color | `#2563EB` | Buttons and links |
|
|
72
|
-
| `textColor` | color | `#111827` | Heading text color |
|
|
73
|
-
| `cardBorderRadius` | select | `2xl` | Card corner rounding (lg/xl/2xl/3xl) |
|
|
74
|
-
|
|
75
|
-
Plus all text labels, placeholders, button text, and URLs are customizable per section.
|
|
76
|
-
|
|
77
|
-
## Auth Flow
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
Register → Verify Code → Login → Profile
|
|
81
|
-
↑ │
|
|
82
|
-
Forgot Password → Verify Code (reset) → Reset Password
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
1. **Register**: User fills email, username, password → `signup()` → redirects to `/verify-code?username=...`
|
|
86
|
-
2. **Verify Code**: User enters 6-digit OTP → `verifyCode()` → redirects to `/login`
|
|
87
|
-
3. **Login**: User signs in → `login()` → tokens stored → redirects to `/`
|
|
88
|
-
4. **Forgot Password**: User enters email → `forgotPassword()` → redirects to `/verify-code?mode=reset&username=...`
|
|
89
|
-
5. **Verify Code (reset)**: OTP → `verifyCodeReset()` → returns session → redirects to `/reset-password?session=...`
|
|
90
|
-
6. **Profile**: View/edit name, phone, address → `updateProfile()`. Change password → `changePassword()`
|
|
91
|
-
|
|
92
|
-
## Configuration
|
|
93
|
-
|
|
94
|
-
### Required Environment Variables
|
|
95
|
-
|
|
96
|
-
```env
|
|
97
|
-
NEXT_PUBLIC_API_URL=https://api-dev.onexeos.com
|
|
98
|
-
NEXT_PUBLIC_COMPANY_ID=your-company-id
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
These are read by `initializeOnex()` which creates the `AuthService` and registers it with the `useAuth` Zustand store.
|
|
102
|
-
|
|
103
|
-
## Testing Locally
|
|
104
|
-
|
|
105
|
-
### Preview mode (UI only)
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
onexthm dev
|
|
109
|
-
# Visit http://localhost:3456/login
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Preview with editing mode
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
onexthm dev
|
|
116
|
-
# Visit http://localhost:3456/login?editing=true
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Preview with real API (requires .env)
|
|
120
|
-
|
|
121
|
-
Create `.env` in your theme directory:
|
|
122
|
-
|
|
123
|
-
```env
|
|
124
|
-
NEXT_PUBLIC_API_URL=https://api-dev.onexeos.com
|
|
125
|
-
NEXT_PUBLIC_COMPANY_ID=your-company-id
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Then run `onexthm dev` — login/register/verify will make real API calls.
|
|
129
|
-
|
|
130
|
-
## File Structure
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
hooks/
|
|
134
|
-
index.ts
|
|
135
|
-
use-login-form.ts
|
|
136
|
-
use-register-form.ts
|
|
137
|
-
use-forgot-password-form.ts
|
|
138
|
-
use-verify-code-form.ts
|
|
139
|
-
use-profile-form.ts
|
|
140
|
-
sections/
|
|
141
|
-
auth-login/
|
|
142
|
-
auth-login-default.tsx # Login form UI
|
|
143
|
-
auth-login.schema.ts # Editable settings
|
|
144
|
-
index.ts
|
|
145
|
-
auth-register/
|
|
146
|
-
auth-register-default.tsx
|
|
147
|
-
auth-register.schema.ts
|
|
148
|
-
index.ts
|
|
149
|
-
auth-forgot-password/
|
|
150
|
-
auth-forgot-password-default.tsx
|
|
151
|
-
auth-forgot-password.schema.ts
|
|
152
|
-
index.ts
|
|
153
|
-
auth-verify-code/
|
|
154
|
-
auth-verify-code-default.tsx
|
|
155
|
-
auth-verify-code.schema.ts
|
|
156
|
-
index.ts
|
|
157
|
-
profile/
|
|
158
|
-
profile-default.tsx
|
|
159
|
-
profile.schema.ts
|
|
160
|
-
index.ts
|
|
161
|
-
pages/
|
|
162
|
-
login.ts
|
|
163
|
-
register.ts
|
|
164
|
-
forgot-password.ts
|
|
165
|
-
verify-code.ts
|
|
166
|
-
profile.ts
|
|
167
|
-
```
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
# Header & Footer Layout — Default Theme
|
|
2
|
-
|
|
3
|
-
This document covers the built-in header and footer sections that render on every page via `theme.layout.ts`.
|
|
4
|
-
|
|
5
|
-
## How It Works
|
|
6
|
-
|
|
7
|
-
Header and footer are **layout-level sections** — they're defined once in `theme.layout.ts` and rendered on every page automatically. Individual pages can opt out using `hideHeader` / `hideFooter`.
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
theme.layout.ts
|
|
11
|
-
├── headerSections[] ──→ rendered as <header> on every page
|
|
12
|
-
└── footerSections[] ──→ rendered as <footer> on every page
|
|
13
|
-
|
|
14
|
-
Page config
|
|
15
|
-
├── hideHeader: true ──→ skips header for this page
|
|
16
|
-
└── hideFooter: true ──→ skips footer for this page
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Header Section
|
|
20
|
-
|
|
21
|
-
### Smart Scroll Behavior (default: on)
|
|
22
|
-
|
|
23
|
-
The header auto-hides when scrolling down and reappears when scrolling up. This is fully customizable via schema settings:
|
|
24
|
-
|
|
25
|
-
| Setting | Type | Default | Description |
|
|
26
|
-
| -------------------- | -------- | ----------- | --------------------------------------------- |
|
|
27
|
-
| `sticky` | checkbox | `true` | Pin header to top of viewport |
|
|
28
|
-
| `autoHide` | checkbox | `true` | Hide on scroll down, show on scroll up |
|
|
29
|
-
| `scrollThreshold` | number | `10` | Pixels of scroll needed to trigger hide/show |
|
|
30
|
-
| `showShadowOnScroll` | checkbox | `true` | Add drop shadow when page is scrolled |
|
|
31
|
-
| `transparentOnTop` | checkbox | `false` | Transparent background when at top of page |
|
|
32
|
-
| `headerHeight` | select | `16` (64px) | Compact (48px) / Default (64px) / Tall (80px) |
|
|
33
|
-
|
|
34
|
-
### Behavior Presets
|
|
35
|
-
|
|
36
|
-
**Default (sticky + auto-hide):**
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
// theme.layout.ts
|
|
40
|
-
settings: {
|
|
41
|
-
sticky: true,
|
|
42
|
-
autoHide: true,
|
|
43
|
-
showShadowOnScroll: true,
|
|
44
|
-
transparentOnTop: false,
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
**Always visible (no auto-hide):**
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
settings: {
|
|
52
|
-
sticky: true,
|
|
53
|
-
autoHide: false, // ← stays visible at all times
|
|
54
|
-
showShadowOnScroll: true,
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**Transparent hero overlay:**
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
settings: {
|
|
62
|
-
sticky: true,
|
|
63
|
-
autoHide: true,
|
|
64
|
-
transparentOnTop: true, // ← transparent at top, solid on scroll
|
|
65
|
-
showShadowOnScroll: true,
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Static (not sticky):**
|
|
70
|
-
|
|
71
|
-
```ts
|
|
72
|
-
settings: {
|
|
73
|
-
sticky: false, // ← scrolls away with the page
|
|
74
|
-
autoHide: false,
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Other Header Settings
|
|
79
|
-
|
|
80
|
-
| Setting | Type | Default | Description |
|
|
81
|
-
| ----------------- | ----- | --------------------- | ----------------------------------------- |
|
|
82
|
-
| `logoText` | text | `"My Site"` | Logo text (fallback if no logo component) |
|
|
83
|
-
| `navigationItems` | array | Home, About, Showcase | Navigation links `[{ label, href }]` |
|
|
84
|
-
| `ctaText` | text | `"Contact"` | CTA button text |
|
|
85
|
-
| `ctaLink` | url | `"#contact"` | CTA button link |
|
|
86
|
-
| `backgroundColor` | color | `#FFFFFF` | Header background |
|
|
87
|
-
| `textColor` | color | `#111827` | Navigation text color |
|
|
88
|
-
| `primaryColor` | color | `#2563EB` | CTA button color |
|
|
89
|
-
|
|
90
|
-
### How Auto-Hide Works
|
|
91
|
-
|
|
92
|
-
The header uses `requestAnimationFrame` for smooth 60fps scroll detection:
|
|
93
|
-
|
|
94
|
-
1. **Scroll down > threshold** (and past 80px from top) → header slides up (`translateY(-100%)`)
|
|
95
|
-
2. **Scroll up > threshold** → header slides back down (`translateY(0)`)
|
|
96
|
-
3. **At very top** (scrollY = 0) → always visible
|
|
97
|
-
4. **In editor** (`isEditing = true`) → auto-hide disabled, always visible
|
|
98
|
-
5. CSS transition: `duration-300 ease-in-out` for smooth animation
|
|
99
|
-
|
|
100
|
-
## Footer Section
|
|
101
|
-
|
|
102
|
-
### Settings
|
|
103
|
-
|
|
104
|
-
| Setting | Type | Default | Description |
|
|
105
|
-
| ------------------ | -------- | -------------------------- | ------------------------------- |
|
|
106
|
-
| `companyName` | text | `"My Site"` | Company name |
|
|
107
|
-
| `description` | textarea | `"A clean and minimal..."` | Company description |
|
|
108
|
-
| `showAboutColumn` | checkbox | `true` | Show/hide about links column |
|
|
109
|
-
| `aboutColumnTitle` | text | `"About"` | About column heading |
|
|
110
|
-
| `aboutLinks` | array | About Us, Contact | About links `[{ label, href }]` |
|
|
111
|
-
| `showLinksColumn` | checkbox | `true` | Show/hide quick links column |
|
|
112
|
-
| `linksColumnTitle` | text | `"Quick Links"` | Links column heading |
|
|
113
|
-
| `quickLinks` | array | Home, Showcase | Quick links `[{ label, href }]` |
|
|
114
|
-
| `copyrightText` | text | `"My Site. All rights..."` | Copyright text |
|
|
115
|
-
| `backgroundColor` | color | `#111827` | Footer background |
|
|
116
|
-
| `textColor` | color | `#9CA3AF` | Body text color |
|
|
117
|
-
| `primaryColor` | color | `#FFFFFF` | Heading color |
|
|
118
|
-
|
|
119
|
-
## Per-Page Visibility
|
|
120
|
-
|
|
121
|
-
Auth pages (login, register, forgot-password, verify-code) have `hideHeader: true` and `hideFooter: true` by default since they're full-screen.
|
|
122
|
-
|
|
123
|
-
### Hide header/footer on a page
|
|
124
|
-
|
|
125
|
-
```ts
|
|
126
|
-
// pages/my-page.ts
|
|
127
|
-
export const myPageConfig = {
|
|
128
|
-
title: "My Page",
|
|
129
|
-
handle: "my-page",
|
|
130
|
-
path: "/my-page",
|
|
131
|
-
hideHeader: true, // ← no header on this page
|
|
132
|
-
hideFooter: true, // ← no footer on this page
|
|
133
|
-
// ...
|
|
134
|
-
};
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Pages with header/footer (default)
|
|
138
|
-
|
|
139
|
-
Pages without `hideHeader`/`hideFooter` get both automatically:
|
|
140
|
-
|
|
141
|
-
| Page | Header | Footer |
|
|
142
|
-
| ------------------------------------ | ------ | ------ |
|
|
143
|
-
| Home (`/`) | Yes | Yes |
|
|
144
|
-
| About (`/about`) | Yes | Yes |
|
|
145
|
-
| Showcase (`/showcase`) | Yes | Yes |
|
|
146
|
-
| Profile (`/profile`) | Yes | Yes |
|
|
147
|
-
| Login (`/login`) | No | No |
|
|
148
|
-
| Register (`/register`) | No | No |
|
|
149
|
-
| Forgot Password (`/forgot-password`) | No | No |
|
|
150
|
-
| Verify Code (`/verify-code`) | No | No |
|
|
151
|
-
|
|
152
|
-
## Customizing in the Editor
|
|
153
|
-
|
|
154
|
-
In the visual editor:
|
|
155
|
-
|
|
156
|
-
1. Go to **Theme Settings** (gear icon)
|
|
157
|
-
2. Open **Header Sections** or **Footer Sections** accordion
|
|
158
|
-
3. Click on the section to edit its settings
|
|
159
|
-
4. Changes apply to all pages that show the header/footer
|
|
160
|
-
|
|
161
|
-
## File Structure
|
|
162
|
-
|
|
163
|
-
```
|
|
164
|
-
sections/
|
|
165
|
-
header/
|
|
166
|
-
header-default.tsx # Component with smart scroll behavior
|
|
167
|
-
header.schema.ts # All settings including scroll behavior
|
|
168
|
-
index.ts
|
|
169
|
-
footer/
|
|
170
|
-
footer-default.tsx # 3-column footer
|
|
171
|
-
footer.schema.ts # Company info, links, copyright settings
|
|
172
|
-
index.ts
|
|
173
|
-
theme.layout.ts # References header/footer with default settings
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Extending
|
|
177
|
-
|
|
178
|
-
### Adding a second header template
|
|
179
|
-
|
|
180
|
-
```ts
|
|
181
|
-
// sections/header/header-centered.tsx
|
|
182
|
-
export function HeaderCentered({ section, schema, isEditing }) { ... }
|
|
183
|
-
|
|
184
|
-
// sections/header/index.ts
|
|
185
|
-
export const headerComponents = {
|
|
186
|
-
default: HeaderDefault,
|
|
187
|
-
centered: HeaderCentered, // ← new template
|
|
188
|
-
};
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Then in `theme.layout.ts`, change `template: "centered"`.
|
|
192
|
-
|
|
193
|
-
### Custom scroll behavior
|
|
194
|
-
|
|
195
|
-
Override the `useHeaderScroll` hook logic in `header-default.tsx`, or create a new template with different behavior. All scroll settings are passed via schema — no code changes needed for basic customization.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Theme Hooks
|
|
3
|
-
* Re-exports all authentication form hooks
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export { useLoginForm } from "./use-login-form";
|
|
7
|
-
export type { LoginFormData, UseLoginFormReturn } from "./use-login-form";
|
|
8
|
-
|
|
9
|
-
export { useRegisterForm } from "./use-register-form";
|
|
10
|
-
export type {
|
|
11
|
-
RegisterFormData,
|
|
12
|
-
UseRegisterFormReturn,
|
|
13
|
-
} from "./use-register-form";
|
|
14
|
-
|
|
15
|
-
export { useForgotPasswordForm } from "./use-forgot-password-form";
|
|
16
|
-
export type { UseForgotPasswordFormReturn } from "./use-forgot-password-form";
|
|
17
|
-
|
|
18
|
-
export { useVerifyCodeForm } from "./use-verify-code-form";
|
|
19
|
-
export type { UseVerifyCodeFormReturn } from "./use-verify-code-form";
|
|
20
|
-
|
|
21
|
-
export { useProfileForm } from "./use-profile-form";
|
|
22
|
-
export type {
|
|
23
|
-
ProfileFormData,
|
|
24
|
-
ChangePasswordData,
|
|
25
|
-
UseProfileFormReturn,
|
|
26
|
-
} from "./use-profile-form";
|