@onereach/ui-components 4.7.0-beta.2811.0 → 4.8.0-beta.2836.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 (715) hide show
  1. package/dist/bundled/{v3/_baseAssignValue-22e630c1.js → v2/_baseAssignValue-008b033a.js} +1 -1
  2. package/dist/bundled/v2/{_baseIsEqual-a1cc156c.js → _baseIsEqual-9edac039.js} +5 -5
  3. package/dist/bundled/v2/_commonjsHelpers-6584e42b.js +11 -0
  4. package/dist/bundled/v2/components/OrAvatar/OrAvatar.js +6 -5
  5. package/dist/bundled/v2/components/OrAvatar/index.js +6 -5
  6. package/dist/bundled/v2/components/OrBottomSheetV3/OrBottomSheet.js +2 -2
  7. package/dist/bundled/v2/components/OrBottomSheetV3/index.js +2 -2
  8. package/dist/bundled/v2/components/OrButtonV2/OrButton.js +6 -5
  9. package/dist/bundled/v2/components/OrButtonV2/index.js +6 -5
  10. package/dist/bundled/v2/components/OrButtonV3/OrButton.js +2 -2
  11. package/dist/bundled/v2/components/OrButtonV3/index.js +2 -2
  12. package/dist/bundled/v2/components/OrCardCollection/OrCardCollection.js +7 -6
  13. package/dist/bundled/v2/components/OrCardCollection/index.js +7 -6
  14. package/dist/bundled/v2/components/OrCardCollectionV3/OrCardCollection.js +2 -2
  15. package/dist/bundled/v2/components/OrCardCollectionV3/index.js +2 -2
  16. package/dist/bundled/v2/components/OrCarousel/OrCarousel.js +6 -5
  17. package/dist/bundled/v2/components/OrCarousel/index.js +6 -5
  18. package/dist/bundled/v2/components/OrCheckbox/OrCheckbox.js +6 -5
  19. package/dist/bundled/v2/components/OrCheckbox/index.js +6 -5
  20. package/dist/bundled/v2/components/OrCheckboxGroupV3/OrCheckboxGroup.js +2 -2
  21. package/dist/bundled/v2/components/OrCheckboxGroupV3/index.js +2 -2
  22. package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.js +2 -2
  23. package/dist/bundled/v2/components/OrCheckboxTreeV3/index.js +2 -2
  24. package/dist/bundled/v2/components/OrCheckboxV3/OrCheckbox.js +2 -2
  25. package/dist/bundled/v2/components/OrCheckboxV3/index.js +2 -2
  26. package/dist/bundled/v2/components/OrChip/OrChip.js +6 -5
  27. package/dist/bundled/v2/components/OrChip/index.js +6 -5
  28. package/dist/bundled/v2/components/OrChips/OrChips.js +6 -5
  29. package/dist/bundled/v2/components/OrChips/index.js +6 -5
  30. package/dist/bundled/v2/components/OrCode/OrCode.js +14 -3799
  31. package/dist/bundled/v2/components/OrCode/index.js +14 -9
  32. package/dist/bundled/v2/components/OrCode/lang.js +3941 -3
  33. package/dist/bundled/v2/components/OrCode/theme.js +2 -1
  34. package/dist/bundled/v2/components/OrCollapse/OrCollapse.js +6 -5
  35. package/dist/bundled/v2/components/OrCollapse/index.js +6 -5
  36. package/dist/bundled/v2/components/OrColorPicker/OrColorPicker.js +8 -7
  37. package/dist/bundled/v2/components/OrColorPicker/index.js +8 -7
  38. package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +10 -8
  39. package/dist/bundled/v2/components/OrConfirm/index.js +10 -8
  40. package/dist/bundled/v2/components/OrConfirmV3/OrConfirm.js +3 -3
  41. package/dist/bundled/v2/components/OrConfirmV3/index.js +3 -3
  42. package/dist/bundled/v2/components/OrDatePickerV3/OrDatePicker.js +4 -4
  43. package/dist/bundled/v2/components/OrDatePickerV3/index.js +4 -4
  44. package/dist/bundled/v2/components/OrDateTimePicker/OrDateTimePicker.js +10 -9
  45. package/dist/bundled/v2/components/OrDateTimePicker/index.js +10 -9
  46. package/dist/bundled/v2/components/OrDateTimePickerV3/OrDateTimePicker.js +5 -5
  47. package/dist/bundled/v2/components/OrDateTimePickerV3/index.js +5 -5
  48. package/dist/bundled/v2/components/OrFloating/OrFloating.js +6 -5
  49. package/dist/bundled/v2/components/OrFloating/index.js +6 -5
  50. package/dist/bundled/v2/components/OrIcon/OrIcon.js +6 -5
  51. package/dist/bundled/v2/components/OrIcon/index.js +6 -5
  52. package/dist/bundled/v2/components/OrIconButtonV2/OrIconButton.js +6 -5
  53. package/dist/bundled/v2/components/OrIconButtonV2/index.js +6 -5
  54. package/dist/bundled/v2/components/OrIconButtonV3/OrIconButton.js +2 -2
  55. package/dist/bundled/v2/components/OrIconButtonV3/index.js +2 -2
  56. package/dist/bundled/v2/components/OrInlineInputV3/OrInlineInput.js +2 -2
  57. package/dist/bundled/v2/components/OrInlineInputV3/index.js +2 -2
  58. package/dist/bundled/v2/components/OrInlineTextEdit/OrInlineTextEdit.js +8 -7
  59. package/dist/bundled/v2/components/OrInlineTextEdit/index.js +8 -7
  60. package/dist/bundled/v2/components/OrInlineTextareaV3/OrInlineTextarea.js +2 -2
  61. package/dist/bundled/v2/components/OrInlineTextareaV3/index.js +2 -2
  62. package/dist/bundled/v2/components/OrInput/OrInput.js +6 -5
  63. package/dist/bundled/v2/components/OrInput/index.js +6 -5
  64. package/dist/bundled/v2/components/OrInputV3/OrInput.js +2 -2
  65. package/dist/bundled/v2/components/OrInputV3/index.js +2 -2
  66. package/dist/bundled/v2/components/OrList/OrList.js +10 -9
  67. package/dist/bundled/v2/components/OrList/index.js +10 -9
  68. package/dist/bundled/v2/components/OrListOfInputs/OrListOfInputs.js +10 -9
  69. package/dist/bundled/v2/components/OrListOfInputs/index.js +10 -9
  70. package/dist/bundled/v2/components/OrLoaderV3/OrLoader.js +2 -2
  71. package/dist/bundled/v2/components/OrLoaderV3/index.js +2 -2
  72. package/dist/bundled/v2/components/OrMenuV3/OrMenu.js +2 -2
  73. package/dist/bundled/v2/components/OrMenuV3/index.js +2 -2
  74. package/dist/bundled/v2/components/OrModal/OrModal.js +10 -1352
  75. package/dist/bundled/v2/components/OrModal/index.js +9 -7
  76. package/dist/bundled/v2/components/OrModalV3/OrModal.js +4 -4
  77. package/dist/bundled/v2/components/OrModalV3/index.js +2 -2
  78. package/dist/bundled/v2/components/OrNotification/OrNotification.js +6 -5
  79. package/dist/bundled/v2/components/OrNotification/index.js +6 -5
  80. package/dist/bundled/v2/components/OrNotificationV3/OrNotification.js +2 -2
  81. package/dist/bundled/v2/components/OrNotificationV3/index.js +2 -2
  82. package/dist/bundled/v2/components/OrNumberInput/OrNumberInput.js +6 -5
  83. package/dist/bundled/v2/components/OrNumberInput/index.js +6 -5
  84. package/dist/bundled/v2/components/OrOverflowMenu/OrOverflowMenu.js +8 -7
  85. package/dist/bundled/v2/components/OrOverflowMenu/index.js +8 -7
  86. package/dist/bundled/v2/components/OrOverlayV3/OrOverlay.js +2 -2
  87. package/dist/bundled/v2/components/OrOverlayV3/index.js +2 -2
  88. package/dist/bundled/v2/components/OrPaginationV3/OrPagination.js +2 -2
  89. package/dist/bundled/v2/components/OrPaginationV3/index.js +2 -2
  90. package/dist/bundled/v2/components/OrPassword/OrPassword.js +8 -7
  91. package/dist/bundled/v2/components/OrPassword/index.js +8 -7
  92. package/dist/bundled/v2/components/OrPopoverV3/OrPopover.js +2 -2
  93. package/dist/bundled/v2/components/OrPopoverV3/index.js +2 -2
  94. package/dist/bundled/v2/components/OrProgress/OrProgress.js +6 -5
  95. package/dist/bundled/v2/components/OrProgress/index.js +6 -5
  96. package/dist/bundled/v2/components/OrProgressV3/OrProgress.js +8 -7
  97. package/dist/bundled/v2/components/OrProgressV3/index.js +8 -7
  98. package/dist/bundled/v2/components/OrRadio/OrRadio.js +8 -7
  99. package/dist/bundled/v2/components/OrRadio/index.js +8 -7
  100. package/dist/bundled/v2/components/OrRadioGroupV3/OrRadioGroup.js +2 -2
  101. package/dist/bundled/v2/components/OrRadioGroupV3/index.js +2 -2
  102. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +2201 -0
  103. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +220 -0
  104. package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +2 -0
  105. package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +73 -0
  106. package/dist/bundled/v2/components/OrRichTextEditorV3/props.d.ts +4 -0
  107. package/dist/bundled/v2/components/OrRichTextEditorV3/props.js +7 -0
  108. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +6 -0
  109. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +38 -0
  110. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
  111. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +46 -0
  112. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
  113. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
  114. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
  115. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
  116. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
  117. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
  118. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
  119. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
  120. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
  121. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +6 -0
  122. package/dist/bundled/v2/components/OrSearch/OrSearch.js +7 -6
  123. package/dist/bundled/v2/components/OrSearch/index.js +7 -6
  124. package/dist/bundled/v2/components/OrSearchV3/OrSearch.js +2 -2
  125. package/dist/bundled/v2/components/OrSearchV3/index.js +2 -2
  126. package/dist/bundled/v2/components/OrSelect/OrSelect.js +11 -10
  127. package/dist/bundled/v2/components/OrSelect/index.js +11 -10
  128. package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +2 -2
  129. package/dist/bundled/v2/components/OrSelectV3/index.js +2 -2
  130. package/dist/bundled/v2/components/OrSidebar/OrSidebar.js +2 -2
  131. package/dist/bundled/v2/components/OrSidebar/index.js +2 -2
  132. package/dist/bundled/v2/components/OrSidebarV3/OrSidebar.js +2 -2
  133. package/dist/bundled/v2/components/OrSidebarV3/index.js +2 -2
  134. package/dist/bundled/v2/components/OrSkeleton/index.js +6 -5
  135. package/dist/bundled/v2/components/OrSkeletonText/OrSkeletonText.js +6 -5
  136. package/dist/bundled/v2/components/OrSkeletonText/index.js +6 -5
  137. package/dist/bundled/v2/components/OrSkeletonTextV3/OrSkeletonText.js +6 -5
  138. package/dist/bundled/v2/components/OrSkeletonTextV3/index.js +6 -5
  139. package/dist/bundled/v2/components/OrSkeletonV3/index.js +6 -5
  140. package/dist/bundled/v2/components/OrSlider/OrSlider.js +8 -7
  141. package/dist/bundled/v2/components/OrSlider/index.js +8 -7
  142. package/dist/bundled/v2/components/OrStepper/OrStepper.js +6 -5
  143. package/dist/bundled/v2/components/OrStepper/index.js +6 -5
  144. package/dist/bundled/v2/components/OrSwitchV3/OrSwitch.js +2 -2
  145. package/dist/bundled/v2/components/OrSwitchV3/index.js +2 -2
  146. package/dist/bundled/v2/components/OrTabsV3/OrTabs.js +2 -2
  147. package/dist/bundled/v2/components/OrTabsV3/index.js +2 -2
  148. package/dist/bundled/v2/components/OrTag/OrTag.js +6 -5
  149. package/dist/bundled/v2/components/OrTag/index.js +6 -5
  150. package/dist/bundled/v2/components/OrTagV3/OrTag.js +2 -2
  151. package/dist/bundled/v2/components/OrTagV3/index.js +2 -2
  152. package/dist/bundled/v2/components/OrTagsV3/OrTags.js +2 -2
  153. package/dist/bundled/v2/components/OrTagsV3/index.js +2 -2
  154. package/dist/bundled/v2/components/OrTextarea/OrTextarea.js +6 -5
  155. package/dist/bundled/v2/components/OrTextarea/index.js +6 -5
  156. package/dist/bundled/v2/components/OrTextbox/OrTextbox.js +6 -5
  157. package/dist/bundled/v2/components/OrTextbox/index.js +6 -5
  158. package/dist/bundled/v2/components/OrTimePickerV3/OrTimePicker.js +4 -4
  159. package/dist/bundled/v2/components/OrTimePickerV3/index.js +4 -4
  160. package/dist/bundled/v2/components/OrToast/OrToast.js +9 -8
  161. package/dist/bundled/v2/components/OrToast/Timer.js +1 -1
  162. package/dist/bundled/v2/components/OrToast/composable/index.js +2 -2
  163. package/dist/bundled/v2/components/OrToast/composable/useToast.js +2 -2
  164. package/dist/bundled/v2/components/OrToast/composable/useToastEventBus.js +2 -2
  165. package/dist/bundled/v2/components/OrToast/index.js +11 -10
  166. package/dist/bundled/v2/components/OrToastContainer/OrToastContainer.js +11 -10
  167. package/dist/bundled/v2/components/OrToastContainer/index.js +11 -10
  168. package/dist/bundled/v2/components/OrToastContainerV3/OrToastContainer.js +2 -2
  169. package/dist/bundled/v2/components/OrToastContainerV3/index.js +2 -2
  170. package/dist/bundled/v2/components/OrToastV3/OrToast.js +2 -2
  171. package/dist/bundled/v2/components/OrToastV3/Timer.js +1 -1
  172. package/dist/bundled/v2/components/OrToastV3/composable/index.js +2 -2
  173. package/dist/bundled/v2/components/OrToastV3/composable/useToast.js +2 -2
  174. package/dist/bundled/v2/components/OrToastV3/composable/useToastEventBus.js +2 -2
  175. package/dist/bundled/v2/components/OrToastV3/index.js +2 -2
  176. package/dist/bundled/v2/components/OrTooltip/OrTooltip.js +6 -5
  177. package/dist/bundled/v2/components/OrTooltip/index.js +6 -5
  178. package/dist/bundled/v2/components/OrTooltipV3/OrTooltip.js +2 -2
  179. package/dist/bundled/v2/components/OrTooltipV3/index.js +2 -2
  180. package/dist/bundled/v2/components/index.d.ts +1 -0
  181. package/dist/bundled/v2/components/index.js +36 -21
  182. package/dist/bundled/{v3/dom-700444b4.js → v2/dom-c98dce89.js} +2 -2
  183. package/dist/bundled/v2/{eq-95cd2573.js → eq-037e6fce.js} +1 -1
  184. package/dist/bundled/{v3/get-ab1b7d93.js → v2/get-b30afe93.js} +3 -3
  185. package/dist/bundled/v2/hooks/index.d.ts +1 -0
  186. package/dist/bundled/v2/hooks/index.js +6 -2
  187. package/dist/bundled/v2/hooks/useOverflow.d.ts +2 -2
  188. package/dist/bundled/v2/hooks/useOverflow.js +2 -2
  189. package/dist/bundled/v2/hooks/usePopoverState.js +1 -1
  190. package/dist/bundled/v2/hooks/useResponsive/index.js +2 -2
  191. package/dist/bundled/v2/hooks/useResponsive/useResponsive.js +2 -2
  192. package/dist/bundled/v2/hooks/useTheme.d.ts +2 -0
  193. package/dist/bundled/v2/hooks/useTheme.js +10125 -0
  194. package/dist/bundled/v2/{index-8a1b5b9c.js → index-06f6bbe4.js} +1 -1
  195. package/dist/bundled/v2/{index-cf2c3c27.js → index-0d224ae5.js} +3 -115
  196. package/dist/bundled/v2/index-80a3a4f4.js +9714 -0
  197. package/dist/bundled/v2/index-85c2efe8.js +7122 -0
  198. package/dist/bundled/v2/{index-6d94f832.js → index-af414338.js} +2 -2
  199. package/dist/bundled/{v3/OrCode.vue_vue_type_script_lang-7af61a76.js → v2/index-d92d0b48.js} +14 -235
  200. package/dist/bundled/v2/{index-82718479.js → index-dac0fb7c.js} +1 -1
  201. package/dist/bundled/v2/{lang-0fb8f78b.js → index-e9f6b2d8.js} +73 -4009
  202. package/dist/bundled/v2/index.es-3f39f316.js +115 -0
  203. package/dist/bundled/v2/index.js +42 -24
  204. package/dist/bundled/v2/{isArrayLike-e46b8eac.js → isArrayLike-61275a05.js} +1 -1
  205. package/dist/bundled/v2/{isEqual-44382965.js → isEqual-8bbb1110.js} +1 -1
  206. package/dist/bundled/{v3/isObject-fe8b81fd.js → v2/isObject-08fab135.js} +1 -1
  207. package/dist/bundled/v2/markdown-c78b4891.js +17977 -0
  208. package/dist/bundled/{v3/range-6f26eda4.js → v2/range-637f1361.js} +4 -4
  209. package/dist/bundled/{v3/round-f34440f4.js → v2/round-4a894f03.js} +4 -4
  210. package/dist/bundled/{v3/toFinite-74227610.js → v2/toFinite-675db18a.js} +1 -1
  211. package/dist/bundled/v2/{toInteger-2fd112a9.js → toInteger-27595771.js} +1 -1
  212. package/dist/bundled/{v3/toString-f3196832.js → v2/toString-a72d5149.js} +1 -1
  213. package/dist/bundled/{v3/OrModal.vue_vue_type_script_lang-6e26795e.js → v2/useFocusTrap-c1384da1.js} +4 -100
  214. package/dist/bundled/v2/utils/functions/dom.js +6 -5
  215. package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-2a494943.js → OrAvatar.vue_vue_type_script_lang-36439ec1.js} +1 -1
  216. package/dist/bundled/v3/{OrBottomSheet.vue_vue_type_script_lang-2f9406a6.js → OrBottomSheet.vue_vue_type_script_lang-a4e73f9e.js} +2 -2
  217. package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-af5ff967.js → OrButton.vue_vue_type_script_lang-d31ada75.js} +1 -1
  218. package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-5ae410e5.js → OrButton.vue_vue_type_script_lang-fc3b3109.js} +1 -1
  219. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-86c25f0f.js → OrCardCollection.vue_vue_type_script_lang-0b7357dc.js} +3 -3
  220. package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-decf25ee.js → OrCardCollection.vue_vue_type_script_lang-d1cba987.js} +4 -4
  221. package/dist/bundled/v3/{OrCarousel.vue_vue_type_script_lang-272cb9c9.js → OrCarousel.vue_vue_type_script_lang-cfd11d11.js} +1 -1
  222. package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-a6d72885.js → OrCheckbox.vue_vue_type_script_lang-0fcd7886.js} +1 -1
  223. package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-b1dd62bd.js → OrCheckbox.vue_vue_type_script_lang-579d41cf.js} +1 -1
  224. package/dist/bundled/v3/{OrCheckboxGroup.vue_vue_type_script_lang-b4421b8d.js → OrCheckboxGroup.vue_vue_type_script_lang-bf90c3cc.js} +2 -2
  225. package/dist/bundled/v3/{OrCheckboxTree.vue_vue_type_script_lang-c7beacdf.js → OrCheckboxTree.vue_vue_type_script_lang-96fce5bf.js} +4 -4
  226. package/dist/bundled/v3/{OrChip.vue_vue_type_script_lang-a182e324.js → OrChip.vue_vue_type_script_lang-fcda103b.js} +1 -1
  227. package/dist/bundled/v3/{OrChips.vue_vue_type_script_lang-9e98c258.js → OrChips.vue_vue_type_script_lang-8d26707d.js} +1 -1
  228. package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-22d2a803.js +237 -0
  229. package/dist/bundled/v3/{OrCollapse.vue_vue_type_script_lang-2a5c0929.js → OrCollapse.vue_vue_type_script_lang-00da895c.js} +1 -1
  230. package/dist/bundled/v3/{OrColorPicker.vue_vue_type_script_lang-6143f82f.js → OrColorPicker.vue_vue_type_script_lang-476f49f1.js} +3 -3
  231. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-ac591c04.js → OrConfirm.vue_vue_type_script_lang-39a1bd4d.js} +6 -6
  232. package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-cdd89236.js → OrConfirm.vue_vue_type_script_lang-b7cc200c.js} +6 -6
  233. package/dist/bundled/v3/{OrDatePicker.vue_vue_type_script_lang-b9052966.js → OrDatePicker.vue_vue_type_script_lang-83dd873c.js} +4 -4
  234. package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-111a251e.js → OrDateTimePicker.vue_vue_type_script_lang-77880140.js} +7 -7
  235. package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-741b8048.js → OrDateTimePicker.vue_vue_type_script_lang-77e069a1.js} +5 -5
  236. package/dist/bundled/v3/{OrDateTimePickerMonthSelect-6c5e416a.js → OrDateTimePickerMonthSelect-3348fba1.js} +3 -3
  237. package/dist/bundled/v3/{OrDateTimePickerPopoverHeader-894382f9.js → OrDateTimePickerPopoverHeader-cbe4de91.js} +1 -1
  238. package/dist/bundled/v3/{OrDateTimePickerTimeSelect-b04942c5.js → OrDateTimePickerTimeSelect-c2ad08b5.js} +1 -1
  239. package/dist/bundled/v3/{OrFloating.vue_vue_type_script_lang-d419627c.js → OrFloating.vue_vue_type_script_lang-8bc114e8.js} +1 -1
  240. package/dist/bundled/v3/{OrIcon.vue_vue_type_script_lang-cd2da378.js → OrIcon.vue_vue_type_script_lang-52900ff4.js} +1 -1
  241. package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-d1496a81.js → OrIconButton.vue_vue_type_script_lang-416cbbd3.js} +2 -2
  242. package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-743eb1eb.js → OrIconButton.vue_vue_type_script_lang-a32f0635.js} +1 -1
  243. package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-2df002e8.js → OrInlineInput.vue_vue_type_script_lang-d34f84b1.js} +1 -1
  244. package/dist/bundled/v3/{OrInlineTextEdit.vue_vue_type_script_lang-1e78da3c.js → OrInlineTextEdit.vue_vue_type_script_lang-7955bdac.js} +4 -4
  245. package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-139602f1.js → OrInlineTextarea.vue_vue_type_script_lang-2f0d13e0.js} +1 -1
  246. package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-30a2b358.js → OrInput.vue_vue_type_script_lang-2680e4e1.js} +2 -2
  247. package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-bf9fa981.js → OrInput.vue_vue_type_script_lang-f887102b.js} +2 -2
  248. package/dist/bundled/v3/{OrList.vue_vue_type_script_lang-ccab1c75.js → OrList.vue_vue_type_script_lang-cb8806b2.js} +11 -11
  249. package/dist/bundled/v3/{OrListOfInputs.vue_vue_type_script_lang-32d935ae.js → OrListOfInputs.vue_vue_type_script_lang-14a99046.js} +4 -4
  250. package/dist/bundled/v3/{OrLoader.vue_vue_type_script_lang-c1b5372a.js → OrLoader.vue_vue_type_script_lang-1e4c32ee.js} +1 -1
  251. package/dist/bundled/v3/{OrMenu.vue_vue_type_script_lang-90d57815.js → OrMenu.vue_vue_type_script_lang-2958c018.js} +1 -1
  252. package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-910b80a1.js → OrModal.vue_vue_type_script_lang-a84affbb.js} +2 -2
  253. package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-b716f9f7.js +101 -0
  254. package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-3f6dd187.js → OrNotification.vue_vue_type_script_lang-564035a6.js} +2 -2
  255. package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-f414a938.js → OrNotification.vue_vue_type_script_lang-6d6d3de9.js} +1 -1
  256. package/dist/bundled/v3/{OrNumberInput.vue_vue_type_script_lang-1fb535e6.js → OrNumberInput.vue_vue_type_script_lang-e904d247.js} +1 -1
  257. package/dist/bundled/v3/{OrOverflowMenu.vue_vue_type_script_lang-fb64f2d0.js → OrOverflowMenu.vue_vue_type_script_lang-396e26c0.js} +5 -5
  258. package/dist/bundled/v3/{OrOverlay.vue_vue_type_script_lang-93864f05.js → OrOverlay.vue_vue_type_script_lang-4a4c532b.js} +1 -1
  259. package/dist/bundled/v3/{OrPagination.vue_vue_type_script_lang-4d9cc1c9.js → OrPagination.vue_vue_type_script_lang-d29f6b11.js} +2 -2
  260. package/dist/bundled/v3/{OrPassword.vue_vue_type_script_lang-d8bfee83.js → OrPassword.vue_vue_type_script_lang-ea54f428.js} +3 -3
  261. package/dist/bundled/v3/{OrPopover.vue_vue_type_script_lang-dca9481d.js → OrPopover.vue_vue_type_script_lang-00135a32.js} +2 -2
  262. package/dist/bundled/v3/{OrProgress.vue_vue_type_script_lang-1c15f38e.js → OrProgress.vue_vue_type_script_lang-9c13f877.js} +2 -2
  263. package/dist/bundled/v3/{OrProgress.vue_vue_type_script_lang-a99362ae.js → OrProgress.vue_vue_type_script_lang-d4cf52da.js} +1 -1
  264. package/dist/bundled/v3/{OrRadio.vue_vue_type_script_lang-3a551734.js → OrRadio.vue_vue_type_script_lang-5e642c5f.js} +2 -2
  265. package/dist/bundled/v3/{OrRadioGroup.vue_vue_type_script_lang-5734ced2.js → OrRadioGroup.vue_vue_type_script_lang-4b4d1420.js} +1 -1
  266. package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-9bbcc18a.js +1889 -0
  267. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-ba26f3af.js → OrSearch.vue_vue_type_script_lang-14e7fd28.js} +2 -2
  268. package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-82b7b602.js → OrSearch.vue_vue_type_script_lang-3e7729fe.js} +3 -3
  269. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-a156c8b5.js → OrSelect.vue_vue_type_script_lang-19dc9748.js} +4 -4
  270. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-c9547f1b.js → OrSelect.vue_vue_type_script_lang-5bdf06cb.js} +11 -11
  271. package/dist/bundled/v3/{OrSidebar.vue_vue_type_script_lang-55b5ffb4.js → OrSidebar.vue_vue_type_script_lang-2681fb99.js} +1 -1
  272. package/dist/bundled/v3/{OrSidebar.vue_vue_type_script_lang-3914fce0.js → OrSidebar.vue_vue_type_script_lang-c96d5866.js} +2 -2
  273. package/dist/bundled/v3/{OrSkeletonText.vue_vue_type_script_lang-c2a5ab96.js → OrSkeletonText.vue_vue_type_script_lang-36cfe2f4.js} +1 -1
  274. package/dist/bundled/v3/{OrSkeletonText.vue_vue_type_script_lang-26b3cfd1.js → OrSkeletonText.vue_vue_type_script_lang-5cf21df0.js} +1 -1
  275. package/dist/bundled/v3/{OrSlider.vue_vue_type_script_lang-22cc5cd5.js → OrSlider.vue_vue_type_script_lang-d933ca0c.js} +3 -3
  276. package/dist/bundled/v3/{OrStepper.vue_vue_type_script_lang-67408a1a.js → OrStepper.vue_vue_type_script_lang-d4259c67.js} +1 -1
  277. package/dist/bundled/v3/{OrSwitch.vue_vue_type_script_lang-32427513.js → OrSwitch.vue_vue_type_script_lang-cde58199.js} +1 -1
  278. package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-4c2cecd7.js → OrTabs.vue_vue_type_script_lang-d4356af4.js} +2 -2
  279. package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-ce916e72.js → OrTag.vue_vue_type_script_lang-21f4b080.js} +1 -1
  280. package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-cbb4a16d.js → OrTag.vue_vue_type_script_lang-2e2393a5.js} +1 -1
  281. package/dist/bundled/v3/{OrTags.vue_vue_type_script_lang-1f1278ce.js → OrTags.vue_vue_type_script_lang-dea58dbe.js} +3 -3
  282. package/dist/bundled/v3/{OrTextarea.vue_vue_type_script_lang-1ab55f91.js → OrTextarea.vue_vue_type_script_lang-1585e4e5.js} +2 -2
  283. package/dist/bundled/v3/{OrTextbox.vue_vue_type_script_lang-1ec469f0.js → OrTextbox.vue_vue_type_script_lang-02b1c369.js} +3 -3
  284. package/dist/bundled/v3/{OrTimePicker.vue_vue_type_script_lang-a03960c6.js → OrTimePicker.vue_vue_type_script_lang-77e08a6d.js} +4 -4
  285. package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-592e1632.js → OrToastContainer.vue_vue_type_script_lang-364ee300.js} +1 -1
  286. package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-9f5a5d56.js → OrToastContainer.vue_vue_type_script_lang-b1bb24ab.js} +1 -1
  287. package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-a06d73f0.js → OrTooltip.vue_vue_type_script_lang-05d89296.js} +1 -1
  288. package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-44e9f7e4.js → OrTooltip.vue_vue_type_script_lang-50478e4b.js} +1 -1
  289. package/dist/bundled/{v2/_baseAssignValue-22e630c1.js → v3/_baseAssignValue-008b033a.js} +1 -1
  290. package/dist/bundled/v3/{_baseIsEqual-a1cc156c.js → _baseIsEqual-9edac039.js} +5 -5
  291. package/dist/bundled/v3/_commonjsHelpers-6584e42b.js +11 -0
  292. package/dist/bundled/v3/components/OrAvatar/OrAvatar.js +10 -9
  293. package/dist/bundled/v3/components/OrAvatar/index.js +9 -8
  294. package/dist/bundled/v3/components/OrBottomSheetV3/OrBottomSheet.js +5 -5
  295. package/dist/bundled/v3/components/OrBottomSheetV3/index.js +4 -4
  296. package/dist/bundled/v3/components/OrButtonV2/OrButton.js +10 -9
  297. package/dist/bundled/v3/components/OrButtonV2/index.js +11 -10
  298. package/dist/bundled/v3/components/OrButtonV3/OrButton.js +5 -5
  299. package/dist/bundled/v3/components/OrButtonV3/index.js +4 -4
  300. package/dist/bundled/v3/components/OrCardCollection/OrCardCollection.js +16 -15
  301. package/dist/bundled/v3/components/OrCardCollection/index.js +15 -14
  302. package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +14 -14
  303. package/dist/bundled/v3/components/OrCardCollectionV3/index.js +13 -13
  304. package/dist/bundled/v3/components/OrCarousel/OrCarousel.js +10 -9
  305. package/dist/bundled/v3/components/OrCarousel/index.js +9 -8
  306. package/dist/bundled/v3/components/OrCheckbox/OrCheckbox.js +10 -9
  307. package/dist/bundled/v3/components/OrCheckbox/index.js +9 -8
  308. package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.js +8 -8
  309. package/dist/bundled/v3/components/OrCheckboxGroupV3/index.js +7 -7
  310. package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.js +7 -7
  311. package/dist/bundled/v3/components/OrCheckboxTreeV3/index.js +6 -6
  312. package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.js +4 -4
  313. package/dist/bundled/v3/components/OrCheckboxV3/index.js +3 -3
  314. package/dist/bundled/v3/components/OrChip/OrChip.js +10 -9
  315. package/dist/bundled/v3/components/OrChip/index.js +9 -8
  316. package/dist/bundled/v3/components/OrChips/OrChips.js +11 -10
  317. package/dist/bundled/v3/components/OrChips/index.js +10 -9
  318. package/dist/bundled/v3/components/OrCode/OrCode.js +22 -17
  319. package/dist/bundled/v3/components/OrCode/index.js +20 -15
  320. package/dist/bundled/v3/components/OrCode/lang.js +3941 -3
  321. package/dist/bundled/v3/components/OrCode/theme.js +2 -1
  322. package/dist/bundled/v3/components/OrCollapse/OrCollapse.js +8 -7
  323. package/dist/bundled/v3/components/OrCollapse/index.js +7 -6
  324. package/dist/bundled/v3/components/OrColorPicker/OrColorPicker.js +11 -10
  325. package/dist/bundled/v3/components/OrColorPicker/index.js +10 -9
  326. package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +20 -18
  327. package/dist/bundled/v3/components/OrConfirm/index.js +19 -17
  328. package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +13 -13
  329. package/dist/bundled/v3/components/OrConfirmV3/index.js +12 -12
  330. package/dist/bundled/v3/components/OrDatePickerV3/OrDatePicker.js +14 -14
  331. package/dist/bundled/v3/components/OrDatePickerV3/index.js +13 -13
  332. package/dist/bundled/v3/components/OrDateTimePicker/OrDateTimePicker.js +17 -16
  333. package/dist/bundled/v3/components/OrDateTimePicker/index.js +16 -15
  334. package/dist/bundled/v3/components/OrDateTimePickerV3/OrDateTimePicker.js +15 -15
  335. package/dist/bundled/v3/components/OrDateTimePickerV3/index.js +14 -14
  336. package/dist/bundled/v3/components/OrFloating/OrFloating.js +8 -7
  337. package/dist/bundled/v3/components/OrFloating/index.js +7 -6
  338. package/dist/bundled/v3/components/OrIcon/OrIcon.js +9 -8
  339. package/dist/bundled/v3/components/OrIcon/index.js +8 -7
  340. package/dist/bundled/v3/components/OrIconButtonV2/OrIconButton.js +11 -10
  341. package/dist/bundled/v3/components/OrIconButtonV2/index.js +10 -9
  342. package/dist/bundled/v3/components/OrIconButtonV3/OrIconButton.js +8 -8
  343. package/dist/bundled/v3/components/OrIconButtonV3/index.js +7 -7
  344. package/dist/bundled/v3/components/OrInlineInputV3/OrInlineInput.js +9 -9
  345. package/dist/bundled/v3/components/OrInlineInputV3/index.js +8 -8
  346. package/dist/bundled/v3/components/OrInlineTextEdit/OrInlineTextEdit.js +15 -14
  347. package/dist/bundled/v3/components/OrInlineTextEdit/index.js +14 -13
  348. package/dist/bundled/v3/components/OrInlineTextareaV3/OrInlineTextarea.js +9 -9
  349. package/dist/bundled/v3/components/OrInlineTextareaV3/index.js +8 -8
  350. package/dist/bundled/v3/components/OrInput/OrInput.js +9 -8
  351. package/dist/bundled/v3/components/OrInput/index.js +8 -7
  352. package/dist/bundled/v3/components/OrInputV3/OrInput.js +10 -10
  353. package/dist/bundled/v3/components/OrInputV3/index.js +9 -9
  354. package/dist/bundled/v3/components/OrList/OrList.js +17 -16
  355. package/dist/bundled/v3/components/OrList/index.js +16 -15
  356. package/dist/bundled/v3/components/OrListOfInputs/OrListOfInputs.js +20 -19
  357. package/dist/bundled/v3/components/OrListOfInputs/index.js +19 -18
  358. package/dist/bundled/v3/components/OrLoaderV3/OrLoader.js +4 -4
  359. package/dist/bundled/v3/components/OrLoaderV3/index.js +3 -3
  360. package/dist/bundled/v3/components/OrMenuV3/OrMenu.js +7 -7
  361. package/dist/bundled/v3/components/OrMenuV3/index.js +6 -6
  362. package/dist/bundled/v3/components/OrModal/OrModal.js +15 -13
  363. package/dist/bundled/v3/components/OrModal/index.js +14 -12
  364. package/dist/bundled/v3/components/OrModalV3/OrModal.js +9 -9
  365. package/dist/bundled/v3/components/OrModalV3/index.js +8 -8
  366. package/dist/bundled/v3/components/OrNotification/OrNotification.js +12 -11
  367. package/dist/bundled/v3/components/OrNotification/index.js +11 -10
  368. package/dist/bundled/v3/components/OrNotificationV3/OrNotification.js +9 -9
  369. package/dist/bundled/v3/components/OrNotificationV3/index.js +8 -8
  370. package/dist/bundled/v3/components/OrNumberInput/OrNumberInput.js +10 -9
  371. package/dist/bundled/v3/components/OrNumberInput/index.js +9 -8
  372. package/dist/bundled/v3/components/OrOverflowMenu/OrOverflowMenu.js +15 -14
  373. package/dist/bundled/v3/components/OrOverflowMenu/index.js +14 -13
  374. package/dist/bundled/v3/components/OrOverlayV3/OrOverlay.js +4 -4
  375. package/dist/bundled/v3/components/OrOverlayV3/index.js +3 -3
  376. package/dist/bundled/v3/components/OrPaginationV3/OrPagination.js +10 -10
  377. package/dist/bundled/v3/components/OrPaginationV3/index.js +9 -9
  378. package/dist/bundled/v3/components/OrPassword/OrPassword.js +16 -15
  379. package/dist/bundled/v3/components/OrPassword/index.js +15 -14
  380. package/dist/bundled/v3/components/OrPopoverV3/OrPopover.js +6 -6
  381. package/dist/bundled/v3/components/OrPopoverV3/index.js +5 -5
  382. package/dist/bundled/v3/components/OrProgress/OrProgress.js +8 -7
  383. package/dist/bundled/v3/components/OrProgress/index.js +7 -6
  384. package/dist/bundled/v3/components/OrProgressV3/OrProgress.js +10 -9
  385. package/dist/bundled/v3/components/OrProgressV3/index.js +9 -8
  386. package/dist/bundled/v3/components/OrRadio/OrRadio.js +10 -9
  387. package/dist/bundled/v3/components/OrRadio/index.js +9 -8
  388. package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.js +4 -4
  389. package/dist/bundled/v3/components/OrRadioGroupV3/index.js +3 -3
  390. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +286 -0
  391. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +220 -0
  392. package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +2 -0
  393. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +89 -0
  394. package/dist/bundled/v3/components/OrRichTextEditorV3/props.d.ts +4 -0
  395. package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +7 -0
  396. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +6 -0
  397. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +38 -0
  398. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
  399. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +46 -0
  400. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
  401. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
  402. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
  403. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
  404. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
  405. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
  406. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
  407. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
  408. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
  409. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +6 -0
  410. package/dist/bundled/v3/components/OrSearch/OrSearch.js +15 -14
  411. package/dist/bundled/v3/components/OrSearch/index.js +14 -13
  412. package/dist/bundled/v3/components/OrSearchV3/OrSearch.js +11 -11
  413. package/dist/bundled/v3/components/OrSearchV3/index.js +10 -10
  414. package/dist/bundled/v3/components/OrSelect/OrSelect.js +17 -16
  415. package/dist/bundled/v3/components/OrSelect/index.js +16 -15
  416. package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +13 -13
  417. package/dist/bundled/v3/components/OrSelectV3/index.js +12 -12
  418. package/dist/bundled/v3/components/OrSidebar/OrSidebar.js +4 -4
  419. package/dist/bundled/v3/components/OrSidebar/index.js +3 -3
  420. package/dist/bundled/v3/components/OrSidebarV3/OrSidebar.js +9 -9
  421. package/dist/bundled/v3/components/OrSidebarV3/index.js +8 -8
  422. package/dist/bundled/v3/components/OrSkeleton/index.js +7 -6
  423. package/dist/bundled/v3/components/OrSkeletonText/OrSkeletonText.js +8 -7
  424. package/dist/bundled/v3/components/OrSkeletonText/index.js +7 -6
  425. package/dist/bundled/v3/components/OrSkeletonTextV3/OrSkeletonText.js +8 -7
  426. package/dist/bundled/v3/components/OrSkeletonTextV3/index.js +7 -6
  427. package/dist/bundled/v3/components/OrSkeletonV3/index.js +7 -6
  428. package/dist/bundled/v3/components/OrSlider/OrSlider.js +12 -11
  429. package/dist/bundled/v3/components/OrSlider/index.js +11 -10
  430. package/dist/bundled/v3/components/OrStepper/OrStepper.js +11 -10
  431. package/dist/bundled/v3/components/OrStepper/index.js +10 -9
  432. package/dist/bundled/v3/components/OrSwitchV3/OrSwitch.js +5 -5
  433. package/dist/bundled/v3/components/OrSwitchV3/index.js +4 -4
  434. package/dist/bundled/v3/components/OrTabsV3/OrTabs.js +8 -8
  435. package/dist/bundled/v3/components/OrTabsV3/index.js +7 -7
  436. package/dist/bundled/v3/components/OrTag/OrTag.js +10 -9
  437. package/dist/bundled/v3/components/OrTag/index.js +9 -8
  438. package/dist/bundled/v3/components/OrTagV3/OrTag.js +9 -9
  439. package/dist/bundled/v3/components/OrTagV3/index.js +8 -8
  440. package/dist/bundled/v3/components/OrTagsV3/OrTags.js +12 -12
  441. package/dist/bundled/v3/components/OrTagsV3/index.js +11 -11
  442. package/dist/bundled/v3/components/OrTextarea/OrTextarea.js +9 -8
  443. package/dist/bundled/v3/components/OrTextarea/index.js +8 -7
  444. package/dist/bundled/v3/components/OrTextbox/OrTextbox.js +13 -12
  445. package/dist/bundled/v3/components/OrTextbox/index.js +12 -11
  446. package/dist/bundled/v3/components/OrTimePickerV3/OrTimePicker.js +13 -13
  447. package/dist/bundled/v3/components/OrTimePickerV3/index.js +12 -12
  448. package/dist/bundled/v3/components/OrToast/OrToast.js +14 -13
  449. package/dist/bundled/v3/components/OrToast/Timer.js +1 -1
  450. package/dist/bundled/v3/components/OrToast/composable/index.js +2 -2
  451. package/dist/bundled/v3/components/OrToast/composable/useToast.js +2 -2
  452. package/dist/bundled/v3/components/OrToast/composable/useToastEventBus.js +2 -2
  453. package/dist/bundled/v3/components/OrToast/index.js +17 -16
  454. package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.js +18 -17
  455. package/dist/bundled/v3/components/OrToastContainer/index.js +17 -16
  456. package/dist/bundled/v3/components/OrToastContainerV3/OrToastContainer.js +10 -10
  457. package/dist/bundled/v3/components/OrToastContainerV3/index.js +9 -9
  458. package/dist/bundled/v3/components/OrToastV3/OrToast.js +8 -8
  459. package/dist/bundled/v3/components/OrToastV3/Timer.js +1 -1
  460. package/dist/bundled/v3/components/OrToastV3/composable/index.js +2 -2
  461. package/dist/bundled/v3/components/OrToastV3/composable/useToast.js +2 -2
  462. package/dist/bundled/v3/components/OrToastV3/composable/useToastEventBus.js +2 -2
  463. package/dist/bundled/v3/components/OrToastV3/index.js +9 -9
  464. package/dist/bundled/v3/components/OrTooltip/OrTooltip.js +9 -8
  465. package/dist/bundled/v3/components/OrTooltip/index.js +8 -7
  466. package/dist/bundled/v3/components/OrTooltipV3/OrTooltip.js +7 -7
  467. package/dist/bundled/v3/components/OrTooltipV3/index.js +6 -6
  468. package/dist/bundled/v3/components/index.d.ts +1 -0
  469. package/dist/bundled/v3/components/index.js +107 -91
  470. package/dist/bundled/{v2/dom-700444b4.js → v3/dom-c98dce89.js} +2 -2
  471. package/dist/bundled/v3/{eq-95cd2573.js → eq-037e6fce.js} +1 -1
  472. package/dist/bundled/{v2/get-ab1b7d93.js → v3/get-b30afe93.js} +3 -3
  473. package/dist/bundled/v3/hooks/index.d.ts +1 -0
  474. package/dist/bundled/v3/hooks/index.js +6 -2
  475. package/dist/bundled/v3/hooks/useOverflow.d.ts +2 -2
  476. package/dist/bundled/v3/hooks/useOverflow.js +2 -2
  477. package/dist/bundled/v3/hooks/usePopoverState.js +1 -1
  478. package/dist/bundled/v3/hooks/useResponsive/index.js +2 -2
  479. package/dist/bundled/v3/hooks/useResponsive/useResponsive.js +2 -2
  480. package/dist/bundled/v3/hooks/useTheme.d.ts +2 -0
  481. package/dist/bundled/v3/hooks/useTheme.js +10125 -0
  482. package/dist/bundled/v3/{index-cf2c3c27.js → index-0d224ae5.js} +3 -115
  483. package/dist/bundled/v3/{index-5e8e7a46.js → index-40b35d94.js} +1 -1
  484. package/dist/bundled/v3/{index-51eb57bd.js → index-749f3444.js} +1 -1
  485. package/dist/bundled/v3/index-80a3a4f4.js +9714 -0
  486. package/dist/bundled/v3/index-85c2efe8.js +7122 -0
  487. package/dist/bundled/v3/{index-02705c13.js → index-ae815a7e.js} +2 -2
  488. package/dist/bundled/v3/index-d92d0b48.js +3805 -0
  489. package/dist/bundled/v3/{lang-0fb8f78b.js → index-e9f6b2d8.js} +73 -4009
  490. package/dist/bundled/v3/index.es-3f39f316.js +115 -0
  491. package/dist/bundled/v3/index.js +113 -94
  492. package/dist/bundled/v3/{isArrayLike-e46b8eac.js → isArrayLike-61275a05.js} +1 -1
  493. package/dist/bundled/v3/{isEqual-44382965.js → isEqual-8bbb1110.js} +1 -1
  494. package/dist/bundled/{v2/isObject-fe8b81fd.js → v3/isObject-08fab135.js} +1 -1
  495. package/dist/bundled/v3/markdown-c78b4891.js +17977 -0
  496. package/dist/bundled/{v2/range-6f26eda4.js → v3/range-637f1361.js} +4 -4
  497. package/dist/bundled/{v2/round-f34440f4.js → v3/round-4a894f03.js} +4 -4
  498. package/dist/bundled/{v2/toFinite-74227610.js → v3/toFinite-675db18a.js} +1 -1
  499. package/dist/bundled/v3/{toInteger-2fd112a9.js → toInteger-27595771.js} +1 -1
  500. package/dist/bundled/{v2/toString-f3196832.js → v3/toString-a72d5149.js} +1 -1
  501. package/dist/bundled/v3/useFocusTrap-a61a80ac.js +1349 -0
  502. package/dist/bundled/v3/utils/functions/dom.js +6 -5
  503. package/dist/esm/v2/{OrBottomSheet-0592ccb2.js → OrBottomSheet-4244ab1c.js} +3 -1
  504. package/dist/esm/v2/{OrCardCollection-2b9bc050.js → OrCardCollection-20e66b6e.js} +4 -4
  505. package/dist/esm/v2/{OrCheckbox-3a8c93ad.js → OrCheckbox-41f2822d.js} +2 -0
  506. package/dist/esm/v2/{OrCheckboxGroup-b0d95dd6.js → OrCheckboxGroup-97cfcbda.js} +1 -1
  507. package/dist/esm/v2/{OrCheckboxTree-54b0fdc1.js → OrCheckboxTree-a7dc126c.js} +1 -1
  508. package/dist/esm/v2/{OrConfirm-3f19c23b.js → OrConfirm-65cc835a.js} +4 -2
  509. package/dist/esm/v2/{OrDatePicker-e991e7b2.js → OrDatePicker-9fb8810c.js} +3 -3
  510. package/dist/esm/v2/{OrDateTimePicker-7bbd81d1.js → OrDateTimePicker-4032b280.js} +3 -3
  511. package/dist/esm/v2/{OrDateTimePickerMonthSelect-d75a849c.js → OrDateTimePickerMonthSelect-a50f9f56.js} +3 -3
  512. package/dist/esm/v2/{OrIconButton-75972865.js → OrIconButton-24be052f.js} +2 -2
  513. package/dist/esm/v2/{OrInlineInput-cf17dbb2.js → OrInlineInput-dd95fc1b.js} +3 -1
  514. package/dist/esm/v2/{OrInlineTextarea-2b0e2f39.js → OrInlineTextarea-194515fa.js} +3 -1
  515. package/dist/esm/v2/{OrInput-1a2b8ad9.js → OrInput-bfbb6522.js} +3 -1
  516. package/dist/esm/v2/{OrMenu-a35caf3b.js → OrMenu-a376f4a7.js} +3 -1
  517. package/dist/esm/v2/{OrModal-4aaae6bc.js → OrModal-e6acc87a.js} +4 -2
  518. package/dist/esm/v2/{OrNotification-a773f1df.js → OrNotification-650aab04.js} +1 -1
  519. package/dist/esm/v2/{OrOverlay-f791976c.js → OrOverlay-948346df.js} +2 -0
  520. package/dist/esm/v2/{OrPagination-3513165d.js → OrPagination-7be2401b.js} +4 -2
  521. package/dist/esm/v2/{OrPassword-1de0dc6c.js → OrPassword-681f8c53.js} +2 -0
  522. package/dist/esm/v2/{OrPopover-a8950b85.js → OrPopover-fff4a3a4.js} +3 -1
  523. package/dist/esm/v2/{OrProgress-102e3b5d.js → OrProgress-e079e857.js} +2 -0
  524. package/dist/esm/v2/{OrRadio-a812088f.js → OrRadio-23810acd.js} +2 -0
  525. package/dist/esm/v2/{OrRadioGroup-0de37d76.js → OrRadioGroup-0e1bf22c.js} +1 -1
  526. package/dist/esm/v2/OrRichTextEditor-c13801ba.js +919 -0
  527. package/dist/esm/v2/{OrSearch-19c157b3.js → OrSearch-9027a8e2.js} +1 -1
  528. package/dist/esm/v2/{OrSelect-991b8be3.js → OrSelect-b7e9eaa7.js} +6 -4
  529. package/dist/esm/v2/{OrSidebar-bfbb8b0a.js → OrSidebar-466d8244.js} +1 -1
  530. package/dist/esm/v2/{OrSidebarCollapseButton-a98037d6.js → OrSidebarCollapseButton-3009ed8e.js} +1 -1
  531. package/dist/esm/v2/{OrSwitch-9fae0bae.js → OrSwitch-cb97f4d3.js} +2 -0
  532. package/dist/esm/v2/{OrTabs-abf290af.js → OrTabs-cce59ff2.js} +2 -2
  533. package/dist/esm/v2/{OrTag-aa46cecd.js → OrTag-6a60ef87.js} +1 -1
  534. package/dist/esm/v2/{OrTags-2a567e79.js → OrTags-e4d6bf08.js} +4 -2
  535. package/dist/esm/v2/{OrTextarea-e5c66426.js → OrTextarea-01df0715.js} +2 -0
  536. package/dist/esm/v2/{OrTextbox-c85d7fe6.js → OrTextbox-a937432f.js} +2 -0
  537. package/dist/esm/v2/{OrTimePicker-766637cb.js → OrTimePicker-7cbcc2c0.js} +2 -2
  538. package/dist/esm/v2/{OrTooltip-0dc63c1a.js → OrTooltip-ab6c05c5.js} +3 -1
  539. package/dist/esm/v2/codemirrorView-be2c7423.js +353 -0
  540. package/dist/esm/v2/components/index.d.ts +1 -0
  541. package/dist/esm/v2/components/index.js +62 -36
  542. package/dist/esm/v2/components/or-bottom-sheet-v3/index.js +4 -2
  543. package/dist/esm/v2/components/or-card-collection-v3/index.js +11 -9
  544. package/dist/esm/v2/components/or-checkbox-group-v3/index.js +5 -3
  545. package/dist/esm/v2/components/or-checkbox-tree-v3/index.js +4 -2
  546. package/dist/esm/v2/components/or-checkbox-v3/index.js +3 -1
  547. package/dist/esm/v2/components/or-confirm-v3/index.js +9 -7
  548. package/dist/esm/v2/components/or-date-picker-v3/index.js +10 -8
  549. package/dist/esm/v2/components/or-date-time-picker-v3/index.js +10 -8
  550. package/dist/esm/v2/components/or-icon-button-v3/index.js +7 -5
  551. package/dist/esm/v2/components/or-inline-input-v3/index.js +8 -6
  552. package/dist/esm/v2/components/or-inline-textarea-v3/index.js +8 -6
  553. package/dist/esm/v2/components/or-input-v3/index.js +8 -6
  554. package/dist/esm/v2/components/or-menu-v3/index.js +6 -4
  555. package/dist/esm/v2/components/or-modal-v3/index.js +8 -6
  556. package/dist/esm/v2/components/or-notification-v3/index.js +8 -6
  557. package/dist/esm/v2/components/or-overlay-v3/index.js +3 -1
  558. package/dist/esm/v2/components/or-pagination-v3/index.js +7 -5
  559. package/dist/esm/v2/components/or-password/index.js +3 -1
  560. package/dist/esm/v2/components/or-popover-v3/index.js +5 -3
  561. package/dist/esm/v2/components/or-progress-v3/index.js +3 -1
  562. package/dist/esm/v2/components/or-radio-group-v3/index.js +4 -2
  563. package/dist/esm/v2/components/or-radio-v3/index.js +3 -1
  564. package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +220 -0
  565. package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +2 -0
  566. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +62 -0
  567. package/dist/esm/v2/components/or-rich-text-editor-v3/props.d.ts +4 -0
  568. package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +6 -0
  569. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
  570. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
  571. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
  572. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
  573. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
  574. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
  575. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
  576. package/dist/esm/v2/components/or-search-v3/index.js +9 -7
  577. package/dist/esm/v2/components/or-select-v3/index.js +11 -9
  578. package/dist/esm/v2/components/or-sidebar-v3/index.js +9 -7
  579. package/dist/esm/v2/components/or-sidebar-v3/partials/index.js +8 -6
  580. package/dist/esm/v2/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +8 -6
  581. package/dist/esm/v2/components/or-switch-v3/index.js +3 -1
  582. package/dist/esm/v2/components/or-tabs-v3/index.js +7 -5
  583. package/dist/esm/v2/components/or-tag-v3/index.js +8 -6
  584. package/dist/esm/v2/components/or-tags-v3/index.js +9 -7
  585. package/dist/esm/v2/components/or-textarea-v3/index.js +3 -1
  586. package/dist/esm/v2/components/or-textbox/index.js +3 -1
  587. package/dist/esm/v2/components/or-time-picker-v3/index.js +8 -6
  588. package/dist/esm/v2/components/or-toast-v3/index.js +8 -6
  589. package/dist/esm/v2/components/or-toast-v3/or-toast-container-v3/index.js +8 -6
  590. package/dist/esm/v2/components/or-tooltip-v3/index.js +6 -4
  591. package/dist/esm/v2/hooks/index.d.ts +1 -0
  592. package/dist/esm/v2/hooks/index.js +3 -0
  593. package/dist/esm/v2/hooks/useOverflow.d.ts +2 -2
  594. package/dist/esm/v2/hooks/useTheme.d.ts +2 -0
  595. package/dist/esm/v2/index.js +63 -36
  596. package/dist/esm/v2/{types-f30860ee.js → types-08ab4707.js} +3 -1
  597. package/dist/esm/v2/useTheme-e23d13c8.js +9 -0
  598. package/dist/esm/v3/{OrBottomSheet-a39fb331.js → OrBottomSheet-e9463e4d.js} +3 -1
  599. package/dist/esm/v3/{OrCardCollection-3d652a34.js → OrCardCollection-dbe7dac6.js} +4 -4
  600. package/dist/esm/v3/{OrCheckbox-7093e9c2.js → OrCheckbox-2194e473.js} +2 -0
  601. package/dist/esm/v3/{OrCheckboxGroup-f755d216.js → OrCheckboxGroup-6c36527f.js} +1 -1
  602. package/dist/esm/v3/{OrCheckboxTree-99f6eaec.js → OrCheckboxTree-1873a941.js} +1 -1
  603. package/dist/esm/v3/{OrConfirm-cb0b2b78.js → OrConfirm-104754d0.js} +4 -2
  604. package/dist/esm/v3/{OrDatePicker-6a44ad41.js → OrDatePicker-c12fab59.js} +3 -3
  605. package/dist/esm/v3/{OrDateTimePicker-2cbcf8c7.js → OrDateTimePicker-ad360ebc.js} +3 -3
  606. package/dist/esm/v3/{OrDateTimePickerMonthSelect-2f61d92f.js → OrDateTimePickerMonthSelect-16e3f5b9.js} +3 -3
  607. package/dist/esm/v3/{OrIconButton-e34a20eb.js → OrIconButton-c6d15a51.js} +2 -2
  608. package/dist/esm/v3/{OrInlineInput-ad0d4264.js → OrInlineInput-48e936d2.js} +3 -1
  609. package/dist/esm/v3/{OrInlineTextarea-b5ec488d.js → OrInlineTextarea-3937421c.js} +3 -1
  610. package/dist/esm/v3/{OrInput-a9aeef6e.js → OrInput-14b88801.js} +3 -1
  611. package/dist/esm/v3/{OrMenu-f590d761.js → OrMenu-b90e6784.js} +3 -1
  612. package/dist/esm/v3/{OrModal-9dc09e95.js → OrModal-231fb401.js} +4 -2
  613. package/dist/esm/v3/{OrNotification-69031471.js → OrNotification-dde92a43.js} +1 -1
  614. package/dist/esm/v3/{OrOverlay-28952099.js → OrOverlay-489fdf76.js} +2 -0
  615. package/dist/esm/v3/{OrPagination-f3be120f.js → OrPagination-22356f86.js} +4 -2
  616. package/dist/esm/v3/{OrPassword-9192b9ea.js → OrPassword-cd8a3c46.js} +2 -0
  617. package/dist/esm/v3/{OrPopover-ebd57053.js → OrPopover-8ea2062a.js} +3 -1
  618. package/dist/esm/v3/{OrProgress-efa51d7b.js → OrProgress-a54a42c0.js} +2 -0
  619. package/dist/esm/v3/{OrRadio-a6c88f29.js → OrRadio-4f0026c9.js} +2 -0
  620. package/dist/esm/v3/{OrRadioGroup-5d1fe6fd.js → OrRadioGroup-d215409c.js} +1 -1
  621. package/dist/esm/v3/OrRichTextEditor-b7f30172.js +852 -0
  622. package/dist/esm/v3/{OrSearch-5576cf14.js → OrSearch-7bf5009e.js} +1 -1
  623. package/dist/esm/v3/{OrSelect-0b3ebce9.js → OrSelect-b7d87ded.js} +6 -4
  624. package/dist/esm/v3/{OrSidebar-303ef558.js → OrSidebar-84533704.js} +1 -1
  625. package/dist/esm/v3/{OrSidebarCollapseButton-d7f004df.js → OrSidebarCollapseButton-88a165e8.js} +1 -1
  626. package/dist/esm/v3/{OrSwitch-594f5a63.js → OrSwitch-ed9868db.js} +2 -0
  627. package/dist/esm/v3/{OrTabs-b6c8077c.js → OrTabs-ffb69679.js} +2 -2
  628. package/dist/esm/v3/{OrTag-4ac45254.js → OrTag-51d8f47d.js} +1 -1
  629. package/dist/esm/v3/{OrTags-de9f065e.js → OrTags-3ae4a908.js} +4 -2
  630. package/dist/esm/v3/{OrTextarea-93cf7da7.js → OrTextarea-0f9a2a27.js} +2 -0
  631. package/dist/esm/v3/{OrTextbox-56714f51.js → OrTextbox-8d2903db.js} +2 -0
  632. package/dist/esm/v3/{OrTimePicker-0fe72767.js → OrTimePicker-16a88b67.js} +2 -2
  633. package/dist/esm/v3/{OrTooltip-edb28095.js → OrTooltip-9a63f445.js} +3 -1
  634. package/dist/esm/v3/codemirrorView-be2c7423.js +353 -0
  635. package/dist/esm/v3/components/index.d.ts +1 -0
  636. package/dist/esm/v3/components/index.js +62 -36
  637. package/dist/esm/v3/components/or-bottom-sheet-v3/index.js +4 -2
  638. package/dist/esm/v3/components/or-card-collection-v3/index.js +11 -9
  639. package/dist/esm/v3/components/or-checkbox-group-v3/index.js +5 -3
  640. package/dist/esm/v3/components/or-checkbox-tree-v3/index.js +4 -2
  641. package/dist/esm/v3/components/or-checkbox-v3/index.js +3 -1
  642. package/dist/esm/v3/components/or-confirm-v3/index.js +9 -7
  643. package/dist/esm/v3/components/or-date-picker-v3/index.js +10 -8
  644. package/dist/esm/v3/components/or-date-time-picker-v3/index.js +10 -8
  645. package/dist/esm/v3/components/or-icon-button-v3/index.js +7 -5
  646. package/dist/esm/v3/components/or-inline-input-v3/index.js +8 -6
  647. package/dist/esm/v3/components/or-inline-textarea-v3/index.js +8 -6
  648. package/dist/esm/v3/components/or-input-v3/index.js +8 -6
  649. package/dist/esm/v3/components/or-menu-v3/index.js +6 -4
  650. package/dist/esm/v3/components/or-modal-v3/index.js +8 -6
  651. package/dist/esm/v3/components/or-notification-v3/index.js +8 -6
  652. package/dist/esm/v3/components/or-overlay-v3/index.js +3 -1
  653. package/dist/esm/v3/components/or-pagination-v3/index.js +7 -5
  654. package/dist/esm/v3/components/or-password/index.js +3 -1
  655. package/dist/esm/v3/components/or-popover-v3/index.js +5 -3
  656. package/dist/esm/v3/components/or-progress-v3/index.js +3 -1
  657. package/dist/esm/v3/components/or-radio-group-v3/index.js +4 -2
  658. package/dist/esm/v3/components/or-radio-v3/index.js +3 -1
  659. package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +220 -0
  660. package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +2 -0
  661. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +60 -0
  662. package/dist/esm/v3/components/or-rich-text-editor-v3/props.d.ts +4 -0
  663. package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +6 -0
  664. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
  665. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
  666. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
  667. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
  668. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
  669. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
  670. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
  671. package/dist/esm/v3/components/or-search-v3/index.js +9 -7
  672. package/dist/esm/v3/components/or-select-v3/index.js +11 -9
  673. package/dist/esm/v3/components/or-sidebar-v3/index.js +9 -7
  674. package/dist/esm/v3/components/or-sidebar-v3/partials/index.js +8 -6
  675. package/dist/esm/v3/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +8 -6
  676. package/dist/esm/v3/components/or-switch-v3/index.js +3 -1
  677. package/dist/esm/v3/components/or-tabs-v3/index.js +7 -5
  678. package/dist/esm/v3/components/or-tag-v3/index.js +8 -6
  679. package/dist/esm/v3/components/or-tags-v3/index.js +9 -7
  680. package/dist/esm/v3/components/or-textarea-v3/index.js +3 -1
  681. package/dist/esm/v3/components/or-textbox/index.js +3 -1
  682. package/dist/esm/v3/components/or-time-picker-v3/index.js +8 -6
  683. package/dist/esm/v3/components/or-toast-v3/index.js +8 -6
  684. package/dist/esm/v3/components/or-toast-v3/or-toast-container-v3/index.js +8 -6
  685. package/dist/esm/v3/components/or-tooltip-v3/index.js +6 -4
  686. package/dist/esm/v3/hooks/index.d.ts +1 -0
  687. package/dist/esm/v3/hooks/index.js +3 -0
  688. package/dist/esm/v3/hooks/useOverflow.d.ts +2 -2
  689. package/dist/esm/v3/hooks/useTheme.d.ts +2 -0
  690. package/dist/esm/v3/index.js +63 -36
  691. package/dist/esm/v3/{types-60f3dd35.js → types-03758078.js} +3 -1
  692. package/dist/esm/v3/useTheme-e23d13c8.js +9 -0
  693. package/package.json +26 -4
  694. package/src/components/index.ts +1 -0
  695. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +761 -0
  696. package/src/components/or-rich-text-editor-v3/index.ts +2 -0
  697. package/src/components/or-rich-text-editor-v3/props.ts +4 -0
  698. package/src/components/or-rich-text-editor-v3/styles.ts +53 -0
  699. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +40 -0
  700. package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +254 -0
  701. package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +1 -0
  702. package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +213 -0
  703. package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +22 -0
  704. package/src/components/or-rich-text-editor-v3/utils/markdown.ts +120 -0
  705. package/src/hooks/index.ts +1 -0
  706. package/src/hooks/useElevation.ts +1 -4
  707. package/src/hooks/useOverflow.ts +3 -5
  708. package/src/hooks/useTheme.ts +7 -0
  709. package/src/shims-mdx.d.ts +4 -0
  710. package/src/shims-png.d.ts +2 -2
  711. package/src/shims-vue.d.ts +3 -2
  712. package/src/shims.d.ts +11 -2
  713. /package/dist/bundled/v2/{OrDateTimePickerMonthSelect-769685bc.js → OrDateTimePickerMonthSelect-eb2c5c01.js} +0 -0
  714. /package/dist/bundled/v2/{OrDateTimePickerPopoverHeader-bc0df38f.js → OrDateTimePickerPopoverHeader-257ef8d8.js} +0 -0
  715. /package/dist/bundled/v2/{OrDateTimePickerTimeSelect-e284797b.js → OrDateTimePickerTimeSelect-37dcd0a3.js} +0 -0
