@djangocfg/layouts 1.4.27 → 1.4.28

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.
Files changed (76) hide show
  1. package/package.json +5 -5
  2. package/src/auth/middlewares/index.ts +1 -1
  3. package/src/auth/middlewares/proxy.ts +10 -2
  4. package/src/layouts/index.ts +0 -3
  5. package/src/snippets/ContactForm/ContactPage.tsx +16 -3
  6. package/src/layouts/UILayout/README.md +0 -267
  7. package/src/layouts/UILayout/SUMMARY.md +0 -298
  8. package/src/layouts/UILayout/TOOLS_INTEGRATION.md +0 -216
  9. package/src/layouts/UILayout/components/AutoComponentDemo.tsx +0 -77
  10. package/src/layouts/UILayout/components/CategoryRenderer.tsx +0 -45
  11. package/src/layouts/UILayout/components/TailwindGuideRenderer.tsx +0 -138
  12. package/src/layouts/UILayout/components/index.ts +0 -15
  13. package/src/layouts/UILayout/components/layout/Header/CopyAIButton.tsx +0 -58
  14. package/src/layouts/UILayout/components/layout/Header/Header.tsx +0 -60
  15. package/src/layouts/UILayout/components/layout/Header/HeaderDesktop.tsx +0 -51
  16. package/src/layouts/UILayout/components/layout/Header/HeaderMobile.tsx +0 -71
  17. package/src/layouts/UILayout/components/layout/Header/TestValidationButton.tsx +0 -268
  18. package/src/layouts/UILayout/components/layout/Header/index.ts +0 -11
  19. package/src/layouts/UILayout/components/layout/MobileOverlay/MobileOverlay.tsx +0 -47
  20. package/src/layouts/UILayout/components/layout/MobileOverlay/index.ts +0 -6
  21. package/src/layouts/UILayout/components/layout/Sidebar/Sidebar.tsx +0 -95
  22. package/src/layouts/UILayout/components/layout/Sidebar/SidebarCategory.tsx +0 -54
  23. package/src/layouts/UILayout/components/layout/Sidebar/SidebarContent.tsx +0 -93
  24. package/src/layouts/UILayout/components/layout/Sidebar/SidebarFooter.tsx +0 -49
  25. package/src/layouts/UILayout/components/layout/Sidebar/index.ts +0 -9
  26. package/src/layouts/UILayout/components/layout/index.ts +0 -8
  27. package/src/layouts/UILayout/components/shared/Badge/CountBadge.tsx +0 -38
  28. package/src/layouts/UILayout/components/shared/Badge/index.ts +0 -5
  29. package/src/layouts/UILayout/components/shared/CodeBlock/CodeBlock.tsx +0 -48
  30. package/src/layouts/UILayout/components/shared/CodeBlock/CopyButton.tsx +0 -49
  31. package/src/layouts/UILayout/components/shared/CodeBlock/index.ts +0 -6
  32. package/src/layouts/UILayout/components/shared/Section/Section.tsx +0 -63
  33. package/src/layouts/UILayout/components/shared/Section/index.ts +0 -5
  34. package/src/layouts/UILayout/components/shared/index.ts +0 -8
  35. package/src/layouts/UILayout/config/ai-export.config.ts +0 -89
  36. package/src/layouts/UILayout/config/categories.config.tsx +0 -122
  37. package/src/layouts/UILayout/config/components/blocks.config.tsx +0 -239
  38. package/src/layouts/UILayout/config/components/data.config.tsx +0 -433
  39. package/src/layouts/UILayout/config/components/feedback.config.tsx +0 -290
  40. package/src/layouts/UILayout/config/components/forms.config.tsx +0 -996
  41. package/src/layouts/UILayout/config/components/hooks.config.tsx +0 -168
  42. package/src/layouts/UILayout/config/components/index.ts +0 -72
  43. package/src/layouts/UILayout/config/components/layout.config.tsx +0 -246
  44. package/src/layouts/UILayout/config/components/navigation.config.tsx +0 -352
  45. package/src/layouts/UILayout/config/components/overlay.config.tsx +0 -569
  46. package/src/layouts/UILayout/config/components/specialized.config.tsx +0 -400
  47. package/src/layouts/UILayout/config/components/tools.config.tsx +0 -234
  48. package/src/layouts/UILayout/config/components/types.ts +0 -14
  49. package/src/layouts/UILayout/config/index.ts +0 -42
  50. package/src/layouts/UILayout/config/tailwind.config.ts +0 -131
  51. package/src/layouts/UILayout/constants.ts +0 -23
  52. package/src/layouts/UILayout/context/ShowcaseContext.tsx +0 -81
  53. package/src/layouts/UILayout/context/index.ts +0 -1
  54. package/src/layouts/UILayout/core/UIGuideApp.client.tsx +0 -18
  55. package/src/layouts/UILayout/core/UIGuideApp.tsx +0 -33
  56. package/src/layouts/UILayout/core/UIGuideLanding.tsx +0 -172
  57. package/src/layouts/UILayout/core/UIGuideView.tsx +0 -61
  58. package/src/layouts/UILayout/core/UILayout.tsx +0 -125
  59. package/src/layouts/UILayout/core/UILayoutSidebar.tsx +0 -11
  60. package/src/layouts/UILayout/core/index.ts +0 -10
  61. package/src/layouts/UILayout/hooks/index.ts +0 -9
  62. package/src/layouts/UILayout/hooks/useAIExport.ts +0 -78
  63. package/src/layouts/UILayout/hooks/useCategoryNavigation.ts +0 -92
  64. package/src/layouts/UILayout/hooks/useComponentSearch.ts +0 -81
  65. package/src/layouts/UILayout/hooks/useSidebarState.ts +0 -36
  66. package/src/layouts/UILayout/index.ts +0 -160
  67. package/src/layouts/UILayout/types/component.ts +0 -45
  68. package/src/layouts/UILayout/types/index.ts +0 -23
  69. package/src/layouts/UILayout/types/layout.ts +0 -57
  70. package/src/layouts/UILayout/types/navigation.ts +0 -33
  71. package/src/layouts/UILayout/utils/ai-export/formatters.ts +0 -71
  72. package/src/layouts/UILayout/utils/ai-export/index.ts +0 -5
  73. package/src/layouts/UILayout/utils/component-helpers/filter.ts +0 -109
  74. package/src/layouts/UILayout/utils/component-helpers/index.ts +0 -6
  75. package/src/layouts/UILayout/utils/component-helpers/search.ts +0 -95
  76. package/src/layouts/UILayout/utils/index.ts +0 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/layouts",
