@donotdev/core 0.0.46 → 0.1.1
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.md +3 -3
- package/functions/index.d.ts +11 -166
- package/functions/index.js +7 -7
- package/i18n/locales/eager/dndev_ar.json +158 -0
- package/i18n/locales/eager/dndev_da.json +153 -0
- package/i18n/locales/eager/dndev_de.json +158 -0
- package/i18n/locales/eager/dndev_en.json +3 -0
- package/i18n/locales/eager/dndev_es.json +159 -1
- package/i18n/locales/eager/dndev_fr.json +158 -0
- package/i18n/locales/eager/dndev_it.json +158 -0
- package/i18n/locales/eager/dndev_ja.json +158 -0
- package/i18n/locales/eager/dndev_ko.json +158 -0
- package/i18n/locales/eager/dndev_nl.json +153 -0
- package/i18n/locales/eager/dndev_pt.json +581 -0
- package/i18n/locales/eager/dndev_zh.json +581 -0
- package/i18n/locales/lazy/ai_en.json +25 -0
- package/i18n/locales/lazy/ai_pt.json +25 -0
- package/i18n/locales/lazy/ai_zh.json +25 -0
- package/i18n/locales/lazy/auth_ar.json +44 -0
- package/i18n/locales/lazy/auth_da.json +45 -1
- package/i18n/locales/lazy/auth_de.json +44 -0
- package/i18n/locales/lazy/auth_en.json +44 -0
- package/i18n/locales/lazy/auth_es.json +44 -0
- package/i18n/locales/lazy/auth_fr.json +44 -0
- package/i18n/locales/lazy/auth_it.json +44 -0
- package/i18n/locales/lazy/auth_ja.json +44 -0
- package/i18n/locales/lazy/auth_ko.json +44 -0
- package/i18n/locales/lazy/auth_nl.json +45 -1
- package/i18n/locales/lazy/auth_pt.json +192 -0
- package/i18n/locales/lazy/auth_zh.json +192 -0
- package/i18n/locales/lazy/billing_en.json +11 -0
- package/i18n/locales/lazy/billing_pt.json +93 -0
- package/i18n/locales/lazy/billing_zh.json +93 -0
- package/i18n/locales/lazy/blog_pt.json +9 -0
- package/i18n/locales/lazy/blog_zh.json +9 -0
- package/i18n/locales/lazy/cookies_pt.json +32 -0
- package/i18n/locales/lazy/cookies_zh.json +32 -0
- package/i18n/locales/lazy/crud_ar.json +3 -0
- package/i18n/locales/lazy/crud_da.json +3 -0
- package/i18n/locales/lazy/crud_de.json +3 -0
- package/i18n/locales/lazy/crud_en.json +3 -0
- package/i18n/locales/lazy/crud_es.json +3 -0
- package/i18n/locales/lazy/crud_fr.json +3 -0
- package/i18n/locales/lazy/crud_it.json +3 -0
- package/i18n/locales/lazy/crud_ja.json +3 -0
- package/i18n/locales/lazy/crud_ko.json +3 -0
- package/i18n/locales/lazy/crud_nl.json +3 -0
- package/i18n/locales/lazy/crud_pt.json +534 -0
- package/i18n/locales/lazy/crud_zh.json +534 -0
- package/i18n/locales/lazy/homeTemplate_pt.json +52 -0
- package/i18n/locales/lazy/homeTemplate_zh.json +52 -0
- package/i18n/locales/lazy/legalNotice_pt.json +55 -0
- package/i18n/locales/lazy/legalNotice_zh.json +55 -0
- package/i18n/locales/lazy/oauth_pt.json +11 -0
- package/i18n/locales/lazy/oauth_zh.json +11 -0
- package/i18n/locales/lazy/privacy_pt.json +178 -0
- package/i18n/locales/lazy/privacy_zh.json +178 -0
- package/i18n/locales/lazy/terms_pt.json +200 -0
- package/i18n/locales/lazy/terms_zh.json +200 -0
- package/index.d.ts +2834 -4778
- package/index.js +44 -516
- package/next/index.d.ts +349 -176
- package/next/index.js +84 -61
- package/package.json +10 -6
- package/server.d.ts +1994 -2847
- package/server.js +1 -372
- package/vite/index.d.ts +298 -181
- package/vite/index.js +91 -76
package/vite/index.d.ts
CHANGED
|
@@ -1,4 +1,237 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Footer mode constants - DRY single source of truth
|
|
5
|
+
*
|
|
6
|
+
* @version 0.1.0
|
|
7
|
+
* @since 0.0.1
|
|
8
|
+
* @author AMBROISE PARK Consulting
|
|
9
|
+
*/
|
|
10
|
+
declare const FOOTER_MODE = {
|
|
11
|
+
FIXED: 'fixed',
|
|
12
|
+
SCROLL: 'scroll',
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Footer mode type - auto-derived from constants
|
|
17
|
+
*/
|
|
18
|
+
type FooterMode = (typeof FOOTER_MODE)[keyof typeof FOOTER_MODE];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Layout preset constants - DRY single source of truth
|
|
22
|
+
* Use these instead of hardcoded strings throughout the codebase
|
|
23
|
+
*
|
|
24
|
+
* @version 0.1.0
|
|
25
|
+
* @since 0.0.1
|
|
26
|
+
* @author AMBROISE PARK Consulting
|
|
27
|
+
*/
|
|
28
|
+
declare const LAYOUT_PRESET = {
|
|
29
|
+
ADMIN: 'admin',
|
|
30
|
+
BLOG: 'blog',
|
|
31
|
+
DOCS: 'docs',
|
|
32
|
+
GAME: 'game',
|
|
33
|
+
LANDING: 'landing',
|
|
34
|
+
MOOLTI: 'moolti',
|
|
35
|
+
PLAIN: 'plain',
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Layout preset type - auto-derived from constants, with string fallback
|
|
40
|
+
* Accepts known presets OR any string (runtime validates and defaults to 'landing')
|
|
41
|
+
*
|
|
42
|
+
* @version 0.1.0
|
|
43
|
+
* @since 0.0.1
|
|
44
|
+
* @author AMBROISE PARK Consulting
|
|
45
|
+
*/
|
|
46
|
+
type LayoutPreset =
|
|
47
|
+
| (typeof LAYOUT_PRESET)[keyof typeof LAYOUT_PRESET]
|
|
48
|
+
| string;
|
|
49
|
+
|
|
50
|
+
// packages/core/types/src/layout/presetConfig.ts
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Slot content function - returns ReactNode or null
|
|
56
|
+
*
|
|
57
|
+
* Presets use functions that return ReactNode, same API as consumers.
|
|
58
|
+
* Return null to explicitly hide the slot.
|
|
59
|
+
*/
|
|
60
|
+
type SlotContent = () => ReactNode | null;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Header zone configuration
|
|
64
|
+
*
|
|
65
|
+
* Grid-based layout with start/center/end areas.
|
|
66
|
+
* - start: start-aligned (typically branding: AppIcon, AppTitle)
|
|
67
|
+
* - center: absolutely centered (overlay, regardless of start/end content)
|
|
68
|
+
* - end: end-aligned (typically actions: GoTo, Auth, Language, Theme)
|
|
69
|
+
*/
|
|
70
|
+
interface HeaderZoneConfig {
|
|
71
|
+
/** Start slot - start-aligned, typically branding (AppIcon, AppTitle) */
|
|
72
|
+
start?: SlotContent;
|
|
73
|
+
|
|
74
|
+
/** Center slot - absolutely centered overlay, optional (navigation, search) */
|
|
75
|
+
center?: SlotContent;
|
|
76
|
+
|
|
77
|
+
/** End slot - end-aligned, typically actions (GoTo, Auth, Language, Theme) */
|
|
78
|
+
end?: SlotContent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Sidebar zone configuration
|
|
83
|
+
*
|
|
84
|
+
* Vertical layout with top/content/bottom areas.
|
|
85
|
+
* All sidebars use ResizableSidebar wrapper.
|
|
86
|
+
*/
|
|
87
|
+
interface SidebarZoneConfig {
|
|
88
|
+
/** Top slot - branding, search */
|
|
89
|
+
top?: SlotContent;
|
|
90
|
+
|
|
91
|
+
/** Content slot - main scrollable area (defaults to NavigationMenu) */
|
|
92
|
+
content?: SlotContent;
|
|
93
|
+
|
|
94
|
+
/** Bottom slot - user profile, settings */
|
|
95
|
+
bottom?: SlotContent;
|
|
96
|
+
|
|
97
|
+
/** Default sidebar width in pixels */
|
|
98
|
+
defaultWidth?: number;
|
|
99
|
+
|
|
100
|
+
/** Minimum width when resizing */
|
|
101
|
+
minWidth?: number;
|
|
102
|
+
|
|
103
|
+
/** Maximum width when resizing */
|
|
104
|
+
maxWidth?: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Footer zone configuration
|
|
109
|
+
*
|
|
110
|
+
* Simple footer: Copyright (left) | LegalLinks + DoNotDev (right)
|
|
111
|
+
* - `null`: Hide footer
|
|
112
|
+
* - `undefined`: Use defaults (copyright + legal links + DoNotDev)
|
|
113
|
+
* - `{ copyright?: ..., legalLinks?: ... }`: Custom configuration
|
|
114
|
+
*/
|
|
115
|
+
interface FooterConfig {
|
|
116
|
+
/** Copyright configuration
|
|
117
|
+
* - `null`: Hide copyright
|
|
118
|
+
* - `undefined`: Use default (© YEAR appName. All rights reserved)
|
|
119
|
+
* - `string`: Custom copyright text
|
|
120
|
+
*/
|
|
121
|
+
copyright?: null | string;
|
|
122
|
+
/** Legal links configuration
|
|
123
|
+
* - `null`: Hide legal links
|
|
124
|
+
* - `Array<{ path, label }>`: Custom legal links
|
|
125
|
+
* - `undefined`: Use framework defaults
|
|
126
|
+
*/
|
|
127
|
+
legalLinks?: null | Array<{
|
|
128
|
+
path: string;
|
|
129
|
+
label: string;
|
|
130
|
+
}>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Footer zone configuration
|
|
135
|
+
*
|
|
136
|
+
* - `FooterConfig` object: configure DnDevFooter (copyright, legal links)
|
|
137
|
+
* - `SlotContent` function: replace DnDevFooter with custom component
|
|
138
|
+
* - `null`: hide footer
|
|
139
|
+
* - `undefined`: use defaults
|
|
140
|
+
*/
|
|
141
|
+
type FooterZoneConfig = FooterConfig | SlotContent | null;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* MergedBar configuration for mobile
|
|
145
|
+
*
|
|
146
|
+
* Fixed trigger bar that opens a Sheet with navigation content.
|
|
147
|
+
* Each slot is customizable per-preset, with smart defaults.
|
|
148
|
+
*/
|
|
149
|
+
interface MergedBarConfig {
|
|
150
|
+
/** Position of the trigger bar */
|
|
151
|
+
position: 'top' | 'bottom';
|
|
152
|
+
|
|
153
|
+
/** Height of the trigger bar (default: 64px for top, 48px for bottom) */
|
|
154
|
+
height?: string;
|
|
155
|
+
|
|
156
|
+
/** Trigger bar content (default: header.start for top, footer-like for bottom) */
|
|
157
|
+
trigger?: SlotContent;
|
|
158
|
+
|
|
159
|
+
/** Sheet top slot */
|
|
160
|
+
top?: SlotContent;
|
|
161
|
+
|
|
162
|
+
/** Sheet content slot - scrollable (default: sidebar.content) */
|
|
163
|
+
content?: SlotContent;
|
|
164
|
+
|
|
165
|
+
/** Sheet bottom slot (default: sidebar.bottom) */
|
|
166
|
+
bottom?: SlotContent;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Mobile behavior configuration
|
|
171
|
+
*
|
|
172
|
+
* Defines how the layout adapts on mobile/tablet breakpoints.
|
|
173
|
+
*/
|
|
174
|
+
interface MobileBehaviorConfig {
|
|
175
|
+
/** Breakpoint at which mobile behavior activates (default: 1024px) */
|
|
176
|
+
breakpoint?: number;
|
|
177
|
+
|
|
178
|
+
/** Header slot overrides for mobile (overrides desktop header slots) */
|
|
179
|
+
header?: HeaderZoneConfig;
|
|
180
|
+
|
|
181
|
+
/** Sidebar slot overrides for mobile (overrides desktop sidebar slots) */
|
|
182
|
+
sidebar?: SidebarZoneConfig;
|
|
183
|
+
|
|
184
|
+
/** MergedBar configuration - replaces header/footer with sheet trigger */
|
|
185
|
+
mergedBar?: MergedBarConfig;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Complete preset configuration
|
|
190
|
+
*
|
|
191
|
+
* Declarative configuration for a layout preset.
|
|
192
|
+
* Uses function-based slots, same API as consumers.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* const landingPreset: PresetConfig = {
|
|
197
|
+
* name: 'landing',
|
|
198
|
+
* header: {
|
|
199
|
+
* start: () => <AppBranding />,
|
|
200
|
+
* center: () => null,
|
|
201
|
+
* end: () => (
|
|
202
|
+
* <>
|
|
203
|
+
* <GoTo />
|
|
204
|
+
* <AuthHeader />
|
|
205
|
+
* </>
|
|
206
|
+
* ),
|
|
207
|
+
* },
|
|
208
|
+
* mobile: {
|
|
209
|
+
* header: {
|
|
210
|
+
* end: () => <HeaderMenu>{desktop end content}</HeaderMenu>,
|
|
211
|
+
* },
|
|
212
|
+
* },
|
|
213
|
+
* };
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
interface PresetConfig {
|
|
217
|
+
/** Preset identifier (must match LayoutPreset type) */
|
|
218
|
+
name: LayoutPreset;
|
|
219
|
+
|
|
220
|
+
/** Header zone configuration (undefined = use defaults, object = override slots, function = custom mode) */
|
|
221
|
+
header?: HeaderZoneConfig | SlotContent;
|
|
222
|
+
|
|
223
|
+
/** Sidebar zone configuration (undefined = use defaults, object = override slots, function = custom mode) */
|
|
224
|
+
sidebar?: SidebarZoneConfig | SlotContent;
|
|
225
|
+
|
|
226
|
+
/** Footer zone configuration (undefined = use defaults, object = override) */
|
|
227
|
+
footer?: FooterZoneConfig;
|
|
228
|
+
|
|
229
|
+
/** Footer scroll behavior override for this preset */
|
|
230
|
+
footerMode?: FooterMode;
|
|
231
|
+
|
|
232
|
+
/** Mobile behavior configuration */
|
|
233
|
+
mobile?: MobileBehaviorConfig;
|
|
234
|
+
}
|
|
2
235
|
|
|
3
236
|
// packages/core/types/src/layout/layoutTypes.ts
|
|
4
237
|
|
|
@@ -7,7 +240,7 @@ import * as React from 'react';
|
|
|
7
240
|
/**
|
|
8
241
|
* App metadata and branding configuration
|
|
9
242
|
*
|
|
10
|
-
* @version 0.0
|
|
243
|
+
* @version 0.1.0
|
|
11
244
|
* @since 0.0.1
|
|
12
245
|
* @author AMBROISE PARK Consulting
|
|
13
246
|
*/
|
|
@@ -83,19 +316,21 @@ interface AppMetadata {
|
|
|
83
316
|
* };
|
|
84
317
|
* ```
|
|
85
318
|
*
|
|
86
|
-
* @version 0.0
|
|
319
|
+
* @version 0.1.0
|
|
87
320
|
* @since 0.0.1
|
|
88
321
|
* @author AMBROISE PARK Consulting
|
|
89
322
|
*/
|
|
90
323
|
interface AuthConfig {
|
|
91
|
-
/** Route to redirect when authentication required (default: '/
|
|
92
|
-
authRoute
|
|
324
|
+
/** Route to redirect when authentication required (default: '/') */
|
|
325
|
+
authRoute?: string;
|
|
93
326
|
/** Route to redirect when role insufficient (default: '/404') */
|
|
94
327
|
roleRoute: string;
|
|
95
328
|
/** Route to redirect when tier insufficient (default: '/404') */
|
|
96
329
|
tierRoute: string;
|
|
97
330
|
/** Optional: Path to login page. If provided, AuthHeader links to login page. If undefined (default), shows providers in header */
|
|
98
331
|
loginPath?: string;
|
|
332
|
+
/** Optional: Path to password reset callback page (default: '/auth/reset-password'). Framework auto-handles the route. */
|
|
333
|
+
resetPasswordPath?: string;
|
|
99
334
|
/** Optional: Path to profile page (default: '/profile') */
|
|
100
335
|
profilePath?: string;
|
|
101
336
|
/**
|
|
@@ -156,7 +391,7 @@ interface AuthConfig {
|
|
|
156
391
|
* };
|
|
157
392
|
* ```
|
|
158
393
|
*
|
|
159
|
-
* @version 0.0
|
|
394
|
+
* @version 0.1.0
|
|
160
395
|
* @since 0.0.1
|
|
161
396
|
* @author AMBROISE PARK Consulting
|
|
162
397
|
*/
|
|
@@ -181,6 +416,39 @@ interface SEOConfig {
|
|
|
181
416
|
twitterHandle?: string;
|
|
182
417
|
/** Additional static meta tags */
|
|
183
418
|
staticTags?: Record<string, string>;
|
|
419
|
+
/** URL redirect rules - generates platform-specific 301/302 redirects at build time */
|
|
420
|
+
redirects?: Array<{
|
|
421
|
+
/** Source path (supports :param syntax, e.g. '/old-blog/:slug') */
|
|
422
|
+
from: string;
|
|
423
|
+
/** Destination path (supports :param syntax, e.g. '/blog/:slug') */
|
|
424
|
+
to: string;
|
|
425
|
+
/** true = 301 permanent (default), false = 302 temporary */
|
|
426
|
+
permanent?: boolean;
|
|
427
|
+
}>;
|
|
428
|
+
|
|
429
|
+
// --- SEO/GEO features (all ON by default, opt-out per feature) ---
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* AI crawler management in robots.txt (default: 'recommended')
|
|
433
|
+
* - 'recommended': Block training bots (GPTBot, Google-Extended, CCBot, ClaudeBot),
|
|
434
|
+
* allow search/retrieval bots (OAI-SearchBot, ChatGPT-User, Claude-SearchBot, etc.)
|
|
435
|
+
* - 'block-all': Block all AI bots
|
|
436
|
+
* - 'allow-all': Allow all AI bots
|
|
437
|
+
* - false: No AI crawler directives
|
|
438
|
+
*/
|
|
439
|
+
aiCrawlers?: 'recommended' | 'block-all' | 'allow-all' | false;
|
|
440
|
+
/** Generate llms.txt per llmstxt.org spec (default: true). Set to false to disable. */
|
|
441
|
+
llmsTxt?: boolean;
|
|
442
|
+
/** Inject Speculation Rules API for prefetch/prerender of internal links (default: true). Set to false to disable. */
|
|
443
|
+
speculationRules?: boolean;
|
|
444
|
+
/** Emit hreflang alternate links when i18n has 2+ languages (default: true). No-op for monolingual apps. Set to false to disable. */
|
|
445
|
+
hreflang?: boolean;
|
|
446
|
+
/** Auto-generate BreadcrumbList JSON-LD from URL path segments (default: true). Set to false to disable. */
|
|
447
|
+
breadcrumbSchema?: boolean;
|
|
448
|
+
/** Auto-generate WebSite JSON-LD with SearchAction for sitelinks search box (default: true). Set to false to disable. */
|
|
449
|
+
websiteSchema?: boolean;
|
|
450
|
+
/** Auto-generate Organization JSON-LD on homepage from app.links (default: true). Set to false to disable. */
|
|
451
|
+
organizationSchema?: boolean;
|
|
184
452
|
}
|
|
185
453
|
|
|
186
454
|
/**
|
|
@@ -197,7 +465,7 @@ interface SEOConfig {
|
|
|
197
465
|
* };
|
|
198
466
|
* ```
|
|
199
467
|
*
|
|
200
|
-
* @version 0.0
|
|
468
|
+
* @version 0.1.0
|
|
201
469
|
* @since 0.0.1
|
|
202
470
|
* @author AMBROISE PARK Consulting
|
|
203
471
|
*/
|
|
@@ -231,7 +499,7 @@ interface FaviconConfig {
|
|
|
231
499
|
* };
|
|
232
500
|
* ```
|
|
233
501
|
*
|
|
234
|
-
* @version 0.0
|
|
502
|
+
* @version 0.1.0
|
|
235
503
|
* @since 0.0.1
|
|
236
504
|
* @author AMBROISE PARK Consulting
|
|
237
505
|
*/
|
|
@@ -306,7 +574,7 @@ interface FeaturesConfig {
|
|
|
306
574
|
* };
|
|
307
575
|
* ```
|
|
308
576
|
*
|
|
309
|
-
* @version 0.0
|
|
577
|
+
* @version 0.1.0
|
|
310
578
|
* @since 0.0.1
|
|
311
579
|
* @author AMBROISE PARK Consulting
|
|
312
580
|
*/
|
|
@@ -342,7 +610,7 @@ interface FeaturesConfig {
|
|
|
342
610
|
* }
|
|
343
611
|
* ```
|
|
344
612
|
*
|
|
345
|
-
* @version 0.0
|
|
613
|
+
* @version 0.1.0
|
|
346
614
|
* @since 0.0.1
|
|
347
615
|
* @author AMBROISE PARK Consulting
|
|
348
616
|
*/
|
|
@@ -363,6 +631,7 @@ interface QueryConfig {
|
|
|
363
631
|
mutationRetryDelay?: (attemptIndex: number) => number;
|
|
364
632
|
}
|
|
365
633
|
|
|
634
|
+
/** Top-level application configuration passed to DoNotDevProvider. */
|
|
366
635
|
interface AppConfig {
|
|
367
636
|
/** App metadata and branding */
|
|
368
637
|
app?: AppMetadata;
|
|
@@ -374,173 +643,21 @@ interface AppConfig {
|
|
|
374
643
|
favicon?: FaviconConfig | false;
|
|
375
644
|
/** Layout preset for store initialization (defaults to 'landing' if invalid/empty) */
|
|
376
645
|
preset?: string;
|
|
646
|
+
/** Custom presets — same shape as built-in presets, keyed by name */
|
|
647
|
+
customPresets?: Record<string, PresetConfig>;
|
|
377
648
|
/** Feature flags */
|
|
378
649
|
features?: FeaturesConfig;
|
|
379
650
|
/** Query cache configuration (defaults: 5min staleTime, refetch on focus/reconnect) */
|
|
380
651
|
query?: QueryConfig;
|
|
381
652
|
}
|
|
382
653
|
|
|
383
|
-
type $MergeBy<T, K> = Omit<T, keyof K> & K;
|
|
384
|
-
|
|
385
|
-
type $PreservedValue<Value, Fallback> = [Value] extends [never] ? Fallback : Value;
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* This interface can be augmented by users to add types to `i18next` default TypeOptions.
|
|
389
|
-
*
|
|
390
|
-
* Usage:
|
|
391
|
-
* ```ts
|
|
392
|
-
* // i18next.d.ts
|
|
393
|
-
* import 'i18next';
|
|
394
|
-
* declare module 'i18next' {
|
|
395
|
-
* interface CustomTypeOptions {
|
|
396
|
-
* defaultNS: 'custom';
|
|
397
|
-
* returnNull: false;
|
|
398
|
-
* returnObjects: false;
|
|
399
|
-
* nsSeparator: ':';
|
|
400
|
-
* keySeparator: '.';
|
|
401
|
-
* compatibilityJSON: 'v4';
|
|
402
|
-
* allowObjectInHTMLChildren: false;
|
|
403
|
-
* resources: {
|
|
404
|
-
* custom: {
|
|
405
|
-
* foo: 'foo';
|
|
406
|
-
* };
|
|
407
|
-
* };
|
|
408
|
-
* }
|
|
409
|
-
* }
|
|
410
|
-
* ```
|
|
411
|
-
*/
|
|
412
|
-
interface CustomTypeOptions {}
|
|
413
|
-
|
|
414
|
-
type TypeOptions = $MergeBy<
|
|
415
|
-
{
|
|
416
|
-
/** @see {InitOptions.returnNull} */
|
|
417
|
-
returnNull: false;
|
|
418
|
-
|
|
419
|
-
/** @see {InitOptions.returnEmptyString} */
|
|
420
|
-
returnEmptyString: true;
|
|
421
|
-
|
|
422
|
-
/** @see {InitOptions.returnObjects} */
|
|
423
|
-
returnObjects: false;
|
|
424
|
-
|
|
425
|
-
/** @see {InitOptions.keySeparator} */
|
|
426
|
-
keySeparator: '.';
|
|
427
|
-
|
|
428
|
-
/** @see {InitOptions.nsSeparator} */
|
|
429
|
-
nsSeparator: ':';
|
|
430
|
-
|
|
431
|
-
/** @see {InitOptions.pluralSeparator} */
|
|
432
|
-
pluralSeparator: '_';
|
|
433
|
-
|
|
434
|
-
/** @see {InitOptions.contextSeparator} */
|
|
435
|
-
contextSeparator: '_';
|
|
436
|
-
|
|
437
|
-
/** @see {InitOptions.defaultNS} */
|
|
438
|
-
defaultNS: 'translation';
|
|
439
|
-
|
|
440
|
-
/** @see {InitOptions.fallbackNS} */
|
|
441
|
-
fallbackNS: false;
|
|
442
|
-
|
|
443
|
-
/** @see {InitOptions.compatibilityJSON} */
|
|
444
|
-
compatibilityJSON: 'v4';
|
|
445
|
-
|
|
446
|
-
/** @see {InitOptions.resources} */
|
|
447
|
-
resources: object;
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Flag that allows HTML elements to receive objects. This is only useful for React applications
|
|
451
|
-
* where you pass objects to HTML elements so they can be replaced to their respective interpolation
|
|
452
|
-
* values (mostly with Trans component)
|
|
453
|
-
*/
|
|
454
|
-
allowObjectInHTMLChildren: false;
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Flag that enables strict key checking even if a `defaultValue` has been provided.
|
|
458
|
-
* This ensures all calls of `t` function don't accidentally use implicitly missing keys.
|
|
459
|
-
*/
|
|
460
|
-
strictKeyChecks: false;
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Prefix for interpolation
|
|
464
|
-
*/
|
|
465
|
-
interpolationPrefix: '{{';
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Suffix for interpolation
|
|
469
|
-
*/
|
|
470
|
-
interpolationSuffix: '}}';
|
|
471
|
-
|
|
472
|
-
/** @see {InterpolationOptions.unescapePrefix} */
|
|
473
|
-
unescapePrefix: '-';
|
|
474
|
-
|
|
475
|
-
/** @see {InterpolationOptions.unescapeSuffix} */
|
|
476
|
-
unescapeSuffix: '';
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Use a proxy-based selector to select a translation.
|
|
480
|
-
*
|
|
481
|
-
* Enables features like go-to definition, and better DX/faster autocompletion
|
|
482
|
-
* for TypeScript developers.
|
|
483
|
-
*
|
|
484
|
-
* If you're working with an especially large set of translations and aren't
|
|
485
|
-
* using context, you set `enableSelector` to `"optimize"` and i18next won't do
|
|
486
|
-
* any type-level processing of your translations at all.
|
|
487
|
-
*
|
|
488
|
-
* With `enableSelector` set to `"optimize"`, i18next is capable of supporting
|
|
489
|
-
* arbitrarily large/deep translation sets without causing any IDE slowdown
|
|
490
|
-
* whatsoever.
|
|
491
|
-
*
|
|
492
|
-
* @default false
|
|
493
|
-
*/
|
|
494
|
-
enableSelector: false;
|
|
495
|
-
},
|
|
496
|
-
CustomTypeOptions
|
|
497
|
-
>;
|
|
498
|
-
|
|
499
|
-
type FlatNamespace = $PreservedValue<keyof TypeOptions['resources'], string>;
|
|
500
|
-
type Namespace<T = FlatNamespace> = T | readonly T[];
|
|
501
|
-
|
|
502
|
-
interface ReportNamespaces {
|
|
503
|
-
addUsedNamespaces(namespaces: Namespace): void;
|
|
504
|
-
getUsedNamespaces(): string[];
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
declare module 'i18next' {
|
|
508
|
-
// interface i18n {
|
|
509
|
-
// reportNamespaces?: ReportNamespaces;
|
|
510
|
-
// }
|
|
511
|
-
interface CustomInstanceExtensions {
|
|
512
|
-
reportNamespaces?: ReportNamespaces;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
type ObjectOrNever = TypeOptions['allowObjectInHTMLChildren'] extends true
|
|
517
|
-
? Record<string, unknown>
|
|
518
|
-
: never;
|
|
519
|
-
|
|
520
|
-
type ReactI18NextChildren = React.ReactNode | ObjectOrNever;
|
|
521
|
-
|
|
522
|
-
declare module 'react' {
|
|
523
|
-
namespace JSX {
|
|
524
|
-
interface IntrinsicAttributes {
|
|
525
|
-
i18nIsDynamicList?: boolean;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
interface HTMLAttributes<T> {
|
|
530
|
-
// This union is inspired by the typings for React.ReactNode. We do this to fix "This JSX tag's 'children' prop
|
|
531
|
-
// expects a single child of type 'ReactI18NextChildren', but multiple children were provided":
|
|
532
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5a1e9f91ed0143adede394adb3f540e650455f71/types/react/index.d.ts#L268
|
|
533
|
-
children?: ReactI18NextChildren | Iterable<ReactI18NextChildren>;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
|
|
537
654
|
// packages/core/config/index.d.ts
|
|
538
655
|
|
|
539
656
|
/**
|
|
540
657
|
* @fileoverview TypeScript Definitions for @donotdev/config
|
|
541
658
|
* @description Comprehensive configuration system for DNDev applications supporting Vite and Next.js with built-in routing, theming, and internationalization.
|
|
542
659
|
*
|
|
543
|
-
* @version 0.0
|
|
660
|
+
* @version 0.1.0
|
|
544
661
|
* @since 0.0.1
|
|
545
662
|
* @author AMBROISE PARK Consulting
|
|
546
663
|
*/
|
|
@@ -548,7 +665,7 @@ declare module 'react' {
|
|
|
548
665
|
/**
|
|
549
666
|
* Build configuration options
|
|
550
667
|
*
|
|
551
|
-
* @version 0.0
|
|
668
|
+
* @version 0.1.0
|
|
552
669
|
* @since 0.0.1
|
|
553
670
|
* @author AMBROISE PARK Consulting
|
|
554
671
|
*/
|
|
@@ -580,7 +697,7 @@ interface BuildConfig {
|
|
|
580
697
|
/**
|
|
581
698
|
* Module resolution options
|
|
582
699
|
*
|
|
583
|
-
* @version 0.0
|
|
700
|
+
* @version 0.1.0
|
|
584
701
|
* @since 0.0.1
|
|
585
702
|
* @author AMBROISE PARK Consulting
|
|
586
703
|
*/
|
|
@@ -594,7 +711,7 @@ interface ResolveOptions {
|
|
|
594
711
|
* Server configuration options
|
|
595
712
|
* Used for both dev server and preview server
|
|
596
713
|
*
|
|
597
|
-
* @version 0.0
|
|
714
|
+
* @version 0.1.0
|
|
598
715
|
* @since 0.0.1
|
|
599
716
|
* @author AMBROISE PARK Consulting
|
|
600
717
|
*/
|
|
@@ -651,7 +768,7 @@ interface ServerOptions {
|
|
|
651
768
|
/**
|
|
652
769
|
* I18n virtual mapping options
|
|
653
770
|
*
|
|
654
|
-
* @version 0.0
|
|
771
|
+
* @version 0.1.0
|
|
655
772
|
* @since 0.0.1
|
|
656
773
|
* @author AMBROISE PARK Consulting
|
|
657
774
|
*/
|
|
@@ -665,7 +782,7 @@ interface I18nVirtualMappingOptions {
|
|
|
665
782
|
* HMR options are internal framework concerns (in DEFAULT_OPTIONS only, not user-configurable)
|
|
666
783
|
* Plugins are always enabled (part of framework) - no enabled option
|
|
667
784
|
*
|
|
668
|
-
* @version 0.0
|
|
785
|
+
* @version 0.1.0
|
|
669
786
|
* @since 0.0.1
|
|
670
787
|
* @author AMBROISE PARK Consulting
|
|
671
788
|
*/
|
|
@@ -679,7 +796,7 @@ interface BaseDiscoveryOptions {
|
|
|
679
796
|
/**
|
|
680
797
|
* Theme detection options
|
|
681
798
|
*
|
|
682
|
-
* @version 0.0
|
|
799
|
+
* @version 0.1.0
|
|
683
800
|
* @since 0.0.1
|
|
684
801
|
* @author AMBROISE PARK Consulting
|
|
685
802
|
*/
|
|
@@ -693,7 +810,7 @@ interface ThemeDetectionOptions extends BaseDiscoveryOptions {
|
|
|
693
810
|
/**
|
|
694
811
|
* Route discovery options with virtual module support
|
|
695
812
|
*
|
|
696
|
-
* @version 0.0
|
|
813
|
+
* @version 0.1.0
|
|
697
814
|
* @since 0.0.1
|
|
698
815
|
* @author AMBROISE PARK Consulting
|
|
699
816
|
*/
|
|
@@ -709,7 +826,7 @@ interface RouteDiscoveryOptions extends BaseDiscoveryOptions {
|
|
|
709
826
|
/**
|
|
710
827
|
* I18n options
|
|
711
828
|
*
|
|
712
|
-
* @version 0.0
|
|
829
|
+
* @version 0.1.0
|
|
713
830
|
* @since 0.0.1
|
|
714
831
|
* @author AMBROISE PARK Consulting
|
|
715
832
|
*/
|
|
@@ -728,7 +845,7 @@ interface I18nOptions extends BaseDiscoveryOptions {
|
|
|
728
845
|
/**
|
|
729
846
|
* Asset options
|
|
730
847
|
*
|
|
731
|
-
* @version 0.0
|
|
848
|
+
* @version 0.1.0
|
|
732
849
|
* @since 0.0.1
|
|
733
850
|
* @author AMBROISE PARK Consulting
|
|
734
851
|
*/
|
|
@@ -740,7 +857,7 @@ interface AssetOptions extends BaseDiscoveryOptions {
|
|
|
740
857
|
/**
|
|
741
858
|
* Progressive Web App options
|
|
742
859
|
*
|
|
743
|
-
* @version 0.0
|
|
860
|
+
* @version 0.1.0
|
|
744
861
|
* @since 0.0.1
|
|
745
862
|
* @author AMBROISE PARK Consulting
|
|
746
863
|
*/
|
|
@@ -811,7 +928,7 @@ interface PWAOptions {
|
|
|
811
928
|
/**
|
|
812
929
|
* Asset fallback options
|
|
813
930
|
*
|
|
814
|
-
* @version 0.0
|
|
931
|
+
* @version 0.1.0
|
|
815
932
|
* @since 0.0.1
|
|
816
933
|
* @author AMBROISE PARK Consulting
|
|
817
934
|
*/
|
|
@@ -836,7 +953,7 @@ interface AssetFallbackOptions {
|
|
|
836
953
|
* User patterns are APPENDED to framework's react-core patterns (not replaced).
|
|
837
954
|
* Framework patterns are always included - user patterns extend them.
|
|
838
955
|
*
|
|
839
|
-
* @version 0.0
|
|
956
|
+
* @version 0.1.0
|
|
840
957
|
* @since 0.0.1
|
|
841
958
|
* @author AMBROISE PARK Consulting
|
|
842
959
|
*/
|
|
@@ -849,7 +966,7 @@ interface ChunkingOptions {
|
|
|
849
966
|
* Server shim options for blocking server-only imports
|
|
850
967
|
* Note: serverShim cannot be disabled - framework would crash without it
|
|
851
968
|
*
|
|
852
|
-
* @version 0.0
|
|
969
|
+
* @version 0.1.0
|
|
853
970
|
* @since 0.0.1
|
|
854
971
|
* @author AMBROISE PARK Consulting
|
|
855
972
|
*/
|
|
@@ -863,7 +980,7 @@ interface ServerShimOptions {
|
|
|
863
980
|
/**
|
|
864
981
|
* Dependency optimization options
|
|
865
982
|
*
|
|
866
|
-
* @version 0.0
|
|
983
|
+
* @version 0.1.0
|
|
867
984
|
* @since 0.0.1
|
|
868
985
|
* @author AMBROISE PARK Consulting
|
|
869
986
|
*/
|
|
@@ -888,7 +1005,7 @@ interface OptimizeDepsOptions {
|
|
|
888
1005
|
* Provides comprehensive configuration for Vite-based applications with
|
|
889
1006
|
* built-in support for routing, theming, internationalization, and SEO.
|
|
890
1007
|
*
|
|
891
|
-
* @version 0.0
|
|
1008
|
+
* @version 0.1.0
|
|
892
1009
|
* @since 0.0.1
|
|
893
1010
|
* @author AMBROISE PARK Consulting
|
|
894
1011
|
*/
|
|
@@ -943,7 +1060,7 @@ interface ConfigOptions {
|
|
|
943
1060
|
* @param options - Configuration options
|
|
944
1061
|
* @returns Complete Vite configuration object
|
|
945
1062
|
*
|
|
946
|
-
* @version 0.0
|
|
1063
|
+
* @version 0.1.0
|
|
947
1064
|
* @since 0.0.1
|
|
948
1065
|
* @author AMBROISE PARK Consulting
|
|
949
1066
|
*/
|