@@ -1,9 +1,10 @@
1
- import { E as EditorView, F as Facet, c as combineConfig, S as StateField, a as EditorSelection, T as Transaction, C as ChangeSet, b as ChangeDesc, I as IndentContext, g as getIndentation, i as indentString, d as Text, e as indentUnit, f as countColumn, h as getIndentUnit, A as Annotation, j as StateEffect, m as matchBrackets, s as syntaxTree, N as NodeProp, D as Direction, k as findClusterBreak, V as ViewPlugin, l as Decoration, n as codePointAt, o as codePointSize, p as getPanel, q as CharCategory, P as Prec, r as fromCodePoint, t as showPanel, R as RangeSetBuilder, u as EditorState, v as runScopeHandlers, w as hoverTooltip, W as WidgetType, x as logException, y as lineNumbers, z as highlightActiveLineGutter, B as highlightSpecialChars, G as foldGutter, H as drawSelection, J as dropCursor, K as indentOnInput, L as syntaxHighlighting, M as defaultHighlightStyle, O as bracketMatching, Q as rectangularSelection, U as crosshairCursor, X as highlightActiveLine, Y as keymap, Z as foldKeymap } from '../../index-cf2c3c27.js';
2
- import { c as closeBrackets, a as autocompletion, b as closeBracketsKeymap, d as completionKeymap, l as languages } from '../../lang-0fb8f78b.js';
3
- import { a as useElementHover } from '../../index-6d94f832.js';
1
+ import { E as EditorView, a as EditorState, k as keymap } from '../../index-0d224ae5.js';
2
+ import { b as basicSetup, i as indentWithTab } from '../../index-d92d0b48.js';
3
+ import { a as useElementHover } from '../../index-af414338.js';
4
4
  import { defineComponent, ref } from 'vue-demi';
