Skip to content

Commit f3c0557

Browse files
committed
feat: docs update
1 parent 7bb96c7 commit f3c0557

26 files changed

+1851
-111
lines changed

app/docs/[slug]/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ export default async function DocPage({
2929
notFound();
3030
}
3131
const breadcrumbs = getBreadcrumbsFromUrl(slug);
32+
const currentPath = `/docs/${slug}`;
3233
console.log({slug});
3334
return <SidebarProvider>
34-
<AppSidebar />
35+
<AppSidebar currentPath={currentPath} />
3536
<SidebarInset>
3637
<header className="flex h-16 shrink-0 items-center justify-between gap-2 border-b px-4">
3738
<SidebarTrigger className="-ml-1" />

app/docs/docs-data/data.ts

Lines changed: 85 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,61 @@
11
import { INTRODUCTION_LAYER } from "@/app/docs/docs-data/docs-page-layers/introduction";
2+
import { QUICK_START_LAYER } from "@/app/docs/docs-data/docs-page-layers/quick-start";
3+
import { COMPONENT_REGISTRY_LAYER } from "@/app/docs/docs-data/docs-page-layers/component-registry";
4+
import { FIELD_OVERRIDES_LAYER } from "@/app/docs/docs-data/docs-page-layers/field-overrides";
5+
import { CUSTOM_COMPONENTS_LAYER } from "@/app/docs/docs-data/docs-page-layers/custom-components";
6+
import { CANVAS_EDITOR_LAYER } from "@/app/docs/docs-data/docs-page-layers/canvas-editor";
7+
import { PAGES_PANEL_LAYER } from "@/app/docs/docs-data/docs-page-layers/pages-panel";
8+
import { VARIABLES_PANEL_LAYER } from "@/app/docs/docs-data/docs-page-layers/variables-panel";
9+
import { PROPS_PANEL_LAYER } from "@/app/docs/docs-data/docs-page-layers/props-panel";
10+
import { APPEARANCE_PANEL_LAYER } from "@/app/docs/docs-data/docs-page-layers/appearance-panel";
11+
import { IMMUTABLE_PAGES_LAYER } from "@/app/docs/docs-data/docs-page-layers/immutable-pages";
12+
import { PANEL_CONFIGURATION_LAYER } from "@/app/docs/docs-data/docs-page-layers/panel-configuration";
13+
import { VARIABLES_LAYER } from "@/app/docs/docs-data/docs-page-layers/variables";
14+
import { VARIABLE_BINDING_LAYER } from "@/app/docs/docs-data/docs-page-layers/variable-binding";
15+
import { READ_ONLY_MODE_LAYER } from "@/app/docs/docs-data/docs-page-layers/read-only-mode";
16+
import { DATA_BINDING_LAYER } from "@/app/docs/docs-data/docs-page-layers/data-binding";
17+
import { LAYER_STRUCTURE_LAYER } from "@/app/docs/docs-data/docs-page-layers/layer-structure";
18+
import { PERSISTENCE_LAYER } from "@/app/docs/docs-data/docs-page-layers/persistence";
19+
import { RENDERING_PAGES_LAYER } from "@/app/docs/docs-data/docs-page-layers/rendering-pages";
20+
import { PAGE_THEMING_LAYER } from "@/app/docs/docs-data/docs-page-layers/page-theming";
21+
import { EDITOR_PANEL_CONFIG_LAYER } from "@/app/docs/docs-data/docs-page-layers/editor-panel-config";
22+
import { PROPS_PANEL_CUSTOMIZATION_LAYER } from "@/app/docs/docs-data/docs-page-layers/props-panel-customization";
223

324
export const DOCS_PAGES = [
4-
INTRODUCTION_LAYER
25+
// Core
26+
INTRODUCTION_LAYER,
27+
QUICK_START_LAYER,
28+
29+
// Component System
30+
COMPONENT_REGISTRY_LAYER,
31+
CUSTOM_COMPONENTS_LAYER,
32+
FIELD_OVERRIDES_LAYER,
33+
34+
// Editor Features
35+
CANVAS_EDITOR_LAYER,
36+
PAGES_PANEL_LAYER,
37+
IMMUTABLE_PAGES_LAYER,
38+
APPEARANCE_PANEL_LAYER,
39+
PROPS_PANEL_LAYER,
40+
VARIABLES_PANEL_LAYER,
41+
PANEL_CONFIGURATION_LAYER,
42+
EDITOR_PANEL_CONFIG_LAYER,
43+
PROPS_PANEL_CUSTOMIZATION_LAYER,
44+
45+
// Data & Variables
46+
VARIABLES_LAYER,
47+
VARIABLE_BINDING_LAYER,
48+
READ_ONLY_MODE_LAYER,
49+
DATA_BINDING_LAYER,
50+
51+
// Layout & Persistence
52+
LAYER_STRUCTURE_LAYER,
53+
PERSISTENCE_LAYER,
54+
55+
// Rendering
56+
RENDERING_PAGES_LAYER,
57+
PAGE_THEMING_LAYER,
58+
559
] as const;
660

761
type ExistingDocPageNames = `${Capitalize<(typeof DOCS_PAGES)[number]["name"]>}`;
@@ -12,8 +66,8 @@ type ExistingDocGroupNames = `${Capitalize<(typeof DOCS_PAGES)[0]["props"]["data
1266
type DocPageNavItem = {
1367
title: ExistingDocGroupNames | string;
1468
items: {
15-
title: ExistingDocPageNames | string;
16-
url: `/${ExistingDocPageIds}` | `/${string}`;
69+
title: ExistingDocPageNames ;
70+
url: `/docs/${ExistingDocPageIds}`;
1771
}[];
1872
}
1973

@@ -23,32 +77,28 @@ export const MENU_DATA: DocPageNavItem[] = [
2377
items: [
2478
{
2579
title: "Introduction",
26-
url: "/introduction",
80+
url: "/docs/introduction",
2781
},
2882
{
2983
title: "Quick Start",
30-
url: "/quick-start",
84+
url: "/docs/quick-start",
3185
},
3286
],
3387
},
3488
{
3589
title: "Component System",
3690
items: [
3791
{
38-
title: "Component Registry",
39-
url: "/component-registry",
92+
title: "Getting Started with Components",
93+
url: "/docs/component-registry",
4094
},
4195
{
42-
title: "Field Overrides",
43-
url: "/field-overrides",
96+
title: "Creating Custom Components",
97+
url: "/docs/custom-components",
4498
},
4599
{
46-
title: "Default Children",
47-
url: "/default-children",
48-
},
49-
{
50-
title: "Custom Components",
51-
url: "/custom-components",
100+
title: "Advanced Component Configuration",
101+
url: "/docs/field-overrides",
52102
}
53103
],
54104
},
@@ -57,43 +107,39 @@ export const MENU_DATA: DocPageNavItem[] = [
57107
items: [
58108
{
59109
title: "Canvas Editor",
60-
url: "/canvas-editor",
110+
url: "/docs/canvas-editor",
61111
},
62112
{
63113
title: "Pages Panel",
64-
url: "/pages-panel",
114+
url: "/docs/pages-panel",
65115
},
66116
{
67117
title: "Immutable Pages",
68-
url: "/immutable-pages",
118+
url: "/docs/immutable-pages",
69119
},
70120
{
71121
title: "Appearance Panel",
72-
url: "/appearance-panel",
122+
url: "/docs/appearance-panel",
73123
},
74124
{
75125
title: "Props Panel",
76-
url: "/props-panel",
126+
url: "/docs/props-panel",
77127
},
78128
{
79129
title: "Variables Panel",
80-
url: "/variables-panel",
130+
url: "/docs/variables-panel",
81131
},
82132
{
83133
title: "Panel Configuration",
84-
url: "/panel-configuration",
134+
url: "/docs/panel-configuration",
85135
},
86136
{
87137
title: "Editor Panel Config",
88-
url: "/editor-panel-config",
89-
},
90-
{
91-
title: "NavBar Customization",
92-
url: "/navbar-customization",
138+
url: "/docs/editor-panel-config",
93139
},
94140
{
95141
title: "Props Panel Customization",
96-
url: "/props-panel-customization",
142+
url: "/docs/props-panel-customization",
97143
},
98144
],
99145
},
@@ -102,19 +148,19 @@ export const MENU_DATA: DocPageNavItem[] = [
102148
items: [
103149
{
104150
title: "Variables",
105-
url: "/variables",
151+
url: "/docs/variables",
106152
},
107153
{
108154
title: "Variable Binding",
109-
url: "/variable-binding",
155+
url: "/docs/variable-binding",
110156
},
111157
{
112-
title: "Read-Only Mode",
113-
url: "/read-only-mode",
158+
title: "Read Only Mode",
159+
url: "/docs/read-only-mode",
114160
},
115161
{
116162
title: "Data Binding",
117-
url: "/data-binding",
163+
url: "/docs/data-binding",
118164
},
119165
],
120166
},
@@ -123,15 +169,11 @@ export const MENU_DATA: DocPageNavItem[] = [
123169
items: [
124170
{
125171
title: "Layer Structure",
126-
url: "/layer-structure",
127-
},
128-
{
129-
title: "Persistence",
130-
url: "/persistence",
172+
url: "/docs/layer-structure",
131173
},
132174
{
133-
title: "Persist Layer Store",
134-
url: "/persist-layer-store",
175+
title: "State Management & Persistence",
176+
url: "/docs/persistence",
135177
},
136178
],
137179
},
@@ -140,27 +182,14 @@ export const MENU_DATA: DocPageNavItem[] = [
140182
items: [
141183
{
142184
title: "Rendering Pages",
143-
url: "/rendering-pages",
185+
url: "/docs/rendering-pages",
144186
},
145187
{
146188
title: "Page Theming",
147-
url: "/page-theming",
189+
url: "/docs/page-theming",
148190
},
149191
],
150-
},
151-
{
152-
title: "Code & Extensibility",
153-
items: [
154-
{
155-
title: "Code Generation",
156-
url: "/code-generation",
157-
},
158-
{
159-
title: "Blocks (Planned)",
160-
url: "/blocks-planned",
161-
},
162-
],
163-
},
192+
}
164193
] as const;
165194

166195

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { ComponentLayer } from "@/components/ui/ui-builder/types";
2+
3+
export const APPEARANCE_PANEL_LAYER = {
4+
"id": "appearance-panel",
5+
"type": "div",
6+
"name": "Appearance Panel",
7+
"props": {
8+
"className": "h-full bg-background px-4 flex flex-col gap-6 min-h-screen",
9+
"data-group": "editor-features"
10+
},
11+
"children": [
12+
{
13+
"type": "span",
14+
"children": "Appearance Panel",
15+
"id": "appearance-panel-title",
16+
"name": "Text",
17+
"props": {
18+
"className": "text-4xl"
19+
}
20+
},
21+
{
22+
"id": "appearance-panel-intro",
23+
"type": "Markdown",
24+
"name": "Markdown",
25+
"props": {},
26+
"children": "The appearance panel provides visual tools for page configuration and Tailwind CSS theme management. Configure page settings and global styling through an intuitive interface that integrates with your design system."
27+
},
28+
{
29+
"id": "appearance-panel-demo",
30+
"type": "div",
31+
"name": "div",
32+
"props": {},
33+
"children": [
34+
{
35+
"id": "appearance-panel-badge",
36+
"type": "Badge",
37+
"name": "Badge",
38+
"props": {
39+
"variant": "default",
40+
"className": "rounded rounded-b-none"
41+
},
42+
"children": [
43+
{
44+
"id": "appearance-panel-badge-text",
45+
"type": "span",
46+
"name": "span",
47+
"props": {},
48+
"children": "Theme & Config"
49+
}
50+
]
51+
},
52+
{
53+
"id": "appearance-panel-demo-frame",
54+
"type": "div",
55+
"name": "div",
56+
"props": {
57+
"className": "border border-primary shadow-lg rounded-b-sm rounded-tr-sm overflow-hidden"
58+
},
59+
"children": [
60+
{
61+
"id": "appearance-panel-iframe",
62+
"type": "iframe",
63+
"name": "iframe",
64+
"props": {
65+
"src": "http://localhost:3000/examples/editor",
66+
"title": "Appearance Panel Demo",
67+
"className": "aspect-square md:aspect-video w-full"
68+
},
69+
"children": []
70+
}
71+
]
72+
}
73+
]
74+
},
75+
{
76+
"id": "appearance-panel-content",
77+
"type": "Markdown",
78+
"name": "Markdown",
79+
"props": {},
80+
"children": "## Panel Components\n\nThe appearance panel consists of two main components:\n\n### ConfigPanel\nManages page-level configuration:\n- **Page Name** - Edit the current page's display name\n- **Page Properties** - Configure page-specific settings\n- **Page Actions** - Duplicate or delete pages\n\n### TailwindThemePanel\nProvides Tailwind CSS theme management:\n- **CSS Variables** - Edit theme CSS custom properties\n- **Color Palette** - Manage theme colors\n- **Theme Toggle** - Switch between light/dark modes\n- **Live Preview** - See theme changes instantly\n\n## Page Configuration\n\nThe ConfigPanel allows you to edit page properties:\n\n```tsx\n// Current page configuration\nconst currentPage = {\n id: 'homepage',\n name: 'Home Page', // Editable in ConfigPanel\n type: 'div',\n props: {\n className: 'min-h-screen bg-background'\n },\n children: []\n};\n\n// ConfigPanel provides:\n// - Page name editing\n// - Duplicate page button\n// - Delete page button (if multiple pages exist)\n```\n\n## Tailwind Theme Management\n\nThe TailwindThemePanel integrates with shadcn/ui's CSS variable system:\n\n### CSS Variables Structure\n\n```css\n/* Light mode variables */\n:root {\n --background: 0 0% 100%;\n --foreground: 222.2 84% 4.9%;\n --primary: 221.2 83.2% 53.3%;\n --primary-foreground: 210 40% 98%;\n --secondary: 210 40% 96%;\n --secondary-foreground: 222.2 84% 4.9%;\n /* ... more variables */\n}\n\n/* Dark mode variables */\n.dark {\n --background: 222.2 84% 4.9%;\n --foreground: 210 40% 98%;\n --primary: 217.2 91.2% 59.8%;\n --primary-foreground: 222.2 84% 4.9%;\n /* ... more variables */\n}\n```\n\n### Theme Editing\n\nThe TailwindThemePanel allows real-time editing of theme variables:\n\n- **Color Pickers** - Visual color selection for theme variables\n- **HSL Values** - Direct HSL value editing\n- **Live Preview** - Changes apply instantly to the editor\n- **Reset Options** - Restore default theme values\n\n## Customizing the Appearance Panel\n\nYou can customize the appearance panel through `panelConfig`:\n\n```tsx\nimport { ConfigPanel } from '@/components/ui/ui-builder/internal/config-panel';\nimport { TailwindThemePanel } from '@/components/ui/ui-builder/internal/tailwind-theme-panel';\n\n// Custom appearance panel content\nconst customAppearancePanel = (\n <div className=\"py-2 px-4 gap-2 flex flex-col overflow-y-auto\">\n <ConfigPanel />\n <TailwindThemePanel />\n {/* Add your custom components */}\n <MyCustomThemeSettings />\n </div>\n);\n\n<UIBuilder\n panelConfig={{\n pageConfigPanelTabsContent: {\n layers: { title: \"Layers\", content: <LayersPanel /> },\n appearance: { \n title: \"Theme\", \n content: customAppearancePanel \n },\n data: { title: \"Data\", content: <VariablesPanel /> }\n }\n }}\n/>\n```\n\n## Theme Integration with Components\n\nComponents automatically inherit theme variables through Tailwind CSS classes:\n\n```tsx\n// Component using theme colors\nconst ThemedButton = {\n component: Button,\n schema: z.object({\n variant: z.enum(['default', 'destructive', 'outline']).default('default'),\n children: z.any().optional()\n }),\n from: '@/components/ui/button'\n};\n\n// Button component CSS (simplified)\n.btn-default {\n background-color: hsl(var(--primary));\n color: hsl(var(--primary-foreground));\n}\n\n.btn-destructive {\n background-color: hsl(var(--destructive));\n color: hsl(var(--destructive-foreground));\n}\n```\n\n## Working with CSS Variables\n\n### Adding Custom Variables\n\nExtend the theme system with custom CSS variables:\n\n```css\n/* In your global CSS */\n:root {\n /* Existing shadcn/ui variables */\n --background: 0 0% 100%;\n --foreground: 222.2 84% 4.9%;\n \n /* Your custom variables */\n --brand-primary: 220 90% 56%;\n --brand-secondary: 340 82% 52%;\n --accent-gradient: linear-gradient(135deg, hsl(var(--brand-primary)), hsl(var(--brand-secondary)));\n}\n\n.dark {\n /* Dark mode overrides */\n --brand-primary: 220 90% 66%;\n --brand-secondary: 340 82% 62%;\n}\n```\n\n### Using Variables in Components\n\n```tsx\n// Component that uses custom theme variables\nconst BrandCard = {\n component: ({ children, className, ...props }) => (\n <div \n className={cn(\n 'p-6 rounded-lg border',\n 'bg-gradient-to-br from-[hsl(var(--brand-primary))] to-[hsl(var(--brand-secondary))]',\n 'text-white',\n className\n )}\n {...props}\n >\n {children}\n </div>\n ),\n schema: z.object({\n className: z.string().optional(),\n children: z.any().optional()\n }),\n from: '@/components/brand-card'\n};\n```\n\n## Responsive Theming\n\nTailwind CSS and the theme panel support responsive design:\n\n```tsx\n// Responsive component using theme variables\nconst ResponsiveHero = {\n type: 'div',\n props: {\n className: [\n 'bg-background text-foreground',\n 'p-4 md:p-8 lg:p-12', // Responsive padding\n 'min-h-screen flex items-center justify-center'\n ].join(' ')\n },\n children: [\n {\n type: 'div',\n props: {\n className: [\n 'text-center max-w-2xl mx-auto',\n 'space-y-4 md:space-y-6 lg:space-y-8'\n ].join(' ')\n },\n children: [\n // Hero content\n ]\n }\n ]\n};\n```\n\n## Theme Persistence\n\nTheme changes are automatically persisted:\n\n- **localStorage** - Theme preferences saved locally\n- **CSS Variables** - Applied immediately to the document\n- **Component Updates** - All components reflect theme changes instantly\n\n## Best Practices\n\n### Theme Design\n- **Use HSL values** for better color manipulation\n- **Maintain contrast ratios** for accessibility\n- **Test both light and dark modes** thoroughly\n- **Keep semantic naming** (primary, secondary, destructive)\n\n### Component Integration\n- **Use theme variables** instead of hardcoded colors\n- **Follow shadcn/ui patterns** for consistency\n- **Test with different themes** to ensure compatibility\n- **Provide fallbacks** for custom variables\n\n### Performance\n- **CSS variables are fast** - they update instantly\n- **Avoid inline styles** when possible\n- **Use Tailwind classes** for optimal performance\n- **Minimize theme variable count** to reduce complexity\n\n## Integration with Design Systems\n\nThe appearance panel works well with existing design systems:\n\n```tsx\n// Design system integration\nconst designSystemTheme = {\n colors: {\n // Map design system colors to CSS variables\n primary: 'hsl(var(--brand-blue))',\n secondary: 'hsl(var(--brand-purple))',\n accent: 'hsl(var(--brand-green))',\n neutral: 'hsl(var(--neutral-500))'\n },\n spacing: {\n // Use consistent spacing scale\n xs: '0.25rem',\n sm: '0.5rem',\n md: '1rem',\n lg: '1.5rem',\n xl: '2rem'\n }\n};\n```"
81+
}
82+
]
83+
} as const satisfies ComponentLayer;

0 commit comments

Comments
 (0)