@payloadcms/richtext-lexical 4.0.0-canary.0 → 4.0.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/{RelationshipComponent-RZL743CS.js → RelationshipComponent-YCPAKOL7.js} +1 -1
- package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-CUFJGFNW.js +2 -0
- package/dist/exports/client/chunk-CUFJGFNW.js.map +7 -0
- package/dist/exports/client/{component-KESPRYJR.js → component-PHZQBOJE.js} +1 -1
- package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
- package/dist/exports/client/componentInline-DV4EGOWU.js +2 -0
- package/dist/exports/client/index.js +14 -14
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blockquote/server/index.d.ts +1 -4
- package/dist/features/blockquote/server/index.d.ts.map +1 -1
- package/dist/features/blockquote/server/index.js +2 -0
- package/dist/features/blockquote/server/index.js.map +1 -1
- package/dist/features/blockquote/server/schema.d.ts +8 -0
- package/dist/features/blockquote/server/schema.d.ts.map +1 -0
- package/dist/features/blockquote/server/schema.js +15 -0
- package/dist/features/blockquote/server/schema.js.map +1 -0
- package/dist/features/blocks/client/component/index.d.ts +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +2 -1
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +2 -1
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +4 -2
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
- package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
- package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
- package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts +1 -0
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +24 -72
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
- package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/server/schema.d.ts +45 -0
- package/dist/features/blocks/server/schema.d.ts.map +1 -0
- package/dist/features/blocks/server/schema.js +139 -0
- package/dist/features/blocks/server/schema.js.map +1 -0
- package/dist/features/blocks/server/validate.d.ts +1 -2
- package/dist/features/blocks/server/validate.d.ts.map +1 -1
- package/dist/features/blocks/server/validate.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/types.d.ts +14 -15
- package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/types.d.ts +14 -15
- package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/Component/index.d.ts +4 -2
- package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
- package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
- package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
- package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
- package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
- package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
- package/dist/features/experimental_table/server/index.d.ts +1 -6
- package/dist/features/experimental_table/server/index.d.ts.map +1 -1
- package/dist/features/experimental_table/server/index.js +4 -0
- package/dist/features/experimental_table/server/index.js.map +1 -1
- package/dist/features/experimental_table/server/schema.d.ts +27 -0
- package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
- package/dist/features/experimental_table/server/schema.js +107 -0
- package/dist/features/experimental_table/server/schema.js.map +1 -0
- package/dist/features/heading/server/index.d.ts +2 -4
- package/dist/features/heading/server/index.d.ts.map +1 -1
- package/dist/features/heading/server/index.js +2 -0
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/features/heading/server/schema.d.ts +10 -0
- package/dist/features/heading/server/schema.d.ts.map +1 -0
- package/dist/features/heading/server/schema.js +37 -0
- package/dist/features/heading/server/schema.js.map +1 -0
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/horizontalRule/server/index.d.ts +1 -0
- package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/index.js +2 -0
- package/dist/features/horizontalRule/server/index.js.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/horizontalRule/server/schema.d.ts +7 -0
- package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
- package/dist/features/horizontalRule/server/schema.js +25 -0
- package/dist/features/horizontalRule/server/schema.js.map +1 -0
- package/dist/features/link/client/index.d.ts.map +1 -1
- package/dist/features/link/client/index.js.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
- package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
- package/dist/features/link/client/plugins/link/index.js.map +1 -1
- package/dist/features/link/markdownTransformer.d.ts +1 -1
- package/dist/features/link/markdownTransformer.d.ts.map +1 -1
- package/dist/features/link/markdownTransformer.js.map +1 -1
- package/dist/features/link/markdownTransformer.spec.js.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
- package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js +2 -1
- package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.d.ts +3 -3
- package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +2 -1
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/server/baseFields.js.map +1 -1
- package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
- package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/link/server/index.d.ts +2 -1
- package/dist/features/link/server/index.d.ts.map +1 -1
- package/dist/features/link/server/index.js +3 -0
- package/dist/features/link/server/index.js.map +1 -1
- package/dist/features/link/server/schema.d.ts +32 -0
- package/dist/features/link/server/schema.d.ts.map +1 -0
- package/dist/features/link/server/schema.js +169 -0
- package/dist/features/link/server/schema.js.map +1 -0
- package/dist/features/link/server/validate.d.ts +1 -1
- package/dist/features/link/server/validate.d.ts.map +1 -1
- package/dist/features/link/server/validate.js.map +1 -1
- package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
- package/dist/features/lists/checklist/server/index.js +3 -0
- package/dist/features/lists/checklist/server/index.js.map +1 -1
- package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
- package/dist/features/lists/orderedList/server/index.js +3 -0
- package/dist/features/lists/orderedList/server/index.js.map +1 -1
- package/dist/features/lists/plugin/index.d.ts +0 -9
- package/dist/features/lists/plugin/index.d.ts.map +1 -1
- package/dist/features/lists/plugin/index.js.map +1 -1
- package/dist/features/lists/shared/schema.d.ts +18 -0
- package/dist/features/lists/shared/schema.d.ts.map +1 -0
- package/dist/features/lists/shared/schema.js +62 -0
- package/dist/features/lists/shared/schema.js.map +1 -0
- package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/server/index.js +3 -0
- package/dist/features/lists/unorderedList/server/index.js.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.d.ts +1 -1
- package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
- package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
- package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
- package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
- package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/relationship/server/index.d.ts +1 -0
- package/dist/features/relationship/server/index.d.ts.map +1 -1
- package/dist/features/relationship/server/index.js +2 -0
- package/dist/features/relationship/server/index.js.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/server/schema.d.ts +28 -0
- package/dist/features/relationship/server/schema.d.ts.map +1 -0
- package/dist/features/relationship/server/schema.js +80 -0
- package/dist/features/relationship/server/schema.js.map +1 -0
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
- package/dist/features/typesServer.d.ts +17 -40
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/client/component/index.d.ts +1 -1
- package/dist/features/upload/client/component/index.d.ts.map +1 -1
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
- package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/client/plugin/index.d.ts +1 -1
- package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/upload/server/index.d.ts +1 -0
- package/dist/features/upload/server/index.d.ts.map +1 -1
- package/dist/features/upload/server/index.js +3 -2
- package/dist/features/upload/server/index.js.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
- package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
- package/dist/features/upload/server/nodes/conversions.js.map +1 -1
- package/dist/features/upload/server/schema.d.ts +52 -0
- package/dist/features/upload/server/schema.d.ts.map +1 -0
- package/dist/features/upload/server/schema.js +129 -0
- package/dist/features/upload/server/schema.js.map +1 -0
- package/dist/features/upload/server/validate.d.ts +1 -1
- package/dist/features/upload/server/validate.d.ts.map +1 -1
- package/dist/features/upload/server/validate.js.map +1 -1
- package/dist/field/Diff/converters/upload/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.css +4 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/sanitize.js +9 -11
- package/dist/lexical/config/server/sanitize.js.map +1 -1
- package/dist/types/builtInNodes.d.ts +14 -0
- package/dist/types/builtInNodes.d.ts.map +1 -0
- package/dist/types/builtInNodes.js +203 -0
- package/dist/types/builtInNodes.js.map +1 -0
- package/dist/types/index.d.ts +14 -15
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/jsonSchemaHelpers.d.ts +30 -0
- package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
- package/dist/types/jsonSchemaHelpers.js +58 -0
- package/dist/types/jsonSchemaHelpers.js.map +1 -0
- package/dist/types/nodeTypes.d.ts +115 -61
- package/dist/types/nodeTypes.d.ts.map +1 -1
- package/dist/types/nodeTypes.js +3 -2
- package/dist/types/nodeTypes.js.map +1 -1
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/types/schema.js +67 -65
- package/dist/types/schema.js.map +1 -1
- package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
- package/dist/utilities/applyBaseFilterToFields.js +1 -2
- package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
- package/dist/utilities/buildEditorState.d.ts +17 -3
- package/dist/utilities/buildEditorState.d.ts.map +1 -1
- package/dist/utilities/buildEditorState.js +8 -0
- package/dist/utilities/buildEditorState.js.map +1 -1
- package/dist/utilities/fieldsDrawer/index.css +5 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/package.json +6 -6
- package/dist/exports/client/RelationshipComponent-RZL743CS.js.map +0 -7
- package/dist/exports/client/chunk-XIJE2UCQ.js +0 -2
- package/dist/exports/client/chunk-XIJE2UCQ.js.map +0 -7
- package/dist/exports/client/component-KESPRYJR.js.map +0 -7
- package/dist/exports/client/componentInline-R2RSJX4K.js +0 -2
- package/dist/features/link/nodes/types.d.ts +0 -27
- package/dist/features/link/nodes/types.d.ts.map +0 -1
- package/dist/features/link/nodes/types.js +0 -2
- package/dist/features/link/nodes/types.js.map +0 -1
- /package/dist/exports/client/{componentInline-R2RSJX4K.js.map → componentInline-DV4EGOWU.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\n\nexport type JSXConverterArgs<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = {\n childIndex: number\n converters: JSXConverters\n node: TNode\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n parent: SerializedLexicalNodeWithParent\n}\nexport type JSXConverter<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = ((args: JSXConverterArgs<TNode>) => React.ReactNode) | React.ReactNode\n\nexport type JSXConverters<\n TNodes extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [key: string]:\n | {\n [blockSlug: string]: JSXConverter<any>\n }\n | JSXConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\n\nexport type JSXConverterArgs<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = {\n childIndex: number\n converters: JSXConverters\n node: TNode\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n parent: SerializedLexicalNodeWithParent\n}\nexport type JSXConverter<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = ((args: JSXConverterArgs<TNode>) => React.ReactNode) | React.ReactNode\n\nexport type JSXConverters<\n TNodes extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [key: string]:\n | {\n [blockSlug: string]: JSXConverter<any>\n }\n | JSXConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<TNodes, { type: 'block' }>['fields']['blockType']]?: JSXConverter<\n Extract<TNodes, { fields: { blockType: K }; type: 'block' }>\n >\n }\n inlineBlocks?: {\n [K in Extract<TNodes, { type: 'inlineBlock' }>['fields']['blockType']]?: JSXConverter<\n Extract<TNodes, { fields: { blockType: K }; type: 'inlineBlock' }>\n >\n }\n unknown?: JSXConverter<SerializedLexicalNode>\n}\nexport type SerializedLexicalNodeWithParent = {\n parent?: SerializedLexicalNode\n} & SerializedLexicalNode\n"],"mappings":"AAwDA","ignoreList":[]}
|
|
@@ -35,26 +35,24 @@ export type PlaintextConverters<T extends {
|
|
|
35
35
|
}>>;
|
|
36
36
|
} & {
|
|
37
37
|
blocks?: {
|
|
38
|
-
[K in Extract<
|
|
38
|
+
[K in Extract<T, {
|
|
39
39
|
type: 'block';
|
|
40
|
-
}>
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
}>['fields']['blockType']]?: PlaintextConverter<Extract<T, {
|
|
41
|
+
fields: {
|
|
42
|
+
blockType: K;
|
|
43
|
+
};
|
|
43
44
|
type: 'block';
|
|
44
|
-
}
|
|
45
|
-
blockType: K;
|
|
46
|
-
}>> : SerializedBlockNode>;
|
|
45
|
+
}>>;
|
|
47
46
|
};
|
|
48
47
|
inlineBlocks?: {
|
|
49
|
-
[K in Extract<
|
|
48
|
+
[K in Extract<T, {
|
|
50
49
|
type: 'inlineBlock';
|
|
51
|
-
}>
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
}>['fields']['blockType']]?: PlaintextConverter<Extract<T, {
|
|
51
|
+
fields: {
|
|
52
|
+
blockType: K;
|
|
53
|
+
};
|
|
54
54
|
type: 'inlineBlock';
|
|
55
|
-
}
|
|
56
|
-
blockType: K;
|
|
57
|
-
}>> : SerializedInlineBlockNode>;
|
|
55
|
+
}>>;
|
|
58
56
|
};
|
|
59
57
|
};
|
|
60
58
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToPlaintext/sync/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAA;AAEzE,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IAErE,CAAC,CAAC,IAAI,EAAE;IACN,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,mBAAmB,CAAA;IAC/B,IAAI,EAAE,CAAC,CAAA;IACP,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACvB,UAAU,CAAC,EAAE,mBAAmB,CAAA;QAChC,KAAK,EAAE,qBAAqB,EAAE,CAAA;QAC9B,MAAM,CAAC,EAAE,+BAA+B,CAAA;KACzC,KAAK,MAAM,EAAE,CAAA;IACd,MAAM,EAAE,+BAA+B,CAAA;CACxC,KAAK,MAAM,CAAC,GACb,MAAM,CAAA;AAEV,MAAM,MAAM,yBAAyB,GACjC,gBAAgB,GAChB,mBAAmB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GACrE,yBAAyB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAE/E,MAAM,MAAM,mBAAmB,CAC7B,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,yBAAyB,IACzE;IACF,CAAC,GAAG,EAAE,MAAM,GACR;QACE,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;KAC7C,GACD,kBAAkB,CAAC,GAAG,CAAC,GACvB,SAAS,CAAA;CACd,GAAG;KACD,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,kBAAkB,CACzF,OAAO,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC,CAC/B;CACF,GAAG;IACF,MAAM,CAAC,EAAE;SACN,CAAC,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToPlaintext/sync/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAA;AAEzE,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IAErE,CAAC,CAAC,IAAI,EAAE;IACN,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,mBAAmB,CAAA;IAC/B,IAAI,EAAE,CAAC,CAAA;IACP,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACvB,UAAU,CAAC,EAAE,mBAAmB,CAAA;QAChC,KAAK,EAAE,qBAAqB,EAAE,CAAA;QAC9B,MAAM,CAAC,EAAE,+BAA+B,CAAA;KACzC,KAAK,MAAM,EAAE,CAAA;IACd,MAAM,EAAE,+BAA+B,CAAA;CACxC,KAAK,MAAM,CAAC,GACb,MAAM,CAAA;AAEV,MAAM,MAAM,yBAAyB,GACjC,gBAAgB,GAChB,mBAAmB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GACrE,yBAAyB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAE/E,MAAM,MAAM,mBAAmB,CAC7B,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,yBAAyB,IACzE;IACF,CAAC,GAAG,EAAE,MAAM,GACR;QACE,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;KAC7C,GACD,kBAAkB,CAAC,GAAG,CAAC,GACvB,SAAS,CAAA;CACd,GAAG;KACD,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,kBAAkB,CACzF,OAAO,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC,CAC/B;CACF,GAAG;IACF,MAAM,CAAC,EAAE;SACN,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE;YAAE,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAC9E,OAAO,CAAC,CAAC,EAAE;YAAE,MAAM,EAAE;gBAAE,SAAS,EAAE,CAAC,CAAA;aAAE,CAAC;YAAC,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC,CACxD;KACF,CAAA;IACD,YAAY,CAAC,EAAE;SACZ,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE;YAAE,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,kBAAkB,CACpF,OAAO,CAAC,CAAC,EAAE;YAAE,MAAM,EAAE;gBAAE,SAAS,EAAE,CAAC,CAAA;aAAE,CAAC;YAAC,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,CAC9D;KACF,CAAA;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToPlaintext/sync/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\nimport type { SerializedLexicalNodeWithParent } from '../shared/types.js'\n\nexport type PlaintextConverter<\n T extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> =\n | ((args: {\n childIndex: number\n converters: PlaintextConverters\n node: T\n nodesToPlaintext: (args: {\n converters?: PlaintextConverters\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => string[]\n parent: SerializedLexicalNodeWithParent\n }) => string)\n | string\n\nexport type DefaultPlaintextNodeTypes =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>\n\nexport type PlaintextConverters<\n T extends { [key: string]: any; type?: string } = DefaultPlaintextNodeTypes,\n> = {\n [key: string]:\n | {\n [blockSlug: string]: PlaintextConverter<any>\n }\n | PlaintextConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: PlaintextConverter<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToPlaintext/sync/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\nimport type { SerializedLexicalNodeWithParent } from '../shared/types.js'\n\nexport type PlaintextConverter<\n T extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> =\n | ((args: {\n childIndex: number\n converters: PlaintextConverters\n node: T\n nodesToPlaintext: (args: {\n converters?: PlaintextConverters\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => string[]\n parent: SerializedLexicalNodeWithParent\n }) => string)\n | string\n\nexport type DefaultPlaintextNodeTypes =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>\n\nexport type PlaintextConverters<\n T extends { [key: string]: any; type?: string } = DefaultPlaintextNodeTypes,\n> = {\n [key: string]:\n | {\n [blockSlug: string]: PlaintextConverter<any>\n }\n | PlaintextConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: PlaintextConverter<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<T, { type: 'block' }>['fields']['blockType']]?: PlaintextConverter<\n Extract<T, { fields: { blockType: K }; type: 'block' }>\n >\n }\n inlineBlocks?: {\n [K in Extract<T, { type: 'inlineBlock' }>['fields']['blockType']]?: PlaintextConverter<\n Extract<T, { fields: { blockType: K }; type: 'inlineBlock' }>\n >\n }\n}\n"],"mappings":"AA8BA","ignoreList":[]}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SerializedLexicalNode } from 'lexical';
|
|
3
|
-
import type { StronglyTypedElementNode } from '../../../types/nodeTypes.js';
|
|
4
|
-
export type SerializedTableCellNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedTableCellNode, 'tablecell', T>;
|
|
5
|
-
export type SerializedTableNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedTableNode, 'table', T>;
|
|
6
|
-
export type SerializedTableRowNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedTableRowNode, 'tablerow', T>;
|
|
1
|
+
export type { SerializedTableCellNode, SerializedTableNode, SerializedTableRowNode, } from './schema.js';
|
|
7
2
|
export declare const EXPERIMENTAL_TableFeature: import("../../typesServer.js").FeatureProviderProviderServer<undefined, undefined, undefined>;
|
|
8
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/index.ts"],"names":[],"mappings":"AAUA,YAAY,EACV,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,aAAa,CAAA;AAiBpB,eAAO,MAAM,yBAAyB,+FAwCpC,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { sanitizeFields } from 'payload';
|
|
|
3
3
|
import { createServerFeature } from '../../../utilities/createServerFeature.js';
|
|
4
4
|
import { createNode } from '../../typeUtilities.js';
|
|
5
5
|
import { TableMarkdownTransformer } from '../markdownTransformer.js';
|
|
6
|
+
import { tableCellNodeJSONSchema, tableNodeJSONSchema, tableRowNodeJSONSchema } from './schema.js';
|
|
6
7
|
const fields = [{
|
|
7
8
|
name: 'rows',
|
|
8
9
|
type: 'number',
|
|
@@ -39,10 +40,13 @@ export const EXPERIMENTAL_TableFeature = createServerFeature({
|
|
|
39
40
|
},
|
|
40
41
|
markdownTransformers: [TableMarkdownTransformer],
|
|
41
42
|
nodes: [createNode({
|
|
43
|
+
jsonSchema: tableNodeJSONSchema,
|
|
42
44
|
node: TableNode
|
|
43
45
|
}), createNode({
|
|
46
|
+
jsonSchema: tableCellNodeJSONSchema,
|
|
44
47
|
node: TableCellNode
|
|
45
48
|
}), createNode({
|
|
49
|
+
jsonSchema: tableRowNodeJSONSchema,
|
|
46
50
|
node: TableRowNode
|
|
47
51
|
})]
|
|
48
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","createServerFeature","createNode","TableMarkdownTransformer","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","parentIsLocalized","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","node","key"],"sources":["../../../../src/features/experimental_table/server/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","createServerFeature","createNode","TableMarkdownTransformer","tableCellNodeJSONSchema","tableNodeJSONSchema","tableRowNodeJSONSchema","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","parentIsLocalized","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../src/features/experimental_table/server/index.ts"],"sourcesContent":["import type { Config, Field, FieldSchemaMap } from 'payload'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { sanitizeFields } from 'payload'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { TableMarkdownTransformer } from '../markdownTransformer.js'\nimport { tableCellNodeJSONSchema, tableNodeJSONSchema, tableRowNodeJSONSchema } from './schema.js'\n\nexport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from './schema.js'\n\nconst fields: Field[] = [\n {\n name: 'rows',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n {\n name: 'columns',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n]\n\nexport const EXPERIMENTAL_TableFeature = createServerFeature({\n feature: async ({ config, isRoot, parentIsLocalized }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedFields = await sanitizeFields({\n config: config as unknown as Config,\n fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#TableFeatureClient',\n generateSchemaMap: () => {\n const schemaMap: FieldSchemaMap = new Map()\n\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n markdownTransformers: [TableMarkdownTransformer],\n nodes: [\n createNode({\n jsonSchema: tableNodeJSONSchema,\n node: TableNode,\n }),\n createNode({\n jsonSchema: tableCellNodeJSONSchema,\n node: TableCellNode,\n }),\n createNode({\n jsonSchema: tableRowNodeJSONSchema,\n node: TableRowNode,\n }),\n ],\n }\n },\n key: 'experimental_table',\n})\n"],"mappings":"AAEA,SAASA,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ;AACvD,SAASC,cAAc,QAAQ;AAE/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,wBAAwB,QAAQ;AACzC,SAASC,uBAAuB,EAAEC,mBAAmB,EAAEC,sBAAsB,QAAQ;AAQrF,MAAMC,MAAA,GAAkB,CACtB;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,GACA;EACEH,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,EACD;AAED,OAAO,MAAMC,yBAAA,GAA4BX,mBAAA,CAAoB;EAC3DY,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAiB,CAAE;IACnD,MAAMC,kBAAA,GAAqBH,MAAA,CAAOI,WAAW,CAACC,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAK,EAAE;IAEtE,MAAMC,eAAA,GAAkB,MAAMtB,cAAA,CAAe;MAC3Cc,MAAA,EAAQA,MAAA;MACRP,MAAA;MACAS,iBAAA;MACAO,+BAAA,EAAiCR,MAAA;MACjCE;IACF;IACA,OAAO;MACLO,aAAA,EAAe;MACfC,iBAAA,EAAmBA,CAAA;QACjB,MAAMC,SAAA,GAA4B,IAAIC,GAAA;QAEtCD,SAAA,CAAUE,GAAG,CAAC,UAAU;UACtBrB,MAAA,EAAQe;QACV;QAEA,OAAOI,SAAA;MACT;MACAG,oBAAA,EAAsB,CAAC1B,wBAAA,CAAyB;MAChD2B,KAAA,EAAO,CACL5B,UAAA,CAAW;QACT6B,UAAA,EAAY1B,mBAAA;QACZ2B,IAAA,EAAMlC;MACR,IACAI,UAAA,CAAW;QACT6B,UAAA,EAAY3B,uBAAA;QACZ4B,IAAA,EAAMnC;MACR,IACAK,UAAA,CAAW;QACT6B,UAAA,EAAYzB,sBAAA;QACZ0B,IAAA,EAAMjC;MACR;IAEJ;EACF;EACAkC,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SerializedLexicalNode } from 'lexical';
|
|
2
|
+
import type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js';
|
|
3
|
+
import type { JSONSchemaFn } from '../../typesServer.js';
|
|
4
|
+
export interface SerializedTableCellNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode> extends SerializedLexicalElementBase<TChildren> {
|
|
5
|
+
backgroundColor?: null | string;
|
|
6
|
+
colSpan?: number;
|
|
7
|
+
headerState: number;
|
|
8
|
+
rowSpan?: number;
|
|
9
|
+
type: 'tablecell';
|
|
10
|
+
verticalAlign?: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface SerializedTableNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode> extends SerializedLexicalElementBase<TChildren> {
|
|
14
|
+
colWidths?: number[];
|
|
15
|
+
frozenColumnCount?: number;
|
|
16
|
+
frozenRowCount?: number;
|
|
17
|
+
rowStriping?: boolean;
|
|
18
|
+
type: 'table';
|
|
19
|
+
}
|
|
20
|
+
export interface SerializedTableRowNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode> extends SerializedLexicalElementBase<TChildren> {
|
|
21
|
+
height?: number;
|
|
22
|
+
type: 'tablerow';
|
|
23
|
+
}
|
|
24
|
+
export declare const tableNodeJSONSchema: JSONSchemaFn;
|
|
25
|
+
export declare const tableCellNodeJSONSchema: JSONSchemaFn;
|
|
26
|
+
export declare const tableRowNodeJSONSchema: JSONSchemaFn;
|
|
27
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,uBAAuB,CACtC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,eAAe,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,WAAW,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB,CAClC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,WAAW,sBAAsB,CACrC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;CACjB;AA2BD,eAAO,MAAM,mBAAmB,EAAE,YAgBjC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAuBrC,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,YAWpC,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MUST stay byte-for-byte in sync with the runtime `SerializedTableNode`,
|
|
3
|
+
* `SerializedTableRowNode`, and `SerializedTableCellNode` declared above.
|
|
4
|
+
*/const TABLE_NODES_TS = `export interface SerializedTableNode<TChildren> extends SerializedLexicalElementBase<TChildren> {
|
|
5
|
+
type: 'table';
|
|
6
|
+
colWidths?: number[];
|
|
7
|
+
frozenColumnCount?: number;
|
|
8
|
+
frozenRowCount?: number;
|
|
9
|
+
rowStriping?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface SerializedTableRowNode<TChildren> extends SerializedLexicalElementBase<TChildren> {
|
|
12
|
+
type: 'tablerow';
|
|
13
|
+
height?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface SerializedTableCellNode<TChildren> extends SerializedLexicalElementBase<TChildren> {
|
|
16
|
+
type: 'tablecell';
|
|
17
|
+
backgroundColor?: string | null;
|
|
18
|
+
colSpan?: number;
|
|
19
|
+
headerState: number;
|
|
20
|
+
rowSpan?: number;
|
|
21
|
+
verticalAlign?: string;
|
|
22
|
+
width?: number;
|
|
23
|
+
}`;
|
|
24
|
+
export const tableNodeJSONSchema = ({
|
|
25
|
+
elementNodeSchema,
|
|
26
|
+
nodeUnionName,
|
|
27
|
+
typeStringDefinitions
|
|
28
|
+
}) => {
|
|
29
|
+
typeStringDefinitions.add(TABLE_NODES_TS);
|
|
30
|
+
return elementNodeSchema({
|
|
31
|
+
nodeType: 'table',
|
|
32
|
+
properties: {
|
|
33
|
+
colWidths: {
|
|
34
|
+
type: 'array',
|
|
35
|
+
items: {
|
|
36
|
+
type: 'number'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
frozenColumnCount: {
|
|
40
|
+
type: 'integer'
|
|
41
|
+
},
|
|
42
|
+
frozenRowCount: {
|
|
43
|
+
type: 'integer'
|
|
44
|
+
},
|
|
45
|
+
rowStriping: {
|
|
46
|
+
type: 'boolean'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
tsType: `SerializedTableNode<${nodeUnionName}>`
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export const tableCellNodeJSONSchema = ({
|
|
53
|
+
elementNodeSchema,
|
|
54
|
+
nodeUnionName,
|
|
55
|
+
typeStringDefinitions
|
|
56
|
+
}) => {
|
|
57
|
+
typeStringDefinitions.add(TABLE_NODES_TS);
|
|
58
|
+
return elementNodeSchema({
|
|
59
|
+
nodeType: 'tablecell',
|
|
60
|
+
properties: {
|
|
61
|
+
backgroundColor: {
|
|
62
|
+
oneOf: [{
|
|
63
|
+
type: 'string'
|
|
64
|
+
}, {
|
|
65
|
+
type: 'null'
|
|
66
|
+
}]
|
|
67
|
+
},
|
|
68
|
+
colSpan: {
|
|
69
|
+
type: 'integer',
|
|
70
|
+
description: 'How many columns this cell spans (default 1).'
|
|
71
|
+
},
|
|
72
|
+
headerState: {
|
|
73
|
+
type: 'integer',
|
|
74
|
+
description: 'Header bitmask: 0 = normal cell, 1 = row header, 2 = column header, 3 = both.'
|
|
75
|
+
},
|
|
76
|
+
rowSpan: {
|
|
77
|
+
type: 'integer',
|
|
78
|
+
description: 'How many rows this cell spans (default 1).'
|
|
79
|
+
},
|
|
80
|
+
verticalAlign: {
|
|
81
|
+
type: 'string'
|
|
82
|
+
},
|
|
83
|
+
width: {
|
|
84
|
+
type: 'integer'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
required: ['headerState'],
|
|
88
|
+
tsType: `SerializedTableCellNode<${nodeUnionName}>`
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
export const tableRowNodeJSONSchema = ({
|
|
92
|
+
elementNodeSchema,
|
|
93
|
+
nodeUnionName,
|
|
94
|
+
typeStringDefinitions
|
|
95
|
+
}) => {
|
|
96
|
+
typeStringDefinitions.add(TABLE_NODES_TS);
|
|
97
|
+
return elementNodeSchema({
|
|
98
|
+
nodeType: 'tablerow',
|
|
99
|
+
properties: {
|
|
100
|
+
height: {
|
|
101
|
+
type: 'integer'
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
tsType: `SerializedTableRowNode<${nodeUnionName}>`
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":["TABLE_NODES_TS","tableNodeJSONSchema","elementNodeSchema","nodeUnionName","typeStringDefinitions","add","nodeType","properties","colWidths","type","items","frozenColumnCount","frozenRowCount","rowStriping","tsType","tableCellNodeJSONSchema","backgroundColor","oneOf","colSpan","description","headerState","rowSpan","verticalAlign","width","required","tableRowNodeJSONSchema","height"],"sources":["../../../../src/features/experimental_table/server/schema.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\n\nexport interface SerializedTableCellNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n backgroundColor?: null | string\n colSpan?: number\n headerState: number\n rowSpan?: number\n type: 'tablecell'\n verticalAlign?: string\n width?: number\n}\n\nexport interface SerializedTableNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n colWidths?: number[]\n frozenColumnCount?: number\n frozenRowCount?: number\n rowStriping?: boolean\n type: 'table'\n}\n\nexport interface SerializedTableRowNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> extends SerializedLexicalElementBase<TChildren> {\n height?: number\n type: 'tablerow'\n}\n\n/**\n * MUST stay byte-for-byte in sync with the runtime `SerializedTableNode`,\n * `SerializedTableRowNode`, and `SerializedTableCellNode` declared above.\n */\nconst TABLE_NODES_TS = `export interface SerializedTableNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'table';\n colWidths?: number[];\n frozenColumnCount?: number;\n frozenRowCount?: number;\n rowStriping?: boolean;\n}\nexport interface SerializedTableRowNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'tablerow';\n height?: number;\n}\nexport interface SerializedTableCellNode<TChildren> extends SerializedLexicalElementBase<TChildren> {\n type: 'tablecell';\n backgroundColor?: string | null;\n colSpan?: number;\n headerState: number;\n rowSpan?: number;\n verticalAlign?: string;\n width?: number;\n}`\n\nexport const tableNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(TABLE_NODES_TS)\n return elementNodeSchema({\n nodeType: 'table',\n properties: {\n colWidths: { type: 'array', items: { type: 'number' } },\n frozenColumnCount: { type: 'integer' },\n frozenRowCount: { type: 'integer' },\n rowStriping: { type: 'boolean' },\n },\n tsType: `SerializedTableNode<${nodeUnionName}>`,\n })\n}\n\nexport const tableCellNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(TABLE_NODES_TS)\n return elementNodeSchema({\n nodeType: 'tablecell',\n properties: {\n backgroundColor: { oneOf: [{ type: 'string' }, { type: 'null' }] },\n colSpan: { type: 'integer', description: 'How many columns this cell spans (default 1).' },\n headerState: {\n type: 'integer',\n description:\n 'Header bitmask: 0 = normal cell, 1 = row header, 2 = column header, 3 = both.',\n },\n rowSpan: { type: 'integer', description: 'How many rows this cell spans (default 1).' },\n verticalAlign: { type: 'string' },\n width: { type: 'integer' },\n },\n required: ['headerState'],\n tsType: `SerializedTableCellNode<${nodeUnionName}>`,\n })\n}\n\nexport const tableRowNodeJSONSchema: JSONSchemaFn = ({\n elementNodeSchema,\n nodeUnionName,\n typeStringDefinitions,\n}) => {\n typeStringDefinitions.add(TABLE_NODES_TS)\n return elementNodeSchema({\n nodeType: 'tablerow',\n properties: { height: { type: 'integer' } },\n tsType: `SerializedTableRowNode<${nodeUnionName}>`,\n })\n}\n"],"mappings":"AAkCA;;;GAIA,MAAMA,cAAA,GAAiB;;;;;;;;;;;;;;;;;;;EAmBrB;AAEF,OAAO,MAAMC,mBAAA,GAAoCA,CAAC;EAChDC,iBAAiB;EACjBC,aAAa;EACbC;AAAqB,CACtB;EACCA,qBAAA,CAAsBC,GAAG,CAACL,cAAA;EAC1B,OAAOE,iBAAA,CAAkB;IACvBI,QAAA,EAAU;IACVC,UAAA,EAAY;MACVC,SAAA,EAAW;QAAEC,IAAA,EAAM;QAASC,KAAA,EAAO;UAAED,IAAA,EAAM;QAAS;MAAE;MACtDE,iBAAA,EAAmB;QAAEF,IAAA,EAAM;MAAU;MACrCG,cAAA,EAAgB;QAAEH,IAAA,EAAM;MAAU;MAClCI,WAAA,EAAa;QAAEJ,IAAA,EAAM;MAAU;IACjC;IACAK,MAAA,EAAQ,uBAAuBX,aAAA;EACjC;AACF;AAEA,OAAO,MAAMY,uBAAA,GAAwCA,CAAC;EACpDb,iBAAiB;EACjBC,aAAa;EACbC;AAAqB,CACtB;EACCA,qBAAA,CAAsBC,GAAG,CAACL,cAAA;EAC1B,OAAOE,iBAAA,CAAkB;IACvBI,QAAA,EAAU;IACVC,UAAA,EAAY;MACVS,eAAA,EAAiB;QAAEC,KAAA,EAAO,CAAC;UAAER,IAAA,EAAM;QAAS,GAAG;UAAEA,IAAA,EAAM;QAAO;MAAG;MACjES,OAAA,EAAS;QAAET,IAAA,EAAM;QAAWU,WAAA,EAAa;MAAgD;MACzFC,WAAA,EAAa;QACXX,IAAA,EAAM;QACNU,WAAA,EACE;MACJ;MACAE,OAAA,EAAS;QAAEZ,IAAA,EAAM;QAAWU,WAAA,EAAa;MAA6C;MACtFG,aAAA,EAAe;QAAEb,IAAA,EAAM;MAAS;MAChCc,KAAA,EAAO;QAAEd,IAAA,EAAM;MAAU;IAC3B;IACAe,QAAA,EAAU,CAAC,cAAc;IACzBV,MAAA,EAAQ,2BAA2BX,aAAA;EACrC;AACF;AAEA,OAAO,MAAMsB,sBAAA,GAAuCA,CAAC;EACnDvB,iBAAiB;EACjBC,aAAa;EACbC;AAAqB,CACtB;EACCA,qBAAA,CAAsBC,GAAG,CAACL,cAAA;EAC1B,OAAOE,iBAAA,CAAkB;IACvBI,QAAA,EAAU;IACVC,UAAA,EAAY;MAAEmB,MAAA,EAAQ;QAAEjB,IAAA,EAAM;MAAU;IAAE;IAC1CK,MAAA,EAAQ,0BAA0BX,aAAA;EACpC;AACF","ignoreList":[]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type { StronglyTypedElementNode } from '../../../types/nodeTypes.js';
|
|
4
|
-
export type SerializedHeadingNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedHeadingNode, 'heading', T>;
|
|
1
|
+
import type { HeadingTagType } from '@lexical/rich-text';
|
|
2
|
+
export type { SerializedHeadingNode } from './schema.js';
|
|
5
3
|
export type HeadingFeatureProps = {
|
|
6
4
|
enabledHeadingSizes?: HeadingTagType[];
|
|
7
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/heading/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/heading/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAUxD,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAExD,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,cAAc,6HA8BzB,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { createServerFeature } from '../../../utilities/createServerFeature.js';
|
|
|
3
3
|
import { createNode } from '../../typeUtilities.js';
|
|
4
4
|
import { MarkdownTransformer } from '../markdownTransformer.js';
|
|
5
5
|
import { i18n } from './i18n.js';
|
|
6
|
+
import { createHeadingJSONSchema } from './schema.js';
|
|
6
7
|
export const HeadingFeature = createServerFeature({
|
|
7
8
|
feature: ({
|
|
8
9
|
props
|
|
@@ -20,6 +21,7 @@ export const HeadingFeature = createServerFeature({
|
|
|
20
21
|
i18n,
|
|
21
22
|
markdownTransformers: enabledHeadingSizes.length > 0 ? [MarkdownTransformer(enabledHeadingSizes)] : [],
|
|
22
23
|
nodes: [createNode({
|
|
24
|
+
jsonSchema: createHeadingJSONSchema(enabledHeadingSizes),
|
|
23
25
|
node: HeadingNode
|
|
24
26
|
})],
|
|
25
27
|
sanitizedServerFeatureProps: props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["HeadingNode","createServerFeature","createNode","MarkdownTransformer","i18n","HeadingFeature","feature","props","enabledHeadingSizes","sort","ClientFeature","clientFeatureProps","markdownTransformers","length","nodes","node","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/heading/server/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["HeadingNode","createServerFeature","createNode","MarkdownTransformer","i18n","createHeadingJSONSchema","HeadingFeature","feature","props","enabledHeadingSizes","sort","ClientFeature","clientFeatureProps","markdownTransformers","length","nodes","jsonSchema","node","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/heading/server/index.ts"],"sourcesContent":["import type { HeadingTagType } from '@lexical/rich-text'\n\nimport { HeadingNode } from '@lexical/rich-text'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { MarkdownTransformer } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\nimport { createHeadingJSONSchema } from './schema.js'\n\nexport type { SerializedHeadingNode } from './schema.js'\n\nexport type HeadingFeatureProps = {\n enabledHeadingSizes?: HeadingTagType[]\n}\n\nexport const HeadingFeature = createServerFeature<\n HeadingFeatureProps,\n HeadingFeatureProps,\n HeadingFeatureProps\n>({\n feature: ({ props }) => {\n if (!props) {\n props = {}\n }\n\n const { enabledHeadingSizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] } = props\n\n enabledHeadingSizes.sort()\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#HeadingFeatureClient',\n clientFeatureProps: props,\n i18n,\n markdownTransformers:\n enabledHeadingSizes.length > 0 ? [MarkdownTransformer(enabledHeadingSizes)] : [],\n nodes: [\n createNode({\n jsonSchema: createHeadingJSONSchema(enabledHeadingSizes),\n node: HeadingNode,\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'heading',\n})\n"],"mappings":"AAEA,SAASA,WAAW,QAAQ;AAE5B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,IAAI,QAAQ;AACrB,SAASC,uBAAuB,QAAQ;AAQxC,OAAO,MAAMC,cAAA,GAAiBL,mBAAA,CAI5B;EACAM,OAAA,EAASA,CAAC;IAAEC;EAAK,CAAE;IACjB,IAAI,CAACA,KAAA,EAAO;MACVA,KAAA,GAAQ,CAAC;IACX;IAEA,MAAM;MAAEC,mBAAA,GAAsB,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM;IAAK,CAAE,GAAGD,KAAA;IAEvEC,mBAAA,CAAoBC,IAAI;IAExB,OAAO;MACLC,aAAA,EAAe;MACfC,kBAAA,EAAoBJ,KAAA;MACpBJ,IAAA;MACAS,oBAAA,EACEJ,mBAAA,CAAoBK,MAAM,GAAG,IAAI,CAACX,mBAAA,CAAoBM,mBAAA,EAAqB,GAAG,EAAE;MAClFM,KAAA,EAAO,CACLb,UAAA,CAAW;QACTc,UAAA,EAAYX,uBAAA,CAAwBI,mBAAA;QACpCQ,IAAA,EAAMjB;MACR,GACD;MACDkB,2BAAA,EAA6BV;IAC/B;EACF;EACAW,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HeadingTagType } from '@lexical/rich-text';
|
|
2
|
+
import type { SerializedLexicalNode } from 'lexical';
|
|
3
|
+
import type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js';
|
|
4
|
+
import type { JSONSchemaFn } from '../../typesServer.js';
|
|
5
|
+
export interface SerializedHeadingNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode, TTag extends HeadingTagType = HeadingTagType> extends SerializedLexicalElementBase<TChildren> {
|
|
6
|
+
tag: TTag;
|
|
7
|
+
type: 'heading';
|
|
8
|
+
}
|
|
9
|
+
export declare const createHeadingJSONSchema: (enabledHeadingSizes: HeadingTagType[]) => JSONSchemaFn;
|
|
10
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/heading/server/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,qBAAqB,CACpC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,EAC/D,IAAI,SAAS,cAAc,GAAG,cAAc,CAC5C,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,GAAG,EAAE,IAAI,CAAA;IACT,IAAI,EAAE,SAAS,CAAA;CAChB;AAaD,eAAO,MAAM,uBAAuB,GACjC,qBAAqB,cAAc,EAAE,KAAG,YAyBxC,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const ALL_HEADING_TAGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
2
|
+
/** MUST stay byte-for-byte in sync with the runtime `SerializedHeadingNode` declared above. */
|
|
3
|
+
const SERIALIZED_HEADING_NODE_TS = `export interface SerializedHeadingNode<
|
|
4
|
+
TChildren,
|
|
5
|
+
TTag extends 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6',
|
|
6
|
+
> extends SerializedLexicalElementBase<TChildren> {
|
|
7
|
+
type: 'heading';
|
|
8
|
+
tag: TTag;
|
|
9
|
+
}`;
|
|
10
|
+
export const createHeadingJSONSchema = enabledHeadingSizes => ({
|
|
11
|
+
elementNodeSchema,
|
|
12
|
+
nodeUnionName,
|
|
13
|
+
typeStringDefinitions
|
|
14
|
+
}) => {
|
|
15
|
+
typeStringDefinitions.add(SERIALIZED_HEADING_NODE_TS);
|
|
16
|
+
// Empty array means the user disabled every heading size. Treat the same
|
|
17
|
+
// as "no tag constraint" rather than emitting an invalid `<T, >` generic
|
|
18
|
+
// and an unsatisfiable `enum: []`.
|
|
19
|
+
const isAllTags = enabledHeadingSizes.length === 0 || enabledHeadingSizes.length === ALL_HEADING_TAGS.length && ALL_HEADING_TAGS.every(tag => enabledHeadingSizes.includes(tag));
|
|
20
|
+
const tagSchema = enabledHeadingSizes.length === 0 ? {
|
|
21
|
+
type: 'string'
|
|
22
|
+
} : {
|
|
23
|
+
type: 'string',
|
|
24
|
+
enum: enabledHeadingSizes
|
|
25
|
+
};
|
|
26
|
+
const tagUnion = enabledHeadingSizes.map(tag => `'${tag}'`).join(' | ');
|
|
27
|
+
const tsType = isAllTags ? `SerializedHeadingNode<${nodeUnionName}>` : `SerializedHeadingNode<${nodeUnionName}, ${tagUnion}>`;
|
|
28
|
+
return elementNodeSchema({
|
|
29
|
+
nodeType: 'heading',
|
|
30
|
+
properties: {
|
|
31
|
+
tag: tagSchema
|
|
32
|
+
},
|
|
33
|
+
required: ['tag'],
|
|
34
|
+
tsType
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":["ALL_HEADING_TAGS","SERIALIZED_HEADING_NODE_TS","createHeadingJSONSchema","enabledHeadingSizes","elementNodeSchema","nodeUnionName","typeStringDefinitions","add","isAllTags","length","every","tag","includes","tagSchema","type","enum","tagUnion","map","join","tsType","nodeType","properties","required"],"sources":["../../../../src/features/heading/server/schema.ts"],"sourcesContent":["import type { HeadingTagType } from '@lexical/rich-text'\nimport type { JSONSchema4 } from 'json-schema'\nimport type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\n\nexport interface SerializedHeadingNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TTag extends HeadingTagType = HeadingTagType,\n> extends SerializedLexicalElementBase<TChildren> {\n tag: TTag\n type: 'heading'\n}\n\nconst ALL_HEADING_TAGS: HeadingTagType[] = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedHeadingNode` declared above. */\nconst SERIALIZED_HEADING_NODE_TS = `export interface SerializedHeadingNode<\n TChildren,\n TTag extends 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6',\n> extends SerializedLexicalElementBase<TChildren> {\n type: 'heading';\n tag: TTag;\n}`\n\nexport const createHeadingJSONSchema =\n (enabledHeadingSizes: HeadingTagType[]): JSONSchemaFn =>\n ({ elementNodeSchema, nodeUnionName, typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_HEADING_NODE_TS)\n // Empty array means the user disabled every heading size. Treat the same\n // as \"no tag constraint\" rather than emitting an invalid `<T, >` generic\n // and an unsatisfiable `enum: []`.\n const isAllTags =\n enabledHeadingSizes.length === 0 ||\n (enabledHeadingSizes.length === ALL_HEADING_TAGS.length &&\n ALL_HEADING_TAGS.every((tag) => enabledHeadingSizes.includes(tag)))\n const tagSchema: JSONSchema4 =\n enabledHeadingSizes.length === 0\n ? { type: 'string' }\n : { type: 'string', enum: enabledHeadingSizes }\n const tagUnion = enabledHeadingSizes.map((tag) => `'${tag}'`).join(' | ')\n const tsType = isAllTags\n ? `SerializedHeadingNode<${nodeUnionName}>`\n : `SerializedHeadingNode<${nodeUnionName}, ${tagUnion}>`\n\n return elementNodeSchema({\n nodeType: 'heading',\n properties: { tag: tagSchema },\n required: ['tag'],\n tsType,\n })\n }\n"],"mappings":"AAeA,MAAMA,gBAAA,GAAqC,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK;AAE/E;AACA,MAAMC,0BAAA,GAA6B;;;;;;EAMjC;AAEF,OAAO,MAAMC,uBAAA,GACVC,mBAAA,IACD,CAAC;EAAEC,iBAAiB;EAAEC,aAAa;EAAEC;AAAqB,CAAE;EAC1DA,qBAAA,CAAsBC,GAAG,CAACN,0BAAA;EAC1B;EACA;EACA;EACA,MAAMO,SAAA,GACJL,mBAAA,CAAoBM,MAAM,KAAK,KAC9BN,mBAAA,CAAoBM,MAAM,KAAKT,gBAAA,CAAiBS,MAAM,IACrDT,gBAAA,CAAiBU,KAAK,CAAEC,GAAA,IAAQR,mBAAA,CAAoBS,QAAQ,CAACD,GAAA;EACjE,MAAME,SAAA,GACJV,mBAAA,CAAoBM,MAAM,KAAK,IAC3B;IAAEK,IAAA,EAAM;EAAS,IACjB;IAAEA,IAAA,EAAM;IAAUC,IAAA,EAAMZ;EAAoB;EAClD,MAAMa,QAAA,GAAWb,mBAAA,CAAoBc,GAAG,CAAEN,GAAA,IAAQ,IAAIA,GAAA,GAAM,EAAEO,IAAI,CAAC;EACnE,MAAMC,MAAA,GAASX,SAAA,GACX,yBAAyBH,aAAA,GAAgB,GACzC,yBAAyBA,aAAA,KAAkBW,QAAA,GAAW;EAE1D,OAAOZ,iBAAA,CAAkB;IACvBgB,QAAA,EAAU;IACVC,UAAA,EAAY;MAAEV,GAAA,EAAKE;IAAU;IAC7BS,QAAA,EAAU,CAAC,MAAM;IACjBH;EACF;AACF","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LexicalNode, SerializedLexicalNode } from 'lexical';
|
|
2
|
-
import type { SerializedHorizontalRuleNode } from '../../server/
|
|
2
|
+
import type { SerializedHorizontalRuleNode } from '../../server/schema.js';
|
|
3
3
|
import { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js';
|
|
4
4
|
export declare class HorizontalRuleNode extends HorizontalRuleServerNode {
|
|
5
5
|
static clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAKtF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAuB,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAKtF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AAE1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAA;AAEnF,qBAAa,kBAAmB,SAAQ,wBAAwB;WAC9C,KAAK,CAAC,IAAI,EAAE,wBAAwB,GAAG,wBAAwB;WAI/D,OAAO,IAAI,MAAM;IAIjC;;OAEG;WACa,UAAU,CAAC,cAAc,EAAE,4BAA4B,GAAG,kBAAkB;IAI5F;;OAEG;IACM,QAAQ;IAIR,UAAU,IAAI,qBAAqB;CAG7C;AAMD,wBAAgB,yBAAyB,IAAI,kBAAkB,CAE9D;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,kBAAkB,CAE5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalRuleNode.js","names":["$applyNodeReplacement","React","HorizontalRuleServerNode","HorizontalRuleNode","clone","node","getType","importJSON","serializedNode","$createHorizontalRuleNode","decorate","exportJSON","$convertHorizontalRuleElement","$isHorizontalRuleNode"],"sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/
|
|
1
|
+
{"version":3,"file":"HorizontalRuleNode.js","names":["$applyNodeReplacement","React","HorizontalRuleServerNode","HorizontalRuleNode","clone","node","getType","importJSON","serializedNode","$createHorizontalRuleNode","decorate","exportJSON","$convertHorizontalRuleElement","$isHorizontalRuleNode"],"sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/schema.js'\n\nimport { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nexport class HorizontalRuleNode extends HorizontalRuleServerNode {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n override decorate() {\n return null\n }\n\n override exportJSON(): SerializedLexicalNode {\n return super.exportJSON()\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n"],"mappings":"AAAA;;AAGA,SAASA,qBAAqB,QAAQ;AACtC,YAAYC,KAAA,MAAW;AAIvB,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,kBAAA,SAA2BD,wBAAA;EACtC,OAAgBE,MAAMC,IAA8B,EAA4B;IAC9E,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA;;;EAGA,OAAgBC,WAAWC,cAA4C,EAAsB;IAC3F,OAAOC,yBAAA;EACT;EAEA;;;EAGAC,QAASA,CAAA,EAAW;IAClB,OAAO;EACT;EAESC,WAAA,EAAoC;IAC3C,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,SAASC,8BAAA;EACP,OAAO;IAAEP,IAAA,EAAMI,yBAAA;EAA4B;AAC7C;AAEA,OAAO,SAASA,0BAAA;EACd,OAAOT,qBAAA,CAAsB,IAAIG,kBAAA;AACnC;AAEA,OAAO,SAASU,sBACdR,IAAoC;EAEpC,OAAOA,IAAA,YAAgBF,kBAAA;AACzB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/index.ts"],"names":[],"mappings":"AAOA,YAAY,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAE/D,eAAO,MAAM,qBAAqB,+FAahC,CAAA"}
|
|
@@ -3,12 +3,14 @@ import { createNode } from '../../typeUtilities.js';
|
|
|
3
3
|
import { i18n } from './i18n.js';
|
|
4
4
|
import { MarkdownTransformer } from './markdownTransformer.js';
|
|
5
5
|
import { HorizontalRuleServerNode } from './nodes/HorizontalRuleNode.js';
|
|
6
|
+
import { horizontalRuleNodeJSONSchema } from './schema.js';
|
|
6
7
|
export const HorizontalRuleFeature = createServerFeature({
|
|
7
8
|
feature: {
|
|
8
9
|
ClientFeature: '@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient',
|
|
9
10
|
i18n,
|
|
10
11
|
markdownTransformers: [MarkdownTransformer],
|
|
11
12
|
nodes: [createNode({
|
|
13
|
+
jsonSchema: horizontalRuleNodeJSONSchema,
|
|
12
14
|
node: HorizontalRuleServerNode
|
|
13
15
|
})]
|
|
14
16
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createServerFeature","createNode","i18n","MarkdownTransformer","HorizontalRuleServerNode","HorizontalRuleFeature","feature","ClientFeature","markdownTransformers","nodes","node","key"],"sources":["../../../../src/features/horizontalRule/server/index.ts"],"sourcesContent":["import { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { i18n } from './i18n.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\nimport { HorizontalRuleServerNode } from './nodes/HorizontalRuleNode.js'\n\nexport const HorizontalRuleFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient',\n i18n,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n node: HorizontalRuleServerNode,\n }),\n ],\n },\n key: 'horizontalRule',\n})\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AACrB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,wBAAwB,QAAQ;
|
|
1
|
+
{"version":3,"file":"index.js","names":["createServerFeature","createNode","i18n","MarkdownTransformer","HorizontalRuleServerNode","horizontalRuleNodeJSONSchema","HorizontalRuleFeature","feature","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../src/features/horizontalRule/server/index.ts"],"sourcesContent":["import { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { i18n } from './i18n.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\nimport { HorizontalRuleServerNode } from './nodes/HorizontalRuleNode.js'\nimport { horizontalRuleNodeJSONSchema } from './schema.js'\n\nexport type { SerializedHorizontalRuleNode } from './schema.js'\n\nexport const HorizontalRuleFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient',\n i18n,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n jsonSchema: horizontalRuleNodeJSONSchema,\n node: HorizontalRuleServerNode,\n }),\n ],\n },\n key: 'horizontalRule',\n})\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AACrB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,4BAA4B,QAAQ;AAI7C,OAAO,MAAMC,qBAAA,GAAwBN,mBAAA,CAAoB;EACvDO,OAAA,EAAS;IACPC,aAAA,EAAe;IACfN,IAAA;IACAO,oBAAA,EAAsB,CAACN,mBAAA,CAAoB;IAC3CO,KAAA,EAAO,CACLT,UAAA,CAAW;MACTU,UAAA,EAAYN,4BAAA;MACZO,IAAA,EAAMR;IACR;EAEJ;EACAS,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalCommand, LexicalNode, SerializedLexicalNode } from 'lexical';
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
import { DecoratorNode } from 'lexical';
|
|
4
|
-
import type {
|
|
5
|
-
/**
|
|
6
|
-
* Serialized representation of a horizontal rule node. Serialized = converted to JSON. This is what is stored in the database / in the lexical editor state.
|
|
7
|
-
*/
|
|
8
|
-
export type SerializedHorizontalRuleNode = StronglyTypedLeafNode<SerializedLexicalNode, 'horizontalrule'>;
|
|
4
|
+
import type { SerializedHorizontalRuleNode } from '../schema.js';
|
|
9
5
|
export declare const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void>;
|
|
10
6
|
/**
|
|
11
7
|
* This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,EACX,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAGnC,OAAO,EAAwC,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,EACX,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAGnC,OAAO,EAAwC,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAA;AAEhE,eAAO,MAAM,8BAA8B,EAAE,cAAc,CAAC,IAAI,CAE/D,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,aAAa,CAAC,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC;WACpE,KAAK,CAAC,IAAI,EAAE,wBAAwB,GAAG,wBAAwB;WAI/D,OAAO,IAAI,MAAM;IAIjC;;;;OAIG;WACa,SAAS,IAAI,gBAAgB,GAAG,IAAI;IASpD;;OAEG;WACa,UAAU,CACxB,cAAc,EAAE,4BAA4B,GAC3C,wBAAwB;IAI3B;;OAEG;IACM,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;IAM5C,QAAQ,IAAI,IAAI,GAAG,KAAK,CAAC,YAAY;IAI9C;;;;OAIG;IACM,SAAS,IAAI,eAAe;IAGrC;;OAEG;IACM,UAAU,IAAI,qBAAqB;IAOnC,cAAc,IAAI,MAAM;IAIxB,QAAQ,IAAI,KAAK;IAIjB,SAAS,IAAI,OAAO;CAG9B;AAMD,wBAAgB,+BAA+B,IAAI,wBAAwB,CAE1E;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,wBAAwB,CAElC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalRuleNode.js","names":["addClassNamesToElement","$applyNodeReplacement","createCommand","DecoratorNode","INSERT_HORIZONTAL_RULE_COMMAND","HorizontalRuleServerNode","clone","node","__key","getType","importDOM","hr","conversion","$convertHorizontalRuleElement","priority","importJSON","serializedNode","$createHorizontalRuleServerNode","createDOM","config","element","document","createElement","theme","decorate","exportDOM","exportJSON","type","version","getTextContent","isInline","updateDOM","$isHorizontalRuleServerNode"],"sources":["../../../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n LexicalCommand,\n LexicalNode,\n SerializedLexicalNode,\n} from 'lexical'\nimport type * as React from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, createCommand, DecoratorNode } from 'lexical'\n\nimport type {
|
|
1
|
+
{"version":3,"file":"HorizontalRuleNode.js","names":["addClassNamesToElement","$applyNodeReplacement","createCommand","DecoratorNode","INSERT_HORIZONTAL_RULE_COMMAND","HorizontalRuleServerNode","clone","node","__key","getType","importDOM","hr","conversion","$convertHorizontalRuleElement","priority","importJSON","serializedNode","$createHorizontalRuleServerNode","createDOM","config","element","document","createElement","theme","decorate","exportDOM","exportJSON","type","version","getTextContent","isInline","updateDOM","$isHorizontalRuleServerNode"],"sources":["../../../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n LexicalCommand,\n LexicalNode,\n SerializedLexicalNode,\n} from 'lexical'\nimport type * as React from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, createCommand, DecoratorNode } from 'lexical'\n\nimport type { SerializedHorizontalRuleNode } from '../schema.js'\n\nexport const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void> = createCommand(\n 'INSERT_HORIZONTAL_RULE_COMMAND',\n)\n\n/**\n * This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.\n *\n * They need both createDom and decorate functions. createDom => outside of the html. decorate => React Component inside of the html.\n *\n * If we used DecoratorBlockNode instead, we would only need a decorate method\n */\nexport class HorizontalRuleServerNode extends DecoratorNode<null | React.ReactElement> {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return new this(node.__key)\n }\n\n static override getType(): string {\n return 'horizontalrule'\n }\n\n /**\n * Defines what happens if you copy an hr element from another page and paste it into the lexical editor\n *\n * This also determines the behavior of lexical's internal HTML -> Lexical converter\n */\n static override importDOM(): DOMConversionMap | null {\n return {\n hr: () => ({\n conversion: $convertHorizontalRuleElement,\n priority: 0,\n }),\n }\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(\n serializedNode: SerializedHorizontalRuleNode,\n ): HorizontalRuleServerNode {\n return $createHorizontalRuleServerNode()\n }\n\n /**\n * Determines how the hr element is rendered in the lexical editor. This is only the \"initial\" / \"outer\" HTML element.\n */\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('hr')\n addClassNamesToElement(element, config.theme.hr)\n return element\n }\n\n override decorate(): null | React.ReactElement {\n return null\n }\n\n /**\n * Opposite of importDOM, this function defines what happens when you copy an hr element from the lexical editor and paste it into another page.\n *\n * This also determines the behavior of lexical's internal Lexical -> HTML converter\n */\n override exportDOM(): DOMExportOutput {\n return { element: document.createElement('hr') }\n }\n /**\n * Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.\n */\n override exportJSON(): SerializedLexicalNode {\n return {\n type: 'horizontalrule',\n version: 1,\n }\n }\n\n override getTextContent(): string {\n return '\\n'\n }\n\n override isInline(): false {\n return false\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleServerNode() }\n}\n\nexport function $createHorizontalRuleServerNode(): HorizontalRuleServerNode {\n return $applyNodeReplacement(new HorizontalRuleServerNode())\n}\n\nexport function $isHorizontalRuleServerNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleServerNode {\n return node instanceof HorizontalRuleServerNode\n}\n"],"mappings":"AAWA,SAASA,sBAAsB,QAAQ;AACvC,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AAIpE,OAAO,MAAMC,8BAAA,GAAuDF,aAAA,CAClE;AAGF;;;;;;;AAOA,OAAO,MAAMG,wBAAA,SAAiCF,aAAA;EAC5C,OAAgBG,MAAMC,IAA8B,EAA4B;IAC9E,OAAO,IAAI,IAAI,CAACA,IAAA,CAAKC,KAAK;EAC5B;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA;;;;;EAKA,OAAgBC,UAAA,EAAqC;IACnD,OAAO;MACLC,EAAA,EAAIA,CAAA,MAAO;QACTC,UAAA,EAAYC,6BAAA;QACZC,QAAA,EAAU;MACZ;IACF;EACF;EAEA;;;EAGA,OAAgBC,WACdC,cAA4C,EAClB;IAC1B,OAAOC,+BAAA;EACT;EAEA;;;EAGAC,SAASA,CAAUC,MAAoB,EAAe;IACpD,MAAMC,OAAA,GAAUC,QAAA,CAASC,aAAa,CAAC;IACvCtB,sBAAA,CAAuBoB,OAAA,EAASD,MAAA,CAAOI,KAAK,CAACZ,EAAE;IAC/C,OAAOS,OAAA;EACT;EAESI,SAAA,EAAsC;IAC7C,OAAO;EACT;EAEA;;;;;EAKAC,SAASA,CAAA,EAA6B;IACpC,OAAO;MAAEL,OAAA,EAASC,QAAA,CAASC,aAAa,CAAC;IAAM;EACjD;EACA;;;EAGAI,UAASA,CAAA,EAAoC;IAC3C,OAAO;MACLC,IAAA,EAAM;MACNC,OAAA,EAAS;IACX;EACF;EAESC,eAAA,EAAyB;IAChC,OAAO;EACT;EAESC,SAAA,EAAkB;IACzB,OAAO;EACT;EAESC,UAAA,EAAqB;IAC5B,OAAO;EACT;AACF;AAEA,SAASlB,8BAAA;EACP,OAAO;IAAEN,IAAA,EAAMU,+BAAA;EAAkC;AACnD;AAEA,OAAO,SAASA,gCAAA;EACd,OAAOhB,qBAAA,CAAsB,IAAII,wBAAA;AACnC;AAEA,OAAO,SAAS2B,4BACdzB,IAAoC;EAEpC,OAAOA,IAAA,YAAgBF,wBAAA;AACzB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;CAChB;AAQD,eAAO,MAAM,4BAA4B,EAAE,YAY1C,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** MUST stay byte-for-byte in sync with the runtime `SerializedHorizontalRuleNode` declared above. */const SERIALIZED_HORIZONTAL_RULE_NODE_TS = `export interface SerializedHorizontalRuleNode {
|
|
2
|
+
type: 'horizontalrule';
|
|
3
|
+
version: number;
|
|
4
|
+
}`;
|
|
5
|
+
export const horizontalRuleNodeJSONSchema = ({
|
|
6
|
+
typeStringDefinitions
|
|
7
|
+
}) => {
|
|
8
|
+
typeStringDefinitions.add(SERIALIZED_HORIZONTAL_RULE_NODE_TS);
|
|
9
|
+
return {
|
|
10
|
+
type: 'object',
|
|
11
|
+
additionalProperties: false,
|
|
12
|
+
properties: {
|
|
13
|
+
type: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
const: 'horizontalrule'
|
|
16
|
+
},
|
|
17
|
+
version: {
|
|
18
|
+
type: 'integer'
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
required: ['type', 'version'],
|
|
22
|
+
tsType: 'SerializedHorizontalRuleNode'
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":["SERIALIZED_HORIZONTAL_RULE_NODE_TS","horizontalRuleNodeJSONSchema","typeStringDefinitions","add","type","additionalProperties","properties","const","version","required","tsType"],"sources":["../../../../src/features/horizontalRule/server/schema.ts"],"sourcesContent":["import type { JSONSchemaFn } from '../../typesServer.js'\n\nexport interface SerializedHorizontalRuleNode {\n type: 'horizontalrule'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedHorizontalRuleNode` declared above. */\nconst SERIALIZED_HORIZONTAL_RULE_NODE_TS = `export interface SerializedHorizontalRuleNode {\n type: 'horizontalrule';\n version: number;\n}`\n\nexport const horizontalRuleNodeJSONSchema: JSONSchemaFn = ({ typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_HORIZONTAL_RULE_NODE_TS)\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'horizontalrule' },\n version: { type: 'integer' },\n },\n required: ['type', 'version'],\n tsType: 'SerializedHorizontalRuleNode',\n }\n}\n"],"mappings":"AAOA,sGACA,MAAMA,kCAAA,GAAqC;;;EAGzC;AAEF,OAAO,MAAMC,4BAAA,GAA6CA,CAAC;EAAEC;AAAqB,CAAE;EAClFA,qBAAA,CAAsBC,GAAG,CAACH,kCAAA;EAC1B,OAAO;IACLI,IAAA,EAAM;IACNC,oBAAA,EAAsB;IACtBC,UAAA,EAAY;MACVF,IAAA,EAAM;QAAEA,IAAA,EAAM;QAAUG,KAAA,EAAO;MAAiB;MAChDC,OAAA,EAAS;QAAEJ,IAAA,EAAM;MAAU;IAC7B;IACAK,QAAA,EAAU,CAAC,QAAQ,UAAU;IAC7BC,MAAA,EAAQ;EACV;AACF","ignoreList":[]}
|