@onereach/ui-components 4.1.0-beta.2511.0 → 4.1.0

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 (285) hide show
  1. package/dist/bundled/v2/components/OrBottomSheetV3/OrBottomSheet.js +8 -1
  2. package/dist/bundled/v2/components/OrButtonV3/styles.js +3 -1
  3. package/dist/bundled/v2/components/OrCode/OrCode.js +3727 -5
  4. package/dist/bundled/v2/components/OrCode/index.js +2 -5
  5. package/dist/bundled/v2/components/OrCode/lang.js +3 -3897
  6. package/dist/bundled/v2/components/OrCode/theme.js +1 -2
  7. package/dist/bundled/v2/components/OrPopoverV3/OrPopover.js +8 -1
  8. package/dist/bundled/v2/components/index.d.ts +0 -1
  9. package/dist/bundled/v2/components/index.js +2 -14
  10. package/dist/bundled/v2/hooks/useElevation.js +3 -3
  11. package/dist/bundled/v2/{index-f5487f12.js → index-6976c52a.js} +115 -3
  12. package/dist/bundled/v2/index.js +5 -17
  13. package/dist/bundled/v2/{index-70ca38c5.js → lang-02d2bb2d.js} +3965 -73
  14. package/dist/bundled/v2/utils/isVisible.js +1 -1
  15. package/dist/bundled/v3/{OrBottomSheet.vue_vue_type_script_lang-1489a97d.js → OrBottomSheet.vue_vue_type_script_lang-01d7c429.js} +9 -2
  16. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-606eede5.js → OrCardCollection.vue_vue_type_script_lang-843e396a.js} +4 -4
  17. package/dist/bundled/v3/{index-16aee5bc.js → OrCode.vue_vue_type_script_lang-c5a9adb7.js} +234 -14
  18. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-7d9bcdc4.js → OrConfirm.vue_vue_type_script_lang-d069c95f.js} +3 -3
  19. package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-42a8285c.js → OrIconButton.vue_vue_type_script_lang-41f12b45.js} +1 -1
  20. package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-6b0f4112.js → OrInlineInput.vue_vue_type_script_lang-2b485aef.js} +1 -1
  21. package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-6a7a22a3.js → OrInlineTextarea.vue_vue_type_script_lang-aa848373.js} +1 -1
  22. package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-60b49ebd.js → OrInput.vue_vue_type_script_lang-fe526531.js} +1 -1
  23. package/dist/bundled/v3/{OrMenu.vue_vue_type_script_lang-2676b9cc.js → OrMenu.vue_vue_type_script_lang-4772731e.js} +1 -1
  24. package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-9ed0d5c2.js → OrModal.vue_vue_type_script_lang-265f39e0.js} +2 -2
  25. package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-9bd9811a.js → OrNotification.vue_vue_type_script_lang-1b2d17a2.js} +1 -1
  26. package/dist/bundled/v3/{OrPagination.vue_vue_type_script_lang-b08cc71a.js → OrPagination.vue_vue_type_script_lang-ddef5272.js} +2 -2
  27. package/dist/bundled/v3/{OrPopover.vue_vue_type_script_lang-a9419b58.js → OrPopover.vue_vue_type_script_lang-9d3a7c2d.js} +9 -2
  28. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-3613e38d.js → OrSearch.vue_vue_type_script_lang-36ad17a9.js} +1 -1
  29. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-262351de.js → OrSelect.vue_vue_type_script_lang-410f4efc.js} +3 -3
  30. package/dist/bundled/v3/{OrSidebar.vue_vue_type_script_lang-198126ca.js → OrSidebar.vue_vue_type_script_lang-ed7c92fb.js} +1 -1
  31. package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-b723fa78.js → OrTabs.vue_vue_type_script_lang-4f5e0d90.js} +1 -1
  32. package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-9deddfc8.js → OrTag.vue_vue_type_script_lang-fbc19deb.js} +1 -1
  33. package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-703eaacb.js → OrTooltip.vue_vue_type_script_lang-b35199da.js} +1 -1
  34. package/dist/bundled/v3/components/OrBottomSheetV3/OrBottomSheet.js +3 -3
  35. package/dist/bundled/v3/components/OrBottomSheetV3/index.js +2 -2
  36. package/dist/bundled/v3/components/OrButtonV3/OrButton.js +2 -2
  37. package/dist/bundled/v3/components/OrButtonV3/index.js +1 -1
  38. package/dist/bundled/v3/components/OrButtonV3/styles.js +3 -1
  39. package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +11 -11
  40. package/dist/bundled/v3/components/OrCardCollectionV3/index.js +10 -10
  41. package/dist/bundled/v3/components/OrCode/OrCode.js +5 -8
  42. package/dist/bundled/v3/components/OrCode/index.js +3 -6
  43. package/dist/bundled/v3/components/OrCode/lang.js +3 -3897
  44. package/dist/bundled/v3/components/OrCode/theme.js +1 -2
  45. package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +9 -9
  46. package/dist/bundled/v3/components/OrConfirmV3/index.js +8 -8
  47. package/dist/bundled/v3/components/OrIconButtonV3/OrIconButton.js +6 -6
  48. package/dist/bundled/v3/components/OrIconButtonV3/index.js +5 -5
  49. package/dist/bundled/v3/components/OrInlineInputV3/OrInlineInput.js +7 -7
  50. package/dist/bundled/v3/components/OrInlineInputV3/index.js +6 -6
  51. package/dist/bundled/v3/components/OrInlineTextareaV3/OrInlineTextarea.js +7 -7
  52. package/dist/bundled/v3/components/OrInlineTextareaV3/index.js +6 -6
  53. package/dist/bundled/v3/components/OrInputV3/OrInput.js +7 -7
  54. package/dist/bundled/v3/components/OrInputV3/index.js +6 -6
  55. package/dist/bundled/v3/components/OrMenuV3/OrMenu.js +5 -5
  56. package/dist/bundled/v3/components/OrMenuV3/index.js +4 -4
  57. package/dist/bundled/v3/components/OrModalV3/OrModal.js +7 -7
  58. package/dist/bundled/v3/components/OrModalV3/index.js +6 -6
  59. package/dist/bundled/v3/components/OrNotificationV3/OrNotification.js +7 -7
  60. package/dist/bundled/v3/components/OrNotificationV3/index.js +6 -6
  61. package/dist/bundled/v3/components/OrOverlayV3/OrOverlay.js +2 -2
  62. package/dist/bundled/v3/components/OrOverlayV3/index.js +1 -1
  63. package/dist/bundled/v3/components/OrPaginationV3/OrPagination.js +7 -7
  64. package/dist/bundled/v3/components/OrPaginationV3/index.js +6 -6
  65. package/dist/bundled/v3/components/OrPopoverV3/OrPopover.js +4 -4
  66. package/dist/bundled/v3/components/OrPopoverV3/index.js +3 -3
  67. package/dist/bundled/v3/components/OrSearchV3/OrSearch.js +8 -8
  68. package/dist/bundled/v3/components/OrSearchV3/index.js +7 -7
  69. package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +9 -9
  70. package/dist/bundled/v3/components/OrSelectV3/index.js +8 -8
  71. package/dist/bundled/v3/components/OrSidebarV3/OrSidebar.js +7 -7
  72. package/dist/bundled/v3/components/OrSidebarV3/index.js +6 -6
  73. package/dist/bundled/v3/components/OrTabsV3/OrTabs.js +6 -6
  74. package/dist/bundled/v3/components/OrTabsV3/index.js +5 -5
  75. package/dist/bundled/v3/components/OrTagV3/OrTag.js +7 -7
  76. package/dist/bundled/v3/components/OrTagV3/index.js +6 -6
  77. package/dist/bundled/v3/components/OrToastContainerV3/OrToastContainer.js +7 -7
  78. package/dist/bundled/v3/components/OrToastContainerV3/index.js +6 -6
  79. package/dist/bundled/v3/components/OrToastV3/OrToast.js +5 -5
  80. package/dist/bundled/v3/components/OrToastV3/index.js +6 -6
  81. package/dist/bundled/v3/components/OrTooltipV3/OrTooltip.js +5 -5
  82. package/dist/bundled/v3/components/OrTooltipV3/index.js +4 -4
  83. package/dist/bundled/v3/components/index.d.ts +0 -1
  84. package/dist/bundled/v3/components/index.js +24 -37
  85. package/dist/bundled/v3/hooks/useElevation.js +3 -3
  86. package/dist/bundled/v3/{index-f5487f12.js → index-6976c52a.js} +115 -3
  87. package/dist/bundled/v3/index.js +27 -40
  88. package/dist/bundled/v3/{index-70ca38c5.js → lang-02d2bb2d.js} +3965 -73
  89. package/dist/bundled/v3/utils/isVisible.js +1 -1
  90. package/dist/esm/v2/{OrBottomSheet-29df8db9.js → OrBottomSheet-2d3d8fbc.js} +9 -2
  91. package/dist/esm/v2/{OrButton-236d9c2e.js → OrButton-6b60a776.js} +3 -1
  92. package/dist/esm/v2/{OrCardCollection-97167234.js → OrCardCollection-6b43a9b2.js} +5 -5
  93. package/dist/esm/v2/{OrConfirm-cd41987e.js → OrConfirm-92e39afe.js} +3 -3
  94. package/dist/esm/v2/{OrIconButton-a9db16fa.js → OrIconButton-fbe52eb8.js} +2 -2
  95. package/dist/esm/v2/{OrInlineInput-79c86e6a.js → OrInlineInput-50bf7e7c.js} +1 -1
  96. package/dist/esm/v2/{OrInlineTextarea-3e24548d.js → OrInlineTextarea-78b8aa48.js} +1 -1
  97. package/dist/esm/v2/{OrInput-044a9c85.js → OrInput-6370bd94.js} +1 -1
  98. package/dist/esm/v2/{OrMenu-47b319a6.js → OrMenu-fce31ed4.js} +1 -1
  99. package/dist/esm/v2/{OrModal-fa99b102.js → OrModal-77d6cf30.js} +2 -2
  100. package/dist/esm/v2/{OrNotification-6411c891.js → OrNotification-2b2d81d5.js} +1 -1
  101. package/dist/esm/v2/{OrOverlay-2ce3cfd7.js → OrOverlay-b1609eef.js} +1 -1
  102. package/dist/esm/v2/{OrPagination-28ad44a3.js → OrPagination-ad0e1d23.js} +3 -3
  103. package/dist/esm/v2/{OrPopover-83c885d0.js → OrPopover-9df5572b.js} +10 -3
  104. package/dist/esm/v2/{OrSearch-83631294.js → OrSearch-a3038272.js} +1 -1
  105. package/dist/esm/v2/{OrSelect-affebf55.js → OrSelect-209a7a2c.js} +3 -3
  106. package/dist/esm/v2/{OrSidebar-9834d431.js → OrSidebar-26785a1e.js} +1 -1
  107. package/dist/esm/v2/{OrSidebarCollapseButton-3275b9dd.js → OrSidebarCollapseButton-9c424133.js} +1 -1
  108. package/dist/esm/v2/{OrTabs-f0e4db08.js → OrTabs-58881ef9.js} +2 -2
  109. package/dist/esm/v2/{OrTag-ca297170.js → OrTag-e9761c21.js} +1 -1
  110. package/dist/esm/v2/{OrTooltip-2c09dcaf.js → OrTooltip-82c59279.js} +1 -1
  111. package/dist/esm/v2/components/index.d.ts +0 -1
  112. package/dist/esm/v2/components/index.js +23 -47
  113. package/dist/esm/v2/components/or-bottom-sheet-v3/index.js +3 -3
  114. package/dist/esm/v2/components/or-button-v3/index.js +1 -1
  115. package/dist/esm/v2/components/or-card-collection-v3/index.js +11 -11
  116. package/dist/esm/v2/components/or-confirm-v3/index.js +9 -9
  117. package/dist/esm/v2/components/or-icon-button-v3/index.js +6 -6
  118. package/dist/esm/v2/components/or-inline-input-v3/index.js +7 -7
  119. package/dist/esm/v2/components/or-inline-textarea-v3/index.js +7 -7
  120. package/dist/esm/v2/components/or-input-v3/index.js +7 -7
  121. package/dist/esm/v2/components/or-menu-v3/index.js +5 -5
  122. package/dist/esm/v2/components/or-modal-v3/index.js +7 -7
  123. package/dist/esm/v2/components/or-notification-v3/index.js +7 -7
  124. package/dist/esm/v2/components/or-overlay-v3/index.js +2 -2
  125. package/dist/esm/v2/components/or-pagination-v3/index.js +7 -7
  126. package/dist/esm/v2/components/or-popover-v3/index.js +4 -4
  127. package/dist/esm/v2/components/or-search-v3/index.js +8 -8
  128. package/dist/esm/v2/components/or-select-v3/index.js +9 -9
  129. package/dist/esm/v2/components/or-sidebar-v3/index.js +8 -8
  130. package/dist/esm/v2/components/or-sidebar-v3/partials/index.js +7 -7
  131. package/dist/esm/v2/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +7 -7
  132. package/dist/esm/v2/components/or-tabs-v3/index.js +6 -6
  133. package/dist/esm/v2/components/or-tag-v3/index.js +7 -7
  134. package/dist/esm/v2/components/or-toast-v3/index.js +7 -7
  135. package/dist/esm/v2/components/or-toast-v3/or-toast-container-v3/index.js +7 -7
  136. package/dist/esm/v2/components/or-tooltip-v3/index.js +5 -5
  137. package/dist/esm/v2/hooks/index.js +1 -1
  138. package/dist/esm/v2/index.js +23 -47
  139. package/dist/esm/v2/{types-9b09f101.js → types-707995c5.js} +1 -1
  140. package/dist/esm/{v3/useElevation-92fce12c.js → v2/useElevation-df91fa50.js} +4 -4
  141. package/dist/esm/v3/{OrBottomSheet-0f24ecae.js → OrBottomSheet-95bc694e.js} +9 -2
  142. package/dist/esm/v3/{OrButton-b9bab32c.js → OrButton-8558588c.js} +3 -1
  143. package/dist/esm/v3/{OrCardCollection-5415b71b.js → OrCardCollection-631cb8e3.js} +5 -5
  144. package/dist/esm/v3/{OrConfirm-d7a152ab.js → OrConfirm-b0c7f796.js} +3 -3
  145. package/dist/esm/v3/{OrIconButton-65e83586.js → OrIconButton-786b9346.js} +2 -2
  146. package/dist/esm/v3/{OrInlineInput-2def321a.js → OrInlineInput-ca82ccc3.js} +1 -1
  147. package/dist/esm/v3/{OrInlineTextarea-6d38a261.js → OrInlineTextarea-864f1099.js} +1 -1
  148. package/dist/esm/v3/{OrInput-a7cbc8b9.js → OrInput-a43b53d2.js} +1 -1
  149. package/dist/esm/v3/{OrMenu-053a9ab7.js → OrMenu-f8132f3e.js} +1 -1
  150. package/dist/esm/v3/{OrModal-81dc4dcd.js → OrModal-cb236842.js} +2 -2
  151. package/dist/esm/v3/{OrNotification-da37f927.js → OrNotification-45b47899.js} +1 -1
  152. package/dist/esm/v3/{OrOverlay-7cf03aea.js → OrOverlay-d63d39c3.js} +1 -1
  153. package/dist/esm/v3/{OrPagination-f54ad672.js → OrPagination-1e334ccd.js} +3 -3
  154. package/dist/esm/v3/{OrPopover-3ac8f589.js → OrPopover-d6d82a06.js} +10 -3
  155. package/dist/esm/v3/{OrSearch-06f01165.js → OrSearch-d5d46937.js} +1 -1
  156. package/dist/esm/v3/{OrSelect-eab4bc19.js → OrSelect-f2911b60.js} +3 -3
  157. package/dist/esm/v3/{OrSidebar-bb1f7ea4.js → OrSidebar-0d715029.js} +1 -1
  158. package/dist/esm/v3/{OrSidebarCollapseButton-f2390f52.js → OrSidebarCollapseButton-4d7497ec.js} +1 -1
  159. package/dist/esm/v3/{OrTabs-d9e2a07e.js → OrTabs-f667cf9f.js} +2 -2
  160. package/dist/esm/v3/{OrTag-e8c12288.js → OrTag-dc1b8628.js} +1 -1
  161. package/dist/esm/v3/{OrTooltip-d91128f4.js → OrTooltip-56ed42c7.js} +1 -1
  162. package/dist/esm/v3/components/index.d.ts +0 -1
  163. package/dist/esm/v3/components/index.js +23 -47
  164. package/dist/esm/v3/components/or-bottom-sheet-v3/index.js +3 -3
  165. package/dist/esm/v3/components/or-button-v3/index.js +1 -1
  166. package/dist/esm/v3/components/or-card-collection-v3/index.js +11 -11
  167. package/dist/esm/v3/components/or-confirm-v3/index.js +9 -9
  168. package/dist/esm/v3/components/or-icon-button-v3/index.js +6 -6
  169. package/dist/esm/v3/components/or-inline-input-v3/index.js +7 -7
  170. package/dist/esm/v3/components/or-inline-textarea-v3/index.js +7 -7
  171. package/dist/esm/v3/components/or-input-v3/index.js +7 -7
  172. package/dist/esm/v3/components/or-menu-v3/index.js +5 -5
  173. package/dist/esm/v3/components/or-modal-v3/index.js +7 -7
  174. package/dist/esm/v3/components/or-notification-v3/index.js +7 -7
  175. package/dist/esm/v3/components/or-overlay-v3/index.js +2 -2
  176. package/dist/esm/v3/components/or-pagination-v3/index.js +7 -7
  177. package/dist/esm/v3/components/or-popover-v3/index.js +4 -4
  178. package/dist/esm/v3/components/or-search-v3/index.js +8 -8
  179. package/dist/esm/v3/components/or-select-v3/index.js +9 -9
  180. package/dist/esm/v3/components/or-sidebar-v3/index.js +8 -8
  181. package/dist/esm/v3/components/or-sidebar-v3/partials/index.js +7 -7
  182. package/dist/esm/v3/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +7 -7
  183. package/dist/esm/v3/components/or-tabs-v3/index.js +6 -6
  184. package/dist/esm/v3/components/or-tag-v3/index.js +7 -7
  185. package/dist/esm/v3/components/or-toast-v3/index.js +7 -7
  186. package/dist/esm/v3/components/or-toast-v3/or-toast-container-v3/index.js +7 -7
  187. package/dist/esm/v3/components/or-tooltip-v3/index.js +5 -5
  188. package/dist/esm/v3/hooks/index.js +1 -1
  189. package/dist/esm/v3/index.js +23 -47
  190. package/dist/esm/v3/{types-0e3ddb0f.js → types-71d7c1df.js} +1 -1
  191. package/dist/esm/{v2/useElevation-92fce12c.js → v3/useElevation-df91fa50.js} +4 -4
  192. package/package.json +5 -25
  193. package/src/components/index.ts +0 -1
  194. package/src/components/or-bottom-sheet-v3/OrBottomSheet.vue +7 -1
  195. package/src/components/or-button-v3/styles.ts +6 -2
  196. package/src/components/or-popover-v3/OrPopover.vue +7 -1
  197. package/src/hooks/useElevation.ts +3 -2
  198. package/src/utils/isVisible.ts +1 -1
  199. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -2036
  200. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -181
  201. package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +0 -1
  202. package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +0 -67
  203. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +0 -6
  204. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +0 -38
  205. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
  206. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -45
  207. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
  208. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
  209. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
  210. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
  211. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
  212. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
  213. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
  214. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.js +0 -1
  215. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
  216. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +0 -5
  217. package/dist/bundled/v2/index-16aee5bc.js +0 -3740
  218. package/dist/bundled/v2/index-62c3221b.js +0 -6956
  219. package/dist/bundled/v2/index.es-3f39f316.js +0 -115
  220. package/dist/bundled/v2/markdown-00716a39.js +0 -18683
  221. package/dist/bundled/v2/tiptap-core.esm-f85402b1.js +0 -9360
  222. package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-f9e835d0.js +0 -236
  223. package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-eb03c076.js +0 -1813
  224. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -226
  225. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -181
  226. package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +0 -1
  227. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +0 -83
  228. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +0 -6
  229. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +0 -38
  230. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
  231. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -45
  232. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
  233. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
  234. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
  235. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
  236. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
  237. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
  238. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
  239. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.js +0 -1
  240. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
  241. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +0 -5
  242. package/dist/bundled/v3/index-62c3221b.js +0 -6956
  243. package/dist/bundled/v3/index.es-3f39f316.js +0 -115
  244. package/dist/bundled/v3/markdown-00716a39.js +0 -18683
  245. package/dist/bundled/v3/tiptap-core.esm-f85402b1.js +0 -9360
  246. package/dist/esm/v2/OrRichTextEditor-93ace5e2.js +0 -716
  247. package/dist/esm/v2/codemirrorView-be2c7423.js +0 -353
  248. package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -181
  249. package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +0 -1
  250. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +0 -58
  251. package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -6
  252. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
  253. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
  254. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
  255. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
  256. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
  257. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
  258. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
  259. package/dist/esm/v3/OrRichTextEditor-d99a44df.js +0 -680
  260. package/dist/esm/v3/codemirrorView-be2c7423.js +0 -353
  261. package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -181
  262. package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +0 -1
  263. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +0 -56
  264. package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -6
  265. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
  266. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
  267. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
  268. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
  269. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
  270. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
  271. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
  272. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +0 -7
  273. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +0 -79
  274. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +0 -622
  275. package/src/components/or-rich-text-editor-v3/index.ts +0 -1
  276. package/src/components/or-rich-text-editor-v3/styles.ts +0 -64
  277. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +0 -40
  278. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +0 -254
  279. package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +0 -1
  280. package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +0 -213
  281. package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +0 -22
  282. package/src/components/or-rich-text-editor-v3/utils/markdown.ts +0 -110
  283. /package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-fe412ca5.js → OrButton.vue_vue_type_script_lang-5650b394.js} +0 -0
  284. /package/dist/bundled/v3/{OrOverlay.vue_vue_type_script_lang-30f62546.js → OrOverlay.vue_vue_type_script_lang-47004a50.js} +0 -0
  285. /package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-117ff0b8.js → OrToastContainer.vue_vue_type_script_lang-96bc2f19.js} +0 -0
