@ainsleydev/payload-helper 0.0.38 → 0.0.40

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 CHANGED
@@ -4,6 +4,93 @@ Payload Helper is a project designed to extend and enhance functionality for Pay
4
4
  project includes custom configurations, scripts, and utilities to streamline development and content
5
5
  management processes.
6
6
 
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @ainsleydev/payload-helper
11
+ # or
12
+ pnpm add @ainsleydev/payload-helper
13
+ # or
14
+ yarn add @ainsleydev/payload-helper
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Add the plugin to your Payload configuration:
20
+
21
+ ```typescript
22
+ import { payloadHelper } from '@ainsleydev/payload-helper'
23
+
24
+ export default buildConfig({
25
+ plugins: [
26
+ payloadHelper({
27
+ siteName: 'My Site',
28
+ admin: {
29
+ logo: {
30
+ path: '/images/logo-light.svg',
31
+ darkModePath: '/images/logo-dark.svg',
32
+ width: 150,
33
+ height: 40,
34
+ alt: 'My Site Logo',
35
+ className: 'custom-logo-class',
36
+ },
37
+ icon: {
38
+ path: '/images/icon-light.svg',
39
+ darkModePath: '/images/icon-dark.svg',
40
+ width: 120,
41
+ height: 120,
42
+ alt: 'My Site Icon',
43
+ className: 'custom-icon-class',
44
+ },
45
+ },
46
+ }),
47
+ ],
48
+ })
49
+ ```
50
+
51
+ ## Configuration
52
+
53
+ ### Admin configuration
54
+
55
+ The `admin` object contains configuration for admin UI customisation:
56
+
57
+ #### Logo configuration
58
+
59
+ The logo appears in the navigation area of the Payload admin dashboard.
60
+
61
+ - `path` (required): Path to the logo image file
62
+ - `darkModePath` (optional): Path to the logo for dark mode
63
+ - `width` (optional): Logo width in pixels (default: 150)
64
+ - `height` (optional): Logo height in pixels (default: 40)
65
+ - `alt` (optional): Alt text for the logo (defaults to siteName)
66
+ - `className` (optional): Custom CSS class name
67
+
68
+ #### Icon configuration
69
+
70
+ The icon appears in the top left corner of the Payload admin dashboard.
71
+
72
+ - `path` (required): Path to the icon image file
73
+ - `darkModePath` (optional): Path to the icon for dark mode
74
+ - `width` (optional): Icon width in pixels (default: 120)
75
+ - `height` (optional): Icon height in pixels (default: 120)
76
+ - `alt` (optional): Alt text for the icon (defaults to siteName)
77
+ - `className` (optional): Custom CSS class name
78
+
79
+ ### Web server configuration
80
+
81
+ Configure cache invalidation for your web server:
82
+
83
+ ```typescript
84
+ payloadHelper({
85
+ siteName: 'My Site',
86
+ webServer: {
87
+ apiKey: 'your-api-key',
88
+ baseURL: 'https://your-site.com',
89
+ cacheEndpoint: '/api/cache/purge',
90
+ },
91
+ })
92
+ ```
93
+
7
94
  ## Open Source
8
95
 
9
96
  ainsley.dev permits the use of any HTML, SCSS and Javascript found within the repository for use