5
5
  import __vue_component__$3 from '../OrTeleport/OrTeleport.js';
6
6
  import { OrCodeLanguages } from './constants.js';
7
+ import languages from './lang.js';
7
8
  import theme from './theme.js';
8
9
  import __vue_component__$1 from '../OrIconButtonV2/OrIconButton.js';
9
10
  import __vue_component__$2 from '../OrModal/OrModal.js';
@@ -12,7 +13,9 @@ import __vue_component__$5 from '../OrHint/OrHint.js';
12
13
  import __vue_component__$6 from '../OrLabel/OrLabel.js';
13
14
  import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
14
15
  import { n as normalizeComponent } from '../../normalize-component-6e8e3d80.js';
15
- import '../../index-8a1b5b9c.js';
16
+ import '../../index.es-3f39f316.js';
17
+ import '../../index-e9f6b2d8.js';
18
+ import '../../index-06f6bbe4.js';
16
19
  import 'vue';
17
20
  import '../OrTeleport/constants.js';
18
21
  import '../OrTooltip/OrTooltip.js';
@@ -20,11 +23,12 @@ import '../OrTooltipContent/OrTooltipContent.js';
20
23
  import '../OrFloating/OrFloating.js';
21
24
  import '../../floating-ui.dom.esm-83eba816.js';
22
25
  import '../OrFloating/constants.js';
23
- import '../../dom-700444b4.js';
24
- import '../../isObject-fe8b81fd.js';
25
- import '../../get-ab1b7d93.js';
26
- import '../../toString-f3196832.js';
27
- import '../../eq-95cd2573.js';
26
+ import '../../dom-c98dce89.js';
27
+ import '../../isObject-08fab135.js';
28
+ import '../../_commonjsHelpers-6584e42b.js';
29
+ import '../../get-b30afe93.js';
30
+ import '../../toString-a72d5149.js';
31
+ import '../../eq-037e6fce.js';
28
32
  import '../OrButtonV2/constants.js';
29
33
  import '../OrIcon/OrIcon.js';
30
34
  import '../OrIcon/constants.js';
@@ -33,3798 +37,9 @@ import '../OrLoader/OrLoader.js';
33
37
  import '../../utils/isEmpty.js';
34
38
  import '../OrLoader/constants.js';
35
39
  import '../OrModal/constants.js';
40
+ import '../../useFocusTrap-c1384da1.js';
36
41
  import '../OrOverlay/OrOverlay.js';
37
42
 
