@payloadcms/richtext-slate 3.0.0-alpha.60 → 3.0.0-alpha.62

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 (135) hide show
  1. package/dist/cell/index.js.map +1 -1
  2. package/dist/data/defaultValue.js.map +1 -1
  3. package/dist/data/populate.js.map +1 -1
  4. package/dist/data/recurseNestedFields.js.map +1 -1
  5. package/dist/data/richTextRelationshipPromise.js.map +1 -1
  6. package/dist/data/validation.js +3 -3
  7. package/dist/data/validation.js.map +1 -1
  8. package/dist/field/RichText.js.map +1 -1
  9. package/dist/field/createFeatureMap.js.map +1 -1
  10. package/dist/field/elements/Button.js.map +1 -1
  11. package/dist/field/elements/EnabledRelationshipsCondition.js.map +1 -1
  12. package/dist/field/elements/ListButton.js.map +1 -1
  13. package/dist/field/elements/areAllChildrenElements.js.map +1 -1
  14. package/dist/field/elements/blockquote/Blockquote.js.map +1 -1
  15. package/dist/field/elements/blockquote/index.js.map +1 -1
  16. package/dist/field/elements/getCommonBlock.js.map +1 -1
  17. package/dist/field/elements/h1/Heading1.js.map +1 -1
  18. package/dist/field/elements/h1/index.js.map +1 -1
  19. package/dist/field/elements/h2/Heading2.js.map +1 -1
  20. package/dist/field/elements/h2/index.js.map +1 -1
  21. package/dist/field/elements/h3/Heading3.js.map +1 -1
  22. package/dist/field/elements/h3/index.js.map +1 -1
  23. package/dist/field/elements/h4/Heading4.js.map +1 -1
  24. package/dist/field/elements/h4/index.js.map +1 -1
  25. package/dist/field/elements/h5/Heading5.js.map +1 -1
  26. package/dist/field/elements/h5/index.js.map +1 -1
  27. package/dist/field/elements/h6/Heading6.js.map +1 -1
  28. package/dist/field/elements/h6/index.js.map +1 -1
  29. package/dist/field/elements/indent/Button.js.map +1 -1
  30. package/dist/field/elements/indent/Element.js.map +1 -1
  31. package/dist/field/elements/indent/index.js.map +1 -1
  32. package/dist/field/elements/indent/shared.js.map +1 -1
  33. package/dist/field/elements/index.js.map +1 -1
  34. package/dist/field/elements/injectVoid.js.map +1 -1
  35. package/dist/field/elements/isActive.js.map +1 -1
  36. package/dist/field/elements/isBlockElement.js.map +1 -1
  37. package/dist/field/elements/isLastSelectedElementEmpty.js.map +1 -1
  38. package/dist/field/elements/isListActive.js.map +1 -1
  39. package/dist/field/elements/isWithinListItem.js.map +1 -1
  40. package/dist/field/elements/li/ListItem.js.map +1 -1
  41. package/dist/field/elements/li/index.js.map +1 -1
  42. package/dist/field/elements/link/Button/index.js.map +1 -1
  43. package/dist/field/elements/link/Element/index.js.map +1 -1
  44. package/dist/field/elements/link/LinkDrawer/baseFields.d.ts.map +1 -1
  45. package/dist/field/elements/link/LinkDrawer/baseFields.js +8 -19
  46. package/dist/field/elements/link/LinkDrawer/baseFields.js.map +1 -1
  47. package/dist/field/elements/link/LinkDrawer/index.js.map +1 -1
  48. package/dist/field/elements/link/LinkDrawer/types.js.map +1 -1
  49. package/dist/field/elements/link/WithLinks.js.map +1 -1
  50. package/dist/field/elements/link/index.js.map +1 -1
  51. package/dist/field/elements/link/shared.js.map +1 -1
  52. package/dist/field/elements/link/types.js.map +1 -1
  53. package/dist/field/elements/link/utilities.js.map +1 -1
  54. package/dist/field/elements/listTypes.js.map +1 -1
  55. package/dist/field/elements/ol/OrderedList.js.map +1 -1
  56. package/dist/field/elements/ol/index.js.map +1 -1
  57. package/dist/field/elements/relationship/Button/index.js.map +1 -1
  58. package/dist/field/elements/relationship/Element/index.js.map +1 -1
  59. package/dist/field/elements/relationship/index.js.map +1 -1
  60. package/dist/field/elements/relationship/plugin.js.map +1 -1
  61. package/dist/field/elements/relationship/shared.js.map +1 -1
  62. package/dist/field/elements/relationship/types.js.map +1 -1
  63. package/dist/field/elements/textAlign/index.js.map +1 -1
  64. package/dist/field/elements/toggle.js.map +1 -1
  65. package/dist/field/elements/toggleList.js.map +1 -1
  66. package/dist/field/elements/types.js.map +1 -1
  67. package/dist/field/elements/ul/UnorderedList.js.map +1 -1
  68. package/dist/field/elements/ul/index.js.map +1 -1
  69. package/dist/field/elements/unwrapList.js.map +1 -1
  70. package/dist/field/elements/upload/Button/index.js.map +1 -1
  71. package/dist/field/elements/upload/Element/UploadDrawer/index.js.map +1 -1
  72. package/dist/field/elements/upload/Element/index.js.map +1 -1
  73. package/dist/field/elements/upload/index.js.map +1 -1
  74. package/dist/field/elements/upload/plugin.js.map +1 -1
  75. package/dist/field/elements/upload/shared.js.map +1 -1
  76. package/dist/field/elements/upload/types.js.map +1 -1
  77. package/dist/field/hotkeys.js.map +1 -1
  78. package/dist/field/icons/AlignCenter/index.js.map +1 -1
  79. package/dist/field/icons/AlignLeft/index.js.map +1 -1
  80. package/dist/field/icons/AlignRight/index.js.map +1 -1
  81. package/dist/field/icons/Blockquote/index.js.map +1 -1
  82. package/dist/field/icons/Bold/index.js.map +1 -1
  83. package/dist/field/icons/Code/index.js.map +1 -1
  84. package/dist/field/icons/IndentLeft/index.js.map +1 -1
  85. package/dist/field/icons/IndentRight/index.js.map +1 -1
  86. package/dist/field/icons/Italic/index.js.map +1 -1
  87. package/dist/field/icons/Link/index.js.map +1 -1
  88. package/dist/field/icons/OrderedList/index.js.map +1 -1
  89. package/dist/field/icons/Relationship/index.js.map +1 -1
  90. package/dist/field/icons/Strikethrough/index.js.map +1 -1
  91. package/dist/field/icons/Underline/index.js.map +1 -1
  92. package/dist/field/icons/UnorderedList/index.js.map +1 -1
  93. package/dist/field/icons/Upload/index.js.map +1 -1
  94. package/dist/field/icons/headings/H1/index.js.map +1 -1
  95. package/dist/field/icons/headings/H2/index.js.map +1 -1
  96. package/dist/field/icons/headings/H3/index.js.map +1 -1
  97. package/dist/field/icons/headings/H4/index.js.map +1 -1
  98. package/dist/field/icons/headings/H5/index.js.map +1 -1
  99. package/dist/field/icons/headings/H6/index.js.map +1 -1
  100. package/dist/field/index.js.map +1 -1
  101. package/dist/field/leaves/Button.js.map +1 -1
  102. package/dist/field/leaves/bold/Bold/index.js.map +1 -1
  103. package/dist/field/leaves/bold/index.js.map +1 -1
  104. package/dist/field/leaves/code/Code/index.js.map +1 -1
  105. package/dist/field/leaves/code/index.js.map +1 -1
  106. package/dist/field/leaves/index.js.map +1 -1
  107. package/dist/field/leaves/isActive.js.map +1 -1
  108. package/dist/field/leaves/italic/Italic/index.js.map +1 -1
  109. package/dist/field/leaves/italic/index.js.map +1 -1
  110. package/dist/field/leaves/strikethrough/Strikethrough/index.js.map +1 -1
  111. package/dist/field/leaves/strikethrough/index.js.map +1 -1
  112. package/dist/field/leaves/toggle.js.map +1 -1
  113. package/dist/field/leaves/underline/Underline/index.js.map +1 -1
  114. package/dist/field/leaves/underline/index.js.map +1 -1
  115. package/dist/field/mergeCustomFunctions.js.map +1 -1
  116. package/dist/field/plugins/withEnterBreakOut.js.map +1 -1
  117. package/dist/field/plugins/withHTML.js.map +1 -1
  118. package/dist/field/providers/ElementButtonProvider.js.map +1 -1
  119. package/dist/field/providers/ElementProvider.js.map +1 -1
  120. package/dist/field/providers/LeafButtonProvider.js.map +1 -1
  121. package/dist/field/providers/LeafProvider.js.map +1 -1
  122. package/dist/field/types.js.map +1 -1
  123. package/dist/generateComponentMap.d.ts.map +1 -1
  124. package/dist/generateComponentMap.js +5 -8
  125. package/dist/generateComponentMap.js.map +1 -1
  126. package/dist/generateSchemaMap.d.ts.map +1 -1
  127. package/dist/generateSchemaMap.js +1 -8
  128. package/dist/generateSchemaMap.js.map +1 -1
  129. package/dist/index.js.map +1 -1
  130. package/dist/scss/app.scss +2 -3
  131. package/dist/scss/vars.scss +0 -7
  132. package/dist/types.js.map +1 -1
  133. package/dist/utilities/useSlatePlugin.js.map +1 -1
  134. package/package.json +15 -9
  135. package/dist/scss/fonts.scss +0 -75
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/leaves/bold/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { BoldIcon } from '../../icons/Bold/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Bold } from './Bold/index.js'\n\nexport const bold: RichTextCustomLeaf = {\n name: 'bold',\n Button: () => (\n <LeafButton format=\"bold\">\n <BoldIcon />\n </LeafButton>\n ),\n Leaf: Bold,\n}\n"],"names":["React","BoldIcon","LeafButton","Bold","bold","name","Button","format","Leaf"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,QAAQ,QAAQ,4BAA2B;AACpD,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,IAAI,QAAQ,kBAAiB;AAEtC,OAAO,MAAMC,OAA2B;IACtCC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/leaves/bold/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { BoldIcon } from '../../icons/Bold/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Bold } from './Bold/index.js'\n\nexport const bold: RichTextCustomLeaf = {\n name: 'bold',\n Button: () => (\n <LeafButton format=\"bold\">\n <BoldIcon />\n </LeafButton>\n ),\n Leaf: Bold,\n}\n"],"names":["React","BoldIcon","LeafButton","Bold","bold","name","Button","format","Leaf"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,QAAQ,QAAQ,4BAA2B;AACpD,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,IAAI,QAAQ,kBAAiB;AAEtC,OAAO,MAAMC,OAA2B;IACtCC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/leaves/code/Code/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLeaf } from '../../../providers/LeafProvider.js'\n\nexport const Code = () => {\n const { attributes, children } = useLeaf()\n return <code {...attributes}>{children}</code>\n}\n"],"names":["React","useLeaf","Code","attributes","children","code"],"mappings":"AAAA;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,qCAAoC;AAE5D,OAAO,MAAMC,OAAO;IAClB,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IACjC,qBAAO,oBAACI,QAASF,YAAaC;AAChC,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/leaves/code/Code/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLeaf } from '../../../providers/LeafProvider.js'\n\nexport const Code = () => {\n const { attributes, children } = useLeaf()\n return <code {...attributes}>{children}</code>\n}\n"],"names":["React","useLeaf","Code","attributes","children","code"],"rangeMappings":";;;;;;","mappings":"AAAA;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,qCAAoC;AAE5D,OAAO,MAAMC,OAAO;IAClB,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IACjC,qBAAO,oBAACI,QAASF,YAAaC;AAChC,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/leaves/code/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { CodeIcon } from '../../icons/Code/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Code } from './Code/index.js'\n\nexport const code: RichTextCustomLeaf = {\n name: 'code',\n Button: () => (\n <LeafButton format=\"code\">\n <CodeIcon />\n </LeafButton>\n ),\n Leaf: Code,\n}\n"],"names":["React","CodeIcon","LeafButton","Code","code","name","Button","format","Leaf"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,QAAQ,QAAQ,4BAA2B;AACpD,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,IAAI,QAAQ,kBAAiB;AAEtC,OAAO,MAAMC,OAA2B;IACtCC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/leaves/code/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { CodeIcon } from '../../icons/Code/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Code } from './Code/index.js'\n\nexport const code: RichTextCustomLeaf = {\n name: 'code',\n Button: () => (\n <LeafButton format=\"code\">\n <CodeIcon />\n </LeafButton>\n ),\n Leaf: Code,\n}\n"],"names":["React","CodeIcon","LeafButton","Code","code","name","Button","format","Leaf"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,QAAQ,QAAQ,4BAA2B;AACpD,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,IAAI,QAAQ,kBAAiB;AAEtC,OAAO,MAAMC,OAA2B;IACtCC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/leaves/index.tsx"],"sourcesContent":["import type { RichTextCustomLeaf } from '../../types.js'\n\nimport { bold } from './bold/index.js'\nimport { code } from './code/index.js'\nimport { italic } from './italic/index.js'\nimport { strikethrough } from './strikethrough/index.js'\nimport { underline } from './underline/index.js'\n\nexport const defaultLeaves: Record<string, RichTextCustomLeaf> = {\n bold,\n code,\n italic,\n strikethrough,\n underline,\n}\n"],"names":["bold","code","italic","strikethrough","underline","defaultLeaves"],"mappings":"AAEA,SAASA,IAAI,QAAQ,kBAAiB;AACtC,SAASC,IAAI,QAAQ,kBAAiB;AACtC,SAASC,MAAM,QAAQ,oBAAmB;AAC1C,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,MAAMC,gBAAoD;IAC/DL;IACAC;IACAC;IACAC;IACAC;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/leaves/index.tsx"],"sourcesContent":["import type { RichTextCustomLeaf } from '../../types.js'\n\nimport { bold } from './bold/index.js'\nimport { code } from './code/index.js'\nimport { italic } from './italic/index.js'\nimport { strikethrough } from './strikethrough/index.js'\nimport { underline } from './underline/index.js'\n\nexport const defaultLeaves: Record<string, RichTextCustomLeaf> = {\n bold,\n code,\n italic,\n strikethrough,\n underline,\n}\n"],"names":["bold","code","italic","strikethrough","underline","defaultLeaves"],"rangeMappings":";;;;;;;;;;;","mappings":"AAEA,SAASA,IAAI,QAAQ,kBAAiB;AACtC,SAASC,IAAI,QAAQ,kBAAiB;AACtC,SAASC,MAAM,QAAQ,oBAAmB;AAC1C,SAASC,aAAa,QAAQ,2BAA0B;AACxD,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,MAAMC,gBAAoD;IAC/DL;IACAC;IACAC;IACAC;IACAC;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/leaves/isActive.tsx"],"sourcesContent":["import { Editor } from 'slate'\n\nexport const isLeafActive = (editor, format) => {\n const leaves = Editor.marks(editor)\n return leaves ? leaves[format] === true : false\n}\n"],"names":["Editor","isLeafActive","editor","format","leaves","marks"],"mappings":"AAAA,SAASA,MAAM,QAAQ,QAAO;AAE9B,OAAO,MAAMC,eAAe,CAACC,QAAQC;IACnC,MAAMC,SAASJ,OAAOK,KAAK,CAACH;IAC5B,OAAOE,SAASA,MAAM,CAACD,OAAO,KAAK,OAAO;AAC5C,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/leaves/isActive.tsx"],"sourcesContent":["import { Editor } from 'slate'\n\nexport const isLeafActive = (editor, format) => {\n const leaves = Editor.marks(editor)\n return leaves ? leaves[format] === true : false\n}\n"],"names":["Editor","isLeafActive","editor","format","leaves","marks"],"rangeMappings":";;;;","mappings":"AAAA,SAASA,MAAM,QAAQ,QAAO;AAE9B,OAAO,MAAMC,eAAe,CAACC,QAAQC;IACnC,MAAMC,SAASJ,OAAOK,KAAK,CAACH;IAC5B,OAAOE,SAASA,MAAM,CAACD,OAAO,KAAK,OAAO;AAC5C,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/leaves/italic/Italic/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLeaf } from '../../../providers/LeafProvider.js'\n\nexport const Italic = () => {\n const { attributes, children } = useLeaf()\n return <em {...attributes}>{children}</em>\n}\n"],"names":["React","useLeaf","Italic","attributes","children","em"],"mappings":"AAAA;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,qCAAoC;AAE5D,OAAO,MAAMC,SAAS;IACpB,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IACjC,qBAAO,oBAACI,MAAOF,YAAaC;AAC9B,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/leaves/italic/Italic/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLeaf } from '../../../providers/LeafProvider.js'\n\nexport const Italic = () => {\n const { attributes, children } = useLeaf()\n return <em {...attributes}>{children}</em>\n}\n"],"names":["React","useLeaf","Italic","attributes","children","em"],"rangeMappings":";;;;;;","mappings":"AAAA;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,qCAAoC;AAE5D,OAAO,MAAMC,SAAS;IACpB,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IACjC,qBAAO,oBAACI,MAAOF,YAAaC;AAC9B,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/leaves/italic/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { ItalicIcon } from '../../icons/Italic/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Italic } from './Italic/index.js'\n\nexport const italic: RichTextCustomLeaf = {\n name: 'italic',\n Button: () => (\n <LeafButton format=\"italic\">\n <ItalicIcon />\n </LeafButton>\n ),\n Leaf: Italic,\n}\n"],"names":["React","ItalicIcon","LeafButton","Italic","italic","name","Button","format","Leaf"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,UAAU,QAAQ,8BAA6B;AACxD,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,MAAM,QAAQ,oBAAmB;AAE1C,OAAO,MAAMC,SAA6B;IACxCC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/leaves/italic/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { ItalicIcon } from '../../icons/Italic/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Italic } from './Italic/index.js'\n\nexport const italic: RichTextCustomLeaf = {\n name: 'italic',\n Button: () => (\n <LeafButton format=\"italic\">\n <ItalicIcon />\n </LeafButton>\n ),\n Leaf: Italic,\n}\n"],"names":["React","ItalicIcon","LeafButton","Italic","italic","name","Button","format","Leaf"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,UAAU,QAAQ,8BAA6B;AACxD,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,MAAM,QAAQ,oBAAmB;AAE1C,OAAO,MAAMC,SAA6B;IACxCC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/leaves/strikethrough/Strikethrough/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLeaf } from '../../../providers/LeafProvider.js'\n\nexport const Strikethrough = () => {\n const { attributes, children } = useLeaf()\n return <del {...attributes}>{children}</del>\n}\n"],"names":["React","useLeaf","Strikethrough","attributes","children","del"],"mappings":"AAAA;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,qCAAoC;AAE5D,OAAO,MAAMC,gBAAgB;IAC3B,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IACjC,qBAAO,oBAACI,OAAQF,YAAaC;AAC/B,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/leaves/strikethrough/Strikethrough/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLeaf } from '../../../providers/LeafProvider.js'\n\nexport const Strikethrough = () => {\n const { attributes, children } = useLeaf()\n return <del {...attributes}>{children}</del>\n}\n"],"names":["React","useLeaf","Strikethrough","attributes","children","del"],"rangeMappings":";;;;;;","mappings":"AAAA;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,qCAAoC;AAE5D,OAAO,MAAMC,gBAAgB;IAC3B,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IACjC,qBAAO,oBAACI,OAAQF,YAAaC;AAC/B,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/leaves/strikethrough/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { StrikethroughIcon } from '../../icons/Strikethrough/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Strikethrough } from './Strikethrough/index.js'\n\nexport const strikethrough: RichTextCustomLeaf = {\n name: 'strikethrough',\n Button: () => (\n <LeafButton format=\"strikethrough\">\n <StrikethroughIcon />\n </LeafButton>\n ),\n Leaf: Strikethrough,\n}\n"],"names":["React","StrikethroughIcon","LeafButton","Strikethrough","strikethrough","name","Button","format","Leaf"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,iBAAiB,QAAQ,qCAAoC;AACtE,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,aAAa,QAAQ,2BAA0B;AAExD,OAAO,MAAMC,gBAAoC;IAC/CC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/leaves/strikethrough/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { StrikethroughIcon } from '../../icons/Strikethrough/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Strikethrough } from './Strikethrough/index.js'\n\nexport const strikethrough: RichTextCustomLeaf = {\n name: 'strikethrough',\n Button: () => (\n <LeafButton format=\"strikethrough\">\n <StrikethroughIcon />\n </LeafButton>\n ),\n Leaf: Strikethrough,\n}\n"],"names":["React","StrikethroughIcon","LeafButton","Strikethrough","strikethrough","name","Button","format","Leaf"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,iBAAiB,QAAQ,qCAAoC;AACtE,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,aAAa,QAAQ,2BAA0B;AAExD,OAAO,MAAMC,gBAAoC;IAC/CC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/leaves/toggle.tsx"],"sourcesContent":["import { Editor } from 'slate'\n\nimport { isLeafActive } from './isActive.js'\n\nexport const toggleLeaf = (editor, format) => {\n const isActive = isLeafActive(editor, format)\n\n if (isActive) {\n Editor.removeMark(editor, format)\n } else {\n Editor.addMark(editor, format, true)\n }\n}\n"],"names":["Editor","isLeafActive","toggleLeaf","editor","format","isActive","removeMark","addMark"],"mappings":"AAAA,SAASA,MAAM,QAAQ,QAAO;AAE9B,SAASC,YAAY,QAAQ,gBAAe;AAE5C,OAAO,MAAMC,aAAa,CAACC,QAAQC;IACjC,MAAMC,WAAWJ,aAAaE,QAAQC;IAEtC,IAAIC,UAAU;QACZL,OAAOM,UAAU,CAACH,QAAQC;IAC5B,OAAO;QACLJ,OAAOO,OAAO,CAACJ,QAAQC,QAAQ;IACjC;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/leaves/toggle.tsx"],"sourcesContent":["import { Editor } from 'slate'\n\nimport { isLeafActive } from './isActive.js'\n\nexport const toggleLeaf = (editor, format) => {\n const isActive = isLeafActive(editor, format)\n\n if (isActive) {\n Editor.removeMark(editor, format)\n } else {\n Editor.addMark(editor, format, true)\n }\n}\n"],"names":["Editor","isLeafActive","toggleLeaf","editor","format","isActive","removeMark","addMark"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,SAASA,MAAM,QAAQ,QAAO;AAE9B,SAASC,YAAY,QAAQ,gBAAe;AAE5C,OAAO,MAAMC,aAAa,CAACC,QAAQC;IACjC,MAAMC,WAAWJ,aAAaE,QAAQC;IAEtC,IAAIC,UAAU;QACZL,OAAOM,UAAU,CAACH,QAAQC;IAC5B,OAAO;QACLJ,OAAOO,OAAO,CAACJ,QAAQC,QAAQ;IACjC;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/leaves/underline/Underline/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLeaf } from '../../../providers/LeafProvider.js'\n\nexport const Underline = () => {\n const { attributes, children } = useLeaf()\n return <u {...attributes}>{children}</u>\n}\n"],"names":["React","useLeaf","Underline","attributes","children","u"],"mappings":"AAAA;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,qCAAoC;AAE5D,OAAO,MAAMC,YAAY;IACvB,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IACjC,qBAAO,oBAACI,KAAMF,YAAaC;AAC7B,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/leaves/underline/Underline/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useLeaf } from '../../../providers/LeafProvider.js'\n\nexport const Underline = () => {\n const { attributes, children } = useLeaf()\n return <u {...attributes}>{children}</u>\n}\n"],"names":["React","useLeaf","Underline","attributes","children","u"],"rangeMappings":";;;;;;","mappings":"AAAA;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,qCAAoC;AAE5D,OAAO,MAAMC,YAAY;IACvB,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAGH;IACjC,qBAAO,oBAACI,KAAMF,YAAaC;AAC7B,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/leaves/underline/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { UnderlineIcon } from '../../icons/Underline/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Underline } from './Underline/index.js'\n\nexport const underline: RichTextCustomLeaf = {\n name: 'underline',\n Button: () => (\n <LeafButton format=\"underline\">\n <UnderlineIcon />\n </LeafButton>\n ),\n Leaf: Underline,\n}\n"],"names":["React","UnderlineIcon","LeafButton","Underline","underline","name","Button","format","Leaf"],"mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,MAAMC,YAAgC;IAC3CC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/leaves/underline/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport type { RichTextCustomLeaf } from '../../../types.js'\n\nimport { UnderlineIcon } from '../../icons/Underline/index.js'\nimport { LeafButton } from '../Button.js'\nimport { Underline } from './Underline/index.js'\n\nexport const underline: RichTextCustomLeaf = {\n name: 'underline',\n Button: () => (\n <LeafButton format=\"underline\">\n <UnderlineIcon />\n </LeafButton>\n ),\n Leaf: Underline,\n}\n"],"names":["React","UnderlineIcon","LeafButton","Underline","underline","name","Button","format","Leaf"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,OAAOA,WAAW,QAAO;AAIzB,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,SAAS,QAAQ,uBAAsB;AAEhD,OAAO,MAAMC,YAAgC;IAC3CC,MAAM;IACNC,QAAQ,kBACN,oBAACJ;YAAWK,QAAO;yBACjB,oBAACN;IAGLO,MAAML;AACR,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/field/mergeCustomFunctions.tsx"],"sourcesContent":["export default (enabledFunctions, builtInFunctions) => {\n const formattedEnabledFunctions = [...enabledFunctions]\n\n if (enabledFunctions.indexOf('ul') > -1 || enabledFunctions.indexOf('ol') > -1) {\n formattedEnabledFunctions.push('li')\n }\n\n return formattedEnabledFunctions.reduce((resultingFunctions, func) => {\n if (typeof func === 'object' && func.name) {\n return {\n ...resultingFunctions,\n [func.name]: func,\n }\n }\n\n if (typeof func === 'string' && builtInFunctions[func]) {\n return {\n ...resultingFunctions,\n [func]: builtInFunctions[func],\n }\n }\n\n return resultingFunctions\n }, {})\n}\n"],"names":["enabledFunctions","builtInFunctions","formattedEnabledFunctions","indexOf","push","reduce","resultingFunctions","func","name"],"mappings":"AAAA,eAAe,CAAA,CAACA,kBAAkBC;IAChC,MAAMC,4BAA4B;WAAIF;KAAiB;IAEvD,IAAIA,iBAAiBG,OAAO,CAAC,QAAQ,CAAC,KAAKH,iBAAiBG,OAAO,CAAC,QAAQ,CAAC,GAAG;QAC9ED,0BAA0BE,IAAI,CAAC;IACjC;IAEA,OAAOF,0BAA0BG,MAAM,CAAC,CAACC,oBAAoBC;QAC3D,IAAI,OAAOA,SAAS,YAAYA,KAAKC,IAAI,EAAE;YACzC,OAAO;gBACL,GAAGF,kBAAkB;gBACrB,CAACC,KAAKC,IAAI,CAAC,EAAED;YACf;QACF;QAEA,IAAI,OAAOA,SAAS,YAAYN,gBAAgB,CAACM,KAAK,EAAE;YACtD,OAAO;gBACL,GAAGD,kBAAkB;gBACrB,CAACC,KAAK,EAAEN,gBAAgB,CAACM,KAAK;YAChC;QACF;QAEA,OAAOD;IACT,GAAG,CAAC;AACN,CAAA,EAAC"}
1
+ {"version":3,"sources":["../../src/field/mergeCustomFunctions.tsx"],"sourcesContent":["export default (enabledFunctions, builtInFunctions) => {\n const formattedEnabledFunctions = [...enabledFunctions]\n\n if (enabledFunctions.indexOf('ul') > -1 || enabledFunctions.indexOf('ol') > -1) {\n formattedEnabledFunctions.push('li')\n }\n\n return formattedEnabledFunctions.reduce((resultingFunctions, func) => {\n if (typeof func === 'object' && func.name) {\n return {\n ...resultingFunctions,\n [func.name]: func,\n }\n }\n\n if (typeof func === 'string' && builtInFunctions[func]) {\n return {\n ...resultingFunctions,\n [func]: builtInFunctions[func],\n }\n }\n\n return resultingFunctions\n }, {})\n}\n"],"names":["enabledFunctions","builtInFunctions","formattedEnabledFunctions","indexOf","push","reduce","resultingFunctions","func","name"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,eAAe,CAAA,CAACA,kBAAkBC;IAChC,MAAMC,4BAA4B;WAAIF;KAAiB;IAEvD,IAAIA,iBAAiBG,OAAO,CAAC,QAAQ,CAAC,KAAKH,iBAAiBG,OAAO,CAAC,QAAQ,CAAC,GAAG;QAC9ED,0BAA0BE,IAAI,CAAC;IACjC;IAEA,OAAOF,0BAA0BG,MAAM,CAAC,CAACC,oBAAoBC;QAC3D,IAAI,OAAOA,SAAS,YAAYA,KAAKC,IAAI,EAAE;YACzC,OAAO;gBACL,GAAGF,kBAAkB;gBACrB,CAACC,KAAKC,IAAI,CAAC,EAAED;YACf;QACF;QAEA,IAAI,OAAOA,SAAS,YAAYN,gBAAgB,CAACM,KAAK,EAAE;YACtD,OAAO;gBACL,GAAGD,kBAAkB;gBACrB,CAACC,KAAK,EAAEN,gBAAgB,CAACM,KAAK;YAChC;QACF;QAEA,OAAOD;IACT,GAAG,CAAC;AACN,CAAA,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/plugins/withEnterBreakOut.ts"],"sourcesContent":["const enterBreakOutTypes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'link']\n\nexport const withEnterBreakOut = (editor) => {\n const newEditor = editor\n newEditor.shouldBreakOutOnEnter = (element) => enterBreakOutTypes.includes(String(element.type))\n return newEditor\n}\n"],"names":["enterBreakOutTypes","withEnterBreakOut","editor","newEditor","shouldBreakOutOnEnter","element","includes","String","type"],"mappings":"AAAA,MAAMA,qBAAqB;IAAC;IAAM;IAAM;IAAM;IAAM;IAAM;IAAM;CAAO;AAEvE,OAAO,MAAMC,oBAAoB,CAACC;IAChC,MAAMC,YAAYD;IAClBC,UAAUC,qBAAqB,GAAG,CAACC,UAAYL,mBAAmBM,QAAQ,CAACC,OAAOF,QAAQG,IAAI;IAC9F,OAAOL;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/plugins/withEnterBreakOut.ts"],"sourcesContent":["const enterBreakOutTypes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'link']\n\nexport const withEnterBreakOut = (editor) => {\n const newEditor = editor\n newEditor.shouldBreakOutOnEnter = (element) => enterBreakOutTypes.includes(String(element.type))\n return newEditor\n}\n"],"names":["enterBreakOutTypes","withEnterBreakOut","editor","newEditor","shouldBreakOutOnEnter","element","includes","String","type"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,MAAMA,qBAAqB;IAAC;IAAM;IAAM;IAAM;IAAM;IAAM;IAAM;CAAO;AAEvE,OAAO,MAAMC,oBAAoB,CAACC;IAChC,MAAMC,YAAYD;IAClBC,UAAUC,qBAAqB,GAAG,CAACC,UAAYL,mBAAmBM,QAAQ,CAACC,OAAOF,QAAQG,IAAI;IAC9F,OAAOL;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/plugins/withHTML.tsx"],"sourcesContent":["import { Transforms } from 'slate'\nimport { jsx } from 'slate-hyperscript'\n\nconst ELEMENT_TAGS = {\n A: (el) => ({\n type: 'link',\n newTab: el.getAttribute('target') === '_blank',\n url: el.getAttribute('href'),\n }),\n BLOCKQUOTE: () => ({ type: 'blockquote' }),\n H1: () => ({ type: 'h1' }),\n H2: () => ({ type: 'h2' }),\n H3: () => ({ type: 'h3' }),\n H4: () => ({ type: 'h4' }),\n H5: () => ({ type: 'h5' }),\n H6: () => ({ type: 'h6' }),\n LI: () => ({ type: 'li' }),\n OL: () => ({ type: 'ol' }),\n P: () => ({}),\n PRE: () => ({ type: 'code' }),\n UL: () => ({ type: 'ul' }),\n}\n\nconst TEXT_TAGS = {\n CODE: () => ({ code: true }),\n DEL: () => ({ strikethrough: true }),\n EM: () => ({ italic: true }),\n I: () => ({ italic: true }),\n S: () => ({ strikethrough: true }),\n STRONG: () => ({ bold: true }),\n U: () => ({ underline: true }),\n}\n\nconst deserialize = (el) => {\n if (el.nodeType === 3) {\n return el.textContent\n }\n if (el.nodeType !== 1) {\n return null\n }\n if (el.nodeName === 'BR') {\n return '\\n'\n }\n\n const { nodeName } = el\n let parent = el\n\n if (nodeName === 'PRE' && el.childNodes[0] && el.childNodes[0].nodeName === 'CODE') {\n ;[parent] = el.childNodes\n }\n\n let children = Array.from(parent.childNodes).map(deserialize).flat()\n\n if (children.length === 0) {\n children = [{ text: '' }]\n }\n\n if (el.nodeName === 'BODY') {\n return jsx('fragment', {}, children)\n }\n\n if (ELEMENT_TAGS[nodeName]) {\n const attrs = ELEMENT_TAGS[nodeName](el)\n return jsx('element', attrs, children)\n }\n\n if (TEXT_TAGS[nodeName]) {\n const attrs = TEXT_TAGS[nodeName](el)\n return children.map((child) => jsx('text', attrs, child))\n }\n\n return children\n}\n\nexport const withHTML = (incomingEditor) => {\n const { insertData } = incomingEditor\n\n const editor = incomingEditor\n\n editor.insertData = (data) => {\n if (!data.types.includes('application/x-slate-fragment')) {\n const html = data.getData('text/html')\n\n if (html) {\n const parsed = new DOMParser().parseFromString(html, 'text/html')\n const fragment = deserialize(parsed.body)\n Transforms.insertFragment(editor, fragment)\n return\n }\n }\n\n insertData(data)\n }\n\n return editor\n}\n"],"names":["Transforms","jsx","ELEMENT_TAGS","A","el","type","newTab","getAttribute","url","BLOCKQUOTE","H1","H2","H3","H4","H5","H6","LI","OL","P","PRE","UL","TEXT_TAGS","CODE","code","DEL","strikethrough","EM","italic","I","S","STRONG","bold","U","underline","deserialize","nodeType","textContent","nodeName","parent","childNodes","children","Array","from","map","flat","length","text","attrs","child","withHTML","incomingEditor","insertData","editor","data","types","includes","html","getData","parsed","DOMParser","parseFromString","fragment","body","insertFragment"],"mappings":"AAAA,SAASA,UAAU,QAAQ,QAAO;AAClC,SAASC,GAAG,QAAQ,oBAAmB;AAEvC,MAAMC,eAAe;IACnBC,GAAG,CAACC,KAAQ,CAAA;YACVC,MAAM;YACNC,QAAQF,GAAGG,YAAY,CAAC,cAAc;YACtCC,KAAKJ,GAAGG,YAAY,CAAC;QACvB,CAAA;IACAE,YAAY,IAAO,CAAA;YAAEJ,MAAM;QAAa,CAAA;IACxCK,IAAI,IAAO,CAAA;YAAEL,MAAM;QAAK,CAAA;IACxBM,IAAI,IAAO,CAAA;YAAEN,MAAM;QAAK,CAAA;IACxBO,IAAI,IAAO,CAAA;YAAEP,MAAM;QAAK,CAAA;IACxBQ,IAAI,IAAO,CAAA;YAAER,MAAM;QAAK,CAAA;IACxBS,IAAI,IAAO,CAAA;YAAET,MAAM;QAAK,CAAA;IACxBU,IAAI,IAAO,CAAA;YAAEV,MAAM;QAAK,CAAA;IACxBW,IAAI,IAAO,CAAA;YAAEX,MAAM;QAAK,CAAA;IACxBY,IAAI,IAAO,CAAA;YAAEZ,MAAM;QAAK,CAAA;IACxBa,GAAG,IAAO,CAAA,CAAC,CAAA;IACXC,KAAK,IAAO,CAAA;YAAEd,MAAM;QAAO,CAAA;IAC3Be,IAAI,IAAO,CAAA;YAAEf,MAAM;QAAK,CAAA;AAC1B;AAEA,MAAMgB,YAAY;IAChBC,MAAM,IAAO,CAAA;YAAEC,MAAM;QAAK,CAAA;IAC1BC,KAAK,IAA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;QAClC,OAAOoC,SAASG,GAAG,CAAC,CAACK,QAAU/C,IAAI,QAAQ8C,OAAOC;IACpD;IAEA,OAAOR;AACT;AAEA,OAAO,MAAMS,WAAW,CAACC;IACvB,MAAM,EAAEC,UAAU,EAAE,GAAGD;IAEvB,MAAME,SAASF;IAEfE,OAAOD,UAAU,GAAG,CAACE;QACnB,IAAI,CAACA,KAAKC,KAAK,CAACC,QAAQ,CAAC,iCAAiC;YACxD,MAAMC,OAAOH,KAAKI,OAAO,CAAC;YAE1B,IAAID,MAAM;gBACR,MAAME,SAAS,IAAIC,YAAYC,eAAe,CAACJ,MAAM;gBACrD,MAAMK,WAAW3B,YAAYwB,OAAOI,IAAI;gBACxC9D,WAAW+D,cAAc,CAACX,QAAQS;gBAClC;YACF;QACF;QAEAV,WAAWE;IACb;IAEA,OAAOD;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/plugins/withHTML.tsx"],"sourcesContent":["import { Transforms } from 'slate'\nimport { jsx } from 'slate-hyperscript'\n\nconst ELEMENT_TAGS = {\n A: (el) => ({\n type: 'link',\n newTab: el.getAttribute('target') === '_blank',\n url: el.getAttribute('href'),\n }),\n BLOCKQUOTE: () => ({ type: 'blockquote' }),\n H1: () => ({ type: 'h1' }),\n H2: () => ({ type: 'h2' }),\n H3: () => ({ type: 'h3' }),\n H4: () => ({ type: 'h4' }),\n H5: () => ({ type: 'h5' }),\n H6: () => ({ type: 'h6' }),\n LI: () => ({ type: 'li' }),\n OL: () => ({ type: 'ol' }),\n P: () => ({}),\n PRE: () => ({ type: 'code' }),\n UL: () => ({ type: 'ul' }),\n}\n\nconst TEXT_TAGS = {\n CODE: () => ({ code: true }),\n DEL: () => ({ strikethrough: true }),\n EM: () => ({ italic: true }),\n I: () => ({ italic: true }),\n S: () => ({ strikethrough: true }),\n STRONG: () => ({ bold: true }),\n U: () => ({ underline: true }),\n}\n\nconst deserialize = (el) => {\n if (el.nodeType === 3) {\n return el.textContent\n }\n if (el.nodeType !== 1) {\n return null\n }\n if (el.nodeName === 'BR') {\n return '\\n'\n }\n\n const { nodeName } = el\n let parent = el\n\n if (nodeName === 'PRE' && el.childNodes[0] && el.childNodes[0].nodeName === 'CODE') {\n ;[parent] = el.childNodes\n }\n\n let children = Array.from(parent.childNodes).map(deserialize).flat()\n\n if (children.length === 0) {\n children = [{ text: '' }]\n }\n\n if (el.nodeName === 'BODY') {\n return jsx('fragment', {}, children)\n }\n\n if (ELEMENT_TAGS[nodeName]) {\n const attrs = ELEMENT_TAGS[nodeName](el)\n return jsx('element', attrs, children)\n }\n\n if (TEXT_TAGS[nodeName]) {\n const attrs = TEXT_TAGS[nodeName](el)\n return children.map((child) => jsx('text', attrs, child))\n }\n\n return children\n}\n\nexport const withHTML = (incomingEditor) => {\n const { insertData } = incomingEditor\n\n const editor = incomingEditor\n\n editor.insertData = (data) => {\n if (!data.types.includes('application/x-slate-fragment')) {\n const html = data.getData('text/html')\n\n if (html) {\n const parsed = new DOMParser().parseFromString(html, 'text/html')\n const fragment = deserialize(parsed.body)\n Transforms.insertFragment(editor, fragment)\n return\n }\n }\n\n insertData(data)\n }\n\n return editor\n}\n"],"names":["Transforms","jsx","ELEMENT_TAGS","A","el","type","newTab","getAttribute","url","BLOCKQUOTE","H1","H2","H3","H4","H5","H6","LI","OL","P","PRE","UL","TEXT_TAGS","CODE","code","DEL","strikethrough","EM","italic","I","S","STRONG","bold","U","underline","deserialize","nodeType","textContent","nodeName","parent","childNodes","children","Array","from","map","flat","length","text","attrs","child","withHTML","incomingEditor","insertData","editor","data","types","includes","html","getData","parsed","DOMParser","parseFromString","fragment","body","insertFragment"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,QAAQ,QAAO;AAClC,SAASC,GAAG,QAAQ,oBAAmB;AAEv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MK,WAAW3B,YAAYwB,OAAOI,IAAI;gBACxC9D,WAAW+D,cAAc,CAACX,QAAQS;gBAClC;YACF;QACF;QAEAV,WAAWE;IACb;IAEA,OAAOD;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/providers/ElementButtonProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\n\nimport React from 'react'\n\ntype ElementButtonContextType = {\n fieldProps: FormFieldBase & {\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n }\n path: string\n schemaPath: string\n}\n\nconst ElementButtonContext = React.createContext<ElementButtonContextType>({\n fieldProps: {} as any,\n path: '',\n schemaPath: '',\n})\n\nexport const ElementButtonProvider: React.FC<\n ElementButtonContextType & {\n children: React.ReactNode\n }\n> = (props) => {\n const { children, ...rest } = props\n\n return (\n <ElementButtonContext.Provider\n value={{\n ...rest,\n }}\n >\n {children}\n </ElementButtonContext.Provider>\n )\n}\n\nexport const useElementButton = () => {\n const path = React.useContext(ElementButtonContext)\n return path\n}\n"],"names":["React","ElementButtonContext","createContext","fieldProps","path","schemaPath","ElementButtonProvider","props","children","rest","Provider","value","useElementButton","useContext"],"mappings":"AAAA;AAIA,OAAOA,WAAW,QAAO;AAWzB,MAAMC,qCAAuBD,MAAME,aAAa,CAA2B;IACzEC,YAAY,CAAC;IACbC,MAAM;IACNC,YAAY;AACd;AAEA,OAAO,MAAMC,wBAIT,CAACC;IACH,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGF;IAE9B,qBACE,oBAACN,qBAAqBS,QAAQ;QAC5BC,OAAO;YACL,GAAGF,IAAI;QACT;OAECD;AAGP,EAAC;AAED,OAAO,MAAMI,mBAAmB;IAC9B,MAAMR,OAAOJ,MAAMa,UAAU,CAACZ;IAC9B,OAAOG;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/providers/ElementButtonProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\n\nimport React from 'react'\n\ntype ElementButtonContextType = {\n fieldProps: FormFieldBase & {\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n }\n path: string\n schemaPath: string\n}\n\nconst ElementButtonContext = React.createContext<ElementButtonContextType>({\n fieldProps: {} as any,\n path: '',\n schemaPath: '',\n})\n\nexport const ElementButtonProvider: React.FC<\n ElementButtonContextType & {\n children: React.ReactNode\n }\n> = (props) => {\n const { children, ...rest } = props\n\n return (\n <ElementButtonContext.Provider\n value={{\n ...rest,\n }}\n >\n {children}\n </ElementButtonContext.Provider>\n )\n}\n\nexport const useElementButton = () => {\n const path = React.useContext(ElementButtonContext)\n return path\n}\n"],"names":["React","ElementButtonContext","createContext","fieldProps","path","schemaPath","ElementButtonProvider","props","children","rest","Provider","value","useElementButton","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,OAAOA,WAAW,QAAO;AAWzB,MAAMC,qCAAuBD,MAAME,aAAa,CAA2B;IACzEC,YAAY,CAAC;IACbC,MAAM;IACNC,YAAY;AACd;AAEA,OAAO,MAAMC,wBAIT,CAACC;IACH,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGF;IAE9B,qBACE,oBAACN,qBAAqBS,QAAQ;QAC5BC,OAAO;YACL,GAAGF,IAAI;QACT;OAECD;AAGP,EAAC;AAED,OAAO,MAAMI,mBAAmB;IAC9B,MAAMR,OAAOJ,MAAMa,UAAU,CAACZ;IAC9B,OAAOG;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/providers/ElementProvider.tsx"],"sourcesContent":["'use client'\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { Element } from 'slate'\n\nimport React from 'react'\n\ntype ElementContextType<T> = {\n attributes: Record<string, unknown>\n children: React.ReactNode\n editorRef: React.MutableRefObject<HTMLDivElement>\n element: T\n fieldProps: FormFieldBase & {\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n }\n path: string\n schemaPath: string\n}\n\nconst ElementContext = React.createContext<ElementContextType<Element>>({\n attributes: {},\n children: null,\n editorRef: null,\n element: {} as Element,\n fieldProps: {} as any,\n path: '',\n schemaPath: '',\n})\n\nexport const ElementProvider: React.FC<\n ElementContextType<Element> & {\n childNodes: React.ReactNode\n }\n> = (props) => {\n const { childNodes, children, ...rest } = props\n\n return (\n <ElementContext.Provider\n value={{\n ...rest,\n children: childNodes,\n }}\n >\n {children}\n </ElementContext.Provider>\n )\n}\n\nexport const useElement = <T,>(): ElementContextType<T> => {\n return React.useContext(ElementContext) as ElementContextType<T>\n}\n"],"names":["React","ElementContext","createContext","attributes","children","editorRef","element","fieldProps","path","schemaPath","ElementProvider","props","childNodes","rest","Provider","value","useElement","useContext"],"mappings":"AAAA;AAIA,OAAOA,WAAW,QAAO;AAezB,MAAMC,+BAAiBD,MAAME,aAAa,CAA8B;IACtEC,YAAY,CAAC;IACbC,UAAU;IACVC,WAAW;IACXC,SAAS,CAAC;IACVC,YAAY,CAAC;IACbC,MAAM;IACNC,YAAY;AACd;AAEA,OAAO,MAAMC,kBAIT,CAACC;IACH,MAAM,EAAEC,UAAU,EAAER,QAAQ,EAAE,GAAGS,MAAM,GAAGF;IAE1C,qBACE,oBAACV,eAAea,QAAQ;QACtBC,OAAO;YACL,GAAGF,IAAI;YACPT,UAAUQ;QACZ;OAECR;AAGP,EAAC;AAED,OAAO,MAAMY,aAAa;IACxB,OAAOhB,MAAMiB,UAAU,CAAChB;AAC1B,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/providers/ElementProvider.tsx"],"sourcesContent":["'use client'\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\nimport type { Element } from 'slate'\n\nimport React from 'react'\n\ntype ElementContextType<T> = {\n attributes: Record<string, unknown>\n children: React.ReactNode\n editorRef: React.MutableRefObject<HTMLDivElement>\n element: T\n fieldProps: FormFieldBase & {\n name: string\n richTextComponentMap: Map<string, React.ReactNode>\n }\n path: string\n schemaPath: string\n}\n\nconst ElementContext = React.createContext<ElementContextType<Element>>({\n attributes: {},\n children: null,\n editorRef: null,\n element: {} as Element,\n fieldProps: {} as any,\n path: '',\n schemaPath: '',\n})\n\nexport const ElementProvider: React.FC<\n ElementContextType<Element> & {\n childNodes: React.ReactNode\n }\n> = (props) => {\n const { childNodes, children, ...rest } = props\n\n return (\n <ElementContext.Provider\n value={{\n ...rest,\n children: childNodes,\n }}\n >\n {children}\n </ElementContext.Provider>\n )\n}\n\nexport const useElement = <T,>(): ElementContextType<T> => {\n return React.useContext(ElementContext) as ElementContextType<T>\n}\n"],"names":["React","ElementContext","createContext","attributes","children","editorRef","element","fieldProps","path","schemaPath","ElementProvider","props","childNodes","rest","Provider","value","useElement","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,OAAOA,WAAW,QAAO;AAezB,MAAMC,+BAAiBD,MAAME,aAAa,CAA8B;IACtEC,YAAY,CAAC;IACbC,UAAU;IACVC,WAAW;IACXC,SAAS,CAAC;IACVC,YAAY,CAAC;IACbC,MAAM;IACNC,YAAY;AACd;AAEA,OAAO,MAAMC,kBAIT,CAACC;IACH,MAAM,EAAEC,UAAU,EAAER,QAAQ,EAAE,GAAGS,MAAM,GAAGF;IAE1C,qBACE,oBAACV,eAAea,QAAQ;QACtBC,OAAO;YACL,GAAGF,IAAI;YACPT,UAAUQ;QACZ;OAECR;AAGP,EAAC;AAED,OAAO,MAAMY,aAAa;IACxB,OAAOhB,MAAMiB,UAAU,CAAChB;AAC1B,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/providers/LeafButtonProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\n\nimport React from 'react'\n\ntype LeafButtonContextType = {\n fieldProps: FormFieldBase & {\n name: string\n }\n path: string\n schemaPath: string\n}\n\nconst LeafButtonContext = React.createContext<LeafButtonContextType>({\n fieldProps: {} as any,\n path: '',\n schemaPath: '',\n})\n\nexport const LeafButtonProvider: React.FC<\n LeafButtonContextType & {\n children: React.ReactNode\n }\n> = (props) => {\n const { children, ...rest } = props\n\n return (\n <LeafButtonContext.Provider\n value={{\n ...rest,\n }}\n >\n {children}\n </LeafButtonContext.Provider>\n )\n}\n\nexport const useLeafButton = () => {\n const path = React.useContext(LeafButtonContext)\n return path\n}\n"],"names":["React","LeafButtonContext","createContext","fieldProps","path","schemaPath","LeafButtonProvider","props","children","rest","Provider","value","useLeafButton","useContext"],"mappings":"AAAA;AAIA,OAAOA,WAAW,QAAO;AAUzB,MAAMC,kCAAoBD,MAAME,aAAa,CAAwB;IACnEC,YAAY,CAAC;IACbC,MAAM;IACNC,YAAY;AACd;AAEA,OAAO,MAAMC,qBAIT,CAACC;IACH,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGF;IAE9B,qBACE,oBAACN,kBAAkBS,QAAQ;QACzBC,OAAO;YACL,GAAGF,IAAI;QACT;OAECD;AAGP,EAAC;AAED,OAAO,MAAMI,gBAAgB;IAC3B,MAAMR,OAAOJ,MAAMa,UAAU,CAACZ;IAC9B,OAAOG;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/providers/LeafButtonProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\n\nimport React from 'react'\n\ntype LeafButtonContextType = {\n fieldProps: FormFieldBase & {\n name: string\n }\n path: string\n schemaPath: string\n}\n\nconst LeafButtonContext = React.createContext<LeafButtonContextType>({\n fieldProps: {} as any,\n path: '',\n schemaPath: '',\n})\n\nexport const LeafButtonProvider: React.FC<\n LeafButtonContextType & {\n children: React.ReactNode\n }\n> = (props) => {\n const { children, ...rest } = props\n\n return (\n <LeafButtonContext.Provider\n value={{\n ...rest,\n }}\n >\n {children}\n </LeafButtonContext.Provider>\n )\n}\n\nexport const useLeafButton = () => {\n const path = React.useContext(LeafButtonContext)\n return path\n}\n"],"names":["React","LeafButtonContext","createContext","fieldProps","path","schemaPath","LeafButtonProvider","props","children","rest","Provider","value","useLeafButton","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,OAAOA,WAAW,QAAO;AAUzB,MAAMC,kCAAoBD,MAAME,aAAa,CAAwB;IACnEC,YAAY,CAAC;IACbC,MAAM;IACNC,YAAY;AACd;AAEA,OAAO,MAAMC,qBAIT,CAACC;IACH,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGF;IAE9B,qBACE,oBAACN,kBAAkBS,QAAQ;QACzBC,OAAO;YACL,GAAGF,IAAI;QACT;OAECD;AAGP,EAAC;AAED,OAAO,MAAMI,gBAAgB;IAC3B,MAAMR,OAAOJ,MAAMa,UAAU,CAACZ;IAC9B,OAAOG;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/providers/LeafProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\n\nimport React from 'react'\n\ntype LeafContextType = {\n attributes: Record<string, unknown>\n children: React.ReactNode\n editorRef: React.MutableRefObject<HTMLDivElement>\n fieldProps: FormFieldBase & {\n name: string\n }\n leaf: string\n path: string\n schemaPath: string\n}\n\nconst LeafContext = React.createContext<LeafContextType>({\n attributes: {},\n children: null,\n editorRef: null,\n fieldProps: {} as any,\n leaf: '',\n path: '',\n schemaPath: '',\n})\n\nexport const LeafProvider: React.FC<\n LeafContextType & {\n result: React.ReactNode\n }\n> = (props) => {\n const { children, result, ...rest } = props\n\n return (\n <LeafContext.Provider\n value={{\n ...rest,\n children: result,\n }}\n >\n {children}\n </LeafContext.Provider>\n )\n}\n\nexport const useLeaf = () => {\n const path = React.useContext(LeafContext)\n return path\n}\n"],"names":["React","LeafContext","createContext","attributes","children","editorRef","fieldProps","leaf","path","schemaPath","LeafProvider","props","result","rest","Provider","value","useLeaf","useContext"],"mappings":"AAAA;AAIA,OAAOA,WAAW,QAAO;AAczB,MAAMC,4BAAcD,MAAME,aAAa,CAAkB;IACvDC,YAAY,CAAC;IACbC,UAAU;IACVC,WAAW;IACXC,YAAY,CAAC;IACbC,MAAM;IACNC,MAAM;IACNC,YAAY;AACd;AAEA,OAAO,MAAMC,eAIT,CAACC;IACH,MAAM,EAAEP,QAAQ,EAAEQ,MAAM,EAAE,GAAGC,MAAM,GAAGF;IAEtC,qBACE,oBAACV,YAAYa,QAAQ;QACnBC,OAAO;YACL,GAAGF,IAAI;YACPT,UAAUQ;QACZ;OAECR;AAGP,EAAC;AAED,OAAO,MAAMY,UAAU;IACrB,MAAMR,OAAOR,MAAMiB,UAAU,CAAChB;IAC9B,OAAOO;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/providers/LeafProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { FormFieldBase } from '@payloadcms/ui/fields/shared'\n\nimport React from 'react'\n\ntype LeafContextType = {\n attributes: Record<string, unknown>\n children: React.ReactNode\n editorRef: React.MutableRefObject<HTMLDivElement>\n fieldProps: FormFieldBase & {\n name: string\n }\n leaf: string\n path: string\n schemaPath: string\n}\n\nconst LeafContext = React.createContext<LeafContextType>({\n attributes: {},\n children: null,\n editorRef: null,\n fieldProps: {} as any,\n leaf: '',\n path: '',\n schemaPath: '',\n})\n\nexport const LeafProvider: React.FC<\n LeafContextType & {\n result: React.ReactNode\n }\n> = (props) => {\n const { children, result, ...rest } = props\n\n return (\n <LeafContext.Provider\n value={{\n ...rest,\n children: result,\n }}\n >\n {children}\n </LeafContext.Provider>\n )\n}\n\nexport const useLeaf = () => {\n const path = React.useContext(LeafContext)\n return path\n}\n"],"names":["React","LeafContext","createContext","attributes","children","editorRef","fieldProps","leaf","path","schemaPath","LeafProvider","props","result","rest","Provider","value","useLeaf","useContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,OAAOA,WAAW,QAAO;AAczB,MAAMC,4BAAcD,MAAME,aAAa,CAAkB;IACvDC,YAAY,CAAC;IACbC,UAAU;IACVC,WAAW;IACXC,YAAY,CAAC;IACbC,MAAM;IACNC,MAAM;IACNC,YAAY;AACd;AAEA,OAAO,MAAMC,eAIT,CAACC;IACH,MAAM,EAAEP,QAAQ,EAAEQ,MAAM,EAAE,GAAGC,MAAM,GAAGF;IAEtC,qBACE,oBAACV,YAAYa,QAAQ;QACnBC,OAAO;YACL,GAAGF,IAAI;YACPT,UAAUQ;QACZ;OAECR;AAGP,EAAC;AAED,OAAO,MAAMY,UAAU;IACrB,MAAMR,OAAOR,MAAMiB,UAAU,CAAChB;IAC9B,OAAOO;AACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/field/types.ts"],"sourcesContent":["export type EnabledFeatures = {\n elements: {\n [name: string]: {\n Button: React.ReactNode\n Element: React.ReactNode\n name: string\n }\n }\n leaves: {\n [name: string]: {\n Button: React.ReactNode\n Leaf: React.ReactNode\n name: string\n }\n }\n plugins: React.ReactNode[]\n}\n"],"names":[],"mappings":"AAAA,WAgBC"}
1
+ {"version":3,"sources":["../../src/field/types.ts"],"sourcesContent":["export type EnabledFeatures = {\n elements: {\n [name: string]: {\n Button: React.ReactNode\n Element: React.ReactNode\n name: string\n }\n }\n leaves: {\n [name: string]: {\n Button: React.ReactNode\n Leaf: React.ReactNode\n name: string\n }\n }\n plugins: React.ReactNode[]\n}\n"],"names":[],"rangeMappings":"","mappings":"AAAA,WAgBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generateComponentMap.d.ts","sourceRoot":"","sources":["../src/generateComponentMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAQpD,OAAO,KAAK,EAAE,gBAAgB,EAA6C,MAAM,YAAY,CAAA;AAQ7F,eAAO,MAAM,uBAAuB,SAC3B,gBAAgB,KAAG,eAAe,CAAC,sBAAsB,CA8G/D,CAAA"}
1
+ {"version":3,"file":"generateComponentMap.d.ts","sourceRoot":"","sources":["../src/generateComponentMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAMpD,OAAO,KAAK,EAAE,gBAAgB,EAA6C,MAAM,YAAY,CAAA;AAQ7F,eAAO,MAAM,uBAAuB,SAC3B,gBAAgB,KAAG,eAAe,CAAC,sBAAsB,CAiH/D,CAAA"}
@@ -1,5 +1,3 @@
1
- import { initI18n } from '@payloadcms/translations';
2
- import { translations } from '@payloadcms/translations/client';
3
1
  import { mapFields } from '@payloadcms/ui/utilities/buildComponentMap';
4
2
  import { sanitizeFields } from 'payload/config';
5
3
  import React from 'react';
@@ -8,13 +6,8 @@ import { linkFieldsSchemaPath } from './field/elements/link/shared.js';
8
6
  import { transformExtraFields } from './field/elements/link/utilities.js';
9
7
  import { uploadFieldsSchemaPath } from './field/elements/upload/shared.js';
10
8
  import { defaultLeaves as leafTypes } from './field/leaves/index.js';
11
- export const getGenerateComponentMap = (args)=>({ config })=>{
9
+ export const getGenerateComponentMap = (args)=>({ WithServerSideProps, config, i18n })=>{
12
10
  const componentMap = new Map();
13
- const i18n = initI18n({
14
- config: config.i18n,
15
- context: 'client',
16
- translations
17
- });
18
11
  const validRelationships = config.collections.map((c)=>c.slug) || [];
19
12
  (args?.admin?.leaves || Object.values(leafTypes)).forEach((leaf)=>{
20
13
  let leafObject;
@@ -61,8 +54,10 @@ export const getGenerateComponentMap = (args)=>({ config })=>{
61
54
  validRelationships
62
55
  });
63
56
  const mappedFields = mapFields({
57
+ WithServerSideProps,
64
58
  config,
65
59
  fieldSchema: linkFields,
60
+ i18n,
66
61
  readOnly: false
67
62
  });
68
63
  componentMap.set(linkFieldsSchemaPath, mappedFields);
@@ -84,8 +79,10 @@ export const getGenerateComponentMap = (args)=>({ config })=>{
84
79
  validRelationships
85
80
  });
86
81
  const mappedFields = mapFields({
82
+ WithServerSideProps,
87
83
  config,
88
84
  fieldSchema: uploadFields,
85
+ i18n,
89
86
  readOnly: false
90
87
  });
91
88
  componentMap.set(`${uploadFieldsSchemaPath}.${collection.slug}`, mappedFields);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/generateComponentMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { translations } from '@payloadcms/translations/client'\nimport { mapFields } from '@payloadcms/ui/utilities/buildComponentMap'\nimport { sanitizeFields } from 'payload/config'\nimport React from 'react'\n\nimport type { AdapterArguments, RichTextCustomElement, RichTextCustomLeaf } from './types.js'\n\nimport { elements as elementTypes } from './field/elements/index.js'\nimport { linkFieldsSchemaPath } from './field/elements/link/shared.js'\nimport { transformExtraFields } from './field/elements/link/utilities.js'\nimport { uploadFieldsSchemaPath } from './field/elements/upload/shared.js'\nimport { defaultLeaves as leafTypes } from './field/leaves/index.js'\n\nexport const getGenerateComponentMap =\n (args: AdapterArguments): RichTextAdapter['generateComponentMap'] =>\n ({ config }) => {\n const componentMap = new Map()\n\n const i18n = initI18n({ config: config.i18n, context: 'client', translations })\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n ;(args?.admin?.leaves || Object.values(leafTypes)).forEach((leaf) => {\n let leafObject: RichTextCustomLeaf\n\n if (typeof leaf === 'object' && leaf !== null) {\n leafObject = leaf\n } else if (typeof leaf === 'string' && leafTypes[leaf]) {\n leafObject = leafTypes[leaf]\n }\n\n if (leafObject) {\n const LeafButton = leafObject.Button\n const LeafComponent = leafObject.Leaf\n\n componentMap.set(`leaf.button.${leafObject.name}`, <LeafButton />)\n componentMap.set(`leaf.component.${leafObject.name}`, <LeafComponent />)\n\n if (Array.isArray(leafObject.plugins)) {\n leafObject.plugins.forEach((Plugin, i) => {\n componentMap.set(`leaf.plugin.${leafObject.name}.${i}`, <Plugin />)\n })\n }\n }\n })\n ;(args?.admin?.elements || Object.values(elementTypes)).forEach((el) => {\n let element: RichTextCustomElement\n\n if (typeof el === 'object' && el !== null) {\n element = el\n } else if (typeof el === 'string' && elementTypes[el]) {\n element = elementTypes[el]\n }\n\n if (element) {\n const ElementButton = element.Button\n const ElementComponent = element.Element\n\n if (ElementButton) componentMap.set(`element.button.${element.name}`, <ElementButton />)\n componentMap.set(`element.component.${element.name}`, <ElementComponent />)\n\n if (Array.isArray(element.plugins)) {\n element.plugins.forEach((Plugin, i) => {\n componentMap.set(`element.plugin.${element.name}.${i}`, <Plugin />)\n })\n }\n\n switch (element.name) {\n case 'link': {\n const linkFields = sanitizeFields({\n config,\n fields: transformExtraFields(args.admin?.link?.fields, config, i18n),\n validRelationships,\n })\n\n const mappedFields = mapFields({\n config,\n fieldSchema: linkFields,\n readOnly: false,\n })\n\n componentMap.set(linkFieldsSchemaPath, mappedFields)\n\n break\n }\n\n case 'upload': {\n const uploadEnabledCollections = config.collections.filter(\n ({ admin: { enableRichTextRelationship, hidden }, upload }) => {\n if (hidden === true) {\n return false\n }\n\n return enableRichTextRelationship && Boolean(upload) === true\n },\n )\n\n uploadEnabledCollections.forEach((collection) => {\n if (args?.admin?.upload?.collections[collection.slug]?.fields) {\n const uploadFields = sanitizeFields({\n config,\n fields: args?.admin?.upload?.collections[collection.slug]?.fields,\n validRelationships,\n })\n\n const mappedFields = mapFields({\n config,\n fieldSchema: uploadFields,\n readOnly: false,\n })\n\n componentMap.set(`${uploadFieldsSchemaPath}.${collection.slug}`, mappedFields)\n }\n })\n\n break\n }\n\n case 'relationship':\n break\n }\n }\n })\n\n return componentMap\n }\n"],"names":["initI18n","translations","mapFields","sanitizeFields","React","elements","elementTypes","linkFieldsSchemaPath","transformExtraFields","uploadFieldsSchemaPath","defaultLeaves","leafTypes","getGenerateComponentMap","args","config","componentMap","Map","i18n","context","validRelationships","collections","map","c","slug","admin","leaves","Object","values","forEach","leaf","leafObject","LeafButton","Button","LeafComponent","Leaf","set","name","Array","isArray","plugins","Plugin","i","el","element","ElementButton","ElementComponent","Element","linkFields","fields","link","mappedFields","fieldSchema","readOnly","uploadEnabledCollections","filter","enableRichTextRelationship","hidden","upload","Boolean","collection","uploadFields"],"mappings":"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AaoB,GAAG,CAAC5B,sBAAsB2C;4BAEvC;wBACF;oBAEA,KAAK;wBAAU;4BACb,MAAMG,2BAA2BvC,OAAOM,WAAW,CAACkC,MAAM,CACxD,CAAC,EAAE9B,OAAO,EAAE+B,0BAA0B,EAAEC,MAAM,EAAE,EAAEC,MAAM,EAAE;gCACxD,IAAID,WAAW,MAAM;oCACnB,OAAO;gCACT;gCAEA,OAAOD,8BAA8BG,QAAQD,YAAY;4BAC3D;4BAGFJ,yBAAyBzB,OAAO,CAAC,CAAC+B;gCAChC,IAAI9C,MAAMW,OAAOiC,QAAQrC,WAAW,CAACuC,WAAWpC,IAAI,CAAC,EAAEyB,QAAQ;oCAC7D,MAAMY,eAAezD,eAAe;wCAClCW;wCACAkC,QAAQnC,MAAMW,OAAOiC,QAAQrC,WAAW,CAACuC,WAAWpC,IAAI,CAAC,EAAEyB;wCAC3D7B;oCACF;oCAEA,MAAM+B,eAAehD,UAAU;wCAC7BY;wCACAqC,aAAaS;wCACbR,UAAU;oCACZ;oCAEArC,aAAaoB,GAAG,CAAC,CAAC,EAAE1B,uBAAuB,CAAC,EAAEkD,WAAWpC,IAAI,CAAC,CAAC,EAAE2B;gCACnE;4BACF;4BAEA;wBACF;oBAEA,KAAK;wBACH;gBACJ;YACF;QACF;QAEA,OAAOnC;IACT,EAAC"}
1
+ {"version":3,"sources":["../src/generateComponentMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport { mapFields } from '@payloadcms/ui/utilities/buildComponentMap'\nimport { sanitizeFields } from 'payload/config'\nimport React from 'react'\n\nimport type { AdapterArguments, RichTextCustomElement, RichTextCustomLeaf } from './types.js'\n\nimport { elements as elementTypes } from './field/elements/index.js'\nimport { linkFieldsSchemaPath } from './field/elements/link/shared.js'\nimport { transformExtraFields } from './field/elements/link/utilities.js'\nimport { uploadFieldsSchemaPath } from './field/elements/upload/shared.js'\nimport { defaultLeaves as leafTypes } from './field/leaves/index.js'\n\nexport const getGenerateComponentMap =\n (args: AdapterArguments): RichTextAdapter['generateComponentMap'] =>\n ({ WithServerSideProps, config, i18n }) => {\n const componentMap = new Map()\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n ;(args?.admin?.leaves || Object.values(leafTypes)).forEach((leaf) => {\n let leafObject: RichTextCustomLeaf\n\n if (typeof leaf === 'object' && leaf !== null) {\n leafObject = leaf\n } else if (typeof leaf === 'string' && leafTypes[leaf]) {\n leafObject = leafTypes[leaf]\n }\n\n if (leafObject) {\n const LeafButton = leafObject.Button\n const LeafComponent = leafObject.Leaf\n\n componentMap.set(`leaf.button.${leafObject.name}`, <LeafButton />)\n componentMap.set(`leaf.component.${leafObject.name}`, <LeafComponent />)\n\n if (Array.isArray(leafObject.plugins)) {\n leafObject.plugins.forEach((Plugin, i) => {\n componentMap.set(`leaf.plugin.${leafObject.name}.${i}`, <Plugin />)\n })\n }\n }\n })\n ;(args?.admin?.elements || Object.values(elementTypes)).forEach((el) => {\n let element: RichTextCustomElement\n\n if (typeof el === 'object' && el !== null) {\n element = el\n } else if (typeof el === 'string' && elementTypes[el]) {\n element = elementTypes[el]\n }\n\n if (element) {\n const ElementButton = element.Button\n const ElementComponent = element.Element\n\n if (ElementButton) componentMap.set(`element.button.${element.name}`, <ElementButton />)\n componentMap.set(`element.component.${element.name}`, <ElementComponent />)\n\n if (Array.isArray(element.plugins)) {\n element.plugins.forEach((Plugin, i) => {\n componentMap.set(`element.plugin.${element.name}.${i}`, <Plugin />)\n })\n }\n\n switch (element.name) {\n case 'link': {\n const linkFields = sanitizeFields({\n config,\n fields: transformExtraFields(args.admin?.link?.fields, config, i18n),\n validRelationships,\n })\n\n const mappedFields = mapFields({\n WithServerSideProps,\n config,\n fieldSchema: linkFields,\n i18n,\n readOnly: false,\n })\n\n componentMap.set(linkFieldsSchemaPath, mappedFields)\n\n break\n }\n\n case 'upload': {\n const uploadEnabledCollections = config.collections.filter(\n ({ admin: { enableRichTextRelationship, hidden }, upload }) => {\n if (hidden === true) {\n return false\n }\n\n return enableRichTextRelationship && Boolean(upload) === true\n },\n )\n\n uploadEnabledCollections.forEach((collection) => {\n if (args?.admin?.upload?.collections[collection.slug]?.fields) {\n const uploadFields = sanitizeFields({\n config,\n fields: args?.admin?.upload?.collections[collection.slug]?.fields,\n validRelationships,\n })\n\n const mappedFields = mapFields({\n WithServerSideProps,\n config,\n fieldSchema: uploadFields,\n i18n,\n readOnly: false,\n })\n\n componentMap.set(`${uploadFieldsSchemaPath}.${collection.slug}`, mappedFields)\n }\n })\n\n break\n }\n\n case 'relationship':\n break\n }\n }\n })\n\n return componentMap\n }\n"],"names":["mapFields","sanitizeFields","React","elements","elementTypes","linkFieldsSchemaPath","transformExtraFields","uploadFieldsSchemaPath","defaultLeaves","leafTypes","getGenerateComponentMap","args","WithServerSideProps","config","i18n","componentMap","Map","validRelationships","collections","map","c","slug","admin","leaves","Object","values","forEach","leaf","leafObject","LeafButton","Button","LeafComponent","Leaf","set","name","Array","isArray","plugins","Plugin","i","el","element","ElementButton","ElementComponent","Element","linkFields","fields","link","mappedFields","fieldSchema","readOnly","uploadEnabledCollections","filter","enableRichTextRelationship","hidden","upload","Boolean","collection","uploadFields"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,SAAS,QAAQ,6CAA4C;AACtE,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,WAAW,QAAO;AAIzB,SAASC,YAAYC,YAAY,QAAQ,4BAA2B;AACpE,SAASC,oBAAoB,QAAQ,kCAAiC;AACtE,SAASC,oBAAoB,QAAQ,qCAAoC;AACzE,SAASC,sBAAsB,QAAQ,oCAAmC;AAC1E,SAASC,iBAAiBC,SAAS,QAAQ,0BAAyB;AAEpE,OAAO,MAAMC,0BACX,CAACC,OACD,CAAC,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,IAA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,QAAQrC,WAAW,CAACuC,WAAWpC,IAAI,CAAC,EAAEyB;wCAC3D7B;oCACF;oCAEA,MAAM+B,eAAehD,UAAU;wCAC7BY;wCACAC;wCACAoC,aAAaS;wCACb5C;wCACAoC,UAAU;oCACZ;oCAEAnC,aAAakB,GAAG,CAAC,CAAC,EAAE1B,uBAAuB,CAAC,EAAEkD,WAAWpC,IAAI,CAAC,CAAC,EAAE2B;gCACnE;4BACF;4BAEA;wBACF;oBAEA,KAAK;wBACH;gBACJ;YACF;QACF;QAEA,OAAOjC;IACT,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generateSchemaMap.d.ts","sourceRoot":"","sources":["../src/generateSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAMpD,OAAO,KAAK,EAAE,gBAAgB,EAAyB,MAAM,YAAY,CAAA;AAOzE,eAAO,MAAM,oBAAoB,SACxB,gBAAgB,KAAG,eAAe,CAAC,mBAAmB,CAgE5D,CAAA"}
1
+ {"version":3,"file":"generateSchemaMap.d.ts","sourceRoot":"","sources":["../src/generateSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAIpD,OAAO,KAAK,EAAE,gBAAgB,EAAyB,MAAM,YAAY,CAAA;AAOzE,eAAO,MAAM,oBAAoB,SACxB,gBAAgB,KAAG,eAAe,CAAC,mBAAmB,CA+D5D,CAAA"}
@@ -1,16 +1,9 @@
1
- import { initI18n } from '@payloadcms/translations';
2
- import { translations } from '@payloadcms/translations/client';
3
1
  import { sanitizeFields } from 'payload/config';
4
2
  import { elements as elementTypes } from './field/elements/index.js';
5
3
  import { linkFieldsSchemaPath } from './field/elements/link/shared.js';
6
4
  import { transformExtraFields } from './field/elements/link/utilities.js';
7
5
  import { uploadFieldsSchemaPath } from './field/elements/upload/shared.js';
8
- export const getGenerateSchemaMap = (args)=>({ config, schemaMap, schemaPath })=>{
9
- const i18n = initI18n({
10
- config: config.i18n,
11
- context: 'client',
12
- translations
13
- });
6
+ export const getGenerateSchemaMap = (args)=>({ config, i18n, schemaMap, schemaPath })=>{
14
7
  const validRelationships = config.collections.map((c)=>c.slug) || [];
15
8
  (args?.admin?.elements || Object.values(elementTypes)).forEach((el)=>{
16
9
  let element;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/generateSchemaMap.ts"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport { initI18n } from '@payloadcms/translations'\nimport { translations } from '@payloadcms/translations/client'\nimport { sanitizeFields } from 'payload/config'\n\nimport type { AdapterArguments, RichTextCustomElement } from './types.js'\n\nimport { elements as elementTypes } from './field/elements/index.js'\nimport { linkFieldsSchemaPath } from './field/elements/link/shared.js'\nimport { transformExtraFields } from './field/elements/link/utilities.js'\nimport { uploadFieldsSchemaPath } from './field/elements/upload/shared.js'\n\nexport const getGenerateSchemaMap =\n (args: AdapterArguments): RichTextAdapter['generateSchemaMap'] =>\n ({ config, schemaMap, schemaPath }) => {\n const i18n = initI18n({ config: config.i18n, context: 'client', translations })\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n ;(args?.admin?.elements || Object.values(elementTypes)).forEach((el) => {\n let element: RichTextCustomElement\n\n if (typeof el === 'object' && el !== null) {\n element = el\n } else if (typeof el === 'string' && elementTypes[el]) {\n element = elementTypes[el]\n }\n\n if (element) {\n switch (element.name) {\n case 'link': {\n const linkFields = sanitizeFields({\n config,\n fields: transformExtraFields(args.admin?.link?.fields, config, i18n),\n validRelationships,\n })\n\n schemaMap.set(`${schemaPath}.${linkFieldsSchemaPath}`, linkFields)\n\n break\n }\n\n case 'upload': {\n const uploadEnabledCollections = config.collections.filter(\n ({ admin: { enableRichTextRelationship, hidden }, upload }) => {\n if (hidden === true) {\n return false\n }\n\n return enableRichTextRelationship && Boolean(upload) === true\n },\n )\n\n uploadEnabledCollections.forEach((collection) => {\n if (args?.admin?.upload?.collections[collection.slug]?.fields) {\n const uploadFields = sanitizeFields({\n config,\n fields: args?.admin?.upload?.collections[collection.slug]?.fields,\n validRelationships,\n })\n\n schemaMap.set(\n `${schemaPath}.${uploadFieldsSchemaPath}.${collection.slug}`,\n uploadFields,\n )\n }\n })\n\n break\n }\n\n case 'relationship':\n break\n }\n }\n })\n\n return schemaMap\n }\n"],"names":["initI18n","translations","sanitizeFields","elements","elementTypes","linkFieldsSchemaPath","transformExtraFields","uploadFieldsSchemaPath","getGenerateSchemaMap","args","config","schemaMap","schemaPath","i18n","context","validRelationships","collections","map","c","slug","admin","Object","values","forEach","el","element","name","linkFields","fields","link","set","uploadEnabledCollections","filter","enableRichTextRelationship","hidden","upload","Boolean","collection","uploadFields"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,2BAA0B;AACnD,SAASC,YAAY,QAAQ,kCAAiC;AAC9D,SAASC,cAAc,QAAQ,iBAAgB;AAI/C,SAASC,YAAYC,YAAY,QAAQ,4BAA2B;AACpE,SAASC,oBAAoB,QAAQ,kCAAiC;AACtE,SAASC,oBAAoB,QAAQ,qCAAoC;AACzE,SAASC,sBAAsB,QAAQ,oCAAmC;AAE1E,OAAO,MAAMC,uBACX,CAACC,OACD,CAAC,EAAEC,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAE;QAChC,MAAMC,OAAOb,SAAS;YAAEU,QAAQA,OAAOG,IAAI;YAAEC,SAAS;YAAUb;QAAa;QAC7E,MAAMc,qBAAqBL,OAAOM,WAAW,CAACC,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAK,EAAE;QAEpEV,CAAAA,MAAMW,OAAOjB,YAAYkB,OAAOC,MAAM,CAAClB,aAAY,EAAGmB,OAAO,CAAC,CAACC;YAC/D,IAAIC;YAEJ,IAAI,OAAOD,OAAO,YAAYA,OAAO,MAAM;gBACzCC,UAAUD;YACZ,OAAO,IAAI,OAAOA,OAAO,YAAYpB,YAAY,CAACoB,GAAG,EAAE;gBACrDC,UAAUrB,YAAY,CAACoB,GAAG;YAC5B;YAEA,IAAIC,SAAS;gBACX,OAAQA,QAAQC,IAAI;oBAClB,KAAK;wBAAQ;4BACX,MAAMC,aAAazB,eAAe;gCAChCQ;gCACAkB,QAAQtB,qBAAqBG,KAAKW,KAAK,EAAES,MAAMD,QAAQlB,QAAQG;gCAC/DE;4BACF;4BAEAJ,UAAUmB,GAAG,CAAC,CAAC,EAAElB,WAAW,CAAC,EAAEP,qBAAqB,CAAC,EAAEsB;4BAEvD;wBACF;oBAEA,KAAK;wBAAU;4BACb,MAAMI,2BAA2BrB,OAAOM,WAAW,CAACgB,MAAM,CACxD,CAAC,EAAEZ,OAAO,EAAEa,0BAA0B,EAAEC,MAAM,EAAE,EAAEC,MAAM,EAAE;gCACxD,IAAID,WAAW,MAAM;oCACnB,OAAO;gCACT;gCAEA,OAAOD,8BAA8BG,QAAQD,YAAY;4BAC3D;4BAGFJ,yBAAyBR,OAAO,CAAC,CAACc;gCAChC,IAAI5B,MAAMW,OAAOe,QAAQnB,WAAW,CAACqB,WAAWlB,IAAI,CAAC,EAAES,QAAQ;oCAC7D,MAAMU,eAAepC,eAAe;wCAClCQ;wCACAkB,QAAQnB,MAAMW,OAAOe,QAAQnB,WAAW,CAACqB,WAAWlB,IAAI,CAAC,EAAES;wCAC3Db;oCACF;oCAEAJ,UAAUmB,GAAG,CACX,CAAC,EAAElB,WAAW,CAAC,EAAEL,uBAAuB,CAAC,EAAE8B,WAAWlB,IAAI,CAAC,CAAC,EAC5DmB;gCAEJ;4BACF;4BAEA;wBACF;oBAEA,KAAK;wBACH;gBACJ;YACF;QACF;QAEA,OAAO3B;IACT,EAAC"}
1
+ {"version":3,"sources":["../src/generateSchemaMap.ts"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport { sanitizeFields } from 'payload/config'\n\nimport type { AdapterArguments, RichTextCustomElement } from './types.js'\n\nimport { elements as elementTypes } from './field/elements/index.js'\nimport { linkFieldsSchemaPath } from './field/elements/link/shared.js'\nimport { transformExtraFields } from './field/elements/link/utilities.js'\nimport { uploadFieldsSchemaPath } from './field/elements/upload/shared.js'\n\nexport const getGenerateSchemaMap =\n (args: AdapterArguments): RichTextAdapter['generateSchemaMap'] =>\n ({ config, i18n, schemaMap, schemaPath }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n ;(args?.admin?.elements || Object.values(elementTypes)).forEach((el) => {\n let element: RichTextCustomElement\n\n if (typeof el === 'object' && el !== null) {\n element = el\n } else if (typeof el === 'string' && elementTypes[el]) {\n element = elementTypes[el]\n }\n\n if (element) {\n switch (element.name) {\n case 'link': {\n const linkFields = sanitizeFields({\n config,\n fields: transformExtraFields(args.admin?.link?.fields, config, i18n),\n validRelationships,\n })\n\n schemaMap.set(`${schemaPath}.${linkFieldsSchemaPath}`, linkFields)\n\n break\n }\n\n case 'upload': {\n const uploadEnabledCollections = config.collections.filter(\n ({ admin: { enableRichTextRelationship, hidden }, upload }) => {\n if (hidden === true) {\n return false\n }\n\n return enableRichTextRelationship && Boolean(upload) === true\n },\n )\n\n uploadEnabledCollections.forEach((collection) => {\n if (args?.admin?.upload?.collections[collection.slug]?.fields) {\n const uploadFields = sanitizeFields({\n config,\n fields: args?.admin?.upload?.collections[collection.slug]?.fields,\n validRelationships,\n })\n\n schemaMap.set(\n `${schemaPath}.${uploadFieldsSchemaPath}.${collection.slug}`,\n uploadFields,\n )\n }\n })\n\n break\n }\n\n case 'relationship':\n break\n }\n }\n })\n\n return schemaMap\n }\n"],"names":["sanitizeFields","elements","elementTypes","linkFieldsSchemaPath","transformExtraFields","uploadFieldsSchemaPath","getGenerateSchemaMap","args","config","i18n","schemaMap","schemaPath","validRelationships","collections","map","c","slug","admin","Object","values","forEach","el","element","name","linkFields","fields","link","set","uploadEnabledCollections","filter","enableRichTextRelationship","hidden","upload","Boolean","collection","uploadFields"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,cAAc,QAAQ,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nB,WAAW,CAACqB,WAAWlB,IAAI,CAAC,EAAES,QAAQ;oCAC7D,MAAMU,eAAenC,eAAe;wCAClCQ;wCACAiB,QAAQlB,MAAMU,OAAOe,QAAQnB,WAAW,CAACqB,WAAWlB,IAAI,CAAC,EAAES;wCAC3Db;oCACF;oCAEAF,UAAUiB,GAAG,CACX,CAAC,EAAEhB,WAAW,CAAC,EAAEN,uBAAuB,CAAC,EAAE6B,WAAWlB,IAAI,CAAC,CAAC,EAC5DmB;gCAEJ;4BACF;4BAEA;wBACF;oBAEA,KAAK;wBACH;gBACJ;YACF;QACF;QAEA,OAAOzB;IACT,EAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport { withNullableJSONSchemaType } from 'payload/utilities'\n\nimport type { AdapterArguments } from './types.js'\n\nimport { RichTextCell } from './cell/index.js'\nimport { richTextRelationshipPromise } from './data/richTextRelationshipPromise.js'\nimport { richTextValidate } from './data/validation.js'\nimport { RichTextField } from './field/index.js'\nimport { getGenerateComponentMap } from './generateComponentMap.js'\nimport { getGenerateSchemaMap } from './generateSchemaMap.js'\n\nexport function slateEditor(args: AdapterArguments): RichTextAdapter<any[], AdapterArguments, any> {\n return {\n CellComponent: RichTextCell,\n FieldComponent: RichTextField,\n generateComponentMap: getGenerateComponentMap(args),\n generateSchemaMap: getGenerateSchemaMap(args),\n outputSchema: ({ isRequired }) => {\n return {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n type: 'object',\n },\n }\n },\n populationPromise({\n context,\n currentDepth,\n depth,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n if (\n field.admin?.elements?.includes('relationship') ||\n field.admin?.elements?.includes('upload') ||\n field.admin?.elements?.includes('link') ||\n !field?.admin?.elements\n ) {\n return richTextRelationshipPromise({\n context,\n currentDepth,\n depth,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n return null\n },\n validate: richTextValidate,\n }\n}\n\nexport { ElementButton } from './field/elements/Button.js'\n\nexport { toggleElement } from './field/elements/toggle.js'\nexport { LeafButton } from './field/leaves/Button.js'\nexport type {\n AdapterArguments,\n ElementNode,\n FieldProps,\n RichTextCustomElement,\n RichTextCustomLeaf,\n RichTextElement,\n RichTextLeaf,\n TextNode,\n} from './types.js'\n\nexport { nodeIsTextNode } from './types.js'\n"],"names":["withNullableJSONSchemaType","RichTextCell","richTextRelationshipPromise","richTextValidate","RichTextField","getGenerateComponentMap","getGenerateSchemaMap","slateEditor","args","CellComponent","FieldComponent","generateComponentMap","generateSchemaMap","outputSchema","isRequired","type","items","populationPromise","context","currentDepth","depth","field","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","admin","elements","includes","validate","ElementButton","toggleElement","LeafButton","nodeIsTextNode"],"mappings":"AAEA,SAASA,0BAA0B,QAAQ,oBAAmB;AAI9D,SAASC,YAAY,QAAQ,kBAAiB;AAC9C,SAASC,2BAA2B,QAAQ,wCAAuC;AACnF,SAASC,gBAAgB,QAAQ,uBAAsB;AACvD,SAASC,aAAa,QAAQ,mBAAkB;AAChD,SAASC,uBAAuB,QAAQ,4BAA2B;AACnE,SAASC,oBAAoB,QAAQ,yBAAwB;AAE7D,OAAO,SAASC,YAAYC,IAAsB;IAChD,OAAO;QACLC,eAAeR;QACfS,gBAAgBN;QAChBO,sBAAsBN,wBAAwBG;QAC9CI,mBAAmBN,qBAAqBE;QACxCK,cAAc,CAAC,EAAEC,UAAU,EAAE;YAC3B,OAAO;gBACLC,MAAMf,2BAA2B,SAASc;gBAC1CE,OAAO;oBACLD,MAAM;gBACR;YACF;QACF;QACAE,mBAAkB,EAChBC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,QAAQ,EACRC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACX;YACC,IACEP,MAAMQ,KAAK,EAAEC,UAAUC,SAAS,mBAChCV,MAAMQ,KAAK,EAAEC,UAAUC,SAAS,aAChCV,MAAMQ,KAAK,EAAEC,UAAUC,SAAS,WAChC,CAACV,OAAOQ,OAAOC,UACf;gBACA,OAAO5B,4BAA4B;oBACjCgB;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;gBACF;YACF;YACA,OAAO;QACT;QACAI,UAAU7B;IACZ;AACF;AAEA,SAAS8B,aAAa,QAAQ,6BAA4B;AAE1D,SAASC,aAAa,QAAQ,6BAA4B;AAC1D,SAASC,UAAU,QAAQ,2BAA0B;AAYrD,SAASC,cAAc,QAAQ,aAAY"}
1
+ {"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport { withNullableJSONSchemaType } from 'payload/utilities'\n\nimport type { AdapterArguments } from './types.js'\n\nimport { RichTextCell } from './cell/index.js'\nimport { richTextRelationshipPromise } from './data/richTextRelationshipPromise.js'\nimport { richTextValidate } from './data/validation.js'\nimport { RichTextField } from './field/index.js'\nimport { getGenerateComponentMap } from './generateComponentMap.js'\nimport { getGenerateSchemaMap } from './generateSchemaMap.js'\n\nexport function slateEditor(args: AdapterArguments): RichTextAdapter<any[], AdapterArguments, any> {\n return {\n CellComponent: RichTextCell,\n FieldComponent: RichTextField,\n generateComponentMap: getGenerateComponentMap(args),\n generateSchemaMap: getGenerateSchemaMap(args),\n outputSchema: ({ isRequired }) => {\n return {\n type: withNullableJSONSchemaType('array', isRequired),\n items: {\n type: 'object',\n },\n }\n },\n populationPromise({\n context,\n currentDepth,\n depth,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }) {\n if (\n field.admin?.elements?.includes('relationship') ||\n field.admin?.elements?.includes('upload') ||\n field.admin?.elements?.includes('link') ||\n !field?.admin?.elements\n ) {\n return richTextRelationshipPromise({\n context,\n currentDepth,\n depth,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n return null\n },\n validate: richTextValidate,\n }\n}\n\nexport { ElementButton } from './field/elements/Button.js'\n\nexport { toggleElement } from './field/elements/toggle.js'\nexport { LeafButton } from './field/leaves/Button.js'\nexport type {\n AdapterArguments,\n ElementNode,\n FieldProps,\n RichTextCustomElement,\n RichTextCustomLeaf,\n RichTextElement,\n RichTextLeaf,\n TextNode,\n} from './types.js'\n\nexport { nodeIsTextNode } from './types.js'\n"],"names":["withNullableJSONSchemaType","RichTextCell","richTextRelationshipPromise","richTextValidate","RichTextField","getGenerateComponentMap","getGenerateSchemaMap","slateEditor","args","CellComponent","FieldComponent","generateComponentMap","generateSchemaMap","outputSchema","isRequired","type","items","populationPromise","context","currentDepth","depth","field","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","admin","elements","includes","validate","ElementButton","toggleElement","LeafButton","nodeIsTextNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,0BAA0B,QAAQ,oBAAmB;AAI9D,SAASC,YAAY,QAAQ,kBAAiB;AAC9C,SAASC,2BAA2B,QAAQ,wCAAuC;AACnF,SAASC,gBAAgB,QAAQ,uBAAsB;AACvD,SAASC,aAAa,QAAQ,mBAAkB;AAChD,SAASC,uBAAuB,QAAQ,4BAA2B;AACnE,SAASC,oBAAoB,QAAQ,yBAAwB;AAE7D,OAAO,SAASC,YAAYC,IAAsB;IAChD,OAAO;QACLC,eAAeR;QACfS,gBAAgBN;QAChBO,sBAAsBN,wBAAwBG;QAC9CI,mBAAmBN,qBAAqBE;QACxCK,cAAc,CAAC,EAAEC,UAAU,EAAE;YAC3B,OAAO;gBACLC,MAAMf,2BAA2B,SAASc;gBAC1CE,OAAO;oBACLD,MAAM;gBACR;YACF;QACF;QACAE,mBAAkB,EAChBC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,KAAK,EACLC,QAAQ,EACRC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACX;YACC,IACEP,MAAMQ,KAAK,EAAEC,UAAUC,SAAS,mBAChCV,MAAMQ,KAAK,EAAEC,UAAUC,SAAS,aAChCV,MAAMQ,KAAK,EAAEC,UAAUC,SAAS,WAChC,CAACV,OAAOQ,OAAOC,UACf;gBACA,OAAO5B,4BAA4B;oBACjCgB;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;gBACF;YACF;YACA,OAAO;QACT;QACAI,UAAU7B;IACZ;AACF;AAEA,SAAS8B,aAAa,QAAQ,6BAA4B;AAE1D,SAASC,aAAa,QAAQ,6BAA4B;AAC1D,SAASC,UAAU,QAAQ,2BAA0B;AAYrD,SAASC,cAAc,QAAQ,aAAY"}
@@ -1,4 +1,3 @@
1
- @import 'fonts';
2
1
  @import 'styles';
3
2
  @import './toastify.scss';
4
3
  @import './colors.scss';
@@ -20,9 +19,9 @@
20
19
  --theme-overlay: rgba(5, 5, 5, 0.5);
21
20
  --theme-baseline: #{$baseline-px};
22
21
  --theme-baseline-body-size: #{$baseline-body-size};
23
- --font-body: 'Suisse Intl', system-ui;
22
+ --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
23
+ sans-serif;
24
24
  --font-mono: monospace;
25
- --font-serif: 'Merriweather', serif;
26
25
 
27
26
  --style-radius-s: #{$style-radius-s};
28
27
  --style-radius-m: #{$style-radius-m};
@@ -21,13 +21,6 @@ $baseline: math.div($baseline-px, $baseline-body-size) + rem;
21
21
  @return (math.div($baseline-px, $baseline-body-size) * $multiplier) + rem;
22
22
  }
23
23
 
24
- //////////////////////////////
25
- // FONTS (DEPRECATED. DO NOT USE. PREFER CSS VARIABLES)
26
- //////////////////////////////
27
-
28
- $font-body: 'Suisse Intl' !default;
29
- $font-mono: monospace !default;
30
-
31
24
  //////////////////////////////
32
25
  // COLORS (DEPRECATED. DO NOT USE. PREFER CSS VARIABLES)
33
26
  //////////////////////////////
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { Field, RichTextFieldProps } from 'payload/types'\nimport type { Editor } from 'slate'\n\nexport type TextNode = { [x: string]: unknown; text: string }\n\nexport type ElementNode = { children: (ElementNode | TextNode)[]; type?: string }\n\nexport function nodeIsTextNode(node: ElementNode | TextNode): node is TextNode {\n return 'text' in node\n}\n\nexport type RichTextPluginComponent = React.ComponentType\nexport type RichTextPlugin = (editor: Editor) => Editor\n\nexport type RichTextCustomElement = {\n Button?: React.ComponentType<any>\n Element: React.ComponentType<any>\n name: string\n plugins?: RichTextPluginComponent[]\n}\n\nexport type RichTextCustomLeaf = {\n Button: React.ComponentType<any>\n Leaf: React.ComponentType<any>\n name: string\n plugins?: RichTextPluginComponent[]\n}\n\nexport type RichTextElement =\n | 'blockquote'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'indent'\n | 'link'\n | 'ol'\n | 'relationship'\n | 'textAlign'\n | 'ul'\n | 'upload'\n | RichTextCustomElement\nexport type RichTextLeaf =\n | 'bold'\n | 'code'\n | 'italic'\n | 'strikethrough'\n | 'underline'\n | RichTextCustomLeaf\n\nexport type AdapterArguments = {\n admin?: {\n elements?: RichTextElement[]\n hideGutter?: boolean\n leaves?: RichTextLeaf[]\n link?: {\n fields?:\n | ((args: { config: SanitizedConfig; defaultFields: Field[]; i18n: I18n }) => Field[])\n | Field[]\n }\n placeholder?: Record<string, string> | string\n rtl?: boolean\n upload?: {\n collections: {\n [collection: string]: {\n fields: Field[]\n }\n }\n }\n }\n}\n\nexport type FieldProps = RichTextFieldProps<any[], AdapterArguments, AdapterArguments>\n"],"names":["nodeIsTextNode","node"],"mappings":"AASA,OAAO,SAASA,eAAeC,IAA4B;IACzD,OAAO,UAAUA;AACnB"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { Field, RichTextFieldProps } from 'payload/types'\nimport type { Editor } from 'slate'\n\nexport type TextNode = { [x: string]: unknown; text: string }\n\nexport type ElementNode = { children: (ElementNode | TextNode)[]; type?: string }\n\nexport function nodeIsTextNode(node: ElementNode | TextNode): node is TextNode {\n return 'text' in node\n}\n\nexport type RichTextPluginComponent = React.ComponentType\nexport type RichTextPlugin = (editor: Editor) => Editor\n\nexport type RichTextCustomElement = {\n Button?: React.ComponentType<any>\n Element: React.ComponentType<any>\n name: string\n plugins?: RichTextPluginComponent[]\n}\n\nexport type RichTextCustomLeaf = {\n Button: React.ComponentType<any>\n Leaf: React.ComponentType<any>\n name: string\n plugins?: RichTextPluginComponent[]\n}\n\nexport type RichTextElement =\n | 'blockquote'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'indent'\n | 'link'\n | 'ol'\n | 'relationship'\n | 'textAlign'\n | 'ul'\n | 'upload'\n | RichTextCustomElement\nexport type RichTextLeaf =\n | 'bold'\n | 'code'\n | 'italic'\n | 'strikethrough'\n | 'underline'\n | RichTextCustomLeaf\n\nexport type AdapterArguments = {\n admin?: {\n elements?: RichTextElement[]\n hideGutter?: boolean\n leaves?: RichTextLeaf[]\n link?: {\n fields?:\n | ((args: { config: SanitizedConfig; defaultFields: Field[]; i18n: I18n }) => Field[])\n | Field[]\n }\n placeholder?: Record<string, string> | string\n rtl?: boolean\n upload?: {\n collections: {\n [collection: string]: {\n fields: Field[]\n }\n }\n }\n }\n}\n\nexport type FieldProps = RichTextFieldProps<any[], AdapterArguments, AdapterArguments>\n"],"names":["nodeIsTextNode","node"],"rangeMappings":";;","mappings":"AASA,OAAO,SAASA,eAAeC,IAA4B;IACzD,OAAO,UAAUA;AACnB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/useSlatePlugin.tsx"],"sourcesContent":["import type { Editor } from 'slate'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useAddClientFunction } from '@payloadcms/ui/providers/ClientFunction'\n\ntype Plugin = (editor: Editor) => Editor\n\nexport const useSlatePlugin = (key: string, plugin: Plugin) => {\n const { schemaPath } = useFieldProps()\n\n useAddClientFunction(`slatePlugin.${schemaPath}.${key}`, plugin)\n}\n"],"names":["useFieldProps","useAddClientFunction","useSlatePlugin","key","plugin","schemaPath"],"mappings":"AAEA,SAASA,aAAa,QAAQ,0CAAyC;AACvE,SAASC,oBAAoB,QAAQ,0CAAyC;AAI9E,OAAO,MAAMC,iBAAiB,CAACC,KAAaC;IAC1C,MAAM,EAAEC,UAAU,EAAE,GAAGL;IAEvBC,qBAAqB,CAAC,YAAY,EAAEI,WAAW,CAAC,EAAEF,IAAI,CAAC,EAAEC;AAC3D,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/useSlatePlugin.tsx"],"sourcesContent":["import type { Editor } from 'slate'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useAddClientFunction } from '@payloadcms/ui/providers/ClientFunction'\n\ntype Plugin = (editor: Editor) => Editor\n\nexport const useSlatePlugin = (key: string, plugin: Plugin) => {\n const { schemaPath } = useFieldProps()\n\n useAddClientFunction(`slatePlugin.${schemaPath}.${key}`, plugin)\n}\n"],"names":["useFieldProps","useAddClientFunction","useSlatePlugin","key","plugin","schemaPath"],"rangeMappings":";;;;;","mappings":"AAEA,SAASA,aAAa,QAAQ,0CAAyC;AACvE,SAASC,oBAAoB,QAAQ,0CAAyC;AAI9E,OAAO,MAAMC,iBAAiB,CAACC,KAAaC;IAC1C,MAAM,EAAEC,UAAU,EAAE,GAAGL;IAEvBC,qBAAqB,CAAC,YAAY,EAAEI,WAAW,CAAC,EAAEF,IAAI,CAAC,EAAEC;AAC3D,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-slate",
3
- "version": "3.0.0-alpha.60",
3
+ "version": "3.0.0-alpha.62",
4
4
  "description": "The officially supported Slate richtext adapter for Payload",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,21 +25,27 @@
25
25
  "devDependencies": {
26
26
  "@types/node": "20.12.5",
27
27
  "@types/react": "18.2.74",
28
- "@payloadcms/ui": "3.0.0-alpha.60",
29
- "payload": "3.0.0-alpha.60",
30
- "@payloadcms/eslint-config": "1.1.1"
28
+ "@payloadcms/eslint-config": "1.1.1",
29
+ "payload": "3.0.0-alpha.62",
30
+ "@payloadcms/ui": "3.0.0-alpha.62"
31
31
  },
32
32
  "peerDependencies": {
33
- "payload": "3.0.0-alpha.60",
34
- "@payloadcms/ui": "3.0.0-alpha.60",
35
- "@payloadcms/translations": "3.0.0-alpha.60"
33
+ "@payloadcms/translations": "3.0.0-alpha.62",
34
+ "@payloadcms/ui": "3.0.0-alpha.62",
35
+ "payload": "3.0.0-alpha.62"
36
+ },
37
+ "exports": {
38
+ ".": {
39
+ "import": "./dist/index.js",
40
+ "require": "./dist/index.js",
41
+ "types": "./dist/index.d.ts"
42
+ }
36
43
  },
37
- "exports": null,
38
44
  "publishConfig": {
39
45
  "registry": "https://registry.npmjs.org/"
40
46
  },
41
47
  "engines": {
42
- "node": ">=18.17.0"
48
+ "node": ">=18.20.2"
43
49
  },
44
50
  "files": [
45
51
  "dist"
@@ -1,75 +0,0 @@
1
- @font-face {
2
- font-family: 'Suisse Intl';
3
- src:
4
- url('../assets/fonts/SuisseIntl.woff2') format('woff2'),
5
- url('../assets/fonts/SuisseIntl.woff') format('woff');
6
- font-weight: normal;
7
- font-style: normal;
8
- }
9
-
10
- @font-face {
11
- font-family: 'Suisse Intl';
12
- src:
13
- url('../assets/fonts/SuisseIntl-Medium.woff2') format('woff2'),
14
- url('../assets/fonts/SuisseIntl-Medium.woff') format('woff');
15
- font-weight: 500;
16
- font-style: normal;
17
- }
18
-
19
- @font-face {
20
- font-family: 'Suisse Intl';
21
- src:
22
- url('../assets/fonts/SuisseIntl-SemiBold.woff2') format('woff2'),
23
- url('../assets/fonts/SuisseIntl-SemiBold.woff') format('woff');
24
- font-weight: 600;
25
- font-style: normal;
26
- }
27
-
28
- @font-face {
29
- font-family: 'Suisse Intl';
30
- src:
31
- url('../assets/fonts/SuisseIntl-Bold.woff2') format('woff2'),
32
- url('../assets/fonts/SuisseIntl-Bold.woff') format('woff');
33
- font-weight: bold;
34
- font-style: normal;
35
- }
36
-
37
- @font-face {
38
- font-family: 'Merriweather';
39
- font-style: normal;
40
- font-weight: 400;
41
- src:
42
- local(''),
43
- url('../assets/fonts/merriweather-v30-latin-regular.woff2') format('woff2'),
44
- url('../assets/fonts/merriweather-v30-latin-regular.woff') format('woff');
45
- }
46
-
47
- @font-face {
48
- font-family: 'Merriweather';
49
- font-style: italic;
50
- font-weight: 400;
51
- src:
52
- local(''),
53
- url('../assets/fonts/merriweather-v30-latin-italic.woff2') format('woff2'),
54
- url('../assets/fonts/merriweather-v30-latin-italic.woff') format('woff');
55
- }
56
-
57
- @font-face {
58
- font-family: 'Merriweather';
59
- font-style: normal;
60
- font-weight: 900;
61
- src:
62
- local(''),
63
- url('../assets/fonts/merriweather-v30-latin-900.woff2') format('woff2'),
64
- url('../assets/fonts/merriweather-v30-latin-900.woff') format('woff');
65
- }
66
-
67
- @font-face {
68
- font-family: 'Merriweather';
69
- font-style: italic;
70
- font-weight: 900;
71
- src:
72
- local(''),
73
- url('../assets/fonts/merriweather-v30-latin-900italic.woff2') format('woff2'),
74
- url('../assets/fonts/merriweather-v30-latin-900italic.woff') format('woff');
75
- }