@frontify/fondue 12.0.0-beta.134 → 12.0.0-beta.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/components/RichTextEditor/RichTextEditor.es.js +25 -23
  2. package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
  3. package/dist/components/RichTextEditor/serializer/markdown/MarkdownToSlate.es.js +3 -3
  4. package/dist/components/RichTextEditor/serializer/markdown/MarkdownToSlate.es.js.map +1 -1
  5. package/dist/components/RichTextEditor/serializer/markdown/deserializer/deserialize.d.ts +2 -2
  6. package/dist/components/RichTextEditor/serializer/markdown/deserializer/deserialize.es.js +30 -28
  7. package/dist/components/RichTextEditor/serializer/markdown/deserializer/deserialize.es.js.map +1 -1
  8. package/dist/components/RichTextEditor/serializer/markdown/options.es.js +23 -22
  9. package/dist/components/RichTextEditor/serializer/markdown/options.es.js.map +1 -1
  10. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/list/index.d.ts +2 -0
  11. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/list/index.es.js +16 -0
  12. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/list/index.es.js.map +1 -0
  13. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/mention/index.d.ts +2 -0
  14. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/mention/index.es.js +52 -0
  15. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/mention/index.es.js.map +1 -0
  16. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/extensions/mention/types.d.ts +4 -0
  17. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/index.d.ts +2 -0
  18. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/index.es.js +12 -0
  19. package/dist/components/RichTextEditor/serializer/markdown/remarkFondue/index.es.js.map +1 -0
  20. package/dist/components/RichTextEditor/serializer/markdown/{remarkMention → remarkFondue}/types.d.ts +2 -6
  21. package/dist/components/RichTextEditor/serializer/markdown/serializer/applyFormattingToBlockNode.es.js +7 -4
  22. package/dist/components/RichTextEditor/serializer/markdown/serializer/applyFormattingToBlockNode.es.js.map +1 -1
  23. package/dist/components/RichTextEditor/serializer/markdown/types.d.ts +7 -2
  24. package/dist/components/RichTextEditor/serializer/markdown/types.es.js +1 -0
  25. package/dist/components/RichTextEditor/serializer/markdown/types.es.js.map +1 -1
  26. package/dist/index.cjs.js +20 -19
  27. package/dist/index.cjs.js.map +1 -1
  28. package/dist/index.umd.js +24 -23
  29. package/dist/index.umd.js.map +1 -1
  30. package/dist/styles.css +1 -1
  31. package/package.json +1 -1
  32. package/dist/components/RichTextEditor/serializer/markdown/remarkMention/index.d.ts +0 -3
  33. package/dist/components/RichTextEditor/serializer/markdown/remarkMention/index.es.js +0 -49
  34. package/dist/components/RichTextEditor/serializer/markdown/remarkMention/index.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"applyFormattingToBlockNode.es.js","sources":["../../../../../../src/components/RichTextEditor/serializer/markdown/serializer/applyFormattingToBlockNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport escapeHtml from 'escape-html';\nimport { BlockType, InputNodeTypes, NodeType, OptionType } from '../types';\nimport { isLeafNode } from './isLeafNode';\n\nconst processMentionNode = (chunk: BlockType) => `@[${chunk.category}:${chunk.id}]`;\n\nconst processListItemNode = (\n nodeTypes: InputNodeTypes,\n children: string,\n chunk: NodeType,\n listDepth: number,\n): string => {\n const isOL = chunk && chunk.parentType === nodeTypes.olList;\n const treatAsLeaf = (chunk as BlockType).children.length === 1 && isLeafNode((chunk as BlockType).children[0]);\n\n let spacer = '';\n for (let k = 0; listDepth > k; k++) {\n if (isOL) {\n // https://github.com/remarkjs/remark-react/issues/65\n spacer += ' ';\n } else {\n spacer += ' ';\n }\n }\n return `${spacer}${isOL ? '1.' : '-'} ${children}${treatAsLeaf ? '\\n' : ''}`;\n};\n\nconst shouldEscapeNode = (children: string, nodeTypes: InputNodeTypes, type?: string, parentType?: string) => {\n // don't escape if: code block, image, img\n const isCodeBlock = parentType === nodeTypes.codeBlock || type === nodeTypes.codeBlock;\n if (!isCodeBlock) {\n children = escapeHtml(children);\n }\n\n return children;\n};\n\nexport const applyFormattingToBlockNode = (\n options: OptionType,\n children: string,\n chunk: NodeType,\n listDepth: number,\n type?: string,\n parentType?: string,\n) => {\n const nodeTypes = options.nodeTypes as InputNodeTypes;\n\n switch (type) {\n case nodeTypes.heading[1]:\n return `# ${children}\\n`;\n case nodeTypes.heading[2]:\n return `## ${children}\\n`;\n case nodeTypes.heading[3]:\n return `### ${children}\\n`;\n case nodeTypes.heading[4]:\n return `#### ${children}\\n`;\n case nodeTypes.heading[5]:\n return `##### ${children}\\n`;\n case nodeTypes.heading[6]:\n return `###### ${children}\\n`;\n\n case nodeTypes.blockQuote:\n /**\n * For some reason, marked is parsing blockquote w/ one new line as\n * continued blockquote, so adding two new lines ensures that doesn't\n * happen\n */\n return `> ${children}\\n`;\n\n case nodeTypes.codeBlock:\n return `\\`\\`\\`${(chunk as BlockType).language || ''}\\n${children}\\n\\`\\`\\`\\n`;\n\n case nodeTypes.link:\n const linkUrl = (chunk as BlockType).url ?? '';\n return `[${children}](${linkUrl})`;\n\n case nodeTypes.image:\n const imageUrl = (chunk as BlockType).link ?? '';\n return `![${(chunk as BlockType).caption}](${imageUrl})`;\n\n case nodeTypes.ulList:\n case nodeTypes.olList:\n return `\\n${children}\\n`;\n\n case nodeTypes.listItem:\n return processListItemNode(nodeTypes, children, chunk, listDepth);\n\n case nodeTypes.paragraph:\n return `${children}\\n`;\n\n case nodeTypes.thematicBreak:\n return `\\n---${children}\\n\\n`;\n\n case nodeTypes.mention:\n return processMentionNode(chunk as BlockType);\n\n default:\n return shouldEscapeNode(children, nodeTypes, type, parentType);\n }\n};\n"],"names":["processMentionNode","chunk","processListItemNode","nodeTypes","children","listDepth","isOL","treatAsLeaf","isLeafNode","spacer","k","shouldEscapeNode","type","parentType","escapeHtml","applyFormattingToBlockNode","options","linkUrl","imageUrl"],"mappings":";;AAMA,MAAMA,IAAqB,CAACC,MAAqB,KAAKA,EAAM,YAAYA,EAAM,OAExEC,IAAsB,CACxBC,GACAC,GACAH,GACAI,MACS;AACT,QAAMC,IAAOL,KAASA,EAAM,eAAeE,EAAU,QAC/CI,IAAeN,EAAoB,SAAS,WAAW,KAAKO,EAAYP,EAAoB,SAAS,CAAC,CAAC;AAE7G,MAAIQ,IAAS;AACb,WAASC,IAAI,GAAGL,IAAYK,GAAGA;AAC3B,IAAIJ,IAEUG,KAAA,QAEAA,KAAA;AAGlB,SAAO,GAAGA,IAASH,IAAO,OAAO,OAAOF,IAAWG,IAAc;AAAA,IAAO;AAC5E,GAEMI,IAAmB,CAACP,GAAkBD,GAA2BS,GAAeC,OAE9DA,MAAeV,EAAU,aAAaS,MAAST,EAAU,cAEzEC,IAAWU,EAAWV,CAAQ,IAG3BA,IAGEW,IAA6B,CACtCC,GACAZ,GACAH,GACAI,GACAO,GACAC,MACC;AACD,QAAMV,IAAYa,EAAQ;AAE1B,UAAQJ,GAAM;AAAA,IACV,KAAKT,EAAU,QAAQ,CAAC;AACpB,aAAO,KAAKC;AAAA;AAAA,IAChB,KAAKD,EAAU,QAAQ,CAAC;AACpB,aAAO,MAAMC;AAAA;AAAA,IACjB,KAAKD,EAAU,QAAQ,CAAC;AACpB,aAAO,OAAOC;AAAA;AAAA,IAClB,KAAKD,EAAU,QAAQ,CAAC;AACpB,aAAO,QAAQC;AAAA;AAAA,IACnB,KAAKD,EAAU,QAAQ,CAAC;AACpB,aAAO,SAASC;AAAA;AAAA,IACpB,KAAKD,EAAU,QAAQ,CAAC;AACpB,aAAO,UAAUC;AAAA;AAAA,IAErB,KAAKD,EAAU;AAMX,aAAO,KAAKC;AAAA;AAAA,IAEhB,KAAKD,EAAU;AACJ,aAAA,SAAUF,EAAoB,YAAY;AAAA,EAAOG;AAAA;AAAA;AAAA,IAE5D,KAAKD,EAAU;AACL,YAAAc,IAAWhB,EAAoB,OAAO;AAC5C,aAAO,IAAIG,MAAaa;AAAA,IAE5B,KAAKd,EAAU;AACL,YAAAe,IAAYjB,EAAoB,QAAQ;AACvC,aAAA,KAAMA,EAAoB,YAAYiB;AAAA,IAEjD,KAAKf,EAAU;AAAA,IACf,KAAKA,EAAU;AACJ,aAAA;AAAA,EAAKC;AAAA;AAAA,IAEhB,KAAKD,EAAU;AACX,aAAOD,EAAoBC,GAAWC,GAAUH,GAAOI,CAAS;AAAA,IAEpE,KAAKF,EAAU;AACX,aAAO,GAAGC;AAAA;AAAA,IAEd,KAAKD,EAAU;AACJ,aAAA;AAAA,KAAQC;AAAA;AAAA;AAAA,IAEnB,KAAKD,EAAU;AACX,aAAOH,EAAmBC,CAAkB;AAAA,IAEhD;AACI,aAAOU,EAAiBP,GAAUD,GAAWS,GAAMC,CAAU;AAAA,EACrE;AACJ;"}
