@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.
- package/README.md +381 -0
- package/dist/access.d.ts +11 -0
- package/dist/access.js +34 -0
- package/dist/blocks.d.ts +24 -0
- package/dist/blocks.js +75 -0
- package/dist/collections.d.ts +200 -0
- package/dist/collections.js +625 -0
- package/dist/components.d.ts +6 -0
- package/dist/components.js +38 -0
- package/dist/config.d.ts +100 -0
- package/dist/config.js +914 -0
- package/dist/core-access.d.ts +11 -0
- package/dist/core-access.js +34 -0
- package/dist/core-blocks.d.ts +24 -0
- package/dist/core-blocks.js +75 -0
- package/dist/core-fields.d.ts +36 -0
- package/dist/core-fields.js +134 -0
- package/dist/core-utils.d.ts +16 -0
- package/dist/core-utils.js +59 -0
- package/dist/data-collections.d.ts +200 -0
- package/dist/data-collections.js +625 -0
- package/dist/data-seed.d.ts +76 -0
- package/dist/data-seed.js +212 -0
- package/dist/data-test.d.ts +30 -0
- package/dist/data-test.js +1018 -0
- package/dist/fields.d.ts +36 -0
- package/dist/fields.js +134 -0
- package/dist/globals.d.ts +48 -0
- package/dist/globals.js +228 -0
- package/dist/hooks.d.ts +108 -0
- package/dist/hooks.js +196 -0
- package/dist/imagehash.d.ts +3 -0
- package/dist/imagehash.js +24 -0
- package/dist/import-map-provider.d.ts +20 -0
- package/dist/import-map-provider.js +26 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +38 -0
- package/dist/metadata.d.ts +122 -0
- package/dist/metadata.js +335 -0
- package/dist/pages.d.ts +323 -0
- package/dist/pages.js +1016 -0
- package/dist/render-components.d.ts +42 -0
- package/dist/render-components.js +144 -0
- package/dist/render-metadata.d.ts +122 -0
- package/dist/render-metadata.js +335 -0
- package/dist/render-pages.d.ts +574 -0
- package/dist/render-pages.js +1450 -0
- package/dist/render-utils.d.ts +158 -0
- package/dist/render-utils.js +341 -0
- package/dist/seed.d.ts +76 -0
- package/dist/seed.js +212 -0
- package/dist/server.d.ts +922 -0
- package/dist/server.js +2055 -0
- package/dist/test.d.ts +30 -0
- package/dist/test.js +1018 -0
- package/dist/translator.d.ts +2 -0
- package/dist/translator.js +24 -0
- package/dist/utils.d.ts +16 -0
- package/dist/utils.js +59 -0
- package/dist/with-www-config.d.ts +100 -0
- package/dist/with-www-config.js +914 -0
- package/package.json +246 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Access } from "payload";
|
|
2
|
+
declare const anyone: Access;
|
|
3
|
+
declare const authenticated: Access;
|
|
4
|
+
declare const authenticatedOrPublished: Access;
|
|
5
|
+
import { Access as Access_wc6ft0 } from "payload";
|
|
6
|
+
declare const _default: {
|
|
7
|
+
anyone: Access_wc6ft0;
|
|
8
|
+
authenticated: Access_wc6ft0;
|
|
9
|
+
authenticatedOrPublished: Access_wc6ft0;
|
|
10
|
+
};
|
|
11
|
+
export { _default as default, authenticatedOrPublished, authenticated, anyone };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
|
|
18
|
+
// src/core/access/index.ts
|
|
19
|
+
var anyone = () => true;
|
|
20
|
+
var authenticated = ({ req: { user } }) => Boolean(user);
|
|
21
|
+
var authenticatedOrPublished = ({ req: { user } }) => {
|
|
22
|
+
if (user)
|
|
23
|
+
return true;
|
|
24
|
+
return { _status: { equals: "published" } };
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// src/exports/core-access.ts
|
|
28
|
+
var core_access_default = { anyone, authenticated, authenticatedOrPublished };
|
|
29
|
+
export {
|
|
30
|
+
core_access_default as default,
|
|
31
|
+
authenticatedOrPublished,
|
|
32
|
+
authenticated,
|
|
33
|
+
anyone
|
|
34
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ImportMap, SanitizedConfig } from "payload";
|
|
3
|
+
type RenderBlocksProps = {
|
|
4
|
+
blocks: Array<{
|
|
5
|
+
blockType: string;
|
|
6
|
+
} & Record<string, unknown>>;
|
|
7
|
+
blockProps?: Record<string, unknown>;
|
|
8
|
+
importMap: ImportMap;
|
|
9
|
+
config: SanitizedConfig;
|
|
10
|
+
locale: string;
|
|
11
|
+
searchParams?: Record<string, string | string[] | undefined>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Render a page's `blocks` array to React. Each block's render module
|
|
15
|
+
* is resolved via Payload's generated importMap. The host registers
|
|
16
|
+
* each block in the importMap with a key like `BlockCta#default` (use
|
|
17
|
+
* `generateImportName('block', 'cta')` to build the key).
|
|
18
|
+
*
|
|
19
|
+
* Falls back gracefully: if a block's importMap path is missing or
|
|
20
|
+
* the component is not registered, the block is skipped and a
|
|
21
|
+
* `console.warn` is logged (in dev).
|
|
22
|
+
*/
|
|
23
|
+
declare const RenderBlocks: FC<RenderBlocksProps>;
|
|
24
|
+
export { RenderBlocks as default, RenderBlocksProps, RenderBlocks };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
|
|
18
|
+
// src/core/utils/getFromImportMap.ts
|
|
19
|
+
function getFromImportMap(key, importMap) {
|
|
20
|
+
return importMap[key.includes("#") ? key : key + "#default"];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/core/utils/generateImportName.ts
|
|
24
|
+
function generateImportName(type, slug) {
|
|
25
|
+
switch (type) {
|
|
26
|
+
case "block":
|
|
27
|
+
return `Block${slug.replace(/(^\w|-\w)/g, (m) => m.replace("-", "").toUpperCase())}#default`;
|
|
28
|
+
case "page":
|
|
29
|
+
return `Page${slug.replace(/(^\w|-\w)/g, (m) => m.replace("-", "").toUpperCase())}#default`;
|
|
30
|
+
default:
|
|
31
|
+
throw new Error(`Unknown type: ${type}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/render/blocks/renderBlocks.tsx
|
|
36
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
37
|
+
var RenderBlocks = ({
|
|
38
|
+
blocks,
|
|
39
|
+
blockProps,
|
|
40
|
+
config,
|
|
41
|
+
importMap,
|
|
42
|
+
locale,
|
|
43
|
+
searchParams
|
|
44
|
+
}) => {
|
|
45
|
+
if (!blocks || !Array.isArray(blocks) || blocks.length === 0)
|
|
46
|
+
return null;
|
|
47
|
+
const rendered = [];
|
|
48
|
+
for (let i = 0;i < blocks.length; i++) {
|
|
49
|
+
const block = blocks[i];
|
|
50
|
+
const { blockType } = block;
|
|
51
|
+
const importMapPath = config.admin?.dependencies?.[blockType]?.path ?? generateImportName("block", blockType);
|
|
52
|
+
const Block = getFromImportMap(importMapPath, importMap);
|
|
53
|
+
if (!Block) {
|
|
54
|
+
console.warn(`No block found for type: ${blockType}, config.admin?.dependencies?.[blockType]: ${config.admin?.dependencies?.[blockType]}`);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
rendered.push(/* @__PURE__ */ jsx(Block, {
|
|
58
|
+
index: i,
|
|
59
|
+
...blockProps,
|
|
60
|
+
...block,
|
|
61
|
+
locale,
|
|
62
|
+
searchParams
|
|
63
|
+
}, i));
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
66
|
+
children: rendered
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/exports/core-blocks.ts
|
|
71
|
+
var core_blocks_default = RenderBlocks;
|
|
72
|
+
export {
|
|
73
|
+
core_blocks_default as default,
|
|
74
|
+
RenderBlocks
|
|
75
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Field, GroupField } from "payload";
|
|
2
|
+
type LinkAppearances = "default" | "outline";
|
|
3
|
+
declare const appearanceOptions: Record<LinkAppearances, {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}>;
|
|
7
|
+
type LinkOptions = {
|
|
8
|
+
appearances?: LinkAppearances[] | false;
|
|
9
|
+
disableLabel?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Collection slugs the link can reference. Payload 3.85 rejects
|
|
12
|
+
* empty arrays, so the lib defaults to `['pages']` (its own Pages
|
|
13
|
+
* collection). Hosts that reference different collections pass
|
|
14
|
+
* their own list.
|
|
15
|
+
*/
|
|
16
|
+
relationTo?: string[];
|
|
17
|
+
/** Mark the text fields as `localized: true`. */
|
|
18
|
+
localized?: boolean;
|
|
19
|
+
/** Deep-merge into the resulting group. */
|
|
20
|
+
overrides?: Partial<GroupField>;
|
|
21
|
+
/** Legacy alias for the host's custom field overrides. */
|
|
22
|
+
linkOverrides?: Partial<GroupField>;
|
|
23
|
+
};
|
|
24
|
+
declare const link: (options?: LinkOptions) => Field;
|
|
25
|
+
import { Field as Field2 } from "payload";
|
|
26
|
+
declare const linkGroup: (options?: LinkOptions) => Field2;
|
|
27
|
+
import { Field as Field_14espm } from "payload";
|
|
28
|
+
declare const _default: {
|
|
29
|
+
link: (options?: LinkOptions) => Field_14espm;
|
|
30
|
+
linkGroup: (options?: LinkOptions) => Field_14espm;
|
|
31
|
+
appearanceOptions: Record<LinkAppearances, {
|
|
32
|
+
label: string;
|
|
33
|
+
value: string;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
export { linkGroup, link, _default as default, appearanceOptions, LinkOptions, LinkAppearances };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
|
|
18
|
+
// src/config/constants.ts
|
|
19
|
+
var PAGES_RENDER_PATH = "@justanarthur/payload-www/render-pages#PagesPage";
|
|
20
|
+
var POSTS_RENDER_PATH = "@justanarthur/payload-www/render-pages#PostsPage";
|
|
21
|
+
var HEADER_RENDER_PATH = "@justanarthur/payload-www/render-pages#HeaderPage";
|
|
22
|
+
var FOOTER_RENDER_PATH = "@justanarthur/payload-www/render-pages#FooterPage";
|
|
23
|
+
var LIVE_PREVIEW_LISTENER_PATH = "@justanarthur/payload-www/render-components#LivePreviewListener";
|
|
24
|
+
var PAGES_SLUG = "pages";
|
|
25
|
+
var POSTS_SLUG = "posts";
|
|
26
|
+
var STATIC_PAGES_SLUG = "staticPages";
|
|
27
|
+
|
|
28
|
+
// src/core/fields/link.ts
|
|
29
|
+
var appearanceOptions = {
|
|
30
|
+
default: { label: "Default", value: "default" },
|
|
31
|
+
outline: { label: "Outline", value: "outline" }
|
|
32
|
+
};
|
|
33
|
+
var link = (options = {}) => {
|
|
34
|
+
const {
|
|
35
|
+
appearances,
|
|
36
|
+
disableLabel = false,
|
|
37
|
+
relationTo = [PAGES_SLUG],
|
|
38
|
+
localized = false,
|
|
39
|
+
overrides = {}
|
|
40
|
+
} = options;
|
|
41
|
+
const result = {
|
|
42
|
+
name: "link",
|
|
43
|
+
type: "group",
|
|
44
|
+
admin: { hideGutter: true },
|
|
45
|
+
fields: [
|
|
46
|
+
{
|
|
47
|
+
type: "row",
|
|
48
|
+
fields: [
|
|
49
|
+
{
|
|
50
|
+
name: "type",
|
|
51
|
+
type: "radio",
|
|
52
|
+
admin: { layout: "horizontal", width: "50%" },
|
|
53
|
+
defaultValue: "reference",
|
|
54
|
+
options: [
|
|
55
|
+
{ label: "Internal link", value: "reference" },
|
|
56
|
+
{ label: "Custom URL", value: "custom" }
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "newTab",
|
|
61
|
+
type: "checkbox",
|
|
62
|
+
admin: { style: { alignSelf: "flex-end" }, width: "50%" },
|
|
63
|
+
label: "Open in new tab"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
};
|
|
69
|
+
const linkTypes = [
|
|
70
|
+
{
|
|
71
|
+
name: "reference",
|
|
72
|
+
type: "relationship",
|
|
73
|
+
admin: { condition: (_, siblingData) => siblingData?.type === "reference" },
|
|
74
|
+
label: "Document to link to",
|
|
75
|
+
relationTo,
|
|
76
|
+
required: true,
|
|
77
|
+
localized
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "url",
|
|
81
|
+
type: "text",
|
|
82
|
+
admin: { condition: (_, siblingData) => siblingData?.type === "custom" },
|
|
83
|
+
label: "Custom URL",
|
|
84
|
+
required: true,
|
|
85
|
+
localized
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
if (!disableLabel) {
|
|
89
|
+
result.fields.push({
|
|
90
|
+
type: "row",
|
|
91
|
+
fields: [
|
|
92
|
+
...linkTypes,
|
|
93
|
+
{
|
|
94
|
+
name: "label",
|
|
95
|
+
type: "text",
|
|
96
|
+
admin: { width: "50%" },
|
|
97
|
+
label: "Label",
|
|
98
|
+
required: true,
|
|
99
|
+
localized
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
result.fields = [...result.fields, ...linkTypes];
|
|
105
|
+
}
|
|
106
|
+
if (appearances !== false) {
|
|
107
|
+
const opts = appearances ? appearances.map((a) => appearanceOptions[a]) : [appearanceOptions.default, appearanceOptions.outline];
|
|
108
|
+
result.fields.push({
|
|
109
|
+
name: "appearance",
|
|
110
|
+
type: "select",
|
|
111
|
+
admin: { description: "Choose how the link should be rendered." },
|
|
112
|
+
defaultValue: "default",
|
|
113
|
+
options: opts
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return { ...result, ...overrides };
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// src/core/fields/linkGroup.ts
|
|
120
|
+
var linkGroup = (options = {}) => ({
|
|
121
|
+
name: "links",
|
|
122
|
+
type: "array",
|
|
123
|
+
fields: [link(options)],
|
|
124
|
+
admin: { initCollapsed: true }
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// src/exports/core-fields.ts
|
|
128
|
+
var core_fields_default = { link, linkGroup, appearanceOptions };
|
|
129
|
+
export {
|
|
130
|
+
linkGroup,
|
|
131
|
+
link,
|
|
132
|
+
core_fields_default as default,
|
|
133
|
+
appearanceOptions
|
|
134
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ImportMap } from "payload";
|
|
2
|
+
declare function getFromImportMap(key: string, importMap: ImportMap): any;
|
|
3
|
+
declare function generateImportName(type: "block" | "page", slug: string): string;
|
|
4
|
+
import { ImportMap as ImportMap2 } from "payload";
|
|
5
|
+
import { JSX as JSX_1kxb } from "react/jsx-runtime";
|
|
6
|
+
type Element_12xgc = JSX_1kxb["Element"];
|
|
7
|
+
declare function renderCollectionModule(collection: {
|
|
8
|
+
slug: string;
|
|
9
|
+
custom?: Record<string, any>;
|
|
10
|
+
}[] | undefined, slug: string, importMap: ImportMap2, props?: Record<string, any>): Element_12xgc | null;
|
|
11
|
+
declare const _default: {
|
|
12
|
+
getFromImportMap: typeof getFromImportMap;
|
|
13
|
+
generateImportName: typeof generateImportName;
|
|
14
|
+
renderCollectionModule: typeof renderCollectionModule;
|
|
15
|
+
};
|
|
16
|
+
export { renderCollectionModule, getFromImportMap, generateImportName, _default as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
|
+
|
|
18
|
+
// src/core/utils/getFromImportMap.ts
|
|
19
|
+
function getFromImportMap(key, importMap) {
|
|
20
|
+
return importMap[key.includes("#") ? key : key + "#default"];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/core/utils/generateImportName.ts
|
|
24
|
+
function generateImportName(type, slug) {
|
|
25
|
+
switch (type) {
|
|
26
|
+
case "block":
|
|
27
|
+
return `Block${slug.replace(/(^\w|-\w)/g, (m) => m.replace("-", "").toUpperCase())}#default`;
|
|
28
|
+
case "page":
|
|
29
|
+
return `Page${slug.replace(/(^\w|-\w)/g, (m) => m.replace("-", "").toUpperCase())}#default`;
|
|
30
|
+
default:
|
|
31
|
+
throw new Error(`Unknown type: ${type}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/render/utils/renderCollectionModule.tsx
|
|
36
|
+
import { jsx } from "react/jsx-runtime";
|
|
37
|
+
function renderCollectionModule(collection = [], slug, importMap, props) {
|
|
38
|
+
const renderPath = collection?.find((c) => c.slug === slug)?.custom?.path;
|
|
39
|
+
if (!renderPath)
|
|
40
|
+
return null;
|
|
41
|
+
const CollectionRenderModule = getFromImportMap(renderPath, importMap);
|
|
42
|
+
if (!CollectionRenderModule) {
|
|
43
|
+
if (false) {}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsx(CollectionRenderModule, {
|
|
47
|
+
importMap,
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/exports/core-utils.ts
|
|
53
|
+
var core_utils_default = { getFromImportMap, generateImportName, renderCollectionModule };
|
|
54
|
+
export {
|
|
55
|
+
renderCollectionModule,
|
|
56
|
+
getFromImportMap,
|
|
57
|
+
generateImportName,
|
|
58
|
+
core_utils_default as default
|
|
59
|
+
};
|
|
@@ -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 };
|