@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.
- package/README.md +317 -307
- package/dist/access.d.ts +2 -2
- package/dist/access.js +3 -17
- package/dist/blocks.d.ts +7 -12
- package/dist/blocks.js +24 -43
- package/dist/cli.js +201 -0
- package/dist/collections.d.ts +33 -225
- package/dist/collections.js +185 -639
- package/dist/config.d.ts +19 -105
- package/dist/config.js +257 -855
- package/dist/fields.d.ts +4 -46
- package/dist/fields.js +177 -53
- package/dist/imagehash.js +0 -15
- package/dist/import-map-provider.d.ts +0 -16
- package/dist/import-map-provider.js +0 -15
- package/dist/metadata.d.ts +24 -89
- package/dist/metadata.js +123 -255
- package/dist/pages.d.ts +37 -319
- package/dist/pages.js +349 -964
- package/dist/render-pages.d.ts +70 -565
- package/dist/render-pages.js +464 -1477
- package/dist/sitemap.d.ts +10 -0
- package/dist/sitemap.js +337 -0
- package/dist/translator.js +0 -15
- package/dist/utils.d.ts +10 -12
- package/dist/utils.js +18 -41
- package/package.json +81 -178
- package/dist/components.d.ts +0 -6
- package/dist/components.js +0 -39
- package/dist/core-access.d.ts +0 -11
- package/dist/core-access.js +0 -34
- package/dist/core-blocks.d.ts +0 -24
- package/dist/core-blocks.js +0 -79
- package/dist/core-fields.d.ts +0 -73
- package/dist/core-fields.js +0 -167
- package/dist/core-utils.d.ts +0 -16
- package/dist/core-utils.js +0 -63
- package/dist/data-collections.d.ts +0 -229
- package/dist/data-collections.js +0 -676
- package/dist/data-seed.d.ts +0 -76
- package/dist/data-seed.js +0 -212
- package/dist/data-test.d.ts +0 -30
- package/dist/data-test.js +0 -1110
- package/dist/globals.d.ts +0 -69
- package/dist/globals.js +0 -251
- package/dist/hooks.d.ts +0 -108
- package/dist/hooks.js +0 -228
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -39
- package/dist/render-components.d.ts +0 -42
- package/dist/render-components.js +0 -154
- package/dist/render-metadata.d.ts +0 -122
- package/dist/render-metadata.js +0 -390
- package/dist/render-utils.d.ts +0 -166
- package/dist/render-utils.js +0 -398
- package/dist/seed.d.ts +0 -76
- package/dist/seed.js +0 -212
- package/dist/server.d.ts +0 -980
- package/dist/server.js +0 -2231
- package/dist/test.d.ts +0 -30
- package/dist/test.js +0 -1110
- package/dist/with-www-config.d.ts +0 -108
- package/dist/with-www-config.js +0 -1006
package/package.json
CHANGED
|
@@ -1,108 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justanarthur/payload-www",
|
|
3
3
|
"description": "Reusable Payload CMS website template — config builder, collections, globals, blocks, fields, access, hooks, metadata (JSON-LD, hreflang), page renderers, and test helpers.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"sideEffects": false,
|
|
10
|
-
"engines": {
|
|
11
|
-
"node": ">=20"
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "bunup && node scripts/strip-createRequire.mjs",
|
|
15
|
-
"clean": "rm -rf dist .tsbuildinfo",
|
|
16
|
-
"test": "vitest run",
|
|
17
|
-
"test:watch": "vitest",
|
|
18
|
-
"typecheck": "tsc --noEmit",
|
|
19
|
-
"prepublishOnly": "bun run clean && bun run build"
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@justanarthur/payload-imagehash-plugin": "3.2.3",
|
|
23
|
-
"@justanarthur/payload-plugin-seo": "1.3.11",
|
|
24
|
-
"@justanarthur/payload-plugin-translator": "1.3.21",
|
|
25
|
-
"@payloadcms/live-preview-react": "3.85.0",
|
|
26
|
-
"@payloadcms/richtext-lexical": "3.85.0",
|
|
27
|
-
"@payloadcms/next": "3.85.0",
|
|
28
|
-
"next": "16.2.6",
|
|
29
|
-
"next-intl": "^4.0.0",
|
|
30
|
-
"server-only": "0.0.1"
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@types/node": "22.19.9",
|
|
34
|
-
"@types/react": "19.2.14",
|
|
35
|
-
"@types/react-dom": "19.2.3",
|
|
36
|
-
"bunup": "^0.16.32",
|
|
37
|
-
"payload": "3.85.0",
|
|
38
|
-
"react": "19.2.6",
|
|
39
|
-
"react-dom": "19.2.6",
|
|
40
|
-
"typescript": "5.7.3",
|
|
41
|
-
"vitest": "4.0.18"
|
|
42
|
-
},
|
|
43
|
-
"peerDependencies": {
|
|
44
|
-
"@payloadcms/live-preview-react": "^3.85.0",
|
|
45
|
-
"@payloadcms/next": "^3.85.0",
|
|
46
|
-
"@payloadcms/richtext-lexical": "^3.85.0",
|
|
47
|
-
"@payloadcms/translations": "^3.85.0",
|
|
48
|
-
"@payloadcms/ui": "^3.85.0",
|
|
49
|
-
"next": "^16.2.6",
|
|
50
|
-
"next-intl": "^4.0.0",
|
|
51
|
-
"payload": "^3.85.0",
|
|
52
|
-
"react": "^19.2.6",
|
|
53
|
-
"react-dom": "^19.2.6"
|
|
54
|
-
},
|
|
55
7
|
"files": [
|
|
56
8
|
"dist",
|
|
57
9
|
"README.md"
|
|
58
10
|
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"payload-www": "./dist/cli.js"
|
|
13
|
+
},
|
|
59
14
|
"exports": {
|
|
60
|
-
"./
|
|
61
|
-
"import": {
|
|
62
|
-
"types": "./dist/data-seed.d.ts",
|
|
63
|
-
"default": "./dist/data-seed.js"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"./hooks": {
|
|
67
|
-
"import": {
|
|
68
|
-
"types": "./dist/hooks.d.ts",
|
|
69
|
-
"default": "./dist/hooks.js"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
"./server": {
|
|
73
|
-
"import": {
|
|
74
|
-
"types": "./dist/server.d.ts",
|
|
75
|
-
"default": "./dist/server.js"
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
"./data-test": {
|
|
79
|
-
"import": {
|
|
80
|
-
"types": "./dist/data-test.d.ts",
|
|
81
|
-
"default": "./dist/data-test.js"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
"./with-www-config": {
|
|
85
|
-
"import": {
|
|
86
|
-
"types": "./dist/with-www-config.d.ts",
|
|
87
|
-
"default": "./dist/with-www-config.js"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"./imagehash": {
|
|
91
|
-
"import": {
|
|
92
|
-
"types": "./dist/imagehash.d.ts",
|
|
93
|
-
"default": "./dist/imagehash.js"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
".": {
|
|
97
|
-
"import": {
|
|
98
|
-
"types": "./dist/index.d.ts",
|
|
99
|
-
"default": "./dist/index.js"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
"./fields": {
|
|
15
|
+
"./translator": {
|
|
103
16
|
"import": {
|
|
104
|
-
"types": "./dist/
|
|
105
|
-
"default": "./dist/
|
|
17
|
+
"types": "./dist/translator.d.ts",
|
|
18
|
+
"default": "./dist/translator.js"
|
|
106
19
|
}
|
|
107
20
|
},
|
|
108
21
|
"./render-pages": {
|
|
@@ -111,18 +24,6 @@
|
|
|
111
24
|
"default": "./dist/render-pages.js"
|
|
112
25
|
}
|
|
113
26
|
},
|
|
114
|
-
"./import-map-provider": {
|
|
115
|
-
"import": {
|
|
116
|
-
"types": "./dist/import-map-provider.d.ts",
|
|
117
|
-
"default": "./dist/import-map-provider.js"
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
"./core-access": {
|
|
121
|
-
"import": {
|
|
122
|
-
"types": "./dist/core-access.d.ts",
|
|
123
|
-
"default": "./dist/core-access.js"
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
27
|
"./metadata": {
|
|
127
28
|
"import": {
|
|
128
29
|
"types": "./dist/metadata.d.ts",
|
|
@@ -135,52 +36,34 @@
|
|
|
135
36
|
"default": "./dist/config.js"
|
|
136
37
|
}
|
|
137
38
|
},
|
|
138
|
-
"./
|
|
139
|
-
"import": {
|
|
140
|
-
"types": "./dist/render-utils.d.ts",
|
|
141
|
-
"default": "./dist/render-utils.js"
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
"./data-collections": {
|
|
145
|
-
"import": {
|
|
146
|
-
"types": "./dist/data-collections.d.ts",
|
|
147
|
-
"default": "./dist/data-collections.js"
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
"./seed": {
|
|
151
|
-
"import": {
|
|
152
|
-
"types": "./dist/seed.d.ts",
|
|
153
|
-
"default": "./dist/seed.js"
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
"./pages": {
|
|
39
|
+
"./imagehash": {
|
|
157
40
|
"import": {
|
|
158
|
-
"types": "./dist/
|
|
159
|
-
"default": "./dist/
|
|
41
|
+
"types": "./dist/imagehash.d.ts",
|
|
42
|
+
"default": "./dist/imagehash.js"
|
|
160
43
|
}
|
|
161
44
|
},
|
|
162
|
-
"./
|
|
45
|
+
"./blocks": {
|
|
163
46
|
"import": {
|
|
164
|
-
"types": "./dist/
|
|
165
|
-
"default": "./dist/
|
|
47
|
+
"types": "./dist/blocks.d.ts",
|
|
48
|
+
"default": "./dist/blocks.js"
|
|
166
49
|
}
|
|
167
50
|
},
|
|
168
|
-
"./
|
|
51
|
+
"./collections": {
|
|
169
52
|
"import": {
|
|
170
|
-
"types": "./dist/
|
|
171
|
-
"default": "./dist/
|
|
53
|
+
"types": "./dist/collections.d.ts",
|
|
54
|
+
"default": "./dist/collections.js"
|
|
172
55
|
}
|
|
173
56
|
},
|
|
174
|
-
"./
|
|
57
|
+
"./utils": {
|
|
175
58
|
"import": {
|
|
176
|
-
"types": "./dist/
|
|
177
|
-
"default": "./dist/
|
|
59
|
+
"types": "./dist/utils.d.ts",
|
|
60
|
+
"default": "./dist/utils.js"
|
|
178
61
|
}
|
|
179
62
|
},
|
|
180
|
-
"./
|
|
63
|
+
"./pages": {
|
|
181
64
|
"import": {
|
|
182
|
-
"types": "./dist/
|
|
183
|
-
"default": "./dist/
|
|
65
|
+
"types": "./dist/pages.d.ts",
|
|
66
|
+
"default": "./dist/pages.js"
|
|
184
67
|
}
|
|
185
68
|
},
|
|
186
69
|
"./access": {
|
|
@@ -189,56 +72,76 @@
|
|
|
189
72
|
"default": "./dist/access.js"
|
|
190
73
|
}
|
|
191
74
|
},
|
|
192
|
-
"./
|
|
193
|
-
"import": {
|
|
194
|
-
"types": "./dist/globals.d.ts",
|
|
195
|
-
"default": "./dist/globals.js"
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
"./core-utils": {
|
|
199
|
-
"import": {
|
|
200
|
-
"types": "./dist/core-utils.d.ts",
|
|
201
|
-
"default": "./dist/core-utils.js"
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
"./translator": {
|
|
205
|
-
"import": {
|
|
206
|
-
"types": "./dist/translator.d.ts",
|
|
207
|
-
"default": "./dist/translator.js"
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
"./blocks": {
|
|
211
|
-
"import": {
|
|
212
|
-
"types": "./dist/blocks.d.ts",
|
|
213
|
-
"default": "./dist/blocks.js"
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
"./components": {
|
|
217
|
-
"import": {
|
|
218
|
-
"types": "./dist/components.d.ts",
|
|
219
|
-
"default": "./dist/components.js"
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
"./core-blocks": {
|
|
75
|
+
"./import-map-provider": {
|
|
223
76
|
"import": {
|
|
224
|
-
"types": "./dist/
|
|
225
|
-
"default": "./dist/
|
|
77
|
+
"types": "./dist/import-map-provider.d.ts",
|
|
78
|
+
"default": "./dist/import-map-provider.js"
|
|
226
79
|
}
|
|
227
80
|
},
|
|
228
|
-
"./
|
|
81
|
+
"./fields": {
|
|
229
82
|
"import": {
|
|
230
|
-
"types": "./dist/
|
|
231
|
-
"default": "./dist/
|
|
83
|
+
"types": "./dist/fields.d.ts",
|
|
84
|
+
"default": "./dist/fields.js"
|
|
232
85
|
}
|
|
233
86
|
},
|
|
234
|
-
"./
|
|
87
|
+
"./sitemap": {
|
|
235
88
|
"import": {
|
|
236
|
-
"types": "./dist/
|
|
237
|
-
"default": "./dist/
|
|
89
|
+
"types": "./dist/sitemap.d.ts",
|
|
90
|
+
"default": "./dist/sitemap.js"
|
|
238
91
|
}
|
|
239
92
|
},
|
|
240
93
|
"./package.json": "./package.json"
|
|
241
94
|
},
|
|
95
|
+
"sideEffects": false,
|
|
96
|
+
"engines": {
|
|
97
|
+
"node": ">=20"
|
|
98
|
+
},
|
|
99
|
+
"scripts": {
|
|
100
|
+
"build": "NODE_ENV=production bunup && node scripts/strip-createRequire.mjs && bun run build:cli",
|
|
101
|
+
"build:lib": "NODE_ENV=production bunup",
|
|
102
|
+
"build:cli": "bun build src/cli/index.ts --target node --format esm --outfile dist/cli.js --external tsx --external 'tsx/esm/api'",
|
|
103
|
+
"clean": "rm -rf dist .tsbuildinfo",
|
|
104
|
+
"test": "vitest run",
|
|
105
|
+
"test:watch": "vitest",
|
|
106
|
+
"typecheck": "tsc --noEmit",
|
|
107
|
+
"prepublishOnly": "bun run clean && bun run build"
|
|
108
|
+
},
|
|
109
|
+
"dependencies": {
|
|
110
|
+
"@payloadcms/live-preview-react": "3.85.0",
|
|
111
|
+
"@payloadcms/plugin-mcp": "3.85.0",
|
|
112
|
+
"@payloadcms/richtext-lexical": "3.85.0",
|
|
113
|
+
"@payloadcms/next": "3.85.0",
|
|
114
|
+
"next": "16.2.6",
|
|
115
|
+
"next-intl": "^4.0.0",
|
|
116
|
+
"server-only": "0.0.1",
|
|
117
|
+
"tsx": "^4.19.2"
|
|
118
|
+
},
|
|
119
|
+
"devDependencies": {
|
|
120
|
+
"@types/node": "22.19.9",
|
|
121
|
+
"@types/react": "19.2.14",
|
|
122
|
+
"@types/react-dom": "19.2.3",
|
|
123
|
+
"bunup": "^0.16.32",
|
|
124
|
+
"payload": "3.85.1",
|
|
125
|
+
"react": "19.2.6",
|
|
126
|
+
"react-dom": "19.2.6",
|
|
127
|
+
"typescript": "5.7.3",
|
|
128
|
+
"vitest": "4.0.18"
|
|
129
|
+
},
|
|
130
|
+
"peerDependencies": {
|
|
131
|
+
"@payloadcms/live-preview-react": "^3.85.0",
|
|
132
|
+
"@payloadcms/next": "^3.85.0",
|
|
133
|
+
"@payloadcms/richtext-lexical": "^3.85.0",
|
|
134
|
+
"@payloadcms/translations": "^3.85.0",
|
|
135
|
+
"@payloadcms/ui": "^3.85.0",
|
|
136
|
+
"next": "^16.2.6",
|
|
137
|
+
"next-intl": "^4.0.0",
|
|
138
|
+
"payload": "^3.85.0",
|
|
139
|
+
"react": "^19.2.6",
|
|
140
|
+
"react-dom": "^19.2.6",
|
|
141
|
+
"@justanarthur/payload-plugin-seo": "^3.0.0",
|
|
142
|
+
"@justanarthur/payload-plugin-translator": "^3.0.0",
|
|
143
|
+
"@justanarthur/payload-imagehash-plugin": "^3.3.0"
|
|
144
|
+
},
|
|
242
145
|
"properties": {
|
|
243
146
|
"gitCommitScopeRelatedNames": "payload-www,render,revalidation,www",
|
|
244
147
|
"priority": 1
|
package/dist/components.d.ts
DELETED
package/dist/components.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __returnValue = (v) => v;
|
|
5
|
-
function __exportSetter(name, newValue) {
|
|
6
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
7
|
-
}
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, {
|
|
11
|
-
get: all[name],
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
set: __exportSetter.bind(all, name)
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
18
|
-
|
|
19
|
-
// src/render/components/LivePreviewListener.tsx
|
|
20
|
-
import { RefreshRouteOnSave as PayloadLivePreview } from "@payloadcms/live-preview-react";
|
|
21
|
-
import { useRouter } from "next/navigation";
|
|
22
|
-
import { jsx } from "react/jsx-runtime";
|
|
23
|
-
|
|
24
|
-
var LivePreviewListener = ({ serverURL }) => {
|
|
25
|
-
const router = useRouter();
|
|
26
|
-
const url = serverURL ?? process.env.NEXT_PUBLIC_SERVER_URL ?? (typeof window !== "undefined" ? window.location.origin : "");
|
|
27
|
-
console.log("[WWW] render/components:LivePreviewListener serverURL=", url);
|
|
28
|
-
return /* @__PURE__ */ jsx(PayloadLivePreview, {
|
|
29
|
-
refresh: router.refresh,
|
|
30
|
-
serverURL: url
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// src/exports/components.ts
|
|
35
|
-
var components_default = LivePreviewListener;
|
|
36
|
-
export {
|
|
37
|
-
components_default as default,
|
|
38
|
-
LivePreviewListener
|
|
39
|
-
};
|
package/dist/core-access.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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 };
|
package/dist/core-access.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/core-blocks.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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 };
|
package/dist/core-blocks.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
console.log("[WWW] render/blocks:RenderBlocks no blocks (locale=", locale, ")");
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
console.log("[WWW] render/blocks:RenderBlocks rendering count=", blocks.length, "locale=", locale);
|
|
50
|
-
const rendered = [];
|
|
51
|
-
for (let i = 0;i < blocks.length; i++) {
|
|
52
|
-
const block = blocks[i];
|
|
53
|
-
const { blockType } = block;
|
|
54
|
-
const importMapPath = config.admin?.dependencies?.[blockType]?.path ?? generateImportName("block", blockType);
|
|
55
|
-
const Block = getFromImportMap(importMapPath, importMap);
|
|
56
|
-
if (!Block) {
|
|
57
|
-
console.warn(`[WWW] render/blocks:RenderBlocks no block for type=${blockType} importMapPath=${importMapPath} (locale=${locale})`);
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
console.log("[WWW] render/blocks:RenderBlocks [", i, "] blockType=", blockType, "importMapPath=", importMapPath);
|
|
61
|
-
rendered.push(/* @__PURE__ */ jsx(Block, {
|
|
62
|
-
index: i,
|
|
63
|
-
...blockProps,
|
|
64
|
-
...block,
|
|
65
|
-
locale,
|
|
66
|
-
searchParams
|
|
67
|
-
}, i));
|
|
68
|
-
}
|
|
69
|
-
return /* @__PURE__ */ jsx(Fragment, {
|
|
70
|
-
children: rendered
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// src/exports/core-blocks.ts
|
|
75
|
-
var core_blocks_default = RenderBlocks;
|
|
76
|
-
export {
|
|
77
|
-
core_blocks_default as default,
|
|
78
|
-
RenderBlocks
|
|
79
|
-
};
|
package/dist/core-fields.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
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
|
-
* Extra fields appended to the link group — e.g. a `description`
|
|
25
|
-
* text field or a `navHover` group for a mega-menu. Lets hosts
|
|
26
|
-
* extend the nav link schema without re-implementing the whole
|
|
27
|
-
* `link` field. Appended after the standard type/label/appearance
|
|
28
|
-
* fields.
|
|
29
|
-
*/
|
|
30
|
-
extraFields?: Field[];
|
|
31
|
-
};
|
|
32
|
-
declare const link: (options?: LinkOptions) => Field;
|
|
33
|
-
import { Field as Field2 } from "payload";
|
|
34
|
-
declare const linkGroup: (options?: LinkOptions) => Field2;
|
|
35
|
-
import { Field as Field3 } from "payload";
|
|
36
|
-
type SlugFieldOptions = {
|
|
37
|
-
/** Field name. Default: `'slug'`. */
|
|
38
|
-
name?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Allow the `_` nesting divider in the slug so `about_us` renders at
|
|
41
|
-
* `/about/us`. Relaxes validation and documents the convention in the
|
|
42
|
-
* admin UI. Pair with `createCollectionPageExports({ nested: true })`.
|
|
43
|
-
* Default: `false`.
|
|
44
|
-
*/
|
|
45
|
-
nested?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Localize the slug — one slug per locale (`/about` in `en`, `/o-nas`
|
|
48
|
-
* in `sk`), stored in the collection's `_locales` table. This is the
|
|
49
|
-
* default: the lib's collections are multilingual, so per-locale slugs
|
|
50
|
-
* power localized URLs and hreflang alternates. Pass `false` for a
|
|
51
|
-
* single shared slug.
|
|
52
|
-
*/
|
|
53
|
-
localized?: boolean;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* The slug field shared by the lib's Pages / Posts collections: a
|
|
57
|
-
* required, unique, indexed, sidebar text field, localized by default.
|
|
58
|
-
*
|
|
59
|
-
* The empty string is reserved for the home page (rendered at
|
|
60
|
-
* `/${locale}`), so validation only rejects non-empty malformed values.
|
|
61
|
-
*/
|
|
62
|
-
declare const slugField: (options?: SlugFieldOptions) => Field3;
|
|
63
|
-
import { Field as Field_14espm } from "payload";
|
|
64
|
-
declare const _default: {
|
|
65
|
-
link: (options?: LinkOptions) => Field_14espm;
|
|
66
|
-
linkGroup: (options?: LinkOptions) => Field_14espm;
|
|
67
|
-
appearanceOptions: Record<LinkAppearances, {
|
|
68
|
-
label: string;
|
|
69
|
-
value: string;
|
|
70
|
-
}>;
|
|
71
|
-
slugField: (options?: SlugFieldOptions) => Field_14espm;
|
|
72
|
-
};
|
|
73
|
-
export { slugField, linkGroup, link, _default as default, appearanceOptions, SlugFieldOptions, LinkOptions, LinkAppearances };
|