@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.
- package/dist/@types/assets.d.js +2 -0
- package/dist/@types/assets.d.js.map +1 -0
- package/dist/cell/rscEntry.d.ts.map +1 -1
- package/dist/cell/rscEntry.js +5 -5
- package/dist/cell/rscEntry.js.map +1 -1
- package/dist/exports/client/Field-VYBSMSRY.js +2 -0
- package/dist/exports/client/Field-VYBSMSRY.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-5VIL27GI.js +2 -0
- package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
- package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
- package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
- package/dist/exports/client/chunk-ZYXHC5CY.js +2 -0
- package/dist/exports/client/chunk-ZYXHC5CY.js.map +7 -0
- package/dist/exports/client/{component-HKTAZ77E.js → component-PHZQBOJE.js} +2 -2
- package/dist/exports/client/componentInline-R3EPNYWF.js +2 -0
- package/dist/exports/client/index.d.ts +1 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +25 -25
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/server/rsc.browser.d.ts +11 -0
- package/dist/exports/server/rsc.browser.d.ts.map +1 -0
- package/dist/exports/server/rsc.browser.js +10 -0
- package/dist/exports/server/rsc.browser.js.map +1 -0
- package/dist/features/blocks/client/component/index.d.ts +1 -0
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +15 -8
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts +1 -0
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +14 -7
- package/dist/features/blocks/client/componentInline/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/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +2 -2
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/schema.d.ts +5 -5
- package/dist/features/blocks/server/schema.d.ts.map +1 -1
- package/dist/features/blocks/server/schema.js +26 -23
- package/dist/features/blocks/server/schema.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/types.d.ts +13 -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/types.d.ts +13 -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 +2 -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/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/schema.d.ts.map +1 -1
- package/dist/features/experimental_table/server/schema.js +6 -3
- package/dist/features/experimental_table/server/schema.js.map +1 -1
- package/dist/features/link/server/schema.d.ts.map +1 -1
- package/dist/features/link/server/schema.js +10 -7
- package/dist/features/link/server/schema.js.map +1 -1
- package/dist/features/relationship/server/schema.d.ts.map +1 -1
- package/dist/features/relationship/server/schema.js +5 -8
- package/dist/features/relationship/server/schema.js.map +1 -1
- package/dist/features/upload/client/component/index.css +2 -2
- package/dist/features/upload/server/schema.d.ts +4 -4
- package/dist/features/upload/server/schema.d.ts.map +1 -1
- package/dist/features/upload/server/schema.js +34 -18
- package/dist/features/upload/server/schema.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/clientEntry.d.ts +29 -0
- package/dist/field/clientEntry.d.ts.map +1 -0
- package/dist/field/clientEntry.js +86 -0
- package/dist/field/clientEntry.js.map +1 -0
- package/dist/field/index.css +9 -12
- package/dist/field/index.js +1 -1
- package/dist/field/index.js.map +1 -1
- package/dist/field/rscEntry.d.ts.map +1 -1
- package/dist/field/rscEntry.js +2 -0
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -4
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +36 -2
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/lexical/LexicalProvider.js +22 -7
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/loader.d.ts.map +1 -1
- package/dist/lexical/config/client/loader.js +5 -1
- package/dist/lexical/config/client/loader.js.map +1 -1
- package/dist/types/builtInNodes.d.ts.map +1 -1
- package/dist/types/builtInNodes.js +17 -17
- package/dist/types/builtInNodes.js.map +1 -1
- package/dist/types/index.d.ts +16 -16
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/jsonSchemaHelpers.d.ts +2 -0
- package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
- package/dist/types/jsonSchemaHelpers.js +7 -3
- package/dist/types/jsonSchemaHelpers.js.map +1 -1
- package/dist/types/nodeTypes.d.ts +51 -9
- package/dist/types/nodeTypes.d.ts.map +1 -1
- package/dist/types/nodeTypes.js +3 -3
- package/dist/types/nodeTypes.js.map +1 -1
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/types/schema.js +12 -2
- package/dist/types/schema.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/buildInitialState.d.ts +2 -1
- package/dist/utilities/buildInitialState.d.ts.map +1 -1
- package/dist/utilities/buildInitialState.js.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/fieldsDrawer/index.css +12 -0
- package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
- package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
- package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
- package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.js +7 -3
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/package.json +8 -7
- package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
- package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
- package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
- package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
- package/dist/exports/client/chunk-INBEEENE.js +0 -2
- package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
- package/dist/exports/client/chunk-UAKNDD6R.js +0 -2
- package/dist/exports/client/chunk-UAKNDD6R.js.map +0 -7
- package/dist/exports/client/componentInline-D3A6OW76.js +0 -2
- /package/dist/exports/client/{component-HKTAZ77E.js.map → component-PHZQBOJE.js.map} +0 -0
- /package/dist/exports/client/{componentInline-D3A6OW76.js.map → componentInline-R3EPNYWF.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToHtml/async/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type { SelectType, TypeWithID } from 'payload'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\nimport type { SerializedLexicalNodeWithParent } from '../shared/types.js'\nexport type HTMLPopulateArguments = {\n collectionSlug: string\n id: number | string\n select?: SelectType\n}\n\nexport type HTMLPopulateFn = <TData extends object = TypeWithID>(\n args: HTMLPopulateArguments,\n) => Promise<TData | undefined>\n\nexport type HTMLConverterAsync<\n T extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> =\n | ((args: {\n childIndex: number\n converters: HTMLConvertersAsync\n node: T\n nodesToHTML: (args: {\n converters?: HTMLConvertersAsync\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => Promise<string[]>\n parent: SerializedLexicalNodeWithParent\n populate?: HTMLPopulateFn\n providedCSSString: string\n providedStyleTag: string\n }) => Promise<string> | string)\n | string\n\nexport type HTMLConvertersAsync<\n T 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]: HTMLConverterAsync<any>\n }\n | HTMLConverterAsync<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: HTMLConverterAsync<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToHtml/async/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type { SelectType, TypeWithID } from 'payload'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\nimport type { SerializedLexicalNodeWithParent } from '../shared/types.js'\nexport type HTMLPopulateArguments = {\n collectionSlug: string\n id: number | string\n select?: SelectType\n}\n\nexport type HTMLPopulateFn = <TData extends object = TypeWithID>(\n args: HTMLPopulateArguments,\n) => Promise<TData | undefined>\n\nexport type HTMLConverterAsync<\n T extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> =\n | ((args: {\n childIndex: number\n converters: HTMLConvertersAsync\n node: T\n nodesToHTML: (args: {\n converters?: HTMLConvertersAsync\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => Promise<string[]>\n parent: SerializedLexicalNodeWithParent\n populate?: HTMLPopulateFn\n providedCSSString: string\n providedStyleTag: string\n }) => Promise<string> | string)\n | string\n\nexport type HTMLConvertersAsync<\n T 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]: HTMLConverterAsync<any>\n }\n | HTMLConverterAsync<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: HTMLConverterAsync<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<T, { type: 'block' }>['fields']['blockType']]?: HTMLConverterAsync<\n Extract<T, { fields: { blockType: K }; type: 'block' }>\n >\n }\n inlineBlocks?: {\n [K in Extract<T, { type: 'inlineBlock' }>['fields']['blockType']]?: HTMLConverterAsync<\n Extract<T, { fields: { blockType: K }; type: 'inlineBlock' }>\n >\n }\n unknown?: HTMLConverterAsync<SerializedLexicalNode>\n}\n\nexport type HTMLConvertersFunctionAsync<\n T extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }>\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>,\n> = (args: { defaultConverters: HTMLConvertersAsync<T> }) => HTMLConvertersAsync<T>\n"],"mappings":"AAsEA","ignoreList":[]}
|
|
@@ -38,26 +38,24 @@ export type HTMLConverters<T extends {
|
|
|
38
38
|
}>>;
|
|
39
39
|
} & {
|
|
40
40
|
blocks?: {
|
|
41
|
-
[K in Extract<
|
|
41
|
+
[K in Extract<T, {
|
|
42
42
|
type: 'block';
|
|
43
|
-
}>
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
}>['fields']['blockType']]?: HTMLConverter<Extract<T, {
|
|
44
|
+
fields: {
|
|
45
|
+
blockType: K;
|
|
46
|
+
};
|
|
46
47
|
type: 'block';
|
|
47
|
-
}
|
|
48
|
-
blockType: K;
|
|
49
|
-
}>> : SerializedBlockNode>;
|
|
48
|
+
}>>;
|
|
50
49
|
};
|
|
51
50
|
inlineBlocks?: {
|
|
52
|
-
[K in Extract<
|
|
51
|
+
[K in Extract<T, {
|
|
53
52
|
type: 'inlineBlock';
|
|
54
|
-
}>
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
}>['fields']['blockType']]?: HTMLConverter<Extract<T, {
|
|
54
|
+
fields: {
|
|
55
|
+
blockType: K;
|
|
56
|
+
};
|
|
57
57
|
type: 'inlineBlock';
|
|
58
|
-
}
|
|
59
|
-
blockType: K;
|
|
60
|
-
}>> : SerializedInlineBlockNode>;
|
|
58
|
+
}>>;
|
|
61
59
|
};
|
|
62
60
|
unknown?: HTMLConverter<SerializedLexicalNode>;
|
|
63
61
|
};
|
|
@@ -71,6 +69,6 @@ export type HTMLConvertersFunction<T extends {
|
|
|
71
69
|
blockName?: null | string;
|
|
72
70
|
blockType: string;
|
|
73
71
|
}>> = (args: {
|
|
74
|
-
defaultConverters: HTMLConverters<
|
|
72
|
+
defaultConverters: HTMLConverters<T>;
|
|
75
73
|
}) => HTMLConverters<T>;
|
|
76
74
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToHtml/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,aAAa,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IAE3F,CAAC,CAAC,IAAI,EAAE;IACN,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,cAAc,CAAA;IAC1B,IAAI,EAAE,CAAC,CAAA;IACP,WAAW,EAAE,CAAC,IAAI,EAAE;QAClB,UAAU,CAAC,EAAE,cAAc,CAAA;QAC3B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QACrC,KAAK,EAAE,qBAAqB,EAAE,CAAA;QAC9B,MAAM,CAAC,EAAE,+BAA+B,CAAA;KACzC,KAAK,MAAM,EAAE,CAAA;IACd,MAAM,EAAE,+BAA+B,CAAA;IACvC,iBAAiB,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;CACzB,KAAK,MAAM,CAAC,GACb,MAAM,CAAA;AAEZ,MAAM,MAAM,cAAc,CACxB,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,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,IAC7E;IACF,CAAC,GAAG,EAAE,MAAM,GACR;QACE,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;KACxC,GACD,aAAa,CAAC,GAAG,CAAC,GAClB,SAAS,CAAA;CACd,GAAG;KACD,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,CACpF,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/lexicalToHtml/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,gC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EAAE,MAAM,CAAA;CAAE,CAAC,GACrE,yBAAyB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,IAC7E,CAAC,IAAI,EAAE;IAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC,CAAA;CAAE,KAAK,cAAc,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToHtml/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 HTMLConverter<T extends { [key: string]: any; type?: string } = SerializedLexicalNode> =\n\n | ((args: {\n childIndex: number\n converters: HTMLConverters\n node: T\n nodesToHTML: (args: {\n converters?: HTMLConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => string[]\n parent: SerializedLexicalNodeWithParent\n providedCSSString: string\n providedStyleTag: string\n }) => string)\n | string\n\nexport type HTMLConverters<\n T 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]: HTMLConverter<any>\n }\n | HTMLConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: HTMLConverter<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToHtml/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 HTMLConverter<T extends { [key: string]: any; type?: string } = SerializedLexicalNode> =\n\n | ((args: {\n childIndex: number\n converters: HTMLConverters\n node: T\n nodesToHTML: (args: {\n converters?: HTMLConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => string[]\n parent: SerializedLexicalNodeWithParent\n providedCSSString: string\n providedStyleTag: string\n }) => string)\n | string\n\nexport type HTMLConverters<\n T 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]: HTMLConverter<any>\n }\n | HTMLConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: HTMLConverter<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<T, { type: 'block' }>['fields']['blockType']]?: HTMLConverter<\n Extract<T, { fields: { blockType: K }; type: 'block' }>\n >\n }\n inlineBlocks?: {\n [K in Extract<T, { type: 'inlineBlock' }>['fields']['blockType']]?: HTMLConverter<\n Extract<T, { fields: { blockType: K }; type: 'inlineBlock' }>\n >\n }\n unknown?: HTMLConverter<SerializedLexicalNode>\n}\n\nexport type HTMLConvertersFunction<\n T extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }>\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>,\n> = (args: { defaultConverters: HTMLConverters<T> }) => HTMLConverters<T>\n"],"mappings":"AA0DA","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ export type JSXConvertersFunction<T extends SerializedNodeBase = DefaultNodeType
|
|
|
10
10
|
blockName?: null | string;
|
|
11
11
|
blockType: string;
|
|
12
12
|
}>> = (args: {
|
|
13
|
-
defaultConverters: JSXConverters<
|
|
13
|
+
defaultConverters: JSXConverters<T>;
|
|
14
14
|
}) => JSXConverters<T>;
|
|
15
15
|
type RichTextProps<TNodes extends SerializedNodeBase = SerializedNodeBase> = {
|
|
16
16
|
/**
|
|
@@ -20,7 +20,7 @@ type RichTextProps<TNodes extends SerializedNodeBase = SerializedNodeBase> = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Custom converters to transform your nodes to JSX. Can be an object or a function that receives the default converters.
|
|
22
22
|
*/
|
|
23
|
-
converters?: JSXConverters | JSXConvertersFunction
|
|
23
|
+
converters?: JSXConverters<TNodes> | JSXConvertersFunction<TNodes>;
|
|
24
24
|
/**
|
|
25
25
|
* If true, removes the container div wrapper.
|
|
26
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/Component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,OAAO,EAAuB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAEzF,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,kBAAkB,GACxB,gBAAgB,GAChB,mBAAmB,CAAC;IAAE,SA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AAC,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAA;IAElE;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAC,CAAA;AAEpG,wBAAgB,QAAQ,CAAC,MAAM,SAAS,kBAAkB,GAAG,kBAAkB,EAAE,EAC/E,SAAS,EACT,UAAU,EACV,IAAI,EAAE,WAAW,EACjB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,OAAO,GACR,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,SAAS,CAoCzC"}
|
|
@@ -14,14 +14,15 @@ export function RichText({
|
|
|
14
14
|
if (!editorState) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
|
+
const baseConverters = converters;
|
|
17
18
|
let finalConverters = {};
|
|
18
|
-
if (
|
|
19
|
-
if (typeof
|
|
20
|
-
finalConverters =
|
|
19
|
+
if (baseConverters) {
|
|
20
|
+
if (typeof baseConverters === 'function') {
|
|
21
|
+
finalConverters = baseConverters({
|
|
21
22
|
defaultConverters: defaultJSXConverters
|
|
22
23
|
});
|
|
23
24
|
} else {
|
|
24
|
-
finalConverters =
|
|
25
|
+
finalConverters = baseConverters;
|
|
25
26
|
}
|
|
26
27
|
} else {
|
|
27
28
|
finalConverters = defaultJSXConverters;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","defaultJSXConverters","convertLexicalToJSX","RichText","className","converters","data","editorState","disableContainer","disableIndent","disableTextAlign","nodeMap","finalConverters","defaultConverters","content","Array","isArray","_jsx","_Fragment"],"sources":["../../../../../src/features/converters/lexicalToJSX/Component/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { SerializedNodeBase } from '../../../../types/index.js'\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\nimport type { JSXConverters } from '../converter/types.js'\n\nimport { defaultJSXConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToJSX, type ConvertLexicalToJSXArgs } from '../converter/index.js'\n\nexport type JSXConvertersFunction<\n T extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }>\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>,\n> = (args: { defaultConverters: JSXConverters<
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","defaultJSXConverters","convertLexicalToJSX","RichText","className","converters","data","editorState","disableContainer","disableIndent","disableTextAlign","nodeMap","baseConverters","finalConverters","defaultConverters","content","Array","isArray","_jsx","_Fragment"],"sources":["../../../../../src/features/converters/lexicalToJSX/Component/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { SerializedNodeBase } from '../../../../types/index.js'\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\nimport type { JSXConverters } from '../converter/types.js'\n\nimport { defaultJSXConverters } from '../converter/defaultConverters.js'\nimport { convertLexicalToJSX, type ConvertLexicalToJSXArgs } from '../converter/index.js'\n\nexport type JSXConvertersFunction<\n T extends SerializedNodeBase =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }>\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>,\n> = (args: { defaultConverters: JSXConverters<T> }) => JSXConverters<T>\n\ntype RichTextProps<TNodes extends SerializedNodeBase = SerializedNodeBase> = {\n /**\n * Override class names for the container.\n */\n className?: string\n /**\n * Custom converters to transform your nodes to JSX. Can be an object or a function that receives the default converters.\n */\n converters?: JSXConverters<TNodes> | JSXConvertersFunction<TNodes>\n\n /**\n * If true, removes the container div wrapper.\n */\n disableContainer?: boolean\n} & Pick<ConvertLexicalToJSXArgs<TNodes>, 'data' | 'disableIndent' | 'disableTextAlign' | 'nodeMap'>\n\nexport function RichText<TNodes extends SerializedNodeBase = SerializedNodeBase>({\n className,\n converters,\n data: editorState,\n disableContainer,\n disableIndent,\n disableTextAlign,\n nodeMap,\n}: RichTextProps<TNodes>): React.ReactNode {\n if (!editorState) {\n return null\n }\n\n const baseConverters = converters as JSXConverters | JSXConvertersFunction | undefined\n\n let finalConverters: JSXConverters = {}\n if (baseConverters) {\n if (typeof baseConverters === 'function') {\n finalConverters = baseConverters({ defaultConverters: defaultJSXConverters })\n } else {\n finalConverters = baseConverters\n }\n } else {\n finalConverters = defaultJSXConverters\n }\n\n const content =\n editorState &&\n !Array.isArray(editorState) &&\n typeof editorState === 'object' &&\n 'root' in editorState &&\n convertLexicalToJSX({\n converters: finalConverters,\n data: editorState,\n disableIndent,\n disableTextAlign,\n nodeMap,\n })\n\n if (disableContainer) {\n return <>{content}</>\n }\n\n return <div className={className ?? 'payload-richtext'}>{content}</div>\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAUlB,SAASC,oBAAoB,QAAQ;AACrC,SAASC,mBAAmB,QAAsC;AAyBlE,OAAO,SAASC,SAAiE;EAC/EC,SAAS;EACTC,UAAU;EACVC,IAAA,EAAMC,WAAW;EACjBC,gBAAgB;EAChBC,aAAa;EACbC,gBAAgB;EAChBC;AAAO,CACe;EACtB,IAAI,CAACJ,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,MAAMK,cAAA,GAAiBP,UAAA;EAEvB,IAAIQ,eAAA,GAAiC,CAAC;EACtC,IAAID,cAAA,EAAgB;IAClB,IAAI,OAAOA,cAAA,KAAmB,YAAY;MACxCC,eAAA,GAAkBD,cAAA,CAAe;QAAEE,iBAAA,EAAmBb;MAAqB;IAC7E,OAAO;MACLY,eAAA,GAAkBD,cAAA;IACpB;EACF,OAAO;IACLC,eAAA,GAAkBZ,oBAAA;EACpB;EAEA,MAAMc,OAAA,GACJR,WAAA,IACA,CAACS,KAAA,CAAMC,OAAO,CAACV,WAAA,KACf,OAAOA,WAAA,KAAgB,YACvB,UAAUA,WAAA,IACVL,mBAAA,CAAoB;IAClBG,UAAA,EAAYQ,eAAA;IACZP,IAAA,EAAMC,WAAA;IACNE,aAAA;IACAC,gBAAA;IACAC;EACF;EAEF,IAAIH,gBAAA,EAAkB;IACpB,oBAAOU,IAAA,CAAAC,SAAA;gBAAGJ;;EACZ;EAEA,oBAAOG,IAAA,CAAC;IAAId,SAAA,EAAWA,SAAA,IAAa;cAAqBW;;AAC3D","ignoreList":[]}
|
|
@@ -39,26 +39,24 @@ export type JSXConverters<TNodes extends {
|
|
|
39
39
|
}>>;
|
|
40
40
|
} & {
|
|
41
41
|
blocks?: {
|
|
42
|
-
[K in Extract<
|
|
42
|
+
[K in Extract<TNodes, {
|
|
43
43
|
type: 'block';
|
|
44
|
-
}>
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
}>['fields']['blockType']]?: JSXConverter<Extract<TNodes, {
|
|
45
|
+
fields: {
|
|
46
|
+
blockType: K;
|
|
47
|
+
};
|
|
47
48
|
type: 'block';
|
|
48
|
-
}
|
|
49
|
-
blockType: K;
|
|
50
|
-
}>> : SerializedBlockNode>;
|
|
49
|
+
}>>;
|
|
51
50
|
};
|
|
52
51
|
inlineBlocks?: {
|
|
53
|
-
[K in Extract<
|
|
52
|
+
[K in Extract<TNodes, {
|
|
54
53
|
type: 'inlineBlock';
|
|
55
|
-
}>
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
}>['fields']['blockType']]?: JSXConverter<Extract<TNodes, {
|
|
55
|
+
fields: {
|
|
56
|
+
blockType: K;
|
|
57
|
+
};
|
|
58
58
|
type: 'inlineBlock';
|
|
59
|
-
}
|
|
60
|
-
blockType: K;
|
|
61
|
-
}>> : SerializedInlineBlockNode>;
|
|
59
|
+
}>>;
|
|
62
60
|
};
|
|
63
61
|
unknown?: JSXConverter<SerializedLexicalNode>;
|
|
64
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/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AE,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,IAC7E;IACF,CAAC,GAAG,EAAE,MAAM,GACR;QACE,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;KACvC,GACD,YAAY,CAAC,GAAG,CAAC,GACjB,SAAS,CAAA;CACd,GAAG;KACD,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,YAAY,CACxF,OAAO,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC,CACpC;CACF,GAAG;IACF,MAAM,CAAC,EAAE;SACN,CAAC,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/converter/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;AAEvC,MAAM,MAAM,gBAAgB,CAC1B,KAAK,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IACzE;IACF,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,aAAa,CAAA;IACzB,IAAI,EAAE,KAAK,CAAA;IACX,UAAU,EAAE,CAAC,IAAI,EAAE;QACjB,UAAU,CAAC,EAAE,aAAa,CAAA;QAC1B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QA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AAG;IACF,MAAM,CAAC,EAAE;SACN,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE;YAAE,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,CAC7E,OAAO,CAAC,MAAM,EAAE;YAAE,MAAM,EAAE;gBAAE,SAAS,EAAE,CAAC,CAAA;aAAE,CAAC;YAAC,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC,CAC7D;KACF,CAAA;IACD,YAAY,CAAC,EAAE;SACZ,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE;YAAE,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,CACnF,OAAO,CAAC,MAAM,EAAE;YAAE,MAAM,EAAE;gBAAE,SAAS,EAAE,CAAC,CAAA;aAAE,CAAC;YAAC,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,CACnE;KACF,CAAA;IACD,OAAO,CAAC,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAA;CAC9C,CAAA;AACD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAC/B,GAAG,qBAAqB,CAAA"}
|
|
@@ -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,CA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AAA;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 +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,UAA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EAAE,YAgBjC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAuBrC,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,YAWpC,CAAA"}
|
|
@@ -66,13 +66,16 @@ export const tableCellNodeJSONSchema = ({
|
|
|
66
66
|
}]
|
|
67
67
|
},
|
|
68
68
|
colSpan: {
|
|
69
|
-
type: 'integer'
|
|
69
|
+
type: 'integer',
|
|
70
|
+
description: 'How many columns this cell spans (default 1).'
|
|
70
71
|
},
|
|
71
72
|
headerState: {
|
|
72
|
-
type: 'integer'
|
|
73
|
+
type: 'integer',
|
|
74
|
+
description: 'Header bitmask: 0 = normal cell, 1 = row header, 2 = column header, 3 = both.'
|
|
73
75
|
},
|
|
74
76
|
rowSpan: {
|
|
75
|
-
type: 'integer'
|
|
77
|
+
type: 'integer',
|
|
78
|
+
description: 'How many rows this cell spans (default 1).'
|
|
76
79
|
},
|
|
77
80
|
verticalAlign: {
|
|
78
81
|
type: 'string'
|
|
@@ -1 +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","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' },\n headerState: {
|
|
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,U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AAA;EACpC;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAK3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExE,MAAM,MAAM,UAAU,GAAG;IACvB,6DAA6D;IAC7D,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACpB,GAAG,CAAC,EAAE;QACJ,UAAU,EAAE,MAAM,CAAA;QAClB,yEAAyE;QACzE,KAAK,EAAE;YAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;YAAC,EAAE,EAAE,qBAAqB,CAAA;SAAE,GAAG,qBAAqB,CAAA;KACnF,GAAG,IAAI,CAAA;IACR,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,WAAW,kBAAkB,CACjC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,EAC/D,OAAO,GAAG,UAAU,CACpB,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAA;IACf,mEAAmE;IACnE,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,sBAAsB,CACrC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,EAC/D,OAAO,GAAG,UAAU,CACpB,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;CACjB;AAqHD,eAAO,MAAM,wBAAwB,GAClC,4BAA4B,KAAK,EAAE,KAAG,YActC,CAAA;AAEH,eAAO,MAAM,4BAA4B,GACtC,4BAA4B,KAAK,EAAE,KAAG,YAatC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from 'crypto';
|
|
1
2
|
import { fieldsToJSONSchema, flattenAllFields } from 'payload';
|
|
2
3
|
/**
|
|
3
4
|
* MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,
|
|
@@ -91,15 +92,18 @@ const buildLinkFieldsJSONSchema = (sanitizedFieldsWithoutText, {
|
|
|
91
92
|
type: 'string'
|
|
92
93
|
}
|
|
93
94
|
},
|
|
94
|
-
|
|
95
|
+
// `linkType`/`newTab` are already in `userFieldsSchema.required`; use Set to dedupe,
|
|
96
|
+
// so `required` stays unique (draft 2020-12 enforces `uniqueItems`).
|
|
97
|
+
required: [...new Set(['linkType', 'newTab', ...userFieldsSchema.required])]
|
|
95
98
|
};
|
|
96
99
|
};
|
|
97
100
|
/** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */
|
|
98
101
|
const STANDARD_LINK_FIELD_NAMES = new Set(['doc', 'linkType', 'newTab', 'url']);
|
|
102
|
+
const hashLinkFields = schema => createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase();
|
|
99
103
|
/**
|
|
100
|
-
* With custom link fields, emit a
|
|
101
|
-
*
|
|
102
|
-
*
|
|
104
|
+
* With custom link fields, emit a `LexicalLinkFields_<hash>` interface (hashed by its own content)
|
|
105
|
+
* so the link node picks up their real shape. Without any, reuse the default `LexicalLinkFields` for
|
|
106
|
+
* cross-alias assignability.
|
|
103
107
|
*/
|
|
104
108
|
const resolveLinkFieldsRef = (sanitizedFieldsWithoutText, args) => {
|
|
105
109
|
const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args);
|
|
@@ -110,12 +114,11 @@ const resolveLinkFieldsRef = (sanitizedFieldsWithoutText, args) => {
|
|
|
110
114
|
fieldsTypeName: 'LexicalLinkFields'
|
|
111
115
|
};
|
|
112
116
|
}
|
|
113
|
-
const
|
|
114
|
-
const fieldsTypeName = `LexicalLinkFields_${editorHash}`;
|
|
117
|
+
const fieldsTypeName = `LexicalLinkFields_${hashLinkFields(fieldsSchema)}`;
|
|
115
118
|
args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema);
|
|
116
119
|
return {
|
|
117
120
|
fieldsRef: {
|
|
118
|
-
$ref:
|
|
121
|
+
$ref: `#/$defs/${fieldsTypeName}`
|
|
119
122
|
},
|
|
120
123
|
fieldsTypeName
|
|
121
124
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":["fieldsToJSONSchema","flattenAllFields","LINK_NODES_TS","buildLinkFieldsJSONSchema","sanitizedFieldsWithoutText","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","flattenedExtraFields","fields","userFieldsSchema","length","properties","required","type","additionalProperties","doc","oneOf","relationTo","value","id","linkType","enum","newTab","url","STANDARD_LINK_FIELD_NAMES","Set","resolveLinkFieldsRef","args","fieldsSchema","hasUserExtras","some","field","has","name","fieldsRef","fieldsTypeName","editorHash","nodeUnionName","replace","set","$ref","createLinkNodeJSONSchema","elementNodeSchema","add","nodeType","tsType","createAutoLinkNodeJSONSchema"],"sources":["../../../../src/features/link/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { DefaultDocumentIDType, Field } from 'payload'\n\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaArgs, JSONSchemaFn } from '../../typesServer.js'\n\nexport type LinkFields = {\n /** Custom fields added via `LinkFeature`'s `fields` prop. */\n [k: string]: unknown\n doc?: {\n relationTo: string\n /** Document ID, or the full doc when populated by the afterRead hook. */\n value: { [k: string]: unknown; id: DefaultDocumentIDType } | DefaultDocumentIDType\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url?: string\n}\n\nexport interface SerializedLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n /** @todo make required in 4.0 and type AutoLinkNode differently */\n id?: string\n type: 'link'\n}\n\nexport interface SerializedAutoLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n type: 'autolink'\n}\n\n/**\n * MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,\n * and `SerializedAutoLinkNode` declared above.\n */\nconst LINK_NODES_TS = `export interface LexicalLinkFields {\n [k: string]: unknown;\n doc?: {\n relationTo: string;\n value: Config['db']['defaultIDType'] | { [k: string]: unknown; id: Config['db']['defaultIDType'] };\n } | null;\n linkType: 'custom' | 'internal';\n newTab: boolean;\n url?: string;\n}\nexport interface SerializedLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'link';\n fields: TFields;\n id?: string;\n}\nexport interface SerializedAutoLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'autolink';\n fields: TFields;\n}`\n\nconst buildLinkFieldsJSONSchema = (\n sanitizedFieldsWithoutText: Field[],\n {\n collectionIDFieldTypes,\n config,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n }: JSONSchemaArgs,\n): JSONSchema4 => {\n const flattenedExtraFields = flattenAllFields({ fields: sanitizedFieldsWithoutText })\n const userFieldsSchema =\n flattenedExtraFields.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtraFields,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n })\n : { properties: {}, required: [] }\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n ...userFieldsSchema.properties,\n doc: {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n properties: {\n relationTo: { type: 'string' },\n value: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n // Populated form (afterRead inflates `value` into the doc).\n {\n type: 'object',\n additionalProperties: true,\n properties: { id: { type: ['string', 'number'] } },\n required: ['id'],\n },\n ],\n },\n },\n required: ['relationTo', 'value'],\n },\n { type: 'null' },\n ],\n },\n linkType: { type: 'string', enum: ['custom', 'internal'] },\n newTab: { type: 'boolean' },\n url: { type: 'string' },\n },\n required: ['linkType', 'newTab', ...userFieldsSchema.required],\n }\n}\n\n/** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */\nconst STANDARD_LINK_FIELD_NAMES = new Set(['doc', 'linkType', 'newTab', 'url'])\n\n/**\n * With custom link fields, emit a per-editor `LexicalLinkFields_<hash>`\n * interface so the link node picks up their real shape. Without any,\n * reuse the default `LexicalLinkFields` for cross-alias assignability.\n */\nconst resolveLinkFieldsRef = (\n sanitizedFieldsWithoutText: Field[],\n args: JSONSchemaArgs,\n): { fieldsRef: JSONSchema4; fieldsTypeName: string } => {\n const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args)\n const hasUserExtras = sanitizedFieldsWithoutText.some(\n (field) => 'name' in field && !STANDARD_LINK_FIELD_NAMES.has(field.name),\n )\n if (!hasUserExtras) {\n return { fieldsRef: fieldsSchema, fieldsTypeName: 'LexicalLinkFields' }\n }\n const editorHash = args.nodeUnionName.replace(/^LexicalNodes_/, '')\n const fieldsTypeName = `LexicalLinkFields_${editorHash}`\n args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n return { fieldsRef: { $ref: `#/definitions/${fieldsTypeName}` }, fieldsTypeName }\n}\n\nexport const createLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'link',\n properties: {\n id: { type: 'string' },\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n\nexport const createAutoLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'autolink',\n properties: {\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedAutoLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n"],"mappings":"AAIA,SAASA,kBAAkB,EAAEC,gBAAgB,QAAQ;AAoCrD;;;;AAIA,MAAMC,aAAA,GAAgB;;;;;;;;;;;;;;;;;;EAkBpB;AAEF,MAAMC,yBAAA,GAA4BA,CAChCC,0BAAA,EACA;EACEC,sBAAsB;EACtBC,MAAM;EACNC,IAAI;EACJC,wBAAwB;EACxBC;AAAqB,CACN;EAEjB,MAAMC,oBAAA,GAAuBT,gBAAA,CAAiB;IAAEU,MAAA,EAAQP;EAA2B;EACnF,MAAMQ,gBAAA,GACJF,oBAAA,CAAqBG,MAAM,GAAG,KAAKP,MAAA,GAC/BN,kBAAA,CAAmB;IACjBK,sBAAA;IACAC,MAAA;IACAK,MAAA,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,EAA4B0B,IAAA;EACvF,OAAOe,iBAAA,CAAkB;IACvBE,QAAA,EAAU;IACVjC,UAAA,EAAY;MACVH,MAAA,EAAQ0B;IACV;IACAtB,QAAA,EAAU,CAAC,SAAS;IACpBiC,MAAA,EAAQ,0BAA0BR,aAAA,KAAkBF,cAAA;EACtD;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"schema.js","names":["createHash","fieldsToJSONSchema","flattenAllFields","LINK_NODES_TS","buildLinkFieldsJSONSchema","sanitizedFieldsWithoutText","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","flattenedExtraFields","fields","userFieldsSchema","length","properties","required","type","additionalProperties","doc","oneOf","relationTo","value","id","linkType","enum","newTab","url","Set","STANDARD_LINK_FIELD_NAMES","hashLinkFields","schema","update","JSON","stringify","digest","slice","toUpperCase","resolveLinkFieldsRef","args","fieldsSchema","hasUserExtras","some","field","has","name","fieldsRef","fieldsTypeName","set","$ref","createLinkNodeJSONSchema","elementNodeSchema","nodeUnionName","add","nodeType","tsType","createAutoLinkNodeJSONSchema"],"sources":["../../../../src/features/link/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { DefaultDocumentIDType, Field } from 'payload'\n\nimport { createHash } from 'crypto'\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaArgs, JSONSchemaFn } from '../../typesServer.js'\n\nexport type LinkFields = {\n /** Custom fields added via `LinkFeature`'s `fields` prop. */\n [k: string]: unknown\n doc?: {\n relationTo: string\n /** Document ID, or the full doc when populated by the afterRead hook. */\n value: { [k: string]: unknown; id: DefaultDocumentIDType } | DefaultDocumentIDType\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url?: string\n}\n\nexport interface SerializedLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n /** @todo make required in 4.0 and type AutoLinkNode differently */\n id?: string\n type: 'link'\n}\n\nexport interface SerializedAutoLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n type: 'autolink'\n}\n\n/**\n * MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,\n * and `SerializedAutoLinkNode` declared above.\n */\nconst LINK_NODES_TS = `export interface LexicalLinkFields {\n [k: string]: unknown;\n doc?: {\n relationTo: string;\n value: Config['db']['defaultIDType'] | { [k: string]: unknown; id: Config['db']['defaultIDType'] };\n } | null;\n linkType: 'custom' | 'internal';\n newTab: boolean;\n url?: string;\n}\nexport interface SerializedLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'link';\n fields: TFields;\n id?: string;\n}\nexport interface SerializedAutoLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'autolink';\n fields: TFields;\n}`\n\nconst buildLinkFieldsJSONSchema = (\n sanitizedFieldsWithoutText: Field[],\n {\n collectionIDFieldTypes,\n config,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n }: JSONSchemaArgs,\n): JSONSchema4 => {\n const flattenedExtraFields = flattenAllFields({ fields: sanitizedFieldsWithoutText })\n const userFieldsSchema =\n flattenedExtraFields.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtraFields,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n })\n : { properties: {}, required: [] }\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n ...userFieldsSchema.properties,\n doc: {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n properties: {\n relationTo: { type: 'string' },\n value: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n // Populated form (afterRead inflates `value` into the doc).\n {\n type: 'object',\n additionalProperties: true,\n properties: { id: { type: ['string', 'number'] } },\n required: ['id'],\n },\n ],\n },\n },\n required: ['relationTo', 'value'],\n },\n { type: 'null' },\n ],\n },\n linkType: { type: 'string', enum: ['custom', 'internal'] },\n newTab: { type: 'boolean' },\n url: { type: 'string' },\n },\n // `linkType`/`newTab` are already in `userFieldsSchema.required`; use Set to dedupe,\n // so `required` stays unique (draft 2020-12 enforces `uniqueItems`).\n required: [...new Set(['linkType', 'newTab', ...userFieldsSchema.required])],\n }\n}\n\n/** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */\nconst STANDARD_LINK_FIELD_NAMES = new Set(['doc', 'linkType', 'newTab', 'url'])\n\nconst hashLinkFields = (schema: JSONSchema4): string =>\n createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase()\n\n/**\n * With custom link fields, emit a `LexicalLinkFields_<hash>` interface (hashed by its own content)\n * so the link node picks up their real shape. Without any, reuse the default `LexicalLinkFields` for\n * cross-alias assignability.\n */\nconst resolveLinkFieldsRef = (\n sanitizedFieldsWithoutText: Field[],\n args: JSONSchemaArgs,\n): { fieldsRef: JSONSchema4; fieldsTypeName: string } => {\n const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args)\n const hasUserExtras = sanitizedFieldsWithoutText.some(\n (field) => 'name' in field && !STANDARD_LINK_FIELD_NAMES.has(field.name),\n )\n if (!hasUserExtras) {\n return { fieldsRef: fieldsSchema, fieldsTypeName: 'LexicalLinkFields' }\n }\n const fieldsTypeName = `LexicalLinkFields_${hashLinkFields(fieldsSchema)}`\n args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n return { fieldsRef: { $ref: `#/$defs/${fieldsTypeName}` }, fieldsTypeName }\n}\n\nexport const createLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'link',\n properties: {\n id: { type: 'string' },\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n\nexport const createAutoLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'autolink',\n properties: {\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedAutoLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n"],"mappings":"AAIA,SAASA,UAAU,QAAQ;AAC3B,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ;AAoCrD;;;;AAIA,MAAMC,aAAA,GAAgB;;;;;;;;;;;;;;;;;;EAkBpB;AAEF,MAAMC,yBAAA,GAA4BA,CAChCC,0BAAA,EACA;EACEC,sBAAsB;EACtBC,MAAM;EACNC,IAAI;EACJC,wBAAwB;EACxBC;AAAqB,CACN;EAEjB,MAAMC,oBAAA,GAAuBT,gBAAA,CAAiB;IAAEU,MAAA,EAAQP;EAA2B;EACnF,MAAMQ,gBAAA,GACJF,oBAAA,CAAqBG,MAAM,GAAG,KAAKP,MAAA,GAC/BN,kBAAA,CAAmB;IACjBK,sBAAA;IACAC,MAAA;IACAK,MAAA,EAAQD,oBAAA;IACRH,IAAA;IACAC,wBAAA;IACAC;EACF,KACA;IAAEK,UAAA,EAAY,CAAC;IAAGC,QAAA,EAAU;EAAG;EAErC,OAAO;IACLC,IAAA,EAAM;IACNC,oBAAA,EAAsB;IACtBH,UAAA,EAAY;MACV,GAAGF,gBAAA,CAAiBE,UAAU;MA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,UAAA,EAAY;MACVH,MAAA,EAAQkC;IACV;IACA9B,QAAA,EAAU,CAAC,SAAS;IACpBuC,MAAA,EAAQ,0BAA0BH,aAAA,KAAkBL,cAAA;EACtD;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAK1D,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI,cAAc,GAAG;QACnC,UAAU,EAAE,eAAe,CAAA;QAC3B,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC,SAAS;IAC5F,KAAK;CACN,GACG,cAAc,GACd,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAA;AAEjD,MAAM,MAAM,0BAA0B,CAAC,MAAM,SAAS,cAAc,GAAG,uBAAuB,IAAI;KAC/F,KAAK,IAAI,MAAM,GAAG;QACjB,UAAU,EAAE,KAAK,CAAA;QACjB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACvD;CACF,CAAC,MAAM,CAAC,GAAG;IACV,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;C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AA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { formatSchema } from '../../../types/jsonSchemaHelpers.js';
|
|
1
|
+
import { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js';
|
|
2
2
|
import { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js';
|
|
3
3
|
/** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */
|
|
4
4
|
const SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {
|
|
@@ -39,15 +39,14 @@ export const createRelationshipNodeJSONSchema = props => ({
|
|
|
39
39
|
const: slug
|
|
40
40
|
},
|
|
41
41
|
value: {
|
|
42
|
+
description: 'The related document by ID (string or number). Populated to the full document when read at depth > 0.',
|
|
42
43
|
oneOf: [{
|
|
43
44
|
type: idType
|
|
44
45
|
}, {
|
|
45
|
-
$ref:
|
|
46
|
+
$ref: `#/$defs/${slug}`
|
|
46
47
|
}]
|
|
47
48
|
},
|
|
48
|
-
version:
|
|
49
|
-
type: 'integer'
|
|
50
|
-
}
|
|
49
|
+
version: versionSchema
|
|
51
50
|
},
|
|
52
51
|
required: ['format', 'relationTo', 'type', 'value', 'version']
|
|
53
52
|
};
|
|
@@ -62,9 +61,7 @@ export const createRelationshipNodeJSONSchema = props => ({
|
|
|
62
61
|
type: 'string',
|
|
63
62
|
const: 'relationship'
|
|
64
63
|
},
|
|
65
|
-
version:
|
|
66
|
-
type: 'integer'
|
|
67
|
-
}
|
|
64
|
+
version: versionSchema
|
|
68
65
|
},
|
|
69
66
|
required: ['type', 'version']
|
|
70
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":["formatSchema","filterEnabledRelationshipCollections","SERIALIZED_RELATIONSHIP_NODE_TS","createRelationshipNodeJSONSchema","props","collectionIDFieldTypes","config","typeStringDefinitions","add","enabledCollections","collections","disabledCollections","uploads","variants","map","collection","slug","idType","type","additionalProperties","properties","const","format","relationTo","value","oneOf","$ref","version","required","schema","length","slugUnion","c","join","baseSchema","tsType"],"sources":["../../../../src/features/relationship/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { CollectionSlug, DataFromCollectionSlug, UploadCollectionSlug } from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { RelationshipFeatureProps } from './index.js'\n\nimport { formatSchema } from '../../../types/jsonSchemaHelpers.js'\nimport { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\n/**\n * Exclude upload collection slugs. This matches runtime behavior, as well as the json schema.\n */\nexport type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionSlug>] extends [\n never,\n]\n ? CollectionSlug\n : Exclude<CollectionSlug, UploadCollectionSlug>\n\nexport type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | number | string\n }\n}[TSlugs] & {\n format: LexicalElementFormat\n type: 'relationship'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */\nconst SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {\n type: 'relationship';\n format: LexicalElementFormat;\n version: number;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: number | string | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\nexport const createRelationshipNodeJSONSchema =\n (props: RelationshipFeatureProps | undefined): JSONSchemaFn =>\n ({ collectionIDFieldTypes, config, typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_RELATIONSHIP_NODE_TS)\n const enabledCollections = config?.collections\n ? filterEnabledRelationshipCollections(config.collections, {\n disabledCollections: props?.disabledCollections,\n enabledCollections: props?.enabledCollections,\n uploads: false,\n })\n : []\n\n const variants: JSONSchema4[] = enabledCollections.map((collection) => {\n const slug = collection.slug\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'relationship' },\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: {\n oneOf: [{ type: idType }, { $ref:
|
|
1
|
+
{"version":3,"file":"schema.js","names":["formatSchema","versionSchema","filterEnabledRelationshipCollections","SERIALIZED_RELATIONSHIP_NODE_TS","createRelationshipNodeJSONSchema","props","collectionIDFieldTypes","config","typeStringDefinitions","add","enabledCollections","collections","disabledCollections","uploads","variants","map","collection","slug","idType","type","additionalProperties","properties","const","format","relationTo","value","description","oneOf","$ref","version","required","schema","length","slugUnion","c","join","baseSchema","tsType"],"sources":["../../../../src/features/relationship/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { CollectionSlug, DataFromCollectionSlug, UploadCollectionSlug } from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { RelationshipFeatureProps } from './index.js'\n\nimport { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js'\nimport { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\n/**\n * Exclude upload collection slugs. This matches runtime behavior, as well as the json schema.\n */\nexport type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionSlug>] extends [\n never,\n]\n ? CollectionSlug\n : Exclude<CollectionSlug, UploadCollectionSlug>\n\nexport type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | number | string\n }\n}[TSlugs] & {\n format: LexicalElementFormat\n type: 'relationship'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */\nconst SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {\n type: 'relationship';\n format: LexicalElementFormat;\n version: number;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: number | string | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\nexport const createRelationshipNodeJSONSchema =\n (props: RelationshipFeatureProps | undefined): JSONSchemaFn =>\n ({ collectionIDFieldTypes, config, typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_RELATIONSHIP_NODE_TS)\n const enabledCollections = config?.collections\n ? filterEnabledRelationshipCollections(config.collections, {\n disabledCollections: props?.disabledCollections,\n enabledCollections: props?.enabledCollections,\n uploads: false,\n })\n : []\n\n const variants: JSONSchema4[] = enabledCollections.map((collection) => {\n const slug = collection.slug\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'relationship' },\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: {\n description:\n 'The related document by ID (string or number). Populated to the full document when read at depth > 0.',\n oneOf: [{ type: idType }, { $ref: `#/$defs/${slug}` }],\n },\n version: versionSchema,\n },\n required: ['format', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (variants.length === 0) {\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'relationship' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n }\n } else {\n const slugUnion = enabledCollections.map((c) => `'${c.slug}'`).join(' | ')\n const baseSchema: JSONSchema4 = variants.length === 1 ? variants[0]! : { oneOf: variants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AAM,KAAK,GAAG;IACzBD,MAAA,GAAS;MACPZ,IAAA,EAAM;MACNC,oBAAA,EAAsB;MACtBC,UAAA,EAAY;QACVF,IAAA,EAAM;UAAEA,IAAA,EAAM;UAAUG,KAAA,EAAO;QAAe;QAC9CO,OAAA,EAAS5B;MACX;MACA6B,QAAA,EAAU,CAAC,QAAQ;IACrB;EACF,OAAO;IACL,MAAMG,SAAA,GAAYvB,kBAAA,CAAmBK,GAAG,CAAEmB,CAAA,IAAM,IAAIA,CAAA,CAAEjB,IAAI,GAAG,EAAEkB,IAAI,CAAC;IACpE,MAAMC,UAAA,GAA0BtB,QAAA,CAASkB,MAAM,KAAK,IAAIlB,QAAQ,CAAC,EAAE,GAAI;MAAEa,KAAA,EAAOb;IAAS;IACzFiB,MAAA,GAAS;MAAE,GAAGK,UAAU;MAAEC,MAAA,EAAQ,8BAA8BJ,SAAA;IAAa;EAC/E;EAEA,OAAOF,MAAA;AACT","ignoreList":[]}
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
background: var(--color-bg-menu);
|
|
90
90
|
border-radius: var(--radius-large);
|
|
91
91
|
color: var(--color-text);
|
|
92
|
-
|
|
92
|
+
opacity: 0;
|
|
93
93
|
pointer-events: none;
|
|
94
94
|
white-space: nowrap;
|
|
95
95
|
z-index: 1;
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
.LexicalEditorTheme__upload__divider {
|
|
152
152
|
width: var(--stroke-width-small);
|
|
153
153
|
height: var(--spacer-6);
|
|
154
|
-
background: var(--
|
|
154
|
+
background: var(--color-border);
|
|
155
155
|
flex-shrink: 0;
|
|
156
156
|
}
|
|
157
157
|
|