1
+ {"version":3,"file":"applyFormattingToBlockNode.es.js","sources":["../../../../../../src/components/RichTextEditor/serializer/markdown/serializer/applyFormattingToBlockNode.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport escapeHtml from 'escape-html';\nimport { BlockType, InputNodeTypes, NodeType, OptionType } from '../types';\nimport { isLeafNode } from './isLeafNode';\n\nconst processMentionNode = (chunk: BlockType) => `@[${chunk.category}:${chunk.id}]`;\n\nconst processListItemChildNode = (children: string) => `${children}\\n`;\n\nconst processListItemNode = (\n nodeTypes: InputNodeTypes,\n children: string,\n chunk: NodeType,\n listDepth: number,\n): string => {\n const isOL = chunk && chunk.parentType === nodeTypes.olList;\n const treatAsLeaf = (chunk as BlockType).children.length === 1 && isLeafNode((chunk as BlockType).children[0]);\n\n let spacer = '';\n for (let k = 0; listDepth > k; k++) {\n if (isOL) {\n // https://github.com/remarkjs/remark-react/issues/65\n spacer += ' ';\n } else {\n spacer += ' ';\n }\n }\n return `${spacer}${isOL ? '1.' : '-'} ${children}${treatAsLeaf ? '\\n' : ''}`;\n};\n\nconst shouldEscapeNode = (children: string, nodeTypes: InputNodeTypes, type?: string, parentType?: string) => {\n // don't escape if: code block, image, img\n const isCodeBlock = parentType === nodeTypes.codeBlock || type === nodeTypes.codeBlock;\n if (!isCodeBlock) {\n children = escapeHtml(children);\n }\n\n return children;\n};\n\nexport const applyFormattingToBlockNode = (\n options: OptionType,\n children: string,\n chunk: NodeType,\n listDepth: number,\n type?: string,\n parentType?: string,\n) => {\n const nodeTypes = options.nodeTypes as InputNodeTypes;\n\n switch (type) {\n case nodeTypes.heading[1]:\n return `# ${children}\\n`;\n case nodeTypes.heading[2]:\n return `## ${children}\\n`;\n case nodeTypes.heading[3]:\n return `### ${children}\\n`;\n case nodeTypes.heading[4]:\n return `#### ${children}\\n`;\n case nodeTypes.heading[5]:\n return `##### ${children}\\n`;\n case nodeTypes.heading[6]:\n return `###### ${children}\\n`;\n\n case nodeTypes.blockQuote:\n /**\n * For some reason, marked is parsing blockquote w/ one new line as\n * continued blockquote, so adding two new lines ensures that doesn't\n * happen\n */\n return `> ${children}\\n`;\n\n case nodeTypes.codeBlock:\n return `\\`\\`\\`${(chunk as BlockType).language || ''}\\n${children}\\n\\`\\`\\`\\n`;\n\n case nodeTypes.link:\n const linkUrl = (chunk as BlockType).url ?? '';\n return `[${children}](${linkUrl})`;\n\n case nodeTypes.image:\n const imageUrl = (chunk as BlockType).link ?? '';\n return `![${(chunk as BlockType).caption}](${imageUrl})`;\n\n case nodeTypes.ulList:\n case nodeTypes.olList:\n return `\\n${children}\\n`;\n\n case nodeTypes.listItem:\n return processListItemNode(nodeTypes, children, chunk, listDepth);\n\n case nodeTypes.listItemChild:\n return processListItemChildNode(children);\n\n case nodeTypes.paragraph:\n return `${children}\\n`;\n\n case nodeTypes.thematicBreak:\n return `\\n---${children}\\n\\n`;\n\n case nodeTypes.mention:\n return processMentionNode(chunk as BlockType);\n\n default:\n return shouldEscapeNode(children, nodeTypes, type, parentType);\n }\n};\n"],"names":["processMentionNode","chunk","processListItemChildNode","children","processListItemNode","nodeTypes","listDepth","isOL","treatAsLeaf","isLeafNode","spacer","k","shouldEscapeNode","type","parentType","escapeHtml","applyFormattingToBlockNode","options","linkUrl","imageUrl"],"mappings":";;AAMA,MAAMA,IAAqB,CAACC,MAAqB,KAAKA,EAAM,YAAYA,EAAM,OAExEC,IAA2B,CAACC,MAAqB,GAAGA;AAAA,GAEpDC,IAAsB,CACxBC,GACAF,GACAF,GACAK,MACS;AACT,QAAMC,IAAON,KAASA,EAAM,eAAeI,EAAU,QAC/CG,IAAeP,EAAoB,SAAS,WAAW,KAAKQ,EAAYR,EAAoB,SAAS,CAAC,CAAC;AAE7G,MAAIS,IAAS;AACb,WAASC,IAAI,GAAGL,IAAYK,GAAGA;AAC3B,IAAIJ,IAEUG,KAAA,QAEAA,KAAA;AAGlB,SAAO,GAAGA,IAASH,IAAO,OAAO,OAAOJ,IAAWK,IAAc;AAAA,IAAO;AAC5E,GAEMI,IAAmB,CAACT,GAAkBE,GAA2BQ,GAAeC,OAE9DA,MAAeT,EAAU,aAAaQ,MAASR,EAAU,cAEzEF,IAAWY,EAAWZ,CAAQ,IAG3BA,IAGEa,IAA6B,CACtCC,GACAd,GACAF,GACAK,GACAO,GACAC,MACC;AACD,QAAMT,IAAYY,EAAQ;AAE1B,UAAQJ,GAAM;AAAA,IACV,KAAKR,EAAU,QAAQ,CAAC;AACpB,aAAO,KAAKF;AAAA;AAAA,IAChB,KAAKE,EAAU,QAAQ,CAAC;AACpB,aAAO,MAAMF;AAAA;AAAA,IACjB,KAAKE,EAAU,QAAQ,CAAC;AACpB,aAAO,OAAOF;AAAA;AAAA,IAClB,KAAKE,EAAU,QAAQ,CAAC;AACpB,aAAO,QAAQF;AAAA;AAAA,IACnB,KAAKE,EAAU,QAAQ,CAAC;AACpB,aAAO,SAASF;AAAA;AAAA,IACpB,KAAKE,EAAU,QAAQ,CAAC;AACpB,aAAO,UAAUF;AAAA;AAAA,IAErB,KAAKE,EAAU;AAMX,aAAO,KAAKF;AAAA;AAAA,IAEhB,KAAKE,EAAU;AACJ,aAAA,SAAUJ,EAAoB,YAAY;AAAA,EAAOE;AAAA;AAAA;AAAA,IAE5D,KAAKE,EAAU;AACL,YAAAa,IAAWjB,EAAoB,OAAO;AAC5C,aAAO,IAAIE,MAAae;AAAA,IAE5B,KAAKb,EAAU;AACL,YAAAc,IAAYlB,EAAoB,QAAQ;AACvC,aAAA,KAAMA,EAAoB,YAAYkB;AAAA,IAEjD,KAAKd,EAAU;AAAA,IACf,KAAKA,EAAU;AACJ,aAAA;AAAA,EAAKF;AAAA;AAAA,IAEhB,KAAKE,EAAU;AACX,aAAOD,EAAoBC,GAAWF,GAAUF,GAAOK,CAAS;AAAA,IAEpE,KAAKD,EAAU;AACX,aAAOH,EAAyBC,CAAQ;AAAA,IAE5C,KAAKE,EAAU;AACX,aAAO,GAAGF;AAAA;AAAA,IAEd,KAAKE,EAAU;AACJ,aAAA;AAAA,KAAQF;AAAA;AAAA;AAAA,IAEnB,KAAKE,EAAU;AACX,aAAOL,EAAmBC,CAAkB;AAAA,IAEhD;AACI,aAAOW,EAAiBT,GAAUE,GAAWQ,GAAMC,CAAU;AAAA,EACrE;AACJ;"}
@@ -6,6 +6,7 @@ export type InputNodeTypes = {
6
6
  ulList: string;
7
7
  olList: string;
8
8
  listItem: string;
9
+ listItemChild: string;
9
10
  heading: {
10
11
  1: string;
11
12
  2: string;
@@ -22,7 +23,7 @@ export type InputNodeTypes = {
22
23
  image: string;
23
24
  mention: string;
24
25
  };
25
- export type MarkdownAstNodeType = 'paragraph' | 'heading' | 'list' | 'listItem' | 'link' | 'image' | 'blockquote' | 'code' | 'html' | 'emphasis' | 'strong' | 'delete' | 'inlineCode' | 'thematicBreak' | 'text' | 'mention';
26
+ export type MarkdownAstNodeType = 'paragraph' | 'heading' | 'list' | 'listItem' | 'listItemChild' | 'link' | 'image' | 'blockquote' | 'code' | 'html' | 'emphasis' | 'strong' | 'delete' | 'inlineCode' | 'thematicBreak' | 'text' | 'mention';
26
27
  export declare const defaultNodeTypes: InputNodeTypes;
27
28
  export type NodeType = BlockType | LeafType;
28
29
  export type LeafType = {
@@ -92,6 +93,10 @@ export type ListItemNode<T extends InputNodeTypes> = {
92
93
  type: T['listItem'];
93
94
  children: Array<DeserializedNode<T>>;
94
95
  };
96
+ export type ListItemChildNode<T extends InputNodeTypes> = {
97
+ type: T['listItemChild'];
98
+ children: Array<DeserializedNode<T>>;
99
+ };
95
100
  export type ParagraphNode<T extends InputNodeTypes> = {
96
101
  type: T['paragraph'];
97
102
  break?: true;
@@ -137,4 +142,4 @@ export type InlineCodeNode = {
137
142
  code: true;
138
143
  text: string | undefined;
139
144
  };
140
- export type DeserializedNode<T extends InputNodeTypes> = CodeBlockNode<T> | HeadingNode<T> | ListNode<T> | ListItemNode<T> | ParagraphNode<T> | LinkNode<T> | ImageNode<T> | BlockQuoteNode<T> | InlineCodeMarkNode<T> | ThematicBreakNode<T> | ItalicNode<T> | BoldNode | StrikeThoughNode | InlineCodeNode | TextNode;
145
+ export type DeserializedNode<T extends InputNodeTypes> = CodeBlockNode<T> | HeadingNode<T> | ListNode<T> | ListItemNode<T> | ListItemChildNode<T> | ParagraphNode<T> | LinkNode<T> | ImageNode<T> | BlockQuoteNode<T> | InlineCodeMarkNode<T> | ThematicBreakNode<T> | ItalicNode<T> | BoldNode | StrikeThoughNode | InlineCodeNode | TextNode;
@@ -6,6 +6,7 @@ const e = {
6
6
  ulList: "ul_list",
7
7
  olList: "ol_list",
8
8
  listItem: "list_item",
9
+ listItemChild: "lic",
9
10
  heading: {
10
11
  1: "heading_one",
11
12
  2: "heading_two",
@@ -1 +1 @@
1
- {"version":3,"file":"types.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/markdown/types.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport type InputNodeTypes = {\n paragraph: string;\n blockQuote: string;\n codeBlock: string;\n link: string;\n ulList: string;\n olList: string;\n listItem: string;\n heading: {\n 1: string;\n 2: string;\n 3: string;\n 4: string;\n 5: string;\n 6: string;\n };\n emphasisMark: string;\n strongMark: string;\n deleteMark: string;\n inlineCodeMark: string;\n thematicBreak: string;\n image: string;\n mention: string;\n};\n\nexport type MarkdownAstNodeType =\n | 'paragraph'\n | 'heading'\n | 'list'\n | 'listItem'\n | 'link'\n | 'image'\n | 'blockquote'\n | 'code'\n | 'html'\n | 'emphasis'\n | 'strong'\n | 'delete'\n | 'inlineCode'\n | 'thematicBreak'\n | 'text'\n | 'mention';\n\nexport const defaultNodeTypes: InputNodeTypes = {\n paragraph: 'paragraph',\n blockQuote: 'block_quote',\n codeBlock: 'code_block',\n link: 'link',\n ulList: 'ul_list',\n olList: 'ol_list',\n listItem: 'list_item',\n heading: {\n 1: 'heading_one',\n 2: 'heading_two',\n 3: 'heading_three',\n 4: 'heading_four',\n 5: 'heading_five',\n 6: 'heading_six',\n },\n emphasisMark: 'italic',\n strongMark: 'bold',\n deleteMark: 'strikethrough',\n inlineCodeMark: 'code',\n thematicBreak: 'thematic_break',\n image: 'image',\n mention: 'mention',\n};\n\nexport type NodeType = BlockType | LeafType;\n\nexport type LeafType = {\n text: string;\n strikethrough?: boolean;\n bold?: boolean;\n italic?: boolean;\n code?: boolean;\n parentType?: string;\n};\n\nexport type BlockType = {\n type: string;\n children: NodeType[];\n parentType?: string;\n caption?: string;\n language?: string;\n break?: boolean;\n link?: string;\n url?: string;\n id?: string;\n category?: string;\n};\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?: RecursivePartial<T[P]>;\n};\n\nexport type OptionType<T extends InputNodeTypes = InputNodeTypes> = {\n nodeTypes: RecursivePartial<T>;\n linkDestinationKey: string;\n ignoreParagraphNewline: boolean;\n listDepth: number;\n imageSourceKey?: string;\n imageCaptionKey?: string;\n};\n\nexport type PartialOptionType<T extends OptionType = OptionType> = Partial<T>;\n\nexport type MarkdownAstNode = {\n type?: MarkdownAstNodeType;\n ordered?: boolean;\n value?: string;\n text?: string;\n children?: Array<MarkdownAstNode>;\n depth?: 1 | 2 | 3 | 4 | 5 | 6;\n url?: string;\n alt?: string;\n lang?: string;\n // Markdown Ast metadata\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n position?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n spread?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n checked?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n indent?: any;\n};\n\nexport type TextNode = { text?: string };\n\nexport type CodeBlockNode<T extends InputNodeTypes> = {\n type: T['codeBlock'];\n language: string | undefined;\n children: Array<TextNode>;\n};\n\nexport type HeadingNode<T extends InputNodeTypes> = {\n type: T['heading'][1] | T['heading'][2] | T['heading'][3] | T['heading'][4] | T['heading'][5] | T['heading'][6];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type ListNode<T extends InputNodeTypes> = {\n type: T['olList'] | T['ulList'];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type ListItemNode<T extends InputNodeTypes> = {\n type: T['listItem'];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type ParagraphNode<T extends InputNodeTypes> = {\n type: T['paragraph'];\n break?: true;\n children: Array<DeserializedNode<T>>;\n};\n\nexport type LinkNode<T extends InputNodeTypes> = {\n type: T['link'];\n children: Array<DeserializedNode<T>>;\n [urlKey: string]: string | undefined | Array<DeserializedNode<T>>;\n};\n\nexport type ImageNode<T extends InputNodeTypes> = {\n type: T['image'];\n children: Array<DeserializedNode<T>>;\n [sourceOrCaptionKey: string]: string | undefined | Array<DeserializedNode<T>>;\n};\n\nexport type BlockQuoteNode<T extends InputNodeTypes> = {\n type: T['blockQuote'];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type InlineCodeMarkNode<T extends InputNodeTypes> = {\n type: T['inlineCodeMark'];\n children: Array<TextNode>;\n language: string | undefined;\n};\n\nexport type ThematicBreakNode<T extends InputNodeTypes> = {\n type: T['thematicBreak'];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type ItalicNode<T extends InputNodeTypes> = {\n [K in T['emphasisMark']]: true;\n} & {\n children: TextNode;\n};\n\nexport type BoldNode = {\n bold: true;\n children: TextNode;\n};\n\nexport type StrikeThoughNode = {\n strikethrough: true;\n children: TextNode;\n};\n\nexport type InlineCodeNode = {\n code: true;\n text: string | undefined;\n};\n\nexport type DeserializedNode<T extends InputNodeTypes> =\n | CodeBlockNode<T>\n | HeadingNode<T>\n | ListNode<T>\n | ListItemNode<T>\n | ParagraphNode<T>\n | LinkNode<T>\n | ImageNode<T>\n | BlockQuoteNode<T>\n | InlineCodeMarkNode<T>\n | ThematicBreakNode<T>\n | ItalicNode<T>\n | BoldNode\n | StrikeThoughNode\n | InlineCodeNode\n | TextNode;\n"],"names":["defaultNodeTypes"],"mappings":"AA6CO,MAAMA,IAAmC;AAAA,EAC5C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACP;AAAA,EACA,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,OAAO;AAAA,EACP,SAAS;AACb;"}
1
+ {"version":3,"file":"types.es.js","sources":["../../../../../src/components/RichTextEditor/serializer/markdown/types.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport type InputNodeTypes = {\n paragraph: string;\n blockQuote: string;\n codeBlock: string;\n link: string;\n ulList: string;\n olList: string;\n listItem: string;\n listItemChild: string;\n heading: {\n 1: string;\n 2: string;\n 3: string;\n 4: string;\n 5: string;\n 6: string;\n };\n emphasisMark: string;\n strongMark: string;\n deleteMark: string;\n inlineCodeMark: string;\n thematicBreak: string;\n image: string;\n mention: string;\n};\n\nexport type MarkdownAstNodeType =\n | 'paragraph'\n | 'heading'\n | 'list'\n | 'listItem'\n | 'listItemChild'\n | 'link'\n | 'image'\n | 'blockquote'\n | 'code'\n | 'html'\n | 'emphasis'\n | 'strong'\n | 'delete'\n | 'inlineCode'\n | 'thematicBreak'\n | 'text'\n | 'mention';\n\nexport const defaultNodeTypes: InputNodeTypes = {\n paragraph: 'paragraph',\n blockQuote: 'block_quote',\n codeBlock: 'code_block',\n link: 'link',\n ulList: 'ul_list',\n olList: 'ol_list',\n listItem: 'list_item',\n listItemChild: 'lic',\n heading: {\n 1: 'heading_one',\n 2: 'heading_two',\n 3: 'heading_three',\n 4: 'heading_four',\n 5: 'heading_five',\n 6: 'heading_six',\n },\n emphasisMark: 'italic',\n strongMark: 'bold',\n deleteMark: 'strikethrough',\n inlineCodeMark: 'code',\n thematicBreak: 'thematic_break',\n image: 'image',\n mention: 'mention',\n};\n\nexport type NodeType = BlockType | LeafType;\n\nexport type LeafType = {\n text: string;\n strikethrough?: boolean;\n bold?: boolean;\n italic?: boolean;\n code?: boolean;\n parentType?: string;\n};\n\nexport type BlockType = {\n type: string;\n children: NodeType[];\n parentType?: string;\n caption?: string;\n language?: string;\n break?: boolean;\n link?: string;\n url?: string;\n id?: string;\n category?: string;\n};\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?: RecursivePartial<T[P]>;\n};\n\nexport type OptionType<T extends InputNodeTypes = InputNodeTypes> = {\n nodeTypes: RecursivePartial<T>;\n linkDestinationKey: string;\n ignoreParagraphNewline: boolean;\n listDepth: number;\n imageSourceKey?: string;\n imageCaptionKey?: string;\n};\n\nexport type PartialOptionType<T extends OptionType = OptionType> = Partial<T>;\n\nexport type MarkdownAstNode = {\n type?: MarkdownAstNodeType;\n ordered?: boolean;\n value?: string;\n text?: string;\n children?: Array<MarkdownAstNode>;\n depth?: 1 | 2 | 3 | 4 | 5 | 6;\n url?: string;\n alt?: string;\n lang?: string;\n // Markdown Ast metadata\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n position?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n spread?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n checked?: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n indent?: any;\n};\n\nexport type TextNode = { text?: string };\n\nexport type CodeBlockNode<T extends InputNodeTypes> = {\n type: T['codeBlock'];\n language: string | undefined;\n children: Array<TextNode>;\n};\n\nexport type HeadingNode<T extends InputNodeTypes> = {\n type: T['heading'][1] | T['heading'][2] | T['heading'][3] | T['heading'][4] | T['heading'][5] | T['heading'][6];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type ListNode<T extends InputNodeTypes> = {\n type: T['olList'] | T['ulList'];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type ListItemNode<T extends InputNodeTypes> = {\n type: T['listItem'];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type ListItemChildNode<T extends InputNodeTypes> = {\n type: T['listItemChild'];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type ParagraphNode<T extends InputNodeTypes> = {\n type: T['paragraph'];\n break?: true;\n children: Array<DeserializedNode<T>>;\n};\n\nexport type LinkNode<T extends InputNodeTypes> = {\n type: T['link'];\n children: Array<DeserializedNode<T>>;\n [urlKey: string]: string | undefined | Array<DeserializedNode<T>>;\n};\n\nexport type ImageNode<T extends InputNodeTypes> = {\n type: T['image'];\n children: Array<DeserializedNode<T>>;\n [sourceOrCaptionKey: string]: string | undefined | Array<DeserializedNode<T>>;\n};\n\nexport type BlockQuoteNode<T extends InputNodeTypes> = {\n type: T['blockQuote'];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type InlineCodeMarkNode<T extends InputNodeTypes> = {\n type: T['inlineCodeMark'];\n children: Array<TextNode>;\n language: string | undefined;\n};\n\nexport type ThematicBreakNode<T extends InputNodeTypes> = {\n type: T['thematicBreak'];\n children: Array<DeserializedNode<T>>;\n};\n\nexport type ItalicNode<T extends InputNodeTypes> = {\n [K in T['emphasisMark']]: true;\n} & {\n children: TextNode;\n};\n\nexport type BoldNode = {\n bold: true;\n children: TextNode;\n};\n\nexport type StrikeThoughNode = {\n strikethrough: true;\n children: TextNode;\n};\n\nexport type InlineCodeNode = {\n code: true;\n text: string | undefined;\n};\n\nexport type DeserializedNode<T extends InputNodeTypes> =\n | CodeBlockNode<T>\n | HeadingNode<T>\n | ListNode<T>\n | ListItemNode<T>\n | ListItemChildNode<T>\n | ParagraphNode<T>\n | LinkNode<T>\n | ImageNode<T>\n | BlockQuoteNode<T>\n | InlineCodeMarkNode<T>\n | ThematicBreakNode<T>\n | ItalicNode<T>\n | BoldNode\n | StrikeThoughNode\n | InlineCodeNode\n | TextNode;\n"],"names":["defaultNodeTypes"],"mappings":"AA+CO,MAAMA,IAAmC;AAAA,EAC5C,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,eAAe;AAAA,EACf,SAAS;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACP;AAAA,EACA,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,OAAO;AAAA,EACP,SAAS;AACb;"}