@justanarthur/payload-www 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 (62) hide show
  1. package/README.md +381 -0
  2. package/dist/access.d.ts +11 -0
  3. package/dist/access.js +34 -0
  4. package/dist/blocks.d.ts +24 -0
  5. package/dist/blocks.js +75 -0
  6. package/dist/collections.d.ts +200 -0
  7. package/dist/collections.js +625 -0
  8. package/dist/components.d.ts +6 -0
  9. package/dist/components.js +38 -0
  10. package/dist/config.d.ts +100 -0
  11. package/dist/config.js +914 -0
  12. package/dist/core-access.d.ts +11 -0
  13. package/dist/core-access.js +34 -0
  14. package/dist/core-blocks.d.ts +24 -0
  15. package/dist/core-blocks.js +75 -0
  16. package/dist/core-fields.d.ts +36 -0
  17. package/dist/core-fields.js +134 -0
  18. package/dist/core-utils.d.ts +16 -0
  19. package/dist/core-utils.js +59 -0
  20. package/dist/data-collections.d.ts +200 -0
  21. package/dist/data-collections.js +625 -0
  22. package/dist/data-seed.d.ts +76 -0
  23. package/dist/data-seed.js +212 -0
  24. package/dist/data-test.d.ts +30 -0
  25. package/dist/data-test.js +1018 -0
  26. package/dist/fields.d.ts +36 -0
  27. package/dist/fields.js +134 -0
  28. package/dist/globals.d.ts +48 -0
  29. package/dist/globals.js +228 -0
  30. package/dist/hooks.d.ts +108 -0
  31. package/dist/hooks.js +196 -0
  32. package/dist/imagehash.d.ts +3 -0
  33. package/dist/imagehash.js +24 -0
  34. package/dist/import-map-provider.d.ts +20 -0
  35. package/dist/import-map-provider.js +26 -0
  36. package/dist/index.d.ts +6 -0
  37. package/dist/index.js +38 -0
  38. package/dist/metadata.d.ts +122 -0
  39. package/dist/metadata.js +335 -0
  40. package/dist/pages.d.ts +323 -0
  41. package/dist/pages.js +1016 -0
  42. package/dist/render-components.d.ts +42 -0
  43. package/dist/render-components.js +144 -0
  44. package/dist/render-metadata.d.ts +122 -0
  45. package/dist/render-metadata.js +335 -0
  46. package/dist/render-pages.d.ts +574 -0
  47. package/dist/render-pages.js +1450 -0
  48. package/dist/render-utils.d.ts +158 -0
  49. package/dist/render-utils.js +341 -0
  50. package/dist/seed.d.ts +76 -0
  51. package/dist/seed.js +212 -0
  52. package/dist/server.d.ts +922 -0
  53. package/dist/server.js +2055 -0
  54. package/dist/test.d.ts +30 -0
  55. package/dist/test.js +1018 -0
  56. package/dist/translator.d.ts +2 -0
  57. package/dist/translator.js +24 -0
  58. package/dist/utils.d.ts +16 -0
  59. package/dist/utils.js +59 -0
  60. package/dist/with-www-config.d.ts +100 -0
  61. package/dist/with-www-config.js +914 -0
  62. package/package.json +246 -0
