@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.
Files changed (166) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +572 -0
  3. package/bin/create-simple-site.js +390 -0
  4. package/bin/simple-site.js +664 -0
  5. package/dist/client.js +135 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/client.mjs +107 -0
  8. package/dist/client.mjs.map +1 -0
  9. package/dist/components/index.d.mts +3936 -0
  10. package/dist/components/index.d.ts +3936 -0
  11. package/dist/components/index.js +38265 -0
  12. package/dist/components/index.js.map +1 -0
  13. package/dist/components/index.mjs +38173 -0
  14. package/dist/components/index.mjs.map +1 -0
  15. package/dist/config/index.d.mts +298 -0
  16. package/dist/config/index.d.ts +298 -0
  17. package/dist/config/index.js +19 -0
  18. package/dist/config/index.js.map +1 -0
  19. package/dist/config/index.mjs +1 -0
  20. package/dist/config/index.mjs.map +1 -0
  21. package/dist/index.d.mts +2184 -0
  22. package/dist/index.d.ts +2184 -0
  23. package/dist/index.js +1713 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/index.mjs +1605 -0
  26. package/dist/index.mjs.map +1 -0
  27. package/dist/lib/i18n/index.js +665 -0
  28. package/dist/lib/i18n/index.js.map +1 -0
  29. package/dist/lib/i18n/index.mjs +621 -0
  30. package/dist/lib/i18n/index.mjs.map +1 -0
  31. package/docs/DOCUMENTATION-STRUCTURE.md +1156 -0
  32. package/docs/EXPORTS.md +125 -0
  33. package/docs/PERFORMANCE.md +757 -0
  34. package/docs/POLICY-PAGES.md +867 -0
  35. package/docs/ROADMAP.md +334 -0
  36. package/docs/SEO.md +455 -0
  37. package/docs/SITEMAP.md +708 -0
  38. package/docs/STRUCTURED-DATA.md +671 -0
  39. package/docs/accessibility/common-patterns.md +529 -0
  40. package/docs/accessibility/keyboard-navigation.md +263 -0
  41. package/docs/accessibility/overview.md +122 -0
  42. package/docs/accessibility/screen-readers.md +311 -0
  43. package/docs/accessibility/wcag-compliance.md +159 -0
  44. package/docs/api/README.md +164 -0
  45. package/docs/api/components/Accessibility.md +356 -0
  46. package/docs/api/components/Button.md +240 -0
  47. package/docs/api/components/HeroSection.md +306 -0
  48. package/docs/architecture/decisions.md +449 -0
  49. package/docs/components/AnalyticsTracker.md +58 -0
  50. package/docs/components/AnimatedCounter.md +48 -0
  51. package/docs/components/AnimatedSection.md +56 -0
  52. package/docs/components/BlogCard.md +42 -0
  53. package/docs/components/Checkbox.md +56 -0
  54. package/docs/components/CodeBlock.md +52 -0
  55. package/docs/components/ComparisonTable.md +40 -0
  56. package/docs/components/ComponentDemo.md +38 -0
  57. package/docs/components/CountdownTimer.md +51 -0
  58. package/docs/components/ExitIntentModal.md +56 -0
  59. package/docs/components/FAQAccordion.md +66 -0
  60. package/docs/components/FeaturesGrid.md +55 -0
  61. package/docs/components/FileUpload.md +54 -0
  62. package/docs/components/I18nMetaTags.md +55 -0
  63. package/docs/components/Icon.md +53 -0
  64. package/docs/components/LazySection.md +46 -0
  65. package/docs/components/LiveProof.md +53 -0
  66. package/docs/components/LoadingSpinner.md +46 -0
  67. package/docs/components/MultiStepForm.md +48 -0
  68. package/docs/components/PolicyLayout.md +55 -0
  69. package/docs/components/PricingTable.md +49 -0
  70. package/docs/components/Radio.md +59 -0
  71. package/docs/components/SEOMetaTags.md +58 -0
  72. package/docs/components/ScriptInjector.md +50 -0
  73. package/docs/components/Select.md +72 -0
  74. package/docs/components/Skeleton.md +47 -0
  75. package/docs/components/StatsSection.md +48 -0
  76. package/docs/components/StickyBar.md +62 -0
  77. package/docs/components/StructuredData.md +99 -0
  78. package/docs/components/StyleGuide.md +46 -0
  79. package/docs/components/TableOfContents.md +47 -0
  80. package/docs/components/TestimonialCarousel.md +42 -0
  81. package/docs/components/Timeline.md +51 -0
  82. package/docs/components/Toast.md +59 -0
  83. package/docs/components/TrackedLink.md +62 -0
  84. package/docs/components/TrustBadges.md +44 -0
  85. package/docs/components/conversion/MobileCTA.md +363 -0
  86. package/docs/components/forms/ContactForm.md +75 -0
  87. package/docs/components/forms/FormField.md +74 -0
  88. package/docs/components/layout/Footer.md +601 -0
  89. package/docs/components/layout/Header.md +549 -0
  90. package/docs/components/layout/LanguageSelector.md +54 -0
  91. package/docs/components/layout/LanguageSwitcher.md +24 -0
  92. package/docs/components/overview.md +447 -0
  93. package/docs/components/sections/AboutSection.md +48 -0
  94. package/docs/components/sections/CTASection.md +596 -0
  95. package/docs/components/sections/CaseStudySection.md +47 -0
  96. package/docs/components/sections/ContactSection.md +599 -0
  97. package/docs/components/sections/FeatureSection.md +44 -0
  98. package/docs/components/sections/HeroSection.md +404 -0
  99. package/docs/components/sections/LogosSection.md +47 -0
  100. package/docs/components/sections/PersonalTaxesSection.md +23 -0
  101. package/docs/components/sections/RecruitingSection.md +23 -0
  102. package/docs/components/sections/SecurePortalSection.md +23 -0
  103. package/docs/components/sections/ServicePageLayout.md +52 -0
  104. package/docs/components/sections/ServicesSection.md +49 -0
  105. package/docs/components/sections/TestimonialSection.md +44 -0
  106. package/docs/components/sections/WhyChooseUsSection.md +54 -0
  107. package/docs/components/ui/Breadcrumb.md +70 -0
  108. package/docs/components/ui/Button.md +514 -0
  109. package/docs/components/ui/Card.md +501 -0
  110. package/docs/components/ui/Input.md +54 -0
  111. package/docs/components/ui/MobileLinks.md +43 -0
  112. package/docs/components/ui/Modal.md +60 -0
  113. package/docs/components/ui/Tabs.md +62 -0
  114. package/docs/components/ui/Textarea.md +52 -0
  115. package/docs/core-concepts/configuration-driven.md +552 -0
  116. package/docs/core-concepts/overview.md +351 -0
  117. package/docs/features/accessibility/README.md +73 -0
  118. package/docs/features/accessibility/aria-support.md +177 -0
  119. package/docs/features/accessibility/color-contrast.md +155 -0
  120. package/docs/features/accessibility/focus-management.md +187 -0
  121. package/docs/features/accessibility/testing.md +196 -0
  122. package/docs/features/analytics/README.md +51 -0
  123. package/docs/features/analytics/ab-testing.md +171 -0
  124. package/docs/features/analytics/conversion-tracking.md +207 -0
  125. package/docs/features/analytics/custom-events.md +219 -0
  126. package/docs/features/analytics/privacy.md +198 -0
  127. package/docs/features/analytics/setup.md +114 -0
  128. package/docs/features/analytics/tracking-events.md +224 -0
  129. package/docs/features/i18n/README.md +51 -0
  130. package/docs/features/i18n/best-practices.md +273 -0
  131. package/docs/features/i18n/configuration.md +84 -0
  132. package/docs/features/i18n/formatting.md +133 -0
  133. package/docs/features/i18n/locale-detection.md +122 -0
  134. package/docs/features/i18n/routing.md +99 -0
  135. package/docs/features/i18n/rtl-support.md +191 -0
  136. package/docs/features/i18n/translations.md +129 -0
  137. package/docs/features/internationalization.md +595 -0
  138. package/docs/features/performance/README.md +77 -0
  139. package/docs/features/performance/bundle-size.md +134 -0
  140. package/docs/features/performance/caching.md +131 -0
  141. package/docs/features/performance/code-splitting.md +121 -0
  142. package/docs/features/performance/image-optimization.md +110 -0
  143. package/docs/features/performance/lazy-loading.md +92 -0
  144. package/docs/features/performance/monitoring.md +148 -0
  145. package/docs/features/seo/README.md +51 -0
  146. package/docs/features/seo/best-practices.md +184 -0
  147. package/docs/features/seo/canonical-urls.md +182 -0
  148. package/docs/features/seo/meta-tags.md +126 -0
  149. package/docs/features/seo/open-graph.md +166 -0
  150. package/docs/features/seo/robots-txt.md +146 -0
  151. package/docs/features/seo/sitemaps.md +162 -0
  152. package/docs/features/seo/structured-data.md +166 -0
  153. package/docs/getting-started/installation.md +292 -0
  154. package/docs/getting-started/introduction.md +195 -0
  155. package/docs/getting-started/quick-start.md +460 -0
  156. package/docs/guides/analytics-setup.md +616 -0
  157. package/docs/i18n/CONFIGURATION.md +353 -0
  158. package/docs/i18n/EXAMPLES.md +402 -0
  159. package/docs/i18n/MIGRATION.md +260 -0
  160. package/docs/i18n/SEO.md +392 -0
  161. package/docs/i18n/STATIC-GENERATION-FIX.md +71 -0
  162. package/docs/migration/changelog.md +136 -0
  163. package/docs/migration/overview.md +233 -0
  164. package/docs/recipes/adding-animations.md +475 -0
  165. package/docs/recipes/forms-with-validation.md +393 -0
  166. package/package.json +152 -0
