@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/next/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,170 +643,18 @@ 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
|
/**
|
|
538
655
|
* I18n virtual mapping options
|
|
539
656
|
*
|
|
540
|
-
* @version 0.0
|
|
657
|
+
* @version 0.1.0
|
|
541
658
|
* @since 0.0.1
|
|
542
659
|
* @author AMBROISE PARK Consulting
|
|
543
660
|
*/
|
|
@@ -551,7 +668,7 @@ interface I18nVirtualMappingOptions {
|
|
|
551
668
|
* HMR options are internal framework concerns (in DEFAULT_OPTIONS only, not user-configurable)
|
|
552
669
|
* Plugins are always enabled (part of framework) - no enabled option
|
|
553
670
|
*
|
|
554
|
-
* @version 0.0
|
|
671
|
+
* @version 0.1.0
|
|
555
672
|
* @since 0.0.1
|
|
556
673
|
* @author AMBROISE PARK Consulting
|
|
557
674
|
*/
|
|
@@ -565,7 +682,7 @@ interface BaseDiscoveryOptions {
|
|
|
565
682
|
/**
|
|
566
683
|
* Theme detection options
|
|
567
684
|
*
|
|
568
|
-
* @version 0.0
|
|
685
|
+
* @version 0.1.0
|
|
569
686
|
* @since 0.0.1
|
|
570
687
|
* @author AMBROISE PARK Consulting
|
|
571
688
|
*/
|
|
@@ -579,7 +696,7 @@ interface ThemeDetectionOptions extends BaseDiscoveryOptions {
|
|
|
579
696
|
/**
|
|
580
697
|
* Route discovery options with virtual module support
|
|
581
698
|
*
|
|
582
|
-
* @version 0.0
|
|
699
|
+
* @version 0.1.0
|
|
583
700
|
* @since 0.0.1
|
|
584
701
|
* @author AMBROISE PARK Consulting
|
|
585
702
|
*/
|
|
@@ -595,7 +712,7 @@ interface RouteDiscoveryOptions extends BaseDiscoveryOptions {
|
|
|
595
712
|
/**
|
|
596
713
|
* I18n options
|
|
597
714
|
*
|
|
598
|
-
* @version 0.0
|
|
715
|
+
* @version 0.1.0
|
|
599
716
|
* @since 0.0.1
|
|
600
717
|
* @author AMBROISE PARK Consulting
|
|
601
718
|
*/
|
|
@@ -614,7 +731,7 @@ interface I18nOptions extends BaseDiscoveryOptions {
|
|
|
614
731
|
/**
|
|
615
732
|
* Asset options
|
|
616
733
|
*
|
|
617
|
-
* @version 0.0
|
|
734
|
+
* @version 0.1.0
|
|
618
735
|
* @since 0.0.1
|
|
619
736
|
* @author AMBROISE PARK Consulting
|
|
620
737
|
*/
|
|
@@ -626,7 +743,7 @@ interface AssetOptions extends BaseDiscoveryOptions {
|
|
|
626
743
|
/**
|
|
627
744
|
* Progressive Web App options
|
|
628
745
|
*
|
|
629
|
-
* @version 0.0
|
|
746
|
+
* @version 0.1.0
|
|
630
747
|
* @since 0.0.1
|
|
631
748
|
* @author AMBROISE PARK Consulting
|
|
632
749
|
*/
|
|
@@ -697,7 +814,7 @@ interface PWAOptions {
|
|
|
697
814
|
/**
|
|
698
815
|
* Asset fallback options
|
|
699
816
|
*
|
|
700
|
-
* @version 0.0
|
|
817
|
+
* @version 0.1.0
|
|
701
818
|
* @since 0.0.1
|
|
702
819
|
* @author AMBROISE PARK Consulting
|
|
703
820
|
*/
|
|
@@ -720,7 +837,7 @@ interface AssetFallbackOptions {
|
|
|
720
837
|
* Server shim options for blocking server-only imports
|
|
721
838
|
* Note: serverShim cannot be disabled - framework would crash without it
|
|
722
839
|
*
|
|
723
|
-
* @version 0.0
|
|
840
|
+
* @version 0.1.0
|
|
724
841
|
* @since 0.0.1
|
|
725
842
|
* @author AMBROISE PARK Consulting
|
|
726
843
|
*/
|
|
@@ -736,7 +853,7 @@ interface ServerShimOptions {
|
|
|
736
853
|
/**
|
|
737
854
|
* Next.js configuration options for DNDev applications
|
|
738
855
|
*
|
|
739
|
-
* @version 0.0
|
|
856
|
+
* @version 0.1.0
|
|
740
857
|
* @since 0.0.1
|
|
741
858
|
* @author AMBROISE PARK Consulting
|
|
742
859
|
*/
|
|
@@ -775,7 +892,7 @@ interface NextConfigOptions {
|
|
|
775
892
|
/**
|
|
776
893
|
* Creates a Next.js configuration optimized for DNDev applications
|
|
777
894
|
*
|
|
778
|
-
* @version 0.0
|
|
895
|
+
* @version 0.1.0
|
|
779
896
|
* @since 0.0.1
|
|
780
897
|
* @author AMBROISE PARK Consulting
|
|
781
898
|
*/
|
|
@@ -798,5 +915,61 @@ declare function defineNextConfig(options?: NextConfigOptions): any;
|
|
|
798
915
|
*/
|
|
799
916
|
declare function definePostCSSConfig(): Promise<{ plugins: Array<unknown> }>;
|
|
800
917
|
|
|
801
|
-
|
|
918
|
+
/**
|
|
919
|
+
* Next.js Metadata object (simplified)
|
|
920
|
+
*/
|
|
921
|
+
interface NextMetadata {
|
|
922
|
+
title?: string;
|
|
923
|
+
description?: string;
|
|
924
|
+
keywords?: string | string[];
|
|
925
|
+
openGraph?: {
|
|
926
|
+
title?: string;
|
|
927
|
+
description?: string;
|
|
928
|
+
type?: string;
|
|
929
|
+
images?: string[];
|
|
930
|
+
siteName?: string;
|
|
931
|
+
};
|
|
932
|
+
twitter?: {
|
|
933
|
+
card?: 'summary' | 'summary_large_image';
|
|
934
|
+
title?: string;
|
|
935
|
+
description?: string;
|
|
936
|
+
images?: string[];
|
|
937
|
+
};
|
|
938
|
+
robots?: {
|
|
939
|
+
index?: boolean;
|
|
940
|
+
follow?: boolean;
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Get Next.js Metadata object for a given path.
|
|
946
|
+
* Reads pre-built metadata from manifest generated at build time.
|
|
947
|
+
*
|
|
948
|
+
* @example
|
|
949
|
+
* ```tsx
|
|
950
|
+
* // app/layout.tsx
|
|
951
|
+
* import { getMetadataForPath } from '@donotdev/core/next';
|
|
952
|
+
*
|
|
953
|
+
* export async function generateMetadata() {
|
|
954
|
+
* return getMetadataForPath('/');
|
|
955
|
+
* }
|
|
956
|
+
* ```
|
|
957
|
+
*
|
|
958
|
+
* @param path - Route path (e.g., '/', '/about')
|
|
959
|
+
* @param locale - Current locale (defaults to manifest's defaultLocale)
|
|
960
|
+
* @param options - Additional options
|
|
961
|
+
*/
|
|
962
|
+
declare function getMetadataForPath(
|
|
963
|
+
path: string,
|
|
964
|
+
locale?: string,
|
|
965
|
+
options?: { siteName?: string }
|
|
966
|
+
): NextMetadata;
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* Clear the metadata manifest cache.
|
|
970
|
+
* Useful for development hot-reload scenarios.
|
|
971
|
+
*/
|
|
972
|
+
declare function clearMetadataCache(): void;
|
|
973
|
+
|
|
974
|
+
export { clearMetadataCache, defineNextConfig, definePostCSSConfig, getMetadataForPath };
|
|
802
975
|
export type { NextConfigOptions };
|