@@ -0,0 +1,200 @@
1
+ import { Block, CollectionConfig } from "payload";
2
+ type LocalePrefixMode = "always" | "as-needed" | "never";
3
+ type CreateRevalidateCollectionHookOptions = {
4
+ /**
5
+ * The collection's slug. Used in the per-collection tag fired
6
+ * alongside path invalidation: `collection_<slug>_<id>`.
7
+ */
8
+ collectionSlug: string;
9
+ /**
10
+ * URL path prefix for this collection's rendered URLs. Pages use
11
+ * `''` (mounted at root); Posts use `'/posts'`. Leading slash,
12
+ * no trailing slash — same convention as
13
+ * `createSitemapFile.urlPrefixes`.
14
+ */
15
+ urlPathPrefix?: string;
16
+ /**
17
+ * Sitemap tag the collection's revalidation hook invalidates on
18
+ * every save. Defaults to `${collectionSlug}-sitemap`. Pass
19
+ * `false` to opt out (collections without a sitemap handler).
20
+ */
21
+ sitemapTag?: string | false;
22
+ /**
23
+ * Locale prefix mode — mirrors next-intl's `localePrefix`.
24
+ * Defaults to `'always'` (preserves legacy behavior).
25
+ */
26
+ localePrefix?: LocalePrefixMode;
27
+ /**
28
+ * Default locale for `localePrefix: 'as-needed'`. Falls back to
29
+ * `req.payload.config.localization.defaultLocale` at request time
30
+ * when omitted.
31
+ */
32
+ defaultLocale?: string;
33
+ /**
34
+ * Path invalidation strategy. Default: `'url'` — fans out
35
+ * `revalidatePath` for every locale × every slug. Set to
36
+ * `'tag-only'` for collections without a URL (e.g. `staticPages`
37
+ * — addressed by a `kind` discriminator, not a slug). Tag-only
38
+ * mode still fires the per-collection tag (via `sitemapTag`) and
39
+ * the per-id tag (`collection_<slug>_<id>`).
40
+ */
41
+ pathMode?: "url" | "tag-only";
42
+ };
43
+ declare const HOME_PAGE_SLUG = "";
44
+ declare const PAGES_SLUG = "pages";
45
+ type CreatePagesCollectionOptions = {
46
+ /**
47
+ * Blocks the Pages collection accepts.
48
+ */
49
+ blocks: Block[];
50
+ /**
51
+ * Optional override for the collection slug. Default: `'pages'`.
52
+ * Hosts that want a different slug (e.g. `'site_pages'`) pass
53
+ * it here. The lib's Header / Footer `linkRelationTo` default
54
+ * uses `'pages'` — combine this with a matching
55
+ * `linkRelationTo` to keep nav links targeting the right
56
+ * collection.
57
+ */
58
+ slug?: string;
59
+ /**
60
+ * Optional override for the `custom.path` Payload uses to resolve
61
+ * the page's render module. Default: the lib's `PAGES_RENDER_PATH`
62
+ * (a Server Component that calls `RenderBlocks`). Use this when
63
+ * you've defined your own Server Component for the collection.
64
+ */
65
+ renderPath?: string;
66
+ /**
67
+ * Locale prefix mode for path invalidation. Defaults to `'always'`
68
+ * (preserves current behavior). Set to `'as-needed'` when the host
69
+ * uses next-intl `localePrefix: 'as-needed'` — otherwise the hook
70
+ * invalidates paths the public routes don't use.
71
+ */
72
+ localePrefix?: CreateRevalidateCollectionHookOptions["localePrefix"];
73
+ /**
74
+ * Default locale for prefix skipping. Falls back to
75
+ * `req.payload.config.localization.defaultLocale` at request time
76
+ * when omitted.
77
+ */
78
+ defaultLocale?: CreateRevalidateCollectionHookOptions["defaultLocale"];
79
+ };
80
+ declare const createPagesCollection: (blocks: Block[], options?: Omit<CreatePagesCollectionOptions, "blocks">) => CollectionConfig;
81
+ import { CollectionConfig as CollectionConfig2 } from "payload";
82
+ declare const POSTS_SLUG = "posts";
83
+ type CreatePostsCollectionOptions = {
84
+ /**
85
+ * Optional override for the collection slug. Default: `'posts'`.
86
+ * Hosts that want a different slug (e.g. `'articles'` or `'blog'`)
87
+ * pass it here. Combine with the page route's URL convention and
88
+ * the lib's translator plugin's `collections` list.
89
+ */
90
+ slug?: string;
91
+ /**
92
+ * Override the `custom.path` Payload uses to resolve the post's
93
+ * render module. Defaults to the lib's `POSTS_RENDER_PATH`
94
+ * (the lib's `<PostsPage>` Server Component, which renders
95
+ * `title` + `excerpt` + Lexical `content`). Hosts that want a
96
+ * custom render pass their own Server Component's import path
97
+ * here (e.g. `'@/blog/Post#default'`).
98
+ */
99
+ renderPath?: string;
100
+ /**
101
+ * Locale prefix mode for path invalidation. Defaults to `'always'`.
102
+ * Set to `'as-needed'` when the host uses next-intl
103
+ * `localePrefix: 'as-needed'` — otherwise the hook invalidates
104
+ * paths the public routes don't use.
105
+ */
106
+ localePrefix?: "always" | "as-needed" | "never";
107
+ /**
108
+ * Default locale for prefix skipping. Falls back to
109
+ * `req.payload.config.localization.defaultLocale` at request time
110
+ * when omitted.
111
+ */
112
+ defaultLocale?: string;
113
+ };
114
+ /**
115
+ * Build the Posts collection. Posts have a simpler shape than
116
+ * Pages: `title` + `excerpt` (both localized) + a Lexical `content`
117
+ * rich text field. Hosts that want blocks can either swap the
118
+ * `content` field for a `blocks` field via the returned config, or
119
+ * define a custom Post shape entirely.
120
+ *
121
+ * The Posts collection exists primarily so the lib's translator
122
+ * plugin has a second localized collection to translate.
123
+ */
124
+ declare const createPostsCollection: (options?: CreatePostsCollectionOptions) => CollectionConfig2;
125
+ import { Block as Block2, CollectionConfig as CollectionConfig3 } from "payload";
126
+ declare const STATIC_PAGES_SLUG = "staticPages";
127
+ type CreateStaticPagesCollectionOptions = {
128
+ /**
129
+ * Blocks the StaticPages collection accepts. Hosts pass the same
130
+ * `blocks` they use for `createPagesCollection` (or a smaller
131
+ * subset — e.g. just `pageHeroBlock` + `ctaBlock` + `featureGridBlock`).
132
+ * The lib does not curate a separate block set for system pages.
133
+ */
134
+ blocks: Block2[];
135
+ };
136
+ declare const createStaticPagesCollection: (blocks: Block2[]) => CollectionConfig3;
137
+ import { GlobalConfig } from "payload";
138
+ type CreateHeaderGlobalOptions = {
139
+ /**
140
+ * Optional override for the `custom.path` Payload uses to resolve
141
+ * the header's render module. Default: the lib's `HEADER_RENDER_PATH`.
142
+ */
143
+ renderPath?: string;
144
+ /**
145
+ * Collection slugs the nav's link fields can reference. Required
146
+ * by Payload 3.85 — empty `relationTo` arrays are rejected.
147
+ * Defaults to `['pages']` (the lib's Pages collection). Pass a
148
+ * different list when your host has additional linkable collections.
149
+ */
150
+ linkRelationTo?: string[];
151
+ };
152
+ /**
153
+ * Build the Header global. The lib's default shape: a `nav` blocks
154
+ * field with two block types — `navColumn` (a titled group of links)
155
+ * and `navItem` (a single link).
156
+ */
157
+ declare const createHeaderGlobal: (options?: CreateHeaderGlobalOptions) => GlobalConfig;
158
+ import { GlobalConfig as GlobalConfig2 } from "payload";
159
+ type CreateFooterGlobalOptions = {
160
+ /**
161
+ * Optional override for the `custom.path` Payload uses to resolve
162
+ * the footer's render module. Default: the lib's `FOOTER_RENDER_PATH`.
163
+ */
164
+ renderPath?: string;
165
+ /**
166
+ * Collection slugs the nav's link fields can reference. Required
167
+ * by Payload 3.85 — empty `relationTo` arrays are rejected.
168
+ * Defaults to `['pages']` (the lib's Pages collection). Pass a
169
+ * different list when your host has additional linkable collections.
170
+ */
171
+ linkRelationTo?: string[];
172
+ };
173
+ /**
174
+ * Build the Footer global. The lib's default shape mirrors the
175
+ * Header: a `nav` blocks field with `navColumn` (a titled group of
176
+ * links) and `navItem` (a single link) blocks.
177
+ */
178
+ declare const createFooterGlobal: (options?: CreateFooterGlobalOptions) => GlobalConfig2;
179
+ import { CollectionSlug, PayloadRequest } from "payload";
180
+ declare function generatePreviewPath({ collection, slug }: {
181
+ collection: CollectionSlug;
182
+ slug: string | null | undefined;
183
+ req?: PayloadRequest;
184
+ }): string | null;
185
+ import { Block as Block_129qi5 } from "payload";
186
+ import { CollectionConfig as CollectionConfig_j7kwbk } from "payload";
187
+ import { GlobalConfig as GlobalConfig_fuin17 } from "payload";
188
+ declare const _default: {
189
+ createPagesCollection: (blocks: Block_129qi5[], options?: Omit<CreatePagesCollectionOptions, "blocks">) => CollectionConfig_j7kwbk;
190
+ createPostsCollection: (options?: CreatePostsCollectionOptions) => CollectionConfig_j7kwbk;
191
+ createStaticPagesCollection: (blocks: Block_129qi5[]) => CollectionConfig_j7kwbk;
192
+ createHeaderGlobal: (options?: CreateHeaderGlobalOptions) => GlobalConfig_fuin17;
193
+ createFooterGlobal: (options?: CreateFooterGlobalOptions) => GlobalConfig_fuin17;
194
+ generatePreviewPath: typeof generatePreviewPath;
195
+ HOME_PAGE_SLUG: string;
196
+ PAGES_SLUG: string;
197
+ POSTS_SLUG: string;
198
+ STATIC_PAGES_SLUG: string;
199
+ };
200
+ export { generatePreviewPath, _default as default, createStaticPagesCollection, createPostsCollection, createPagesCollection, createHeaderGlobal, createFooterGlobal, STATIC_PAGES_SLUG, POSTS_SLUG, PAGES_SLUG, HOME_PAGE_SLUG, CreateStaticPagesCollectionOptions, CreatePostsCollectionOptions, CreatePagesCollectionOptions, CreateHeaderGlobalOptions, CreateFooterGlobalOptions };