@ainsleydev/payload-helper 0.0.37 → 0.0.39
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/admin/components/Logo.d.ts +15 -0
- package/dist/admin/components/Logo.js +25 -0
- package/dist/admin/components/Logo.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -22
- package/dist/index.js.map +1 -1
- package/dist/plugin/logo.d.ts +6 -0
- package/dist/plugin/logo.js +26 -0
- package/dist/plugin/logo.js.map +1 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.js +0 -7
- package/dist/types.js.map +1 -1
- package/package.json +24 -14
- package/dist/util/lexical.test.js +0 -21
- package/dist/util/lexical.test.js.map +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { AdminLogoConfig } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the Logo component.
|
|
5
|
+
*/
|
|
6
|
+
export type LogoProps = {
|
|
7
|
+
config: AdminLogoConfig;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Logo component that displays a configurable logo with theme support.
|
|
11
|
+
*
|
|
12
|
+
* @param {LogoProps} props - Component props containing logo configuration
|
|
13
|
+
* @returns {React.ReactElement} Logo component
|
|
14
|
+
*/
|
|
15
|
+
export declare const Logo: React.FC<LogoProps>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useTheme } from '@payloadcms/ui';
|
|
4
|
+
// @ts-expect-error - next/image is a peer dependency and will be available in consumer projects
|
|
5
|
+
import Image from 'next/image';
|
|
6
|
+
/**
|
|
7
|
+
* Logo component that displays a configurable logo with theme support.
|
|
8
|
+
*
|
|
9
|
+
* @param {LogoProps} props - Component props containing logo configuration
|
|
10
|
+
* @returns {React.ReactElement} Logo component
|
|
11
|
+
*/ export const Logo = ({ config })=>{
|
|
12
|
+
const { theme } = useTheme();
|
|
13
|
+
const imagePath = theme === 'light' || !config.darkModePath ? config.path : config.darkModePath;
|
|
14
|
+
return /*#__PURE__*/ _jsx("figure", {
|
|
15
|
+
className: config.className ? config.className : undefined,
|
|
16
|
+
children: /*#__PURE__*/ _jsx(Image, {
|
|
17
|
+
src: imagePath,
|
|
18
|
+
alt: config.alt || 'Logo',
|
|
19
|
+
width: config.width || 150,
|
|
20
|
+
height: config.height || 40
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=Logo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/admin/components/Logo.tsx"],"sourcesContent":["'use client';\n\nimport { useTheme } from '@payloadcms/ui';\n// @ts-expect-error - next/image is a peer dependency and will be available in consumer projects\nimport Image from 'next/image';\nimport type React from 'react';\nimport type { AdminLogoConfig } from '../../types.js';\n\n/**\n * Props for the Logo component.\n */\nexport type LogoProps = {\n\tconfig: AdminLogoConfig;\n};\n\n/**\n * Logo component that displays a configurable logo with theme support.\n *\n * @param {LogoProps} props - Component props containing logo configuration\n * @returns {React.ReactElement} Logo component\n */\nexport const Logo: React.FC<LogoProps> = ({ config }) => {\n\tconst { theme } = useTheme();\n\tconst imagePath = theme === 'light' || !config.darkModePath ? config.path : config.darkModePath;\n\n\treturn (\n\t\t<figure className={config.className ? config.className : undefined}>\n\t\t\t<Image\n\t\t\t\tsrc={imagePath}\n\t\t\t\talt={config.alt || 'Logo'}\n\t\t\t\twidth={config.width || 150}\n\t\t\t\theight={config.height || 40}\n\t\t\t/>\n\t\t</figure>\n\t);\n};\n"],"names":["useTheme","Image","Logo","config","theme","imagePath","darkModePath","path","figure","className","undefined","src","alt","width","height"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,QAAQ,iBAAiB;AAC1C,gGAAgG;AAChG,OAAOC,WAAW,aAAa;AAW/B;;;;;CAKC,GACD,OAAO,MAAMC,OAA4B,CAAC,EAAEC,MAAM,EAAE;IACnD,MAAM,EAAEC,KAAK,EAAE,GAAGJ;IAClB,MAAMK,YAAYD,UAAU,WAAW,CAACD,OAAOG,YAAY,GAAGH,OAAOI,IAAI,GAAGJ,OAAOG,YAAY;IAE/F,qBACC,KAACE;QAAOC,WAAWN,OAAOM,SAAS,GAAGN,OAAOM,SAAS,GAAGC;kBACxD,cAAA,KAACT;YACAU,KAAKN;YACLO,KAAKT,OAAOS,GAAG,IAAI;YACnBC,OAAOV,OAAOU,KAAK,IAAI;YACvBC,QAAQX,OAAOW,MAAM,IAAI;;;AAI7B,EAAE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,3 +7,5 @@ import type { PayloadHelperPluginConfig } from './types.js';
|
|
|
7
7
|
* @param pluginOptions
|
|
8
8
|
*/
|
|
9
9
|
export declare const payloadHelper: (pluginOptions: PayloadHelperPluginConfig) => (incomingConfig: Config) => Config;
|
|
10
|
+
export type { LogoProps } from './admin/components/Logo.js';
|
|
11
|
+
export type { AdminLogoConfig, PayloadHelperPluginConfig } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';
|
|
2
|
-
|
|
3
|
-
// return [
|
|
4
|
-
// seoPlugin({
|
|
5
|
-
// collections: pluginOptions?.seo?.collections,
|
|
6
|
-
// globals: pluginOptions?.seo?.globals,
|
|
7
|
-
// fields: [...SEOFields, pluginOptions.seo?.fields],
|
|
8
|
-
// tabbedUI: true,
|
|
9
|
-
// uploadsCollection: 'media',
|
|
10
|
-
// generateTitle: pluginOptions?.seo?.generateTitle ?
|
|
11
|
-
// pluginOptions?.seo?.generateTitle :
|
|
12
|
-
// ({ doc }) => `${pluginOptions.siteName} — ${doc?.title?.value ?? ''}`,
|
|
13
|
-
// generateDescription: pluginOptions?.seo?.generateDescription ?
|
|
14
|
-
// pluginOptions?.seo?.generateDescription :
|
|
15
|
-
// ({ doc }) => doc?.excerpt?.value,
|
|
16
|
-
// }),
|
|
17
|
-
// ];
|
|
18
|
-
// };
|
|
2
|
+
import { injectAdminLogo } from './plugin/logo.js';
|
|
19
3
|
/**
|
|
20
4
|
* Payload Helper Plugin for websites at ainsley.dev
|
|
21
5
|
*
|
|
@@ -23,11 +7,16 @@ import { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';
|
|
|
23
7
|
* @param pluginOptions
|
|
24
8
|
*/ export const payloadHelper = (pluginOptions)=>(incomingConfig)=>{
|
|
25
9
|
// TODO: Validate Config
|
|
10
|
+
let config = incomingConfig;
|
|
26
11
|
// Update typescript generation file
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
config.typescript = config.typescript || {};
|
|
13
|
+
config.typescript.outputFile = './src/types/payload.ts';
|
|
14
|
+
// Inject admin Logo component if adminLogo config is provided
|
|
15
|
+
if (pluginOptions.adminLogo) {
|
|
16
|
+
config = injectAdminLogo(config, pluginOptions.adminLogo, pluginOptions.siteName);
|
|
17
|
+
}
|
|
29
18
|
// Map collections & add hooks
|
|
30
|
-
|
|
19
|
+
config.collections = (config.collections || []).map((collection)=>{
|
|
31
20
|
if (collection.upload !== undefined && collection.upload !== true) {
|
|
32
21
|
return collection;
|
|
33
22
|
}
|
|
@@ -50,7 +39,7 @@ import { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';
|
|
|
50
39
|
};
|
|
51
40
|
});
|
|
52
41
|
// Map globals & add hooks
|
|
53
|
-
|
|
42
|
+
config.globals = (config.globals || []).map((global)=>{
|
|
54
43
|
const hooks = global.hooks || {};
|
|
55
44
|
// Add afterChange hook only if webServer is defined
|
|
56
45
|
if (pluginOptions.webServer) {
|
|
@@ -69,7 +58,7 @@ import { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';
|
|
|
69
58
|
hooks
|
|
70
59
|
};
|
|
71
60
|
});
|
|
72
|
-
return
|
|
61
|
+
return config;
|
|
73
62
|
};
|
|
74
63
|
|
|
75
64
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config } from 'payload';\nimport { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config } from 'payload';\nimport { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';\nimport { injectAdminLogo } from './plugin/logo.js';\nimport type { PayloadHelperPluginConfig } from './types.js';\n\n/**\n * Payload Helper Plugin for websites at ainsley.dev\n *\n * @constructor\n * @param pluginOptions\n */\nexport const payloadHelper =\n\t(pluginOptions: PayloadHelperPluginConfig) =>\n\t(incomingConfig: Config): Config => {\n\t\t// TODO: Validate Config\n\n\t\tlet config = incomingConfig;\n\n\t\t// Update typescript generation file\n\t\tconfig.typescript = config.typescript || {};\n\t\tconfig.typescript.outputFile = './src/types/payload.ts';\n\n\t\t// Inject admin Logo component if adminLogo config is provided\n\t\tif (pluginOptions.adminLogo) {\n\t\t\tconfig = injectAdminLogo(config, pluginOptions.adminLogo, pluginOptions.siteName);\n\t\t}\n\n\t\t// Map collections & add hooks\n\t\tconfig.collections = (config.collections || []).map((collection): CollectionConfig => {\n\t\t\tif (collection.upload !== undefined && collection.upload !== true) {\n\t\t\t\treturn collection;\n\t\t\t}\n\n\t\t\tconst hooks = collection.hooks || {};\n\n\t\t\t// Add afterChange hook only if webServer is defined\n\t\t\tif (pluginOptions.webServer) {\n\t\t\t\thooks.afterChange = [\n\t\t\t\t\t...(hooks.afterChange || []),\n\t\t\t\t\tcacheHookCollections({\n\t\t\t\t\t\tserver: pluginOptions.webServer,\n\t\t\t\t\t\tslug: collection.slug,\n\t\t\t\t\t\tfields: collection.fields,\n\t\t\t\t\t\tisCollection: true,\n\t\t\t\t\t}),\n\t\t\t\t];\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\thooks,\n\t\t\t};\n\t\t});\n\n\t\t// Map globals & add hooks\n\t\tconfig.globals = (config.globals || []).map((global) => {\n\t\t\tconst hooks = global.hooks || {};\n\n\t\t\t// Add afterChange hook only if webServer is defined\n\t\t\tif (pluginOptions.webServer) {\n\t\t\t\thooks.afterChange = [\n\t\t\t\t\t...(hooks.afterChange || []),\n\t\t\t\t\tcacheHookGlobals({\n\t\t\t\t\t\tserver: pluginOptions.webServer,\n\t\t\t\t\t\tslug: global.slug,\n\t\t\t\t\t\tfields: global.fields,\n\t\t\t\t\t\tisCollection: true,\n\t\t\t\t\t}),\n\t\t\t\t];\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...global,\n\t\t\t\thooks,\n\t\t\t};\n\t\t});\n\n\t\treturn config;\n\t};\n\nexport type { LogoProps } from './admin/components/Logo.js';\nexport type { AdminLogoConfig, PayloadHelperPluginConfig } from './types.js';\n"],"names":["cacheHookCollections","cacheHookGlobals","injectAdminLogo","payloadHelper","pluginOptions","incomingConfig","config","typescript","outputFile","adminLogo","siteName","collections","map","collection","upload","undefined","hooks","webServer","afterChange","server","slug","fields","isCollection","globals","global"],"mappings":"AACA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,oBAAoB;AAC3E,SAASC,eAAe,QAAQ,mBAAmB;AAGnD;;;;;CAKC,GACD,OAAO,MAAMC,gBACZ,CAACC,gBACD,CAACC;QACA,wBAAwB;QAExB,IAAIC,SAASD;QAEb,oCAAoC;QACpCC,OAAOC,UAAU,GAAGD,OAAOC,UAAU,IAAI,CAAC;QAC1CD,OAAOC,UAAU,CAACC,UAAU,GAAG;QAE/B,8DAA8D;QAC9D,IAAIJ,cAAcK,SAAS,EAAE;YAC5BH,SAASJ,gBAAgBI,QAAQF,cAAcK,SAAS,EAAEL,cAAcM,QAAQ;QACjF;QAEA,8BAA8B;QAC9BJ,OAAOK,WAAW,GAAG,AAACL,CAAAA,OAAOK,WAAW,IAAI,EAAE,AAAD,EAAGC,GAAG,CAAC,CAACC;YACpD,IAAIA,WAAWC,MAAM,KAAKC,aAAaF,WAAWC,MAAM,KAAK,MAAM;gBAClE,OAAOD;YACR;YAEA,MAAMG,QAAQH,WAAWG,KAAK,IAAI,CAAC;YAEnC,oDAAoD;YACpD,IAAIZ,cAAca,SAAS,EAAE;gBAC5BD,MAAME,WAAW,GAAG;uBACfF,MAAME,WAAW,IAAI,EAAE;oBAC3BlB,qBAAqB;wBACpBmB,QAAQf,cAAca,SAAS;wBAC/BG,MAAMP,WAAWO,IAAI;wBACrBC,QAAQR,WAAWQ,MAAM;wBACzBC,cAAc;oBACf;iBACA;YACF;YAEA,OAAO;gBACN,GAAGT,UAAU;gBACbG;YACD;QACD;QAEA,0BAA0B;QAC1BV,OAAOiB,OAAO,GAAG,AAACjB,CAAAA,OAAOiB,OAAO,IAAI,EAAE,AAAD,EAAGX,GAAG,CAAC,CAACY;YAC5C,MAAMR,QAAQQ,OAAOR,KAAK,IAAI,CAAC;YAE/B,oDAAoD;YACpD,IAAIZ,cAAca,SAAS,EAAE;gBAC5BD,MAAME,WAAW,GAAG;uBACfF,MAAME,WAAW,IAAI,EAAE;oBAC3BjB,iBAAiB;wBAChBkB,QAAQf,cAAca,SAAS;wBAC/BG,MAAMI,OAAOJ,IAAI;wBACjBC,QAAQG,OAAOH,MAAM;wBACrBC,cAAc;oBACf;iBACA;YACF;YAEA,OAAO;gBACN,GAAGE,MAAM;gBACTR;YACD;QACD;QAEA,OAAOV;IACR,EAAE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Config } from 'payload';
|
|
2
|
+
import type { AdminLogoConfig } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Injects the admin Logo component into the Payload config.
|
|
5
|
+
*/
|
|
6
|
+
export declare const injectAdminLogo: (config: Config, logoConfig: AdminLogoConfig, siteName: string) => Config;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Injects the admin Logo component into the Payload config.
|
|
3
|
+
*/ export const injectAdminLogo = (config, logoConfig, siteName)=>({
|
|
4
|
+
...config,
|
|
5
|
+
admin: {
|
|
6
|
+
...config.admin,
|
|
7
|
+
components: {
|
|
8
|
+
...config.admin?.components,
|
|
9
|
+
graphics: {
|
|
10
|
+
...config.admin?.components?.graphics,
|
|
11
|
+
Logo: {
|
|
12
|
+
path: '@ainsleydev/payload-helper/dist/admin/components/Logo',
|
|
13
|
+
exportName: 'Logo',
|
|
14
|
+
clientProps: {
|
|
15
|
+
config: {
|
|
16
|
+
...logoConfig,
|
|
17
|
+
alt: logoConfig.alt || siteName
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=logo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/plugin/logo.ts"],"sourcesContent":["import type { Config } from 'payload';\nimport type { AdminLogoConfig } from '../types.js';\n\n/**\n * Injects the admin Logo component into the Payload config.\n */\nexport const injectAdminLogo = (\n\tconfig: Config,\n\tlogoConfig: AdminLogoConfig,\n\tsiteName: string,\n): Config => ({\n\t...config,\n\tadmin: {\n\t\t...config.admin,\n\t\tcomponents: {\n\t\t\t...config.admin?.components,\n\t\t\tgraphics: {\n\t\t\t\t...config.admin?.components?.graphics,\n\t\t\t\tLogo: {\n\t\t\t\t\tpath: '@ainsleydev/payload-helper/dist/admin/components/Logo',\n\t\t\t\t\texportName: 'Logo',\n\t\t\t\t\tclientProps: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\t...logoConfig,\n\t\t\t\t\t\t\talt: logoConfig.alt || siteName,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n});\n"],"names":["injectAdminLogo","config","logoConfig","siteName","admin","components","graphics","Logo","path","exportName","clientProps","alt"],"mappings":"AAGA;;CAEC,GACD,OAAO,MAAMA,kBAAkB,CAC9BC,QACAC,YACAC,WACa,CAAA;QACb,GAAGF,MAAM;QACTG,OAAO;YACN,GAAGH,OAAOG,KAAK;YACfC,YAAY;gBACX,GAAGJ,OAAOG,KAAK,EAAEC,UAAU;gBAC3BC,UAAU;oBACT,GAAGL,OAAOG,KAAK,EAAEC,YAAYC,QAAQ;oBACrCC,MAAM;wBACLC,MAAM;wBACNC,YAAY;wBACZC,aAAa;4BACZT,QAAQ;gCACP,GAAGC,UAAU;gCACbS,KAAKT,WAAWS,GAAG,IAAIR;4BACxB;wBACD;oBACD;gBACD;YACD;QACD;IACD,CAAA,EAAG"}
|
package/dist/types.d.ts
CHANGED
|
@@ -10,8 +10,17 @@ export type WebServerConfig = {
|
|
|
10
10
|
baseURL: string;
|
|
11
11
|
cacheEndpoint: string;
|
|
12
12
|
};
|
|
13
|
+
export type AdminLogoConfig = {
|
|
14
|
+
path: string;
|
|
15
|
+
darkModePath?: string;
|
|
16
|
+
width?: number;
|
|
17
|
+
height?: number;
|
|
18
|
+
alt?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
13
21
|
export type PayloadHelperPluginConfig = {
|
|
14
22
|
siteName: string;
|
|
15
23
|
settings?: SettingsConfig;
|
|
16
24
|
webServer?: WebServerConfig;
|
|
25
|
+
adminLogo?: AdminLogoConfig;
|
|
17
26
|
};
|
package/dist/types.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
// import type { SEOPluginConfig } from "@payloadcms/plugin-seo/types";
|
|
2
|
-
// export type SEOConfig = Omit<SEOPluginConfig, 'uploadsCollection' | 'tabbedUI'>;
|
|
3
|
-
//
|
|
4
|
-
// export type S3Config = {
|
|
5
|
-
// enabled: boolean;
|
|
6
|
-
// bucket: string
|
|
7
|
-
// config: AWS.S3ClientConfig;
|
|
8
|
-
// }
|
|
9
2
|
export { };
|
|
10
3
|
|
|
11
4
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["// import type { SEOPluginConfig } from \"@payloadcms/plugin-seo/types\";\nimport type { GlobalConfig, Tab, TextField, TextareaField, UploadField } from 'payload';\n// import type {SEOPluginConfig} from \"@payloadcms/plugin-seo/dist/types.js\";\n\nexport type SettingsConfig = {\n\tadditionalTabs?: Tab[];\n\toverride: (args: {\n\t\tconfig: GlobalConfig;\n\t}) => GlobalConfig;\n};\n\nexport type WebServerConfig = {\n\tapiKey?: string;\n\tbaseURL: string;\n\tcacheEndpoint: string;\n};\n\n// export type SEOConfig = Omit<SEOPluginConfig, 'uploadsCollection' | 'tabbedUI'>;\n//\n// export type S3Config = {\n// \tenabled: boolean;\n// \tbucket: string\n// \tconfig: AWS.S3ClientConfig;\n// }\n\nexport type PayloadHelperPluginConfig = {\n\tsiteName: string;\n\tsettings?: SettingsConfig;\n\t// seo?: SEOConfig;\n\twebServer?: WebServerConfig;\n};\n"],"names":[],"mappings":"AAAA,uEAAuE;
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["// import type { SEOPluginConfig } from \"@payloadcms/plugin-seo/types\";\nimport type { GlobalConfig, Tab, TextField, TextareaField, UploadField } from 'payload';\n// import type {SEOPluginConfig} from \"@payloadcms/plugin-seo/dist/types.js\";\n\nexport type SettingsConfig = {\n\tadditionalTabs?: Tab[];\n\toverride: (args: {\n\t\tconfig: GlobalConfig;\n\t}) => GlobalConfig;\n};\n\nexport type WebServerConfig = {\n\tapiKey?: string;\n\tbaseURL: string;\n\tcacheEndpoint: string;\n};\n\n// export type SEOConfig = Omit<SEOPluginConfig, 'uploadsCollection' | 'tabbedUI'>;\n//\n// export type S3Config = {\n// \tenabled: boolean;\n// \tbucket: string\n// \tconfig: AWS.S3ClientConfig;\n// }\n\nexport type AdminLogoConfig = {\n\tpath: string;\n\tdarkModePath?: string;\n\twidth?: number;\n\theight?: number;\n\talt?: string;\n\tclassName?: string;\n};\n\nexport type PayloadHelperPluginConfig = {\n\tsiteName: string;\n\tsettings?: SettingsConfig;\n\t// seo?: SEOConfig;\n\twebServer?: WebServerConfig;\n\tadminLogo?: AdminLogoConfig;\n};\n"],"names":[],"mappings":"AAAA,uEAAuE;AAkCvE,WAME"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainsleydev/payload-helper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "Payload CMS utilities, collections and global types for ainsley.dev builds",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"url": "https://ainsley.dev"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/index.js",
|
|
25
|
-
"types": "./dist/
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
26
|
"bin": {
|
|
27
27
|
"payload-helper": "bin.js"
|
|
28
28
|
},
|
|
@@ -37,36 +37,46 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"
|
|
41
|
-
"@
|
|
42
|
-
"@payloadcms/richtext-lexical": "3.56.0",
|
|
43
|
-
"@payloadcms/plugin-form-builder": "3.56.0",
|
|
44
|
-
"@payloadcms/plugin-seo": "3.56.0",
|
|
45
|
-
"@lexical/headless": "0.28.0",
|
|
46
|
-
"@lexical/html": "0.28.0",
|
|
40
|
+
"@lexical/headless": "0.38.2",
|
|
41
|
+
"@lexical/html": "0.38.2",
|
|
47
42
|
"@nouance/payload-better-fields-plugin": "^1.4.1",
|
|
43
|
+
"@payloadcms/db-sqlite": "3.63.0",
|
|
44
|
+
"@payloadcms/plugin-form-builder": "3.63.0",
|
|
45
|
+
"@payloadcms/plugin-seo": "3.63.0",
|
|
46
|
+
"@payloadcms/richtext-lexical": "3.63.0",
|
|
48
47
|
"@types/json-schema": "^7.0.15",
|
|
49
48
|
"chalk": "^5.3.0",
|
|
50
49
|
"commander": "^12.1.0",
|
|
51
50
|
"dotenv": "^16.4.5",
|
|
52
51
|
"jsdom": "^24.1.1",
|
|
53
52
|
"lexical": "0.28.0",
|
|
54
|
-
"mime-types": "^2.1.35"
|
|
53
|
+
"mime-types": "^2.1.35",
|
|
54
|
+
"payload": "3.63.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@payloadcms/ui": "3.x",
|
|
58
|
+
"next": "15.x || 16.x",
|
|
59
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
55
60
|
},
|
|
56
61
|
"devDependencies": {
|
|
57
62
|
"@jest/globals": "^29.7.0",
|
|
58
|
-
"@
|
|
63
|
+
"@payloadcms/ui": "3.63.0",
|
|
64
|
+
"@swc/cli": "^0.7.8",
|
|
59
65
|
"@swc/core": "^1.7.2",
|
|
60
66
|
"@types/jest": "^29.5.12",
|
|
61
67
|
"@types/jsdom": "^21.1.7",
|
|
62
68
|
"@types/mime-types": "^2.1.4",
|
|
69
|
+
"@types/node": "^24.10.1",
|
|
70
|
+
"@types/react": "^18.3.26",
|
|
63
71
|
"jest": "^29.7.0",
|
|
64
72
|
"json-schema": "^0.4.0",
|
|
65
|
-
"
|
|
73
|
+
"next": "^16.0.1",
|
|
74
|
+
"react": "^19.2.0",
|
|
75
|
+
"rimraf": "6.1.0",
|
|
66
76
|
"ts-jest": "^29.2.3",
|
|
67
77
|
"ts-node": "^10.9.2",
|
|
68
78
|
"typescript": "^5.5.4",
|
|
69
|
-
"@ainsleydev/eslint-config": "0.0.
|
|
79
|
+
"@ainsleydev/eslint-config": "0.0.9"
|
|
70
80
|
},
|
|
71
81
|
"engines": {
|
|
72
82
|
"node": ">=18",
|
|
@@ -79,6 +89,6 @@
|
|
|
79
89
|
"format": "biome format --write . --apply-unsafe --organise-imports",
|
|
80
90
|
"lint": "biome lint --write .",
|
|
81
91
|
"clean": "rimraf {dist,*.tsbuildinfo}",
|
|
82
|
-
"test": "jest"
|
|
92
|
+
"test": "jest --passWithNoTests"
|
|
83
93
|
}
|
|
84
94
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { htmlToLexical } from './lexical';
|
|
2
|
-
describe('htmlToLexical', ()=>{
|
|
3
|
-
it('should convert an HTML string to a Lexical editor state', ()=>{
|
|
4
|
-
const html = '<p>Hello, world!</p>';
|
|
5
|
-
const editorState = htmlToLexical(html);
|
|
6
|
-
expect(editorState).toEqual({
|
|
7
|
-
nodes: [
|
|
8
|
-
{
|
|
9
|
-
type: 'paragraph',
|
|
10
|
-
children: [
|
|
11
|
-
{
|
|
12
|
-
text: 'Hello, world!'
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=lexical.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/lexical.test.ts"],"sourcesContent":["import { htmlToLexical } from './lexical';\n\ndescribe('htmlToLexical', () => {\n\tit('should convert an HTML string to a Lexical editor state', () => {\n\t\tconst html = '<p>Hello, world!</p>';\n\t\tconst editorState = htmlToLexical(html);\n\n\t\texpect(editorState).toEqual({\n\t\t\tnodes: [\n\t\t\t\t{\n\t\t\t\t\ttype: 'paragraph',\n\t\t\t\t\tchildren: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttext: 'Hello, world!',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t});\n});\n"],"names":["htmlToLexical","describe","it","html","editorState","expect","toEqual","nodes","type","children","text"],"mappings":"AAAA,SAASA,aAAa,QAAQ,YAAY;AAE1CC,SAAS,iBAAiB;IACzBC,GAAG,2DAA2D;QAC7D,MAAMC,OAAO;QACb,MAAMC,cAAcJ,cAAcG;QAElCE,OAAOD,aAAaE,OAAO,CAAC;YAC3BC,OAAO;gBACN;oBACCC,MAAM;oBACNC,UAAU;wBACT;4BACCC,MAAM;wBACP;qBACA;gBACF;aACA;QACF;IACD;AACD"}
|