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