@donotdev/core 0.3.2 → 0.3.4

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 (51) hide show
  1. package/functions/index.js +19 -19
  2. package/i18n/locales/eager/dndev_ar.json +2 -1
  3. package/i18n/locales/eager/dndev_da.json +2 -1
  4. package/i18n/locales/eager/dndev_de.json +2 -1
  5. package/i18n/locales/eager/dndev_en.json +2 -1
  6. package/i18n/locales/eager/dndev_es.json +2 -1
  7. package/i18n/locales/eager/dndev_fr.json +2 -1
  8. package/i18n/locales/eager/dndev_it.json +2 -1
  9. package/i18n/locales/eager/dndev_ja.json +2 -1
  10. package/i18n/locales/eager/dndev_ko.json +2 -1
  11. package/i18n/locales/eager/dndev_nl.json +2 -1
  12. package/i18n/locales/eager/dndev_pl.json +2 -1
  13. package/i18n/locales/eager/dndev_pt.json +2 -1
  14. package/i18n/locales/eager/dndev_zh.json +2 -1
  15. package/i18n/locales/lazy/auth_ar.json +25 -2
  16. package/i18n/locales/lazy/auth_da.json +28 -2
  17. package/i18n/locales/lazy/auth_de.json +25 -2
  18. package/i18n/locales/lazy/auth_en.json +25 -2
  19. package/i18n/locales/lazy/auth_es.json +25 -2
  20. package/i18n/locales/lazy/auth_fr.json +25 -2
  21. package/i18n/locales/lazy/auth_it.json +25 -2
  22. package/i18n/locales/lazy/auth_ja.json +25 -2
  23. package/i18n/locales/lazy/auth_ko.json +25 -2
  24. package/i18n/locales/lazy/auth_nl.json +28 -2
  25. package/i18n/locales/lazy/auth_pl.json +25 -2
  26. package/i18n/locales/lazy/auth_pt.json +25 -2
  27. package/i18n/locales/lazy/auth_zh.json +25 -2
  28. package/i18n/locales/lazy/crud_ar.json +3 -1
  29. package/i18n/locales/lazy/crud_da.json +3 -1
  30. package/i18n/locales/lazy/crud_de.json +3 -1
  31. package/i18n/locales/lazy/crud_en.json +3 -1
  32. package/i18n/locales/lazy/crud_es.json +3 -1
  33. package/i18n/locales/lazy/crud_fr.json +3 -1
  34. package/i18n/locales/lazy/crud_it.json +3 -1
  35. package/i18n/locales/lazy/crud_ja.json +3 -1
  36. package/i18n/locales/lazy/crud_ko.json +3 -1
  37. package/i18n/locales/lazy/crud_nl.json +3 -1
  38. package/i18n/locales/lazy/crud_pl.json +3 -1
  39. package/i18n/locales/lazy/crud_pt.json +3 -1
  40. package/i18n/locales/lazy/crud_zh.json +3 -1
  41. package/index.d.ts +455 -49
  42. package/index.js +5 -5
  43. package/next/index.d.ts +80 -10
  44. package/next/index.js +259 -216
  45. package/next/runtime.js +2 -2
  46. package/package.json +2 -2
  47. package/server.d.ts +323 -24
  48. package/shared.js +2 -2
  49. package/symbol-index.json +1 -1
  50. package/vite/index.d.ts +65 -1
  51. package/vite/index.js +113 -107
package/next/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { Metadata } from 'next';
3
- import { LanguageRouting, EntitySeoOptions, AnyEntity, EntitySeoRecord, EntitySeo, languageUrl, buildBreadcrumbJsonLd, dndevSchema, formatTrailingSlash, ICrudAdapter, languageUrls, OperationSchemas } from '@donotdev/core/server';
3
+ import { LanguageRouting, EntitySeoOptions, AnyEntity, EntitySeoRecord, EntitySeo, languageUrl, buildBreadcrumbJsonLd, BreadcrumbRoute, dndevSchema, formatTrailingSlash, ICrudAdapter, languageUrls, OperationSchemas } from '@donotdev/core/server';
4
4
 
