@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/dist/index.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/index.ts
|
|
35
|
-
var exports_default = LivePreviewListener;
|
|
36
|
-
export {
|
|
37
|
-
exports_default as default,
|
|
38
|
-
LivePreviewListener
|
|
39
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
|
-
type LivePreviewListenerProps = {
|
|
3
|
-
serverURL?: string;
|
|
4
|
-
};
|
|
5
|
-
declare const LivePreviewListener: FC<LivePreviewListenerProps>;
|
|
6
|
-
import { FC as FC2 } from "react";
|
|
7
|
-
type AdminBarLabels = {
|
|
8
|
-
/** Trigger button label (when popover is closed). */
|
|
9
|
-
trigger?: string;
|
|
10
|
-
/** Exit-preview link label. */
|
|
11
|
-
exitPreview?: string;
|
|
12
|
-
/** Tooltip / a11y description for the trigger button. */
|
|
13
|
-
triggerHint?: string;
|
|
14
|
-
};
|
|
15
|
-
type AdminBarProps = {
|
|
16
|
-
/**
|
|
17
|
-
* Whether draft mode is currently active. When `false`, the
|
|
18
|
-
* component renders `null` — zero DOM cost in production.
|
|
19
|
-
*/
|
|
20
|
-
preview: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Path to navigate to when the host clicks "Exit preview". Defaults
|
|
23
|
-
* to `/next/exit-preview` (matches Payload's standard handler).
|
|
24
|
-
*/
|
|
25
|
-
exitPreviewPath?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Per-label overrides for i18n hosts. Defaults are English.
|
|
28
|
-
*/
|
|
29
|
-
labels?: AdminBarLabels;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Next.js App Router–style draft-mode admin bar. Renders only when
|
|
33
|
-
* `preview` is true; shows a small floating button in the bottom-right
|
|
34
|
-
* that opens a native `<dialog>` popover with an "Exit preview" link.
|
|
35
|
-
*
|
|
36
|
-
* Mirrors `LivePreviewListener` as a self-contained `'use client'`
|
|
37
|
-
* component the host drops into the layout's providers tree. No
|
|
38
|
-
* dependency on `@payloadcms/admin-bar` — pure React + a few
|
|
39
|
-
* Tailwind-free inline styles so hosts can theme freely.
|
|
40
|
-
*/
|
|
41
|
-
declare const AdminBar: FC2<AdminBarProps>;
|
|
42
|
-
export { LivePreviewListener as default, LivePreviewListenerProps, LivePreviewListener, AdminBarProps, AdminBarLabels, AdminBar };
|
|
@@ -1,154 +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/render/components/AdminBar.tsx
|
|
35
|
-
import { useRouter as useRouter2 } from "next/navigation";
|
|
36
|
-
import { useState } from "react";
|
|
37
|
-
import { jsx as jsx2, jsxs, Fragment } from "react/jsx-runtime";
|
|
38
|
-
|
|
39
|
-
var defaultLabels = {
|
|
40
|
-
trigger: "Preview",
|
|
41
|
-
exitPreview: "Exit preview",
|
|
42
|
-
triggerHint: "Open draft-mode admin bar"
|
|
43
|
-
};
|
|
44
|
-
var AdminBar = ({ preview, exitPreviewPath = "/next/exit-preview", labels }) => {
|
|
45
|
-
const router = useRouter2();
|
|
46
|
-
const [open, setOpen] = useState(false);
|
|
47
|
-
const merged = { ...defaultLabels, ...labels };
|
|
48
|
-
if (!preview) {
|
|
49
|
-
console.log("[WWW] render/components:AdminBar preview=false -> null");
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
console.log("[WWW] render/components:AdminBar preview=true exitPreviewPath=", exitPreviewPath);
|
|
53
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
54
|
-
children: [
|
|
55
|
-
/* @__PURE__ */ jsx2("button", {
|
|
56
|
-
type: "button",
|
|
57
|
-
onClick: () => {
|
|
58
|
-
console.log("[WWW] render/components:AdminBar trigger clicked");
|
|
59
|
-
setOpen(true);
|
|
60
|
-
},
|
|
61
|
-
title: merged.triggerHint,
|
|
62
|
-
style: {
|
|
63
|
-
position: "fixed",
|
|
64
|
-
bottom: 16,
|
|
65
|
-
right: 16,
|
|
66
|
-
zIndex: 2147483647,
|
|
67
|
-
padding: "8px 14px",
|
|
68
|
-
borderRadius: 9999,
|
|
69
|
-
border: "1px solid rgba(0,0,0,0.12)",
|
|
70
|
-
background: "#111",
|
|
71
|
-
color: "#fff",
|
|
72
|
-
fontSize: 12,
|
|
73
|
-
fontWeight: 600,
|
|
74
|
-
letterSpacing: 0.4,
|
|
75
|
-
textTransform: "uppercase",
|
|
76
|
-
cursor: "pointer",
|
|
77
|
-
boxShadow: "0 4px 16px rgba(0,0,0,0.18)"
|
|
78
|
-
},
|
|
79
|
-
children: merged.trigger
|
|
80
|
-
}),
|
|
81
|
-
/* @__PURE__ */ jsx2("dialog", {
|
|
82
|
-
open,
|
|
83
|
-
onClose: () => setOpen(false),
|
|
84
|
-
onClick: (e) => {
|
|
85
|
-
if (e.target === e.currentTarget)
|
|
86
|
-
setOpen(false);
|
|
87
|
-
},
|
|
88
|
-
style: {
|
|
89
|
-
position: "fixed",
|
|
90
|
-
inset: 0,
|
|
91
|
-
width: "100vw",
|
|
92
|
-
height: "100vh",
|
|
93
|
-
maxWidth: "100vw",
|
|
94
|
-
maxHeight: "100vh",
|
|
95
|
-
margin: 0,
|
|
96
|
-
padding: 0,
|
|
97
|
-
border: "none",
|
|
98
|
-
background: "rgba(0,0,0,0.32)",
|
|
99
|
-
zIndex: 2147483647
|
|
100
|
-
},
|
|
101
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
102
|
-
style: {
|
|
103
|
-
position: "absolute",
|
|
104
|
-
bottom: 24,
|
|
105
|
-
right: 24,
|
|
106
|
-
minWidth: 220,
|
|
107
|
-
padding: 16,
|
|
108
|
-
borderRadius: 8,
|
|
109
|
-
background: "#fff",
|
|
110
|
-
color: "#111",
|
|
111
|
-
boxShadow: "0 12px 36px rgba(0,0,0,0.24)"
|
|
112
|
-
},
|
|
113
|
-
onClick: (e) => e.stopPropagation(),
|
|
114
|
-
children: [
|
|
115
|
-
/* @__PURE__ */ jsx2("div", {
|
|
116
|
-
style: { fontSize: 13, fontWeight: 600, marginBottom: 8 },
|
|
117
|
-
children: merged.trigger
|
|
118
|
-
}),
|
|
119
|
-
/* @__PURE__ */ jsx2("div", {
|
|
120
|
-
style: { fontSize: 12, color: "#666", marginBottom: 12 },
|
|
121
|
-
children: "Draft mode is on. Edits in Payload will refresh this view automatically."
|
|
122
|
-
}),
|
|
123
|
-
/* @__PURE__ */ jsx2("a", {
|
|
124
|
-
href: exitPreviewPath,
|
|
125
|
-
onClick: () => {
|
|
126
|
-
console.log("[WWW] render/components:AdminBar exit preview -> refresh");
|
|
127
|
-
router.refresh();
|
|
128
|
-
},
|
|
129
|
-
style: {
|
|
130
|
-
display: "inline-block",
|
|
131
|
-
padding: "6px 10px",
|
|
132
|
-
borderRadius: 6,
|
|
133
|
-
background: "#111",
|
|
134
|
-
color: "#fff",
|
|
135
|
-
fontSize: 12,
|
|
136
|
-
fontWeight: 600,
|
|
137
|
-
textDecoration: "none"
|
|
138
|
-
},
|
|
139
|
-
children: merged.exitPreview
|
|
140
|
-
})
|
|
141
|
-
]
|
|
142
|
-
})
|
|
143
|
-
})
|
|
144
|
-
]
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
// src/exports/render-components.ts
|
|
149
|
-
var render_components_default = LivePreviewListener;
|
|
150
|
-
export {
|
|
151
|
-
render_components_default as default,
|
|
152
|
-
LivePreviewListener,
|
|
153
|
-
AdminBar
|
|
154
|
-
};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
type ArticleLdOptions = {
|
|
2
|
-
doc: Record<string, any>;
|
|
3
|
-
url: string;
|
|
4
|
-
locale: string;
|
|
5
|
-
siteUrl: string;
|
|
6
|
-
type?: "BlogPosting" | "Article" | "NewsArticle" | "TechArticle";
|
|
7
|
-
publisherName?: string;
|
|
8
|
-
publisherLogo?: string | null;
|
|
9
|
-
};
|
|
10
|
-
declare function buildArticleLd({ doc, url, locale, siteUrl, type, publisherName, publisherLogo }: ArticleLdOptions): Record<string, unknown>;
|
|
11
|
-
type BreadcrumbItem = {
|
|
12
|
-
label: string;
|
|
13
|
-
url: string;
|
|
14
|
-
};
|
|
15
|
-
declare function buildBreadcrumbsLd({ items, currentUrl }: {
|
|
16
|
-
items: BreadcrumbItem[];
|
|
17
|
-
currentUrl: string;
|
|
18
|
-
}): Record<string, unknown>;
|
|
19
|
-
declare function buildOrganizationLd({ siteUrl, name, logo, sameAs }: {
|
|
20
|
-
siteUrl: string;
|
|
21
|
-
name?: string;
|
|
22
|
-
logo?: string;
|
|
23
|
-
sameAs?: string[];
|
|
24
|
-
}): Record<string, unknown>;
|
|
25
|
-
declare function buildHreflangAlternates<L extends string>({ siteUrl, locale, urlPrefix, storedSlug, queryAllLocaleSlugs, nested, homeSlug, defaultLocale, locales, localePrefix }: {
|
|
26
|
-
siteUrl: string;
|
|
27
|
-
locale: L;
|
|
28
|
-
urlPrefix: string;
|
|
29
|
-
storedSlug: string;
|
|
30
|
-
queryAllLocaleSlugs: (slug: string, locale: L) => Promise<Partial<Record<L, string>> | undefined>;
|
|
31
|
-
nested: boolean;
|
|
32
|
-
homeSlug: string;
|
|
33
|
-
defaultLocale: L;
|
|
34
|
-
locales: readonly L[];
|
|
35
|
-
/**
|
|
36
|
-
* Locale prefix mode — mirrors next-intl's `localePrefix` so each
|
|
37
|
-
* alternate URL matches the host's actual route shape:
|
|
38
|
-
*
|
|
39
|
-
* - `'always'`: every URL is prefixed with `/{locale}/…`
|
|
40
|
-
* (e.g. `/en/about`, `/uk/about`). The default — preserves
|
|
41
|
-
* the helper's prior behavior.
|
|
42
|
-
* - `'as-needed'`: the default locale renders without a prefix
|
|
43
|
-
* (e.g. `/about`), other locales are prefixed (`/uk/about`).
|
|
44
|
-
* Critical: callers that emit hreflang alongside a canonical
|
|
45
|
-
* URL built with `as-needed` mode MUST pass this through,
|
|
46
|
-
* otherwise the `en` and `x-default` alternates point to URLs
|
|
47
|
-
* the host doesn't actually serve.
|
|
48
|
-
* - `'never'`: no locale prefix at all.
|
|
49
|
-
*/
|
|
50
|
-
localePrefix?: "always" | "as-needed" | "never";
|
|
51
|
-
}): Promise<Record<string, string>>;
|
|
52
|
-
declare function segmentsToStoredSlug(segments: string[] | string, nested?: boolean): string;
|
|
53
|
-
declare function segmentsToUrlPath(segments: string[] | string, nested?: boolean): string;
|
|
54
|
-
declare function storedSlugToSegments(storedSlug: string, nested?: boolean): string[] | string;
|
|
55
|
-
declare function buildCanonicalUrl<L extends string>({ siteUrl, locale, urlPrefix, urlPath }: {
|
|
56
|
-
siteUrl: string;
|
|
57
|
-
locale: L;
|
|
58
|
-
urlPrefix: string;
|
|
59
|
-
urlPath: string;
|
|
60
|
-
}): string;
|
|
61
|
-
declare function getUrlPath(segments: string[] | string, nested: boolean, homeSlug: string): string;
|
|
62
|
-
import { DataFromCollectionSlug, ImportMap, SanitizedConfig } from "payload";
|
|
63
|
-
declare const queryDocBySlug: <S extends string>({ collectionSlug, slug, slugField, locale, draft, config }: {
|
|
64
|
-
collectionSlug: S;
|
|
65
|
-
slug: string;
|
|
66
|
-
slugField?: string;
|
|
67
|
-
locale: string;
|
|
68
|
-
draft?: boolean;
|
|
69
|
-
config: Promise<SanitizedConfig>;
|
|
70
|
-
}) => Promise<DataFromCollectionSlug<S> | null>;
|
|
71
|
-
declare const queryAllDocs: <S extends string>({ collectionSlug, slugField, locale, config }: {
|
|
72
|
-
collectionSlug: S;
|
|
73
|
-
slugField?: string;
|
|
74
|
-
locale: string;
|
|
75
|
-
config: Promise<SanitizedConfig>;
|
|
76
|
-
}) => Promise<DataFromCollectionSlug<S>[]>;
|
|
77
|
-
declare const queryAllLocaleSlugs2: <S extends string>({ collectionSlug, slug, slugField, locale, config }: {
|
|
78
|
-
collectionSlug: S;
|
|
79
|
-
slug: string;
|
|
80
|
-
slugField?: string;
|
|
81
|
-
locale: string;
|
|
82
|
-
config: Promise<SanitizedConfig>;
|
|
83
|
-
}) => Promise<Record<string, string> | undefined>;
|
|
84
|
-
declare function getRenderModuleExports(exportName: string, collection: {
|
|
85
|
-
custom?: Record<string, unknown>;
|
|
86
|
-
} | undefined, importMap: ImportMap): unknown;
|
|
87
|
-
import { SanitizedConfig as SanitizedConfig_ee8ogz } from "payload";
|
|
88
|
-
import { DataFromCollectionSlug as DataFromCollectionSlug_2e2bqb } from "payload";
|
|
89
|
-
declare const _default: {
|
|
90
|
-
buildArticleLd: typeof buildArticleLd;
|
|
91
|
-
buildBreadcrumbsLd: typeof buildBreadcrumbsLd;
|
|
92
|
-
buildOrganizationLd: typeof buildOrganizationLd;
|
|
93
|
-
buildHreflangAlternates: typeof buildHreflangAlternates;
|
|
94
|
-
queryDocBySlug: <S extends string>({ collectionSlug, slug, slugField, locale, draft, config }: {
|
|
95
|
-
collectionSlug: S;
|
|
96
|
-
slug: string;
|
|
97
|
-
slugField?: string;
|
|
98
|
-
locale: string;
|
|
99
|
-
draft?: boolean;
|
|
100
|
-
config: Promise<SanitizedConfig_ee8ogz>;
|
|
101
|
-
}) => Promise<DataFromCollectionSlug_2e2bqb<S> | null>;
|
|
102
|
-
queryAllDocs: <S extends string>({ collectionSlug, slugField, locale, config }: {
|
|
103
|
-
collectionSlug: S;
|
|
104
|
-
slugField?: string;
|
|
105
|
-
locale: string;
|
|
106
|
-
config: Promise<SanitizedConfig_ee8ogz>;
|
|
107
|
-
}) => Promise<DataFromCollectionSlug_2e2bqb<S>[]>;
|
|
108
|
-
queryAllLocaleSlugs2: <S extends string>({ collectionSlug, slug, slugField, locale, config }: {
|
|
109
|
-
collectionSlug: S;
|
|
110
|
-
slug: string;
|
|
111
|
-
slugField?: string;
|
|
112
|
-
locale: string;
|
|
113
|
-
config: Promise<SanitizedConfig_ee8ogz>;
|
|
114
|
-
}) => Promise<Record<string, string> | undefined>;
|
|
115
|
-
getUrlPath: typeof getUrlPath;
|
|
116
|
-
segmentsToStoredSlug: typeof segmentsToStoredSlug;
|
|
117
|
-
segmentsToUrlPath: typeof segmentsToUrlPath;
|
|
118
|
-
storedSlugToSegments: typeof storedSlugToSegments;
|
|
119
|
-
buildCanonicalUrl: typeof buildCanonicalUrl;
|
|
120
|
-
getRenderModuleExports: typeof getRenderModuleExports;
|
|
121
|
-
};
|
|
122
|
-
export { storedSlugToSegments, segmentsToUrlPath, segmentsToStoredSlug, queryDocBySlug, queryAllLocaleSlugs2 as queryAllLocaleSlugs, queryAllDocs, getUrlPath, getRenderModuleExports, _default as default, buildOrganizationLd, buildHreflangAlternates, buildCanonicalUrl, buildBreadcrumbsLd, buildArticleLd, BreadcrumbItem, ArticleLdOptions };
|