38
- /**
39
- Comment or uncomment the current selection. Will use line comments
40
- if available, otherwise falling back to block comments.
41
- */
42
- const toggleComment = target => {
43
- let {
44
- state
45
- } = target,
46
- line = state.doc.lineAt(state.selection.main.from),
47
- config = getConfig(target.state, line.from);
48
- return config.line ? toggleLineComment(target) : config.block ? toggleBlockCommentByLine(target) : false;
49
- };
50
- function command(f, option) {
51
- return _ref => {
52
- let {
53
- state,
54
- dispatch
55
- } = _ref;
56
- if (state.readOnly) return false;
57
- let tr = f(option, state);
58
- if (!tr) return false;
59
- dispatch(state.update(tr));
60
- return true;
61
- };
62
- }
63
- /**
64
- Comment or uncomment the current selection using line comments.
65
- The line comment syntax is taken from the
66
- [`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language
67
- data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).
68
- */
69
- const toggleLineComment = /*@__PURE__*/command(changeLineComment, 0 /* CommentOption.Toggle */);
70
- /**
71
- Comment or uncomment the current selection using block comments.
72
- The block comment syntax is taken from the
73
- [`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language
74
- data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).
75
- */
76
- const toggleBlockComment = /*@__PURE__*/command(changeBlockComment, 0 /* CommentOption.Toggle */);
77
- /**
78
- Comment or uncomment the lines around the current selection using
79
- block comments.
80
- */
81
- const toggleBlockCommentByLine = /*@__PURE__*/command((o, s) => changeBlockComment(o, s, selectedLineRanges(s)), 0 /* CommentOption.Toggle */);
82
- function getConfig(state, pos) {
83
- let data = state.languageDataAt("commentTokens", pos);
84
- return data.length ? data[0] : {};
85
- }
86
- const SearchMargin = 50;
87
- /**
88
- Determines if the given range is block-commented in the given
89
- state.
90
- */
91
- function findBlockComment(state, _ref2, from, to) {
92
- let {
93
- open,
94
- close
95
- } = _ref2;
96
- let textBefore = state.sliceDoc(from - SearchMargin, from);
97
- let textAfter = state.sliceDoc(to, to + SearchMargin);
98
- let spaceBefore = /\s*$/.exec(textBefore)[0].length,
99
- spaceAfter = /^\s*/.exec(textAfter)[0].length;
100
- let beforeOff = textBefore.length - spaceBefore;
101
- if (textBefore.slice(beforeOff - open.length, beforeOff) == open && textAfter.slice(spaceAfter, spaceAfter + close.length) == close) {
102
- return {
103
- open: {
104
- pos: from - spaceBefore,
105
- margin: spaceBefore && 1
106
- },
107
- close: {
108
- pos: to + spaceAfter,
109
- margin: spaceAfter && 1
110
- }
111
- };
112
- }
113
- let startText, endText;
114
- if (to - from <= 2 * SearchMargin) {
115
- startText = endText = state.sliceDoc(from, to);
116
- } else {
117
- startText = state.sliceDoc(from, from + SearchMargin);
118
- endText = state.sliceDoc(to - SearchMargin, to);
119
- }
120
- let startSpace = /^\s*/.exec(startText)[0].length,
121
- endSpace = /\s*$/.exec(endText)[0].length;
122
- let endOff = endText.length - endSpace - close.length;
123
- if (startText.slice(startSpace, startSpace + open.length) == open && endText.slice(endOff, endOff + close.length) == close) {
124
- return {
125
- open: {
126
- pos: from + startSpace + open.length,
127
- margin: /\s/.test(startText.charAt(startSpace + open.length)) ? 1 : 0
128
- },
129
- close: {
130
- pos: to - endSpace - close.length,
131
- margin: /\s/.test(endText.charAt(endOff - 1)) ? 1 : 0
132
- }
133
- };
134
- }
135
- return null;
136
- }
137
- function selectedLineRanges(state) {
138
- let ranges = [];
139
- for (let r of state.selection.ranges) {
140
- let fromLine = state.doc.lineAt(r.from);
141
- let toLine = r.to <= fromLine.to ? fromLine : state.doc.lineAt(r.to);
142
- let last = ranges.length - 1;
143
- if (last >= 0 && ranges[last].to > fromLine.from) ranges[last].to = toLine.to;else ranges.push({
144
- from: fromLine.from,
145
- to: toLine.to
146
- });
147
- }
148
- return ranges;
149
- }
150
- // Performs toggle, comment and uncomment of block comments in
151
- // languages that support them.
152
- function changeBlockComment(option, state) {
153
- let ranges = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : state.selection.ranges;
154
- let tokens = ranges.map(r => getConfig(state, r.from).block);
155
- if (!tokens.every(c => c)) return null;
156
- let comments = ranges.map((r, i) => findBlockComment(state, tokens[i], r.from, r.to));
157
- if (option != 2 /* CommentOption.Uncomment */ && !comments.every(c => c)) {
158
- return {
159
- changes: state.changes(ranges.map((range, i) => {
160
- if (comments[i]) return [];
161
- return [{
162
- from: range.from,
163
- insert: tokens[i].open + " "
164
- }, {
165
- from: range.to,
166
- insert: " " + tokens[i].close
167
- }];
168
- }))
169
- };
170
- } else if (option != 1 /* CommentOption.Comment */ && comments.some(c => c)) {
171
- let changes = [];
172
- for (let i = 0, comment; i < comments.length; i++) if (comment = comments[i]) {
173
- let token = tokens[i],
174
- {
175
- open,
176
- close
177
- } = comment;
178
- changes.push({
179
- from: open.pos - token.open.length,
180
- to: open.pos + open.margin
181
- }, {
182
- from: close.pos - close.margin,
183
- to: close.pos + token.close.length
184
- });
185
- }
186
- return {
187
- changes
188
- };
189
- }
190
- return null;
191
- }
192
- // Performs toggle, comment and uncomment of line comments.
193
- function changeLineComment(option, state) {
194
- let ranges = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : state.selection.ranges;
195
- let lines = [];
196
- let prevLine = -1;
197
- for (let {
198
- from,
199
- to
200
- } of ranges) {
201
- let startI = lines.length,
202
- minIndent = 1e9;
203
- let token = getConfig(state, from).line;
204
- if (!token) continue;
205
- for (let pos = from; pos <= to;) {
206
- let line = state.doc.lineAt(pos);
207
- if (line.from > prevLine && (from == to || to > line.from)) {
208
- prevLine = line.from;
209
- let indent = /^\s*/.exec(line.text)[0].length;
210
- let empty = indent == line.length;
211
- let comment = line.text.slice(indent, indent + token.length) == token ? indent : -1;
212
- if (indent < line.text.length && indent < minIndent) minIndent = indent;
213
- lines.push({
214
- line,
215
- comment,
216
- token,
217
- indent,
218
- empty,
219
- single: false
220
- });
221
- }
222
- pos = line.to + 1;
223
- }
224
- if (minIndent < 1e9) for (let i = startI; i < lines.length; i++) if (lines[i].indent < lines[i].line.text.length) lines[i].indent = minIndent;
225
- if (lines.length == startI + 1) lines[startI].single = true;
226
- }
227
- if (option != 2 /* CommentOption.Uncomment */ && lines.some(l => l.comment < 0 && (!l.empty || l.single))) {
228
- let changes = [];
229
- for (let {
230
- line,
231
- token,
232
- indent,
233
- empty,
234
- single
235
- } of lines) if (single || !empty) changes.push({
236
- from: line.from + indent,
237
- insert: token + " "
238
- });
239
- let changeSet = state.changes(changes);
240
- return {
241
- changes: changeSet,
242
- selection: state.selection.map(changeSet, 1)
243
- };
244
- } else if (option != 1 /* CommentOption.Comment */ && lines.some(l => l.comment >= 0)) {
245
- let changes = [];
246
- for (let {
247
- line,
248
- comment,
249
- token
250
- } of lines) if (comment >= 0) {
251
- let from = line.from + comment,
252
- to = from + token.length;
253
- if (line.text[to - line.from] == " ") to++;
254
- changes.push({
255
- from,
256
- to
257
- });
258
- }
259
- return {
260
- changes
261
- };
262
- }
263
- return null;
264
- }
265
- const fromHistory = /*@__PURE__*/Annotation.define();
266
- /**
267
- Transaction annotation that will prevent that transaction from
268
- being combined with other transactions in the undo history. Given
269
- `"before"`, it'll prevent merging with previous transactions. With
270
- `"after"`, subsequent transactions won't be combined with this
271
- one. With `"full"`, the transaction is isolated on both sides.
272
- */
273
- const isolateHistory = /*@__PURE__*/Annotation.define();
274
- /**
275
- This facet provides a way to register functions that, given a
276
- transaction, provide a set of effects that the history should
277
- store when inverting the transaction. This can be used to
278
- integrate some kinds of effects in the history, so that they can
279
- be undone (and redone again).
280
- */
281
- const invertedEffects = /*@__PURE__*/Facet.define();
282
- const historyConfig = /*@__PURE__*/Facet.define({
283
- combine(configs) {
284
- return combineConfig(configs, {
285
- minDepth: 100,
286
- newGroupDelay: 500,
287
- joinToEvent: (_t, isAdjacent) => isAdjacent
288
- }, {
289
- minDepth: Math.max,
290
- newGroupDelay: Math.min,
291
- joinToEvent: (a, b) => (tr, adj) => a(tr, adj) || b(tr, adj)
292
- });
293
- }
294
- });
295
- function changeEnd(changes) {
296
- let end = 0;
297
- changes.iterChangedRanges((_, to) => end = to);
298
- return end;
299
- }
300
- const historyField_ = /*@__PURE__*/StateField.define({
301
- create() {
302
- return HistoryState.empty;
303
- },
304
- update(state, tr) {
305
- let config = tr.state.facet(historyConfig);
306
- let fromHist = tr.annotation(fromHistory);
307
- if (fromHist) {
308
- let selection = tr.docChanged ? EditorSelection.single(changeEnd(tr.changes)) : undefined;
309
- let item = HistEvent.fromTransaction(tr, selection),
310
- from = fromHist.side;
311
- let other = from == 0 /* BranchName.Done */ ? state.undone : state.done;
312
- if (item) other = updateBranch(other, other.length, config.minDepth, item);else other = addSelection(other, tr.startState.selection);
313
- return new HistoryState(from == 0 /* BranchName.Done */ ? fromHist.rest : other, from == 0 /* BranchName.Done */ ? other : fromHist.rest);
314
- }
315
- let isolate = tr.annotation(isolateHistory);
316
- if (isolate == "full" || isolate == "before") state = state.isolate();
317
- if (tr.annotation(Transaction.addToHistory) === false) return !tr.changes.empty ? state.addMapping(tr.changes.desc) : state;
318
- let event = HistEvent.fromTransaction(tr);
319
- let time = tr.annotation(Transaction.time),
320
- userEvent = tr.annotation(Transaction.userEvent);
321
- if (event) state = state.addChanges(event, time, userEvent, config, tr);else if (tr.selection) state = state.addSelection(tr.startState.selection, time, userEvent, config.newGroupDelay);
322
- if (isolate == "full" || isolate == "after") state = state.isolate();
323
- return state;
324
- },
325
- toJSON(value) {
326
- return {
327
- done: value.done.map(e => e.toJSON()),
328
- undone: value.undone.map(e => e.toJSON())
329
- };
330
- },
331
- fromJSON(json) {
332
- return new HistoryState(json.done.map(HistEvent.fromJSON), json.undone.map(HistEvent.fromJSON));
333
- }
334
- });
335
- /**
336
- Create a history extension with the given configuration.
337
- */
338
- function history() {
339
- let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
340
- return [historyField_, historyConfig.of(config), EditorView.domEventHandlers({
341
- beforeinput(e, view) {
342
- let command = e.inputType == "historyUndo" ? undo : e.inputType == "historyRedo" ? redo : null;
343
- if (!command) return false;
344
- e.preventDefault();
345
- return command(view);
346
- }
347
- })];
348
- }
349
- function cmd(side, selection) {
350
- return function (_ref3) {
351
- let {
352
- state,
353
- dispatch
354
- } = _ref3;
355
- if (!selection && state.readOnly) return false;
356
- let historyState = state.field(historyField_, false);
357
- if (!historyState) return false;
358
- let tr = historyState.pop(side, state, selection);
359
- if (!tr) return false;
360
- dispatch(tr);
361
- return true;
362
- };
363
- }
364
- /**
365
- Undo a single group of history events. Returns false if no group
366
- was available.
367
- */
368
- const undo = /*@__PURE__*/cmd(0 /* BranchName.Done */, false);
369
- /**
370
- Redo a group of history events. Returns false if no group was
371
- available.
372
- */
373
- const redo = /*@__PURE__*/cmd(1 /* BranchName.Undone */, false);
374
- /**
375
- Undo a change or selection change.
376
- */
377
- const undoSelection = /*@__PURE__*/cmd(0 /* BranchName.Done */, true);
378
- /**
379
- Redo a change or selection change.
380
- */
381
- const redoSelection = /*@__PURE__*/cmd(1 /* BranchName.Undone */, true);
382
- // History events store groups of changes or effects that need to be
383
- // undone/redone together.
384
- class HistEvent {
385
- constructor(
386
- // The changes in this event. Normal events hold at least one
387
- // change or effect. But it may be necessary to store selection
388
- // events before the first change, in which case a special type of
389
- // instance is created which doesn't hold any changes, with
390
- // changes == startSelection == undefined
391
- changes,
392
- // The effects associated with this event
393
- effects,
394
- // Accumulated mapping (from addToHistory==false) that should be
395
- // applied to events below this one.
396
- mapped,
397
- // The selection before this event
398
- startSelection,
399
- // Stores selection changes after this event, to be used for
400
- // selection undo/redo.
401
- selectionsAfter) {
402
- this.changes = changes;
403
- this.effects = effects;
404
- this.mapped = mapped;
405
- this.startSelection = startSelection;
406
- this.selectionsAfter = selectionsAfter;
407
- }
408
- setSelAfter(after) {
409
- return new HistEvent(this.changes, this.effects, this.mapped, this.startSelection, after);
410
- }
411
- toJSON() {
412
- var _a, _b, _c;
413
- return {
414
- changes: (_a = this.changes) === null || _a === void 0 ? void 0 : _a.toJSON(),
415
- mapped: (_b = this.mapped) === null || _b === void 0 ? void 0 : _b.toJSON(),
416
- startSelection: (_c = this.startSelection) === null || _c === void 0 ? void 0 : _c.toJSON(),
417
- selectionsAfter: this.selectionsAfter.map(s => s.toJSON())
418
- };
419
- }
420
- static fromJSON(json) {
421
- return new HistEvent(json.changes && ChangeSet.fromJSON(json.changes), [], json.mapped && ChangeDesc.fromJSON(json.mapped), json.startSelection && EditorSelection.fromJSON(json.startSelection), json.selectionsAfter.map(EditorSelection.fromJSON));
422
- }
423
- // This does not check `addToHistory` and such, it assumes the
424
- // transaction needs to be converted to an item. Returns null when
425
- // there are no changes or effects in the transaction.
426
- static fromTransaction(tr, selection) {
427
- let effects = none;
428
- for (let invert of tr.startState.facet(invertedEffects)) {
429
- let result = invert(tr);
430
- if (result.length) effects = effects.concat(result);
431
- }
432
- if (!effects.length && tr.changes.empty) return null;
433
- return new HistEvent(tr.changes.invert(tr.startState.doc), effects, undefined, selection || tr.startState.selection, none);
434
- }
435
- static selection(selections) {
436
- return new HistEvent(undefined, none, undefined, undefined, selections);
437
- }
438
- }
439
- function updateBranch(branch, to, maxLen, newEvent) {
440
- let start = to + 1 > maxLen + 20 ? to - maxLen - 1 : 0;
441
- let newBranch = branch.slice(start, to);
442
- newBranch.push(newEvent);
443
- return newBranch;
444
- }
445
- function isAdjacent(a, b) {
446
- let ranges = [],
447
- isAdjacent = false;
448
- a.iterChangedRanges((f, t) => ranges.push(f, t));
449
- b.iterChangedRanges((_f, _t, f, t) => {
450
- for (let i = 0; i < ranges.length;) {
451
- let from = ranges[i++],
452
- to = ranges[i++];
453
- if (t >= from && f <= to) isAdjacent = true;
454
- }
455
- });
456
- return isAdjacent;
457
- }
458
- function eqSelectionShape(a, b) {
459
- return a.ranges.length == b.ranges.length && a.ranges.filter((r, i) => r.empty != b.ranges[i].empty).length === 0;
460
- }
461
- function conc(a, b) {
462
- return !a.length ? b : !b.length ? a : a.concat(b);
463
- }
464
- const none = [];
465
- const MaxSelectionsPerEvent = 200;
466
- function addSelection(branch, selection) {
467
- if (!branch.length) {
468
- return [HistEvent.selection([selection])];
469
- } else {
470
- let lastEvent = branch[branch.length - 1];
471
- let sels = lastEvent.selectionsAfter.slice(Math.max(0, lastEvent.selectionsAfter.length - MaxSelectionsPerEvent));
472
- if (sels.length && sels[sels.length - 1].eq(selection)) return branch;
473
- sels.push(selection);
474
- return updateBranch(branch, branch.length - 1, 1e9, lastEvent.setSelAfter(sels));
475
- }
476
- }
477
- // Assumes the top item has one or more selectionAfter values
478
- function popSelection(branch) {
479
- let last = branch[branch.length - 1];
480
- let newBranch = branch.slice();
481
- newBranch[branch.length - 1] = last.setSelAfter(last.selectionsAfter.slice(0, last.selectionsAfter.length - 1));
482
- return newBranch;
483
- }
484
- // Add a mapping to the top event in the given branch. If this maps
485
- // away all the changes and effects in that item, drop it and
486
- // propagate the mapping to the next item.
487
- function addMappingToBranch(branch, mapping) {
488
- if (!branch.length) return branch;
489
- let length = branch.length,
490
- selections = none;
491
- while (length) {
492
- let event = mapEvent(branch[length - 1], mapping, selections);
493
- if (event.changes && !event.changes.empty || event.effects.length) {
494
- // Event survived mapping
495
- let result = branch.slice(0, length);
496
- result[length - 1] = event;
497
- return result;
498
- } else {
499
- // Drop this event, since there's no changes or effects left
500
- mapping = event.mapped;
501
- length--;
502
- selections = event.selectionsAfter;
503
- }
504
- }
505
- return selections.length ? [HistEvent.selection(selections)] : none;
506
- }
507
- function mapEvent(event, mapping, extraSelections) {
508
- let selections = conc(event.selectionsAfter.length ? event.selectionsAfter.map(s => s.map(mapping)) : none, extraSelections);
509
- // Change-less events don't store mappings (they are always the last event in a branch)
510
- if (!event.changes) return HistEvent.selection(selections);
511
- let mappedChanges = event.changes.map(mapping),
512
- before = mapping.mapDesc(event.changes, true);
513
- let fullMapping = event.mapped ? event.mapped.composeDesc(before) : before;
514
- return new HistEvent(mappedChanges, StateEffect.mapEffects(event.effects, mapping), fullMapping, event.startSelection.map(before), selections);
515
- }
516
- const joinableUserEvent = /^(input\.type|delete)($|\.)/;
517
- class HistoryState {
518
- constructor(done, undone) {
519
- let prevTime = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
520
- let prevUserEvent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
521
- this.done = done;
522
- this.undone = undone;
523
- this.prevTime = prevTime;
524
- this.prevUserEvent = prevUserEvent;
525
- }
526
- isolate() {
527
- return this.prevTime ? new HistoryState(this.done, this.undone) : this;
528
- }
529
- addChanges(event, time, userEvent, config, tr) {
530
- let done = this.done,
531
- lastEvent = done[done.length - 1];
532
- if (lastEvent && lastEvent.changes && !lastEvent.changes.empty && event.changes && (!userEvent || joinableUserEvent.test(userEvent)) && (!lastEvent.selectionsAfter.length && time - this.prevTime < config.newGroupDelay && config.joinToEvent(tr, isAdjacent(lastEvent.changes, event.changes)) ||
533
- // For compose (but not compose.start) events, always join with previous event
534
- userEvent == "input.type.compose")) {
535
- done = updateBranch(done, done.length - 1, config.minDepth, new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none));
536
- } else {
537
- done = updateBranch(done, done.length, config.minDepth, event);
538
- }
539
- return new HistoryState(done, none, time, userEvent);
540
- }
541
- addSelection(selection, time, userEvent, newGroupDelay) {
542
- let last = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none;
543
- if (last.length > 0 && time - this.prevTime < newGroupDelay && userEvent == this.prevUserEvent && userEvent && /^select($|\.)/.test(userEvent) && eqSelectionShape(last[last.length - 1], selection)) return this;
544
- return new HistoryState(addSelection(this.done, selection), this.undone, time, userEvent);
545
- }
546
- addMapping(mapping) {
547
- return new HistoryState(addMappingToBranch(this.done, mapping), addMappingToBranch(this.undone, mapping), this.prevTime, this.prevUserEvent);
548
- }
549
- pop(side, state, selection) {
550
- let branch = side == 0 /* BranchName.Done */ ? this.done : this.undone;
551
- if (branch.length == 0) return null;
552
- let event = branch[branch.length - 1];
553
- if (selection && event.selectionsAfter.length) {
554
- return state.update({
555
- selection: event.selectionsAfter[event.selectionsAfter.length - 1],
556
- annotations: fromHistory.of({
557
- side,
558
- rest: popSelection(branch)
559
- }),
560
- userEvent: side == 0 /* BranchName.Done */ ? "select.undo" : "select.redo",
561
- scrollIntoView: true
562
- });
563
- } else if (!event.changes) {
564
- return null;
565
- } else {
566
- let rest = branch.length == 1 ? none : branch.slice(0, branch.length - 1);
567
- if (event.mapped) rest = addMappingToBranch(rest, event.mapped);
568
- return state.update({
569
- changes: event.changes,
570
- selection: event.startSelection,
571
- effects: event.effects,
572
- annotations: fromHistory.of({
573
- side,
574
- rest
575
- }),
576
- filter: false,
577
- userEvent: side == 0 /* BranchName.Done */ ? "undo" : "redo",
578
- scrollIntoView: true
579
- });
580
- }
581
- }
582
- }
583
- HistoryState.empty = /*@__PURE__*/new HistoryState(none, none);
584
- /**
585
- Default key bindings for the undo history.
586
-
587
- - Mod-z: [`undo`](https://codemirror.net/6/docs/ref/#commands.undo).
588
- - Mod-y (Mod-Shift-z on macOS) + Ctrl-Shift-z on Linux: [`redo`](https://codemirror.net/6/docs/ref/#commands.redo).
589
- - Mod-u: [`undoSelection`](https://codemirror.net/6/docs/ref/#commands.undoSelection).
590
- - Alt-u (Mod-Shift-u on macOS): [`redoSelection`](https://codemirror.net/6/docs/ref/#commands.redoSelection).
591
- */
592
- const historyKeymap = [{
593
- key: "Mod-z",
594
- run: undo,
595
- preventDefault: true
596
- }, {
597
- key: "Mod-y",
598
- mac: "Mod-Shift-z",
599
- run: redo,
600
- preventDefault: true
601
- }, {
602
- linux: "Ctrl-Shift-z",
603
- run: redo,
604
- preventDefault: true
605
- }, {
606
- key: "Mod-u",
607
- run: undoSelection,
608
- preventDefault: true
609
- }, {
610
- key: "Alt-u",
611
- mac: "Mod-Shift-u",
612
- run: redoSelection,
613
- preventDefault: true
614
- }];
615
- function updateSel(sel, by) {
616
- return EditorSelection.create(sel.ranges.map(by), sel.mainIndex);
617
- }
618
- function setSel(state, selection) {
619
- return state.update({
620
- selection,
621
- scrollIntoView: true,
622
- userEvent: "select"
623
- });
624
- }
625
- function moveSel(_ref4, how) {
626
- let {
627
- state,
628
- dispatch
629
- } = _ref4;
630
- let selection = updateSel(state.selection, how);
631
- if (selection.eq(state.selection)) return false;
632
- dispatch(setSel(state, selection));
633
- return true;
634
- }
635
- function rangeEnd(range, forward) {
636
- return EditorSelection.cursor(forward ? range.to : range.from);
637
- }
638
- function cursorByChar(view, forward) {
639
- return moveSel(view, range => range.empty ? view.moveByChar(range, forward) : rangeEnd(range, forward));
640
- }
641
- function ltrAtCursor(view) {
642
- return view.textDirectionAt(view.state.selection.main.head) == Direction.LTR;
643
- }
644
- /**
645
- Move the selection one character to the left (which is backward in
646
- left-to-right text, forward in right-to-left text).
647
- */
648
- const cursorCharLeft = view => cursorByChar(view, !ltrAtCursor(view));
649
- /**
650
- Move the selection one character to the right.
651
- */
652
- const cursorCharRight = view => cursorByChar(view, ltrAtCursor(view));
653
- function cursorByGroup(view, forward) {
654
- return moveSel(view, range => range.empty ? view.moveByGroup(range, forward) : rangeEnd(range, forward));
655
- }
656
- /**
657
- Move the selection to the left across one group of word or
658
- non-word (but also non-space) characters.
659
- */
660
- const cursorGroupLeft = view => cursorByGroup(view, !ltrAtCursor(view));
661
- /**
662
- Move the selection one group to the right.
663
- */
664
- const cursorGroupRight = view => cursorByGroup(view, ltrAtCursor(view));
665
- function interestingNode(state, node, bracketProp) {
666
- if (node.type.prop(bracketProp)) return true;
667
- let len = node.to - node.from;
668
- return len && (len > 2 || /[^\s,.;:]/.test(state.sliceDoc(node.from, node.to))) || node.firstChild;
669
- }
670
- function moveBySyntax(state, start, forward) {
671
- let pos = syntaxTree(state).resolveInner(start.head);
672
- let bracketProp = forward ? NodeProp.closedBy : NodeProp.openedBy;
673
- // Scan forward through child nodes to see if there's an interesting
674
- // node ahead.
675
- for (let at = start.head;;) {
676
- let next = forward ? pos.childAfter(at) : pos.childBefore(at);
677
- if (!next) break;
678
- if (interestingNode(state, next, bracketProp)) pos = next;else at = forward ? next.to : next.from;
679
- }
680
- let bracket = pos.type.prop(bracketProp),
681
- match,
682
- newPos;
683
- if (bracket && (match = forward ? matchBrackets(state, pos.from, 1) : matchBrackets(state, pos.to, -1)) && match.matched) newPos = forward ? match.end.to : match.end.from;else newPos = forward ? pos.to : pos.from;
684
- return EditorSelection.cursor(newPos, forward ? -1 : 1);
685
- }
686
- /**
687
- Move the cursor over the next syntactic element to the left.
688
- */
689
- const cursorSyntaxLeft = view => moveSel(view, range => moveBySyntax(view.state, range, !ltrAtCursor(view)));
690
- /**
691
- Move the cursor over the next syntactic element to the right.
692
- */
693
- const cursorSyntaxRight = view => moveSel(view, range => moveBySyntax(view.state, range, ltrAtCursor(view)));
694
- function cursorByLine(view, forward) {
695
- return moveSel(view, range => {
696
- if (!range.empty) return rangeEnd(range, forward);
697
- let moved = view.moveVertically(range, forward);
698
- return moved.head != range.head ? moved : view.moveToLineBoundary(range, forward);
699
- });
700
- }
701
- /**
702
- Move the selection one line up.
703
- */
704
- const cursorLineUp = view => cursorByLine(view, false);
705
- /**
706
- Move the selection one line down.
707
- */
708
- const cursorLineDown = view => cursorByLine(view, true);
709
- function pageInfo(view) {
710
- let selfScroll = view.scrollDOM.clientHeight < view.scrollDOM.scrollHeight - 2;
711
- let marginTop = 0,
712
- marginBottom = 0,
713
- height;
714
- if (selfScroll) {
715
- for (let source of view.state.facet(EditorView.scrollMargins)) {
716
- let margins = source(view);
717
- if (margins === null || margins === void 0 ? void 0 : margins.top) marginTop = Math.max(margins === null || margins === void 0 ? void 0 : margins.top, marginTop);
718
- if (margins === null || margins === void 0 ? void 0 : margins.bottom) marginBottom = Math.max(margins === null || margins === void 0 ? void 0 : margins.bottom, marginBottom);
719
- }
720
- height = view.scrollDOM.clientHeight - marginTop - marginBottom;
721
- } else {
722
- height = (view.dom.ownerDocument.defaultView || window).innerHeight;
723
- }
724
- return {
725
- marginTop,
726
- marginBottom,
727
- selfScroll,
728
- height: Math.max(view.defaultLineHeight, height - 5)
729
- };
730
- }
731
- function cursorByPage(view, forward) {
732
- let page = pageInfo(view);
733
- let {
734
- state
735
- } = view,
736
- selection = updateSel(state.selection, range => {
737
- return range.empty ? view.moveVertically(range, forward, page.height) : rangeEnd(range, forward);
738
- });
739
- if (selection.eq(state.selection)) return false;
740
- let effect;
741
- if (page.selfScroll) {
742
- let startPos = view.coordsAtPos(state.selection.main.head);
743
- let scrollRect = view.scrollDOM.getBoundingClientRect();
744
- let scrollTop = scrollRect.top + page.marginTop,
745
- scrollBottom = scrollRect.bottom - page.marginBottom;
746
- if (startPos && startPos.top > scrollTop && startPos.bottom < scrollBottom) effect = EditorView.scrollIntoView(selection.main.head, {
747
- y: "start",
748
- yMargin: startPos.top - scrollTop
749
- });
750
- }
751
- view.dispatch(setSel(state, selection), {
752
- effects: effect
753
- });
754
- return true;
755
- }
756
- /**
757
- Move the selection one page up.
758
- */
759
- const cursorPageUp = view => cursorByPage(view, false);
760
- /**
761
- Move the selection one page down.
762
- */
763
- const cursorPageDown = view => cursorByPage(view, true);
764
- function moveByLineBoundary(view, start, forward) {
765
- let line = view.lineBlockAt(start.head),
766
- moved = view.moveToLineBoundary(start, forward);
767
- if (moved.head == start.head && moved.head != (forward ? line.to : line.from)) moved = view.moveToLineBoundary(start, forward, false);
768
- if (!forward && moved.head == line.from && line.length) {
769
- let space = /^\s*/.exec(view.state.sliceDoc(line.from, Math.min(line.from + 100, line.to)))[0].length;
770
- if (space && start.head != line.from + space) moved = EditorSelection.cursor(line.from + space);
771
- }
772
- return moved;
773
- }
774
- /**
775
- Move the selection to the next line wrap point, or to the end of
776
- the line if there isn't one left on this line.
777
- */
778
- const cursorLineBoundaryForward = view => moveSel(view, range => moveByLineBoundary(view, range, true));
779
- /**
780
- Move the selection to previous line wrap point, or failing that to
781
- the start of the line. If the line is indented, and the cursor
782
- isn't already at the end of the indentation, this will move to the
783
- end of the indentation instead of the start of the line.
784
- */
785
- const cursorLineBoundaryBackward = view => moveSel(view, range => moveByLineBoundary(view, range, false));
786
- /**
787
- Move the selection one line wrap point to the left.
788
- */
789
- const cursorLineBoundaryLeft = view => moveSel(view, range => moveByLineBoundary(view, range, !ltrAtCursor(view)));
790
- /**
791
- Move the selection one line wrap point to the right.
792
- */
793
- const cursorLineBoundaryRight = view => moveSel(view, range => moveByLineBoundary(view, range, ltrAtCursor(view)));
794
- /**
795
- Move the selection to the start of the line.
796
- */
797
- const cursorLineStart = view => moveSel(view, range => EditorSelection.cursor(view.lineBlockAt(range.head).from, 1));
798
- /**
799
- Move the selection to the end of the line.
800
- */
801
- const cursorLineEnd = view => moveSel(view, range => EditorSelection.cursor(view.lineBlockAt(range.head).to, -1));
802
- function toMatchingBracket(state, dispatch, extend) {
803
- let found = false,
804
- selection = updateSel(state.selection, range => {
805
- let matching = matchBrackets(state, range.head, -1) || matchBrackets(state, range.head, 1) || range.head > 0 && matchBrackets(state, range.head - 1, 1) || range.head < state.doc.length && matchBrackets(state, range.head + 1, -1);
806
- if (!matching || !matching.end) return range;
807
- found = true;
808
- let head = matching.start.from == range.head ? matching.end.to : matching.end.from;
809
- return extend ? EditorSelection.range(range.anchor, head) : EditorSelection.cursor(head);
810
- });
811
- if (!found) return false;
812
- dispatch(setSel(state, selection));
813
- return true;
814
- }
815
- /**
816
- Move the selection to the bracket matching the one it is currently
817
- on, if any.
818
- */
819
- const cursorMatchingBracket = _ref5 => {
820
- let {
821
- state,
822
- dispatch
823
- } = _ref5;
824
- return toMatchingBracket(state, dispatch, false);
825
- };
826
- function extendSel(view, how) {
827
- let selection = updateSel(view.state.selection, range => {
828
- let head = how(range);
829
- return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);
830
- });
831
- if (selection.eq(view.state.selection)) return false;
832
- view.dispatch(setSel(view.state, selection));
833
- return true;
834
- }
835
- function selectByChar(view, forward) {
836
- return extendSel(view, range => view.moveByChar(range, forward));
837
- }
838
- /**
839
- Move the selection head one character to the left, while leaving
840
- the anchor in place.
841
- */
842
- const selectCharLeft = view => selectByChar(view, !ltrAtCursor(view));
843
- /**
844
- Move the selection head one character to the right.
845
- */
846
- const selectCharRight = view => selectByChar(view, ltrAtCursor(view));
847
- function selectByGroup(view, forward) {
848
- return extendSel(view, range => view.moveByGroup(range, forward));
849
- }
850
- /**
851
- Move the selection head one [group](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) to
852
- the left.
853
- */
854
- const selectGroupLeft = view => selectByGroup(view, !ltrAtCursor(view));
855
- /**
856
- Move the selection head one group to the right.
857
- */
858
- const selectGroupRight = view => selectByGroup(view, ltrAtCursor(view));
859
- /**
860
- Move the selection head over the next syntactic element to the left.
861
- */
862
- const selectSyntaxLeft = view => extendSel(view, range => moveBySyntax(view.state, range, !ltrAtCursor(view)));
863
- /**
864
- Move the selection head over the next syntactic element to the right.
865
- */
866
- const selectSyntaxRight = view => extendSel(view, range => moveBySyntax(view.state, range, ltrAtCursor(view)));
867
- function selectByLine(view, forward) {
868
- return extendSel(view, range => view.moveVertically(range, forward));
869
- }
870
- /**
871
- Move the selection head one line up.
872
- */
873
- const selectLineUp = view => selectByLine(view, false);
874
- /**
875
- Move the selection head one line down.
876
- */
877
- const selectLineDown = view => selectByLine(view, true);
878
- function selectByPage(view, forward) {
879
- return extendSel(view, range => view.moveVertically(range, forward, pageInfo(view).height));
880
- }
881
- /**
882
- Move the selection head one page up.
883
- */
884
- const selectPageUp = view => selectByPage(view, false);
885
- /**
886
- Move the selection head one page down.
887
- */
888
- const selectPageDown = view => selectByPage(view, true);
889
- /**
890
- Move the selection head to the next line boundary.
891
- */
892
- const selectLineBoundaryForward = view => extendSel(view, range => moveByLineBoundary(view, range, true));
893
- /**
894
- Move the selection head to the previous line boundary.
895
- */
896
- const selectLineBoundaryBackward = view => extendSel(view, range => moveByLineBoundary(view, range, false));
897
- /**
898
- Move the selection head one line boundary to the left.
899
- */
900
- const selectLineBoundaryLeft = view => extendSel(view, range => moveByLineBoundary(view, range, !ltrAtCursor(view)));
901
- /**
902
- Move the selection head one line boundary to the right.
903
- */
904
- const selectLineBoundaryRight = view => extendSel(view, range => moveByLineBoundary(view, range, ltrAtCursor(view)));
905
- /**
906
- Move the selection head to the start of the line.
907
- */
908
- const selectLineStart = view => extendSel(view, range => EditorSelection.cursor(view.lineBlockAt(range.head).from));
909
- /**
910
- Move the selection head to the end of the line.
911
- */
912
- const selectLineEnd = view => extendSel(view, range => EditorSelection.cursor(view.lineBlockAt(range.head).to));
913
- /**
914
- Move the selection to the start of the document.
915
- */
916
- const cursorDocStart = _ref7 => {
917
- let {
918
- state,
919
- dispatch
920
- } = _ref7;
921
- dispatch(setSel(state, {
922
- anchor: 0
923
- }));
924
- return true;
925
- };
926
- /**
927
- Move the selection to the end of the document.
928
- */
929
- const cursorDocEnd = _ref8 => {
930
- let {
931
- state,
932
- dispatch
933
- } = _ref8;
934
- dispatch(setSel(state, {
935
- anchor: state.doc.length
936
- }));
937
- return true;
938
- };
939
- /**
940
- Move the selection head to the start of the document.
941
- */
942
- const selectDocStart = _ref9 => {
943
- let {
944
- state,
945
- dispatch
946
- } = _ref9;
947
- dispatch(setSel(state, {
948
- anchor: state.selection.main.anchor,
949
- head: 0
950
- }));
951
- return true;
952
- };
953
- /**
954
- Move the selection head to the end of the document.
955
- */
956
- const selectDocEnd = _ref10 => {
957
- let {
958
- state,
959
- dispatch
960
- } = _ref10;
961
- dispatch(setSel(state, {
962
- anchor: state.selection.main.anchor,
963
- head: state.doc.length
964
- }));
965
- return true;
966
- };
967
- /**
968
- Select the entire document.
969
- */
970
- const selectAll = _ref11 => {
971
- let {
972
- state,
973
- dispatch
974
- } = _ref11;
975
- dispatch(state.update({
976
- selection: {
977
- anchor: 0,
978
- head: state.doc.length
979
- },
980
- userEvent: "select"
981
- }));
982
- return true;
983
- };
984
- /**
985
- Expand the selection to cover entire lines.
986
- */
987
- const selectLine = _ref12 => {
988
- let {
989
- state,
990
- dispatch
991
- } = _ref12;
992
- let ranges = selectedLineBlocks(state).map(_ref13 => {
993
- let {
994
- from,
995
- to
996
- } = _ref13;
997
- return EditorSelection.range(from, Math.min(to + 1, state.doc.length));
998
- });
999
- dispatch(state.update({
1000
- selection: EditorSelection.create(ranges),
1001
- userEvent: "select"
1002
- }));
1003
- return true;
1004
- };
1005
- /**
1006
- Select the next syntactic construct that is larger than the
1007
- selection. Note that this will only work insofar as the language
1008
- [provider](https://codemirror.net/6/docs/ref/#language.language) you use builds up a full
1009
- syntax tree.
1010
- */
1011
- const selectParentSyntax = _ref14 => {
1012
- let {
1013
- state,
1014
- dispatch
1015
- } = _ref14;
1016
- let selection = updateSel(state.selection, range => {
1017
- var _a;
1018
- let context = syntaxTree(state).resolveInner(range.head, 1);
1019
- while (!(context.from < range.from && context.to >= range.to || context.to > range.to && context.from <= range.from || !((_a = context.parent) === null || _a === void 0 ? void 0 : _a.parent))) context = context.parent;
1020
- return EditorSelection.range(context.to, context.from);
1021
- });
1022
- dispatch(setSel(state, selection));
1023
- return true;
1024
- };
1025
- /**
1026
- Simplify the current selection. When multiple ranges are selected,
1027
- reduce it to its main range. Otherwise, if the selection is
1028
- non-empty, convert it to a cursor selection.
1029
- */
1030
- const simplifySelection = _ref15 => {
1031
- let {
1032
- state,
1033
- dispatch
1034
- } = _ref15;
1035
- let cur = state.selection,
1036
- selection = null;
1037
- if (cur.ranges.length > 1) selection = EditorSelection.create([cur.main]);else if (!cur.main.empty) selection = EditorSelection.create([EditorSelection.cursor(cur.main.head)]);
1038
- if (!selection) return false;
1039
- dispatch(setSel(state, selection));
1040
- return true;
1041
- };
1042
- function deleteBy(target, by) {
1043
- if (target.state.readOnly) return false;
1044
- let event = "delete.selection",
1045
- {
1046
- state
1047
- } = target;
1048
- let changes = state.changeByRange(range => {
1049
- let {
1050
- from,
1051
- to
1052
- } = range;
1053
- if (from == to) {
1054
- let towards = by(from);
1055
- if (towards < from) {
1056
- event = "delete.backward";
1057
- towards = skipAtomic(target, towards, false);
1058
- } else if (towards > from) {
1059
- event = "delete.forward";
1060
- towards = skipAtomic(target, towards, true);
1061
- }
1062
- from = Math.min(from, towards);
1063
- to = Math.max(to, towards);
1064
- } else {
1065
- from = skipAtomic(target, from, false);
1066
- to = skipAtomic(target, to, true);
1067
- }
1068
- return from == to ? {
1069
- range
1070
- } : {
1071
- changes: {
1072
- from,
1073
- to
1074
- },
1075
- range: EditorSelection.cursor(from)
1076
- };
1077
- });
1078
- if (changes.changes.empty) return false;
1079
- target.dispatch(state.update(changes, {
1080
- scrollIntoView: true,
1081
- userEvent: event,
1082
- effects: event == "delete.selection" ? EditorView.announce.of(state.phrase("Selection deleted")) : undefined
1083
- }));
1084
- return true;
1085
- }
1086
- function skipAtomic(target, pos, forward) {
1087
- if (target instanceof EditorView) for (let ranges of target.state.facet(EditorView.atomicRanges).map(f => f(target))) ranges.between(pos, pos, (from, to) => {
1088
- if (from < pos && to > pos) pos = forward ? to : from;
1089
- });
1090
- return pos;
1091
- }
1092
- const deleteByChar = (target, forward) => deleteBy(target, pos => {
1093
- let {
1094
- state
1095
- } = target,
1096
- line = state.doc.lineAt(pos),
1097
- before,
1098
- targetPos;
1099
- if (!forward && pos > line.from && pos < line.from + 200 && !/[^ \t]/.test(before = line.text.slice(0, pos - line.from))) {
1100
- if (before[before.length - 1] == "\t") return pos - 1;
1101
- let col = countColumn(before, state.tabSize),
1102
- drop = col % getIndentUnit(state) || getIndentUnit(state);
1103
- for (let i = 0; i < drop && before[before.length - 1 - i] == " "; i++) pos--;
1104
- targetPos = pos;
1105
- } else {
1106
- targetPos = findClusterBreak(line.text, pos - line.from, forward, forward) + line.from;
1107
- if (targetPos == pos && line.number != (forward ? state.doc.lines : 1)) targetPos += forward ? 1 : -1;
1108
- }
1109
- return targetPos;
1110
- });
1111
- /**
1112
- Delete the selection, or, for cursor selections, the character
1113
- before the cursor.
1114
- */
1115
- const deleteCharBackward = view => deleteByChar(view, false);
1116
- /**
1117
- Delete the selection or the character after the cursor.
1118
- */
1119
- const deleteCharForward = view => deleteByChar(view, true);
1120
- const deleteByGroup = (target, forward) => deleteBy(target, start => {
1121
- let pos = start,
1122
- {
1123
- state
1124
- } = target,
1125
- line = state.doc.lineAt(pos);
1126
- let categorize = state.charCategorizer(pos);
1127
- for (let cat = null;;) {
1128
- if (pos == (forward ? line.to : line.from)) {
1129
- if (pos == start && line.number != (forward ? state.doc.lines : 1)) pos += forward ? 1 : -1;
1130
- break;
1131
- }
1132
- let next = findClusterBreak(line.text, pos - line.from, forward) + line.from;
1133
- let nextChar = line.text.slice(Math.min(pos, next) - line.from, Math.max(pos, next) - line.from);
1134
- let nextCat = categorize(nextChar);
1135
- if (cat != null && nextCat != cat) break;
1136
- if (nextChar != " " || pos != start) cat = nextCat;
1137
- pos = next;
1138
- }
1139
- return pos;
1140
- });
1141
- /**
1142
- Delete the selection or backward until the end of the next
1143
- [group](https://codemirror.net/6/docs/ref/#view.EditorView.moveByGroup), only skipping groups of
1144
- whitespace when they consist of a single space.
1145
- */
1146
- const deleteGroupBackward = target => deleteByGroup(target, false);
1147
- /**
1148
- Delete the selection or forward until the end of the next group.
1149
- */
1150
- const deleteGroupForward = target => deleteByGroup(target, true);
1151
- /**
1152
- Delete the selection, or, if it is a cursor selection, delete to
1153
- the end of the line. If the cursor is directly at the end of the
1154
- line, delete the line break after it.
1155
- */
1156
- const deleteToLineEnd = view => deleteBy(view, pos => {
1157
- let lineEnd = view.lineBlockAt(pos).to;
1158
- return pos < lineEnd ? lineEnd : Math.min(view.state.doc.length, pos + 1);
1159
- });
1160
- /**
1161
- Delete the selection, or, if it is a cursor selection, delete to
1162
- the start of the line. If the cursor is directly at the start of the
1163
- line, delete the line break before it.
1164
- */
1165
- const deleteToLineStart = view => deleteBy(view, pos => {
1166
- let lineStart = view.lineBlockAt(pos).from;
1167
- return pos > lineStart ? lineStart : Math.max(0, pos - 1);
1168
- });
1169
- /**
1170
- Replace each selection range with a line break, leaving the cursor
1171
- on the line before the break.
1172
- */
1173
- const splitLine = _ref17 => {
1174
- let {
1175
- state,
1176
- dispatch
1177
- } = _ref17;
1178
- if (state.readOnly) return false;
1179
- let changes = state.changeByRange(range => {
1180
- return {
1181
- changes: {
1182
- from: range.from,
1183
- to: range.to,
1184
- insert: Text.of(["", ""])
1185
- },
1186
- range: EditorSelection.cursor(range.from)
1187
- };
1188
- });
1189
- dispatch(state.update(changes, {
1190
- scrollIntoView: true,
1191
- userEvent: "input"
1192
- }));
1193
- return true;
1194
- };
1195
- /**
1196
- Flip the characters before and after the cursor(s).
1197
- */
1198
- const transposeChars = _ref18 => {
1199
- let {
1200
- state,
1201
- dispatch
1202
- } = _ref18;
1203
- if (state.readOnly) return false;
1204
- let changes = state.changeByRange(range => {
1205
- if (!range.empty || range.from == 0 || range.from == state.doc.length) return {
1206
- range
1207
- };
1208
- let pos = range.from,
1209
- line = state.doc.lineAt(pos);
1210
- let from = pos == line.from ? pos - 1 : findClusterBreak(line.text, pos - line.from, false) + line.from;
1211
- let to = pos == line.to ? pos + 1 : findClusterBreak(line.text, pos - line.from, true) + line.from;
1212
- return {
1213
- changes: {
1214
- from,
1215
- to,
1216
- insert: state.doc.slice(pos, to).append(state.doc.slice(from, pos))
1217
- },
1218
- range: EditorSelection.cursor(to)
1219
- };
1220
- });
1221
- if (changes.changes.empty) return false;
1222
- dispatch(state.update(changes, {
1223
- scrollIntoView: true,
1224
- userEvent: "move.character"
1225
- }));
1226
- return true;
1227
- };
1228
- function selectedLineBlocks(state) {
1229
- let blocks = [],
1230
- upto = -1;
1231
- for (let range of state.selection.ranges) {
1232
- let startLine = state.doc.lineAt(range.from),
1233
- endLine = state.doc.lineAt(range.to);
1234
- if (!range.empty && range.to == endLine.from) endLine = state.doc.lineAt(range.to - 1);
1235
- if (upto >= startLine.number) {
1236
- let prev = blocks[blocks.length - 1];
1237
- prev.to = endLine.to;
1238
- prev.ranges.push(range);
1239
- } else {
1240
- blocks.push({
1241
- from: startLine.from,
1242
- to: endLine.to,
1243
- ranges: [range]
1244
- });
1245
- }
1246
- upto = endLine.number + 1;
1247
- }
1248
- return blocks;
1249
- }
1250
- function moveLine(state, dispatch, forward) {
1251
- if (state.readOnly) return false;
1252
- let changes = [],
1253
- ranges = [];
1254
- for (let block of selectedLineBlocks(state)) {
1255
- if (forward ? block.to == state.doc.length : block.from == 0) continue;
1256
- let nextLine = state.doc.lineAt(forward ? block.to + 1 : block.from - 1);
1257
- let size = nextLine.length + 1;
1258
- if (forward) {
1259
- changes.push({
1260
- from: block.to,
1261
- to: nextLine.to
1262
- }, {
1263
- from: block.from,
1264
- insert: nextLine.text + state.lineBreak
1265
- });
1266
- for (let r of block.ranges) ranges.push(EditorSelection.range(Math.min(state.doc.length, r.anchor + size), Math.min(state.doc.length, r.head + size)));
1267
- } else {
1268
- changes.push({
1269
- from: nextLine.from,
1270
- to: block.from
1271
- }, {
1272
- from: block.to,
1273
- insert: state.lineBreak + nextLine.text
1274
- });
1275
- for (let r of block.ranges) ranges.push(EditorSelection.range(r.anchor - size, r.head - size));
1276
- }
1277
- }
1278
- if (!changes.length) return false;
1279
- dispatch(state.update({
1280
- changes,
1281
- scrollIntoView: true,
1282
- selection: EditorSelection.create(ranges, state.selection.mainIndex),
1283
- userEvent: "move.line"
1284
- }));
1285
- return true;
1286
- }
1287
- /**
1288
- Move the selected lines up one line.
1289
- */
1290
- const moveLineUp = _ref19 => {
1291
- let {
1292
- state,
1293
- dispatch
1294
- } = _ref19;
1295
- return moveLine(state, dispatch, false);
1296
- };
1297
- /**
1298
- Move the selected lines down one line.
1299
- */
1300
- const moveLineDown = _ref20 => {
1301
- let {
1302
- state,
1303
- dispatch
1304
- } = _ref20;
1305
- return moveLine(state, dispatch, true);
1306
- };
1307
- function copyLine(state, dispatch, forward) {
1308
- if (state.readOnly) return false;
1309
- let changes = [];
1310
- for (let block of selectedLineBlocks(state)) {
1311
- if (forward) changes.push({
1312
- from: block.from,
1313
- insert: state.doc.slice(block.from, block.to) + state.lineBreak
1314
- });else changes.push({
1315
- from: block.to,
1316
- insert: state.lineBreak + state.doc.slice(block.from, block.to)
1317
- });
1318
- }
1319
- dispatch(state.update({
1320
- changes,
1321
- scrollIntoView: true,
1322
- userEvent: "input.copyline"
1323
- }));
1324
- return true;
1325
- }
1326
- /**
1327
- Create a copy of the selected lines. Keep the selection in the top copy.
1328
- */
1329
- const copyLineUp = _ref21 => {
1330
- let {
1331
- state,
1332
- dispatch
1333
- } = _ref21;
1334
- return copyLine(state, dispatch, false);
1335
- };
1336
- /**
1337
- Create a copy of the selected lines. Keep the selection in the bottom copy.
1338
- */
1339
- const copyLineDown = _ref22 => {
1340
- let {
1341
- state,
1342
- dispatch
1343
- } = _ref22;
1344
- return copyLine(state, dispatch, true);
1345
- };
1346
- /**
1347
- Delete selected lines.
1348
- */
1349
- const deleteLine = view => {
1350
- if (view.state.readOnly) return false;
1351
- let {
1352
- state
1353
- } = view,
1354
- changes = state.changes(selectedLineBlocks(state).map(_ref23 => {
1355
- let {
1356
- from,
1357
- to
1358
- } = _ref23;
1359
- if (from > 0) from--;else if (to < state.doc.length) to++;
1360
- return {
1361
- from,
1362
- to
1363
- };
1364
- }));
1365
- let selection = updateSel(state.selection, range => view.moveVertically(range, true)).map(changes);
1366
- view.dispatch({
1367
- changes,
1368
- selection,
1369
- scrollIntoView: true,
1370
- userEvent: "delete.line"
1371
- });
1372
- return true;
1373
- };
1374
- function isBetweenBrackets(state, pos) {
1375
- if (/\(\)|\[\]|\{\}/.test(state.sliceDoc(pos - 1, pos + 1))) return {
1376
- from: pos,
1377
- to: pos
1378
- };
1379
- let context = syntaxTree(state).resolveInner(pos);
1380
- let before = context.childBefore(pos),
1381
- after = context.childAfter(pos),
1382
- closedBy;
1383
- if (before && after && before.to <= pos && after.from >= pos && (closedBy = before.type.prop(NodeProp.closedBy)) && closedBy.indexOf(after.name) > -1 && state.doc.lineAt(before.to).from == state.doc.lineAt(after.from).from) return {
1384
- from: before.to,
1385
- to: after.from
1386
- };
1387
- return null;
1388
- }
1389
- /**
1390
- Replace the selection with a newline and indent the newly created
1391
- line(s). If the current line consists only of whitespace, this
1392
- will also delete that whitespace. When the cursor is between
1393
- matching brackets, an additional newline will be inserted after
1394
- the cursor.
1395
- */
1396
- const insertNewlineAndIndent = /*@__PURE__*/newlineAndIndent(false);
1397
- /**
1398
- Create a blank, indented line below the current line.
1399
- */
1400
- const insertBlankLine = /*@__PURE__*/newlineAndIndent(true);
1401
- function newlineAndIndent(atEof) {
1402
- return _ref25 => {
1403
- let {
1404
- state,
1405
- dispatch
1406
- } = _ref25;
1407
- if (state.readOnly) return false;
1408
- let changes = state.changeByRange(range => {
1409
- let {
1410
- from,
1411
- to
1412
- } = range,
1413
- line = state.doc.lineAt(from);
1414
- let explode = !atEof && from == to && isBetweenBrackets(state, from);
1415
- if (atEof) from = to = (to <= line.to ? line : state.doc.lineAt(to)).to;
1416
- let cx = new IndentContext(state, {
1417
- simulateBreak: from,
1418
- simulateDoubleBreak: !!explode
1419
- });
1420
- let indent = getIndentation(cx, from);
1421
- if (indent == null) indent = /^\s*/.exec(state.doc.lineAt(from).text)[0].length;
1422
- while (to < line.to && /\s/.test(line.text[to - line.from])) to++;
1423
- if (explode) ({
1424
- from,
1425
- to
1426
- } = explode);else if (from > line.from && from < line.from + 100 && !/\S/.test(line.text.slice(0, from))) from = line.from;
1427
- let insert = ["", indentString(state, indent)];
1428
- if (explode) insert.push(indentString(state, cx.lineIndent(line.from, -1)));
1429
- return {
1430
- changes: {
1431
- from,
1432
- to,
1433
- insert: Text.of(insert)
1434
- },
1435
- range: EditorSelection.cursor(from + 1 + insert[1].length)
1436
- };
1437
- });
1438
- dispatch(state.update(changes, {
1439
- scrollIntoView: true,
1440
- userEvent: "input"
1441
- }));
1442
- return true;
1443
- };
1444
- }
1445
- function changeBySelectedLine(state, f) {
1446
- let atLine = -1;
1447
- return state.changeByRange(range => {
1448
- let changes = [];
1449
- for (let pos = range.from; pos <= range.to;) {
1450
- let line = state.doc.lineAt(pos);
1451
- if (line.number > atLine && (range.empty || range.to > line.from)) {
1452
- f(line, changes, range);
1453
- atLine = line.number;
1454
- }
1455
- pos = line.to + 1;
1456
- }
1457
- let changeSet = state.changes(changes);
1458
- return {
1459
- changes,
1460
- range: EditorSelection.range(changeSet.mapPos(range.anchor, 1), changeSet.mapPos(range.head, 1))
1461
- };
1462
- });
1463
- }
1464
- /**
1465
- Auto-indent the selected lines. This uses the [indentation service
1466
- facet](https://codemirror.net/6/docs/ref/#language.indentService) as source for auto-indent
1467
- information.
1468
- */
1469
- const indentSelection = _ref26 => {
1470
- let {
1471
- state,
1472
- dispatch
1473
- } = _ref26;
1474
- if (state.readOnly) return false;
1475
- let updated = Object.create(null);
1476
- let context = new IndentContext(state, {
1477
- overrideIndentation: start => {
1478
- let found = updated[start];
1479
- return found == null ? -1 : found;
1480
- }
1481
- });
1482
- let changes = changeBySelectedLine(state, (line, changes, range) => {
1483
- let indent = getIndentation(context, line.from);
1484
- if (indent == null) return;
1485
- if (!/\S/.test(line.text)) indent = 0;
1486
- let cur = /^\s*/.exec(line.text)[0];
1487
- let norm = indentString(state, indent);
1488
- if (cur != norm || range.from < line.from + cur.length) {
1489
- updated[line.from] = indent;
1490
- changes.push({
1491
- from: line.from,
1492
- to: line.from + cur.length,
1493
- insert: norm
1494
- });
1495
- }
1496
- });
1497
- if (!changes.changes.empty) dispatch(state.update(changes, {
1498
- userEvent: "indent"
1499
- }));
1500
- return true;
1501
- };
1502
- /**
1503
- Add a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation to all selected
1504
- lines.
1505
- */
1506
- const indentMore = _ref27 => {
1507
- let {
1508
- state,
1509
- dispatch
1510
- } = _ref27;
1511
- if (state.readOnly) return false;
1512
- dispatch(state.update(changeBySelectedLine(state, (line, changes) => {
1513
- changes.push({
1514
- from: line.from,
1515
- insert: state.facet(indentUnit)
1516
- });
1517
- }), {
1518
- userEvent: "input.indent"
1519
- }));
1520
- return true;
1521
- };
1522
- /**
1523
- Remove a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation from all
1524
- selected lines.
1525
- */
1526
- const indentLess = _ref28 => {
1527
- let {
1528
- state,
1529
- dispatch
1530
- } = _ref28;
1531
- if (state.readOnly) return false;
1532
- dispatch(state.update(changeBySelectedLine(state, (line, changes) => {
1533
- let space = /^\s*/.exec(line.text)[0];
1534
- if (!space) return;
1535
- let col = countColumn(space, state.tabSize),
1536
- keep = 0;
1537
- let insert = indentString(state, Math.max(0, col - getIndentUnit(state)));
1538
- while (keep < space.length && keep < insert.length && space.charCodeAt(keep) == insert.charCodeAt(keep)) keep++;
1539
- changes.push({
1540
- from: line.from + keep,
1541
- to: line.from + space.length,
1542
- insert: insert.slice(keep)
1543
- });
1544
- }), {
1545
- userEvent: "delete.dedent"
1546
- }));
1547
- return true;
1548
- };
1549
- /**
1550
- Array of key bindings containing the Emacs-style bindings that are
1551
- available on macOS by default.
1552
-
1553
- - Ctrl-b: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)
1554
- - Ctrl-f: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)
1555
- - Ctrl-p: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)
1556
- - Ctrl-n: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)
1557
- - Ctrl-a: [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)
1558
- - Ctrl-e: [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)
1559
- - Ctrl-d: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)
1560
- - Ctrl-h: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)
1561
- - Ctrl-k: [`deleteToLineEnd`](https://codemirror.net/6/docs/ref/#commands.deleteToLineEnd)
1562
- - Ctrl-Alt-h: [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)
1563
- - Ctrl-o: [`splitLine`](https://codemirror.net/6/docs/ref/#commands.splitLine)
1564
- - Ctrl-t: [`transposeChars`](https://codemirror.net/6/docs/ref/#commands.transposeChars)
1565
- - Ctrl-v: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown)
1566
- - Alt-v: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp)
1567
- */
1568
- const emacsStyleKeymap = [{
1569
- key: "Ctrl-b",
1570
- run: cursorCharLeft,
1571
- shift: selectCharLeft,
1572
- preventDefault: true
1573
- }, {
1574
- key: "Ctrl-f",
1575
- run: cursorCharRight,
1576
- shift: selectCharRight
1577
- }, {
1578
- key: "Ctrl-p",
1579
- run: cursorLineUp,
1580
- shift: selectLineUp
1581
- }, {
1582
- key: "Ctrl-n",
1583
- run: cursorLineDown,
1584
- shift: selectLineDown
1585
- }, {
1586
- key: "Ctrl-a",
1587
- run: cursorLineStart,
1588
- shift: selectLineStart
1589
- }, {
1590
- key: "Ctrl-e",
1591
- run: cursorLineEnd,
1592
- shift: selectLineEnd
1593
- }, {
1594
- key: "Ctrl-d",
1595
- run: deleteCharForward
1596
- }, {
1597
- key: "Ctrl-h",
1598
- run: deleteCharBackward
1599
- }, {
1600
- key: "Ctrl-k",
1601
- run: deleteToLineEnd
1602
- }, {
1603
- key: "Ctrl-Alt-h",
1604
- run: deleteGroupBackward
1605
- }, {
1606
- key: "Ctrl-o",
1607
- run: splitLine
1608
- }, {
1609
- key: "Ctrl-t",
1610
- run: transposeChars
1611
- }, {
1612
- key: "Ctrl-v",
1613
- run: cursorPageDown
1614
- }];
1615
- /**
1616
- An array of key bindings closely sticking to platform-standard or
1617
- widely used bindings. (This includes the bindings from
1618
- [`emacsStyleKeymap`](https://codemirror.net/6/docs/ref/#commands.emacsStyleKeymap), with their `key`
1619
- property changed to `mac`.)
1620
-
1621
- - ArrowLeft: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)
1622
- - ArrowRight: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)
1623
- - Ctrl-ArrowLeft (Alt-ArrowLeft on macOS): [`cursorGroupLeft`](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) ([`selectGroupLeft`](https://codemirror.net/6/docs/ref/#commands.selectGroupLeft) with Shift)
1624
- - Ctrl-ArrowRight (Alt-ArrowRight on macOS): [`cursorGroupRight`](https://codemirror.net/6/docs/ref/#commands.cursorGroupRight) ([`selectGroupRight`](https://codemirror.net/6/docs/ref/#commands.selectGroupRight) with Shift)
1625
- - Cmd-ArrowLeft (on macOS): [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)
1626
- - Cmd-ArrowRight (on macOS): [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)
1627
- - ArrowUp: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)
1628
- - ArrowDown: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)
1629
- - Cmd-ArrowUp (on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)
1630
- - Cmd-ArrowDown (on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)
1631
- - Ctrl-ArrowUp (on macOS): [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)
1632
- - Ctrl-ArrowDown (on macOS): [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)
1633
- - PageUp: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)
1634
- - PageDown: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)
1635
- - Home: [`cursorLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryBackward) ([`selectLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryBackward) with Shift)
1636
- - End: [`cursorLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryForward) ([`selectLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryForward) with Shift)
1637
- - Ctrl-Home (Cmd-Home on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)
1638
- - Ctrl-End (Cmd-Home on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)
1639
- - Enter: [`insertNewlineAndIndent`](https://codemirror.net/6/docs/ref/#commands.insertNewlineAndIndent)
1640
- - Ctrl-a (Cmd-a on macOS): [`selectAll`](https://codemirror.net/6/docs/ref/#commands.selectAll)
1641
- - Backspace: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)
1642
- - Delete: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)
1643
- - Ctrl-Backspace (Alt-Backspace on macOS): [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)
1644
- - Ctrl-Delete (Alt-Delete on macOS): [`deleteGroupForward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupForward)
1645
- - Cmd-Backspace (macOS): [`deleteToLineStart`](https://codemirror.net/6/docs/ref/#commands.deleteToLineStart).
1646
- - Cmd-Delete (macOS): [`deleteToLineEnd`](https://codemirror.net/6/docs/ref/#commands.deleteToLineEnd).
1647
- */
1648
- const standardKeymap = /*@__PURE__*/[{
1649
- key: "ArrowLeft",
1650
- run: cursorCharLeft,
1651
- shift: selectCharLeft,
1652
- preventDefault: true
1653
- }, {
1654
- key: "Mod-ArrowLeft",
1655
- mac: "Alt-ArrowLeft",
1656
- run: cursorGroupLeft,
1657
- shift: selectGroupLeft,
1658
- preventDefault: true
1659
- }, {
1660
- mac: "Cmd-ArrowLeft",
1661
- run: cursorLineBoundaryLeft,
1662
- shift: selectLineBoundaryLeft,
1663
- preventDefault: true
1664
- }, {
1665
- key: "ArrowRight",
1666
- run: cursorCharRight,
1667
- shift: selectCharRight,
1668
- preventDefault: true
1669
- }, {
1670
- key: "Mod-ArrowRight",
1671
- mac: "Alt-ArrowRight",
1672
- run: cursorGroupRight,
1673
- shift: selectGroupRight,
1674
- preventDefault: true
1675
- }, {
1676
- mac: "Cmd-ArrowRight",
1677
- run: cursorLineBoundaryRight,
1678
- shift: selectLineBoundaryRight,
1679
- preventDefault: true
1680
- }, {
1681
- key: "ArrowUp",
1682
- run: cursorLineUp,
1683
- shift: selectLineUp,
1684
- preventDefault: true
1685
- }, {
1686
- mac: "Cmd-ArrowUp",
1687
- run: cursorDocStart,
1688
- shift: selectDocStart
1689
- }, {
1690
- mac: "Ctrl-ArrowUp",
1691
- run: cursorPageUp,
1692
- shift: selectPageUp
1693
- }, {
1694
- key: "ArrowDown",
1695
- run: cursorLineDown,
1696
- shift: selectLineDown,
1697
- preventDefault: true
1698
- }, {
1699
- mac: "Cmd-ArrowDown",
1700
- run: cursorDocEnd,
1701
- shift: selectDocEnd
1702
- }, {
1703
- mac: "Ctrl-ArrowDown",
1704
- run: cursorPageDown,
1705
- shift: selectPageDown
1706
- }, {
1707
- key: "PageUp",
1708
- run: cursorPageUp,
1709
- shift: selectPageUp
1710
- }, {
1711
- key: "PageDown",
1712
- run: cursorPageDown,
1713
- shift: selectPageDown
1714
- }, {
1715
- key: "Home",
1716
- run: cursorLineBoundaryBackward,
1717
- shift: selectLineBoundaryBackward,
1718
- preventDefault: true
1719
- }, {
1720
- key: "Mod-Home",
1721
- run: cursorDocStart,
1722
- shift: selectDocStart
1723
- }, {
1724
- key: "End",
1725
- run: cursorLineBoundaryForward,
1726
- shift: selectLineBoundaryForward,
1727
- preventDefault: true
1728
- }, {
1729
- key: "Mod-End",
1730
- run: cursorDocEnd,
1731
- shift: selectDocEnd
1732
- }, {
1733
- key: "Enter",
1734
- run: insertNewlineAndIndent
1735
- }, {
1736
- key: "Mod-a",
1737
- run: selectAll
1738
- }, {
1739
- key: "Backspace",
1740
- run: deleteCharBackward,
1741
- shift: deleteCharBackward
1742
- }, {
1743
- key: "Delete",
1744
- run: deleteCharForward
1745
- }, {
1746
- key: "Mod-Backspace",
1747
- mac: "Alt-Backspace",
1748
- run: deleteGroupBackward
1749
- }, {
1750
- key: "Mod-Delete",
1751
- mac: "Alt-Delete",
1752
- run: deleteGroupForward
1753
- }, {
1754
- mac: "Mod-Backspace",
1755
- run: deleteToLineStart
1756
- }, {
1757
- mac: "Mod-Delete",
1758
- run: deleteToLineEnd
1759
- }].concat( /*@__PURE__*/emacsStyleKeymap.map(b => ({
1760
- mac: b.key,
1761
- run: b.run,
1762
- shift: b.shift
1763
- })));
1764
- /**
1765
- The default keymap. Includes all bindings from
1766
- [`standardKeymap`](https://codemirror.net/6/docs/ref/#commands.standardKeymap) plus the following:
1767
-
1768
- - Alt-ArrowLeft (Ctrl-ArrowLeft on macOS): [`cursorSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxLeft) ([`selectSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxLeft) with Shift)
1769
- - Alt-ArrowRight (Ctrl-ArrowRight on macOS): [`cursorSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxRight) ([`selectSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxRight) with Shift)
1770
- - Alt-ArrowUp: [`moveLineUp`](https://codemirror.net/6/docs/ref/#commands.moveLineUp)
1771
- - Alt-ArrowDown: [`moveLineDown`](https://codemirror.net/6/docs/ref/#commands.moveLineDown)
1772
- - Shift-Alt-ArrowUp: [`copyLineUp`](https://codemirror.net/6/docs/ref/#commands.copyLineUp)
1773
- - Shift-Alt-ArrowDown: [`copyLineDown`](https://codemirror.net/6/docs/ref/#commands.copyLineDown)
1774
- - Escape: [`simplifySelection`](https://codemirror.net/6/docs/ref/#commands.simplifySelection)
1775
- - Ctrl-Enter (Comd-Enter on macOS): [`insertBlankLine`](https://codemirror.net/6/docs/ref/#commands.insertBlankLine)
1776
- - Alt-l (Ctrl-l on macOS): [`selectLine`](https://codemirror.net/6/docs/ref/#commands.selectLine)
1777
- - Ctrl-i (Cmd-i on macOS): [`selectParentSyntax`](https://codemirror.net/6/docs/ref/#commands.selectParentSyntax)
1778
- - Ctrl-[ (Cmd-[ on macOS): [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess)
1779
- - Ctrl-] (Cmd-] on macOS): [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore)
1780
- - Ctrl-Alt-\\ (Cmd-Alt-\\ on macOS): [`indentSelection`](https://codemirror.net/6/docs/ref/#commands.indentSelection)
1781
- - Shift-Ctrl-k (Shift-Cmd-k on macOS): [`deleteLine`](https://codemirror.net/6/docs/ref/#commands.deleteLine)
1782
- - Shift-Ctrl-\\ (Shift-Cmd-\\ on macOS): [`cursorMatchingBracket`](https://codemirror.net/6/docs/ref/#commands.cursorMatchingBracket)
1783
- - Ctrl-/ (Cmd-/ on macOS): [`toggleComment`](https://codemirror.net/6/docs/ref/#commands.toggleComment).
1784
- - Shift-Alt-a: [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).
1785
- */
1786
- const defaultKeymap = /*@__PURE__*/[{
1787
- key: "Alt-ArrowLeft",
1788
- mac: "Ctrl-ArrowLeft",
1789
- run: cursorSyntaxLeft,
1790
- shift: selectSyntaxLeft
1791
- }, {
1792
- key: "Alt-ArrowRight",
1793
- mac: "Ctrl-ArrowRight",
1794
- run: cursorSyntaxRight,
1795
- shift: selectSyntaxRight
1796
- }, {
1797
- key: "Alt-ArrowUp",
1798
- run: moveLineUp
1799
- }, {
1800
- key: "Shift-Alt-ArrowUp",
1801
- run: copyLineUp
1802
- }, {
1803
- key: "Alt-ArrowDown",
1804
- run: moveLineDown
1805
- }, {
1806
- key: "Shift-Alt-ArrowDown",
1807
- run: copyLineDown
1808
- }, {
1809
- key: "Escape",
1810
- run: simplifySelection
1811
- }, {
1812
- key: "Mod-Enter",
1813
- run: insertBlankLine
1814
- }, {
1815
- key: "Alt-l",
1816
- mac: "Ctrl-l",
1817
- run: selectLine
1818
- }, {
1819
- key: "Mod-i",
1820
- run: selectParentSyntax,
1821
- preventDefault: true
1822
- }, {
1823
- key: "Mod-[",
1824
- run: indentLess
1825
- }, {
1826
- key: "Mod-]",
1827
- run: indentMore
1828
- }, {
1829
- key: "Mod-Alt-\\",
1830
- run: indentSelection
1831
- }, {
1832
- key: "Shift-Mod-k",
1833
- run: deleteLine
1834
- }, {
1835
- key: "Shift-Mod-\\",
1836
- run: cursorMatchingBracket
1837
- }, {
1838
- key: "Mod-/",
1839
- run: toggleComment
1840
- }, {
1841
- key: "Alt-A",
1842
- run: toggleBlockComment
1843
- }].concat(standardKeymap);
1844
- /**
1845
- A binding that binds Tab to [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) and
1846
- Shift-Tab to [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess).
1847
- Please see the [Tab example](../../examples/tab/) before using
1848
- this.
1849
- */
1850
- const indentWithTab = {
1851
- key: "Tab",
1852
- run: indentMore,
1853
- shift: indentLess
1854
- };
1855
-
1856
- function crelt() {
1857
- var elt = arguments[0];
1858
- if (typeof elt == "string") elt = document.createElement(elt);
1859
- var i = 1,
1860
- next = arguments[1];
1861
- if (next && typeof next == "object" && next.nodeType == null && !Array.isArray(next)) {
1862
- for (var name in next) if (Object.prototype.hasOwnProperty.call(next, name)) {
1863
- var value = next[name];
1864
- if (typeof value == "string") elt.setAttribute(name, value);else if (value != null) elt[name] = value;
1865
- }
1866
- i++;
1867
- }
1868
- for (; i < arguments.length; i++) add(elt, arguments[i]);
1869
- return elt;
1870
- }
1871
- function add(elt, child) {
1872
- if (typeof child == "string") {
1873
- elt.appendChild(document.createTextNode(child));
1874
- } else if (child == null) ; else if (child.nodeType != null) {
1875
- elt.appendChild(child);
1876
- } else if (Array.isArray(child)) {
1877
- for (var i = 0; i < child.length; i++) add(elt, child[i]);
1878
- } else {
1879
- throw new RangeError("Unsupported child node: " + child);
1880
- }
1881
- }
1882
-
1883
- const basicNormalize = typeof String.prototype.normalize == "function" ? x => x.normalize("NFKD") : x => x;
1884
- /**
1885
- A search cursor provides an iterator over text matches in a
1886
- document.
1887
- */
1888
- class SearchCursor {
1889
- /**
1890
- Create a text cursor. The query is the search string, `from` to
1891
- `to` provides the region to search.
1892
-
1893
- When `normalize` is given, it will be called, on both the query
1894
- string and the content it is matched against, before comparing.
1895
- You can, for example, create a case-insensitive search by
1896
- passing `s => s.toLowerCase()`.
1897
-
1898
- Text is always normalized with
1899
- [`.normalize("NFKD")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
1900
- (when supported).
1901
- */
1902
- constructor(text, query) {
1903
- let from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1904
- let to = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : text.length;
1905
- let normalize = arguments.length > 4 ? arguments[4] : undefined;
1906
- let test = arguments.length > 5 ? arguments[5] : undefined;
1907
- this.test = test;
1908
- /**
1909
- The current match (only holds a meaningful value after
1910
- [`next`](https://codemirror.net/6/docs/ref/#search.SearchCursor.next) has been called and when
1911
- `done` is false).
1912
- */
1913
- this.value = {
1914
- from: 0,
1915
- to: 0
1916
- };
1917
- /**
1918
- Whether the end of the iterated region has been reached.
1919
- */
1920
- this.done = false;
1921
- this.matches = [];
1922
- this.buffer = "";
1923
- this.bufferPos = 0;
1924
- this.iter = text.iterRange(from, to);
1925
- this.bufferStart = from;
1926
- this.normalize = normalize ? x => normalize(basicNormalize(x)) : basicNormalize;
1927
- this.query = this.normalize(query);
1928
- }
1929
- peek() {
1930
- if (this.bufferPos == this.buffer.length) {
1931
- this.bufferStart += this.buffer.length;
1932
- this.iter.next();
1933
- if (this.iter.done) return -1;
1934
- this.bufferPos = 0;
1935
- this.buffer = this.iter.value;
1936
- }
1937
- return codePointAt(this.buffer, this.bufferPos);
1938
- }
1939
- /**
1940
- Look for the next match. Updates the iterator's
1941
- [`value`](https://codemirror.net/6/docs/ref/#search.SearchCursor.value) and
1942
- [`done`](https://codemirror.net/6/docs/ref/#search.SearchCursor.done) properties. Should be called
1943
- at least once before using the cursor.
1944
- */
1945
- next() {
1946
- while (this.matches.length) this.matches.pop();
1947
- return this.nextOverlapping();
1948
- }
1949
- /**
1950
- The `next` method will ignore matches that partially overlap a
1951
- previous match. This method behaves like `next`, but includes
1952
- such matches.
1953
- */
1954
- nextOverlapping() {
1955
- for (;;) {
1956
- let next = this.peek();
1957
- if (next < 0) {
1958
- this.done = true;
1959
- return this;
1960
- }
1961
- let str = fromCodePoint(next),
1962
- start = this.bufferStart + this.bufferPos;
1963
- this.bufferPos += codePointSize(next);
1964
- let norm = this.normalize(str);
1965
- for (let i = 0, pos = start;; i++) {
1966
- let code = norm.charCodeAt(i);
1967
- let match = this.match(code, pos);
1968
- if (match) {
1969
- this.value = match;
1970
- return this;
1971
- }
1972
- if (i == norm.length - 1) break;
1973
- if (pos == start && i < str.length && str.charCodeAt(i) == code) pos++;
1974
- }
1975
- }
1976
- }
1977
- match(code, pos) {
1978
- let match = null;
1979
- for (let i = 0; i < this.matches.length; i += 2) {
1980
- let index = this.matches[i],
1981
- keep = false;
1982
- if (this.query.charCodeAt(index) == code) {
1983
- if (index == this.query.length - 1) {
1984
- match = {
1985
- from: this.matches[i + 1],
1986
- to: pos + 1
1987
- };
1988
- } else {
1989
- this.matches[i]++;
1990
- keep = true;
1991
- }
1992
- }
1993
- if (!keep) {
1994
- this.matches.splice(i, 2);
1995
- i -= 2;
1996
- }
1997
- }
1998
- if (this.query.charCodeAt(0) == code) {
1999
- if (this.query.length == 1) match = {
2000
- from: pos,
2001
- to: pos + 1
2002
- };else this.matches.push(1, pos);
2003
- }
2004
- if (match && this.test && !this.test(match.from, match.to, this.buffer, this.bufferPos)) match = null;
2005
- return match;
2006
- }
2007
- }
2008
- if (typeof Symbol != "undefined") SearchCursor.prototype[Symbol.iterator] = function () {
2009
- return this;
2010
- };
2011
- const empty = {
2012
- from: -1,
2013
- to: -1,
2014
- match: /*@__PURE__*/ /.*/.exec("")
2015
- };
2016
- const baseFlags = "gm" + (/x/.unicode == null ? "" : "u");
2017
- /**
2018
- This class is similar to [`SearchCursor`](https://codemirror.net/6/docs/ref/#search.SearchCursor)
2019
- but searches for a regular expression pattern instead of a plain
2020
- string.
2021
- */
2022
- class RegExpCursor {
2023
- /**
2024
- Create a cursor that will search the given range in the given
2025
- document. `query` should be the raw pattern (as you'd pass it to
2026
- `new RegExp`).
2027
- */
2028
- constructor(text, query, options) {
2029
- let from = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2030
- let to = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : text.length;
2031
- this.text = text;
2032
- this.to = to;
2033
- this.curLine = "";
2034
- /**
2035
- Set to `true` when the cursor has reached the end of the search
2036
- range.
2037
- */
2038
- this.done = false;
2039
- /**
2040
- Will contain an object with the extent of the match and the
2041
- match object when [`next`](https://codemirror.net/6/docs/ref/#search.RegExpCursor.next)
2042
- sucessfully finds a match.
2043
- */
2044
- this.value = empty;
2045
- if (/\\[sWDnr]|\n|\r|\[\^/.test(query)) return new MultilineRegExpCursor(text, query, options, from, to);
2046
- this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));
2047
- this.test = options === null || options === void 0 ? void 0 : options.test;
2048
- this.iter = text.iter();
2049
- let startLine = text.lineAt(from);
2050
- this.curLineStart = startLine.from;
2051
- this.matchPos = toCharEnd(text, from);
2052
- this.getLine(this.curLineStart);
2053
- }
2054
- getLine(skip) {
2055
- this.iter.next(skip);
2056
- if (this.iter.lineBreak) {
2057
- this.curLine = "";
2058
- } else {
2059
- this.curLine = this.iter.value;
2060
- if (this.curLineStart + this.curLine.length > this.to) this.curLine = this.curLine.slice(0, this.to - this.curLineStart);
2061
- this.iter.next();
2062
- }
2063
- }
2064
- nextLine() {
2065
- this.curLineStart = this.curLineStart + this.curLine.length + 1;
2066
- if (this.curLineStart > this.to) this.curLine = "";else this.getLine(0);
2067
- }
2068
- /**
2069
- Move to the next match, if there is one.
2070
- */
2071
- next() {
2072
- for (let off = this.matchPos - this.curLineStart;;) {
2073
- this.re.lastIndex = off;
2074
- let match = this.matchPos <= this.to && this.re.exec(this.curLine);
2075
- if (match) {
2076
- let from = this.curLineStart + match.index,
2077
- to = from + match[0].length;
2078
- this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0));
2079
- if (from == this.curLineStart + this.curLine.length) this.nextLine();
2080
- if ((from < to || from > this.value.to) && (!this.test || this.test(from, to, match))) {
2081
- this.value = {
2082
- from,
2083
- to,
2084
- match
2085
- };
2086
- return this;
2087
- }
2088
- off = this.matchPos - this.curLineStart;
2089
- } else if (this.curLineStart + this.curLine.length < this.to) {
2090
- this.nextLine();
2091
- off = 0;
2092
- } else {
2093
- this.done = true;
2094
- return this;
2095
- }
2096
- }
2097
- }
2098
- }
2099
- const flattened = /*@__PURE__*/new WeakMap();
2100
- // Reusable (partially) flattened document strings
2101
- class FlattenedDoc {
2102
- constructor(from, text) {
2103
- this.from = from;
2104
- this.text = text;
2105
- }
2106
- get to() {
2107
- return this.from + this.text.length;
2108
- }
2109
- static get(doc, from, to) {
2110
- let cached = flattened.get(doc);
2111
- if (!cached || cached.from >= to || cached.to <= from) {
2112
- let flat = new FlattenedDoc(from, doc.sliceString(from, to));
2113
- flattened.set(doc, flat);
2114
- return flat;
2115
- }
2116
- if (cached.from == from && cached.to == to) return cached;
2117
- let {
2118
- text,
2119
- from: cachedFrom
2120
- } = cached;
2121
- if (cachedFrom > from) {
2122
- text = doc.sliceString(from, cachedFrom) + text;
2123
- cachedFrom = from;
2124
- }
2125
- if (cached.to < to) text += doc.sliceString(cached.to, to);
2126
- flattened.set(doc, new FlattenedDoc(cachedFrom, text));
2127
- return new FlattenedDoc(from, text.slice(from - cachedFrom, to - cachedFrom));
2128
- }
2129
- }
2130
- class MultilineRegExpCursor {
2131
- constructor(text, query, options, from, to) {
2132
- this.text = text;
2133
- this.to = to;
2134
- this.done = false;
2135
- this.value = empty;
2136
- this.matchPos = toCharEnd(text, from);
2137
- this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));
2138
- this.test = options === null || options === void 0 ? void 0 : options.test;
2139
- this.flat = FlattenedDoc.get(text, from, this.chunkEnd(from + 5000 /* Chunk.Base */));
2140
- }
2141
-
2142
- chunkEnd(pos) {
2143
- return pos >= this.to ? this.to : this.text.lineAt(pos).to;
2144
- }
2145
- next() {
2146
- for (;;) {
2147
- let off = this.re.lastIndex = this.matchPos - this.flat.from;
2148
- let match = this.re.exec(this.flat.text);
2149
- // Skip empty matches directly after the last match
2150
- if (match && !match[0] && match.index == off) {
2151
- this.re.lastIndex = off + 1;
2152
- match = this.re.exec(this.flat.text);
2153
- }
2154
- if (match) {
2155
- let from = this.flat.from + match.index,
2156
- to = from + match[0].length;
2157
- // If a match goes almost to the end of a noncomplete chunk, try
2158
- // again, since it'll likely be able to match more
2159
- if ((this.flat.to >= this.to || match.index + match[0].length <= this.flat.text.length - 10) && (!this.test || this.test(from, to, match))) {
2160
- this.value = {
2161
- from,
2162
- to,
2163
- match
2164
- };
2165
- this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0));
2166
- return this;
2167
- }
2168
- }
2169
- if (this.flat.to == this.to) {
2170
- this.done = true;
2171
- return this;
2172
- }
2173
- // Grow the flattened doc
2174
- this.flat = FlattenedDoc.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
2175
- }
2176
- }
2177
- }
2178
- if (typeof Symbol != "undefined") {
2179
- RegExpCursor.prototype[Symbol.iterator] = MultilineRegExpCursor.prototype[Symbol.iterator] = function () {
2180
- return this;
2181
- };
2182
- }
2183
- function validRegExp(source) {
2184
- try {
2185
- new RegExp(source, baseFlags);
2186
- return true;
2187
- } catch (_a) {
2188
- return false;
2189
- }
2190
- }
2191
- function toCharEnd(text, pos) {
2192
- if (pos >= text.length) return pos;
2193
- let line = text.lineAt(pos),
2194
- next;
2195
- while (pos < line.to && (next = line.text.charCodeAt(pos - line.from)) >= 0xDC00 && next < 0xE000) pos++;
2196
- return pos;
2197
- }
2198
- function createLineDialog(view) {
2199
- let input = crelt("input", {
2200
- class: "cm-textfield",
2201
- name: "line"
2202
- });
2203
- let dom = crelt("form", {
2204
- class: "cm-gotoLine",
2205
- onkeydown: event => {
2206
- if (event.keyCode == 27) {
2207
- // Escape
2208
- event.preventDefault();
2209
- view.dispatch({
2210
- effects: dialogEffect.of(false)
2211
- });
2212
- view.focus();
2213
- } else if (event.keyCode == 13) {
2214
- // Enter
2215
- event.preventDefault();
2216
- go();
2217
- }
2218
- },
2219
- onsubmit: event => {
2220
- event.preventDefault();
2221
- go();
2222
- }
2223
- }, crelt("label", view.state.phrase("Go to line"), ": ", input), " ", crelt("button", {
2224
- class: "cm-button",
2225
- type: "submit"
2226
- }, view.state.phrase("go")));
2227
- function go() {
2228
- let match = /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(input.value);
2229
- if (!match) return;
2230
- let {
2231
- state
2232
- } = view,
2233
- startLine = state.doc.lineAt(state.selection.main.head);
2234
- let [, sign, ln, cl, percent] = match;
2235
- let col = cl ? +cl.slice(1) : 0;
2236
- let line = ln ? +ln : startLine.number;
2237
- if (ln && percent) {
2238
- let pc = line / 100;
2239
- if (sign) pc = pc * (sign == "-" ? -1 : 1) + startLine.number / state.doc.lines;
2240
- line = Math.round(state.doc.lines * pc);
2241
- } else if (ln && sign) {
2242
- line = line * (sign == "-" ? -1 : 1) + startLine.number;
2243
- }
2244
- let docLine = state.doc.line(Math.max(1, Math.min(state.doc.lines, line)));
2245
- view.dispatch({
2246
- effects: dialogEffect.of(false),
2247
- selection: EditorSelection.cursor(docLine.from + Math.max(0, Math.min(col, docLine.length))),
2248
- scrollIntoView: true
2249
- });
2250
- view.focus();
2251
- }
2252
- return {
2253
- dom
2254
- };
2255
- }
2256
- const dialogEffect = /*@__PURE__*/StateEffect.define();
2257
- const dialogField = /*@__PURE__*/StateField.define({
2258
- create() {
2259
- return true;
2260
- },
2261
- update(value, tr) {
2262
- for (let e of tr.effects) if (e.is(dialogEffect)) value = e.value;
2263
- return value;
2264
- },
2265
- provide: f => showPanel.from(f, val => val ? createLineDialog : null)
2266
- });
2267
- /**
2268
- Command that shows a dialog asking the user for a line number, and
2269
- when a valid position is provided, moves the cursor to that line.
2270
-
2271
- Supports line numbers, relative line offsets prefixed with `+` or
2272
- `-`, document percentages suffixed with `%`, and an optional
2273
- column position by adding `:` and a second number after the line
2274
- number.
2275
- */
2276
- const gotoLine = view => {
2277
- let panel = getPanel(view, createLineDialog);
2278
- if (!panel) {
2279
- let effects = [dialogEffect.of(true)];
2280
- if (view.state.field(dialogField, false) == null) effects.push(StateEffect.appendConfig.of([dialogField, baseTheme$1]));
2281
- view.dispatch({
2282
- effects
2283
- });
2284
- panel = getPanel(view, createLineDialog);
2285
- }
2286
- if (panel) panel.dom.querySelector("input").focus();
2287
- return true;
2288
- };
2289
- const baseTheme$1 = /*@__PURE__*/EditorView.baseTheme({
2290
- ".cm-panel.cm-gotoLine": {
2291
- padding: "2px 6px 4px",
2292
- "& label": {
2293
- fontSize: "80%"
2294
- }
2295
- }
2296
- });
2297
- const defaultHighlightOptions = {
2298
- highlightWordAroundCursor: false,
2299
- minSelectionLength: 1,
2300
- maxMatches: 100,
2301
- wholeWords: false
2302
- };
2303
- const highlightConfig = /*@__PURE__*/Facet.define({
2304
- combine(options) {
2305
- return combineConfig(options, defaultHighlightOptions, {
2306
- highlightWordAroundCursor: (a, b) => a || b,
2307
- minSelectionLength: Math.min,
2308
- maxMatches: Math.min
2309
- });
2310
- }
2311
- });
2312
- /**
2313
- This extension highlights text that matches the selection. It uses
2314
- the `"cm-selectionMatch"` class for the highlighting. When
2315
- `highlightWordAroundCursor` is enabled, the word at the cursor
2316
- itself will be highlighted with `"cm-selectionMatch-main"`.
2317
- */
2318
- function highlightSelectionMatches(options) {
2319
- let ext = [defaultTheme, matchHighlighter];
2320
- if (options) ext.push(highlightConfig.of(options));
2321
- return ext;
2322
- }
2323
- const matchDeco = /*@__PURE__*/Decoration.mark({
2324
- class: "cm-selectionMatch"
2325
- });
2326
- const mainMatchDeco = /*@__PURE__*/Decoration.mark({
2327
- class: "cm-selectionMatch cm-selectionMatch-main"
2328
- });
2329
- // Whether the characters directly outside the given positions are non-word characters
2330
- function insideWordBoundaries(check, state, from, to) {
2331
- return (from == 0 || check(state.sliceDoc(from - 1, from)) != CharCategory.Word) && (to == state.doc.length || check(state.sliceDoc(to, to + 1)) != CharCategory.Word);
2332
- }
2333
- // Whether the characters directly at the given positions are word characters
2334
- function insideWord(check, state, from, to) {
2335
- return check(state.sliceDoc(from, from + 1)) == CharCategory.Word && check(state.sliceDoc(to - 1, to)) == CharCategory.Word;
2336
- }
2337
- const matchHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {
2338
- constructor(view) {
2339
- this.decorations = this.getDeco(view);
2340
- }
2341
- update(update) {
2342
- if (update.selectionSet || update.docChanged || update.viewportChanged) this.decorations = this.getDeco(update.view);
2343
- }
2344
- getDeco(view) {
2345
- let conf = view.state.facet(highlightConfig);
2346
- let {
2347
- state
2348
- } = view,
2349
- sel = state.selection;
2350
- if (sel.ranges.length > 1) return Decoration.none;
2351
- let range = sel.main,
2352
- query,
2353
- check = null;
2354
- if (range.empty) {
2355
- if (!conf.highlightWordAroundCursor) return Decoration.none;
2356
- let word = state.wordAt(range.head);
2357
- if (!word) return Decoration.none;
2358
- check = state.charCategorizer(range.head);
2359
- query = state.sliceDoc(word.from, word.to);
2360
- } else {
2361
- let len = range.to - range.from;
2362
- if (len < conf.minSelectionLength || len > 200) return Decoration.none;
2363
- if (conf.wholeWords) {
2364
- query = state.sliceDoc(range.from, range.to); // TODO: allow and include leading/trailing space?
2365
- check = state.charCategorizer(range.head);
2366
- if (!(insideWordBoundaries(check, state, range.from, range.to) && insideWord(check, state, range.from, range.to))) return Decoration.none;
2367
- } else {
2368
- query = state.sliceDoc(range.from, range.to).trim();
2369
- if (!query) return Decoration.none;
2370
- }
2371
- }
2372
- let deco = [];
2373
- for (let part of view.visibleRanges) {
2374
- let cursor = new SearchCursor(state.doc, query, part.from, part.to);
2375
- while (!cursor.next().done) {
2376
- let {
2377
- from,
2378
- to
2379
- } = cursor.value;
2380
- if (!check || insideWordBoundaries(check, state, from, to)) {
2381
- if (range.empty && from <= range.from && to >= range.to) deco.push(mainMatchDeco.range(from, to));else if (from >= range.to || to <= range.from) deco.push(matchDeco.range(from, to));
2382
- if (deco.length > conf.maxMatches) return Decoration.none;
2383
- }
2384
- }
2385
- }
2386
- return Decoration.set(deco);
2387
- }
2388
- }, {
2389
- decorations: v => v.decorations
2390
- });
2391
- const defaultTheme = /*@__PURE__*/EditorView.baseTheme({
2392
- ".cm-selectionMatch": {
2393
- backgroundColor: "#99ff7780"
2394
- },
2395
- ".cm-searchMatch .cm-selectionMatch": {
2396
- backgroundColor: "transparent"
2397
- }
2398
- });
2399
- // Select the words around the cursors.
2400
- const selectWord = _ref => {
2401
- let {
2402
- state,
2403
- dispatch
2404
- } = _ref;
2405
- let {
2406
- selection
2407
- } = state;
2408
- let newSel = EditorSelection.create(selection.ranges.map(range => state.wordAt(range.head) || EditorSelection.cursor(range.head)), selection.mainIndex);
2409
- if (newSel.eq(selection)) return false;
2410
- dispatch(state.update({
2411
- selection: newSel
2412
- }));
2413
- return true;
2414
- };
2415
- // Find next occurrence of query relative to last cursor. Wrap around
2416
- // the document if there are no more matches.
2417
- function findNextOccurrence(state, query) {
2418
- let {
2419
- main,
2420
- ranges
2421
- } = state.selection;
2422
- let word = state.wordAt(main.head),
2423
- fullWord = word && word.from == main.from && word.to == main.to;
2424
- for (let cycled = false, cursor = new SearchCursor(state.doc, query, ranges[ranges.length - 1].to);;) {
2425
- cursor.next();
2426
- if (cursor.done) {
2427
- if (cycled) return null;
2428
- cursor = new SearchCursor(state.doc, query, 0, Math.max(0, ranges[ranges.length - 1].from - 1));
2429
- cycled = true;
2430
- } else {
2431
- if (cycled && ranges.some(r => r.from == cursor.value.from)) continue;
2432
- if (fullWord) {
2433
- let word = state.wordAt(cursor.value.from);
2434
- if (!word || word.from != cursor.value.from || word.to != cursor.value.to) continue;
2435
- }
2436
- return cursor.value;
2437
- }
2438
- }
2439
- }
2440
- /**
2441
- Select next occurrence of the current selection. Expand selection
2442
- to the surrounding word when the selection is empty.
2443
- */
2444
- const selectNextOccurrence = _ref2 => {
2445
- let {
2446
- state,
2447
- dispatch
2448
- } = _ref2;
2449
- let {
2450
- ranges
2451
- } = state.selection;
2452
- if (ranges.some(sel => sel.from === sel.to)) return selectWord({
2453
- state,
2454
- dispatch
2455
- });
2456
- let searchedText = state.sliceDoc(ranges[0].from, ranges[0].to);
2457
- if (state.selection.ranges.some(r => state.sliceDoc(r.from, r.to) != searchedText)) return false;
2458
- let range = findNextOccurrence(state, searchedText);
2459
- if (!range) return false;
2460
- dispatch(state.update({
2461
- selection: state.selection.addRange(EditorSelection.range(range.from, range.to), false),
2462
- effects: EditorView.scrollIntoView(range.to)
2463
- }));
2464
- return true;
2465
- };
2466
- const searchConfigFacet = /*@__PURE__*/Facet.define({
2467
- combine(configs) {
2468
- return combineConfig(configs, {
2469
- top: false,
2470
- caseSensitive: false,
2471
- literal: false,
2472
- wholeWord: false,
2473
- createPanel: view => new SearchPanel(view),
2474
- scrollToMatch: range => EditorView.scrollIntoView(range)
2475
- });
2476
- }
2477
- });
2478
- /**
2479
- A search query. Part of the editor's search state.
2480
- */
2481
- class SearchQuery {
2482
- /**
2483
- Create a query object.
2484
- */
2485
- constructor(config) {
2486
- this.search = config.search;
2487
- this.caseSensitive = !!config.caseSensitive;
2488
- this.literal = !!config.literal;
2489
- this.regexp = !!config.regexp;
2490
- this.replace = config.replace || "";
2491
- this.valid = !!this.search && (!this.regexp || validRegExp(this.search));
2492
- this.unquoted = this.unquote(this.search);
2493
- this.wholeWord = !!config.wholeWord;
2494
- }
2495
- /**
2496
- @internal
2497
- */
2498
- unquote(text) {
2499
- return this.literal ? text : text.replace(/\\([nrt\\])/g, (_, ch) => ch == "n" ? "\n" : ch == "r" ? "\r" : ch == "t" ? "\t" : "\\");
2500
- }
2501
- /**
2502
- Compare this query to another query.
2503
- */
2504
- eq(other) {
2505
- return this.search == other.search && this.replace == other.replace && this.caseSensitive == other.caseSensitive && this.regexp == other.regexp && this.wholeWord == other.wholeWord;
2506
- }
2507
- /**
2508
- @internal
2509
- */
2510
- create() {
2511
- return this.regexp ? new RegExpQuery(this) : new StringQuery(this);
2512
- }
2513
- /**
2514
- Get a search cursor for this query, searching through the given
2515
- range in the given state.
2516
- */
2517
- getCursor(state) {
2518
- let from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2519
- let to = arguments.length > 2 ? arguments[2] : undefined;
2520
- let st = state.doc ? state : EditorState.create({
2521
- doc: state
2522
- });
2523
- if (to == null) to = st.doc.length;
2524
- return this.regexp ? regexpCursor(this, st, from, to) : stringCursor(this, st, from, to);
2525
- }
2526
- }
2527
- class QueryType {
2528
- constructor(spec) {
2529
- this.spec = spec;
2530
- }
2531
- }
2532
- function stringCursor(spec, state, from, to) {
2533
- return new SearchCursor(state.doc, spec.unquoted, from, to, spec.caseSensitive ? undefined : x => x.toLowerCase(), spec.wholeWord ? stringWordTest(state.doc, state.charCategorizer(state.selection.main.head)) : undefined);
2534
- }
2535
- function stringWordTest(doc, categorizer) {
2536
- return (from, to, buf, bufPos) => {
2537
- if (bufPos > from || bufPos + buf.length < to) {
2538
- bufPos = Math.max(0, from - 2);
2539
- buf = doc.sliceString(bufPos, Math.min(doc.length, to + 2));
2540
- }
2541
- return (categorizer(charBefore(buf, from - bufPos)) != CharCategory.Word || categorizer(charAfter(buf, from - bufPos)) != CharCategory.Word) && (categorizer(charAfter(buf, to - bufPos)) != CharCategory.Word || categorizer(charBefore(buf, to - bufPos)) != CharCategory.Word);
2542
- };
2543
- }
2544
- class StringQuery extends QueryType {
2545
- constructor(spec) {
2546
- super(spec);
2547
- }
2548
- nextMatch(state, curFrom, curTo) {
2549
- let cursor = stringCursor(this.spec, state, curTo, state.doc.length).nextOverlapping();
2550
- if (cursor.done) cursor = stringCursor(this.spec, state, 0, curFrom).nextOverlapping();
2551
- return cursor.done ? null : cursor.value;
2552
- }
2553
- // Searching in reverse is, rather than implementing inverted search
2554
- // cursor, done by scanning chunk after chunk forward.
2555
- prevMatchInRange(state, from, to) {
2556
- for (let pos = to;;) {
2557
- let start = Math.max(from, pos - 10000 /* FindPrev.ChunkSize */ - this.spec.unquoted.length);
2558
- let cursor = stringCursor(this.spec, state, start, pos),
2559
- range = null;
2560
- while (!cursor.nextOverlapping().done) range = cursor.value;
2561
- if (range) return range;
2562
- if (start == from) return null;
2563
- pos -= 10000 /* FindPrev.ChunkSize */;
2564
- }
2565
- }
2566
-
2567
- prevMatch(state, curFrom, curTo) {
2568
- return this.prevMatchInRange(state, 0, curFrom) || this.prevMatchInRange(state, curTo, state.doc.length);
2569
- }
2570
- getReplacement(_result) {
2571
- return this.spec.unquote(this.spec.replace);
2572
- }
2573
- matchAll(state, limit) {
2574
- let cursor = stringCursor(this.spec, state, 0, state.doc.length),
2575
- ranges = [];
2576
- while (!cursor.next().done) {
2577
- if (ranges.length >= limit) return null;
2578
- ranges.push(cursor.value);
2579
- }
2580
- return ranges;
2581
- }
2582
- highlight(state, from, to, add) {
2583
- let cursor = stringCursor(this.spec, state, Math.max(0, from - this.spec.unquoted.length), Math.min(to + this.spec.unquoted.length, state.doc.length));
2584
- while (!cursor.next().done) add(cursor.value.from, cursor.value.to);
2585
- }
2586
- }
2587
- function regexpCursor(spec, state, from, to) {
2588
- return new RegExpCursor(state.doc, spec.search, {
2589
- ignoreCase: !spec.caseSensitive,
2590
- test: spec.wholeWord ? regexpWordTest(state.charCategorizer(state.selection.main.head)) : undefined
2591
- }, from, to);
2592
- }
2593
- function charBefore(str, index) {
2594
- return str.slice(findClusterBreak(str, index, false), index);
2595
- }
2596
- function charAfter(str, index) {
2597
- return str.slice(index, findClusterBreak(str, index));
2598
- }
2599
- function regexpWordTest(categorizer) {
2600
- return (_from, _to, match) => !match[0].length || (categorizer(charBefore(match.input, match.index)) != CharCategory.Word || categorizer(charAfter(match.input, match.index)) != CharCategory.Word) && (categorizer(charAfter(match.input, match.index + match[0].length)) != CharCategory.Word || categorizer(charBefore(match.input, match.index + match[0].length)) != CharCategory.Word);
2601
- }
2602
- class RegExpQuery extends QueryType {
2603
- nextMatch(state, curFrom, curTo) {
2604
- let cursor = regexpCursor(this.spec, state, curTo, state.doc.length).next();
2605
- if (cursor.done) cursor = regexpCursor(this.spec, state, 0, curFrom).next();
2606
- return cursor.done ? null : cursor.value;
2607
- }
2608
- prevMatchInRange(state, from, to) {
2609
- for (let size = 1;; size++) {
2610
- let start = Math.max(from, to - size * 10000 /* FindPrev.ChunkSize */);
2611
- let cursor = regexpCursor(this.spec, state, start, to),
2612
- range = null;
2613
- while (!cursor.next().done) range = cursor.value;
2614
- if (range && (start == from || range.from > start + 10)) return range;
2615
- if (start == from) return null;
2616
- }
2617
- }
2618
- prevMatch(state, curFrom, curTo) {
2619
- return this.prevMatchInRange(state, 0, curFrom) || this.prevMatchInRange(state, curTo, state.doc.length);
2620
- }
2621
- getReplacement(result) {
2622
- return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g, (m, i) => i == "$" ? "$" : i == "&" ? result.match[0] : i != "0" && +i < result.match.length ? result.match[i] : m));
2623
- }
2624
- matchAll(state, limit) {
2625
- let cursor = regexpCursor(this.spec, state, 0, state.doc.length),
2626
- ranges = [];
2627
- while (!cursor.next().done) {
2628
- if (ranges.length >= limit) return null;
2629
- ranges.push(cursor.value);
2630
- }
2631
- return ranges;
2632
- }
2633
- highlight(state, from, to, add) {
2634
- let cursor = regexpCursor(this.spec, state, Math.max(0, from - 250 /* RegExp.HighlightMargin */), Math.min(to + 250 /* RegExp.HighlightMargin */, state.doc.length));
2635
- while (!cursor.next().done) add(cursor.value.from, cursor.value.to);
2636
- }
2637
- }
2638
- /**
2639
- A state effect that updates the current search query. Note that
2640
- this only has an effect if the search state has been initialized
2641
- (by including [`search`](https://codemirror.net/6/docs/ref/#search.search) in your configuration or
2642
- by running [`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel) at least
2643
- once).
2644
- */
2645
- const setSearchQuery = /*@__PURE__*/StateEffect.define();
2646
- const togglePanel$1 = /*@__PURE__*/StateEffect.define();
2647
- const searchState = /*@__PURE__*/StateField.define({
2648
- create(state) {
2649
- return new SearchState(defaultQuery(state).create(), null);
2650
- },
2651
- update(value, tr) {
2652
- for (let effect of tr.effects) {
2653
- if (effect.is(setSearchQuery)) value = new SearchState(effect.value.create(), value.panel);else if (effect.is(togglePanel$1)) value = new SearchState(value.query, effect.value ? createSearchPanel : null);
2654
- }
2655
- return value;
2656
- },
2657
- provide: f => showPanel.from(f, val => val.panel)
2658
- });
2659
- class SearchState {
2660
- constructor(query, panel) {
2661
- this.query = query;
2662
- this.panel = panel;
2663
- }
2664
- }
2665
- const matchMark = /*@__PURE__*/Decoration.mark({
2666
- class: "cm-searchMatch"
2667
- }),
2668
- selectedMatchMark = /*@__PURE__*/Decoration.mark({
2669
- class: "cm-searchMatch cm-searchMatch-selected"
2670
- });
2671
- const searchHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {
2672
- constructor(view) {
2673
- this.view = view;
2674
- this.decorations = this.highlight(view.state.field(searchState));
2675
- }
2676
- update(update) {
2677
- let state = update.state.field(searchState);
2678
- if (state != update.startState.field(searchState) || update.docChanged || update.selectionSet || update.viewportChanged) this.decorations = this.highlight(state);
2679
- }
2680
- highlight(_ref3) {
2681
- let {
2682
- query,
2683
- panel
2684
- } = _ref3;
2685
- if (!panel || !query.spec.valid) return Decoration.none;
2686
- let {
2687
- view
2688
- } = this;
2689
- let builder = new RangeSetBuilder();
2690
- for (let i = 0, ranges = view.visibleRanges, l = ranges.length; i < l; i++) {
2691
- let {
2692
- from,
2693
- to
2694
- } = ranges[i];
2695
- while (i < l - 1 && to > ranges[i + 1].from - 2 * 250 /* RegExp.HighlightMargin */) to = ranges[++i].to;
2696
- query.highlight(view.state, from, to, (from, to) => {
2697
- let selected = view.state.selection.ranges.some(r => r.from == from && r.to == to);
2698
- builder.add(from, to, selected ? selectedMatchMark : matchMark);
2699
- });
2700
- }
2701
- return builder.finish();
2702
- }
2703
- }, {
2704
- decorations: v => v.decorations
2705
- });
2706
- function searchCommand(f) {
2707
- return view => {
2708
- let state = view.state.field(searchState, false);
2709
- return state && state.query.spec.valid ? f(view, state) : openSearchPanel(view);
2710
- };
2711
- }
2712
- /**
2713
- Open the search panel if it isn't already open, and move the
2714
- selection to the first match after the current main selection.
2715
- Will wrap around to the start of the document when it reaches the
2716
- end.
2717
- */
2718
- const findNext = /*@__PURE__*/searchCommand((view, _ref4) => {
2719
- let {
2720
- query
2721
- } = _ref4;
2722
- let {
2723
- to
2724
- } = view.state.selection.main;
2725
- let next = query.nextMatch(view.state, to, to);
2726
- if (!next) return false;
2727
- let selection = EditorSelection.single(next.from, next.to);
2728
- let config = view.state.facet(searchConfigFacet);
2729
- view.dispatch({
2730
- selection,
2731
- effects: [announceMatch(view, next), config.scrollToMatch(selection.main)],
2732
- userEvent: "select.search"
2733
- });
2734
- return true;
2735
- });
2736
- /**
2737
- Move the selection to the previous instance of the search query,
2738
- before the current main selection. Will wrap past the start
2739
- of the document to start searching at the end again.
2740
- */
2741
- const findPrevious = /*@__PURE__*/searchCommand((view, _ref5) => {
2742
- let {
2743
- query
2744
- } = _ref5;
2745
- let {
2746
- state
2747
- } = view,
2748
- {
2749
- from
2750
- } = state.selection.main;
2751
- let prev = query.prevMatch(state, from, from);
2752
- if (!prev) return false;
2753
- let selection = EditorSelection.single(prev.from, prev.to);
2754
- let config = view.state.facet(searchConfigFacet);
2755
- view.dispatch({
2756
- selection,
2757
- effects: [announceMatch(view, prev), config.scrollToMatch(selection.main)],
2758
- userEvent: "select.search"
2759
- });
2760
- return true;
2761
- });
2762
- /**
2763
- Select all instances of the search query.
2764
- */
2765
- const selectMatches = /*@__PURE__*/searchCommand((view, _ref6) => {
2766
- let {
2767
- query
2768
- } = _ref6;
2769
- let ranges = query.matchAll(view.state, 1000);
2770
- if (!ranges || !ranges.length) return false;
2771
- view.dispatch({
2772
- selection: EditorSelection.create(ranges.map(r => EditorSelection.range(r.from, r.to))),
2773
- userEvent: "select.search.matches"
2774
- });
2775
- return true;
2776
- });
2777
- /**
2778
- Select all instances of the currently selected text.
2779
- */
2780
- const selectSelectionMatches = _ref7 => {
2781
- let {
2782
- state,
2783
- dispatch
2784
- } = _ref7;
2785
- let sel = state.selection;
2786
- if (sel.ranges.length > 1 || sel.main.empty) return false;
2787
- let {
2788
- from,
2789
- to
2790
- } = sel.main;
2791
- let ranges = [],
2792
- main = 0;
2793
- for (let cur = new SearchCursor(state.doc, state.sliceDoc(from, to)); !cur.next().done;) {
2794
- if (ranges.length > 1000) return false;
2795
- if (cur.value.from == from) main = ranges.length;
2796
- ranges.push(EditorSelection.range(cur.value.from, cur.value.to));
2797
- }
2798
- dispatch(state.update({
2799
- selection: EditorSelection.create(ranges, main),
2800
- userEvent: "select.search.matches"
2801
- }));
2802
- return true;
2803
- };
2804
- /**
2805
- Replace the current match of the search query.
2806
- */
2807
- const replaceNext = /*@__PURE__*/searchCommand((view, _ref8) => {
2808
- let {
2809
- query
2810
- } = _ref8;
2811
- let {
2812
- state
2813
- } = view,
2814
- {
2815
- from,
2816
- to
2817
- } = state.selection.main;
2818
- if (state.readOnly) return false;
2819
- let next = query.nextMatch(state, from, from);
2820
- if (!next) return false;
2821
- let changes = [],
2822
- selection,
2823
- replacement;
2824
- let effects = [];
2825
- if (next.from == from && next.to == to) {
2826
- replacement = state.toText(query.getReplacement(next));
2827
- changes.push({
2828
- from: next.from,
2829
- to: next.to,
2830
- insert: replacement
2831
- });
2832
- next = query.nextMatch(state, next.from, next.to);
2833
- effects.push(EditorView.announce.of(state.phrase("replaced match on line $", state.doc.lineAt(from).number) + "."));
2834
- }
2835
- if (next) {
2836
- let off = changes.length == 0 || changes[0].from >= next.to ? 0 : next.to - next.from - replacement.length;
2837
- selection = EditorSelection.single(next.from - off, next.to - off);
2838
- effects.push(announceMatch(view, next));
2839
- effects.push(state.facet(searchConfigFacet).scrollToMatch(selection.main));
2840
- }
2841
- view.dispatch({
2842
- changes,
2843
- selection,
2844
- effects,
2845
- userEvent: "input.replace"
2846
- });
2847
- return true;
2848
- });
2849
- /**
2850
- Replace all instances of the search query with the given
2851
- replacement.
2852
- */
2853
- const replaceAll = /*@__PURE__*/searchCommand((view, _ref9) => {
2854
- let {
2855
- query
2856
- } = _ref9;
2857
- if (view.state.readOnly) return false;
2858
- let changes = query.matchAll(view.state, 1e9).map(match => {
2859
- let {
2860
- from,
2861
- to
2862
- } = match;
2863
- return {
2864
- from,
2865
- to,
2866
- insert: query.getReplacement(match)
2867
- };
2868
- });
2869
- if (!changes.length) return false;
2870
- let announceText = view.state.phrase("replaced $ matches", changes.length) + ".";
2871
- view.dispatch({
2872
- changes,
2873
- effects: EditorView.announce.of(announceText),
2874
- userEvent: "input.replace.all"
2875
- });
2876
- return true;
2877
- });
2878
- function createSearchPanel(view) {
2879
- return view.state.facet(searchConfigFacet).createPanel(view);
2880
- }
2881
- function defaultQuery(state, fallback) {
2882
- var _a, _b, _c, _d;
2883
- let sel = state.selection.main;
2884
- let selText = sel.empty || sel.to > sel.from + 100 ? "" : state.sliceDoc(sel.from, sel.to);
2885
- if (fallback && !selText) return fallback;
2886
- let config = state.facet(searchConfigFacet);
2887
- return new SearchQuery({
2888
- search: ((_a = fallback === null || fallback === void 0 ? void 0 : fallback.literal) !== null && _a !== void 0 ? _a : config.literal) ? selText : selText.replace(/\n/g, "\\n"),
2889
- caseSensitive: (_b = fallback === null || fallback === void 0 ? void 0 : fallback.caseSensitive) !== null && _b !== void 0 ? _b : config.caseSensitive,
2890
- literal: (_c = fallback === null || fallback === void 0 ? void 0 : fallback.literal) !== null && _c !== void 0 ? _c : config.literal,
2891
- wholeWord: (_d = fallback === null || fallback === void 0 ? void 0 : fallback.wholeWord) !== null && _d !== void 0 ? _d : config.wholeWord
2892
- });
2893
- }
2894
- /**
2895
- Make sure the search panel is open and focused.
2896
- */
2897
- const openSearchPanel = view => {
2898
- let state = view.state.field(searchState, false);
2899
- if (state && state.panel) {
2900
- let panel = getPanel(view, createSearchPanel);
2901
- if (!panel) return false;
2902
- let searchInput = panel.dom.querySelector("[main-field]");
2903
- if (searchInput && searchInput != view.root.activeElement) {
2904
- let query = defaultQuery(view.state, state.query.spec);
2905
- if (query.valid) view.dispatch({
2906
- effects: setSearchQuery.of(query)
2907
- });
2908
- searchInput.focus();
2909
- searchInput.select();
2910
- }
2911
- } else {
2912
- view.dispatch({
2913
- effects: [togglePanel$1.of(true), state ? setSearchQuery.of(defaultQuery(view.state, state.query.spec)) : StateEffect.appendConfig.of(searchExtensions)]
2914
- });
2915
- }
2916
- return true;
2917
- };
2918
- /**
2919
- Close the search panel.
2920
- */
2921
- const closeSearchPanel = view => {
2922
- let state = view.state.field(searchState, false);
2923
- if (!state || !state.panel) return false;
2924
- let panel = getPanel(view, createSearchPanel);
2925
- if (panel && panel.dom.contains(view.root.activeElement)) view.focus();
2926
- view.dispatch({
2927
- effects: togglePanel$1.of(false)
2928
- });
2929
- return true;
2930
- };
2931
- /**
2932
- Default search-related key bindings.
2933
-
2934
- - Mod-f: [`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel)
2935
- - F3, Mod-g: [`findNext`](https://codemirror.net/6/docs/ref/#search.findNext)
2936
- - Shift-F3, Shift-Mod-g: [`findPrevious`](https://codemirror.net/6/docs/ref/#search.findPrevious)
2937
- - Alt-g: [`gotoLine`](https://codemirror.net/6/docs/ref/#search.gotoLine)
2938
- - Mod-d: [`selectNextOccurrence`](https://codemirror.net/6/docs/ref/#search.selectNextOccurrence)
2939
- */
2940
- const searchKeymap = [{
2941
- key: "Mod-f",
2942
- run: openSearchPanel,
2943
- scope: "editor search-panel"
2944
- }, {
2945
- key: "F3",
2946
- run: findNext,
2947
- shift: findPrevious,
2948
- scope: "editor search-panel",
2949
- preventDefault: true
2950
- }, {
2951
- key: "Mod-g",
2952
- run: findNext,
2953
- shift: findPrevious,
2954
- scope: "editor search-panel",
2955
- preventDefault: true
2956
- }, {
2957
- key: "Escape",
2958
- run: closeSearchPanel,
2959
- scope: "editor search-panel"
2960
- }, {
2961
- key: "Mod-Shift-l",
2962
- run: selectSelectionMatches
2963
- }, {
2964
- key: "Alt-g",
2965
- run: gotoLine
2966
- }, {
2967
- key: "Mod-d",
2968
- run: selectNextOccurrence,
2969
- preventDefault: true
2970
- }];
2971
- class SearchPanel {
2972
- constructor(view) {
2973
- this.view = view;
2974
- let query = this.query = view.state.field(searchState).query.spec;
2975
- this.commit = this.commit.bind(this);
2976
- this.searchField = crelt("input", {
2977
- value: query.search,
2978
- placeholder: phrase(view, "Find"),
2979
- "aria-label": phrase(view, "Find"),
2980
- class: "cm-textfield",
2981
- name: "search",
2982
- form: "",
2983
- "main-field": "true",
2984
- onchange: this.commit,
2985
- onkeyup: this.commit
2986
- });
2987
- this.replaceField = crelt("input", {
2988
- value: query.replace,
2989
- placeholder: phrase(view, "Replace"),
2990
- "aria-label": phrase(view, "Replace"),
2991
- class: "cm-textfield",
2992
- name: "replace",
2993
- form: "",
2994
- onchange: this.commit,
2995
- onkeyup: this.commit
2996
- });
2997
- this.caseField = crelt("input", {
2998
- type: "checkbox",
2999
- name: "case",
3000
- form: "",
3001
- checked: query.caseSensitive,
3002
- onchange: this.commit
3003
- });
3004
- this.reField = crelt("input", {
3005
- type: "checkbox",
3006
- name: "re",
3007
- form: "",
3008
- checked: query.regexp,
3009
- onchange: this.commit
3010
- });
3011
- this.wordField = crelt("input", {
3012
- type: "checkbox",
3013
- name: "word",
3014
- form: "",
3015
- checked: query.wholeWord,
3016
- onchange: this.commit
3017
- });
3018
- function button(name, onclick, content) {
3019
- return crelt("button", {
3020
- class: "cm-button",
3021
- name,
3022
- onclick,
3023
- type: "button"
3024
- }, content);
3025
- }
3026
- this.dom = crelt("div", {
3027
- onkeydown: e => this.keydown(e),
3028
- class: "cm-search"
3029
- }, [this.searchField, button("next", () => findNext(view), [phrase(view, "next")]), button("prev", () => findPrevious(view), [phrase(view, "previous")]), button("select", () => selectMatches(view), [phrase(view, "all")]), crelt("label", null, [this.caseField, phrase(view, "match case")]), crelt("label", null, [this.reField, phrase(view, "regexp")]), crelt("label", null, [this.wordField, phrase(view, "by word")]), ...(view.state.readOnly ? [] : [crelt("br"), this.replaceField, button("replace", () => replaceNext(view), [phrase(view, "replace")]), button("replaceAll", () => replaceAll(view), [phrase(view, "replace all")])]), crelt("button", {
3030
- name: "close",
3031
- onclick: () => closeSearchPanel(view),
3032
- "aria-label": phrase(view, "close"),
3033
- type: "button"
3034
- }, ["×"])]);
3035
- }
3036
- commit() {
3037
- let query = new SearchQuery({
3038
- search: this.searchField.value,
3039
- caseSensitive: this.caseField.checked,
3040
- regexp: this.reField.checked,
3041
- wholeWord: this.wordField.checked,
3042
- replace: this.replaceField.value
3043
- });
3044
- if (!query.eq(this.query)) {
3045
- this.query = query;
3046
- this.view.dispatch({
3047
- effects: setSearchQuery.of(query)
3048
- });
3049
- }
3050
- }
3051
- keydown(e) {
3052
- if (runScopeHandlers(this.view, e, "search-panel")) {
3053
- e.preventDefault();
3054
- } else if (e.keyCode == 13 && e.target == this.searchField) {
3055
- e.preventDefault();
3056
- (e.shiftKey ? findPrevious : findNext)(this.view);
3057
- } else if (e.keyCode == 13 && e.target == this.replaceField) {
3058
- e.preventDefault();
3059
- replaceNext(this.view);
3060
- }
3061
- }
3062
- update(update) {
3063
- for (let tr of update.transactions) for (let effect of tr.effects) {
3064
- if (effect.is(setSearchQuery) && !effect.value.eq(this.query)) this.setQuery(effect.value);
3065
- }
3066
- }
3067
- setQuery(query) {
3068
- this.query = query;
3069
- this.searchField.value = query.search;
3070
- this.replaceField.value = query.replace;
3071
- this.caseField.checked = query.caseSensitive;
3072
- this.reField.checked = query.regexp;
3073
- this.wordField.checked = query.wholeWord;
3074
- }
3075
- mount() {
3076
- this.searchField.select();
3077
- }
3078
- get pos() {
3079
- return 80;
3080
- }
3081
- get top() {
3082
- return this.view.state.facet(searchConfigFacet).top;
3083
- }
3084
- }
3085
- function phrase(view, phrase) {
3086
- return view.state.phrase(phrase);
3087
- }
3088
- const AnnounceMargin = 30;
3089
- const Break = /[\s\.,:;?!]/;
3090
- function announceMatch(view, _ref10) {
3091
- let {
3092
- from,
3093
- to
3094
- } = _ref10;
3095
- let line = view.state.doc.lineAt(from),
3096
- lineEnd = view.state.doc.lineAt(to).to;
3097
- let start = Math.max(line.from, from - AnnounceMargin),
3098
- end = Math.min(lineEnd, to + AnnounceMargin);
3099
- let text = view.state.sliceDoc(start, end);
3100
- if (start != line.from) {
3101
- for (let i = 0; i < AnnounceMargin; i++) if (!Break.test(text[i + 1]) && Break.test(text[i])) {
3102
- text = text.slice(i);
3103
- break;
3104
- }
3105
- }
3106
- if (end != lineEnd) {
3107
- for (let i = text.length - 1; i > text.length - AnnounceMargin; i--) if (!Break.test(text[i - 1]) && Break.test(text[i])) {
3108
- text = text.slice(0, i);
3109
- break;
3110
- }
3111
- }
3112
- return EditorView.announce.of(`${view.state.phrase("current match")}. ${text} ${view.state.phrase("on line")} ${line.number}.`);
3113
- }
3114
- const baseTheme$2 = /*@__PURE__*/EditorView.baseTheme({
3115
- ".cm-panel.cm-search": {
3116
- padding: "2px 6px 4px",
3117
- position: "relative",
3118
- "& [name=close]": {
3119
- position: "absolute",
3120
- top: "0",
3121
- right: "4px",
3122
- backgroundColor: "inherit",
3123
- border: "none",
3124
- font: "inherit",
3125
- padding: 0,
3126
- margin: 0
3127
- },
3128
- "& input, & button, & label": {
3129
- margin: ".2em .6em .2em 0"
3130
- },
3131
- "& input[type=checkbox]": {
3132
- marginRight: ".2em"
3133
- },
3134
- "& label": {
3135
- fontSize: "80%",
3136
- whiteSpace: "pre"
3137
- }
3138
- },
3139
- "&light .cm-searchMatch": {
3140
- backgroundColor: "#ffff0054"
3141
- },
3142
- "&dark .cm-searchMatch": {
3143
- backgroundColor: "#00ffff8a"
3144
- },
3145
- "&light .cm-searchMatch-selected": {
3146
- backgroundColor: "#ff6a0054"
3147
- },
3148
- "&dark .cm-searchMatch-selected": {
3149
- backgroundColor: "#ff00ff8a"
3150
- }
3151
- });
3152
- const searchExtensions = [searchState, /*@__PURE__*/Prec.lowest(searchHighlighter), baseTheme$2];
3153
-
3154
- class SelectedDiagnostic {
3155
- constructor(from, to, diagnostic) {
3156
- this.from = from;
3157
- this.to = to;
3158
- this.diagnostic = diagnostic;
3159
- }
3160
- }
3161
- class LintState {
3162
- constructor(diagnostics, panel, selected) {
3163
- this.diagnostics = diagnostics;
3164
- this.panel = panel;
3165
- this.selected = selected;
3166
- }
3167
- static init(diagnostics, panel, state) {
3168
- // Filter the list of diagnostics for which to create markers
3169
- let markedDiagnostics = diagnostics;
3170
- let diagnosticFilter = state.facet(lintConfig).markerFilter;
3171
- if (diagnosticFilter) markedDiagnostics = diagnosticFilter(markedDiagnostics);
3172
- let ranges = Decoration.set(markedDiagnostics.map(d => {
3173
- // For zero-length ranges or ranges covering only a line break, create a widget
3174
- return d.from == d.to || d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from ? Decoration.widget({
3175
- widget: new DiagnosticWidget(d),
3176
- diagnostic: d
3177
- }).range(d.from) : Decoration.mark({
3178
- attributes: {
3179
- class: "cm-lintRange cm-lintRange-" + d.severity
3180
- },
3181
- diagnostic: d
3182
- }).range(d.from, d.to);
3183
- }), true);
3184
- return new LintState(ranges, panel, findDiagnostic(ranges));
3185
- }
3186
- }
3187
- function findDiagnostic(diagnostics) {
3188
- let diagnostic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
3189
- let after = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
3190
- let found = null;
3191
- diagnostics.between(after, 1e9, (from, to, _ref) => {
3192
- let {
3193
- spec
3194
- } = _ref;
3195
- if (diagnostic && spec.diagnostic != diagnostic) return;
3196
- found = new SelectedDiagnostic(from, to, spec.diagnostic);
3197
- return false;
3198
- });
3199
- return found;
3200
- }
3201
- function hideTooltip(tr, tooltip) {
3202
- return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(tooltip.pos));
3203
- }
3204
- function maybeEnableLint(state, effects) {
3205
- return state.field(lintState, false) ? effects : effects.concat(StateEffect.appendConfig.of([lintState, EditorView.decorations.compute([lintState], state => {
3206
- let {
3207
- selected,
3208
- panel
3209
- } = state.field(lintState);
3210
- return !selected || !panel || selected.from == selected.to ? Decoration.none : Decoration.set([activeMark.range(selected.from, selected.to)]);
3211
- }), hoverTooltip(lintTooltip, {
3212
- hideOn: hideTooltip
3213
- }), baseTheme]));
3214
- }
3215
- /**
3216
- Returns a transaction spec which updates the current set of
3217
- diagnostics, and enables the lint extension if if wasn't already
3218
- active.
3219
- */
3220
- function setDiagnostics(state, diagnostics) {
3221
- return {
3222
- effects: maybeEnableLint(state, [setDiagnosticsEffect.of(diagnostics)])
3223
- };
3224
- }
3225
- /**
3226
- The state effect that updates the set of active diagnostics. Can
3227
- be useful when writing an extension that needs to track these.
3228
- */
3229
- const setDiagnosticsEffect = /*@__PURE__*/StateEffect.define();
3230
- const togglePanel = /*@__PURE__*/StateEffect.define();
3231
- const movePanelSelection = /*@__PURE__*/StateEffect.define();
3232
- const lintState = /*@__PURE__*/StateField.define({
3233
- create() {
3234
- return new LintState(Decoration.none, null, null);
3235
- },
3236
- update(value, tr) {
3237
- if (tr.docChanged) {
3238
- let mapped = value.diagnostics.map(tr.changes),
3239
- selected = null;
3240
- if (value.selected) {
3241
- let selPos = tr.changes.mapPos(value.selected.from, 1);
3242
- selected = findDiagnostic(mapped, value.selected.diagnostic, selPos) || findDiagnostic(mapped, null, selPos);
3243
- }
3244
- value = new LintState(mapped, value.panel, selected);
3245
- }
3246
- for (let effect of tr.effects) {
3247
- if (effect.is(setDiagnosticsEffect)) {
3248
- value = LintState.init(effect.value, value.panel, tr.state);
3249
- } else if (effect.is(togglePanel)) {
3250
- value = new LintState(value.diagnostics, effect.value ? LintPanel.open : null, value.selected);
3251
- } else if (effect.is(movePanelSelection)) {
3252
- value = new LintState(value.diagnostics, value.panel, effect.value);
3253
- }
3254
- }
3255
- return value;
3256
- },
3257
- provide: f => [showPanel.from(f, val => val.panel), EditorView.decorations.from(f, s => s.diagnostics)]
3258
- });
3259
- const activeMark = /*@__PURE__*/Decoration.mark({
3260
- class: "cm-lintRange cm-lintRange-active"
3261
- });
3262
- function lintTooltip(view, pos, side) {
3263
- let {
3264
- diagnostics
3265
- } = view.state.field(lintState);
3266
- let found = [],
3267
- stackStart = 2e8,
3268
- stackEnd = 0;
3269
- diagnostics.between(pos - (side < 0 ? 1 : 0), pos + (side > 0 ? 1 : 0), (from, to, _ref2) => {
3270
- let {
3271
- spec
3272
- } = _ref2;
3273
- if (pos >= from && pos <= to && (from == to || (pos > from || side > 0) && (pos < to || side < 0))) {
3274
- found.push(spec.diagnostic);
3275
- stackStart = Math.min(from, stackStart);
3276
- stackEnd = Math.max(to, stackEnd);
3277
- }
3278
- });
3279
- let diagnosticFilter = view.state.facet(lintConfig).tooltipFilter;
3280
- if (diagnosticFilter) found = diagnosticFilter(found);
3281
- if (!found.length) return null;
3282
- return {
3283
- pos: stackStart,
3284
- end: stackEnd,
3285
- above: view.state.doc.lineAt(stackStart).to < stackEnd,
3286
- create() {
3287
- return {
3288
- dom: diagnosticsTooltip(view, found)
3289
- };
3290
- }
3291
- };
3292
- }
3293
- function diagnosticsTooltip(view, diagnostics) {
3294
- return crelt("ul", {
3295
- class: "cm-tooltip-lint"
3296
- }, diagnostics.map(d => renderDiagnostic(view, d, false)));
3297
- }
3298
- /**
3299
- Command to open and focus the lint panel.
3300
- */
3301
- const openLintPanel = view => {
3302
- let field = view.state.field(lintState, false);
3303
- if (!field || !field.panel) view.dispatch({
3304
- effects: maybeEnableLint(view.state, [togglePanel.of(true)])
3305
- });
3306
- let panel = getPanel(view, LintPanel.open);
3307
- if (panel) panel.dom.querySelector(".cm-panel-lint ul").focus();
3308
- return true;
3309
- };
3310
- /**
3311
- Command to close the lint panel, when open.
3312
- */
3313
- const closeLintPanel = view => {
3314
- let field = view.state.field(lintState, false);
3315
- if (!field || !field.panel) return false;
3316
- view.dispatch({
3317
- effects: togglePanel.of(false)
3318
- });
3319
- return true;
3320
- };
3321
- /**
3322
- Move the selection to the next diagnostic.
3323
- */
3324
- const nextDiagnostic = view => {
3325
- let field = view.state.field(lintState, false);
3326
- if (!field) return false;
3327
- let sel = view.state.selection.main,
3328
- next = field.diagnostics.iter(sel.to + 1);
3329
- if (!next.value) {
3330
- next = field.diagnostics.iter(0);
3331
- if (!next.value || next.from == sel.from && next.to == sel.to) return false;
3332
- }
3333
- view.dispatch({
3334
- selection: {
3335
- anchor: next.from,
3336
- head: next.to
3337
- },
3338
- scrollIntoView: true
3339
- });
3340
- return true;
3341
- };
3342
- /**
3343
- A set of default key bindings for the lint functionality.
3344
-
3345
- - Ctrl-Shift-m (Cmd-Shift-m on macOS): [`openLintPanel`](https://codemirror.net/6/docs/ref/#lint.openLintPanel)
3346
- - F8: [`nextDiagnostic`](https://codemirror.net/6/docs/ref/#lint.nextDiagnostic)
3347
- */
3348
- const lintKeymap = [{
3349
- key: "Mod-Shift-m",
3350
- run: openLintPanel,
3351
- preventDefault: true
3352
- }, {
3353
- key: "F8",
3354
- run: nextDiagnostic
3355
- }];
3356
- const lintPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
3357
- constructor(view) {
3358
- this.view = view;
3359
- this.timeout = -1;
3360
- this.set = true;
3361
- let {
3362
- delay
3363
- } = view.state.facet(lintConfig);
3364
- this.lintTime = Date.now() + delay;
3365
- this.run = this.run.bind(this);
3366
- this.timeout = setTimeout(this.run, delay);
3367
- }
3368
- run() {
3369
- let now = Date.now();
3370
- if (now < this.lintTime - 10) {
3371
- setTimeout(this.run, this.lintTime - now);
3372
- } else {
3373
- this.set = false;
3374
- let {
3375
- state
3376
- } = this.view,
3377
- {
3378
- sources
3379
- } = state.facet(lintConfig);
3380
- Promise.all(sources.map(source => Promise.resolve(source(this.view)))).then(annotations => {
3381
- let all = annotations.reduce((a, b) => a.concat(b));
3382
- if (this.view.state.doc == state.doc) this.view.dispatch(setDiagnostics(this.view.state, all));
3383
- }, error => {
3384
- logException(this.view.state, error);
3385
- });
3386
- }
3387
- }
3388
- update(update) {
3389
- let config = update.state.facet(lintConfig);
3390
- if (update.docChanged || config != update.startState.facet(lintConfig) || config.needsRefresh && config.needsRefresh(update)) {
3391
- this.lintTime = Date.now() + config.delay;
3392
- if (!this.set) {
3393
- this.set = true;
3394
- this.timeout = setTimeout(this.run, config.delay);
3395
- }
3396
- }
3397
- }
3398
- force() {
3399
- if (this.set) {
3400
- this.lintTime = Date.now();
3401
- this.run();
3402
- }
3403
- }
3404
- destroy() {
3405
- clearTimeout(this.timeout);
3406
- }
3407
- });
3408
- const lintConfig = /*@__PURE__*/Facet.define({
3409
- combine(input) {
3410
- return Object.assign({
3411
- sources: input.map(i => i.source)
3412
- }, combineConfig(input.map(i => i.config), {
3413
- delay: 750,
3414
- markerFilter: null,
3415
- tooltipFilter: null,
3416
- needsRefresh: null
3417
- }, {
3418
- needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u)
3419
- }));
3420
- },
3421
- enables: lintPlugin
3422
- });
3423
- function assignKeys(actions) {
3424
- let assigned = [];
3425
- if (actions) actions: for (let {
3426
- name
3427
- } of actions) {
3428
- for (let i = 0; i < name.length; i++) {
3429
- let ch = name[i];
3430
- if (/[a-zA-Z]/.test(ch) && !assigned.some(c => c.toLowerCase() == ch.toLowerCase())) {
3431
- assigned.push(ch);
3432
- continue actions;
3433
- }
3434
- }
3435
- assigned.push("");
3436
- }
3437
- return assigned;
3438
- }
3439
- function renderDiagnostic(view, diagnostic, inPanel) {
3440
- var _a;
3441
- let keys = inPanel ? assignKeys(diagnostic.actions) : [];
3442
- return crelt("li", {
3443
- class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity
3444
- }, crelt("span", {
3445
- class: "cm-diagnosticText"
3446
- }, diagnostic.renderMessage ? diagnostic.renderMessage() : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
3447
- let fired = false,
3448
- click = e => {
3449
- e.preventDefault();
3450
- if (fired) return;
3451
- fired = true;
3452
- let found = findDiagnostic(view.state.field(lintState).diagnostics, diagnostic);
3453
- if (found) action.apply(view, found.from, found.to);
3454
- };
3455
- let {
3456
- name
3457
- } = action,
3458
- keyIndex = keys[i] ? name.indexOf(keys[i]) : -1;
3459
- let nameElt = keyIndex < 0 ? name : [name.slice(0, keyIndex), crelt("u", name.slice(keyIndex, keyIndex + 1)), name.slice(keyIndex + 1)];
3460
- return crelt("button", {
3461
- type: "button",
3462
- class: "cm-diagnosticAction",
3463
- onclick: click,
3464
- onmousedown: click,
3465
- "aria-label": ` Action: ${name}${keyIndex < 0 ? "" : ` (access key "${keys[i]})"`}.`
3466
- }, nameElt);
3467
- }), diagnostic.source && crelt("div", {
3468
- class: "cm-diagnosticSource"
3469
- }, diagnostic.source));
3470
- }
3471
- class DiagnosticWidget extends WidgetType {
3472
- constructor(diagnostic) {
3473
- super();
3474
- this.diagnostic = diagnostic;
3475
- }
3476
- eq(other) {
3477
- return other.diagnostic == this.diagnostic;
3478
- }
3479
- toDOM() {
3480
- return crelt("span", {
3481
- class: "cm-lintPoint cm-lintPoint-" + this.diagnostic.severity
3482
- });
3483
- }
3484
- }
3485
- class PanelItem {
3486
- constructor(view, diagnostic) {
3487
- this.diagnostic = diagnostic;
3488
- this.id = "item_" + Math.floor(Math.random() * 0xffffffff).toString(16);
3489
- this.dom = renderDiagnostic(view, diagnostic, true);
3490
- this.dom.id = this.id;
3491
- this.dom.setAttribute("role", "option");
3492
- }
3493
- }
3494
- class LintPanel {
3495
- constructor(view) {
3496
- this.view = view;
3497
- this.items = [];
3498
- let onkeydown = event => {
3499
- if (event.keyCode == 27) {
3500
- // Escape
3501
- closeLintPanel(this.view);
3502
- this.view.focus();
3503
- } else if (event.keyCode == 38 || event.keyCode == 33) {
3504
- // ArrowUp, PageUp
3505
- this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
3506
- } else if (event.keyCode == 40 || event.keyCode == 34) {
3507
- // ArrowDown, PageDown
3508
- this.moveSelection((this.selectedIndex + 1) % this.items.length);
3509
- } else if (event.keyCode == 36) {
3510
- // Home
3511
- this.moveSelection(0);
3512
- } else if (event.keyCode == 35) {
3513
- // End
3514
- this.moveSelection(this.items.length - 1);
3515
- } else if (event.keyCode == 13) {
3516
- // Enter
3517
- this.view.focus();
3518
- } else if (event.keyCode >= 65 && event.keyCode <= 90 && this.selectedIndex >= 0) {
3519
- // A-Z
3520
- let {
3521
- diagnostic
3522
- } = this.items[this.selectedIndex],
3523
- keys = assignKeys(diagnostic.actions);
3524
- for (let i = 0; i < keys.length; i++) if (keys[i].toUpperCase().charCodeAt(0) == event.keyCode) {
3525
- let found = findDiagnostic(this.view.state.field(lintState).diagnostics, diagnostic);
3526
- if (found) diagnostic.actions[i].apply(view, found.from, found.to);
3527
- }
3528
- } else {
3529
- return;
3530
- }
3531
- event.preventDefault();
3532
- };
3533
- let onclick = event => {
3534
- for (let i = 0; i < this.items.length; i++) {
3535
- if (this.items[i].dom.contains(event.target)) this.moveSelection(i);
3536
- }
3537
- };
3538
- this.list = crelt("ul", {
3539
- tabIndex: 0,
3540
- role: "listbox",
3541
- "aria-label": this.view.state.phrase("Diagnostics"),
3542
- onkeydown,
3543
- onclick
3544
- });
3545
- this.dom = crelt("div", {
3546
- class: "cm-panel-lint"
3547
- }, this.list, crelt("button", {
3548
- type: "button",
3549
- name: "close",
3550
- "aria-label": this.view.state.phrase("close"),
3551
- onclick: () => closeLintPanel(this.view)
3552
- }, "×"));
3553
- this.update();
3554
- }
3555
- get selectedIndex() {
3556
- let selected = this.view.state.field(lintState).selected;
3557
- if (!selected) return -1;
3558
- for (let i = 0; i < this.items.length; i++) if (this.items[i].diagnostic == selected.diagnostic) return i;
3559
- return -1;
3560
- }
3561
- update() {
3562
- let {
3563
- diagnostics,
3564
- selected
3565
- } = this.view.state.field(lintState);
3566
- let i = 0,
3567
- needsSync = false,
3568
- newSelectedItem = null;
3569
- diagnostics.between(0, this.view.state.doc.length, (_start, _end, _ref3) => {
3570
- let {
3571
- spec
3572
- } = _ref3;
3573
- let found = -1,
3574
- item;
3575
- for (let j = i; j < this.items.length; j++) if (this.items[j].diagnostic == spec.diagnostic) {
3576
- found = j;
3577
- break;
3578
- }
3579
- if (found < 0) {
3580
- item = new PanelItem(this.view, spec.diagnostic);
3581
- this.items.splice(i, 0, item);
3582
- needsSync = true;
3583
- } else {
3584
- item = this.items[found];
3585
- if (found > i) {
3586
- this.items.splice(i, found - i);
3587
- needsSync = true;
3588
- }
3589
- }
3590
- if (selected && item.diagnostic == selected.diagnostic) {
3591
- if (!item.dom.hasAttribute("aria-selected")) {
3592
- item.dom.setAttribute("aria-selected", "true");
3593
- newSelectedItem = item;
3594
- }
3595
- } else if (item.dom.hasAttribute("aria-selected")) {
3596
- item.dom.removeAttribute("aria-selected");
3597
- }
3598
- i++;
3599
- });
3600
- while (i < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0)) {
3601
- needsSync = true;
3602
- this.items.pop();
3603
- }
3604
- if (this.items.length == 0) {
3605
- this.items.push(new PanelItem(this.view, {
3606
- from: -1,
3607
- to: -1,
3608
- severity: "info",
3609
- message: this.view.state.phrase("No diagnostics")
3610
- }));
3611
- needsSync = true;
3612
- }
3613
- if (newSelectedItem) {
3614
- this.list.setAttribute("aria-activedescendant", newSelectedItem.id);
3615
- this.view.requestMeasure({
3616
- key: this,
3617
- read: () => ({
3618
- sel: newSelectedItem.dom.getBoundingClientRect(),
3619
- panel: this.list.getBoundingClientRect()
3620
- }),
3621
- write: _ref4 => {
3622
- let {
3623
- sel,
3624
- panel
3625
- } = _ref4;
3626
- if (sel.top < panel.top) this.list.scrollTop -= panel.top - sel.top;else if (sel.bottom > panel.bottom) this.list.scrollTop += sel.bottom - panel.bottom;
3627
- }
3628
- });
3629
- } else if (this.selectedIndex < 0) {
3630
- this.list.removeAttribute("aria-activedescendant");
3631
- }
3632
- if (needsSync) this.sync();
3633
- }
3634
- sync() {
3635
- let domPos = this.list.firstChild;
3636
- function rm() {
3637
- let prev = domPos;
3638
- domPos = prev.nextSibling;
3639
- prev.remove();
3640
- }
3641
- for (let item of this.items) {
3642
- if (item.dom.parentNode == this.list) {
3643
- while (domPos != item.dom) rm();
3644
- domPos = item.dom.nextSibling;
3645
- } else {
3646
- this.list.insertBefore(item.dom, domPos);
3647
- }
3648
- }
3649
- while (domPos) rm();
3650
- }
3651
- moveSelection(selectedIndex) {
3652
- if (this.selectedIndex < 0) return;
3653
- let field = this.view.state.field(lintState);
3654
- let selection = findDiagnostic(field.diagnostics, this.items[selectedIndex].diagnostic);
3655
- if (!selection) return;
3656
- this.view.dispatch({
3657
- selection: {
3658
- anchor: selection.from,
3659
- head: selection.to
3660
- },
3661
- scrollIntoView: true,
3662
- effects: movePanelSelection.of(selection)
3663
- });
3664
- }
3665
- static open(view) {
3666
- return new LintPanel(view);
3667
- }
3668
- }
3669
- function svg(content) {
3670
- let attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `viewBox="0 0 40 40"`;
3671
- return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${attrs}>${encodeURIComponent(content)}</svg>')`;
3672
- }
3673
- function underline(color) {
3674
- return svg(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${color}" fill="none" stroke-width=".7"/>`, `width="6" height="3"`);
3675
- }
3676
- const baseTheme = /*@__PURE__*/EditorView.baseTheme({
3677
- ".cm-diagnostic": {
3678
- padding: "3px 6px 3px 8px",
3679
- marginLeft: "-1px",
3680
- display: "block",
3681
- whiteSpace: "pre-wrap"
3682
- },
3683
- ".cm-diagnostic-error": {
3684
- borderLeft: "5px solid #d11"
3685
- },
3686
- ".cm-diagnostic-warning": {
3687
- borderLeft: "5px solid orange"
3688
- },
3689
- ".cm-diagnostic-info": {
3690
- borderLeft: "5px solid #999"
3691
- },
3692
- ".cm-diagnosticAction": {
3693
- font: "inherit",
3694
- border: "none",
3695
- padding: "2px 4px",
3696
- backgroundColor: "#444",
3697
- color: "white",
3698
- borderRadius: "3px",
3699
- marginLeft: "8px",
3700
- cursor: "pointer"
3701
- },
3702
- ".cm-diagnosticSource": {
3703
- fontSize: "70%",
3704
- opacity: .7
3705
- },
3706
- ".cm-lintRange": {
3707
- backgroundPosition: "left bottom",
3708
- backgroundRepeat: "repeat-x",
3709
- paddingBottom: "0.7px"
3710
- },
3711
- ".cm-lintRange-error": {
3712
- backgroundImage: /*@__PURE__*/underline("#d11")
3713
- },
3714
- ".cm-lintRange-warning": {
3715
- backgroundImage: /*@__PURE__*/underline("orange")
3716
- },
3717
- ".cm-lintRange-info": {
3718
- backgroundImage: /*@__PURE__*/underline("#999")
3719
- },
3720
- ".cm-lintRange-active": {
3721
- backgroundColor: "#ffdd9980"
3722
- },
3723
- ".cm-tooltip-lint": {
3724
- padding: 0,
3725
- margin: 0
3726
- },
3727
- ".cm-lintPoint": {
3728
- position: "relative",
3729
- "&:after": {
3730
- content: '""',
3731
- position: "absolute",
3732
- bottom: 0,
3733
- left: "-2px",
3734
- borderLeft: "3px solid transparent",
3735
- borderRight: "3px solid transparent",
3736
- borderBottom: "4px solid #d11"
3737
- }
3738
- },
3739
- ".cm-lintPoint-warning": {
3740
- "&:after": {
3741
- borderBottomColor: "orange"
3742
- }
3743
- },
3744
- ".cm-lintPoint-info": {
3745
- "&:after": {
3746
- borderBottomColor: "#999"
3747
- }
3748
- },
3749
- ".cm-panel.cm-panel-lint": {
3750
- position: "relative",
3751
- "& ul": {
3752
- maxHeight: "100px",
3753
- overflowY: "auto",
3754
- "& [aria-selected]": {
3755
- backgroundColor: "#ddd",
3756
- "& u": {
3757
- textDecoration: "underline"
3758
- }
3759
- },
3760
- "&:focus [aria-selected]": {
3761
- background_fallback: "#bdf",
3762
- backgroundColor: "Highlight",
3763
- color_fallback: "white",
3764
- color: "HighlightText"
3765
- },
3766
- "& u": {
3767
- textDecoration: "none"
3768
- },
3769
- padding: 0,
3770
- margin: 0
3771
- },
3772
- "& [name=close]": {
3773
- position: "absolute",
3774
- top: "0",
3775
- right: "2px",
3776
- background: "inherit",
3777
- border: "none",
3778
- font: "inherit",
3779
- padding: 0,
3780
- margin: 0
3781
- }
3782
- }
3783
- });
3784
-
3785
- // (The superfluous function calls around the list of extensions work
3786
- // around current limitations in tree-shaking software.)
3787
- /**
3788
- This is an extension value that just pulls together a number of
3789
- extensions that you might want in a basic editor. It is meant as a
3790
- convenient helper to quickly set up CodeMirror without installing
3791
- and importing a lot of separate packages.
3792
-
3793
- Specifically, it includes...
3794
-
3795
- - [the default command bindings](https://codemirror.net/6/docs/ref/#commands.defaultKeymap)
3796
- - [line numbers](https://codemirror.net/6/docs/ref/#view.lineNumbers)
3797
- - [special character highlighting](https://codemirror.net/6/docs/ref/#view.highlightSpecialChars)
3798
- - [the undo history](https://codemirror.net/6/docs/ref/#commands.history)
3799
- - [a fold gutter](https://codemirror.net/6/docs/ref/#language.foldGutter)
3800
- - [custom selection drawing](https://codemirror.net/6/docs/ref/#view.drawSelection)
3801
- - [drop cursor](https://codemirror.net/6/docs/ref/#view.dropCursor)
3802
- - [multiple selections](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections)
3803
- - [reindentation on input](https://codemirror.net/6/docs/ref/#language.indentOnInput)
3804
- - [the default highlight style](https://codemirror.net/6/docs/ref/#language.defaultHighlightStyle) (as fallback)
3805
- - [bracket matching](https://codemirror.net/6/docs/ref/#language.bracketMatching)
3806
- - [bracket closing](https://codemirror.net/6/docs/ref/#autocomplete.closeBrackets)
3807
- - [autocompletion](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion)
3808
- - [rectangular selection](https://codemirror.net/6/docs/ref/#view.rectangularSelection) and [crosshair cursor](https://codemirror.net/6/docs/ref/#view.crosshairCursor)
3809
- - [active line highlighting](https://codemirror.net/6/docs/ref/#view.highlightActiveLine)
3810
- - [active line gutter highlighting](https://codemirror.net/6/docs/ref/#view.highlightActiveLineGutter)
3811
- - [selection match highlighting](https://codemirror.net/6/docs/ref/#search.highlightSelectionMatches)
3812
- - [search](https://codemirror.net/6/docs/ref/#search.searchKeymap)
3813
- - [linting](https://codemirror.net/6/docs/ref/#lint.lintKeymap)
3814
-
3815
- (You'll probably want to add some language package to your setup
3816
- too.)
3817
-
3818
- This extension does not allow customization. The idea is that,
3819
- once you decide you want to configure your editor more precisely,
3820
- you take this package's source (which is just a bunch of imports
3821
- and an array literal), copy it into your own code, and adjust it
3822
- as desired.
3823
- */
3824
- const basicSetup = /*@__PURE__*/(() => [lineNumbers(), highlightActiveLineGutter(), highlightSpecialChars(), history(), foldGutter(), drawSelection(), dropCursor(), EditorState.allowMultipleSelections.of(true), indentOnInput(), syntaxHighlighting(defaultHighlightStyle, {
3825
- fallback: true
3826
- }), bracketMatching(), closeBrackets(), autocompletion(), rectangularSelection(), crosshairCursor(), highlightActiveLine(), highlightSelectionMatches(), keymap.of([...closeBracketsKeymap, ...defaultKeymap, ...searchKeymap, ...historyKeymap, ...foldKeymap, ...completionKeymap, ...lintKeymap])])();
3827
-
3828
43
  //partially based on https://github.com/logue/vue-codemirror6/blob/master/src/components/CodeMirror.vue
3829
44
  var script = defineComponent({
3830
45
  name: 'OrCode',