@justanarthur/payload-www 0.3.4 → 1.0.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 +317 -307
- package/dist/access.d.ts +2 -2
- package/dist/access.js +6 -30
- package/dist/blocks.d.ts +0 -10
- package/dist/blocks.js +8 -33
- package/dist/collections.d.ts +33 -225
- package/dist/collections.js +186 -661
- package/dist/config.d.ts +19 -105
- package/dist/config.js +263 -868
- package/dist/fields.d.ts +4 -46
- package/dist/fields.js +183 -73
- 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 -258
- package/dist/pages.d.ts +37 -319
- package/dist/pages.js +355 -973
- package/dist/render-pages.d.ts +69 -564
- package/dist/render-pages.js +476 -1502
- package/dist/sitemap.d.ts +10 -0
- package/dist/sitemap.js +324 -0
- package/dist/translator.js +0 -15
- package/dist/utils.d.ts +4 -12
- package/dist/utils.js +10 -56
- package/package.json +75 -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 -44
- package/dist/core-blocks.d.ts +0 -24
- package/dist/core-blocks.js +0 -89
- package/dist/core-fields.d.ts +0 -73
- package/dist/core-fields.js +0 -181
- package/dist/core-utils.d.ts +0 -16
- package/dist/core-utils.js +0 -73
- package/dist/data-collections.d.ts +0 -229
- package/dist/data-collections.js +0 -697
- 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 -1134
- package/dist/globals.d.ts +0 -69
- package/dist/globals.js +0 -259
- 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 -393
- package/dist/render-utils.d.ts +0 -166
- package/dist/render-utils.js +0 -401
- 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 -2265
- package/dist/test.d.ts +0 -30
- package/dist/test.js +0 -1134
- package/dist/with-www-config.d.ts +0 -108
- package/dist/with-www-config.js +0 -1030
package/package.json
CHANGED
|
@@ -1,108 +1,18 @@
|
|
|
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": "0.
|
|
4
|
+
"version": "1.0.1",
|
|
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
|
],
|
|
59
11
|
"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": {
|
|
12
|
+
"./translator": {
|
|
103
13
|
"import": {
|
|
104
|
-
"types": "./dist/
|
|
105
|
-
"default": "./dist/
|
|
14
|
+
"types": "./dist/translator.d.ts",
|
|
15
|
+
"default": "./dist/translator.js"
|
|
106
16
|
}
|
|
107
17
|
},
|
|
108
18
|
"./render-pages": {
|
|
@@ -111,18 +21,6 @@
|
|
|
111
21
|
"default": "./dist/render-pages.js"
|
|
112
22
|
}
|
|
113
23
|
},
|
|
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
24
|
"./metadata": {
|
|
127
25
|
"import": {
|
|
128
26
|
"types": "./dist/metadata.d.ts",
|
|
@@ -135,52 +33,34 @@
|
|
|
135
33
|
"default": "./dist/config.js"
|
|
136
34
|
}
|
|
137
35
|
},
|
|
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": {
|
|
36
|
+
"./imagehash": {
|
|
157
37
|
"import": {
|
|
158
|
-
"types": "./dist/
|
|
159
|
-
"default": "./dist/
|
|
38
|
+
"types": "./dist/imagehash.d.ts",
|
|
39
|
+
"default": "./dist/imagehash.js"
|
|
160
40
|
}
|
|
161
41
|
},
|
|
162
|
-
"./
|
|
42
|
+
"./blocks": {
|
|
163
43
|
"import": {
|
|
164
|
-
"types": "./dist/
|
|
165
|
-
"default": "./dist/
|
|
44
|
+
"types": "./dist/blocks.d.ts",
|
|
45
|
+
"default": "./dist/blocks.js"
|
|
166
46
|
}
|
|
167
47
|
},
|
|
168
|
-
"./
|
|
48
|
+
"./collections": {
|
|
169
49
|
"import": {
|
|
170
|
-
"types": "./dist/
|
|
171
|
-
"default": "./dist/
|
|
50
|
+
"types": "./dist/collections.d.ts",
|
|
51
|
+
"default": "./dist/collections.js"
|
|
172
52
|
}
|
|
173
53
|
},
|
|
174
|
-
"./
|
|
54
|
+
"./utils": {
|
|
175
55
|
"import": {
|
|
176
|
-
"types": "./dist/
|
|
177
|
-
"default": "./dist/
|
|
56
|
+
"types": "./dist/utils.d.ts",
|
|
57
|
+
"default": "./dist/utils.js"
|
|
178
58
|
}
|
|
179
59
|
},
|
|
180
|
-
"./
|
|
60
|
+
"./pages": {
|
|
181
61
|
"import": {
|
|
182
|
-
"types": "./dist/
|
|
183
|
-
"default": "./dist/
|
|
62
|
+
"types": "./dist/pages.d.ts",
|
|
63
|
+
"default": "./dist/pages.js"
|
|
184
64
|
}
|
|
185
65
|
},
|
|
186
66
|
"./access": {
|
|
@@ -189,56 +69,73 @@
|
|
|
189
69
|
"default": "./dist/access.js"
|
|
190
70
|
}
|
|
191
71
|
},
|
|
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": {
|
|
72
|
+
"./import-map-provider": {
|
|
223
73
|
"import": {
|
|
224
|
-
"types": "./dist/
|
|
225
|
-
"default": "./dist/
|
|
74
|
+
"types": "./dist/import-map-provider.d.ts",
|
|
75
|
+
"default": "./dist/import-map-provider.js"
|
|
226
76
|
}
|
|
227
77
|
},
|
|
228
|
-
"./
|
|
78
|
+
"./fields": {
|
|
229
79
|
"import": {
|
|
230
|
-
"types": "./dist/
|
|
231
|
-
"default": "./dist/
|
|
80
|
+
"types": "./dist/fields.d.ts",
|
|
81
|
+
"default": "./dist/fields.js"
|
|
232
82
|
}
|
|
233
83
|
},
|
|
234
|
-
"./
|
|
84
|
+
"./sitemap": {
|
|
235
85
|
"import": {
|
|
236
|
-
"types": "./dist/
|
|
237
|
-
"default": "./dist/
|
|
86
|
+
"types": "./dist/sitemap.d.ts",
|
|
87
|
+
"default": "./dist/sitemap.js"
|
|
238
88
|
}
|
|
239
89
|
},
|
|
240
90
|
"./package.json": "./package.json"
|
|
241
91
|
},
|
|
92
|
+
"sideEffects": false,
|
|
93
|
+
"engines": {
|
|
94
|
+
"node": ">=20"
|
|
95
|
+
},
|
|
96
|
+
"scripts": {
|
|
97
|
+
"build": "NODE_ENV=production bunup && node scripts/strip-createRequire.mjs",
|
|
98
|
+
"clean": "rm -rf dist .tsbuildinfo",
|
|
99
|
+
"test": "vitest run",
|
|
100
|
+
"test:watch": "vitest",
|
|
101
|
+
"typecheck": "tsc --noEmit",
|
|
102
|
+
"prepublishOnly": "bun run clean && bun run build"
|
|
103
|
+
},
|
|
104
|
+
"dependencies": {
|
|
105
|
+
"@payloadcms/live-preview-react": "3.85.0",
|
|
106
|
+
"@payloadcms/plugin-mcp": "3.85.0",
|
|
107
|
+
"@payloadcms/richtext-lexical": "3.85.0",
|
|
108
|
+
"@payloadcms/next": "3.85.0",
|
|
109
|
+
"next": "16.2.6",
|
|
110
|
+
"next-intl": "^4.0.0",
|
|
111
|
+
"server-only": "0.0.1"
|
|
112
|
+
},
|
|
113
|
+
"devDependencies": {
|
|
114
|
+
"@types/node": "22.19.9",
|
|
115
|
+
"@types/react": "19.2.14",
|
|
116
|
+
"@types/react-dom": "19.2.3",
|
|
117
|
+
"bunup": "^0.16.32",
|
|
118
|
+
"payload": "3.85.0",
|
|
119
|
+
"react": "19.2.6",
|
|
120
|
+
"react-dom": "19.2.6",
|
|
121
|
+
"typescript": "5.7.3",
|
|
122
|
+
"vitest": "4.0.18"
|
|
123
|
+
},
|
|
124
|
+
"peerDependencies": {
|
|
125
|
+
"@payloadcms/live-preview-react": "^3.85.0",
|
|
126
|
+
"@payloadcms/next": "^3.85.0",
|
|
127
|
+
"@payloadcms/richtext-lexical": "^3.85.0",
|
|
128
|
+
"@payloadcms/translations": "^3.85.0",
|
|
129
|
+
"@payloadcms/ui": "^3.85.0",
|
|
130
|
+
"next": "^16.2.6",
|
|
131
|
+
"next-intl": "^4.0.0",
|
|
132
|
+
"payload": "^3.85.0",
|
|
133
|
+
"react": "^19.2.6",
|
|
134
|
+
"react-dom": "^19.2.6",
|
|
135
|
+
"@justanarthur/payload-plugin-seo": "^3.0.0",
|
|
136
|
+
"@justanarthur/payload-plugin-translator": "^3.0.0",
|
|
137
|
+
"@justanarthur/payload-imagehash-plugin": "^3.3.0"
|
|
138
|
+
},
|
|
242
139
|
"properties": {
|
|
243
140
|
"gitCommitScopeRelatedNames": "payload-www,render,revalidation,www",
|
|
244
141
|
"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,44 +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 = () => {
|
|
20
|
-
console.log("[WWW] core/access:anyone -> true");
|
|
21
|
-
return true;
|
|
22
|
-
};
|
|
23
|
-
var authenticated = ({ req: { user } }) => {
|
|
24
|
-
const result = Boolean(user);
|
|
25
|
-
console.log("[WWW] core/access:authenticated ->", result);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
var authenticatedOrPublished = ({ req: { user } }) => {
|
|
29
|
-
if (user) {
|
|
30
|
-
console.log("[WWW] core/access:authenticatedOrPublished -> true (authenticated)");
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
console.log('[WWW] core/access:authenticatedOrPublished -> { _status: { equals: "published" } }');
|
|
34
|
-
return { _status: { equals: "published" } };
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// src/exports/core-access.ts
|
|
38
|
-
var core_access_default = { anyone, authenticated, authenticatedOrPublished };
|
|
39
|
-
export {
|
|
40
|
-
core_access_default as default,
|
|
41
|
-
authenticatedOrPublished,
|
|
42
|
-
authenticated,
|
|
43
|
-
anyone
|
|
44
|
-
};
|
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,89 +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
|
-
const resolvedKey = key.includes("#") ? key : key + "#default";
|
|
21
|
-
const value = importMap[resolvedKey];
|
|
22
|
-
console.log("[WWW] core/utils:getFromImportMap key=", key, "resolved=", resolvedKey, "hit=", Boolean(value));
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// src/core/utils/generateImportName.ts
|
|
27
|
-
function generateImportName(type, slug) {
|
|
28
|
-
switch (type) {
|
|
29
|
-
case "block": {
|
|
30
|
-
const name = `Block${slug.replace(/(^\w|-\w)/g, (m) => m.replace("-", "").toUpperCase())}#default`;
|
|
31
|
-
console.log("[WWW] core/utils:generateImportName type=block slug=", slug, "->", name);
|
|
32
|
-
return name;
|
|
33
|
-
}
|
|
34
|
-
case "page": {
|
|
35
|
-
const name = `Page${slug.replace(/(^\w|-\w)/g, (m) => m.replace("-", "").toUpperCase())}#default`;
|
|
36
|
-
console.log("[WWW] core/utils:generateImportName type=page slug=", slug, "->", name);
|
|
37
|
-
return name;
|
|
38
|
-
}
|
|
39
|
-
default:
|
|
40
|
-
console.error("[WWW] core/utils:generateImportName unknown type:", type);
|
|
41
|
-
throw new Error(`Unknown type: ${type}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// src/render/blocks/renderBlocks.tsx
|
|
46
|
-
import { jsx, Fragment } from "react/jsx-runtime";
|
|
47
|
-
var RenderBlocks = ({
|
|
48
|
-
blocks,
|
|
49
|
-
blockProps,
|
|
50
|
-
config,
|
|
51
|
-
importMap,
|
|
52
|
-
locale,
|
|
53
|
-
searchParams
|
|
54
|
-
}) => {
|
|
55
|
-
if (!blocks || !Array.isArray(blocks) || blocks.length === 0) {
|
|
56
|
-
console.log("[WWW] render/blocks:RenderBlocks no blocks (locale=", locale, ")");
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
console.log("[WWW] render/blocks:RenderBlocks rendering count=", blocks.length, "locale=", locale);
|
|
60
|
-
const rendered = [];
|
|
61
|
-
for (let i = 0;i < blocks.length; i++) {
|
|
62
|
-
const block = blocks[i];
|
|
63
|
-
const { blockType } = block;
|
|
64
|
-
const importMapPath = config.admin?.dependencies?.[blockType]?.path ?? generateImportName("block", blockType);
|
|
65
|
-
const Block = getFromImportMap(importMapPath, importMap);
|
|
66
|
-
if (!Block) {
|
|
67
|
-
console.warn(`[WWW] render/blocks:RenderBlocks no block for type=${blockType} importMapPath=${importMapPath} (locale=${locale})`);
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
console.log("[WWW] render/blocks:RenderBlocks [", i, "] blockType=", blockType, "importMapPath=", importMapPath);
|
|
71
|
-
rendered.push(/* @__PURE__ */ jsx(Block, {
|
|
72
|
-
index: i,
|
|
73
|
-
...blockProps,
|
|
74
|
-
...block,
|
|
75
|
-
locale,
|
|
76
|
-
searchParams
|
|
77
|
-
}, i));
|
|
78
|
-
}
|
|
79
|
-
return /* @__PURE__ */ jsx(Fragment, {
|
|
80
|
-
children: rendered
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// src/exports/core-blocks.ts
|
|
85
|
-
var core_blocks_default = RenderBlocks;
|
|
86
|
-
export {
|
|
87
|
-
core_blocks_default as default,
|
|
88
|
-
RenderBlocks
|
|
89
|
-
};
|
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 };
|