@onereach/ui-components 4.3.3-beta.2627.0 → 4.3.3
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.
- package/dist/bundled/v2/{OrDateTimePickerMonthSelect-11e7596d.js → OrDateTimePickerMonthSelect-e20fd8dc.js} +3 -4
- package/dist/bundled/v2/components/OrBottomSheetV3/OrBottomSheet.js +4 -8
- package/dist/bundled/v2/components/OrButton/OrButton.js +1 -1
- package/dist/bundled/v2/components/OrButtonV2/OrButton.js +1 -1
- package/dist/bundled/v2/components/OrCardCollection/OrCardCollection.js +3 -4
- package/dist/bundled/v2/components/OrCarousel/OrCarousel.js +1 -7
- package/dist/bundled/v2/components/OrCheckbox/OrCheckbox.js +3 -4
- package/dist/bundled/v2/components/OrCheckboxGroupV3/OrCheckboxGroup.js +3 -4
- package/dist/bundled/v2/components/OrCheckboxTreeV3/OrCheckboxTree.js +3 -4
- package/dist/bundled/v2/components/OrCheckboxV3/OrCheckbox.js +3 -4
- package/dist/bundled/v2/components/OrCode/OrCode.js +197 -263
- package/dist/bundled/v2/components/OrCode/index.js +2 -2
- package/dist/bundled/v2/components/OrCode/lang.js +2 -2
- package/dist/bundled/v2/components/OrCode/theme.js +1 -1
- package/dist/bundled/v2/components/OrCollapse/OrCollapse.js +4 -6
- package/dist/bundled/v2/components/OrColorPicker/utils/defultPalette.js +1 -2
- package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +4 -5
- package/dist/bundled/v2/components/OrConfirm/index.js +1 -1
- package/dist/bundled/v2/components/OrConfirmV3/OrConfirm.js +4 -5
- package/dist/bundled/v2/components/OrConfirmV3/index.js +1 -1
- package/dist/bundled/v2/components/OrDatePickerV3/OrDatePicker.js +1 -1
- package/dist/bundled/v2/components/OrDatePickerV3/index.js +1 -1
- package/dist/bundled/v2/components/OrDateTimePickerV3/OrDateTimePicker.js +1 -1
- package/dist/bundled/v2/components/OrDateTimePickerV3/index.js +1 -1
- package/dist/bundled/v2/components/OrIconButtonV2/OrIconButton.js +4 -5
- package/dist/bundled/v2/components/OrInlineTextEdit/OrInlineTextEdit.js +3 -4
- package/dist/bundled/v2/components/OrList/OrList.js +4 -5
- package/dist/bundled/v2/components/OrMenuV3/OrMenu.js +5 -11
- package/dist/bundled/v2/components/OrModal/OrModal.js +20 -101
- package/dist/bundled/v2/components/OrNumberInput/OrNumberInput.js +3 -4
- package/dist/bundled/v2/components/OrOverflowMenu/OrOverflowMenu.js +3 -4
- package/dist/bundled/v2/components/OrPassword/OrPassword.js +3 -4
- package/dist/bundled/v2/components/OrPopoverV3/OrPopover.js +4 -8
- package/dist/bundled/v2/components/OrRadio/OrRadio.js +3 -4
- package/dist/bundled/v2/components/OrRadioGroupV3/OrRadioGroup.js +3 -4
- package/dist/bundled/v2/components/OrSearch/OrSearch.js +3 -4
- package/dist/bundled/v2/components/OrSelectV3/OrSelect.js +4 -8
- package/dist/bundled/v2/components/OrSidebarV3/OrSidebar.js +3 -4
- package/dist/bundled/v2/components/OrSwitch/OrSwitch.js +3 -4
- package/dist/bundled/v2/components/OrTabHeaderItem/OrTabHeaderItem.js +3 -4
- package/dist/bundled/v2/components/OrTabs/OrTabs.js +4 -5
- package/dist/bundled/v2/components/OrTabsV3/OrTabs.js +4 -8
- package/dist/bundled/v2/components/OrTextbox/OrTextbox.js +4 -5
- package/dist/bundled/v2/components/OrToast/OrToast.js +1 -1
- package/dist/bundled/v2/components/OrToast/composable/useToast.js +5 -10
- package/dist/bundled/v2/components/OrToastContainer/OrToastContainer.js +1 -1
- package/dist/bundled/v2/components/OrToastContainerV3/OrToastContainer.js +3 -6
- package/dist/bundled/v2/components/OrToastV3/composable/useToast.js +5 -10
- package/dist/bundled/v2/components/index.js +6 -6
- package/dist/bundled/v2/hooks/useElevation.js +1 -2
- package/dist/bundled/v2/hooks/useOverflow.js +4 -5
- package/dist/bundled/v2/hooks/useToggle.js +1 -2
- package/dist/bundled/{v3/index-e0b25cea.js → v2/index-6976c52a.js} +715 -1229
- package/dist/bundled/v2/index.js +6 -6
- package/dist/bundled/{v3/lang-973a418e.js → v2/lang-02d2bb2d.js} +196 -275
- package/dist/bundled/v2/utils/functions/color.js +1 -2
- package/dist/bundled/v2/utils/functions/flattenDeep.js +1 -2
- package/dist/bundled/v3/{OrBottomSheet.vue_vue_type_script_lang-4d344331.js → OrBottomSheet.vue_vue_type_script_lang-1e5544b0.js} +5 -9
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-d3f43900.js → OrCardCollection.vue_vue_type_script_lang-7a2e1332.js} +5 -6
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-53ff464f.js → OrCardCollection.vue_vue_type_script_lang-7d15b872.js} +3 -3
- package/dist/bundled/v3/{OrCarousel.vue_vue_type_script_lang-188ca513.js → OrCarousel.vue_vue_type_script_lang-6976844a.js} +1 -7
- package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-ba11d80f.js → OrCheckbox.vue_vue_type_script_lang-11b16d93.js} +3 -4
- package/dist/bundled/v3/{OrCheckbox.vue_vue_type_script_lang-75c6053a.js → OrCheckbox.vue_vue_type_script_lang-1cf06290.js} +3 -4
- package/dist/bundled/v3/{OrCheckboxTree.vue_vue_type_script_lang-528dd4d5.js → OrCheckboxTree.vue_vue_type_script_lang-4042ef27.js} +4 -5
- package/dist/bundled/v3/{OrChips.vue_vue_type_script_lang-211e03a1.js → OrChips.vue_vue_type_script_lang-d4bb44eb.js} +2 -4
- package/dist/bundled/v3/{OrCode.vue_vue_type_script_lang-ea34c576.js → OrCode.vue_vue_type_script_lang-5397df6a.js} +199 -265
- package/dist/bundled/v3/{OrCollapse.vue_vue_type_script_lang-45b18baf.js → OrCollapse.vue_vue_type_script_lang-5137ca99.js} +4 -6
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-cb05ea27.js → OrConfirm.vue_vue_type_script_lang-5ee20884.js} +6 -7
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-64d9dd5f.js → OrConfirm.vue_vue_type_script_lang-89febea7.js} +7 -8
- package/dist/bundled/v3/{OrDatePicker.vue_vue_type_script_lang-2dec05d3.js → OrDatePicker.vue_vue_type_script_lang-8c1c9c3e.js} +3 -3
- package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-6fd7c75e.js → OrDateTimePicker.vue_vue_type_script_lang-8ff54abd.js} +3 -5
- package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-365d6597.js → OrDateTimePicker.vue_vue_type_script_lang-cba80c1c.js} +3 -3
- package/dist/bundled/v3/{OrDateTimePickerMonthSelect-c42a6517.js → OrDateTimePickerMonthSelect-a9634fe9.js} +5 -6
- package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-fb99a3ea.js → OrIconButton.vue_vue_type_script_lang-96cb5b59.js} +3 -4
- package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-e30d0a1f.js → OrIconButton.vue_vue_type_script_lang-c2534846.js} +1 -1
- package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-aee9bc3b.js → OrInlineInput.vue_vue_type_script_lang-a8c0670a.js} +1 -1
- package/dist/bundled/v3/{OrInlineTextEdit.vue_vue_type_script_lang-869c7772.js → OrInlineTextEdit.vue_vue_type_script_lang-45987769.js} +5 -6
- package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-82570af3.js → OrInlineTextarea.vue_vue_type_script_lang-03708ef8.js} +1 -1
- package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-4067879f.js → OrInput.vue_vue_type_script_lang-ad995b35.js} +1 -1
- package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-75e02556.js → OrInput.vue_vue_type_script_lang-f9fef480.js} +1 -1
- package/dist/bundled/v3/{OrList.vue_vue_type_script_lang-47bafed1.js → OrList.vue_vue_type_script_lang-2c7537cc.js} +6 -7
- package/dist/bundled/v3/{OrListOfInputs.vue_vue_type_script_lang-006e0106.js → OrListOfInputs.vue_vue_type_script_lang-009f62a5.js} +3 -3
- package/dist/bundled/v3/{OrMenu.vue_vue_type_script_lang-50c154c4.js → OrMenu.vue_vue_type_script_lang-d3ea7d1e.js} +6 -12
- package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-08019fc7.js → OrModal.vue_vue_type_script_lang-07955a9f.js} +2 -2
- package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-ae842e5b.js → OrModal.vue_vue_type_script_lang-c53617ae.js} +21 -102
- package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-81fca13f.js → OrNotification.vue_vue_type_script_lang-5a62577f.js} +1 -1
- package/dist/bundled/v3/{OrNotification.vue_vue_type_script_lang-cf2e272c.js → OrNotification.vue_vue_type_script_lang-efb05bb2.js} +1 -1
- package/dist/bundled/v3/{OrNumberInput.vue_vue_type_script_lang-55c5ea8f.js → OrNumberInput.vue_vue_type_script_lang-1d469d1f.js} +4 -5
- package/dist/bundled/v3/{OrOverflowMenu.vue_vue_type_script_lang-fe2d0395.js → OrOverflowMenu.vue_vue_type_script_lang-ba50133f.js} +5 -6
- package/dist/bundled/v3/{OrPagination.vue_vue_type_script_lang-a1b05723.js → OrPagination.vue_vue_type_script_lang-60000de8.js} +1 -1
- package/dist/bundled/v3/{OrPassword.vue_vue_type_script_lang-1f5d2a91.js → OrPassword.vue_vue_type_script_lang-37f52611.js} +5 -6
- package/dist/bundled/v3/{OrPopover.vue_vue_type_script_lang-f159bc50.js → OrPopover.vue_vue_type_script_lang-65598970.js} +5 -9
- package/dist/bundled/v3/{OrRadio.vue_vue_type_script_lang-e1617a0e.js → OrRadio.vue_vue_type_script_lang-cc11200c.js} +3 -4
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-0d161f08.js → OrSearch.vue_vue_type_script_lang-2726e332.js} +1 -1
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-7ac93e50.js → OrSearch.vue_vue_type_script_lang-bcb935c3.js} +5 -6
- package/dist/bundled/v3/{OrSegmentedControl.vue_vue_type_script_lang-ed0d9fe7.js → OrSegmentedControl.vue_vue_type_script_lang-d1b4694c.js} +1 -3
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-9ebf93f2.js → OrSelect.vue_vue_type_script_lang-c232523a.js} +8 -12
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-29a48259.js → OrSelect.vue_vue_type_script_lang-c82d8f58.js} +4 -8
- package/dist/bundled/v3/{OrSidebar.vue_vue_type_script_lang-e2579a69.js → OrSidebar.vue_vue_type_script_lang-0f22b364.js} +4 -5
- package/dist/bundled/v3/{OrStepper.vue_vue_type_script_lang-d230260e.js → OrStepper.vue_vue_type_script_lang-975a4df6.js} +1 -1
- package/dist/bundled/v3/{OrSwitch.vue_vue_type_script_lang-c986f062.js → OrSwitch.vue_vue_type_script_lang-1c079a74.js} +3 -4
- package/dist/bundled/v3/{OrTabHeaderItem.vue_vue_type_script_lang-29f331ec.js → OrTabHeaderItem.vue_vue_type_script_lang-0a67721f.js} +3 -4
- package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-5836b8bd.js → OrTabs.vue_vue_type_script_lang-06a89286.js} +5 -6
- package/dist/bundled/v3/{OrTabs.vue_vue_type_script_lang-b6d7c643.js → OrTabs.vue_vue_type_script_lang-ff032e95.js} +5 -9
- package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-32301d9c.js → OrTag.vue_vue_type_script_lang-e3ba4ecb.js} +1 -1
- package/dist/bundled/v3/{OrTextarea.vue_vue_type_script_lang-048cb245.js → OrTextarea.vue_vue_type_script_lang-1236e04a.js} +1 -1
- package/dist/bundled/v3/{OrTextbox.vue_vue_type_script_lang-dad835c3.js → OrTextbox.vue_vue_type_script_lang-812f302d.js} +6 -7
- package/dist/bundled/v3/{OrTimePicker.vue_vue_type_script_lang-7e1bbe0e.js → OrTimePicker.vue_vue_type_script_lang-34c2901e.js} +2 -2
- package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-0a4977d5.js → OrToastContainer.vue_vue_type_script_lang-16a49a54.js} +3 -6
- package/dist/bundled/v3/{OrTooltip.vue_vue_type_script_lang-9ec302b4.js → OrTooltip.vue_vue_type_script_lang-cd7c37c3.js} +1 -1
- package/dist/bundled/v3/components/OrAvatar/OrAvatar.js +4 -8
- package/dist/bundled/v3/components/OrAvatar/index.js +1 -1
- package/dist/bundled/v3/components/OrAvatarV3/OrAvatar.js +2 -2
- package/dist/bundled/v3/components/OrAvatarV3/index.js +1 -1
- package/dist/bundled/v3/components/OrBottomSheetV3/OrBottomSheet.js +3 -3
- package/dist/bundled/v3/components/OrBottomSheetV3/index.js +2 -2
- package/dist/bundled/v3/components/OrButton/OrButton.js +1 -1
- package/dist/bundled/v3/components/OrButtonV2/OrButton.js +3 -3
- package/dist/bundled/v3/components/OrButtonV2/index.js +2 -2
- package/dist/bundled/v3/components/OrCardCollection/OrCardCollection.js +6 -6
- package/dist/bundled/v3/components/OrCardCollection/index.js +5 -5
- package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +10 -10
- package/dist/bundled/v3/components/OrCardCollectionV3/index.js +9 -9
- package/dist/bundled/v3/components/OrCarousel/OrCarousel.js +2 -2
- package/dist/bundled/v3/components/OrCarousel/index.js +1 -1
- package/dist/bundled/v3/components/OrCheckbox/OrCheckbox.js +4 -8
- package/dist/bundled/v3/components/OrCheckbox/index.js +1 -1
- package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.js +5 -6
- package/dist/bundled/v3/components/OrCheckboxGroupV3/index.js +2 -2
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.js +3 -3
- package/dist/bundled/v3/components/OrCheckboxTreeV3/index.js +2 -2
- package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.js +3 -5
- package/dist/bundled/v3/components/OrCheckboxV3/index.js +1 -1
- package/dist/bundled/v3/components/OrChip/OrChip.js +3 -5
- package/dist/bundled/v3/components/OrChip/index.js +1 -1
- package/dist/bundled/v3/components/OrChips/OrChips.js +3 -3
- package/dist/bundled/v3/components/OrChips/index.js +2 -2
- package/dist/bundled/v3/components/OrCode/OrCode.js +6 -6
- package/dist/bundled/v3/components/OrCode/index.js +5 -5
- package/dist/bundled/v3/components/OrCode/lang.js +2 -2
- package/dist/bundled/v3/components/OrCode/theme.js +1 -1
- package/dist/bundled/v3/components/OrCollapse/OrCollapse.js +2 -2
- package/dist/bundled/v3/components/OrCollapse/index.js +1 -1
- package/dist/bundled/v3/components/OrColorPicker/OrColorPicker.js +3 -5
- package/dist/bundled/v3/components/OrColorPicker/index.js +1 -1
- package/dist/bundled/v3/components/OrColorPicker/utils/defultPalette.js +1 -2
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +8 -8
- package/dist/bundled/v3/components/OrConfirm/index.js +7 -7
- package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +9 -9
- package/dist/bundled/v3/components/OrConfirmV3/index.js +8 -8
- package/dist/bundled/v3/components/OrDatePickerV3/OrDatePicker.js +9 -9
- package/dist/bundled/v3/components/OrDatePickerV3/index.js +8 -8
- package/dist/bundled/v3/components/OrDateTimePicker/OrDateTimePicker.js +5 -7
- package/dist/bundled/v3/components/OrDateTimePicker/index.js +3 -3
- package/dist/bundled/v3/components/OrDateTimePickerV3/OrDateTimePicker.js +9 -9
- package/dist/bundled/v3/components/OrDateTimePickerV3/index.js +8 -8
- package/dist/bundled/v3/components/OrIcon/OrIcon.js +2 -6
- package/dist/bundled/v3/components/OrIconButtonV2/OrIconButton.js +3 -3
- package/dist/bundled/v3/components/OrIconButtonV2/index.js +1 -1
- package/dist/bundled/v3/components/OrIconButtonV3/OrIconButton.js +6 -6
- package/dist/bundled/v3/components/OrIconButtonV3/index.js +5 -5
- package/dist/bundled/v3/components/OrInlineInputV3/OrInlineInput.js +9 -13
- package/dist/bundled/v3/components/OrInlineInputV3/index.js +6 -6
- package/dist/bundled/v3/components/OrInlineTextEdit/OrInlineTextEdit.js +12 -28
- package/dist/bundled/v3/components/OrInlineTextEdit/index.js +3 -3
- package/dist/bundled/v3/components/OrInlineTextareaV3/OrInlineTextarea.js +9 -13
- package/dist/bundled/v3/components/OrInlineTextareaV3/index.js +6 -6
- package/dist/bundled/v3/components/OrInput/OrInput.js +6 -12
- package/dist/bundled/v3/components/OrInput/index.js +2 -2
- package/dist/bundled/v3/components/OrInputV3/OrInput.js +7 -7
- package/dist/bundled/v3/components/OrInputV3/index.js +6 -6
- package/dist/bundled/v3/components/OrList/OrList.js +4 -4
- package/dist/bundled/v3/components/OrList/index.js +3 -3
- package/dist/bundled/v3/components/OrListOfInputs/OrListOfInputs.js +54 -63
- package/dist/bundled/v3/components/OrListOfInputs/index.js +6 -6
- package/dist/bundled/v3/components/OrMenuV3/OrMenu.js +6 -8
- package/dist/bundled/v3/components/OrMenuV3/index.js +4 -4
- package/dist/bundled/v3/components/OrModal/OrModal.js +3 -3
- package/dist/bundled/v3/components/OrModal/index.js +2 -2
- package/dist/bundled/v3/components/OrModalV3/OrModal.js +7 -7
- package/dist/bundled/v3/components/OrModalV3/index.js +6 -6
- package/dist/bundled/v3/components/OrNotification/OrNotification.js +3 -3
- package/dist/bundled/v3/components/OrNotification/index.js +2 -2
- package/dist/bundled/v3/components/OrNotificationV3/OrNotification.js +7 -7
- package/dist/bundled/v3/components/OrNotificationV3/index.js +6 -6
- package/dist/bundled/v3/components/OrNumberInput/OrNumberInput.js +4 -4
- package/dist/bundled/v3/components/OrNumberInput/index.js +3 -3
- package/dist/bundled/v3/components/OrOverflowMenu/OrOverflowMenu.js +4 -4
- package/dist/bundled/v3/components/OrOverflowMenu/index.js +3 -3
- package/dist/bundled/v3/components/OrOverlayV3/OrOverlay.js +2 -2
- package/dist/bundled/v3/components/OrOverlayV3/index.js +1 -1
- package/dist/bundled/v3/components/OrPaginationV3/OrPagination.js +6 -6
- package/dist/bundled/v3/components/OrPaginationV3/index.js +5 -5
- package/dist/bundled/v3/components/OrPassword/OrPassword.js +5 -5
- package/dist/bundled/v3/components/OrPassword/index.js +4 -4
- package/dist/bundled/v3/components/OrPopoverV3/OrPopover.js +4 -4
- package/dist/bundled/v3/components/OrPopoverV3/index.js +3 -3
- package/dist/bundled/v3/components/OrRadio/OrRadio.js +3 -5
- package/dist/bundled/v3/components/OrRadio/index.js +1 -1
- package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.js +3 -4
- package/dist/bundled/v3/components/OrSearch/OrSearch.js +5 -5
- package/dist/bundled/v3/components/OrSearch/index.js +4 -4
- package/dist/bundled/v3/components/OrSearchV3/OrSearch.js +8 -8
- package/dist/bundled/v3/components/OrSearchV3/index.js +7 -7
- package/dist/bundled/v3/components/OrSegmentedControlV3/OrSegmentedControl.js +2 -2
- package/dist/bundled/v3/components/OrSegmentedControlV3/index.js +1 -1
- package/dist/bundled/v3/components/OrSelect/OrSelect.js +4 -4
- package/dist/bundled/v3/components/OrSelect/index.js +3 -3
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +10 -10
- package/dist/bundled/v3/components/OrSelectV3/index.js +9 -9
- package/dist/bundled/v3/components/OrSidebarV3/OrSidebar.js +7 -7
- package/dist/bundled/v3/components/OrSidebarV3/index.js +6 -6
- package/dist/bundled/v3/components/OrSlider/OrSlider.js +5 -17
- package/dist/bundled/v3/components/OrSlider/index.js +1 -1
- package/dist/bundled/v3/components/OrStepper/OrStepper.js +3 -3
- package/dist/bundled/v3/components/OrStepper/index.js +2 -2
- package/dist/bundled/v3/components/OrSwitch/OrSwitch.js +3 -5
- package/dist/bundled/v3/components/OrSwitch/index.js +1 -1
- package/dist/bundled/v3/components/OrTabHeaderItem/OrTabHeaderItem.js +3 -5
- package/dist/bundled/v3/components/OrTabHeaderItem/index.js +1 -1
- package/dist/bundled/v3/components/OrTabs/OrTabs.js +3 -3
- package/dist/bundled/v3/components/OrTabs/index.js +2 -2
- package/dist/bundled/v3/components/OrTabsV3/OrTabs.js +6 -6
- package/dist/bundled/v3/components/OrTabsV3/index.js +5 -5
- package/dist/bundled/v3/components/OrTag/OrTag.js +3 -5
- package/dist/bundled/v3/components/OrTag/index.js +1 -1
- package/dist/bundled/v3/components/OrTagV3/OrTag.js +7 -7
- package/dist/bundled/v3/components/OrTagV3/index.js +6 -6
- package/dist/bundled/v3/components/OrTextarea/OrTextarea.js +6 -12
- package/dist/bundled/v3/components/OrTextarea/index.js +2 -2
- package/dist/bundled/v3/components/OrTextbox/OrTextbox.js +10 -22
- package/dist/bundled/v3/components/OrTextbox/index.js +3 -3
- package/dist/bundled/v3/components/OrTimePickerV3/OrTimePicker.js +7 -7
- package/dist/bundled/v3/components/OrTimePickerV3/index.js +6 -6
- package/dist/bundled/v3/components/OrToast/OrToast.js +3 -5
- package/dist/bundled/v3/components/OrToast/composable/useToast.js +5 -10
- package/dist/bundled/v3/components/OrToast/index.js +2 -2
- package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.js +4 -4
- package/dist/bundled/v3/components/OrToastContainer/index.js +2 -2
- package/dist/bundled/v3/components/OrToastContainerV3/OrToastContainer.js +7 -7
- package/dist/bundled/v3/components/OrToastContainerV3/index.js +6 -6
- package/dist/bundled/v3/components/OrToastV3/OrToast.js +6 -8
- package/dist/bundled/v3/components/OrToastV3/composable/useToast.js +5 -10
- package/dist/bundled/v3/components/OrToastV3/index.js +6 -6
- package/dist/bundled/v3/components/OrTooltip/OrTooltip.js +2 -6
- package/dist/bundled/v3/components/OrTooltipV3/OrTooltip.js +5 -5
- package/dist/bundled/v3/components/OrTooltipV3/index.js +4 -4
- package/dist/bundled/v3/components/index.js +66 -66
- package/dist/bundled/v3/hooks/useElevation.js +1 -2
- package/dist/bundled/v3/hooks/useOverflow.js +4 -5
- package/dist/bundled/v3/hooks/useToggle.js +1 -2
- package/dist/bundled/{v2/index-e0b25cea.js → v3/index-6976c52a.js} +715 -1229
- package/dist/bundled/v3/index.js +66 -66
- package/dist/bundled/{v2/lang-973a418e.js → v3/lang-02d2bb2d.js} +196 -275
- package/dist/bundled/v3/utils/functions/color.js +1 -2
- package/dist/bundled/v3/utils/functions/flattenDeep.js +1 -2
- package/dist/esm/v2/{OrAvatar-3df48865.js → OrAvatar-12b0e276.js} +1 -1
- package/dist/esm/v2/{OrBottomSheet-6b875223.js → OrBottomSheet-0938dbde.js} +5 -9
- package/dist/esm/v2/{OrButton-dbf0efe7.js → OrButton-4e532ddb.js} +1 -1
- package/dist/esm/v2/OrButton-549e8852.js +195 -0
- package/dist/esm/v2/OrButton.vue_rollup-plugin-vue_styles.0-48c5883e.js +106 -0
- package/dist/esm/v2/{OrCardCollection-fe8a1a88.js → OrCardCollection-9bf513b7.js} +7 -8
- package/dist/esm/v2/{OrCardCollection-7a8cd067.js → OrCardCollection-ead1d063.js} +4 -4
- package/dist/esm/v2/{OrCarousel-5c2b2d10.js → OrCarousel-e0c2e387.js} +1 -7
- package/dist/esm/v2/{OrCheckbox-59332f84.js → OrCheckbox-60e4456b.js} +3 -4
- package/dist/esm/v2/{OrCheckbox-03e5eaff.js → OrCheckbox-7b98fc08.js} +3 -4
- package/dist/esm/v2/{OrCheckboxTree-df80d4ab.js → OrCheckboxTree-85f8ec89.js} +5 -6
- package/dist/esm/v2/{OrCode-0288dd2d.js → OrCode-e54e09f7.js} +7 -8
- package/dist/esm/v2/{OrCollapse-57c64292.js → OrCollapse-50e3914c.js} +4 -6
- package/dist/esm/v2/{OrColorPicker-ca470d10.js → OrColorPicker-fa92b4fa.js} +1 -2
- package/dist/esm/v2/{OrConfirm-b62d9ce4.js → OrConfirm-5d5dd9bc.js} +7 -8
- package/dist/esm/v2/{OrConfirm-09bb952d.js → OrConfirm-d1572223.js} +5 -6
- package/dist/esm/v2/{OrDatePicker-8603b729.js → OrDatePicker-ff4cebfb.js} +3 -3
- package/dist/esm/v2/{OrDateTimePicker-77ef1975.js → OrDateTimePicker-6e2853ec.js} +4 -4
- package/dist/esm/v2/{OrDateTimePicker-f270e639.js → OrDateTimePicker-da3d6d4d.js} +3 -3
- package/dist/esm/v2/{OrDateTimePickerMonthSelect-58303f9d.js → OrDateTimePickerMonthSelect-7803ed9e.js} +6 -7
- package/dist/esm/v2/{OrIconButton-e13b8108.js → OrIconButton-0ec2cda6.js} +2 -2
- package/dist/esm/v2/{OrIconButton-83608cbc.js → OrIconButton-23972f7d.js} +1 -1
- package/dist/esm/v2/OrIconButton.vue_rollup-plugin-vue_styles.0-277ce06c.js +205 -0
- package/dist/esm/v2/{OrInlineInput-3ad8d3e5.js → OrInlineInput-7a60a995.js} +1 -1
- package/dist/esm/v2/{OrInlineTextEdit-a129aaf1.js → OrInlineTextEdit-9541b625.js} +7 -8
- package/dist/esm/v2/{OrInlineTextarea-968008cc.js → OrInlineTextarea-56d8f558.js} +1 -1
- package/dist/esm/v2/{OrInput-d73d9322.js → OrInput-884b6686.js} +1 -1
- package/dist/esm/v2/{OrInput-bc2371b6.js → OrInput-c005a759.js} +1 -1
- package/dist/esm/v2/{OrList-7de293f5.js → OrList-61c7b8ea.js} +7 -8
- package/dist/esm/v2/{OrListOfInputs-fa926159.js → OrListOfInputs-e1b09290.js} +5 -5
- package/dist/esm/v2/{OrMenu-2f823afc.js → OrMenu-55befbc8.js} +6 -12
- package/dist/esm/v2/{OrModal-4d570c2f.js → OrModal-b0a470f9.js} +2 -2
- package/dist/esm/v2/{OrModal-3f09ae47.js → OrModal-b9cfb8ec.js} +6 -7
- package/dist/esm/v2/{OrNotification-855e31ad.js → OrNotification-4497b02f.js} +1 -1
- package/dist/esm/v2/{OrNotification-bfa97981.js → OrNotification-fdb88eec.js} +3 -3
- package/dist/esm/v2/{OrNumberInput-5b1135df.js → OrNumberInput-eb0e7087.js} +4 -5
- package/dist/esm/v2/{OrOverflowMenu-13fac7a3.js → OrOverflowMenu-83540c76.js} +7 -8
- package/dist/esm/v2/{OrOverlay-2b61ec26.js → OrOverlay-b1609eef.js} +1 -1
- package/dist/esm/v2/{OrPagination-a333b8a2.js → OrPagination-67b30f14.js} +2 -2
- package/dist/esm/v2/{OrPassword-82877067.js → OrPassword-022e10fd.js} +8 -9
- package/dist/esm/v2/{OrPopover-d7fc7c17.js → OrPopover-c902e2fd.js} +6 -10
- package/dist/esm/v2/{OrRadio-f53c0944.js → OrRadio-514e8de8.js} +3 -4
- package/dist/esm/v2/{OrSearch-330e9af0.js → OrSearch-620d5d76.js} +7 -8
- package/dist/esm/v2/{OrSearch-d5202cd2.js → OrSearch-dea30353.js} +1 -1
- package/dist/esm/v2/{OrSelect-c5e6f9ee.js → OrSelect-7266296e.js} +9 -13
- package/dist/esm/v2/{OrSelect-22eea9cc.js → OrSelect-d887118b.js} +1 -1
- package/dist/esm/v2/{OrSidebar-00b1be87.js → OrSidebar-82a4c03f.js} +4 -5
- package/dist/esm/v2/{OrSidebarCollapseButton-ace90e38.js → OrSidebarCollapseButton-c41c688a.js} +1 -1
- package/dist/esm/v2/{OrStepper-2ae3fc21.js → OrStepper-b00f7531.js} +2 -2
- package/dist/esm/v2/{OrSwitch-e7fe2b86.js → OrSwitch-cd24ee40.js} +3 -4
- package/dist/esm/v2/{OrTabHeaderItem-46947417.js → OrTabHeaderItem-6a08756e.js} +3 -4
- package/dist/esm/v2/{OrTabs-1b314eeb.js → OrTabs-12138346.js} +5 -6
- package/dist/esm/v2/{OrTabs-c383bde4.js → OrTabs-a8008116.js} +6 -10
- package/dist/esm/v2/{OrTag-a36ef302.js → OrTag-213bc082.js} +1 -1
- package/dist/esm/v2/{OrTag-8ded4261.js → OrTag-6349049b.js} +1 -1
- package/dist/esm/v2/{OrTextarea-226ab7a2.js → OrTextarea-724a4d6f.js} +1 -1
- package/dist/esm/v2/{OrTextbox-90badc95.js → OrTextbox-0373bd6a.js} +9 -10
- package/dist/esm/v2/{OrTimePicker-fc6fa5ab.js → OrTimePicker-038ceb81.js} +2 -2
- package/dist/esm/v2/{OrToastContainer-2f530752.js → OrToastContainer-1625b803.js} +4 -4
- package/dist/esm/v2/{OrTooltip-6add8ee9.js → OrTooltip-b7290ed1.js} +1 -1
- package/dist/esm/{v3/color-40b7fe6b.js → v2/color-1f348774.js} +1 -2
- package/dist/esm/v2/components/index.js +66 -66
- package/dist/esm/v2/components/or-avatar-v3/index.js +2 -2
- package/dist/esm/v2/components/or-bottom-sheet-v3/index.js +3 -3
- package/dist/esm/v2/components/or-button/index.js +1 -1
- package/dist/esm/v2/components/or-button-v2/index.js +4 -4
- package/dist/esm/v2/components/or-card-collection/index.js +7 -7
- package/dist/esm/v2/components/or-card-collection-v3/index.js +10 -10
- package/dist/esm/v2/components/or-carousel/index.js +1 -1
- package/dist/esm/v2/components/or-checkbox/index.js +1 -1
- package/dist/esm/v2/components/or-checkbox-group-v3/index.js +6 -7
- package/dist/esm/v2/components/or-checkbox-tree-v3/index.js +3 -3
- package/dist/esm/v2/components/or-checkbox-v3/index.js +1 -1
- package/dist/esm/v2/components/or-code/index.js +5 -5
- package/dist/esm/v2/components/or-collapse/index.js +1 -1
- package/dist/esm/v2/components/or-color-picker/index.js +1 -1
- package/dist/esm/v2/components/or-confirm/index.js +8 -8
- package/dist/esm/v2/components/or-confirm-v3/index.js +8 -8
- package/dist/esm/v2/components/or-date-picker-v3/index.js +9 -9
- package/dist/esm/v2/components/or-date-time-picker/index.js +5 -5
- package/dist/esm/v2/components/or-date-time-picker-v3/index.js +9 -9
- package/dist/esm/v2/components/or-icon-button-v2/index.js +2 -2
- package/dist/esm/v2/components/or-icon-button-v3/index.js +6 -6
- package/dist/esm/v2/components/or-inline-input-v3/index.js +7 -7
- package/dist/esm/v2/components/or-inline-text-edit/index.js +5 -5
- package/dist/esm/v2/components/or-inline-textarea-v3/index.js +7 -7
- package/dist/esm/v2/components/or-input/index.js +2 -2
- package/dist/esm/v2/components/or-input-v3/index.js +7 -7
- package/dist/esm/v2/components/or-list/index.js +5 -5
- package/dist/esm/v2/components/or-list-of-inputs/index.js +8 -8
- package/dist/esm/v2/components/or-menu-v3/index.js +5 -5
- package/dist/esm/v2/components/or-modal/index.js +4 -4
- package/dist/esm/v2/components/or-modal-v3/index.js +7 -7
- package/dist/esm/v2/components/or-notification/index.js +4 -4
- package/dist/esm/v2/components/or-notification-v3/index.js +7 -7
- package/dist/esm/v2/components/or-number-input/index.js +3 -3
- package/dist/esm/v2/components/or-overflow-menu/index.js +5 -5
- package/dist/esm/v2/components/or-overlay-v3/index.js +2 -2
- package/dist/esm/v2/components/or-pagination-v3/index.js +6 -6
- package/dist/esm/v2/components/or-password/index.js +7 -7
- package/dist/esm/v2/components/or-popover-v3/index.js +4 -4
- package/dist/esm/v2/components/or-radio/index.js +1 -1
- package/dist/esm/v2/components/or-radio-group-v3/index.js +3 -4
- package/dist/esm/v2/components/or-search/index.js +6 -6
- package/dist/esm/v2/components/or-search-v3/index.js +8 -8
- package/dist/esm/v2/components/or-select/index.js +2 -2
- package/dist/esm/v2/components/or-select-v3/index.js +11 -11
- package/dist/esm/v2/components/or-sidebar-v3/index.js +8 -8
- package/dist/esm/v2/components/or-sidebar-v3/partials/index.js +7 -7
- package/dist/esm/v2/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +7 -7
- package/dist/esm/v2/components/or-stepper/index.js +4 -4
- package/dist/esm/v2/components/or-switch/index.js +1 -1
- package/dist/esm/v2/components/or-tab-header-item/index.js +1 -1
- package/dist/esm/v2/components/or-tabs/index.js +2 -2
- package/dist/esm/v2/components/or-tabs-v3/index.js +6 -6
- package/dist/esm/v2/components/or-tag/index.js +2 -2
- package/dist/esm/v2/components/or-tag-v3/index.js +7 -7
- package/dist/esm/v2/components/or-textarea/index.js +2 -2
- package/dist/esm/v2/components/or-textbox/index.js +6 -6
- package/dist/esm/v2/components/or-time-picker-v3/index.js +7 -7
- package/dist/esm/v2/components/or-toast/composable/index.js +1 -1
- package/dist/esm/v2/components/or-toast/index.js +5 -5
- package/dist/esm/v2/components/or-toast/or-toast-container/index.js +5 -5
- package/dist/esm/v2/components/or-toast-v3/composable/index.js +1 -1
- package/dist/esm/v2/components/or-toast-v3/index.js +8 -8
- package/dist/esm/v2/components/or-toast-v3/or-toast-container-v3/index.js +8 -8
- package/dist/esm/v2/components/or-tooltip-v3/index.js +5 -5
- package/dist/esm/v2/{flattenDeep-fe0af413.js → flattenDeep-e7a8b995.js} +1 -2
- package/dist/esm/v2/hooks/index.js +3 -3
- package/dist/esm/v2/index.js +67 -67
- package/dist/esm/v2/{types-8fffa58d.js → types-b674518e.js} +5 -8
- package/dist/esm/{v3/useElevation-b5a49746.js → v2/useElevation-df91fa50.js} +1 -2
- package/dist/esm/{v3/useOverflow-c856b7b7.js → v2/useOverflow-af6161c8.js} +4 -5
- package/dist/esm/{v3/useToast-a1332cc2.js → v2/useToast-0665462d.js} +5 -10
- package/dist/esm/{v3/useToast-b5ea5cb2.js → v2/useToast-4fbe0e5a.js} +5 -10
- package/dist/esm/{v3/useToggle-c04fc920.js → v2/useToggle-29e4d7c7.js} +1 -2
- package/dist/esm/v3/{OrAvatar-8a73221d.js → OrAvatar-14a5c5f0.js} +3 -7
- package/dist/esm/v3/{OrAvatar-3ccb5f60.js → OrAvatar-1ebca2e8.js} +1 -1
- package/dist/esm/v3/{OrBottomSheet-67a0d6b5.js → OrBottomSheet-6538d9c3.js} +5 -9
- package/dist/esm/v3/OrButton-f8b10d79.js +142 -0
- package/dist/esm/v3/OrButton-fca9019a.js +162 -0
- package/dist/esm/v3/{OrCardCollection-d217f7af.js → OrCardCollection-b7d73647.js} +4 -4
- package/dist/esm/v3/{OrCardCollection-d79dac85.js → OrCardCollection-ffbb9eda.js} +7 -8
- package/dist/esm/v3/{OrCarousel-4fb775f8.js → OrCarousel-03597740.js} +2 -8
- package/dist/esm/v3/{OrCheckbox-56d7b6eb.js → OrCheckbox-247ce27b.js} +4 -7
- package/dist/esm/v3/{OrCheckbox-ab457011.js → OrCheckbox-7efd5f26.js} +6 -11
- package/dist/esm/v3/{OrCheckboxTree-4a85b9b3.js → OrCheckboxTree-ed8b5f53.js} +5 -6
- package/dist/esm/v3/{OrChip-1b479371.js → OrChip-97a85e10.js} +2 -4
- package/dist/esm/v3/{OrChips-544a35b3.js → OrChips-64b86761.js} +2 -4
- package/dist/esm/v3/{OrCode-48281fc0.js → OrCode-6f2e4d99.js} +6 -7
- package/dist/esm/v3/{OrCollapse-2b31de04.js → OrCollapse-37a52e8f.js} +4 -6
- package/dist/esm/v3/{OrColorPicker-ffaaf14f.js → OrColorPicker-9a149e6b.js} +2 -5
- package/dist/esm/v3/{OrConfirm-e57bd854.js → OrConfirm-14cefbad.js} +5 -6
- package/dist/esm/v3/{OrConfirm-1a94bdea.js → OrConfirm-ab04201f.js} +7 -8
- package/dist/esm/v3/{OrDatePicker-2533a646.js → OrDatePicker-748c8f09.js} +3 -3
- package/dist/esm/v3/{OrDateTimePicker-2af19719.js → OrDateTimePicker-014f7819.js} +5 -9
- package/dist/esm/v3/{OrDateTimePicker-94776158.js → OrDateTimePicker-10f2eb69.js} +3 -3
- package/dist/esm/v3/{OrDateTimePickerMonthSelect-13300c6e.js → OrDateTimePickerMonthSelect-7e13dcca.js} +6 -7
- package/dist/esm/v3/{OrIcon-b566a871.js → OrIcon-925c5413.js} +3 -7
- package/dist/esm/v3/{OrIconButton-025fb2de.js → OrIconButton-46b3c1e2.js} +2 -2
- package/dist/esm/v3/OrIconButton-5387fd59.js +222 -0
- package/dist/esm/v3/{OrInlineInput-11ed65f7.js → OrInlineInput-63b1d245.js} +3 -7
- package/dist/esm/v3/{OrInlineTextEdit-4f4ecba4.js → OrInlineTextEdit-6f97629f.js} +14 -31
- package/dist/esm/v3/{OrInlineTextarea-05769204.js → OrInlineTextarea-d03f81c4.js} +3 -7
- package/dist/esm/v3/{OrInput-53a32706.js → OrInput-0dbd5a01.js} +4 -10
- package/dist/esm/v3/{OrInput-c7763e63.js → OrInput-cc1991ff.js} +1 -1
- package/dist/esm/v3/{OrList-0543a645.js → OrList-b8799cf4.js} +7 -8
- package/dist/esm/v3/{OrListOfInputs-2fc8087c.js → OrListOfInputs-16ba8358.js} +52 -61
- package/dist/esm/v3/{OrMenu-054e0d2e.js → OrMenu-03a8a492.js} +7 -15
- package/dist/esm/v3/{OrModal-0173d0ff.js → OrModal-28d273a8.js} +2 -2
- package/dist/esm/v3/{OrModal-c420594e.js → OrModal-e6513e8c.js} +5 -6
- package/dist/esm/v3/{OrNotification-26bdb1ca.js → OrNotification-16190cf5.js} +1 -1
- package/dist/esm/v3/{OrNotification-9a696585.js → OrNotification-4c56f7ea.js} +3 -3
- package/dist/esm/v3/{OrNumberInput-a80859d1.js → OrNumberInput-dca5e850.js} +4 -5
- package/dist/esm/v3/{OrOverflowMenu-4b2d2950.js → OrOverflowMenu-fe77e22c.js} +5 -6
- package/dist/esm/v3/{OrOverlay-bf72f582.js → OrOverlay-d63d39c3.js} +1 -1
- package/dist/esm/v3/{OrPagination-a7fa36ad.js → OrPagination-6bf44eec.js} +2 -2
- package/dist/esm/v3/{OrPassword-35c5775f.js → OrPassword-9c8a458d.js} +7 -8
- package/dist/esm/v3/{OrPopover-986f867f.js → OrPopover-e34e8f6c.js} +6 -10
- package/dist/esm/v3/{OrRadio-dfd0f0c9.js → OrRadio-c3ab11f2.js} +4 -7
- package/dist/esm/v3/{OrSearch-bb3a3acc.js → OrSearch-7277ebfd.js} +1 -1
- package/dist/esm/v3/{OrSearch-f4ad73db.js → OrSearch-c4caf04e.js} +6 -7
- package/dist/esm/v3/{OrSegmentedControl-359fbf3a.js → OrSegmentedControl-4587c7a9.js} +1 -3
- package/dist/esm/v3/{OrSelect-93b70fcc.js → OrSelect-9c7044f8.js} +9 -13
- package/dist/esm/v3/{OrSelect-6ff34196.js → OrSelect-d8a78242.js} +6 -10
- package/dist/esm/v3/{OrSidebar-fede2b0e.js → OrSidebar-0f4629bf.js} +4 -5
- package/dist/esm/v3/{OrSidebarCollapseButton-5c64c1b0.js → OrSidebarCollapseButton-a384cd37.js} +1 -1
- package/dist/esm/v3/{OrSlider-c3778aa7.js → OrSlider-80e0f2e6.js} +4 -16
- package/dist/esm/v3/{OrStepper-fedc1cca.js → OrStepper-3a586401.js} +2 -2
- package/dist/esm/v3/{OrSwitch-3fca7e24.js → OrSwitch-c333ee32.js} +4 -7
- package/dist/esm/v3/{OrTabHeaderItem-3bb0b711.js → OrTabHeaderItem-d668cc59.js} +4 -7
- package/dist/esm/v3/{OrTabs-b2bbc82a.js → OrTabs-9e29eeec.js} +6 -10
- package/dist/esm/v3/{OrTabs-35a376a3.js → OrTabs-d3812c11.js} +5 -6
- package/dist/esm/v3/{OrTag-930d11c3.js → OrTag-b508f25f.js} +1 -1
- package/dist/esm/v3/{OrTag-2d9eacf8.js → OrTag-e7adb078.js} +3 -5
- package/dist/esm/v3/{OrTextarea-f6722edc.js → OrTextarea-de1ecb0f.js} +4 -10
- package/dist/esm/v3/{OrTextbox-6e585202.js → OrTextbox-f7388a30.js} +14 -27
- package/dist/esm/v3/{OrTimePicker-cd206930.js → OrTimePicker-2fe3c573.js} +2 -2
- package/dist/esm/v3/{OrToastContainer-24839efd.js → OrToastContainer-94ba2803.js} +4 -6
- package/dist/esm/v3/{OrTooltip-89ce98e8.js → OrTooltip-618ce7c9.js} +2 -6
- package/dist/esm/v3/{OrTooltip-ace3359f.js → OrTooltip-e3c85390.js} +1 -1
- package/dist/esm/{v2/color-40b7fe6b.js → v3/color-1f348774.js} +1 -2
- package/dist/esm/v3/components/index.js +71 -71
- package/dist/esm/v3/components/or-avatar/index.js +3 -3
- package/dist/esm/v3/components/or-avatar-v3/index.js +2 -2
- package/dist/esm/v3/components/or-bottom-sheet-v3/index.js +3 -3
- package/dist/esm/v3/components/or-button/index.js +1 -1
- package/dist/esm/v3/components/or-button-v2/index.js +4 -4
- package/dist/esm/v3/components/or-card-collection/index.js +8 -8
- package/dist/esm/v3/components/or-card-collection-v3/index.js +10 -10
- package/dist/esm/v3/components/or-carousel/index.js +3 -3
- package/dist/esm/v3/components/or-checkbox/index.js +3 -3
- package/dist/esm/v3/components/or-checkbox-group-v3/index.js +6 -7
- package/dist/esm/v3/components/or-checkbox-tree-v3/index.js +3 -3
- package/dist/esm/v3/components/or-checkbox-v3/index.js +1 -1
- package/dist/esm/v3/components/or-chips/index.js +4 -4
- package/dist/esm/v3/components/or-chips/or-chip/index.js +3 -3
- package/dist/esm/v3/components/or-code/index.js +6 -6
- package/dist/esm/v3/components/or-collapse/index.js +1 -1
- package/dist/esm/v3/components/or-color-picker/index.js +1 -1
- package/dist/esm/v3/components/or-confirm/index.js +8 -8
- package/dist/esm/v3/components/or-confirm-v3/index.js +8 -8
- package/dist/esm/v3/components/or-date-picker-v3/index.js +9 -9
- package/dist/esm/v3/components/or-date-time-picker/index.js +6 -6
- package/dist/esm/v3/components/or-date-time-picker-v3/index.js +9 -9
- package/dist/esm/v3/components/or-icon/index.js +2 -2
- package/dist/esm/v3/components/or-icon-button-v2/index.js +3 -3
- package/dist/esm/v3/components/or-icon-button-v3/index.js +6 -6
- package/dist/esm/v3/components/or-inline-input-v3/index.js +7 -7
- package/dist/esm/v3/components/or-inline-text-edit/index.js +6 -6
- package/dist/esm/v3/components/or-inline-textarea-v3/index.js +7 -7
- package/dist/esm/v3/components/or-input/index.js +2 -2
- package/dist/esm/v3/components/or-input-v3/index.js +7 -7
- package/dist/esm/v3/components/or-list/index.js +5 -5
- package/dist/esm/v3/components/or-list-of-inputs/index.js +8 -8
- package/dist/esm/v3/components/or-menu-v3/index.js +5 -5
- package/dist/esm/v3/components/or-modal/index.js +5 -5
- package/dist/esm/v3/components/or-modal-v3/index.js +7 -7
- package/dist/esm/v3/components/or-notification/index.js +5 -5
- package/dist/esm/v3/components/or-notification-v3/index.js +7 -7
- package/dist/esm/v3/components/or-number-input/index.js +3 -3
- package/dist/esm/v3/components/or-overflow-menu/index.js +5 -5
- package/dist/esm/v3/components/or-overlay-v3/index.js +2 -2
- package/dist/esm/v3/components/or-pagination-v3/index.js +6 -6
- package/dist/esm/v3/components/or-password/index.js +8 -8
- package/dist/esm/v3/components/or-popover-v3/index.js +4 -4
- package/dist/esm/v3/components/or-radio/index.js +1 -1
- package/dist/esm/v3/components/or-radio-group-v3/index.js +3 -4
- package/dist/esm/v3/components/or-search/index.js +7 -7
- package/dist/esm/v3/components/or-search-v3/index.js +8 -8
- package/dist/esm/v3/components/or-segmented-control-v3/index.js +1 -1
- package/dist/esm/v3/components/or-select/index.js +6 -6
- package/dist/esm/v3/components/or-select-v3/index.js +11 -11
- package/dist/esm/v3/components/or-sidebar-v3/index.js +8 -8
- package/dist/esm/v3/components/or-sidebar-v3/partials/index.js +7 -7
- package/dist/esm/v3/components/or-sidebar-v3/partials/or-sidebar-collapse-button/index.js +7 -7
- package/dist/esm/v3/components/or-slider/index.js +3 -3
- package/dist/esm/v3/components/or-stepper/index.js +5 -5
- package/dist/esm/v3/components/or-switch/index.js +1 -1
- package/dist/esm/v3/components/or-tab-header-item/index.js +1 -1
- package/dist/esm/v3/components/or-tabs/index.js +2 -2
- package/dist/esm/v3/components/or-tabs-v3/index.js +6 -6
- package/dist/esm/v3/components/or-tag/index.js +4 -4
- package/dist/esm/v3/components/or-tag-v3/index.js +7 -7
- package/dist/esm/v3/components/or-textarea/index.js +2 -2
- package/dist/esm/v3/components/or-textbox/index.js +7 -7
- package/dist/esm/v3/components/or-time-picker-v3/index.js +7 -7
- package/dist/esm/v3/components/or-toast/composable/index.js +1 -1
- package/dist/esm/v3/components/or-toast/index.js +6 -6
- package/dist/esm/v3/components/or-toast/or-toast-container/index.js +6 -6
- package/dist/esm/v3/components/or-toast-v3/composable/index.js +1 -1
- package/dist/esm/v3/components/or-toast-v3/index.js +8 -8
- package/dist/esm/v3/components/or-toast-v3/or-toast-container-v3/index.js +8 -8
- package/dist/esm/v3/components/or-tooltip/index.js +1 -1
- package/dist/esm/v3/components/or-tooltip-v3/index.js +5 -5
- package/dist/esm/v3/{flattenDeep-fe0af413.js → flattenDeep-e7a8b995.js} +1 -2
- package/dist/esm/v3/hooks/index.js +3 -3
- package/dist/esm/v3/index.js +72 -72
- package/dist/esm/v3/{types-b64c7e13.js → types-9034029d.js} +6 -11
- package/dist/esm/{v2/useElevation-b5a49746.js → v3/useElevation-df91fa50.js} +1 -2
- package/dist/esm/{v2/useOverflow-c856b7b7.js → v3/useOverflow-af6161c8.js} +4 -5
- package/dist/esm/{v2/useToast-a1332cc2.js → v3/useToast-0665462d.js} +5 -10
- package/dist/esm/{v2/useToast-b5ea5cb2.js → v3/useToast-4fbe0e5a.js} +5 -10
- package/dist/esm/{v2/useToggle-c04fc920.js → v3/useToggle-29e4d7c7.js} +1 -2
- package/package.json +8 -8
- package/dist/esm/v2/OrButton-b4a39652.js +0 -195
- package/dist/esm/v2/OrButton.vue_rollup-plugin-vue_styles.0-83b5a752.js +0 -106
- package/dist/esm/v2/OrIconButton.vue_rollup-plugin-vue_styles.0-20b054cc.js +0 -206
- package/dist/esm/v3/OrButton-49605f5c.js +0 -162
- package/dist/esm/v3/OrButton-d6834ea0.js +0 -142
- package/dist/esm/v3/OrIconButton-049a3bd2.js +0 -223
- /package/dist/bundled/v2/{index-1301ac7b.js → index-63e094a0.js} +0 -0
- /package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-8d7ce473.js → OrAvatar.vue_vue_type_script_lang-623c32a1.js} +0 -0
- /package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-2d5de9d4.js → OrAvatar.vue_vue_type_script_lang-6511e348.js} +0 -0
- /package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-4f44f547.js → OrButton.vue_vue_type_script_lang-da7f7ed0.js} +0 -0
- /package/dist/bundled/v3/{OrChip.vue_vue_type_script_lang-185d8d45.js → OrChip.vue_vue_type_script_lang-5a390853.js} +0 -0
- /package/dist/bundled/v3/{OrColorPicker.vue_vue_type_script_lang-d8588b52.js → OrColorPicker.vue_vue_type_script_lang-3a799e23.js} +0 -0
- /package/dist/bundled/v3/{OrOverlay.vue_vue_type_script_lang-86c7b93a.js → OrOverlay.vue_vue_type_script_lang-47004a50.js} +0 -0
- /package/dist/bundled/v3/{OrSlider.vue_vue_type_script_lang-7234ab75.js → OrSlider.vue_vue_type_script_lang-45ecddbe.js} +0 -0
- /package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-4e98d8a0.js → OrTag.vue_vue_type_script_lang-621e9307.js} +0 -0
- /package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-45713d6c.js → OrToastContainer.vue_vue_type_script_lang-70cc38be.js} +0 -0
- /package/dist/bundled/v3/{index-1301ac7b.js → index-63e094a0.js} +0 -0
|
@@ -39,8 +39,7 @@ class Text {
|
|
|
39
39
|
/**
|
|
40
40
|
Retrieve the text between the given points.
|
|
41
41
|
*/
|
|
42
|
-
slice(from) {
|
|
43
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.length;
|
|
42
|
+
slice(from, to = this.length) {
|
|
44
43
|
let parts = [];
|
|
45
44
|
this.decompose(from, to, parts, 0);
|
|
46
45
|
return TextNode.from(parts, to - from);
|
|
@@ -69,16 +68,14 @@ class Text {
|
|
|
69
68
|
from end to start. This will return lines and the breaks between
|
|
70
69
|
them as separate strings.
|
|
71
70
|
*/
|
|
72
|
-
iter() {
|
|
73
|
-
let dir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
71
|
+
iter(dir = 1) {
|
|
74
72
|
return new RawTextCursor(this, dir);
|
|
75
73
|
}
|
|
76
74
|
/**
|
|
77
75
|
Iterate over a range of the text. When `from` > `to`, the
|
|
78
76
|
iterator will run in reverse.
|
|
79
77
|
*/
|
|
80
|
-
iterRange(from) {
|
|
81
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.length;
|
|
78
|
+
iterRange(from, to = this.length) {
|
|
82
79
|
return new PartialTextCursor(this, from, to);
|
|
83
80
|
}
|
|
84
81
|
/**
|
|
@@ -127,8 +124,7 @@ class Text {
|
|
|
127
124
|
// between these strings. Leaves are limited in size and have to be
|
|
128
125
|
// contained in TextNode instances for bigger documents.
|
|
129
126
|
class TextLeaf extends Text {
|
|
130
|
-
constructor(text) {
|
|
131
|
-
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : textLength(text);
|
|
127
|
+
constructor(text, length = textLength(text)) {
|
|
132
128
|
super();
|
|
133
129
|
this.text = text;
|
|
134
130
|
this.length = length;
|
|
@@ -170,9 +166,7 @@ class TextLeaf extends Text {
|
|
|
170
166
|
if (lines.length <= 32 /* Tree.Branch */) return new TextLeaf(lines, newLen);
|
|
171
167
|
return TextNode.from(TextLeaf.split(lines, []), newLen);
|
|
172
168
|
}
|
|
173
|
-
sliceString(from) {
|
|
174
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.length;
|
|
175
|
-
let lineSep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "\n";
|
|
169
|
+
sliceString(from, to = this.length, lineSep = "\n") {
|
|
176
170
|
let result = "";
|
|
177
171
|
for (let pos = 0, i = 0; pos <= to && i < this.text.length; i++) {
|
|
178
172
|
let line = this.text[i],
|
|
@@ -259,9 +253,7 @@ class TextNode extends Text {
|
|
|
259
253
|
}
|
|
260
254
|
return super.replace(from, to, text);
|
|
261
255
|
}
|
|
262
|
-
sliceString(from) {
|
|
263
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.length;
|
|
264
|
-
let lineSep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "\n";
|
|
256
|
+
sliceString(from, to = this.length, lineSep = "\n") {
|
|
265
257
|
let result = "";
|
|
266
258
|
for (let i = 0, pos = 0; i < this.children.length && pos <= to; i++) {
|
|
267
259
|
let child = this.children[i],
|
|
@@ -287,8 +279,7 @@ class TextNode extends Text {
|
|
|
287
279
|
length += chA.length + 1;
|
|
288
280
|
}
|
|
289
281
|
}
|
|
290
|
-
static from(children) {
|
|
291
|
-
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : children.reduce((l, ch) => l + ch.length + 1, -1);
|
|
282
|
+
static from(children, length = children.reduce((l, ch) => l + ch.length + 1, -1)) {
|
|
292
283
|
let lines = 0;
|
|
293
284
|
for (let ch of children) lines += ch.lines;
|
|
294
285
|
if (lines < 32 /* Tree.Branch */) {
|
|
@@ -338,9 +329,7 @@ function textLength(text) {
|
|
|
338
329
|
for (let line of text) length += line.length + 1;
|
|
339
330
|
return length;
|
|
340
331
|
}
|
|
341
|
-
function appendText(text, target) {
|
|
342
|
-
let from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
343
|
-
let to = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1e9;
|
|
332
|
+
function appendText(text, target, from = 0, to = 1e9) {
|
|
344
333
|
for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {
|
|
345
334
|
let line = text[i],
|
|
346
335
|
end = pos + line.length;
|
|
@@ -360,8 +349,7 @@ function sliceText(text, from, to) {
|
|
|
360
349
|
return appendText(text, [""], from, to);
|
|
361
350
|
}
|
|
362
351
|
class RawTextCursor {
|
|
363
|
-
constructor(text) {
|
|
364
|
-
let dir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
352
|
+
constructor(text, dir = 1) {
|
|
365
353
|
this.dir = dir;
|
|
366
354
|
this.done = false;
|
|
367
355
|
this.lineBreak = false;
|
|
@@ -416,8 +404,7 @@ class RawTextCursor {
|
|
|
416
404
|
}
|
|
417
405
|
}
|
|
418
406
|
}
|
|
419
|
-
next() {
|
|
420
|
-
let skip = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
407
|
+
next(skip = 0) {
|
|
421
408
|
if (skip < 0) {
|
|
422
409
|
this.nextInner(-skip, -this.dir);
|
|
423
410
|
skip = this.value.length;
|
|
@@ -452,8 +439,7 @@ class PartialTextCursor {
|
|
|
452
439
|
this.done = !this.value;
|
|
453
440
|
return this;
|
|
454
441
|
}
|
|
455
|
-
next() {
|
|
456
|
-
let skip = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
442
|
+
next(skip = 0) {
|
|
457
443
|
if (skip < 0) skip = Math.max(skip, this.from - this.pos);else if (skip > 0) skip = Math.min(skip, this.to - this.pos);
|
|
458
444
|
return this.nextInner(skip, this.cursor.dir);
|
|
459
445
|
}
|
|
@@ -468,8 +454,7 @@ class LineCursor {
|
|
|
468
454
|
this.value = "";
|
|
469
455
|
this.done = false;
|
|
470
456
|
}
|
|
471
|
-
next() {
|
|
472
|
-
let skip = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
457
|
+
next(skip = 0) {
|
|
473
458
|
let {
|
|
474
459
|
done,
|
|
475
460
|
lineBreak,
|
|
@@ -567,9 +552,7 @@ Moves across surrogate pairs, extending characters (when
|
|
|
567
552
|
`includeExtending` is true), characters joined with zero-width
|
|
568
553
|
joiners, and flag emoji.
|
|
569
554
|
*/
|
|
570
|
-
function findClusterBreak(str, pos) {
|
|
571
|
-
let forward = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
572
|
-
let includeExtending = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
555
|
+
function findClusterBreak(str, pos, forward = true, includeExtending = true) {
|
|
573
556
|
return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);
|
|
574
557
|
}
|
|
575
558
|
function nextClusterBreak(str, pos, includeExtending) {
|
|
@@ -739,8 +722,7 @@ class ChangeDesc {
|
|
|
739
722
|
separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are
|
|
740
723
|
reported separately.
|
|
741
724
|
*/
|
|
742
|
-
iterChangedRanges(f) {
|
|
743
|
-
let individual = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
725
|
+
iterChangedRanges(f, individual = false) {
|
|
744
726
|
iterChanges(this, f, individual);
|
|
745
727
|
}
|
|
746
728
|
/**
|
|
@@ -769,13 +751,10 @@ class ChangeDesc {
|
|
|
769
751
|
applied after it. When `before` is true, map as if the changes
|
|
770
752
|
in `other` happened before the ones in `this`.
|
|
771
753
|
*/
|
|
772
|
-
mapDesc(other) {
|
|
773
|
-
let before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
754
|
+
mapDesc(other, before = false) {
|
|
774
755
|
return other.empty ? this : mapSet(this, other, before);
|
|
775
756
|
}
|
|
776
|
-
mapPos(pos) {
|
|
777
|
-
let assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
|
778
|
-
let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : MapMode.Simple;
|
|
757
|
+
mapPos(pos, assoc = -1, mode = MapMode.Simple) {
|
|
779
758
|
let posA = 0,
|
|
780
759
|
posB = 0;
|
|
781
760
|
for (let i = 0; i < this.sections.length;) {
|
|
@@ -800,8 +779,7 @@ class ChangeDesc {
|
|
|
800
779
|
changes entirely covers the range, the string `"cover"` is
|
|
801
780
|
returned.
|
|
802
781
|
*/
|
|
803
|
-
touchesRange(from) {
|
|
804
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
|
|
782
|
+
touchesRange(from, to = from) {
|
|
805
783
|
for (let i = 0, pos = 0; i < this.sections.length && pos <= to;) {
|
|
806
784
|
let len = this.sections[i++],
|
|
807
785
|
ins = this.sections[i++],
|
|
@@ -867,8 +845,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
867
845
|
iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false);
|
|
868
846
|
return doc;
|
|
869
847
|
}
|
|
870
|
-
mapDesc(other) {
|
|
871
|
-
let before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
848
|
+
mapDesc(other, before = false) {
|
|
872
849
|
return mapSet(this, other, before, true);
|
|
873
850
|
}
|
|
874
851
|
/**
|
|
@@ -916,8 +893,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
916
893
|
transformation](https://en.wikipedia.org/wiki/Operational_transformation),
|
|
917
894
|
and can be used for collaborative editing.
|
|
918
895
|
*/
|
|
919
|
-
map(other) {
|
|
920
|
-
let before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
896
|
+
map(other, before = false) {
|
|
921
897
|
return other.empty ? this : mapSet(this, other, before, true);
|
|
922
898
|
}
|
|
923
899
|
/**
|
|
@@ -929,8 +905,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
929
905
|
When `individual` is true, adjacent changes are reported
|
|
930
906
|
separately.
|
|
931
907
|
*/
|
|
932
|
-
iterChanges(f) {
|
|
933
|
-
let individual = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
908
|
+
iterChanges(f, individual = false) {
|
|
934
909
|
iterChanges(this, f, individual);
|
|
935
910
|
}
|
|
936
911
|
/**
|
|
@@ -996,8 +971,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
996
971
|
inserted = [],
|
|
997
972
|
pos = 0;
|
|
998
973
|
let total = null;
|
|
999
|
-
function flush() {
|
|
1000
|
-
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
974
|
+
function flush(force = false) {
|
|
1001
975
|
if (!force && !sections.length) return;
|
|
1002
976
|
if (pos < length) addSection(sections, length - pos, -1);
|
|
1003
977
|
let set = new ChangeSet(sections, inserted);
|
|
@@ -1071,8 +1045,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
1071
1045
|
return new ChangeSet(sections, inserted);
|
|
1072
1046
|
}
|
|
1073
1047
|
}
|
|
1074
|
-
function addSection(sections, len, ins) {
|
|
1075
|
-
let forceJoin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
1048
|
+
function addSection(sections, len, ins, forceJoin = false) {
|
|
1076
1049
|
if (len == 0 && ins <= 0) return;
|
|
1077
1050
|
let last = sections.length - 2;
|
|
1078
1051
|
if (last >= 0 && ins <= 0 && ins == sections[last + 1]) sections[last] += len;else if (len == 0 && sections[last] == 0) sections[last + 1] += ins;else if (forceJoin) {
|
|
@@ -1116,8 +1089,7 @@ function iterChanges(desc, f, individual) {
|
|
|
1116
1089
|
}
|
|
1117
1090
|
}
|
|
1118
1091
|
}
|
|
1119
|
-
function mapSet(setA, setB, before) {
|
|
1120
|
-
let mkSet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
1092
|
+
function mapSet(setA, setB, before, mkSet = false) {
|
|
1121
1093
|
// Produce a copy of setA that applies to the document after setB
|
|
1122
1094
|
// has been applied (assuming both start at the same document).
|
|
1123
1095
|
let sections = [],
|
|
@@ -1181,8 +1153,7 @@ function mapSet(setA, setB, before) {
|
|
|
1181
1153
|
}
|
|
1182
1154
|
}
|
|
1183
1155
|
}
|
|
1184
|
-
function composeSets(setA, setB) {
|
|
1185
|
-
let mkSet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1156
|
+
function composeSets(setA, setB, mkSet = false) {
|
|
1186
1157
|
let sections = [];
|
|
1187
1158
|
let insert = mkSet ? [] : null;
|
|
1188
1159
|
let a = new SectionIter(setA),
|
|
@@ -1345,8 +1316,7 @@ class SelectionRange {
|
|
|
1345
1316
|
Map this range through a change, producing a valid range in the
|
|
1346
1317
|
updated document.
|
|
1347
1318
|
*/
|
|
1348
|
-
map(change) {
|
|
1349
|
-
let assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
|
1319
|
+
map(change, assoc = -1) {
|
|
1350
1320
|
let from, to;
|
|
1351
1321
|
if (this.empty) {
|
|
1352
1322
|
from = to = change.mapPos(this.from, assoc);
|
|
@@ -1359,8 +1329,7 @@ class SelectionRange {
|
|
|
1359
1329
|
/**
|
|
1360
1330
|
Extend this range to cover at least `from` to `to`.
|
|
1361
1331
|
*/
|
|
1362
|
-
extend(from) {
|
|
1363
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
|
|
1332
|
+
extend(from, to = from) {
|
|
1364
1333
|
if (from <= this.anchor && to >= this.anchor) return EditorSelection.range(from, to);
|
|
1365
1334
|
let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to;
|
|
1366
1335
|
return EditorSelection.range(this.anchor, head);
|
|
@@ -1417,8 +1386,7 @@ class EditorSelection {
|
|
|
1417
1386
|
Map a selection through a change. Used to adjust the selection
|
|
1418
1387
|
position for changes.
|
|
1419
1388
|
*/
|
|
1420
|
-
map(change) {
|
|
1421
|
-
let assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
|
1389
|
+
map(change, assoc = -1) {
|
|
1422
1390
|
if (change.empty) return this;
|
|
1423
1391
|
return EditorSelection.create(this.ranges.map(r => r.map(change, assoc)), this.mainIndex);
|
|
1424
1392
|
}
|
|
@@ -1448,16 +1416,14 @@ class EditorSelection {
|
|
|
1448
1416
|
/**
|
|
1449
1417
|
Extend this selection with an extra range.
|
|
1450
1418
|
*/
|
|
1451
|
-
addRange(range) {
|
|
1452
|
-
let main = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1419
|
+
addRange(range, main = true) {
|
|
1453
1420
|
return EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1);
|
|
1454
1421
|
}
|
|
1455
1422
|
/**
|
|
1456
1423
|
Replace a given range with another range, and then normalize the
|
|
1457
1424
|
selection to merge and sort ranges if necessary.
|
|
1458
1425
|
*/
|
|
1459
|
-
replaceRange(range) {
|
|
1460
|
-
let which = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.mainIndex;
|
|
1426
|
+
replaceRange(range, which = this.mainIndex) {
|
|
1461
1427
|
let ranges = this.ranges.slice();
|
|
1462
1428
|
ranges[which] = range;
|
|
1463
1429
|
return EditorSelection.create(ranges, this.mainIndex);
|
|
@@ -1482,16 +1448,14 @@ class EditorSelection {
|
|
|
1482
1448
|
/**
|
|
1483
1449
|
Create a selection holding a single range.
|
|
1484
1450
|
*/
|
|
1485
|
-
static single(anchor) {
|
|
1486
|
-
let head = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : anchor;
|
|
1451
|
+
static single(anchor, head = anchor) {
|
|
1487
1452
|
return new EditorSelection([EditorSelection.range(anchor, head)], 0);
|
|
1488
1453
|
}
|
|
1489
1454
|
/**
|
|
1490
1455
|
Sort and merge the given set of ranges, creating a valid
|
|
1491
1456
|
selection.
|
|
1492
1457
|
*/
|
|
1493
|
-
static create(ranges) {
|
|
1494
|
-
let mainIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1458
|
+
static create(ranges, mainIndex = 0) {
|
|
1495
1459
|
if (ranges.length == 0) throw new RangeError("A selection needs at least one range");
|
|
1496
1460
|
for (let pos = 0, i = 0; i < ranges.length; i++) {
|
|
1497
1461
|
let range = ranges[i];
|
|
@@ -1504,10 +1468,7 @@ class EditorSelection {
|
|
|
1504
1468
|
Create a cursor selection range at the given position. You can
|
|
1505
1469
|
safely ignore the optional arguments in most situations.
|
|
1506
1470
|
*/
|
|
1507
|
-
static cursor(pos) {
|
|
1508
|
-
let assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1509
|
-
let bidiLevel = arguments.length > 2 ? arguments[2] : undefined;
|
|
1510
|
-
let goalColumn = arguments.length > 3 ? arguments[3] : undefined;
|
|
1471
|
+
static cursor(pos, assoc = 0, bidiLevel, goalColumn) {
|
|
1511
1472
|
return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 4 /* RangeFlag.AssocBefore */ : 8 /* RangeFlag.AssocAfter */) | (bidiLevel == null ? 3 : Math.min(2, bidiLevel)) | (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */);
|
|
1512
1473
|
}
|
|
1513
1474
|
/**
|
|
@@ -1520,8 +1481,7 @@ class EditorSelection {
|
|
|
1520
1481
|
/**
|
|
1521
1482
|
@internal
|
|
1522
1483
|
*/
|
|
1523
|
-
static normalized(ranges) {
|
|
1524
|
-
let mainIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1484
|
+
static normalized(ranges, mainIndex = 0) {
|
|
1525
1485
|
let main = ranges[mainIndex];
|
|
1526
1486
|
ranges.sort((a, b) => a.from - b.from);
|
|
1527
1487
|
mainIndex = ranges.indexOf(main);
|
|
@@ -1580,8 +1540,7 @@ class Facet {
|
|
|
1580
1540
|
/**
|
|
1581
1541
|
Define a new facet.
|
|
1582
1542
|
*/
|
|
1583
|
-
static define() {
|
|
1584
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1543
|
+
static define(config = {}) {
|
|
1585
1544
|
return new Facet(config.combine || (a => a), config.compareInput || ((a, b) => a === b), config.compare || (!config.combine ? sameArray$1 : (a, b) => a === b), !!config.static, config.enables);
|
|
1586
1545
|
}
|
|
1587
1546
|
/**
|
|
@@ -2152,8 +2111,7 @@ class StateEffect {
|
|
|
2152
2111
|
Define a new effect type. The type parameter indicates the type
|
|
2153
2112
|
of values that his effect holds.
|
|
2154
2113
|
*/
|
|
2155
|
-
static define() {
|
|
2156
|
-
let spec = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2114
|
+
static define(spec = {}) {
|
|
2157
2115
|
return new StateEffectType(spec.map || (v => v));
|
|
2158
2116
|
}
|
|
2159
2117
|
/**
|
|
@@ -2535,8 +2493,7 @@ class EditorState {
|
|
|
2535
2493
|
for (let i = 0; i < this.config.dynamicSlots.length; i++) ensureAddr(this, i << 1);
|
|
2536
2494
|
this.computeSlot = null;
|
|
2537
2495
|
}
|
|
2538
|
-
field(field) {
|
|
2539
|
-
let require = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2496
|
+
field(field, require = true) {
|
|
2540
2497
|
let addr = this.config.address[field.id];
|
|
2541
2498
|
if (addr == null) {
|
|
2542
2499
|
if (require) throw new RangeError("Field is not present in this state");
|
|
@@ -2560,10 +2517,7 @@ class EditorState {
|
|
|
2560
2517
|
specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later
|
|
2561
2518
|
specs take precedence over earlier ones.
|
|
2562
2519
|
*/
|
|
2563
|
-
update() {
|
|
2564
|
-
for (var _len = arguments.length, specs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2565
|
-
specs[_key] = arguments[_key];
|
|
2566
|
-
}
|
|
2520
|
+
update(...specs) {
|
|
2567
2521
|
return resolveTransaction(this, specs, true);
|
|
2568
2522
|
}
|
|
2569
2523
|
/**
|
|
@@ -2654,8 +2608,7 @@ class EditorState {
|
|
|
2654
2608
|
description, taking the state's document length and line
|
|
2655
2609
|
separator into account.
|
|
2656
2610
|
*/
|
|
2657
|
-
changes() {
|
|
2658
|
-
let spec = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2611
|
+
changes(spec = []) {
|
|
2659
2612
|
if (spec instanceof ChangeSet) return spec;
|
|
2660
2613
|
return ChangeSet.of(spec, this.doc.length, this.facet(EditorState.lineSeparator));
|
|
2661
2614
|
}
|
|
@@ -2670,9 +2623,7 @@ class EditorState {
|
|
|
2670
2623
|
/**
|
|
2671
2624
|
Return the given range of the document as a string.
|
|
2672
2625
|
*/
|
|
2673
|
-
sliceDoc() {
|
|
2674
|
-
let from = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
2675
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.doc.length;
|
|
2626
|
+
sliceDoc(from = 0, to = this.doc.length) {
|
|
2676
2627
|
return this.doc.sliceString(from, to, this.lineBreak);
|
|
2677
2628
|
}
|
|
2678
2629
|
/**
|
|
@@ -2707,9 +2658,7 @@ class EditorState {
|
|
|
2707
2658
|
to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as
|
|
2708
2659
|
third argument.
|
|
2709
2660
|
*/
|
|
2710
|
-
static fromJSON(json) {
|
|
2711
|
-
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2712
|
-
let fields = arguments.length > 2 ? arguments[2] : undefined;
|
|
2661
|
+
static fromJSON(json, config = {}, fields) {
|
|
2713
2662
|
if (!json || typeof json.doc != "string") throw new RangeError("Invalid JSON representation for EditorState");
|
|
2714
2663
|
let fieldInit = [];
|
|
2715
2664
|
if (fields) for (let prop in fields) {
|
|
@@ -2730,8 +2679,7 @@ class EditorState {
|
|
|
2730
2679
|
initializing an editor—updated states are created by applying
|
|
2731
2680
|
transactions.
|
|
2732
2681
|
*/
|
|
2733
|
-
static create() {
|
|
2734
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2682
|
+
static create(config = {}) {
|
|
2735
2683
|
let configuration = Configuration.resolve(config.extensions || [], new Map());
|
|
2736
2684
|
let doc = config.doc instanceof Text ? config.doc : Text.of((config.doc || "").split(configuration.staticFacet(EditorState.lineSeparator) || DefaultSplit));
|
|
2737
2685
|
let selection = !config.selection ? EditorSelection.single(0) : config.selection instanceof EditorSelection ? config.selection : EditorSelection.single(config.selection.anchor, config.selection.head);
|
|
@@ -2770,10 +2718,7 @@ class EditorState {
|
|
|
2770
2718
|
A single `$` is equivalent to `$1`, and `$$` will produce a
|
|
2771
2719
|
literal dollar sign.
|
|
2772
2720
|
*/
|
|
2773
|
-
phrase(phrase) {
|
|
2774
|
-
for (var _len2 = arguments.length, insert = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
2775
|
-
insert[_key2 - 1] = arguments[_key2];
|
|
2776
|
-
}
|
|
2721
|
+
phrase(phrase, ...insert) {
|
|
2777
2722
|
for (let map of this.facet(EditorState.phrases)) if (Object.prototype.hasOwnProperty.call(map, phrase)) {
|
|
2778
2723
|
phrase = map[phrase];
|
|
2779
2724
|
break;
|
|
@@ -2801,8 +2746,7 @@ class EditorState {
|
|
|
2801
2746
|
- [`"closeBrackets"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls
|
|
2802
2747
|
bracket closing behavior.
|
|
2803
2748
|
*/
|
|
2804
|
-
languageDataAt(name, pos) {
|
|
2805
|
-
let side = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
2749
|
+
languageDataAt(name, pos, side = -1) {
|
|
2806
2750
|
let values = [];
|
|
2807
2751
|
for (let provider of this.facet(languageData)) {
|
|
2808
2752
|
for (let result of provider(this, pos, side)) {
|
|
@@ -2972,8 +2916,9 @@ The function will, by default, error
|
|
|
2972
2916
|
when a field gets two values that aren't `===`-equal, but you can
|
|
2973
2917
|
provide combine functions per field to do something else.
|
|
2974
2918
|
*/
|
|
2975
|
-
function combineConfig(configs, defaults
|
|
2976
|
-
|
|
2919
|
+
function combineConfig(configs, defaults,
|
|
2920
|
+
// Should hold only the optional properties of Config, but I haven't managed to express that
|
|
2921
|
+
combine = {}) {
|
|
2977
2922
|
let result = {};
|
|
2978
2923
|
for (let config of configs) for (let key of Object.keys(config)) {
|
|
2979
2924
|
let value = config[key],
|
|
@@ -3003,8 +2948,7 @@ class RangeValue {
|
|
|
3003
2948
|
/**
|
|
3004
2949
|
Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value.
|
|
3005
2950
|
*/
|
|
3006
|
-
range(from) {
|
|
3007
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
|
|
2951
|
+
range(from, to = from) {
|
|
3008
2952
|
return Range$1.create(from, to, this);
|
|
3009
2953
|
}
|
|
3010
2954
|
}
|
|
@@ -3059,8 +3003,7 @@ class Chunk {
|
|
|
3059
3003
|
}
|
|
3060
3004
|
// Find the index of the given position and side. Use the ranges'
|
|
3061
3005
|
// `from` pos when `end == false`, `to` when `end == true`.
|
|
3062
|
-
findIndex(pos, side, end) {
|
|
3063
|
-
let startAt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3006
|
+
findIndex(pos, side, end, startAt = 0) {
|
|
3064
3007
|
let arr = end ? this.to : this.from;
|
|
3065
3008
|
for (let lo = startAt, hi = arr.length;;) {
|
|
3066
3009
|
if (lo == hi) return lo;
|
|
@@ -3262,8 +3205,7 @@ class RangeSet {
|
|
|
3262
3205
|
Iterate over the ranges in this set, in order, including all
|
|
3263
3206
|
ranges that end at or after `from`.
|
|
3264
3207
|
*/
|
|
3265
|
-
iter() {
|
|
3266
|
-
let from = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
3208
|
+
iter(from = 0) {
|
|
3267
3209
|
return HeapCursor.from([this]).goto(from);
|
|
3268
3210
|
}
|
|
3269
3211
|
/**
|
|
@@ -3276,8 +3218,7 @@ class RangeSet {
|
|
|
3276
3218
|
Iterate over the ranges in a collection of sets, in order,
|
|
3277
3219
|
starting from `from`.
|
|
3278
3220
|
*/
|
|
3279
|
-
static iter(sets) {
|
|
3280
|
-
let from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3221
|
+
static iter(sets, from = 0) {
|
|
3281
3222
|
return HeapCursor.from(sets).goto(from);
|
|
3282
3223
|
}
|
|
3283
3224
|
/**
|
|
@@ -3290,8 +3231,12 @@ class RangeSet {
|
|
|
3290
3231
|
ranges, and is needed to synchronize the iteration. `from` and
|
|
3291
3232
|
`to` are coordinates in the _new_ space, after these changes.
|
|
3292
3233
|
*/
|
|
3293
|
-
textDiff, comparator
|
|
3294
|
-
|
|
3234
|
+
textDiff, comparator,
|
|
3235
|
+
/**
|
|
3236
|
+
Can be used to ignore all non-point ranges, and points below
|
|
3237
|
+
the given size. When -1, all ranges are compared.
|
|
3238
|
+
*/
|
|
3239
|
+
minPointSize = -1) {
|
|
3295
3240
|
let a = oldSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);
|
|
3296
3241
|
let b = newSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);
|
|
3297
3242
|
let sharedChunks = findSharedChunks(a, b, textDiff);
|
|
@@ -3304,9 +3249,7 @@ class RangeSet {
|
|
|
3304
3249
|
Compare the contents of two groups of range sets, returning true
|
|
3305
3250
|
if they are equivalent in the given range.
|
|
3306
3251
|
*/
|
|
3307
|
-
static eq(oldSets, newSets) {
|
|
3308
|
-
let from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3309
|
-
let to = arguments.length > 3 ? arguments[3] : undefined;
|
|
3252
|
+
static eq(oldSets, newSets, from = 0, to) {
|
|
3310
3253
|
if (to == null) to = 1000000000 /* C.Far */ - 1;
|
|
3311
3254
|
let a = oldSets.filter(set => !set.isEmpty && newSets.indexOf(set) < 0);
|
|
3312
3255
|
let b = newSets.filter(set => !set.isEmpty && oldSets.indexOf(set) < 0);
|
|
@@ -3329,8 +3272,12 @@ class RangeSet {
|
|
|
3329
3272
|
[`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end
|
|
3330
3273
|
of the iteration.
|
|
3331
3274
|
*/
|
|
3332
|
-
static spans(sets, from, to, iterator
|
|
3333
|
-
|
|
3275
|
+
static spans(sets, from, to, iterator,
|
|
3276
|
+
/**
|
|
3277
|
+
When given and greater than -1, only points of at least this
|
|
3278
|
+
size are taken into account.
|
|
3279
|
+
*/
|
|
3280
|
+
minPointSize = -1) {
|
|
3334
3281
|
let cursor = new SpanCursor(sets, null, minPointSize).goto(from),
|
|
3335
3282
|
pos = from;
|
|
3336
3283
|
let openRanges = cursor.openStart;
|
|
@@ -3357,8 +3304,7 @@ class RangeSet {
|
|
|
3357
3304
|
`value.startSide`). You can pass `true` as second argument to
|
|
3358
3305
|
cause the method to sort them.
|
|
3359
3306
|
*/
|
|
3360
|
-
static of(ranges) {
|
|
3361
|
-
let sort = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3307
|
+
static of(ranges, sort = false) {
|
|
3362
3308
|
let build = new RangeSetBuilder();
|
|
3363
3309
|
for (let range of ranges instanceof Range$1 ? [ranges] : sort ? lazySort(ranges) : ranges) build.add(range.from, range.to, range.value);
|
|
3364
3310
|
return build.finish();
|
|
@@ -3481,8 +3427,7 @@ function findSharedChunks(a, b, textDiff) {
|
|
|
3481
3427
|
return shared;
|
|
3482
3428
|
}
|
|
3483
3429
|
class LayerCursor {
|
|
3484
|
-
constructor(layer, skip, minPoint) {
|
|
3485
|
-
let rank = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3430
|
+
constructor(layer, skip, minPoint, rank = 0) {
|
|
3486
3431
|
this.layer = layer;
|
|
3487
3432
|
this.skip = skip;
|
|
3488
3433
|
this.minPoint = minPoint;
|
|
@@ -3494,8 +3439,7 @@ class LayerCursor {
|
|
|
3494
3439
|
get endSide() {
|
|
3495
3440
|
return this.value ? this.value.endSide : 0;
|
|
3496
3441
|
}
|
|
3497
|
-
goto(pos) {
|
|
3498
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1000000000;
|
|
3442
|
+
goto(pos, side = -1000000000 /* C.Far */) {
|
|
3499
3443
|
this.chunkIndex = this.rangeIndex = 0;
|
|
3500
3444
|
this.gotoInner(pos, side, false);
|
|
3501
3445
|
return this;
|
|
@@ -3558,9 +3502,7 @@ class HeapCursor {
|
|
|
3558
3502
|
constructor(heap) {
|
|
3559
3503
|
this.heap = heap;
|
|
3560
3504
|
}
|
|
3561
|
-
static from(sets) {
|
|
3562
|
-
let skip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
3563
|
-
let minPoint = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
3505
|
+
static from(sets, skip = null, minPoint = -1) {
|
|
3564
3506
|
let heap = [];
|
|
3565
3507
|
for (let i = 0; i < sets.length; i++) {
|
|
3566
3508
|
for (let cur = sets[i]; !cur.isEmpty; cur = cur.nextLayer) {
|
|
@@ -3572,8 +3514,7 @@ class HeapCursor {
|
|
|
3572
3514
|
get startSide() {
|
|
3573
3515
|
return this.value ? this.value.startSide : 0;
|
|
3574
3516
|
}
|
|
3575
|
-
goto(pos) {
|
|
3576
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1000000000;
|
|
3517
|
+
goto(pos, side = -1000000000 /* C.Far */) {
|
|
3577
3518
|
for (let cur of this.heap) cur.goto(pos, side);
|
|
3578
3519
|
for (let i = this.heap.length >> 1; i >= 0; i--) heapBubble(this.heap, i);
|
|
3579
3520
|
this.next();
|
|
@@ -3633,8 +3574,7 @@ class SpanCursor {
|
|
|
3633
3574
|
this.openStart = -1;
|
|
3634
3575
|
this.cursor = HeapCursor.from(sets, skip, minPoint);
|
|
3635
3576
|
}
|
|
3636
|
-
goto(pos) {
|
|
3637
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1000000000;
|
|
3577
|
+
goto(pos, side = -1000000000 /* C.Far */) {
|
|
3638
3578
|
this.cursor.goto(pos, side);
|
|
3639
3579
|
this.active.length = this.activeTo.length = this.activeRank.length = 0;
|
|
3640
3580
|
this.minActive = -1;
|
|
@@ -3782,8 +3722,7 @@ function findMinIndex(value, array) {
|
|
|
3782
3722
|
Count the column position at the given offset into the string,
|
|
3783
3723
|
taking extending characters and tab size into account.
|
|
3784
3724
|
*/
|
|
3785
|
-
function countColumn(string, tabSize) {
|
|
3786
|
-
let to = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : string.length;
|
|
3725
|
+
function countColumn(string, tabSize, to = string.length) {
|
|
3787
3726
|
let n = 0;
|
|
3788
3727
|
for (let i = 0; i < to;) {
|
|
3789
3728
|
if (string.charCodeAt(i) == 9) {
|
|
@@ -3900,11 +3839,11 @@ class StyleSet {
|
|
|
3900
3839
|
constructor(root) {
|
|
3901
3840
|
if (!root.head && root.adoptedStyleSheets && typeof CSSStyleSheet != "undefined") {
|
|
3902
3841
|
if (adoptedSet) {
|
|
3903
|
-
root.adoptedStyleSheets = [adoptedSet.sheet
|
|
3842
|
+
root.adoptedStyleSheets = [adoptedSet.sheet].concat(root.adoptedStyleSheets);
|
|
3904
3843
|
return root[SET] = adoptedSet;
|
|
3905
3844
|
}
|
|
3906
3845
|
this.sheet = new CSSStyleSheet();
|
|
3907
|
-
root.adoptedStyleSheets = [this.sheet
|
|
3846
|
+
root.adoptedStyleSheets = [this.sheet].concat(root.adoptedStyleSheets);
|
|
3908
3847
|
adoptedSet = this;
|
|
3909
3848
|
} else {
|
|
3910
3849
|
this.styleTag = (root.ownerDocument || root).createElement("style");
|
|
@@ -4330,8 +4269,7 @@ function focusPreventScroll(dom) {
|
|
|
4330
4269
|
}
|
|
4331
4270
|
}
|
|
4332
4271
|
let scratchRange;
|
|
4333
|
-
function textRange(node, from) {
|
|
4334
|
-
let to = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : from;
|
|
4272
|
+
function textRange(node, from, to = from) {
|
|
4335
4273
|
let range = scratchRange || (scratchRange = document.createRange());
|
|
4336
4274
|
range.setEnd(node, to);
|
|
4337
4275
|
range.setStart(node, from);
|
|
@@ -4384,8 +4322,7 @@ function atElementStart(doc, selection) {
|
|
|
4384
4322
|
}
|
|
4385
4323
|
}
|
|
4386
4324
|
class DOMPos {
|
|
4387
|
-
constructor(node, offset) {
|
|
4388
|
-
let precise = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
4325
|
+
constructor(node, offset, precise = true) {
|
|
4389
4326
|
this.node = node;
|
|
4390
4327
|
this.offset = offset;
|
|
4391
4328
|
this.precise = precise;
|
|
@@ -4405,6 +4342,10 @@ class ContentView {
|
|
|
4405
4342
|
this.dirty = 2 /* Dirty.Node */;
|
|
4406
4343
|
}
|
|
4407
4344
|
|
|
4345
|
+
get editorView() {
|
|
4346
|
+
if (!this.parent) throw new Error("Accessing view in orphan content view");
|
|
4347
|
+
return this.parent.editorView;
|
|
4348
|
+
}
|
|
4408
4349
|
get overrideDOMText() {
|
|
4409
4350
|
return null;
|
|
4410
4351
|
}
|
|
@@ -4431,7 +4372,7 @@ class ContentView {
|
|
|
4431
4372
|
coordsAt(_pos, _side) {
|
|
4432
4373
|
return null;
|
|
4433
4374
|
}
|
|
4434
|
-
sync(
|
|
4375
|
+
sync(track) {
|
|
4435
4376
|
if (this.dirty & 2 /* Dirty.Node */) {
|
|
4436
4377
|
let parent = this.dom;
|
|
4437
4378
|
let prev = null,
|
|
@@ -4442,7 +4383,7 @@ class ContentView {
|
|
|
4442
4383
|
let contentView = ContentView.get(next);
|
|
4443
4384
|
if (!contentView || !contentView.parent && contentView.canReuseDOM(child)) child.reuseDOM(next);
|
|
4444
4385
|
}
|
|
4445
|
-
child.sync(
|
|
4386
|
+
child.sync(track);
|
|
4446
4387
|
child.dirty = 0 /* Dirty.Not */;
|
|
4447
4388
|
}
|
|
4448
4389
|
|
|
@@ -4460,7 +4401,7 @@ class ContentView {
|
|
|
4460
4401
|
while (next) next = rm$1(next);
|
|
4461
4402
|
} else if (this.dirty & 1 /* Dirty.Child */) {
|
|
4462
4403
|
for (let child of this.children) if (child.dirty) {
|
|
4463
|
-
child.sync(
|
|
4404
|
+
child.sync(track);
|
|
4464
4405
|
child.dirty = 0 /* Dirty.Not */;
|
|
4465
4406
|
}
|
|
4466
4407
|
}
|
|
@@ -4492,8 +4433,7 @@ class ContentView {
|
|
|
4492
4433
|
pos += child.length + child.breakAfter;
|
|
4493
4434
|
}
|
|
4494
4435
|
}
|
|
4495
|
-
domBoundsAround(from, to) {
|
|
4496
|
-
let offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
4436
|
+
domBoundsAround(from, to, offset = 0) {
|
|
4497
4437
|
let fromI = -1,
|
|
4498
4438
|
fromStart = -1,
|
|
4499
4439
|
toI = -1,
|
|
@@ -4521,8 +4461,7 @@ class ContentView {
|
|
|
4521
4461
|
endDOM: toI < this.children.length && toI >= 0 ? this.children[toI].dom : null
|
|
4522
4462
|
};
|
|
4523
4463
|
}
|
|
4524
|
-
markDirty() {
|
|
4525
|
-
let andParent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
4464
|
+
markDirty(andParent = false) {
|
|
4526
4465
|
this.dirty |= 2 /* Dirty.Node */;
|
|
4527
4466
|
this.markParentsDirty(andParent);
|
|
4528
4467
|
}
|
|
@@ -4552,8 +4491,7 @@ class ContentView {
|
|
|
4552
4491
|
v = parent;
|
|
4553
4492
|
}
|
|
4554
4493
|
}
|
|
4555
|
-
replaceChildren(from, to) {
|
|
4556
|
-
let children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noChildren;
|
|
4494
|
+
replaceChildren(from, to, children = noChildren) {
|
|
4557
4495
|
this.markDirty();
|
|
4558
4496
|
for (let i = from; i < to; i++) {
|
|
4559
4497
|
let child = this.children[i];
|
|
@@ -4568,12 +4506,10 @@ class ContentView {
|
|
|
4568
4506
|
ignoreEvent(_event) {
|
|
4569
4507
|
return false;
|
|
4570
4508
|
}
|
|
4571
|
-
childCursor() {
|
|
4572
|
-
let pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.length;
|
|
4509
|
+
childCursor(pos = this.length) {
|
|
4573
4510
|
return new ChildCursor(this.children, pos, this.children.length);
|
|
4574
4511
|
}
|
|
4575
|
-
childPos(pos) {
|
|
4576
|
-
let bias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
4512
|
+
childPos(pos, bias = 1) {
|
|
4577
4513
|
return this.childCursor().findPos(pos, bias);
|
|
4578
4514
|
}
|
|
4579
4515
|
toString() {
|
|
@@ -4586,9 +4522,6 @@ class ContentView {
|
|
|
4586
4522
|
get isEditable() {
|
|
4587
4523
|
return true;
|
|
4588
4524
|
}
|
|
4589
|
-
get isWidget() {
|
|
4590
|
-
return false;
|
|
4591
|
-
}
|
|
4592
4525
|
merge(from, to, source, hasStart, openStart, openEnd) {
|
|
4593
4526
|
return false;
|
|
4594
4527
|
}
|
|
@@ -4622,8 +4555,7 @@ class ChildCursor {
|
|
|
4622
4555
|
this.i = i;
|
|
4623
4556
|
this.off = 0;
|
|
4624
4557
|
}
|
|
4625
|
-
findPos(pos) {
|
|
4626
|
-
let bias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
4558
|
+
findPos(pos, bias = 1) {
|
|
4627
4559
|
for (;;) {
|
|
4628
4560
|
if (pos > this.pos || pos == this.pos && (bias > 0 || this.i == 0 || this.children[this.i - 1].breakAfter)) {
|
|
4629
4561
|
this.off = pos - this.pos;
|
|
@@ -4763,7 +4695,7 @@ class TextView extends ContentView {
|
|
|
4763
4695
|
createDOM(textDOM) {
|
|
4764
4696
|
this.setDOM(textDOM || document.createTextNode(this.text));
|
|
4765
4697
|
}
|
|
4766
|
-
sync(
|
|
4698
|
+
sync(track) {
|
|
4767
4699
|
if (!this.dom) this.createDOM();
|
|
4768
4700
|
if (this.dom.nodeValue != this.text) {
|
|
4769
4701
|
if (track && track.node == this.dom) track.written = true;
|
|
@@ -4804,9 +4736,7 @@ class TextView extends ContentView {
|
|
|
4804
4736
|
}
|
|
4805
4737
|
}
|
|
4806
4738
|
class MarkView extends ContentView {
|
|
4807
|
-
constructor(mark) {
|
|
4808
|
-
let children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
4809
|
-
let length = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
4739
|
+
constructor(mark, children = [], length = 0) {
|
|
4810
4740
|
super();
|
|
4811
4741
|
this.mark = mark;
|
|
4812
4742
|
this.children = children;
|
|
@@ -4826,9 +4756,9 @@ class MarkView extends ContentView {
|
|
|
4826
4756
|
}
|
|
4827
4757
|
}
|
|
4828
4758
|
|
|
4829
|
-
sync(
|
|
4759
|
+
sync(track) {
|
|
4830
4760
|
if (!this.dom) this.setDOM(this.setAttrs(document.createElement(this.mark.tagName)));else if (this.dirty & 4 /* Dirty.Attrs */) this.setAttrs(this.dom);
|
|
4831
|
-
super.sync(
|
|
4761
|
+
super.sync(track);
|
|
4832
4762
|
}
|
|
4833
4763
|
merge(from, to, source, _hasStart, openStart, openEnd) {
|
|
4834
4764
|
if (source && (!(source instanceof MarkView && source.mark.eq(this.mark)) || from && openStart <= 0 || to < this.length && openEnd <= 0)) return false;
|
|
@@ -4907,11 +4837,11 @@ class WidgetView extends ContentView {
|
|
|
4907
4837
|
this.length -= from;
|
|
4908
4838
|
return result;
|
|
4909
4839
|
}
|
|
4910
|
-
sync(
|
|
4911
|
-
if (!this.dom || !this.widget.updateDOM(this.dom
|
|
4840
|
+
sync() {
|
|
4841
|
+
if (!this.dom || !this.widget.updateDOM(this.dom)) {
|
|
4912
4842
|
if (this.dom && this.prevWidget) this.prevWidget.destroy(this.dom);
|
|
4913
4843
|
this.prevWidget = null;
|
|
4914
|
-
this.setDOM(this.widget.toDOM(
|
|
4844
|
+
this.setDOM(this.widget.toDOM(this.editorView));
|
|
4915
4845
|
this.dom.contentEditable = "false";
|
|
4916
4846
|
}
|
|
4917
4847
|
}
|
|
@@ -4944,9 +4874,7 @@ class WidgetView extends ContentView {
|
|
|
4944
4874
|
if (this.length == 0) return Text.empty;
|
|
4945
4875
|
let top = this;
|
|
4946
4876
|
while (top.parent) top = top.parent;
|
|
4947
|
-
let
|
|
4948
|
-
view
|
|
4949
|
-
} = top,
|
|
4877
|
+
let view = top.editorView,
|
|
4950
4878
|
text = view && view.state.doc,
|
|
4951
4879
|
start = this.posAtStart;
|
|
4952
4880
|
return text ? text.slice(start, start + this.length) : Text.empty;
|
|
@@ -4970,9 +4898,6 @@ class WidgetView extends ContentView {
|
|
|
4970
4898
|
get isEditable() {
|
|
4971
4899
|
return false;
|
|
4972
4900
|
}
|
|
4973
|
-
get isWidget() {
|
|
4974
|
-
return true;
|
|
4975
|
-
}
|
|
4976
4901
|
destroy() {
|
|
4977
4902
|
super.destroy();
|
|
4978
4903
|
if (this.dom) this.widget.destroy(this.dom);
|
|
@@ -5046,9 +4971,9 @@ function scanCompositionTree(pos, side, view, text, enterView, fromText) {
|
|
|
5046
4971
|
}
|
|
5047
4972
|
function posFromDOMInCompositionTree(node, offset, view, text) {
|
|
5048
4973
|
if (view instanceof MarkView) {
|
|
5049
|
-
let pos = 0;
|
|
5050
4974
|
for (let child of view.children) {
|
|
5051
|
-
let
|
|
4975
|
+
let pos = 0,
|
|
4976
|
+
hasComp = contains(child.dom, text);
|
|
5052
4977
|
if (contains(child.dom, node)) return pos + (hasComp ? posFromDOMInCompositionTree(node, offset, child, text) : child.localPosFromDOM(node, offset));
|
|
5053
4978
|
pos += hasComp ? text.nodeValue.length : child.length;
|
|
5054
4979
|
}
|
|
@@ -5089,7 +5014,7 @@ class WidgetBufferView extends ContentView {
|
|
|
5089
5014
|
return this.side;
|
|
5090
5015
|
}
|
|
5091
5016
|
domAtPos(pos) {
|
|
5092
|
-
return
|
|
5017
|
+
return DOMPos.before(this.dom);
|
|
5093
5018
|
}
|
|
5094
5019
|
localPosFromDOM() {
|
|
5095
5020
|
return 0;
|
|
@@ -5259,7 +5184,7 @@ class WidgetType {
|
|
|
5259
5184
|
couldn't (in which case the widget will be redrawn). The default
|
|
5260
5185
|
implementation just returns false.
|
|
5261
5186
|
*/
|
|
5262
|
-
updateDOM(dom
|
|
5187
|
+
updateDOM(dom) {
|
|
5263
5188
|
return false;
|
|
5264
5189
|
}
|
|
5265
5190
|
/**
|
|
@@ -5412,8 +5337,7 @@ class Decoration extends RangeValue {
|
|
|
5412
5337
|
decorated range or ranges. If the ranges aren't already sorted,
|
|
5413
5338
|
pass `true` for `sort` to make the library sort them for you.
|
|
5414
5339
|
*/
|
|
5415
|
-
static set(of) {
|
|
5416
|
-
let sort = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
5340
|
+
static set(of, sort = false) {
|
|
5417
5341
|
return RangeSet.of(of, sort);
|
|
5418
5342
|
}
|
|
5419
5343
|
/**
|
|
@@ -5441,8 +5365,7 @@ class MarkDecoration extends Decoration {
|
|
|
5441
5365
|
eq(other) {
|
|
5442
5366
|
return this == other || other instanceof MarkDecoration && this.tagName == other.tagName && this.class == other.class && attrsEq(this.attrs, other.attrs);
|
|
5443
5367
|
}
|
|
5444
|
-
range(from) {
|
|
5445
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
|
|
5368
|
+
range(from, to = from) {
|
|
5446
5369
|
if (from >= to) throw new RangeError("Mark decorations may not be empty");
|
|
5447
5370
|
return super.range(from, to);
|
|
5448
5371
|
}
|
|
@@ -5455,8 +5378,7 @@ class LineDecoration extends Decoration {
|
|
|
5455
5378
|
eq(other) {
|
|
5456
5379
|
return other instanceof LineDecoration && this.spec.class == other.spec.class && attrsEq(this.spec.attributes, other.spec.attributes);
|
|
5457
5380
|
}
|
|
5458
|
-
range(from) {
|
|
5459
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
|
|
5381
|
+
range(from, to = from) {
|
|
5460
5382
|
if (to != from) throw new RangeError("Line decoration ranges must be zero-length");
|
|
5461
5383
|
return super.range(from, to);
|
|
5462
5384
|
}
|
|
@@ -5480,16 +5402,14 @@ class PointDecoration extends Decoration {
|
|
|
5480
5402
|
eq(other) {
|
|
5481
5403
|
return other instanceof PointDecoration && widgetsEq(this.widget, other.widget) && this.block == other.block && this.startSide == other.startSide && this.endSide == other.endSide;
|
|
5482
5404
|
}
|
|
5483
|
-
range(from) {
|
|
5484
|
-
let to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
|
|
5405
|
+
range(from, to = from) {
|
|
5485
5406
|
if (this.isReplace && (from > to || from == to && this.startSide > 0 && this.endSide <= 0)) throw new RangeError("Invalid range for replacement decoration");
|
|
5486
5407
|
if (!this.isReplace && to != from) throw new RangeError("Widget decorations can only have zero-length ranges");
|
|
5487
5408
|
return super.range(from, to);
|
|
5488
5409
|
}
|
|
5489
5410
|
}
|
|
5490
5411
|
PointDecoration.prototype.point = true;
|
|
5491
|
-
function getInclusive(spec) {
|
|
5492
|
-
let block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
5412
|
+
function getInclusive(spec, block = false) {
|
|
5493
5413
|
let {
|
|
5494
5414
|
inclusiveStart: start,
|
|
5495
5415
|
inclusiveEnd: end
|
|
@@ -5504,8 +5424,7 @@ function getInclusive(spec) {
|
|
|
5504
5424
|
function widgetsEq(a, b) {
|
|
5505
5425
|
return a == b || !!(a && b && a.compare(b));
|
|
5506
5426
|
}
|
|
5507
|
-
function addRange(from, to, ranges) {
|
|
5508
|
-
let margin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
5427
|
+
function addRange(from, to, ranges, margin = 0) {
|
|
5509
5428
|
let last = ranges.length - 1;
|
|
5510
5429
|
if (last >= 0 && ranges[last] + margin >= from) ranges[last] = Math.max(ranges[last], to);else ranges.push(from, to);
|
|
5511
5430
|
}
|
|
@@ -5588,7 +5507,7 @@ class LineView extends ContentView {
|
|
|
5588
5507
|
}
|
|
5589
5508
|
}
|
|
5590
5509
|
|
|
5591
|
-
sync(
|
|
5510
|
+
sync(track) {
|
|
5592
5511
|
var _a;
|
|
5593
5512
|
if (!this.dom) {
|
|
5594
5513
|
this.setDOM(document.createElement("div"));
|
|
@@ -5604,7 +5523,7 @@ class LineView extends ContentView {
|
|
|
5604
5523
|
this.dom.classList.add("cm-line");
|
|
5605
5524
|
this.prevAttrs = undefined;
|
|
5606
5525
|
}
|
|
5607
|
-
super.sync(
|
|
5526
|
+
super.sync(track);
|
|
5608
5527
|
let last = this.dom.lastChild;
|
|
5609
5528
|
while (last && ContentView.get(last) instanceof MarkView) last = last.lastChild;
|
|
5610
5529
|
if (!last || !this.length || last.nodeName != "BR" && ((_a = ContentView.get(last)) === null || _a === void 0 ? void 0 : _a.isEditable) == false && (!browser.ios || !this.children.some(ch => ch instanceof TextView))) {
|
|
@@ -5615,41 +5534,20 @@ class LineView extends ContentView {
|
|
|
5615
5534
|
}
|
|
5616
5535
|
measureTextSize() {
|
|
5617
5536
|
if (this.children.length == 0 || this.length > 20) return null;
|
|
5618
|
-
let totalWidth = 0
|
|
5619
|
-
textHeight;
|
|
5537
|
+
let totalWidth = 0;
|
|
5620
5538
|
for (let child of this.children) {
|
|
5621
5539
|
if (!(child instanceof TextView) || /[^ -~]/.test(child.text)) return null;
|
|
5622
5540
|
let rects = clientRectsFor(child.dom);
|
|
5623
5541
|
if (rects.length != 1) return null;
|
|
5624
5542
|
totalWidth += rects[0].width;
|
|
5625
|
-
textHeight = rects[0].height;
|
|
5626
5543
|
}
|
|
5627
5544
|
return !totalWidth ? null : {
|
|
5628
5545
|
lineHeight: this.dom.getBoundingClientRect().height,
|
|
5629
|
-
charWidth: totalWidth / this.length
|
|
5630
|
-
textHeight
|
|
5546
|
+
charWidth: totalWidth / this.length
|
|
5631
5547
|
};
|
|
5632
5548
|
}
|
|
5633
5549
|
coordsAt(pos, side) {
|
|
5634
|
-
|
|
5635
|
-
// Correct rectangle height for empty lines when the returned
|
|
5636
|
-
// height is larger than the text height.
|
|
5637
|
-
if (!this.children.length && rect && this.parent) {
|
|
5638
|
-
let {
|
|
5639
|
-
heightOracle
|
|
5640
|
-
} = this.parent.view.viewState,
|
|
5641
|
-
height = rect.bottom - rect.top;
|
|
5642
|
-
if (Math.abs(height - heightOracle.lineHeight) < 2 && heightOracle.textHeight < height) {
|
|
5643
|
-
let dist = (height - heightOracle.textHeight) / 2;
|
|
5644
|
-
return {
|
|
5645
|
-
top: rect.top + dist,
|
|
5646
|
-
bottom: rect.bottom - dist,
|
|
5647
|
-
left: rect.left,
|
|
5648
|
-
right: rect.left
|
|
5649
|
-
};
|
|
5650
|
-
}
|
|
5651
|
-
}
|
|
5652
|
-
return rect;
|
|
5550
|
+
return coordsInChildren(this, pos, side);
|
|
5653
5551
|
}
|
|
5654
5552
|
become(_other) {
|
|
5655
5553
|
return false;
|
|
@@ -5697,11 +5595,11 @@ class BlockWidgetView extends ContentView {
|
|
|
5697
5595
|
get children() {
|
|
5698
5596
|
return noChildren;
|
|
5699
5597
|
}
|
|
5700
|
-
sync(
|
|
5701
|
-
if (!this.dom || !this.widget.updateDOM(this.dom
|
|
5598
|
+
sync() {
|
|
5599
|
+
if (!this.dom || !this.widget.updateDOM(this.dom)) {
|
|
5702
5600
|
if (this.dom && this.prevWidget) this.prevWidget.destroy(this.dom);
|
|
5703
5601
|
this.prevWidget = null;
|
|
5704
|
-
this.setDOM(this.widget.toDOM(
|
|
5602
|
+
this.setDOM(this.widget.toDOM(this.editorView));
|
|
5705
5603
|
this.dom.contentEditable = "false";
|
|
5706
5604
|
}
|
|
5707
5605
|
}
|
|
@@ -5728,12 +5626,6 @@ class BlockWidgetView extends ContentView {
|
|
|
5728
5626
|
ignoreEvent(event) {
|
|
5729
5627
|
return this.widget.ignoreEvent(event);
|
|
5730
5628
|
}
|
|
5731
|
-
get isEditable() {
|
|
5732
|
-
return false;
|
|
5733
|
-
}
|
|
5734
|
-
get isWidget() {
|
|
5735
|
-
return true;
|
|
5736
|
-
}
|
|
5737
5629
|
destroy() {
|
|
5738
5630
|
super.destroy();
|
|
5739
5631
|
if (this.dom) this.widget.destroy(this.dom);
|
|
@@ -5771,8 +5663,7 @@ class ContentBuilder {
|
|
|
5771
5663
|
}
|
|
5772
5664
|
return this.curLine;
|
|
5773
5665
|
}
|
|
5774
|
-
flushBuffer() {
|
|
5775
|
-
let active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.bufferMarks;
|
|
5666
|
+
flushBuffer(active = this.bufferMarks) {
|
|
5776
5667
|
if (this.pendingBuffer) {
|
|
5777
5668
|
this.curLine.append(wrapMarks(new WidgetBufferView(-1), active), active.length);
|
|
5778
5669
|
this.pendingBuffer = 0 /* Buf.No */;
|
|
@@ -5904,7 +5795,6 @@ const mouseSelectionStyle = /*@__PURE__*/Facet.define();
|
|
|
5904
5795
|
const exceptionSink = /*@__PURE__*/Facet.define();
|
|
5905
5796
|
const updateListener = /*@__PURE__*/Facet.define();
|
|
5906
5797
|
const inputHandler = /*@__PURE__*/Facet.define();
|
|
5907
|
-
const focusChangeEffect = /*@__PURE__*/Facet.define();
|
|
5908
5798
|
const perLineTextDirection = /*@__PURE__*/Facet.define({
|
|
5909
5799
|
combine: values => values.some(x => x)
|
|
5910
5800
|
});
|
|
@@ -5912,11 +5802,7 @@ const nativeSelectionHidden = /*@__PURE__*/Facet.define({
|
|
|
5912
5802
|
combine: values => values.some(x => x)
|
|
5913
5803
|
});
|
|
5914
5804
|
class ScrollTarget {
|
|
5915
|
-
constructor(range) {
|
|
5916
|
-
let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "nearest";
|
|
5917
|
-
let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "nearest";
|
|
5918
|
-
let yMargin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5;
|
|
5919
|
-
let xMargin = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 5;
|
|
5805
|
+
constructor(range, y = "nearest", x = "nearest", yMargin = 5, xMargin = 5) {
|
|
5920
5806
|
this.range = range;
|
|
5921
5807
|
this.y = y;
|
|
5922
5808
|
this.x = x;
|
|
@@ -6139,6 +6025,11 @@ class ViewUpdate {
|
|
|
6139
6025
|
let changedRanges = [];
|
|
6140
6026
|
this.changes.iterChangedRanges((fromA, toA, fromB, toB) => changedRanges.push(new ChangedRange(fromA, toA, fromB, toB)));
|
|
6141
6027
|
this.changedRanges = changedRanges;
|
|
6028
|
+
let focus = view.hasFocus;
|
|
6029
|
+
if (focus != view.inputState.notifiedFocused) {
|
|
6030
|
+
view.inputState.notifiedFocused = focus;
|
|
6031
|
+
this.flags |= 1 /* UpdateFlag.Focus */;
|
|
6032
|
+
}
|
|
6142
6033
|
}
|
|
6143
6034
|
/**
|
|
6144
6035
|
@internal
|
|
@@ -6591,6 +6482,9 @@ class DocView extends ContentView {
|
|
|
6591
6482
|
this.updateDeco();
|
|
6592
6483
|
this.updateInner([new ChangedRange(0, 0, 0, view.state.doc.length)], 0);
|
|
6593
6484
|
}
|
|
6485
|
+
get editorView() {
|
|
6486
|
+
return this.view;
|
|
6487
|
+
}
|
|
6594
6488
|
get length() {
|
|
6595
6489
|
return this.view.state.doc.length;
|
|
6596
6490
|
}
|
|
@@ -6601,13 +6495,10 @@ class DocView extends ContentView {
|
|
|
6601
6495
|
update(update) {
|
|
6602
6496
|
let changedRanges = update.changedRanges;
|
|
6603
6497
|
if (this.minWidth > 0 && changedRanges.length) {
|
|
6604
|
-
if (!changedRanges.every(
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
} = _ref;
|
|
6609
|
-
return toA < this.minWidthFrom || fromA > this.minWidthTo;
|
|
6610
|
-
})) {
|
|
6498
|
+
if (!changedRanges.every(({
|
|
6499
|
+
fromA,
|
|
6500
|
+
toA
|
|
6501
|
+
}) => toA < this.minWidthFrom || fromA > this.minWidthTo)) {
|
|
6611
6502
|
this.minWidth = this.minWidthFrom = this.minWidthTo = 0;
|
|
6612
6503
|
} else {
|
|
6613
6504
|
this.minWidthFrom = update.changes.mapPos(this.minWidthFrom, 1);
|
|
@@ -6656,7 +6547,7 @@ class DocView extends ContentView {
|
|
|
6656
6547
|
node: observer.selectionRange.focusNode,
|
|
6657
6548
|
written: false
|
|
6658
6549
|
} : undefined;
|
|
6659
|
-
this.sync(
|
|
6550
|
+
this.sync(track);
|
|
6660
6551
|
this.dirty = 0 /* Dirty.Not */;
|
|
6661
6552
|
if (track && (track.written || observer.selectionRange.focusNode != track.node)) this.forceSelection = true;
|
|
6662
6553
|
this.dom.style.height = "";
|
|
@@ -6694,9 +6585,7 @@ class DocView extends ContentView {
|
|
|
6694
6585
|
}
|
|
6695
6586
|
}
|
|
6696
6587
|
// Sync the DOM selection to this.state.selection
|
|
6697
|
-
updateSelection() {
|
|
6698
|
-
let mustRead = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
6699
|
-
let fromPointer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6588
|
+
updateSelection(mustRead = false, fromPointer = false) {
|
|
6700
6589
|
if (mustRead || !this.view.observer.selectionRange.focusNode) this.view.observer.readSelectionRange();
|
|
6701
6590
|
if (!(fromPointer || this.mayControlSelection())) return;
|
|
6702
6591
|
let force = this.forceSelection;
|
|
@@ -6883,8 +6772,7 @@ class DocView extends ContentView {
|
|
|
6883
6772
|
// If no workable line exists, force a layout of a measurable element
|
|
6884
6773
|
let dummy = document.createElement("div"),
|
|
6885
6774
|
lineHeight,
|
|
6886
|
-
charWidth
|
|
6887
|
-
textHeight;
|
|
6775
|
+
charWidth;
|
|
6888
6776
|
dummy.className = "cm-line";
|
|
6889
6777
|
dummy.style.width = "99999px";
|
|
6890
6778
|
dummy.textContent = "abc def ghi jkl mno pqr stu";
|
|
@@ -6893,17 +6781,14 @@ class DocView extends ContentView {
|
|
|
6893
6781
|
let rect = clientRectsFor(dummy.firstChild)[0];
|
|
6894
6782
|
lineHeight = dummy.getBoundingClientRect().height;
|
|
6895
6783
|
charWidth = rect ? rect.width / 27 : 7;
|
|
6896
|
-
textHeight = rect ? rect.height : lineHeight;
|
|
6897
6784
|
dummy.remove();
|
|
6898
6785
|
});
|
|
6899
6786
|
return {
|
|
6900
6787
|
lineHeight,
|
|
6901
|
-
charWidth
|
|
6902
|
-
textHeight
|
|
6788
|
+
charWidth
|
|
6903
6789
|
};
|
|
6904
6790
|
}
|
|
6905
|
-
childCursor() {
|
|
6906
|
-
let pos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.length;
|
|
6791
|
+
childCursor(pos = this.length) {
|
|
6907
6792
|
// Move back to start of last element when possible, so that
|
|
6908
6793
|
// `ChildCursor.findPos` doesn't have to deal with the edge case
|
|
6909
6794
|
// of being after the last element.
|
|
@@ -7084,26 +6969,19 @@ class CompositionWidget extends WidgetType {
|
|
|
7084
6969
|
return CompositionView;
|
|
7085
6970
|
}
|
|
7086
6971
|
}
|
|
7087
|
-
function nearbyTextNode(
|
|
7088
|
-
|
|
6972
|
+
function nearbyTextNode(node, offset, side) {
|
|
6973
|
+
for (;;) {
|
|
7089
6974
|
if (node.nodeType == 3) return node;
|
|
7090
|
-
if (node.nodeType == 1 && offset > 0) {
|
|
6975
|
+
if (node.nodeType == 1 && offset > 0 && side <= 0) {
|
|
7091
6976
|
node = node.childNodes[offset - 1];
|
|
7092
6977
|
offset = maxOffset(node);
|
|
7093
|
-
} else {
|
|
7094
|
-
break;
|
|
7095
|
-
}
|
|
7096
|
-
}
|
|
7097
|
-
if (side >= 0) for (let node = startNode, offset = startOffset;;) {
|
|
7098
|
-
if (node.nodeType == 3) return node;
|
|
7099
|
-
if (node.nodeType == 1 && offset < node.childNodes.length && side >= 0) {
|
|
6978
|
+
} else if (node.nodeType == 1 && offset < node.childNodes.length && side >= 0) {
|
|
7100
6979
|
node = node.childNodes[offset];
|
|
7101
6980
|
offset = 0;
|
|
7102
6981
|
} else {
|
|
7103
|
-
|
|
6982
|
+
return null;
|
|
7104
6983
|
}
|
|
7105
6984
|
}
|
|
7106
|
-
return null;
|
|
7107
6985
|
}
|
|
7108
6986
|
function nextToUneditable(node, offset) {
|
|
7109
6987
|
if (node.nodeType != 1) return 0;
|
|
@@ -7133,8 +7011,7 @@ function inUneditable(node, inside) {
|
|
|
7133
7011
|
}
|
|
7134
7012
|
return false;
|
|
7135
7013
|
}
|
|
7136
|
-
function groupAt(state, pos) {
|
|
7137
|
-
let bias = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
7014
|
+
function groupAt(state, pos, bias = 1) {
|
|
7138
7015
|
let categorize = state.charCategorizer(pos);
|
|
7139
7016
|
let line = state.doc.lineAt(pos),
|
|
7140
7017
|
linePos = pos - line.from;
|
|
@@ -7277,20 +7154,18 @@ function domPosInText(node, x, y) {
|
|
|
7277
7154
|
offset: closestOffset > -1 ? closestOffset : generalSide > 0 ? node.nodeValue.length : 0
|
|
7278
7155
|
};
|
|
7279
7156
|
}
|
|
7280
|
-
function posAtCoords(view,
|
|
7281
|
-
|
|
7282
|
-
|
|
7157
|
+
function posAtCoords(view, {
|
|
7158
|
+
x,
|
|
7159
|
+
y
|
|
7160
|
+
}, precise, bias = -1) {
|
|
7161
|
+
var _a;
|
|
7283
7162
|
let content = view.contentDOM.getBoundingClientRect(),
|
|
7284
7163
|
docTop = content.top + view.viewState.paddingTop;
|
|
7285
7164
|
let block,
|
|
7286
7165
|
{
|
|
7287
7166
|
docHeight
|
|
7288
7167
|
} = view.viewState;
|
|
7289
|
-
let
|
|
7290
|
-
x,
|
|
7291
|
-
y
|
|
7292
|
-
} = coords,
|
|
7293
|
-
yOffset = y - docTop;
|
|
7168
|
+
let yOffset = y - docTop;
|
|
7294
7169
|
if (yOffset < 0) return 0;
|
|
7295
7170
|
if (yOffset > docHeight) return view.state.doc.length;
|
|
7296
7171
|
// Scan for a text block near the queried y position
|
|
@@ -7355,14 +7230,7 @@ function posAtCoords(view, coords, precise) {
|
|
|
7355
7230
|
offset
|
|
7356
7231
|
} = domPosAtCoords(line.dom, x, y));
|
|
7357
7232
|
}
|
|
7358
|
-
|
|
7359
|
-
if (!nearest) return null;
|
|
7360
|
-
if (nearest.isWidget && ((_b = nearest.dom) === null || _b === void 0 ? void 0 : _b.nodeType) == 1) {
|
|
7361
|
-
let rect = nearest.dom.getBoundingClientRect();
|
|
7362
|
-
return coords.y < rect.top || coords.y <= rect.bottom && coords.x <= (rect.left + rect.right) / 2 ? nearest.posAtStart : nearest.posAtEnd;
|
|
7363
|
-
} else {
|
|
7364
|
-
return nearest.localPosFromDOM(node, offset) + nearest.posAtStart;
|
|
7365
|
-
}
|
|
7233
|
+
return view.docView.posFromDOM(node, offset);
|
|
7366
7234
|
}
|
|
7367
7235
|
function posAtCoordsImprecise(view, contentRect, block, x, y) {
|
|
7368
7236
|
let into = Math.round((x - contentRect.left) * view.defaultCharacterWidth);
|
|
@@ -7534,16 +7402,7 @@ class InputState {
|
|
|
7534
7402
|
this.registeredEvents.push(type);
|
|
7535
7403
|
}
|
|
7536
7404
|
view.scrollDOM.addEventListener("mousedown", event => {
|
|
7537
|
-
if (event.target == view.scrollDOM
|
|
7538
|
-
handleEvent(handlers.mousedown, event);
|
|
7539
|
-
if (!event.defaultPrevented && event.button == 2) {
|
|
7540
|
-
// Make sure the content covers the entire scroller height, in order
|
|
7541
|
-
// to catch a native context menu click below it
|
|
7542
|
-
let start = view.contentDOM.style.minHeight;
|
|
7543
|
-
view.contentDOM.style.minHeight = "100%";
|
|
7544
|
-
setTimeout(() => view.contentDOM.style.minHeight = start, 200);
|
|
7545
|
-
}
|
|
7546
|
-
}
|
|
7405
|
+
if (event.target == view.scrollDOM) handleEvent(handlers.mousedown, event);
|
|
7547
7406
|
});
|
|
7548
7407
|
if (browser.chrome && browser.chrome_version == 102) {
|
|
7549
7408
|
// FIXME remove at some point
|
|
@@ -7715,13 +7574,11 @@ class MouseSelection {
|
|
|
7715
7574
|
this.multiple = view.state.facet(EditorState.allowMultipleSelections) && addsSelectionRange(view, startEvent);
|
|
7716
7575
|
this.dragMove = dragMovesSelection(view, startEvent);
|
|
7717
7576
|
this.dragging = isInPrimarySelection(view, startEvent) && getClickType(startEvent) == 1 ? null : false;
|
|
7718
|
-
}
|
|
7719
|
-
start(event) {
|
|
7720
7577
|
// When clicking outside of the selection, immediately apply the
|
|
7721
7578
|
// effect of starting the selection
|
|
7722
7579
|
if (this.dragging === false) {
|
|
7723
|
-
|
|
7724
|
-
this.select(
|
|
7580
|
+
startEvent.preventDefault();
|
|
7581
|
+
this.select(startEvent);
|
|
7725
7582
|
}
|
|
7726
7583
|
}
|
|
7727
7584
|
move(event) {
|
|
@@ -7906,9 +7763,8 @@ handlers.mousedown = (view, event) => {
|
|
|
7906
7763
|
if (!style && event.button == 0) style = basicMouseSelection(view, event);
|
|
7907
7764
|
if (style) {
|
|
7908
7765
|
let mustFocus = view.root.activeElement != view.contentDOM;
|
|
7909
|
-
view.inputState.startMouseSelection(new MouseSelection(view, event, style, mustFocus));
|
|
7910
7766
|
if (mustFocus) view.observer.ignore(() => focusPreventScroll(view.contentDOM));
|
|
7911
|
-
|
|
7767
|
+
view.inputState.startMouseSelection(new MouseSelection(view, event, style, mustFocus));
|
|
7912
7768
|
}
|
|
7913
7769
|
};
|
|
7914
7770
|
function rangeForClick(view, pos, bias, type) {
|
|
@@ -8074,7 +7930,7 @@ handlers.paste = (view, event) => {
|
|
|
8074
7930
|
view.observer.flush();
|
|
8075
7931
|
let data = brokenClipboardAPI ? null : event.clipboardData;
|
|
8076
7932
|
if (data) {
|
|
8077
|
-
doPaste(view, data.getData("text/plain")
|
|
7933
|
+
doPaste(view, data.getData("text/plain"));
|
|
8078
7934
|
event.preventDefault();
|
|
8079
7935
|
} else {
|
|
8080
7936
|
capturePaste(view);
|
|
@@ -8151,25 +8007,9 @@ handlers.copy = handlers.cut = (view, event) => {
|
|
|
8151
8007
|
userEvent: "delete.cut"
|
|
8152
8008
|
});
|
|
8153
8009
|
};
|
|
8154
|
-
const isFocusChange = /*@__PURE__*/Annotation.define();
|
|
8155
|
-
function focusChangeTransaction(state, focus) {
|
|
8156
|
-
let effects = [];
|
|
8157
|
-
for (let getEffect of state.facet(focusChangeEffect)) {
|
|
8158
|
-
let effect = getEffect(state, focus);
|
|
8159
|
-
if (effect) effects.push(effect);
|
|
8160
|
-
}
|
|
8161
|
-
return effects ? state.update({
|
|
8162
|
-
effects,
|
|
8163
|
-
annotations: isFocusChange.of(true)
|
|
8164
|
-
}) : null;
|
|
8165
|
-
}
|
|
8166
8010
|
function updateForFocusChange(view) {
|
|
8167
8011
|
setTimeout(() => {
|
|
8168
|
-
|
|
8169
|
-
if (focus != view.inputState.notifiedFocused) {
|
|
8170
|
-
let tr = focusChangeTransaction(view.state, focus);
|
|
8171
|
-
if (tr) view.dispatch(tr);else view.update([]);
|
|
8172
|
-
}
|
|
8012
|
+
if (view.hasFocus != view.inputState.notifiedFocused) view.update([]);
|
|
8173
8013
|
}, 10);
|
|
8174
8014
|
}
|
|
8175
8015
|
handlers.focus = view => {
|
|
@@ -8238,16 +8078,15 @@ class HeightOracle {
|
|
|
8238
8078
|
this.lineWrapping = lineWrapping;
|
|
8239
8079
|
this.doc = Text.empty;
|
|
8240
8080
|
this.heightSamples = {};
|
|
8241
|
-
this.lineHeight = 14;
|
|
8081
|
+
this.lineHeight = 14;
|
|
8242
8082
|
this.charWidth = 7;
|
|
8243
|
-
this.textHeight = 14; // The height of the actual font (font-size)
|
|
8244
8083
|
this.lineLength = 30;
|
|
8245
8084
|
// Used to track, during updateHeight, if any actual heights changed
|
|
8246
8085
|
this.heightChanged = false;
|
|
8247
8086
|
}
|
|
8248
8087
|
heightForGap(from, to) {
|
|
8249
8088
|
let lines = this.doc.lineAt(to).number - this.doc.lineAt(from).number + 1;
|
|
8250
|
-
if (this.lineWrapping) lines += Math.
|
|
8089
|
+
if (this.lineWrapping) lines += Math.ceil((to - from - lines * this.lineLength * 0.5) / this.lineLength);
|
|
8251
8090
|
return this.lineHeight * lines;
|
|
8252
8091
|
}
|
|
8253
8092
|
heightForLine(length) {
|
|
@@ -8276,13 +8115,12 @@ class HeightOracle {
|
|
|
8276
8115
|
}
|
|
8277
8116
|
return newHeight;
|
|
8278
8117
|
}
|
|
8279
|
-
refresh(whiteSpace, lineHeight, charWidth,
|
|
8118
|
+
refresh(whiteSpace, lineHeight, charWidth, lineLength, knownHeights) {
|
|
8280
8119
|
let lineWrapping = wrappingWhiteSpace.indexOf(whiteSpace) > -1;
|
|
8281
8120
|
let changed = Math.round(lineHeight) != Math.round(this.lineHeight) || this.lineWrapping != lineWrapping;
|
|
8282
8121
|
this.lineWrapping = lineWrapping;
|
|
8283
8122
|
this.lineHeight = lineHeight;
|
|
8284
8123
|
this.charWidth = charWidth;
|
|
8285
|
-
this.textHeight = textHeight;
|
|
8286
8124
|
this.lineLength = lineLength;
|
|
8287
8125
|
if (changed) {
|
|
8288
8126
|
this.heightSamples = {};
|
|
@@ -8374,8 +8212,9 @@ const Epsilon = 1e-3;
|
|
|
8374
8212
|
class HeightMap {
|
|
8375
8213
|
constructor(length,
|
|
8376
8214
|
// The number of characters covered
|
|
8377
|
-
height
|
|
8378
|
-
|
|
8215
|
+
height,
|
|
8216
|
+
// Height of this part of the document
|
|
8217
|
+
flags = 2 /* Flag.Outdated */) {
|
|
8379
8218
|
this.length = length;
|
|
8380
8219
|
this.height = height;
|
|
8381
8220
|
this.flags = flags;
|
|
@@ -8406,8 +8245,7 @@ class HeightMap {
|
|
|
8406
8245
|
result.push(this);
|
|
8407
8246
|
}
|
|
8408
8247
|
applyChanges(decorations, oldDoc, oracle, changes) {
|
|
8409
|
-
let me = this
|
|
8410
|
-
doc = oracle.doc;
|
|
8248
|
+
let me = this;
|
|
8411
8249
|
for (let i = changes.length - 1; i >= 0; i--) {
|
|
8412
8250
|
let {
|
|
8413
8251
|
fromA,
|
|
@@ -8415,19 +8253,19 @@ class HeightMap {
|
|
|
8415
8253
|
fromB,
|
|
8416
8254
|
toB
|
|
8417
8255
|
} = changes[i];
|
|
8418
|
-
let start = me.lineAt(fromA, QueryType.ByPosNoHeight,
|
|
8419
|
-
let end = start.to >= toA ? start : me.lineAt(toA, QueryType.ByPosNoHeight,
|
|
8256
|
+
let start = me.lineAt(fromA, QueryType.ByPosNoHeight, oldDoc, 0, 0);
|
|
8257
|
+
let end = start.to >= toA ? start : me.lineAt(toA, QueryType.ByPosNoHeight, oldDoc, 0, 0);
|
|
8420
8258
|
toB += end.to - toA;
|
|
8421
8259
|
toA = end.to;
|
|
8422
8260
|
while (i > 0 && start.from <= changes[i - 1].toA) {
|
|
8423
8261
|
fromA = changes[i - 1].fromA;
|
|
8424
8262
|
fromB = changes[i - 1].fromB;
|
|
8425
8263
|
i--;
|
|
8426
|
-
if (fromA < start.from) start = me.lineAt(fromA, QueryType.ByPosNoHeight,
|
|
8264
|
+
if (fromA < start.from) start = me.lineAt(fromA, QueryType.ByPosNoHeight, oldDoc, 0, 0);
|
|
8427
8265
|
}
|
|
8428
8266
|
fromB += start.from - fromA;
|
|
8429
8267
|
fromA = start.from;
|
|
8430
|
-
let nodes = NodeBuilder.build(oracle
|
|
8268
|
+
let nodes = NodeBuilder.build(oracle, decorations, fromB, toB);
|
|
8431
8269
|
me = me.replace(fromA, toA, nodes);
|
|
8432
8270
|
}
|
|
8433
8271
|
return me.updateHeight(oracle, 0);
|
|
@@ -8485,18 +8323,16 @@ class HeightMapBlock extends HeightMap {
|
|
|
8485
8323
|
super(length, height);
|
|
8486
8324
|
this.type = type;
|
|
8487
8325
|
}
|
|
8488
|
-
blockAt(_height,
|
|
8326
|
+
blockAt(_height, _doc, top, offset) {
|
|
8489
8327
|
return new BlockInfo(offset, this.length, top, this.height, this.type);
|
|
8490
8328
|
}
|
|
8491
|
-
lineAt(_value, _type,
|
|
8492
|
-
return this.blockAt(0,
|
|
8329
|
+
lineAt(_value, _type, doc, top, offset) {
|
|
8330
|
+
return this.blockAt(0, doc, top, offset);
|
|
8493
8331
|
}
|
|
8494
|
-
forEachLine(from, to,
|
|
8495
|
-
if (from <= offset + this.length && to >= offset) f(this.blockAt(0,
|
|
8332
|
+
forEachLine(from, to, doc, top, offset, f) {
|
|
8333
|
+
if (from <= offset + this.length && to >= offset) f(this.blockAt(0, doc, top, offset));
|
|
8496
8334
|
}
|
|
8497
|
-
updateHeight(oracle) {
|
|
8498
|
-
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
8499
|
-
let measured = arguments.length > 3 ? arguments[3] : undefined;
|
|
8335
|
+
updateHeight(oracle, offset = 0, _force = false, measured) {
|
|
8500
8336
|
if (measured && measured.from <= offset && measured.more) this.setHeight(oracle, measured.heights[measured.index++]);
|
|
8501
8337
|
this.outdated = false;
|
|
8502
8338
|
return this;
|
|
@@ -8522,10 +8358,7 @@ class HeightMapText extends HeightMapBlock {
|
|
|
8522
8358
|
return HeightMap.of(nodes);
|
|
8523
8359
|
}
|
|
8524
8360
|
}
|
|
8525
|
-
updateHeight(oracle) {
|
|
8526
|
-
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
8527
|
-
let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8528
|
-
let measured = arguments.length > 3 ? arguments[3] : undefined;
|
|
8361
|
+
updateHeight(oracle, offset = 0, force = false, measured) {
|
|
8529
8362
|
if (measured && measured.from <= offset && measured.more) this.setHeight(oracle, measured.heights[measured.index++]);else if (force || this.outdated) this.setHeight(oracle, Math.max(this.widgetHeight, oracle.heightForLine(this.length - this.collapsed)));
|
|
8530
8363
|
this.outdated = false;
|
|
8531
8364
|
return this;
|
|
@@ -8538,85 +8371,58 @@ class HeightMapGap extends HeightMap {
|
|
|
8538
8371
|
constructor(length) {
|
|
8539
8372
|
super(length, 0);
|
|
8540
8373
|
}
|
|
8541
|
-
|
|
8542
|
-
let firstLine =
|
|
8543
|
-
lastLine =
|
|
8544
|
-
let lines = lastLine - firstLine + 1;
|
|
8545
|
-
let perLine,
|
|
8546
|
-
perChar = 0;
|
|
8547
|
-
if (oracle.lineWrapping) {
|
|
8548
|
-
let totalPerLine = Math.min(this.height, oracle.lineHeight * lines);
|
|
8549
|
-
perLine = totalPerLine / lines;
|
|
8550
|
-
perChar = (this.height - totalPerLine) / (this.length - lines - 1);
|
|
8551
|
-
} else {
|
|
8552
|
-
perLine = this.height / lines;
|
|
8553
|
-
}
|
|
8374
|
+
lines(doc, offset) {
|
|
8375
|
+
let firstLine = doc.lineAt(offset).number,
|
|
8376
|
+
lastLine = doc.lineAt(offset + this.length).number;
|
|
8554
8377
|
return {
|
|
8555
8378
|
firstLine,
|
|
8556
8379
|
lastLine,
|
|
8557
|
-
|
|
8558
|
-
perChar
|
|
8380
|
+
lineHeight: this.height / (lastLine - firstLine + 1)
|
|
8559
8381
|
};
|
|
8560
8382
|
}
|
|
8561
|
-
blockAt(height,
|
|
8383
|
+
blockAt(height, doc, top, offset) {
|
|
8562
8384
|
let {
|
|
8563
8385
|
firstLine,
|
|
8564
8386
|
lastLine,
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
return new BlockInfo(line.from, line.length, lineTop, lineHeight, BlockType.Text);
|
|
8574
|
-
} else {
|
|
8575
|
-
let line = Math.max(0, Math.min(lastLine - firstLine, Math.floor((height - top) / perLine)));
|
|
8576
|
-
let {
|
|
8577
|
-
from,
|
|
8578
|
-
length
|
|
8579
|
-
} = oracle.doc.line(firstLine + line);
|
|
8580
|
-
return new BlockInfo(from, length, top + perLine * line, perLine, BlockType.Text);
|
|
8581
|
-
}
|
|
8387
|
+
lineHeight
|
|
8388
|
+
} = this.lines(doc, offset);
|
|
8389
|
+
let line = Math.max(0, Math.min(lastLine - firstLine, Math.floor((height - top) / lineHeight)));
|
|
8390
|
+
let {
|
|
8391
|
+
from,
|
|
8392
|
+
length
|
|
8393
|
+
} = doc.line(firstLine + line);
|
|
8394
|
+
return new BlockInfo(from, length, top + lineHeight * line, lineHeight, BlockType.Text);
|
|
8582
8395
|
}
|
|
8583
|
-
lineAt(value, type,
|
|
8584
|
-
if (type == QueryType.ByHeight) return this.blockAt(value,
|
|
8396
|
+
lineAt(value, type, doc, top, offset) {
|
|
8397
|
+
if (type == QueryType.ByHeight) return this.blockAt(value, doc, top, offset);
|
|
8585
8398
|
if (type == QueryType.ByPosNoHeight) {
|
|
8586
8399
|
let {
|
|
8587
8400
|
from,
|
|
8588
8401
|
to
|
|
8589
|
-
} =
|
|
8402
|
+
} = doc.lineAt(value);
|
|
8590
8403
|
return new BlockInfo(from, to - from, 0, 0, BlockType.Text);
|
|
8591
8404
|
}
|
|
8592
8405
|
let {
|
|
8593
8406
|
firstLine,
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
return new BlockInfo(
|
|
8602
|
-
}
|
|
8603
|
-
forEachLine(from, to,
|
|
8604
|
-
from = Math.max(from, offset);
|
|
8605
|
-
to = Math.min(to, offset + this.length);
|
|
8407
|
+
lineHeight
|
|
8408
|
+
} = this.lines(doc, offset);
|
|
8409
|
+
let {
|
|
8410
|
+
from,
|
|
8411
|
+
length,
|
|
8412
|
+
number
|
|
8413
|
+
} = doc.lineAt(value);
|
|
8414
|
+
return new BlockInfo(from, length, top + lineHeight * (number - firstLine), lineHeight, BlockType.Text);
|
|
8415
|
+
}
|
|
8416
|
+
forEachLine(from, to, doc, top, offset, f) {
|
|
8606
8417
|
let {
|
|
8607
8418
|
firstLine,
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
lineTop += perLine * linesAbove + perChar * (from - offset - linesAbove);
|
|
8616
|
-
}
|
|
8617
|
-
let lineHeight = perLine + perChar * line.length;
|
|
8618
|
-
f(new BlockInfo(line.from, line.length, lineTop, lineHeight, BlockType.Text));
|
|
8619
|
-
lineTop += lineHeight;
|
|
8419
|
+
lineHeight
|
|
8420
|
+
} = this.lines(doc, offset);
|
|
8421
|
+
for (let pos = Math.max(from, offset), end = Math.min(offset + this.length, to); pos <= end;) {
|
|
8422
|
+
let line = doc.lineAt(pos);
|
|
8423
|
+
if (pos == from) top += lineHeight * (line.number - firstLine);
|
|
8424
|
+
f(new BlockInfo(line.from, line.length, top, lineHeight, BlockType.Text));
|
|
8425
|
+
top += lineHeight;
|
|
8620
8426
|
pos = line.to + 1;
|
|
8621
8427
|
}
|
|
8622
8428
|
}
|
|
@@ -8638,10 +8444,7 @@ class HeightMapGap extends HeightMap {
|
|
|
8638
8444
|
decomposeRight(from, result) {
|
|
8639
8445
|
result.push(null, new HeightMapGap(this.length - from - 1));
|
|
8640
8446
|
}
|
|
8641
|
-
updateHeight(oracle) {
|
|
8642
|
-
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
8643
|
-
let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8644
|
-
let measured = arguments.length > 3 ? arguments[3] : undefined;
|
|
8447
|
+
updateHeight(oracle, offset = 0, force = false, measured) {
|
|
8645
8448
|
let end = offset + this.length;
|
|
8646
8449
|
if (measured && measured.from <= offset + this.length && measured.more) {
|
|
8647
8450
|
// Fill in part of this gap with measured lines. We know there
|
|
@@ -8651,6 +8454,7 @@ class HeightMapGap extends HeightMap {
|
|
|
8651
8454
|
let nodes = [],
|
|
8652
8455
|
pos = Math.max(offset, measured.from),
|
|
8653
8456
|
singleHeight = -1;
|
|
8457
|
+
let wasChanged = oracle.heightChanged;
|
|
8654
8458
|
if (measured.from > offset) nodes.push(new HeightMapGap(measured.from - offset - 1).updateHeight(oracle, offset));
|
|
8655
8459
|
while (pos <= end && measured.more) {
|
|
8656
8460
|
let len = oracle.doc.lineAt(pos).length;
|
|
@@ -8664,7 +8468,7 @@ class HeightMapGap extends HeightMap {
|
|
|
8664
8468
|
}
|
|
8665
8469
|
if (pos <= end) nodes.push(null, new HeightMapGap(end - pos).updateHeight(oracle, pos));
|
|
8666
8470
|
let result = HeightMap.of(nodes);
|
|
8667
|
-
|
|
8471
|
+
oracle.heightChanged = wasChanged || singleHeight < 0 || Math.abs(result.height - this.height) >= Epsilon || Math.abs(singleHeight - this.lines(oracle.doc, offset).lineHeight) >= Epsilon;
|
|
8668
8472
|
return result;
|
|
8669
8473
|
} else if (force || this.outdated) {
|
|
8670
8474
|
this.setHeight(oracle, oracle.heightForGap(offset, offset + this.length));
|
|
@@ -8686,30 +8490,30 @@ class HeightMapBranch extends HeightMap {
|
|
|
8686
8490
|
get break() {
|
|
8687
8491
|
return this.flags & 1 /* Flag.Break */;
|
|
8688
8492
|
}
|
|
8689
|
-
blockAt(height,
|
|
8493
|
+
blockAt(height, doc, top, offset) {
|
|
8690
8494
|
let mid = top + this.left.height;
|
|
8691
|
-
return height < mid ? this.left.blockAt(height,
|
|
8495
|
+
return height < mid ? this.left.blockAt(height, doc, top, offset) : this.right.blockAt(height, doc, mid, offset + this.left.length + this.break);
|
|
8692
8496
|
}
|
|
8693
|
-
lineAt(value, type,
|
|
8497
|
+
lineAt(value, type, doc, top, offset) {
|
|
8694
8498
|
let rightTop = top + this.left.height,
|
|
8695
8499
|
rightOffset = offset + this.left.length + this.break;
|
|
8696
8500
|
let left = type == QueryType.ByHeight ? value < rightTop : value < rightOffset;
|
|
8697
|
-
let base = left ? this.left.lineAt(value, type,
|
|
8501
|
+
let base = left ? this.left.lineAt(value, type, doc, top, offset) : this.right.lineAt(value, type, doc, rightTop, rightOffset);
|
|
8698
8502
|
if (this.break || (left ? base.to < rightOffset : base.from > rightOffset)) return base;
|
|
8699
8503
|
let subQuery = type == QueryType.ByPosNoHeight ? QueryType.ByPosNoHeight : QueryType.ByPos;
|
|
8700
|
-
if (left) return base.join(this.right.lineAt(rightOffset, subQuery,
|
|
8504
|
+
if (left) return base.join(this.right.lineAt(rightOffset, subQuery, doc, rightTop, rightOffset));else return this.left.lineAt(rightOffset, subQuery, doc, top, offset).join(base);
|
|
8701
8505
|
}
|
|
8702
|
-
forEachLine(from, to,
|
|
8506
|
+
forEachLine(from, to, doc, top, offset, f) {
|
|
8703
8507
|
let rightTop = top + this.left.height,
|
|
8704
8508
|
rightOffset = offset + this.left.length + this.break;
|
|
8705
8509
|
if (this.break) {
|
|
8706
|
-
if (from < rightOffset) this.left.forEachLine(from, to,
|
|
8707
|
-
if (to >= rightOffset) this.right.forEachLine(from, to,
|
|
8510
|
+
if (from < rightOffset) this.left.forEachLine(from, to, doc, top, offset, f);
|
|
8511
|
+
if (to >= rightOffset) this.right.forEachLine(from, to, doc, rightTop, rightOffset, f);
|
|
8708
8512
|
} else {
|
|
8709
|
-
let mid = this.lineAt(rightOffset, QueryType.ByPos,
|
|
8710
|
-
if (from < mid.from) this.left.forEachLine(from, mid.from - 1,
|
|
8513
|
+
let mid = this.lineAt(rightOffset, QueryType.ByPos, doc, top, offset);
|
|
8514
|
+
if (from < mid.from) this.left.forEachLine(from, mid.from - 1, doc, top, offset, f);
|
|
8711
8515
|
if (mid.to >= from && mid.from <= to) f(mid);
|
|
8712
|
-
if (to > mid.to) this.right.forEachLine(mid.to + 1, to,
|
|
8516
|
+
if (to > mid.to) this.right.forEachLine(mid.to + 1, to, doc, rightTop, rightOffset, f);
|
|
8713
8517
|
}
|
|
8714
8518
|
}
|
|
8715
8519
|
replace(from, to, nodes) {
|
|
@@ -8756,10 +8560,7 @@ class HeightMapBranch extends HeightMap {
|
|
|
8756
8560
|
this.length = left.length + this.break + right.length;
|
|
8757
8561
|
return this;
|
|
8758
8562
|
}
|
|
8759
|
-
updateHeight(oracle) {
|
|
8760
|
-
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
8761
|
-
let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
8762
|
-
let measured = arguments.length > 3 ? arguments[3] : undefined;
|
|
8563
|
+
updateHeight(oracle, offset = 0, force = false, measured) {
|
|
8763
8564
|
let {
|
|
8764
8565
|
left,
|
|
8765
8566
|
right
|
|
@@ -9046,13 +8847,10 @@ class ViewState {
|
|
|
9046
8847
|
} = this.state.selection;
|
|
9047
8848
|
for (let i = 0; i <= 1; i++) {
|
|
9048
8849
|
let pos = i ? main.head : main.anchor;
|
|
9049
|
-
if (!viewports.some(
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
} = _ref2;
|
|
9054
|
-
return pos >= from && pos <= to;
|
|
9055
|
-
})) {
|
|
8850
|
+
if (!viewports.some(({
|
|
8851
|
+
from,
|
|
8852
|
+
to
|
|
8853
|
+
}) => pos >= from && pos <= to)) {
|
|
9056
8854
|
let {
|
|
9057
8855
|
from,
|
|
9058
8856
|
to
|
|
@@ -9061,16 +8859,15 @@ class ViewState {
|
|
|
9061
8859
|
}
|
|
9062
8860
|
}
|
|
9063
8861
|
this.viewports = viewports.sort((a, b) => a.from - b.from);
|
|
9064
|
-
this.scaler = this.heightMap.height <= 7000000 /* VP.MaxDOMHeight */ ? IdScaler : new BigScaler(this.heightOracle, this.heightMap, this.viewports);
|
|
8862
|
+
this.scaler = this.heightMap.height <= 7000000 /* VP.MaxDOMHeight */ ? IdScaler : new BigScaler(this.heightOracle.doc, this.heightMap, this.viewports);
|
|
9065
8863
|
}
|
|
9066
8864
|
updateViewportLines() {
|
|
9067
8865
|
this.viewportLines = [];
|
|
9068
|
-
this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.
|
|
8866
|
+
this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.state.doc, 0, 0, block => {
|
|
9069
8867
|
this.viewportLines.push(this.scaler.scale == 1 ? block : scaleBlock(block, this.scaler));
|
|
9070
8868
|
});
|
|
9071
8869
|
}
|
|
9072
|
-
update(update) {
|
|
9073
|
-
let scrollTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
8870
|
+
update(update, scrollTarget = null) {
|
|
9074
8871
|
this.state = update.state;
|
|
9075
8872
|
let prevDeco = this.stateDeco;
|
|
9076
8873
|
this.stateDeco = this.state.facet(decorations).filter(d => typeof d != "function");
|
|
@@ -9097,9 +8894,8 @@ class ViewState {
|
|
|
9097
8894
|
let whiteSpace = style.whiteSpace;
|
|
9098
8895
|
this.defaultTextDirection = style.direction == "rtl" ? Direction.RTL : Direction.LTR;
|
|
9099
8896
|
let refresh = this.heightOracle.mustRefreshForWrapping(whiteSpace);
|
|
9100
|
-
let
|
|
9101
|
-
|
|
9102
|
-
this.contentDOMHeight = domRect.height;
|
|
8897
|
+
let measureContent = refresh || this.mustMeasureContent || this.contentDOMHeight != dom.clientHeight;
|
|
8898
|
+
this.contentDOMHeight = dom.clientHeight;
|
|
9103
8899
|
this.mustMeasureContent = false;
|
|
9104
8900
|
let result = 0,
|
|
9105
8901
|
bias = 0;
|
|
@@ -9128,9 +8924,9 @@ class ViewState {
|
|
|
9128
8924
|
if (inView) measureContent = true;
|
|
9129
8925
|
}
|
|
9130
8926
|
if (!this.inView && !this.scrollTarget) return 0;
|
|
9131
|
-
let contentWidth =
|
|
8927
|
+
let contentWidth = dom.clientWidth;
|
|
9132
8928
|
if (this.contentDOMWidth != contentWidth || this.editorHeight != view.scrollDOM.clientHeight) {
|
|
9133
|
-
this.contentDOMWidth =
|
|
8929
|
+
this.contentDOMWidth = contentWidth;
|
|
9134
8930
|
this.editorHeight = view.scrollDOM.clientHeight;
|
|
9135
8931
|
result |= 8 /* UpdateFlag.Geometry */;
|
|
9136
8932
|
}
|
|
@@ -9141,10 +8937,9 @@ class ViewState {
|
|
|
9141
8937
|
if (refresh || oracle.lineWrapping && Math.abs(contentWidth - this.contentDOMWidth) > oracle.charWidth) {
|
|
9142
8938
|
let {
|
|
9143
8939
|
lineHeight,
|
|
9144
|
-
charWidth
|
|
9145
|
-
textHeight
|
|
8940
|
+
charWidth
|
|
9146
8941
|
} = view.docView.measureTextSize();
|
|
9147
|
-
refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth,
|
|
8942
|
+
refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, contentWidth / charWidth, lineHeights);
|
|
9148
8943
|
if (refresh) {
|
|
9149
8944
|
view.docView.minWidth = 0;
|
|
9150
8945
|
result |= 8 /* UpdateFlag.Geometry */;
|
|
@@ -9188,12 +8983,12 @@ class ViewState {
|
|
|
9188
8983
|
// since the last update). It'll hold a number between 0 and 1
|
|
9189
8984
|
let marginTop = 0.5 - Math.max(-0.5, Math.min(0.5, bias / 1000 /* VP.Margin */ / 2));
|
|
9190
8985
|
let map = this.heightMap,
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
let viewport = new Viewport(map.lineAt(visibleTop - marginTop * 1000 /* VP.Margin */, QueryType.ByHeight,
|
|
8986
|
+
doc = this.state.doc,
|
|
8987
|
+
{
|
|
8988
|
+
visibleTop,
|
|
8989
|
+
visibleBottom
|
|
8990
|
+
} = this;
|
|
8991
|
+
let viewport = new Viewport(map.lineAt(visibleTop - marginTop * 1000 /* VP.Margin */, QueryType.ByHeight, doc, 0, 0).from, map.lineAt(visibleBottom + (1 - marginTop) * 1000 /* VP.Margin */, QueryType.ByHeight, doc, 0, 0).to);
|
|
9197
8992
|
// If scrollTarget is given, make sure the viewport includes that position
|
|
9198
8993
|
if (scrollTarget) {
|
|
9199
8994
|
let {
|
|
@@ -9201,10 +8996,10 @@ class ViewState {
|
|
|
9201
8996
|
} = scrollTarget.range;
|
|
9202
8997
|
if (head < viewport.from || head > viewport.to) {
|
|
9203
8998
|
let viewHeight = Math.min(this.editorHeight, this.pixelViewport.bottom - this.pixelViewport.top);
|
|
9204
|
-
let block = map.lineAt(head, QueryType.ByPos,
|
|
8999
|
+
let block = map.lineAt(head, QueryType.ByPos, doc, 0, 0),
|
|
9205
9000
|
topPos;
|
|
9206
9001
|
if (scrollTarget.y == "center") topPos = (block.top + block.bottom) / 2 - viewHeight / 2;else if (scrollTarget.y == "start" || scrollTarget.y == "nearest" && head < viewport.from) topPos = block.top;else topPos = block.bottom - viewHeight;
|
|
9207
|
-
viewport = new Viewport(map.lineAt(topPos - 1000 /* VP.Margin */ / 2, QueryType.ByHeight,
|
|
9002
|
+
viewport = new Viewport(map.lineAt(topPos - 1000 /* VP.Margin */ / 2, QueryType.ByHeight, doc, 0, 0).from, map.lineAt(topPos + viewHeight + 1000 /* VP.Margin */ / 2, QueryType.ByHeight, doc, 0, 0).to);
|
|
9208
9003
|
}
|
|
9209
9004
|
}
|
|
9210
9005
|
return viewport;
|
|
@@ -9212,23 +9007,21 @@ class ViewState {
|
|
|
9212
9007
|
mapViewport(viewport, changes) {
|
|
9213
9008
|
let from = changes.mapPos(viewport.from, -1),
|
|
9214
9009
|
to = changes.mapPos(viewport.to, 1);
|
|
9215
|
-
return new Viewport(this.heightMap.lineAt(from, QueryType.ByPos, this.
|
|
9010
|
+
return new Viewport(this.heightMap.lineAt(from, QueryType.ByPos, this.state.doc, 0, 0).from, this.heightMap.lineAt(to, QueryType.ByPos, this.state.doc, 0, 0).to);
|
|
9216
9011
|
}
|
|
9217
9012
|
// Checks if a given viewport covers the visible part of the
|
|
9218
9013
|
// document and not too much beyond that.
|
|
9219
|
-
viewportIsAppropriate(
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
} = _ref3;
|
|
9224
|
-
let bias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
9014
|
+
viewportIsAppropriate({
|
|
9015
|
+
from,
|
|
9016
|
+
to
|
|
9017
|
+
}, bias = 0) {
|
|
9225
9018
|
if (!this.inView) return true;
|
|
9226
9019
|
let {
|
|
9227
9020
|
top
|
|
9228
|
-
} = this.heightMap.lineAt(from, QueryType.ByPos, this.
|
|
9021
|
+
} = this.heightMap.lineAt(from, QueryType.ByPos, this.state.doc, 0, 0);
|
|
9229
9022
|
let {
|
|
9230
9023
|
bottom
|
|
9231
|
-
} = this.heightMap.lineAt(to, QueryType.ByPos, this.
|
|
9024
|
+
} = this.heightMap.lineAt(to, QueryType.ByPos, this.state.doc, 0, 0);
|
|
9232
9025
|
let {
|
|
9233
9026
|
visibleTop,
|
|
9234
9027
|
visibleBottom
|
|
@@ -9353,13 +9146,13 @@ class ViewState {
|
|
|
9353
9146
|
return changed ? 4 /* UpdateFlag.Viewport */ : 0;
|
|
9354
9147
|
}
|
|
9355
9148
|
lineBlockAt(pos) {
|
|
9356
|
-
return pos >= this.viewport.from && pos <= this.viewport.to && this.viewportLines.find(b => b.from <= pos && b.to >= pos) || scaleBlock(this.heightMap.lineAt(pos, QueryType.ByPos, this.
|
|
9149
|
+
return pos >= this.viewport.from && pos <= this.viewport.to && this.viewportLines.find(b => b.from <= pos && b.to >= pos) || scaleBlock(this.heightMap.lineAt(pos, QueryType.ByPos, this.state.doc, 0, 0), this.scaler);
|
|
9357
9150
|
}
|
|
9358
9151
|
lineBlockAtHeight(height) {
|
|
9359
|
-
return scaleBlock(this.heightMap.lineAt(this.scaler.fromDOM(height), QueryType.ByHeight, this.
|
|
9152
|
+
return scaleBlock(this.heightMap.lineAt(this.scaler.fromDOM(height), QueryType.ByHeight, this.state.doc, 0, 0), this.scaler);
|
|
9360
9153
|
}
|
|
9361
9154
|
elementAtHeight(height) {
|
|
9362
|
-
return scaleBlock(this.heightMap.blockAt(this.scaler.fromDOM(height), this.
|
|
9155
|
+
return scaleBlock(this.heightMap.blockAt(this.scaler.fromDOM(height), this.state.doc, 0, 0), this.scaler);
|
|
9363
9156
|
}
|
|
9364
9157
|
get docHeight() {
|
|
9365
9158
|
return this.scaler.toDOM(this.heightMap.height);
|
|
@@ -9403,11 +9196,10 @@ function lineStructure(from, to, stateDeco) {
|
|
|
9403
9196
|
ranges
|
|
9404
9197
|
};
|
|
9405
9198
|
}
|
|
9406
|
-
function findPosition(
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
} = _ref4;
|
|
9199
|
+
function findPosition({
|
|
9200
|
+
total,
|
|
9201
|
+
ranges
|
|
9202
|
+
}, ratio) {
|
|
9411
9203
|
if (ratio <= 0) return ranges[0].from;
|
|
9412
9204
|
if (ratio >= 1) return ranges[ranges.length - 1].to;
|
|
9413
9205
|
let dist = Math.floor(total * ratio);
|
|
@@ -9454,17 +9246,16 @@ const IdScaler = {
|
|
|
9454
9246
|
// regions outside the viewports so that the total height is
|
|
9455
9247
|
// VP.MaxDOMHeight.
|
|
9456
9248
|
class BigScaler {
|
|
9457
|
-
constructor(
|
|
9249
|
+
constructor(doc, heightMap, viewports) {
|
|
9458
9250
|
let vpHeight = 0,
|
|
9459
9251
|
base = 0,
|
|
9460
9252
|
domBase = 0;
|
|
9461
|
-
this.viewports = viewports.map(
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
let
|
|
9467
|
-
let bottom = heightMap.lineAt(to, QueryType.ByPos, oracle, 0, 0).bottom;
|
|
9253
|
+
this.viewports = viewports.map(({
|
|
9254
|
+
from,
|
|
9255
|
+
to
|
|
9256
|
+
}) => {
|
|
9257
|
+
let top = heightMap.lineAt(from, QueryType.ByPos, doc, 0, 0).top;
|
|
9258
|
+
let bottom = heightMap.lineAt(to, QueryType.ByPos, doc, 0, 0).bottom;
|
|
9468
9259
|
vpHeight += bottom - top;
|
|
9469
9260
|
return {
|
|
9470
9261
|
from,
|
|
@@ -9591,9 +9382,6 @@ const baseTheme$1$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
|
|
9591
9382
|
padding: "0 2px 0 6px"
|
|
9592
9383
|
},
|
|
9593
9384
|
".cm-layer": {
|
|
9594
|
-
position: "absolute",
|
|
9595
|
-
left: 0,
|
|
9596
|
-
top: 0,
|
|
9597
9385
|
contain: "size style",
|
|
9598
9386
|
"& > *": {
|
|
9599
9387
|
position: "absolute"
|
|
@@ -9645,9 +9433,6 @@ const baseTheme$1$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
|
|
9645
9433
|
"&dark .cm-cursor": {
|
|
9646
9434
|
borderLeftColor: "#444"
|
|
9647
9435
|
},
|
|
9648
|
-
".cm-dropCursor": {
|
|
9649
|
-
position: "absolute"
|
|
9650
|
-
},
|
|
9651
9436
|
"&.cm-focused .cm-cursor": {
|
|
9652
9437
|
display: "block"
|
|
9653
9438
|
},
|
|
@@ -9866,7 +9651,7 @@ function applyDOMChange(view, domChange) {
|
|
|
9866
9651
|
to: sel.to,
|
|
9867
9652
|
insert: view.state.doc.slice(sel.from, change.from).append(change.insert).append(view.state.doc.slice(change.to, sel.to))
|
|
9868
9653
|
};
|
|
9869
|
-
} else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString())
|
|
9654
|
+
} else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 && /^\. ?$/.test(change.insert.toString())) {
|
|
9870
9655
|
// Detect insert-period-on-double-space Mac and Android behavior,
|
|
9871
9656
|
// and transform it into a regular space insert.
|
|
9872
9657
|
if (newSel && change.insert.length == 2) newSel = EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);
|
|
@@ -10340,8 +10125,7 @@ class DOMObserver {
|
|
|
10340
10125
|
return new DOMChange(this.view, from, to, typeOver);
|
|
10341
10126
|
}
|
|
10342
10127
|
// Apply pending changes, if any
|
|
10343
|
-
flush() {
|
|
10344
|
-
let readSelection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
10128
|
+
flush(readSelection = true) {
|
|
10345
10129
|
// Completely hold off flushing when pending keys are set—the code
|
|
10346
10130
|
// managing those will make sure processRecords is called and the
|
|
10347
10131
|
// view is resynchronized after
|
|
@@ -10480,8 +10264,7 @@ class EditorView {
|
|
|
10480
10264
|
option, or put `view.dom` into your document after creating a
|
|
10481
10265
|
view, so that the user can see the editor.
|
|
10482
10266
|
*/
|
|
10483
|
-
constructor() {
|
|
10484
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10267
|
+
constructor(config = {}) {
|
|
10485
10268
|
this.plugins = [];
|
|
10486
10269
|
this.pluginMap = new Map();
|
|
10487
10270
|
this.editorAttrs = {};
|
|
@@ -10590,8 +10373,8 @@ class EditorView {
|
|
|
10590
10373
|
get win() {
|
|
10591
10374
|
return this.dom.ownerDocument.defaultView || window;
|
|
10592
10375
|
}
|
|
10593
|
-
dispatch() {
|
|
10594
|
-
this._dispatch(
|
|
10376
|
+
dispatch(...input) {
|
|
10377
|
+
this._dispatch(input.length == 1 && input[0] instanceof Transaction ? input[0] : this.state.update(...input));
|
|
10595
10378
|
}
|
|
10596
10379
|
/**
|
|
10597
10380
|
Update the view for the given array of transactions. This will
|
|
@@ -10615,20 +10398,6 @@ class EditorView {
|
|
|
10615
10398
|
this.viewState.state = state;
|
|
10616
10399
|
return;
|
|
10617
10400
|
}
|
|
10618
|
-
let focus = this.hasFocus,
|
|
10619
|
-
focusFlag = 0,
|
|
10620
|
-
dispatchFocus = null;
|
|
10621
|
-
if (transactions.some(tr => tr.annotation(isFocusChange))) {
|
|
10622
|
-
this.inputState.notifiedFocused = focus;
|
|
10623
|
-
// If a focus-change transaction is being dispatched, set this update flag.
|
|
10624
|
-
focusFlag = 1 /* UpdateFlag.Focus */;
|
|
10625
|
-
} else if (focus != this.inputState.notifiedFocused) {
|
|
10626
|
-
this.inputState.notifiedFocused = focus;
|
|
10627
|
-
// Schedule a separate focus transaction if necessary, otherwise
|
|
10628
|
-
// add a flag to this update
|
|
10629
|
-
dispatchFocus = focusChangeTransaction(state, focus);
|
|
10630
|
-
if (!dispatchFocus) focusFlag = 1 /* UpdateFlag.Focus */;
|
|
10631
|
-
}
|
|
10632
10401
|
// If there was a pending DOM change, eagerly read it and try to
|
|
10633
10402
|
// apply it after the given transactions.
|
|
10634
10403
|
let pendingKey = this.observer.delayedAndroidKey,
|
|
@@ -10645,7 +10414,6 @@ class EditorView {
|
|
|
10645
10414
|
// When the phrases change, redraw the editor
|
|
10646
10415
|
if (state.facet(EditorState.phrases) != this.state.facet(EditorState.phrases)) return this.setState(state);
|
|
10647
10416
|
update = ViewUpdate.create(this, state, transactions);
|
|
10648
|
-
update.flags |= focusFlag;
|
|
10649
10417
|
let scrollTarget = this.viewState.scrollTarget;
|
|
10650
10418
|
try {
|
|
10651
10419
|
this.updateState = 2 /* UpdateState.Updating */;
|
|
@@ -10677,12 +10445,9 @@ class EditorView {
|
|
|
10677
10445
|
if (update.startState.facet(theme) != update.state.facet(theme)) this.viewState.mustMeasureContent = true;
|
|
10678
10446
|
if (redrawn || attrsChanged || scrollTarget || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent) this.requestMeasure();
|
|
10679
10447
|
if (!update.empty) for (let listener of this.state.facet(updateListener)) listener(update);
|
|
10680
|
-
if (
|
|
10681
|
-
if (
|
|
10682
|
-
|
|
10683
|
-
if (!applyDOMChange(this, domChange) && pendingKey.force) dispatchKey(this.contentDOM, pendingKey.key, pendingKey.keyCode);
|
|
10684
|
-
}
|
|
10685
|
-
});
|
|
10448
|
+
if (domChange) {
|
|
10449
|
+
if (!applyDOMChange(this, domChange) && pendingKey.force) dispatchKey(this.contentDOM, pendingKey.key, pendingKey.keyCode);
|
|
10450
|
+
}
|
|
10686
10451
|
}
|
|
10687
10452
|
/**
|
|
10688
10453
|
Reset the view to the given state. (This will cause the entire
|
|
@@ -10744,10 +10509,9 @@ class EditorView {
|
|
|
10744
10509
|
/**
|
|
10745
10510
|
@internal
|
|
10746
10511
|
*/
|
|
10747
|
-
measure() {
|
|
10748
|
-
let flush = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
10512
|
+
measure(flush = true) {
|
|
10749
10513
|
if (this.destroyed) return;
|
|
10750
|
-
if (this.measureScheduled > -1)
|
|
10514
|
+
if (this.measureScheduled > -1) cancelAnimationFrame(this.measureScheduled);
|
|
10751
10515
|
this.measureScheduled = 0; // Prevent requestMeasure calls from scheduling another animation frame
|
|
10752
10516
|
if (flush) this.observer.forceFlush();
|
|
10753
10517
|
let updated = null;
|
|
@@ -10998,8 +10762,7 @@ class EditorView {
|
|
|
10998
10762
|
returned. Otherwise this function will return the start or end
|
|
10999
10763
|
of the line.
|
|
11000
10764
|
*/
|
|
11001
|
-
moveToLineBoundary(start, forward) {
|
|
11002
|
-
let includeWrap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
10765
|
+
moveToLineBoundary(start, forward, includeWrap = true) {
|
|
11003
10766
|
return moveToLineBoundary(this, start, forward, includeWrap);
|
|
11004
10767
|
}
|
|
11005
10768
|
/**
|
|
@@ -11036,12 +10799,10 @@ class EditorView {
|
|
|
11036
10799
|
for associating positions with DOM events. Will raise an error
|
|
11037
10800
|
when `node` isn't part of the editor content.
|
|
11038
10801
|
*/
|
|
11039
|
-
posAtDOM(node) {
|
|
11040
|
-
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
10802
|
+
posAtDOM(node, offset = 0) {
|
|
11041
10803
|
return this.docView.posFromDOM(node, offset);
|
|
11042
10804
|
}
|
|
11043
|
-
posAtCoords(coords) {
|
|
11044
|
-
let precise = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
10805
|
+
posAtCoords(coords, precise = true) {
|
|
11045
10806
|
this.readMeasured();
|
|
11046
10807
|
return posAtCoords(this, coords, precise);
|
|
11047
10808
|
}
|
|
@@ -11052,8 +10813,7 @@ class EditorView {
|
|
|
11052
10813
|
available on the given side, the method will transparently use
|
|
11053
10814
|
another strategy to get reasonable coordinates).
|
|
11054
10815
|
*/
|
|
11055
|
-
coordsAtPos(pos) {
|
|
11056
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
10816
|
+
coordsAtPos(pos, side = 1) {
|
|
11057
10817
|
this.readMeasured();
|
|
11058
10818
|
let rect = this.docView.coordsAt(pos, side);
|
|
11059
10819
|
if (!rect || rect.left == rect.right) return rect;
|
|
@@ -11168,7 +10928,7 @@ class EditorView {
|
|
|
11168
10928
|
this.inputState.destroy();
|
|
11169
10929
|
this.dom.remove();
|
|
11170
10930
|
this.observer.destroy();
|
|
11171
|
-
if (this.measureScheduled > -1)
|
|
10931
|
+
if (this.measureScheduled > -1) cancelAnimationFrame(this.measureScheduled);
|
|
11172
10932
|
this.destroyed = true;
|
|
11173
10933
|
}
|
|
11174
10934
|
/**
|
|
@@ -11176,8 +10936,7 @@ class EditorView {
|
|
|
11176
10936
|
[added](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) to a transaction to
|
|
11177
10937
|
cause it to scroll the given position or range into view.
|
|
11178
10938
|
*/
|
|
11179
|
-
static scrollIntoView(pos) {
|
|
11180
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10939
|
+
static scrollIntoView(pos, options = {}) {
|
|
11181
10940
|
return scrollIntoView.of(new ScrollTarget(typeof pos == "number" ? EditorSelection.cursor(pos) : pos, options.y, options.x, options.yMargin, options.xMargin));
|
|
11182
10941
|
}
|
|
11183
10942
|
/**
|
|
@@ -11259,11 +11018,6 @@ called and the default behavior is prevented.
|
|
|
11259
11018
|
*/
|
|
11260
11019
|
EditorView.inputHandler = inputHandler;
|
|
11261
11020
|
/**
|
|
11262
|
-
This facet can be used to provide functions that create effects
|
|
11263
|
-
to be dispatched when the editor's focus state changes.
|
|
11264
|
-
*/
|
|
11265
|
-
EditorView.focusChangeEffect = focusChangeEffect;
|
|
11266
|
-
/**
|
|
11267
11021
|
By default, the editor assumes all its content has the same
|
|
11268
11022
|
[text direction](https://codemirror.net/6/docs/ref/#view.Direction). Configure this with a `true`
|
|
11269
11023
|
value to make it read the text direction of every (rendered)
|
|
@@ -11472,8 +11226,7 @@ function runScopeHandlers(view, event, scope) {
|
|
|
11472
11226
|
}
|
|
11473
11227
|
let storedPrefix = null;
|
|
11474
11228
|
const PrefixTimeout = 4000;
|
|
11475
|
-
function buildKeymap(bindings) {
|
|
11476
|
-
let platform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : currentPlatform;
|
|
11229
|
+
function buildKeymap(bindings, platform = currentPlatform) {
|
|
11477
11230
|
let bound = Object.create(null);
|
|
11478
11231
|
let isPrefix = Object.create(null);
|
|
11479
11232
|
let checkPrefix = (name, is) => {
|
|
@@ -11653,10 +11406,9 @@ function rectanglesForRange(view, className, range) {
|
|
|
11653
11406
|
let content = view.contentDOM,
|
|
11654
11407
|
contentRect = content.getBoundingClientRect(),
|
|
11655
11408
|
base = getBase(view);
|
|
11656
|
-
let
|
|
11657
|
-
|
|
11658
|
-
let
|
|
11659
|
-
let rightSide = contentRect.right - (lineStyle ? parseInt(lineStyle.paddingRight) : 0);
|
|
11409
|
+
let lineStyle = window.getComputedStyle(content.firstChild);
|
|
11410
|
+
let leftSide = contentRect.left + parseInt(lineStyle.paddingLeft) + Math.min(0, parseInt(lineStyle.textIndent));
|
|
11411
|
+
let rightSide = contentRect.right - parseInt(lineStyle.paddingRight);
|
|
11660
11412
|
let startBlock = blockAt(view, from),
|
|
11661
11413
|
endBlock = blockAt(view, to);
|
|
11662
11414
|
let visualStart = startBlock.type == BlockType.Text ? startBlock : null;
|
|
@@ -11678,12 +11430,11 @@ function rectanglesForRange(view, className, range) {
|
|
|
11678
11430
|
return new RectangleMarker(className, left - base.left, top - base.top - 0.01 /* C.Epsilon */, right - left, bottom - top + 0.01 /* C.Epsilon */);
|
|
11679
11431
|
}
|
|
11680
11432
|
|
|
11681
|
-
function pieces(
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
} = _ref6;
|
|
11433
|
+
function pieces({
|
|
11434
|
+
top,
|
|
11435
|
+
bottom,
|
|
11436
|
+
horizontal
|
|
11437
|
+
}) {
|
|
11687
11438
|
let pieces = [];
|
|
11688
11439
|
for (let i = 0; i < horizontal.length; i += 2) pieces.push(piece(horizontal[i], top, horizontal[i + 1], bottom));
|
|
11689
11440
|
return pieces;
|
|
@@ -11832,8 +11583,7 @@ layout cycle for many updates (the selection is drawn based on DOM
|
|
|
11832
11583
|
layout information that's only available after laying out the
|
|
11833
11584
|
content).
|
|
11834
11585
|
*/
|
|
11835
|
-
function drawSelection() {
|
|
11836
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11586
|
+
function drawSelection(config = {}) {
|
|
11837
11587
|
return [selectionConfig.of(config), cursorLayer, selectionLayer, hideNativeSelection, nativeSelectionHidden.of(true)];
|
|
11838
11588
|
}
|
|
11839
11589
|
function configChanged(update) {
|
|
@@ -12167,8 +11917,11 @@ const specialCharConfig = /*@__PURE__*/Facet.define({
|
|
|
12167
11917
|
Returns an extension that installs highlighting of special
|
|
12168
11918
|
characters.
|
|
12169
11919
|
*/
|
|
12170
|
-
function highlightSpecialChars(
|
|
12171
|
-
|
|
11920
|
+
function highlightSpecialChars(
|
|
11921
|
+
/**
|
|
11922
|
+
Configuration options.
|
|
11923
|
+
*/
|
|
11924
|
+
config = {}) {
|
|
12172
11925
|
return [specialCharConfig.of(config), specialCharPlugin()];
|
|
12173
11926
|
}
|
|
12174
11927
|
let _plugin = null;
|
|
@@ -12404,8 +12157,7 @@ down. Can serve as a visual hint that rectangular selection is
|
|
|
12404
12157
|
going to happen when paired with
|
|
12405
12158
|
[`rectangularSelection`](https://codemirror.net/6/docs/ref/#view.rectangularSelection).
|
|
12406
12159
|
*/
|
|
12407
|
-
function crosshairCursor() {
|
|
12408
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12160
|
+
function crosshairCursor(options = {}) {
|
|
12409
12161
|
let [code, getter] = keys[options.key || "Alt"];
|
|
12410
12162
|
let plugin = ViewPlugin.fromClass(class {
|
|
12411
12163
|
constructor(view) {
|
|
@@ -12500,7 +12252,6 @@ const tooltipConfig = /*@__PURE__*/Facet.define({
|
|
|
12500
12252
|
};
|
|
12501
12253
|
}
|
|
12502
12254
|
});
|
|
12503
|
-
const knownHeight = /*@__PURE__*/new WeakMap();
|
|
12504
12255
|
const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
12505
12256
|
constructor(view) {
|
|
12506
12257
|
this.view = view;
|
|
@@ -12604,17 +12355,13 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
12604
12355
|
let tv = this.manager.tooltipViews[i];
|
|
12605
12356
|
return tv.getCoords ? tv.getCoords(t.pos) : this.view.coordsAtPos(t.pos);
|
|
12606
12357
|
}),
|
|
12607
|
-
size: this.manager.tooltipViews.map(
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
} = _ref7;
|
|
12611
|
-
return dom.getBoundingClientRect();
|
|
12612
|
-
}),
|
|
12358
|
+
size: this.manager.tooltipViews.map(({
|
|
12359
|
+
dom
|
|
12360
|
+
}) => dom.getBoundingClientRect()),
|
|
12613
12361
|
space: this.view.state.facet(tooltipConfig).tooltipSpace(this.view)
|
|
12614
12362
|
};
|
|
12615
12363
|
}
|
|
12616
12364
|
writeMeasure(measured) {
|
|
12617
|
-
var _a;
|
|
12618
12365
|
let {
|
|
12619
12366
|
editor,
|
|
12620
12367
|
space
|
|
@@ -12636,7 +12383,7 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
12636
12383
|
let arrow = tooltip.arrow ? tView.dom.querySelector(".cm-tooltip-arrow") : null;
|
|
12637
12384
|
let arrowHeight = arrow ? 7 /* Arrow.Size */ : 0;
|
|
12638
12385
|
let width = size.right - size.left,
|
|
12639
|
-
height =
|
|
12386
|
+
height = size.bottom - size.top;
|
|
12640
12387
|
let offset = tView.offset || noOffset,
|
|
12641
12388
|
ltr = this.view.textDirection == Direction.LTR;
|
|
12642
12389
|
let left = size.width > space.right - space.left ? ltr ? space.left : space.right - size.width : ltr ? Math.min(pos.left - (arrow ? 14 /* Arrow.Offset */ : 0) + offset.x, space.right - width) : Math.max(space.left, pos.left - width + (arrow ? 14 /* Arrow.Offset */ : 0) - offset.x);
|
|
@@ -12648,7 +12395,6 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
|
|
|
12648
12395
|
dom.style.top = Outside;
|
|
12649
12396
|
continue;
|
|
12650
12397
|
}
|
|
12651
|
-
knownHeight.set(tView, height);
|
|
12652
12398
|
dom.style.height = (height = spaceVert) + "px";
|
|
12653
12399
|
} else if (dom.style.height) {
|
|
12654
12400
|
dom.style.height = "";
|
|
@@ -12943,8 +12689,7 @@ Note that all hover tooltips are hosted within a single tooltip
|
|
|
12943
12689
|
container element. This allows multiple tooltips over the same
|
|
12944
12690
|
range to be "merged" together without overlapping.
|
|
12945
12691
|
*/
|
|
12946
|
-
function hoverTooltip(source) {
|
|
12947
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12692
|
+
function hoverTooltip(source, options = {}) {
|
|
12948
12693
|
let setHover = StateEffect.define();
|
|
12949
12694
|
let hoverState = StateField.define({
|
|
12950
12695
|
create() {
|
|
@@ -13524,8 +13269,7 @@ const lineNumberGutter = /*@__PURE__*/activeGutters.compute([lineNumberConfig],
|
|
|
13524
13269
|
/**
|
|
13525
13270
|
Create a line number gutter extension.
|
|
13526
13271
|
*/
|
|
13527
|
-
function lineNumbers() {
|
|
13528
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13272
|
+
function lineNumbers(config = {}) {
|
|
13529
13273
|
return [lineNumberConfig.of(config), gutters(), lineNumberGutter];
|
|
13530
13274
|
}
|
|
13531
13275
|
function maxLineNumber(lines) {
|
|
@@ -13576,8 +13320,7 @@ class Range {
|
|
|
13576
13320
|
/// class represent prop names.
|
|
13577
13321
|
class NodeProp {
|
|
13578
13322
|
/// Create a new node prop type.
|
|
13579
|
-
constructor() {
|
|
13580
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13323
|
+
constructor(config = {}) {
|
|
13581
13324
|
this.id = nextPropID++;
|
|
13582
13325
|
this.perNode = !!config.perNode;
|
|
13583
13326
|
this.deserialize = config.deserialize || (() => {
|
|
@@ -13674,8 +13417,9 @@ class NodeType {
|
|
|
13674
13417
|
props,
|
|
13675
13418
|
/// The id of this node in its set. Corresponds to the term ids
|
|
13676
13419
|
/// used in the parser.
|
|
13677
|
-
id
|
|
13678
|
-
|
|
13420
|
+
id,
|
|
13421
|
+
/// @internal
|
|
13422
|
+
flags = 0) {
|
|
13679
13423
|
this.name = name;
|
|
13680
13424
|
this.props = props;
|
|
13681
13425
|
this.id = id;
|
|
@@ -13765,11 +13509,8 @@ class NodeSet {
|
|
|
13765
13509
|
/// Create a copy of this set with some node properties added. The
|
|
13766
13510
|
/// arguments to this method can be created with
|
|
13767
13511
|
/// [`NodeProp.add`](#common.NodeProp.add).
|
|
13768
|
-
extend() {
|
|
13512
|
+
extend(...props) {
|
|
13769
13513
|
let newTypes = [];
|
|
13770
|
-
for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13771
|
-
props[_key] = arguments[_key];
|
|
13772
|
-
}
|
|
13773
13514
|
for (let type of this.types) {
|
|
13774
13515
|
let newProps = null;
|
|
13775
13516
|
for (let source of props) {
|
|
@@ -13864,15 +13605,13 @@ class Tree {
|
|
|
13864
13605
|
/// Get a [tree cursor](#common.TreeCursor) positioned at the top of
|
|
13865
13606
|
/// the tree. Mode can be used to [control](#common.IterMode) which
|
|
13866
13607
|
/// nodes the cursor visits.
|
|
13867
|
-
cursor() {
|
|
13868
|
-
let mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
13608
|
+
cursor(mode = 0) {
|
|
13869
13609
|
return new TreeCursor(this.topNode, mode);
|
|
13870
13610
|
}
|
|
13871
13611
|
/// Get a [tree cursor](#common.TreeCursor) pointing into this tree
|
|
13872
13612
|
/// at the given position and side (see
|
|
13873
13613
|
/// [`moveTo`](#common.TreeCursor.moveTo).
|
|
13874
|
-
cursorAt(pos) {
|
|
13875
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
13614
|
+
cursorAt(pos, side = 0, mode = 0) {
|
|
13876
13615
|
let scope = CachedNode.get(this) || this.topNode;
|
|
13877
13616
|
let cursor = new TreeCursor(scope);
|
|
13878
13617
|
cursor.moveTo(pos, side);
|
|
@@ -13893,8 +13632,7 @@ class Tree {
|
|
|
13893
13632
|
/// Note that this will not enter
|
|
13894
13633
|
/// [overlays](#common.MountedTree.overlay), and you often want
|
|
13895
13634
|
/// [`resolveInner`](#common.Tree.resolveInner) instead.
|
|
13896
|
-
resolve(pos) {
|
|
13897
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
13635
|
+
resolve(pos, side = 0) {
|
|
13898
13636
|
let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false);
|
|
13899
13637
|
CachedNode.set(this, node);
|
|
13900
13638
|
return node;
|
|
@@ -13904,8 +13642,7 @@ class Tree {
|
|
|
13904
13642
|
/// pointing into the innermost overlaid tree at the given position
|
|
13905
13643
|
/// (with parent links going through all parent structure, including
|
|
13906
13644
|
/// the host trees).
|
|
13907
|
-
resolveInner(pos) {
|
|
13908
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
13645
|
+
resolveInner(pos, side = 0) {
|
|
13909
13646
|
let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true);
|
|
13910
13647
|
CachedInnerNode.set(this, node);
|
|
13911
13648
|
return node;
|
|
@@ -13952,8 +13689,7 @@ class Tree {
|
|
|
13952
13689
|
/// Balance the direct children of this tree, producing a copy of
|
|
13953
13690
|
/// which may have children grouped into subtrees with type
|
|
13954
13691
|
/// [`NodeType.none`](#common.NodeType^none).
|
|
13955
|
-
balance() {
|
|
13956
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13692
|
+
balance(config = {}) {
|
|
13957
13693
|
return this.children.length <= 8 /* Balance.BranchFactor */ ? this : balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));
|
|
13958
13694
|
}
|
|
13959
13695
|
/// Build a tree from a postfix-ordered buffer of node information,
|
|
@@ -14133,8 +13869,7 @@ class TreeNode {
|
|
|
14133
13869
|
get to() {
|
|
14134
13870
|
return this.from + this._tree.length;
|
|
14135
13871
|
}
|
|
14136
|
-
nextChild(i, dir, pos, side) {
|
|
14137
|
-
let mode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
13872
|
+
nextChild(i, dir, pos, side, mode = 0) {
|
|
14138
13873
|
for (let parent = this;;) {
|
|
14139
13874
|
for (let {
|
|
14140
13875
|
children,
|
|
@@ -14172,8 +13907,7 @@ class TreeNode {
|
|
|
14172
13907
|
childBefore(pos) {
|
|
14173
13908
|
return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */);
|
|
14174
13909
|
}
|
|
14175
|
-
enter(pos, side) {
|
|
14176
|
-
let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
13910
|
+
enter(pos, side, mode = 0) {
|
|
14177
13911
|
let mounted;
|
|
14178
13912
|
if (!(mode & IterMode.IgnoreOverlays) && (mounted = this._tree.prop(NodeProp.mounted)) && mounted.overlay) {
|
|
14179
13913
|
let rPos = pos - this.from;
|
|
@@ -14200,8 +13934,7 @@ class TreeNode {
|
|
|
14200
13934
|
get prevSibling() {
|
|
14201
13935
|
return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* Side.DontCare */) : null;
|
|
14202
13936
|
}
|
|
14203
|
-
cursor() {
|
|
14204
|
-
let mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
13937
|
+
cursor(mode = 0) {
|
|
14205
13938
|
return new TreeCursor(this, mode);
|
|
14206
13939
|
}
|
|
14207
13940
|
get tree() {
|
|
@@ -14210,26 +13943,20 @@ class TreeNode {
|
|
|
14210
13943
|
toTree() {
|
|
14211
13944
|
return this._tree;
|
|
14212
13945
|
}
|
|
14213
|
-
resolve(pos) {
|
|
14214
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
13946
|
+
resolve(pos, side = 0) {
|
|
14215
13947
|
return resolveNode(this, pos, side, false);
|
|
14216
13948
|
}
|
|
14217
|
-
resolveInner(pos) {
|
|
14218
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
13949
|
+
resolveInner(pos, side = 0) {
|
|
14219
13950
|
return resolveNode(this, pos, side, true);
|
|
14220
13951
|
}
|
|
14221
13952
|
enterUnfinishedNodesBefore(pos) {
|
|
14222
13953
|
return enterUnfinishedNodesBefore(this, pos);
|
|
14223
13954
|
}
|
|
14224
|
-
getChild(type) {
|
|
14225
|
-
let before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
14226
|
-
let after = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
13955
|
+
getChild(type, before = null, after = null) {
|
|
14227
13956
|
let r = getChildren(this, type, before, after);
|
|
14228
13957
|
return r.length ? r[0] : null;
|
|
14229
13958
|
}
|
|
14230
|
-
getChildren(type) {
|
|
14231
|
-
let before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
14232
|
-
let after = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
13959
|
+
getChildren(type, before = null, after = null) {
|
|
14233
13960
|
return getChildren(this, type, before, after);
|
|
14234
13961
|
}
|
|
14235
13962
|
/// @internal
|
|
@@ -14254,8 +13981,7 @@ function getChildren(node, type, before, after) {
|
|
|
14254
13981
|
if (!cur.nextSibling()) return after == null ? result : [];
|
|
14255
13982
|
}
|
|
14256
13983
|
}
|
|
14257
|
-
function matchNodeContext(node, context) {
|
|
14258
|
-
let i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : context.length - 1;
|
|
13984
|
+
function matchNodeContext(node, context, i = context.length - 1) {
|
|
14259
13985
|
for (let p = node.parent; i >= 0; p = p.parent) {
|
|
14260
13986
|
if (!p) return false;
|
|
14261
13987
|
if (!p.type.isAnonymous) {
|
|
@@ -14308,8 +14034,7 @@ class BufferNode {
|
|
|
14308
14034
|
childBefore(pos) {
|
|
14309
14035
|
return this.child(-1, pos, -2 /* Side.Before */);
|
|
14310
14036
|
}
|
|
14311
|
-
enter(pos, side) {
|
|
14312
|
-
let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
14037
|
+
enter(pos, side, mode = 0) {
|
|
14313
14038
|
if (mode & IterMode.ExcludeBuffers) return null;
|
|
14314
14039
|
let {
|
|
14315
14040
|
buffer
|
|
@@ -14341,8 +14066,7 @@ class BufferNode {
|
|
|
14341
14066
|
return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));
|
|
14342
14067
|
}
|
|
14343
14068
|
|
|
14344
|
-
cursor() {
|
|
14345
|
-
let mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
14069
|
+
cursor(mode = 0) {
|
|
14346
14070
|
return new TreeCursor(this, mode);
|
|
14347
14071
|
}
|
|
14348
14072
|
get tree() {
|
|
@@ -14363,12 +14087,10 @@ class BufferNode {
|
|
|
14363
14087
|
}
|
|
14364
14088
|
return new Tree(this.type, children, positions, this.to - this.from);
|
|
14365
14089
|
}
|
|
14366
|
-
resolve(pos) {
|
|
14367
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
14090
|
+
resolve(pos, side = 0) {
|
|
14368
14091
|
return resolveNode(this, pos, side, false);
|
|
14369
14092
|
}
|
|
14370
|
-
resolveInner(pos) {
|
|
14371
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
14093
|
+
resolveInner(pos, side = 0) {
|
|
14372
14094
|
return resolveNode(this, pos, side, true);
|
|
14373
14095
|
}
|
|
14374
14096
|
enterUnfinishedNodesBefore(pos) {
|
|
@@ -14378,15 +14100,11 @@ class BufferNode {
|
|
|
14378
14100
|
toString() {
|
|
14379
14101
|
return this.context.buffer.childString(this.index);
|
|
14380
14102
|
}
|
|
14381
|
-
getChild(type) {
|
|
14382
|
-
let before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
14383
|
-
let after = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
14103
|
+
getChild(type, before = null, after = null) {
|
|
14384
14104
|
let r = getChildren(this, type, before, after);
|
|
14385
14105
|
return r.length ? r[0] : null;
|
|
14386
14106
|
}
|
|
14387
|
-
getChildren(type) {
|
|
14388
|
-
let before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
14389
|
-
let after = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
14107
|
+
getChildren(type, before = null, after = null) {
|
|
14390
14108
|
return getChildren(this, type, before, after);
|
|
14391
14109
|
}
|
|
14392
14110
|
get node() {
|
|
@@ -14404,8 +14122,9 @@ class TreeCursor {
|
|
|
14404
14122
|
return this.type.name;
|
|
14405
14123
|
}
|
|
14406
14124
|
/// @internal
|
|
14407
|
-
constructor(node
|
|
14408
|
-
|
|
14125
|
+
constructor(node,
|
|
14126
|
+
/// @internal
|
|
14127
|
+
mode = 0) {
|
|
14409
14128
|
this.mode = mode;
|
|
14410
14129
|
/// @internal
|
|
14411
14130
|
this.buffer = null;
|
|
@@ -14488,8 +14207,7 @@ class TreeCursor {
|
|
|
14488
14207
|
/// will also enter [overlaid](#common.MountedTree.overlay)
|
|
14489
14208
|
/// [mounted](#common.NodeProp^mounted) trees unless `overlays` is
|
|
14490
14209
|
/// set to false.
|
|
14491
|
-
enter(pos, side) {
|
|
14492
|
-
let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.mode;
|
|
14210
|
+
enter(pos, side, mode = this.mode) {
|
|
14493
14211
|
if (!this.buffer) return this.yield(this._tree.enter(pos, side, mode));
|
|
14494
14212
|
return mode & IterMode.ExcludeBuffers ? false : this.enterChild(1, pos, side);
|
|
14495
14213
|
}
|
|
@@ -14570,23 +14288,20 @@ class TreeCursor {
|
|
|
14570
14288
|
/// traversal, going from a node to its first child or, if the
|
|
14571
14289
|
/// current node is empty or `enter` is false, its next sibling or
|
|
14572
14290
|
/// the next sibling of the first parent node that has one.
|
|
14573
|
-
next() {
|
|
14574
|
-
let enter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
14291
|
+
next(enter = true) {
|
|
14575
14292
|
return this.move(1, enter);
|
|
14576
14293
|
}
|
|
14577
14294
|
/// Move to the next node in a last-to-first pre-order traveral. A
|
|
14578
14295
|
/// node is followed by its last child or, if it has none, its
|
|
14579
14296
|
/// previous sibling or the previous sibling of the first parent
|
|
14580
14297
|
/// node that has one.
|
|
14581
|
-
prev() {
|
|
14582
|
-
let enter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
14298
|
+
prev(enter = true) {
|
|
14583
14299
|
return this.move(-1, enter);
|
|
14584
14300
|
}
|
|
14585
14301
|
/// Move the cursor to the innermost node that covers `pos`. If
|
|
14586
14302
|
/// `side` is -1, it will enter nodes that end at `pos`. If it is 1,
|
|
14587
14303
|
/// it will enter nodes that start at `pos`.
|
|
14588
|
-
moveTo(pos) {
|
|
14589
|
-
let side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
14304
|
+
moveTo(pos, side = 0) {
|
|
14590
14305
|
// Move up to a node that actually holds the position, if possible
|
|
14591
14306
|
while (this.from == this.to || (side < 1 ? this.from >= pos : this.from > pos) || (side > -1 ? this.to <= pos : this.to < pos)) if (!this.parent()) break;
|
|
14592
14307
|
// Then scan down into child nodes as far as possible
|
|
@@ -14778,9 +14493,7 @@ function buildTree(data) {
|
|
|
14778
14493
|
children.push(makeTree(nodeSet.types[type], localChildren, localPositions, to - from, lookAhead - to));
|
|
14779
14494
|
positions.push(from - base);
|
|
14780
14495
|
}
|
|
14781
|
-
function makeTree(type, children, positions, length) {
|
|
14782
|
-
let lookAhead = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
14783
|
-
let props = arguments.length > 5 ? arguments[5] : undefined;
|
|
14496
|
+
function makeTree(type, children, positions, length, lookAhead = 0, props) {
|
|
14784
14497
|
if (contextHash) {
|
|
14785
14498
|
let pair = [NodeProp.contextHash, contextHash];
|
|
14786
14499
|
props = props ? [pair].concat(props) : [pair];
|
|
@@ -15002,9 +14715,7 @@ class TreeFragment {
|
|
|
15002
14715
|
/// this fragment can be used against. Add this when going from
|
|
15003
14716
|
/// document to tree positions, subtract it to go from tree to
|
|
15004
14717
|
/// document positions.
|
|
15005
|
-
offset) {
|
|
15006
|
-
let openStart = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
15007
|
-
let openEnd = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
14718
|
+
offset, openStart = false, openEnd = false) {
|
|
15008
14719
|
this.from = from;
|
|
15009
14720
|
this.to = to;
|
|
15010
14721
|
this.tree = tree;
|
|
@@ -15029,9 +14740,7 @@ class TreeFragment {
|
|
|
15029
14740
|
/// true, the parse is treated as incomplete, and the resulting
|
|
15030
14741
|
/// fragment has [`openEnd`](#common.TreeFragment.openEnd) set to
|
|
15031
14742
|
/// true.
|
|
15032
|
-
static addTree(tree) {
|
|
15033
|
-
let fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
15034
|
-
let partial = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
14743
|
+
static addTree(tree, fragments = [], partial = false) {
|
|
15035
14744
|
let result = [new TreeFragment(0, tree.length, tree, 0, false, partial)];
|
|
15036
14745
|
for (let f of fragments) if (f.to > tree.length) result.push(f);
|
|
15037
14746
|
return result;
|
|
@@ -15039,8 +14748,7 @@ class TreeFragment {
|
|
|
15039
14748
|
/// Apply a set of edits to an array of fragments, removing or
|
|
15040
14749
|
/// splitting fragments as necessary to remove edited ranges, and
|
|
15041
14750
|
/// adjusting offsets for fragments that moved.
|
|
15042
|
-
static applyChanges(fragments, changes) {
|
|
15043
|
-
let minGap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 128;
|
|
14751
|
+
static applyChanges(fragments, changes, minGap = 128) {
|
|
15044
14752
|
if (!changes.length) return fragments;
|
|
15045
14753
|
let result = [];
|
|
15046
14754
|
let fI = 1,
|
|
@@ -15480,59 +15188,45 @@ function enterFragments(mounts, ranges) {
|
|
|
15480
15188
|
}
|
|
15481
15189
|
|
|
15482
15190
|
let nextTagID = 0;
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
from standard tags to allow highlighters to fall back to those).
|
|
15501
|
-
*/
|
|
15191
|
+
/// Highlighting tags are markers that denote a highlighting category.
|
|
15192
|
+
/// They are [associated](#highlight.styleTags) with parts of a syntax
|
|
15193
|
+
/// tree by a language mode, and then mapped to an actual CSS style by
|
|
15194
|
+
/// a [highlighter](#highlight.Highlighter).
|
|
15195
|
+
///
|
|
15196
|
+
/// Because syntax tree node types and highlight styles have to be
|
|
15197
|
+
/// able to talk the same language, CodeMirror uses a mostly _closed_
|
|
15198
|
+
/// [vocabulary](#highlight.tags) of syntax tags (as opposed to
|
|
15199
|
+
/// traditional open string-based systems, which make it hard for
|
|
15200
|
+
/// highlighting themes to cover all the tokens produced by the
|
|
15201
|
+
/// various languages).
|
|
15202
|
+
///
|
|
15203
|
+
/// It _is_ possible to [define](#highlight.Tag^define) your own
|
|
15204
|
+
/// highlighting tags for system-internal use (where you control both
|
|
15205
|
+
/// the language package and the highlighter), but such tags will not
|
|
15206
|
+
/// be picked up by regular highlighters (though you can derive them
|
|
15207
|
+
/// from standard tags to allow highlighters to fall back to those).
|
|
15502
15208
|
class Tag {
|
|
15503
|
-
|
|
15504
|
-
@internal
|
|
15505
|
-
*/
|
|
15209
|
+
/// @internal
|
|
15506
15210
|
constructor(
|
|
15507
|
-
|
|
15508
|
-
|
|
15509
|
-
this one itself and sorted in order of decreasing specificity.
|
|
15510
|
-
*/
|
|
15211
|
+
/// The set of this tag and all its parent tags, starting with
|
|
15212
|
+
/// this one itself and sorted in order of decreasing specificity.
|
|
15511
15213
|
set,
|
|
15512
|
-
|
|
15513
|
-
|
|
15514
|
-
modified @internal
|
|
15515
|
-
*/
|
|
15214
|
+
/// The base unmodified tag that this one is based on, if it's
|
|
15215
|
+
/// modified @internal
|
|
15516
15216
|
base,
|
|
15517
|
-
|
|
15518
|
-
The modifiers applied to this.base @internal
|
|
15519
|
-
*/
|
|
15217
|
+
/// The modifiers applied to this.base @internal
|
|
15520
15218
|
modified) {
|
|
15521
15219
|
this.set = set;
|
|
15522
15220
|
this.base = base;
|
|
15523
15221
|
this.modified = modified;
|
|
15524
|
-
|
|
15525
|
-
@internal
|
|
15526
|
-
*/
|
|
15222
|
+
/// @internal
|
|
15527
15223
|
this.id = nextTagID++;
|
|
15528
15224
|
}
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
tag, etc).
|
|
15535
|
-
*/
|
|
15225
|
+
/// Define a new tag. If `parent` is given, the tag is treated as a
|
|
15226
|
+
/// sub-tag of that parent, and
|
|
15227
|
+
/// [highlighters](#highlight.tagHighlighter) that don't mention
|
|
15228
|
+
/// this tag will try to fall back to the parent tag (or grandparent
|
|
15229
|
+
/// tag, etc).
|
|
15536
15230
|
static define(parent) {
|
|
15537
15231
|
if (parent === null || parent === void 0 ? void 0 : parent.base) throw new Error("Can not derive from a modified tag");
|
|
15538
15232
|
let tag = new Tag([], null, []);
|
|
@@ -15540,18 +15234,16 @@ class Tag {
|
|
|
15540
15234
|
if (parent) for (let t of parent.set) tag.set.push(t);
|
|
15541
15235
|
return tag;
|
|
15542
15236
|
}
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
== m1(t1)`)
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
`m1(m3(t1)`, and so on.
|
|
15554
|
-
*/
|
|
15237
|
+
/// Define a tag _modifier_, which is a function that, given a tag,
|
|
15238
|
+
/// will return a tag that is a subtag of the original. Applying the
|
|
15239
|
+
/// same modifier to a twice tag will return the same value (`m1(t1)
|
|
15240
|
+
/// == m1(t1)`) and applying multiple modifiers will, regardless or
|
|
15241
|
+
/// order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`).
|
|
15242
|
+
///
|
|
15243
|
+
/// When multiple modifiers are applied to a given base tag, each
|
|
15244
|
+
/// smaller set of modifiers is registered as a parent, so that for
|
|
15245
|
+
/// example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
|
|
15246
|
+
/// `m1(m3(t1)`, and so on.
|
|
15555
15247
|
static defineModifier() {
|
|
15556
15248
|
let mod = new Modifier();
|
|
15557
15249
|
return tag => {
|
|
@@ -15590,57 +15282,55 @@ function powerSet(array) {
|
|
|
15590
15282
|
}
|
|
15591
15283
|
return sets.sort((a, b) => b.length - a.length);
|
|
15592
15284
|
}
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15598
|
-
|
|
15599
|
-
|
|
15600
|
-
|
|
15601
|
-
|
|
15602
|
-
|
|
15603
|
-
|
|
15604
|
-
|
|
15605
|
-
|
|
15606
|
-
|
|
15607
|
-
|
|
15608
|
-
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
15619
|
-
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
```
|
|
15643
|
-
*/
|
|
15285
|
+
/// This function is used to add a set of tags to a language syntax
|
|
15286
|
+
/// via [`NodeSet.extend`](#common.NodeSet.extend) or
|
|
15287
|
+
/// [`LRParser.configure`](#lr.LRParser.configure).
|
|
15288
|
+
///
|
|
15289
|
+
/// The argument object maps node selectors to [highlighting
|
|
15290
|
+
/// tags](#highlight.Tag) or arrays of tags.
|
|
15291
|
+
///
|
|
15292
|
+
/// Node selectors may hold one or more (space-separated) node paths.
|
|
15293
|
+
/// Such a path can be a [node name](#common.NodeType.name), or
|
|
15294
|
+
/// multiple node names (or `*` wildcards) separated by slash
|
|
15295
|
+
/// characters, as in `"Block/Declaration/VariableName"`. Such a path
|
|
15296
|
+
/// matches the final node but only if its direct parent nodes are the
|
|
15297
|
+
/// other nodes mentioned. A `*` in such a path matches any parent,
|
|
15298
|
+
/// but only a single level—wildcards that match multiple parents
|
|
15299
|
+
/// aren't supported, both for efficiency reasons and because Lezer
|
|
15300
|
+
/// trees make it rather hard to reason about what they would match.)
|
|
15301
|
+
///
|
|
15302
|
+
/// A path can be ended with `/...` to indicate that the tag assigned
|
|
15303
|
+
/// to the node should also apply to all child nodes, even if they
|
|
15304
|
+
/// match their own style (by default, only the innermost style is
|
|
15305
|
+
/// used).
|
|
15306
|
+
///
|
|
15307
|
+
/// When a path ends in `!`, as in `Attribute!`, no further matching
|
|
15308
|
+
/// happens for the node's child nodes, and the entire node gets the
|
|
15309
|
+
/// given style.
|
|
15310
|
+
///
|
|
15311
|
+
/// In this notation, node names that contain `/`, `!`, `*`, or `...`
|
|
15312
|
+
/// must be quoted as JSON strings.
|
|
15313
|
+
///
|
|
15314
|
+
/// For example:
|
|
15315
|
+
///
|
|
15316
|
+
/// ```javascript
|
|
15317
|
+
/// parser.withProps(
|
|
15318
|
+
/// styleTags({
|
|
15319
|
+
/// // Style Number and BigNumber nodes
|
|
15320
|
+
/// "Number BigNumber": tags.number,
|
|
15321
|
+
/// // Style Escape nodes whose parent is String
|
|
15322
|
+
/// "String/Escape": tags.escape,
|
|
15323
|
+
/// // Style anything inside Attributes nodes
|
|
15324
|
+
/// "Attributes!": tags.meta,
|
|
15325
|
+
/// // Add a style to all content inside Italic nodes
|
|
15326
|
+
/// "Italic/...": tags.emphasis,
|
|
15327
|
+
/// // Style InvalidString nodes as both `string` and `invalid`
|
|
15328
|
+
/// "InvalidString": [tags.string, tags.invalid],
|
|
15329
|
+
/// // Style the node named "/" as punctuation
|
|
15330
|
+
/// '"/"': tags.punctuation
|
|
15331
|
+
/// })
|
|
15332
|
+
/// )
|
|
15333
|
+
/// ```
|
|
15644
15334
|
function styleTags(spec) {
|
|
15645
15335
|
let byName = Object.create(null);
|
|
15646
15336
|
for (let prop in spec) {
|
|
@@ -15648,11 +15338,11 @@ function styleTags(spec) {
|
|
|
15648
15338
|
if (!Array.isArray(tags)) tags = [tags];
|
|
15649
15339
|
for (let part of prop.split(" ")) if (part) {
|
|
15650
15340
|
let pieces = [],
|
|
15651
|
-
mode = 2 /* Normal */,
|
|
15341
|
+
mode = 2 /* Mode.Normal */,
|
|
15652
15342
|
rest = part;
|
|
15653
15343
|
for (let pos = 0;;) {
|
|
15654
15344
|
if (rest == "..." && pos > 0 && pos + 3 == part.length) {
|
|
15655
|
-
mode = 1 /* Inherit */;
|
|
15345
|
+
mode = 1 /* Mode.Inherit */;
|
|
15656
15346
|
break;
|
|
15657
15347
|
}
|
|
15658
15348
|
let m = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest);
|
|
@@ -15662,7 +15352,7 @@ function styleTags(spec) {
|
|
|
15662
15352
|
if (pos == part.length) break;
|
|
15663
15353
|
let next = part[pos++];
|
|
15664
15354
|
if (pos == part.length && next == "!") {
|
|
15665
|
-
mode = 0 /* Opaque */;
|
|
15355
|
+
mode = 0 /* Mode.Opaque */;
|
|
15666
15356
|
break;
|
|
15667
15357
|
}
|
|
15668
15358
|
if (next != "/") throw new RangeError("Invalid path: " + part);
|
|
@@ -15686,10 +15376,10 @@ class Rule {
|
|
|
15686
15376
|
this.next = next;
|
|
15687
15377
|
}
|
|
15688
15378
|
get opaque() {
|
|
15689
|
-
return this.mode == 0 /* Opaque */;
|
|
15379
|
+
return this.mode == 0 /* Mode.Opaque */;
|
|
15690
15380
|
}
|
|
15691
15381
|
get inherit() {
|
|
15692
|
-
return this.mode == 1 /* Inherit */;
|
|
15382
|
+
return this.mode == 1 /* Mode.Inherit */;
|
|
15693
15383
|
}
|
|
15694
15384
|
sort(other) {
|
|
15695
15385
|
if (!other || other.depth < this.depth) {
|
|
@@ -15703,12 +15393,10 @@ class Rule {
|
|
|
15703
15393
|
return this.context ? this.context.length : 0;
|
|
15704
15394
|
}
|
|
15705
15395
|
}
|
|
15706
|
-
Rule.empty = new Rule([], 2 /* Normal */, null);
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
take precedence.
|
|
15711
|
-
*/
|
|
15396
|
+
Rule.empty = new Rule([], 2 /* Mode.Normal */, null);
|
|
15397
|
+
/// Define a [highlighter](#highlight.Highlighter) from an array of
|
|
15398
|
+
/// tag/class pairs. Classes associated with more specific tags will
|
|
15399
|
+
/// take precedence.
|
|
15712
15400
|
function tagHighlighter(tags, options) {
|
|
15713
15401
|
let map = Object.create(null);
|
|
15714
15402
|
for (let style of tags) {
|
|
@@ -15743,19 +15431,17 @@ function highlightTags(highlighters, tags) {
|
|
|
15743
15431
|
}
|
|
15744
15432
|
return result;
|
|
15745
15433
|
}
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
[highlighter](#highlight.Highlighter).
|
|
15749
|
-
*/
|
|
15434
|
+
/// Highlight the given [tree](#common.Tree) with the given
|
|
15435
|
+
/// [highlighter](#highlight.Highlighter).
|
|
15750
15436
|
function highlightTree(tree, highlighter,
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
|
|
15758
|
-
|
|
15437
|
+
/// Assign styling to a region of the text. Will be called, in order
|
|
15438
|
+
/// of position, for any ranges where more than zero classes apply.
|
|
15439
|
+
/// `classes` is a space separated string of CSS classes.
|
|
15440
|
+
putStyle,
|
|
15441
|
+
/// The start of the range to highlight.
|
|
15442
|
+
from = 0,
|
|
15443
|
+
/// The end of the range.
|
|
15444
|
+
to = tree.length) {
|
|
15759
15445
|
let builder = new HighlightBuilder(from, Array.isArray(highlighter) ? highlighter : [highlighter], putStyle);
|
|
15760
15446
|
builder.highlightRange(tree.cursor(), from, to, "", builder.highlighters);
|
|
15761
15447
|
builder.flush(to);
|
|
@@ -15791,7 +15477,7 @@ class HighlightBuilder {
|
|
|
15791
15477
|
if (tagCls) {
|
|
15792
15478
|
if (cls) cls += " ";
|
|
15793
15479
|
cls += tagCls;
|
|
15794
|
-
if (rule.mode == 1 /* Inherit */) inheritedClass += (inheritedClass ? " " : "") + tagCls;
|
|
15480
|
+
if (rule.mode == 1 /* Mode.Inherit */) inheritedClass += (inheritedClass ? " " : "") + tagCls;
|
|
15795
15481
|
}
|
|
15796
15482
|
this.startSpan(cursor.from, cls);
|
|
15797
15483
|
if (rule.opaque) return;
|
|
@@ -15831,11 +15517,9 @@ class HighlightBuilder {
|
|
|
15831
15517
|
}
|
|
15832
15518
|
}
|
|
15833
15519
|
}
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
opaque (uses a `!`) or applies to all child nodes (`/...`).
|
|
15838
|
-
*/
|
|
15520
|
+
/// Match a syntax node's [highlight rules](#highlight.styleTags). If
|
|
15521
|
+
/// there's a match, return its set of tags, and whether it is
|
|
15522
|
+
/// opaque (uses a `!`) or applies to all child nodes (`/...`).
|
|
15839
15523
|
function getStyleTags(node) {
|
|
15840
15524
|
let rule = node.type.prop(ruleNodeProp);
|
|
15841
15525
|
while (rule && rule.context && !node.matchContext(rule.context)) rule = rule.next;
|
|
@@ -15856,440 +15540,268 @@ const comment = t(),
|
|
|
15856
15540
|
punctuation = t(),
|
|
15857
15541
|
bracket = t(punctuation),
|
|
15858
15542
|
meta = t();
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
the parent.
|
|
15878
|
-
*/
|
|
15543
|
+
/// The default set of highlighting [tags](#highlight.Tag).
|
|
15544
|
+
///
|
|
15545
|
+
/// This collection is heavily biased towards programming languages,
|
|
15546
|
+
/// and necessarily incomplete. A full ontology of syntactic
|
|
15547
|
+
/// constructs would fill a stack of books, and be impractical to
|
|
15548
|
+
/// write themes for. So try to make do with this set. If all else
|
|
15549
|
+
/// fails, [open an
|
|
15550
|
+
/// issue](https://github.com/codemirror/codemirror.next) to propose a
|
|
15551
|
+
/// new tag, or [define](#highlight.Tag^define) a local custom tag for
|
|
15552
|
+
/// your use case.
|
|
15553
|
+
///
|
|
15554
|
+
/// Note that it is not obligatory to always attach the most specific
|
|
15555
|
+
/// tag possible to an element—if your grammar can't easily
|
|
15556
|
+
/// distinguish a certain type of element (such as a local variable),
|
|
15557
|
+
/// it is okay to style it as its more general variant (a variable).
|
|
15558
|
+
///
|
|
15559
|
+
/// For tags that extend some parent tag, the documentation links to
|
|
15560
|
+
/// the parent.
|
|
15879
15561
|
const tags = {
|
|
15880
|
-
|
|
15881
|
-
A comment.
|
|
15882
|
-
*/
|
|
15562
|
+
/// A comment.
|
|
15883
15563
|
comment,
|
|
15884
|
-
|
|
15885
|
-
A line [comment](#highlight.tags.comment).
|
|
15886
|
-
*/
|
|
15564
|
+
/// A line [comment](#highlight.tags.comment).
|
|
15887
15565
|
lineComment: t(comment),
|
|
15888
|
-
|
|
15889
|
-
A block [comment](#highlight.tags.comment).
|
|
15890
|
-
*/
|
|
15566
|
+
/// A block [comment](#highlight.tags.comment).
|
|
15891
15567
|
blockComment: t(comment),
|
|
15892
|
-
|
|
15893
|
-
A documentation [comment](#highlight.tags.comment).
|
|
15894
|
-
*/
|
|
15568
|
+
/// A documentation [comment](#highlight.tags.comment).
|
|
15895
15569
|
docComment: t(comment),
|
|
15896
|
-
|
|
15897
|
-
Any kind of identifier.
|
|
15898
|
-
*/
|
|
15570
|
+
/// Any kind of identifier.
|
|
15899
15571
|
name,
|
|
15900
|
-
|
|
15901
|
-
The [name](#highlight.tags.name) of a variable.
|
|
15902
|
-
*/
|
|
15572
|
+
/// The [name](#highlight.tags.name) of a variable.
|
|
15903
15573
|
variableName: t(name),
|
|
15904
|
-
|
|
15905
|
-
A type [name](#highlight.tags.name).
|
|
15906
|
-
*/
|
|
15574
|
+
/// A type [name](#highlight.tags.name).
|
|
15907
15575
|
typeName: typeName,
|
|
15908
|
-
|
|
15909
|
-
A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
|
|
15910
|
-
*/
|
|
15576
|
+
/// A tag name (subtag of [`typeName`](#highlight.tags.typeName)).
|
|
15911
15577
|
tagName: t(typeName),
|
|
15912
|
-
|
|
15913
|
-
A property or field [name](#highlight.tags.name).
|
|
15914
|
-
*/
|
|
15578
|
+
/// A property or field [name](#highlight.tags.name).
|
|
15915
15579
|
propertyName: propertyName,
|
|
15916
|
-
|
|
15917
|
-
An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
|
|
15918
|
-
*/
|
|
15580
|
+
/// An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).
|
|
15919
15581
|
attributeName: t(propertyName),
|
|
15920
|
-
|
|
15921
|
-
The [name](#highlight.tags.name) of a class.
|
|
15922
|
-
*/
|
|
15582
|
+
/// The [name](#highlight.tags.name) of a class.
|
|
15923
15583
|
className: t(name),
|
|
15924
|
-
|
|
15925
|
-
A label [name](#highlight.tags.name).
|
|
15926
|
-
*/
|
|
15584
|
+
/// A label [name](#highlight.tags.name).
|
|
15927
15585
|
labelName: t(name),
|
|
15928
|
-
|
|
15929
|
-
A namespace [name](#highlight.tags.name).
|
|
15930
|
-
*/
|
|
15586
|
+
/// A namespace [name](#highlight.tags.name).
|
|
15931
15587
|
namespace: t(name),
|
|
15932
|
-
|
|
15933
|
-
The [name](#highlight.tags.name) of a macro.
|
|
15934
|
-
*/
|
|
15588
|
+
/// The [name](#highlight.tags.name) of a macro.
|
|
15935
15589
|
macroName: t(name),
|
|
15936
|
-
|
|
15937
|
-
A literal value.
|
|
15938
|
-
*/
|
|
15590
|
+
/// A literal value.
|
|
15939
15591
|
literal,
|
|
15940
|
-
|
|
15941
|
-
A string [literal](#highlight.tags.literal).
|
|
15942
|
-
*/
|
|
15592
|
+
/// A string [literal](#highlight.tags.literal).
|
|
15943
15593
|
string,
|
|
15944
|
-
|
|
15945
|
-
A documentation [string](#highlight.tags.string).
|
|
15946
|
-
*/
|
|
15594
|
+
/// A documentation [string](#highlight.tags.string).
|
|
15947
15595
|
docString: t(string),
|
|
15948
|
-
|
|
15949
|
-
A character literal (subtag of [string](#highlight.tags.string)).
|
|
15950
|
-
*/
|
|
15596
|
+
/// A character literal (subtag of [string](#highlight.tags.string)).
|
|
15951
15597
|
character: t(string),
|
|
15952
|
-
|
|
15953
|
-
An attribute value (subtag of [string](#highlight.tags.string)).
|
|
15954
|
-
*/
|
|
15598
|
+
/// An attribute value (subtag of [string](#highlight.tags.string)).
|
|
15955
15599
|
attributeValue: t(string),
|
|
15956
|
-
|
|
15957
|
-
A number [literal](#highlight.tags.literal).
|
|
15958
|
-
*/
|
|
15600
|
+
/// A number [literal](#highlight.tags.literal).
|
|
15959
15601
|
number,
|
|
15960
|
-
|
|
15961
|
-
An integer [number](#highlight.tags.number) literal.
|
|
15962
|
-
*/
|
|
15602
|
+
/// An integer [number](#highlight.tags.number) literal.
|
|
15963
15603
|
integer: t(number),
|
|
15964
|
-
|
|
15965
|
-
A floating-point [number](#highlight.tags.number) literal.
|
|
15966
|
-
*/
|
|
15604
|
+
/// A floating-point [number](#highlight.tags.number) literal.
|
|
15967
15605
|
float: t(number),
|
|
15968
|
-
|
|
15969
|
-
A boolean [literal](#highlight.tags.literal).
|
|
15970
|
-
*/
|
|
15606
|
+
/// A boolean [literal](#highlight.tags.literal).
|
|
15971
15607
|
bool: t(literal),
|
|
15972
|
-
|
|
15973
|
-
Regular expression [literal](#highlight.tags.literal).
|
|
15974
|
-
*/
|
|
15608
|
+
/// Regular expression [literal](#highlight.tags.literal).
|
|
15975
15609
|
regexp: t(literal),
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
backslash escape in a string.
|
|
15979
|
-
*/
|
|
15610
|
+
/// An escape [literal](#highlight.tags.literal), for example a
|
|
15611
|
+
/// backslash escape in a string.
|
|
15980
15612
|
escape: t(literal),
|
|
15981
|
-
|
|
15982
|
-
A color [literal](#highlight.tags.literal).
|
|
15983
|
-
*/
|
|
15613
|
+
/// A color [literal](#highlight.tags.literal).
|
|
15984
15614
|
color: t(literal),
|
|
15985
|
-
|
|
15986
|
-
A URL [literal](#highlight.tags.literal).
|
|
15987
|
-
*/
|
|
15615
|
+
/// A URL [literal](#highlight.tags.literal).
|
|
15988
15616
|
url: t(literal),
|
|
15989
|
-
|
|
15990
|
-
A language keyword.
|
|
15991
|
-
*/
|
|
15617
|
+
/// A language keyword.
|
|
15992
15618
|
keyword,
|
|
15993
|
-
|
|
15994
|
-
|
|
15995
|
-
object.
|
|
15996
|
-
*/
|
|
15619
|
+
/// The [keyword](#highlight.tags.keyword) for the self or this
|
|
15620
|
+
/// object.
|
|
15997
15621
|
self: t(keyword),
|
|
15998
|
-
|
|
15999
|
-
The [keyword](#highlight.tags.keyword) for null.
|
|
16000
|
-
*/
|
|
15622
|
+
/// The [keyword](#highlight.tags.keyword) for null.
|
|
16001
15623
|
null: t(keyword),
|
|
16002
|
-
|
|
16003
|
-
A [keyword](#highlight.tags.keyword) denoting some atomic value.
|
|
16004
|
-
*/
|
|
15624
|
+
/// A [keyword](#highlight.tags.keyword) denoting some atomic value.
|
|
16005
15625
|
atom: t(keyword),
|
|
16006
|
-
|
|
16007
|
-
A [keyword](#highlight.tags.keyword) that represents a unit.
|
|
16008
|
-
*/
|
|
15626
|
+
/// A [keyword](#highlight.tags.keyword) that represents a unit.
|
|
16009
15627
|
unit: t(keyword),
|
|
16010
|
-
|
|
16011
|
-
A modifier [keyword](#highlight.tags.keyword).
|
|
16012
|
-
*/
|
|
15628
|
+
/// A modifier [keyword](#highlight.tags.keyword).
|
|
16013
15629
|
modifier: t(keyword),
|
|
16014
|
-
|
|
16015
|
-
A [keyword](#highlight.tags.keyword) that acts as an operator.
|
|
16016
|
-
*/
|
|
15630
|
+
/// A [keyword](#highlight.tags.keyword) that acts as an operator.
|
|
16017
15631
|
operatorKeyword: t(keyword),
|
|
16018
|
-
|
|
16019
|
-
A control-flow related [keyword](#highlight.tags.keyword).
|
|
16020
|
-
*/
|
|
15632
|
+
/// A control-flow related [keyword](#highlight.tags.keyword).
|
|
16021
15633
|
controlKeyword: t(keyword),
|
|
16022
|
-
|
|
16023
|
-
A [keyword](#highlight.tags.keyword) that defines something.
|
|
16024
|
-
*/
|
|
15634
|
+
/// A [keyword](#highlight.tags.keyword) that defines something.
|
|
16025
15635
|
definitionKeyword: t(keyword),
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
interfacing with modules.
|
|
16029
|
-
*/
|
|
15636
|
+
/// A [keyword](#highlight.tags.keyword) related to defining or
|
|
15637
|
+
/// interfacing with modules.
|
|
16030
15638
|
moduleKeyword: t(keyword),
|
|
16031
|
-
|
|
16032
|
-
An operator.
|
|
16033
|
-
*/
|
|
15639
|
+
/// An operator.
|
|
16034
15640
|
operator,
|
|
16035
|
-
|
|
16036
|
-
An [operator](#highlight.tags.operator) that dereferences something.
|
|
16037
|
-
*/
|
|
15641
|
+
/// An [operator](#highlight.tags.operator) that dereferences something.
|
|
16038
15642
|
derefOperator: t(operator),
|
|
16039
|
-
|
|
16040
|
-
Arithmetic-related [operator](#highlight.tags.operator).
|
|
16041
|
-
*/
|
|
15643
|
+
/// Arithmetic-related [operator](#highlight.tags.operator).
|
|
16042
15644
|
arithmeticOperator: t(operator),
|
|
16043
|
-
|
|
16044
|
-
Logical [operator](#highlight.tags.operator).
|
|
16045
|
-
*/
|
|
15645
|
+
/// Logical [operator](#highlight.tags.operator).
|
|
16046
15646
|
logicOperator: t(operator),
|
|
16047
|
-
|
|
16048
|
-
Bit [operator](#highlight.tags.operator).
|
|
16049
|
-
*/
|
|
15647
|
+
/// Bit [operator](#highlight.tags.operator).
|
|
16050
15648
|
bitwiseOperator: t(operator),
|
|
16051
|
-
|
|
16052
|
-
Comparison [operator](#highlight.tags.operator).
|
|
16053
|
-
*/
|
|
15649
|
+
/// Comparison [operator](#highlight.tags.operator).
|
|
16054
15650
|
compareOperator: t(operator),
|
|
16055
|
-
|
|
16056
|
-
[Operator](#highlight.tags.operator) that updates its operand.
|
|
16057
|
-
*/
|
|
15651
|
+
/// [Operator](#highlight.tags.operator) that updates its operand.
|
|
16058
15652
|
updateOperator: t(operator),
|
|
16059
|
-
|
|
16060
|
-
[Operator](#highlight.tags.operator) that defines something.
|
|
16061
|
-
*/
|
|
15653
|
+
/// [Operator](#highlight.tags.operator) that defines something.
|
|
16062
15654
|
definitionOperator: t(operator),
|
|
16063
|
-
|
|
16064
|
-
Type-related [operator](#highlight.tags.operator).
|
|
16065
|
-
*/
|
|
15655
|
+
/// Type-related [operator](#highlight.tags.operator).
|
|
16066
15656
|
typeOperator: t(operator),
|
|
16067
|
-
|
|
16068
|
-
Control-flow [operator](#highlight.tags.operator).
|
|
16069
|
-
*/
|
|
15657
|
+
/// Control-flow [operator](#highlight.tags.operator).
|
|
16070
15658
|
controlOperator: t(operator),
|
|
16071
|
-
|
|
16072
|
-
Program or markup punctuation.
|
|
16073
|
-
*/
|
|
15659
|
+
/// Program or markup punctuation.
|
|
16074
15660
|
punctuation,
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
things.
|
|
16078
|
-
*/
|
|
15661
|
+
/// [Punctuation](#highlight.tags.punctuation) that separates
|
|
15662
|
+
/// things.
|
|
16079
15663
|
separator: t(punctuation),
|
|
16080
|
-
|
|
16081
|
-
Bracket-style [punctuation](#highlight.tags.punctuation).
|
|
16082
|
-
*/
|
|
15664
|
+
/// Bracket-style [punctuation](#highlight.tags.punctuation).
|
|
16083
15665
|
bracket,
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
tokens).
|
|
16087
|
-
*/
|
|
15666
|
+
/// Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`
|
|
15667
|
+
/// tokens).
|
|
16088
15668
|
angleBracket: t(bracket),
|
|
16089
|
-
|
|
16090
|
-
|
|
16091
|
-
tokens).
|
|
16092
|
-
*/
|
|
15669
|
+
/// Square [brackets](#highlight.tags.bracket) (usually `[` and `]`
|
|
15670
|
+
/// tokens).
|
|
16093
15671
|
squareBracket: t(bracket),
|
|
16094
|
-
|
|
16095
|
-
|
|
16096
|
-
[bracket](#highlight.tags.bracket).
|
|
16097
|
-
*/
|
|
15672
|
+
/// Parentheses (usually `(` and `)` tokens). Subtag of
|
|
15673
|
+
/// [bracket](#highlight.tags.bracket).
|
|
16098
15674
|
paren: t(bracket),
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
[bracket](#highlight.tags.bracket).
|
|
16102
|
-
*/
|
|
15675
|
+
/// Braces (usually `{` and `}` tokens). Subtag of
|
|
15676
|
+
/// [bracket](#highlight.tags.bracket).
|
|
16103
15677
|
brace: t(bracket),
|
|
16104
|
-
|
|
16105
|
-
Content, for example plain text in XML or markup documents.
|
|
16106
|
-
*/
|
|
15678
|
+
/// Content, for example plain text in XML or markup documents.
|
|
16107
15679
|
content,
|
|
16108
|
-
|
|
16109
|
-
[Content](#highlight.tags.content) that represents a heading.
|
|
16110
|
-
*/
|
|
15680
|
+
/// [Content](#highlight.tags.content) that represents a heading.
|
|
16111
15681
|
heading,
|
|
16112
|
-
|
|
16113
|
-
A level 1 [heading](#highlight.tags.heading).
|
|
16114
|
-
*/
|
|
15682
|
+
/// A level 1 [heading](#highlight.tags.heading).
|
|
16115
15683
|
heading1: t(heading),
|
|
16116
|
-
|
|
16117
|
-
A level 2 [heading](#highlight.tags.heading).
|
|
16118
|
-
*/
|
|
15684
|
+
/// A level 2 [heading](#highlight.tags.heading).
|
|
16119
15685
|
heading2: t(heading),
|
|
16120
|
-
|
|
16121
|
-
A level 3 [heading](#highlight.tags.heading).
|
|
16122
|
-
*/
|
|
15686
|
+
/// A level 3 [heading](#highlight.tags.heading).
|
|
16123
15687
|
heading3: t(heading),
|
|
16124
|
-
|
|
16125
|
-
A level 4 [heading](#highlight.tags.heading).
|
|
16126
|
-
*/
|
|
15688
|
+
/// A level 4 [heading](#highlight.tags.heading).
|
|
16127
15689
|
heading4: t(heading),
|
|
16128
|
-
|
|
16129
|
-
A level 5 [heading](#highlight.tags.heading).
|
|
16130
|
-
*/
|
|
15690
|
+
/// A level 5 [heading](#highlight.tags.heading).
|
|
16131
15691
|
heading5: t(heading),
|
|
16132
|
-
|
|
16133
|
-
A level 6 [heading](#highlight.tags.heading).
|
|
16134
|
-
*/
|
|
15692
|
+
/// A level 6 [heading](#highlight.tags.heading).
|
|
16135
15693
|
heading6: t(heading),
|
|
16136
|
-
|
|
16137
|
-
A prose separator (such as a horizontal rule).
|
|
16138
|
-
*/
|
|
15694
|
+
/// A prose separator (such as a horizontal rule).
|
|
16139
15695
|
contentSeparator: t(content),
|
|
16140
|
-
|
|
16141
|
-
[Content](#highlight.tags.content) that represents a list.
|
|
16142
|
-
*/
|
|
15696
|
+
/// [Content](#highlight.tags.content) that represents a list.
|
|
16143
15697
|
list: t(content),
|
|
16144
|
-
|
|
16145
|
-
[Content](#highlight.tags.content) that represents a quote.
|
|
16146
|
-
*/
|
|
15698
|
+
/// [Content](#highlight.tags.content) that represents a quote.
|
|
16147
15699
|
quote: t(content),
|
|
16148
|
-
|
|
16149
|
-
[Content](#highlight.tags.content) that is emphasized.
|
|
16150
|
-
*/
|
|
15700
|
+
/// [Content](#highlight.tags.content) that is emphasized.
|
|
16151
15701
|
emphasis: t(content),
|
|
16152
|
-
|
|
16153
|
-
[Content](#highlight.tags.content) that is styled strong.
|
|
16154
|
-
*/
|
|
15702
|
+
/// [Content](#highlight.tags.content) that is styled strong.
|
|
16155
15703
|
strong: t(content),
|
|
16156
|
-
|
|
16157
|
-
[Content](#highlight.tags.content) that is part of a link.
|
|
16158
|
-
*/
|
|
15704
|
+
/// [Content](#highlight.tags.content) that is part of a link.
|
|
16159
15705
|
link: t(content),
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
monospace.
|
|
16163
|
-
*/
|
|
15706
|
+
/// [Content](#highlight.tags.content) that is styled as code or
|
|
15707
|
+
/// monospace.
|
|
16164
15708
|
monospace: t(content),
|
|
16165
|
-
|
|
16166
|
-
|
|
16167
|
-
style.
|
|
16168
|
-
*/
|
|
15709
|
+
/// [Content](#highlight.tags.content) that has a strike-through
|
|
15710
|
+
/// style.
|
|
16169
15711
|
strikethrough: t(content),
|
|
16170
|
-
|
|
16171
|
-
Inserted text in a change-tracking format.
|
|
16172
|
-
*/
|
|
15712
|
+
/// Inserted text in a change-tracking format.
|
|
16173
15713
|
inserted: t(),
|
|
16174
|
-
|
|
16175
|
-
Deleted text.
|
|
16176
|
-
*/
|
|
15714
|
+
/// Deleted text.
|
|
16177
15715
|
deleted: t(),
|
|
16178
|
-
|
|
16179
|
-
Changed text.
|
|
16180
|
-
*/
|
|
15716
|
+
/// Changed text.
|
|
16181
15717
|
changed: t(),
|
|
16182
|
-
|
|
16183
|
-
An invalid or unsyntactic element.
|
|
16184
|
-
*/
|
|
15718
|
+
/// An invalid or unsyntactic element.
|
|
16185
15719
|
invalid: t(),
|
|
16186
|
-
|
|
16187
|
-
Metadata or meta-instruction.
|
|
16188
|
-
*/
|
|
15720
|
+
/// Metadata or meta-instruction.
|
|
16189
15721
|
meta,
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
document.
|
|
16193
|
-
*/
|
|
15722
|
+
/// [Metadata](#highlight.tags.meta) that applies to the entire
|
|
15723
|
+
/// document.
|
|
16194
15724
|
documentMeta: t(meta),
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
attributes to a given syntactic element.
|
|
16198
|
-
*/
|
|
15725
|
+
/// [Metadata](#highlight.tags.meta) that annotates or adds
|
|
15726
|
+
/// attributes to a given syntactic element.
|
|
16199
15727
|
annotation: t(meta),
|
|
16200
|
-
|
|
16201
|
-
|
|
16202
|
-
[meta](#highlight.tags.meta).
|
|
16203
|
-
*/
|
|
15728
|
+
/// Processing instruction or preprocessor directive. Subtag of
|
|
15729
|
+
/// [meta](#highlight.tags.meta).
|
|
16204
15730
|
processingInstruction: t(meta),
|
|
16205
|
-
|
|
16206
|
-
|
|
16207
|
-
|
|
16208
|
-
various [name](#highlight.tags.name) tags.
|
|
16209
|
-
*/
|
|
15731
|
+
/// [Modifier](#highlight.Tag^defineModifier) that indicates that a
|
|
15732
|
+
/// given element is being defined. Expected to be used with the
|
|
15733
|
+
/// various [name](#highlight.tags.name) tags.
|
|
16210
15734
|
definition: Tag.defineModifier(),
|
|
16211
|
-
|
|
16212
|
-
|
|
16213
|
-
|
|
16214
|
-
[variable names](#highlight.tags.variableName).
|
|
16215
|
-
*/
|
|
15735
|
+
/// [Modifier](#highlight.Tag^defineModifier) that indicates that
|
|
15736
|
+
/// something is constant. Mostly expected to be used with
|
|
15737
|
+
/// [variable names](#highlight.tags.variableName).
|
|
16216
15738
|
constant: Tag.defineModifier(),
|
|
16217
|
-
|
|
16218
|
-
[
|
|
16219
|
-
|
|
16220
|
-
|
|
16221
|
-
as a function.
|
|
16222
|
-
*/
|
|
15739
|
+
/// [Modifier](#highlight.Tag^defineModifier) used to indicate that
|
|
15740
|
+
/// a [variable](#highlight.tags.variableName) or [property
|
|
15741
|
+
/// name](#highlight.tags.propertyName) is being called or defined
|
|
15742
|
+
/// as a function.
|
|
16223
15743
|
function: Tag.defineModifier(),
|
|
16224
|
-
|
|
16225
|
-
[
|
|
16226
|
-
|
|
16227
|
-
the language's standard environment.
|
|
16228
|
-
*/
|
|
15744
|
+
/// [Modifier](#highlight.Tag^defineModifier) that can be applied to
|
|
15745
|
+
/// [names](#highlight.tags.name) to indicate that they belong to
|
|
15746
|
+
/// the language's standard environment.
|
|
16229
15747
|
standard: Tag.defineModifier(),
|
|
16230
|
-
|
|
16231
|
-
[
|
|
16232
|
-
[names](#highlight.tags.name) is local to some scope.
|
|
16233
|
-
*/
|
|
15748
|
+
/// [Modifier](#highlight.Tag^defineModifier) that indicates a given
|
|
15749
|
+
/// [names](#highlight.tags.name) is local to some scope.
|
|
16234
15750
|
local: Tag.defineModifier(),
|
|
16235
|
-
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
come up a lot.
|
|
16242
|
-
*/
|
|
15751
|
+
/// A generic variant [modifier](#highlight.Tag^defineModifier) that
|
|
15752
|
+
/// can be used to tag language-specific alternative variants of
|
|
15753
|
+
/// some common tag. It is recommended for themes to define special
|
|
15754
|
+
/// forms of at least the [string](#highlight.tags.string) and
|
|
15755
|
+
/// [variable name](#highlight.tags.variableName) tags, since those
|
|
15756
|
+
/// come up a lot.
|
|
16243
15757
|
special: Tag.defineModifier()
|
|
16244
15758
|
};
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
* [`
|
|
16253
|
-
* [`
|
|
16254
|
-
* [`
|
|
16255
|
-
* [`
|
|
16256
|
-
* [`
|
|
16257
|
-
* [`
|
|
16258
|
-
* [`
|
|
16259
|
-
* [`
|
|
16260
|
-
* [`
|
|
16261
|
-
* [`
|
|
16262
|
-
* [`
|
|
16263
|
-
* [`
|
|
16264
|
-
* [`
|
|
16265
|
-
* [`
|
|
16266
|
-
* [`
|
|
16267
|
-
* [`
|
|
16268
|
-
* [`
|
|
16269
|
-
* [`
|
|
16270
|
-
* [`
|
|
16271
|
-
* [`
|
|
16272
|
-
* [`
|
|
16273
|
-
* [`
|
|
16274
|
-
* [`
|
|
16275
|
-
* [`
|
|
16276
|
-
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
|
|
16281
|
-
|
|
16282
|
-
|
|
16283
|
-
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16291
|
-
to `"tok-propertyName tok-definition"`
|
|
16292
|
-
*/
|
|
15759
|
+
/// This is a highlighter that adds stable, predictable classes to
|
|
15760
|
+
/// tokens, for styling with external CSS.
|
|
15761
|
+
///
|
|
15762
|
+
/// The following tags are mapped to their name prefixed with `"tok-"`
|
|
15763
|
+
/// (for example `"tok-comment"`):
|
|
15764
|
+
///
|
|
15765
|
+
/// * [`link`](#highlight.tags.link)
|
|
15766
|
+
/// * [`heading`](#highlight.tags.heading)
|
|
15767
|
+
/// * [`emphasis`](#highlight.tags.emphasis)
|
|
15768
|
+
/// * [`strong`](#highlight.tags.strong)
|
|
15769
|
+
/// * [`keyword`](#highlight.tags.keyword)
|
|
15770
|
+
/// * [`atom`](#highlight.tags.atom)
|
|
15771
|
+
/// * [`bool`](#highlight.tags.bool)
|
|
15772
|
+
/// * [`url`](#highlight.tags.url)
|
|
15773
|
+
/// * [`labelName`](#highlight.tags.labelName)
|
|
15774
|
+
/// * [`inserted`](#highlight.tags.inserted)
|
|
15775
|
+
/// * [`deleted`](#highlight.tags.deleted)
|
|
15776
|
+
/// * [`literal`](#highlight.tags.literal)
|
|
15777
|
+
/// * [`string`](#highlight.tags.string)
|
|
15778
|
+
/// * [`number`](#highlight.tags.number)
|
|
15779
|
+
/// * [`variableName`](#highlight.tags.variableName)
|
|
15780
|
+
/// * [`typeName`](#highlight.tags.typeName)
|
|
15781
|
+
/// * [`namespace`](#highlight.tags.namespace)
|
|
15782
|
+
/// * [`className`](#highlight.tags.className)
|
|
15783
|
+
/// * [`macroName`](#highlight.tags.macroName)
|
|
15784
|
+
/// * [`propertyName`](#highlight.tags.propertyName)
|
|
15785
|
+
/// * [`operator`](#highlight.tags.operator)
|
|
15786
|
+
/// * [`comment`](#highlight.tags.comment)
|
|
15787
|
+
/// * [`meta`](#highlight.tags.meta)
|
|
15788
|
+
/// * [`punctuation`](#highlight.tags.punctuation)
|
|
15789
|
+
/// * [`invalid`](#highlight.tags.invalid)
|
|
15790
|
+
///
|
|
15791
|
+
/// In addition, these mappings are provided:
|
|
15792
|
+
///
|
|
15793
|
+
/// * [`regexp`](#highlight.tags.regexp),
|
|
15794
|
+
/// [`escape`](#highlight.tags.escape), and
|
|
15795
|
+
/// [`special`](#highlight.tags.special)[`(string)`](#highlight.tags.string)
|
|
15796
|
+
/// are mapped to `"tok-string2"`
|
|
15797
|
+
/// * [`special`](#highlight.tags.special)[`(variableName)`](#highlight.tags.variableName)
|
|
15798
|
+
/// to `"tok-variableName2"`
|
|
15799
|
+
/// * [`local`](#highlight.tags.local)[`(variableName)`](#highlight.tags.variableName)
|
|
15800
|
+
/// to `"tok-variableName tok-local"`
|
|
15801
|
+
/// * [`definition`](#highlight.tags.definition)[`(variableName)`](#highlight.tags.variableName)
|
|
15802
|
+
/// to `"tok-variableName tok-definition"`
|
|
15803
|
+
/// * [`definition`](#highlight.tags.definition)[`(propertyName)`](#highlight.tags.propertyName)
|
|
15804
|
+
/// to `"tok-propertyName tok-definition"`
|
|
16293
15805
|
tagHighlighter([{
|
|
16294
15806
|
tag: tags.link,
|
|
16295
15807
|
class: "tok-link"
|
|
@@ -16402,11 +15914,6 @@ function defineLanguageFacet(baseData) {
|
|
|
16402
15914
|
});
|
|
16403
15915
|
}
|
|
16404
15916
|
/**
|
|
16405
|
-
Syntax node prop used to register sublangauges. Should be added to
|
|
16406
|
-
the top level node type for the language.
|
|
16407
|
-
*/
|
|
16408
|
-
const sublanguageProp = /*@__PURE__*/new NodeProp();
|
|
16409
|
-
/**
|
|
16410
15917
|
A language object manages parsing and per-language
|
|
16411
15918
|
[metadata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt). Parse data is
|
|
16412
15919
|
managed as a [Lezer](https://lezer.codemirror.net) tree. The class
|
|
@@ -16428,9 +15935,11 @@ class Language {
|
|
|
16428
15935
|
The [language data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) facet
|
|
16429
15936
|
used for this language.
|
|
16430
15937
|
*/
|
|
16431
|
-
data, parser
|
|
16432
|
-
|
|
16433
|
-
|
|
15938
|
+
data, parser, extraExtensions = [],
|
|
15939
|
+
/**
|
|
15940
|
+
A language name.
|
|
15941
|
+
*/
|
|
15942
|
+
name = "") {
|
|
16434
15943
|
this.data = data;
|
|
16435
15944
|
this.name = name;
|
|
16436
15945
|
// Kludge to define EditorState.tree as a debugging helper,
|
|
@@ -16442,28 +15951,13 @@ class Language {
|
|
|
16442
15951
|
}
|
|
16443
15952
|
});
|
|
16444
15953
|
this.parser = parser;
|
|
16445
|
-
this.extension = [language.of(this), EditorState.languageData.of((state, pos, side) =>
|
|
16446
|
-
let top = topNodeAt(state, pos, side),
|
|
16447
|
-
data = top.type.prop(languageDataProp);
|
|
16448
|
-
if (!data) return [];
|
|
16449
|
-
let base = state.facet(data),
|
|
16450
|
-
sub = top.type.prop(sublanguageProp);
|
|
16451
|
-
if (sub) {
|
|
16452
|
-
let innerNode = top.resolve(pos - top.from, side);
|
|
16453
|
-
for (let sublang of sub) if (sublang.test(innerNode, state)) {
|
|
16454
|
-
let data = state.facet(sublang.facet);
|
|
16455
|
-
return sublang.type == "replace" ? data : data.concat(base);
|
|
16456
|
-
}
|
|
16457
|
-
}
|
|
16458
|
-
return base;
|
|
16459
|
-
})].concat(extraExtensions);
|
|
15954
|
+
this.extension = [language.of(this), EditorState.languageData.of((state, pos, side) => state.facet(languageDataFacetAt(state, pos, side)))].concat(extraExtensions);
|
|
16460
15955
|
}
|
|
16461
15956
|
/**
|
|
16462
15957
|
Query whether this language is active at the given position.
|
|
16463
15958
|
*/
|
|
16464
|
-
isActiveAt(state, pos) {
|
|
16465
|
-
|
|
16466
|
-
return topNodeAt(state, pos, side).type.prop(languageDataProp) == this.data;
|
|
15959
|
+
isActiveAt(state, pos, side = -1) {
|
|
15960
|
+
return languageDataFacetAt(state, pos, side) == this.data;
|
|
16467
15961
|
}
|
|
16468
15962
|
/**
|
|
16469
15963
|
Find the document regions that were parsed using this language.
|
|
@@ -16523,13 +16017,14 @@ class Language {
|
|
|
16523
16017
|
@internal
|
|
16524
16018
|
*/
|
|
16525
16019
|
Language.setState = /*@__PURE__*/StateEffect.define();
|
|
16526
|
-
function
|
|
16527
|
-
let topLang = state.facet(language)
|
|
16528
|
-
|
|
16529
|
-
|
|
16530
|
-
|
|
16020
|
+
function languageDataFacetAt(state, pos, side) {
|
|
16021
|
+
let topLang = state.facet(language);
|
|
16022
|
+
if (!topLang) return null;
|
|
16023
|
+
let facet = topLang.data;
|
|
16024
|
+
if (topLang.allowsNesting) {
|
|
16025
|
+
for (let node = syntaxTree(state).topNode; node; node = node.enter(pos, side, IterMode.ExcludeBuffers)) facet = node.type.prop(languageDataProp) || facet;
|
|
16531
16026
|
}
|
|
16532
|
-
return
|
|
16027
|
+
return facet;
|
|
16533
16028
|
}
|
|
16534
16029
|
/**
|
|
16535
16030
|
A subclass of [`Language`](https://codemirror.net/6/docs/ref/#language.Language) for use with Lezer
|
|
@@ -16573,15 +16068,13 @@ function syntaxTree(state) {
|
|
|
16573
16068
|
}
|
|
16574
16069
|
// Lezer-style Input object for a Text document.
|
|
16575
16070
|
class DocInput {
|
|
16576
|
-
constructor(doc) {
|
|
16071
|
+
constructor(doc, length = doc.length) {
|
|
16577
16072
|
this.doc = doc;
|
|
16073
|
+
this.length = length;
|
|
16578
16074
|
this.cursorPos = 0;
|
|
16579
16075
|
this.string = "";
|
|
16580
16076
|
this.cursor = doc.iter();
|
|
16581
16077
|
}
|
|
16582
|
-
get length() {
|
|
16583
|
-
return this.doc.length;
|
|
16584
|
-
}
|
|
16585
16078
|
syncTo(pos) {
|
|
16586
16079
|
this.string = this.cursor.next(pos - this.cursorPos).value;
|
|
16587
16080
|
this.cursorPos = pos + this.string.length;
|
|
@@ -16608,40 +16101,38 @@ class ParseContext {
|
|
|
16608
16101
|
/**
|
|
16609
16102
|
The current editor state.
|
|
16610
16103
|
*/
|
|
16611
|
-
state
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
|
|
16621
|
-
|
|
16622
|
-
|
|
16623
|
-
|
|
16624
|
-
|
|
16625
|
-
|
|
16626
|
-
|
|
16627
|
-
|
|
16628
|
-
|
|
16629
|
-
|
|
16630
|
-
|
|
16631
|
-
|
|
16632
|
-
|
|
16633
|
-
|
|
16634
|
-
|
|
16635
|
-
|
|
16636
|
-
|
|
16637
|
-
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
|
|
16641
|
-
|
|
16642
|
-
|
|
16643
|
-
*/
|
|
16644
|
-
scheduleOn = arguments.length > 7 ? arguments[7] : undefined;
|
|
16104
|
+
state,
|
|
16105
|
+
/**
|
|
16106
|
+
Tree fragments that can be reused by incremental re-parses.
|
|
16107
|
+
*/
|
|
16108
|
+
fragments = [],
|
|
16109
|
+
/**
|
|
16110
|
+
@internal
|
|
16111
|
+
*/
|
|
16112
|
+
tree,
|
|
16113
|
+
/**
|
|
16114
|
+
@internal
|
|
16115
|
+
*/
|
|
16116
|
+
treeLen,
|
|
16117
|
+
/**
|
|
16118
|
+
The current editor viewport (or some overapproximation
|
|
16119
|
+
thereof). Intended to be used for opportunistically avoiding
|
|
16120
|
+
work (in which case
|
|
16121
|
+
[`skipUntilInView`](https://codemirror.net/6/docs/ref/#language.ParseContext.skipUntilInView)
|
|
16122
|
+
should be called to make sure the parser is restarted when the
|
|
16123
|
+
skipped region becomes visible).
|
|
16124
|
+
*/
|
|
16125
|
+
viewport,
|
|
16126
|
+
/**
|
|
16127
|
+
@internal
|
|
16128
|
+
*/
|
|
16129
|
+
skipped,
|
|
16130
|
+
/**
|
|
16131
|
+
This is where skipping parsers can register a promise that,
|
|
16132
|
+
when resolved, will schedule a new parse. It is cleared when
|
|
16133
|
+
the parse worker picks up the promise. @internal
|
|
16134
|
+
*/
|
|
16135
|
+
scheduleOn) {
|
|
16645
16136
|
this.parser = parser;
|
|
16646
16137
|
this.state = state;
|
|
16647
16138
|
this.fragments = fragments;
|
|
@@ -17026,8 +16517,14 @@ class LanguageSupport {
|
|
|
17026
16517
|
/**
|
|
17027
16518
|
The language object.
|
|
17028
16519
|
*/
|
|
17029
|
-
language
|
|
17030
|
-
|
|
16520
|
+
language,
|
|
16521
|
+
/**
|
|
16522
|
+
An optional set of supporting extensions. When nesting a
|
|
16523
|
+
language in another language, the outer language is encouraged
|
|
16524
|
+
to include the supporting extensions for its inner languages
|
|
16525
|
+
in its own set of support extensions.
|
|
16526
|
+
*/
|
|
16527
|
+
support = []) {
|
|
17031
16528
|
this.language = language;
|
|
17032
16529
|
this.support = support;
|
|
17033
16530
|
this.extension = [language, support];
|
|
@@ -17057,8 +16554,11 @@ class LanguageDescription {
|
|
|
17057
16554
|
Optional filename pattern that should be associated with this
|
|
17058
16555
|
language.
|
|
17059
16556
|
*/
|
|
17060
|
-
filename, loadFunc
|
|
17061
|
-
|
|
16557
|
+
filename, loadFunc,
|
|
16558
|
+
/**
|
|
16559
|
+
If the language has been loaded, this will hold its value.
|
|
16560
|
+
*/
|
|
16561
|
+
support = undefined) {
|
|
17062
16562
|
this.name = name;
|
|
17063
16563
|
this.alias = alias;
|
|
17064
16564
|
this.extensions = extensions;
|
|
@@ -17112,8 +16612,7 @@ class LanguageDescription {
|
|
|
17112
16612
|
or alias occurs in the string (for names shorter than three
|
|
17113
16613
|
characters, only when surrounded by non-word characters).
|
|
17114
16614
|
*/
|
|
17115
|
-
static matchLanguageName(descs, name) {
|
|
17116
|
-
let fuzzy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
16615
|
+
static matchLanguageName(descs, name, fuzzy = true) {
|
|
17117
16616
|
name = name.toLowerCase();
|
|
17118
16617
|
for (let d of descs) if (d.alias.some(a => a == name)) return d;
|
|
17119
16618
|
if (fuzzy) for (let d of descs) for (let a of d.alias) {
|
|
@@ -17135,16 +16634,15 @@ service.
|
|
|
17135
16634
|
*/
|
|
17136
16635
|
const indentService = /*@__PURE__*/Facet.define();
|
|
17137
16636
|
/**
|
|
17138
|
-
Facet for overriding the unit by which indentation happens.
|
|
17139
|
-
be a string consisting either entirely of
|
|
17140
|
-
|
|
16637
|
+
Facet for overriding the unit by which indentation happens.
|
|
16638
|
+
Should be a string consisting either entirely of spaces or
|
|
16639
|
+
entirely of tabs. When not set, this defaults to 2 spaces.
|
|
17141
16640
|
*/
|
|
17142
16641
|
const indentUnit = /*@__PURE__*/Facet.define({
|
|
17143
16642
|
combine: values => {
|
|
17144
16643
|
if (!values.length) return " ";
|
|
17145
|
-
|
|
17146
|
-
|
|
17147
|
-
return unit;
|
|
16644
|
+
if (!/^(?: +|\t+)$/.test(values[0])) throw new Error("Invalid indent unit: " + JSON.stringify(values[0]));
|
|
16645
|
+
return values[0];
|
|
17148
16646
|
}
|
|
17149
16647
|
});
|
|
17150
16648
|
/**
|
|
@@ -17165,16 +16663,12 @@ tabs.
|
|
|
17165
16663
|
*/
|
|
17166
16664
|
function indentString(state, cols) {
|
|
17167
16665
|
let result = "",
|
|
17168
|
-
ts = state.tabSize
|
|
17169
|
-
|
|
17170
|
-
|
|
17171
|
-
|
|
17172
|
-
result += "\t";
|
|
17173
|
-
cols -= ts;
|
|
17174
|
-
}
|
|
17175
|
-
ch = " ";
|
|
16666
|
+
ts = state.tabSize;
|
|
16667
|
+
if (state.facet(indentUnit).charCodeAt(0) == 9) while (cols >= ts) {
|
|
16668
|
+
result += "\t";
|
|
16669
|
+
cols -= ts;
|
|
17176
16670
|
}
|
|
17177
|
-
for (let i = 0; i < cols; i++) result +=
|
|
16671
|
+
for (let i = 0; i < cols; i++) result += " ";
|
|
17178
16672
|
return result;
|
|
17179
16673
|
}
|
|
17180
16674
|
/**
|
|
@@ -17209,8 +16703,11 @@ class IndentContext {
|
|
|
17209
16703
|
/**
|
|
17210
16704
|
The editor state.
|
|
17211
16705
|
*/
|
|
17212
|
-
state
|
|
17213
|
-
|
|
16706
|
+
state,
|
|
16707
|
+
/**
|
|
16708
|
+
@internal
|
|
16709
|
+
*/
|
|
16710
|
+
options = {}) {
|
|
17214
16711
|
this.state = state;
|
|
17215
16712
|
this.options = options;
|
|
17216
16713
|
this.unit = getIndentUnit(state);
|
|
@@ -17223,8 +16720,7 @@ class IndentContext {
|
|
|
17223
16720
|
argument determines whether the part of the line line before or
|
|
17224
16721
|
after the break is used.
|
|
17225
16722
|
*/
|
|
17226
|
-
lineAt(pos) {
|
|
17227
|
-
let bias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
16723
|
+
lineAt(pos, bias = 1) {
|
|
17228
16724
|
let line = this.state.doc.lineAt(pos);
|
|
17229
16725
|
let {
|
|
17230
16726
|
simulateBreak,
|
|
@@ -17248,8 +16744,7 @@ class IndentContext {
|
|
|
17248
16744
|
Get the text directly after `pos`, either the entire line
|
|
17249
16745
|
or the next 100 characters, whichever is shorter.
|
|
17250
16746
|
*/
|
|
17251
|
-
textAfterPos(pos) {
|
|
17252
|
-
let bias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
16747
|
+
textAfterPos(pos, bias = 1) {
|
|
17253
16748
|
if (this.options.simulateDoubleBreak && pos == this.options.simulateBreak) return "";
|
|
17254
16749
|
let {
|
|
17255
16750
|
text,
|
|
@@ -17260,8 +16755,7 @@ class IndentContext {
|
|
|
17260
16755
|
/**
|
|
17261
16756
|
Find the column for the given position.
|
|
17262
16757
|
*/
|
|
17263
|
-
column(pos) {
|
|
17264
|
-
let bias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
16758
|
+
column(pos, bias = 1) {
|
|
17265
16759
|
let {
|
|
17266
16760
|
text,
|
|
17267
16761
|
from
|
|
@@ -17275,15 +16769,13 @@ class IndentContext {
|
|
|
17275
16769
|
Find the column position (taking tabs into account) of the given
|
|
17276
16770
|
position in the given string.
|
|
17277
16771
|
*/
|
|
17278
|
-
countColumn(line) {
|
|
17279
|
-
let pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : line.length;
|
|
16772
|
+
countColumn(line, pos = line.length) {
|
|
17280
16773
|
return countColumn(line, this.state.tabSize, pos);
|
|
17281
16774
|
}
|
|
17282
16775
|
/**
|
|
17283
16776
|
Find the indentation column of the line at the given point.
|
|
17284
16777
|
*/
|
|
17285
|
-
lineIndent(pos) {
|
|
17286
|
-
let bias = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
16778
|
+
lineIndent(pos, bias = 1) {
|
|
17287
16779
|
let {
|
|
17288
16780
|
text,
|
|
17289
16781
|
from
|
|
@@ -17434,12 +16926,11 @@ opening node, like this:
|
|
|
17434
16926
|
foo(bar,
|
|
17435
16927
|
baz)
|
|
17436
16928
|
*/
|
|
17437
|
-
function delimitedIndent(
|
|
17438
|
-
|
|
17439
|
-
|
|
17440
|
-
|
|
17441
|
-
|
|
17442
|
-
} = _ref;
|
|
16929
|
+
function delimitedIndent({
|
|
16930
|
+
closing,
|
|
16931
|
+
align = true,
|
|
16932
|
+
units = 1
|
|
16933
|
+
}) {
|
|
17443
16934
|
return context => delimitedStrategy(context, align, units, closing);
|
|
17444
16935
|
}
|
|
17445
16936
|
function delimitedStrategy(context, align, units, closing, closedAt) {
|
|
@@ -17463,11 +16954,10 @@ match a pattern (for example `/^else\b/` in `if`/`else`
|
|
|
17463
16954
|
constructs), and you can change the amount of units used with the
|
|
17464
16955
|
`units` option.
|
|
17465
16956
|
*/
|
|
17466
|
-
function continuedIndent(
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
|
|
17470
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16957
|
+
function continuedIndent({
|
|
16958
|
+
except,
|
|
16959
|
+
units = 1
|
|
16960
|
+
} = {}) {
|
|
17471
16961
|
return context => {
|
|
17472
16962
|
let matchExcept = except && except.test(context.textAfter);
|
|
17473
16963
|
return context.baseIndent + (matchExcept ? 0 : units * context.unit);
|
|
@@ -17734,8 +17224,7 @@ const unfoldCode = view => {
|
|
|
17734
17224
|
});
|
|
17735
17225
|
return effects.length > 0;
|
|
17736
17226
|
};
|
|
17737
|
-
function announceFold(view, range) {
|
|
17738
|
-
let fold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
17227
|
+
function announceFold(view, range, fold = true) {
|
|
17739
17228
|
let lineFrom = view.state.doc.lineAt(range.from).number,
|
|
17740
17229
|
lineTo = view.state.doc.lineAt(range.to).number;
|
|
17741
17230
|
return EditorView.announce.of(`${view.state.phrase(fold ? "Folded lines" : "Unfolded lines")} ${lineFrom} ${view.state.phrase("to")} ${lineTo}.`);
|
|
@@ -17878,8 +17367,7 @@ Create an extension that registers a fold gutter, which shows a
|
|
|
17878
17367
|
fold status indicator before foldable lines (which can be clicked
|
|
17879
17368
|
to fold or unfold the line).
|
|
17880
17369
|
*/
|
|
17881
|
-
function foldGutter() {
|
|
17882
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17370
|
+
function foldGutter(config = {}) {
|
|
17883
17371
|
let fullConfig = Object.assign(Object.assign({}, foldGutterDefaults), config);
|
|
17884
17372
|
let canFold = new FoldMarker(fullConfig, true),
|
|
17885
17373
|
canUnfold = new FoldMarker(fullConfig, false);
|
|
@@ -18184,8 +17672,7 @@ cursor is next to a bracket, that bracket and the one it matches
|
|
|
18184
17672
|
are highlighted. Or, when no matching bracket is found, another
|
|
18185
17673
|
highlighting style is used to indicate this.
|
|
18186
17674
|
*/
|
|
18187
|
-
function bracketMatching() {
|
|
18188
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17675
|
+
function bracketMatching(config = {}) {
|
|
18189
17676
|
return [bracketMatchingConfig.of(config), bracketMatchingUnique];
|
|
18190
17677
|
}
|
|
18191
17678
|
/**
|
|
@@ -18216,8 +17703,7 @@ direction `dir`. Only the `brackets` and `maxScanDistance`
|
|
|
18216
17703
|
properties are used from `config`, if given. Returns null if no
|
|
18217
17704
|
bracket was found at `pos`, or a match result otherwise.
|
|
18218
17705
|
*/
|
|
18219
|
-
function matchBrackets(state, pos, dir) {
|
|
18220
|
-
let config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
17706
|
+
function matchBrackets(state, pos, dir, config = {}) {
|
|
18221
17707
|
let maxScanDistance = config.maxScanDistance || DefaultScanDist,
|
|
18222
17708
|
brackets = config.brackets || DefaultBrackets;
|
|
18223
17709
|
let tree = syntaxTree(state),
|