@donotdev/core 0.1.0 → 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.
Files changed (66) hide show
  1. package/functions/index.d.ts +0 -155
  2. package/i18n/locales/eager/dndev_ar.json +158 -0
  3. package/i18n/locales/eager/dndev_da.json +153 -0
  4. package/i18n/locales/eager/dndev_de.json +158 -0
  5. package/i18n/locales/eager/dndev_en.json +3 -0
  6. package/i18n/locales/eager/dndev_es.json +159 -1
  7. package/i18n/locales/eager/dndev_fr.json +158 -0
  8. package/i18n/locales/eager/dndev_it.json +158 -0
  9. package/i18n/locales/eager/dndev_ja.json +158 -0
  10. package/i18n/locales/eager/dndev_ko.json +158 -0
  11. package/i18n/locales/eager/dndev_nl.json +153 -0
  12. package/i18n/locales/eager/dndev_pt.json +581 -0
  13. package/i18n/locales/eager/dndev_zh.json +581 -0
  14. package/i18n/locales/lazy/ai_en.json +25 -0
  15. package/i18n/locales/lazy/ai_pt.json +25 -0
  16. package/i18n/locales/lazy/ai_zh.json +25 -0
  17. package/i18n/locales/lazy/auth_ar.json +44 -0
  18. package/i18n/locales/lazy/auth_da.json +45 -1
  19. package/i18n/locales/lazy/auth_de.json +44 -0
  20. package/i18n/locales/lazy/auth_en.json +44 -0
  21. package/i18n/locales/lazy/auth_es.json +44 -0
  22. package/i18n/locales/lazy/auth_fr.json +44 -0
  23. package/i18n/locales/lazy/auth_it.json +44 -0
  24. package/i18n/locales/lazy/auth_ja.json +44 -0
  25. package/i18n/locales/lazy/auth_ko.json +44 -0
  26. package/i18n/locales/lazy/auth_nl.json +45 -1
  27. package/i18n/locales/lazy/auth_pt.json +192 -0
  28. package/i18n/locales/lazy/auth_zh.json +192 -0
  29. package/i18n/locales/lazy/billing_en.json +11 -0
  30. package/i18n/locales/lazy/billing_pt.json +93 -0
  31. package/i18n/locales/lazy/billing_zh.json +93 -0
  32. package/i18n/locales/lazy/blog_pt.json +9 -0
  33. package/i18n/locales/lazy/blog_zh.json +9 -0
  34. package/i18n/locales/lazy/cookies_pt.json +32 -0
  35. package/i18n/locales/lazy/cookies_zh.json +32 -0
  36. package/i18n/locales/lazy/crud_ar.json +3 -0
  37. package/i18n/locales/lazy/crud_da.json +3 -0
  38. package/i18n/locales/lazy/crud_de.json +3 -0
  39. package/i18n/locales/lazy/crud_en.json +3 -0
  40. package/i18n/locales/lazy/crud_es.json +3 -0
  41. package/i18n/locales/lazy/crud_fr.json +3 -0
  42. package/i18n/locales/lazy/crud_it.json +3 -0
  43. package/i18n/locales/lazy/crud_ja.json +3 -0
  44. package/i18n/locales/lazy/crud_ko.json +3 -0
  45. package/i18n/locales/lazy/crud_nl.json +3 -0
  46. package/i18n/locales/lazy/crud_pt.json +534 -0
  47. package/i18n/locales/lazy/crud_zh.json +534 -0
  48. package/i18n/locales/lazy/homeTemplate_pt.json +52 -0
  49. package/i18n/locales/lazy/homeTemplate_zh.json +52 -0
  50. package/i18n/locales/lazy/legalNotice_pt.json +55 -0
  51. package/i18n/locales/lazy/legalNotice_zh.json +55 -0
  52. package/i18n/locales/lazy/oauth_pt.json +11 -0
  53. package/i18n/locales/lazy/oauth_zh.json +11 -0
  54. package/i18n/locales/lazy/privacy_pt.json +178 -0
  55. package/i18n/locales/lazy/privacy_zh.json +178 -0
  56. package/i18n/locales/lazy/terms_pt.json +200 -0
  57. package/i18n/locales/lazy/terms_zh.json +200 -0
  58. package/index.d.ts +1604 -3832
  59. package/index.js +44 -516
  60. package/next/index.d.ts +299 -159
  61. package/next/index.js +72 -59
  62. package/package.json +10 -6
  63. package/server.d.ts +1328 -2309
  64. package/server.js +1 -372
  65. package/vite/index.d.ts +242 -158
  66. package/vite/index.js +72 -72