5
5
  /**
6
6
  * Footer mode constants - DRY single source of truth
@@ -449,7 +449,7 @@ interface SEOConfig {
449
449
  speculationRules?: boolean;
450
450
  /** Emit hreflang alternate links when i18n has 2+ languages (default: true). No-op for monolingual apps. Set to false to disable. */
451
451
  hreflang?: boolean;
452
- /** Auto-generate BreadcrumbList JSON-LD from URL path segments (default: true). Set to false to disable. */
452
+ /** Auto-generate BreadcrumbList JSON-LD: the site, the page's ancestors (`routeAncestors`: URL prefixes that are pages, PageMeta `parent`) and the page, by page title (default: true). Set to false to disable. */
453
453
  breadcrumbSchema?: boolean;
454
454
  /** Auto-generate WebSite JSON-LD with SearchAction for sitelinks search box (default: true). Set to false to disable. */
455
455
  websiteSchema?: boolean;
@@ -520,6 +520,45 @@ interface HeadersConfig {
520
520
  cache?: readonly CacheOverride[];
521
521
  }
522
522
 
523
+ /**
524
+ * One woff2 file of an app-owned font family ({@link LocalFontConfig}).
525
+ *
526
+ * @since 0.3.3
527
+ */
528
+ interface LocalFontFace {
529
+ /** woff2 path relative to the app root, e.g. `'src/assets/fonts/brand.woff2'` */
530
+ file: string;
531
+ /** A weight (`400`) or a variable font's range (`'300 600'`) */
532
+ weight: number | `${number} ${number}`;
533
+ /** Default `'normal'` */
534
+ style?: 'normal' | 'italic';
535
+ /**
536
+ * The face's `unicode-range` (`'U+AC00-D7A3'`): the browser downloads the file only for
537
+ * characters in it. Omitted: the family's core file, preloaded for the first paint.
538
+ */
539
+ unicodeRange?: string;
540
+ /**
541
+ * Subset the face covers, matched against the page language
542
+ * (`LOCALE_TO_FONT_SUBSETS`, e.g. `'latin-ext'` for `pl`): a face with a `unicodeRange`
543
+ * is preloaded on the pages whose language needs this subset.
544
+ */
545
+ subset?: string;
546
+ }
547
+
548
+ /**
549
+ * An app-owned font family: its woff2 files, for a family no fontsource package
550
+ * provides (a custom subset, a licensed brand font). The family is named in the theme
551
+ * tokens like any other (`--font-sans: Pretendard, 'Pretendard Fallback', sans-serif;`).
552
+ *
553
+ * @since 0.3.3
554
+ */
555
+ interface LocalFontConfig {
556
+ /** Picks the system font of the size-matched fallback face: Arial, or Times New Roman for `serif` */
557
+ category: 'sans-serif' | 'serif';
558
+ /** The family's files */
559
+ faces: readonly LocalFontFace[];
560
+ }
561
+
523
562
  /**
524
563
  * Favicon and PWA configuration
525
564
  *
@@ -765,6 +804,31 @@ interface AppConfig {
765
804
  * @since 0.3.1
766
805
  */
767
806
  headers?: HeadersConfig;
807
+ /**
808
+ * The app's own font files, per family as the theme tokens name it (`src/themes.css`),
809
+ * for families no package provides. Every other family is resolved by name:
810
+ * `@fontsource-variable/<slug>`, then `@fontsource/<slug>` in the app's dependencies,
811
+ * then the families `@donotdev/ui` bundles (Inter, Playfair Display, Space Grotesk,
812
+ * Roboto, Press Start 2P). The framework ships every family the theme renders text in
813
+ * (Next and Vite alike): font preloads and inline `@font-face` in the server HTML,
814
+ * `font-display: optional`, size-matched `'<Family> Fallback'` face, content-hashed
815
+ * files under `/fonts/` cached immutable. Read at build; the app writes no
816
+ * `@font-face`, imports no `@fontsource` CSS and uses no `next/font` (each fails the
817
+ * build).
818
+ *
819
+ * @example
820
+ * ```typescript
821
+ * fonts: {
822
+ * Pretendard: {
823
+ * category: 'sans-serif',
824
+ * faces: [{ file: 'src/assets/fonts/pretendard.woff2', weight: '300 700' }],
825
+ * },
826
+ * }
827
+ * ```
828
+ *
829
+ * @since 0.3.3
830
+ */
831
+ fonts?: Readonly<Record<string, LocalFontConfig>>;
768
832
  }
