@justanarthur/payload-www 0.3.5 → 1.2.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 (63) hide show
  1. package/README.md +317 -307
  2. package/dist/access.d.ts +2 -2
  3. package/dist/access.js +3 -17
  4. package/dist/blocks.d.ts +7 -12
  5. package/dist/blocks.js +24 -43
  6. package/dist/cli.js +201 -0
  7. package/dist/collections.d.ts +33 -225
  8. package/dist/collections.js +185 -639
  9. package/dist/config.d.ts +19 -105
  10. package/dist/config.js +257 -855
  11. package/dist/fields.d.ts +4 -46
  12. package/dist/fields.js +177 -53
  13. package/dist/imagehash.js +0 -15
  14. package/dist/import-map-provider.d.ts +0 -16
  15. package/dist/import-map-provider.js +0 -15
  16. package/dist/metadata.d.ts +24 -89
  17. package/dist/metadata.js +123 -255
  18. package/dist/pages.d.ts +37 -319
  19. package/dist/pages.js +349 -964
  20. package/dist/render-pages.d.ts +70 -565
  21. package/dist/render-pages.js +464 -1477
  22. package/dist/sitemap.d.ts +10 -0
  23. package/dist/sitemap.js +337 -0
  24. package/dist/translator.js +0 -15
  25. package/dist/utils.d.ts +10 -12
  26. package/dist/utils.js +18 -41
  27. package/package.json +81 -178
  28. package/dist/components.d.ts +0 -6
  29. package/dist/components.js +0 -39
  30. package/dist/core-access.d.ts +0 -11
  31. package/dist/core-access.js +0 -34
  32. package/dist/core-blocks.d.ts +0 -24
  33. package/dist/core-blocks.js +0 -79
  34. package/dist/core-fields.d.ts +0 -73
  35. package/dist/core-fields.js +0 -167
  36. package/dist/core-utils.d.ts +0 -16
  37. package/dist/core-utils.js +0 -63
  38. package/dist/data-collections.d.ts +0 -229
  39. package/dist/data-collections.js +0 -676
  40. package/dist/data-seed.d.ts +0 -76
  41. package/dist/data-seed.js +0 -212
  42. package/dist/data-test.d.ts +0 -30
  43. package/dist/data-test.js +0 -1110
  44. package/dist/globals.d.ts +0 -69
  45. package/dist/globals.js +0 -251
  46. package/dist/hooks.d.ts +0 -108
  47. package/dist/hooks.js +0 -228
  48. package/dist/index.d.ts +0 -6
  49. package/dist/index.js +0 -39
  50. package/dist/render-components.d.ts +0 -42
  51. package/dist/render-components.js +0 -154
  52. package/dist/render-metadata.d.ts +0 -122
  53. package/dist/render-metadata.js +0 -390
  54. package/dist/render-utils.d.ts +0 -166
  55. package/dist/render-utils.js +0 -398
  56. package/dist/seed.d.ts +0 -76
  57. package/dist/seed.js +0 -212
  58. package/dist/server.d.ts +0 -980
  59. package/dist/server.js +0 -2231
  60. package/dist/test.d.ts +0 -30
  61. package/dist/test.js +0 -1110
  62. package/dist/with-www-config.d.ts +0 -108
  63. package/dist/with-www-config.js +0 -1006
@@ -1,587 +1,92 @@
1
+ import { ReactElement } from "react";
2
+ import { ImportMap as ImportMap2, SanitizedConfig } from "payload";
3
+ type RenderedWWWModule<Data = any> = {
4
+ config: SanitizedConfig;
5
+ importMap: ImportMap2;
6
+ data: Data;
7
+ } & Record<string, any>;
8
+ declare function FooterPage({ data }: RenderedWWWModule): ReactElement;
9
+ import { ReactElement as ReactElement2 } from "react";
10
+ declare function HeaderPage({ data }: RenderedWWWModule): ReactElement2;
11
+ import { ReactElement as ReactElement3 } from "react";
12
+ declare function PagesPage({ data, locale,...props }: RenderedWWWModule): Promise<ReactElement3>;
13
+ import { ReactElement as ReactElement4 } from "react";
14
+ declare function PostsPage({ doc, locale,...props }: RenderedWWWModule): Promise<ReactElement4>;
1
15
  import { Metadata, MetadataRoute } from "next";