@@ -1,64 +0,0 @@
1
- export const EditorContainer: string[] = [
2
- // Colors
3
- 'border-outline',
4
- 'dark:border-outline-dark',
5
- 'focus-within:theme-border-1-primary',
6
- 'dark:focus-within:theme-border-1-primary-dark',
7
- 'focus-within:bg-primary-opacity-0-08',
8
- 'dark:focus-within:bg-primary-opacity-0-08-dark',
9
- 'focus-within:theme-outline-primary',
10
- 'dark:focus-within:theme-outline-primary-dark',
11
-
12
- // Sizing
13
- 'border-1',
14
- 'rounded-md',
15
- 'w-full',
16
- ];
17
-
18
- export const ToolbarContainer: string[] = [
19
- // Layout
20
- 'flex',
21
- //Spacing
22
- 'py-sm',
23
- //Sizing
24
- 'border-b-1',
25
- //Colors
26
- 'border-b-outline',
27
- 'dark:border-b-outline-dark',
28
- ];
29
-
30
- export const Toolbar: string[] = [
31
- // Layout
32
- 'flex',
33
- // Spacing
34
- 'px-sm',
35
- 'gap-md',
36
- // Sizing
37
- 'border-r-1',
38
- //Colors
39
- 'border-r-disabled',
40
- 'dark:border-r-outline-dark',
41
- // Last child
42
- 'last-of-type:border-none',
43
- ];
44
-
45
- export const ToolbarButton: string[] = [
46
- // Typography
47
- 'text-on-disabled',
48
- 'dark:text-on-disabled-dark',
49
- ];
50
-
51
- export const ToolbarButtonFocused: string[] = [
52
- // Typography
53
- 'text-outline',
54
- 'dark:text-outline-dark',
55
- ];
56
-
57
- export const EditorInput: string[] = [
58
- // Typography
59
- 'typography-body-2-regular',
60
- 'text-on-background',
61
- 'dark:text-on-background-dark',
62
- // Sizing
63
- 'min-h-[88px]',
64
- ];
@@ -1,40 +0,0 @@
1
- import { Node } from '@tiptap/core';
2
- import CodeBlockView from './codemirrorView';
3
- import { minimalSetup } from 'codemirror';
4
- import { javascript } from '@codemirror/lang-javascript';
5
-
6
- export default Node.create({
7
- name: 'codeBlock',
8
- content: 'text*',
9
- marks: '',
10
- group: 'block',
11
- code: true,
12
- defining: true,
13
- isolating: true,
14
-
15
- parseHTML() {
16
- return [
17
- {
18
- tag: 'pre',
19
- preserveWhitespace: 'full',
20
- },
21
- ];
22
- },
23
-
24
- renderHTML() {
25
- return ['pre', ['code', 0]];
26
- },
27
-
28
- addNodeView() {
29
- return ({ node, editor, getPos }) => {
30
- return new CodeBlockView({
31
- node,
32
- view: editor.view,
33
- getPos: getPos as () => number,
34
- cmOptions: {
35
- extensions: [minimalSetup, javascript()],
36
- },
37
- });
38
- };
39
- },
40
- });
@@ -1,254 +0,0 @@
1
- import { Selection, TextSelection } from 'prosemirror-state';
2
- import { EditorView, NodeView } from 'prosemirror-view';
3
- import { Node as ProsemirrorNode } from 'prosemirror-model';
4
- import { exitCode } from 'prosemirror-commands';
5
- import { EditorState as CMState, Transaction as CMTransaction } from '@codemirror/state';
6
- import {
7
- Command,
8
- EditorView as CMView,
9
- keymap,
10
- highlightActiveLine,
11
- highlightActiveLineGutter,
12
- lineNumbers,
13
- } from '@codemirror/view';
14
- import orCodeTheme from './theme';
15
-
16
- import { ComputeChange, CodeMirrorViewOptions } from './types';
17
-
18
- const computeChange = (oldVal: string, newVal: string): ComputeChange | null => {
19
- if (oldVal === newVal) {
20
- return null;
21
- }
22
-
23
- let start = 0;
24
- let oldEnd = oldVal.length;
25
- let newEnd = newVal.length;
26
-
27
- while (start < oldEnd && oldVal.charCodeAt(start) === newVal.charCodeAt(start)) {
28
- start += 1;
29
- }
30
-
31
- while (oldEnd > start && newEnd > start && oldVal.charCodeAt(oldEnd - 1) === newVal.charCodeAt(newEnd - 1)) {
32
- oldEnd -= 1;
33
- newEnd -= 1;
34
- }
35
-
36
- return {
37
- from: start,
38
- to: oldEnd,
39
- text: newVal.slice(start, newEnd),
40
- };
41
- };
42
-
43
- class CodeMirrorView implements NodeView {
44
- name: string;
45
-
46
- node: ProsemirrorNode;
47
-
48
- view: EditorView;
49
-
50
- dom: HTMLElement;
51
-
52
- cm: CMView;
53
-
54
- getPos: () => number;
55
-
56
- updating = false;
57
-
58
- constructor(options: CodeMirrorViewOptions) {
59
- // Store for later
60
- this.node = options.node;
61
- this.view = options.view;
62
- const cmExtensions = options.cmOptions?.extensions || [];
63
- this.name = 'codeBlock',
64
-
65
- this.getPos = options.getPos as () => number;
66
-
67
- const changeFilter = CMState.changeFilter.of((tr) => {
68
- if (!tr.docChanged && !this.updating) {
69
- this.forwardSelection();
70
- }
71
- return true;
72
- });
73
-
74
- // Create a CodeMirror instancew
75
- this.cm = new CMView({
76
- dispatch: this.dispatch.bind(this),
77
- });
78
-
79
- // The editor's outer node is our DOM representation
80
- this.dom = this.cm.dom;
81
-
82
- const cmState = CMState.create({
83
- doc: this.node.textContent,
84
- extensions: [
85
- orCodeTheme,
86
- changeFilter,
87
- highlightActiveLine(),
88
- highlightActiveLineGutter(),
89
- lineNumbers(),
90
- keymap.of([
91
- {
92
- key: 'ArrowUp',
93
- run: this.mayBeEscape('line', -1),
94
- },
95
- {
96
- key: 'ArrowLeft',
97
- run: this.mayBeEscape('char', -1),
98
- },
99
- {
100
- key: 'ArrowDown',
101
- run: this.mayBeEscape('line', 1),
102
- },
103
- {
104
- key: 'ArrowRight',
105
- run: this.mayBeEscape('char', 1),
106
- },
107
- {
108
- key: 'Ctrl-Enter',
109
- run: () => {
110
- if (exitCode(this.view.state, this.view.dispatch)) {
111
- this.view.focus();
112
- return true;
113
- }
114
- return false;
115
- },
116
- },
117
- ]),
118
- cmExtensions,
119
- ],
120
- });
121
-
122
- this.cm.setState(cmState);
123
- }
124
-
125
- forwardSelection() {
126
- if (!this.cm.hasFocus) {
127
- return;
128
- }
129
-
130
- const { state } = this.view;
131
- const selection = this.asProseMirrorSelection(state.doc);
132
-
133
- if (!selection.eq(state.selection)) {
134
- this.view.dispatch(state.tr.setSelection(selection));
135
- }
136
- }
137
-
138
- asProseMirrorSelection(doc: ProsemirrorNode) {
139
- const offset = this.getPos() + 1;
140
- const { anchor, head } = this.cm.state.selection.main;
141
- return TextSelection.create(doc, anchor + offset, head + offset);
142
- }
143
-
144
- dispatch(cmTr: CMTransaction) {
145
- this.cm.setState(cmTr.state);
146
-
147
- if (cmTr.docChanged && !this.updating) {
148
- const start = this.getPos() + 1;
149
-
150
- const cmValue = cmTr.state.doc.toString();
151
- const change = computeChange(this.node.textContent, cmValue);
152
-
153
- if (!change) {
154
- return;
155
- }
156
-
157
- const content = change.text ? this.view.state.schema.text(change.text) : null;
158
-
159
- const tr = this.view.state.tr.replaceWith(change.from + start, change.to + start, content as ProsemirrorNode);
160
- this.view.dispatch(tr);
161
- this.forwardSelection();
162
- }
163
- }
164
-
165
- mayBeEscape(unit: 'char' | 'line', dir: -1 | 1): Command {
166
- return (view) => {
167
- const { state } = view;
168
- const { selection } = state;
169
-
170
- const offsetToPos = () => {
171
- const offset = selection.main.from;
172
- const line = state.doc.lineAt(offset);
173
- return {
174
- line: line.number,
175
- ch: offset - line.from,
176
- };
177
- };
178
-
179
- const pos = offsetToPos();
180
- const hasSelection = state.selection.ranges.some((r) => !r.empty);
181
-
182
- const firstLine = 1;
183
- const lastLine = state.doc.lineAt(state.doc.length).number;
184
-
185
- if (
186
- hasSelection
187
- || pos.line !== (dir < 0 ? firstLine : lastLine)
188
- || (unit === 'char' && pos.ch !== (dir < 0 ? 0 : state.doc.line(pos.line).length))
189
- ) {
190
- return false;
191
- }
192
-
193
- const targetPos = this.getPos() + (dir < 0 ? 0 : this.node.nodeSize);
194
- const pmSelection = Selection.near(this.view.state.doc.resolve(targetPos), dir);
195
- this.view.dispatch(this.view.state.tr.setSelection(pmSelection).scrollIntoView());
196
- this.view.focus();
197
- return true;
198
- };
199
- }
200
-
201
- update(node: ProsemirrorNode) {
202
- if (node.type !== this.node.type) {
203
- return false;
204
- }
205
-
206
- this.node = node;
207
- const change = computeChange(this.cm.state.doc.toString(), node.textContent);
208
-
209
- if (change) {
210
- this.updating = true;
211
- this.cm.dispatch({
212
- changes: {
213
- from: change.from,
214
- to: change.to,
215
- insert: change.text,
216
- },
217
- });
218
- this.updating = false;
219
- }
220
-
221
- return true;
222
- }
223
-
224
- setSelection(anchor: number, head: number): void {
225
- this.focus();
226
- this.updating = true;
227
- this.cm.dispatch({
228
- selection: {
229
- anchor,
230
- head,
231
- },
232
- });
233
- this.updating = false;
234
- }
235
-
236
- focus() {
237
- this.cm.focus();
238
- this.forwardSelection();
239
- }
240
-
241
- selectNode() {
242
- this.focus();
243
- }
244
-
245
- stopEvent() {
246
- return true;
247
- }
248
-
249
- destroy() {
250
- this.cm.destroy();
251
- }
252
- }
253
-
254
- export default CodeMirrorView;
@@ -1 +0,0 @@
1
- export { default as CodeMirrorView } from './codemirrorView';
@@ -1,213 +0,0 @@
1
- import { EditorView } from '@codemirror/view';
2
- import { Extension } from '@codemirror/state';
3
- import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
4
- import { tags as t } from '@lezer/highlight';
5
-
6
- // Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
7
-
8
- const chalky = 'var(--c-warning-darken-20)',
9
- coral = 'var(--c-error)',
10
- cyan = '#56b6c2',
11
- invalid = 'var(--c-white)',
12
- ivory = 'var(--c-neutral-6)',
13
- stone = 'var(--c-neutral-5)', // Brightened compared to original to increase contrast
14
- malibu = '#61afef',
15
- sage = 'var(--c-success)',
16
- whiskey = 'var(--c-warning-darken-5)',
17
- violet = '#c678dd',
18
- darkBackground = 'var(--c-neutral-1)',
19
- highlightBackground = 'var(--c-neutral-2)',
20
- background = 'var(--c-neutral-1)',
21
- tooltipBackground = 'var(--c-neutral-2)',
22
- selection = 'var(--c-neutral-3)',
23
- cursor = 'var(--c-primary)';
24
-
25
- /// The colors used in the theme, as CSS color strings.
26
- export const color = {
27
- chalky,
28
- coral,
29
- cyan,
30
- invalid,
31
- ivory,
32
- stone,
33
- malibu,
34
- sage,
35
- whiskey,
36
- violet,
37
- darkBackground,
38
- highlightBackground,
39
- background,
40
- tooltipBackground,
41
- selection,
42
- cursor,
43
- };
44
-
45
- /// The editor theme styles for One Dark.
46
- export const orCodeTheme = EditorView.theme({
47
- '&': {
48
- color: ivory,
49
- backgroundColor: background,
50
- },
51
-
52
- '.cm-content': {
53
- caretColor: cursor,
54
- },
55
-
56
- '.cm-button': {
57
- background: highlightBackground,
58
- color: 'var(--c-neutral-6)',
59
- border: 0,
60
- borderRadius: 'var(--s-2)',
61
- },
62
-
63
- '.cm-panel.cm-search input[type=checkbox]': {
64
- display: 'inline-block',
65
- verticalAlign: 'middle',
66
- },
67
-
68
- '.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },
69
- '&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
70
- backgroundColor: selection,
71
- },
72
-
73
- '.cm-panels': {
74
- backgroundColor: darkBackground,
75
- color: ivory,
76
- },
77
- '.cm-panels.cm-panels-top': { borderBottom: '2px solid var(--c-neutral-2)' },
78
- '.cm-panels.cm-panels-bottom': { borderTop: '2px solid var(--c-neutral-2)' },
79
-
80
- '.cm-searchMatch': {
81
- backgroundColor: 'var(--c-neutral-1)',
82
- outline: '1px solid var(--c-neutral-2)',
83
- },
84
- '.cm-searchMatch.cm-searchMatch-selected': {
85
- backgroundColor: '#6199ff2f',
86
- },
87
-
88
- '.cm-activeLine': { backgroundColor: '#6699ff0b' },
89
- '.cm-selectionMatch': { backgroundColor: '#aafe661a' },
90
-
91
- '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
92
- backgroundColor: '#bad0f847',
93
- },
94
-
95
- '.cm-gutters': {
96
- backgroundColor: background,
97
- color: stone,
98
- border: 'none',
99
- },
100
-
101
- '.cm-activeLineGutter': {
102
- backgroundColor: highlightBackground,
103
- },
104
-
105
- '.cm-foldPlaceholder': {
106
- backgroundColor: 'transparent',
107
- border: 'none',
108
- color: '#ddd',
109
- },
110
-
111
- '.cm-tooltip': {
112
- border: 'none',
113
- backgroundColor: tooltipBackground,
114
- },
115
- '.cm-tooltip .cm-tooltip-arrow:before': {
116
- borderTopColor: 'transparent',
117
- borderBottomColor: 'transparent',
118
- },
119
- '.cm-tooltip .cm-tooltip-arrow:after': {
120
- borderTopColor: tooltipBackground,
121
- borderBottomColor: tooltipBackground,
122
- },
123
- '.cm-tooltip-autocomplete': {
124
- '& > ul > li[aria-selected]': {
125
- backgroundColor: highlightBackground,
126
- color: ivory,
127
- },
128
- },
129
- '.cm-textfield': {
130
- outline: 'none',
131
- background: background,
132
- color: 'var(--c-neutral-6)',
133
- backgroundColor: 'var(--c-neutral-1)',
134
- border: '1px solid var(--c-neutral-2)',
135
- borderRadius: 'var(--s-2)',
136
- },
137
- }, { dark: true });
138
-
139
- /// The highlighting style for code in the One Dark theme.
140
- export const orCodeHighlightStyle = HighlightStyle.define([
141
- {
142
- tag: t.keyword,
143
- color: violet,
144
- },
145
- {
146
- tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],
147
- color: coral,
148
- },
149
- {
150
- tag: [t.function(t.variableName), t.labelName],
151
- color: malibu,
152
- },
153
- {
154
- tag: [t.color, t.constant(t.name), t.standard(t.name)],
155
- color: whiskey,
156
- },
157
- {
158
- tag: [t.definition(t.name), t.separator],
159
- color: ivory,
160
- },
161
- {
162
- tag: [t.typeName, t.className, t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
163
- color: chalky,
164
- },
165
- {
166
- tag: [t.operator, t.operatorKeyword, t.url, t.escape, t.regexp, t.link, t.special(t.string)],
167
- color: cyan,
168
- },
169
- {
170
- tag: [t.meta, t.comment],
171
- color: stone,
172
- },
173
- {
174
- tag: t.strong,
175
- fontWeight: 'bold',
176
- },
177
- {
178
- tag: t.emphasis,
179
- fontStyle: 'italic',
180
- },
181
- {
182
- tag: t.strikethrough,
183
- textDecoration: 'line-through',
184
- },
185
- {
186
- tag: t.link,
187
- color: stone,
188
- textDecoration: 'underline',
189
- },
190
- {
191
- tag: t.heading,
192
- fontWeight: 'bold',
193
- color: coral,
194
- },
195
- {
196
- tag: [t.atom, t.bool, t.special(t.variableName)],
197
- color: whiskey,
198
- },
199
- {
200
- tag: [t.processingInstruction, t.string, t.inserted],
201
- color: sage,
202
- },
203
- {
204
- tag: t.invalid,
205
- color: invalid,
206
- },
207
- ]);
208
-
209
- /// Extension to enable the One Dark theme (both the editor theme and
210
- /// the highlight style).
211
- const theme: Extension = [orCodeTheme, syntaxHighlighting(orCodeHighlightStyle)];
212
-
213
- export default theme;
@@ -1,22 +0,0 @@
1
- import type { EditorView } from 'prosemirror-view';
2
- import type { Node as ProsemirrorNode } from 'prosemirror-model';
3
- import type { Extension } from '@codemirror/state';
4
-
5
- export interface ComputeChange {
6
- from: number;
7
- to: number;
8
- text: string;
9
- }
10
-
11
- interface CMOptions {
12
- extensions: Extension;
13
- }
14
-
15
- export type GetPos = () => number | undefined;
16
-
17
- export interface CodeMirrorViewOptions {
18
- node: ProsemirrorNode;
19
- view: EditorView;
20
- getPos: GetPos;
21
- cmOptions?: CMOptions;
22
- }
@@ -1,110 +0,0 @@
1
- import {
2
- MarkdownSerializer as ProseMirrorMarkdownSerializer,
3
- defaultMarkdownSerializer,
4
- } from 'prosemirror-markdown';
5
- import { DOMParser as ProseMirrorDOMParser, Node, Mark } from 'prosemirror-model';
6
- import { marked } from 'marked';
7
-
8
- import Paragraph from '@tiptap/extension-paragraph';
9
- import BulletList from '@tiptap/extension-bullet-list';
10
- import ListItem from '@tiptap/extension-list-item';
11
- import OrderedList from '@tiptap/extension-ordered-list';
12
- import Strike from '@tiptap/extension-strike';
13
- import Italic from '@tiptap/extension-italic';
14
- import HardBreak from '@tiptap/extension-hard-break';
15
- import Bold from '@tiptap/extension-bold';
16
- import CodeBlock from '@tiptap/extension-code-block';
17
- import Blockquote from '@tiptap/extension-blockquote';
18
- import Link from '@tiptap/extension-link';
19
- import Highlight from '@tiptap/extension-highlight';
20
-
21
- const serializerNodes = {
22
- ...defaultMarkdownSerializer.nodes,
23
- [Paragraph.name]: defaultMarkdownSerializer.nodes.paragraph,
24
- [BulletList.name]: defaultMarkdownSerializer.nodes.bullet_list,
25
- [ListItem.name]: defaultMarkdownSerializer.nodes.list_item,
26
- [OrderedList.name]: defaultMarkdownSerializer.nodes.ordered_list,
27
- [HardBreak.name]: defaultMarkdownSerializer.nodes.hard_break,
28
- [CodeBlock.name]: defaultMarkdownSerializer.nodes.code_block,
29
- [Blockquote.name]: defaultMarkdownSerializer.nodes.blockquote,
30
- };
31
-
32
- const serializerMarks = {
33
- ...defaultMarkdownSerializer.marks,
34
- [Bold.name]: defaultMarkdownSerializer.marks.strong,
35
- [Strike.name]: {
36
- open: '~~',
37
- close: '~~',
38
- mixable: true,
39
- expelEnclosingWhitespace: true,
40
- },
41
- [Italic.name]: {
42
- open: '_',
43
- close: '_',
44
- mixable: true,
45
- expelEnclosingWhitespace: true,
46
- },
47
- [Highlight.name]: {
48
- open: '==',
49
- close: '==',
50
- mixable: true,
51
- expelEnclosingWhitespace: true,
52
- },
53
- [Link.name]: {
54
- open(state: any, mark: Mark, parent: Node, index: number) {
55
- return isPlainURL(mark, parent, index, 1) ? '<' : '[';
56
- },
57
- close(state: any, mark: Mark, parent: Node, index: number) {
58
- const href = mark.attrs.canonicalSrc || mark.attrs.href;
59
-
60
- return isPlainURL(mark, parent, index, -1)
61
- ? '>'
62
- : `](${state.esc(href)}${
63
- mark.attrs.title ? ` ${state.quote(mark.attrs.title)}` : ''
64
- })`;
65
- },
66
- },
67
- };
68
-
69
- const isPlainURL = (link: Mark, parent: Node, index: number, side: number) => {
70
- if (link.attrs.title || !/^\w+:/.test(link.attrs.href)) return false;
71
- const content = parent.child(index + (side < 0 ? -1 : 0));
72
- if (
73
- !content.isText ||
74
- content.text !== link.attrs.href ||
75
- content.marks[content.marks.length - 1] !== link
76
- )
77
- return false;
78
- if (index === (side < 0 ? 1 : parent.childCount - 1)) return true;
79
- const next = parent.child(index + (side < 0 ? -2 : 1));
80
- return !link.isInSet(next.marks);
81
- };
82
-
83
- const serialize = (schema: any, content: any) => {
84
- const proseMirrorDocument = schema.nodeFromJSON(content);
85
- const serializer = new ProseMirrorMarkdownSerializer(
86
- serializerNodes,
87
- serializerMarks,
88
- );
89
-
90
- return serializer.serialize(proseMirrorDocument);
91
- };
92
-
93
- const deserialize = (schema: any, content: any) => {
94
- if (!content) return null;
95
-
96
- const html = marked.parse(content);
97
-
98
- if (!html) return null;
99
-
100
- const parser = new DOMParser();
101
- const { body } = parser.parseFromString(html, 'text/html');
102
-
103
- // append original source as a comment that nodes can access
104
- body.append(document.createComment(content));
105
-
106
- const state = ProseMirrorDOMParser.fromSchema(schema).parse(body);
107
- return state.toJSON();
108
- };
109
-
110
- export { serialize, deserialize };