769
833
 
770
834
  /**
@@ -1017,11 +1081,9 @@ interface NextConfigOptions {
1017
1081
  serverShim?: ServerShimOptions;
1018
1082
  /**
1019
1083
  * Standard Next.js config options, passed through to Next (which validates them).
1020
- * `rewrites`, `redirects`, `headers` and `compiler.runAfterProductionCompile` are composed
1021
- * with the framework's: `headers` rules come after the framework header policy (last
1022
- * wins), the app's `runAfterProductionCompile` runs after the framework's (Safari < 14.1
1023
- * destructuring fix). The framework sets no `webpack` config (Next 16 builds with
1024
- * Turbopack): an app's own passes through. Prefer
1084
+ * `rewrites`, `redirects` and `headers` are composed with the framework's: `headers` rules
1085
+ * come after the framework header policy (last wins). The framework sets no `webpack` or
1086
+ * `compiler` config (Next 16 builds with Turbopack): an app's own passes through. Prefer
1025
1087
  * `appConfig.headers` for CSP sources and cache overrides (same option on Vite).
1026
1088
  */
1027
1089
  [key: string]: any;
@@ -1042,7 +1104,7 @@ declare function defineNextConfig(options?: NextConfigOptions): any;
1042
1104
 
1043
1105
  /**
1044
1106
  * Create PostCSS configuration for Next.js consumer apps.
1045
- * Handles @fontsource CSS alias and workspace-aware package resolution.
1107
+ * Workspace-aware package resolution (no font goes through CSS: the font plan ships fonts as head tags).
1046
1108
  *
1047
1109
  * @example
1048
1110
  * ```js
@@ -1355,6 +1417,14 @@ interface EntityPageContext {
1355
1417
  languageUrl: typeof languageUrl;
1356
1418
  /** `buildBreadcrumbJsonLd` from @donotdev/core/server (BreadcrumbList ending with the record title) */
1357
1419
  buildBreadcrumbJsonLd: typeof buildBreadcrumbJsonLd;
1420
+ /**
1421
+ * Routes the BreadcrumbList reads: the page's route and its ancestors (`routeAncestors`:
1422
+ * URL prefixes that are routes, PageMeta `parent`) with their PageMeta `namespace`,
1423
+ * `seo` and `parent` (the generated page embeds them; the Vite build passes the manifest)
1424
+ */
1425
+ routes: readonly BreadcrumbRoute[];
1426
+ /** `appConfig.seo.defaultNamespace` (`home`): labels of ancestors without a namespace (`routeLabel`) */
1427
+ defaultNamespace: string;
1358
1428
  }
1359
1429
 
1360
1430
  /** Server identity of one entity page. */
@@ -1370,8 +1440,8 @@ interface EntityPageSeo {
1370
1440
  /** Product JSON-LD (`type: 'product'`), null otherwise */
1371
1441
  jsonLd: Record<string, unknown> | null;
1372
1442
  /**
1373
- * BreadcrumbList JSON-LD: site home, the URL's segments as the visible breadcrumb names
1374
- * them, the record title last (null without a record title). AutoMetaTags emits no
1443
+ * BreadcrumbList JSON-LD: site home, the page's ancestors named by their titles as the
1444
+ * visible breadcrumb names them, the record title last (null without a record title). AutoMetaTags emits no
1375
1445
  * breadcrumb on these routes (`routes.manifest.recordBreadcrumbPaths`).
1376
1446
  */
1377
1447
  breadcrumb: Record<string, unknown> | null;