@@ -0,0 +1,16 @@
1
+ import type React from 'react';
2
+ import type { AdminIconConfig } from '../../types.js';
3
+ /**
4
+ * Props for the Icon component.
5
+ */
6
+ export type IconProps = {
7
+ config: AdminIconConfig;
8
+ };
9
+ /**
10
+ * Icon component that displays a configurable icon with theme support.
11
+ * The icon appears in the top left corner of the Payload dashboard.
12
+ *
13
+ * @param {IconProps} props - Component props containing icon configuration
14
+ * @returns {React.ReactElement} Icon component
15
+ */
16
+ export declare const Icon: React.FC<IconProps>;
@@ -0,0 +1,26 @@
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
+ * Icon component that displays a configurable icon with theme support.
8
+ * The icon appears in the top left corner of the Payload dashboard.
9
+ *
10
+ * @param {IconProps} props - Component props containing icon configuration
11
+ * @returns {React.ReactElement} Icon component
12
+ */ export const Icon = ({ config })=>{
13
+ const { theme } = useTheme();
14
+ const imagePath = theme === 'light' || !config.darkModePath ? config.path : config.darkModePath;
15
+ return /*#__PURE__*/ _jsx("figure", {
16
+ className: config.className ? config.className : undefined,
17
+ children: /*#__PURE__*/ _jsx(Image, {
18
+ src: imagePath,
19
+ alt: config.alt || 'Icon',
20
+ width: config.width || 120,
21
+ height: config.height || 120
22
+ })
23
+ });
24
+ };
25
+
26
+ //# sourceMappingURL=Icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/admin/components/Icon.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 { AdminIconConfig } from '../../types.js';\n\n/**\n * Props for the Icon component.\n */\nexport type IconProps = {\n\tconfig: AdminIconConfig;\n};\n\n/**\n * Icon component that displays a configurable icon with theme support.\n * The icon appears in the top left corner of the Payload dashboard.\n *\n * @param {IconProps} props - Component props containing icon configuration\n * @returns {React.ReactElement} Icon component\n */\nexport const Icon: React.FC<IconProps> = ({ 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 || 'Icon'}\n\t\t\t\twidth={config.width || 120}\n\t\t\t\theight={config.height || 120}\n\t\t\t/>\n\t\t</figure>\n\t);\n};\n"],"names":["useTheme","Image","Icon","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;;;;;;CAMC,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"}
@@ -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,6 @@ 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 { IconProps } from './admin/components/Icon.js';
11
+ export type { LogoProps } from './admin/components/Logo.js';
12
+ export type { AdminConfig, AdminIconConfig, AdminLogoConfig, PayloadHelperPluginConfig, } from './types.js';
package/dist/index.js CHANGED
@@ -1,21 +1,5 @@
1
+ import { injectAdminIcon, injectAdminLogo } from './plugin/admin.js';
1
2
  import { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';
2
- // export const test = (pluginOptions: PayloadHelperPluginConfig): Plugin[] => {
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
- // };
19
3
  /**
20
4
  * Payload Helper Plugin for websites at ainsley.dev
21
5
  *
@@ -23,11 +7,20 @@ 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
- incomingConfig.typescript = incomingConfig.typescript || {};
28
- incomingConfig.typescript.outputFile = './src/types/payload.ts';
12
+ config.typescript = config.typescript || {};
13
+ config.typescript.outputFile = './src/types/payload.ts';
14
+ // Inject admin Logo component if logo config is provided
15
+ if (pluginOptions.admin?.logo) {
16
+ config = injectAdminLogo(config, pluginOptions.admin.logo, pluginOptions.siteName);
17
+ }
18
+ // Inject admin Icon component if icon config is provided
19
+ if (pluginOptions.admin?.icon) {
20
+ config = injectAdminIcon(config, pluginOptions.admin.icon, pluginOptions.siteName);
21
+ }
29
22
  // Map collections & add hooks
30
- incomingConfig.collections = (incomingConfig.collections || []).map((collection)=>{
23
+ config.collections = (config.collections || []).map((collection)=>{
31
24
  if (collection.upload !== undefined && collection.upload !== true) {
32
25
  return collection;
33
26
  }
@@ -50,7 +43,7 @@ import { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';
50
43
  };
51
44
  });
52
45
  // Map globals & add hooks
53
- incomingConfig.globals = (incomingConfig.globals || []).map((global)=>{
46
+ config.globals = (config.globals || []).map((global)=>{
54
47
  const hooks = global.hooks || {};
55
48
  // Add afterChange hook only if webServer is defined
56
49
  if (pluginOptions.webServer) {
@@ -69,7 +62,7 @@ import { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.js';
69
62
  hooks
70
63
  };
71
64
  });
72
- return incomingConfig;
65
+ return config;
73
66
  };
74
67
 
75
68
  //# 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 { fieldMapper, schemas } from './plugin/schema.js';\nimport type { PayloadHelperPluginConfig } from './types.js';\nimport env from './util/env.js';\n\n// export const test = (pluginOptions: PayloadHelperPluginConfig): Plugin[] => {\n// \treturn [\n// \t\tseoPlugin({\n// \t\t\tcollections: pluginOptions?.seo?.collections,\n// \t\t\tglobals: pluginOptions?.seo?.globals,\n// \t\t\tfields: [...SEOFields, pluginOptions.seo?.fields],\n// \t\t\ttabbedUI: true,\n// \t\t\tuploadsCollection: 'media',\n// \t\t\tgenerateTitle: pluginOptions?.seo?.generateTitle ?\n// \t\t\t\tpluginOptions?.seo?.generateTitle :\n// \t\t\t\t({ doc }) => `${pluginOptions.siteName} — ${doc?.title?.value ?? ''}`,\n// \t\t\tgenerateDescription: pluginOptions?.seo?.generateDescription ?\n// \t\t\t\tpluginOptions?.seo?.generateDescription :\n// \t\t\t\t({ doc }) => doc?.excerpt?.value,\n// \t\t}),\n// \t];\n// };\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\t// Update typescript generation file\n\t\tincomingConfig.typescript = incomingConfig.typescript || {};\n\t\tincomingConfig.typescript.outputFile = './src/types/payload.ts';\n\n\t\t// Map collections & add hooks\n\t\tincomingConfig.collections = (incomingConfig.collections || []).map(\n\t\t\t(collection): CollectionConfig => {\n\t\t\t\tif (collection.upload !== undefined && collection.upload !== true) {\n\t\t\t\t\treturn collection;\n\t\t\t\t}\n\n\t\t\t\tconst hooks = collection.hooks || {};\n\n\t\t\t\t// Add afterChange hook only if webServer is defined\n\t\t\t\tif (pluginOptions.webServer) {\n\t\t\t\t\thooks.afterChange = [\n\t\t\t\t\t\t...(hooks.afterChange || []),\n\t\t\t\t\t\tcacheHookCollections({\n\t\t\t\t\t\t\tserver: pluginOptions.webServer,\n\t\t\t\t\t\t\tslug: collection.slug,\n\t\t\t\t\t\t\tfields: collection.fields,\n\t\t\t\t\t\t\tisCollection: true,\n\t\t\t\t\t\t}),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t...collection,\n\t\t\t\t\thooks,\n\t\t\t\t};\n\t\t\t},\n\t\t);\n\n\t\t// Map globals & add hooks\n\t\tincomingConfig.globals = (incomingConfig.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 incomingConfig;\n\t};\n"],"names":["cacheHookCollections","cacheHookGlobals","payloadHelper","pluginOptions","incomingConfig","typescript","outputFile","collections","map","collection","upload","undefined","hooks","webServer","afterChange","server","slug","fields","isCollection","globals","global"],"mappings":"AACA,SAASA,oBAAoB,EAAEC,gBAAgB,QAAQ,oBAAoB;AAK3E,gFAAgF;AAChF,YAAY;AACZ,gBAAgB;AAChB,mDAAmD;AACnD,2CAA2C;AAC3C,wDAAwD;AACxD,qBAAqB;AACrB,iCAAiC;AACjC,wDAAwD;AACxD,0CAA0C;AAC1C,6EAA6E;AAC7E,oEAAoE;AACpE,gDAAgD;AAChD,wCAAwC;AACxC,QAAQ;AACR,MAAM;AACN,KAAK;AAEL;;;;;CAKC,GACD,OAAO,MAAMC,gBACZ,CAACC,gBACD,CAACC;QACA,wBAAwB;QAExB,oCAAoC;QACpCA,eAAeC,UAAU,GAAGD,eAAeC,UAAU,IAAI,CAAC;QAC1DD,eAAeC,UAAU,CAACC,UAAU,GAAG;QAEvC,8BAA8B;QAC9BF,eAAeG,WAAW,GAAG,AAACH,CAAAA,eAAeG,WAAW,IAAI,EAAE,AAAD,EAAGC,GAAG,CAClE,CAACC;YACA,IAAIA,WAAWC,MAAM,KAAKC,aAAaF,WAAWC,MAAM,KAAK,MAAM;gBAClE,OAAOD;YACR;YAEA,MAAMG,QAAQH,WAAWG,KAAK,IAAI,CAAC;YAEnC,oDAAoD;YACpD,IAAIT,cAAcU,SAAS,EAAE;gBAC5BD,MAAME,WAAW,GAAG;uBACfF,MAAME,WAAW,IAAI,EAAE;oBAC3Bd,qBAAqB;wBACpBe,QAAQZ,cAAcU,SAAS;wBAC/BG,MAAMP,WAAWO,IAAI;wBACrBC,QAAQR,WAAWQ,MAAM;wBACzBC,cAAc;oBACf;iBACA;YACF;YAEA,OAAO;gBACN,GAAGT,UAAU;gBACbG;YACD;QACD;QAGD,0BAA0B;QAC1BR,eAAee,OAAO,GAAG,AAACf,CAAAA,eAAee,OAAO,IAAI,EAAE,AAAD,EAAGX,GAAG,CAAC,CAACY;YAC5D,MAAMR,QAAQQ,OAAOR,KAAK,IAAI,CAAC;YAE/B,oDAAoD;YACpD,IAAIT,cAAcU,SAAS,EAAE;gBAC5BD,MAAME,WAAW,GAAG;uBACfF,MAAME,WAAW,IAAI,EAAE;oBAC3Bb,iBAAiB;wBAChBc,QAAQZ,cAAcU,SAAS;wBAC/BG,MAAMI,OAAOJ,IAAI;wBACjBC,QAAQG,OAAOH,MAAM;wBACrBC,cAAc;oBACf;iBACA;YACF;YAEA,OAAO;gBACN,GAAGE,MAAM;gBACTR;YACD;QACD;QAEA,OAAOR;IACR,EAAE"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config } from 'payload';\nimport { injectAdminIcon, injectAdminLogo } from './plugin/admin.js';\nimport { cacheHookCollections, cacheHookGlobals } from './plugin/hooks.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 logo config is provided\n\t\tif (pluginOptions.admin?.logo) {\n\t\t\tconfig = injectAdminLogo(config, pluginOptions.admin.logo, pluginOptions.siteName);\n\t\t}\n\n\t\t// Inject admin Icon component if icon config is provided\n\t\tif (pluginOptions.admin?.icon) {\n\t\t\tconfig = injectAdminIcon(config, pluginOptions.admin.icon, 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 { IconProps } from './admin/components/Icon.js';\nexport type { LogoProps } from './admin/components/Logo.js';\nexport type {\n\tAdminConfig,\n\tAdminIconConfig,\n\tAdminLogoConfig,\n\tPayloadHelperPluginConfig,\n} from './types.js';\n"],"names":["injectAdminIcon","injectAdminLogo","cacheHookCollections","cacheHookGlobals","payloadHelper","pluginOptions","incomingConfig","config","typescript","outputFile","admin","logo","siteName","icon","collections","map","collection","upload","undefined","hooks","webServer","afterChange","server","slug","fields","isCollection","globals","global"],"mappings":"AACA,SAASA,eAAe,EAAEC,eAAe,QAAQ,oBAAoB;AACrE,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,oBAAoB;AAG3E;;;;;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,yDAAyD;QACzD,IAAIJ,cAAcK,KAAK,EAAEC,MAAM;YAC9BJ,SAASN,gBAAgBM,QAAQF,cAAcK,KAAK,CAACC,IAAI,EAAEN,cAAcO,QAAQ;QAClF;QAEA,yDAAyD;QACzD,IAAIP,cAAcK,KAAK,EAAEG,MAAM;YAC9BN,SAASP,gBAAgBO,QAAQF,cAAcK,KAAK,CAACG,IAAI,EAAER,cAAcO,QAAQ;QAClF;QAEA,8BAA8B;QAC9BL,OAAOO,WAAW,GAAG,AAACP,CAAAA,OAAOO,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,IAAId,cAAce,SAAS,EAAE;gBAC5BD,MAAME,WAAW,GAAG;uBACfF,MAAME,WAAW,IAAI,EAAE;oBAC3BnB,qBAAqB;wBACpBoB,QAAQjB,cAAce,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;QAC1BZ,OAAOmB,OAAO,GAAG,AAACnB,CAAAA,OAAOmB,OAAO,IAAI,EAAE,AAAD,EAAGX,GAAG,CAAC,CAACY;YAC5C,MAAMR,QAAQQ,OAAOR,KAAK,IAAI,CAAC;YAE/B,oDAAoD;YACpD,IAAId,cAAce,SAAS,EAAE;gBAC5BD,MAAME,WAAW,GAAG;uBACfF,MAAME,WAAW,IAAI,EAAE;oBAC3BlB,iBAAiB;wBAChBmB,QAAQjB,cAAce,SAAS;wBAC/BG,MAAMI,OAAOJ,IAAI;wBACjBC,QAAQG,OAAOH,MAAM;wBACrBC,cAAc;oBACf;iBACA;YACF;YAEA,OAAO;gBACN,GAAGE,MAAM;gBACTR;YACD;QACD;QAEA,OAAOZ;IACR,EAAE"}
@@ -0,0 +1,10 @@
1
+ import type { Config } from 'payload';
2
+ import type { AdminIconConfig, 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;
7
+ /**
8
+ * Injects the admin Icon component into the Payload config.
9
+ */
10
+ export declare const injectAdminIcon: (config: Config, iconConfig: AdminIconConfig, siteName: string) => Config;
@@ -0,0 +1,50 @@
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
+ * Injects the admin Icon component into the Payload config.
27
+ */ export const injectAdminIcon = (config, iconConfig, siteName)=>({
28
+ ...config,
29
+ admin: {
30
+ ...config.admin,
31
+ components: {
32
+ ...config.admin?.components,
33
+ graphics: {
34
+ ...config.admin?.components?.graphics,
35
+ Icon: {
36
+ path: '@ainsleydev/payload-helper/dist/admin/components/Icon',
37
+ exportName: 'Icon',
38
+ clientProps: {
39
+ config: {
40
+ ...iconConfig,
41
+ alt: iconConfig.alt || siteName
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ });
49
+
50
+ //# sourceMappingURL=admin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugin/admin.ts"],"sourcesContent":["import type { Config } from 'payload';\nimport type { AdminIconConfig, 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\n/**\n * Injects the admin Icon component into the Payload config.\n */\nexport const injectAdminIcon = (\n\tconfig: Config,\n\ticonConfig: AdminIconConfig,\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\tIcon: {\n\t\t\t\t\tpath: '@ainsleydev/payload-helper/dist/admin/components/Icon',\n\t\t\t\t\texportName: 'Icon',\n\t\t\t\t\tclientProps: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\t...iconConfig,\n\t\t\t\t\t\t\talt: iconConfig.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","injectAdminIcon","iconConfig","Icon"],"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;AAEH;;CAEC,GACD,OAAO,MAAMS,kBAAkB,CAC9BX,QACAY,YACAV,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;oBACrCQ,MAAM;wBACLN,MAAM;wBACNC,YAAY;wBACZC,aAAa;4BACZT,QAAQ;gCACP,GAAGY,UAAU;gCACbF,KAAKE,WAAWF,GAAG,IAAIR;4BACxB;wBACD;oBACD;gBACD;YACD;QACD;IACD,CAAA,EAAG"}
@@ -0,0 +1,6 @@
1
+ import type { Config } from 'payload';
2
+ import type { AdminIconConfig } from '../types.js';
3
+ /**
4
+ * Injects the admin Icon component into the Payload config.
5
+ */
6
+ export declare const injectAdminIcon: (config: Config, iconConfig: AdminIconConfig, siteName: string) => Config;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Injects the admin Icon component into the Payload config.
3
+ */ export const injectAdminIcon = (config, iconConfig, siteName)=>({
4
+ ...config,
5
+ admin: {
6
+ ...config.admin,
7
+ components: {
8
+ ...config.admin?.components,
9
+ graphics: {
10
+ ...config.admin?.components?.graphics,
11
+ Icon: {
12
+ path: '@ainsleydev/payload-helper/dist/admin/components/Icon',
13
+ exportName: 'Icon',
14
+ clientProps: {
15
+ config: {
16
+ ...iconConfig,
17
+ alt: iconConfig.alt || siteName
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ });
25
+
26
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugin/icon.ts"],"sourcesContent":["import type { Config } from 'payload';\nimport type { AdminIconConfig } from '../types.js';\n\n/**\n * Injects the admin Icon component into the Payload config.\n */\nexport const injectAdminIcon = (\n\tconfig: Config,\n\ticonConfig: AdminIconConfig,\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\tIcon: {\n\t\t\t\t\tpath: '@ainsleydev/payload-helper/dist/admin/components/Icon',\n\t\t\t\t\texportName: 'Icon',\n\t\t\t\t\tclientProps: {\n\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\t...iconConfig,\n\t\t\t\t\t\t\talt: iconConfig.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":["injectAdminIcon","config","iconConfig","siteName","admin","components","graphics","Icon","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"}
@@ -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,29 @@ 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
+ };
21
+ export type AdminIconConfig = {
22
+ path: string;
23
+ darkModePath?: string;
24
+ width?: number;
25
+ height?: number;
26
+ alt?: string;
27
+ className?: string;
28
+ };
29
+ export type AdminConfig = {
30
+ logo?: AdminLogoConfig;
31
+ icon?: AdminIconConfig;
32
+ };
13
33
  export type PayloadHelperPluginConfig = {
14
34
  siteName: string;
15
35
  settings?: SettingsConfig;
16
36
  webServer?: WebServerConfig;
37
+ admin?: AdminConfig;
17
38
  };
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;AAiBvE,mFAAmF;AACnF,EAAE;AACF,2BAA2B;AAC3B,qBAAqB;AACrB,kBAAkB;AAClB,+BAA+B;AAC/B,IAAI;AAEJ,WAKE"}
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 AdminIconConfig = {\n\tpath: string;\n\tdarkModePath?: string;\n\twidth?: number;\n\theight?: number;\n\talt?: string;\n\tclassName?: string;\n};\n\nexport type AdminConfig = {\n\tlogo?: AdminLogoConfig;\n\ticon?: AdminIconConfig;\n};\n\nexport type PayloadHelperPluginConfig = {\n\tsiteName: string;\n\tsettings?: SettingsConfig;\n\t// seo?: SEOConfig;\n\twebServer?: WebServerConfig;\n\tadmin?: AdminConfig;\n};\n"],"names":[],"mappings":"AAAA,uEAAuE;AAgDvE,WAME"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainsleydev/payload-helper",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
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/types.d.ts",
25
+ "types": "./dist/index.d.ts",
26
26
  "bin": {
27
27
  "payload-helper": "bin.js"
28
28
  },
@@ -37,32 +37,42 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "payload": "3.56.0",
41
- "@payloadcms/db-sqlite": "3.56.0",
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
- "@swc/cli": "^0.4.0",
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
- "rimraf": "6.0.1",
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",
@@ -76,9 +86,9 @@
76
86
  "build": "pnpm clean && pnpm build:types && pnpm build:swc",
77
87
  "build:swc": "swc ./src -d ./dist --config-file .swcrc --strip-leading-paths",
78
88
  "build:types": "tsc --emitDeclarationOnly --outDir dist",
79
- "format": "biome format --write . --apply-unsafe --organise-imports",
89
+ "format": "biome check --write --unsafe .",
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"}