@payloadcms/ui 4.0.0-canary.26 → 4.0.0-canary.28
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/dist/elements/BulkUpload/AddFilesView/index.css +10 -4
- package/dist/elements/BulkUpload/AddFilesView/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/AddFilesView/index.js +71 -51
- package/dist/elements/BulkUpload/AddFilesView/index.js.map +1 -1
- package/dist/elements/Button/index.d.ts.map +1 -1
- package/dist/elements/Button/index.js +2 -0
- package/dist/elements/Button/index.js.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js +10 -3
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +345 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +1 -1
- package/dist/elements/Dropzone/index.css +10 -4
- package/dist/elements/FileManager/index.css +0 -30
- package/dist/elements/FileManager/index.d.ts.map +1 -1
- package/dist/elements/FileManager/index.js +379 -287
- package/dist/elements/FileManager/index.js.map +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts.map +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.js.map +1 -1
- package/dist/elements/Upload/index.css +39 -32
- package/dist/elements/Upload/index.d.ts.map +1 -1
- package/dist/elements/Upload/index.js +37 -99
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/Upload/usePasteFromClipboard.d.ts +14 -0
- package/dist/elements/Upload/usePasteFromClipboard.d.ts.map +1 -0
- package/dist/elements/Upload/usePasteFromClipboard.js +93 -0
- package/dist/elements/Upload/usePasteFromClipboard.js.map +1 -0
- package/dist/elements/Upload/useUploadFromUrl.d.ts +20 -0
- package/dist/elements/Upload/useUploadFromUrl.d.ts.map +1 -0
- package/dist/elements/Upload/useUploadFromUrl.js +201 -0
- package/dist/elements/Upload/useUploadFromUrl.js.map +1 -0
- package/dist/elements/UploadDropzoneContent/index.css +31 -0
- package/dist/elements/UploadDropzoneContent/index.d.ts +17 -0
- package/dist/elements/UploadDropzoneContent/index.d.ts.map +1 -0
- package/dist/elements/UploadDropzoneContent/index.js +62 -0
- package/dist/elements/UploadDropzoneContent/index.js.map +1 -0
- package/dist/elements/WhereBuilder/conditionValue.d.ts +32 -0
- package/dist/elements/WhereBuilder/conditionValue.d.ts.map +1 -0
- package/dist/elements/WhereBuilder/conditionValue.js +32 -0
- package/dist/elements/WhereBuilder/conditionValue.js.map +1 -0
- package/dist/elements/WhereBuilder/conditionValue.spec.js +65 -0
- package/dist/elements/WhereBuilder/conditionValue.spec.js.map +1 -0
- package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/index.js +15 -4
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +26 -0
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/formatMetadata.d.ts.map +1 -1
- package/dist/utilities/formatMetadata.js +0 -5
- package/dist/utilities/formatMetadata.js.map +1 -1
- package/dist/utilities/getFilesFromClipboard.d.ts +10 -0
- package/dist/utilities/getFilesFromClipboard.d.ts.map +1 -0
- package/dist/utilities/getFilesFromClipboard.js +49 -0
- package/dist/utilities/getFilesFromClipboard.js.map +1 -0
- package/dist/utilities/slugify.d.ts.map +1 -1
- package/dist/utilities/slugify.js +1 -0
- package/dist/utilities/slugify.js.map +1 -1
- package/dist/views/Root/getCustomCollectionViewByRoute.d.ts.map +1 -1
- package/dist/views/Root/getCustomCollectionViewByRoute.js.map +1 -1
- package/dist/views/Root/getCustomGlobalViewByRoute.d.ts.map +1 -1
- package/dist/views/Root/getCustomGlobalViewByRoute.js.map +1 -1
- package/dist/views/Root/getCustomViewByKey.d.ts.map +1 -1
- package/dist/views/Root/getCustomViewByKey.js.map +1 -1
- package/dist/views/Version/generateVersionViewMetadata.js.map +1 -1
- package/dist/views/Versions/generateVersionsViewMetadata.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatMetadata.d.ts","sourceRoot":"","sources":["../../src/utilities/formatMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AA4DzC,eAAO,MAAM,cAAc,SACnB;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,KACxC,OAAO,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"formatMetadata.d.ts","sourceRoot":"","sources":["../../src/utilities/formatMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AA4DzC,eAAO,MAAM,cAAc,SACnB;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,KACxC,OAAO,CAAC,UAAU,CAqFpB,CAAA"}
|
|
@@ -47,11 +47,6 @@ export const formatMetadata = async args => {
|
|
|
47
47
|
titleSuffix,
|
|
48
48
|
...rest
|
|
49
49
|
} = args;
|
|
50
|
-
/**
|
|
51
|
-
* @todo find a way to remove the type assertion here.
|
|
52
|
-
* It is a result of needing to `DeepCopy` the `MetaConfig` type from Payload.
|
|
53
|
-
* This is required for the `DeepRequired` from `Config` to `SanitizedConfig`.
|
|
54
|
-
*/
|
|
55
50
|
const incomingMetadata = rest;
|
|
56
51
|
const faviconDark = payloadFaviconDark;
|
|
57
52
|
const faviconLight = payloadFaviconLight;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatMetadata.js","names":["qs","payloadFaviconDark","payloadFaviconLight","staticOGImage","appendTitleSuffix","title","suffix","undefined","default","template","absolute","getTitleString","defaultOpenGraph","description","siteName","formatMetadata","args","defaultOGImageType","serverURL","titleSuffix","rest","incomingMetadata","faviconDark","faviconLight","ogImage","icons","type","rel","sizes","url","src","media","metaTitle","titleStringForOg","openGraph","ogTitle","filter","Boolean","join","mergedOpenGraph","images","alt","height","stringify","addQueryPrefix","width","Promise","resolve","metadataBase","URL","process","env","PAYLOAD_PUBLIC_SERVER_URL","PORT"],"sources":["../../src/utilities/formatMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport * as qs from 'qs-esm'\n\nimport { payloadFaviconDark, payloadFaviconLight, staticOGImage } from '../assets/index.js'\n\n// Replicates the Icon type structure from next/dist/lib/metadata/types/metadata-types\ntype Icon = {\n media?: string\n rel?: string\n sizes?: string\n type?: string\n url: string\n}\n\nconst appendTitleSuffix = (\n title: MetaConfig['title'],\n suffix: string | undefined,\n): MetaConfig['title'] => {\n if (!suffix || !title) {\n return title ?? undefined\n }\n if (typeof title === 'string') {\n return `${title} ${suffix}`\n }\n\n if ('default' in title) {\n return { default: `${title.default} ${suffix}`, template: `${title.template} ${suffix}` }\n }\n\n if ('template' in title) {\n return {\n absolute: `${title.absolute} ${suffix}`,\n template: title.template !== null ? `${title.template} ${suffix}` : null,\n }\n }\n\n return { absolute: `${title.absolute} ${suffix}` }\n}\n\nconst getTitleString = (title: MetaConfig['title']): string | undefined => {\n if (!title) {\n return undefined\n }\n if (typeof title === 'string') {\n return title\n }\n if ('absolute' in title) {\n return title.absolute\n }\n return title.default\n}\n\nconst defaultOpenGraph: MetaConfig['openGraph'] = {\n description:\n 'Payload is a headless CMS and application framework built with TypeScript, Node.js, and React.',\n siteName: 'Payload App',\n title: 'Payload App',\n}\n\nexport const formatMetadata = async (\n args: { serverURL?: string } & MetaConfig,\n): Promise<MetaConfig> => {\n const { defaultOGImageType, serverURL, titleSuffix, ...rest } = args\n
|
|
1
|
+
{"version":3,"file":"formatMetadata.js","names":["qs","payloadFaviconDark","payloadFaviconLight","staticOGImage","appendTitleSuffix","title","suffix","undefined","default","template","absolute","getTitleString","defaultOpenGraph","description","siteName","formatMetadata","args","defaultOGImageType","serverURL","titleSuffix","rest","incomingMetadata","faviconDark","faviconLight","ogImage","icons","type","rel","sizes","url","src","media","metaTitle","titleStringForOg","openGraph","ogTitle","filter","Boolean","join","mergedOpenGraph","images","alt","height","stringify","addQueryPrefix","width","Promise","resolve","metadataBase","URL","process","env","PAYLOAD_PUBLIC_SERVER_URL","PORT"],"sources":["../../src/utilities/formatMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport * as qs from 'qs-esm'\n\nimport { payloadFaviconDark, payloadFaviconLight, staticOGImage } from '../assets/index.js'\n\n// Replicates the Icon type structure from next/dist/lib/metadata/types/metadata-types\ntype Icon = {\n media?: string\n rel?: string\n sizes?: string\n type?: string\n url: string\n}\n\nconst appendTitleSuffix = (\n title: MetaConfig['title'],\n suffix: string | undefined,\n): MetaConfig['title'] => {\n if (!suffix || !title) {\n return title ?? undefined\n }\n if (typeof title === 'string') {\n return `${title} ${suffix}`\n }\n\n if ('default' in title) {\n return { default: `${title.default} ${suffix}`, template: `${title.template} ${suffix}` }\n }\n\n if ('template' in title) {\n return {\n absolute: `${title.absolute} ${suffix}`,\n template: title.template !== null ? `${title.template} ${suffix}` : null,\n }\n }\n\n return { absolute: `${title.absolute} ${suffix}` }\n}\n\nconst getTitleString = (title: MetaConfig['title']): string | undefined => {\n if (!title) {\n return undefined\n }\n if (typeof title === 'string') {\n return title\n }\n if ('absolute' in title) {\n return title.absolute\n }\n return title.default\n}\n\nconst defaultOpenGraph: MetaConfig['openGraph'] = {\n description:\n 'Payload is a headless CMS and application framework built with TypeScript, Node.js, and React.',\n siteName: 'Payload App',\n title: 'Payload App',\n}\n\nexport const formatMetadata = async (\n args: { serverURL?: string } & MetaConfig,\n): Promise<MetaConfig> => {\n const { defaultOGImageType, serverURL, titleSuffix, ...rest } = args\n const incomingMetadata: MetaConfig = rest\n\n const faviconDark = payloadFaviconDark as { src: string } | string\n const faviconLight = payloadFaviconLight as { src: string } | string\n const ogImage = staticOGImage as { src: string } | string\n\n const icons: MetaConfig['icons'] =\n incomingMetadata.icons ||\n ([\n {\n type: 'image/png',\n rel: 'icon',\n sizes: '32x32',\n url: typeof faviconDark === 'object' ? faviconDark.src : faviconDark,\n },\n {\n type: 'image/png',\n media: '(prefers-color-scheme: dark)',\n rel: 'icon',\n sizes: '32x32',\n url: typeof faviconLight === 'object' ? faviconLight.src : faviconLight,\n },\n ] satisfies Array<Icon>)\n\n const metaTitle: MetaConfig['title'] = appendTitleSuffix(incomingMetadata.title, titleSuffix)\n\n const titleStringForOg: string | undefined =\n typeof incomingMetadata.openGraph?.title === 'string'\n ? incomingMetadata.openGraph.title\n : getTitleString(incomingMetadata.title)\n\n const ogTitle = [titleStringForOg, titleSuffix].filter(Boolean).join(' ')\n\n const mergedOpenGraph: MetaConfig['openGraph'] = {\n ...(defaultOpenGraph || {}),\n ...(defaultOGImageType === 'dynamic'\n ? {\n images: [\n {\n alt: ogTitle,\n height: 630,\n url: `/api/og${qs.stringify(\n {\n description:\n incomingMetadata.openGraph?.description || defaultOpenGraph.description,\n title: ogTitle,\n },\n {\n addQueryPrefix: true,\n },\n )}`,\n width: 1200,\n },\n ],\n }\n : {}),\n ...(defaultOGImageType === 'static'\n ? {\n images: [\n {\n alt: ogTitle,\n height: 480,\n url: typeof ogImage === 'object' ? ogImage.src : ogImage,\n width: 640,\n },\n ],\n }\n : {}),\n title: ogTitle,\n ...(incomingMetadata.openGraph || {}),\n }\n\n return Promise.resolve({\n ...incomingMetadata,\n icons,\n metadataBase: new URL(\n serverURL ||\n process.env.PAYLOAD_PUBLIC_SERVER_URL ||\n `http://localhost:${process.env.PORT || 3000}`,\n ),\n openGraph: mergedOpenGraph,\n title: metaTitle,\n })\n}\n"],"mappings":"AAEA,YAAYA,EAAA,MAAQ;AAEpB,SAASC,kBAAkB,EAAEC,mBAAmB,EAAEC,aAAa,QAAQ;AAWvE,MAAMC,iBAAA,GAAoBA,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AA,KAAuB,WACvB;MACEuB,MAAA,EAAQ,CACN;QACEC,GAAA,EAAKN,OAAA;QACLO,MAAA,EAAQ;QACRb,GAAA,EAAK,OAAOL,OAAA,KAAY,WAAWA,OAAA,CAAQM,GAAG,GAAGN,OAAA;QACjDqB,KAAA,EAAO;MACT;IAEJ,IACA,CAAC,CAAC;IACNxC,KAAA,EAAO8B,OAAA;IACP,IAAId,gBAAA,CAAiBa,SAAS,IAAI,CAAC,CAAC;EACtC;EAEA,OAAOY,OAAA,CAAQC,OAAO,CAAC;IACrB,GAAG1B,gBAAgB;IACnBI,KAAA;IACAuB,YAAA,EAAc,IAAIC,GAAA,CAChB/B,SAAA,IACEgC,OAAA,CAAQC,GAAG,CAACC,yBAAyB,IACrC,oBAAoBF,OAAA,CAAQC,GAAG,CAACE,IAAI,IAAI,MAAM;IAElDnB,SAAA,EAAWK,eAAA;IACXlC,KAAA,EAAO2B;EACT;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ClipboardPasteResult = {
|
|
2
|
+
files: FileList;
|
|
3
|
+
type: 'file';
|
|
4
|
+
} | {
|
|
5
|
+
type: 'url';
|
|
6
|
+
url: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const getFilesFromClipboard: () => Promise<FileList | null>;
|
|
9
|
+
export declare const getFileOrUrlFromClipboard: () => Promise<ClipboardPasteResult | null>;
|
|
10
|
+
//# sourceMappingURL=getFilesFromClipboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFilesFromClipboard.d.ts","sourceRoot":"","sources":["../../src/utilities/getFilesFromClipboard.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AA6CnG,eAAO,MAAM,qBAAqB,QAAa,OAAO,CAAC,QAAQ,GAAG,IAAI,CAGrE,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,oBAAoB,GAAG,IAAI,CACrE,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const readClipboard = async () => {
|
|
2
|
+
if (!navigator.clipboard?.read) {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
const clipboardItems = await navigator.clipboard.read();
|
|
6
|
+
const dataTransfer = new DataTransfer();
|
|
7
|
+
// Real OS-level copies (address bar, "copy link", browser context menus) often expose the
|
|
8
|
+
// same URL under several text representations (text/plain, text/uri-list, text/html) rather
|
|
9
|
+
// than a single clean 'text/plain' entry, so every text/* type is a candidate.
|
|
10
|
+
const textCandidates = [];
|
|
11
|
+
for (const clipboardItem of clipboardItems) {
|
|
12
|
+
for (const type of clipboardItem.types) {
|
|
13
|
+
if (type.startsWith('text/')) {
|
|
14
|
+
const textBlob = await clipboardItem.getType(type);
|
|
15
|
+
const text = (await textBlob.text()).trim();
|
|
16
|
+
if (text) {
|
|
17
|
+
textCandidates.push(text);
|
|
18
|
+
}
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const blob = await clipboardItem.getType(type);
|
|
22
|
+
const extension = type.split('/')[1] ?? 'bin';
|
|
23
|
+
const filename = `clipboard-${dataTransfer.items.length + 1}.${extension}`;
|
|
24
|
+
dataTransfer.items.add(new File([blob], filename, {
|
|
25
|
+
type
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (dataTransfer.files.length > 0) {
|
|
30
|
+
return {
|
|
31
|
+
type: 'file',
|
|
32
|
+
files: dataTransfer.files
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const urlCandidate = textCandidates.find(text => URL.canParse(text));
|
|
36
|
+
if (urlCandidate) {
|
|
37
|
+
return {
|
|
38
|
+
type: 'url',
|
|
39
|
+
url: urlCandidate
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
};
|
|
44
|
+
export const getFilesFromClipboard = async () => {
|
|
45
|
+
const result = await readClipboard();
|
|
46
|
+
return result?.type === 'file' ? result.files : null;
|
|
47
|
+
};
|
|
48
|
+
export const getFileOrUrlFromClipboard = async () => readClipboard();
|
|
49
|
+
//# sourceMappingURL=getFilesFromClipboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFilesFromClipboard.js","names":["readClipboard","navigator","clipboard","read","clipboardItems","dataTransfer","DataTransfer","textCandidates","clipboardItem","type","types","startsWith","textBlob","getType","text","trim","push","blob","extension","split","filename","items","length","add","File","files","urlCandidate","find","URL","canParse","url","getFilesFromClipboard","result","getFileOrUrlFromClipboard"],"sources":["../../src/utilities/getFilesFromClipboard.ts"],"sourcesContent":["export type ClipboardPasteResult = { files: FileList; type: 'file' } | { type: 'url'; url: string }\n\nconst readClipboard = async (): Promise<ClipboardPasteResult | null> => {\n if (!navigator.clipboard?.read) {\n return null\n }\n\n const clipboardItems = await navigator.clipboard.read()\n const dataTransfer = new DataTransfer()\n // Real OS-level copies (address bar, \"copy link\", browser context menus) often expose the\n // same URL under several text representations (text/plain, text/uri-list, text/html) rather\n // than a single clean 'text/plain' entry, so every text/* type is a candidate.\n const textCandidates: string[] = []\n\n for (const clipboardItem of clipboardItems) {\n for (const type of clipboardItem.types) {\n if (type.startsWith('text/')) {\n const textBlob = await clipboardItem.getType(type)\n const text = (await textBlob.text()).trim()\n if (text) {\n textCandidates.push(text)\n }\n continue\n }\n\n const blob = await clipboardItem.getType(type)\n const extension = type.split('/')[1] ?? 'bin'\n const filename = `clipboard-${dataTransfer.items.length + 1}.${extension}`\n\n dataTransfer.items.add(new File([blob], filename, { type }))\n }\n }\n\n if (dataTransfer.files.length > 0) {\n return { type: 'file', files: dataTransfer.files }\n }\n\n const urlCandidate = textCandidates.find((text) => URL.canParse(text))\n if (urlCandidate) {\n return { type: 'url', url: urlCandidate }\n }\n\n return null\n}\n\nexport const getFilesFromClipboard = async (): Promise<FileList | null> => {\n const result = await readClipboard()\n return result?.type === 'file' ? result.files : null\n}\n\nexport const getFileOrUrlFromClipboard = async (): Promise<ClipboardPasteResult | null> =>\n readClipboard()\n"],"mappings":"AAEA,MAAMA,aAAA,GAAgB,MAAAA,CAAA;EACpB,IAAI,CAACC,SAAA,CAAUC,SAAS,EAAEC,IAAA,EAAM;IAC9B,OAAO;EACT;EAEA,MAAMC,cAAA,GAAiB,MAAMH,SAAA,CAAUC,SAAS,CAACC,IAAI;EACrD,MAAME,YAAA,GAAe,IAAIC,YAAA;EACzB;EACA;EACA;EACA,MAAMC,cAAA,GAA2B,EAAE;EAEnC,KAAK,MAAMC,aAAA,IAAiBJ,cAAA,EAAgB;IAC1C,KAAK,MAAMK,IAAA,IAAQD,aAAA,CAAcE,KAAK,EAAE;MACtC,IAAID,IAAA,CAAKE,UAAU,CAAC,UAAU;QAC5B,MAAMC,QAAA,GAAW,MAAMJ,aAAA,CAAcK,OAAO,CAACJ,IAAA;QAC7C,MAAMK,IAAA,GAAO,CAAC,MAAMF,QAAA,CAASE,IAAI,EAAC,EAAGC,IAAI;QACzC,IAAID,IAAA,EAAM;UACRP,cAAA,CAAeS,IAAI,CAACF,IAAA;QACtB;QACA;MACF;MAEA,MAAMG,IAAA,GAAO,MAAMT,aAAA,CAAcK,OAAO,CAACJ,IAAA;MACzC,MAAMS,SAAA,GAAYT,IAAA,CAAKU,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI;MACxC,MAAMC,QAAA,GAAW,aAAaf,YAAA,CAAagB,KAAK,CAACC,MAAM,GAAG,KAAKJ,SAAA,EAAW;MAE1Eb,YAAA,CAAagB,KAAK,CAACE,GAAG,CAAC,IAAIC,IAAA,CAAK,CAACP,IAAA,CAAK,EAAEG,QAAA,EAAU;QAAEX;MAAK;IAC3D;EACF;EAEA,IAAIJ,YAAA,CAAaoB,KAAK,CAACH,MAAM,GAAG,GAAG;IACjC,OAAO;MAAEb,IAAA,EAAM;MAAQgB,KAAA,EAAOpB,YAAA,CAAaoB;IAAM;EACnD;EAEA,MAAMC,YAAA,GAAenB,cAAA,CAAeoB,IAAI,CAAEb,IAAA,IAASc,GAAA,CAAIC,QAAQ,CAACf,IAAA;EAChE,IAAIY,YAAA,EAAc;IAChB,OAAO;MAAEjB,IAAA,EAAM;MAAOqB,GAAA,EAAKJ;IAAa;EAC1C;EAEA,OAAO;AACT;AAEA,OAAO,MAAMK,qBAAA,GAAwB,MAAAA,CAAA;EACnC,MAAMC,MAAA,GAAS,MAAMhC,aAAA;EACrB,OAAOgC,MAAA,EAAQvB,IAAA,KAAS,SAASuB,MAAA,CAAOP,KAAK,GAAG;AAClD;AAEA,OAAO,MAAMQ,yBAAA,GAA4B,MAAAA,CAAA,KACvCjC,aAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../src/utilities/slugify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAE/B,MAAM,SAAS,CAAA;AAGhB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CACzC,yBAAyB,EACzB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../src/utilities/slugify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAE/B,MAAM,SAAS,CAAA;AAGhB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CACzC,yBAAyB,EACzB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAqF7B,CAAA"}
|
|
@@ -53,6 +53,7 @@ export const slugifyHandler = async args => {
|
|
|
53
53
|
// a row-filtered (`Where`) result is treated as not allowed, since scoping the probe to readable
|
|
54
54
|
// rows would break uniqueness.
|
|
55
55
|
const canRead = await executeAccess({
|
|
56
|
+
slug: collectionConfig.slug,
|
|
56
57
|
disableErrors: true,
|
|
57
58
|
req
|
|
58
59
|
}, collectionConfig.access.read);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slugify.js","names":["executeAccess","getFieldByPath","getSlugFallbackValue","getUniqueFieldValue","hasDraftsEnabled","UnauthorizedError","slugify","defaultSlugify","slugifyHandler","args","id","collectionSlug","data","globalSlug","locale","path","req","valueToSlugify","user","docConfig","payload","collections","config","globals","find","g","slug","Error","field","fields","flattenedFields","customSlugify","custom","undefined","result","collectionConfig","type","canRead","disableErrors","access","read","localeToScope","localized","excludeId","collection","draftsEnabled","name","value"],"sources":["../../src/utilities/slugify.ts"],"sourcesContent":["import type { Slugify } from 'payload/shared'\n\nimport {\n executeAccess,\n getFieldByPath,\n getSlugFallbackValue,\n getUniqueFieldValue,\n hasDraftsEnabled,\n type ServerFunction,\n type SlugifyServerFunctionArgs,\n UnauthorizedError,\n} from 'payload'\nimport { slugify as defaultSlugify } from 'payload/shared'\n\n/**\n * This server function is directly related to the {@link https://payloadcms.com/docs/fields/slug | Slug Field}.\n * This is a server function that is used to invoke the user's custom slugify function from the client.\n * This pattern is required, as there is no other way for us to pass their function across the client-server boundary.\n * - Not through props\n * - Not from a server function defined within a server component (see below)\n * When a server function contains non-serializable data within its closure, it gets passed through the boundary (and breaks).\n * The only way to pass server functions to the client (that contain non-serializable data) is if it is globally defined.\n * But we also cannot define this function alongside the server component, as we will not have access to their custom slugify function.\n * See `ServerFunctionsProvider` for more details.\n */\nexport const slugifyHandler: ServerFunction<\n SlugifyServerFunctionArgs,\n Promise<ReturnType<Slugify>>\n> = async (args) => {\n const { id, collectionSlug, data, globalSlug, locale, path, req, valueToSlugify } = args\n\n if (!req.user) {\n throw new UnauthorizedError()\n }\n\n const docConfig = collectionSlug\n ? req.payload.collections[collectionSlug]?.config\n : globalSlug\n ? req.payload.config.globals.find((g) => g.slug === globalSlug)\n : null\n\n if (!docConfig) {\n throw new Error()\n }\n\n const { field } = getFieldByPath({\n config: req.payload.config,\n fields: docConfig.flattenedFields,\n path,\n })\n\n const customSlugify = (\n typeof field?.custom?.slugify === 'function' ? field.custom.slugify : undefined\n ) as Slugify\n\n const slugify = (valueToSlugify: unknown) =>\n customSlugify\n ? customSlugify({ data, req, valueToSlugify })\n : defaultSlugify(valueToSlugify as string)\n\n const result = await slugify(valueToSlugify)\n\n const collectionConfig = collectionSlug ? req.payload.collections[collectionSlug]?.config : null\n\n // Uniqueness dedupe only applies to a collection's slug field. Globals have no collection to\n // dedupe against, so their result is returned as-is.\n if (!collectionConfig || !field || field.type !== 'slug' || !('name' in field)) {\n return result\n }\n\n // Probing reads across the whole collection with the raw db, so require unrestricted read access —\n // a row-filtered (`Where`) result is treated as not allowed, since scoping the probe to readable\n // rows would break uniqueness.\n const canRead = await executeAccess({ disableErrors: true, req }
|
|
1
|
+
{"version":3,"file":"slugify.js","names":["executeAccess","getFieldByPath","getSlugFallbackValue","getUniqueFieldValue","hasDraftsEnabled","UnauthorizedError","slugify","defaultSlugify","slugifyHandler","args","id","collectionSlug","data","globalSlug","locale","path","req","valueToSlugify","user","docConfig","payload","collections","config","globals","find","g","slug","Error","field","fields","flattenedFields","customSlugify","custom","undefined","result","collectionConfig","type","canRead","disableErrors","access","read","localeToScope","localized","excludeId","collection","draftsEnabled","name","value"],"sources":["../../src/utilities/slugify.ts"],"sourcesContent":["import type { Slugify } from 'payload/shared'\n\nimport {\n executeAccess,\n getFieldByPath,\n getSlugFallbackValue,\n getUniqueFieldValue,\n hasDraftsEnabled,\n type ServerFunction,\n type SlugifyServerFunctionArgs,\n UnauthorizedError,\n} from 'payload'\nimport { slugify as defaultSlugify } from 'payload/shared'\n\n/**\n * This server function is directly related to the {@link https://payloadcms.com/docs/fields/slug | Slug Field}.\n * This is a server function that is used to invoke the user's custom slugify function from the client.\n * This pattern is required, as there is no other way for us to pass their function across the client-server boundary.\n * - Not through props\n * - Not from a server function defined within a server component (see below)\n * When a server function contains non-serializable data within its closure, it gets passed through the boundary (and breaks).\n * The only way to pass server functions to the client (that contain non-serializable data) is if it is globally defined.\n * But we also cannot define this function alongside the server component, as we will not have access to their custom slugify function.\n * See `ServerFunctionsProvider` for more details.\n */\nexport const slugifyHandler: ServerFunction<\n SlugifyServerFunctionArgs,\n Promise<ReturnType<Slugify>>\n> = async (args) => {\n const { id, collectionSlug, data, globalSlug, locale, path, req, valueToSlugify } = args\n\n if (!req.user) {\n throw new UnauthorizedError()\n }\n\n const docConfig = collectionSlug\n ? req.payload.collections[collectionSlug]?.config\n : globalSlug\n ? req.payload.config.globals.find((g) => g.slug === globalSlug)\n : null\n\n if (!docConfig) {\n throw new Error()\n }\n\n const { field } = getFieldByPath({\n config: req.payload.config,\n fields: docConfig.flattenedFields,\n path,\n })\n\n const customSlugify = (\n typeof field?.custom?.slugify === 'function' ? field.custom.slugify : undefined\n ) as Slugify\n\n const slugify = (valueToSlugify: unknown) =>\n customSlugify\n ? customSlugify({ data, req, valueToSlugify })\n : defaultSlugify(valueToSlugify as string)\n\n const result = await slugify(valueToSlugify)\n\n const collectionConfig = collectionSlug ? req.payload.collections[collectionSlug]?.config : null\n\n // Uniqueness dedupe only applies to a collection's slug field. Globals have no collection to\n // dedupe against, so their result is returned as-is.\n if (!collectionConfig || !field || field.type !== 'slug' || !('name' in field)) {\n return result\n }\n\n // Probing reads across the whole collection with the raw db, so require unrestricted read access —\n // a row-filtered (`Where`) result is treated as not allowed, since scoping the probe to readable\n // rows would break uniqueness.\n const canRead = await executeAccess(\n { slug: collectionConfig.slug, disableErrors: true, req },\n collectionConfig.access.read,\n )\n\n if (canRead !== true) {\n return result\n }\n\n // A localized slug is unique per-locale, so scope the probe to the current locale — otherwise it\n // dedupes against the default locale and can hand back a colliding value. The client passes the\n // active admin locale; fall back to the request's own locale.\n const localeToScope = field.localized ? (locale ?? req.locale ?? undefined) : undefined\n\n // The current doc is excluded so a regenerate can reuse its own value rather than bump past it.\n const excludeId = typeof id === 'string' || typeof id === 'number' ? id : undefined\n\n // A source resolved to a value: dedupe it the same way the next save would, so the generate button\n // can't hand back a slug that's already taken. With no source, return the `<singular>-N` fallback.\n if (result) {\n return getUniqueFieldValue({\n id: excludeId,\n collection: collectionConfig.slug,\n draftsEnabled: hasDraftsEnabled(collectionConfig),\n field: field.name,\n locale: localeToScope,\n req,\n value: result,\n })\n }\n\n return getSlugFallbackValue({\n id: excludeId,\n collection: collectionConfig,\n field: field.name,\n locale: localeToScope,\n req,\n slugify,\n })\n}\n"],"mappings":"AAEA,SACEA,aAAa,EACbC,cAAc,EACdC,oBAAoB,EACpBC,mBAAmB,EACnBC,gBAAgB,EAGhBC,iBAAiB,QACZ;AACP,SAASC,OAAA,IAAWC,cAAc,QAAQ;AAE1C;;;;;;;;;;;AAWA,OAAO,MAAMC,cAAA,GAGT,MAAOC,IAAA;EACT,MAAM;IAAEC,EAAE;IAAEC,cAAc;IAAEC,IAAI;IAAEC,UAAU;IAAEC,MAAM;IAAEC,IAAI;IAAEC,GAAG;IAAEC;EAAc,CAAE,GAAGR,IAAA;EAEpF,IAAI,CAACO,GAAA,CAAIE,IAAI,EAAE;IACb,MAAM,IAAIb,iBAAA;EACZ;EAEA,MAAMc,SAAA,GAAYR,cAAA,GACdK,GAAA,CAAII,OAAO,CAACC,WAAW,CAACV,cAAA,CAAe,EAAEW,MAAA,GACzCT,UAAA,GACEG,GAAA,CAAII,OAAO,CAACE,MAAM,CAACC,OAAO,CAACC,IAAI,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAKb,UAAA,IAClD;EAEN,IAAI,CAACM,SAAA,EAAW;IACd,MAAM,IAAIQ,KAAA;EACZ;EAEA,MAAM;IAAEC;EAAK,CAAE,GAAG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MACzBO,EAAA,EAAIiC,SAAA;MACJC,UAAA,EAAYT,gBAAA,CAAiBT,IAAI;MACjCmB,aAAA,EAAezC,gBAAA,CAAiB+B,gBAAA;MAChCP,KAAA,EAAOA,KAAA,CAAMkB,IAAI;MACjBhC,MAAA,EAAQ2B,aAAA;MACRzB,GAAA;MACA+B,KAAA,EAAOb;IACT;EACF;EAEA,OAAOhC,oBAAA,CAAqB;IAC1BQ,EAAA,EAAIiC,SAAA;IACJC,UAAA,EAAYT,gBAAA;IACZP,KAAA,EAAOA,KAAA,CAAMkB,IAAI;IACjBhC,MAAA,EAAQ2B,aAAA;IACRzB,GAAA;IACAV;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomCollectionViewByRoute.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomCollectionViewByRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getCustomCollectionViewByRoute.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomCollectionViewByRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAI/D,eAAO,MAAM,8BAA8B,2EAKxC;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAA;CACjE,KAAG;IACF,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,IAAI,GAAG,MAAM,CAAA;CA0DvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomCollectionViewByRoute.js","names":["isPathMatchingRoute","getCustomCollectionViewByRoute","adminRoute","baseRoute","currentRoute","currentRouteWithAdmin","views","startsWith","slice","length","foundEntry","Object","entries","find","key","view","isAdminViewConfig","path","adminView","viewPath","exact","sensitive","strict","viewKey","foundViewConfig","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomCollectionViewByRoute.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"getCustomCollectionViewByRoute.js","names":["isPathMatchingRoute","getCustomCollectionViewByRoute","adminRoute","baseRoute","currentRoute","currentRouteWithAdmin","views","startsWith","slice","length","foundEntry","Object","entries","find","key","view","isAdminViewConfig","path","adminView","viewPath","exact","sensitive","strict","viewKey","foundViewConfig","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomCollectionViewByRoute.ts"],"sourcesContent":["import type { AdminViewConfig, SanitizedCollectionConfig } from 'payload'\n\nimport type { ViewFromConfig } from './getCustomViewByRoute.js'\n\nimport { isPathMatchingRoute } from '../../utilities/isPathMatchingRoute.js'\n\nexport const getCustomCollectionViewByRoute = ({\n adminRoute,\n baseRoute,\n currentRoute: currentRouteWithAdmin,\n views,\n}: {\n adminRoute: string\n baseRoute: string\n currentRoute: string\n views: SanitizedCollectionConfig['admin']['components']['views']\n}): {\n view: ViewFromConfig\n viewKey: null | string\n} => {\n const currentRoute =\n adminRoute === '/'\n ? currentRouteWithAdmin\n : currentRouteWithAdmin.startsWith(adminRoute)\n ? currentRouteWithAdmin.slice(adminRoute.length)\n : currentRouteWithAdmin\n\n if (views && typeof views === 'object') {\n const foundEntry = Object.entries(views).find(([key, view]) => {\n // Skip the known collection view types: edit and list\n if (key === 'edit' || key === 'list') {\n return false\n }\n\n // Type guard: custom views should be AdminViewConfig with path and Component\n const isAdminViewConfig =\n typeof view === 'object' &&\n view !== null &&\n 'path' in view &&\n 'Component' in view &&\n typeof view.path === 'string'\n\n if (isAdminViewConfig) {\n const adminView = view as AdminViewConfig\n const viewPath = `${baseRoute}${adminView.path}`\n\n return isPathMatchingRoute({\n currentRoute,\n exact: adminView.exact,\n path: viewPath,\n sensitive: adminView.sensitive,\n strict: adminView.strict,\n })\n }\n\n return false\n })\n\n if (foundEntry) {\n const [viewKey, foundViewConfig] = foundEntry\n const adminView = foundViewConfig as AdminViewConfig\n return {\n view: {\n payloadComponent: adminView.Component,\n },\n viewKey,\n }\n }\n }\n\n return {\n view: {\n Component: null,\n },\n viewKey: null,\n }\n}\n"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ;AAEpC,OAAO,MAAMC,8BAAA,GAAiCA,CAAC;EAC7CC,UAAU;EACVC,SAAS;EACTC,YAAA,EAAcC,qBAAqB;EACnCC;AAAK,CAMN;EAIC,MAAMF,YAAA,GACJF,UAAA,KAAe,MACXG,qBAAA,GACAA,qBAAA,CAAsBE,UAAU,CAACL,UAAA,IAC/BG,qBAAA,CAAsBG,KAAK,CAACN,UAAA,CAAWO,MAAM,IAC7CJ,qBAAA;EAER,IAAIC,KAAA,IAAS,OAAOA,KAAA,KAAU,UAAU;IACtC,MAAMI,UAAA,GAAaC,MAAA,CAAOC,OAAO,CAACN,KAAA,EAAOO,IAAI,CAAC,CAAC,CAACC,GAAA,EAAKC,IAAA,CAAK;MACxD;MACA,IAAID,GAAA,KAAQ,UAAUA,GAAA,KAAQ,QAAQ;QACpC,OAAO;MACT;MAEA;MACA,MAAME,iBAAA,GACJ,OAAOD,IAAA,KAAS,YAChBA,IAAA,KAAS,QACT,UAAUA,IAAA,IACV,eAAeA,IAAA,IACf,OAAOA,IAAA,CAAKE,IAAI,KAAK;MAEvB,IAAID,iBAAA,EAAmB;QACrB,MAAME,SAAA,GAAYH,IAAA;QAClB,MAAMI,QAAA,GAAW,GAAGhB,SAAA,GAAYe,SAAA,CAAUD,IAAI,EAAE;QAEhD,OAAOjB,mBAAA,CAAoB;UACzBI,YAAA;UACAgB,KAAA,EAAOF,SAAA,CAAUE,KAAK;UACtBH,IAAA,EAAME,QAAA;UACNE,SAAA,EAAWH,SAAA,CAAUG,SAAS;UAC9BC,MAAA,EAAQJ,SAAA,CAAUI;QACpB;MACF;MAEA,OAAO;IACT;IAEA,IAAIZ,UAAA,EAAY;MACd,MAAM,CAACa,OAAA,EAASC,eAAA,CAAgB,GAAGd,UAAA;MACnC,MAAMQ,SAAA,GAAYM,eAAA;MAClB,OAAO;QACLT,IAAA,EAAM;UACJU,gBAAA,EAAkBP,SAAA,CAAUQ;QAC9B;QACAH;MACF;IACF;EACF;EAEA,OAAO;IACLR,IAAA,EAAM;MACJW,SAAA,EAAW;IACb;IACAH,OAAA,EAAS;EACX;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomGlobalViewByRoute.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomGlobalViewByRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getCustomGlobalViewByRoute.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomGlobalViewByRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAI/D,eAAO,MAAM,0BAA0B,2EAKpC;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAA;CAC7D,KAAG;IACF,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,IAAI,GAAG,MAAM,CAAA;CAwDvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomGlobalViewByRoute.js","names":["isPathMatchingRoute","getCustomGlobalViewByRoute","adminRoute","baseRoute","currentRoute","currentRouteWithAdmin","views","startsWith","slice","length","foundEntry","Object","entries","find","key","view","isAdminViewConfig","path","adminView","viewPath","exact","sensitive","strict","viewKey","foundViewConfig","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomGlobalViewByRoute.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"getCustomGlobalViewByRoute.js","names":["isPathMatchingRoute","getCustomGlobalViewByRoute","adminRoute","baseRoute","currentRoute","currentRouteWithAdmin","views","startsWith","slice","length","foundEntry","Object","entries","find","key","view","isAdminViewConfig","path","adminView","viewPath","exact","sensitive","strict","viewKey","foundViewConfig","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomGlobalViewByRoute.ts"],"sourcesContent":["import type { AdminViewConfig, SanitizedGlobalConfig } from 'payload'\n\nimport type { ViewFromConfig } from './getCustomViewByRoute.js'\n\nimport { isPathMatchingRoute } from '../../utilities/isPathMatchingRoute.js'\n\nexport const getCustomGlobalViewByRoute = ({\n adminRoute,\n baseRoute,\n currentRoute: currentRouteWithAdmin,\n views,\n}: {\n adminRoute: string\n baseRoute: string\n currentRoute: string\n views: SanitizedGlobalConfig['admin']['components']['views']\n}): {\n view: ViewFromConfig\n viewKey: null | string\n} => {\n const currentRoute =\n adminRoute === '/'\n ? currentRouteWithAdmin\n : currentRouteWithAdmin.startsWith(adminRoute)\n ? currentRouteWithAdmin.slice(adminRoute.length)\n : currentRouteWithAdmin\n\n if (views && typeof views === 'object') {\n const foundEntry = Object.entries(views).find(([key, view]) => {\n if (key === 'edit') {\n return false\n }\n\n const isAdminViewConfig =\n typeof view === 'object' &&\n view !== null &&\n 'path' in view &&\n 'Component' in view &&\n typeof view.path === 'string'\n\n if (isAdminViewConfig) {\n const adminView = view as AdminViewConfig\n const viewPath = `${baseRoute}${adminView.path}`\n\n return isPathMatchingRoute({\n currentRoute,\n exact: adminView.exact,\n path: viewPath,\n sensitive: adminView.sensitive,\n strict: adminView.strict,\n })\n }\n\n return false\n })\n\n if (foundEntry) {\n const [viewKey, foundViewConfig] = foundEntry\n const adminView = foundViewConfig as AdminViewConfig\n return {\n view: {\n payloadComponent: adminView.Component,\n },\n viewKey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AAA,CAAUQ;QAC9B;QACAH;MACF;IACF;EACF;EAEA,OAAO;IACLR,IAAA,EAAM;MACJW,SAAA,EAAW;IACb;IACAH,OAAA,EAAS;EACX;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomViewByKey.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomViewByKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getCustomViewByKey.d.ts","sourceRoot":"","sources":["../../../src/views/Root/getCustomViewByKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE/D,eAAO,MAAM,kBAAkB,yBAG5B;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;CAChB,KAAG;IACF,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,IAaH,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCustomViewByKey.js","names":["getCustomViewByKey","config","viewKey","customViewComponent","admin","components","views","view","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomViewByKey.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"getCustomViewByKey.js","names":["getCustomViewByKey","config","viewKey","customViewComponent","admin","components","views","view","payloadComponent","Component"],"sources":["../../../src/views/Root/getCustomViewByKey.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type { ViewFromConfig } from './getCustomViewByRoute.js'\n\nexport const getCustomViewByKey = ({\n config,\n viewKey,\n}: {\n config: SanitizedConfig\n viewKey: string\n}): {\n view: ViewFromConfig\n viewKey: string\n} | null => {\n const customViewComponent = config.admin.components?.views?.[viewKey]\n\n if (!customViewComponent) {\n return null\n }\n\n return {\n view: {\n payloadComponent: customViewComponent.Component,\n },\n viewKey,\n }\n}\n"],"mappings":"AAIA,OAAO,MAAMA,kBAAA,GAAqBA,CAAC;EACjCC,MAAM;EACNC;AAAO,CAIR;EAIC,MAAMC,mBAAA,GAAsBF,MAAA,CAAOG,KAAK,CAACC,UAAU,EAAEC,KAAA,GAAQJ,OAAA,CAAQ;EAErE,IAAI,CAACC,mBAAA,EAAqB;IACxB,OAAO;EACT;EAEA,OAAO;IACLI,IAAA,EAAM;MACJC,gBAAA,EAAkBL,mBAAA,CAAoBM;IACxC;IACAP;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateVersionViewMetadata.js","names":["getTranslation","formatDate","formatMetadata","generateVersionViewMetadata","collectionConfig","config","globalConfig","i18n","t","metaToUse","admin","meta","doc","formattedCreatedAt","createdAt","date","pattern","dateFormat","useAsTitle","entityLabel","labels","singular","titleFromData","description","documentTitle","title","components","views","edit","version","label","serverURL"],"sources":["../../../src/views/Version/generateVersionViewMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { GenerateEditViewMetadata } from '../API/generateAPIViewMetadata.js'\n\nimport { formatDate } from '../../utilities/formatDocTitle/formatDateTitle.js'\nimport { formatMetadata } from '../../utilities/formatMetadata.js'\n\n/**\n * @todo Remove the `MetaConfig` type assertions. They are currently required because of how the `Metadata` type from `next` consumes the `URL` type.\n */\nexport const generateVersionViewMetadata: GenerateEditViewMetadata = async ({\n collectionConfig,\n config,\n globalConfig,\n i18n,\n}): Promise<MetaConfig> => {\n const { t } = i18n\n\n let metaToUse: MetaConfig = {\n ...(config.admin.meta || {}),\n }\n\n const doc: any = {} // TODO: figure this out\n\n const formattedCreatedAt = doc?.createdAt\n ? formatDate({ date: doc.createdAt, i18n, pattern: config?.admin?.dateFormat })\n : ''\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle || 'id'\n const entityLabel = getTranslation(collectionConfig.labels.singular, i18n)\n const titleFromData = doc?.[useAsTitle]\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersion', { documentTitle: titleFromData, entityLabel }),\n title: `${t('version:version')}${formattedCreatedAt ? ` - ${formattedCreatedAt}` : ''}${titleFromData ? ` - ${titleFromData}` : ''} - ${entityLabel}`,\n ...(collectionConfig?.admin?.meta || {}),\n ...(collectionConfig?.admin?.components?.views?.edit?.version?.meta || {}),\n }\n }\n\n if (globalConfig) {\n const entityLabel = getTranslation(globalConfig.label, i18n)\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersionGlobal', { entityLabel }),\n title: `${t('version:version')}${formattedCreatedAt ? ` - ${formattedCreatedAt}` : ''}${entityLabel}`,\n ...(
|
|
1
|
+
{"version":3,"file":"generateVersionViewMetadata.js","names":["getTranslation","formatDate","formatMetadata","generateVersionViewMetadata","collectionConfig","config","globalConfig","i18n","t","metaToUse","admin","meta","doc","formattedCreatedAt","createdAt","date","pattern","dateFormat","useAsTitle","entityLabel","labels","singular","titleFromData","description","documentTitle","title","components","views","edit","version","label","serverURL"],"sources":["../../../src/views/Version/generateVersionViewMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { GenerateEditViewMetadata } from '../API/generateAPIViewMetadata.js'\n\nimport { formatDate } from '../../utilities/formatDocTitle/formatDateTitle.js'\nimport { formatMetadata } from '../../utilities/formatMetadata.js'\n\n/**\n * @todo Remove the `MetaConfig` type assertions. They are currently required because of how the `Metadata` type from `next` consumes the `URL` type.\n */\nexport const generateVersionViewMetadata: GenerateEditViewMetadata = async ({\n collectionConfig,\n config,\n globalConfig,\n i18n,\n}): Promise<MetaConfig> => {\n const { t } = i18n\n\n let metaToUse: MetaConfig = {\n ...(config.admin.meta || {}),\n }\n\n const doc: any = {} // TODO: figure this out\n\n const formattedCreatedAt = doc?.createdAt\n ? formatDate({ date: doc.createdAt, i18n, pattern: config?.admin?.dateFormat })\n : ''\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle || 'id'\n const entityLabel = getTranslation(collectionConfig.labels.singular, i18n)\n const titleFromData = doc?.[useAsTitle]\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersion', { documentTitle: titleFromData, entityLabel }),\n title: `${t('version:version')}${formattedCreatedAt ? ` - ${formattedCreatedAt}` : ''}${titleFromData ? ` - ${titleFromData}` : ''} - ${entityLabel}`,\n ...(collectionConfig?.admin?.meta || {}),\n ...(collectionConfig?.admin?.components?.views?.edit?.version?.meta || {}),\n }\n }\n\n if (globalConfig) {\n const entityLabel = getTranslation(globalConfig.label, i18n)\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersionGlobal', { entityLabel }),\n title: `${t('version:version')}${formattedCreatedAt ? ` - ${formattedCreatedAt}` : ''}${entityLabel}`,\n ...(globalConfig?.admin?.meta || {}),\n ...(globalConfig?.admin?.components?.views?.edit?.version?.meta || {}),\n }\n }\n\n return formatMetadata({\n ...metaToUse,\n serverURL: config.serverURL,\n })\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAI/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAE/B;;;AAGA,OAAO,MAAMC,2BAAA,GAAwD,MAAAA,CAAO;EAC1EC,gBAAgB;EAChBC,MAAM;EACNC,YAAY;EACZC;AAAI,CACL;EACC,MAAM;IAAEC;EAAC,CAAE,GAAGD,IAAA;EAEd,IAAIE,SAAA,GAAwB;IAC1B,IAAIJ,MAAA,CAAOK,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;EAC7B;EAEA,MAAMC,GAAA,GAAW,CAAC,EAAE;AAAA;EAEpB,MAAMC,kBAAA,GAAqBD,GAAA,EAAKE,SAAA,GAC5Bb,UAAA,CAAW;IAAEc,IAAA,EAAMH,GAAA,CAAIE,SAAS;IAAEP,IAAA;IAAMS,OAA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C,IAAIL,YAAA,EAAcI,KAAA,EAAOgB,UAAA,EAAYC,KAAA,EAAOC,IAAA,EAAMC,OAAA,EAASlB,IAAA,IAAQ,CAAC,CAAC;IACvE;EACF;EAEA,OAAOT,cAAA,CAAe;IACpB,GAAGO,SAAS;IACZsB,SAAA,EAAW1B,MAAA,CAAO0B;EACpB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateVersionsViewMetadata.js","names":["getTranslation","formatMetadata","generateVersionsViewMetadata","collectionConfig","config","globalConfig","i18n","t","entityLabel","labels","singular","label","metaToUse","admin","meta","data","useAsTitle","titleFromData","description","documentTitle","entitySlug","slug","title","components","views","edit","versions","serverURL"],"sources":["../../../src/views/Versions/generateVersionsViewMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { GenerateEditViewMetadata } from '../API/generateAPIViewMetadata.js'\n\nimport { formatMetadata } from '../../utilities/formatMetadata.js'\n\n/**\n * @todo Remove the `MetaConfig` type assertions. They are currently required because of how the `Metadata` type from `next` consumes the `URL` type.\n */\nexport const generateVersionsViewMetadata: GenerateEditViewMetadata = async ({\n collectionConfig,\n config,\n globalConfig,\n i18n,\n}): Promise<MetaConfig> => {\n const { t } = i18n\n\n const entityLabel = collectionConfig\n ? getTranslation(collectionConfig.labels.singular, i18n)\n : globalConfig\n ? getTranslation(globalConfig.label, i18n)\n : ''\n\n let metaToUse: MetaConfig = {\n ...(config.admin.meta || {}),\n }\n\n const data: any = {} // TODO: figure this out\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle || 'id'\n const titleFromData = data?.[useAsTitle]\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersions', {\n documentTitle: data?.[useAsTitle],\n entitySlug: collectionConfig.slug,\n }),\n title: `${t('version:versions')}${titleFromData ? ` - ${titleFromData}` : ''} - ${entityLabel}`,\n ...(collectionConfig?.admin.meta || {}),\n ...(collectionConfig?.admin?.components?.views?.edit?.versions?.meta || {}),\n }\n }\n\n if (globalConfig) {\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersionsGlobal', { entitySlug: globalConfig.slug }),\n title: `${t('version:versions')} - ${entityLabel}`,\n ...(
|
|
1
|
+
{"version":3,"file":"generateVersionsViewMetadata.js","names":["getTranslation","formatMetadata","generateVersionsViewMetadata","collectionConfig","config","globalConfig","i18n","t","entityLabel","labels","singular","label","metaToUse","admin","meta","data","useAsTitle","titleFromData","description","documentTitle","entitySlug","slug","title","components","views","edit","versions","serverURL"],"sources":["../../../src/views/Versions/generateVersionsViewMetadata.ts"],"sourcesContent":["import type { MetaConfig } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { GenerateEditViewMetadata } from '../API/generateAPIViewMetadata.js'\n\nimport { formatMetadata } from '../../utilities/formatMetadata.js'\n\n/**\n * @todo Remove the `MetaConfig` type assertions. They are currently required because of how the `Metadata` type from `next` consumes the `URL` type.\n */\nexport const generateVersionsViewMetadata: GenerateEditViewMetadata = async ({\n collectionConfig,\n config,\n globalConfig,\n i18n,\n}): Promise<MetaConfig> => {\n const { t } = i18n\n\n const entityLabel = collectionConfig\n ? getTranslation(collectionConfig.labels.singular, i18n)\n : globalConfig\n ? getTranslation(globalConfig.label, i18n)\n : ''\n\n let metaToUse: MetaConfig = {\n ...(config.admin.meta || {}),\n }\n\n const data: any = {} // TODO: figure this out\n\n if (collectionConfig) {\n const useAsTitle = collectionConfig?.admin?.useAsTitle || 'id'\n const titleFromData = data?.[useAsTitle]\n\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersions', {\n documentTitle: data?.[useAsTitle],\n entitySlug: collectionConfig.slug,\n }),\n title: `${t('version:versions')}${titleFromData ? ` - ${titleFromData}` : ''} - ${entityLabel}`,\n ...(collectionConfig?.admin.meta || {}),\n ...(collectionConfig?.admin?.components?.views?.edit?.versions?.meta || {}),\n }\n }\n\n if (globalConfig) {\n metaToUse = {\n ...(config.admin.meta || {}),\n description: t('version:viewingVersionsGlobal', { entitySlug: globalConfig.slug }),\n title: `${t('version:versions')} - ${entityLabel}`,\n ...(globalConfig?.admin.meta || {}),\n ...(globalConfig?.admin?.components?.views?.edit?.versions?.meta || {}),\n }\n }\n\n return formatMetadata({\n ...metaToUse,\n serverURL: config.serverURL,\n })\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAI/B,SAASC,cAAc,QAAQ;AAE/B;;;AAGA,OAAO,MAAMC,4BAAA,GAAyD,MAAAA,CAAO;EAC3EC,gBAAgB;EAChBC,MAAM;EACNC,YAAY;EACZC;AAAI,CACL;EACC,MAAM;IAAEC;EAAC,CAAE,GAAGD,IAAA;EAEd,MAAME,WAAA,GAAcL,gBAAA,GAChBH,cAAA,CAAeG,gBAAA,CAAiBM,MAAM,CAACC,QAAQ,EAAEJ,IAAA,IACjDD,YAAA,GACEL,cAAA,CAAeK,YAAA,CAAaM,KAAK,EAAEL,IAAA,IACnC;EAEN,IAAIM,SAAA,GAAwB;IAC1B,IAAIR,MAAA,CAAOS,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;EAC7B;EAEA,MAAMC,IAAA,GAAY,CAAC,EAAE;AAAA;EAErB,IAAIZ,gBAAA,EAAkB;IACpB,MAAMa,UAAA,GAAab,gBAAA,EAAkBU,KAAA,EAAOG,UAAA,IAAc;IAC1D,MAAMC,aAAA,GAAgBF,IAAA,GAAOC,UAAA,CAAW;IAExCJ,SAAA,GAAY;MACV,IAAIR,MAAA,CAAOS,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;MAC3BI,WAAA,EAAaX,CAAA,CAAE,2BAA2B;QACxCY,aAAA,EAAeJ,IAAA,GAAOC,UAAA,CAAW;QACjCI,UAAA,EAAYjB,gBAAA,CAAiBkB;MAC/B;MACAC,KAAA,EAAO,GAAGf,CAAA,CAAE,sBAAsBU,aAAA,GAAgB,MAAMA,aAAA,EAAe,GAAG,QAAQT,WAAA,EAAa;MAC/F,IAAIL,gBAAA,EAAkBU,KAAA,CAAMC,IAAA,IAAQ,CAAC,CAAC;MACtC,IAAIX,gBAAA,EAAkBU,KAAA,EAAOU,UAAA,EAAYC,KAAA,EAAOC,IAAA,EAAMC,QAAA,EAAUZ,IAAA,IAAQ,CAAC,CAAC;IAC5E;EACF;EAEA,IAAIT,YAAA,EAAc;IAChBO,SAAA,GAAY;MACV,IAAIR,MAAA,CAAOS,KAAK,CAACC,IAAI,IAAI,CAAC,CAAC;MAC3BI,WAAA,EAAaX,CAAA,CAAE,iCAAiC;QAAEa,UAAA,EAAYf,YAAA,CAAagB;MAAK;MAChFC,KAAA,EAAO,GAAGf,CAAA,CAAE,yBAAyBC,WAAA,EAAa;MAClD,IAAIH,YAAA,EAAcQ,KAAA,CAAMC,IAAA,IAAQ,CAAC,CAAC;MAClC,IAAIT,YAAA,EAAcQ,KAAA,EAAOU,UAAA,EAAYC,KAAA,EAAOC,IAAA,EAAMC,QAAA,EAAUZ,IAAA,IAAQ,CAAC,CAAC;IACxE;EACF;EAEA,OAAOb,cAAA,CAAe;IACpB,GAAGW,SAAS;IACZe,SAAA,EAAWvB,MAAA,CAAOuB;EACpB;AACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/ui",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.28",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
"ts-essentials": "10.0.3",
|
|
290
290
|
"use-context-selector": "2.0.0",
|
|
291
291
|
"uuid": "14.0.0",
|
|
292
|
-
"@payloadcms/translations": "4.0.0-canary.
|
|
292
|
+
"@payloadcms/translations": "4.0.0-canary.28"
|
|
293
293
|
},
|
|
294
294
|
"devDependencies": {
|
|
295
295
|
"@babel/cli": "7.27.2",
|
|
@@ -303,13 +303,13 @@
|
|
|
303
303
|
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
|
304
304
|
"esbuild": "0.27.1",
|
|
305
305
|
"esbuild-sass-plugin": "3.3.1",
|
|
306
|
-
"
|
|
307
|
-
"
|
|
306
|
+
"payload": "4.0.0-canary.28",
|
|
307
|
+
"@payloadcms/eslint-config": "3.28.0"
|
|
308
308
|
},
|
|
309
309
|
"peerDependencies": {
|
|
310
310
|
"react": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
311
311
|
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
312
|
-
"payload": "4.0.0-canary.
|
|
312
|
+
"payload": "4.0.0-canary.28"
|
|
313
313
|
},
|
|
314
314
|
"engines": {
|
|
315
315
|
"node": ">=24.15.0"
|