2
- import { DataFromCollectionSlug, ImportMap, SanitizedConfig } from "payload";
3
- import { ReactElement, ReactNode } from "react";
4
- type BreadcrumbItem = {
5
- label: string;
6
- url: string;
7
- };
8
- type ArticleJsonLdEntry = {
9
- type: "article";
10
- id?: string;
11
- schemaType?: "BlogPosting" | "Article" | "NewsArticle" | "TechArticle";
12
- publisherName?: string;
13
- publisherLogo?: string | null;
14
- };
15
- type WebSiteJsonLdEntry = {
16
- type: "website";
17
- id?: string;
18
- name?: string;
19
- alternateName?: string;
20
- };
21
- type OrganizationJsonLdEntry = {
22
- type: "organization";
23
- id?: string;
24
- name?: string;
25
- logo?: string;
26
- sameAs?: string[];
27
- };
28
- type BreadcrumbsJsonLdEntry = {
29
- type: "breadcrumbs";
30
- id?: string;
31
- items?: BreadcrumbItem[];
32
- buildItems?: (doc: DataFromCollectionSlug<string>, url: string) => BreadcrumbItem[];
33
- };
34
- type CustomJsonLdEntry = {
35
- type: "custom";
36
- id?: string;
37
- build: (ctx: {
38
- doc: DataFromCollectionSlug<string>;
39
- url: string;
16
+ import { ImportMap as ImportMap3, SanitizedConfig as SanitizedConfig2 } from "payload";
17
+ import { ReactNode as ReactNode2 } from "react";
18
+ type SlugShape = "single" | "catch-all";
19
+ import { ReactNode } from "react";
20
+ type NextPageProps = {
21
+ params: Promise<{
40
22
  locale: string;
41
- siteUrl: string;
42
- }) => Record<string, unknown>;
43
- };
44
- type JsonLdEntry = ArticleJsonLdEntry | WebSiteJsonLdEntry | OrganizationJsonLdEntry | BreadcrumbsJsonLdEntry | CustomJsonLdEntry;
45
- type JsonLdOutput = {
46
- id: string;
47
- schema: Record<string, unknown>;
48
- };
49
- /**
50
- * Minimal next-intl routing contract the lib reads. Hosts pass
51
- * their `defineRouting({...})` result directly; the lib only needs
52
- * the shape below.
53
- *
54
- * `localePrefix` accepts either the simple string form
55
- * (`'always' | 'as-needed' | 'never'`) or next-intl's verbose
56
- * `LocalePrefixConfigVerbose` shape (`{ mode, prefixes? }`). The lib
57
- * normalizes both to a string `mode` internally.
58
- */
59
- type LocalePrefixValue = "always" | "as-needed" | "never" | {
60
- mode?: "always" | "as-needed" | "never";
61
- };
62
- type PageRouting = {
63
- locales: readonly string[];
64
- defaultLocale: string;
65
- localePrefix?: LocalePrefixValue;
66
- /** Optional human-readable labels per locale (used by the
67
- * `<LocaleSwitcher>`). Falls back to the locale code when missing.
68
- * Not part of next-intl's `defineRouting` shape — the host extends
69
- * its routing object to include it (e.g. via a type assertion). */
70
- labels?: Record<string, string>;
71
- };
72
- type MetadataOptions = {
73
- urlPrefix?: string;
74
- /** When true (default), the lib generates a `{type:'website'}` JSON-LD
75
- * entry per page. Pass an array to specify entries; pass `false` to
76
- * skip. */
77
- jsonLd?: boolean | JsonLdEntry[];
78
- changefreq?: MetadataRoute.Sitemap[number]["changeFrequency"];
79
- priority?: number;
80
- /**
81
- * Override the default `'website'` JSON-LD's `name` field. Only
82
- * relevant when `jsonLd !== false` and no `name` is set on the
83
- * auto-generated entry.
84
- */
85
- websiteName?: string;
23
+ slug?: string | string[];
24
+ }>;
86
25
  };
87
- type ShowcaseOptions = {
88
- /**
89
- * Wrap the rendered page in a two-column layout with a sidebar
90
- * that surfaces the page's metadata, JSON-LD, and a language
91
- * switcher. Hosts that want a clean render (no sidebar) leave
92
- * this `false` (the default). The demo's home page enables it
93
- * so visitors can see every artifact the lib generates in one
94
- * place.
95
- */
96
- enabled?: boolean;
97
- /** Heading shown above the metadata block. Default: `'Page metadata'`. */
98
- metadataHeading?: string;
99
- /** Heading shown above the JSON-LD block. Default: `'JSON-LD'`. */
100
- jsonLdHeading?: string;
26
+ type NextLayoutProps = {
27
+ params: Promise<{
28
+ locale: string;
29
+ }>;
30
+ children: ReactNode;
101
31
  };
32
+ import { RoutingConfig as GenericRoutingConfig } from "next-intl/routing";
33
+ type RoutingConfig = GenericRoutingConfig<string[], any, any, any>;
102
34
  type CreateCollectionPageExportsArgs<S extends string = "pages"> = {
103
- config: Promise<SanitizedConfig>;
104
- /**
105
- * Defaults to `'pages'`. The collection slug whose documents the
106
- * page route renders.
107
- */
108
35
  slug?: S;
109
- /**
110
- * The next-intl `defineRouting({...})` result from the host's
111
- * `i18n/routing.ts`. Drives locale validation, URL building,
112
- * hreflang alternates, and the language switcher.
113
- */
114
- routing: PageRouting;
115
- /**
116
- * The host's Payload importMap. The lib uses this to resolve
117
- * the collection's `custom.path` (the page renderer module) and
118
- * the live-preview listener. Pass `import { importMap } from
119
- * '@/app/(payload)/admin/importMap.js'` from the host's page
120
- * file. Default: `{}` — the page renders without a live-preview
121
- * listener and uses the lib's registered `custom.path` for the
122
- * collection renderer (which requires its key to be in the
123
- * supplied importMap).
124
- */
125
- importMap?: ImportMap;
126
- /**
127
- * Optional custom path pointing at the host's render module for
128
- * the collection. Overrides the lib's registered `custom.path`
129
- * (which defaults to `PAGES_RENDER_PATH`). Use this when you've
130
- * defined your own Server Component for the collection.
131
- */
132
- renderPath?: string;
133
- /**
134
- * Enable nested (hierarchical) slugs. When `true`, the catch-all
135
- * `[...slug]` segments are joined with the `_` divider to form the
136
- * stored slug (URL `/about/us` ⇄ stored `about_us`), URL paths and
137
- * hreflang alternates are expanded back to `/about/us`, and
138
- * `generateStaticParams` emits multi-segment params. When `false`
139
- * (the default) only the first URL segment is used — flat slugs.
140
- *
141
- * Pair with `createPagesCollection({ nested: true })` (or
142
- * `createWWWConfig({ nested: true })`) so the collection's slug
143
- * validation accepts the `_` divider.
144
- */
145
- nested?: boolean;
36
+ config: Promise<SanitizedConfig2>;
37
+ importMap: ImportMap3;
38
+ routing: RoutingConfig;
39
+ slugShape?: SlugShape;
146
40
  };
147
41
  type CreateCollectionPageExportsDeps<S extends string> = {
148
- /**
149
- * Host's `getServerSideURL()` (returns the absolute site URL).
150
- */
151
42
  getServerSideURL: () => string;
152
- /**
153
- * Host's `generateMeta({ doc, url, type, locale })` (returns Next.js
154
- * `Metadata`). The `doc` is the host's typed collection document
155
- * (e.g. `Post` for the posts collection, `Page` for pages) with
156
- * localized fields already resolved for the active locale. Read
157
- * `doc.title` directly as a string — no locale-lookup needed.
158
- */
159
- generateMeta: (args: {
160
- doc: DataFromCollectionSlug<S> | null;
161
- url: string;
162
- type: "website" | "article";
163
- locale: string;
164
- }) => Promise<Metadata>;
165
- /**
166
- * Override the metadata type passed to `generateMeta` and the
167
- * JSON-LD entry default. Defaults to `'article'` for the
168
- * `posts` collection, `'website'` everywhere else. Hosts that
169
- * want to opt out (e.g. treat a Post like a WebPage) pass
170
- * `'website'` explicitly here.
171
- */
172
- metadataType?: "website" | "article";
173
- /**
174
- * Optional showcase configuration. When `enabled: true`, the
175
- * default page renders inside a `<PageShowcase>` sidebar that
176
- * surfaces the page's metadata, JSON-LD, and a language
177
- * switcher — useful for demos and CMS previews. Default: off.
178
- */
179
- showcase?: ShowcaseOptions;
180
- /**
181
- * Optional content injected after the rendered doc body when the
182
- * page is the home route (slug = `''`). The lib calls the
183
- * function with the resolved locale and the current doc (or
184
- * `null` if no home doc exists). Hosts that want the home to
185
- * surface additional content — recent pages, recent posts,
186
- * navigation — pass a function here. The return value is
187
- * rendered as a sibling of the lib's doc body inside the page
188
- * (and inside the showcase's main column when showcase is on).
189
- */
190
- homeExtras?: (args: {
191
- locale: string;
192
- doc: DataFromCollectionSlug<S> | null;
193
- }) => ReactNode | Promise<ReactNode>;
194
- };
195
- /**
196
- * Build a Pages (or any collection) page route's exports:
197
- * `default` (the Page Server Component), `generateMetadata`,
198
- * `generateStaticParams`, and `generateSitemap`.
199
- *
200
- * Designed for a next-intl layout: the page lives at
201
- * `app/(frontend)/[locale]/[...slug]/page.tsx`. The catch-all slug
202
- * handles both the home route (slug=[]) and any other doc. The lib
203
- * reads `params.locale` and `params.slug` (string[]), validates
204
- * the locale against `routing.locales`, fetches the doc, generates
205
- * metadata + JSON-LD + hreflang alternates, and renders the
206
- * resolved output.
207
- *
208
- * The host's `next-intl/routing` config is the single source of
209
- * truth for the locale list and URL shape.
210
- *
211
- * // app/(frontend)/[locale]/[...slug]/page.tsx
212
- * import { routing } from '@/i18n/routing'
213
- * import { createCollectionPageExports } from '@justanarthur/payload-www/render-pages'
214
- *
215
- * const { default: Page, generateMetadata, generateStaticParams } =
216
- * createCollectionPageExports(
217
- * { config: configPromise, routing },
218
- * { getServerSideURL, generateMeta, showcase: { enabled: true } }
219
- * )
220
- *
221
- * { generateMetadata, generateStaticParams }
222
- * Page
223
- */
224
- declare function createCollectionPageExports<S extends string = "pages">({ slug, config: configPromise, routing, importMap: importMapArg, renderPath, nested }: CreateCollectionPageExportsArgs<S>, deps: CreateCollectionPageExportsDeps<S>, options?: MetadataOptions): {
225
- default: (props: {
226
- params: Promise<{
227
- locale?: string;
228
- slug?: string[];
229
- }>;
230
- searchParams?: Promise<Record<string, string | string[] | undefined>>;
231
- }) => Promise<ReactElement>;
232
- generateMetadata: (props: {
233
- params: Promise<{
234
- locale?: string;
235
- slug?: string[];
236
- }>;
237
- }) => Promise<Metadata>;
238
- generateStaticParams: () => Promise<Array<{
239
- slug?: string[];
240
- locale: string;
241
- }>>;
242
- generateSitemap: () => Promise<MetadataRoute.Sitemap>;
243
- generateJsonLd: (slugSegments: string[], doc: DataFromCollectionSlug<S>, locale: string) => Promise<JsonLdOutput[]>;
244
- };
245
- declare function addCollectionsToSitemap(exports: Array<{
246
- default: () => Promise<MetadataRoute.Sitemap>;
247
- generateSitemap: () => Promise<MetadataRoute.Sitemap>;
248
- }>): {
249
- default: () => Promise<MetadataRoute.Sitemap>;
250
- generateSitemap: () => Promise<MetadataRoute.Sitemap>;
251
- };
252
- import { ImportMap as ImportMap2, SanitizedConfig as SanitizedConfig2 } from "payload";
253
- import { HTMLAttributes, ReactElement as ReactElement2, ReactNode as ReactNode2 } from "react";
254
- type CreateRootLayoutProvidersArgs = {
255
- children: ReactNode2;
256
- locale: string;
257
- /** Messages for the active locale — hosts pass these into
258
- * `NextIntlClientProvider`. The lib fetches them once per request
259
- * and exposes them here so the host doesn't have to. */
260
- messages: Record<string, any>;
261
- /** Whether Next.js draft mode is currently active. Hosts typically
262
- * pass this to `<AdminBar preview={draftMode} />`. */
263
- draftMode: boolean;
264
- };
43
+ pagePathPrefix?: string;
44
+ };
45
+ declare function createCollectionPageExports<S extends string = "pages">({ slug: collectionSlug, config: configPromise, importMap, routing, slugShape }: CreateCollectionPageExportsArgs<S>, { getServerSideURL, pagePathPrefix }: CreateCollectionPageExportsDeps<S>): {
46
+ default: (props: NextPageProps) => Promise<ReactNode2>;
47
+ generateMetadata: (props: NextPageProps) => Promise<Metadata>;
48
+ generateStaticParams: (props: NextPageProps) => Promise<{
49
+ slug: string | string[];
50
+ }[]>;
51
+ generateSitemap: {
52
+ (): Promise<MetadataRoute.Sitemap>;
53
+ getServerSideURL: () => string;
54
+ pagePathPrefix: string | undefined;
55
+ };
56
+ };
57
+ import { ImportMap as ImportMap4, SanitizedConfig as SanitizedConfig3 } from "payload";
58
+ import { HTMLAttributes, ReactNode as ReactNode3 } from "react";
59
+ import { JSX as JSX_1kxb2 } from "react/jsx-runtime";
265
60
  type CreateRootLayoutExportsArgs = {
266
- /** Payload config promise — same shape `createCollectionPageExports` uses. */
267
- config: Promise<SanitizedConfig2>;
268
- /** next-intl routing config (locales + defaultLocale + localePrefix).
269
- * Same `PageRouting` shape the rest of the lib uses. */
270
- routing: PageRouting;
271
- /**
272
- * The host's Payload importMap. The lib uses this to resolve
273
- * header / footer globals' `custom.path` entries through
274
- * `renderGlobalModule`. Pass `import { importMap } from
275
- * '@/app/(payload)/admin/importMap.js'` (or equivalent path) from
276
- * the host's layout file. Default: `{}` — header/footer globals
277
- * with `custom.path` set won't render unless the matching entry
278
- * is in the supplied importMap.
279
- */
280
- importMap?: ImportMap2;
281
- /**
282
- * Single composition point for the entire provider tree —
283
- * AdminBar, NextIntlClientProvider, theme, analytics, etc.
284
- * Receives `draftMode` so the host can render `<AdminBar>` here
285
- * without re-reading from `next/headers` themselves.
286
- *
287
- * Default: identity (`({ children }) => children`) — wraps nothing.
288
- */
289
- providers?: (args: CreateRootLayoutProvidersArgs) => ReactNode2;
290
- /**
291
- * Optional content rendered inside `<head>`. Hosts drop favicons,
292
- * `<link rel>` tags, theme initialization, etc.
293
- *
294
- * Default: no extra head content (lib doesn't ship favicons —
295
- * that's host content).
296
- */
297
- head?: () => ReactNode2;
298
- /**
299
- * Optional `<html>` attribute overrides. The lib already applies
300
- * `lang={locale}` and `suppressHydrationWarning` — host additions
301
- * are merged on top.
302
- */
303
- htmlAttrs?: (locale: string) => HTMLAttributes<HTMLHtmlElement>;
304
- };
305
- type CreateRootLayoutExportsReturn = {
306
- /** Default for `app/(frontend)/[locale]/layout.tsx`. */
307
- default: (props: {
308
- children: ReactNode2;
309
- params: Promise<{
310
- locale: string;
311
- }>;
312
- }) => Promise<ReactElement2>;
313
- /** Pre-render every locale at build time. */
314
- generateStaticParams: () => Array<{
315
- locale: string;
316
- }>;
317
- };
318
- /**
319
- * Build the lib's root layout exports. Renders:
320
- *
321
- * <html {htmlAttrs}>
322
- * <head>
323
- * {head?.()}
324
- * </head>
325
- * <body>
326
- * {providers({ children: (
327
- * <Header data={...} locale={...} />
328
- * {children}
329
- * <Footer data={...} locale={...} />
330
- * ), locale, messages, draftMode })}
331
- * </body>
332
- * </html>
333
- *
334
- * Header and Footer are fetched per-locale via the lib's
335
- * `queryGlobal` and rendered through their globals' `custom.path`
336
- * — the same mechanism pages/posts use. Hosts override visuals by
337
- * setting a different `renderPath` on the global via
338
- * `createHeaderGlobal({ renderPath })` / `createFooterGlobal({ ... })`.
339
- *
340
- * Usage — minimal:
341
- *
342
- * // app/(frontend)/[locale]/layout.tsx
343
- * import { createRootLayoutExports } from '@justanarthur/payload-www/render-pages'
344
- * import { NextIntlClientProvider } from 'next-intl'
345
- * import { AdminBar } from '@justanarthur/payload-www/render-components'
346
- * import { routing } from '@/i18n/routing'
347
- * import configPromise from '@payload-config'
348
- *
349
- * const { default: RootLayout, generateStaticParams } = createRootLayoutExports({
350
- * config: configPromise,
351
- * routing,
352
- * providers: ({ children, locale, messages, draftMode }) => (
353
- * <>
354
- * <AdminBar preview={draftMode} />
355
- * <NextIntlClientProvider locale={locale} messages={messages}>
356
- * {children}
357
- * </NextIntlClientProvider>
358
- * </>
359
- * ),
360
- * head: () => <link href="/favicon.ico" rel="icon" sizes="32x32" />
361
- * })
362
- *
363
- * { generateStaticParams }
364
- * RootLayout
365
- */
366
- declare function createRootLayoutExports(args: CreateRootLayoutExportsArgs): CreateRootLayoutExportsReturn;
367
- import { ImportMap as ImportMap3, SanitizedConfig as SanitizedConfig3 } from "payload";
368
- import { ReactElement as ReactElement3 } from "react";
369
- type CreateStaticPageExportsArgs = {
370
- /**
371
- * The `kind` discriminator to fetch from the `staticPages`
372
- * collection. Default: `'not-found'`. The factory fetches the
373
- * row where `kind === {kind}` and renders its `blocks` via
374
- * `PagesPage` (the same component the catch-all dynamic route
375
- * uses).
376
- */
377
- kind?: string;
378
- /**
379
- * Payload config promise (same shape as `createCollectionPageExports`).
380
- */
381
61
  config: Promise<SanitizedConfig3>;
382
- /**
383
- * Host's Payload importMap. Same purpose as the Pages factory.
384
- * Default: `{}`.
385
- */
386
- importMap?: ImportMap3;
387
- };
388
- /**
389
- * Build a static page's default — designed for Next.js
390
- * `not-found.tsx` / `error.tsx` (and similar) route files. Static
391
- * pages are addressed by a `kind` discriminator, not a slug, so
392
- * they don't need metadata, sitemap, or static-params plumbing.
393
- *
394
- * Per Next.js docs, not-found/error components receive **no
395
- * props**. The active locale is read via `getLocale()` from
396
- * `next-intl/server`, which reads from the request config
397
- * populated by middleware from the `[locale]` URL segment (the
398
- * host's `i18n/request.ts` handles invalid-locale fallback
399
- * before this returns).
400
- *
401
- * // app/(frontend)/[locale]/not-found.tsx
402
- * import configPromise from '@payload-config'
403
- * import { createStaticPageExports } from '@justanarthur/payload-www/render-pages'
404
- * import { importMap } from '@/app/(payload)/admin/importMap.js'
405
- *
406
- * const { default: NotFound } = createStaticPageExports({
407
- * config: configPromise,
408
- * importMap,
409
- * })
410
- * NotFound
411
- *
412
- * // app/(frontend)/[locale]/server-error.tsx
413
- * const { default: ServerError } = createStaticPageExports({
414
- * kind: 'server-error',
415
- * config: configPromise,
416
- * importMap,
417
- * })
418
- * ServerError
419
- */
420
- declare function createStaticPageExports({ kind, config: configPromise, importMap: importMapArg }: CreateStaticPageExportsArgs): {
421
- default: () => Promise<ReactElement3>;
62
+ importMap: ImportMap4;
63
+ routing: RoutingConfig;
422
64
  };
423
- import { Metadata as Metadata2 } from "next";
424
- import { ReactElement as ReactElement4, ReactNode as ReactNode3 } from "react";
425
- type PageShowcaseProps = {
426
- /** The lib-rendered page body (RenderBlocks output + JSON-LD scripts). */
65
+ type CreateRootLayoutProvidersArgs = {
427
66
  children: ReactNode3;
428
- /**
429
- * The Next.js `Metadata` object resolved by `createCollectionPageExports`'s
430
- * `generateMetadata`. The showcase renders the title, description,
431
- * Open Graph, and Twitter Card entries as a labeled list.
432
- */
433
- metadata: Metadata2;
434
- /**
435
- * The JSON-LD entries resolved by the lib. Rendered as `<pre>`
436
- * blocks inside a `<details>` element so visitors can see the
437
- * schema.org payload without it being a wall of JSON.
438
- */
439
- jsonLd: Array<{
440
- id: string;
441
- schema: Record<string, unknown>;
442
- }>;
443
- /**
444
- * The `<LocaleSwitcher>` element the lib built from the page's
445
- * hreflang alternates. Mounted at the top of the sidebar.
446
- */
447
- localeSwitcher: ReactNode3;
448
- /** Heading above the metadata block. Default: `'Page metadata'`. */
449
- metadataHeading?: string;
450
- /** Heading above the JSON-LD block. Default: `'JSON-LD'`. */
451
- jsonLdHeading?: string;
452
- };
453
- /**
454
- * Two-column showcase layout that surfaces the page's metadata,
455
- * JSON-LD, and language switcher alongside the rendered body. Used
456
- * by the lib's `createCollectionPageExports` when the host passes
457
- * `showcase: { enabled: true }`. The default render is the bare
458
- * doc body + JSON-LD scripts (no sidebar).
459
- *
460
- * The layout is intentionally minimal — a `<div class="page-showcase">`
461
- * with `main` + `aside` columns, no styles. Hosts that want a fancier
462
- * layout override via their own CSS.
463
- */
464
- declare function PageShowcase({ children, metadata, jsonLd, localeSwitcher, metadataHeading, jsonLdHeading }: PageShowcaseProps): ReactElement4;
465
- import { ReactElement as ReactElement5 } from "react";
466
- import { SanitizedConfig as SanitizedConfig4 } from "payload";
467
- type PagesPageProps = {
468
- /**
469
- * The resolved page document. The host's `[slug]/page.tsx` route
470
- * handler is responsible for fetching the doc (via Payload's
471
- * `getPayload` or via the lib's `createCollectionPageExports`'s
472
- * `generateMetadata` helper). This component just renders the
473
- * visual body.
474
- */
475
- doc: Record<string, any> | null;
476
- /**
477
- * Resolved locale string (already validated upstream by the host's
478
- * `[locale]` route segment).
479
- */
480
- locale: string;
481
- /**
482
- * Block components keyed by `blockType`. The host passes the same
483
- * `importMap` it uses everywhere else; the lib's `RenderBlocks`
484
- * resolves each block against the map.
485
- */
486
- importMap: Record<string, unknown>;
487
- config: SanitizedConfig4;
488
- };
489
- /**
490
- * Default visual body for the Pages collection. Renders the doc's
491
- * `blocks` field via the lib's `RenderBlocks`. Hosts can replace
492
- * this by setting a different `custom.path` on their own Pages
493
- * collection (via the lib's `createPagesCollection` factory) and
494
- * pointing it at their own Server Component.
495
- */
496
- declare function PagesPage({ doc,...props }: PagesPageProps): Promise<ReactElement5>;
497
- import { ReactElement as ReactElement6 } from "react";
498
- type PostsPageProps = {
499
- /**
500
- * The resolved post document. The host's `/blog/[...slug]/page.tsx`
501
- * route handler is responsible for fetching the doc (via Payload's
502
- * `getPayload` or via the lib's `createCollectionPageExports`'s
503
- * `generateMetadata` helper). This component just renders the
504
- * visual body.
505
- */
506
- doc: Record<string, any> | null;
507
- /**
508
- * Resolved locale string (already validated upstream by the host's
509
- * `[locale]` route segment). Unused by this default render — kept
510
- * on the signature so hosts can swap in their own component
511
- * without changing the importMap entry.
512
- */
513
67
  locale: string;
514
- /**
515
- * Payload's generated importMap. Reserved for hosts that want to
516
- * extend this component with custom Lexical converters via the
517
- * `RichText` `converters` prop. Not consumed by the default render.
518
- */
519
- importMap: Record<string, unknown>;
520
68
  };
521
- /**
522
- * Default visual body for the Posts collection. Renders the doc's
523
- * `title`, optional `excerpt`, and `content` (Lexical richText)
524
- * via Payload's official `<RichText>` component.
525
- *
526
- * Hosts can replace this by setting a different `custom.path` on
527
- * their own Posts collection (via the lib's `createPostsCollection`
528
- * factory) and pointing it at their own Server Component.
529
- *
530
- * The lib's `<RichText>` import is the client-safe React renderer
531
- * from `@payloadcms/richtext-lexical/react` — no client component
532
- * here. The component serializes on the server.
533
- */
534
- declare function PostsPage({ doc, locale, importMap: _importMap }: PostsPageProps): Promise<ReactElement6>;
535
- import { ReactElement as ReactElement7 } from "react";
536
- type HeaderPageProps = {
537
- /** The resolved Header global document. `null` if the host hasn't
538
- * created a Header yet. */
539
- data: Record<string, any> | null;
540
- /**
541
- * Resolved locale string. The default header visual uses this for
542
- * per-locale labels via next-intl (if the host has it wired). The
543
- * default ships without a label dictionary — the host can override
544
- * by setting a different `custom.path` on the header global.
545
- */
546
- locale: string;
69
+ type CreateRootLayoutExportsDeps = {
70
+ providers?: (args: CreateRootLayoutProvidersArgs) => ReactNode3;
71
+ htmlAttrs?: (locale: string) => HTMLAttributes<HTMLHtmlElement>;
72
+ getServerSideURL?: () => string;
547
73
  };
548
- /**
549
- * Default visual for the `header` global. Renders the header's
550
- * `nav` blocks (a flat list of `navItem` and `navColumn` blocks) as
551
- * a simple `<nav>` element.
552
- *
553
- * Hosts can replace this visual by setting a different `custom.path`
554
- * on their own header global (via the lib's `createHeaderGlobal`
555
- * factory).
556
- */
557
- declare function HeaderPage({ data, locale: _locale }: HeaderPageProps): ReactElement7;
558
- import { ReactElement as ReactElement8 } from "react";
559
- type FooterPageProps = {
560
- /** The resolved Footer global document. `null` if the host hasn't
561
- * created a Footer yet. */
562
- data: Record<string, any> | null;
563
- locale: string;
74
+ type Element_12xgc2 = JSX_1kxb2["Element"];
75
+ declare function createRootLayoutExports({ config: configPromise, importMap, routing }: CreateRootLayoutExportsArgs, { providers, htmlAttrs, getServerSideURL }?: CreateRootLayoutExportsDeps): {
76
+ default: (props: NextLayoutProps) => Promise<Element_12xgc2>;
77
+ generateStaticParams: () => {
78
+ locale: string;
79
+ }[];
564
80
  };
565
- /**
566
- * Default visual for the `footer` global. Renders the footer's
567
- * `nav` blocks (a flat list of `navItem` and `navColumn` blocks)
568
- * as a simple `<footer>` element.
569
- *
570
- * Hosts can replace this visual by setting a different `custom.path`
571
- * on their own footer global (via the lib's `createFooterGlobal`
572
- * factory).
573
- */
574
- declare function FooterPage({ data, locale: _locale }: FooterPageProps): ReactElement8;
575
- declare const PageShowcase2: typeof PageShowcase;
576
- declare const _default: {
577
- addCollectionsToSitemap: typeof addCollectionsToSitemap;
81
+ import { RootJsonLd } from "@justanarthur/payload-plugin-seo/root-jsonld";
82
+ import { RootJsonLdProps } from "@justanarthur/payload-plugin-seo/root-jsonld";
83
+ declare const renderPages: {
578
84
  createCollectionPageExports: typeof createCollectionPageExports;
579
85
  createRootLayoutExports: typeof createRootLayoutExports;
580
- createStaticPageExports: typeof createStaticPageExports;
581
- HeaderPage: typeof HeaderPage;
582
- FooterPage: typeof FooterPage;
583
86
  PagesPage: typeof PagesPage;
584
87
  PostsPage: typeof PostsPage;
585
- PageShowcase2: typeof PageShowcase;
88
+ HeaderPage: typeof HeaderPage;
89
+ FooterPage: typeof FooterPage;
90
+ RootJsonLd: any;
586
91
  };
587
- export { _default as default, createStaticPageExports, createRootLayoutExports, createCollectionPageExports, addCollectionsToSitemap, ShowcaseOptions, PostsPage, PagesPage, PageShowcaseProps, PageShowcase2 as PageShowcase, PageRouting, MetadataOptions, JsonLdOutput, JsonLdEntry, HeaderPage, FooterPage, CreateStaticPageExportsArgs, CreateRootLayoutProvidersArgs, CreateRootLayoutExportsReturn, CreateRootLayoutExportsArgs, CreateCollectionPageExportsDeps, CreateCollectionPageExportsArgs };
92
+ export { renderPages as default, createRootLayoutExports, createCollectionPageExports, RootJsonLdProps, RootJsonLd, PostsPage, PagesPage, HeaderPage, FooterPage, CreateRootLayoutProvidersArgs, CreateRootLayoutExportsDeps, CreateRootLayoutExportsArgs, CreateCollectionPageExportsDeps, CreateCollectionPageExportsArgs };