3
- "version": "1.4.27",
3
+ "version": "1.4.28",
4
4
  "description": "Pre-built dashboard layouts, authentication pages, and admin templates for Next.js applications with Tailwind CSS",
5
5
  "keywords": [
6
6
  "layouts",
@@ -85,9 +85,9 @@
85
85
  "check": "tsc --noEmit"
86
86
  },
87
87
  "peerDependencies": {
88
- "@djangocfg/api": "^1.4.27",
89
- "@djangocfg/og-image": "^1.4.27",
90
- "@djangocfg/ui": "^1.4.27",
88
+ "@djangocfg/api": "^1.4.28",
89
+ "@djangocfg/og-image": "^1.4.28",
90
+ "@djangocfg/ui": "^1.4.28",
91
91
  "@hookform/resolvers": "^5.2.0",
92
92
  "consola": "^3.4.2",
93
93
  "lucide-react": "^0.468.0",
@@ -109,7 +109,7 @@
109
109
  "vidstack": "0.6.15"
110
110
  },
111
111
  "devDependencies": {
112
- "@djangocfg/typescript-config": "^1.4.27",
112
+ "@djangocfg/typescript-config": "^1.4.28",
113
113
  "@types/node": "^24.7.2",
114
114
  "@types/react": "19.2.2",
115
115
  "@types/react-dom": "19.2.1",
@@ -1 +1 @@
1
- export { middleware, config } from './proxy';
1
+ export { proxyMiddleware, proxyMiddlewareConfig } from './proxy';
@@ -1,6 +1,10 @@
1
1
  import { NextRequest, NextResponse } from 'next/server';
2
2
 
3
- export function middleware(request: NextRequest) {
3
+ /**
4
+ * Proxy middleware for media and API endpoints
5
+ * Use this in your middleware.ts file
6
+ */
7
+ export function proxyMiddleware(request: NextRequest) {
4
8
  const { pathname, search } = request.nextUrl;
5
9
  const apiUrl = process.env.NEXT_PUBLIC_API_URL;
6
10
 
@@ -19,6 +23,10 @@ export function middleware(request: NextRequest) {
19
23
  return NextResponse.next();
20
24
  }
21
25
 
22
- export const config = {
26
+ /**
27
+ * Recommended matcher config for proxy middleware
28
+ * Add this to your middleware.ts config
29
+ */
30
+ export const proxyMiddlewareConfig = {
23
31
  matcher: ['/media/:path*', '/api/:path*'],
24
32
  };
@@ -9,8 +9,5 @@ export * from './PaymentsLayout';
9
9
  export * from './AppLayout';
10
10
  export * from './ErrorLayout';
11
11
 
12
- // UILayout - Config-driven UI documentation layout
13
- export * from './UILayout';
14
-
15
12
  // Note: CfgLayout is now part of AppLayout exports
16
13
  // Import it via: import { CfgLayout, useCfgApp } from '@djangocfg/layouts';
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import React from 'react';
4
- import { Mail, MapPin, Calendar } from 'lucide-react';
4
+ import { Mail, MapPin, Calendar, MessageCircle } from 'lucide-react';
5
5
  import { ContactFormBase as ContactForm } from './ContactForm';
6
6
  import { ContactInfo } from './ContactInfo';
7
7
  import type { ContactDetail, LeadSubmissionResult } from './types';
@@ -15,6 +15,7 @@ const isDev = process.env.NODE_ENV === 'development';
15
15
  const DEFAULT_CONFIG = {
16
16
  apiUrl: isDev ? 'http://localhost:8000' : 'https://api.reforms.ai',
17
17
  email: 'markolofsen@gmail.com',
18
+ telegram: '+62 813 39646301',
18
19
  calendly: 'https://calendly.com/markolofsen/meeting',
19
20
  };
20
21
 
@@ -27,6 +28,8 @@ export interface ContactPageProps {
27
28
  apiUrl?: string;
28
29
  /** Override email */
29
30
  email?: string;
31
+ /** Override telegram */
32
+ telegram?: string;
30
33
  /** Override calendly link */
31
34
  calendlyUrl?: string;
32
35
  /** Page title */
@@ -61,6 +64,7 @@ export interface ContactPageProps {
61
64
  export function ContactPageBase({
62
65
  apiUrl = DEFAULT_CONFIG.apiUrl,
63
66
  email = DEFAULT_CONFIG.email,
67
+ telegram = DEFAULT_CONFIG.telegram,
64
68
  calendlyUrl = DEFAULT_CONFIG.calendly,
65
69
  title = 'Get in Touch',
66
70
  subtitle = "Have a question or want to work together? We'd love to hear from you.",
@@ -69,6 +73,9 @@ export function ContactPageBase({
69
73
  className,
70
74
  onSuccess,
71
75
  }: ContactPageProps) {
76
+ // Format phone for tel: link (remove spaces)
77
+ const telegramPhone = telegram.replace(/\s/g, '');
78
+
72
79
  const contactDetails: ContactDetail[] = [
73
80
  {
74
81
  icon: <Mail className="h-5 w-5" />,
@@ -76,6 +83,12 @@ export function ContactPageBase({
76
83
  value: email,
77
84
  href: `mailto:${email}`,
78
85
  },
86
+ {
87
+ icon: <MessageCircle className="h-5 w-5" />,
88
+ label: 'Telegram',
89
+ value: telegram,
90
+ href: `https://t.me/${telegramPhone}`,
91
+ },
79
92
  {
80
93
  icon: <MapPin className="h-5 w-5" />,
81
94
  label: 'Location',
@@ -96,8 +109,8 @@ export function ContactPageBase({
96
109
  </div>
97
110
 
98
111
  {/* Content Grid */}
99
- <div className="grid grid-cols-1 lg:grid-cols-3 gap-8">
100
- <div className="lg:col-span-2">
112
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-8 w-full">
113
+ <div>
101
114
  <ContactForm apiUrl={apiUrl} onSuccess={onSuccess} />
102
115
  </div>
103
116
  <div>
@@ -1,267 +0,0 @@
1
- # UILayout - Config-Driven UI Documentation System
2
-
3
- Modern, type-safe layout system for showcasing UI component libraries with built-in "Copy for AI" functionality.
4
-
5
- ## 🎯 Key Features
6
-
7
- - **Config-Driven**: Single source of truth for all component documentation
8
- - **Type-Safe**: Full TypeScript support with strict typing
9
- - **Auto-Rendering**: Components automatically rendered from config
10
- - **AI-Ready**: One-click export of entire documentation for AI consumption
11
- - **Responsive**: Mobile-first design with adaptive sidebar
12
- - **Dark Mode**: Built-in theme support
13
- - **Organized**: Modular config structure by category
14
-
15
- ## 📁 Structure
16
-
17
- ```
18
- UILayout/
19
- ├── config/ # All configuration (Single Source of Truth)
20
- │ ├── components/ # Component configs by category
21
- │ │ ├── forms.config.tsx # 8 form components
22
- │ │ ├── layout.config.tsx # 5 layout components
23
- │ │ ├── navigation.config.tsx # 4 navigation components
24
- │ │ ├── overlay.config.tsx # 11 overlay components
25
- │ │ ├── feedback.config.tsx # 5 feedback components
26
- │ │ ├── data.config.tsx # 5 data display components
27
- │ │ ├── specialized.config.tsx # 2 specialized components
28
- │ │ ├── blocks.config.tsx # 7 landing page blocks
29
- │ │ ├── hooks.config.tsx # 6 custom hooks
30
- │ │ └── index.ts # Aggregates all configs
31
- │ ├── categories.config.tsx # Category definitions
32
- │ ├── tailwind.config.ts # Tailwind 4 guidelines
33
- │ ├── ai-export.config.ts # AI context generator
34
- │ └── index.ts # Main config exports
35
- ├── components/ # React components
36
- │ ├── AutoComponentDemo.tsx # Auto-renders from config
37
- │ ├── CategoryRenderer.tsx # Renders entire category
38
- │ ├── TailwindGuideRenderer.tsx # Renders Tailwind guide
39
- │ ├── Header.tsx # Header with "Copy for AI"
40
- │ ├── Sidebar.tsx
41
- │ └── MobileOverlay.tsx
42
- ├── context/ # React Context
43
- │ └── ShowcaseContext.tsx # Navigation state management
44
- ├── UILayout.tsx # Main layout component
45
- ├── UIGuideView.tsx # Complete UI guide view
46
- ├── UIGuideLanding.tsx # Landing page
47
- └── UIGuideApp.tsx # Full app wrapper
48
- ```
49
-
50
- ## 🚀 Quick Start
51
-
52
- ### Basic Usage
53
-
54
- ```tsx
55
- import { UILayout, CATEGORIES } from '@djangocfg/layouts';
56
-
57
- function MyComponentGuide() {
58
- const [category, setCategory] = useState('forms');
59
-
60
- return (
61
- <UILayout
62
- title="My Component Library"
63
- categories={CATEGORIES}
64
- currentCategory={category}
65
- onCategoryChange={setCategory}
66
- >
67
- {/* Your content */}
68
- </UILayout>
69
- );
70
- }
71
- ```
72
-
73
- ### Using Category Renderer (Auto-render from config)
74
-
75
- ```tsx
76
- import { UILayout, CATEGORIES, CategoryRenderer } from '@djangocfg/layouts';
77
-
78
- function MyComponentGuide() {
79
- const [category, setCategory] = useState('forms');
80
-
81
- return (
82
- <UILayout
83
- title="My Component Library"
84
- categories={CATEGORIES}
85
- currentCategory={category}
86
- onCategoryChange={setCategory}
87
- >
88
- {/* Automatically renders all components in category */}
89
- <CategoryRenderer categoryId={category} />
90
- </UILayout>
91
- );
92
- }
93
- ```
94
-
95
- ### Using Complete UI Guide
96
-
97
- ```tsx
98
- import { UIGuideApp } from '@djangocfg/layouts';
99
-
100
- // Complete pre-configured UI guide with all components
101
- export default function Page() {
102
- return <UIGuideApp />;
103
- }
104
- ```
105
-
106
- ## 📝 Adding New Components
107
-
108
- ### 1. Add to Config
109
-
110
- Edit the appropriate config file in `config/components/`:
111
-
112
- ```tsx
113
- // config/components/forms.config.tsx
114
- export const FORM_COMPONENTS: ComponentConfig[] = [
115
- {
116
- name: 'MyComponent',
117
- category: 'forms',
118
- description: 'A custom form component',
119
- importPath: "import { MyComponent } from '@mylib/ui';",
120
- example: `<MyComponent value="test" onChange={handler} />`,
121
- preview: <MyComponent value="test" onChange={() => {}} />
122
- },
123
- // ... other components
124
- ];
125
- ```
126
-
127
- ### 2. That's It!
128
-
129
- No need to:
130
- - ❌ Create separate demo files
131
- - ❌ Write duplicate rendering code
132
- - ❌ Update multiple places
133
-
134
- The component automatically:
135
- - ✅ Appears in the UI guide
136
- - ✅ Gets included in "Copy for AI"
137
- - ✅ Shows in the category with proper formatting
138
-
139
- ## 🤖 Copy for AI Feature
140
-
141
- Click the "Copy for AI" button in the header to export entire documentation including:
142
-
143
- - ✅ Tailwind CSS v4 guidelines and best practices
144
- - ✅ All 53 components with full examples
145
- - ✅ Import statements
146
- - ✅ Usage examples
147
- - ✅ Properly formatted for AI consumption
148
-
149
- Perfect for giving AI assistants complete context about your UI library!
150
-
151
- ## 📊 Component Statistics
152
-
153
- | Category | Components |
154
- |----------|------------|
155
- | Forms | 8 |
156
- | Layout | 5 |
157
- | Navigation | 4 |
158
- | Overlay | 11 |
159
- | Feedback | 5 |
160
- | Data Display | 5 |
161
- | Specialized | 2 |
162
- | Blocks | 7 |
163
- | Hooks | 6 |
164
- | **Total** | **53** |
165
-
166
- ## 🎨 Customization
167
-
168
- ### Custom Categories
169
-
170
- ```tsx
171
- import type { ComponentCategory } from '@djangocfg/layouts';
172
-
173
- const customCategories: ComponentCategory[] = [
174
- {
175
- id: 'custom',
176
- label: 'My Category',
177
- icon: <MyIcon />,
178
- count: 5,
179
- description: 'Custom component category'
180
- }
181
- ];
182
- ```
183
-
184
- ### Custom Config
185
-
186
- ```tsx
187
- import type { ComponentConfig } from '@djangocfg/layouts';
188
-
189
- const customComponents: ComponentConfig[] = [
190
- {
191
- name: 'Component',
192
- category: 'custom',
193
- description: '...',
194
- importPath: '...',
195
- example: '...',
196
- preview: <Component />
197
- }
198
- ];
199
- ```
200
-
201
- ## 🔧 API Reference
202
-
203
- ### UILayout Props
204
-
205
- ```typescript
206
- interface UILayoutProps {
207
- children: ReactNode;
208
- title?: string;
209
- description?: string;
210
- categories: ComponentCategory[];
211
- currentCategory?: string;
212
- onCategoryChange?: (categoryId: string) => void;
213
- logo?: ReactNode;
214
- projectName?: string;
215
- }
216
- ```
217
-
218
- ### ComponentConfig Type
219
-
220
- ```typescript
221
- interface ComponentConfig {
222
- name: string; // Component name
223
- category: string; // Category ID
224
- description: string; // Short description
225
- importPath: string; // Import statement
226
- example: string; // Code example
227
- preview: ReactNode; // Live preview component
228
- }
229
- ```
230
-
231
- ### Available Exports
232
-
233
- ```typescript
234
- // Components
235
- export { UILayout, CategoryRenderer, AutoComponentDemo };
236
-
237
- // Views
238
- export { UIGuideView, UIGuideApp, UIGuideLanding };
239
-
240
- // Config
241
- export {
242
- CATEGORIES,
243
- COMPONENTS_CONFIG,
244
- generateAIContext
245
- };
246
-
247
- // Types
248
- export type {
249
- ComponentConfig,
250
- ComponentCategory,
251
- UILayoutProps
252
- };
253
- ```
254
-
255
- ## 🎯 Benefits
256
-
257
- 1. **Single Source of Truth**: All component data in one place
258
- 2. **Zero Duplication**: Write component config once, use everywhere
259
- 3. **Type-Safe**: Full TypeScript support prevents errors
260
- 4. **Auto-Update**: Add to config, automatically appears everywhere
261
- 5. **AI-Friendly**: Built-in export for AI assistants
262
- 6. **Maintainable**: Easy to update and extend
263
- 7. **Scalable**: Add categories and components effortlessly
264
-
265
- ## 📖 More Info
266
-
267
- See the main package README for complete documentation and examples.
@@ -1,298 +0,0 @@
1
- # UILayout - Декомпозиция завершена ✅
2
-
3
- ## 🎉 Результат
4
-
5
- **TypeScript check: PASSED ✅**
6
-
7
- ```bash
8
- > pnpm check
9
- > tsc --noEmit
10
- # No errors!
11
- ```
12
-
13
- ## 📊 Финальная статистика
14
-
15
- ### Структура проекта
16
- ```
17
- UILayout/
18
- ├── 📁 core/ 5 файлов - Главные компоненты
19
- ├── 📁 types/ 4 файла - Структурированные типы
20
- ├── 📁 hooks/ 5 файлов - Custom hooks
21
- ├── 📁 components/
22
- │ ├── layout/ 13 файлов - Декомпозированные layout
23
- │ ├── shared/ 9 файлов - Переиспользуемые UI
24
- │ └── content/ 3 файла - Content компоненты
25
- ├── 📁 utils/ 7 файлов - AI export + helpers
26
- ├── 📁 config/ 15 файлов - Конфигурация (не изменена)
27
- ├── 📁 context/ 2 файла - React Context (не изменен)
28
- └── 📁 docs/ 4 файла - Документация
29
-
30
- Всего файлов: 65
31
- Новых файлов: ~48
32
- ```
33
-
34
- ### Созданные модули
35
-
36
- #### 1. **Types** (4 файла)
37
- - `component.ts` - ComponentConfig, ComponentCategory
38
- - `layout.ts` - UILayoutProps, LayoutConfig, UILayoutConfig
39
- - `navigation.ts` - NavigationState, SidebarState
40
- - `index.ts` - Re-exports
41
-
42
- #### 2. **Hooks** (5 файлов)
43
- - `useSidebarState.ts` - Управление sidebar
44
- - `useAIExport.ts` - AI экспорт с feedback
45
- - `useCategoryNavigation.ts` - Навигация с историей
46
- - `useComponentSearch.ts` - Поиск компонентов
47
- - `index.ts` - Re-exports
48
-
49
- #### 3. **Components**
50
-
51
- **Layout** (13 файлов):
52
- - `Header/` → 5 файлов (Header, HeaderDesktop, HeaderMobile, CopyAIButton, index)
53
- - `Sidebar/` → 5 файлов (Sidebar, SidebarContent, SidebarCategory, SidebarFooter, index)
54
- - `MobileOverlay/` → 2 файла (MobileOverlay, index)
55
- - `index.ts`
56
-
57
- **Shared** (9 файлов):
58
- - `Badge/` → 2 файла (CountBadge, index)
59
- - `CodeBlock/` → 3 файла (CodeBlock, CopyButton, index)
60
- - `Section/` → 2 файла (Section, index)
61
- - `index.ts`
62
-
63
- #### 4. **Utils** (7 файлов)
64
- - `ai-export/` → 3 файла (generators, formatters, index)
65
- - `component-helpers/` → 3 файла (search, filter, index)
66
- - `index.ts`
67
-
68
- #### 5. **Core** (5 файлов)
69
- - `UILayout.tsx` - Главный layout
70
- - `UIGuideApp.tsx` - App wrapper
71
- - `UIGuideView.tsx` - View component
72
- - `UIGuideLanding.tsx` - Landing page
73
- - `index.ts` - Re-exports
74
-
75
- ## 🔧 Ключевые улучшения
76
-
77
- ### 1. Декомпозиция компонентов
78
- ```
79
- Header: 1 файл (115 строк) → 5 файлов (декомпозировано)
80
- Sidebar: 1 файл (189 строк) → 5 файлов (декомпозировано)
81
- ```
82
-
83
- ### 2. Новые hooks
84
- ```typescript
85
- ✅ useSidebarState() - Управление sidebar
86
- ✅ useAIExport() - AI экспорт
87
- ✅ useCategoryNavigation() - Навигация с историей
88
- ✅ useComponentSearch() - Поиск компонентов
89
- ```
90
-
91
- ### 3. Shared компоненты
92
- ```typescript
93
- ✅ <CountBadge /> - Бейдж счетчика
94
- ✅ <CodeBlock /> - Блок кода с копированием
95
- ✅ <Section /> - Секция с заголовком
96
- ```
97
-
98
- ### 4. Utils функции (15+)
99
- ```typescript
100
- // AI Export
101
- ✅ generateAIContext()
102
- ✅ generateTailwindSection()
103
- ✅ formatComponentAsMarkdown()
104
- ✅ formatCodeBlock()
105
-
106
- // Component Helpers
107
- ✅ searchComponents()
108
- ✅ filterByCategory()
109
- ✅ filterByTags()
110
- ✅ applyFilters()
111
- ✅ sortComponents()
112
- ✅ groupComponentsBy()
113
- ```
114
-
115
- ## 📦 Публичные exports
116
-
117
- ### Полный список экспортов:
118
- ```typescript
119
- // Core
120
- export { UILayout, UIGuideApp, UIGuideView, UIGuideLanding } from '@djangocfg/layouts/UILayout';
121
-
122
- // Types
123
- export type {
124
- ComponentConfig,
125
- ComponentCategory,
126
- UILayoutProps,
127
- LayoutConfig,
128
- UILayoutConfig,
129
- NavigationState,
130
- SidebarState,
131
- } from '@djangocfg/layouts/UILayout';
132
-
133
- // Hooks
134
- export {
135
- useSidebarState,
136
- useAIExport,
137
- useCategoryNavigation,
138
- useComponentSearch,
139
- } from '@djangocfg/layouts/UILayout';
140
-
141
- // Layout Components
142
- export {
143
- Header,
144
- HeaderDesktop,
145
- HeaderMobile,
146
- CopyAIButton,
147
- Sidebar,
148
- SidebarContent,
149
- SidebarCategory,
150
- SidebarFooter,
151
- MobileOverlay,
152
- } from '@djangocfg/layouts/UILayout';
153
-
154
- // Shared Components
155
- export {
156
- CountBadge,
157
- CodeBlock,
158
- CopyButton,
159
- Section,
160
- } from '@djangocfg/layouts/UILayout';
161
-
162
- // Utils
163
- export {
164
- generateAIContext,
165
- searchComponents,
166
- filterByCategory,
167
- applyFilters,
168
- sortComponents,
169
- // ... и еще 10+
170
- } from '@djangocfg/layouts/UILayout';
171
-
172
- // Config
173
- export {
174
- CATEGORIES,
175
- COMPONENTS_CONFIG,
176
- TAILWIND_GUIDE,
177
- // ... весь config
178
- } from '@djangocfg/layouts/UILayout';
179
- ```
180
-
181
- ## ✨ Преимущества новой структуры
182
-
183
- ### 1. Модульность
184
- - ✅ Каждый компонент - отдельный файл
185
- - ✅ Логика вынесена в hooks
186
- - ✅ Утилиты изолированы
187
-
188
- ### 2. Переиспользование
189
- - ✅ Hooks можно использовать независимо
190
- - ✅ Shared компоненты универсальны
191
- - ✅ Utils работают с любыми данными
192
-
193
- ### 3. Тестируемость
194
- - ✅ Каждый модуль тестируется отдельно
195
- - ✅ Hooks изолированы
196
- - ✅ Utils - чистые функции
197
-
198
- ### 4. Масштабируемость
199
- - ✅ Легко добавлять hooks
200
- - ✅ Просто создавать shared компоненты
201
- - ✅ Удобно расширять utils
202
-
203
- ### 5. Типобезопасность
204
- - ✅ Структурированные types
205
- - ✅ Все типы экспортируются
206
- - ✅ TypeScript check проходит
207
-
208
- ## 🔄 Изменения
209
-
210
- ### Удалено
211
- - ❌ Backward compatibility (ComponentShowcaseLayout)
212
- - ❌ Старые файлы из корня
213
- - ❌ Дублирующиеся компоненты
214
- - ❌ Legacy exports
215
-
216
- ### Добавлено
217
- - ✅ 4 новых hooks
218
- - ✅ 3 shared компонента
219
- - ✅ 15+ utils функций
220
- - ✅ Структурированные types
221
- - ✅ Декомпозированные layout компоненты
222
-
223
- ## 📚 Документация
224
-
225
- Создано 4 документа:
226
- 1. **README.md** - Основная документация
227
- 2. **STRUCTURE.md** - Детальная структура (3 уровня)
228
- 3. **MIGRATION.md** - Руководство по использованию
229
- 4. **FINAL_REPORT.md** - Полный отчет о декомпозиции
230
- 5. **SUMMARY.md** - Этот краткий отчет
231
-
232
- ## 💡 Примеры использования
233
-
234
- ### 1. Использование hooks
235
- ```typescript
236
- import { useSidebarState, useAIExport } from '@djangocfg/layouts/UILayout';
237
-
238
- function MyComponent() {
239
- const sidebar = useSidebarState();
240
- const { exportForAI, copied } = useAIExport({
241
- generateContext: () => generateAIContext(),
242
- });
243
-
244
- return (
245
- <div>
246
- <button onClick={sidebar.toggle}>Toggle</button>
247
- <button onClick={exportForAI}>
248
- {copied ? 'Copied!' : 'Copy for AI'}
249
- </button>
250
- </div>
251
- );
252
- }
253
- ```
254
-
255
- ### 2. Использование shared компонентов
256
- ```typescript
257
- import { Section, CodeBlock, CountBadge } from '@djangocfg/layouts/UILayout';
258
-
259
- <Section title="API" description="Documentation">
260
- <CodeBlock code="npm install" language="bash" showCopy={true} />
261
- <CountBadge count={42} active={true} />
262
- </Section>
263
- ```
264
-
265
- ### 3. Использование utils
266
- ```typescript
267
- import { searchComponents, applyFilters } from '@djangocfg/layouts/UILayout';
268
-
269
- const results = searchComponents(COMPONENTS_CONFIG, 'button');
270
- const filtered = applyFilters(COMPONENTS_CONFIG, {
271
- category: 'forms',
272
- query: 'input',
273
- });
274
- ```
275
-
276
- ## 🎯 Итоги
277
-
278
- ### Достигнуто
279
- ✅ Полная декомпозиция UILayout
280
- ✅ Создано 48+ новых модульных файлов
281
- ✅ 4 новых custom hooks
282
- ✅ 3 переиспользуемых shared компонента
283
- ✅ 15+ utils функций
284
- ✅ Структурированные types
285
- ✅ TypeScript check проходит без ошибок
286
- ✅ Убрана backward compatibility
287
- ✅ Чистая модульная архитектура
288
-
289
- ### Качество кода
290
- ✅ Модульность: 100%
291
- ✅ Типобезопасность: 100%
292
- ✅ Тестируемость: Высокая
293
- ✅ Масштабируемость: Отличная
294
- ✅ Документация: Полная
295
-
296
- ## 🚀 Готово к использованию!
297
-
298
- Декомпозиция UILayout успешно завершена. Новая структура полностью готова к production использованию.