@payloadcms/richtext-lexical 4.0.0-internal.5f0cd13 → 4.0.0-internal.a0ef1b8

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 (146) hide show
  1. package/dist/@types/assets.d.js +2 -0
  2. package/dist/@types/assets.d.js.map +1 -0
  3. package/dist/cell/rscEntry.d.ts.map +1 -1
  4. package/dist/cell/rscEntry.js +5 -5
  5. package/dist/cell/rscEntry.js.map +1 -1
  6. package/dist/exports/client/Field-VYBSMSRY.js +2 -0
  7. package/dist/exports/client/Field-VYBSMSRY.js.map +7 -0
  8. package/dist/exports/client/bundled.css +1 -1
  9. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  10. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  11. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  12. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  13. package/dist/exports/client/chunk-ZYXHC5CY.js +2 -0
  14. package/dist/exports/client/chunk-ZYXHC5CY.js.map +7 -0
  15. package/dist/exports/client/{component-HKTAZ77E.js → component-PHZQBOJE.js} +2 -2
  16. package/dist/exports/client/componentInline-R3EPNYWF.js +2 -0
  17. package/dist/exports/client/index.d.ts +1 -0
  18. package/dist/exports/client/index.d.ts.map +1 -1
  19. package/dist/exports/client/index.js +25 -25
  20. package/dist/exports/client/index.js.map +4 -4
  21. package/dist/exports/server/rsc.browser.d.ts +11 -0
  22. package/dist/exports/server/rsc.browser.d.ts.map +1 -0
  23. package/dist/exports/server/rsc.browser.js +10 -0
  24. package/dist/exports/server/rsc.browser.js.map +1 -0
  25. package/dist/features/blocks/client/component/index.d.ts +1 -0
  26. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/component/index.js +15 -8
  28. package/dist/features/blocks/client/component/index.js.map +1 -1
  29. package/dist/features/blocks/client/componentInline/index.d.ts +1 -0
  30. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  31. package/dist/features/blocks/client/componentInline/index.js +14 -7
  32. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  33. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  34. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  35. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  36. package/dist/features/blocks/server/index.d.ts.map +1 -1
  37. package/dist/features/blocks/server/index.js +2 -2
  38. package/dist/features/blocks/server/index.js.map +1 -1
  39. package/dist/features/blocks/server/schema.d.ts +5 -5
  40. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  41. package/dist/features/blocks/server/schema.js +26 -23
  42. package/dist/features/blocks/server/schema.js.map +1 -1
  43. package/dist/features/converters/lexicalToHtml/async/types.d.ts +13 -15
  44. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  45. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  46. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +13 -15
  47. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  48. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  49. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -2
  50. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  51. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  52. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  53. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  54. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  55. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  56. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  57. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  58. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  59. package/dist/features/experimental_table/server/schema.d.ts.map +1 -1
  60. package/dist/features/experimental_table/server/schema.js +6 -3
  61. package/dist/features/experimental_table/server/schema.js.map +1 -1
  62. package/dist/features/link/server/schema.d.ts.map +1 -1
  63. package/dist/features/link/server/schema.js +10 -7
  64. package/dist/features/link/server/schema.js.map +1 -1
  65. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  66. package/dist/features/relationship/server/schema.js +5 -8
  67. package/dist/features/relationship/server/schema.js.map +1 -1
  68. package/dist/features/upload/client/component/index.css +2 -2
  69. package/dist/features/upload/server/schema.d.ts +4 -4
  70. package/dist/features/upload/server/schema.d.ts.map +1 -1
  71. package/dist/features/upload/server/schema.js +34 -18
  72. package/dist/features/upload/server/schema.js.map +1 -1
  73. package/dist/field/bundled.css +1 -1
  74. package/dist/field/clientEntry.d.ts +29 -0
  75. package/dist/field/clientEntry.d.ts.map +1 -0
  76. package/dist/field/clientEntry.js +86 -0
  77. package/dist/field/clientEntry.js.map +1 -0
  78. package/dist/field/index.css +9 -12
  79. package/dist/field/index.js +1 -1
  80. package/dist/field/index.js.map +1 -1
  81. package/dist/field/rscEntry.d.ts.map +1 -1
  82. package/dist/field/rscEntry.js +2 -0
  83. package/dist/field/rscEntry.js.map +1 -1
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +47 -4
  86. package/dist/index.js.map +1 -1
  87. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  88. package/dist/lexical/LexicalEditor.js +36 -2
  89. package/dist/lexical/LexicalEditor.js.map +1 -1
  90. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  91. package/dist/lexical/LexicalProvider.js +22 -7
  92. package/dist/lexical/LexicalProvider.js.map +1 -1
  93. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  94. package/dist/lexical/config/client/loader.js +5 -1
  95. package/dist/lexical/config/client/loader.js.map +1 -1
  96. package/dist/types/builtInNodes.d.ts.map +1 -1
  97. package/dist/types/builtInNodes.js +17 -17
  98. package/dist/types/builtInNodes.js.map +1 -1
  99. package/dist/types/index.d.ts +16 -16
  100. package/dist/types/index.d.ts.map +1 -1
  101. package/dist/types/index.js.map +1 -1
  102. package/dist/types/jsonSchemaHelpers.d.ts +2 -0
  103. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  104. package/dist/types/jsonSchemaHelpers.js +7 -3
  105. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  106. package/dist/types/nodeTypes.d.ts +51 -9
  107. package/dist/types/nodeTypes.d.ts.map +1 -1
  108. package/dist/types/nodeTypes.js +3 -3
  109. package/dist/types/nodeTypes.js.map +1 -1
  110. package/dist/types/schema.d.ts.map +1 -1
  111. package/dist/types/schema.js +12 -2
  112. package/dist/types/schema.js.map +1 -1
  113. package/dist/utilities/buildEditorState.d.ts +17 -3
  114. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  115. package/dist/utilities/buildEditorState.js +8 -0
  116. package/dist/utilities/buildEditorState.js.map +1 -1
  117. package/dist/utilities/buildInitialState.d.ts +2 -1
  118. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  119. package/dist/utilities/buildInitialState.js.map +1 -1
  120. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  121. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  122. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  123. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  124. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  125. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  126. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  127. package/dist/utilities/fieldsDrawer/index.css +12 -0
  128. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  129. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  130. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  131. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  132. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  133. package/dist/utilities/generateImportMap.js +7 -3
  134. package/dist/utilities/generateImportMap.js.map +1 -1
  135. package/package.json +8 -7
  136. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  137. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  138. package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
  139. package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
  140. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  141. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  142. package/dist/exports/client/chunk-UAKNDD6R.js +0 -2
  143. package/dist/exports/client/chunk-UAKNDD6R.js.map +0 -7
  144. package/dist/exports/client/componentInline-D3A6OW76.js +0 -2
  145. /package/dist/exports/client/{component-HKTAZ77E.js.map → component-PHZQBOJE.js.map} +0 -0
  146. /package/dist/exports/client/{componentInline-D3A6OW76.js.map → componentInline-R3EPNYWF.js.map} +0 -0
@@ -3,6 +3,8 @@ import type { JSONSchema4 } from 'json-schema';
3
3
  export declare const formatSchema: JSONSchema4;
4
4
  /** `direction` property shared by every element node. */
5
5
  export declare const directionSchema: JSONSchema4;