package/next/index.d.ts CHANGED
@@ -1,4 +1,237 @@
1
- import * as React from 'react';
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
 
@@ -88,14 +321,16 @@ interface AppMetadata {
88
321
  * @author AMBROISE PARK Consulting
89
322
  */
90
323
  interface AuthConfig {
91
- /** Route to redirect when authentication required (default: '/login') */
92
- authRoute: string;
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
  /**
@@ -195,7 +430,7 @@ interface SEOConfig {
195
430
 
196
431
  /**
197
432
  * AI crawler management in robots.txt (default: 'recommended')
198
- * - 'recommended': Block training bots (GPTBot, Google-Extended, CCBot, anthropic-ai),
433
+ * - 'recommended': Block training bots (GPTBot, Google-Extended, CCBot, ClaudeBot),
199
434
  * allow search/retrieval bots (OAI-SearchBot, ChatGPT-User, Claude-SearchBot, etc.)
200
435
  * - 'block-all': Block all AI bots
201
436
  * - 'allow-all': Allow all AI bots
@@ -396,6 +631,7 @@ interface QueryConfig {
396
631
  mutationRetryDelay?: (attemptIndex: number) => number;
397
632
  }
398
633
 
634
+ /** Top-level application configuration passed to DoNotDevProvider. */
399
635
  interface AppConfig {
400
636
  /** App metadata and branding */
401
637
  app?: AppMetadata;
@@ -407,166 +643,14 @@ interface AppConfig {
407
643
  favicon?: FaviconConfig | false;
408
644
  /** Layout preset for store initialization (defaults to 'landing' if invalid/empty) */
409
645
  preset?: string;
646
+ /** Custom presets — same shape as built-in presets, keyed by name */
647
+ customPresets?: Record<string, PresetConfig>;
410
648
  /** Feature flags */
411
649
  features?: FeaturesConfig;
412
650
  /** Query cache configuration (defaults: 5min staleTime, refetch on focus/reconnect) */
413
651
  query?: QueryConfig;
414
652
  }
415
653
 
416
- type $MergeBy<T, K> = Omit<T, keyof K> & K;
417
-
418
- type $PreservedValue<Value, Fallback> = [Value] extends [never] ? Fallback : Value;
419
-
420
- /**
421
- * This interface can be augmented by users to add types to `i18next` default TypeOptions.
422
- *
423
- * Usage:
424
- * ```ts
425
- * // i18next.d.ts
426
- * import 'i18next';
427
- * declare module 'i18next' {
428
- * interface CustomTypeOptions {
429
- * defaultNS: 'custom';
430
- * returnNull: false;
431
- * returnObjects: false;
432
- * nsSeparator: ':';
433
- * keySeparator: '.';
434
- * compatibilityJSON: 'v4';
435
- * allowObjectInHTMLChildren: false;
436
- * resources: {
437
- * custom: {
438
- * foo: 'foo';
439
- * };
440
- * };
441
- * }
442
- * }
443
- * ```
444
- */
445
- interface CustomTypeOptions {}
446
-
447
- type TypeOptions = $MergeBy<
448
- {
449
- /** @see {InitOptions.returnNull} */
450
- returnNull: false;
451
-
452
- /** @see {InitOptions.returnEmptyString} */
453
- returnEmptyString: true;
454
-
455
- /** @see {InitOptions.returnObjects} */
456
- returnObjects: false;
457
-
458
- /** @see {InitOptions.keySeparator} */
459
- keySeparator: '.';
460
-
461
- /** @see {InitOptions.nsSeparator} */
462
- nsSeparator: ':';
463
-
464
- /** @see {InitOptions.pluralSeparator} */
465
- pluralSeparator: '_';
466
-
467
- /** @see {InitOptions.contextSeparator} */
468
- contextSeparator: '_';
469
-
470
- /** @see {InitOptions.defaultNS} */
471
- defaultNS: 'translation';
472
-
473
- /** @see {InitOptions.fallbackNS} */
474
- fallbackNS: false;
475
-
476
- /** @see {InitOptions.compatibilityJSON} */
477
- compatibilityJSON: 'v4';
478
-
479
- /** @see {InitOptions.resources} */
480
- resources: object;
481
-
482
- /**
483
- * Flag that allows HTML elements to receive objects. This is only useful for React applications
484
- * where you pass objects to HTML elements so they can be replaced to their respective interpolation
485
- * values (mostly with Trans component)
486
- */
487
- allowObjectInHTMLChildren: false;
488
-
489
- /**
490
- * Flag that enables strict key checking even if a `defaultValue` has been provided.
491
- * This ensures all calls of `t` function don't accidentally use implicitly missing keys.
492
- */
493
- strictKeyChecks: false;
494
-
495
- /**
496
- * Prefix for interpolation
497
- */
498
- interpolationPrefix: '{{';
499
-
500
- /**
501
- * Suffix for interpolation
502
- */
503
- interpolationSuffix: '}}';
504
-
505
- /** @see {InterpolationOptions.unescapePrefix} */
506
- unescapePrefix: '-';
507
-
508
- /** @see {InterpolationOptions.unescapeSuffix} */
509
- unescapeSuffix: '';
510
-
511
- /**
512
- * Use a proxy-based selector to select a translation.
513
- *
514
- * Enables features like go-to definition, and better DX/faster autocompletion
515
- * for TypeScript developers.
516
- *
517
- * If you're working with an especially large set of translations and aren't
518
- * using context, you set `enableSelector` to `"optimize"` and i18next won't do
519
- * any type-level processing of your translations at all.
520
- *
521
- * With `enableSelector` set to `"optimize"`, i18next is capable of supporting
522
- * arbitrarily large/deep translation sets without causing any IDE slowdown
523
- * whatsoever.
524
- *
525
- * @default false
526
- */
527
- enableSelector: false;
528
- },
529
- CustomTypeOptions
530
- >;
531
-
532
- type FlatNamespace = $PreservedValue<keyof TypeOptions['resources'], string>;
533
- type Namespace<T = FlatNamespace> = T | readonly T[];
534
-
535
- interface ReportNamespaces {
536
- addUsedNamespaces(namespaces: Namespace): void;
537
- getUsedNamespaces(): string[];
538
- }
539
-
540
- declare module 'i18next' {
541
- // interface i18n {
542
- // reportNamespaces?: ReportNamespaces;
543
- // }
544
- interface CustomInstanceExtensions {
545
- reportNamespaces?: ReportNamespaces;
546
- }
547
- }
548
-
549
- type ObjectOrNever = TypeOptions['allowObjectInHTMLChildren'] extends true
550
- ? Record<string, unknown>
551
- : never;
552
-
553
- type ReactI18NextChildren = React.ReactNode | ObjectOrNever;
554
-
555
- declare module 'react' {
556
- namespace JSX {
557
- interface IntrinsicAttributes {
558
- i18nIsDynamicList?: boolean;
559
- }
560
- }
561
-
562
- interface HTMLAttributes<T> {
563
- // This union is inspired by the typings for React.ReactNode. We do this to fix "This JSX tag's 'children' prop
564
- // expects a single child of type 'ReactI18NextChildren', but multiple children were provided":
565
- // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5a1e9f91ed0143adede394adb3f540e650455f71/types/react/index.d.ts#L268
566
- children?: ReactI18NextChildren | Iterable<ReactI18NextChildren>;
567
- }
568
- }
569
-
570
654
  /**
571
655
  * I18n virtual mapping options
572
656
  *
@@ -831,5 +915,61 @@ declare function defineNextConfig(options?: NextConfigOptions): any;
831
915
  */
832
916
  declare function definePostCSSConfig(): Promise<{ plugins: Array<unknown> }>;
833
917
 
834
- export { defineNextConfig, definePostCSSConfig };
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 };
835
975
  export type { NextConfigOptions };