@@ -0,0 +1,353 @@
1
+ # i18n Configuration Reference
2
+
3
+ Complete reference for configuring internationalization in simple-site-framework.
4
+
5
+ ## I18nConfig Interface
6
+
7
+ ```typescript
8
+ interface I18nConfig {
9
+ locales: readonly string[];
10
+ defaultLocale: string;
11
+ localePrefix?: LocalePrefix;
12
+ localeDetection?: boolean;
13
+ localeNames?: Record<string, string>;
14
+ localeLabels?: Record<string, string>;
15
+ rtlLocales?: readonly string[];
16
+ localeCookie?: LocaleCookieConfig;
17
+ slugTranslations?: SlugTranslations;
18
+ }
19
+ ```
20
+
21
+ ## Required Fields
22
+
23
+ ### `locales`
24
+ **Type:** `readonly string[]`
25
+ **Required:** Yes
26
+
27
+ Array of supported locale codes (ISO 639-1).
28
+
29
+ ```typescript
30
+ locales: ['en', 'fr', 'es', 'de', 'ja']
31
+ ```
32
+
33
+ ### `defaultLocale`
34
+ **Type:** `string`
35
+ **Required:** Yes
36
+
37
+ Default locale when none is specified. Must be included in `locales` array.
38
+
39
+ ```typescript
40
+ defaultLocale: 'en'
41
+ ```
42
+
43
+ ## Optional Fields
44
+
45
+ ### `localePrefix`
46
+ **Type:** `'always' | 'as-needed' | 'never'`
47
+ **Default:** `'as-needed'`
48
+
49
+ Controls how locale appears in URLs.
50
+
51
+ #### `'always'` Mode
52
+ All routes have locale prefix:
53
+ - `/en/about`
54
+ - `/fr/about`
55
+ - `/` → redirects to `/en/` (or detected language)
56
+
57
+ **Use when:**
58
+ - You want explicit language in every URL
59
+ - All languages are equal importance
60
+ - Consistency across all locales matters
61
+
62
+ ```typescript
63
+ localePrefix: 'always'
64
+ ```
65
+
66
+ #### `'as-needed'` Mode (Recommended)
67
+ Only non-default locales have prefix:
68
+ - `/about` (default locale, no prefix)
69
+ - `/fr/about` (non-default, with prefix)
70
+ - `/` → stays at `/` (default locale)
71
+
72
+ **Use when:**
73
+ - You have a primary market/language
74
+ - You want cleaner URLs for default language
75
+ - Better SEO for primary market
76
+
77
+ ```typescript
78
+ localePrefix: 'as-needed'
79
+ ```
80
+
81
+ #### `'never'` Mode
82
+ No locale in URLs, detection via cookie/header only:
83
+ - `/about` (all languages)
84
+ - `/` (all languages)
85
+
86
+ **Use when:**
87
+ - Single-language site with optional translations
88
+ - You want simplest possible URLs
89
+ - Not concerned about shareable language-specific links
90
+
91
+ ```typescript
92
+ localePrefix: 'never'
93
+ ```
94
+
95
+ ### `localeDetection`
96
+ **Type:** `boolean`
97
+ **Default:** `true`
98
+
99
+ Enable automatic locale detection from browser `Accept-Language` header.
100
+
101
+ ```typescript
102
+ localeDetection: true // Detect from browser
103
+ localeDetection: false // Always use default locale
104
+ ```
105
+
106
+ When enabled, middleware checks:
107
+ 1. Cookie (user's explicit preference)
108
+ 2. `Accept-Language` header (browser preference)
109
+ 3. Default locale (fallback)
110
+
111
+ ### `localeNames`
112
+ **Type:** `Record<string, string>`
113
+ **Default:** `{}`
114
+
115
+ Full locale names for display in language selector and UI.
116
+
117
+ ```typescript
118
+ localeNames: {
119
+ en: 'English',
120
+ fr: 'Français',
121
+ es: 'Español',
122
+ de: 'Deutsch',
123
+ ja: '日本語',
124
+ ar: 'العربية',
125
+ }
126
+ ```
127
+
128
+ **Best practice:** Use native language names (autonyms).
129
+
130
+ ### `localeLabels`
131
+ **Type:** `Record<string, string>`
132
+ **Default:** `{}`
133
+
134
+ Short locale labels for compact display (e.g., language selector button).
135
+
136
+ ```typescript
137
+ localeLabels: {
138
+ en: 'EN',
139
+ fr: 'FR',
140
+ es: 'ES',
141
+ de: 'DE',
142
+ ja: 'JA',
143
+ ar: 'AR',
144
+ }
145
+ ```
146
+
147
+ ### `rtlLocales`
148
+ **Type:** `readonly string[]`
149
+ **Default:** `[]`
150
+
151
+ Locales that use right-to-left text direction.
152
+
153
+ ```typescript
154
+ rtlLocales: ['ar', 'he', 'fa', 'ur']
155
+ ```
156
+
157
+ Common RTL languages:
158
+ - `ar` - Arabic
159
+ - `he` - Hebrew
160
+ - `fa` - Persian/Farsi
161
+ - `ur` - Urdu
162
+ - `yi` - Yiddish
163
+
164
+ Use with `getTextDirection()` in layout:
165
+ ```tsx
166
+ <html lang={locale} dir={getTextDirection(locale)}>
167
+ ```
168
+
169
+ ### `localeCookie`
170
+ **Type:** `LocaleCookieConfig`
171
+ **Default:** See below
172
+
173
+ Configuration for locale persistence cookie.
174
+
175
+ ```typescript
176
+ localeCookie: {
177
+ name: 'NEXT_LOCALE', // Cookie name
178
+ maxAge: 365 * 24 * 60 * 60, // 1 year in seconds
179
+ sameSite: 'lax', // 'lax' | 'strict' | 'none'
180
+ }
181
+ ```
182
+
183
+ **Defaults:**
184
+ - `name`: `'NEXT_LOCALE'`
185
+ - `maxAge`: `31536000` (1 year)
186
+ - `sameSite`: `'lax'`
187
+
188
+ ### `slugTranslations`
189
+ **Type:** `SlugTranslations`
190
+ **Default:** `{}`
191
+
192
+ Custom slug translations for multilingual routes.
193
+
194
+ ```typescript
195
+ slugTranslations: {
196
+ en: {
197
+ '/about': '/a-propos',
198
+ '/contact': '/nous-contacter',
199
+ '/pricing': '/tarifs',
200
+ },
201
+ fr: {
202
+ '/a-propos': '/about',
203
+ '/nous-contacter': '/contact',
204
+ '/tarifs': '/pricing',
205
+ },
206
+ }
207
+ ```
208
+
209
+ **Note:** Framework provides default French/English translations. Custom translations merge with and override defaults.
210
+
211
+ ## Complete Example
212
+
213
+ ```typescript
214
+ // src/config/i18n.ts
215
+ import type { I18nConfig } from 'simple-site-framework/lib/i18n';
216
+
217
+ export const i18nConfig: I18nConfig = {
218
+ // Required
219
+ locales: ['en', 'fr', 'es', 'ar'],
220
+ defaultLocale: 'en',
221
+
222
+ // Routing
223
+ localePrefix: 'as-needed',
224
+ localeDetection: true,
225
+
226
+ // Display
227
+ localeNames: {
228
+ en: 'English',
229
+ fr: 'Français',
230
+ es: 'Español',
231
+ ar: 'العربية',
232
+ },
233
+ localeLabels: {
234
+ en: 'EN',
235
+ fr: 'FR',
236
+ es: 'ES',
237
+ ar: 'AR',
238
+ },
239
+
240
+ // RTL support
241
+ rtlLocales: ['ar'],
242
+
243
+ // Cookie config
244
+ localeCookie: {
245
+ name: 'MY_LOCALE',
246
+ maxAge: 90 * 24 * 60 * 60, // 90 days
247
+ sameSite: 'lax',
248
+ },
249
+
250
+ // Slug translations
251
+ slugTranslations: {
252
+ en: {
253
+ '/products': '/produits',
254
+ '/services': '/services',
255
+ },
256
+ fr: {
257
+ '/produits': '/products',
258
+ '/services': '/services',
259
+ },
260
+ es: {
261
+ '/products': '/productos',
262
+ '/services': '/servicios',
263
+ },
264
+ },
265
+ };
266
+ ```
267
+
268
+ ## Helper Functions
269
+
270
+ These functions read from your config after initialization:
271
+
272
+ ### Configuration Access
273
+ - `getI18nConfig()` - Get full config
274
+ - `getLocales()` - Get supported locales array
275
+ - `getDefaultLocale()` - Get default locale
276
+ - `getLocalePrefix()` - Get prefix mode
277
+ - `getLocaleNames()` - Get locale names mapping
278
+ - `getLocaleLabels()` - Get locale labels mapping
279
+ - `getRtlLocales()` - Get RTL locales array
280
+
281
+ ### Validation
282
+ - `isSupportedLocale(locale)` - Check if locale is supported
283
+ - `validateLocale(locale)` - Alias for isSupportedLocale
284
+
285
+ ### Display
286
+ - `getLocaleName(locale)` - Get full name for locale
287
+ - `getLocaleLabel(locale)` - Get short label for locale
288
+ - `getLocaleAutonym(locale)` - Get native name (fallback map)
289
+
290
+ ### Utilities
291
+ - `isRtlLocale(locale)` - Check if locale is RTL
292
+ - `getTextDirection(locale)` - Get 'ltr' or 'rtl'
293
+ - `getAlternateLocales(currentLocale)` - Get all other locales
294
+ - `normalizeLocale(locale)` - Handle variants (en-US → en)
295
+ - `matchLocale(locale)` - Match with variant support
296
+
297
+ ## Environment-Specific Configs
298
+
299
+ You can use different configs per environment:
300
+
301
+ ```typescript
302
+ // src/config/i18n.ts
303
+ import type { I18nConfig } from 'simple-site-framework/lib/i18n';
304
+
305
+ const baseConfig: I18nConfig = {
306
+ locales: ['en', 'fr'],
307
+ defaultLocale: 'en',
308
+ localePrefix: 'as-needed',
309
+ };
310
+
311
+ export const i18nConfig: I18nConfig =
312
+ process.env.NODE_ENV === 'development'
313
+ ? {
314
+ ...baseConfig,
315
+ localeDetection: false, // Disable in dev
316
+ }
317
+ : baseConfig;
318
+ ```
319
+
320
+ ## TypeScript Tips
321
+
322
+ ### Type-Safe Locale Strings
323
+
324
+ ```typescript
325
+ import { i18nConfig } from './config/i18n';
326
+
327
+ type AppLocale = typeof i18nConfig.locales[number];
328
+ // AppLocale = 'en' | 'fr' | 'es' | ...
329
+
330
+ function myFunction(locale: AppLocale) {
331
+ // TypeScript ensures only valid locales
332
+ }
333
+ ```
334
+
335
+ ### Extend Config Type
336
+
337
+ ```typescript
338
+ interface MyI18nConfig extends I18nConfig {
339
+ customField: string;
340
+ }
341
+
342
+ export const i18nConfig: MyI18nConfig = {
343
+ locales: ['en', 'fr'],
344
+ defaultLocale: 'en',
345
+ customField: 'my-value',
346
+ };
347
+ ```
348
+
349
+ ## See Also
350
+
351
+ - [Migration Guide](./MIGRATION.md) - Upgrade from old system
352
+ - [Examples](./EXAMPLES.md) - Usage examples
353
+ - [SEO Guide](./SEO.md) - SEO best practices