6
+ /** `version` property shared by every Lexical node. */
7
+ export declare const versionSchema: JSONSchema4;
6
8
  type ElementNodeSchemaOptions = {
7
9
  nodeType: string;
8
10
  properties?: {
@@ -1 +1 @@
1
- {"version":3,"file":"jsonSchemaHelpers.d.ts","sourceRoot":"","sources":["../../src/types/jsonSchemaHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,oFAAoF;AACpF,eAAO,MAAM,YAAY,EAAE,WAI1B,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,eAAe,EAAE,WAG7B,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAA;IACzC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,2DAM/B;IAAE,YAAY,EAAE,WAAW,CAAA;CAAE,GAAG,wBAAwB,KAAG,WAc5D,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,wBAAwB,KAAK,WAAW,CAAA"}
1
+ {"version":3,"file":"jsonSchemaHelpers.d.ts","sourceRoot":"","sources":["../../src/types/jsonSchemaHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,oFAAoF;AACpF,eAAO,MAAM,YAAY,EAAE,WAK1B,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,eAAe,EAAE,WAG7B,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,aAAa,EAAE,WAG3B,CAAA;AAED,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;KAAE,CAAA;IACzC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,2DAM/B;IAAE,YAAY,EAAE,WAAW,CAAA;CAAE,GAAG,wBAAwB,KAAG,WAc5D,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,wBAAwB,KAAK,WAAW,CAAA"}
@@ -1,5 +1,6 @@
1
1
  /** `format` property shared by every element node (Lexical `ElementFormatType`). */export const formatSchema = {
2
2
  type: 'string',
3
+ description: 'How this element is aligned. Empty string means no explicit alignment.',
3
4
  enum: ['left', 'start', 'center', 'right', 'end', 'justify', ''],
4
5
  tsType: 'LexicalElementFormat'
5
6
  };
@@ -13,6 +14,11 @@ export const directionSchema = {
13
14
  }],
14
15
  tsType: 'LexicalElementDirection'
15
16
  };
17
+ /** `version` property shared by every Lexical node. */
18
+ export const versionSchema = {
19
+ type: 'integer',
20
+ description: "Lexical's internal serialization version for this node type."
21
+ };
16
22
  /**
17
23
  * Builds the JSON Schema for a Lexical element node - merges the shared
18
24
  * element-base shape (children/direction/format/indent/version) with the
@@ -41,9 +47,7 @@ export const elementNodeSchema = ({
41
47
  indent: {
42
48
  type: 'integer'
43
49
  },
44
- version: {
45
- type: 'integer'
46
- },
50
+ version: versionSchema,
47
51
  ...properties
48
52
  },
49
53
  required: ['children', 'direction', 'format', 'indent', 'type', 'version', ...required],
@@ -1 +1 @@
1
- {"version":3,"file":"jsonSchemaHelpers.js","names":["formatSchema","type","enum","tsType","directionSchema","oneOf","elementNodeSchema","nodeType","nodeUnionRef","properties","required","additionalProperties","const","children","items","direction","format","indent","version"],"sources":["../../src/types/jsonSchemaHelpers.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\n/** `format` property shared by every element node (Lexical `ElementFormatType`). */\nexport const formatSchema: JSONSchema4 = {\n type: 'string',\n enum: ['left', 'start', 'center', 'right', 'end', 'justify', ''],\n tsType: 'LexicalElementFormat',\n}\n\n/** `direction` property shared by every element node. */\nexport const directionSchema: JSONSchema4 = {\n oneOf: [{ type: 'string', enum: ['ltr', 'rtl'] }, { type: 'null' }],\n tsType: 'LexicalElementDirection',\n}\n\ntype ElementNodeSchemaOptions = {\n nodeType: string\n properties?: { [k: string]: JSONSchema4 }\n required?: string[]\n /** TS helper-type expression — emitted verbatim by json-schema-to-typescript. */\n tsType?: string\n}\n\n/**\n * Builds the JSON Schema for a Lexical element node - merges the shared\n * element-base shape (children/direction/format/indent/version) with the\n * node-specific bits a feature provides.\n */\nexport const elementNodeSchema = ({\n nodeType,\n nodeUnionRef,\n properties = {},\n required = [],\n tsType,\n}: { nodeUnionRef: JSONSchema4 } & ElementNodeSchemaOptions): JSONSchema4 => ({\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: nodeType },\n children: { type: 'array', items: nodeUnionRef },\n direction: directionSchema,\n format: formatSchema,\n indent: { type: 'integer' },\n version: { type: 'integer' },\n ...properties,\n },\n required: ['children', 'direction', 'format', 'indent', 'type', 'version', ...required],\n ...(tsType ? { tsType } : {}),\n})\n\n/**\n * `elementNodeSchema` HOC type, so that features don't have to pass `nodeUnionRef` every time.\n */\nexport type ElementNodeSchemaFn = (opts: ElementNodeSchemaOptions) => JSONSchema4\n"],"mappings":"AAEA,oFACA,OAAO,MAAMA,YAAA,GAA4B;EACvCC,IAAA,EAAM;EACNC,IAAA,EAAM,CAAC,QAAQ,SAAS,UAAU,SAAS,OAAO,WAAW,GAAG;EAChEC,MAAA,EAAQ;AACV;AAEA;AACA,OAAO,MAAMC,eAAA,GAA+B;EAC1CC,KAAA,EAAO,CAAC;IAAEJ,IAAA,EAAM;IAAUC,IAAA,EAAM,CAAC,OAAO;EAAO,GAAG;IAAED,IAAA,EAAM;EAAO,EAAE;EACnEE,MAAA,EAAQ;AACV;AAUA;;;;;AAKA,OAAO,MAAMG,iBAAA,GAAoBA,CAAC;EAChCC,QAAQ;EACRC,YAAY;EACZC,UAAA,GAAa,CAAC,CAAC;EACfC,QAAA,GAAW,EAAE;EACbP;AAAM,CACmD,MAAmB;EAC5EF,IAAA,EAAM;EACNU,oBAAA,EAAsB;EACtBF,UAAA,EAAY;IACVR,IAAA,EAAM;MAAEA,IAAA,EAAM;MAAUW,KAAA,EAAOL;IAAS;IACxCM,QAAA,EAAU;MAAEZ,IAAA,EAAM;MAASa,KAAA,EAAON;IAAa;IAC/CO,SAAA,EAAWX,eAAA;IACXY,MAAA,EAAQhB,YAAA;IACRiB,MAAA,EAAQ;MAAEhB,IAAA,EAAM;IAAU;IAC1BiB,OAAA,EAAS;MAAEjB,IAAA,EAAM;IAAU;IAC3B,GAAGQ;EACL;EACAC,QAAA,EAAU,CAAC,YAAY,aAAa,UAAU,UAAU,QAAQ,W,GAAcA,QAAA,CAAS;EACvF,IAAIP,MAAA,GAAS;IAAEA;EAAO,IAAI,CAAC,CAAC;AAC9B","ignoreList":[]}
1
+ {"version":3,"file":"jsonSchemaHelpers.js","names":["formatSchema","type","description","enum","tsType","directionSchema","oneOf","versionSchema","elementNodeSchema","nodeType","nodeUnionRef","properties","required","additionalProperties","const","children","items","direction","format","indent","version"],"sources":["../../src/types/jsonSchemaHelpers.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\n/** `format` property shared by every element node (Lexical `ElementFormatType`). */\nexport const formatSchema: JSONSchema4 = {\n type: 'string',\n description: 'How this element is aligned. Empty string means no explicit alignment.',\n enum: ['left', 'start', 'center', 'right', 'end', 'justify', ''],\n tsType: 'LexicalElementFormat',\n}\n\n/** `direction` property shared by every element node. */\nexport const directionSchema: JSONSchema4 = {\n oneOf: [{ type: 'string', enum: ['ltr', 'rtl'] }, { type: 'null' }],\n tsType: 'LexicalElementDirection',\n}\n\n/** `version` property shared by every Lexical node. */\nexport const versionSchema: JSONSchema4 = {\n type: 'integer',\n description: \"Lexical's internal serialization version for this node type.\",\n}\n\ntype ElementNodeSchemaOptions = {\n nodeType: string\n properties?: { [k: string]: JSONSchema4 }\n required?: string[]\n /** TS helper-type expression — emitted verbatim by json-schema-to-typescript. */\n tsType?: string\n}\n\n/**\n * Builds the JSON Schema for a Lexical element node - merges the shared\n * element-base shape (children/direction/format/indent/version) with the\n * node-specific bits a feature provides.\n */\nexport const elementNodeSchema = ({\n nodeType,\n nodeUnionRef,\n properties = {},\n required = [],\n tsType,\n}: { nodeUnionRef: JSONSchema4 } & ElementNodeSchemaOptions): JSONSchema4 => ({\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: nodeType },\n children: { type: 'array', items: nodeUnionRef },\n direction: directionSchema,\n format: formatSchema,\n indent: { type: 'integer' },\n version: versionSchema,\n ...properties,\n },\n required: ['children', 'direction', 'format', 'indent', 'type', 'version', ...required],\n ...(tsType ? { tsType } : {}),\n})\n\n/**\n * `elementNodeSchema` HOC type, so that features don't have to pass `nodeUnionRef` every time.\n */\nexport type ElementNodeSchemaFn = (opts: ElementNodeSchemaOptions) => JSONSchema4\n"],"mappings":"AAEA,oFACA,OAAO,MAAMA,YAAA,GAA4B;EACvCC,IAAA,EAAM;EACNC,WAAA,EAAa;EACbC,IAAA,EAAM,CAAC,QAAQ,SAAS,UAAU,SAAS,OAAO,WAAW,GAAG;EAChEC,MAAA,EAAQ;AACV;AAEA;AACA,OAAO,MAAMC,eAAA,GAA+B;EAC1CC,KAAA,EAAO,CAAC;IAAEL,IAAA,EAAM;IAAUE,IAAA,EAAM,CAAC,OAAO;EAAO,GAAG;IAAEF,IAAA,EAAM;EAAO,EAAE;EACnEG,MAAA,EAAQ;AACV;AAEA;AACA,OAAO,MAAMG,aAAA,GAA6B;EACxCN,IAAA,EAAM;EACNC,WAAA,EAAa;AACf;AAUA;;;;;AAKA,OAAO,MAAMM,iBAAA,GAAoBA,CAAC;EAChCC,QAAQ;EACRC,YAAY;EACZC,UAAA,GAAa,CAAC,CAAC;EACfC,QAAA,GAAW,EAAE;EACbR;AAAM,CACmD,MAAmB;EAC5EH,IAAA,EAAM;EACNY,oBAAA,EAAsB;EACtBF,UAAA,EAAY;IACVV,IAAA,EAAM;MAAEA,IAAA,EAAM;MAAUa,KAAA,EAAOL;IAAS;IACxCM,QAAA,EAAU;MAAEd,IAAA,EAAM;MAASe,KAAA,EAAON;IAAa;IAC/CO,SAAA,EAAWZ,eAAA;IACXa,MAAA,EAAQlB,YAAA;IACRmB,MAAA,EAAQ;MAAElB,IAAA,EAAM;IAAU;IAC1BmB,OAAA,EAASb,aAAA;IACT,GAAGI;EACL;EACAC,QAAA,EAAU,CAAC,YAAY,aAAa,UAAU,UAAU,QAAQ,W,GAAcA,QAAA,CAAS;EACvF,IAAIR,MAAA,GAAS;IAAEA;EAAO,IAAI,CAAC,CAAC;AAC9B","ignoreList":[]}
@@ -62,25 +62,67 @@ export interface LexicalRichText<TNode> {
62
62
  export type { SerializedAutoLinkNode, SerializedBlockNode, SerializedHeadingNode, SerializedHorizontalRuleNode, SerializedInlineBlockNode, SerializedLinkNode, SerializedListItemNode, SerializedListNode, SerializedQuoteNode, SerializedRelationshipNode, SerializedTableCellNode, SerializedTableNode, SerializedTableRowNode, SerializedUploadNode, };
63
63
  /** `SerializedEditorState` with nodes narrowed by `type`. No type-casting needed. */
64
64
  export type TypedEditorState<TNode extends SerializedLexicalNode = SerializedLexicalNode> = LexicalRichText<TNode>;
65
+ /**
66
+ * The node union of a generated `richText` field. Pass the field type — e.g.
67
+ * `RichTextNodes<Post['richText']>` — to type an individual node you build for that editor (for
68
+ * example a single block, or a `.map()` of nodes). To build a whole editor state, prefer passing
69
+ * the field type straight to {@link buildEditorState}.
70
+ */
71
+ export type RichTextNodes<TRichText> = NonNullable<TRichText> extends LexicalRichText<infer TNode> ? TNode : never;
65
72
  /**
66
73
  * All node types included by default in a lexical editor. Self-recursive —
67
74
  * each element node's `children` is `DefaultNodeTypes` again, no depth limit.
68
- * To compose your own union including the defaults, see {@link DefaultNodeTypesOf}.
75
+ * To compose your own union including the defaults, see {@link WithDefaultNodes}.
69
76
  */
70
77
  export type DefaultNodeTypes = SerializedAutoLinkNode<DefaultNodeTypes> | SerializedHeadingNode<DefaultNodeTypes> | SerializedHorizontalRuleNode | SerializedLineBreakNode | SerializedLinkNode<DefaultNodeTypes> | SerializedListItemNode<DefaultNodeTypes> | SerializedListNode<DefaultNodeTypes> | SerializedParagraphNode<DefaultNodeTypes> | SerializedQuoteNode<DefaultNodeTypes> | SerializedRelationshipNode | SerializedTabNode | SerializedTextNode | SerializedUploadNode;
71
78
  /**
72
- * Default node types, parameterised by the union to use for element children.
73
- * Use to mix custom nodes with the defaults:
79
+ * The built-in lexical nodes, plus your own - with your nodes threaded into every container's
80
+ * `children`, not just the top level. Pass your custom node(s) as the generic:
74
81
  *
75
82
  * ```ts
76
- * type MyNodes = DefaultNodeTypesOf<MyNodes> | SerializedBlockNode<MyNodes>
83
+ * type MyNodes = WithDefaultNodes<SerializedBlockNode<MyBlockData>>
77
84
  * ```
85
+ *
86
+ * Built by flattening {@link DefaultNodeRegistry} (`Registry[keyof Registry]`); see that interface
87
+ * for why the node set lives in a registry instead of being written as a plain union type.
78
88
  */
79
- export type DefaultNodeTypesOf<TNodes extends SerializedLexicalNode> = SerializedAutoLinkNode<TNodes> | SerializedHeadingNode<TNodes> | SerializedHorizontalRuleNode | SerializedLineBreakNode | SerializedLinkNode<TNodes> | SerializedListItemNode<TNodes> | SerializedListNode<TNodes> | SerializedParagraphNode<TNodes> | SerializedQuoteNode<TNodes> | SerializedRelationshipNode | SerializedTabNode | SerializedTextNode | SerializedUploadNode;
89
+ export type WithDefaultNodes<TCustom extends SerializedLexicalNode = never> = DefaultNodeRegistry<TCustom>[keyof DefaultNodeRegistry<TCustom>];
90
+ /** @internal Re-types an element node's `children` to the recursive node union. */
91
+ type WithRecursiveChildren<TNode, TCustom extends SerializedLexicalNode> = {
92
+ children: WithDefaultNodes<TCustom>[];
93
+ } & Omit<TNode, 'children'>;
94
+ /**
95
+ * @internal The set of default nodes, generic over the user's custom node(s). {@link WithDefaultNodes}
96
+ * flattens it into the node union with `Registry[keyof Registry]`.
97
+ *
98
+ * Why a registry interface instead of writing the union directly? The union has to be self-referential:
99
+ * every element node's `children` is the same node union (so custom nodes nest inside containers too).
100
+ * A generic *type alias* can't reference itself that way - `type N<T> = SerializedParagraphNode<N<T>> | ...`
101
+ * is a `TS2456` circular reference, because instantiating a type alias resolves its type argument
102
+ * eagerly. An *interface* resolves its members lazily, so the self-reference inside `children: ...[]`
103
+ * is allowed - the recursion is legal precisely because it lives inside this interface. Reusing the
104
+ * real node interfaces (re-typing only `children`) keeps each entry in sync with its node's real shape.
105
+ */
106
+ interface DefaultNodeRegistry<TCustom extends SerializedLexicalNode> {
107
+ autolink: WithRecursiveChildren<SerializedAutoLinkNode<SerializedLexicalNode>, TCustom>;
108
+ custom: TCustom;
109
+ heading: WithRecursiveChildren<SerializedHeadingNode<SerializedLexicalNode>, TCustom>;
110
+ horizontalrule: SerializedHorizontalRuleNode;
111
+ linebreak: SerializedLineBreakNode;
112
+ link: WithRecursiveChildren<SerializedLinkNode<SerializedLexicalNode>, TCustom>;
113
+ list: WithRecursiveChildren<SerializedListNode<SerializedLexicalNode>, TCustom>;
114
+ listitem: WithRecursiveChildren<SerializedListItemNode<SerializedLexicalNode>, TCustom>;
115
+ paragraph: WithRecursiveChildren<SerializedParagraphNode<SerializedLexicalNode>, TCustom>;
116
+ quote: WithRecursiveChildren<SerializedQuoteNode<SerializedLexicalNode>, TCustom>;
117
+ relationship: SerializedRelationshipNode;
118
+ tab: SerializedTabNode;
119
+ text: SerializedTextNode;
120
+ upload: SerializedUploadNode;
121
+ }
80
122
  /**
81
- * Like `TypedEditorState` but includes all default node types. Pass extra
82
- * node types as a generic to union them at the top level; for nodes that
83
- * should also nest inside default containers, use {@link DefaultNodeTypesOf}.
123
+ * Like `TypedEditorState`, but pre-filled with every default node type. Pass extra node types as a
124
+ * generic to add your own; they're threaded into every container's `children` (via
125
+ * {@link WithDefaultNodes}), not just allowed at the top level.
84
126
  */
85
- export type DefaultTypedEditorState<TAdditionalNodeTypes extends null | SerializedLexicalNode = null> = [TAdditionalNodeTypes] extends null ? TypedEditorState<DefaultNodeTypes> : TypedEditorState<DefaultNodeTypes | NonNullable<TAdditionalNodeTypes>>;
127
+ export type DefaultTypedEditorState<TAdditionalNodeTypes extends null | SerializedLexicalNode = null> = TypedEditorState<WithDefaultNodes<NonNullable<TAdditionalNodeTypes>>>;
86
128
  //# sourceMappingURL=nodeTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeTypes.d.ts","sourceRoot":"","sources":["../../src/types/nodeTypes.ts"],"names":[],"mappings":"AAAA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,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,qBAAqB,CAAC,qBAAqB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IACrF,cAAc,EAAE,4BAA4B,CAAA;IAC5C,SAAS,EAAE,uBAAuB,CAAA;IAClC,IAAI,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IAC/E,IAAI,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IAC/E,QAAQ,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IACvF,SAAS,EAAE,qBAAqB,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IACzF,KAAK,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,CAAA;IACjF,YAAY,EAAE,0BAA0B,CAAA;IACxC,GAAG,EAAE,iBAAiB,CAAA;IACtB,IAAI,EAAE,kBAAkB,CAAA;IACxB,MAAM,EAAE,oBAAoB,CAAA;CAC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,CACjC,oBAAoB,SAAS,IAAI,GAAG,qBAAqB,GAAG,IAAI,IAC9D,gBAAgB,CAAC,gBAAgB,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Like `TypedEditorState` but includes all default node types. Pass extra
3
- * node types as a generic to union them at the top level; for nodes that
4
- * should also nest inside default containers, use {@link DefaultNodeTypesOf}.
2
+ * Like `TypedEditorState`, but pre-filled with every default node type. Pass extra node types as a
3
+ * generic to add your own; they're threaded into every container's `children` (via
4
+ * {@link WithDefaultNodes}), not just allowed at the top level.
5
5
  */export {};
6
6
  //# sourceMappingURL=nodeTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeTypes.js","names":[],"sources":["../../src/types/nodeTypes.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedQuoteNode } from '../features/blockquote/server/schema.js'\nimport type {\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../features/blocks/server/schema.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from '../features/experimental_table/server/schema.js'\nimport type { SerializedHeadingNode } from '../features/heading/server/schema.js'\nimport type { SerializedHorizontalRuleNode } from '../features/horizontalRule/server/schema.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from '../features/link/server/schema.js'\nimport type { SerializedListItemNode, SerializedListNode } from '../features/lists/shared/schema.js'\nimport type { SerializedRelationshipNode } from '../features/relationship/server/schema.js'\nimport type { SerializedUploadNode } from '../features/upload/server/schema.js'\n\n// The declarations below must stay byte-for-byte aligned with the TS source\n// strings Payload appends to `payload-types.ts` — twins live in\n// `types/builtInNodes.ts` and per-feature `schema.ts`.\n\n/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = '' | 'center' | 'end' | 'justify' | 'left' | 'right' | 'start'\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[]\n direction: LexicalElementDirection\n format: LexicalElementFormat\n indent: number\n textFormat?: number\n textStyle?: string\n version: number\n}\n\nexport type LexicalTextMode = 'normal' | 'segmented' | 'token'\n\nexport interface SerializedTextNode {\n detail: number\n format: number\n mode: LexicalTextMode\n style: string\n text: string\n type: 'text'\n version: number\n}\n\nexport interface SerializedTabNode {\n detail: number\n format: number\n mode: LexicalTextMode\n style: string\n text: string\n type: 'tab'\n version: number\n}\n\nexport interface SerializedLineBreakNode {\n type: 'linebreak'\n version: number\n}\n\nexport interface SerializedParagraphNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n textFormat: number\n textStyle: string\n type: 'paragraph'\n}\n\n/** Shape of a Lexical `richText` field. */\nexport interface LexicalRichText<TNode> {\n root: {\n children: TNode[]\n direction: LexicalElementDirection\n format: LexicalElementFormat\n indent: number\n type: 'root'\n version: number\n }\n}\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\n/** `SerializedEditorState` with nodes narrowed by `type`. No type-casting needed. */\nexport type TypedEditorState<TNode extends SerializedLexicalNode = SerializedLexicalNode> =\n LexicalRichText<TNode>\n\n/**\n * All node types included by default in a lexical editor. Self-recursive —\n * each element node's `children` is `DefaultNodeTypes` again, no depth limit.\n * To compose your own union including the defaults, see {@link DefaultNodeTypesOf}.\n */\nexport type DefaultNodeTypes =\n | SerializedAutoLinkNode<DefaultNodeTypes>\n //| SerializedBlockNode // Not included by default\n | SerializedHeadingNode<DefaultNodeTypes>\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode<DefaultNodeTypes>\n | SerializedListItemNode<DefaultNodeTypes>\n | SerializedListNode<DefaultNodeTypes>\n | SerializedParagraphNode<DefaultNodeTypes>\n | SerializedQuoteNode<DefaultNodeTypes>\n | SerializedRelationshipNode\n | SerializedTabNode\n | SerializedTextNode\n | SerializedUploadNode\n\n/**\n * Default node types, parameterised by the union to use for element children.\n * Use to mix custom nodes with the defaults:\n *\n * ```ts\n * type MyNodes = DefaultNodeTypesOf<MyNodes> | SerializedBlockNode<MyNodes>\n * ```\n */\nexport type DefaultNodeTypesOf<TNodes extends SerializedLexicalNode> =\n | SerializedAutoLinkNode<TNodes>\n | SerializedHeadingNode<TNodes>\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode<TNodes>\n | SerializedListItemNode<TNodes>\n | SerializedListNode<TNodes>\n | SerializedParagraphNode<TNodes>\n | SerializedQuoteNode<TNodes>\n | SerializedRelationshipNode\n | SerializedTabNode\n | SerializedTextNode\n | SerializedUploadNode\n\n/**\n * Like `TypedEditorState` but includes all default node types. Pass extra\n * node types as a generic to union them at the top level; for nodes that\n * should also nest inside default containers, use {@link DefaultNodeTypesOf}.\n */\nexport type DefaultTypedEditorState<\n TAdditionalNodeTypes extends null | SerializedLexicalNode = null,\n> = [TAdditionalNodeTypes] extends null\n ? TypedEditorState<DefaultNodeTypes>\n : TypedEditorState<DefaultNodeTypes | NonNullable<TAdditionalNodeTypes>>\n"],"mappings":"AAqJA;;;;GAKA","ignoreList":[]}
1
+ {"version":3,"file":"nodeTypes.js","names":[],"sources":["../../src/types/nodeTypes.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedQuoteNode } from '../features/blockquote/server/schema.js'\nimport type {\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../features/blocks/server/schema.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from '../features/experimental_table/server/schema.js'\nimport type { SerializedHeadingNode } from '../features/heading/server/schema.js'\nimport type { SerializedHorizontalRuleNode } from '../features/horizontalRule/server/schema.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from '../features/link/server/schema.js'\nimport type { SerializedListItemNode, SerializedListNode } from '../features/lists/shared/schema.js'\nimport type { SerializedRelationshipNode } from '../features/relationship/server/schema.js'\nimport type { SerializedUploadNode } from '../features/upload/server/schema.js'\n\n// The declarations below must stay byte-for-byte aligned with the TS source\n// strings Payload appends to `payload-types.ts` — twins live in\n// `types/builtInNodes.ts` and per-feature `schema.ts`.\n\n/** @internal Core Lexical types — see @payloadcms/richtext-lexical. */\nexport type LexicalElementFormat = '' | 'center' | 'end' | 'justify' | 'left' | 'right' | 'start'\nexport type LexicalElementDirection = ('ltr' | 'rtl') | null\n\nexport interface SerializedLexicalElementBase<TChildren> {\n children: TChildren[]\n direction: LexicalElementDirection\n format: LexicalElementFormat\n indent: number\n textFormat?: number\n textStyle?: string\n version: number\n}\n\nexport type LexicalTextMode = 'normal' | 'segmented' | 'token'\n\nexport interface SerializedTextNode {\n detail: number\n format: number\n mode: LexicalTextMode\n style: string\n text: string\n type: 'text'\n version: number\n}\n\nexport interface SerializedTabNode {\n detail: number\n format: number\n mode: LexicalTextMode\n style: string\n text: string\n type: 'tab'\n version: number\n}\n\nexport interface SerializedLineBreakNode {\n type: 'linebreak'\n version: number\n}\n\nexport interface SerializedParagraphNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n textFormat: number\n textStyle: string\n type: 'paragraph'\n}\n\n/** Shape of a Lexical `richText` field. */\nexport interface LexicalRichText<TNode> {\n root: {\n children: TNode[]\n direction: LexicalElementDirection\n format: LexicalElementFormat\n indent: number\n type: 'root'\n version: number\n }\n}\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\n/** `SerializedEditorState` with nodes narrowed by `type`. No type-casting needed. */\nexport type TypedEditorState<TNode extends SerializedLexicalNode = SerializedLexicalNode> =\n LexicalRichText<TNode>\n\n/**\n * The node union of a generated `richText` field. Pass the field type — e.g.\n * `RichTextNodes<Post['richText']>` — to type an individual node you build for that editor (for\n * example a single block, or a `.map()` of nodes). To build a whole editor state, prefer passing\n * the field type straight to {@link buildEditorState}.\n */\nexport type RichTextNodes<TRichText> =\n NonNullable<TRichText> extends LexicalRichText<infer TNode> ? TNode : never\n\n/**\n * All node types included by default in a lexical editor. Self-recursive —\n * each element node's `children` is `DefaultNodeTypes` again, no depth limit.\n * To compose your own union including the defaults, see {@link WithDefaultNodes}.\n */\nexport type DefaultNodeTypes =\n | SerializedAutoLinkNode<DefaultNodeTypes>\n //| SerializedBlockNode // Not included by default\n | SerializedHeadingNode<DefaultNodeTypes>\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode<DefaultNodeTypes>\n | SerializedListItemNode<DefaultNodeTypes>\n | SerializedListNode<DefaultNodeTypes>\n | SerializedParagraphNode<DefaultNodeTypes>\n | SerializedQuoteNode<DefaultNodeTypes>\n | SerializedRelationshipNode\n | SerializedTabNode\n | SerializedTextNode\n | SerializedUploadNode\n\n/**\n * The built-in lexical nodes, plus your own - with your nodes threaded into every container's\n * `children`, not just the top level. Pass your custom node(s) as the generic:\n *\n * ```ts\n * type MyNodes = WithDefaultNodes<SerializedBlockNode<MyBlockData>>\n * ```\n *\n * Built by flattening {@link DefaultNodeRegistry} (`Registry[keyof Registry]`); see that interface\n * for why the node set lives in a registry instead of being written as a plain union type.\n */\nexport type WithDefaultNodes<TCustom extends SerializedLexicalNode = never> =\n DefaultNodeRegistry<TCustom>[keyof DefaultNodeRegistry<TCustom>]\n\n/** @internal Re-types an element node's `children` to the recursive node union. */\ntype WithRecursiveChildren<TNode, TCustom extends SerializedLexicalNode> = {\n children: WithDefaultNodes<TCustom>[]\n} & Omit<TNode, 'children'>\n\n/**\n * @internal The set of default nodes, generic over the user's custom node(s). {@link WithDefaultNodes}\n * flattens it into the node union with `Registry[keyof Registry]`.\n *\n * Why a registry interface instead of writing the union directly? The union has to be self-referential:\n * every element node's `children` is the same node union (so custom nodes nest inside containers too).\n * A generic *type alias* can't reference itself that way - `type N<T> = SerializedParagraphNode<N<T>> | ...`\n * is a `TS2456` circular reference, because instantiating a type alias resolves its type argument\n * eagerly. An *interface* resolves its members lazily, so the self-reference inside `children: ...[]`\n * is allowed - the recursion is legal precisely because it lives inside this interface. Reusing the\n * real node interfaces (re-typing only `children`) keeps each entry in sync with its node's real shape.\n */\ninterface DefaultNodeRegistry<TCustom extends SerializedLexicalNode> {\n autolink: WithRecursiveChildren<SerializedAutoLinkNode<SerializedLexicalNode>, TCustom>\n custom: TCustom\n heading: WithRecursiveChildren<SerializedHeadingNode<SerializedLexicalNode>, TCustom>\n horizontalrule: SerializedHorizontalRuleNode\n linebreak: SerializedLineBreakNode\n link: WithRecursiveChildren<SerializedLinkNode<SerializedLexicalNode>, TCustom>\n list: WithRecursiveChildren<SerializedListNode<SerializedLexicalNode>, TCustom>\n listitem: WithRecursiveChildren<SerializedListItemNode<SerializedLexicalNode>, TCustom>\n paragraph: WithRecursiveChildren<SerializedParagraphNode<SerializedLexicalNode>, TCustom>\n quote: WithRecursiveChildren<SerializedQuoteNode<SerializedLexicalNode>, TCustom>\n relationship: SerializedRelationshipNode\n tab: SerializedTabNode\n text: SerializedTextNode\n upload: SerializedUploadNode\n}\n\n/**\n * Like `TypedEditorState`, but pre-filled with every default node type. Pass extra node types as a\n * generic to add your own; they're threaded into every container's `children` (via\n * {@link WithDefaultNodes}), not just allowed at the top level.\n */\nexport type DefaultTypedEditorState<\n TAdditionalNodeTypes extends null | SerializedLexicalNode = null,\n> = TypedEditorState<WithDefaultNodes<NonNullable<TAdditionalNodeTypes>>>\n"],"mappings":"AAuLA;;;;GAKA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAqBxD,eAAO,MAAM,oBAAoB,EAAE,CAAC,IAAI,EAAE;IACxC,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAK,sBAAsB,CAAC,YAAY,CAyExC,CAAA"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAqBxD,eAAO,MAAM,oBAAoB,EAAE,CAAC,IAAI,EAAE;IACxC,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAK,sBAAsB,CAAC,YAAY,CAsFxC,CAAA"}
@@ -29,7 +29,7 @@ export const getFieldToJSONSchema = ({
29
29
  elementNodeSchema: args => elementNodeSchema({
30
30
  ...args,
31
31
  nodeUnionRef: {
32
- $ref: `#/definitions/${NODE_UNION_NAME_PLACEHOLDER}`
32
+ $ref: `#/$defs/${NODE_UNION_NAME_PLACEHOLDER}`
33
33
  }
34
34
  }),
35
35
  field,
@@ -51,7 +51,17 @@ export const getFieldToJSONSchema = ({
51
51
  const nodeUnionJson = JSON.stringify({
52
52
  oneOf: nodeSchemas
53
53
  });
54
- const hash = createHash('sha256').update(nodeUnionJson).digest('hex').slice(0, 8).toUpperCase();
54
+ // Features can register per-editor definitions during node-schema build (e.g. a link node's
55
+ // custom `LexicalLinkFields_<hash>`), keyed by the not-yet-resolved hash placeholder. The node
56
+ // union only `$ref`s them, so their content isn't in `nodeUnionJson` - two editors with the same
57
+ // nodes but different feature config (e.g. different custom link fields) would otherwise hash
58
+ // identically and overwrite each other's definition. To avoid that, include that content into the hash too.
59
+ const pendingDefinitions = [...interfaceNameDefinitions.entries()].filter(([key]) => key.includes(NODE_UNION_HASH_PLACEHOLDER)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
60
+ const hashInput = pendingDefinitions.length ? JSON.stringify({
61
+ definitions: pendingDefinitions,
62
+ oneOf: nodeSchemas
63
+ }) : nodeUnionJson;
64
+ const hash = createHash('sha256').update(hashInput).digest('hex').slice(0, 8).toUpperCase();
55
65
  const nodeUnionName = `LexicalNodes_${hash}`;
56
66
  // Replacing the hash resolves the union name and any feature-derived
57
67
  // sibling names in one pass.
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":["createHash","CORE_LEXICAL_TYPE_STRING","lineBreakNodeJSONSchema","paragraphNodeJSONSchema","rootNodeJSONSchema","tabNodeJSONSchema","textNodeJSONSchema","elementNodeSchema","NODE_UNION_HASH_PLACEHOLDER","NODE_UNION_NAME_PLACEHOLDER","getFieldToJSONSchema","editorConfig","collectionIDFieldTypes","config","field","i18n","interfaceNameDefinitions","typeStringDefinitions","add","nodeJsonSchemaArgs","args","nodeUnionRef","$ref","nodeUnionName","nodeSchemas","features","nodes","filter","node","jsonSchema","map","rootSchemaWithPlaceholder","nodeUnionJson","JSON","stringify","oneOf","hash","update","digest","slice","toUpperCase","replacePlaceholder","schemaString","parse","replaceAll","oldKey","schema","entries","newKey","resolvedSchema","delete","set"],"sources":["../../src/types/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\nimport { createHash } from 'crypto'\n\nimport type { JSONSchemaArgs } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextAdapter } from './index.js'\n\nimport {\n CORE_LEXICAL_TYPE_STRING,\n lineBreakNodeJSONSchema,\n paragraphNodeJSONSchema,\n rootNodeJSONSchema,\n tabNodeJSONSchema,\n textNodeJSONSchema,\n} from './builtInNodes.js'\nimport { elementNodeSchema } from './jsonSchemaHelpers.js'\n\n/**\n * The node-union name is a hash of its own schema (so identical editors dedupe).\n * Since the schema references the union name, we use a placeholder during build\n * and substitute the real hash once everything's assembled. Features can derive\n * sibling names (e.g. `LexicalLinkFields_<hash>`) using the bare hash placeholder.\n */\nconst NODE_UNION_HASH_PLACEHOLDER = '__LEXICAL_NODE_UNION_HASH__'\nconst NODE_UNION_NAME_PLACEHOLDER = `LexicalNodes_${NODE_UNION_HASH_PLACEHOLDER}`\n\nexport const getFieldToJSONSchema: (args: {\n editorConfig: SanitizedServerEditorConfig\n}) => LexicalRichTextAdapter['jsonSchema'] = ({ editorConfig }) => {\n return ({\n collectionIDFieldTypes,\n config,\n field,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n }) => {\n // Step 1: build the schema for every node type allowed in this field.\n\n typeStringDefinitions.add(CORE_LEXICAL_TYPE_STRING)\n\n const nodeJsonSchemaArgs: JSONSchemaArgs = {\n collectionIDFieldTypes,\n config,\n // Each element node needs its children typed using the union node type recursively\n elementNodeSchema: (args) =>\n elementNodeSchema({\n ...args,\n nodeUnionRef: {\n $ref: `#/definitions/${NODE_UNION_NAME_PLACEHOLDER}`,\n },\n }),\n field,\n i18n,\n interfaceNameDefinitions,\n nodeUnionName: NODE_UNION_NAME_PLACEHOLDER,\n typeStringDefinitions,\n }\n\n const nodeSchemas: JSONSchema4[] = [\n // Add built-in node schemas\n textNodeJSONSchema(nodeJsonSchemaArgs),\n tabNodeJSONSchema(nodeJsonSchemaArgs),\n lineBreakNodeJSONSchema(nodeJsonSchemaArgs),\n paragraphNodeJSONSchema(nodeJsonSchemaArgs),\n // Add feature node schemas\n ...editorConfig.features.nodes\n .filter((node) => node.jsonSchema)\n .map((node) => node.jsonSchema!(nodeJsonSchemaArgs)),\n ]\n const rootSchemaWithPlaceholder = rootNodeJSONSchema(nodeJsonSchemaArgs)\n\n // Step 2: get the final node union name, then replace the placeholder\n // in both the union members and the root node.\n //\n // See JSDocs for `NODE_UNION_NAME_PLACEHOLDER` for why we use a placeholder and hashing.\n const nodeUnionJson = JSON.stringify({ oneOf: nodeSchemas })\n\n const hash = createHash('sha256').update(nodeUnionJson).digest('hex').slice(0, 8).toUpperCase()\n const nodeUnionName = `LexicalNodes_${hash}`\n\n // Replacing the hash resolves the union name and any feature-derived\n // sibling names in one pass.\n const replacePlaceholder = (schemaString: string) =>\n JSON.parse(schemaString.replaceAll(NODE_UNION_HASH_PLACEHOLDER, hash)) as JSONSchema4\n\n // Resolve placeholders left in feature-registered definitions so Map keys\n // and `$ref` targets line up.\n for (const [oldKey, schema] of [...interfaceNameDefinitions.entries()]) {\n const newKey = oldKey.replaceAll(NODE_UNION_HASH_PLACEHOLDER, hash)\n const resolvedSchema = replacePlaceholder(JSON.stringify(schema))\n if (newKey !== oldKey) {\n interfaceNameDefinitions.delete(oldKey)\n }\n interfaceNameDefinitions.set(newKey, resolvedSchema)\n }\n\n interfaceNameDefinitions.set(nodeUnionName, replacePlaceholder(nodeUnionJson))\n\n return replacePlaceholder(JSON.stringify(rootSchemaWithPlaceholder))\n }\n}\n"],"mappings":"AAEA,SAASA,UAAU,QAAQ;AAM3B,SACEC,wBAAwB,EACxBC,uBAAuB,EACvBC,uBAAuB,EACvBC,kBAAkB,EAClBC,iBAAiB,EACjBC,kBAAkB,QACb;AACP,SAASC,iBAAiB,QAAQ;AAElC;;;;;;AAMA,MAAMC,2BAAA,GAA8B;AACpC,MAAMC,2BAAA,GAA8B,gBAAgBD,2BAAA,EAA6B;AAEjF,OAAO,MAAME,oBAAA,GAEgCA,CAAC;EAAEC;AAAY,CAAE;EAC5D,OAAO,CAAC;IACNC,sBAAsB;IACtBC,MAAM;IACNC,KAAK;IACLC,IAAI;IACJC,wBAAwB;IACxBC;EAAqB,CACtB;IACC;IAEAA,qBAAA,CAAsBC,GAAG,CAACjB,wBAAA;IAE1B,MAAMkB,kBAAA,GAAqC;MACzCP,sBAAA;MACAC,MAAA;MACA;MACAN,iBAAA,EAAoBa,IAAA,IAClBb,iBAAA,CAAkB;QAChB,GAAGa,IAAI;QACPC,YAAA,EAAc;UACZC,IAAA,EAAM,iBAAiBb,2BAAA;QACzB;MACF;MACFK,KAAA;MACAC,IAAA;MACAC,wBAAA;MACAO,aAAA,EAAed,2BAAA;MACfQ;IACF;IAEA,MAAMO,WAAA,GAA6B;IACjC;IACAlB,kBAAA,CAAmBa,kBAAA,GACnBd,iBAAA,CAAkBc,kBAAA,GAClBjB,uBAAA,CAAwBiB,kBAAA,GACxBhB,uBAAA,CAAwBgB,kBAAA;IACxB;OACGR,YAAA,CAAac,QAAQ,CAACC,KAAK,CAC3BC,MAAM,CAAEC,IAAA,IAASA,IAAA,CAAKC,UAAU,EAChCC,GAAG,CAAEF,IAAA,IAASA,IAAA,CAAKC,UAAU,CAAEV,kBAAA,GACnC;IACD,MAAMY,yBAAA,GAA4B3B,kBAAA,CAAmBe,kBAAA;IAErD;IACA;IACA;IACA;IACA,MAAMa,aAAA,GAAgBC,IAAA,CAAKC,SAAS,CAAC;MAAEC,KAAA,EAAOX;IAAY;IAE1D,MAAMY,IAAA,GAAOpC,UAAA,CAAW,UAAUqC,MAAM,CAACL,aAAA,EAAeM,MAAM,CAAC,OAAOC,KAAK,CAAC,GAAG,GAAGC,WAAW;IAC7F,MAAMjB,aAAA,GAAgB,gBAAgBa,IAAA,EAAM;IAE5C;IACA;IACA,MAAMK,kBAAA,GAAsBC,YAAA,IAC1BT,IAAA,CAAKU,KAAK,CAACD,YAAA,CAAaE,UAAU,CAACpC,2BAAA,EAA6B4B,IAAA;IAElE;IACA;IACA,KAAK,MAAM,CAACS,MAAA,EAAQC,MAAA,CAAO,IAAI,C,GAAI9B,wBAAA,CAAyB+B,OAAO,GAAG,EAAE;MACtE,MAAMC,MAAA,GAASH,MAAA,CAAOD,UAAU,CAACpC,2BAAA,EAA6B4B,IAAA;MAC9D,MAAMa,cAAA,GAAiBR,kBAAA,CAAmBR,IAAA,CAAKC,SAAS,CAACY,MAAA;MACzD,IAAIE,MAAA,KAAWH,MAAA,EAAQ;QACrB7B,wBAAA,CAAyBkC,MAAM,CAACL,MAAA;MAClC;MACA7B,wBAAA,CAAyBmC,GAAG,CAACH,MAAA,EAAQC,cAAA;IACvC;IAEAjC,wBAAA,CAAyBmC,GAAG,CAAC5B,aAAA,EAAekB,kBAAA,CAAmBT,aAAA;IAE/D,OAAOS,kBAAA,CAAmBR,IAAA,CAAKC,SAAS,CAACH,yBAAA;EAC3C;AACF","ignoreList":[]}
1
+ {"version":3,"file":"schema.js","names":["createHash","CORE_LEXICAL_TYPE_STRING","lineBreakNodeJSONSchema","paragraphNodeJSONSchema","rootNodeJSONSchema","tabNodeJSONSchema","textNodeJSONSchema","elementNodeSchema","NODE_UNION_HASH_PLACEHOLDER","NODE_UNION_NAME_PLACEHOLDER","getFieldToJSONSchema","editorConfig","collectionIDFieldTypes","config","field","i18n","interfaceNameDefinitions","typeStringDefinitions","add","nodeJsonSchemaArgs","args","nodeUnionRef","$ref","nodeUnionName","nodeSchemas","features","nodes","filter","node","jsonSchema","map","rootSchemaWithPlaceholder","nodeUnionJson","JSON","stringify","oneOf","pendingDefinitions","entries","key","includes","sort","a","b","hashInput","length","definitions","hash","update","digest","slice","toUpperCase","replacePlaceholder","schemaString","parse","replaceAll","oldKey","schema","newKey","resolvedSchema","delete","set"],"sources":["../../src/types/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\nimport { createHash } from 'crypto'\n\nimport type { JSONSchemaArgs } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextAdapter } from './index.js'\n\nimport {\n CORE_LEXICAL_TYPE_STRING,\n lineBreakNodeJSONSchema,\n paragraphNodeJSONSchema,\n rootNodeJSONSchema,\n tabNodeJSONSchema,\n textNodeJSONSchema,\n} from './builtInNodes.js'\nimport { elementNodeSchema } from './jsonSchemaHelpers.js'\n\n/**\n * The node-union name is a hash of its own schema (so identical editors dedupe).\n * Since the schema references the union name, we use a placeholder during build\n * and substitute the real hash once everything's assembled. Features can derive\n * sibling names (e.g. `LexicalLinkFields_<hash>`) using the bare hash placeholder.\n */\nconst NODE_UNION_HASH_PLACEHOLDER = '__LEXICAL_NODE_UNION_HASH__'\nconst NODE_UNION_NAME_PLACEHOLDER = `LexicalNodes_${NODE_UNION_HASH_PLACEHOLDER}`\n\nexport const getFieldToJSONSchema: (args: {\n editorConfig: SanitizedServerEditorConfig\n}) => LexicalRichTextAdapter['jsonSchema'] = ({ editorConfig }) => {\n return ({\n collectionIDFieldTypes,\n config,\n field,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n }) => {\n // Step 1: build the schema for every node type allowed in this field.\n\n typeStringDefinitions.add(CORE_LEXICAL_TYPE_STRING)\n\n const nodeJsonSchemaArgs: JSONSchemaArgs = {\n collectionIDFieldTypes,\n config,\n // Each element node needs its children typed using the union node type recursively\n elementNodeSchema: (args) =>\n elementNodeSchema({\n ...args,\n nodeUnionRef: {\n $ref: `#/$defs/${NODE_UNION_NAME_PLACEHOLDER}`,\n },\n }),\n field,\n i18n,\n interfaceNameDefinitions,\n nodeUnionName: NODE_UNION_NAME_PLACEHOLDER,\n typeStringDefinitions,\n }\n\n const nodeSchemas: JSONSchema4[] = [\n // Add built-in node schemas\n textNodeJSONSchema(nodeJsonSchemaArgs),\n tabNodeJSONSchema(nodeJsonSchemaArgs),\n lineBreakNodeJSONSchema(nodeJsonSchemaArgs),\n paragraphNodeJSONSchema(nodeJsonSchemaArgs),\n // Add feature node schemas\n ...editorConfig.features.nodes\n .filter((node) => node.jsonSchema)\n .map((node) => node.jsonSchema!(nodeJsonSchemaArgs)),\n ]\n const rootSchemaWithPlaceholder = rootNodeJSONSchema(nodeJsonSchemaArgs)\n\n // Step 2: get the final node union name, then replace the placeholder\n // in both the union members and the root node.\n //\n // See JSDocs for `NODE_UNION_NAME_PLACEHOLDER` for why we use a placeholder and hashing.\n const nodeUnionJson = JSON.stringify({ oneOf: nodeSchemas })\n\n // Features can register per-editor definitions during node-schema build (e.g. a link node's\n // custom `LexicalLinkFields_<hash>`), keyed by the not-yet-resolved hash placeholder. The node\n // union only `$ref`s them, so their content isn't in `nodeUnionJson` - two editors with the same\n // nodes but different feature config (e.g. different custom link fields) would otherwise hash\n // identically and overwrite each other's definition. To avoid that, include that content into the hash too.\n const pendingDefinitions = [...interfaceNameDefinitions.entries()]\n .filter(([key]) => key.includes(NODE_UNION_HASH_PLACEHOLDER))\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n\n const hashInput = pendingDefinitions.length\n ? JSON.stringify({ definitions: pendingDefinitions, oneOf: nodeSchemas })\n : nodeUnionJson\n\n const hash = createHash('sha256').update(hashInput).digest('hex').slice(0, 8).toUpperCase()\n const nodeUnionName = `LexicalNodes_${hash}`\n\n // Replacing the hash resolves the union name and any feature-derived\n // sibling names in one pass.\n const replacePlaceholder = (schemaString: string) =>\n JSON.parse(schemaString.replaceAll(NODE_UNION_HASH_PLACEHOLDER, hash)) as JSONSchema4\n\n // Resolve placeholders left in feature-registered definitions so Map keys\n // and `$ref` targets line up.\n for (const [oldKey, schema] of [...interfaceNameDefinitions.entries()]) {\n const newKey = oldKey.replaceAll(NODE_UNION_HASH_PLACEHOLDER, hash)\n const resolvedSchema = replacePlaceholder(JSON.stringify(schema))\n if (newKey !== oldKey) {\n interfaceNameDefinitions.delete(oldKey)\n }\n interfaceNameDefinitions.set(newKey, resolvedSchema)\n }\n\n interfaceNameDefinitions.set(nodeUnionName, replacePlaceholder(nodeUnionJson))\n\n return replacePlaceholder(JSON.stringify(rootSchemaWithPlaceholder))\n }\n}\n"],"mappings":"AAEA,SAASA,UAAU,QAAQ;AAM3B,SACEC,wBAAwB,EACxBC,uBAAuB,EACvBC,uBAAuB,EACvBC,kBAAkB,EAClBC,iBAAiB,EACjBC,kBAAkB,QACb;AACP,SAASC,iBAAiB,QAAQ;AAElC;;;;;;AAMA,MAAMC,2BAAA,GAA8B;AACpC,MAAMC,2BAAA,GAA8B,gBAAgBD,2BAAA,EAA6B;AAEjF,OAAO,MAAME,oBAAA,GAEgCA,CAAC;EAAEC;AAAY,CAAE;EAC5D,OAAO,CAAC;IACNC,sBAAsB;IACtBC,MAAM;IACNC,KAAK;IACLC,IAAI;IACJC,wBAAwB;IACxBC;EAAqB,CACtB;IACC;IAEAA,qBAAA,CAAsBC,GAAG,CAACjB,wBAAA;IAE1B,MAAMkB,kBAAA,GAAqC;MACzCP,sBAAA;MACAC,MAAA;MACA;MACAN,iBAAA,EAAoBa,IAAA,IAClBb,iBAAA,CAAkB;QAChB,GAAGa,IAAI;QACPC,YAAA,EAAc;UACZC,IAAA,EA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AM;IAE5C;IACA;IACA,MAAMK,kBAAA,GAAsBC,YAAA,IAC1BnB,IAAA,CAAKoB,KAAK,CAACD,YAAA,CAAaE,UAAU,CAAC9C,2BAAA,EAA6BsC,IAAA;IAElE;IACA;IACA,KAAK,MAAM,CAACS,MAAA,EAAQC,MAAA,CAAO,IAAI,C,GAAIxC,wBAAA,CAAyBqB,OAAO,GAAG,EAAE;MACtE,MAAMoB,MAAA,GAASF,MAAA,CAAOD,UAAU,CAAC9C,2BAAA,EAA6BsC,IAAA;MAC9D,MAAMY,cAAA,GAAiBP,kBAAA,CAAmBlB,IAAA,CAAKC,SAAS,CAACsB,MAAA;MACzD,IAAIC,MAAA,KAAWF,MAAA,EAAQ;QACrBvC,wBAAA,CAAyB2C,MAAM,CAACJ,MAAA;MAClC;MACAvC,wBAAA,CAAyB4C,GAAG,CAACH,MAAA,EAAQC,cAAA;IACvC;IAEA1C,wBAAA,CAAyB4C,GAAG,CAACrC,aAAA,EAAe4B,kBAAA,CAAmBnB,aAAA;IAE/D,OAAOmB,kBAAA,CAAmBlB,IAAA,CAAKC,SAAS,CAACH,yBAAA;EAC3C;AACF","ignoreList":[]}
@@ -1,5 +1,10 @@
1
1
  import type { SerializedLexicalNode } from 'lexical';
2
2
  import type { DefaultNodeTypes, TypedEditorState } from '../types/nodeTypes.js';
3
+ /**
4
+ * The node union to build with. Accepts either a node union directly (e.g. `DefaultNodeTypes`) or a
5
+ * generated `richText` field type (e.g. `Post['richText']`), whose nodes are extracted automatically.
6
+ */
7
+ type BuildNodes<T> = NonNullable<T> extends TypedEditorState<infer TNode extends SerializedLexicalNode> ? TNode : Extract<NonNullable<T>, SerializedLexicalNode>;
3
8
  /**
4
9
  * Helper to build lexical editor state JSON from text and/or nodes.
5
10
  *
@@ -36,11 +41,19 @@ import type { DefaultNodeTypes, TypedEditorState } from '../types/nodeTypes.js';
36
41
  * ],
37
42
  * })
38
43
  * ```
44
+ *
45
+ * @example
46
+ *
47
+ * passing a generated `richText` field type — the result is exactly that field's type:
48
+ *
49
+ * ```ts
50
+ * post.richText = buildEditorState<Post['richText']>({ text: 'Hello world' })
51
+ * ```
39
52
  */
40
- export declare function buildEditorState<T extends SerializedLexicalNode>({ nodes, text, }: {
41
- nodes?: TypedEditorState<T>['root']['children'];
53
+ export declare function buildEditorState<T extends null | SerializedLexicalNode | TypedEditorState<SerializedLexicalNode> | undefined = DefaultNodeTypes>({ nodes, text, }: {
54
+ nodes?: TypedEditorState<BuildNodes<T>>['root']['children'];
42
55
  text?: string;
43
- }): TypedEditorState<T>;
56
+ }): TypedEditorState<BuildNodes<T>>;
44
57
  /**
45
58
  *
46
59
  * Alias for `buildEditorState<DefaultNodeTypes>`
@@ -49,4 +62,5 @@ export declare function buildEditorState<T extends SerializedLexicalNode>({ node
49
62
  * @internal
50
63
  */
51
64
  export declare const buildDefaultEditorState: typeof buildEditorState<DefaultNodeTypes>;
65
+ export {};
52
66
  //# sourceMappingURL=buildEditorState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildEditorState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildEditorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAEhB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,qBAAqB,EAAE,EAChE,KAAK,EACL,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAuDtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,gBAAgB,CAAC,gBAAgB,CAC1C,CAAA"}
1
+ {"version":3,"file":"buildEditorState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildEditorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAEhB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B;;;GAGG;AACH,KAAK,UAAU,CAAC,CAAC,IACf,WAAW,CAAC,CAAC,CAAC,SAAS,gBAAgB,CAAC,MAAM,KAAK,SAAS,qBAAqB,CAAC,GAC9E,KAAK,GACL,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,SACG,IAAI,GACJ,qBAAqB,GACrB,gBAAgB,CAAC,qBAAqB,CAAC,GACvC,SAAS,GAAG,gBAAgB,EAChC,EACA,KAAK,EACL,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAuDlC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,gBAAgB,CAAC,gBAAgB,CAC1C,CAAA"}
@@ -34,6 +34,14 @@
34
34
  * ],
35
35
  * })
36
36
  * ```
37
+ *
38
+ * @example
39
+ *
40
+ * passing a generated `richText` field type — the result is exactly that field's type:
41
+ *
42
+ * ```ts
43
+ * post.richText = buildEditorState<Post['richText']>({ text: 'Hello world' })
44
+ * ```
37
45
  */export function buildEditorState({
38
46
  nodes,
39
47
  text
@@ -1 +1 @@
1
- {"version":3,"file":"buildEditorState.js","names":["buildEditorState","nodes","text","editorJSON","root","type","children","direction","format","indent","version","push","detail","mode","style","textFormat","textStyle","length","buildDefaultEditorState"],"sources":["../../src/utilities/buildEditorState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n DefaultTypedEditorState,\n TypedEditorState,\n} from '../types/nodeTypes.js'\n\n/**\n * Helper to build lexical editor state JSON from text and/or nodes.\n *\n * @param nodes - The nodes to include in the editor state. If you pass the `text` argument, this will append your nodes after the first paragraph node.\n * @param text - The text content to include in the editor state. This will create a paragraph node with a text node for you and set that as the first node.\n * @returns The constructed editor state JSON.\n *\n * @example\n *\n * just passing text:\n *\n * ```ts\n * const editorState = buildEditorState<DefaultNodeTypes>({ text: 'Hello world' }) // result typed as DefaultTypedEditorState\n * ```\n *\n * @example\n *\n * passing nodes:\n *\n * ```ts\n * const editorState = // result typed as TypedEditorState<DefaultNodeTypes | SerializedBlockNode> (or TypedEditorState<SerializedBlockNode>)\n * buildEditorState<DefaultNodeTypes | SerializedBlockNode>({ // or just buildEditorState<SerializedBlockNode> if you *only* want to allow block nodes\n * nodes: [\n * {\n * type: 'block',\n * fields: {\n * id: 'id',\n * blockName: 'Cool block',\n * blockType: 'myBlock',\n * },\n * format: 'left',\n * version: 1,\n * }\n * ],\n * })\n * ```\n */\nexport function buildEditorState<T extends SerializedLexicalNode>({\n nodes,\n text,\n}: {\n nodes?: TypedEditorState<T>['root']['children']\n text?: string\n}): TypedEditorState<T> {\n const editorJSON: DefaultTypedEditorState = {\n root: {\n type: 'root',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n\n if (text) {\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [\n {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n },\n ],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n if (nodes?.length) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorJSON.root.children.push(...(nodes as any))\n }\n\n if (editorJSON.root.children.length === 0) {\n // An error will be thrown if the root node has no children\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n return editorJSON as TypedEditorState<T>\n}\n\n/**\n *\n * Alias for `buildEditorState<DefaultNodeTypes>`\n *\n * @experimental this API may change or be removed in a minor release\n * @internal\n */\nexport const buildDefaultEditorState: typeof buildEditorState<DefaultNodeTypes> =\n buildEditorState<DefaultNodeTypes>\n"],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCA,OAAO,SAASA,iBAAkD;EAChEC,KAAK;EACLC;AAAI,CAIL;EACC,MAAMC,UAAA,GAAsC;IAC1CC,IAAA,EAAM;MACJC,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRC,OAAA,EAAS;IACX;EACF;EAEA,IAAIR,IAAA,EAAM;IACRC,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,CACR;QACED,IAAA,EAAM;QACNO,MAAA,EAAQ;QACRJ,MAAA,EAAQ;QACRK,IAAA,EAAM;QACNC,KAAA,EAAO;QACPZ,IAAA;QACAQ,OAAA,EAAS;MACX,EACD;MACDH,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,IAAIT,KAAA,EAAOgB,MAAA,EAAQ;IACjB;IACAd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,IAAKV,KAAA;EACpC;EAEA,IAAIE,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACW,MAAM,KAAK,GAAG;IACzC;IACAd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,OAAOP,UAAA;AACT;AAEA;;;;;;;AAOA,OAAO,MAAMe,uBAAA,GACXlB,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"buildEditorState.js","names":["buildEditorState","nodes","text","editorJSON","root","type","children","direction","format","indent","version","push","detail","mode","style","textFormat","textStyle","length","buildDefaultEditorState"],"sources":["../../src/utilities/buildEditorState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n DefaultTypedEditorState,\n TypedEditorState,\n} from '../types/nodeTypes.js'\n\n/**\n * The node union to build with. Accepts either a node union directly (e.g. `DefaultNodeTypes`) or a\n * generated `richText` field type (e.g. `Post['richText']`), whose nodes are extracted automatically.\n */\ntype BuildNodes<T> =\n NonNullable<T> extends TypedEditorState<infer TNode extends SerializedLexicalNode>\n ? TNode\n : Extract<NonNullable<T>, SerializedLexicalNode>\n\n/**\n * Helper to build lexical editor state JSON from text and/or nodes.\n *\n * @param nodes - The nodes to include in the editor state. If you pass the `text` argument, this will append your nodes after the first paragraph node.\n * @param text - The text content to include in the editor state. This will create a paragraph node with a text node for you and set that as the first node.\n * @returns The constructed editor state JSON.\n *\n * @example\n *\n * just passing text:\n *\n * ```ts\n * const editorState = buildEditorState<DefaultNodeTypes>({ text: 'Hello world' }) // result typed as DefaultTypedEditorState\n * ```\n *\n * @example\n *\n * passing nodes:\n *\n * ```ts\n * const editorState = // result typed as TypedEditorState<DefaultNodeTypes | SerializedBlockNode> (or TypedEditorState<SerializedBlockNode>)\n * buildEditorState<DefaultNodeTypes | SerializedBlockNode>({ // or just buildEditorState<SerializedBlockNode> if you *only* want to allow block nodes\n * nodes: [\n * {\n * type: 'block',\n * fields: {\n * id: 'id',\n * blockName: 'Cool block',\n * blockType: 'myBlock',\n * },\n * format: 'left',\n * version: 1,\n * }\n * ],\n * })\n * ```\n *\n * @example\n *\n * passing a generated `richText` field type — the result is exactly that field's type:\n *\n * ```ts\n * post.richText = buildEditorState<Post['richText']>({ text: 'Hello world' })\n * ```\n */\nexport function buildEditorState<\n T extends\n | null\n | SerializedLexicalNode\n | TypedEditorState<SerializedLexicalNode>\n | undefined = DefaultNodeTypes,\n>({\n nodes,\n text,\n}: {\n nodes?: TypedEditorState<BuildNodes<T>>['root']['children']\n text?: string\n}): TypedEditorState<BuildNodes<T>> {\n const editorJSON: DefaultTypedEditorState = {\n root: {\n type: 'root',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n\n if (text) {\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [\n {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n },\n ],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n if (nodes?.length) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorJSON.root.children.push(...(nodes as any))\n }\n\n if (editorJSON.root.children.length === 0) {\n // An error will be thrown if the root node has no children\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n return editorJSON as TypedEditorState<BuildNodes<T>>\n}\n\n/**\n *\n * Alias for `buildEditorState<DefaultNodeTypes>`\n *\n * @experimental this API may change or be removed in a minor release\n * @internal\n */\nexport const buildDefaultEditorState: typeof buildEditorState<DefaultNodeTypes> =\n buildEditorState<DefaultNodeTypes>\n"],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CA,OAAO,SAASA,iBAMd;EACAC,KAAK;EACLC;AAAI,CAIL;EACC,MAAMC,UAAA,GAAsC;IAC1CC,IAAA,EAAM;MACJC,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRC,OAAA,EAAS;IACX;EACF;EAEA,IAAIR,IAAA,EAAM;IACRC,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,CACR;QACED,IAAA,EAAM;QACNO,MAAA,EAAQ;QACRJ,MAAA,EAAQ;QACRK,IAAA,EAAM;QACNC,KAAA,EAAO;QACPZ,IAAA;QACAQ,OAAA,EAAS;MACX,EACD;MACDH,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,IAAIT,KAAA,EAAOgB,MAAA,EAAQ;IACjB;IACAd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,IAAKV,KAAA;EACpC;EAEA,IAAIE,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACW,MAAM,KAAK,GAAG;IACzC;IACAd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,OAAOP,UAAA;AACT;AAEA;;;;;;;AAOA,OAAO,MAAMe,uBAAA,GACXlB,gBAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { SerializedLexicalNode } from 'lexical';
2
- import type { ClientFieldSchemaMap, DocumentPreferences, FieldSchemaMap, FormState, Operation, PayloadRequest, RichTextField, SanitizedFieldPermissions } from 'payload';
2
+ import type { ClientFieldSchemaMap, ComponentRenderer, DocumentPreferences, FieldSchemaMap, FormState, Operation, PayloadRequest, RichTextField, SanitizedFieldPermissions } from 'payload';
3
3
  export type InitialLexicalFormState = {
4
4
  [nodeID: string]: {
5
5
  [key: string]: any;
@@ -19,6 +19,7 @@ type Props = {
19
19
  operation: Operation;
20
20
  permissions?: SanitizedFieldPermissions;
21
21
  preferences: DocumentPreferences;
22
+ renderComponent: ComponentRenderer;
22
23
  renderFieldFn: any;
23
24
  req: PayloadRequest;
24
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"buildInitialState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildInitialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,SAAS,CAAC,EAAE,SAAS,CAAA;KACtB,CAAA;CACF,CAAA;AAED,KAAK,KAAK,GAAG;IACX,OAAO,EAAE;QACP,oBAAoB,EAAE,oBAAoB,CAAA;QAC1C,cAAc,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,GAAG,CAAA;QAClB,KAAK,EAAE,aAAa,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACpB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,SAAS,EAAE,SAAS,CAAA;QACpB,WAAW,CAAC,EAAE,yBAAyB,CAAA;QACvC,WAAW,EAAE,mBAAmB,CAAA;QAChC,aAAa,EAAE,GAAG,CAAA;QAClB,GAAG,EAAE,cAAc,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,YAAY,EAAE,oBAAoB,EAClC,QAAQ,GACT,EAAE,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA4D1C"}
1
+ {"version":3,"file":"buildInitialState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildInitialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAMhB,MAAM,MAAM,uBAAuB,GAAG;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;QAClB,SAAS,CAAC,EAAE,SAAS,CAAA;KACtB,CAAA;CACF,CAAA;AAED,KAAK,KAAK,GAAG;IACX,OAAO,EAAE;QACP,oBAAoB,EAAE,oBAAoB,CAAA;QAC1C,cAAc,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,GAAG,CAAA;QAClB,KAAK,EAAE,aAAa,CAAA;QACpB,cAAc,EAAE,cAAc,CAAA;QAC9B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;QACpB,sBAAsB,EAAE,MAAM,CAAA;QAC9B,SAAS,EAAE,SAAS,CAAA;QACpB,WAAW,CAAC,EAAE,yBAAyB,CAAA;QACvC,WAAW,EAAE,mBAAmB,CAAA;QAChC,eAAe,EAAE,iBAAiB,CAAA;QAClC,aAAa,EAAE,GAAG,CAAA;QAClB,GAAG,EAAE,cAAc,CAAA;KACpB,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAClC,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,YAAY,EAAE,oBAAoB,EAClC,QAAQ,GACT,EAAE,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA4D1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildInitialState.js","names":["fieldSchemasToFormState","buildInitialState","context","initialState","initialStateFromArgs","nodeData","node","children","type","blockNode","id","fields","schemaFieldsPath","lexicalFieldSchemaPath","blockType","formStateResult","clientFieldSchemaMap","collectionSlug","data","documentData","fieldSchemaMap","get","initialBlockData","operation","permissions","preferences","readOnly","disabled","renderAllFields","renderFieldFn","req","schemaPath","formState","currentFieldPreferences","field","name","collapsedArray","collapsed","Array","isArray","includes"],"sources":["../../src/utilities/buildInitialState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientFieldSchemaMap,\n DocumentPreferences,\n FieldSchemaMap,\n FormState,\n Operation,\n PayloadRequest,\n RichTextField,\n SanitizedFieldPermissions,\n} from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { SerializedBlockNode } from '../types/nodeTypes.js'\n\nexport type InitialLexicalFormState = {\n [nodeID: string]: {\n [key: string]: any\n formState?: FormState\n }\n}\n\ntype Props = {\n context: {\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n disabled?: boolean\n documentData?: any\n field: RichTextField\n fieldSchemaMap: FieldSchemaMap\n id?: number | string\n lexicalFieldSchemaPath: string\n operation: Operation\n permissions?: SanitizedFieldPermissions\n preferences: DocumentPreferences\n renderFieldFn: any\n req: PayloadRequest\n }\n initialState?: InitialLexicalFormState\n nodeData: SerializedLexicalNode[]\n}\n\nexport async function buildInitialState({\n context,\n initialState: initialStateFromArgs,\n nodeData,\n}: Props): Promise<InitialLexicalFormState> {\n let initialState: InitialLexicalFormState = initialStateFromArgs ?? {}\n for (const node of nodeData) {\n if ('children' in node) {\n initialState = await buildInitialState({\n context,\n initialState,\n nodeData: node.children as SerializedLexicalNode[],\n })\n }\n\n if (node.type === 'block' || node.type === 'inlineBlock') {\n const blockNode = node as SerializedBlockNode\n const id = blockNode?.fields?.id\n if (!id) {\n continue\n }\n\n const schemaFieldsPath =\n node.type === 'block'\n ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields`\n : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`\n\n // Build form state for the block\n\n const formStateResult = await fieldSchemasToFormState({\n id: context.id,\n clientFieldSchemaMap: context.clientFieldSchemaMap,\n collectionSlug: context.collectionSlug,\n data: blockNode.fields,\n documentData: context.documentData,\n fields: (context.fieldSchemaMap.get(schemaFieldsPath) as any)?.fields,\n fieldSchemaMap: context.fieldSchemaMap,\n initialBlockData: blockNode.fields,\n operation: context.operation as any, // TODO: Type\n permissions: true,\n preferences: context.preferences,\n readOnly: context.disabled,\n renderAllFields: true, // If this function runs, the parent lexical field is being re-rendered => thus we can assume all its sub-fields need to be re-rendered\n renderFieldFn: context.renderFieldFn,\n req: context.req,\n schemaPath: schemaFieldsPath,\n })\n\n if (!initialState[id]) {\n initialState[id] = {}\n }\n\n initialState[id].formState = formStateResult\n\n if (node.type === 'block') {\n const currentFieldPreferences = context.preferences?.fields?.[context.field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n if (Array.isArray(collapsedArray) && collapsedArray.includes(id)) {\n initialState[id].collapsed = true\n }\n }\n }\n }\n return initialState\n}\n"],"mappings":"AAYA,SAASA,uBAAuB,QAAQ;AA+BxC,OAAO,eAAeC,kBAAkB;EACtCC,OAAO;EACPC,YAAA,EAAcC,oBAAoB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AAA,CAAQyB,QAAQ;QAC1BC,eAAA,EAAiB;QACjBC,aAAA,EAAe3B,OAAA,CAAQ2B,aAAa;QACpCC,GAAA,EAAK5B,OAAA,CAAQ4B,GAAG;QAChBC,UAAA,EAAYnB;MACd;MAEA,IAAI,CAACT,YAAY,CAACO,EAAA,CAAG,EAAE;QACrBP,YAAY,CAACO,EAAA,CAAG,GAAG,CAAC;MACtB;MAEAP,YAAY,CAACO,EAAA,CAAG,CAACsB,SAAS,GAAGjB,eAAA;MAE7B,IAAIT,IAAA,CAAKE,IAAI,KAAK,SAAS;QACzB,MAAMyB,uBAAA,GAA0B/B,OAAA,CAAQuB,WAAW,EAAEd,MAAA,GAAST,OAAA,CAAQgC,KAAK,CAACC,IAAI,CAAC;QACjF,MAAMC,cAAA,GAAiBH,uBAAA,EAAyBI,SAAA;QAChD,IAAIC,KAAA,CAAMC,OAAO,CAACH,cAAA,KAAmBA,cAAA,CAAeI,QAAQ,CAAC9B,EAAA,GAAK;UAChEP,YAAY,CAACO,EAAA,CAAG,CAAC2B,SAAS,GAAG;QAC/B;MACF;IACF;EACF;EACA,OAAOlC,YAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"buildInitialState.js","names":["fieldSchemasToFormState","buildInitialState","context","initialState","initialStateFromArgs","nodeData","node","children","type","blockNode","id","fields","schemaFieldsPath","lexicalFieldSchemaPath","blockType","formStateResult","clientFieldSchemaMap","collectionSlug","data","documentData","fieldSchemaMap","get","initialBlockData","operation","permissions","preferences","readOnly","disabled","renderAllFields","renderFieldFn","req","schemaPath","formState","currentFieldPreferences","field","name","collapsedArray","collapsed","Array","isArray","includes"],"sources":["../../src/utilities/buildInitialState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientFieldSchemaMap,\n ComponentRenderer,\n DocumentPreferences,\n FieldSchemaMap,\n FormState,\n Operation,\n PayloadRequest,\n RichTextField,\n SanitizedFieldPermissions,\n} from 'payload'\n\nimport { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\n\nimport type { SerializedBlockNode } from '../types/nodeTypes.js'\n\nexport type InitialLexicalFormState = {\n [nodeID: string]: {\n [key: string]: any\n formState?: FormState\n }\n}\n\ntype Props = {\n context: {\n clientFieldSchemaMap: ClientFieldSchemaMap\n collectionSlug: string\n disabled?: boolean\n documentData?: any\n field: RichTextField\n fieldSchemaMap: FieldSchemaMap\n id?: number | string\n lexicalFieldSchemaPath: string\n operation: Operation\n permissions?: SanitizedFieldPermissions\n preferences: DocumentPreferences\n renderComponent: ComponentRenderer\n renderFieldFn: any\n req: PayloadRequest\n }\n initialState?: InitialLexicalFormState\n nodeData: SerializedLexicalNode[]\n}\n\nexport async function buildInitialState({\n context,\n initialState: initialStateFromArgs,\n nodeData,\n}: Props): Promise<InitialLexicalFormState> {\n let initialState: InitialLexicalFormState = initialStateFromArgs ?? {}\n for (const node of nodeData) {\n if ('children' in node) {\n initialState = await buildInitialState({\n context,\n initialState,\n nodeData: node.children as SerializedLexicalNode[],\n })\n }\n\n if (node.type === 'block' || node.type === 'inlineBlock') {\n const blockNode = node as SerializedBlockNode\n const id = blockNode?.fields?.id\n if (!id) {\n continue\n }\n\n const schemaFieldsPath =\n node.type === 'block'\n ? `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockNode.fields.blockType}.fields`\n : `${context.lexicalFieldSchemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${blockNode.fields.blockType}.fields`\n\n // Build form state for the block\n\n const formStateResult = await fieldSchemasToFormState({\n id: context.id,\n clientFieldSchemaMap: context.clientFieldSchemaMap,\n collectionSlug: context.collectionSlug,\n data: blockNode.fields,\n documentData: context.documentData,\n fields: (context.fieldSchemaMap.get(schemaFieldsPath) as any)?.fields,\n fieldSchemaMap: context.fieldSchemaMap,\n initialBlockData: blockNode.fields,\n operation: context.operation as any, // TODO: Type\n permissions: true,\n preferences: context.preferences,\n readOnly: context.disabled,\n renderAllFields: true, // If this function runs, the parent lexical field is being re-rendered => thus we can assume all its sub-fields need to be re-rendered\n renderFieldFn: context.renderFieldFn,\n req: context.req,\n schemaPath: schemaFieldsPath,\n })\n\n if (!initialState[id]) {\n initialState[id] = {}\n }\n\n initialState[id].formState = formStateResult\n\n if (node.type === 'block') {\n const currentFieldPreferences = context.preferences?.fields?.[context.field.name]\n const collapsedArray = currentFieldPreferences?.collapsed\n if (Array.isArray(collapsedArray) && collapsedArray.includes(id)) {\n initialState[id].collapsed = true\n }\n }\n }\n }\n return initialState\n}\n"],"mappings":"AAaA,SAASA,uBAAuB,QAAQ;AAgCxC,OAAO,eAAeC,kBAAkB;EACtCC,OAAO;EACPC,YAAA,EAAcC,oBAAoB;EAClCC;AAAQ,CACF;EACN,IAAIF,YAAA,GAAwCC,oBAAA,IAAwB,CAAC;EACrE,KAAK,MAAME,IAAA,IAAQD,QAAA,EAAU;IAC3B,IAAI,cAAcC,IAAA,EAAM;MACtBH,YAAA,GAAe,MAAMF,iBAAA,CAAkB;QACrCC,OAAA;QACAC,YAAA;QACAE,QAAA,EAAUC,IAAA,CAAKC;MACjB;IACF;IAEA,IAAID,IAAA,CAAKE,IAAI,KAAK,WAAWF,IAAA,CAAKE,IAAI,KAAK,eAAe;MACxD,MAAMC,SAAA,GAAYH,IAAA;MAClB,MAAMI,EAAA,GAAKD,SAAA,EAAWE,MAAA,EAAQD,EAAA;MAC9B,IAAI,CAACA,EAAA,EAAI;QACP;MACF;MAEA,MAAME,gBAAA,GACJN,IAAA,CAAKE,IAAI,KAAK,UACV,GAAGN,OAAA,CAAQW,sBAAsB,mDAAmDJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS,GACvH,GAAGZ,OAAA,CAAQW,sBAAsB,0DAA0DJ,SAAA,CAAUE,MAAM,CAACG,SAAS,SAAS;MAEpI;MAEA,MAAMC,eAAA,GAAkB,MAAMf,uBAAA,CAAwB;QACpDU,EAAA,EAAIR,OAAA,CAAQQ,EAAE;QACdM,oBAAA,EAAsBd,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CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,EAAE,CAAA;IACzC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAA;IAC1E,QAAQ,CAAC,wBAAwB,CAAC,EAAE,MAAM,CAAA;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACnC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkDpD,CAAA"}
@@ -5,13 +5,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui';
6
6
  import React from 'react';
7
7
  import { DrawerContent } from './DrawerContent.js';
8
+ import { useDrawerSubmit } from './useDrawerSubmit.js';
8
9
  /**
9
10
  * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.
10
11
  * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only
11
12
  * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.
12
13
  */
13
14
  export const FieldsDrawer = t0 => {
14
- const $ = _c(15);
15
+ const $ = _c(17);
15
16
  const {
16
17
  className,
17
18
  data,
@@ -27,6 +28,10 @@ export const FieldsDrawer = t0 => {
27
28
  const {
28
29
  closeModal
29
30
  } = useModal();
31
+ const {
32
+ headerActions,
33
+ submitRef
34
+ } = useDrawerSubmit();
30
35
  const t1 = drawerTitle ?? "";
31
36
  let t2;
32
37
  if ($[0] !== closeModal || $[1] !== drawerSlug || $[2] !== handleDrawerSubmit) {
@@ -44,10 +49,11 @@ export const FieldsDrawer = t0 => {
44
49
  t2 = $[3];
45
50
  }
46
51
  let t3;
47
- if ($[4] !== className || $[5] !== data || $[6] !== drawerSlug || $[7] !== featureKey || $[8] !== fieldMapOverride || $[9] !== schemaFieldsPathOverride || $[10] !== schemaPath || $[11] !== schemaPathSuffix || $[12] !== t1 || $[13] !== t2) {
52
+ if ($[4] !== className || $[5] !== data || $[6] !== drawerSlug || $[7] !== featureKey || $[8] !== fieldMapOverride || $[9] !== headerActions || $[10] !== schemaFieldsPathOverride || $[11] !== schemaPath || $[12] !== schemaPathSuffix || $[13] !== submitRef || $[14] !== t1 || $[15] !== t2) {
48
53
  t3 = _jsx(EditDepthProvider, {
49
54
  children: _jsx(Drawer, {
50
55
  className,
56
+ headerActions,
51
57
  slug: drawerSlug,
52
58
  title: t1,
53
59
  children: _jsx(DrawerContent, {
@@ -57,7 +63,8 @@ export const FieldsDrawer = t0 => {
57
63
  handleDrawerSubmit: t2,
58
64
  schemaFieldsPathOverride,
59
65
  schemaPath,
60
- schemaPathSuffix
66
+ schemaPathSuffix,
67
+ submitRef
61
68
  })
62
69
  })
63
70
  });
@@ -66,14 +73,16 @@ export const FieldsDrawer = t0 => {
66
73
  $[6] = drawerSlug;
67
74
  $[7] = featureKey;
68
75
  $[8] = fieldMapOverride;
69
- $[9] = schemaFieldsPathOverride;
70
- $[10] = schemaPath;
71
- $[11] = schemaPathSuffix;
72
- $[12] = t1;
73
- $[13] = t2;
74
- $[14] = t3;
76
+ $[9] = headerActions;
77
+ $[10] = schemaFieldsPathOverride;
78
+ $[11] = schemaPath;
79
+ $[12] = schemaPathSuffix;
80
+ $[13] = submitRef;
81
+ $[14] = t1;
82
+ $[15] = t2;
83
+ $[16] = t3;
75
84
  } else {
76
- t3 = $[14];
85
+ t3 = $[16];
77
86
  }
78
87
  return t3;
79
88
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","names":["c","_c","Drawer","EditDepthProvider","useModal","React","DrawerContent","FieldsDrawer","t0","$","className","data","drawerSlug","drawerTitle","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","closeModal","t1","t2","args","args2","setTimeout","t3","_jsx","children","slug","title"],"sources":["../../../src/utilities/fieldsDrawer/Drawer.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,MAAM,EAAEC,iBAAiB,EAAEC,QAAQ,QAAQ;AACpD,OAAOC,KAAA,MAAW;AAElB,SAASC,aAAa,QAAQ;AAe9B;;;;;AAKA,OAAO,MAAMC,YAAA,GAA4CC,EAAA;EAAA,MAAAC,CAAA,GAAAR,EAAA;EAAC;IAAAS,SAAA;IAAAC,IAAA;IAAAC,UAAA;IAAAC,WAAA;IAAAC,UAAA;IAAAC,gBAAA;IAAAC,kBAAA;IAAAC,wBAAA;IAAAC,UAAA;IAAAC;EAAA,IAAAX,EAWzD;EACC;IAAAY;EAAA,IAAuBhB,QAAA;EAKoC,MAAAiB,EAAA,GAAAR,WAAA,IAAe;EAAA,IAAAS,EAAA;EAAA,IAAAb,CAAA,QAAAW,UAAA,IAAAX,CAAA,QAAAG,UAAA,IAAAH,CAAA,QAAAO,kBAAA;IAK9CM,EAAA,GAAAA,CAAAC,IAAA,EAAAC,KAAA;MAGlBJ,UAAA,CAAWR,UAAA;MAMXa,UAAA;QACET,kBAAA,CAAmBO,IAAA,EAAMC,KAAA;MAAA,IACxB;IAAA;IACLf,CAAA,MAAAW,UAAA;IAAAX,CAAA,MAAAG,UAAA;IAAAH,CAAA,MAAAO,kBAAA;IAAAP,CAAA,MAAAa,EAAA;EAAA;IAAAA,EAAA,GAAAb,CAAA;EAAA;EAAA,IAAAiB,EAAA;EAAA,IAAAjB,CAAA,QAAAC,SAAA,IAAAD,CAAA,QAAAE,IAAA,IAAAF,CAAA,QAAAG,UAAA,IAAAH,CAAA,QAAAK,UAAA,IAAAL,CAAA,QAAAM,gBAAA,IAAAN,CAAA,QAAAQ,wBAAA,IAAAR,CAAA,SAAAS,UAAA,IAAAT,CAAA,SAAAU,gBAAA,IAAAV,CAAA,SAAAY,EAAA,IAAAZ,CAAA,SAAAa,EAAA;IAlBNI,EAAA,GAAAC,IAAA,CAAAxB,iBAAA;MAAAyB,QAAA,EACED,IAAA,CAAAzB,MAAA;QAAAQ,SAAA;QAAAmB,IAAA,EAAoCjB,UAAA;QAAAkB,KAAA,EAAmBT,EAAe;QAAAO,QAAA,EACpED,IAAA,CAAArB,aAAA;UAAAK,IAAA;UAAAG,UAAA;UAAAC,gBAAA;UAAAC,kBAAA,EAIsBM,EAYpB;UAAAL,wBAAA;UAAAC,UAAA;UAAAC;QAAA,C;;;;;;;;;;;;;;;;;SAlBNO,E;CA0BJ","ignoreList":[]}
1
+ {"version":3,"file":"Drawer.js","names":["c","_c","Drawer","EditDepthProvider","useModal","React","DrawerContent","useDrawerSubmit","FieldsDrawer","t0","$","className","data","drawerSlug","drawerTitle","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","closeModal","headerActions","submitRef","t1","t2","args","args2","setTimeout","t3","_jsx","children","slug","title"],"sources":["../../../src/utilities/fieldsDrawer/Drawer.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\nimport { useDrawerSubmit } from './useDrawerSubmit.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n const { headerActions, submitRef } = useDrawerSubmit()\n\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer\n className={className}\n headerActions={headerActions}\n slug={drawerSlug}\n title={drawerTitle ?? ''}\n >\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n submitRef={submitRef}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,MAAM,EAAEC,iBAAiB,EAAEC,QAAQ,QAAQ;AACpD,OAAOC,KAAA,MAAW;AAElB,SAASC,aAAa,QAAQ;AAC9B,SAASC,eAAe,QAAQ;AAehC;;;;;AAKA,OAAO,MAAMC,YAAA,GAA4CC,EAAA;EAAA,MAAAC,CAAA,GAAAT,EAAA;EAAC;IAAAU,SAAA;IAAAC,I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A;UAAAC,gBAAA;UAAAC,kBAAA,EAIsBQ,EAYpB;UAAAP,wBAAA;UAAAC,UAAA;UAAAC,gBAAA;UAAAG;QAAA,C;;;;;;;;;;;;;;;;;;;SAvBNM,E;CAgCJ","ignoreList":[]}
@@ -1,4 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { FieldsDrawerProps } from './Drawer.js';
3
- export declare const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>>;
3
+ import './index.css';
4
+ export declare const DrawerContent: React.FC<{
5
+ submitRef: React.RefObject<(() => void) | null>;
6
+ } & Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>>;
4
7
  //# sourceMappingURL=DrawerContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAGvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAIpD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,aAAa,CAAC,CAuJzF,CAAA"}
1
+ {"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAGvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAIpD,OAAO,aAAa,CAAA;AAEpB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC;IACE,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;CAChD,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,aAAa,CAAC,CAyJ1D,CAAA"}