@zoyth/simple-site-framework 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/LICENSE +21 -0
- package/README.md +572 -0
- package/bin/create-simple-site.js +390 -0
- package/bin/simple-site.js +664 -0
- package/dist/client.js +135 -0
- package/dist/client.js.map +1 -0
- package/dist/client.mjs +107 -0
- package/dist/client.mjs.map +1 -0
- package/dist/components/index.d.mts +3936 -0
- package/dist/components/index.d.ts +3936 -0
- package/dist/components/index.js +38265 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +38173 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/config/index.d.mts +298 -0
- package/dist/config/index.d.ts +298 -0
- package/dist/config/index.js +19 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.mjs +1 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/index.d.mts +2184 -0
- package/dist/index.d.ts +2184 -0
- package/dist/index.js +1713 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1605 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/i18n/index.js +665 -0
- package/dist/lib/i18n/index.js.map +1 -0
- package/dist/lib/i18n/index.mjs +621 -0
- package/dist/lib/i18n/index.mjs.map +1 -0
- package/docs/DOCUMENTATION-STRUCTURE.md +1156 -0
- package/docs/EXPORTS.md +125 -0
- package/docs/PERFORMANCE.md +757 -0
- package/docs/POLICY-PAGES.md +867 -0
- package/docs/ROADMAP.md +334 -0
- package/docs/SEO.md +455 -0
- package/docs/SITEMAP.md +708 -0
- package/docs/STRUCTURED-DATA.md +671 -0
- package/docs/accessibility/common-patterns.md +529 -0
- package/docs/accessibility/keyboard-navigation.md +263 -0
- package/docs/accessibility/overview.md +122 -0
- package/docs/accessibility/screen-readers.md +311 -0
- package/docs/accessibility/wcag-compliance.md +159 -0
- package/docs/api/README.md +164 -0
- package/docs/api/components/Accessibility.md +356 -0
- package/docs/api/components/Button.md +240 -0
- package/docs/api/components/HeroSection.md +306 -0
- package/docs/architecture/decisions.md +449 -0
- package/docs/components/AnalyticsTracker.md +58 -0
- package/docs/components/AnimatedCounter.md +48 -0
- package/docs/components/AnimatedSection.md +56 -0
- package/docs/components/BlogCard.md +42 -0
- package/docs/components/Checkbox.md +56 -0
- package/docs/components/CodeBlock.md +52 -0
- package/docs/components/ComparisonTable.md +40 -0
- package/docs/components/ComponentDemo.md +38 -0
- package/docs/components/CountdownTimer.md +51 -0
- package/docs/components/ExitIntentModal.md +56 -0
- package/docs/components/FAQAccordion.md +66 -0
- package/docs/components/FeaturesGrid.md +55 -0
- package/docs/components/FileUpload.md +54 -0
- package/docs/components/I18nMetaTags.md +55 -0
- package/docs/components/Icon.md +53 -0
- package/docs/components/LazySection.md +46 -0
- package/docs/components/LiveProof.md +53 -0
- package/docs/components/LoadingSpinner.md +46 -0
- package/docs/components/MultiStepForm.md +48 -0
- package/docs/components/PolicyLayout.md +55 -0
- package/docs/components/PricingTable.md +49 -0
- package/docs/components/Radio.md +59 -0
- package/docs/components/SEOMetaTags.md +58 -0
- package/docs/components/ScriptInjector.md +50 -0
- package/docs/components/Select.md +72 -0
- package/docs/components/Skeleton.md +47 -0
- package/docs/components/StatsSection.md +48 -0
- package/docs/components/StickyBar.md +62 -0
- package/docs/components/StructuredData.md +99 -0
- package/docs/components/StyleGuide.md +46 -0
- package/docs/components/TableOfContents.md +47 -0
- package/docs/components/TestimonialCarousel.md +42 -0
- package/docs/components/Timeline.md +51 -0
- package/docs/components/Toast.md +59 -0
- package/docs/components/TrackedLink.md +62 -0
- package/docs/components/TrustBadges.md +44 -0
- package/docs/components/conversion/MobileCTA.md +363 -0
- package/docs/components/forms/ContactForm.md +75 -0
- package/docs/components/forms/FormField.md +74 -0
- package/docs/components/layout/Footer.md +601 -0
- package/docs/components/layout/Header.md +549 -0
- package/docs/components/layout/LanguageSelector.md +54 -0
- package/docs/components/layout/LanguageSwitcher.md +24 -0
- package/docs/components/overview.md +447 -0
- package/docs/components/sections/AboutSection.md +48 -0
- package/docs/components/sections/CTASection.md +596 -0
- package/docs/components/sections/CaseStudySection.md +47 -0
- package/docs/components/sections/ContactSection.md +599 -0
- package/docs/components/sections/FeatureSection.md +44 -0
- package/docs/components/sections/HeroSection.md +404 -0
- package/docs/components/sections/LogosSection.md +47 -0
- package/docs/components/sections/PersonalTaxesSection.md +23 -0
- package/docs/components/sections/RecruitingSection.md +23 -0
- package/docs/components/sections/SecurePortalSection.md +23 -0
- package/docs/components/sections/ServicePageLayout.md +52 -0
- package/docs/components/sections/ServicesSection.md +49 -0
- package/docs/components/sections/TestimonialSection.md +44 -0
- package/docs/components/sections/WhyChooseUsSection.md +54 -0
- package/docs/components/ui/Breadcrumb.md +70 -0
- package/docs/components/ui/Button.md +514 -0
- package/docs/components/ui/Card.md +501 -0
- package/docs/components/ui/Input.md +54 -0
- package/docs/components/ui/MobileLinks.md +43 -0
- package/docs/components/ui/Modal.md +60 -0
- package/docs/components/ui/Tabs.md +62 -0
- package/docs/components/ui/Textarea.md +52 -0
- package/docs/core-concepts/configuration-driven.md +552 -0
- package/docs/core-concepts/overview.md +351 -0
- package/docs/features/accessibility/README.md +73 -0
- package/docs/features/accessibility/aria-support.md +177 -0
- package/docs/features/accessibility/color-contrast.md +155 -0
- package/docs/features/accessibility/focus-management.md +187 -0
- package/docs/features/accessibility/testing.md +196 -0
- package/docs/features/analytics/README.md +51 -0
- package/docs/features/analytics/ab-testing.md +171 -0
- package/docs/features/analytics/conversion-tracking.md +207 -0
- package/docs/features/analytics/custom-events.md +219 -0
- package/docs/features/analytics/privacy.md +198 -0
- package/docs/features/analytics/setup.md +114 -0
- package/docs/features/analytics/tracking-events.md +224 -0
- package/docs/features/i18n/README.md +51 -0
- package/docs/features/i18n/best-practices.md +273 -0
- package/docs/features/i18n/configuration.md +84 -0
- package/docs/features/i18n/formatting.md +133 -0
- package/docs/features/i18n/locale-detection.md +122 -0
- package/docs/features/i18n/routing.md +99 -0
- package/docs/features/i18n/rtl-support.md +191 -0
- package/docs/features/i18n/translations.md +129 -0
- package/docs/features/internationalization.md +595 -0
- package/docs/features/performance/README.md +77 -0
- package/docs/features/performance/bundle-size.md +134 -0
- package/docs/features/performance/caching.md +131 -0
- package/docs/features/performance/code-splitting.md +121 -0
- package/docs/features/performance/image-optimization.md +110 -0
- package/docs/features/performance/lazy-loading.md +92 -0
- package/docs/features/performance/monitoring.md +148 -0
- package/docs/features/seo/README.md +51 -0
- package/docs/features/seo/best-practices.md +184 -0
- package/docs/features/seo/canonical-urls.md +182 -0
- package/docs/features/seo/meta-tags.md +126 -0
- package/docs/features/seo/open-graph.md +166 -0
- package/docs/features/seo/robots-txt.md +146 -0
- package/docs/features/seo/sitemaps.md +162 -0
- package/docs/features/seo/structured-data.md +166 -0
- package/docs/getting-started/installation.md +292 -0
- package/docs/getting-started/introduction.md +195 -0
- package/docs/getting-started/quick-start.md +460 -0
- package/docs/guides/analytics-setup.md +616 -0
- package/docs/i18n/CONFIGURATION.md +353 -0
- package/docs/i18n/EXAMPLES.md +402 -0
- package/docs/i18n/MIGRATION.md +260 -0
- package/docs/i18n/SEO.md +392 -0
- package/docs/i18n/STATIC-GENERATION-FIX.md +71 -0
- package/docs/migration/changelog.md +136 -0
- package/docs/migration/overview.md +233 -0
- package/docs/recipes/adding-animations.md +475 -0
- package/docs/recipes/forms-with-validation.md +393 -0
- package/package.json +152 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
# Core Concepts
|
|
2
|
+
|
|
3
|
+
Understanding these core concepts will help you work effectively with Simple Site Framework.
|
|
4
|
+
|
|
5
|
+
## The Framework Philosophy
|
|
6
|
+
|
|
7
|
+
Simple Site Framework is built on three foundational principles:
|
|
8
|
+
|
|
9
|
+
### 1. Configuration Over Code
|
|
10
|
+
|
|
11
|
+
Instead of writing component markup repeatedly, you define your site in configuration files. The framework handles rendering, responsive design, accessibility, and performance automatically.
|
|
12
|
+
|
|
13
|
+
**Traditional Approach:**
|
|
14
|
+
```typescript
|
|
15
|
+
// Repeated across every page
|
|
16
|
+
<section className="py-20 px-4">
|
|
17
|
+
<div className="max-w-6xl mx-auto">
|
|
18
|
+
<h1 className="text-4xl font-bold text-center mb-4">
|
|
19
|
+
Welcome to Our Site
|
|
20
|
+
</h1>
|
|
21
|
+
<p className="text-xl text-gray-600 text-center max-w-2xl mx-auto">
|
|
22
|
+
We help businesses grow
|
|
23
|
+
</p>
|
|
24
|
+
<div className="flex justify-center gap-4 mt-8">
|
|
25
|
+
<a href="/contact" className="px-6 py-3 bg-blue-600 text-white rounded-lg">
|
|
26
|
+
Get Started
|
|
27
|
+
</a>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</section>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Framework Approach:**
|
|
34
|
+
```typescript
|
|
35
|
+
<HeroSection
|
|
36
|
+
heading="Welcome to Our Site"
|
|
37
|
+
description="We help businesses grow"
|
|
38
|
+
cta={{ text: 'Get Started', href: '/contact' }}
|
|
39
|
+
variant="centered"
|
|
40
|
+
/>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The framework ensures consistency, accessibility, and responsive design automatically.
|
|
44
|
+
|
|
45
|
+
### 2. Type Safety First
|
|
46
|
+
|
|
47
|
+
Every configuration option, prop, and utility function is fully typed with TypeScript. This catches errors at build time, provides autocomplete in your editor, and serves as inline documentation.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import type { HeroSectionProps, LocalizedString, ThemeConfig } from '@zoyth/simple-site-framework';
|
|
51
|
+
|
|
52
|
+
// TypeScript knows exactly what's expected
|
|
53
|
+
const heading: LocalizedString = {
|
|
54
|
+
en: 'Welcome',
|
|
55
|
+
fr: 'Bienvenue'
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Autocomplete shows all available variants
|
|
59
|
+
<HeroSection variant="centered" | "split" | "minimal" />
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Progressive Enhancement
|
|
63
|
+
|
|
64
|
+
Start simple and add complexity only when needed:
|
|
65
|
+
|
|
66
|
+
1. **Basic:** Use pre-built sections with minimal props
|
|
67
|
+
2. **Customized:** Add your content and theme
|
|
68
|
+
3. **Enhanced:** Override specific props or add custom styling
|
|
69
|
+
4. **Advanced:** Create custom variants while keeping framework benefits
|
|
70
|
+
|
|
71
|
+
You're never locked in - every component accepts `className` for escape hatches.
|
|
72
|
+
|
|
73
|
+
## Key Architectural Decisions
|
|
74
|
+
|
|
75
|
+
### Server Components by Default
|
|
76
|
+
|
|
77
|
+
The framework leverages Next.js Server Components for optimal performance:
|
|
78
|
+
|
|
79
|
+
- **Most components** are server-rendered by default (HeroSection, AboutSection, etc.)
|
|
80
|
+
- **Client-only components** are explicitly marked and exported from `/client`
|
|
81
|
+
- **No unnecessary JavaScript** - only interactive components ship client code
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// Server component (default export)
|
|
85
|
+
import { HeroSection } from '@zoyth/simple-site-framework';
|
|
86
|
+
|
|
87
|
+
// Client component (explicit /client export)
|
|
88
|
+
import { AnalyticsTracker } from '@zoyth/simple-site-framework/client';
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
See **[Server/Client Split](./server-client-split.md)** for details.
|
|
92
|
+
|
|
93
|
+
### Composition Over Inheritance
|
|
94
|
+
|
|
95
|
+
Components are designed to compose together naturally:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
<main>
|
|
99
|
+
<HeroSection {...heroProps} />
|
|
100
|
+
<FeaturesGrid {...featuresProps} />
|
|
101
|
+
<TestimonialSection {...testimonialProps} />
|
|
102
|
+
<CTASection {...ctaProps} />
|
|
103
|
+
</main>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Each section is self-contained but works seamlessly with others.
|
|
107
|
+
|
|
108
|
+
### Minimal Dependencies
|
|
109
|
+
|
|
110
|
+
The framework has intentionally minimal dependencies:
|
|
111
|
+
|
|
112
|
+
- **Required:** `clsx`, `tailwind-merge` (tiny utilities)
|
|
113
|
+
- **Peer dependencies:** Next.js, React, Tailwind (you install what you need)
|
|
114
|
+
- **Optional:** `framer-motion`, `react-hook-form`, `zod` (only if you use those features)
|
|
115
|
+
|
|
116
|
+
This keeps your bundle small and gives you control over what's included.
|
|
117
|
+
|
|
118
|
+
## How Components Work
|
|
119
|
+
|
|
120
|
+
### Section Components
|
|
121
|
+
|
|
122
|
+
Large, complete page sections ready to use:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
<HeroSection /> // Hero banner with heading, description, CTA
|
|
126
|
+
<AboutSection /> // Company story, team, stats
|
|
127
|
+
<ServicesSection /> // Service offerings grid
|
|
128
|
+
<ContactSection /> // Contact form with location info
|
|
129
|
+
<CTASection /> // Conversion-focused call-to-action
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
These handle:
|
|
133
|
+
- Responsive layout
|
|
134
|
+
- Accessibility (ARIA, keyboard nav, focus management)
|
|
135
|
+
- Internationalization
|
|
136
|
+
- Theme integration
|
|
137
|
+
- Performance (lazy loading where appropriate)
|
|
138
|
+
|
|
139
|
+
### Layout Components
|
|
140
|
+
|
|
141
|
+
Persistent elements that appear across pages:
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
<Header /> // Site navigation with logo, menu, CTA
|
|
145
|
+
<Footer /> // Site footer with links, social, legal
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### UI Components
|
|
149
|
+
|
|
150
|
+
Building blocks for custom layouts:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
<Button /> // Themeable button with variants
|
|
154
|
+
<Card /> // Container with shadow and border
|
|
155
|
+
<Input /> // Form input with validation support
|
|
156
|
+
<Modal /> // Accessible dialog
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Form Components
|
|
160
|
+
|
|
161
|
+
Production-ready forms with validation:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
<ContactForm /> // Complete contact form with React Hook Form + Zod
|
|
165
|
+
<FormField /> // Individual field with label, error, help text
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Conversion Components
|
|
169
|
+
|
|
170
|
+
Specialized components for improving conversion rates:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
<MobileCTA /> // Sticky mobile CTA that appears on scroll
|
|
174
|
+
<CTASection /> // Full-width conversion section
|
|
175
|
+
<LiveProof /> // Social proof notification system
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Content Management
|
|
179
|
+
|
|
180
|
+
### LocalizedString Type
|
|
181
|
+
|
|
182
|
+
All user-facing text uses the `LocalizedString` type:
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
type LocalizedString = {
|
|
186
|
+
[locale: string]: string;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// Single language
|
|
190
|
+
const heading = "Welcome";
|
|
191
|
+
|
|
192
|
+
// Multi-language
|
|
193
|
+
const heading: LocalizedString = {
|
|
194
|
+
en: "Welcome",
|
|
195
|
+
fr: "Bienvenue",
|
|
196
|
+
es: "Bienvenido"
|
|
197
|
+
};
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Components automatically display the correct language based on the `locale` prop.
|
|
201
|
+
|
|
202
|
+
### Configuration Files
|
|
203
|
+
|
|
204
|
+
Organize content and settings in dedicated config files:
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
// src/config/site.ts
|
|
208
|
+
export const siteConfig = {
|
|
209
|
+
name: 'Your Company',
|
|
210
|
+
description: 'Professional services',
|
|
211
|
+
url: 'https://yourcompany.com',
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// src/config/theme.ts
|
|
215
|
+
export const themeConfig = {
|
|
216
|
+
colors: {
|
|
217
|
+
primary: '#F16531',
|
|
218
|
+
secondary: '#2D3748',
|
|
219
|
+
},
|
|
220
|
+
fonts: {
|
|
221
|
+
heading: 'Playfair Display',
|
|
222
|
+
body: 'Inter',
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// src/config/navigation.ts
|
|
227
|
+
export const navigation = [
|
|
228
|
+
{ label: 'Home', href: '/' },
|
|
229
|
+
{ label: 'About', href: '/about' },
|
|
230
|
+
{ label: 'Services', href: '/services' },
|
|
231
|
+
];
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
This separates content from code and makes updates easier.
|
|
235
|
+
|
|
236
|
+
## Styling System
|
|
237
|
+
|
|
238
|
+
### Tailwind CSS Integration
|
|
239
|
+
|
|
240
|
+
The framework is built on Tailwind CSS:
|
|
241
|
+
|
|
242
|
+
- **Utility-first** - Use Tailwind classes directly
|
|
243
|
+
- **Theme tokens** - Define once in `tailwind.config.ts`, use everywhere
|
|
244
|
+
- **Custom classes** - Every component accepts `className` prop
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
<HeroSection
|
|
248
|
+
heading="Welcome"
|
|
249
|
+
className="bg-gradient-to-r from-blue-600 to-purple-600"
|
|
250
|
+
/>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Theme Tokens
|
|
254
|
+
|
|
255
|
+
Components use semantic theme tokens:
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
// In tailwind.config.ts
|
|
259
|
+
colors: {
|
|
260
|
+
primary: '#F16531',
|
|
261
|
+
'primary-hover': '#D9551C',
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Components automatically use these
|
|
265
|
+
<Button variant="filled" /> // Uses bg-primary
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
See **[Theme System](./theme-system.md)** for complete customization.
|
|
269
|
+
|
|
270
|
+
## Performance Strategy
|
|
271
|
+
|
|
272
|
+
### Code Splitting
|
|
273
|
+
|
|
274
|
+
The framework uses smart code splitting:
|
|
275
|
+
|
|
276
|
+
- **Heavy dependencies** (framer-motion) are loaded only when used
|
|
277
|
+
- **Client components** are separated from server components
|
|
278
|
+
- **Dynamic imports** for optional features
|
|
279
|
+
|
|
280
|
+
### Lazy Loading
|
|
281
|
+
|
|
282
|
+
Sections below the fold can be lazy-loaded:
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
<LazySection>
|
|
286
|
+
<TestimonialSection {...props} />
|
|
287
|
+
</LazySection>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Optimized Assets
|
|
291
|
+
|
|
292
|
+
Framework components work with Next.js optimizations:
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import Image from 'next/image';
|
|
296
|
+
|
|
297
|
+
<HeroSection
|
|
298
|
+
backgroundImage="/hero.jpg" // Automatically optimized by Next.js
|
|
299
|
+
/>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Error Handling
|
|
303
|
+
|
|
304
|
+
### Type Safety
|
|
305
|
+
|
|
306
|
+
TypeScript catches most errors at build time:
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
// ❌ TypeScript error - missing required prop
|
|
310
|
+
<HeroSection description="..." />
|
|
311
|
+
|
|
312
|
+
// ✅ Correct
|
|
313
|
+
<HeroSection heading="..." description="..." />
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Runtime Validation
|
|
317
|
+
|
|
318
|
+
Components validate props at runtime in development:
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
// Warns in development if locale is missing
|
|
322
|
+
<HeroSection
|
|
323
|
+
heading={{ en: 'Welcome', fr: 'Bienvenue' }}
|
|
324
|
+
locale={undefined} // ⚠️ Warning in dev console
|
|
325
|
+
/>
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Graceful Degradation
|
|
329
|
+
|
|
330
|
+
Components handle missing data gracefully:
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
// If testimonials array is empty, section doesn't render
|
|
334
|
+
<TestimonialSection testimonials={[]} />
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## Next Steps
|
|
338
|
+
|
|
339
|
+
Dive deeper into specific concepts:
|
|
340
|
+
|
|
341
|
+
- **[Configuration-Driven Design](./configuration-driven.md)** - Learn the config approach
|
|
342
|
+
- **[Internationalization](./internationalization.md)** - Multi-language support
|
|
343
|
+
- **[Server/Client Split](./server-client-split.md)** - Understanding the architecture
|
|
344
|
+
- **[Theme System](./theme-system.md)** - Customize appearance
|
|
345
|
+
- **[Performance](./performance.md)** - Optimization strategies
|
|
346
|
+
|
|
347
|
+
Or jump to practical guides:
|
|
348
|
+
|
|
349
|
+
- **[Components Overview](../components/overview.md)** - Explore all components
|
|
350
|
+
- **[Building a Landing Page](../guides/landing-page.md)** - Complete tutorial
|
|
351
|
+
- **[SEO Optimization](../guides/seo-optimization.md)** - Ranking and discoverability
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Accessibility
|
|
2
|
+
|
|
3
|
+
Build inclusive, accessible websites that work for everyone.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Simple Site Framework is built with accessibility as a core concern:
|
|
8
|
+
|
|
9
|
+
- Semantic HTML throughout
|
|
10
|
+
- ARIA attributes on interactive components
|
|
11
|
+
- Keyboard navigation support
|
|
12
|
+
- Screen reader compatibility
|
|
13
|
+
- Color contrast compliance
|
|
14
|
+
- Focus management
|
|
15
|
+
|
|
16
|
+
## Topics
|
|
17
|
+
|
|
18
|
+
- [ARIA Support](./aria-support.md) - ARIA attributes and roles
|
|
19
|
+
- [Keyboard Navigation](../../accessibility/keyboard-navigation.md) - Keyboard interaction patterns
|
|
20
|
+
- [Screen Readers](../../accessibility/screen-readers.md) - Screen reader compatibility
|
|
21
|
+
- [Color Contrast](./color-contrast.md) - Color contrast guidelines
|
|
22
|
+
- [Focus Management](./focus-management.md) - Focus handling patterns
|
|
23
|
+
- [Testing](./testing.md) - Accessibility testing
|
|
24
|
+
- [WCAG Compliance](../../accessibility/wcag-compliance.md) - WCAG 2.1 conformance
|
|
25
|
+
|
|
26
|
+
## Additional Resources
|
|
27
|
+
|
|
28
|
+
- [Common Accessibility Patterns](../../accessibility/common-patterns.md) - Frequently used patterns
|
|
29
|
+
- [Accessibility Overview](../../accessibility/overview.md) - Architecture overview
|
|
30
|
+
|
|
31
|
+
## Quick Reference
|
|
32
|
+
|
|
33
|
+
### Semantic HTML
|
|
34
|
+
|
|
35
|
+
Framework components output semantic HTML:
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<!-- HeroSection renders as -->
|
|
39
|
+
<section aria-labelledby="hero-heading">
|
|
40
|
+
<h1 id="hero-heading">Welcome</h1>
|
|
41
|
+
<p>Description text</p>
|
|
42
|
+
<a href="/start" role="button">Get Started</a>
|
|
43
|
+
</section>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### ARIA in Components
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Button with accessible label
|
|
50
|
+
<Button aria-label="Close menu">
|
|
51
|
+
<Icon name="x" />
|
|
52
|
+
</Button>
|
|
53
|
+
|
|
54
|
+
// Form with accessible errors
|
|
55
|
+
<FormField
|
|
56
|
+
label="Email"
|
|
57
|
+
error="Please enter a valid email"
|
|
58
|
+
required
|
|
59
|
+
/>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Keyboard Support
|
|
63
|
+
|
|
64
|
+
All interactive components support:
|
|
65
|
+
- `Tab` / `Shift+Tab` - Navigate between elements
|
|
66
|
+
- `Enter` / `Space` - Activate buttons and links
|
|
67
|
+
- `Escape` - Close modals and dropdowns
|
|
68
|
+
- Arrow keys - Navigate within component groups
|
|
69
|
+
|
|
70
|
+
## See Also
|
|
71
|
+
|
|
72
|
+
- [Accessibility Components](../../components/overview.md)
|
|
73
|
+
- [WCAG 2.1 Guidelines](https://www.w3.org/WAI/WCAG21/quickref/)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# ARIA Support
|
|
2
|
+
|
|
3
|
+
ARIA (Accessible Rich Internet Applications) implementation across framework components.
|
|
4
|
+
|
|
5
|
+
## Built-in ARIA Attributes
|
|
6
|
+
|
|
7
|
+
Framework components include appropriate ARIA attributes by default.
|
|
8
|
+
|
|
9
|
+
### Sections
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<!-- HeroSection -->
|
|
13
|
+
<section aria-labelledby="hero-heading">
|
|
14
|
+
<h1 id="hero-heading">...</h1>
|
|
15
|
+
</section>
|
|
16
|
+
|
|
17
|
+
<!-- FAQAccordion -->
|
|
18
|
+
<div role="region" aria-labelledby="faq-heading">
|
|
19
|
+
<button aria-expanded="true" aria-controls="faq-1-content">
|
|
20
|
+
Question text
|
|
21
|
+
</button>
|
|
22
|
+
<div id="faq-1-content" role="region" aria-labelledby="faq-1-heading">
|
|
23
|
+
Answer text
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Navigation
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<!-- Header -->
|
|
32
|
+
<header role="banner">
|
|
33
|
+
<nav aria-label="Main navigation">
|
|
34
|
+
<ul role="menubar">...</ul>
|
|
35
|
+
</nav>
|
|
36
|
+
</header>
|
|
37
|
+
|
|
38
|
+
<!-- Footer -->
|
|
39
|
+
<footer role="contentinfo">
|
|
40
|
+
<nav aria-label="Footer navigation">...</nav>
|
|
41
|
+
</footer>
|
|
42
|
+
|
|
43
|
+
<!-- Breadcrumb -->
|
|
44
|
+
<nav aria-label="Breadcrumb">
|
|
45
|
+
<ol>
|
|
46
|
+
<li><a href="/">Home</a></li>
|
|
47
|
+
<li aria-current="page">About</li>
|
|
48
|
+
</ol>
|
|
49
|
+
</nav>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Forms
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<!-- FormField -->
|
|
56
|
+
<div>
|
|
57
|
+
<label for="email">Email <span aria-hidden="true">*</span></label>
|
|
58
|
+
<input
|
|
59
|
+
id="email"
|
|
60
|
+
type="email"
|
|
61
|
+
aria-required="true"
|
|
62
|
+
aria-invalid="true"
|
|
63
|
+
aria-describedby="email-error email-help"
|
|
64
|
+
/>
|
|
65
|
+
<span id="email-error" role="alert">Please enter a valid email</span>
|
|
66
|
+
<span id="email-help">We'll never share your email</span>
|
|
67
|
+
</div>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Modals
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<!-- Modal -->
|
|
74
|
+
<div
|
|
75
|
+
role="dialog"
|
|
76
|
+
aria-modal="true"
|
|
77
|
+
aria-labelledby="modal-title"
|
|
78
|
+
aria-describedby="modal-description"
|
|
79
|
+
>
|
|
80
|
+
<h2 id="modal-title">Modal Title</h2>
|
|
81
|
+
<p id="modal-description">Modal content</p>
|
|
82
|
+
<button aria-label="Close dialog">×</button>
|
|
83
|
+
</div>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Common ARIA Patterns
|
|
87
|
+
|
|
88
|
+
### Live Regions
|
|
89
|
+
|
|
90
|
+
For dynamic content updates:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// Toast notifications
|
|
94
|
+
<div role="status" aria-live="polite">
|
|
95
|
+
Message sent successfully
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
// Error alerts
|
|
99
|
+
<div role="alert" aria-live="assertive">
|
|
100
|
+
Form submission failed
|
|
101
|
+
</div>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Loading States
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
<div aria-busy="true" aria-live="polite">
|
|
108
|
+
<LoadingSpinner aria-label="Loading content" />
|
|
109
|
+
</div>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Tabs
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<div role="tablist" aria-label="Service categories">
|
|
116
|
+
<button role="tab" aria-selected="true" aria-controls="panel-1">Tab 1</button>
|
|
117
|
+
<button role="tab" aria-selected="false" aria-controls="panel-2">Tab 2</button>
|
|
118
|
+
</div>
|
|
119
|
+
<div role="tabpanel" id="panel-1" aria-labelledby="tab-1">
|
|
120
|
+
Panel content
|
|
121
|
+
</div>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Custom ARIA Props
|
|
125
|
+
|
|
126
|
+
Pass additional ARIA attributes to components:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
<Button
|
|
130
|
+
aria-label="Submit contact form"
|
|
131
|
+
aria-describedby="form-instructions"
|
|
132
|
+
>
|
|
133
|
+
Submit
|
|
134
|
+
</Button>
|
|
135
|
+
|
|
136
|
+
<Card aria-labelledby="card-title">
|
|
137
|
+
<h3 id="card-title">Card Title</h3>
|
|
138
|
+
</Card>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## ARIA Roles Reference
|
|
142
|
+
|
|
143
|
+
### Landmark Roles
|
|
144
|
+
|
|
145
|
+
| Role | Usage | Framework Component |
|
|
146
|
+
|------|-------|-------------------|
|
|
147
|
+
| `banner` | Site header | Header |
|
|
148
|
+
| `navigation` | Nav sections | Header, Footer |
|
|
149
|
+
| `main` | Main content | Layout wrapper |
|
|
150
|
+
| `contentinfo` | Site footer | Footer |
|
|
151
|
+
| `complementary` | Sidebar | - |
|
|
152
|
+
| `search` | Search form | - |
|
|
153
|
+
|
|
154
|
+
### Widget Roles
|
|
155
|
+
|
|
156
|
+
| Role | Usage | Framework Component |
|
|
157
|
+
|------|-------|-------------------|
|
|
158
|
+
| `button` | Clickable action | Button |
|
|
159
|
+
| `dialog` | Modal/popup | Modal, ExitIntentModal |
|
|
160
|
+
| `tablist` / `tab` / `tabpanel` | Tab interface | Tabs |
|
|
161
|
+
| `alert` | Important message | Toast |
|
|
162
|
+
| `status` | Status update | Toast, LiveProof |
|
|
163
|
+
|
|
164
|
+
## Best Practices
|
|
165
|
+
|
|
166
|
+
- Don't add ARIA roles that duplicate native HTML semantics
|
|
167
|
+
- Use `aria-label` for icon-only buttons
|
|
168
|
+
- Use `aria-describedby` for additional context
|
|
169
|
+
- Use `aria-live` for dynamic content changes
|
|
170
|
+
- Test with actual screen readers, not just automated tools
|
|
171
|
+
|
|
172
|
+
## See Also
|
|
173
|
+
|
|
174
|
+
- [Screen Readers](../../accessibility/screen-readers.md)
|
|
175
|
+
- [Common Patterns](../../accessibility/common-patterns.md)
|
|
176
|
+
- [WCAG Compliance](../../accessibility/wcag-compliance.md)
|
|
177
|
+
- [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/)
|