@od-labs/payloadcms-dynamic-value-richtext 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +128 -96
  2. package/dist/exports/jsx.d.ts +9 -0
  3. package/dist/exports/jsx.js +73 -0
  4. package/dist/exports/jsx.js.map +1 -0
  5. package/dist/exports/react.d.ts +19 -0
  6. package/dist/exports/react.js +22 -0
  7. package/dist/exports/react.js.map +1 -0
  8. package/dist/exports/rsc.d.ts +1 -0
  9. package/dist/exports/rsc.js +3 -0
  10. package/dist/exports/rsc.js.map +1 -0
  11. package/dist/features/DynamicValue/feature.client.d.ts +4 -8
  12. package/dist/features/DynamicValue/feature.client.js +187 -89
  13. package/dist/features/DynamicValue/feature.client.js.map +1 -1
  14. package/dist/features/DynamicValue/feature.server.d.ts +16 -5
  15. package/dist/features/DynamicValue/feature.server.js +78 -39
  16. package/dist/features/DynamicValue/feature.server.js.map +1 -1
  17. package/dist/features/DynamicValue/types.d.ts +23 -23
  18. package/dist/features/DynamicValue/types.js.map +1 -1
  19. package/dist/icons/dynamicValue/bold.d.ts +2 -0
  20. package/dist/icons/dynamicValue/bold.js +6 -0
  21. package/dist/icons/dynamicValue/bold.js.map +1 -0
  22. package/dist/icons/dynamicValue/index.d.ts +3 -0
  23. package/dist/icons/dynamicValue/index.js +14 -0
  24. package/dist/icons/dynamicValue/index.js.map +1 -0
  25. package/dist/icons/dynamicValue/italic.d.ts +2 -0
  26. package/dist/icons/dynamicValue/italic.js +6 -0
  27. package/dist/icons/dynamicValue/italic.js.map +1 -0
  28. package/dist/icons/dynamicValue/link.d.ts +2 -0
  29. package/dist/icons/dynamicValue/link.js +6 -0
  30. package/dist/icons/dynamicValue/link.js.map +1 -0
  31. package/dist/icons/dynamicValue/strikethrough.d.ts +2 -0
  32. package/dist/icons/dynamicValue/strikethrough.js +6 -0
  33. package/dist/icons/dynamicValue/strikethrough.js.map +1 -0
  34. package/dist/icons/dynamicValue/types.d.ts +5 -0
  35. package/dist/icons/dynamicValue/types.js +3 -0
  36. package/dist/icons/dynamicValue/types.js.map +1 -0
  37. package/dist/icons/dynamicValue/underline.d.ts +2 -0
  38. package/dist/icons/dynamicValue/underline.js +6 -0
  39. package/dist/icons/dynamicValue/underline.js.map +1 -0
  40. package/dist/index.d.ts +6 -6
  41. package/dist/index.js +75 -3
  42. package/dist/index.js.map +1 -1
  43. package/dist/nodes/DynamicValueNode/index.d.ts +13 -13
  44. package/dist/nodes/DynamicValueNode/index.js +155 -83
  45. package/dist/nodes/DynamicValueNode/index.js.map +1 -1
  46. package/package.json +41 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/features/DynamicValue/feature.server.ts"],"sourcesContent":["import type { CollectionSlug, Field, GlobalSlug } from 'payload'\r\n\r\nimport { createNode, createServerFeature } from '@payloadcms/richtext-lexical'\r\n\r\nimport type { DynamicValueConfig, DynamicValueOption } from './types.js'\r\n\r\nimport { DynamicValueNode } from '../../nodes/DynamicValueNode/index.js'\r\n\r\nexport const DynamicValueFeature = createServerFeature<\r\n DynamicValueConfig,\r\n object,\r\n { options: DynamicValueOption[]; trigger: string }\r\n>({\r\n feature: ({ config: payloadConfig, props }) => {\r\n const options: DynamicValueOption[] = []\r\n const trigger = props?.trigger || '@'\r\n\r\n const flattenFields = (fields: Field[], prefix = '') => {\r\n fields.forEach((field) => {\r\n if ('name' in field && field.name && field.type !== 'array' && field.type !== 'blocks') {\r\n const name = prefix ? `${prefix}.${field.name}` : field.name\r\n options.push({\r\n label: (field.label as string) || field.name,\r\n value: name,\r\n })\r\n }\r\n\r\n if ('fields' in field && field.fields && Array.isArray(field.fields)) {\r\n flattenFields(\r\n field.fields,\r\n 'name' in field && field.name\r\n ? prefix\r\n ? `${prefix}.${field.name}`\r\n : field.name\r\n : prefix,\r\n )\r\n }\r\n\r\n if (field.type === 'tabs' && field.tabs) {\r\n field.tabs.forEach((tab) => {\r\n flattenFields(tab.fields, prefix)\r\n })\r\n }\r\n })\r\n }\r\n\r\n // 1. Process directly provided fields\r\n if (props?.fields) {\r\n flattenFields(props.fields)\r\n }\r\n\r\n // 2. Process collections\r\n if (props?.collections && payloadConfig.collections) {\r\n props.collections.forEach((slug: CollectionSlug) => {\r\n const collection = payloadConfig.collections?.find((c) => c.slug === slug)\r\n if (collection) {\r\n flattenFields(collection.fields, slug)\r\n }\r\n })\r\n }\r\n\r\n // 3. Process globals\r\n if (props?.globals && payloadConfig.globals) {\r\n props.globals.forEach((slug: GlobalSlug) => {\r\n const global = payloadConfig.globals?.find((g) => g.slug === slug)\r\n if (global) {\r\n flattenFields(global.fields, slug)\r\n }\r\n })\r\n }\r\n\r\n return {\r\n ClientFeature: '@od-labs/payloadcms-dynamic-value-richtext/client#DynamicValueFeatureClient',\r\n clientProps: {\r\n options,\r\n trigger,\r\n },\r\n key: 'dynamicValue',\r\n nodes: [\r\n createNode({\r\n node: DynamicValueNode,\r\n }),\r\n ],\r\n }\r\n },\r\n key: 'dynamicValue',\r\n})\r\n"],"names":["createNode","createServerFeature","DynamicValueNode","DynamicValueFeature","feature","config","payloadConfig","props","options","trigger","flattenFields","fields","prefix","forEach","field","name","type","push","label","value","Array","isArray","tabs","tab","collections","slug","collection","find","c","globals","global","g","ClientFeature","clientProps","key","nodes","node"],"mappings":"AAEA,SAASA,UAAU,EAAEC,mBAAmB,QAAQ,+BAA8B;AAI9E,SAASC,gBAAgB,QAAQ,wCAAuC;AAExE,OAAO,MAAMC,sBAAsBF,oBAIjC;IACAG,SAAS,CAAC,EAAEC,QAAQC,aAAa,EAAEC,KAAK,EAAE;QACxC,MAAMC,UAAgC,EAAE;QACxC,MAAMC,UAAUF,OAAOE,WAAW;QAElC,MAAMC,gBAAgB,CAACC,QAAiBC,SAAS,EAAE;YACjDD,OAAOE,OAAO,CAAC,CAACC;gBACd,IAAI,UAAUA,SAASA,MAAMC,IAAI,IAAID,MAAME,IAAI,KAAK,WAAWF,MAAME,IAA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C/B;YACF;QACF;QAEA,OAAO;YACLO,eAAe;YACfC,aAAa;gBACXzB;gBACAC;YACF;YACAyB,KAAK;YACLC,OAAO;gBACLnC,WAAW;oBACToC,MAAMlC;gBACR;aACD;QACH;IACF;IACAgC,KAAK;AACP,GAAE"}
1
+ {"version":3,"sources":["../../../src/features/DynamicValue/feature.server.ts"],"sourcesContent":["import type { Field } from 'payload'\r\n\r\nimport { createNode, createServerFeature } from '@payloadcms/richtext-lexical'\r\n\r\nimport {\r\n DYNAMIC_VALUE_NODE_TYPE,\r\n DynamicValueNode,\r\n LEGACY_DYNAMIC_VALUE_NODE_TYPE,\r\n} from '../../nodes/DynamicValueNode/index.js'\r\n\r\nexport type DynamicValueFeatureProps = {\r\n collections?: string[]\r\n fields?: Field[]\r\n globals?: string[]\r\n trigger?: string\r\n}\r\n\r\ntype DynamicValueOption = {\r\n label: string\r\n value: string\r\n}\r\n\r\nconst blockedFieldTypes = new Set(['array', 'blocks', 'richText', 'ui', 'upload'])\r\n\r\nconst flattenFields = (fields: Field[], options: DynamicValueOption[], prefix = ''): void => {\r\n for (const field of fields) {\r\n const fieldName = 'name' in field ? field.name : undefined\r\n const hasFieldName = typeof fieldName === 'string' && fieldName.length > 0\r\n\r\n const nextPrefix = hasFieldName ? (prefix ? `${prefix}.${fieldName}` : fieldName) : prefix\r\n\r\n if (\r\n hasFieldName &&\r\n typeof field.type === 'string' &&\r\n !blockedFieldTypes.has(field.type) &&\r\n nextPrefix\r\n ) {\r\n const fieldLabel = 'label' in field && typeof field.label === 'string' ? field.label : fieldName\r\n\r\n options.push({\r\n label: fieldLabel,\r\n value: nextPrefix,\r\n })\r\n }\r\n\r\n if ('fields' in field && Array.isArray(field.fields)) {\r\n flattenFields(field.fields, options, nextPrefix)\r\n }\r\n\r\n if (field.type === 'tabs' && Array.isArray(field.tabs)) {\r\n for (const tab of field.tabs) {\r\n if (tab.fields) {\r\n flattenFields(tab.fields, options, prefix)\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nconst mapToEnabledSlugs = (value: unknown): string[] => {\r\n if (Array.isArray(value)) {\r\n return value\r\n }\r\n\r\n if (!value || typeof value !== 'object') {\r\n return []\r\n }\r\n\r\n return Object.entries(value)\r\n .filter(([, enabled]) => Boolean(enabled))\r\n .map(([slug]) => slug)\r\n}\r\n\r\nexport const DynamicValueFeature = createServerFeature<\r\n DynamicValueFeatureProps,\r\n DynamicValueFeatureProps,\r\n {\r\n options: DynamicValueOption[]\r\n trigger: string\r\n }\r\n>({\r\n feature: ({ config: payloadConfig, props: featureProps }) => {\r\n const pluginOptions = payloadConfig.custom?.dynamicValue || {}\r\n const props = { ...pluginOptions, ...(featureProps || {}) }\r\n\r\n const options: DynamicValueOption[] = []\r\n const trigger = props.trigger || '@'\r\n\r\n if (props.fields) {\r\n flattenFields(props.fields, options)\r\n }\r\n\r\n if (props.collections && payloadConfig.collections) {\r\n const collectionSlugs = mapToEnabledSlugs(props.collections)\r\n\r\n for (const slug of collectionSlugs) {\r\n const collection = payloadConfig.collections.find((item) => item.slug === slug)\r\n\r\n if (collection) {\r\n flattenFields(collection.fields, options, slug)\r\n }\r\n }\r\n }\r\n\r\n if (props.globals && payloadConfig.globals) {\r\n const globalSlugs = mapToEnabledSlugs(props.globals)\r\n\r\n for (const slug of globalSlugs) {\r\n const global = payloadConfig.globals.find((item) => item.slug === slug)\r\n\r\n if (global) {\r\n flattenFields(global.fields, options, slug)\r\n }\r\n }\r\n }\r\n\r\n return {\r\n ClientFeature: '@od-labs/payloadcms-dynamic-value-richtext/client#DynamicValueFeatureClient',\r\n clientFeatureProps: {\r\n options,\r\n trigger,\r\n },\r\n key: 'dynamicValue',\r\n nodes: [\r\n createNode({\r\n converters: {\r\n html: {\r\n converter: ({ node }: { node: { field?: string; label?: string; value?: string } }) => {\r\n const field = node.field || node.value || ''\r\n const label = node.label || field\r\n\r\n return `<span data-payload-dynamic-value=\"true\" data-payload-dynamic-field=\"${field}\">${label}</span>`\r\n },\r\n nodeTypes: [DYNAMIC_VALUE_NODE_TYPE, LEGACY_DYNAMIC_VALUE_NODE_TYPE],\r\n },\r\n },\r\n node: DynamicValueNode,\r\n }),\r\n ],\r\n sanitizedServerFeatureProps: props,\r\n }\r\n },\r\n key: 'dynamicValue',\r\n})\r\n"],"names":["createNode","createServerFeature","DYNAMIC_VALUE_NODE_TYPE","DynamicValueNode","LEGACY_DYNAMIC_VALUE_NODE_TYPE","blockedFieldTypes","Set","flattenFields","fields","options","prefix","field","fieldName","name","undefined","hasFieldName","length","nextPrefix","type","has","fieldLabel","label","push","value","Array","isArray","tabs","tab","mapToEnabledSlugs","Object","entries","filter","enabled","Boolean","map","slug","DynamicValueFeature","feature","config","payloadConfig","props","featureProps","pluginOptions","custom","dynamicValue","trigger","collections","collectionSlugs","collection","find","item","globals","globalSlugs","global","ClientFeature","clientFeatureProps","key","nodes","converters","html","converter","node","nodeTypes","sanitizedServerFeatureProps"],"mappings":"AAEA,SAASA,UAAU,EAAEC,mBAAmB,QAAQ,+BAA8B;AAE9E,SACEC,uBAAuB,EACvBC,gBAAgB,EAChBC,8BAA8B,QACzB,wCAAuC;AAc9C,MAAMC,oBAAoB,IAAIC,IAAI;IAAC;IAAS;IAAU;IAAY;IAAM;CAAS;AAEjF,MAAMC,gBAAgB,CAACC,QAAiBC,SAA+BC,SAAS,EAAE;IAChF,KAAK,MAAMC,SAASH,OAAQ;QAC1B,MAAMI,YAAY,UAAUD,QAAQA,MAAME,IAAI,GAAGC;QACjD,MAAMC,eAAe,OAAOH,cAAc,YAAYA,UAAUI,MAAM,GAAG;QAEzE,MAAMC,aAAaF,eAAgBL,SAAS,GAAGA,OAAO,CAAC,EAAEE,WAAW,GAAGA,YAAaF;QAEpF,IACEK,gBACA,OAAOJ,MAAMO,IAAI,KAAK,YACtB,CAACb,kBAAkBc,GAAG,CAACR,MAAMO,IAAI,KACjCD,YACA;YACA,MAAMG,aAAa,WAAWT,SAAS,OAAOA,MAAMU,KAAK,KAAK,WAAWV,MAAMU,K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AiB;gBAClC,MAAMC,aAAaT,cAAcO,WAAW,CAACG,IAAI,CAAC,CAACC,OAASA,KAAKf,IAAI,KAAKA;gBAE1E,IAAIa,YAAY;oBACdzC,cAAcyC,WAAWxC,MAAM,EAAEC,SAAS0B;gBAC5C;YACF;QACF;QAEA,IAAIK,MAAMW,OAAO,IAAIZ,cAAcY,OAAO,EAAE;YAC1C,MAAMC,cAAcxB,kBAAkBY,MAAMW,OAAO;YAEnD,KAAK,MAAMhB,QAAQiB,YAAa;gBAC9B,MAAMC,SAASd,cAAcY,OAAO,CAACF,IAAI,CAAC,CAACC,OAASA,KAAKf,IAAI,KAAKA;gBAElE,IAAIkB,QAAQ;oBACV9C,cAAc8C,OAAO7C,MAAM,EAAEC,SAAS0B;gBACxC;YACF;QACF;QAEA,OAAO;YACLmB,eAAe;YACfC,oBAAoB;gBAClB9C;gBACAoC;YACF;YACAW,KAAK;YACLC,OAAO;gBACLzD,WAAW;oBACT0D,YAAY;wBACVC,MAAM;4BACJC,WAAW,CAAC,EAAEC,IAAI,EAAgE;gCAChF,MAAMlD,QAAQkD,KAAKlD,KAAK,IAAIkD,KAAKtC,KAAK,IAAI;gCAC1C,MAAMF,QAAQwC,KAAKxC,KAAK,IAAIV;gCAE5B,OAAO,CAAC,oEAAoE,EAAEA,MAAM,EAAE,EAAEU,MAAM,OAAO,CAAC;4BACxG;4BACAyC,WAAW;gCAAC5D;gCAAyBE;6BAA+B;wBACtE;oBACF;oBACAyD,MAAM1D;gBACR;aACD;YACD4D,6BAA6BvB;QAC/B;IACF;IACAgB,KAAK;AACP,GAAE"}
@@ -1,23 +1,23 @@
1
- import type { CollectionSlug, Field, GlobalSlug } from 'payload';
2
- export type DynamicValueOption = {
3
- label: string;
4
- value: string;
5
- };
6
- export type DynamicValueConfig = {
7
- /**
8
- * Directly provided fields for dynamic values
9
- */
10
- fields?: Field[];
11
- /**
12
- * Collections to pull fields from
13
- */
14
- collections?: CollectionSlug[];
15
- /**
16
- * Globals to pull fields from
17
- */
18
- globals?: GlobalSlug[];
19
- /**
20
- * The trigger character to use in the editor. Defaults to '@'
21
- */
22
- trigger?: string;
23
- };
1
+ import type { CollectionSlug, Field, GlobalSlug } from 'payload';
2
+ export type DynamicValueOption = {
3
+ label: string;
4
+ value: string;
5
+ };
6
+ export type DynamicValueConfig = {
7
+ /**
8
+ * Collections to pull fields from
9
+ */
10
+ collections?: CollectionSlug[];
11
+ /**
12
+ * Directly provided fields for dynamic values
13
+ */
14
+ fields?: Field[];
15
+ /**
16
+ * Globals to pull fields from
17
+ */
18
+ globals?: GlobalSlug[];
19
+ /**
20
+ * The trigger character to use in the editor. Defaults to '@'
21
+ */
22
+ trigger?: string;
23
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/features/DynamicValue/types.ts"],"sourcesContent":["import type { CollectionSlug, Field, GlobalSlug } from 'payload'\r\n\r\nexport type DynamicValueOption = {\r\n label: string\r\n value: string\r\n}\r\n\r\nexport type DynamicValueConfig = {\r\n /**\r\n * Directly provided fields for dynamic values\r\n */\r\n fields?: Field[]\r\n /**\r\n * Collections to pull fields from\r\n */\r\n collections?: CollectionSlug[]\r\n /**\r\n * Globals to pull fields from\r\n */\r\n globals?: GlobalSlug[]\r\n /**\r\n * The trigger character to use in the editor. Defaults to '@'\r\n */\r\n trigger?: string\r\n}\r\n"],"names":[],"mappings":"AAOA,WAiBC"}
1
+ {"version":3,"sources":["../../../src/features/DynamicValue/types.ts"],"sourcesContent":["import type { CollectionSlug, Field, GlobalSlug } from 'payload'\r\n\r\nexport type DynamicValueOption = {\r\n label: string\r\n value: string\r\n}\r\n\r\nexport type DynamicValueConfig = {\r\n /**\r\n * Collections to pull fields from\r\n */\r\n collections?: CollectionSlug[]\r\n /**\r\n * Directly provided fields for dynamic values\r\n */\r\n fields?: Field[]\r\n /**\r\n * Globals to pull fields from\r\n */\r\n globals?: GlobalSlug[]\r\n /**\r\n * The trigger character to use in the editor. Defaults to '@'\r\n */\r\n trigger?: string\r\n}\r\n"],"names":[],"mappings":"AAOA,WAiBC"}
@@ -0,0 +1,2 @@
1
+ import type { IconDefinition } from './types.js';
2
+ export declare const boldIcon: IconDefinition;
@@ -0,0 +1,6 @@
1
+ export const boldIcon = {
2
+ mode: 'fill',
3
+ path: 'M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z'
4
+ };
5
+
6
+ //# sourceMappingURL=bold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/icons/dynamicValue/bold.ts"],"sourcesContent":["import type { IconDefinition } from './types.js'\r\n\r\nexport const boldIcon: IconDefinition = {\r\n mode: 'fill',\r\n path: 'M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z',\r\n}\r\n"],"names":["boldIcon","mode","path"],"mappings":"AAEA,OAAO,MAAMA,WAA2B;IACtCC,MAAM;IACNC,MAAM;AACR,EAAC"}
@@ -0,0 +1,3 @@
1
+ import type { DynamicValueIconType, IconDefinition } from './types.js';
2
+ export type { DynamicValueIconType, IconDefinition } from './types.js';
3
+ export declare const dynamicValueIcons: Record<DynamicValueIconType, IconDefinition>;
@@ -0,0 +1,14 @@
1
+ import { boldIcon } from './bold.js';
2
+ import { italicIcon } from './italic.js';
3
+ import { linkIcon } from './link.js';
4
+ import { strikethroughIcon } from './strikethrough.js';
5
+ import { underlineIcon } from './underline.js';
6
+ export const dynamicValueIcons = {
7
+ bold: boldIcon,
8
+ italic: italicIcon,
9
+ link: linkIcon,
10
+ strikethrough: strikethroughIcon,
11
+ underline: underlineIcon
12
+ };
13
+
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/icons/dynamicValue/index.ts"],"sourcesContent":["import type { DynamicValueIconType, IconDefinition } from './types.js'\r\n\r\nimport { boldIcon } from './bold.js'\r\nimport { italicIcon } from './italic.js'\r\nimport { linkIcon } from './link.js'\r\nimport { strikethroughIcon } from './strikethrough.js'\r\nimport { underlineIcon } from './underline.js'\r\n\r\nexport type { DynamicValueIconType, IconDefinition } from './types.js'\r\n\r\nexport const dynamicValueIcons: Record<DynamicValueIconType, IconDefinition> = {\r\n bold: boldIcon,\r\n italic: italicIcon,\r\n link: linkIcon,\r\n strikethrough: strikethroughIcon,\r\n underline: underlineIcon,\r\n}\r\n"],"names":["boldIcon","italicIcon","linkIcon","strikethroughIcon","underlineIcon","dynamicValueIcons","bold","italic","link","strikethrough","underline"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,YAAW;AACpC,SAASC,UAAU,QAAQ,cAAa;AACxC,SAASC,QAAQ,QAAQ,YAAW;AACpC,SAASC,iBAAiB,QAAQ,qBAAoB;AACtD,SAASC,aAAa,QAAQ,iBAAgB;AAI9C,OAAO,MAAMC,oBAAkE;IAC7EC,MAAMN;IACNO,QAAQN;IACRO,MAAMN;IACNO,eAAeN;IACfO,WAAWN;AACb,EAAC"}
@@ -0,0 +1,2 @@
1
+ import type { IconDefinition } from './types.js';
2
+ export declare const italicIcon: IconDefinition;
@@ -0,0 +1,6 @@
1
+ export const italicIcon = {
2
+ mode: 'fill',
3
+ path: 'M11.2353 5.718L8.8563 15H6.7113L9.0903 5.718H11.2353ZM12.4963 7.421H8.3233L8.7393 5.718H12.9123L12.4963 7.421ZM9.2203 15H5.0473L5.4633 13.297H9.6363L9.2203 15Z'
4
+ };
5
+
6
+ //# sourceMappingURL=italic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/icons/dynamicValue/italic.ts"],"sourcesContent":["import type { IconDefinition } from './types.js'\r\n\r\nexport const italicIcon: IconDefinition = {\r\n mode: 'fill',\r\n path: 'M11.2353 5.718L8.8563 15H6.7113L9.0903 5.718H11.2353ZM12.4963 7.421H8.3233L8.7393 5.718H12.9123L12.4963 7.421ZM9.2203 15H5.0473L5.4633 13.297H9.6363L9.2203 15Z',\r\n}\r\n"],"names":["italicIcon","mode","path"],"mappings":"AAEA,OAAO,MAAMA,aAA6B;IACxCC,MAAM;IACNC,MAAM;AACR,EAAC"}
@@ -0,0 +1,2 @@
1
+ import type { IconDefinition } from './types.js';
2
+ export declare const linkIcon: IconDefinition;
@@ -0,0 +1,6 @@
1
+ export const linkIcon = {
2
+ mode: 'stroke',
3
+ path: 'M7.99999 13.3333H6.66666C5.78261 13.3333 4.93476 12.9821 4.30964 12.357C3.68452 11.7319 3.33333 10.884 3.33333 9.99999C3.33333 9.11593 3.68452 8.26809 4.30964 7.64297C4.93476 7.01785 5.78261 6.66666 6.66666 6.66666H7.99999M12 6.66666H13.3333C14.2174 6.66666 15.0652 7.01785 15.6904 7.64297C16.3155 8.26809 16.6667 9.11593 16.6667 9.99999C16.6667 10.884 16.3155 11.7319 15.6904 12.357C15.0652 12.9821 14.2174 13.3333 13.3333 13.3333H12M7.33333 9.99999H12.6667'
4
+ };
5
+
6
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/icons/dynamicValue/link.ts"],"sourcesContent":["import type { IconDefinition } from './types.js'\r\n\r\nexport const linkIcon: IconDefinition = {\r\n mode: 'stroke',\r\n path: 'M7.99999 13.3333H6.66666C5.78261 13.3333 4.93476 12.9821 4.30964 12.357C3.68452 11.7319 3.33333 10.884 3.33333 9.99999C3.33333 9.11593 3.68452 8.26809 4.30964 7.64297C4.93476 7.01785 5.78261 6.66666 6.66666 6.66666H7.99999M12 6.66666H13.3333C14.2174 6.66666 15.0652 7.01785 15.6904 7.64297C16.3155 8.26809 16.6667 9.11593 16.6667 9.99999C16.6667 10.884 16.3155 11.7319 15.6904 12.357C15.0652 12.9821 14.2174 13.3333 13.3333 13.3333H12M7.33333 9.99999H12.6667',\r\n}\r\n"],"names":["linkIcon","mode","path"],"mappings":"AAEA,OAAO,MAAMA,WAA2B;IACtCC,MAAM;IACNC,MAAM;AACR,EAAC"}
@@ -0,0 +1,2 @@
1
+ import type { IconDefinition } from './types.js';
2
+ export declare const strikethroughIcon: IconDefinition;
@@ -0,0 +1,6 @@
1
+ export const strikethroughIcon = {
2
+ mode: 'fill',
3
+ path: 'M10.0247 12.049C8.38672 11.516 7.75072 11.165 7.75072 10.476C7.75072 9.91799 8.20572 9.48899 9.28472 9.48899C10.3377 9.48899 11.0697 9.89199 11.9277 10.398L13.1887 8.99499C12.4607 8.47499 11.5507 7.99399 10.4287 7.83799L10.7407 6.62999H9.15472L8.82572 7.88999C7.22672 8.17599 5.89172 9.17699 5.89172 10.788C5.89172 12.452 7.25672 13.128 8.64072 13.557C10.2727 14.062 10.9857 14.347 10.9857 15.113C10.9857 15.763 10.4547 16.127 9.41472 16.127C8.35472 16.127 7.50272 15.737 6.61872 15.074L5.33272 16.503C6.08272 17.127 7.16172 17.647 8.40672 17.828L8.06772 19.14H9.65072L9.98672 17.854C11.5987 17.568 12.8707 16.581 12.8707 14.931C12.8707 13.206 11.4017 12.504 10.0247 12.049ZM5.19531 11.698H13.5543V13.076H5.19531V11.698Z'
4
+ };
5
+
6
+ //# sourceMappingURL=strikethrough.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/icons/dynamicValue/strikethrough.ts"],"sourcesContent":["import type { IconDefinition } from './types.js'\r\n\r\nexport const strikethroughIcon: IconDefinition = {\r\n mode: 'fill',\r\n path: 'M10.0247 12.049C8.38672 11.516 7.75072 11.165 7.75072 10.476C7.75072 9.91799 8.20572 9.48899 9.28472 9.48899C10.3377 9.48899 11.0697 9.89199 11.9277 10.398L13.1887 8.99499C12.4607 8.47499 11.5507 7.99399 10.4287 7.83799L10.7407 6.62999H9.15472L8.82572 7.88999C7.22672 8.17599 5.89172 9.17699 5.89172 10.788C5.89172 12.452 7.25672 13.128 8.64072 13.557C10.2727 14.062 10.9857 14.347 10.9857 15.113C10.9857 15.763 10.4547 16.127 9.41472 16.127C8.35472 16.127 7.50272 15.737 6.61872 15.074L5.33272 16.503C6.08272 17.127 7.16172 17.647 8.40672 17.828L8.06772 19.14H9.65072L9.98672 17.854C11.5987 17.568 12.8707 16.581 12.8707 14.931C12.8707 13.206 11.4017 12.504 10.0247 12.049ZM5.19531 11.698H13.5543V13.076H5.19531V11.698Z',\r\n}\r\n"],"names":["strikethroughIcon","mode","path"],"mappings":"AAEA,OAAO,MAAMA,oBAAoC;IAC/CC,MAAM;IACNC,MAAM;AACR,EAAC"}
@@ -0,0 +1,5 @@
1
+ export type DynamicValueIconType = 'bold' | 'italic' | 'link' | 'strikethrough' | 'underline';
2
+ export type IconDefinition = {
3
+ mode: 'fill' | 'stroke';
4
+ path: string;
5
+ };
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/icons/dynamicValue/types.ts"],"sourcesContent":["export type DynamicValueIconType = 'bold' | 'italic' | 'link' | 'strikethrough' | 'underline'\r\n\r\nexport type IconDefinition = {\r\n mode: 'fill' | 'stroke'\r\n path: string\r\n}\r\n"],"names":[],"mappings":"AAEA,WAGC"}
@@ -0,0 +1,2 @@
1
+ import type { IconDefinition } from './types.js';
2
+ export declare const underlineIcon: IconDefinition;
@@ -0,0 +1,6 @@
1
+ export const underlineIcon = {
2
+ mode: 'fill',
3
+ path: 'M13.1577 5.718V11.945C13.1577 14.168 11.7277 15.182 9.89466 15.182C8.02266 15.182 6.59266 14.168 6.59266 11.945V5.718H8.78966V11.711C8.78966 12.751 9.21866 13.245 9.88166 13.245C10.5317 13.245 10.9607 12.751 10.9607 11.711V5.718H13.1577ZM6.26758 16.157H13.4956V17.704H6.26758V16.157Z'
4
+ };
5
+
6
+ //# sourceMappingURL=underline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/icons/dynamicValue/underline.ts"],"sourcesContent":["import type { IconDefinition } from './types.js'\r\n\r\nexport const underlineIcon: IconDefinition = {\r\n mode: 'fill',\r\n path: 'M13.1577 5.718V11.945C13.1577 14.168 11.7277 15.182 9.89466 15.182C8.02266 15.182 6.59266 14.168 6.59266 11.945V5.718H8.78966V11.711C8.78966 12.751 9.21866 13.245 9.88166 13.245C10.5317 13.245 10.9607 12.751 10.9607 11.711V5.718H13.1577ZM6.26758 16.157H13.4956V17.704H6.26758V16.157Z',\r\n}\r\n"],"names":["underlineIcon","mode","path"],"mappings":"AAEA,OAAO,MAAMA,gBAAgC;IAC3CC,MAAM;IACNC,MAAM;AACR,EAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { Config } from 'payload';
2
- import type { DynamicValueConfig } from './features/DynamicValue/types.js';
3
- export { DynamicValueFeature } from './features/DynamicValue/feature.server.js';
4
- export type { DynamicValueConfig, DynamicValueOption } from './features/DynamicValue/types.js';
5
- export { DynamicValueNode } from './nodes/DynamicValueNode/index.js';
6
- export declare const dynamicValuePlugin: (_pluginOptions: DynamicValueConfig) => (config: Config) => Config;
1
+ import { DynamicValueFeature } from './features/DynamicValue/feature.server.js';
2
+ export { DynamicValueRichText } from './exports/react.js';
3
+ export { DynamicValueFeature } from './features/DynamicValue/feature.server.js';
4
+ export { DynamicValueNode } from './nodes/DynamicValueNode/index.js';
5
+ type PluginOptions = Parameters<typeof DynamicValueFeature>[0];
6
+ export declare const dynamicValuePlugin: (pluginOptions: PluginOptions) => (config: any) => any;
package/dist/index.js CHANGED
@@ -1,8 +1,80 @@
1
+ import { DynamicValueFeature } from './features/DynamicValue/feature.server.js';
2
+ export { DynamicValueRichText } from './exports/react.js';
1
3
  export { DynamicValueFeature } from './features/DynamicValue/feature.server.js';
2
4
  export { DynamicValueNode } from './nodes/DynamicValueNode/index.js';
3
- export const dynamicValuePlugin = (_pluginOptions)=>(config)=>{
4
- // Standard plugin wrapper
5
- return config;
5
+ const ensureDynamicFeature = (features)=>{
6
+ if (features.some((feature)=>feature?.key === 'dynamicValue')) {
7
+ return features;
8
+ }
9
+ return [
10
+ ...features,
11
+ DynamicValueFeature()
12
+ ];
13
+ };
14
+ const injectIntoFields = (fields)=>{
15
+ return fields.map((field)=>{
16
+ const nextField = {
17
+ ...field
18
+ };
19
+ if (field.type === 'richText' && field.editor && typeof field.editor === 'object') {
20
+ const nextEditor = {
21
+ ...field.editor
22
+ };
23
+ if (Array.isArray(nextEditor.features)) {
24
+ nextEditor.features = ensureDynamicFeature(nextEditor.features);
25
+ } else if (typeof nextEditor.features === 'function') {
26
+ const originalFeatures = nextEditor.features;
27
+ nextEditor.features = (args)=>ensureDynamicFeature(originalFeatures(args));
28
+ }
29
+ nextField.editor = nextEditor;
30
+ }
31
+ if (Array.isArray(field.fields)) {
32
+ nextField.fields = injectIntoFields(field.fields);
33
+ }
34
+ if (Array.isArray(field.tabs)) {
35
+ nextField.tabs = field.tabs.map((tab)=>({
36
+ ...tab,
37
+ fields: injectIntoFields(tab.fields)
38
+ }));
39
+ }
40
+ if (field.type === 'blocks' && Array.isArray(field.blocks)) {
41
+ nextField.blocks = field.blocks.map((block)=>({
42
+ ...block,
43
+ fields: injectIntoFields(block.fields)
44
+ }));
45
+ }
46
+ return nextField;
47
+ });
48
+ };
49
+ export const dynamicValuePlugin = (pluginOptions)=>(config)=>{
50
+ const nextConfig = {
51
+ ...config
52
+ };
53
+ nextConfig.custom = {
54
+ ...nextConfig.custom || {},
55
+ dynamicValue: pluginOptions
56
+ };
57
+ if (Array.isArray(nextConfig.collections)) {
58
+ nextConfig.collections = nextConfig.collections.map((collection)=>({
59
+ ...collection,
60
+ fields: injectIntoFields(collection.fields)
61
+ }));
62
+ }
63
+ if (Array.isArray(nextConfig.globals)) {
64
+ nextConfig.globals = nextConfig.globals.map((globalConfig)=>({
65
+ ...globalConfig,
66
+ fields: injectIntoFields(globalConfig.fields)
67
+ }));
68
+ }
69
+ if (nextConfig.editor && typeof nextConfig.editor === 'object' && 'features' in nextConfig.editor) {
70
+ if (Array.isArray(nextConfig.editor.features)) {
71
+ nextConfig.editor.features = ensureDynamicFeature(nextConfig.editor.features);
72
+ } else if (typeof nextConfig.editor.features === 'function') {
73
+ const originalFeatures = nextConfig.editor.features;
74
+ nextConfig.editor.features = (args)=>ensureDynamicFeature(originalFeatures(args));
75
+ }
76
+ }
77
+ return nextConfig;
6
78
  };
7
79
 
8
80
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Config } from 'payload'\n\nimport type { DynamicValueConfig } from './features/DynamicValue/types.js'\n\nexport { DynamicValueFeature } from './features/DynamicValue/feature.server.js'\nexport type { DynamicValueConfig, DynamicValueOption } from './features/DynamicValue/types.js'\nexport { DynamicValueNode } from './nodes/DynamicValueNode/index.js'\n\nexport const dynamicValuePlugin =\n (_pluginOptions: DynamicValueConfig) =>\n (config: Config): Config => {\n // Standard plugin wrapper\n return config\n }\n"],"names":["DynamicValueFeature","DynamicValueNode","dynamicValuePlugin","_pluginOptions","config"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,4CAA2C;AAE/E,SAASC,gBAAgB,QAAQ,oCAAmC;AAEpE,OAAO,MAAMC,qBACX,CAACC,iBACD,CAACC;QACC,0BAA0B;QAC1B,OAAOA;IACT,EAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { DynamicValueFeature } from './features/DynamicValue/feature.server.js'\r\n\r\nexport { DynamicValueRichText } from './exports/react.js'\r\n\r\nexport { DynamicValueFeature } from './features/DynamicValue/feature.server.js'\r\nexport { DynamicValueNode } from './nodes/DynamicValueNode/index.js'\r\n\r\ntype PluginOptions = Parameters<typeof DynamicValueFeature>[0]\r\n\r\ntype FieldLike = {\r\n blocks?: Array<{ fields: FieldLike[] }>\r\n editor?: {\r\n features?: ((args: unknown) => any[]) | any[]\r\n }\r\n fields?: FieldLike[]\r\n tabs?: Array<{ fields: FieldLike[] }>\r\n type?: string\r\n}\r\n\r\nconst ensureDynamicFeature = (features: any[]): any[] => {\r\n if (features.some((feature) => feature?.key === 'dynamicValue')) {\r\n return features\r\n }\r\n\r\n return [...features, DynamicValueFeature()]\r\n}\r\n\r\nconst injectIntoFields = (fields: FieldLike[]): FieldLike[] => {\r\n return fields.map((field) => {\r\n const nextField: FieldLike = { ...field }\r\n\r\n if (field.type === 'richText' && field.editor && typeof field.editor === 'object') {\r\n const nextEditor = { ...field.editor }\r\n\r\n if (Array.isArray(nextEditor.features)) {\r\n nextEditor.features = ensureDynamicFeature(nextEditor.features)\r\n } else if (typeof nextEditor.features === 'function') {\r\n const originalFeatures = nextEditor.features\r\n nextEditor.features = (args) => ensureDynamicFeature(originalFeatures(args))\r\n }\r\n\r\n nextField.editor = nextEditor\r\n }\r\n\r\n if (Array.isArray(field.fields)) {\r\n nextField.fields = injectIntoFields(field.fields)\r\n }\r\n\r\n if (Array.isArray(field.tabs)) {\r\n nextField.tabs = field.tabs.map((tab) => ({\r\n ...tab,\r\n fields: injectIntoFields(tab.fields),\r\n }))\r\n }\r\n\r\n if (field.type === 'blocks' && Array.isArray(field.blocks)) {\r\n nextField.blocks = field.blocks.map((block) => ({\r\n ...block,\r\n fields: injectIntoFields(block.fields),\r\n }))\r\n }\r\n\r\n return nextField\r\n })\r\n}\r\n\r\nexport const dynamicValuePlugin = (pluginOptions: PluginOptions) => (config: any) => {\r\n const nextConfig = { ...config }\r\n\r\n nextConfig.custom = {\r\n ...(nextConfig.custom || {}),\r\n dynamicValue: pluginOptions,\r\n }\r\n\r\n if (Array.isArray(nextConfig.collections)) {\r\n nextConfig.collections = nextConfig.collections.map((collection: any) => ({\r\n ...collection,\r\n fields: injectIntoFields(collection.fields),\r\n }))\r\n }\r\n\r\n if (Array.isArray(nextConfig.globals)) {\r\n nextConfig.globals = nextConfig.globals.map((globalConfig: any) => ({\r\n ...globalConfig,\r\n fields: injectIntoFields(globalConfig.fields),\r\n }))\r\n }\r\n\r\n if (nextConfig.editor && typeof nextConfig.editor === 'object' && 'features' in nextConfig.editor) {\r\n if (Array.isArray(nextConfig.editor.features)) {\r\n nextConfig.editor.features = ensureDynamicFeature(nextConfig.editor.features)\r\n } else if (typeof nextConfig.editor.features === 'function') {\r\n const originalFeatures = nextConfig.editor.features\r\n nextConfig.editor.features = (args: unknown) => ensureDynamicFeature(originalFeatures(args))\r\n }\r\n }\r\n\r\n return nextConfig\r\n}\r\n\r\n"],"names":["DynamicValueFeature","DynamicValueRichText","DynamicValueNode","ensureDynamicFeature","features","some","feature","key","injectIntoFields","fields","map","field","nextField","type","editor","nextEditor","Array","isArray","originalFeatures","args","tabs","tab","blocks","block","dynamicValuePlugin","pluginOptions","config","nextConfig","custom","dynamicValue","collections","collection","globals","globalConfig"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,4CAA2C;AAE/E,SAASC,oBAAoB,QAAQ,qBAAoB;AAEzD,SAASD,mBAAmB,QAAQ,4CAA2C;AAC/E,SAASE,gBAAgB,QAAQ,oCAAmC;AAcpE,MAAMC,uBAAuB,CAACC;IAC5B,IAAIA,SAASC,IAAI,CAAC,CAACC,UAAYA,SAASC,QAAQ,iBAAiB;QAC/D,OAAOH;IACT;IAEA,OAAO;WAAIA;QAAUJ;KAAsB;AAC7C;AAEA,MAAMQ,mBAAmB,CAACC;IACxB,OAAOA,OAAOC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AI,CAAC,CAAC;YAC3BC,cAAcJ;QAChB;QAEA,IAAIT,MAAMC,OAAO,CAACU,WAAWG,WAAW,GAAG;YACzCH,WAAWG,WAAW,GAAGH,WAAWG,WAAW,CAACpB,GAAG,CAAC,CAACqB,aAAqB,CAAA;oBACxE,GAAGA,UAAU;oBACbtB,QAAQD,iBAAiBuB,WAAWtB,MAAM;gBAC5C,CAAA;QACF;QAEA,IAAIO,MAAMC,OAAO,CAACU,WAAWK,OAAO,GAAG;YACrCL,WAAWK,OAAO,GAAGL,WAAWK,OAAO,CAACtB,GAAG,CAAC,CAACuB,eAAuB,CAAA;oBAClE,GAAGA,YAAY;oBACfxB,QAAQD,iBAAiByB,aAAaxB,MAAM;gBAC9C,CAAA;QACF;QAEA,IAAIkB,WAAWb,MAAM,IAAI,OAAOa,WAAWb,MAAM,KAAK,YAAY,cAAca,WAAWb,MAAM,EAAE;YACjG,IAAIE,MAAMC,OAAO,CAACU,WAAWb,MAAM,CAACV,QAAQ,GAAG;gBAC7CuB,WAAWb,MAAM,CAACV,QAAQ,GAAGD,qBAAqBwB,WAAWb,MAAM,CAACV,QAAQ;YAC9E,OAAO,IAAI,OAAOuB,WAAWb,MAAM,CAACV,QAAQ,KAAK,YAAY;gBAC3D,MAAMc,mBAAmBS,WAAWb,MAAM,CAACV,QAAQ;gBACnDuB,WAAWb,MAAM,CAACV,QAAQ,GAAG,CAACe,OAAkBhB,qBAAqBe,iBAAiBC;YACxF;QACF;QAEA,OAAOQ;IACT,EAAC"}
@@ -1,26 +1,26 @@
1
- import { DecoratorNode, type DOMConversionMap, type DOMExportOutput, type LexicalNode, type NodeKey, type SerializedLexicalNode, type Spread } from '@payloadcms/richtext-lexical/lexical';
2
- import React from 'react';
1
+ import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalNode, NodeKey, SerializedTextNode, Spread } from '@payloadcms/richtext-lexical/lexical';
2
+ import { TextNode } from '@payloadcms/richtext-lexical/lexical';
3
+ export declare const DYNAMIC_VALUE_NODE_TYPE = "dynamic-value";
4
+ export declare const LEGACY_DYNAMIC_VALUE_NODE_TYPE = "dynamicValue";
3
5
  export type SerializedDynamicValueNode = Spread<{
4
6
  field: string;
5
7
  label?: string;
6
- }, SerializedLexicalNode>;
7
- export declare class DynamicValueNode extends DecoratorNode<React.ReactNode> {
8
+ type: typeof DYNAMIC_VALUE_NODE_TYPE;
9
+ version: 1;
10
+ }, SerializedTextNode>;
11
+ export declare class DynamicValueNode extends TextNode {
8
12
  __field: string;
9
- __label: string;
10
- constructor(field: string, label?: string, key?: NodeKey);
13
+ constructor(field: string, text: string, key?: NodeKey);
11
14
  static clone(node: DynamicValueNode): DynamicValueNode;
12
15
  static getType(): string;
13
16
  static importDOM(): DOMConversionMap | null;
14
17
  static importJSON(serializedNode: SerializedDynamicValueNode): DynamicValueNode;
15
- createDOM(): HTMLElement;
16
- decorate(): React.ReactNode;
18
+ createDOM(config: EditorConfig): HTMLElement;
17
19
  exportDOM(): DOMExportOutput;
18
20
  exportJSON(): SerializedDynamicValueNode;
19
21
  getField(): string;
20
- getTextContent(): string;
21
- isInline(): boolean;
22
- isToken(): boolean;
23
- updateDOM(): boolean;
22
+ isTextEntity(): true;
23
+ updateDOM(prevNode: DynamicValueNode, dom: HTMLElement, config: EditorConfig): boolean;
24
24
  }
25
- export declare function $createDynamicValueNode(field: string, label?: string): DynamicValueNode;
25
+ export declare function $createDynamicValueNode(field: string, text?: string): DynamicValueNode;
26
26
  export declare function $isDynamicValueNode(node: LexicalNode | null | undefined): node is DynamicValueNode;