@onereach/ui-components 4.4.0-beta.2691.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled/v2/components/OrCode/OrCode.js +3792 -6
- package/dist/bundled/v2/components/OrCode/index.js +2 -6
- package/dist/bundled/v2/components/OrCode/lang.js +3 -3941
- package/dist/bundled/v2/components/OrCode/theme.js +1 -2
- package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +3 -4
- package/dist/bundled/v2/components/OrConfirm/index.js +1 -2
- package/dist/bundled/v2/components/OrConfirmV3/OrConfirm.js +1 -1
- package/dist/bundled/v2/components/OrConfirmV3/index.js +1 -1
- package/dist/bundled/v2/components/OrExpansionPanelV3/styles.js +3 -1
- package/dist/bundled/v2/components/OrInlineTextEdit/OrInlineTextEdit.js +2 -2
- package/dist/bundled/v2/components/OrModal/OrModal.js +1346 -3
- package/dist/bundled/v2/components/OrModal/index.js +0 -1
- package/dist/bundled/v2/components/OrSidebarV3/styles.js +1 -1
- package/dist/bundled/v2/components/OrTagV3/OrTag.vue.d.ts +5 -5
- package/dist/bundled/v2/components/OrTagsV3/OrTags.js +163 -0
- package/dist/bundled/v2/components/OrTagsV3/OrTags.vue.d.ts +80 -0
- package/dist/bundled/v2/components/OrTagsV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrTagsV3/index.js +37 -0
- package/dist/bundled/v2/components/OrTagsV3/styles.d.ts +4 -0
- package/dist/bundled/v2/components/OrTagsV3/styles.js +26 -0
- package/dist/bundled/v2/components/OrTextV3/OrText.vue.d.ts +2 -2
- package/dist/bundled/v2/components/OrTextarea/OrTextarea.vue.d.ts +2 -2
- package/dist/bundled/v2/components/OrTextareaV3/OrTextarea.vue.d.ts +2 -2
- package/dist/bundled/v2/components/OrTextbox/OrTextbox.vue.d.ts +2 -2
- package/dist/bundled/v2/components/OrTimePickerV3/OrTimePicker.vue.d.ts +2 -2
- package/dist/bundled/v2/components/OrToast/OrToast.vue.d.ts +2 -2
- package/dist/bundled/v2/components/OrToastV3/OrToast.vue.d.ts +2 -2
- package/dist/bundled/v2/components/OrTooltip/OrTooltip.vue.d.ts +2 -2
- package/dist/bundled/v2/components/OrTooltipV3/OrTooltip.vue.d.ts +2 -2
- package/dist/bundled/v2/components/index.d.ts +4 -1
- package/dist/bundled/v2/components/index.js +13 -17
- package/dist/bundled/v2/{index-0d224ae5.js → index-cf2c3c27.js} +115 -3
- package/dist/bundled/v2/index.js +16 -21
- package/dist/bundled/{v3/index-e9f6b2d8.js → v2/lang-0fb8f78b.js} +4009 -73
- package/dist/bundled/v3/OrCheckboxGroup.vue_vue_type_script_lang-1e71771d.js +60 -0
- package/dist/bundled/v3/{index-d92d0b48.js → OrCode.vue_vue_type_script_lang-74060519.js} +235 -14
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-dca252a7.js → OrConfirm.vue_vue_type_script_lang-23e4ce08.js} +1 -1
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-4eaa8470.js → OrConfirm.vue_vue_type_script_lang-e5a8f92a.js} +2 -2
- package/dist/bundled/{v2/useFocusTrap-48767a70.js → v3/OrModal.vue_vue_type_script_lang-ae842e5b.js} +106 -3
- package/dist/bundled/v3/OrRadioGroup.vue_vue_type_script_lang-dfffdd80.js +59 -0
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-264914d3.js → OrSelect.vue_vue_type_script_lang-2c4c9f9d.js} +2 -2
- package/dist/bundled/v3/OrTags.vue_vue_type_script_lang-e75444b5.js +70 -0
- package/dist/bundled/v3/components/OrAvatar/OrAvatar.vue.d.ts +11 -26
- package/dist/bundled/v3/components/OrAvatarV3/OrAvatar.vue.d.ts +8 -24
- package/dist/bundled/v3/components/OrBottomSheetV3/OrBottomSheet.vue.d.ts +20 -33
- package/dist/bundled/v3/components/OrButton/OrButton.vue.d.ts +16 -51
- package/dist/bundled/v3/components/OrButtonV2/OrButton.vue.d.ts +20 -57
- package/dist/bundled/v3/components/OrButtonV3/OrButton.vue.d.ts +15 -35
- package/dist/bundled/v3/components/OrCard/OrCard.vue.d.ts +7 -15
- package/dist/bundled/v3/components/OrCardCollection/OrCardCollection.vue.d.ts +21 -47
- package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.vue.d.ts +22 -70
- package/dist/bundled/v3/components/OrCardV3/OrCard.vue.d.ts +4 -7
- package/dist/bundled/v3/components/OrCarousel/OrCarousel.vue.d.ts +126 -676
- package/dist/bundled/v3/components/OrCarouselItem/OrCarouselItem.vue.d.ts +1 -1
- package/dist/bundled/v3/components/OrCheckbox/OrCheckbox.vue.d.ts +15 -35
- package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.js +9 -60
- package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.vue.d.ts +6 -24
- package/dist/bundled/v3/components/OrCheckboxGroupV3/index.js +2 -2
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.js +2 -2
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +17 -43
- package/dist/bundled/v3/components/OrCheckboxTreeV3/index.js +1 -1
- package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.vue.d.ts +23 -53
- package/dist/bundled/v3/components/OrChip/OrChip.vue.d.ts +9 -25
- package/dist/bundled/v3/components/OrChips/OrChips.vue.d.ts +24 -51
- package/dist/bundled/v3/components/OrCode/OrCode.js +6 -10
- package/dist/bundled/v3/components/OrCode/OrCode.vue.d.ts +24 -69
- package/dist/bundled/v3/components/OrCode/index.js +4 -8
- package/dist/bundled/v3/components/OrCode/lang.js +3 -3941
- package/dist/bundled/v3/components/OrCode/theme.js +1 -2
- package/dist/bundled/v3/components/OrCollapse/OrCollapse.vue.d.ts +17 -39
- package/dist/bundled/v3/components/OrColorPicker/OrColorPicker.vue.d.ts +13 -31
- package/dist/bundled/v3/components/OrCombinedInputV3/OrCombinedInput.vue.d.ts +8 -30
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +5 -6
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.vue.d.ts +23 -84
- package/dist/bundled/v3/components/OrConfirm/index.js +3 -4
- package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +3 -3
- package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.vue.d.ts +29 -91
- package/dist/bundled/v3/components/OrConfirmV3/index.js +2 -2
- package/dist/bundled/v3/components/OrDatePickerV3/OrDatePicker.vue.d.ts +25 -81
- package/dist/bundled/v3/components/OrDateTimePicker/OrDateTimePicker.vue.d.ts +68 -177
- package/dist/bundled/v3/components/OrDateTimePickerV3/OrDateTimePicker.vue.d.ts +31 -105
- package/dist/bundled/v3/components/OrEmptyStateV3/OrEmptyState.vue.d.ts +11 -28
- package/dist/bundled/v3/components/OrError/OrError.vue.d.ts +4 -8
- package/dist/bundled/v3/components/OrErrorTagV3/OrErrorTag.vue.d.ts +4 -7
- package/dist/bundled/v3/components/OrErrorV3/OrError.vue.d.ts +9 -18
- package/dist/bundled/v3/components/OrExpansionPanelV3/OrExpansionPanel.js +2 -2
- package/dist/bundled/v3/components/OrExpansionPanelV3/OrExpansionPanel.vue.d.ts +14 -35
- package/dist/bundled/v3/components/OrExpansionPanelV3/index.js +1 -1
- package/dist/bundled/v3/components/OrExpansionPanelV3/styles.js +3 -1
- package/dist/bundled/v3/components/OrFabV3/OrFab.vue.d.ts +8 -20
- package/dist/bundled/v3/components/OrFloating/OrFloating.vue.d.ts +15 -46
- package/dist/bundled/v3/components/OrFormGroupV3/OrFormGroup.vue.d.ts +10 -30
- package/dist/bundled/v3/components/OrHint/OrHint.vue.d.ts +4 -8
- package/dist/bundled/v3/components/OrHintV3/OrHint.vue.d.ts +9 -18
- package/dist/bundled/v3/components/OrIcon/OrIcon.vue.d.ts +16 -44
- package/dist/bundled/v3/components/OrIconButtonV2/OrIconButton.vue.d.ts +13 -43
- package/dist/bundled/v3/components/OrIconButtonV3/OrIconButton.vue.d.ts +16 -52
- package/dist/bundled/v3/components/OrIconV3/OrIcon.vue.d.ts +7 -18
- package/dist/bundled/v3/components/OrInlineInputBoxV3/OrInlineInputBox.vue.d.ts +7 -16
- package/dist/bundled/v3/components/OrInlineInputV3/OrInlineInput.vue.d.ts +39 -83
- package/dist/bundled/v3/components/OrInlineTextEdit/OrInlineTextEdit.js +1 -1
- package/dist/bundled/v3/components/OrInlineTextEdit/OrInlineTextEdit.vue.d.ts +43 -95
- package/dist/bundled/v3/components/OrInlineTextareaV3/OrInlineTextarea.vue.d.ts +39 -79
- package/dist/bundled/v3/components/OrInput/OrInput.vue.d.ts +36 -87
- package/dist/bundled/v3/components/OrInputBoxV3/OrInputBox.vue.d.ts +7 -22
- package/dist/bundled/v3/components/OrInputV3/OrInput.vue.d.ts +34 -85
- package/dist/bundled/v3/components/OrLabel/OrLabel.vue.d.ts +9 -20
- package/dist/bundled/v3/components/OrLabelV3/OrLabel.vue.d.ts +9 -24
- package/dist/bundled/v3/components/OrLinkV3/OrLink.vue.d.ts +7 -24
- package/dist/bundled/v3/components/OrList/OrList.vue.d.ts +21 -47
- package/dist/bundled/v3/components/OrListOfInputs/OrListOfInputs.vue.d.ts +11 -27
- package/dist/bundled/v3/components/OrLoader/OrLoader.vue.d.ts +10 -26
- package/dist/bundled/v3/components/OrLoaderV3/OrLoader.vue.d.ts +13 -34
- package/dist/bundled/v3/components/OrMenuItemV3/OrMenuItem.vue.d.ts +13 -34
- package/dist/bundled/v3/components/OrMenuV3/OrMenu.vue.d.ts +16 -43
- package/dist/bundled/v3/components/OrModal/OrModal.js +2 -3
- package/dist/bundled/v3/components/OrModal/OrModal.vue.d.ts +14 -38
- package/dist/bundled/v3/components/OrModal/index.js +1 -2
- package/dist/bundled/v3/components/OrModalV3/OrModal.vue.d.ts +15 -31
- package/dist/bundled/v3/components/OrNotification/OrNotification.vue.d.ts +9 -27
- package/dist/bundled/v3/components/OrNotificationV3/OrNotification.vue.d.ts +9 -20
- package/dist/bundled/v3/components/OrNumberInput/OrNumberInput.vue.d.ts +24 -70
- package/dist/bundled/v3/components/OrOverflowMenu/OrOverflowMenu.vue.d.ts +13 -31
- package/dist/bundled/v3/components/OrOverlay/OrOverlay.vue.d.ts +6 -16
- package/dist/bundled/v3/components/OrOverlayV3/OrOverlay.vue.d.ts +7 -14
- package/dist/bundled/v3/components/OrPaginationV3/OrPagination.vue.d.ts +27 -75
- package/dist/bundled/v3/components/OrPassword/OrPassword.vue.d.ts +22 -63
- package/dist/bundled/v3/components/OrPopoverV3/OrPopover.vue.d.ts +27 -74
- package/dist/bundled/v3/components/OrProgress/OrProgress.vue.d.ts +20 -56
- package/dist/bundled/v3/components/OrProgressV3/OrProgress.vue.d.ts +25 -62
- package/dist/bundled/v3/components/OrRadio/OrRadio.vue.d.ts +13 -35
- package/dist/bundled/v3/components/OrRadioGroup/OrRadioGroup.vue.d.ts +9 -26
- package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.js +9 -60
- package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.vue.d.ts +6 -32
- package/dist/bundled/v3/components/OrRadioGroupV3/index.js +1 -1
- package/dist/bundled/v3/components/OrRadioV3/OrRadio.vue.d.ts +21 -49
- package/dist/bundled/v3/components/OrSearch/OrSearch.vue.d.ts +23 -65
- package/dist/bundled/v3/components/OrSearchV3/OrSearch.vue.d.ts +17 -41
- package/dist/bundled/v3/components/OrSegmentedControlV3/OrSegmentedControl.vue.d.ts +9 -25
- package/dist/bundled/v3/components/OrSelect/OrSelect.vue.d.ts +28 -77
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +3 -3
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +37 -115
- package/dist/bundled/v3/components/OrSelectV3/index.js +2 -2
- package/dist/bundled/v3/components/OrSidebar/OrSidebar.vue.d.ts +14 -33
- package/dist/bundled/v3/components/OrSidebarV3/OrSidebar.js +2 -2
- package/dist/bundled/v3/components/OrSidebarV3/OrSidebar.vue.d.ts +28 -63
- package/dist/bundled/v3/components/OrSidebarV3/index.js +1 -1
- package/dist/bundled/v3/components/OrSidebarV3/styles.js +1 -1
- package/dist/bundled/v3/components/OrSkeletonCircle/OrSkeletonCircle.vue.d.ts +9 -20
- package/dist/bundled/v3/components/OrSkeletonCircleV3/OrSkeletonCircle.vue.d.ts +13 -28
- package/dist/bundled/v3/components/OrSkeletonRect/OrSkeletonRect.vue.d.ts +9 -22
- package/dist/bundled/v3/components/OrSkeletonRectV3/OrSkeletonRect.vue.d.ts +11 -26
- package/dist/bundled/v3/components/OrSkeletonText/OrSkeletonText.vue.d.ts +10 -26
- package/dist/bundled/v3/components/OrSkeletonTextV3/OrSkeletonText.vue.d.ts +16 -40
- package/dist/bundled/v3/components/OrSlider/OrSlider.vue.d.ts +35 -91
- package/dist/bundled/v3/components/OrSortHeaderV3/OrSortHeader.vue.d.ts +13 -25
- package/dist/bundled/v3/components/OrStepper/OrStepper.vue.d.ts +16 -43
- package/dist/bundled/v3/components/OrSwitch/OrSwitch.vue.d.ts +12 -33
- package/dist/bundled/v3/components/OrSwitchV3/OrSwitch.vue.d.ts +22 -53
- package/dist/bundled/v3/components/OrTab/OrTab.vue.d.ts +9 -22
- package/dist/bundled/v3/components/OrTabHeaderItem/OrTabHeaderItem.vue.d.ts +13 -29
- package/dist/bundled/v3/components/OrTabV3/OrTab.vue.d.ts +10 -17
- package/dist/bundled/v3/components/OrTabs/OrTabs.vue.d.ts +4 -17
- package/dist/bundled/v3/components/OrTabsV3/OrTabs.vue.d.ts +24 -69
- package/dist/bundled/v3/components/OrTag/OrTag.vue.d.ts +10 -27
- package/dist/bundled/v3/components/OrTagV3/OrTag.vue.d.ts +15 -26
- package/dist/bundled/v3/components/OrTagsV3/OrTags.js +101 -0
- package/dist/bundled/v3/components/OrTagsV3/OrTags.vue.d.ts +36 -0
- package/dist/bundled/v3/components/OrTagsV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrTagsV3/index.js +46 -0
- package/dist/bundled/v3/components/OrTagsV3/styles.d.ts +4 -0
- package/dist/bundled/v3/components/OrTagsV3/styles.js +26 -0
- package/dist/bundled/v3/components/OrTeleport/OrTeleport.vue3.vue.d.ts +4 -10
- package/dist/bundled/v3/components/OrTeleportV3/OrTeleport.vue3.vue.d.ts +4 -10
- package/dist/bundled/v3/components/OrTextV3/OrText.vue.d.ts +11 -24
- package/dist/bundled/v3/components/OrTextarea/OrTextarea.vue.d.ts +37 -85
- package/dist/bundled/v3/components/OrTextareaV3/OrTextarea.vue.d.ts +32 -73
- package/dist/bundled/v3/components/OrTextbox/OrTextbox.vue.d.ts +55 -137
- package/dist/bundled/v3/components/OrTimePickerV3/OrTimePicker.vue.d.ts +25 -79
- package/dist/bundled/v3/components/OrToast/OrToast.vue.d.ts +11 -31
- package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.vue.d.ts +25 -55
- package/dist/bundled/v3/components/OrToastContainerV3/OrToastContainer.vue.d.ts +24 -54
- package/dist/bundled/v3/components/OrToastV3/OrToast.vue.d.ts +16 -38
- package/dist/bundled/v3/components/OrTooltip/OrTooltip.vue.d.ts +14 -33
- package/dist/bundled/v3/components/OrTooltipContent/OrTooltipContent.vue.d.ts +4 -10
- package/dist/bundled/v3/components/OrTooltipV3/OrTooltip.vue.d.ts +13 -37
- package/dist/bundled/v3/components/index.d.ts +4 -1
- package/dist/bundled/v3/components/index.js +24 -26
- package/dist/bundled/v3/directives/dropdown-close.d.ts +3 -1
- package/dist/bundled/v3/directives/dropdown-open.d.ts +3 -1
- package/dist/bundled/v3/hooks/useResponsive/useResponsive.d.ts +2 -2
- package/dist/bundled/v3/{index-0d224ae5.js → index-cf2c3c27.js} +115 -3
- package/dist/bundled/v3/index.js +33 -33
- package/dist/bundled/{v2/index-e9f6b2d8.js → v3/lang-0fb8f78b.js} +4009 -73
- package/dist/esm/v2/OrCheckboxGroup-f470f938.js +121 -0
- package/dist/esm/v2/{OrCheckboxTree-df80d4ab.js → OrCheckboxTree-1304ae59.js} +6 -2
- package/dist/esm/v2/{OrConfirm-b62d9ce4.js → OrConfirm-d0d9d56c.js} +2 -2
- package/dist/esm/v2/{OrExpansionPanel-7c359bb0.js → OrExpansionPanel-d3a2218d.js} +3 -1
- package/dist/esm/v2/OrInlineTextEdit-601163c3.js +400 -0
- package/dist/esm/v2/OrRadioGroup-0de37d76.js +120 -0
- package/dist/esm/v2/{OrSelect-9d6b3363.js → OrSelect-a4c34099.js} +1 -1
- package/dist/esm/v2/{OrSidebar-b8387abe.js → OrSidebar-de938772.js} +1 -1
- package/dist/esm/v2/OrTags-4ffaa13b.js +159 -0
- package/dist/esm/v2/components/index.d.ts +4 -1
- package/dist/esm/v2/components/index.js +10 -29
- package/dist/esm/v2/components/or-checkbox-group-v3/index.js +6 -122
- package/dist/esm/v2/components/or-checkbox-tree-v3/index.js +1 -2
- package/dist/esm/v2/components/or-confirm/index.js +1 -1
- package/dist/esm/v2/components/or-expansion-panel-v3/index.js +1 -1
- package/dist/esm/v2/components/or-inline-text-edit/index.js +1 -1
- package/dist/esm/v2/components/or-radio-group-v3/index.js +6 -120
- package/dist/esm/v2/components/or-select-v3/index.js +2 -2
- package/dist/esm/v2/components/or-sidebar-v3/index.js +1 -1
- package/dist/esm/v2/components/or-tag-v3/OrTag.vue.d.ts +5 -5
- package/dist/esm/v2/components/or-tags-v3/OrTags.vue.d.ts +80 -0
- package/dist/esm/v2/components/or-tags-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-tags-v3/index.js +19 -0
- package/dist/esm/v2/components/or-tags-v3/styles.d.ts +4 -0
- package/dist/esm/v2/components/or-text-v3/OrText.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-textarea/OrTextarea.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-textarea-v3/OrTextarea.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-textbox/OrTextbox.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-time-picker-v3/OrTimePicker.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-toast/OrToast.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-toast/or-toast-container/OrToastContainer.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-toast-v3/OrToast.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-toast-v3/or-toast-container-v3/OrToastContainer.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-tooltip/OrTooltip.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-tooltip/or-tooltip-content/OrTooltipContent.vue.d.ts +2 -2
- package/dist/esm/v2/components/or-tooltip-v3/OrTooltip.vue.d.ts +2 -2
- package/dist/esm/v2/index.js +10 -30
- package/dist/esm/v3/OrCheckboxGroup-c41a99ba.js +88 -0
- package/dist/esm/v3/{OrCheckboxTree-4a85b9b3.js → OrCheckboxTree-fa6288af.js} +6 -2
- package/dist/esm/v3/{OrConfirm-1a94bdea.js → OrConfirm-410da5b4.js} +1 -1
- package/dist/esm/v3/{OrExpansionPanel-99ca7ed7.js → OrExpansionPanel-c016d8fa.js} +3 -1
- package/dist/esm/v3/OrInlineTextEdit-42d59fb9.js +356 -0
- package/dist/esm/v3/OrRadioGroup-5d1fe6fd.js +87 -0
- package/dist/esm/v3/{OrSelect-3dbddc6b.js → OrSelect-046e8e36.js} +1 -1
- package/dist/esm/v3/{OrSidebar-bfd19c4c.js → OrSidebar-3f2502fb.js} +1 -1
- package/dist/esm/v3/OrTags-a082de82.js +147 -0
- package/dist/esm/v3/components/index.d.ts +4 -1
- package/dist/esm/v3/components/index.js +10 -29
- package/dist/esm/v3/components/or-avatar/OrAvatar.vue.d.ts +11 -26
- package/dist/esm/v3/components/or-avatar-v3/OrAvatar.vue.d.ts +8 -24
- package/dist/esm/v3/components/or-bottom-sheet-v3/OrBottomSheet.vue.d.ts +20 -33
- package/dist/esm/v3/components/or-button/OrButton.vue.d.ts +16 -51
- package/dist/esm/v3/components/or-button-v2/OrButton.vue.d.ts +20 -57
- package/dist/esm/v3/components/or-button-v3/OrButton.vue.d.ts +15 -35
- package/dist/esm/v3/components/or-card/OrCard.vue.d.ts +7 -15
- package/dist/esm/v3/components/or-card-collection/OrCardCollection.vue.d.ts +21 -47
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +22 -70
- package/dist/esm/v3/components/or-card-collection-v3/partials/OrCardCollectionView.vue3.vue.d.ts +6 -14
- package/dist/esm/v3/components/or-card-v3/OrCard.vue.d.ts +4 -7
- package/dist/esm/v3/components/or-carousel/OrCarousel.vue.d.ts +126 -676
- package/dist/esm/v3/components/or-carousel/or-carousel-item/OrCarouselItem.vue.d.ts +1 -1
- package/dist/esm/v3/components/or-checkbox/OrCheckbox.vue.d.ts +15 -35
- package/dist/esm/v3/components/or-checkbox-group-v3/OrCheckboxGroup.vue.d.ts +6 -24
- package/dist/esm/v3/components/or-checkbox-group-v3/index.js +6 -89
- package/dist/esm/v3/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +17 -43
- package/dist/esm/v3/components/or-checkbox-tree-v3/index.js +1 -2
- package/dist/esm/v3/components/or-checkbox-v3/OrCheckbox.vue.d.ts +23 -53
- package/dist/esm/v3/components/or-chips/OrChips.vue.d.ts +24 -51
- package/dist/esm/v3/components/or-chips/or-chip/OrChip.vue.d.ts +9 -25
- package/dist/esm/v3/components/or-chips/partials/OrChipsInput.vue.d.ts +17 -37
- package/dist/esm/v3/components/or-code/OrCode.vue.d.ts +24 -69
- package/dist/esm/v3/components/or-collapse/OrCollapse.vue.d.ts +17 -39
- package/dist/esm/v3/components/or-color-picker/OrColorPicker.vue.d.ts +13 -31
- package/dist/esm/v3/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +8 -30
- package/dist/esm/v3/components/or-confirm/OrConfirm.vue.d.ts +23 -84
- package/dist/esm/v3/components/or-confirm/index.js +1 -1
- package/dist/esm/v3/components/or-confirm-v3/OrConfirm.vue.d.ts +29 -91
- package/dist/esm/v3/components/or-date-picker-v3/OrDatePicker.vue.d.ts +25 -81
- package/dist/esm/v3/components/or-date-time-picker/OrDateTimePicker.vue.d.ts +68 -177
- package/dist/esm/v3/components/or-date-time-picker/partials/OrDateTimePickerCalendarItem.vue.d.ts +12 -33
- package/dist/esm/v3/components/or-date-time-picker-v3/OrDateTimePicker.vue.d.ts +31 -105
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-date-control/OrDateTimePickerDateControl.vue.d.ts +11 -28
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-date-select/OrDateTimePickerDateSelect.vue.d.ts +17 -39
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-mobile-control/OrDateTimePickerMobileControl.vue.d.ts +7 -15
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-month-select/OrDateTimePickerMonthSelect.vue.d.ts +23 -85
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-popover-footer/OrDateTimePickerPopoverFooter.vue.d.ts +7 -11
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-popover-header/OrDateTimePickerPopoverHeader.vue.d.ts +4 -7
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-time-control/OrDateTimePickerTimeControl.vue.d.ts +11 -28
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-time-select/OrDateTimePickerTimeSelect.vue.d.ts +15 -37
- package/dist/esm/v3/components/or-empty-state-v3/OrEmptyState.vue.d.ts +11 -28
- package/dist/esm/v3/components/or-error/OrError.vue.d.ts +4 -8
- package/dist/esm/v3/components/or-error-tag-v3/OrErrorTag.vue.d.ts +4 -7
- package/dist/esm/v3/components/or-error-v3/OrError.vue.d.ts +9 -18
- package/dist/esm/v3/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +14 -35
- package/dist/esm/v3/components/or-expansion-panel-v3/index.js +1 -1
- package/dist/esm/v3/components/or-fab-v3/OrFab.vue.d.ts +8 -20
- package/dist/esm/v3/components/or-floating/OrFloating.vue.d.ts +15 -46
- package/dist/esm/v3/components/or-form-group-v3/OrFormGroup.vue.d.ts +10 -30
- package/dist/esm/v3/components/or-hint/OrHint.vue.d.ts +4 -8
- package/dist/esm/v3/components/or-hint-v3/OrHint.vue.d.ts +9 -18
- package/dist/esm/v3/components/or-icon/OrIcon.vue.d.ts +16 -44
- package/dist/esm/v3/components/or-icon-button-v2/OrIconButton.vue.d.ts +13 -43
- package/dist/esm/v3/components/or-icon-button-v2/partials/OrTooltipWrapper.vue.d.ts +8 -10
- package/dist/esm/v3/components/or-icon-button-v3/OrIconButton.vue.d.ts +16 -52
- package/dist/esm/v3/components/or-icon-v3/OrIcon.vue.d.ts +7 -18
- package/dist/esm/v3/components/or-inline-input-box-v3/OrInlineInputBox.vue.d.ts +7 -16
- package/dist/esm/v3/components/or-inline-input-v3/OrInlineInput.vue.d.ts +39 -83
- package/dist/esm/v3/components/or-inline-text-edit/OrInlineTextEdit.vue.d.ts +43 -95
- package/dist/esm/v3/components/or-inline-text-edit/index.js +1 -1
- package/dist/esm/v3/components/or-inline-textarea-v3/OrInlineTextarea.vue.d.ts +39 -79
- package/dist/esm/v3/components/or-input/OrInput.vue.d.ts +36 -87
- package/dist/esm/v3/components/or-input-box-v3/OrInputBox.vue.d.ts +7 -22
- package/dist/esm/v3/components/or-input-v3/OrInput.vue.d.ts +34 -85
- package/dist/esm/v3/components/or-label/OrLabel.vue.d.ts +9 -20
- package/dist/esm/v3/components/or-label-v3/OrLabel.vue.d.ts +9 -24
- package/dist/esm/v3/components/or-link-v3/OrLink.vue.d.ts +7 -24
- package/dist/esm/v3/components/or-list/OrList.vue.d.ts +21 -47
- package/dist/esm/v3/components/or-list-of-inputs/OrListOfInputs.vue.d.ts +11 -27
- package/dist/esm/v3/components/or-loader/OrLoader.vue.d.ts +10 -26
- package/dist/esm/v3/components/or-loader-v3/OrLoader.vue.d.ts +13 -34
- package/dist/esm/v3/components/or-menu-item-v3/OrMenuItem.vue.d.ts +13 -34
- package/dist/esm/v3/components/or-menu-v3/OrMenu.vue.d.ts +16 -43
- package/dist/esm/v3/components/or-modal/OrModal.vue.d.ts +14 -38
- package/dist/esm/v3/components/or-modal-v3/OrModal.vue.d.ts +15 -31
- package/dist/esm/v3/components/or-notification/OrNotification.vue.d.ts +9 -27
- package/dist/esm/v3/components/or-notification-v3/OrNotification.vue.d.ts +9 -20
- package/dist/esm/v3/components/or-number-input/OrNumberInput.vue.d.ts +24 -70
- package/dist/esm/v3/components/or-overflow-menu/OrOverflowMenu.vue.d.ts +13 -31
- package/dist/esm/v3/components/or-overflow-menu/partials/OrOverflowMenuItem.vue.d.ts +7 -23
- package/dist/esm/v3/components/or-overlay/OrOverlay.vue.d.ts +6 -16
- package/dist/esm/v3/components/or-overlay-v3/OrOverlay.vue.d.ts +7 -14
- package/dist/esm/v3/components/or-pagination-v3/OrPagination.vue.d.ts +27 -75
- package/dist/esm/v3/components/or-password/OrPassword.vue.d.ts +22 -63
- package/dist/esm/v3/components/or-popover-v3/OrPopover.vue.d.ts +27 -74
- package/dist/esm/v3/components/or-progress/OrProgress.vue.d.ts +20 -56
- package/dist/esm/v3/components/or-progress-v3/OrProgress.vue.d.ts +25 -62
- package/dist/esm/v3/components/or-radio/OrRadio.vue.d.ts +13 -35
- package/dist/esm/v3/components/or-radio-group/OrRadioGroup.vue.d.ts +9 -26
- package/dist/esm/v3/components/or-radio-group-v3/OrRadioGroup.vue.d.ts +6 -32
- package/dist/esm/v3/components/or-radio-group-v3/index.js +6 -87
- package/dist/esm/v3/components/or-radio-v3/OrRadio.vue.d.ts +21 -49
- package/dist/esm/v3/components/or-search/OrSearch.vue.d.ts +23 -65
- package/dist/esm/v3/components/or-search-v3/OrSearch.vue.d.ts +17 -41
- package/dist/esm/v3/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts +9 -25
- package/dist/esm/v3/components/or-segmented-control-v3/partials/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +8 -20
- package/dist/esm/v3/components/or-select/OrSelect.vue.d.ts +28 -77
- package/dist/esm/v3/components/or-select/partials/OrSelectContent.vue.d.ts +18 -49
- package/dist/esm/v3/components/or-select/partials/OrSelectContentEmpty.vue.d.ts +4 -16
- package/dist/esm/v3/components/or-select/partials/OrSelectContentOptions.vue.d.ts +13 -67
- package/dist/esm/v3/components/or-select/partials/OrSelectInput.vue.d.ts +16 -41
- package/dist/esm/v3/components/or-select/partials/OrSelectInputValue.vue.d.ts +16 -35
- package/dist/esm/v3/components/or-select/partials/OrSelectMain.vue.d.ts +24 -71
- package/dist/esm/v3/components/or-select/partials/OrSelectOption.vue.d.ts +7 -19
- package/dist/esm/v3/components/or-select/partials/OrSelectSearchOptions.vue.d.ts +11 -24
- package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +37 -115
- package/dist/esm/v3/components/or-select-v3/index.js +2 -2
- package/dist/esm/v3/components/or-sidebar/OrSidebar.vue.d.ts +14 -33
- package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +28 -63
- package/dist/esm/v3/components/or-sidebar-v3/index.js +1 -1
- package/dist/esm/v3/components/or-sidebar-v3/partials/or-sidebar-collapse-button/OrSidebarCollapseButton.vue.d.ts +10 -23
- package/dist/esm/v3/components/or-skeleton/or-skeleton-circle/OrSkeletonCircle.vue.d.ts +9 -20
- package/dist/esm/v3/components/or-skeleton/or-skeleton-rect/OrSkeletonRect.vue.d.ts +9 -22
- package/dist/esm/v3/components/or-skeleton/or-skeleton-text/OrSkeletonText.vue.d.ts +10 -26
- package/dist/esm/v3/components/or-skeleton-v3/or-skeleton-circle-v3/OrSkeletonCircle.vue.d.ts +13 -28
- package/dist/esm/v3/components/or-skeleton-v3/or-skeleton-rect-v3/OrSkeletonRect.vue.d.ts +11 -26
- package/dist/esm/v3/components/or-skeleton-v3/or-skeleton-text-v3/OrSkeletonText.vue.d.ts +16 -40
- package/dist/esm/v3/components/or-slider/OrSlider.vue.d.ts +35 -91
- package/dist/esm/v3/components/or-sort-header-v3/OrSortHeader.vue.d.ts +13 -25
- package/dist/esm/v3/components/or-stepper/OrStepper.vue.d.ts +16 -43
- package/dist/esm/v3/components/or-stepper/partials/OrStepperButtonOptions.vue.d.ts +4 -20
- package/dist/esm/v3/components/or-stepper/partials/OrStepperOptionHorizontal.vue.d.ts +4 -26
- package/dist/esm/v3/components/or-stepper/partials/OrStepperOptionVertical.vue.d.ts +4 -26
- package/dist/esm/v3/components/or-stepper/partials/OrStepperTitle.vue.d.ts +6 -22
- package/dist/esm/v3/components/or-stepper/partials/StatusIcon.vue.d.ts +6 -12
- package/dist/esm/v3/components/or-switch/OrSwitch.vue.d.ts +12 -33
- package/dist/esm/v3/components/or-switch-v3/OrSwitch.vue.d.ts +22 -53
- package/dist/esm/v3/components/or-tab/OrTab.vue.d.ts +9 -22
- package/dist/esm/v3/components/or-tab-header-item/OrTabHeaderItem.vue.d.ts +13 -29
- package/dist/esm/v3/components/or-tab-v3/OrTab.vue.d.ts +10 -17
- package/dist/esm/v3/components/or-tabs/OrTabs.vue.d.ts +4 -17
- package/dist/esm/v3/components/or-tabs-v3/OrTabs.vue.d.ts +24 -69
- package/dist/esm/v3/components/or-tag/OrTag.vue.d.ts +10 -27
- package/dist/esm/v3/components/or-tag-v3/OrTag.vue.d.ts +15 -26
- package/dist/esm/v3/components/or-tags-v3/OrTags.vue.d.ts +36 -0
- package/dist/esm/v3/components/or-tags-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-tags-v3/index.js +18 -0
- package/dist/esm/v3/components/or-tags-v3/styles.d.ts +4 -0
- package/dist/esm/v3/components/or-teleport/OrTeleport.vue3.vue.d.ts +4 -10
- package/dist/esm/v3/components/or-teleport-v3/OrTeleport.vue3.vue.d.ts +4 -10
- package/dist/esm/v3/components/or-text-v3/OrText.vue.d.ts +11 -24
- package/dist/esm/v3/components/or-textarea/OrTextarea.vue.d.ts +37 -85
- package/dist/esm/v3/components/or-textarea-v3/OrTextarea.vue.d.ts +32 -73
- package/dist/esm/v3/components/or-textbox/OrTextbox.vue.d.ts +55 -137
- package/dist/esm/v3/components/or-time-picker-v3/OrTimePicker.vue.d.ts +25 -79
- package/dist/esm/v3/components/or-toast/OrToast.vue.d.ts +11 -31
- package/dist/esm/v3/components/or-toast/or-toast-container/OrToastContainer.vue.d.ts +25 -55
- package/dist/esm/v3/components/or-toast-v3/OrToast.vue.d.ts +16 -38
- package/dist/esm/v3/components/or-toast-v3/or-toast-container-v3/OrToastContainer.vue.d.ts +24 -54
- package/dist/esm/v3/components/or-tooltip/OrTooltip.vue.d.ts +14 -33
- package/dist/esm/v3/components/or-tooltip/or-tooltip-content/OrTooltipContent.vue.d.ts +4 -10
- package/dist/esm/v3/components/or-tooltip-v3/OrTooltip.vue.d.ts +13 -37
- package/dist/esm/v3/directives/dropdown-close.d.ts +3 -1
- package/dist/esm/v3/directives/dropdown-open.d.ts +3 -1
- package/dist/esm/v3/hooks/useResponsive/useResponsive.d.ts +2 -2
- package/dist/esm/v3/index.js +10 -30
- package/package.json +5 -25
- package/src/components/index.ts +4 -1
- package/src/components/or-confirm/OrConfirm.vue +1 -1
- package/src/components/or-expansion-panel-v3/styles.ts +4 -1
- package/src/components/or-inline-text-edit/OrInlineTextEdit.vue +6 -6
- package/src/components/or-sidebar-v3/styles.ts +1 -1
- package/src/components/or-tag-v3/OrTag.vue +3 -2
- package/src/components/or-tags-v3/OrTags.docs.mdx +7 -0
- package/src/components/or-tags-v3/OrTags.stories3.ts +101 -0
- package/src/components/or-tags-v3/OrTags.vue +129 -0
- package/src/components/or-tags-v3/index.ts +1 -0
- package/src/components/or-tags-v3/styles.ts +41 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -2178
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -220
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +0 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +0 -70
- package/dist/bundled/v2/components/OrRichTextEditorV3/props.d.ts +0 -4
- package/dist/bundled/v2/components/OrRichTextEditorV3/props.js +0 -7
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +0 -6
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +0 -38
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -46
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.js +0 -1
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +0 -5
- package/dist/bundled/v2/index-1182caa8.js +0 -9633
- package/dist/bundled/v2/index-85c2efe8.js +0 -7122
- package/dist/bundled/v2/index-d92d0b48.js +0 -3805
- package/dist/bundled/v2/index.es-3f39f316.js +0 -115
- package/dist/bundled/v2/markdown-d43767b0.js +0 -17980
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-7e29b3d0.js +0 -237
- package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-2c009ee0.js +0 -108
- package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-8bc72542.js +0 -1869
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +0 -283
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +0 -220
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +0 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +0 -86
- package/dist/bundled/v3/components/OrRichTextEditorV3/props.d.ts +0 -4
- package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +0 -7
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +0 -6
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +0 -38
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +0 -46
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +0 -184
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +0 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +0 -5
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +0 -24
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +0 -190
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +0 -19
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.js +0 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +0 -3
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +0 -5
- package/dist/bundled/v3/index-1182caa8.js +0 -9633
- package/dist/bundled/v3/index-85c2efe8.js +0 -7122
- package/dist/bundled/v3/index.es-3f39f316.js +0 -115
- package/dist/bundled/v3/markdown-d43767b0.js +0 -17980
- package/dist/bundled/v3/useFocusTrap-48767a70.js +0 -1348
- package/dist/esm/v2/OrInlineTextEdit-a129aaf1.js +0 -400
- package/dist/esm/v2/OrRichTextEditor-95d1070d.js +0 -901
- package/dist/esm/v2/codemirrorView-be2c7423.js +0 -353
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -220
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +0 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +0 -59
- package/dist/esm/v2/components/or-rich-text-editor-v3/props.d.ts +0 -4
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -6
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
- package/dist/esm/v2/flattenDeep-fe0af413.js +0 -6
- package/dist/esm/v3/OrInlineTextEdit-4f4ecba4.js +0 -356
- package/dist/esm/v3/OrRichTextEditor-bdee1f41.js +0 -834
- package/dist/esm/v3/codemirrorView-be2c7423.js +0 -353
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +0 -220
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +0 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +0 -57
- package/dist/esm/v3/components/or-rich-text-editor-v3/props.d.ts +0 -4
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -6
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +0 -3
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +0 -27
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +0 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +0 -7
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +0 -24
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +0 -19
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +0 -3
- package/dist/esm/v3/flattenDeep-fe0af413.js +0 -6
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.docs.mdx +0 -7
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +0 -142
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +0 -749
- package/src/components/or-rich-text-editor-v3/index.ts +0 -1
- package/src/components/or-rich-text-editor-v3/props.ts +0 -4
- package/src/components/or-rich-text-editor-v3/styles.ts +0 -56
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +0 -40
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +0 -254
- package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +0 -1
- package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +0 -213
- package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +0 -22
- package/src/components/or-rich-text-editor-v3/utils/markdown.ts +0 -120
- package/dist/bundled/v2/{index-f6664cb1.js → index-968c331a.js} +0 -0
- package/dist/bundled/v3/{OrCheckboxTree.vue_vue_type_script_lang-528dd4d5.js → OrCheckboxTree.vue_vue_type_script_lang-46436cf3.js} +1 -1
- /package/dist/bundled/v3/{OrExpansionPanel.vue_vue_type_script_lang-f1b6ff7d.js → OrExpansionPanel.vue_vue_type_script_lang-d4ed6199.js} +0 -0
- /package/dist/bundled/v3/{OrSidebar.vue_vue_type_script_lang-d7f700de.js → OrSidebar.vue_vue_type_script_lang-5723e223.js} +0 -0
- /package/dist/bundled/v3/{index-f6664cb1.js → index-968c331a.js} +0 -0
|
@@ -1,3941 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import '../../index.es-3f39f316.js';
|
|
5
|
-
|
|
6
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
7
|
-
const scriptText = 54,
|
|
8
|
-
StartCloseScriptTag = 1,
|
|
9
|
-
styleText = 55,
|
|
10
|
-
StartCloseStyleTag = 2,
|
|
11
|
-
textareaText = 56,
|
|
12
|
-
StartCloseTextareaTag = 3,
|
|
13
|
-
EndTag = 4,
|
|
14
|
-
SelfClosingEndTag = 5,
|
|
15
|
-
StartTag = 6,
|
|
16
|
-
StartScriptTag = 7,
|
|
17
|
-
StartStyleTag = 8,
|
|
18
|
-
StartTextareaTag = 9,
|
|
19
|
-
StartSelfClosingTag = 10,
|
|
20
|
-
StartCloseTag = 11,
|
|
21
|
-
NoMatchStartCloseTag = 12,
|
|
22
|
-
MismatchedStartCloseTag = 13,
|
|
23
|
-
missingCloseTag = 57,
|
|
24
|
-
IncompleteCloseTag = 14,
|
|
25
|
-
commentContent$1 = 58,
|
|
26
|
-
Element$1 = 20,
|
|
27
|
-
TagName = 22,
|
|
28
|
-
Attribute = 23,
|
|
29
|
-
AttributeName = 24,
|
|
30
|
-
AttributeValue = 26,
|
|
31
|
-
UnquotedAttributeValue = 27,
|
|
32
|
-
ScriptText = 28,
|
|
33
|
-
StyleText = 31,
|
|
34
|
-
TextareaText = 34,
|
|
35
|
-
OpenTag = 36,
|
|
36
|
-
CloseTag = 37,
|
|
37
|
-
Dialect_noMatch = 0,
|
|
38
|
-
Dialect_selfClosing = 1;
|
|
39
|
-
|
|
40
|
-
/* Hand-written tokenizers for HTML. */
|
|
41
|
-
|
|
42
|
-
const selfClosers = {
|
|
43
|
-
area: true,
|
|
44
|
-
base: true,
|
|
45
|
-
br: true,
|
|
46
|
-
col: true,
|
|
47
|
-
command: true,
|
|
48
|
-
embed: true,
|
|
49
|
-
frame: true,
|
|
50
|
-
hr: true,
|
|
51
|
-
img: true,
|
|
52
|
-
input: true,
|
|
53
|
-
keygen: true,
|
|
54
|
-
link: true,
|
|
55
|
-
meta: true,
|
|
56
|
-
param: true,
|
|
57
|
-
source: true,
|
|
58
|
-
track: true,
|
|
59
|
-
wbr: true,
|
|
60
|
-
menuitem: true
|
|
61
|
-
};
|
|
62
|
-
const implicitlyClosed = {
|
|
63
|
-
dd: true,
|
|
64
|
-
li: true,
|
|
65
|
-
optgroup: true,
|
|
66
|
-
option: true,
|
|
67
|
-
p: true,
|
|
68
|
-
rp: true,
|
|
69
|
-
rt: true,
|
|
70
|
-
tbody: true,
|
|
71
|
-
td: true,
|
|
72
|
-
tfoot: true,
|
|
73
|
-
th: true,
|
|
74
|
-
tr: true
|
|
75
|
-
};
|
|
76
|
-
const closeOnOpen = {
|
|
77
|
-
dd: {
|
|
78
|
-
dd: true,
|
|
79
|
-
dt: true
|
|
80
|
-
},
|
|
81
|
-
dt: {
|
|
82
|
-
dd: true,
|
|
83
|
-
dt: true
|
|
84
|
-
},
|
|
85
|
-
li: {
|
|
86
|
-
li: true
|
|
87
|
-
},
|
|
88
|
-
option: {
|
|
89
|
-
option: true,
|
|
90
|
-
optgroup: true
|
|
91
|
-
},
|
|
92
|
-
optgroup: {
|
|
93
|
-
optgroup: true
|
|
94
|
-
},
|
|
95
|
-
p: {
|
|
96
|
-
address: true,
|
|
97
|
-
article: true,
|
|
98
|
-
aside: true,
|
|
99
|
-
blockquote: true,
|
|
100
|
-
dir: true,
|
|
101
|
-
div: true,
|
|
102
|
-
dl: true,
|
|
103
|
-
fieldset: true,
|
|
104
|
-
footer: true,
|
|
105
|
-
form: true,
|
|
106
|
-
h1: true,
|
|
107
|
-
h2: true,
|
|
108
|
-
h3: true,
|
|
109
|
-
h4: true,
|
|
110
|
-
h5: true,
|
|
111
|
-
h6: true,
|
|
112
|
-
header: true,
|
|
113
|
-
hgroup: true,
|
|
114
|
-
hr: true,
|
|
115
|
-
menu: true,
|
|
116
|
-
nav: true,
|
|
117
|
-
ol: true,
|
|
118
|
-
p: true,
|
|
119
|
-
pre: true,
|
|
120
|
-
section: true,
|
|
121
|
-
table: true,
|
|
122
|
-
ul: true
|
|
123
|
-
},
|
|
124
|
-
rp: {
|
|
125
|
-
rp: true,
|
|
126
|
-
rt: true
|
|
127
|
-
},
|
|
128
|
-
rt: {
|
|
129
|
-
rp: true,
|
|
130
|
-
rt: true
|
|
131
|
-
},
|
|
132
|
-
tbody: {
|
|
133
|
-
tbody: true,
|
|
134
|
-
tfoot: true
|
|
135
|
-
},
|
|
136
|
-
td: {
|
|
137
|
-
td: true,
|
|
138
|
-
th: true
|
|
139
|
-
},
|
|
140
|
-
tfoot: {
|
|
141
|
-
tbody: true
|
|
142
|
-
},
|
|
143
|
-
th: {
|
|
144
|
-
td: true,
|
|
145
|
-
th: true
|
|
146
|
-
},
|
|
147
|
-
thead: {
|
|
148
|
-
tbody: true,
|
|
149
|
-
tfoot: true
|
|
150
|
-
},
|
|
151
|
-
tr: {
|
|
152
|
-
tr: true
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
function nameChar(ch) {
|
|
156
|
-
return ch == 45 || ch == 46 || ch == 58 || ch >= 65 && ch <= 90 || ch == 95 || ch >= 97 && ch <= 122 || ch >= 161;
|
|
157
|
-
}
|
|
158
|
-
function isSpace(ch) {
|
|
159
|
-
return ch == 9 || ch == 10 || ch == 13 || ch == 32;
|
|
160
|
-
}
|
|
161
|
-
let cachedName = null,
|
|
162
|
-
cachedInput = null,
|
|
163
|
-
cachedPos = 0;
|
|
164
|
-
function tagNameAfter(input, offset) {
|
|
165
|
-
let pos = input.pos + offset;
|
|
166
|
-
if (cachedPos == pos && cachedInput == input) return cachedName;
|
|
167
|
-
let next = input.peek(offset);
|
|
168
|
-
while (isSpace(next)) next = input.peek(++offset);
|
|
169
|
-
let name = "";
|
|
170
|
-
for (;;) {
|
|
171
|
-
if (!nameChar(next)) break;
|
|
172
|
-
name += String.fromCharCode(next);
|
|
173
|
-
next = input.peek(++offset);
|
|
174
|
-
}
|
|
175
|
-
// Undefined to signal there's a <? or <!, null for just missing
|
|
176
|
-
cachedInput = input;
|
|
177
|
-
cachedPos = pos;
|
|
178
|
-
return cachedName = name ? name.toLowerCase() : next == question || next == bang ? undefined : null;
|
|
179
|
-
}
|
|
180
|
-
const lessThan = 60,
|
|
181
|
-
greaterThan = 62,
|
|
182
|
-
slash = 47,
|
|
183
|
-
question = 63,
|
|
184
|
-
bang = 33,
|
|
185
|
-
dash$1 = 45;
|
|
186
|
-
function ElementContext(name, parent) {
|
|
187
|
-
this.name = name;
|
|
188
|
-
this.parent = parent;
|
|
189
|
-
this.hash = parent ? parent.hash : 0;
|
|
190
|
-
for (let i = 0; i < name.length; i++) this.hash += (this.hash << 4) + name.charCodeAt(i) + (name.charCodeAt(i) << 8);
|
|
191
|
-
}
|
|
192
|
-
const startTagTerms = [StartTag, StartSelfClosingTag, StartScriptTag, StartStyleTag, StartTextareaTag];
|
|
193
|
-
const elementContext = new ContextTracker({
|
|
194
|
-
start: null,
|
|
195
|
-
shift(context, term, stack, input) {
|
|
196
|
-
return startTagTerms.indexOf(term) > -1 ? new ElementContext(tagNameAfter(input, 1) || "", context) : context;
|
|
197
|
-
},
|
|
198
|
-
reduce(context, term) {
|
|
199
|
-
return term == Element$1 && context ? context.parent : context;
|
|
200
|
-
},
|
|
201
|
-
reuse(context, node, stack, input) {
|
|
202
|
-
let type = node.type.id;
|
|
203
|
-
return type == StartTag || type == OpenTag ? new ElementContext(tagNameAfter(input, 1) || "", context) : context;
|
|
204
|
-
},
|
|
205
|
-
hash(context) {
|
|
206
|
-
return context ? context.hash : 0;
|
|
207
|
-
},
|
|
208
|
-
strict: false
|
|
209
|
-
});
|
|
210
|
-
const tagStart = new ExternalTokenizer((input, stack) => {
|
|
211
|
-
if (input.next != lessThan) {
|
|
212
|
-
// End of file, close any open tags
|
|
213
|
-
if (input.next < 0 && stack.context) input.acceptToken(missingCloseTag);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
input.advance();
|
|
217
|
-
let close = input.next == slash;
|
|
218
|
-
if (close) input.advance();
|
|
219
|
-
let name = tagNameAfter(input, 0);
|
|
220
|
-
if (name === undefined) return;
|
|
221
|
-
if (!name) return input.acceptToken(close ? IncompleteCloseTag : StartTag);
|
|
222
|
-
let parent = stack.context ? stack.context.name : null;
|
|
223
|
-
if (close) {
|
|
224
|
-
if (name == parent) return input.acceptToken(StartCloseTag);
|
|
225
|
-
if (parent && implicitlyClosed[parent]) return input.acceptToken(missingCloseTag, -2);
|
|
226
|
-
if (stack.dialectEnabled(Dialect_noMatch)) return input.acceptToken(NoMatchStartCloseTag);
|
|
227
|
-
for (let cx = stack.context; cx; cx = cx.parent) if (cx.name == name) return;
|
|
228
|
-
input.acceptToken(MismatchedStartCloseTag);
|
|
229
|
-
} else {
|
|
230
|
-
if (name == "script") return input.acceptToken(StartScriptTag);
|
|
231
|
-
if (name == "style") return input.acceptToken(StartStyleTag);
|
|
232
|
-
if (name == "textarea") return input.acceptToken(StartTextareaTag);
|
|
233
|
-
if (selfClosers.hasOwnProperty(name)) return input.acceptToken(StartSelfClosingTag);
|
|
234
|
-
if (parent && closeOnOpen[parent] && closeOnOpen[parent][name]) input.acceptToken(missingCloseTag, -1);else input.acceptToken(StartTag);
|
|
235
|
-
}
|
|
236
|
-
}, {
|
|
237
|
-
contextual: true
|
|
238
|
-
});
|
|
239
|
-
const commentContent = new ExternalTokenizer(input => {
|
|
240
|
-
for (let dashes = 0, i = 0;; i++) {
|
|
241
|
-
if (input.next < 0) {
|
|
242
|
-
if (i) input.acceptToken(commentContent$1);
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
if (input.next == dash$1) {
|
|
246
|
-
dashes++;
|
|
247
|
-
} else if (input.next == greaterThan && dashes >= 2) {
|
|
248
|
-
if (i > 3) input.acceptToken(commentContent$1, -2);
|
|
249
|
-
break;
|
|
250
|
-
} else {
|
|
251
|
-
dashes = 0;
|
|
252
|
-
}
|
|
253
|
-
input.advance();
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
function inForeignElement(context) {
|
|
257
|
-
for (; context; context = context.parent) if (context.name == "svg" || context.name == "math") return true;
|
|
258
|
-
return false;
|
|
259
|
-
}
|
|
260
|
-
const endTag = new ExternalTokenizer((input, stack) => {
|
|
261
|
-
if (input.next == slash && input.peek(1) == greaterThan) {
|
|
262
|
-
let selfClosing = stack.dialectEnabled(Dialect_selfClosing) || inForeignElement(stack.context);
|
|
263
|
-
input.acceptToken(selfClosing ? SelfClosingEndTag : EndTag, 2);
|
|
264
|
-
} else if (input.next == greaterThan) {
|
|
265
|
-
input.acceptToken(EndTag, 1);
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
function contentTokenizer(tag, textToken, endToken) {
|
|
269
|
-
let lastState = 2 + tag.length;
|
|
270
|
-
return new ExternalTokenizer(input => {
|
|
271
|
-
// state means:
|
|
272
|
-
// - 0 nothing matched
|
|
273
|
-
// - 1 '<' matched
|
|
274
|
-
// - 2 '</' + possibly whitespace matched
|
|
275
|
-
// - 3-(1+tag.length) part of the tag matched
|
|
276
|
-
// - lastState whole tag + possibly whitespace matched
|
|
277
|
-
for (let state = 0, matchedLen = 0, i = 0;; i++) {
|
|
278
|
-
if (input.next < 0) {
|
|
279
|
-
if (i) input.acceptToken(textToken);
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
if (state == 0 && input.next == lessThan || state == 1 && input.next == slash || state >= 2 && state < lastState && input.next == tag.charCodeAt(state - 2)) {
|
|
283
|
-
state++;
|
|
284
|
-
matchedLen++;
|
|
285
|
-
} else if ((state == 2 || state == lastState) && isSpace(input.next)) {
|
|
286
|
-
matchedLen++;
|
|
287
|
-
} else if (state == lastState && input.next == greaterThan) {
|
|
288
|
-
if (i > matchedLen) input.acceptToken(textToken, -matchedLen);else input.acceptToken(endToken, -(matchedLen - 2));
|
|
289
|
-
break;
|
|
290
|
-
} else if ((input.next == 10 /* '\n' */ || input.next == 13 /* '\r' */) && i) {
|
|
291
|
-
input.acceptToken(textToken, 1);
|
|
292
|
-
break;
|
|
293
|
-
} else {
|
|
294
|
-
state = matchedLen = 0;
|
|
295
|
-
}
|
|
296
|
-
input.advance();
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
const scriptTokens = contentTokenizer("script", scriptText, StartCloseScriptTag);
|
|
301
|
-
const styleTokens = contentTokenizer("style", styleText, StartCloseStyleTag);
|
|
302
|
-
const textareaTokens = contentTokenizer("textarea", textareaText, StartCloseTextareaTag);
|
|
303
|
-
const htmlHighlighting = styleTags({
|
|
304
|
-
"Text RawText": tags$1.content,
|
|
305
|
-
"StartTag StartCloseTag SelfClosingEndTag EndTag": tags$1.angleBracket,
|
|
306
|
-
TagName: tags$1.tagName,
|
|
307
|
-
"MismatchedCloseTag/TagName": [tags$1.tagName, tags$1.invalid],
|
|
308
|
-
AttributeName: tags$1.attributeName,
|
|
309
|
-
"AttributeValue UnquotedAttributeValue": tags$1.attributeValue,
|
|
310
|
-
Is: tags$1.definitionOperator,
|
|
311
|
-
"EntityReference CharacterReference": tags$1.character,
|
|
312
|
-
Comment: tags$1.blockComment,
|
|
313
|
-
ProcessingInst: tags$1.processingInstruction,
|
|
314
|
-
DoctypeDecl: tags$1.documentMeta
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
318
|
-
const parser$3 = LRParser.deserialize({
|
|
319
|
-
version: 14,
|
|
320
|
-
states: ",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%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^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",
|
|
322
|
-
goto: "%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",
|
|
323
|
-
nodeNames: "⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",
|
|
324
|
-
maxTerm: 67,
|
|
325
|
-
context: elementContext,
|
|
326
|
-
nodeProps: [["closedBy", -10, 1, 2, 3, 7, 8, 9, 10, 11, 12, 13, "EndTag", 6, "EndTag SelfClosingEndTag", -4, 21, 30, 33, 36, "CloseTag"], ["openedBy", 4, "StartTag StartCloseTag", 5, "StartTag", -4, 29, 32, 35, 37, "OpenTag"], ["group", -9, 14, 17, 18, 19, 20, 39, 40, 41, 42, "Entity", 16, "Entity TextContent", -3, 28, 31, 34, "TextContent Entity"]],
|
|
327
|
-
propSources: [htmlHighlighting],
|
|
328
|
-
skippedNodes: [0],
|
|
329
|
-
repeatNodeCount: 9,
|
|
330
|
-
tokenData: "#%g!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs4ysv-_vw5iwxJ^x}-_}!OKP!O!P-_!P!Q$q!Q![-_![!]!!O!]!^-_!^!_!&W!_!`#$o!`!a&X!a!c-_!c!}!!O!}#R-_#R#S!!O#S#T3V#T#o!!O#o#s-_#s$f$q$f%W-_%W%o!!O%o%p-_%p&a!!O&a&b-_&b1p!!O1p4U-_4U4d!!O4d4e-_4e$IS!!O$IS$I`-_$I`$Ib!!O$Ib$Kh-_$Kh%#t!!O%#t&/x-_&/x&Et!!O&Et&FV-_&FV;'S!!O;'S;:j!&Q;:j;=`4s<%l?&r-_?&r?Ah!!O?Ah?BY$q?BY?Mn!!O?MnO$q!Z$|c`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bX`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UV`P!cpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pT`POv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!cpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`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[scriptTokens, styleTokens, textareaTokens, endTag, tagStart, commentContent, 0, 1, 2, 3, 4, 5],
|
|
332
|
-
topRules: {
|
|
333
|
-
"Document": [0, 15]
|
|
334
|
-
},
|
|
335
|
-
dialects: {
|
|
336
|
-
noMatch: 0,
|
|
337
|
-
selfClosing: 485
|
|
338
|
-
},
|
|
339
|
-
tokenPrec: 487
|
|
340
|
-
});
|
|
341
|
-
function getAttrs(openTag, input) {
|
|
342
|
-
let attrs = Object.create(null);
|
|
343
|
-
for (let att of openTag.getChildren(Attribute)) {
|
|
344
|
-
let name = att.getChild(AttributeName),
|
|
345
|
-
value = att.getChild(AttributeValue) || att.getChild(UnquotedAttributeValue);
|
|
346
|
-
if (name) attrs[input.read(name.from, name.to)] = !value ? "" : value.type.id == AttributeValue ? input.read(value.from + 1, value.to - 1) : input.read(value.from, value.to);
|
|
347
|
-
}
|
|
348
|
-
return attrs;
|
|
349
|
-
}
|
|
350
|
-
function findTagName(openTag, input) {
|
|
351
|
-
let tagNameNode = openTag.getChild(TagName);
|
|
352
|
-
return tagNameNode ? input.read(tagNameNode.from, tagNameNode.to) : " ";
|
|
353
|
-
}
|
|
354
|
-
function maybeNest(node, input, tags) {
|
|
355
|
-
let attrs;
|
|
356
|
-
for (let tag of tags) {
|
|
357
|
-
if (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(node.node.parent.firstChild, input)))) return {
|
|
358
|
-
parser: tag.parser
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// tags?: {
|
|
365
|
-
// tag: string,
|
|
366
|
-
// attrs?: ({[attr: string]: string}) => boolean,
|
|
367
|
-
// parser: Parser
|
|
368
|
-
// }[]
|
|
369
|
-
// attributes?: {
|
|
370
|
-
// name: string,
|
|
371
|
-
// tagName?: string,
|
|
372
|
-
// parser: Parser
|
|
373
|
-
// }[]
|
|
374
|
-
|
|
375
|
-
function configureNesting() {
|
|
376
|
-
let tags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
377
|
-
let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
378
|
-
let script = [],
|
|
379
|
-
style = [],
|
|
380
|
-
textarea = [],
|
|
381
|
-
other = [];
|
|
382
|
-
for (let tag of tags) {
|
|
383
|
-
let array = tag.tag == "script" ? script : tag.tag == "style" ? style : tag.tag == "textarea" ? textarea : other;
|
|
384
|
-
array.push(tag);
|
|
385
|
-
}
|
|
386
|
-
let attrs = attributes.length ? Object.create(null) : null;
|
|
387
|
-
for (let attr of attributes) (attrs[attr.name] || (attrs[attr.name] = [])).push(attr);
|
|
388
|
-
return parseMixed((node, input) => {
|
|
389
|
-
let id = node.type.id;
|
|
390
|
-
if (id == ScriptText) return maybeNest(node, input, script);
|
|
391
|
-
if (id == StyleText) return maybeNest(node, input, style);
|
|
392
|
-
if (id == TextareaText) return maybeNest(node, input, textarea);
|
|
393
|
-
if (id == Element$1 && other.length) {
|
|
394
|
-
let n = node.node,
|
|
395
|
-
open = n.firstChild,
|
|
396
|
-
tagName = open && findTagName(open, input),
|
|
397
|
-
attrs;
|
|
398
|
-
if (tagName) for (let tag of other) {
|
|
399
|
-
if (tag.tag == tagName && (!tag.attrs || tag.attrs(attrs || (attrs = getAttrs(n, input))))) {
|
|
400
|
-
let close = n.lastChild;
|
|
401
|
-
return {
|
|
402
|
-
parser: tag.parser,
|
|
403
|
-
overlay: [{
|
|
404
|
-
from: open.to,
|
|
405
|
-
to: close.type.id == CloseTag ? close.from : n.to
|
|
406
|
-
}]
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
if (attrs && id == Attribute) {
|
|
412
|
-
let n = node.node,
|
|
413
|
-
nameNode;
|
|
414
|
-
if (nameNode = n.firstChild) {
|
|
415
|
-
let matches = attrs[input.read(nameNode.from, nameNode.to)];
|
|
416
|
-
if (matches) for (let attr of matches) {
|
|
417
|
-
if (attr.tagName && attr.tagName != findTagName(n.parent, input)) continue;
|
|
418
|
-
let value = n.lastChild;
|
|
419
|
-
if (value.type.id == AttributeValue) {
|
|
420
|
-
let from = value.from + 1;
|
|
421
|
-
let last = value.lastChild,
|
|
422
|
-
to = value.to - (last && last.isError ? 0 : 1);
|
|
423
|
-
if (to > from) return {
|
|
424
|
-
parser: attr.parser,
|
|
425
|
-
overlay: [{
|
|
426
|
-
from,
|
|
427
|
-
to
|
|
428
|
-
}]
|
|
429
|
-
};
|
|
430
|
-
} else if (value.type.id == UnquotedAttributeValue) {
|
|
431
|
-
return {
|
|
432
|
-
parser: attr.parser,
|
|
433
|
-
overlay: [{
|
|
434
|
-
from: value.from,
|
|
435
|
-
to: value.to
|
|
436
|
-
}]
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
return null;
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
447
|
-
const descendantOp = 94,
|
|
448
|
-
Unit = 1,
|
|
449
|
-
callee = 95,
|
|
450
|
-
identifier$2 = 96,
|
|
451
|
-
VariableName = 2;
|
|
452
|
-
|
|
453
|
-
/* Hand-written tokenizers for CSS tokens that can't be
|
|
454
|
-
expressed by Lezer's built-in tokenizer. */
|
|
455
|
-
|
|
456
|
-
const space$1 = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288];
|
|
457
|
-
const colon = 58,
|
|
458
|
-
parenL = 40,
|
|
459
|
-
underscore = 95,
|
|
460
|
-
bracketL = 91,
|
|
461
|
-
dash = 45,
|
|
462
|
-
period = 46,
|
|
463
|
-
hash = 35,
|
|
464
|
-
percent = 37;
|
|
465
|
-
function isAlpha(ch) {
|
|
466
|
-
return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 161;
|
|
467
|
-
}
|
|
468
|
-
function isDigit(ch) {
|
|
469
|
-
return ch >= 48 && ch <= 57;
|
|
470
|
-
}
|
|
471
|
-
const identifiers = new ExternalTokenizer((input, stack) => {
|
|
472
|
-
for (let inside = false, dashes = 0, i = 0;; i++) {
|
|
473
|
-
let {
|
|
474
|
-
next
|
|
475
|
-
} = input;
|
|
476
|
-
if (isAlpha(next) || next == dash || next == underscore || inside && isDigit(next)) {
|
|
477
|
-
if (!inside && (next != dash || i > 0)) inside = true;
|
|
478
|
-
if (dashes === i && next == dash) dashes++;
|
|
479
|
-
input.advance();
|
|
480
|
-
} else {
|
|
481
|
-
if (inside) input.acceptToken(next == parenL ? callee : dashes == 2 && stack.canShift(VariableName) ? VariableName : identifier$2);
|
|
482
|
-
break;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
const descendant = new ExternalTokenizer(input => {
|
|
487
|
-
if (space$1.includes(input.peek(-1))) {
|
|
488
|
-
let {
|
|
489
|
-
next
|
|
490
|
-
} = input;
|
|
491
|
-
if (isAlpha(next) || next == underscore || next == hash || next == period || next == bracketL || next == colon || next == dash) input.acceptToken(descendantOp);
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
|
-
const unitToken = new ExternalTokenizer(input => {
|
|
495
|
-
if (!space$1.includes(input.peek(-1))) {
|
|
496
|
-
let {
|
|
497
|
-
next
|
|
498
|
-
} = input;
|
|
499
|
-
if (next == percent) {
|
|
500
|
-
input.advance();
|
|
501
|
-
input.acceptToken(Unit);
|
|
502
|
-
}
|
|
503
|
-
if (isAlpha(next)) {
|
|
504
|
-
do {
|
|
505
|
-
input.advance();
|
|
506
|
-
} while (isAlpha(input.next));
|
|
507
|
-
input.acceptToken(Unit);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
const cssHighlighting = styleTags({
|
|
512
|
-
"AtKeyword import charset namespace keyframes media supports": tags$1.definitionKeyword,
|
|
513
|
-
"from to selector": tags$1.keyword,
|
|
514
|
-
NamespaceName: tags$1.namespace,
|
|
515
|
-
KeyframeName: tags$1.labelName,
|
|
516
|
-
TagName: tags$1.tagName,
|
|
517
|
-
ClassName: tags$1.className,
|
|
518
|
-
PseudoClassName: tags$1.constant(tags$1.className),
|
|
519
|
-
IdName: tags$1.labelName,
|
|
520
|
-
"FeatureName PropertyName": tags$1.propertyName,
|
|
521
|
-
AttributeName: tags$1.attributeName,
|
|
522
|
-
NumberLiteral: tags$1.number,
|
|
523
|
-
KeywordQuery: tags$1.keyword,
|
|
524
|
-
UnaryQueryOp: tags$1.operatorKeyword,
|
|
525
|
-
"CallTag ValueName": tags$1.atom,
|
|
526
|
-
VariableName: tags$1.variableName,
|
|
527
|
-
Callee: tags$1.operatorKeyword,
|
|
528
|
-
Unit: tags$1.unit,
|
|
529
|
-
"UniversalSelector NestingSelector": tags$1.definitionOperator,
|
|
530
|
-
MatchOp: tags$1.compareOperator,
|
|
531
|
-
"ChildOp SiblingOp, LogicOp": tags$1.logicOperator,
|
|
532
|
-
BinOp: tags$1.arithmeticOperator,
|
|
533
|
-
Important: tags$1.modifier,
|
|
534
|
-
Comment: tags$1.blockComment,
|
|
535
|
-
ParenthesizedContent: tags$1.special(tags$1.name),
|
|
536
|
-
ColorLiteral: tags$1.color,
|
|
537
|
-
StringLiteral: tags$1.string,
|
|
538
|
-
":": tags$1.punctuation,
|
|
539
|
-
"PseudoOp #": tags$1.derefOperator,
|
|
540
|
-
"; ,": tags$1.separator,
|
|
541
|
-
"( )": tags$1.paren,
|
|
542
|
-
"[ ]": tags$1.squareBracket,
|
|
543
|
-
"{ }": tags$1.brace
|
|
544
|
-
});
|
|
545
|
-
|
|
546
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
547
|
-
const spec_callee = {
|
|
548
|
-
__proto__: null,
|
|
549
|
-
lang: 32,
|
|
550
|
-
"nth-child": 32,
|
|
551
|
-
"nth-last-child": 32,
|
|
552
|
-
"nth-of-type": 32,
|
|
553
|
-
"nth-last-of-type": 32,
|
|
554
|
-
dir: 32,
|
|
555
|
-
"host-context": 32,
|
|
556
|
-
url: 60,
|
|
557
|
-
"url-prefix": 60,
|
|
558
|
-
domain: 60,
|
|
559
|
-
regexp: 60,
|
|
560
|
-
selector: 134
|
|
561
|
-
};
|
|
562
|
-
const spec_AtKeyword = {
|
|
563
|
-
__proto__: null,
|
|
564
|
-
"@import": 114,
|
|
565
|
-
"@media": 138,
|
|
566
|
-
"@charset": 142,
|
|
567
|
-
"@namespace": 146,
|
|
568
|
-
"@keyframes": 152,
|
|
569
|
-
"@supports": 164
|
|
570
|
-
};
|
|
571
|
-
const spec_identifier = {
|
|
572
|
-
__proto__: null,
|
|
573
|
-
not: 128,
|
|
574
|
-
only: 128,
|
|
575
|
-
from: 158,
|
|
576
|
-
to: 160
|
|
577
|
-
};
|
|
578
|
-
const parser$2 = LRParser.deserialize({
|
|
579
|
-
version: 14,
|
|
580
|
-
states: "7WQYQ[OOO#_Q[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO#fQ[O'#CfO$YQXO'#CaO$aQ[O'#ChO$lQ[O'#DPO$qQ[O'#DTOOQP'#Ed'#EdO$vQdO'#DeO%bQ[O'#DrO$vQdO'#DtO%sQ[O'#DvO&OQ[O'#DyO&TQ[O'#EPO&cQ[O'#EROOQS'#Ec'#EcOOQS'#ET'#ETQYQ[OOO&jQXO'#CdO'_QWO'#DaO'dQWO'#EjO'oQ[O'#EjQOQWOOOOQP'#Cg'#CgOOQP,59Q,59QO#fQ[O,59QO'yQ[O'#EWO(eQWO,58{O(mQ[O,59SO$lQ[O,59kO$qQ[O,59oO'yQ[O,59sO'yQ[O,59uO'yQ[O,59vO(xQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)PQWO,59SO)UQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)ZQ`O,59oOOQS'#Cp'#CpO$vQdO'#CqO)cQv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P+h+k+q+z_aOPcgt!j#hkXOPcglqrst!j!z#]#hkROPcglqrst!j!z#]#hQjSR!mkQxUR!qnQ!qzQ#S!UR#k!sq!WY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mp!WY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mT$R#b$Sq!UY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mp!WY[!Q!i!{!}#Q#f#m#r#y$V$W$_$d$mQ!b]R#a!cQyUR!rnQ!qyR#k!rQ|VR!toQ!OWR!upQuTQ!pmQ#^!_Q#d!fQ#e!gR$f$RSfPtQ!lgQ#g!jR$Y#hZePgt!j#ha!^Z_`!S!Y![#X#YR#V!YR!c]R!e^R#c!eQcOSgPtU!hcg#hR#h!jQ#r!{U$^#r$d$mQ$d#yR$m$_Q$`#rR$n$`QmTS!om$[R$[#oQ$W#fR$j$WQ!kfS#i!k#jR#j!lQ#Z!ZR#}#ZQ$S#bR$g$S_bOPcgt!j#h^TOPcgt!j#hQ!nlQ!vqQ!wrQ!xsQ#o!zR$O#]R#s!{Q!SYQ!`[Q#O!QQ#f!i[#q!{#r#y$_$d$mQ#t!}Q#v#QS$U#f$WQ$Z#mR$i$VR#p!zQhPR!ytQ!_ZQ!g`R#R!SU!ZZ`!SQ!f_Q#W!YQ#[![Q#{#XR#|#Y",
|
|
583
|
-
nodeNames: "⚠ Unit VariableName Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee CallLiteral CallTag ParenthesizedContent , PseudoClassName ArgList IdSelector # IdName ] AttributeSelector [ AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp } { Block Declaration PropertyName Important ; ImportStatement AtKeyword import KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList from to SupportsStatement supports AtRule Styles",
|
|
584
|
-
maxTerm: 108,
|
|
585
|
-
nodeProps: [["openedBy", 17, "(", 48, "{"], ["closedBy", 18, ")", 49, "}"]],
|
|
586
|
-
propSources: [cssHighlighting],
|
|
587
|
-
skippedNodes: [0, 3],
|
|
588
|
-
repeatNodeCount: 8,
|
|
589
|
-
tokenData: "Lq~R!^OX$}X^%u^p$}pq%uqr)Xrs.Rst/utu6duv$}vw7^wx7oxy9^yz9oz{9t{|:_|}?Q}!O?c!O!P@Q!P!Q@i!Q![Cu![!]Dp!]!^El!^!_$}!_!`E}!`!aF`!a!b$}!b!cG[!c!}$}!}#OHt#O#P$}#P#QIV#Q#R6d#R#T$}#T#UIh#U#c$}#c#dJy#d#o$}#o#pK`#p#q6d#q#rKq#r#sLS#s#y$}#y#z%u#z$f$}$f$g%u$g#BY$}#BY#BZ%u#BZ$IS$}$IS$I_%u$I_$I|$}$I|$JO%u$JO$JT$}$JT$JU%u$JU$KV$}$KV$KW%u$KW&FU$}&FU&FV%u&FV;'S$};'S;=`Lk<%lO$}W%QSOy%^z;'S%^;'S;=`%o<%lO%^W%cSoWOy%^z;'S%^;'S;=`%o<%lO%^W%rP;=`<%l%^~%zh#U~OX%^X^'f^p%^pq'fqy%^z#y%^#y#z'f#z$f%^$f$g'f$g#BY%^#BY#BZ'f#BZ$IS%^$IS$I_'f$I_$I|%^$I|$JO'f$JO$JT%^$JT$JU'f$JU$KV%^$KV$KW'f$KW&FU%^&FU&FV'f&FV;'S%^;'S;=`%o<%lO%^~'mh#U~oWOX%^X^'f^p%^pq'fqy%^z#y%^#y#z'f#z$f%^$f$g'f$g#BY%^#BY#BZ'f#BZ$IS%^$IS$I_'f$I_$I|%^$I|$JO'f$JO$JT%^$JT$JU'f$JU$KV%^$KV$KW'f$KW&FU%^&FU&FV'f&FV;'S%^;'S;=`%o<%lO%^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|
|
592
|
-
"StyleSheet": [0, 4],
|
|
593
|
-
"Styles": [1, 84]
|
|
594
|
-
},
|
|
595
|
-
specialized: [{
|
|
596
|
-
term: 95,
|
|
597
|
-
get: value => spec_callee[value] || -1
|
|
598
|
-
}, {
|
|
599
|
-
term: 56,
|
|
600
|
-
get: value => spec_AtKeyword[value] || -1
|
|
601
|
-
}, {
|
|
602
|
-
term: 96,
|
|
603
|
-
get: value => spec_identifier[value] || -1
|
|
604
|
-
}],
|
|
605
|
-
tokenPrec: 1123
|
|
606
|
-
});
|
|
607
|
-
|
|
608
|
-
let _properties = null;
|
|
609
|
-
function properties() {
|
|
610
|
-
if (!_properties && typeof document == "object" && document.body) {
|
|
611
|
-
let names = [];
|
|
612
|
-
for (let prop in document.body.style) {
|
|
613
|
-
if (!/[A-Z]|^-|^(item|length)$/.test(prop)) names.push(prop);
|
|
614
|
-
}
|
|
615
|
-
_properties = names.sort().map(name => ({
|
|
616
|
-
type: "property",
|
|
617
|
-
label: name
|
|
618
|
-
}));
|
|
619
|
-
}
|
|
620
|
-
return _properties || [];
|
|
621
|
-
}
|
|
622
|
-
const pseudoClasses = /*@__PURE__*/["active", "after", "before", "checked", "default", "disabled", "empty", "enabled", "first-child", "first-letter", "first-line", "first-of-type", "focus", "hover", "in-range", "indeterminate", "invalid", "lang", "last-child", "last-of-type", "link", "not", "nth-child", "nth-last-child", "nth-last-of-type", "nth-of-type", "only-of-type", "only-child", "optional", "out-of-range", "placeholder", "read-only", "read-write", "required", "root", "selection", "target", "valid", "visited"].map(name => ({
|
|
623
|
-
type: "class",
|
|
624
|
-
label: name
|
|
625
|
-
}));
|
|
626
|
-
const values = /*@__PURE__*/["above", "absolute", "activeborder", "additive", "activecaption", "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate", "always", "antialiased", "appworkspace", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-decimal", "clear", "clip", "close-quote", "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", "compact", "condensed", "contain", "content", "contents", "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "dense", "destination-atop", "destination-in", "destination-out", "destination-over", "difference", "disc", "discard", "disclosure-closed", "disclosure-open", "document", "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic-abegede-gez", "ethiopic-halehame-aa-er", "ethiopic-halehame-gez", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", "forwards", "from", "geometricPrecision", "graytext", "grid", "groove", "hand", "hard-light", "help", "hidden", "hide", "higher", "highlight", "highlighttext", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "keep-all", "landscape", "large", "larger", "left", "level", "lighter", "lighten", "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-hexadecimal", "lower-latin", "lower-norwegian", "lowercase", "ltr", "luminosity", "manipulation", "match", "matrix", "matrix3d", "medium", "menu", "menutext", "message-box", "middle", "min-intrinsic", "mix", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "n-resize", "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "opacity", "open-quote", "optimizeLegibility", "optimizeSpeed", "outset", "outside", "outside-shape", "overlay", "overline", "padding", "padding-box", "painted", "page", "paused", "perspective", "pinch-zoom", "plus-darker", "plus-lighter", "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", "radial-gradient", "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region", "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", "scroll", "scrollbar", "scroll-position", "se-resize", "self-start", "self-end", "semi-condensed", "semi-expanded", "separate", "serif", "show", "single", "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square", "start", "static", "status-bar", "stretch", "stroke", "stroke-box", "sub", "subpixel-antialiased", "svg_masks", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row", "table-row-group", "text", "text-bottom", "text-top", "textarea", "textfield", "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "to", "top", "transform", "translate", "translate3d", "translateX", "translateY", "translateZ", "transparent", "ultra-condensed", "ultra-expanded", "underline", "unidirectional-pan", "unset", "up", "upper-latin", "uppercase", "url", "var", "vertical", "vertical-text", "view-box", "visible", "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "wider", "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor", "xx-large", "xx-small"].map(name => ({
|
|
627
|
-
type: "keyword",
|
|
628
|
-
label: name
|
|
629
|
-
})).concat( /*@__PURE__*/["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"].map(name => ({
|
|
630
|
-
type: "constant",
|
|
631
|
-
label: name
|
|
632
|
-
})));
|
|
633
|
-
const tags = /*@__PURE__*/["a", "abbr", "address", "article", "aside", "b", "bdi", "bdo", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "figcaption", "figure", "footer", "form", "header", "hgroup", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "meter", "nav", "ol", "output", "p", "pre", "ruby", "section", "select", "small", "source", "span", "strong", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "tr", "u", "ul"].map(name => ({
|
|
634
|
-
type: "type",
|
|
635
|
-
label: name
|
|
636
|
-
}));
|
|
637
|
-
const identifier$1 = /^[\w-]*/;
|
|
638
|
-
/**
|
|
639
|
-
CSS property and value keyword completion source.
|
|
640
|
-
*/
|
|
641
|
-
const cssCompletionSource = context => {
|
|
642
|
-
let {
|
|
643
|
-
state,
|
|
644
|
-
pos
|
|
645
|
-
} = context,
|
|
646
|
-
node = syntaxTree(state).resolveInner(pos, -1);
|
|
647
|
-
if (node.name == "PropertyName") return {
|
|
648
|
-
from: node.from,
|
|
649
|
-
options: properties(),
|
|
650
|
-
validFor: identifier$1
|
|
651
|
-
};
|
|
652
|
-
if (node.name == "ValueName") return {
|
|
653
|
-
from: node.from,
|
|
654
|
-
options: values,
|
|
655
|
-
validFor: identifier$1
|
|
656
|
-
};
|
|
657
|
-
if (node.name == "PseudoClassName") return {
|
|
658
|
-
from: node.from,
|
|
659
|
-
options: pseudoClasses,
|
|
660
|
-
validFor: identifier$1
|
|
661
|
-
};
|
|
662
|
-
if (node.name == "TagName") {
|
|
663
|
-
for (let {
|
|
664
|
-
parent
|
|
665
|
-
} = node; parent; parent = parent.parent) if (parent.name == "Block") return {
|
|
666
|
-
from: node.from,
|
|
667
|
-
options: properties(),
|
|
668
|
-
validFor: identifier$1
|
|
669
|
-
};
|
|
670
|
-
return {
|
|
671
|
-
from: node.from,
|
|
672
|
-
options: tags,
|
|
673
|
-
validFor: identifier$1
|
|
674
|
-
};
|
|
675
|
-
}
|
|
676
|
-
if (!context.explicit) return null;
|
|
677
|
-
let above = node.resolve(pos),
|
|
678
|
-
before = above.childBefore(pos);
|
|
679
|
-
if (before && before.name == ":" && above.name == "PseudoClassSelector") return {
|
|
680
|
-
from: pos,
|
|
681
|
-
options: pseudoClasses,
|
|
682
|
-
validFor: identifier$1
|
|
683
|
-
};
|
|
684
|
-
if (before && before.name == ":" && above.name == "Declaration" || above.name == "ArgList") return {
|
|
685
|
-
from: pos,
|
|
686
|
-
options: values,
|
|
687
|
-
validFor: identifier$1
|
|
688
|
-
};
|
|
689
|
-
if (above.name == "Block") return {
|
|
690
|
-
from: pos,
|
|
691
|
-
options: properties(),
|
|
692
|
-
validFor: identifier$1
|
|
693
|
-
};
|
|
694
|
-
return null;
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
A language provider based on the [Lezer CSS
|
|
699
|
-
parser](https://github.com/lezer-parser/css), extended with
|
|
700
|
-
highlighting and indentation information.
|
|
701
|
-
*/
|
|
702
|
-
const cssLanguage = /*@__PURE__*/LRLanguage.define({
|
|
703
|
-
parser: /*@__PURE__*/parser$2.configure({
|
|
704
|
-
props: [/*@__PURE__*/indentNodeProp.add({
|
|
705
|
-
Declaration: /*@__PURE__*/continuedIndent()
|
|
706
|
-
}), /*@__PURE__*/foldNodeProp.add({
|
|
707
|
-
Block: foldInside
|
|
708
|
-
})]
|
|
709
|
-
}),
|
|
710
|
-
languageData: {
|
|
711
|
-
commentTokens: {
|
|
712
|
-
block: {
|
|
713
|
-
open: "/*",
|
|
714
|
-
close: "*/"
|
|
715
|
-
}
|
|
716
|
-
},
|
|
717
|
-
indentOnInput: /^\s*\}$/,
|
|
718
|
-
wordChars: "-"
|
|
719
|
-
}
|
|
720
|
-
});
|
|
721
|
-
/**
|
|
722
|
-
Language support for CSS.
|
|
723
|
-
*/
|
|
724
|
-
function css() {
|
|
725
|
-
return new LanguageSupport(cssLanguage, cssLanguage.data.of({
|
|
726
|
-
autocomplete: cssCompletionSource
|
|
727
|
-
}));
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
const Targets = ["_blank", "_self", "_top", "_parent"];
|
|
731
|
-
const Charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
|
|
732
|
-
const Methods = ["get", "post", "put", "delete"];
|
|
733
|
-
const Encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
|
|
734
|
-
const Bool = ["true", "false"];
|
|
735
|
-
const S = {}; // Empty tag spec
|
|
736
|
-
const Tags = {
|
|
737
|
-
a: {
|
|
738
|
-
attrs: {
|
|
739
|
-
href: null,
|
|
740
|
-
ping: null,
|
|
741
|
-
type: null,
|
|
742
|
-
media: null,
|
|
743
|
-
target: Targets,
|
|
744
|
-
hreflang: null
|
|
745
|
-
}
|
|
746
|
-
},
|
|
747
|
-
abbr: S,
|
|
748
|
-
acronym: S,
|
|
749
|
-
address: S,
|
|
750
|
-
applet: S,
|
|
751
|
-
area: {
|
|
752
|
-
attrs: {
|
|
753
|
-
alt: null,
|
|
754
|
-
coords: null,
|
|
755
|
-
href: null,
|
|
756
|
-
target: null,
|
|
757
|
-
ping: null,
|
|
758
|
-
media: null,
|
|
759
|
-
hreflang: null,
|
|
760
|
-
type: null,
|
|
761
|
-
shape: ["default", "rect", "circle", "poly"]
|
|
762
|
-
}
|
|
763
|
-
},
|
|
764
|
-
article: S,
|
|
765
|
-
aside: S,
|
|
766
|
-
audio: {
|
|
767
|
-
attrs: {
|
|
768
|
-
src: null,
|
|
769
|
-
mediagroup: null,
|
|
770
|
-
crossorigin: ["anonymous", "use-credentials"],
|
|
771
|
-
preload: ["none", "metadata", "auto"],
|
|
772
|
-
autoplay: ["autoplay"],
|
|
773
|
-
loop: ["loop"],
|
|
774
|
-
controls: ["controls"]
|
|
775
|
-
}
|
|
776
|
-
},
|
|
777
|
-
b: S,
|
|
778
|
-
base: {
|
|
779
|
-
attrs: {
|
|
780
|
-
href: null,
|
|
781
|
-
target: Targets
|
|
782
|
-
}
|
|
783
|
-
},
|
|
784
|
-
basefont: S,
|
|
785
|
-
bdi: S,
|
|
786
|
-
bdo: S,
|
|
787
|
-
big: S,
|
|
788
|
-
blockquote: {
|
|
789
|
-
attrs: {
|
|
790
|
-
cite: null
|
|
791
|
-
}
|
|
792
|
-
},
|
|
793
|
-
body: S,
|
|
794
|
-
br: S,
|
|
795
|
-
button: {
|
|
796
|
-
attrs: {
|
|
797
|
-
form: null,
|
|
798
|
-
formaction: null,
|
|
799
|
-
name: null,
|
|
800
|
-
value: null,
|
|
801
|
-
autofocus: ["autofocus"],
|
|
802
|
-
disabled: ["autofocus"],
|
|
803
|
-
formenctype: Encs,
|
|
804
|
-
formmethod: Methods,
|
|
805
|
-
formnovalidate: ["novalidate"],
|
|
806
|
-
formtarget: Targets,
|
|
807
|
-
type: ["submit", "reset", "button"]
|
|
808
|
-
}
|
|
809
|
-
},
|
|
810
|
-
canvas: {
|
|
811
|
-
attrs: {
|
|
812
|
-
width: null,
|
|
813
|
-
height: null
|
|
814
|
-
}
|
|
815
|
-
},
|
|
816
|
-
caption: S,
|
|
817
|
-
center: S,
|
|
818
|
-
cite: S,
|
|
819
|
-
code: S,
|
|
820
|
-
col: {
|
|
821
|
-
attrs: {
|
|
822
|
-
span: null
|
|
823
|
-
}
|
|
824
|
-
},
|
|
825
|
-
colgroup: {
|
|
826
|
-
attrs: {
|
|
827
|
-
span: null
|
|
828
|
-
}
|
|
829
|
-
},
|
|
830
|
-
command: {
|
|
831
|
-
attrs: {
|
|
832
|
-
type: ["command", "checkbox", "radio"],
|
|
833
|
-
label: null,
|
|
834
|
-
icon: null,
|
|
835
|
-
radiogroup: null,
|
|
836
|
-
command: null,
|
|
837
|
-
title: null,
|
|
838
|
-
disabled: ["disabled"],
|
|
839
|
-
checked: ["checked"]
|
|
840
|
-
}
|
|
841
|
-
},
|
|
842
|
-
data: {
|
|
843
|
-
attrs: {
|
|
844
|
-
value: null
|
|
845
|
-
}
|
|
846
|
-
},
|
|
847
|
-
datagrid: {
|
|
848
|
-
attrs: {
|
|
849
|
-
disabled: ["disabled"],
|
|
850
|
-
multiple: ["multiple"]
|
|
851
|
-
}
|
|
852
|
-
},
|
|
853
|
-
datalist: {
|
|
854
|
-
attrs: {
|
|
855
|
-
data: null
|
|
856
|
-
}
|
|
857
|
-
},
|
|
858
|
-
dd: S,
|
|
859
|
-
del: {
|
|
860
|
-
attrs: {
|
|
861
|
-
cite: null,
|
|
862
|
-
datetime: null
|
|
863
|
-
}
|
|
864
|
-
},
|
|
865
|
-
details: {
|
|
866
|
-
attrs: {
|
|
867
|
-
open: ["open"]
|
|
868
|
-
}
|
|
869
|
-
},
|
|
870
|
-
dfn: S,
|
|
871
|
-
dir: S,
|
|
872
|
-
div: S,
|
|
873
|
-
dl: S,
|
|
874
|
-
dt: S,
|
|
875
|
-
em: S,
|
|
876
|
-
embed: {
|
|
877
|
-
attrs: {
|
|
878
|
-
src: null,
|
|
879
|
-
type: null,
|
|
880
|
-
width: null,
|
|
881
|
-
height: null
|
|
882
|
-
}
|
|
883
|
-
},
|
|
884
|
-
eventsource: {
|
|
885
|
-
attrs: {
|
|
886
|
-
src: null
|
|
887
|
-
}
|
|
888
|
-
},
|
|
889
|
-
fieldset: {
|
|
890
|
-
attrs: {
|
|
891
|
-
disabled: ["disabled"],
|
|
892
|
-
form: null,
|
|
893
|
-
name: null
|
|
894
|
-
}
|
|
895
|
-
},
|
|
896
|
-
figcaption: S,
|
|
897
|
-
figure: S,
|
|
898
|
-
font: S,
|
|
899
|
-
footer: S,
|
|
900
|
-
form: {
|
|
901
|
-
attrs: {
|
|
902
|
-
action: null,
|
|
903
|
-
name: null,
|
|
904
|
-
"accept-charset": Charsets,
|
|
905
|
-
autocomplete: ["on", "off"],
|
|
906
|
-
enctype: Encs,
|
|
907
|
-
method: Methods,
|
|
908
|
-
novalidate: ["novalidate"],
|
|
909
|
-
target: Targets
|
|
910
|
-
}
|
|
911
|
-
},
|
|
912
|
-
frame: S,
|
|
913
|
-
frameset: S,
|
|
914
|
-
h1: S,
|
|
915
|
-
h2: S,
|
|
916
|
-
h3: S,
|
|
917
|
-
h4: S,
|
|
918
|
-
h5: S,
|
|
919
|
-
h6: S,
|
|
920
|
-
head: {
|
|
921
|
-
children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
|
|
922
|
-
},
|
|
923
|
-
header: S,
|
|
924
|
-
hgroup: S,
|
|
925
|
-
hr: S,
|
|
926
|
-
html: {
|
|
927
|
-
attrs: {
|
|
928
|
-
manifest: null
|
|
929
|
-
}
|
|
930
|
-
},
|
|
931
|
-
i: S,
|
|
932
|
-
iframe: {
|
|
933
|
-
attrs: {
|
|
934
|
-
src: null,
|
|
935
|
-
srcdoc: null,
|
|
936
|
-
name: null,
|
|
937
|
-
width: null,
|
|
938
|
-
height: null,
|
|
939
|
-
sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
|
|
940
|
-
seamless: ["seamless"]
|
|
941
|
-
}
|
|
942
|
-
},
|
|
943
|
-
img: {
|
|
944
|
-
attrs: {
|
|
945
|
-
alt: null,
|
|
946
|
-
src: null,
|
|
947
|
-
ismap: null,
|
|
948
|
-
usemap: null,
|
|
949
|
-
width: null,
|
|
950
|
-
height: null,
|
|
951
|
-
crossorigin: ["anonymous", "use-credentials"]
|
|
952
|
-
}
|
|
953
|
-
},
|
|
954
|
-
input: {
|
|
955
|
-
attrs: {
|
|
956
|
-
alt: null,
|
|
957
|
-
dirname: null,
|
|
958
|
-
form: null,
|
|
959
|
-
formaction: null,
|
|
960
|
-
height: null,
|
|
961
|
-
list: null,
|
|
962
|
-
max: null,
|
|
963
|
-
maxlength: null,
|
|
964
|
-
min: null,
|
|
965
|
-
name: null,
|
|
966
|
-
pattern: null,
|
|
967
|
-
placeholder: null,
|
|
968
|
-
size: null,
|
|
969
|
-
src: null,
|
|
970
|
-
step: null,
|
|
971
|
-
value: null,
|
|
972
|
-
width: null,
|
|
973
|
-
accept: ["audio/*", "video/*", "image/*"],
|
|
974
|
-
autocomplete: ["on", "off"],
|
|
975
|
-
autofocus: ["autofocus"],
|
|
976
|
-
checked: ["checked"],
|
|
977
|
-
disabled: ["disabled"],
|
|
978
|
-
formenctype: Encs,
|
|
979
|
-
formmethod: Methods,
|
|
980
|
-
formnovalidate: ["novalidate"],
|
|
981
|
-
formtarget: Targets,
|
|
982
|
-
multiple: ["multiple"],
|
|
983
|
-
readonly: ["readonly"],
|
|
984
|
-
required: ["required"],
|
|
985
|
-
type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month", "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio", "file", "submit", "image", "reset", "button"]
|
|
986
|
-
}
|
|
987
|
-
},
|
|
988
|
-
ins: {
|
|
989
|
-
attrs: {
|
|
990
|
-
cite: null,
|
|
991
|
-
datetime: null
|
|
992
|
-
}
|
|
993
|
-
},
|
|
994
|
-
kbd: S,
|
|
995
|
-
keygen: {
|
|
996
|
-
attrs: {
|
|
997
|
-
challenge: null,
|
|
998
|
-
form: null,
|
|
999
|
-
name: null,
|
|
1000
|
-
autofocus: ["autofocus"],
|
|
1001
|
-
disabled: ["disabled"],
|
|
1002
|
-
keytype: ["RSA"]
|
|
1003
|
-
}
|
|
1004
|
-
},
|
|
1005
|
-
label: {
|
|
1006
|
-
attrs: {
|
|
1007
|
-
for: null,
|
|
1008
|
-
form: null
|
|
1009
|
-
}
|
|
1010
|
-
},
|
|
1011
|
-
legend: S,
|
|
1012
|
-
li: {
|
|
1013
|
-
attrs: {
|
|
1014
|
-
value: null
|
|
1015
|
-
}
|
|
1016
|
-
},
|
|
1017
|
-
link: {
|
|
1018
|
-
attrs: {
|
|
1019
|
-
href: null,
|
|
1020
|
-
type: null,
|
|
1021
|
-
hreflang: null,
|
|
1022
|
-
media: null,
|
|
1023
|
-
sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
|
|
1024
|
-
}
|
|
1025
|
-
},
|
|
1026
|
-
map: {
|
|
1027
|
-
attrs: {
|
|
1028
|
-
name: null
|
|
1029
|
-
}
|
|
1030
|
-
},
|
|
1031
|
-
mark: S,
|
|
1032
|
-
menu: {
|
|
1033
|
-
attrs: {
|
|
1034
|
-
label: null,
|
|
1035
|
-
type: ["list", "context", "toolbar"]
|
|
1036
|
-
}
|
|
1037
|
-
},
|
|
1038
|
-
meta: {
|
|
1039
|
-
attrs: {
|
|
1040
|
-
content: null,
|
|
1041
|
-
charset: Charsets,
|
|
1042
|
-
name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
|
|
1043
|
-
"http-equiv": ["content-language", "content-type", "default-style", "refresh"]
|
|
1044
|
-
}
|
|
1045
|
-
},
|
|
1046
|
-
meter: {
|
|
1047
|
-
attrs: {
|
|
1048
|
-
value: null,
|
|
1049
|
-
min: null,
|
|
1050
|
-
low: null,
|
|
1051
|
-
high: null,
|
|
1052
|
-
max: null,
|
|
1053
|
-
optimum: null
|
|
1054
|
-
}
|
|
1055
|
-
},
|
|
1056
|
-
nav: S,
|
|
1057
|
-
noframes: S,
|
|
1058
|
-
noscript: S,
|
|
1059
|
-
object: {
|
|
1060
|
-
attrs: {
|
|
1061
|
-
data: null,
|
|
1062
|
-
type: null,
|
|
1063
|
-
name: null,
|
|
1064
|
-
usemap: null,
|
|
1065
|
-
form: null,
|
|
1066
|
-
width: null,
|
|
1067
|
-
height: null,
|
|
1068
|
-
typemustmatch: ["typemustmatch"]
|
|
1069
|
-
}
|
|
1070
|
-
},
|
|
1071
|
-
ol: {
|
|
1072
|
-
attrs: {
|
|
1073
|
-
reversed: ["reversed"],
|
|
1074
|
-
start: null,
|
|
1075
|
-
type: ["1", "a", "A", "i", "I"]
|
|
1076
|
-
},
|
|
1077
|
-
children: ["li", "script", "template", "ul", "ol"]
|
|
1078
|
-
},
|
|
1079
|
-
optgroup: {
|
|
1080
|
-
attrs: {
|
|
1081
|
-
disabled: ["disabled"],
|
|
1082
|
-
label: null
|
|
1083
|
-
}
|
|
1084
|
-
},
|
|
1085
|
-
option: {
|
|
1086
|
-
attrs: {
|
|
1087
|
-
disabled: ["disabled"],
|
|
1088
|
-
label: null,
|
|
1089
|
-
selected: ["selected"],
|
|
1090
|
-
value: null
|
|
1091
|
-
}
|
|
1092
|
-
},
|
|
1093
|
-
output: {
|
|
1094
|
-
attrs: {
|
|
1095
|
-
for: null,
|
|
1096
|
-
form: null,
|
|
1097
|
-
name: null
|
|
1098
|
-
}
|
|
1099
|
-
},
|
|
1100
|
-
p: S,
|
|
1101
|
-
param: {
|
|
1102
|
-
attrs: {
|
|
1103
|
-
name: null,
|
|
1104
|
-
value: null
|
|
1105
|
-
}
|
|
1106
|
-
},
|
|
1107
|
-
pre: S,
|
|
1108
|
-
progress: {
|
|
1109
|
-
attrs: {
|
|
1110
|
-
value: null,
|
|
1111
|
-
max: null
|
|
1112
|
-
}
|
|
1113
|
-
},
|
|
1114
|
-
q: {
|
|
1115
|
-
attrs: {
|
|
1116
|
-
cite: null
|
|
1117
|
-
}
|
|
1118
|
-
},
|
|
1119
|
-
rp: S,
|
|
1120
|
-
rt: S,
|
|
1121
|
-
ruby: S,
|
|
1122
|
-
s: S,
|
|
1123
|
-
samp: S,
|
|
1124
|
-
script: {
|
|
1125
|
-
attrs: {
|
|
1126
|
-
type: ["text/javascript"],
|
|
1127
|
-
src: null,
|
|
1128
|
-
async: ["async"],
|
|
1129
|
-
defer: ["defer"],
|
|
1130
|
-
charset: Charsets
|
|
1131
|
-
}
|
|
1132
|
-
},
|
|
1133
|
-
section: S,
|
|
1134
|
-
select: {
|
|
1135
|
-
attrs: {
|
|
1136
|
-
form: null,
|
|
1137
|
-
name: null,
|
|
1138
|
-
size: null,
|
|
1139
|
-
autofocus: ["autofocus"],
|
|
1140
|
-
disabled: ["disabled"],
|
|
1141
|
-
multiple: ["multiple"]
|
|
1142
|
-
}
|
|
1143
|
-
},
|
|
1144
|
-
slot: {
|
|
1145
|
-
attrs: {
|
|
1146
|
-
name: null
|
|
1147
|
-
}
|
|
1148
|
-
},
|
|
1149
|
-
small: S,
|
|
1150
|
-
source: {
|
|
1151
|
-
attrs: {
|
|
1152
|
-
src: null,
|
|
1153
|
-
type: null,
|
|
1154
|
-
media: null
|
|
1155
|
-
}
|
|
1156
|
-
},
|
|
1157
|
-
span: S,
|
|
1158
|
-
strike: S,
|
|
1159
|
-
strong: S,
|
|
1160
|
-
style: {
|
|
1161
|
-
attrs: {
|
|
1162
|
-
type: ["text/css"],
|
|
1163
|
-
media: null,
|
|
1164
|
-
scoped: null
|
|
1165
|
-
}
|
|
1166
|
-
},
|
|
1167
|
-
sub: S,
|
|
1168
|
-
summary: S,
|
|
1169
|
-
sup: S,
|
|
1170
|
-
table: S,
|
|
1171
|
-
tbody: S,
|
|
1172
|
-
td: {
|
|
1173
|
-
attrs: {
|
|
1174
|
-
colspan: null,
|
|
1175
|
-
rowspan: null,
|
|
1176
|
-
headers: null
|
|
1177
|
-
}
|
|
1178
|
-
},
|
|
1179
|
-
template: S,
|
|
1180
|
-
textarea: {
|
|
1181
|
-
attrs: {
|
|
1182
|
-
dirname: null,
|
|
1183
|
-
form: null,
|
|
1184
|
-
maxlength: null,
|
|
1185
|
-
name: null,
|
|
1186
|
-
placeholder: null,
|
|
1187
|
-
rows: null,
|
|
1188
|
-
cols: null,
|
|
1189
|
-
autofocus: ["autofocus"],
|
|
1190
|
-
disabled: ["disabled"],
|
|
1191
|
-
readonly: ["readonly"],
|
|
1192
|
-
required: ["required"],
|
|
1193
|
-
wrap: ["soft", "hard"]
|
|
1194
|
-
}
|
|
1195
|
-
},
|
|
1196
|
-
tfoot: S,
|
|
1197
|
-
th: {
|
|
1198
|
-
attrs: {
|
|
1199
|
-
colspan: null,
|
|
1200
|
-
rowspan: null,
|
|
1201
|
-
headers: null,
|
|
1202
|
-
scope: ["row", "col", "rowgroup", "colgroup"]
|
|
1203
|
-
}
|
|
1204
|
-
},
|
|
1205
|
-
thead: S,
|
|
1206
|
-
time: {
|
|
1207
|
-
attrs: {
|
|
1208
|
-
datetime: null
|
|
1209
|
-
}
|
|
1210
|
-
},
|
|
1211
|
-
title: S,
|
|
1212
|
-
tr: S,
|
|
1213
|
-
track: {
|
|
1214
|
-
attrs: {
|
|
1215
|
-
src: null,
|
|
1216
|
-
label: null,
|
|
1217
|
-
default: null,
|
|
1218
|
-
kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
|
|
1219
|
-
srclang: null
|
|
1220
|
-
}
|
|
1221
|
-
},
|
|
1222
|
-
tt: S,
|
|
1223
|
-
u: S,
|
|
1224
|
-
ul: {
|
|
1225
|
-
children: ["li", "script", "template", "ul", "ol"]
|
|
1226
|
-
},
|
|
1227
|
-
var: S,
|
|
1228
|
-
video: {
|
|
1229
|
-
attrs: {
|
|
1230
|
-
src: null,
|
|
1231
|
-
poster: null,
|
|
1232
|
-
width: null,
|
|
1233
|
-
height: null,
|
|
1234
|
-
crossorigin: ["anonymous", "use-credentials"],
|
|
1235
|
-
preload: ["auto", "metadata", "none"],
|
|
1236
|
-
autoplay: ["autoplay"],
|
|
1237
|
-
mediagroup: ["movie"],
|
|
1238
|
-
muted: ["muted"],
|
|
1239
|
-
controls: ["controls"]
|
|
1240
|
-
}
|
|
1241
|
-
},
|
|
1242
|
-
wbr: S
|
|
1243
|
-
};
|
|
1244
|
-
const GlobalAttrs = {
|
|
1245
|
-
accesskey: null,
|
|
1246
|
-
class: null,
|
|
1247
|
-
contenteditable: Bool,
|
|
1248
|
-
contextmenu: null,
|
|
1249
|
-
dir: ["ltr", "rtl", "auto"],
|
|
1250
|
-
draggable: ["true", "false", "auto"],
|
|
1251
|
-
dropzone: ["copy", "move", "link", "string:", "file:"],
|
|
1252
|
-
hidden: ["hidden"],
|
|
1253
|
-
id: null,
|
|
1254
|
-
inert: ["inert"],
|
|
1255
|
-
itemid: null,
|
|
1256
|
-
itemprop: null,
|
|
1257
|
-
itemref: null,
|
|
1258
|
-
itemscope: ["itemscope"],
|
|
1259
|
-
itemtype: null,
|
|
1260
|
-
lang: ["ar", "bn", "de", "en-GB", "en-US", "es", "fr", "hi", "id", "ja", "pa", "pt", "ru", "tr", "zh"],
|
|
1261
|
-
spellcheck: Bool,
|
|
1262
|
-
autocorrect: Bool,
|
|
1263
|
-
autocapitalize: Bool,
|
|
1264
|
-
style: null,
|
|
1265
|
-
tabindex: null,
|
|
1266
|
-
title: null,
|
|
1267
|
-
translate: ["yes", "no"],
|
|
1268
|
-
onclick: null,
|
|
1269
|
-
rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"],
|
|
1270
|
-
role: /*@__PURE__*/"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),
|
|
1271
|
-
"aria-activedescendant": null,
|
|
1272
|
-
"aria-atomic": Bool,
|
|
1273
|
-
"aria-autocomplete": ["inline", "list", "both", "none"],
|
|
1274
|
-
"aria-busy": Bool,
|
|
1275
|
-
"aria-checked": ["true", "false", "mixed", "undefined"],
|
|
1276
|
-
"aria-controls": null,
|
|
1277
|
-
"aria-describedby": null,
|
|
1278
|
-
"aria-disabled": Bool,
|
|
1279
|
-
"aria-dropeffect": null,
|
|
1280
|
-
"aria-expanded": ["true", "false", "undefined"],
|
|
1281
|
-
"aria-flowto": null,
|
|
1282
|
-
"aria-grabbed": ["true", "false", "undefined"],
|
|
1283
|
-
"aria-haspopup": Bool,
|
|
1284
|
-
"aria-hidden": Bool,
|
|
1285
|
-
"aria-invalid": ["true", "false", "grammar", "spelling"],
|
|
1286
|
-
"aria-label": null,
|
|
1287
|
-
"aria-labelledby": null,
|
|
1288
|
-
"aria-level": null,
|
|
1289
|
-
"aria-live": ["off", "polite", "assertive"],
|
|
1290
|
-
"aria-multiline": Bool,
|
|
1291
|
-
"aria-multiselectable": Bool,
|
|
1292
|
-
"aria-owns": null,
|
|
1293
|
-
"aria-posinset": null,
|
|
1294
|
-
"aria-pressed": ["true", "false", "mixed", "undefined"],
|
|
1295
|
-
"aria-readonly": Bool,
|
|
1296
|
-
"aria-relevant": null,
|
|
1297
|
-
"aria-required": Bool,
|
|
1298
|
-
"aria-selected": ["true", "false", "undefined"],
|
|
1299
|
-
"aria-setsize": null,
|
|
1300
|
-
"aria-sort": ["ascending", "descending", "none", "other"],
|
|
1301
|
-
"aria-valuemax": null,
|
|
1302
|
-
"aria-valuemin": null,
|
|
1303
|
-
"aria-valuenow": null,
|
|
1304
|
-
"aria-valuetext": null
|
|
1305
|
-
};
|
|
1306
|
-
class Schema {
|
|
1307
|
-
constructor(extraTags, extraAttrs) {
|
|
1308
|
-
this.tags = Object.assign(Object.assign({}, Tags), extraTags);
|
|
1309
|
-
this.globalAttrs = Object.assign(Object.assign({}, GlobalAttrs), extraAttrs);
|
|
1310
|
-
this.allTags = Object.keys(this.tags);
|
|
1311
|
-
this.globalAttrNames = Object.keys(this.globalAttrs);
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
Schema.default = /*@__PURE__*/new Schema();
|
|
1315
|
-
function elementName(doc, tree) {
|
|
1316
|
-
let max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : doc.length;
|
|
1317
|
-
if (!tree) return "";
|
|
1318
|
-
let tag = tree.firstChild;
|
|
1319
|
-
let name = tag && tag.getChild("TagName");
|
|
1320
|
-
return name ? doc.sliceString(name.from, Math.min(name.to, max)) : "";
|
|
1321
|
-
}
|
|
1322
|
-
function findParentElement(tree) {
|
|
1323
|
-
let skip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1324
|
-
for (let cur = tree.parent; cur; cur = cur.parent) if (cur.name == "Element") {
|
|
1325
|
-
if (skip) skip = false;else return cur;
|
|
1326
|
-
}
|
|
1327
|
-
return null;
|
|
1328
|
-
}
|
|
1329
|
-
function allowedChildren(doc, tree, schema) {
|
|
1330
|
-
let parentInfo = schema.tags[elementName(doc, findParentElement(tree, true))];
|
|
1331
|
-
return (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.children) || schema.allTags;
|
|
1332
|
-
}
|
|
1333
|
-
function openTags(doc, tree) {
|
|
1334
|
-
let open = [];
|
|
1335
|
-
for (let parent = tree; parent = findParentElement(parent);) {
|
|
1336
|
-
let tagName = elementName(doc, parent);
|
|
1337
|
-
if (tagName && parent.lastChild.name == "CloseTag") break;
|
|
1338
|
-
if (tagName && open.indexOf(tagName) < 0 && (tree.name == "EndTag" || tree.from >= parent.firstChild.to)) open.push(tagName);
|
|
1339
|
-
}
|
|
1340
|
-
return open;
|
|
1341
|
-
}
|
|
1342
|
-
const identifier = /^[:\-\.\w\u00b7-\uffff]*$/;
|
|
1343
|
-
function completeTag(state, schema, tree, from, to) {
|
|
1344
|
-
let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
|
|
1345
|
-
return {
|
|
1346
|
-
from,
|
|
1347
|
-
to,
|
|
1348
|
-
options: allowedChildren(state.doc, tree, schema).map(tagName => ({
|
|
1349
|
-
label: tagName,
|
|
1350
|
-
type: "type"
|
|
1351
|
-
})).concat(openTags(state.doc, tree).map((tag, i) => ({
|
|
1352
|
-
label: "/" + tag,
|
|
1353
|
-
apply: "/" + tag + end,
|
|
1354
|
-
type: "type",
|
|
1355
|
-
boost: 99 - i
|
|
1356
|
-
}))),
|
|
1357
|
-
validFor: /^\/?[:\-\.\w\u00b7-\uffff]*$/
|
|
1358
|
-
};
|
|
1359
|
-
}
|
|
1360
|
-
function completeCloseTag(state, tree, from, to) {
|
|
1361
|
-
let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
|
|
1362
|
-
return {
|
|
1363
|
-
from,
|
|
1364
|
-
to,
|
|
1365
|
-
options: openTags(state.doc, tree).map((tag, i) => ({
|
|
1366
|
-
label: tag,
|
|
1367
|
-
apply: tag + end,
|
|
1368
|
-
type: "type",
|
|
1369
|
-
boost: 99 - i
|
|
1370
|
-
})),
|
|
1371
|
-
validFor: identifier
|
|
1372
|
-
};
|
|
1373
|
-
}
|
|
1374
|
-
function completeStartTag(state, schema, tree, pos) {
|
|
1375
|
-
let options = [],
|
|
1376
|
-
level = 0;
|
|
1377
|
-
for (let tagName of allowedChildren(state.doc, tree, schema)) options.push({
|
|
1378
|
-
label: "<" + tagName,
|
|
1379
|
-
type: "type"
|
|
1380
|
-
});
|
|
1381
|
-
for (let open of openTags(state.doc, tree)) options.push({
|
|
1382
|
-
label: "</" + open + ">",
|
|
1383
|
-
type: "type",
|
|
1384
|
-
boost: 99 - level++
|
|
1385
|
-
});
|
|
1386
|
-
return {
|
|
1387
|
-
from: pos,
|
|
1388
|
-
to: pos,
|
|
1389
|
-
options,
|
|
1390
|
-
validFor: /^<\/?[:\-\.\w\u00b7-\uffff]*$/
|
|
1391
|
-
};
|
|
1392
|
-
}
|
|
1393
|
-
function completeAttrName(state, schema, tree, from, to) {
|
|
1394
|
-
let elt = findParentElement(tree),
|
|
1395
|
-
info = elt ? schema.tags[elementName(state.doc, elt)] : null;
|
|
1396
|
-
let names = info && info.attrs ? Object.keys(info.attrs).concat(schema.globalAttrNames) : schema.globalAttrNames;
|
|
1397
|
-
return {
|
|
1398
|
-
from,
|
|
1399
|
-
to,
|
|
1400
|
-
options: names.map(attrName => ({
|
|
1401
|
-
label: attrName,
|
|
1402
|
-
type: "property"
|
|
1403
|
-
})),
|
|
1404
|
-
validFor: identifier
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
function completeAttrValue(state, schema, tree, from, to) {
|
|
1408
|
-
var _a;
|
|
1409
|
-
let nameNode = (_a = tree.parent) === null || _a === void 0 ? void 0 : _a.getChild("AttributeName");
|
|
1410
|
-
let options = [],
|
|
1411
|
-
token = undefined;
|
|
1412
|
-
if (nameNode) {
|
|
1413
|
-
let attrName = state.sliceDoc(nameNode.from, nameNode.to);
|
|
1414
|
-
let attrs = schema.globalAttrs[attrName];
|
|
1415
|
-
if (!attrs) {
|
|
1416
|
-
let elt = findParentElement(tree),
|
|
1417
|
-
info = elt ? schema.tags[elementName(state.doc, elt)] : null;
|
|
1418
|
-
attrs = (info === null || info === void 0 ? void 0 : info.attrs) && info.attrs[attrName];
|
|
1419
|
-
}
|
|
1420
|
-
if (attrs) {
|
|
1421
|
-
let base = state.sliceDoc(from, to).toLowerCase(),
|
|
1422
|
-
quoteStart = '"',
|
|
1423
|
-
quoteEnd = '"';
|
|
1424
|
-
if (/^['"]/.test(base)) {
|
|
1425
|
-
token = base[0] == '"' ? /^[^"]*$/ : /^[^']*$/;
|
|
1426
|
-
quoteStart = "";
|
|
1427
|
-
quoteEnd = state.sliceDoc(to, to + 1) == base[0] ? "" : base[0];
|
|
1428
|
-
base = base.slice(1);
|
|
1429
|
-
from++;
|
|
1430
|
-
} else {
|
|
1431
|
-
token = /^[^\s<>='"]*$/;
|
|
1432
|
-
}
|
|
1433
|
-
for (let value of attrs) options.push({
|
|
1434
|
-
label: value,
|
|
1435
|
-
apply: quoteStart + value + quoteEnd,
|
|
1436
|
-
type: "constant"
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
return {
|
|
1441
|
-
from,
|
|
1442
|
-
to,
|
|
1443
|
-
options,
|
|
1444
|
-
validFor: token
|
|
1445
|
-
};
|
|
1446
|
-
}
|
|
1447
|
-
function htmlCompletionFor(schema, context) {
|
|
1448
|
-
let {
|
|
1449
|
-
state,
|
|
1450
|
-
pos
|
|
1451
|
-
} = context,
|
|
1452
|
-
around = syntaxTree(state).resolveInner(pos),
|
|
1453
|
-
tree = around.resolve(pos, -1);
|
|
1454
|
-
for (let scan = pos, before; around == tree && (before = tree.childBefore(scan));) {
|
|
1455
|
-
let last = before.lastChild;
|
|
1456
|
-
if (!last || !last.type.isError || last.from < last.to) break;
|
|
1457
|
-
around = tree = before;
|
|
1458
|
-
scan = last.from;
|
|
1459
|
-
}
|
|
1460
|
-
if (tree.name == "TagName") {
|
|
1461
|
-
return tree.parent && /CloseTag$/.test(tree.parent.name) ? completeCloseTag(state, tree, tree.from, pos) : completeTag(state, schema, tree, tree.from, pos);
|
|
1462
|
-
} else if (tree.name == "StartTag") {
|
|
1463
|
-
return completeTag(state, schema, tree, pos, pos);
|
|
1464
|
-
} else if (tree.name == "StartCloseTag" || tree.name == "IncompleteCloseTag") {
|
|
1465
|
-
return completeCloseTag(state, tree, pos, pos);
|
|
1466
|
-
} else if (context.explicit && (tree.name == "OpenTag" || tree.name == "SelfClosingTag") || tree.name == "AttributeName") {
|
|
1467
|
-
return completeAttrName(state, schema, tree, tree.name == "AttributeName" ? tree.from : pos, pos);
|
|
1468
|
-
} else if (tree.name == "Is" || tree.name == "AttributeValue" || tree.name == "UnquotedAttributeValue") {
|
|
1469
|
-
return completeAttrValue(state, schema, tree, tree.name == "Is" ? pos : tree.from, pos);
|
|
1470
|
-
} else if (context.explicit && (around.name == "Element" || around.name == "Text" || around.name == "Document")) {
|
|
1471
|
-
return completeStartTag(state, schema, tree, pos);
|
|
1472
|
-
} else {
|
|
1473
|
-
return null;
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
Create a completion source for HTML extended with additional tags
|
|
1478
|
-
or attributes.
|
|
1479
|
-
*/
|
|
1480
|
-
function htmlCompletionSourceWith(config) {
|
|
1481
|
-
let {
|
|
1482
|
-
extraTags,
|
|
1483
|
-
extraGlobalAttributes: extraAttrs
|
|
1484
|
-
} = config;
|
|
1485
|
-
let schema = extraAttrs || extraTags ? new Schema(extraTags, extraAttrs) : Schema.default;
|
|
1486
|
-
return context => htmlCompletionFor(schema, context);
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
/**
|
|
1490
|
-
A language provider based on the [Lezer HTML
|
|
1491
|
-
parser](https://github.com/lezer-parser/html), extended with the
|
|
1492
|
-
JavaScript and CSS parsers to parse the content of `<script>` and
|
|
1493
|
-
`<style>` tags.
|
|
1494
|
-
*/
|
|
1495
|
-
const htmlLanguage = /*@__PURE__*/LRLanguage.define({
|
|
1496
|
-
parser: /*@__PURE__*/parser$3.configure({
|
|
1497
|
-
props: [/*@__PURE__*/indentNodeProp.add({
|
|
1498
|
-
Element(context) {
|
|
1499
|
-
let after = /^(\s*)(<\/)?/.exec(context.textAfter);
|
|
1500
|
-
if (context.node.to <= context.pos + after[0].length) return context.continue();
|
|
1501
|
-
return context.lineIndent(context.node.from) + (after[2] ? 0 : context.unit);
|
|
1502
|
-
},
|
|
1503
|
-
"OpenTag CloseTag SelfClosingTag"(context) {
|
|
1504
|
-
return context.column(context.node.from) + context.unit;
|
|
1505
|
-
},
|
|
1506
|
-
Document(context) {
|
|
1507
|
-
if (context.pos + /\s*/.exec(context.textAfter)[0].length < context.node.to) return context.continue();
|
|
1508
|
-
let endElt = null,
|
|
1509
|
-
close;
|
|
1510
|
-
for (let cur = context.node;;) {
|
|
1511
|
-
let last = cur.lastChild;
|
|
1512
|
-
if (!last || last.name != "Element" || last.to != cur.to) break;
|
|
1513
|
-
endElt = cur = last;
|
|
1514
|
-
}
|
|
1515
|
-
if (endElt && !((close = endElt.lastChild) && (close.name == "CloseTag" || close.name == "SelfClosingTag"))) return context.lineIndent(endElt.from) + context.unit;
|
|
1516
|
-
return null;
|
|
1517
|
-
}
|
|
1518
|
-
}), /*@__PURE__*/foldNodeProp.add({
|
|
1519
|
-
Element(node) {
|
|
1520
|
-
let first = node.firstChild,
|
|
1521
|
-
last = node.lastChild;
|
|
1522
|
-
if (!first || first.name != "OpenTag") return null;
|
|
1523
|
-
return {
|
|
1524
|
-
from: first.to,
|
|
1525
|
-
to: last.name == "CloseTag" ? last.from : node.to
|
|
1526
|
-
};
|
|
1527
|
-
}
|
|
1528
|
-
})],
|
|
1529
|
-
wrap: /*@__PURE__*/configureNesting([{
|
|
1530
|
-
tag: "script",
|
|
1531
|
-
attrs(attrs) {
|
|
1532
|
-
return !attrs.type || /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(attrs.type);
|
|
1533
|
-
},
|
|
1534
|
-
parser: javascriptLanguage.parser
|
|
1535
|
-
}, {
|
|
1536
|
-
tag: "style",
|
|
1537
|
-
attrs(attrs) {
|
|
1538
|
-
return (!attrs.lang || attrs.lang == "css") && (!attrs.type || /^(text\/)?(x-)?(stylesheet|css)$/i.test(attrs.type));
|
|
1539
|
-
},
|
|
1540
|
-
parser: cssLanguage.parser
|
|
1541
|
-
}])
|
|
1542
|
-
}),
|
|
1543
|
-
languageData: {
|
|
1544
|
-
commentTokens: {
|
|
1545
|
-
block: {
|
|
1546
|
-
open: "<!--",
|
|
1547
|
-
close: "-->"
|
|
1548
|
-
}
|
|
1549
|
-
},
|
|
1550
|
-
indentOnInput: /^\s*<\/\w+\W$/,
|
|
1551
|
-
wordChars: "-._"
|
|
1552
|
-
}
|
|
1553
|
-
});
|
|
1554
|
-
/**
|
|
1555
|
-
Language support for HTML, including
|
|
1556
|
-
[`htmlCompletion`](https://codemirror.net/6/docs/ref/#lang-html.htmlCompletion) and JavaScript and
|
|
1557
|
-
CSS support extensions.
|
|
1558
|
-
*/
|
|
1559
|
-
function html() {
|
|
1560
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1561
|
-
let lang = htmlLanguage;
|
|
1562
|
-
if (config.matchClosingTags === false) lang = lang.configure({
|
|
1563
|
-
dialect: "noMatch"
|
|
1564
|
-
});
|
|
1565
|
-
return new LanguageSupport(lang, [htmlLanguage.data.of({
|
|
1566
|
-
autocomplete: htmlCompletionSourceWith(config)
|
|
1567
|
-
}), config.autoCloseTags !== false ? autoCloseTags : [], javascript().support, css().support]);
|
|
1568
|
-
}
|
|
1569
|
-
/**
|
|
1570
|
-
Extension that will automatically insert close tags when a `>` or
|
|
1571
|
-
`/` is typed.
|
|
1572
|
-
*/
|
|
1573
|
-
const autoCloseTags = /*@__PURE__*/EditorView.inputHandler.of((view, from, to, text) => {
|
|
1574
|
-
if (view.composing || view.state.readOnly || from != to || text != ">" && text != "/" || !htmlLanguage.isActiveAt(view.state, from, -1)) return false;
|
|
1575
|
-
let {
|
|
1576
|
-
state
|
|
1577
|
-
} = view;
|
|
1578
|
-
let changes = state.changeByRange(range => {
|
|
1579
|
-
var _a, _b, _c;
|
|
1580
|
-
let {
|
|
1581
|
-
head
|
|
1582
|
-
} = range,
|
|
1583
|
-
around = syntaxTree(state).resolveInner(head, -1),
|
|
1584
|
-
name;
|
|
1585
|
-
if (around.name == "TagName" || around.name == "StartTag") around = around.parent;
|
|
1586
|
-
if (text == ">" && around.name == "OpenTag") {
|
|
1587
|
-
if (((_b = (_a = around.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "CloseTag" && (name = elementName(state.doc, around.parent, head))) return {
|
|
1588
|
-
range: EditorSelection.cursor(head + 1),
|
|
1589
|
-
changes: {
|
|
1590
|
-
from: head,
|
|
1591
|
-
insert: `></${name}>`
|
|
1592
|
-
}
|
|
1593
|
-
};
|
|
1594
|
-
} else if (text == "/" && around.name == "OpenTag") {
|
|
1595
|
-
let empty = around.parent,
|
|
1596
|
-
base = empty === null || empty === void 0 ? void 0 : empty.parent;
|
|
1597
|
-
if (empty.from == head - 1 && ((_c = base.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "CloseTag" && (name = elementName(state.doc, base, head))) {
|
|
1598
|
-
let insert = `/${name}>`;
|
|
1599
|
-
return {
|
|
1600
|
-
range: EditorSelection.cursor(head + insert.length),
|
|
1601
|
-
changes: {
|
|
1602
|
-
from: head,
|
|
1603
|
-
insert
|
|
1604
|
-
}
|
|
1605
|
-
};
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
return {
|
|
1609
|
-
range
|
|
1610
|
-
};
|
|
1611
|
-
});
|
|
1612
|
-
if (changes.changes.empty) return false;
|
|
1613
|
-
view.dispatch(changes, {
|
|
1614
|
-
userEvent: "input.type",
|
|
1615
|
-
scrollIntoView: true
|
|
1616
|
-
});
|
|
1617
|
-
return true;
|
|
1618
|
-
});
|
|
1619
|
-
|
|
1620
|
-
const jsonHighlighting = styleTags({
|
|
1621
|
-
String: tags$1.string,
|
|
1622
|
-
Number: tags$1.number,
|
|
1623
|
-
"True False": tags$1.bool,
|
|
1624
|
-
PropertyName: tags$1.propertyName,
|
|
1625
|
-
Null: tags$1.null,
|
|
1626
|
-
",": tags$1.separator,
|
|
1627
|
-
"[ ]": tags$1.squareBracket,
|
|
1628
|
-
"{ }": tags$1.brace
|
|
1629
|
-
});
|
|
1630
|
-
|
|
1631
|
-
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
1632
|
-
const parser$1 = LRParser.deserialize({
|
|
1633
|
-
version: 14,
|
|
1634
|
-
states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",
|
|
1635
|
-
stateData: "#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",
|
|
1636
|
-
goto: "!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
|
|
1637
|
-
nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",
|
|
1638
|
-
maxTerm: 25,
|
|
1639
|
-
nodeProps: [["openedBy", 7, "{", 12, "["], ["closedBy", 8, "}", 13, "]"]],
|
|
1640
|
-
propSources: [jsonHighlighting],
|
|
1641
|
-
skippedNodes: [0],
|
|
1642
|
-
repeatNodeCount: 2,
|
|
1643
|
-
tokenData: "(p~RaXY!WYZ!W]^!Wpq!Wrs!]|}$i}!O$n!Q!R$w!R![&V![!]&h!}#O&m#P#Q&r#Y#Z&w#b#c'f#h#i'}#o#p(f#q#r(k~!]Oc~~!`Upq!]qr!]rs!rs#O!]#O#P!w#P~!]~!wOe~~!zXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#g~#jR!Q![#s!c!i#s#T#Z#s~#vR!Q![$P!c!i$P#T#Z$P~$SR!Q![$]!c!i$]#T#Z$]~$`R!Q![!]!c!i!]#T#Z!]~$nOh~~$qQ!Q!R$w!R![&V~$|RT~!O!P%V!g!h%k#X#Y%k~%YP!Q![%]~%bRT~!Q![%]!g!h%k#X#Y%k~%nR{|%w}!O%w!Q![%}~%zP!Q![%}~&SPT~!Q![%}~&[ST~!O!P%V!Q![&V!g!h%k#X#Y%k~&mOg~~&rO]~~&wO[~~&zP#T#U&}~'QP#`#a'T~'WP#g#h'Z~'^P#X#Y'a~'fOR~~'iP#i#j'l~'oP#`#a'r~'uP#`#a'x~'}OS~~(QP#f#g(T~(WP#i#j(Z~(^P#X#Y(a~(fOQ~~(kOW~~(pOV~",
|
|
1644
|
-
tokenizers: [0],
|
|
1645
|
-
topRules: {
|
|
1646
|
-
"JsonText": [0, 1]
|
|
1647
|
-
},
|
|
1648
|
-
tokenPrec: 0
|
|
1649
|
-
});
|
|
1650
|
-
|
|
1651
|
-
/**
|
|
1652
|
-
A language provider that provides JSON parsing.
|
|
1653
|
-
*/
|
|
1654
|
-
const jsonLanguage = /*@__PURE__*/LRLanguage.define({
|
|
1655
|
-
parser: /*@__PURE__*/parser$1.configure({
|
|
1656
|
-
props: [/*@__PURE__*/indentNodeProp.add({
|
|
1657
|
-
Object: /*@__PURE__*/continuedIndent({
|
|
1658
|
-
except: /^\s*\}/
|
|
1659
|
-
}),
|
|
1660
|
-
Array: /*@__PURE__*/continuedIndent({
|
|
1661
|
-
except: /^\s*\]/
|
|
1662
|
-
})
|
|
1663
|
-
}), /*@__PURE__*/foldNodeProp.add({
|
|
1664
|
-
"Object Array": foldInside
|
|
1665
|
-
})]
|
|
1666
|
-
}),
|
|
1667
|
-
languageData: {
|
|
1668
|
-
closeBrackets: {
|
|
1669
|
-
brackets: ["[", "{", '"']
|
|
1670
|
-
},
|
|
1671
|
-
indentOnInput: /^\s*[\}\]]$/
|
|
1672
|
-
}
|
|
1673
|
-
});
|
|
1674
|
-
/**
|
|
1675
|
-
JSON language support.
|
|
1676
|
-
*/
|
|
1677
|
-
function json() {
|
|
1678
|
-
return new LanguageSupport(jsonLanguage);
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
class CompositeBlock {
|
|
1682
|
-
constructor(type,
|
|
1683
|
-
// Used for indentation in list items, markup character in lists
|
|
1684
|
-
value, from, hash, end, children, positions) {
|
|
1685
|
-
this.type = type;
|
|
1686
|
-
this.value = value;
|
|
1687
|
-
this.from = from;
|
|
1688
|
-
this.hash = hash;
|
|
1689
|
-
this.end = end;
|
|
1690
|
-
this.children = children;
|
|
1691
|
-
this.positions = positions;
|
|
1692
|
-
this.hashProp = [[NodeProp.contextHash, hash]];
|
|
1693
|
-
}
|
|
1694
|
-
static create(type, value, from, parentHash, end) {
|
|
1695
|
-
let hash = parentHash + (parentHash << 8) + type + (value << 4) | 0;
|
|
1696
|
-
return new CompositeBlock(type, value, from, hash, end, [], []);
|
|
1697
|
-
}
|
|
1698
|
-
addChild(child, pos) {
|
|
1699
|
-
if (child.prop(NodeProp.contextHash) != this.hash) child = new Tree(child.type, child.children, child.positions, child.length, this.hashProp);
|
|
1700
|
-
this.children.push(child);
|
|
1701
|
-
this.positions.push(pos);
|
|
1702
|
-
}
|
|
1703
|
-
toTree(nodeSet) {
|
|
1704
|
-
let end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.end;
|
|
1705
|
-
let last = this.children.length - 1;
|
|
1706
|
-
if (last >= 0) end = Math.max(end, this.positions[last] + this.children[last].length + this.from);
|
|
1707
|
-
let tree = new Tree(nodeSet.types[this.type], this.children, this.positions, end - this.from).balance({
|
|
1708
|
-
makeTree: (children, positions, length) => new Tree(NodeType.none, children, positions, length, this.hashProp)
|
|
1709
|
-
});
|
|
1710
|
-
return tree;
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
var Type;
|
|
1714
|
-
(function (Type) {
|
|
1715
|
-
Type[Type["Document"] = 1] = "Document";
|
|
1716
|
-
Type[Type["CodeBlock"] = 2] = "CodeBlock";
|
|
1717
|
-
Type[Type["FencedCode"] = 3] = "FencedCode";
|
|
1718
|
-
Type[Type["Blockquote"] = 4] = "Blockquote";
|
|
1719
|
-
Type[Type["HorizontalRule"] = 5] = "HorizontalRule";
|
|
1720
|
-
Type[Type["BulletList"] = 6] = "BulletList";
|
|
1721
|
-
Type[Type["OrderedList"] = 7] = "OrderedList";
|
|
1722
|
-
Type[Type["ListItem"] = 8] = "ListItem";
|
|
1723
|
-
Type[Type["ATXHeading1"] = 9] = "ATXHeading1";
|
|
1724
|
-
Type[Type["ATXHeading2"] = 10] = "ATXHeading2";
|
|
1725
|
-
Type[Type["ATXHeading3"] = 11] = "ATXHeading3";
|
|
1726
|
-
Type[Type["ATXHeading4"] = 12] = "ATXHeading4";
|
|
1727
|
-
Type[Type["ATXHeading5"] = 13] = "ATXHeading5";
|
|
1728
|
-
Type[Type["ATXHeading6"] = 14] = "ATXHeading6";
|
|
1729
|
-
Type[Type["SetextHeading1"] = 15] = "SetextHeading1";
|
|
1730
|
-
Type[Type["SetextHeading2"] = 16] = "SetextHeading2";
|
|
1731
|
-
Type[Type["HTMLBlock"] = 17] = "HTMLBlock";
|
|
1732
|
-
Type[Type["LinkReference"] = 18] = "LinkReference";
|
|
1733
|
-
Type[Type["Paragraph"] = 19] = "Paragraph";
|
|
1734
|
-
Type[Type["CommentBlock"] = 20] = "CommentBlock";
|
|
1735
|
-
Type[Type["ProcessingInstructionBlock"] = 21] = "ProcessingInstructionBlock";
|
|
1736
|
-
// Inline
|
|
1737
|
-
Type[Type["Escape"] = 22] = "Escape";
|
|
1738
|
-
Type[Type["Entity"] = 23] = "Entity";
|
|
1739
|
-
Type[Type["HardBreak"] = 24] = "HardBreak";
|
|
1740
|
-
Type[Type["Emphasis"] = 25] = "Emphasis";
|
|
1741
|
-
Type[Type["StrongEmphasis"] = 26] = "StrongEmphasis";
|
|
1742
|
-
Type[Type["Link"] = 27] = "Link";
|
|
1743
|
-
Type[Type["Image"] = 28] = "Image";
|
|
1744
|
-
Type[Type["InlineCode"] = 29] = "InlineCode";
|
|
1745
|
-
Type[Type["HTMLTag"] = 30] = "HTMLTag";
|
|
1746
|
-
Type[Type["Comment"] = 31] = "Comment";
|
|
1747
|
-
Type[Type["ProcessingInstruction"] = 32] = "ProcessingInstruction";
|
|
1748
|
-
Type[Type["URL"] = 33] = "URL";
|
|
1749
|
-
// Smaller tokens
|
|
1750
|
-
Type[Type["HeaderMark"] = 34] = "HeaderMark";
|
|
1751
|
-
Type[Type["QuoteMark"] = 35] = "QuoteMark";
|
|
1752
|
-
Type[Type["ListMark"] = 36] = "ListMark";
|
|
1753
|
-
Type[Type["LinkMark"] = 37] = "LinkMark";
|
|
1754
|
-
Type[Type["EmphasisMark"] = 38] = "EmphasisMark";
|
|
1755
|
-
Type[Type["CodeMark"] = 39] = "CodeMark";
|
|
1756
|
-
Type[Type["CodeText"] = 40] = "CodeText";
|
|
1757
|
-
Type[Type["CodeInfo"] = 41] = "CodeInfo";
|
|
1758
|
-
Type[Type["LinkTitle"] = 42] = "LinkTitle";
|
|
1759
|
-
Type[Type["LinkLabel"] = 43] = "LinkLabel";
|
|
1760
|
-
})(Type || (Type = {}));
|
|
1761
|
-
/// Data structure used to accumulate a block's content during [leaf
|
|
1762
|
-
/// block parsing](#BlockParser.leaf).
|
|
1763
|
-
class LeafBlock {
|
|
1764
|
-
/// @internal
|
|
1765
|
-
constructor(
|
|
1766
|
-
/// The start position of the block.
|
|
1767
|
-
start,
|
|
1768
|
-
/// The block's text content.
|
|
1769
|
-
content) {
|
|
1770
|
-
this.start = start;
|
|
1771
|
-
this.content = content;
|
|
1772
|
-
/// @internal
|
|
1773
|
-
this.marks = [];
|
|
1774
|
-
/// The block parsers active for this block.
|
|
1775
|
-
this.parsers = [];
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
/// Data structure used during block-level per-line parsing.
|
|
1779
|
-
class Line {
|
|
1780
|
-
constructor() {
|
|
1781
|
-
/// The line's full text.
|
|
1782
|
-
this.text = "";
|
|
1783
|
-
/// The base indent provided by the composite contexts (that have
|
|
1784
|
-
/// been handled so far).
|
|
1785
|
-
this.baseIndent = 0;
|
|
1786
|
-
/// The string position corresponding to the base indent.
|
|
1787
|
-
this.basePos = 0;
|
|
1788
|
-
/// The number of contexts handled @internal
|
|
1789
|
-
this.depth = 0;
|
|
1790
|
-
/// Any markers (i.e. block quote markers) parsed for the contexts. @internal
|
|
1791
|
-
this.markers = [];
|
|
1792
|
-
/// The position of the next non-whitespace character beyond any
|
|
1793
|
-
/// list, blockquote, or other composite block markers.
|
|
1794
|
-
this.pos = 0;
|
|
1795
|
-
/// The column of the next non-whitespace character.
|
|
1796
|
-
this.indent = 0;
|
|
1797
|
-
/// The character code of the character after `pos`.
|
|
1798
|
-
this.next = -1;
|
|
1799
|
-
}
|
|
1800
|
-
/// @internal
|
|
1801
|
-
forward() {
|
|
1802
|
-
if (this.basePos > this.pos) this.forwardInner();
|
|
1803
|
-
}
|
|
1804
|
-
/// @internal
|
|
1805
|
-
forwardInner() {
|
|
1806
|
-
let newPos = this.skipSpace(this.basePos);
|
|
1807
|
-
this.indent = this.countIndent(newPos, this.pos, this.indent);
|
|
1808
|
-
this.pos = newPos;
|
|
1809
|
-
this.next = newPos == this.text.length ? -1 : this.text.charCodeAt(newPos);
|
|
1810
|
-
}
|
|
1811
|
-
/// Skip whitespace after the given position, return the position of
|
|
1812
|
-
/// the next non-space character or the end of the line if there's
|
|
1813
|
-
/// only space after `from`.
|
|
1814
|
-
skipSpace(from) {
|
|
1815
|
-
return skipSpace(this.text, from);
|
|
1816
|
-
}
|
|
1817
|
-
/// @internal
|
|
1818
|
-
reset(text) {
|
|
1819
|
-
this.text = text;
|
|
1820
|
-
this.baseIndent = this.basePos = this.pos = this.indent = 0;
|
|
1821
|
-
this.forwardInner();
|
|
1822
|
-
this.depth = 1;
|
|
1823
|
-
while (this.markers.length) this.markers.pop();
|
|
1824
|
-
}
|
|
1825
|
-
/// Move the line's base position forward to the given position.
|
|
1826
|
-
/// This should only be called by composite [block
|
|
1827
|
-
/// parsers](#BlockParser.parse) or [markup skipping
|
|
1828
|
-
/// functions](#NodeSpec.composite).
|
|
1829
|
-
moveBase(to) {
|
|
1830
|
-
this.basePos = to;
|
|
1831
|
-
this.baseIndent = this.countIndent(to, this.pos, this.indent);
|
|
1832
|
-
}
|
|
1833
|
-
/// Move the line's base position forward to the given _column_.
|
|
1834
|
-
moveBaseColumn(indent) {
|
|
1835
|
-
this.baseIndent = indent;
|
|
1836
|
-
this.basePos = this.findColumn(indent);
|
|
1837
|
-
}
|
|
1838
|
-
/// Store a composite-block-level marker. Should be called from
|
|
1839
|
-
/// [markup skipping functions](#NodeSpec.composite) when they
|
|
1840
|
-
/// consume any non-whitespace characters.
|
|
1841
|
-
addMarker(elt) {
|
|
1842
|
-
this.markers.push(elt);
|
|
1843
|
-
}
|
|
1844
|
-
/// Find the column position at `to`, optionally starting at a given
|
|
1845
|
-
/// position and column.
|
|
1846
|
-
countIndent(to) {
|
|
1847
|
-
let from = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1848
|
-
let indent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1849
|
-
for (let i = from; i < to; i++) indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
|
|
1850
|
-
return indent;
|
|
1851
|
-
}
|
|
1852
|
-
/// Find the position corresponding to the given column.
|
|
1853
|
-
findColumn(goal) {
|
|
1854
|
-
let i = 0;
|
|
1855
|
-
for (let indent = 0; i < this.text.length && indent < goal; i++) indent += this.text.charCodeAt(i) == 9 ? 4 - indent % 4 : 1;
|
|
1856
|
-
return i;
|
|
1857
|
-
}
|
|
1858
|
-
/// @internal
|
|
1859
|
-
scrub() {
|
|
1860
|
-
if (!this.baseIndent) return this.text;
|
|
1861
|
-
let result = "";
|
|
1862
|
-
for (let i = 0; i < this.basePos; i++) result += " ";
|
|
1863
|
-
return result + this.text.slice(this.basePos);
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
function skipForList(bl, cx, line) {
|
|
1867
|
-
if (line.pos == line.text.length || bl != cx.block && line.indent >= cx.stack[line.depth + 1].value + line.baseIndent) return true;
|
|
1868
|
-
if (line.indent >= line.baseIndent + 4) return false;
|
|
1869
|
-
let size = (bl.type == Type.OrderedList ? isOrderedList : isBulletList)(line, cx, false);
|
|
1870
|
-
return size > 0 && (bl.type != Type.BulletList || isHorizontalRule(line, cx, false) < 0) && line.text.charCodeAt(line.pos + size - 1) == bl.value;
|
|
1871
|
-
}
|
|
1872
|
-
const DefaultSkipMarkup = {
|
|
1873
|
-
[Type.Blockquote](bl, cx, line) {
|
|
1874
|
-
if (line.next != 62 /* '>' */) return false;
|
|
1875
|
-
line.markers.push(elt(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1));
|
|
1876
|
-
line.moveBase(line.pos + (space(line.text.charCodeAt(line.pos + 1)) ? 2 : 1));
|
|
1877
|
-
bl.end = cx.lineStart + line.text.length;
|
|
1878
|
-
return true;
|
|
1879
|
-
},
|
|
1880
|
-
[Type.ListItem](bl, _cx, line) {
|
|
1881
|
-
if (line.indent < line.baseIndent + bl.value && line.next > -1) return false;
|
|
1882
|
-
line.moveBaseColumn(line.baseIndent + bl.value);
|
|
1883
|
-
return true;
|
|
1884
|
-
},
|
|
1885
|
-
[Type.OrderedList]: skipForList,
|
|
1886
|
-
[Type.BulletList]: skipForList,
|
|
1887
|
-
[Type.Document]() {
|
|
1888
|
-
return true;
|
|
1889
|
-
}
|
|
1890
|
-
};
|
|
1891
|
-
function space(ch) {
|
|
1892
|
-
return ch == 32 || ch == 9 || ch == 10 || ch == 13;
|
|
1893
|
-
}
|
|
1894
|
-
function skipSpace(line) {
|
|
1895
|
-
let i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1896
|
-
while (i < line.length && space(line.charCodeAt(i))) i++;
|
|
1897
|
-
return i;
|
|
1898
|
-
}
|
|
1899
|
-
function skipSpaceBack(line, i, to) {
|
|
1900
|
-
while (i > to && space(line.charCodeAt(i - 1))) i--;
|
|
1901
|
-
return i;
|
|
1902
|
-
}
|
|
1903
|
-
function isFencedCode(line) {
|
|
1904
|
-
if (line.next != 96 && line.next != 126 /* '`~' */) return -1;
|
|
1905
|
-
let pos = line.pos + 1;
|
|
1906
|
-
while (pos < line.text.length && line.text.charCodeAt(pos) == line.next) pos++;
|
|
1907
|
-
if (pos < line.pos + 3) return -1;
|
|
1908
|
-
if (line.next == 96) for (let i = pos; i < line.text.length; i++) if (line.text.charCodeAt(i) == 96) return -1;
|
|
1909
|
-
return pos;
|
|
1910
|
-
}
|
|
1911
|
-
function isBlockquote(line) {
|
|
1912
|
-
return line.next != 62 /* '>' */ ? -1 : line.text.charCodeAt(line.pos + 1) == 32 ? 2 : 1;
|
|
1913
|
-
}
|
|
1914
|
-
function isHorizontalRule(line, cx, breaking) {
|
|
1915
|
-
if (line.next != 42 && line.next != 45 && line.next != 95 /* '_-*' */) return -1;
|
|
1916
|
-
let count = 1;
|
|
1917
|
-
for (let pos = line.pos + 1; pos < line.text.length; pos++) {
|
|
1918
|
-
let ch = line.text.charCodeAt(pos);
|
|
1919
|
-
if (ch == line.next) count++;else if (!space(ch)) return -1;
|
|
1920
|
-
}
|
|
1921
|
-
// Setext headers take precedence
|
|
1922
|
-
if (breaking && line.next == 45 && isSetextUnderline(line) > -1 && line.depth == cx.stack.length) return -1;
|
|
1923
|
-
return count < 3 ? -1 : 1;
|
|
1924
|
-
}
|
|
1925
|
-
function inList(cx, type) {
|
|
1926
|
-
for (let i = cx.stack.length - 1; i >= 0; i--) if (cx.stack[i].type == type) return true;
|
|
1927
|
-
return false;
|
|
1928
|
-
}
|
|
1929
|
-
function isBulletList(line, cx, breaking) {
|
|
1930
|
-
return (line.next == 45 || line.next == 43 || line.next == 42 /* '-+*' */) && (line.pos == line.text.length - 1 || space(line.text.charCodeAt(line.pos + 1))) && (!breaking || inList(cx, Type.BulletList) || line.skipSpace(line.pos + 2) < line.text.length) ? 1 : -1;
|
|
1931
|
-
}
|
|
1932
|
-
function isOrderedList(line, cx, breaking) {
|
|
1933
|
-
let pos = line.pos,
|
|
1934
|
-
next = line.next;
|
|
1935
|
-
for (;;) {
|
|
1936
|
-
if (next >= 48 && next <= 57 /* '0-9' */) pos++;else break;
|
|
1937
|
-
if (pos == line.text.length) return -1;
|
|
1938
|
-
next = line.text.charCodeAt(pos);
|
|
1939
|
-
}
|
|
1940
|
-
if (pos == line.pos || pos > line.pos + 9 || next != 46 && next != 41 /* '.)' */ || pos < line.text.length - 1 && !space(line.text.charCodeAt(pos + 1)) || breaking && !inList(cx, Type.OrderedList) && (line.skipSpace(pos + 1) == line.text.length || pos > line.pos + 1 || line.next != 49 /* '1' */)) return -1;
|
|
1941
|
-
return pos + 1 - line.pos;
|
|
1942
|
-
}
|
|
1943
|
-
function isAtxHeading(line) {
|
|
1944
|
-
if (line.next != 35 /* '#' */) return -1;
|
|
1945
|
-
let pos = line.pos + 1;
|
|
1946
|
-
while (pos < line.text.length && line.text.charCodeAt(pos) == 35) pos++;
|
|
1947
|
-
if (pos < line.text.length && line.text.charCodeAt(pos) != 32) return -1;
|
|
1948
|
-
let size = pos - line.pos;
|
|
1949
|
-
return size > 6 ? -1 : size;
|
|
1950
|
-
}
|
|
1951
|
-
function isSetextUnderline(line) {
|
|
1952
|
-
if (line.next != 45 && line.next != 61 /* '-=' */ || line.indent >= line.baseIndent + 4) return -1;
|
|
1953
|
-
let pos = line.pos + 1;
|
|
1954
|
-
while (pos < line.text.length && line.text.charCodeAt(pos) == line.next) pos++;
|
|
1955
|
-
let end = pos;
|
|
1956
|
-
while (pos < line.text.length && space(line.text.charCodeAt(pos))) pos++;
|
|
1957
|
-
return pos == line.text.length ? end : -1;
|
|
1958
|
-
}
|
|
1959
|
-
const EmptyLine = /^[ \t]*$/,
|
|
1960
|
-
CommentEnd = /-->/,
|
|
1961
|
-
ProcessingEnd = /\?>/;
|
|
1962
|
-
const HTMLBlockStyle = [[/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i], [/^\s*<!--/, CommentEnd], [/^\s*<\?/, ProcessingEnd], [/^\s*<![A-Z]/, />/], [/^\s*<!\[CDATA\[/, /\]\]>/], [/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i, EmptyLine], [/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, EmptyLine]];
|
|
1963
|
-
function isHTMLBlock(line, _cx, breaking) {
|
|
1964
|
-
if (line.next != 60 /* '<' */) return -1;
|
|
1965
|
-
let rest = line.text.slice(line.pos);
|
|
1966
|
-
for (let i = 0, e = HTMLBlockStyle.length - (breaking ? 1 : 0); i < e; i++) if (HTMLBlockStyle[i][0].test(rest)) return i;
|
|
1967
|
-
return -1;
|
|
1968
|
-
}
|
|
1969
|
-
function getListIndent(line, pos) {
|
|
1970
|
-
let indentAfter = line.countIndent(pos, line.pos, line.indent);
|
|
1971
|
-
let indented = line.countIndent(line.skipSpace(pos), pos, indentAfter);
|
|
1972
|
-
return indented >= indentAfter + 5 ? indentAfter + 1 : indented;
|
|
1973
|
-
}
|
|
1974
|
-
function addCodeText(marks, from, to) {
|
|
1975
|
-
let last = marks.length - 1;
|
|
1976
|
-
if (last >= 0 && marks[last].to == from && marks[last].type == Type.CodeText) marks[last].to = to;else marks.push(elt(Type.CodeText, from, to));
|
|
1977
|
-
}
|
|
1978
|
-
// Rules for parsing blocks. A return value of false means the rule
|
|
1979
|
-
// doesn't apply here, true means it does. When true is returned and
|
|
1980
|
-
// `p.line` has been updated, the rule is assumed to have consumed a
|
|
1981
|
-
// leaf block. Otherwise, it is assumed to have opened a context.
|
|
1982
|
-
const DefaultBlockParsers = {
|
|
1983
|
-
LinkReference: undefined,
|
|
1984
|
-
IndentedCode(cx, line) {
|
|
1985
|
-
let base = line.baseIndent + 4;
|
|
1986
|
-
if (line.indent < base) return false;
|
|
1987
|
-
let start = line.findColumn(base);
|
|
1988
|
-
let from = cx.lineStart + start,
|
|
1989
|
-
to = cx.lineStart + line.text.length;
|
|
1990
|
-
let marks = [],
|
|
1991
|
-
pendingMarks = [];
|
|
1992
|
-
addCodeText(marks, from, to);
|
|
1993
|
-
while (cx.nextLine() && line.depth >= cx.stack.length) {
|
|
1994
|
-
if (line.pos == line.text.length) {
|
|
1995
|
-
// Empty
|
|
1996
|
-
addCodeText(pendingMarks, cx.lineStart - 1, cx.lineStart);
|
|
1997
|
-
for (let m of line.markers) pendingMarks.push(m);
|
|
1998
|
-
} else if (line.indent < base) {
|
|
1999
|
-
break;
|
|
2000
|
-
} else {
|
|
2001
|
-
if (pendingMarks.length) {
|
|
2002
|
-
for (let m of pendingMarks) {
|
|
2003
|
-
if (m.type == Type.CodeText) addCodeText(marks, m.from, m.to);else marks.push(m);
|
|
2004
|
-
}
|
|
2005
|
-
pendingMarks = [];
|
|
2006
|
-
}
|
|
2007
|
-
addCodeText(marks, cx.lineStart - 1, cx.lineStart);
|
|
2008
|
-
for (let m of line.markers) marks.push(m);
|
|
2009
|
-
to = cx.lineStart + line.text.length;
|
|
2010
|
-
let codeStart = cx.lineStart + line.findColumn(line.baseIndent + 4);
|
|
2011
|
-
if (codeStart < to) addCodeText(marks, codeStart, to);
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
if (pendingMarks.length) {
|
|
2015
|
-
pendingMarks = pendingMarks.filter(m => m.type != Type.CodeText);
|
|
2016
|
-
if (pendingMarks.length) line.markers = pendingMarks.concat(line.markers);
|
|
2017
|
-
}
|
|
2018
|
-
cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.CodeBlock, to - from), from);
|
|
2019
|
-
return true;
|
|
2020
|
-
},
|
|
2021
|
-
FencedCode(cx, line) {
|
|
2022
|
-
let fenceEnd = isFencedCode(line);
|
|
2023
|
-
if (fenceEnd < 0) return false;
|
|
2024
|
-
let from = cx.lineStart + line.pos,
|
|
2025
|
-
ch = line.next,
|
|
2026
|
-
len = fenceEnd - line.pos;
|
|
2027
|
-
let infoFrom = line.skipSpace(fenceEnd),
|
|
2028
|
-
infoTo = skipSpaceBack(line.text, line.text.length, infoFrom);
|
|
2029
|
-
let marks = [elt(Type.CodeMark, from, from + len)];
|
|
2030
|
-
if (infoFrom < infoTo) marks.push(elt(Type.CodeInfo, cx.lineStart + infoFrom, cx.lineStart + infoTo));
|
|
2031
|
-
for (let first = true; cx.nextLine() && line.depth >= cx.stack.length; first = false) {
|
|
2032
|
-
let i = line.pos;
|
|
2033
|
-
if (line.indent - line.baseIndent < 4) while (i < line.text.length && line.text.charCodeAt(i) == ch) i++;
|
|
2034
|
-
if (i - line.pos >= len && line.skipSpace(i) == line.text.length) {
|
|
2035
|
-
for (let m of line.markers) marks.push(m);
|
|
2036
|
-
marks.push(elt(Type.CodeMark, cx.lineStart + line.pos, cx.lineStart + i));
|
|
2037
|
-
cx.nextLine();
|
|
2038
|
-
break;
|
|
2039
|
-
} else {
|
|
2040
|
-
if (!first) addCodeText(marks, cx.lineStart - 1, cx.lineStart);
|
|
2041
|
-
for (let m of line.markers) marks.push(m);
|
|
2042
|
-
let textStart = cx.lineStart + line.basePos,
|
|
2043
|
-
textEnd = cx.lineStart + line.text.length;
|
|
2044
|
-
if (textStart < textEnd) addCodeText(marks, textStart, textEnd);
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
cx.addNode(cx.buffer.writeElements(marks, -from).finish(Type.FencedCode, cx.prevLineEnd() - from), from);
|
|
2048
|
-
return true;
|
|
2049
|
-
},
|
|
2050
|
-
Blockquote(cx, line) {
|
|
2051
|
-
let size = isBlockquote(line);
|
|
2052
|
-
if (size < 0) return false;
|
|
2053
|
-
cx.startContext(Type.Blockquote, line.pos);
|
|
2054
|
-
cx.addNode(Type.QuoteMark, cx.lineStart + line.pos, cx.lineStart + line.pos + 1);
|
|
2055
|
-
line.moveBase(line.pos + size);
|
|
2056
|
-
return null;
|
|
2057
|
-
},
|
|
2058
|
-
HorizontalRule(cx, line) {
|
|
2059
|
-
if (isHorizontalRule(line, cx, false) < 0) return false;
|
|
2060
|
-
let from = cx.lineStart + line.pos;
|
|
2061
|
-
cx.nextLine();
|
|
2062
|
-
cx.addNode(Type.HorizontalRule, from);
|
|
2063
|
-
return true;
|
|
2064
|
-
},
|
|
2065
|
-
BulletList(cx, line) {
|
|
2066
|
-
let size = isBulletList(line, cx, false);
|
|
2067
|
-
if (size < 0) return false;
|
|
2068
|
-
if (cx.block.type != Type.BulletList) cx.startContext(Type.BulletList, line.basePos, line.next);
|
|
2069
|
-
let newBase = getListIndent(line, line.pos + 1);
|
|
2070
|
-
cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
|
|
2071
|
-
cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
|
|
2072
|
-
line.moveBaseColumn(newBase);
|
|
2073
|
-
return null;
|
|
2074
|
-
},
|
|
2075
|
-
OrderedList(cx, line) {
|
|
2076
|
-
let size = isOrderedList(line, cx, false);
|
|
2077
|
-
if (size < 0) return false;
|
|
2078
|
-
if (cx.block.type != Type.OrderedList) cx.startContext(Type.OrderedList, line.basePos, line.text.charCodeAt(line.pos + size - 1));
|
|
2079
|
-
let newBase = getListIndent(line, line.pos + size);
|
|
2080
|
-
cx.startContext(Type.ListItem, line.basePos, newBase - line.baseIndent);
|
|
2081
|
-
cx.addNode(Type.ListMark, cx.lineStart + line.pos, cx.lineStart + line.pos + size);
|
|
2082
|
-
line.moveBaseColumn(newBase);
|
|
2083
|
-
return null;
|
|
2084
|
-
},
|
|
2085
|
-
ATXHeading(cx, line) {
|
|
2086
|
-
let size = isAtxHeading(line);
|
|
2087
|
-
if (size < 0) return false;
|
|
2088
|
-
let off = line.pos,
|
|
2089
|
-
from = cx.lineStart + off;
|
|
2090
|
-
let endOfSpace = skipSpaceBack(line.text, line.text.length, off),
|
|
2091
|
-
after = endOfSpace;
|
|
2092
|
-
while (after > off && line.text.charCodeAt(after - 1) == line.next) after--;
|
|
2093
|
-
if (after == endOfSpace || after == off || !space(line.text.charCodeAt(after - 1))) after = line.text.length;
|
|
2094
|
-
let buf = cx.buffer.write(Type.HeaderMark, 0, size).writeElements(cx.parser.parseInline(line.text.slice(off + size + 1, after), from + size + 1), -from);
|
|
2095
|
-
if (after < line.text.length) buf.write(Type.HeaderMark, after - off, endOfSpace - off);
|
|
2096
|
-
let node = buf.finish(Type.ATXHeading1 - 1 + size, line.text.length - off);
|
|
2097
|
-
cx.nextLine();
|
|
2098
|
-
cx.addNode(node, from);
|
|
2099
|
-
return true;
|
|
2100
|
-
},
|
|
2101
|
-
HTMLBlock(cx, line) {
|
|
2102
|
-
let type = isHTMLBlock(line, cx, false);
|
|
2103
|
-
if (type < 0) return false;
|
|
2104
|
-
let from = cx.lineStart + line.pos,
|
|
2105
|
-
end = HTMLBlockStyle[type][1];
|
|
2106
|
-
let marks = [],
|
|
2107
|
-
trailing = end != EmptyLine;
|
|
2108
|
-
while (!end.test(line.text) && cx.nextLine()) {
|
|
2109
|
-
if (line.depth < cx.stack.length) {
|
|
2110
|
-
trailing = false;
|
|
2111
|
-
break;
|
|
2112
|
-
}
|
|
2113
|
-
for (let m of line.markers) marks.push(m);
|
|
2114
|
-
}
|
|
2115
|
-
if (trailing) cx.nextLine();
|
|
2116
|
-
let nodeType = end == CommentEnd ? Type.CommentBlock : end == ProcessingEnd ? Type.ProcessingInstructionBlock : Type.HTMLBlock;
|
|
2117
|
-
let to = cx.prevLineEnd();
|
|
2118
|
-
cx.addNode(cx.buffer.writeElements(marks, -from).finish(nodeType, to - from), from);
|
|
2119
|
-
return true;
|
|
2120
|
-
},
|
|
2121
|
-
SetextHeading: undefined // Specifies relative precedence for block-continue function
|
|
2122
|
-
};
|
|
2123
|
-
// This implements a state machine that incrementally parses link references. At each
|
|
2124
|
-
// next line, it looks ahead to see if the line continues the reference or not. If it
|
|
2125
|
-
// doesn't and a valid link is available ending before that line, it finishes that.
|
|
2126
|
-
// Similarly, on `finish` (when the leaf is terminated by external circumstances), it
|
|
2127
|
-
// creates a link reference if there's a valid reference up to the current point.
|
|
2128
|
-
class LinkReferenceParser {
|
|
2129
|
-
constructor(leaf) {
|
|
2130
|
-
this.stage = 0 /* Start */;
|
|
2131
|
-
this.elts = [];
|
|
2132
|
-
this.pos = 0;
|
|
2133
|
-
this.start = leaf.start;
|
|
2134
|
-
this.advance(leaf.content);
|
|
2135
|
-
}
|
|
2136
|
-
nextLine(cx, line, leaf) {
|
|
2137
|
-
if (this.stage == -1 /* Failed */) return false;
|
|
2138
|
-
let content = leaf.content + "\n" + line.scrub();
|
|
2139
|
-
let finish = this.advance(content);
|
|
2140
|
-
if (finish > -1 && finish < content.length) return this.complete(cx, leaf, finish);
|
|
2141
|
-
return false;
|
|
2142
|
-
}
|
|
2143
|
-
finish(cx, leaf) {
|
|
2144
|
-
if ((this.stage == 2 /* Link */ || this.stage == 3 /* Title */) && skipSpace(leaf.content, this.pos) == leaf.content.length) return this.complete(cx, leaf, leaf.content.length);
|
|
2145
|
-
return false;
|
|
2146
|
-
}
|
|
2147
|
-
complete(cx, leaf, len) {
|
|
2148
|
-
cx.addLeafElement(leaf, elt(Type.LinkReference, this.start, this.start + len, this.elts));
|
|
2149
|
-
return true;
|
|
2150
|
-
}
|
|
2151
|
-
nextStage(elt) {
|
|
2152
|
-
if (elt) {
|
|
2153
|
-
this.pos = elt.to - this.start;
|
|
2154
|
-
this.elts.push(elt);
|
|
2155
|
-
this.stage++;
|
|
2156
|
-
return true;
|
|
2157
|
-
}
|
|
2158
|
-
if (elt === false) this.stage = -1 /* Failed */;
|
|
2159
|
-
return false;
|
|
2160
|
-
}
|
|
2161
|
-
advance(content) {
|
|
2162
|
-
for (;;) {
|
|
2163
|
-
if (this.stage == -1 /* Failed */) {
|
|
2164
|
-
return -1;
|
|
2165
|
-
} else if (this.stage == 0 /* Start */) {
|
|
2166
|
-
if (!this.nextStage(parseLinkLabel(content, this.pos, this.start, true))) return -1;
|
|
2167
|
-
if (content.charCodeAt(this.pos) != 58 /* ':' */) return this.stage = -1 /* Failed */;
|
|
2168
|
-
this.elts.push(elt(Type.LinkMark, this.pos + this.start, this.pos + this.start + 1));
|
|
2169
|
-
this.pos++;
|
|
2170
|
-
} else if (this.stage == 1 /* Label */) {
|
|
2171
|
-
if (!this.nextStage(parseURL(content, skipSpace(content, this.pos), this.start))) return -1;
|
|
2172
|
-
} else if (this.stage == 2 /* Link */) {
|
|
2173
|
-
let skip = skipSpace(content, this.pos),
|
|
2174
|
-
end = 0;
|
|
2175
|
-
if (skip > this.pos) {
|
|
2176
|
-
let title = parseLinkTitle(content, skip, this.start);
|
|
2177
|
-
if (title) {
|
|
2178
|
-
let titleEnd = lineEnd(content, title.to - this.start);
|
|
2179
|
-
if (titleEnd > 0) {
|
|
2180
|
-
this.nextStage(title);
|
|
2181
|
-
end = titleEnd;
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
if (!end) end = lineEnd(content, this.pos);
|
|
2186
|
-
return end > 0 && end < content.length ? end : -1;
|
|
2187
|
-
} else {
|
|
2188
|
-
// RefStage.Title
|
|
2189
|
-
return lineEnd(content, this.pos);
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
function lineEnd(text, pos) {
|
|
2195
|
-
for (; pos < text.length; pos++) {
|
|
2196
|
-
let next = text.charCodeAt(pos);
|
|
2197
|
-
if (next == 10) break;
|
|
2198
|
-
if (!space(next)) return -1;
|
|
2199
|
-
}
|
|
2200
|
-
return pos;
|
|
2201
|
-
}
|
|
2202
|
-
class SetextHeadingParser {
|
|
2203
|
-
nextLine(cx, line, leaf) {
|
|
2204
|
-
let underline = line.depth < cx.stack.length ? -1 : isSetextUnderline(line);
|
|
2205
|
-
let next = line.next;
|
|
2206
|
-
if (underline < 0) return false;
|
|
2207
|
-
let underlineMark = elt(Type.HeaderMark, cx.lineStart + line.pos, cx.lineStart + underline);
|
|
2208
|
-
cx.nextLine();
|
|
2209
|
-
cx.addLeafElement(leaf, elt(next == 61 ? Type.SetextHeading1 : Type.SetextHeading2, leaf.start, cx.prevLineEnd(), [...cx.parser.parseInline(leaf.content, leaf.start), underlineMark]));
|
|
2210
|
-
return true;
|
|
2211
|
-
}
|
|
2212
|
-
finish() {
|
|
2213
|
-
return false;
|
|
2214
|
-
}
|
|
2215
|
-
}
|
|
2216
|
-
const DefaultLeafBlocks = {
|
|
2217
|
-
LinkReference(_, leaf) {
|
|
2218
|
-
return leaf.content.charCodeAt(0) == 91 /* '[' */ ? new LinkReferenceParser(leaf) : null;
|
|
2219
|
-
},
|
|
2220
|
-
SetextHeading() {
|
|
2221
|
-
return new SetextHeadingParser();
|
|
2222
|
-
}
|
|
2223
|
-
};
|
|
2224
|
-
const DefaultEndLeaf = [(_, line) => isAtxHeading(line) >= 0, (_, line) => isFencedCode(line) >= 0, (_, line) => isBlockquote(line) >= 0, (p, line) => isBulletList(line, p, true) >= 0, (p, line) => isOrderedList(line, p, true) >= 0, (p, line) => isHorizontalRule(line, p, true) >= 0, (p, line) => isHTMLBlock(line, p, true) >= 0];
|
|
2225
|
-
const scanLineResult = {
|
|
2226
|
-
text: "",
|
|
2227
|
-
end: 0
|
|
2228
|
-
};
|
|
2229
|
-
/// Block-level parsing functions get access to this context object.
|
|
2230
|
-
class BlockContext {
|
|
2231
|
-
/// @internal
|
|
2232
|
-
constructor(
|
|
2233
|
-
/// The parser configuration used.
|
|
2234
|
-
parser,
|
|
2235
|
-
/// @internal
|
|
2236
|
-
input, fragments,
|
|
2237
|
-
/// @internal
|
|
2238
|
-
ranges) {
|
|
2239
|
-
this.parser = parser;
|
|
2240
|
-
this.input = input;
|
|
2241
|
-
this.ranges = ranges;
|
|
2242
|
-
this.line = new Line();
|
|
2243
|
-
this.atEnd = false;
|
|
2244
|
-
/// @internal
|
|
2245
|
-
this.dontInject = new Set();
|
|
2246
|
-
this.stoppedAt = null;
|
|
2247
|
-
/// The range index that absoluteLineStart points into @internal
|
|
2248
|
-
this.rangeI = 0;
|
|
2249
|
-
this.to = ranges[ranges.length - 1].to;
|
|
2250
|
-
this.lineStart = this.absoluteLineStart = this.absoluteLineEnd = ranges[0].from;
|
|
2251
|
-
this.block = CompositeBlock.create(Type.Document, 0, this.lineStart, 0, 0);
|
|
2252
|
-
this.stack = [this.block];
|
|
2253
|
-
this.fragments = fragments.length ? new FragmentCursor(fragments, input) : null;
|
|
2254
|
-
this.readLine();
|
|
2255
|
-
}
|
|
2256
|
-
get parsedPos() {
|
|
2257
|
-
return this.absoluteLineStart;
|
|
2258
|
-
}
|
|
2259
|
-
advance() {
|
|
2260
|
-
if (this.stoppedAt != null && this.absoluteLineStart > this.stoppedAt) return this.finish();
|
|
2261
|
-
let {
|
|
2262
|
-
line
|
|
2263
|
-
} = this;
|
|
2264
|
-
for (;;) {
|
|
2265
|
-
while (line.depth < this.stack.length) this.finishContext();
|
|
2266
|
-
for (let mark of line.markers) this.addNode(mark.type, mark.from, mark.to);
|
|
2267
|
-
if (line.pos < line.text.length) break;
|
|
2268
|
-
// Empty line
|
|
2269
|
-
if (!this.nextLine()) return this.finish();
|
|
2270
|
-
}
|
|
2271
|
-
if (this.fragments && this.reuseFragment(line.basePos)) return null;
|
|
2272
|
-
start: for (;;) {
|
|
2273
|
-
for (let type of this.parser.blockParsers) if (type) {
|
|
2274
|
-
let result = type(this, line);
|
|
2275
|
-
if (result != false) {
|
|
2276
|
-
if (result == true) return null;
|
|
2277
|
-
line.forward();
|
|
2278
|
-
continue start;
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
|
-
break;
|
|
2282
|
-
}
|
|
2283
|
-
let leaf = new LeafBlock(this.lineStart + line.pos, line.text.slice(line.pos));
|
|
2284
|
-
for (let parse of this.parser.leafBlockParsers) if (parse) {
|
|
2285
|
-
let parser = parse(this, leaf);
|
|
2286
|
-
if (parser) leaf.parsers.push(parser);
|
|
2287
|
-
}
|
|
2288
|
-
lines: while (this.nextLine()) {
|
|
2289
|
-
if (line.pos == line.text.length) break;
|
|
2290
|
-
if (line.indent < line.baseIndent + 4) {
|
|
2291
|
-
for (let stop of this.parser.endLeafBlock) if (stop(this, line, leaf)) break lines;
|
|
2292
|
-
}
|
|
2293
|
-
for (let parser of leaf.parsers) if (parser.nextLine(this, line, leaf)) return null;
|
|
2294
|
-
leaf.content += "\n" + line.scrub();
|
|
2295
|
-
for (let m of line.markers) leaf.marks.push(m);
|
|
2296
|
-
}
|
|
2297
|
-
this.finishLeaf(leaf);
|
|
2298
|
-
return null;
|
|
2299
|
-
}
|
|
2300
|
-
stopAt(pos) {
|
|
2301
|
-
if (this.stoppedAt != null && this.stoppedAt < pos) throw new RangeError("Can't move stoppedAt forward");
|
|
2302
|
-
this.stoppedAt = pos;
|
|
2303
|
-
}
|
|
2304
|
-
reuseFragment(start) {
|
|
2305
|
-
if (!this.fragments.moveTo(this.absoluteLineStart + start, this.absoluteLineStart) || !this.fragments.matches(this.block.hash)) return false;
|
|
2306
|
-
let taken = this.fragments.takeNodes(this);
|
|
2307
|
-
if (!taken) return false;
|
|
2308
|
-
let withoutGaps = taken,
|
|
2309
|
-
end = this.absoluteLineStart + taken;
|
|
2310
|
-
for (let i = 1; i < this.ranges.length; i++) {
|
|
2311
|
-
let gapFrom = this.ranges[i - 1].to,
|
|
2312
|
-
gapTo = this.ranges[i].from;
|
|
2313
|
-
if (gapFrom >= this.lineStart && gapTo < end) withoutGaps -= gapTo - gapFrom;
|
|
2314
|
-
}
|
|
2315
|
-
this.lineStart += withoutGaps;
|
|
2316
|
-
this.absoluteLineStart += taken;
|
|
2317
|
-
this.moveRangeI();
|
|
2318
|
-
if (this.absoluteLineStart < this.to) {
|
|
2319
|
-
this.lineStart++;
|
|
2320
|
-
this.absoluteLineStart++;
|
|
2321
|
-
this.readLine();
|
|
2322
|
-
} else {
|
|
2323
|
-
this.atEnd = true;
|
|
2324
|
-
this.readLine();
|
|
2325
|
-
}
|
|
2326
|
-
return true;
|
|
2327
|
-
}
|
|
2328
|
-
/// The number of parent blocks surrounding the current block.
|
|
2329
|
-
get depth() {
|
|
2330
|
-
return this.stack.length;
|
|
2331
|
-
}
|
|
2332
|
-
/// Get the type of the parent block at the given depth. When no
|
|
2333
|
-
/// depth is passed, return the type of the innermost parent.
|
|
2334
|
-
parentType() {
|
|
2335
|
-
let depth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.depth - 1;
|
|
2336
|
-
return this.parser.nodeSet.types[this.stack[depth].type];
|
|
2337
|
-
}
|
|
2338
|
-
/// Move to the next input line. This should only be called by
|
|
2339
|
-
/// (non-composite) [block parsers](#BlockParser.parse) that consume
|
|
2340
|
-
/// the line directly, or leaf block parser
|
|
2341
|
-
/// [`nextLine`](#LeafBlockParser.nextLine) methods when they
|
|
2342
|
-
/// consume the current line (and return true).
|
|
2343
|
-
nextLine() {
|
|
2344
|
-
this.lineStart += this.line.text.length;
|
|
2345
|
-
if (this.absoluteLineEnd >= this.to) {
|
|
2346
|
-
this.absoluteLineStart = this.absoluteLineEnd;
|
|
2347
|
-
this.atEnd = true;
|
|
2348
|
-
this.readLine();
|
|
2349
|
-
return false;
|
|
2350
|
-
} else {
|
|
2351
|
-
this.lineStart++;
|
|
2352
|
-
this.absoluteLineStart = this.absoluteLineEnd + 1;
|
|
2353
|
-
this.moveRangeI();
|
|
2354
|
-
this.readLine();
|
|
2355
|
-
return true;
|
|
2356
|
-
}
|
|
2357
|
-
}
|
|
2358
|
-
moveRangeI() {
|
|
2359
|
-
while (this.rangeI < this.ranges.length - 1 && this.absoluteLineStart >= this.ranges[this.rangeI].to) {
|
|
2360
|
-
this.rangeI++;
|
|
2361
|
-
this.absoluteLineStart = Math.max(this.absoluteLineStart, this.ranges[this.rangeI].from);
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
2364
|
-
/// @internal
|
|
2365
|
-
scanLine(start) {
|
|
2366
|
-
let r = scanLineResult;
|
|
2367
|
-
r.end = start;
|
|
2368
|
-
if (start >= this.to) {
|
|
2369
|
-
r.text = "";
|
|
2370
|
-
} else {
|
|
2371
|
-
r.text = this.lineChunkAt(start);
|
|
2372
|
-
r.end += r.text.length;
|
|
2373
|
-
if (this.ranges.length > 1) {
|
|
2374
|
-
let textOffset = this.absoluteLineStart,
|
|
2375
|
-
rangeI = this.rangeI;
|
|
2376
|
-
while (this.ranges[rangeI].to < r.end) {
|
|
2377
|
-
rangeI++;
|
|
2378
|
-
let nextFrom = this.ranges[rangeI].from;
|
|
2379
|
-
let after = this.lineChunkAt(nextFrom);
|
|
2380
|
-
r.end = nextFrom + after.length;
|
|
2381
|
-
r.text = r.text.slice(0, this.ranges[rangeI - 1].to - textOffset) + after;
|
|
2382
|
-
textOffset = r.end - r.text.length;
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
return r;
|
|
2387
|
-
}
|
|
2388
|
-
/// @internal
|
|
2389
|
-
readLine() {
|
|
2390
|
-
let {
|
|
2391
|
-
line
|
|
2392
|
-
} = this,
|
|
2393
|
-
{
|
|
2394
|
-
text,
|
|
2395
|
-
end
|
|
2396
|
-
} = this.scanLine(this.absoluteLineStart);
|
|
2397
|
-
this.absoluteLineEnd = end;
|
|
2398
|
-
line.reset(text);
|
|
2399
|
-
for (; line.depth < this.stack.length; line.depth++) {
|
|
2400
|
-
let cx = this.stack[line.depth],
|
|
2401
|
-
handler = this.parser.skipContextMarkup[cx.type];
|
|
2402
|
-
if (!handler) throw new Error("Unhandled block context " + Type[cx.type]);
|
|
2403
|
-
if (!handler(cx, this, line)) break;
|
|
2404
|
-
line.forward();
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
lineChunkAt(pos) {
|
|
2408
|
-
let next = this.input.chunk(pos),
|
|
2409
|
-
text;
|
|
2410
|
-
if (!this.input.lineChunks) {
|
|
2411
|
-
let eol = next.indexOf("\n");
|
|
2412
|
-
text = eol < 0 ? next : next.slice(0, eol);
|
|
2413
|
-
} else {
|
|
2414
|
-
text = next == "\n" ? "" : next;
|
|
2415
|
-
}
|
|
2416
|
-
return pos + text.length > this.to ? text.slice(0, this.to - pos) : text;
|
|
2417
|
-
}
|
|
2418
|
-
/// The end position of the previous line.
|
|
2419
|
-
prevLineEnd() {
|
|
2420
|
-
return this.atEnd ? this.lineStart : this.lineStart - 1;
|
|
2421
|
-
}
|
|
2422
|
-
/// @internal
|
|
2423
|
-
startContext(type, start) {
|
|
2424
|
-
let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
2425
|
-
this.block = CompositeBlock.create(type, value, this.lineStart + start, this.block.hash, this.lineStart + this.line.text.length);
|
|
2426
|
-
this.stack.push(this.block);
|
|
2427
|
-
}
|
|
2428
|
-
/// Start a composite block. Should only be called from [block
|
|
2429
|
-
/// parser functions](#BlockParser.parse) that return null.
|
|
2430
|
-
startComposite(type, start) {
|
|
2431
|
-
let value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
2432
|
-
this.startContext(this.parser.getNodeType(type), start, value);
|
|
2433
|
-
}
|
|
2434
|
-
/// @internal
|
|
2435
|
-
addNode(block, from, to) {
|
|
2436
|
-
if (typeof block == "number") block = new Tree(this.parser.nodeSet.types[block], none, none, (to !== null && to !== void 0 ? to : this.prevLineEnd()) - from);
|
|
2437
|
-
this.block.addChild(block, from - this.block.from);
|
|
2438
|
-
}
|
|
2439
|
-
/// Add a block element. Can be called by [block
|
|
2440
|
-
/// parsers](#BlockParser.parse).
|
|
2441
|
-
addElement(elt) {
|
|
2442
|
-
this.block.addChild(elt.toTree(this.parser.nodeSet), elt.from - this.block.from);
|
|
2443
|
-
}
|
|
2444
|
-
/// Add a block element from a [leaf parser](#LeafBlockParser). This
|
|
2445
|
-
/// makes sure any extra composite block markup (such as blockquote
|
|
2446
|
-
/// markers) inside the block are also added to the syntax tree.
|
|
2447
|
-
addLeafElement(leaf, elt) {
|
|
2448
|
-
this.addNode(this.buffer.writeElements(injectMarks(elt.children, leaf.marks), -elt.from).finish(elt.type, elt.to - elt.from), elt.from);
|
|
2449
|
-
}
|
|
2450
|
-
/// @internal
|
|
2451
|
-
finishContext() {
|
|
2452
|
-
let cx = this.stack.pop();
|
|
2453
|
-
let top = this.stack[this.stack.length - 1];
|
|
2454
|
-
top.addChild(cx.toTree(this.parser.nodeSet), cx.from - top.from);
|
|
2455
|
-
this.block = top;
|
|
2456
|
-
}
|
|
2457
|
-
finish() {
|
|
2458
|
-
while (this.stack.length > 1) this.finishContext();
|
|
2459
|
-
return this.addGaps(this.block.toTree(this.parser.nodeSet, this.lineStart));
|
|
2460
|
-
}
|
|
2461
|
-
addGaps(tree) {
|
|
2462
|
-
return this.ranges.length > 1 ? injectGaps(this.ranges, 0, tree.topNode, this.ranges[0].from, this.dontInject) : tree;
|
|
2463
|
-
}
|
|
2464
|
-
/// @internal
|
|
2465
|
-
finishLeaf(leaf) {
|
|
2466
|
-
for (let parser of leaf.parsers) if (parser.finish(this, leaf)) return;
|
|
2467
|
-
let inline = injectMarks(this.parser.parseInline(leaf.content, leaf.start), leaf.marks);
|
|
2468
|
-
this.addNode(this.buffer.writeElements(inline, -leaf.start).finish(Type.Paragraph, leaf.content.length), leaf.start);
|
|
2469
|
-
}
|
|
2470
|
-
elt(type, from, to, children) {
|
|
2471
|
-
if (typeof type == "string") return elt(this.parser.getNodeType(type), from, to, children);
|
|
2472
|
-
return new TreeElement(type, from);
|
|
2473
|
-
}
|
|
2474
|
-
/// @internal
|
|
2475
|
-
get buffer() {
|
|
2476
|
-
return new Buffer(this.parser.nodeSet);
|
|
2477
|
-
}
|
|
2478
|
-
}
|
|
2479
|
-
function injectGaps(ranges, rangeI, tree, offset, dont) {
|
|
2480
|
-
if (dont.has(tree.tree)) return tree.tree;
|
|
2481
|
-
let rangeEnd = ranges[rangeI].to;
|
|
2482
|
-
let children = [],
|
|
2483
|
-
positions = [],
|
|
2484
|
-
start = tree.from + offset;
|
|
2485
|
-
function movePastNext(upto, inclusive) {
|
|
2486
|
-
while (inclusive ? upto >= rangeEnd : upto > rangeEnd) {
|
|
2487
|
-
let size = ranges[rangeI + 1].from - rangeEnd;
|
|
2488
|
-
offset += size;
|
|
2489
|
-
upto += size;
|
|
2490
|
-
rangeI++;
|
|
2491
|
-
rangeEnd = ranges[rangeI].to;
|
|
2492
|
-
}
|
|
2493
|
-
}
|
|
2494
|
-
for (let ch = tree.firstChild; ch; ch = ch.nextSibling) {
|
|
2495
|
-
movePastNext(ch.from + offset, true);
|
|
2496
|
-
let from = ch.from + offset,
|
|
2497
|
-
node;
|
|
2498
|
-
if (ch.to + offset > rangeEnd) {
|
|
2499
|
-
node = injectGaps(ranges, rangeI, ch, offset, dont);
|
|
2500
|
-
movePastNext(ch.to + offset, false);
|
|
2501
|
-
} else {
|
|
2502
|
-
node = ch.toTree();
|
|
2503
|
-
}
|
|
2504
|
-
children.push(node);
|
|
2505
|
-
positions.push(from - start);
|
|
2506
|
-
}
|
|
2507
|
-
movePastNext(tree.to + offset, false);
|
|
2508
|
-
return new Tree(tree.type, children, positions, tree.to + offset - start, tree.tree ? tree.tree.propValues : undefined);
|
|
2509
|
-
}
|
|
2510
|
-
/// A Markdown parser configuration.
|
|
2511
|
-
class MarkdownParser extends Parser {
|
|
2512
|
-
/// @internal
|
|
2513
|
-
constructor(
|
|
2514
|
-
/// The parser's syntax [node
|
|
2515
|
-
/// types](https://lezer.codemirror.net/docs/ref/#common.NodeSet).
|
|
2516
|
-
nodeSet,
|
|
2517
|
-
/// @internal
|
|
2518
|
-
blockParsers,
|
|
2519
|
-
/// @internal
|
|
2520
|
-
leafBlockParsers,
|
|
2521
|
-
/// @internal
|
|
2522
|
-
blockNames,
|
|
2523
|
-
/// @internal
|
|
2524
|
-
endLeafBlock,
|
|
2525
|
-
/// @internal
|
|
2526
|
-
skipContextMarkup,
|
|
2527
|
-
/// @internal
|
|
2528
|
-
inlineParsers,
|
|
2529
|
-
/// @internal
|
|
2530
|
-
inlineNames,
|
|
2531
|
-
/// @internal
|
|
2532
|
-
wrappers) {
|
|
2533
|
-
super();
|
|
2534
|
-
this.nodeSet = nodeSet;
|
|
2535
|
-
this.blockParsers = blockParsers;
|
|
2536
|
-
this.leafBlockParsers = leafBlockParsers;
|
|
2537
|
-
this.blockNames = blockNames;
|
|
2538
|
-
this.endLeafBlock = endLeafBlock;
|
|
2539
|
-
this.skipContextMarkup = skipContextMarkup;
|
|
2540
|
-
this.inlineParsers = inlineParsers;
|
|
2541
|
-
this.inlineNames = inlineNames;
|
|
2542
|
-
this.wrappers = wrappers;
|
|
2543
|
-
/// @internal
|
|
2544
|
-
this.nodeTypes = Object.create(null);
|
|
2545
|
-
for (let t of nodeSet.types) this.nodeTypes[t.name] = t.id;
|
|
2546
|
-
}
|
|
2547
|
-
createParse(input, fragments, ranges) {
|
|
2548
|
-
let parse = new BlockContext(this, input, fragments, ranges);
|
|
2549
|
-
for (let w of this.wrappers) parse = w(parse, input, fragments, ranges);
|
|
2550
|
-
return parse;
|
|
2551
|
-
}
|
|
2552
|
-
/// Reconfigure the parser.
|
|
2553
|
-
configure(spec) {
|
|
2554
|
-
let config = resolveConfig(spec);
|
|
2555
|
-
if (!config) return this;
|
|
2556
|
-
let {
|
|
2557
|
-
nodeSet,
|
|
2558
|
-
skipContextMarkup
|
|
2559
|
-
} = this;
|
|
2560
|
-
let blockParsers = this.blockParsers.slice(),
|
|
2561
|
-
leafBlockParsers = this.leafBlockParsers.slice(),
|
|
2562
|
-
blockNames = this.blockNames.slice(),
|
|
2563
|
-
inlineParsers = this.inlineParsers.slice(),
|
|
2564
|
-
inlineNames = this.inlineNames.slice(),
|
|
2565
|
-
endLeafBlock = this.endLeafBlock.slice(),
|
|
2566
|
-
wrappers = this.wrappers;
|
|
2567
|
-
if (nonEmpty(config.defineNodes)) {
|
|
2568
|
-
skipContextMarkup = Object.assign({}, skipContextMarkup);
|
|
2569
|
-
let nodeTypes = nodeSet.types.slice(),
|
|
2570
|
-
styles;
|
|
2571
|
-
for (let s of config.defineNodes) {
|
|
2572
|
-
let {
|
|
2573
|
-
name,
|
|
2574
|
-
block,
|
|
2575
|
-
composite,
|
|
2576
|
-
style
|
|
2577
|
-
} = typeof s == "string" ? {
|
|
2578
|
-
name: s
|
|
2579
|
-
} : s;
|
|
2580
|
-
if (nodeTypes.some(t => t.name == name)) continue;
|
|
2581
|
-
if (composite) skipContextMarkup[nodeTypes.length] = (bl, cx, line) => composite(cx, line, bl.value);
|
|
2582
|
-
let id = nodeTypes.length;
|
|
2583
|
-
let group = composite ? ["Block", "BlockContext"] : !block ? undefined : id >= Type.ATXHeading1 && id <= Type.SetextHeading2 ? ["Block", "LeafBlock", "Heading"] : ["Block", "LeafBlock"];
|
|
2584
|
-
nodeTypes.push(NodeType.define({
|
|
2585
|
-
id,
|
|
2586
|
-
name,
|
|
2587
|
-
props: group && [[NodeProp.group, group]]
|
|
2588
|
-
}));
|
|
2589
|
-
if (style) {
|
|
2590
|
-
if (!styles) styles = {};
|
|
2591
|
-
if (Array.isArray(style) || style instanceof Tag) styles[name] = style;else Object.assign(styles, style);
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
nodeSet = new NodeSet(nodeTypes);
|
|
2595
|
-
if (styles) nodeSet = nodeSet.extend(styleTags(styles));
|
|
2596
|
-
}
|
|
2597
|
-
if (nonEmpty(config.props)) nodeSet = nodeSet.extend(...config.props);
|
|
2598
|
-
if (nonEmpty(config.remove)) {
|
|
2599
|
-
for (let rm of config.remove) {
|
|
2600
|
-
let block = this.blockNames.indexOf(rm),
|
|
2601
|
-
inline = this.inlineNames.indexOf(rm);
|
|
2602
|
-
if (block > -1) blockParsers[block] = leafBlockParsers[block] = undefined;
|
|
2603
|
-
if (inline > -1) inlineParsers[inline] = undefined;
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
if (nonEmpty(config.parseBlock)) {
|
|
2607
|
-
for (let spec of config.parseBlock) {
|
|
2608
|
-
let found = blockNames.indexOf(spec.name);
|
|
2609
|
-
if (found > -1) {
|
|
2610
|
-
blockParsers[found] = spec.parse;
|
|
2611
|
-
leafBlockParsers[found] = spec.leaf;
|
|
2612
|
-
} else {
|
|
2613
|
-
let pos = spec.before ? findName(blockNames, spec.before) : spec.after ? findName(blockNames, spec.after) + 1 : blockNames.length - 1;
|
|
2614
|
-
blockParsers.splice(pos, 0, spec.parse);
|
|
2615
|
-
leafBlockParsers.splice(pos, 0, spec.leaf);
|
|
2616
|
-
blockNames.splice(pos, 0, spec.name);
|
|
2617
|
-
}
|
|
2618
|
-
if (spec.endLeaf) endLeafBlock.push(spec.endLeaf);
|
|
2619
|
-
}
|
|
2620
|
-
}
|
|
2621
|
-
if (nonEmpty(config.parseInline)) {
|
|
2622
|
-
for (let spec of config.parseInline) {
|
|
2623
|
-
let found = inlineNames.indexOf(spec.name);
|
|
2624
|
-
if (found > -1) {
|
|
2625
|
-
inlineParsers[found] = spec.parse;
|
|
2626
|
-
} else {
|
|
2627
|
-
let pos = spec.before ? findName(inlineNames, spec.before) : spec.after ? findName(inlineNames, spec.after) + 1 : inlineNames.length - 1;
|
|
2628
|
-
inlineParsers.splice(pos, 0, spec.parse);
|
|
2629
|
-
inlineNames.splice(pos, 0, spec.name);
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
}
|
|
2633
|
-
if (config.wrap) wrappers = wrappers.concat(config.wrap);
|
|
2634
|
-
return new MarkdownParser(nodeSet, blockParsers, leafBlockParsers, blockNames, endLeafBlock, skipContextMarkup, inlineParsers, inlineNames, wrappers);
|
|
2635
|
-
}
|
|
2636
|
-
/// @internal
|
|
2637
|
-
getNodeType(name) {
|
|
2638
|
-
let found = this.nodeTypes[name];
|
|
2639
|
-
if (found == null) throw new RangeError(`Unknown node type '${name}'`);
|
|
2640
|
-
return found;
|
|
2641
|
-
}
|
|
2642
|
-
/// Parse the given piece of inline text at the given offset,
|
|
2643
|
-
/// returning an array of [`Element`](#Element) objects representing
|
|
2644
|
-
/// the inline content.
|
|
2645
|
-
parseInline(text, offset) {
|
|
2646
|
-
let cx = new InlineContext(this, text, offset);
|
|
2647
|
-
outer: for (let pos = offset; pos < cx.end;) {
|
|
2648
|
-
let next = cx.char(pos);
|
|
2649
|
-
for (let token of this.inlineParsers) if (token) {
|
|
2650
|
-
let result = token(cx, next, pos);
|
|
2651
|
-
if (result >= 0) {
|
|
2652
|
-
pos = result;
|
|
2653
|
-
continue outer;
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
pos++;
|
|
2657
|
-
}
|
|
2658
|
-
return cx.resolveMarkers(0);
|
|
2659
|
-
}
|
|
2660
|
-
}
|
|
2661
|
-
function nonEmpty(a) {
|
|
2662
|
-
return a != null && a.length > 0;
|
|
2663
|
-
}
|
|
2664
|
-
function resolveConfig(spec) {
|
|
2665
|
-
if (!Array.isArray(spec)) return spec;
|
|
2666
|
-
if (spec.length == 0) return null;
|
|
2667
|
-
let conf = resolveConfig(spec[0]);
|
|
2668
|
-
if (spec.length == 1) return conf;
|
|
2669
|
-
let rest = resolveConfig(spec.slice(1));
|
|
2670
|
-
if (!rest || !conf) return conf || rest;
|
|
2671
|
-
let conc = (a, b) => (a || none).concat(b || none);
|
|
2672
|
-
let wrapA = conf.wrap,
|
|
2673
|
-
wrapB = rest.wrap;
|
|
2674
|
-
return {
|
|
2675
|
-
props: conc(conf.props, rest.props),
|
|
2676
|
-
defineNodes: conc(conf.defineNodes, rest.defineNodes),
|
|
2677
|
-
parseBlock: conc(conf.parseBlock, rest.parseBlock),
|
|
2678
|
-
parseInline: conc(conf.parseInline, rest.parseInline),
|
|
2679
|
-
remove: conc(conf.remove, rest.remove),
|
|
2680
|
-
wrap: !wrapA ? wrapB : !wrapB ? wrapA : (inner, input, fragments, ranges) => wrapA(wrapB(inner, input, fragments, ranges), input, fragments, ranges)
|
|
2681
|
-
};
|
|
2682
|
-
}
|
|
2683
|
-
function findName(names, name) {
|
|
2684
|
-
let found = names.indexOf(name);
|
|
2685
|
-
if (found < 0) throw new RangeError(`Position specified relative to unknown parser ${name}`);
|
|
2686
|
-
return found;
|
|
2687
|
-
}
|
|
2688
|
-
let nodeTypes = [NodeType.none];
|
|
2689
|
-
for (let i = 1, name; name = Type[i]; i++) {
|
|
2690
|
-
nodeTypes[i] = NodeType.define({
|
|
2691
|
-
id: i,
|
|
2692
|
-
name,
|
|
2693
|
-
props: i >= Type.Escape ? [] : [[NodeProp.group, i in DefaultSkipMarkup ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]]
|
|
2694
|
-
});
|
|
2695
|
-
}
|
|
2696
|
-
const none = [];
|
|
2697
|
-
class Buffer {
|
|
2698
|
-
constructor(nodeSet) {
|
|
2699
|
-
this.nodeSet = nodeSet;
|
|
2700
|
-
this.content = [];
|
|
2701
|
-
this.nodes = [];
|
|
2702
|
-
}
|
|
2703
|
-
write(type, from, to) {
|
|
2704
|
-
let children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
2705
|
-
this.content.push(type, from, to, 4 + children * 4);
|
|
2706
|
-
return this;
|
|
2707
|
-
}
|
|
2708
|
-
writeElements(elts) {
|
|
2709
|
-
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2710
|
-
for (let e of elts) e.writeTo(this, offset);
|
|
2711
|
-
return this;
|
|
2712
|
-
}
|
|
2713
|
-
finish(type, length) {
|
|
2714
|
-
return Tree.build({
|
|
2715
|
-
buffer: this.content,
|
|
2716
|
-
nodeSet: this.nodeSet,
|
|
2717
|
-
reused: this.nodes,
|
|
2718
|
-
topID: type,
|
|
2719
|
-
length
|
|
2720
|
-
});
|
|
2721
|
-
}
|
|
2722
|
-
}
|
|
2723
|
-
/// Elements are used to compose syntax nodes during parsing.
|
|
2724
|
-
class Element {
|
|
2725
|
-
/// @internal
|
|
2726
|
-
constructor(
|
|
2727
|
-
/// The node's
|
|
2728
|
-
/// [id](https://lezer.codemirror.net/docs/ref/#common.NodeType.id).
|
|
2729
|
-
type,
|
|
2730
|
-
/// The start of the node, as an offset from the start of the document.
|
|
2731
|
-
from,
|
|
2732
|
-
/// The end of the node.
|
|
2733
|
-
to) {
|
|
2734
|
-
let children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : none;
|
|
2735
|
-
this.type = type;
|
|
2736
|
-
this.from = from;
|
|
2737
|
-
this.to = to;
|
|
2738
|
-
this.children = children;
|
|
2739
|
-
}
|
|
2740
|
-
/// @internal
|
|
2741
|
-
writeTo(buf, offset) {
|
|
2742
|
-
let startOff = buf.content.length;
|
|
2743
|
-
buf.writeElements(this.children, offset);
|
|
2744
|
-
buf.content.push(this.type, this.from + offset, this.to + offset, buf.content.length + 4 - startOff);
|
|
2745
|
-
}
|
|
2746
|
-
/// @internal
|
|
2747
|
-
toTree(nodeSet) {
|
|
2748
|
-
return new Buffer(nodeSet).writeElements(this.children, -this.from).finish(this.type, this.to - this.from);
|
|
2749
|
-
}
|
|
2750
|
-
}
|
|
2751
|
-
class TreeElement {
|
|
2752
|
-
constructor(tree, from) {
|
|
2753
|
-
this.tree = tree;
|
|
2754
|
-
this.from = from;
|
|
2755
|
-
}
|
|
2756
|
-
get to() {
|
|
2757
|
-
return this.from + this.tree.length;
|
|
2758
|
-
}
|
|
2759
|
-
get type() {
|
|
2760
|
-
return this.tree.type.id;
|
|
2761
|
-
}
|
|
2762
|
-
get children() {
|
|
2763
|
-
return none;
|
|
2764
|
-
}
|
|
2765
|
-
writeTo(buf, offset) {
|
|
2766
|
-
buf.nodes.push(this.tree);
|
|
2767
|
-
buf.content.push(buf.nodes.length - 1, this.from + offset, this.to + offset, -1);
|
|
2768
|
-
}
|
|
2769
|
-
toTree() {
|
|
2770
|
-
return this.tree;
|
|
2771
|
-
}
|
|
2772
|
-
}
|
|
2773
|
-
function elt(type, from, to, children) {
|
|
2774
|
-
return new Element(type, from, to, children);
|
|
2775
|
-
}
|
|
2776
|
-
const EmphasisUnderscore = {
|
|
2777
|
-
resolve: "Emphasis",
|
|
2778
|
-
mark: "EmphasisMark"
|
|
2779
|
-
};
|
|
2780
|
-
const EmphasisAsterisk = {
|
|
2781
|
-
resolve: "Emphasis",
|
|
2782
|
-
mark: "EmphasisMark"
|
|
2783
|
-
};
|
|
2784
|
-
const LinkStart = {},
|
|
2785
|
-
ImageStart = {};
|
|
2786
|
-
class InlineDelimiter {
|
|
2787
|
-
constructor(type, from, to, side) {
|
|
2788
|
-
this.type = type;
|
|
2789
|
-
this.from = from;
|
|
2790
|
-
this.to = to;
|
|
2791
|
-
this.side = side;
|
|
2792
|
-
}
|
|
2793
|
-
}
|
|
2794
|
-
const Escapable = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
|
|
2795
|
-
let Punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;
|
|
2796
|
-
try {
|
|
2797
|
-
Punctuation = new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]", "u");
|
|
2798
|
-
} catch (_) {}
|
|
2799
|
-
const DefaultInline = {
|
|
2800
|
-
Escape(cx, next, start) {
|
|
2801
|
-
if (next != 92 /* '\\' */ || start == cx.end - 1) return -1;
|
|
2802
|
-
let escaped = cx.char(start + 1);
|
|
2803
|
-
for (let i = 0; i < Escapable.length; i++) if (Escapable.charCodeAt(i) == escaped) return cx.append(elt(Type.Escape, start, start + 2));
|
|
2804
|
-
return -1;
|
|
2805
|
-
},
|
|
2806
|
-
Entity(cx, next, start) {
|
|
2807
|
-
if (next != 38 /* '&' */) return -1;
|
|
2808
|
-
let m = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(cx.slice(start + 1, start + 31));
|
|
2809
|
-
return m ? cx.append(elt(Type.Entity, start, start + 1 + m[0].length)) : -1;
|
|
2810
|
-
},
|
|
2811
|
-
InlineCode(cx, next, start) {
|
|
2812
|
-
if (next != 96 /* '`' */ || start && cx.char(start - 1) == 96) return -1;
|
|
2813
|
-
let pos = start + 1;
|
|
2814
|
-
while (pos < cx.end && cx.char(pos) == 96) pos++;
|
|
2815
|
-
let size = pos - start,
|
|
2816
|
-
curSize = 0;
|
|
2817
|
-
for (; pos < cx.end; pos++) {
|
|
2818
|
-
if (cx.char(pos) == 96) {
|
|
2819
|
-
curSize++;
|
|
2820
|
-
if (curSize == size && cx.char(pos + 1) != 96) return cx.append(elt(Type.InlineCode, start, pos + 1, [elt(Type.CodeMark, start, start + size), elt(Type.CodeMark, pos + 1 - size, pos + 1)]));
|
|
2821
|
-
} else {
|
|
2822
|
-
curSize = 0;
|
|
2823
|
-
}
|
|
2824
|
-
}
|
|
2825
|
-
return -1;
|
|
2826
|
-
},
|
|
2827
|
-
HTMLTag(cx, next, start) {
|
|
2828
|
-
if (next != 60 /* '<' */ || start == cx.end - 1) return -1;
|
|
2829
|
-
let after = cx.slice(start + 1, cx.end);
|
|
2830
|
-
let url = /^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(after);
|
|
2831
|
-
if (url) return cx.append(elt(Type.URL, start, start + 1 + url[0].length));
|
|
2832
|
-
let comment = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(after);
|
|
2833
|
-
if (comment) return cx.append(elt(Type.Comment, start, start + 1 + comment[0].length));
|
|
2834
|
-
let procInst = /^\?[^]*?\?>/.exec(after);
|
|
2835
|
-
if (procInst) return cx.append(elt(Type.ProcessingInstruction, start, start + 1 + procInst[0].length));
|
|
2836
|
-
let m = /^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(after);
|
|
2837
|
-
if (!m) return -1;
|
|
2838
|
-
return cx.append(elt(Type.HTMLTag, start, start + 1 + m[0].length));
|
|
2839
|
-
},
|
|
2840
|
-
Emphasis(cx, next, start) {
|
|
2841
|
-
if (next != 95 && next != 42) return -1;
|
|
2842
|
-
let pos = start + 1;
|
|
2843
|
-
while (cx.char(pos) == next) pos++;
|
|
2844
|
-
let before = cx.slice(start - 1, start),
|
|
2845
|
-
after = cx.slice(pos, pos + 1);
|
|
2846
|
-
let pBefore = Punctuation.test(before),
|
|
2847
|
-
pAfter = Punctuation.test(after);
|
|
2848
|
-
let sBefore = /\s|^$/.test(before),
|
|
2849
|
-
sAfter = /\s|^$/.test(after);
|
|
2850
|
-
let leftFlanking = !sAfter && (!pAfter || sBefore || pBefore);
|
|
2851
|
-
let rightFlanking = !sBefore && (!pBefore || sAfter || pAfter);
|
|
2852
|
-
let canOpen = leftFlanking && (next == 42 || !rightFlanking || pBefore);
|
|
2853
|
-
let canClose = rightFlanking && (next == 42 || !leftFlanking || pAfter);
|
|
2854
|
-
return cx.append(new InlineDelimiter(next == 95 ? EmphasisUnderscore : EmphasisAsterisk, start, pos, (canOpen ? 1 /* Open */ : 0) | (canClose ? 2 /* Close */ : 0)));
|
|
2855
|
-
},
|
|
2856
|
-
HardBreak(cx, next, start) {
|
|
2857
|
-
if (next == 92 /* '\\' */ && cx.char(start + 1) == 10 /* '\n' */) return cx.append(elt(Type.HardBreak, start, start + 2));
|
|
2858
|
-
if (next == 32) {
|
|
2859
|
-
let pos = start + 1;
|
|
2860
|
-
while (cx.char(pos) == 32) pos++;
|
|
2861
|
-
if (cx.char(pos) == 10 && pos >= start + 2) return cx.append(elt(Type.HardBreak, start, pos + 1));
|
|
2862
|
-
}
|
|
2863
|
-
return -1;
|
|
2864
|
-
},
|
|
2865
|
-
Link(cx, next, start) {
|
|
2866
|
-
return next == 91 /* '[' */ ? cx.append(new InlineDelimiter(LinkStart, start, start + 1, 1 /* Open */)) : -1;
|
|
2867
|
-
},
|
|
2868
|
-
Image(cx, next, start) {
|
|
2869
|
-
return next == 33 /* '!' */ && cx.char(start + 1) == 91 /* '[' */ ? cx.append(new InlineDelimiter(ImageStart, start, start + 2, 1 /* Open */)) : -1;
|
|
2870
|
-
},
|
|
2871
|
-
LinkEnd(cx, next, start) {
|
|
2872
|
-
if (next != 93 /* ']' */) return -1;
|
|
2873
|
-
// Scanning back to the next link/image start marker
|
|
2874
|
-
for (let i = cx.parts.length - 1; i >= 0; i--) {
|
|
2875
|
-
let part = cx.parts[i];
|
|
2876
|
-
if (part instanceof InlineDelimiter && (part.type == LinkStart || part.type == ImageStart)) {
|
|
2877
|
-
// If this one has been set invalid (because it would produce
|
|
2878
|
-
// a nested link) or there's no valid link here ignore both.
|
|
2879
|
-
if (!part.side || cx.skipSpace(part.to) == start && !/[(\[]/.test(cx.slice(start + 1, start + 2))) {
|
|
2880
|
-
cx.parts[i] = null;
|
|
2881
|
-
return -1;
|
|
2882
|
-
}
|
|
2883
|
-
// Finish the content and replace the entire range in
|
|
2884
|
-
// this.parts with the link/image node.
|
|
2885
|
-
let content = cx.takeContent(i);
|
|
2886
|
-
let link = cx.parts[i] = finishLink(cx, content, part.type == LinkStart ? Type.Link : Type.Image, part.from, start + 1);
|
|
2887
|
-
// Set any open-link markers before this link to invalid.
|
|
2888
|
-
if (part.type == LinkStart) for (let j = 0; j < i; j++) {
|
|
2889
|
-
let p = cx.parts[j];
|
|
2890
|
-
if (p instanceof InlineDelimiter && p.type == LinkStart) p.side = 0;
|
|
2891
|
-
}
|
|
2892
|
-
return link.to;
|
|
2893
|
-
}
|
|
2894
|
-
}
|
|
2895
|
-
return -1;
|
|
2896
|
-
}
|
|
2897
|
-
};
|
|
2898
|
-
function finishLink(cx, content, type, start, startPos) {
|
|
2899
|
-
let {
|
|
2900
|
-
text
|
|
2901
|
-
} = cx,
|
|
2902
|
-
next = cx.char(startPos),
|
|
2903
|
-
endPos = startPos;
|
|
2904
|
-
content.unshift(elt(Type.LinkMark, start, start + (type == Type.Image ? 2 : 1)));
|
|
2905
|
-
content.push(elt(Type.LinkMark, startPos - 1, startPos));
|
|
2906
|
-
if (next == 40 /* '(' */) {
|
|
2907
|
-
let pos = cx.skipSpace(startPos + 1);
|
|
2908
|
-
let dest = parseURL(text, pos - cx.offset, cx.offset),
|
|
2909
|
-
title;
|
|
2910
|
-
if (dest) {
|
|
2911
|
-
pos = cx.skipSpace(dest.to);
|
|
2912
|
-
title = parseLinkTitle(text, pos - cx.offset, cx.offset);
|
|
2913
|
-
if (title) pos = cx.skipSpace(title.to);
|
|
2914
|
-
}
|
|
2915
|
-
if (cx.char(pos) == 41 /* ')' */) {
|
|
2916
|
-
content.push(elt(Type.LinkMark, startPos, startPos + 1));
|
|
2917
|
-
endPos = pos + 1;
|
|
2918
|
-
if (dest) content.push(dest);
|
|
2919
|
-
if (title) content.push(title);
|
|
2920
|
-
content.push(elt(Type.LinkMark, pos, endPos));
|
|
2921
|
-
}
|
|
2922
|
-
} else if (next == 91 /* '[' */) {
|
|
2923
|
-
let label = parseLinkLabel(text, startPos - cx.offset, cx.offset, false);
|
|
2924
|
-
if (label) {
|
|
2925
|
-
content.push(label);
|
|
2926
|
-
endPos = label.to;
|
|
2927
|
-
}
|
|
2928
|
-
}
|
|
2929
|
-
return elt(type, start, endPos, content);
|
|
2930
|
-
}
|
|
2931
|
-
// These return `null` when falling off the end of the input, `false`
|
|
2932
|
-
// when parsing fails otherwise (for use in the incremental link
|
|
2933
|
-
// reference parser).
|
|
2934
|
-
function parseURL(text, start, offset) {
|
|
2935
|
-
let next = text.charCodeAt(start);
|
|
2936
|
-
if (next == 60 /* '<' */) {
|
|
2937
|
-
for (let pos = start + 1; pos < text.length; pos++) {
|
|
2938
|
-
let ch = text.charCodeAt(pos);
|
|
2939
|
-
if (ch == 62 /* '>' */) return elt(Type.URL, start + offset, pos + 1 + offset);
|
|
2940
|
-
if (ch == 60 || ch == 10 /* '<\n' */) return false;
|
|
2941
|
-
}
|
|
2942
|
-
return null;
|
|
2943
|
-
} else {
|
|
2944
|
-
let depth = 0,
|
|
2945
|
-
pos = start;
|
|
2946
|
-
for (let escaped = false; pos < text.length; pos++) {
|
|
2947
|
-
let ch = text.charCodeAt(pos);
|
|
2948
|
-
if (space(ch)) {
|
|
2949
|
-
break;
|
|
2950
|
-
} else if (escaped) {
|
|
2951
|
-
escaped = false;
|
|
2952
|
-
} else if (ch == 40 /* '(' */) {
|
|
2953
|
-
depth++;
|
|
2954
|
-
} else if (ch == 41 /* ')' */) {
|
|
2955
|
-
if (!depth) break;
|
|
2956
|
-
depth--;
|
|
2957
|
-
} else if (ch == 92 /* '\\' */) {
|
|
2958
|
-
escaped = true;
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
return pos > start ? elt(Type.URL, start + offset, pos + offset) : pos == text.length ? null : false;
|
|
2962
|
-
}
|
|
2963
|
-
}
|
|
2964
|
-
function parseLinkTitle(text, start, offset) {
|
|
2965
|
-
let next = text.charCodeAt(start);
|
|
2966
|
-
if (next != 39 && next != 34 && next != 40 /* '"\'(' */) return false;
|
|
2967
|
-
let end = next == 40 ? 41 : next;
|
|
2968
|
-
for (let pos = start + 1, escaped = false; pos < text.length; pos++) {
|
|
2969
|
-
let ch = text.charCodeAt(pos);
|
|
2970
|
-
if (escaped) escaped = false;else if (ch == end) return elt(Type.LinkTitle, start + offset, pos + 1 + offset);else if (ch == 92 /* '\\' */) escaped = true;
|
|
2971
|
-
}
|
|
2972
|
-
return null;
|
|
2973
|
-
}
|
|
2974
|
-
function parseLinkLabel(text, start, offset, requireNonWS) {
|
|
2975
|
-
for (let escaped = false, pos = start + 1, end = Math.min(text.length, pos + 999); pos < end; pos++) {
|
|
2976
|
-
let ch = text.charCodeAt(pos);
|
|
2977
|
-
if (escaped) escaped = false;else if (ch == 93 /* ']' */) return requireNonWS ? false : elt(Type.LinkLabel, start + offset, pos + 1 + offset);else {
|
|
2978
|
-
if (requireNonWS && !space(ch)) requireNonWS = false;
|
|
2979
|
-
if (ch == 91 /* '[' */) return false;else if (ch == 92 /* '\\' */) escaped = true;
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
|
-
return null;
|
|
2983
|
-
}
|
|
2984
|
-
/// Inline parsing functions get access to this context, and use it to
|
|
2985
|
-
/// read the content and emit syntax nodes.
|
|
2986
|
-
class InlineContext {
|
|
2987
|
-
/// @internal
|
|
2988
|
-
constructor(
|
|
2989
|
-
/// The parser that is being used.
|
|
2990
|
-
parser,
|
|
2991
|
-
/// The text of this inline section.
|
|
2992
|
-
text,
|
|
2993
|
-
/// The starting offset of the section in the document.
|
|
2994
|
-
offset) {
|
|
2995
|
-
this.parser = parser;
|
|
2996
|
-
this.text = text;
|
|
2997
|
-
this.offset = offset;
|
|
2998
|
-
/// @internal
|
|
2999
|
-
this.parts = [];
|
|
3000
|
-
}
|
|
3001
|
-
/// Get the character code at the given (document-relative)
|
|
3002
|
-
/// position.
|
|
3003
|
-
char(pos) {
|
|
3004
|
-
return pos >= this.end ? -1 : this.text.charCodeAt(pos - this.offset);
|
|
3005
|
-
}
|
|
3006
|
-
/// The position of the end of this inline section.
|
|
3007
|
-
get end() {
|
|
3008
|
-
return this.offset + this.text.length;
|
|
3009
|
-
}
|
|
3010
|
-
/// Get a substring of this inline section. Again uses
|
|
3011
|
-
/// document-relative positions.
|
|
3012
|
-
slice(from, to) {
|
|
3013
|
-
return this.text.slice(from - this.offset, to - this.offset);
|
|
3014
|
-
}
|
|
3015
|
-
/// @internal
|
|
3016
|
-
append(elt) {
|
|
3017
|
-
this.parts.push(elt);
|
|
3018
|
-
return elt.to;
|
|
3019
|
-
}
|
|
3020
|
-
/// Add a [delimiter](#DelimiterType) at this given position. `open`
|
|
3021
|
-
/// and `close` indicate whether this delimiter is opening, closing,
|
|
3022
|
-
/// or both. Returns the end of the delimiter, for convenient
|
|
3023
|
-
/// returning from [parse functions](#InlineParser.parse).
|
|
3024
|
-
addDelimiter(type, from, to, open, close) {
|
|
3025
|
-
return this.append(new InlineDelimiter(type, from, to, (open ? 1 /* Open */ : 0) | (close ? 2 /* Close */ : 0)));
|
|
3026
|
-
}
|
|
3027
|
-
/// Add an inline element. Returns the end of the element.
|
|
3028
|
-
addElement(elt) {
|
|
3029
|
-
return this.append(elt);
|
|
3030
|
-
}
|
|
3031
|
-
/// Resolve markers between this.parts.length and from, wrapping matched markers in the
|
|
3032
|
-
/// appropriate node and updating the content of this.parts. @internal
|
|
3033
|
-
resolveMarkers(from) {
|
|
3034
|
-
// Scan forward, looking for closing tokens
|
|
3035
|
-
for (let i = from; i < this.parts.length; i++) {
|
|
3036
|
-
let close = this.parts[i];
|
|
3037
|
-
if (!(close instanceof InlineDelimiter && close.type.resolve && close.side & 2 /* Close */)) continue;
|
|
3038
|
-
let emp = close.type == EmphasisUnderscore || close.type == EmphasisAsterisk;
|
|
3039
|
-
let closeSize = close.to - close.from;
|
|
3040
|
-
let open,
|
|
3041
|
-
j = i - 1;
|
|
3042
|
-
// Continue scanning for a matching opening token
|
|
3043
|
-
for (; j >= from; j--) {
|
|
3044
|
-
let part = this.parts[j];
|
|
3045
|
-
if (part instanceof InlineDelimiter && part.side & 1 /* Open */ && part.type == close.type &&
|
|
3046
|
-
// Ignore emphasis delimiters where the character count doesn't match
|
|
3047
|
-
!(emp && (close.side & 1 /* Open */ || part.side & 2 /* Close */) && (part.to - part.from + closeSize) % 3 == 0 && ((part.to - part.from) % 3 || closeSize % 3))) {
|
|
3048
|
-
open = part;
|
|
3049
|
-
break;
|
|
3050
|
-
}
|
|
3051
|
-
}
|
|
3052
|
-
if (!open) continue;
|
|
3053
|
-
let type = close.type.resolve,
|
|
3054
|
-
content = [];
|
|
3055
|
-
let start = open.from,
|
|
3056
|
-
end = close.to;
|
|
3057
|
-
// Emphasis marker effect depends on the character count. Size consumed is minimum of the two
|
|
3058
|
-
// markers.
|
|
3059
|
-
if (emp) {
|
|
3060
|
-
let size = Math.min(2, open.to - open.from, closeSize);
|
|
3061
|
-
start = open.to - size;
|
|
3062
|
-
end = close.from + size;
|
|
3063
|
-
type = size == 1 ? "Emphasis" : "StrongEmphasis";
|
|
3064
|
-
}
|
|
3065
|
-
// Move the covered region into content, optionally adding marker nodes
|
|
3066
|
-
if (open.type.mark) content.push(this.elt(open.type.mark, start, open.to));
|
|
3067
|
-
for (let k = j + 1; k < i; k++) {
|
|
3068
|
-
if (this.parts[k] instanceof Element) content.push(this.parts[k]);
|
|
3069
|
-
this.parts[k] = null;
|
|
3070
|
-
}
|
|
3071
|
-
if (close.type.mark) content.push(this.elt(close.type.mark, close.from, end));
|
|
3072
|
-
let element = this.elt(type, start, end, content);
|
|
3073
|
-
// If there are leftover emphasis marker characters, shrink the close/open markers. Otherwise, clear them.
|
|
3074
|
-
this.parts[j] = emp && open.from != start ? new InlineDelimiter(open.type, open.from, start, open.side) : null;
|
|
3075
|
-
let keep = this.parts[i] = emp && close.to != end ? new InlineDelimiter(close.type, end, close.to, close.side) : null;
|
|
3076
|
-
// Insert the new element in this.parts
|
|
3077
|
-
if (keep) this.parts.splice(i, 0, element);else this.parts[i] = element;
|
|
3078
|
-
}
|
|
3079
|
-
// Collect the elements remaining in this.parts into an array.
|
|
3080
|
-
let result = [];
|
|
3081
|
-
for (let i = from; i < this.parts.length; i++) {
|
|
3082
|
-
let part = this.parts[i];
|
|
3083
|
-
if (part instanceof Element) result.push(part);
|
|
3084
|
-
}
|
|
3085
|
-
return result;
|
|
3086
|
-
}
|
|
3087
|
-
/// Find an opening delimiter of the given type. Returns `null` if
|
|
3088
|
-
/// no delimiter is found, or an index that can be passed to
|
|
3089
|
-
/// [`takeContent`](#InlineContext.takeContent) otherwise.
|
|
3090
|
-
findOpeningDelimiter(type) {
|
|
3091
|
-
for (let i = this.parts.length - 1; i >= 0; i--) {
|
|
3092
|
-
let part = this.parts[i];
|
|
3093
|
-
if (part instanceof InlineDelimiter && part.type == type) return i;
|
|
3094
|
-
}
|
|
3095
|
-
return null;
|
|
3096
|
-
}
|
|
3097
|
-
/// Remove all inline elements and delimiters starting from the
|
|
3098
|
-
/// given index (which you should get from
|
|
3099
|
-
/// [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
|
|
3100
|
-
/// resolve delimiters inside of them, and return them as an array
|
|
3101
|
-
/// of elements.
|
|
3102
|
-
takeContent(startIndex) {
|
|
3103
|
-
let content = this.resolveMarkers(startIndex);
|
|
3104
|
-
this.parts.length = startIndex;
|
|
3105
|
-
return content;
|
|
3106
|
-
}
|
|
3107
|
-
/// Skip space after the given (document) position, returning either
|
|
3108
|
-
/// the position of the next non-space character or the end of the
|
|
3109
|
-
/// section.
|
|
3110
|
-
skipSpace(from) {
|
|
3111
|
-
return skipSpace(this.text, from - this.offset) + this.offset;
|
|
3112
|
-
}
|
|
3113
|
-
elt(type, from, to, children) {
|
|
3114
|
-
if (typeof type == "string") return elt(this.parser.getNodeType(type), from, to, children);
|
|
3115
|
-
return new TreeElement(type, from);
|
|
3116
|
-
}
|
|
3117
|
-
}
|
|
3118
|
-
function injectMarks(elements, marks) {
|
|
3119
|
-
if (!marks.length) return elements;
|
|
3120
|
-
if (!elements.length) return marks;
|
|
3121
|
-
let elts = elements.slice(),
|
|
3122
|
-
eI = 0;
|
|
3123
|
-
for (let mark of marks) {
|
|
3124
|
-
while (eI < elts.length && elts[eI].to < mark.to) eI++;
|
|
3125
|
-
if (eI < elts.length && elts[eI].from < mark.from) {
|
|
3126
|
-
let e = elts[eI];
|
|
3127
|
-
if (e instanceof Element) elts[eI] = new Element(e.type, e.from, e.to, injectMarks(e.children, [mark]));
|
|
3128
|
-
} else {
|
|
3129
|
-
elts.splice(eI++, 0, mark);
|
|
3130
|
-
}
|
|
3131
|
-
}
|
|
3132
|
-
return elts;
|
|
3133
|
-
}
|
|
3134
|
-
// These are blocks that can span blank lines, and should thus only be
|
|
3135
|
-
// reused if their next sibling is also being reused.
|
|
3136
|
-
const NotLast = [Type.CodeBlock, Type.ListItem, Type.OrderedList, Type.BulletList];
|
|
3137
|
-
class FragmentCursor {
|
|
3138
|
-
constructor(fragments, input) {
|
|
3139
|
-
this.fragments = fragments;
|
|
3140
|
-
this.input = input;
|
|
3141
|
-
// Index into fragment array
|
|
3142
|
-
this.i = 0;
|
|
3143
|
-
// Active fragment
|
|
3144
|
-
this.fragment = null;
|
|
3145
|
-
this.fragmentEnd = -1;
|
|
3146
|
-
// Cursor into the current fragment, if any. When `moveTo` returns
|
|
3147
|
-
// true, this points at the first block after `pos`.
|
|
3148
|
-
this.cursor = null;
|
|
3149
|
-
if (fragments.length) this.fragment = fragments[this.i++];
|
|
3150
|
-
}
|
|
3151
|
-
nextFragment() {
|
|
3152
|
-
this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null;
|
|
3153
|
-
this.cursor = null;
|
|
3154
|
-
this.fragmentEnd = -1;
|
|
3155
|
-
}
|
|
3156
|
-
moveTo(pos, lineStart) {
|
|
3157
|
-
while (this.fragment && this.fragment.to <= pos) this.nextFragment();
|
|
3158
|
-
if (!this.fragment || this.fragment.from > (pos ? pos - 1 : 0)) return false;
|
|
3159
|
-
if (this.fragmentEnd < 0) {
|
|
3160
|
-
let end = this.fragment.to;
|
|
3161
|
-
while (end > 0 && this.input.read(end - 1, end) != "\n") end--;
|
|
3162
|
-
this.fragmentEnd = end ? end - 1 : 0;
|
|
3163
|
-
}
|
|
3164
|
-
let c = this.cursor;
|
|
3165
|
-
if (!c) {
|
|
3166
|
-
c = this.cursor = this.fragment.tree.cursor();
|
|
3167
|
-
c.firstChild();
|
|
3168
|
-
}
|
|
3169
|
-
let rPos = pos + this.fragment.offset;
|
|
3170
|
-
while (c.to <= rPos) if (!c.parent()) return false;
|
|
3171
|
-
for (;;) {
|
|
3172
|
-
if (c.from >= rPos) return this.fragment.from <= lineStart;
|
|
3173
|
-
if (!c.childAfter(rPos)) return false;
|
|
3174
|
-
}
|
|
3175
|
-
}
|
|
3176
|
-
matches(hash) {
|
|
3177
|
-
let tree = this.cursor.tree;
|
|
3178
|
-
return tree && tree.prop(NodeProp.contextHash) == hash;
|
|
3179
|
-
}
|
|
3180
|
-
takeNodes(cx) {
|
|
3181
|
-
let cur = this.cursor,
|
|
3182
|
-
off = this.fragment.offset,
|
|
3183
|
-
fragEnd = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0);
|
|
3184
|
-
let start = cx.absoluteLineStart,
|
|
3185
|
-
end = start,
|
|
3186
|
-
blockI = cx.block.children.length;
|
|
3187
|
-
let prevEnd = end,
|
|
3188
|
-
prevI = blockI;
|
|
3189
|
-
for (;;) {
|
|
3190
|
-
if (cur.to - off > fragEnd) {
|
|
3191
|
-
if (cur.type.isAnonymous && cur.firstChild()) continue;
|
|
3192
|
-
break;
|
|
3193
|
-
}
|
|
3194
|
-
cx.dontInject.add(cur.tree);
|
|
3195
|
-
cx.addNode(cur.tree, cur.from - off);
|
|
3196
|
-
// Taken content must always end in a block, because incremental
|
|
3197
|
-
// parsing happens on block boundaries. Never stop directly
|
|
3198
|
-
// after an indented code block, since those can continue after
|
|
3199
|
-
// any number of blank lines.
|
|
3200
|
-
if (cur.type.is("Block")) {
|
|
3201
|
-
if (NotLast.indexOf(cur.type.id) < 0) {
|
|
3202
|
-
end = cur.to - off;
|
|
3203
|
-
blockI = cx.block.children.length;
|
|
3204
|
-
} else {
|
|
3205
|
-
end = prevEnd;
|
|
3206
|
-
blockI = prevI;
|
|
3207
|
-
prevEnd = cur.to - off;
|
|
3208
|
-
prevI = cx.block.children.length;
|
|
3209
|
-
}
|
|
3210
|
-
}
|
|
3211
|
-
if (!cur.nextSibling()) break;
|
|
3212
|
-
}
|
|
3213
|
-
while (cx.block.children.length > blockI) {
|
|
3214
|
-
cx.block.children.pop();
|
|
3215
|
-
cx.block.positions.pop();
|
|
3216
|
-
}
|
|
3217
|
-
return end - start;
|
|
3218
|
-
}
|
|
3219
|
-
}
|
|
3220
|
-
const markdownHighlighting = styleTags({
|
|
3221
|
-
"Blockquote/...": tags$1.quote,
|
|
3222
|
-
HorizontalRule: tags$1.contentSeparator,
|
|
3223
|
-
"ATXHeading1/... SetextHeading1/...": tags$1.heading1,
|
|
3224
|
-
"ATXHeading2/... SetextHeading2/...": tags$1.heading2,
|
|
3225
|
-
"ATXHeading3/...": tags$1.heading3,
|
|
3226
|
-
"ATXHeading4/...": tags$1.heading4,
|
|
3227
|
-
"ATXHeading5/...": tags$1.heading5,
|
|
3228
|
-
"ATXHeading6/...": tags$1.heading6,
|
|
3229
|
-
"Comment CommentBlock": tags$1.comment,
|
|
3230
|
-
Escape: tags$1.escape,
|
|
3231
|
-
Entity: tags$1.character,
|
|
3232
|
-
"Emphasis/...": tags$1.emphasis,
|
|
3233
|
-
"StrongEmphasis/...": tags$1.strong,
|
|
3234
|
-
"Link/... Image/...": tags$1.link,
|
|
3235
|
-
"OrderedList/... BulletList/...": tags$1.list,
|
|
3236
|
-
"BlockQuote/...": tags$1.quote,
|
|
3237
|
-
"InlineCode CodeText": tags$1.monospace,
|
|
3238
|
-
URL: tags$1.url,
|
|
3239
|
-
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": tags$1.processingInstruction,
|
|
3240
|
-
"CodeInfo LinkLabel": tags$1.labelName,
|
|
3241
|
-
LinkTitle: tags$1.string,
|
|
3242
|
-
Paragraph: tags$1.content
|
|
3243
|
-
});
|
|
3244
|
-
/// The default CommonMark parser.
|
|
3245
|
-
const parser = new MarkdownParser(new NodeSet(nodeTypes).extend(markdownHighlighting), Object.keys(DefaultBlockParsers).map(n => DefaultBlockParsers[n]), Object.keys(DefaultBlockParsers).map(n => DefaultLeafBlocks[n]), Object.keys(DefaultBlockParsers), DefaultEndLeaf, DefaultSkipMarkup, Object.keys(DefaultInline).map(n => DefaultInline[n]), Object.keys(DefaultInline), []);
|
|
3246
|
-
function leftOverSpace(node, from, to) {
|
|
3247
|
-
let ranges = [];
|
|
3248
|
-
for (let n = node.firstChild, pos = from;; n = n.nextSibling) {
|
|
3249
|
-
let nextPos = n ? n.from : to;
|
|
3250
|
-
if (nextPos > pos) ranges.push({
|
|
3251
|
-
from: pos,
|
|
3252
|
-
to: nextPos
|
|
3253
|
-
});
|
|
3254
|
-
if (!n) break;
|
|
3255
|
-
pos = n.to;
|
|
3256
|
-
}
|
|
3257
|
-
return ranges;
|
|
3258
|
-
}
|
|
3259
|
-
/// Create a Markdown extension to enable nested parsing on code
|
|
3260
|
-
/// blocks and/or embedded HTML.
|
|
3261
|
-
function parseCode(config) {
|
|
3262
|
-
let {
|
|
3263
|
-
codeParser,
|
|
3264
|
-
htmlParser
|
|
3265
|
-
} = config;
|
|
3266
|
-
let wrap = parseMixed((node, input) => {
|
|
3267
|
-
let id = node.type.id;
|
|
3268
|
-
if (codeParser && (id == Type.CodeBlock || id == Type.FencedCode)) {
|
|
3269
|
-
let info = "";
|
|
3270
|
-
if (id == Type.FencedCode) {
|
|
3271
|
-
let infoNode = node.node.getChild(Type.CodeInfo);
|
|
3272
|
-
if (infoNode) info = input.read(infoNode.from, infoNode.to);
|
|
3273
|
-
}
|
|
3274
|
-
let parser = codeParser(info);
|
|
3275
|
-
if (parser) return {
|
|
3276
|
-
parser,
|
|
3277
|
-
overlay: node => node.type.id == Type.CodeText
|
|
3278
|
-
};
|
|
3279
|
-
} else if (htmlParser && (id == Type.HTMLBlock || id == Type.HTMLTag)) {
|
|
3280
|
-
return {
|
|
3281
|
-
parser: htmlParser,
|
|
3282
|
-
overlay: leftOverSpace(node.node, node.from, node.to)
|
|
3283
|
-
};
|
|
3284
|
-
}
|
|
3285
|
-
return null;
|
|
3286
|
-
});
|
|
3287
|
-
return {
|
|
3288
|
-
wrap
|
|
3289
|
-
};
|
|
3290
|
-
}
|
|
3291
|
-
const StrikethroughDelim = {
|
|
3292
|
-
resolve: "Strikethrough",
|
|
3293
|
-
mark: "StrikethroughMark"
|
|
3294
|
-
};
|
|
3295
|
-
/// An extension that implements
|
|
3296
|
-
/// [GFM-style](https://github.github.com/gfm/#strikethrough-extension-)
|
|
3297
|
-
/// Strikethrough syntax using `~~` delimiters.
|
|
3298
|
-
const Strikethrough = {
|
|
3299
|
-
defineNodes: [{
|
|
3300
|
-
name: "Strikethrough",
|
|
3301
|
-
style: {
|
|
3302
|
-
"Strikethrough/...": tags$1.strikethrough
|
|
3303
|
-
}
|
|
3304
|
-
}, {
|
|
3305
|
-
name: "StrikethroughMark",
|
|
3306
|
-
style: tags$1.processingInstruction
|
|
3307
|
-
}],
|
|
3308
|
-
parseInline: [{
|
|
3309
|
-
name: "Strikethrough",
|
|
3310
|
-
parse(cx, next, pos) {
|
|
3311
|
-
if (next != 126 /* '~' */ || cx.char(pos + 1) != 126 || cx.char(pos + 2) == 126) return -1;
|
|
3312
|
-
let before = cx.slice(pos - 1, pos),
|
|
3313
|
-
after = cx.slice(pos + 2, pos + 3);
|
|
3314
|
-
let sBefore = /\s|^$/.test(before),
|
|
3315
|
-
sAfter = /\s|^$/.test(after);
|
|
3316
|
-
let pBefore = Punctuation.test(before),
|
|
3317
|
-
pAfter = Punctuation.test(after);
|
|
3318
|
-
return cx.addDelimiter(StrikethroughDelim, pos, pos + 2, !sAfter && (!pAfter || sBefore || pBefore), !sBefore && (!pBefore || sAfter || pAfter));
|
|
3319
|
-
},
|
|
3320
|
-
after: "Emphasis"
|
|
3321
|
-
}]
|
|
3322
|
-
};
|
|
3323
|
-
function parseRow(cx, line) {
|
|
3324
|
-
let startI = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
3325
|
-
let elts = arguments.length > 3 ? arguments[3] : undefined;
|
|
3326
|
-
let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
3327
|
-
let count = 0,
|
|
3328
|
-
first = true,
|
|
3329
|
-
cellStart = -1,
|
|
3330
|
-
cellEnd = -1,
|
|
3331
|
-
esc = false;
|
|
3332
|
-
let parseCell = () => {
|
|
3333
|
-
elts.push(cx.elt("TableCell", offset + cellStart, offset + cellEnd, cx.parser.parseInline(line.slice(cellStart, cellEnd), offset + cellStart)));
|
|
3334
|
-
};
|
|
3335
|
-
for (let i = startI; i < line.length; i++) {
|
|
3336
|
-
let next = line.charCodeAt(i);
|
|
3337
|
-
if (next == 124 /* '|' */ && !esc) {
|
|
3338
|
-
if (!first || cellStart > -1) count++;
|
|
3339
|
-
first = false;
|
|
3340
|
-
if (elts) {
|
|
3341
|
-
if (cellStart > -1) parseCell();
|
|
3342
|
-
elts.push(cx.elt("TableDelimiter", i + offset, i + offset + 1));
|
|
3343
|
-
}
|
|
3344
|
-
cellStart = cellEnd = -1;
|
|
3345
|
-
} else if (esc || next != 32 && next != 9) {
|
|
3346
|
-
if (cellStart < 0) cellStart = i;
|
|
3347
|
-
cellEnd = i + 1;
|
|
3348
|
-
}
|
|
3349
|
-
esc = !esc && next == 92;
|
|
3350
|
-
}
|
|
3351
|
-
if (cellStart > -1) {
|
|
3352
|
-
count++;
|
|
3353
|
-
if (elts) parseCell();
|
|
3354
|
-
}
|
|
3355
|
-
return count;
|
|
3356
|
-
}
|
|
3357
|
-
function hasPipe(str, start) {
|
|
3358
|
-
for (let i = start; i < str.length; i++) {
|
|
3359
|
-
let next = str.charCodeAt(i);
|
|
3360
|
-
if (next == 124 /* '|' */) return true;
|
|
3361
|
-
if (next == 92 /* '\\' */) i++;
|
|
3362
|
-
}
|
|
3363
|
-
return false;
|
|
3364
|
-
}
|
|
3365
|
-
const delimiterLine = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;
|
|
3366
|
-
class TableParser {
|
|
3367
|
-
constructor() {
|
|
3368
|
-
// Null means we haven't seen the second line yet, false means this
|
|
3369
|
-
// isn't a table, and an array means this is a table and we've
|
|
3370
|
-
// parsed the given rows so far.
|
|
3371
|
-
this.rows = null;
|
|
3372
|
-
}
|
|
3373
|
-
nextLine(cx, line, leaf) {
|
|
3374
|
-
if (this.rows == null) {
|
|
3375
|
-
// Second line
|
|
3376
|
-
this.rows = false;
|
|
3377
|
-
let lineText;
|
|
3378
|
-
if ((line.next == 45 || line.next == 58 || line.next == 124 /* '-:|' */) && delimiterLine.test(lineText = line.text.slice(line.pos))) {
|
|
3379
|
-
let firstRow = [],
|
|
3380
|
-
firstCount = parseRow(cx, leaf.content, 0, firstRow, leaf.start);
|
|
3381
|
-
if (firstCount == parseRow(cx, lineText, line.pos)) this.rows = [cx.elt("TableHeader", leaf.start, leaf.start + leaf.content.length, firstRow), cx.elt("TableDelimiter", cx.lineStart + line.pos, cx.lineStart + line.text.length)];
|
|
3382
|
-
}
|
|
3383
|
-
} else if (this.rows) {
|
|
3384
|
-
// Line after the second
|
|
3385
|
-
let content = [];
|
|
3386
|
-
parseRow(cx, line.text, line.pos, content, cx.lineStart);
|
|
3387
|
-
this.rows.push(cx.elt("TableRow", cx.lineStart + line.pos, cx.lineStart + line.text.length, content));
|
|
3388
|
-
}
|
|
3389
|
-
return false;
|
|
3390
|
-
}
|
|
3391
|
-
finish(cx, leaf) {
|
|
3392
|
-
if (!this.rows) return false;
|
|
3393
|
-
cx.addLeafElement(leaf, cx.elt("Table", leaf.start, leaf.start + leaf.content.length, this.rows));
|
|
3394
|
-
return true;
|
|
3395
|
-
}
|
|
3396
|
-
}
|
|
3397
|
-
/// This extension provides
|
|
3398
|
-
/// [GFM-style](https://github.github.com/gfm/#tables-extension-)
|
|
3399
|
-
/// tables, using syntax like this:
|
|
3400
|
-
///
|
|
3401
|
-
/// ```
|
|
3402
|
-
/// | head 1 | head 2 |
|
|
3403
|
-
/// | --- | --- |
|
|
3404
|
-
/// | cell 1 | cell 2 |
|
|
3405
|
-
/// ```
|
|
3406
|
-
const Table = {
|
|
3407
|
-
defineNodes: [{
|
|
3408
|
-
name: "Table",
|
|
3409
|
-
block: true
|
|
3410
|
-
}, {
|
|
3411
|
-
name: "TableHeader",
|
|
3412
|
-
style: {
|
|
3413
|
-
"TableHeader/...": tags$1.heading
|
|
3414
|
-
}
|
|
3415
|
-
}, "TableRow", {
|
|
3416
|
-
name: "TableCell",
|
|
3417
|
-
style: tags$1.content
|
|
3418
|
-
}, {
|
|
3419
|
-
name: "TableDelimiter",
|
|
3420
|
-
style: tags$1.processingInstruction
|
|
3421
|
-
}],
|
|
3422
|
-
parseBlock: [{
|
|
3423
|
-
name: "Table",
|
|
3424
|
-
leaf(_, leaf) {
|
|
3425
|
-
return hasPipe(leaf.content, 0) ? new TableParser() : null;
|
|
3426
|
-
},
|
|
3427
|
-
endLeaf(cx, line, leaf) {
|
|
3428
|
-
if (leaf.parsers.some(p => p instanceof TableParser) || !hasPipe(line.text, line.basePos)) return false;
|
|
3429
|
-
let next = cx.scanLine(cx.absoluteLineEnd + 1).text;
|
|
3430
|
-
return delimiterLine.test(next) && parseRow(cx, line.text, line.basePos) == parseRow(cx, next, line.basePos);
|
|
3431
|
-
},
|
|
3432
|
-
before: "SetextHeading"
|
|
3433
|
-
}]
|
|
3434
|
-
};
|
|
3435
|
-
class TaskParser {
|
|
3436
|
-
nextLine() {
|
|
3437
|
-
return false;
|
|
3438
|
-
}
|
|
3439
|
-
finish(cx, leaf) {
|
|
3440
|
-
cx.addLeafElement(leaf, cx.elt("Task", leaf.start, leaf.start + leaf.content.length, [cx.elt("TaskMarker", leaf.start, leaf.start + 3), ...cx.parser.parseInline(leaf.content.slice(3), leaf.start + 3)]));
|
|
3441
|
-
return true;
|
|
3442
|
-
}
|
|
3443
|
-
}
|
|
3444
|
-
/// Extension providing
|
|
3445
|
-
/// [GFM-style](https://github.github.com/gfm/#task-list-items-extension-)
|
|
3446
|
-
/// task list items, where list items can be prefixed with `[ ]` or
|
|
3447
|
-
/// `[x]` to add a checkbox.
|
|
3448
|
-
const TaskList = {
|
|
3449
|
-
defineNodes: [{
|
|
3450
|
-
name: "Task",
|
|
3451
|
-
block: true,
|
|
3452
|
-
style: tags$1.list
|
|
3453
|
-
}, {
|
|
3454
|
-
name: "TaskMarker",
|
|
3455
|
-
style: tags$1.atom
|
|
3456
|
-
}],
|
|
3457
|
-
parseBlock: [{
|
|
3458
|
-
name: "TaskList",
|
|
3459
|
-
leaf(cx, leaf) {
|
|
3460
|
-
return /^\[[ xX]\]/.test(leaf.content) && cx.parentType().name == "ListItem" ? new TaskParser() : null;
|
|
3461
|
-
},
|
|
3462
|
-
after: "SetextHeading"
|
|
3463
|
-
}]
|
|
3464
|
-
};
|
|
3465
|
-
/// Extension bundle containing [`Table`](#Table),
|
|
3466
|
-
/// [`TaskList`](#TaskList) and [`Strikethrough`](#Strikethrough).
|
|
3467
|
-
const GFM = [Table, TaskList, Strikethrough];
|
|
3468
|
-
function parseSubSuper(ch, node, mark) {
|
|
3469
|
-
return (cx, next, pos) => {
|
|
3470
|
-
if (next != ch || cx.char(pos + 1) == ch) return -1;
|
|
3471
|
-
let elts = [cx.elt(mark, pos, pos + 1)];
|
|
3472
|
-
for (let i = pos + 1; i < cx.end; i++) {
|
|
3473
|
-
let next = cx.char(i);
|
|
3474
|
-
if (next == ch) return cx.addElement(cx.elt(node, pos, i + 1, elts.concat(cx.elt(mark, i, i + 1))));
|
|
3475
|
-
if (next == 92 /* '\\' */) elts.push(cx.elt("Escape", i, i++ + 2));
|
|
3476
|
-
if (space(next)) break;
|
|
3477
|
-
}
|
|
3478
|
-
return -1;
|
|
3479
|
-
};
|
|
3480
|
-
}
|
|
3481
|
-
/// Extension providing
|
|
3482
|
-
/// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
|
|
3483
|
-
/// superscript using `^` markers.
|
|
3484
|
-
const Superscript = {
|
|
3485
|
-
defineNodes: [{
|
|
3486
|
-
name: "Superscript",
|
|
3487
|
-
style: tags$1.special(tags$1.content)
|
|
3488
|
-
}, {
|
|
3489
|
-
name: "SuperscriptMark",
|
|
3490
|
-
style: tags$1.processingInstruction
|
|
3491
|
-
}],
|
|
3492
|
-
parseInline: [{
|
|
3493
|
-
name: "Superscript",
|
|
3494
|
-
parse: parseSubSuper(94 /* '^' */, "Superscript", "SuperscriptMark")
|
|
3495
|
-
}]
|
|
3496
|
-
};
|
|
3497
|
-
/// Extension providing
|
|
3498
|
-
/// [Pandoc-style](https://pandoc.org/MANUAL.html#superscripts-and-subscripts)
|
|
3499
|
-
/// subscript using `~` markers.
|
|
3500
|
-
const Subscript = {
|
|
3501
|
-
defineNodes: [{
|
|
3502
|
-
name: "Subscript",
|
|
3503
|
-
style: tags$1.special(tags$1.content)
|
|
3504
|
-
}, {
|
|
3505
|
-
name: "SubscriptMark",
|
|
3506
|
-
style: tags$1.processingInstruction
|
|
3507
|
-
}],
|
|
3508
|
-
parseInline: [{
|
|
3509
|
-
name: "Subscript",
|
|
3510
|
-
parse: parseSubSuper(126 /* '~' */, "Subscript", "SubscriptMark")
|
|
3511
|
-
}]
|
|
3512
|
-
};
|
|
3513
|
-
/// Extension that parses two colons with only letters, underscores,
|
|
3514
|
-
/// and numbers between them as `Emoji` nodes.
|
|
3515
|
-
const Emoji = {
|
|
3516
|
-
defineNodes: [{
|
|
3517
|
-
name: "Emoji",
|
|
3518
|
-
style: tags$1.character
|
|
3519
|
-
}],
|
|
3520
|
-
parseInline: [{
|
|
3521
|
-
name: "Emoji",
|
|
3522
|
-
parse(cx, next, pos) {
|
|
3523
|
-
let match;
|
|
3524
|
-
if (next != 58 /* ':' */ || !(match = /^[a-zA-Z_0-9]+:/.exec(cx.slice(pos + 1, cx.end)))) return -1;
|
|
3525
|
-
return cx.addElement(cx.elt("Emoji", pos, pos + 1 + match[0].length));
|
|
3526
|
-
}
|
|
3527
|
-
}]
|
|
3528
|
-
};
|
|
3529
|
-
|
|
3530
|
-
const data = /*@__PURE__*/defineLanguageFacet({
|
|
3531
|
-
block: {
|
|
3532
|
-
open: "<!--",
|
|
3533
|
-
close: "-->"
|
|
3534
|
-
}
|
|
3535
|
-
});
|
|
3536
|
-
const commonmark = /*@__PURE__*/parser.configure({
|
|
3537
|
-
props: [/*@__PURE__*/foldNodeProp.add(type => {
|
|
3538
|
-
if (!type.is("Block") || type.is("Document")) return undefined;
|
|
3539
|
-
return (tree, state) => ({
|
|
3540
|
-
from: state.doc.lineAt(tree.from).to,
|
|
3541
|
-
to: tree.to
|
|
3542
|
-
});
|
|
3543
|
-
}), /*@__PURE__*/indentNodeProp.add({
|
|
3544
|
-
Document: () => null
|
|
3545
|
-
}), /*@__PURE__*/languageDataProp.add({
|
|
3546
|
-
Document: data
|
|
3547
|
-
})]
|
|
3548
|
-
});
|
|
3549
|
-
function mkLang(parser) {
|
|
3550
|
-
return new Language(data, parser);
|
|
3551
|
-
}
|
|
3552
|
-
/**
|
|
3553
|
-
Language support for strict CommonMark.
|
|
3554
|
-
*/
|
|
3555
|
-
const commonmarkLanguage = /*@__PURE__*/mkLang(commonmark);
|
|
3556
|
-
const extended = /*@__PURE__*/commonmark.configure([GFM, Subscript, Superscript, Emoji]);
|
|
3557
|
-
/**
|
|
3558
|
-
Language support for [GFM](https://github.github.com/gfm/) plus
|
|
3559
|
-
subscript, superscript, and emoji syntax.
|
|
3560
|
-
*/
|
|
3561
|
-
const markdownLanguage = /*@__PURE__*/mkLang(extended);
|
|
3562
|
-
function getCodeParser(languages, defaultLanguage) {
|
|
3563
|
-
return info => {
|
|
3564
|
-
if (info && languages) {
|
|
3565
|
-
let found = null;
|
|
3566
|
-
// Strip anything after whitespace
|
|
3567
|
-
info = /\S*/.exec(info)[0];
|
|
3568
|
-
if (typeof languages == "function") found = languages(info);else found = LanguageDescription.matchLanguageName(languages, info, true);
|
|
3569
|
-
if (found instanceof LanguageDescription) return found.support ? found.support.language.parser : ParseContext.getSkippingParser(found.load());else if (found) return found.parser;
|
|
3570
|
-
}
|
|
3571
|
-
return defaultLanguage ? defaultLanguage.parser : null;
|
|
3572
|
-
};
|
|
3573
|
-
}
|
|
3574
|
-
function nodeStart(node, doc) {
|
|
3575
|
-
return doc.sliceString(node.from, node.from + 50);
|
|
3576
|
-
}
|
|
3577
|
-
class Context {
|
|
3578
|
-
constructor(node, from, to, spaceBefore, spaceAfter, type, item) {
|
|
3579
|
-
this.node = node;
|
|
3580
|
-
this.from = from;
|
|
3581
|
-
this.to = to;
|
|
3582
|
-
this.spaceBefore = spaceBefore;
|
|
3583
|
-
this.spaceAfter = spaceAfter;
|
|
3584
|
-
this.type = type;
|
|
3585
|
-
this.item = item;
|
|
3586
|
-
}
|
|
3587
|
-
blank() {
|
|
3588
|
-
let trailing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
3589
|
-
let result = this.spaceBefore;
|
|
3590
|
-
if (this.node.name == "Blockquote") result += ">";else for (let i = this.to - this.from - result.length - this.spaceAfter.length; i > 0; i--) result += " ";
|
|
3591
|
-
return result + (trailing ? this.spaceAfter : "");
|
|
3592
|
-
}
|
|
3593
|
-
marker(doc, add) {
|
|
3594
|
-
let number = this.node.name == "OrderedList" ? String(+itemNumber(this.item, doc)[2] + add) : "";
|
|
3595
|
-
return this.spaceBefore + number + this.type + this.spaceAfter;
|
|
3596
|
-
}
|
|
3597
|
-
}
|
|
3598
|
-
function getContext(node, line, doc) {
|
|
3599
|
-
let nodes = [];
|
|
3600
|
-
for (let cur = node; cur && cur.name != "Document"; cur = cur.parent) {
|
|
3601
|
-
if (cur.name == "ListItem" || cur.name == "Blockquote") nodes.push(cur);
|
|
3602
|
-
}
|
|
3603
|
-
let context = [],
|
|
3604
|
-
pos = 0;
|
|
3605
|
-
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
3606
|
-
let node = nodes[i],
|
|
3607
|
-
match,
|
|
3608
|
-
start = pos;
|
|
3609
|
-
if (node.name == "Blockquote" && (match = /^[ \t]*>( ?)/.exec(line.slice(pos)))) {
|
|
3610
|
-
pos += match[0].length;
|
|
3611
|
-
context.push(new Context(node, start, pos, "", match[1], ">", null));
|
|
3612
|
-
} else if (node.name == "ListItem" && node.parent.name == "OrderedList" && (match = /^([ \t]*)\d+([.)])([ \t]*)/.exec(nodeStart(node, doc)))) {
|
|
3613
|
-
let after = match[3],
|
|
3614
|
-
len = match[0].length;
|
|
3615
|
-
if (after.length >= 4) {
|
|
3616
|
-
after = after.slice(0, after.length - 4);
|
|
3617
|
-
len -= 4;
|
|
3618
|
-
}
|
|
3619
|
-
pos += len;
|
|
3620
|
-
context.push(new Context(node.parent, start, pos, match[1], after, match[2], node));
|
|
3621
|
-
} else if (node.name == "ListItem" && node.parent.name == "BulletList" && (match = /^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(nodeStart(node, doc)))) {
|
|
3622
|
-
let after = match[4],
|
|
3623
|
-
len = match[0].length;
|
|
3624
|
-
if (after.length > 4) {
|
|
3625
|
-
after = after.slice(0, after.length - 4);
|
|
3626
|
-
len -= 4;
|
|
3627
|
-
}
|
|
3628
|
-
let type = match[2];
|
|
3629
|
-
if (match[3]) type += match[3].replace(/[xX]/, ' ');
|
|
3630
|
-
pos += len;
|
|
3631
|
-
context.push(new Context(node.parent, start, pos, match[1], after, type, node));
|
|
3632
|
-
}
|
|
3633
|
-
}
|
|
3634
|
-
return context;
|
|
3635
|
-
}
|
|
3636
|
-
function itemNumber(item, doc) {
|
|
3637
|
-
return /^(\s*)(\d+)(?=[.)])/.exec(doc.sliceString(item.from, item.from + 10));
|
|
3638
|
-
}
|
|
3639
|
-
function renumberList(after, doc, changes) {
|
|
3640
|
-
let offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3641
|
-
for (let prev = -1, node = after;;) {
|
|
3642
|
-
if (node.name == "ListItem") {
|
|
3643
|
-
let m = itemNumber(node, doc);
|
|
3644
|
-
let number = +m[2];
|
|
3645
|
-
if (prev >= 0) {
|
|
3646
|
-
if (number != prev + 1) return;
|
|
3647
|
-
changes.push({
|
|
3648
|
-
from: node.from + m[1].length,
|
|
3649
|
-
to: node.from + m[0].length,
|
|
3650
|
-
insert: String(prev + 2 + offset)
|
|
3651
|
-
});
|
|
3652
|
-
}
|
|
3653
|
-
prev = number;
|
|
3654
|
-
}
|
|
3655
|
-
let next = node.nextSibling;
|
|
3656
|
-
if (!next) break;
|
|
3657
|
-
node = next;
|
|
3658
|
-
}
|
|
3659
|
-
}
|
|
3660
|
-
/**
|
|
3661
|
-
This command, when invoked in Markdown context with cursor
|
|
3662
|
-
selection(s), will create a new line with the markup for
|
|
3663
|
-
blockquotes and lists that were active on the old line. If the
|
|
3664
|
-
cursor was directly after the end of the markup for the old line,
|
|
3665
|
-
trailing whitespace and list markers are removed from that line.
|
|
3666
|
-
|
|
3667
|
-
The command does nothing in non-Markdown context, so it should
|
|
3668
|
-
not be used as the only binding for Enter (even in a Markdown
|
|
3669
|
-
document, HTML and code regions might use a different language).
|
|
3670
|
-
*/
|
|
3671
|
-
const insertNewlineContinueMarkup = _ref => {
|
|
3672
|
-
let {
|
|
3673
|
-
state,
|
|
3674
|
-
dispatch
|
|
3675
|
-
} = _ref;
|
|
3676
|
-
let tree = syntaxTree(state),
|
|
3677
|
-
{
|
|
3678
|
-
doc
|
|
3679
|
-
} = state;
|
|
3680
|
-
let dont = null,
|
|
3681
|
-
changes = state.changeByRange(range => {
|
|
3682
|
-
if (!range.empty || !markdownLanguage.isActiveAt(state, range.from)) return dont = {
|
|
3683
|
-
range
|
|
3684
|
-
};
|
|
3685
|
-
let pos = range.from,
|
|
3686
|
-
line = doc.lineAt(pos);
|
|
3687
|
-
let context = getContext(tree.resolveInner(pos, -1), line.text, doc);
|
|
3688
|
-
while (context.length && context[context.length - 1].from > pos - line.from) context.pop();
|
|
3689
|
-
if (!context.length) return dont = {
|
|
3690
|
-
range
|
|
3691
|
-
};
|
|
3692
|
-
let inner = context[context.length - 1];
|
|
3693
|
-
if (inner.to - inner.spaceAfter.length > pos - line.from) return dont = {
|
|
3694
|
-
range
|
|
3695
|
-
};
|
|
3696
|
-
let emptyLine = pos >= inner.to - inner.spaceAfter.length && !/\S/.test(line.text.slice(inner.to));
|
|
3697
|
-
// Empty line in list
|
|
3698
|
-
if (inner.item && emptyLine) {
|
|
3699
|
-
// First list item or blank line before: delete a level of markup
|
|
3700
|
-
if (inner.node.firstChild.to >= pos || line.from > 0 && !/[^\s>]/.test(doc.lineAt(line.from - 1).text)) {
|
|
3701
|
-
let next = context.length > 1 ? context[context.length - 2] : null;
|
|
3702
|
-
let delTo,
|
|
3703
|
-
insert = "";
|
|
3704
|
-
if (next && next.item) {
|
|
3705
|
-
// Re-add marker for the list at the next level
|
|
3706
|
-
delTo = line.from + next.from;
|
|
3707
|
-
insert = next.marker(doc, 1);
|
|
3708
|
-
} else {
|
|
3709
|
-
delTo = line.from + (next ? next.to : 0);
|
|
3710
|
-
}
|
|
3711
|
-
let changes = [{
|
|
3712
|
-
from: delTo,
|
|
3713
|
-
to: pos,
|
|
3714
|
-
insert
|
|
3715
|
-
}];
|
|
3716
|
-
if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes, -2);
|
|
3717
|
-
if (next && next.node.name == "OrderedList") renumberList(next.item, doc, changes);
|
|
3718
|
-
return {
|
|
3719
|
-
range: EditorSelection.cursor(delTo + insert.length),
|
|
3720
|
-
changes
|
|
3721
|
-
};
|
|
3722
|
-
} else {
|
|
3723
|
-
// Move this line down
|
|
3724
|
-
let insert = "";
|
|
3725
|
-
for (let i = 0, e = context.length - 2; i <= e; i++) insert += context[i].blank(i < e);
|
|
3726
|
-
insert += state.lineBreak;
|
|
3727
|
-
return {
|
|
3728
|
-
range: EditorSelection.cursor(pos + insert.length),
|
|
3729
|
-
changes: {
|
|
3730
|
-
from: line.from,
|
|
3731
|
-
insert
|
|
3732
|
-
}
|
|
3733
|
-
};
|
|
3734
|
-
}
|
|
3735
|
-
}
|
|
3736
|
-
if (inner.node.name == "Blockquote" && emptyLine && line.from) {
|
|
3737
|
-
let prevLine = doc.lineAt(line.from - 1),
|
|
3738
|
-
quoted = />\s*$/.exec(prevLine.text);
|
|
3739
|
-
// Two aligned empty quoted lines in a row
|
|
3740
|
-
if (quoted && quoted.index == inner.from) {
|
|
3741
|
-
let changes = state.changes([{
|
|
3742
|
-
from: prevLine.from + quoted.index,
|
|
3743
|
-
to: prevLine.to
|
|
3744
|
-
}, {
|
|
3745
|
-
from: line.from + inner.from,
|
|
3746
|
-
to: line.to
|
|
3747
|
-
}]);
|
|
3748
|
-
return {
|
|
3749
|
-
range: range.map(changes),
|
|
3750
|
-
changes
|
|
3751
|
-
};
|
|
3752
|
-
}
|
|
3753
|
-
}
|
|
3754
|
-
let changes = [];
|
|
3755
|
-
if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes);
|
|
3756
|
-
let insert = state.lineBreak;
|
|
3757
|
-
let continued = inner.item && inner.item.from < line.from;
|
|
3758
|
-
// If not dedented
|
|
3759
|
-
if (!continued || /^[\s\d.)\-+*>]*/.exec(line.text)[0].length >= inner.to) {
|
|
3760
|
-
for (let i = 0, e = context.length - 1; i <= e; i++) insert += i == e && !continued ? context[i].marker(doc, 1) : context[i].blank();
|
|
3761
|
-
}
|
|
3762
|
-
let from = pos;
|
|
3763
|
-
while (from > line.from && /\s/.test(line.text.charAt(from - line.from - 1))) from--;
|
|
3764
|
-
changes.push({
|
|
3765
|
-
from,
|
|
3766
|
-
to: pos,
|
|
3767
|
-
insert
|
|
3768
|
-
});
|
|
3769
|
-
return {
|
|
3770
|
-
range: EditorSelection.cursor(from + insert.length),
|
|
3771
|
-
changes
|
|
3772
|
-
};
|
|
3773
|
-
});
|
|
3774
|
-
if (dont) return false;
|
|
3775
|
-
dispatch(state.update(changes, {
|
|
3776
|
-
scrollIntoView: true,
|
|
3777
|
-
userEvent: "input"
|
|
3778
|
-
}));
|
|
3779
|
-
return true;
|
|
3780
|
-
};
|
|
3781
|
-
function isMark(node) {
|
|
3782
|
-
return node.name == "QuoteMark" || node.name == "ListMark";
|
|
3783
|
-
}
|
|
3784
|
-
function contextNodeForDelete(tree, pos) {
|
|
3785
|
-
let node = tree.resolveInner(pos, -1),
|
|
3786
|
-
scan = pos;
|
|
3787
|
-
if (isMark(node)) {
|
|
3788
|
-
scan = node.from;
|
|
3789
|
-
node = node.parent;
|
|
3790
|
-
}
|
|
3791
|
-
for (let prev; prev = node.childBefore(scan);) {
|
|
3792
|
-
if (isMark(prev)) {
|
|
3793
|
-
scan = prev.from;
|
|
3794
|
-
} else if (prev.name == "OrderedList" || prev.name == "BulletList") {
|
|
3795
|
-
node = prev.lastChild;
|
|
3796
|
-
scan = node.to;
|
|
3797
|
-
} else {
|
|
3798
|
-
break;
|
|
3799
|
-
}
|
|
3800
|
-
}
|
|
3801
|
-
return node;
|
|
3802
|
-
}
|
|
3803
|
-
/**
|
|
3804
|
-
This command will, when invoked in a Markdown context with the
|
|
3805
|
-
cursor directly after list or blockquote markup, delete one level
|
|
3806
|
-
of markup. When the markup is for a list, it will be replaced by
|
|
3807
|
-
spaces on the first invocation (a further invocation will delete
|
|
3808
|
-
the spaces), to make it easy to continue a list.
|
|
3809
|
-
|
|
3810
|
-
When not after Markdown block markup, this command will return
|
|
3811
|
-
false, so it is intended to be bound alongside other deletion
|
|
3812
|
-
commands, with a higher precedence than the more generic commands.
|
|
3813
|
-
*/
|
|
3814
|
-
const deleteMarkupBackward = _ref2 => {
|
|
3815
|
-
let {
|
|
3816
|
-
state,
|
|
3817
|
-
dispatch
|
|
3818
|
-
} = _ref2;
|
|
3819
|
-
let tree = syntaxTree(state);
|
|
3820
|
-
let dont = null,
|
|
3821
|
-
changes = state.changeByRange(range => {
|
|
3822
|
-
let pos = range.from,
|
|
3823
|
-
{
|
|
3824
|
-
doc
|
|
3825
|
-
} = state;
|
|
3826
|
-
if (range.empty && markdownLanguage.isActiveAt(state, range.from)) {
|
|
3827
|
-
let line = doc.lineAt(pos);
|
|
3828
|
-
let context = getContext(contextNodeForDelete(tree, pos), line.text, doc);
|
|
3829
|
-
if (context.length) {
|
|
3830
|
-
let inner = context[context.length - 1];
|
|
3831
|
-
let spaceEnd = inner.to - inner.spaceAfter.length + (inner.spaceAfter ? 1 : 0);
|
|
3832
|
-
// Delete extra trailing space after markup
|
|
3833
|
-
if (pos - line.from > spaceEnd && !/\S/.test(line.text.slice(spaceEnd, pos - line.from))) return {
|
|
3834
|
-
range: EditorSelection.cursor(line.from + spaceEnd),
|
|
3835
|
-
changes: {
|
|
3836
|
-
from: line.from + spaceEnd,
|
|
3837
|
-
to: pos
|
|
3838
|
-
}
|
|
3839
|
-
};
|
|
3840
|
-
if (pos - line.from == spaceEnd) {
|
|
3841
|
-
let start = line.from + inner.from;
|
|
3842
|
-
// Replace a list item marker with blank space
|
|
3843
|
-
if (inner.item && inner.node.from < inner.item.from && /\S/.test(line.text.slice(inner.from, inner.to))) return {
|
|
3844
|
-
range,
|
|
3845
|
-
changes: {
|
|
3846
|
-
from: start,
|
|
3847
|
-
to: line.from + inner.to,
|
|
3848
|
-
insert: inner.blank()
|
|
3849
|
-
}
|
|
3850
|
-
};
|
|
3851
|
-
// Delete one level of indentation
|
|
3852
|
-
if (start < pos) return {
|
|
3853
|
-
range: EditorSelection.cursor(start),
|
|
3854
|
-
changes: {
|
|
3855
|
-
from: start,
|
|
3856
|
-
to: pos
|
|
3857
|
-
}
|
|
3858
|
-
};
|
|
3859
|
-
}
|
|
3860
|
-
}
|
|
3861
|
-
}
|
|
3862
|
-
return dont = {
|
|
3863
|
-
range
|
|
3864
|
-
};
|
|
3865
|
-
});
|
|
3866
|
-
if (dont) return false;
|
|
3867
|
-
dispatch(state.update(changes, {
|
|
3868
|
-
scrollIntoView: true,
|
|
3869
|
-
userEvent: "delete"
|
|
3870
|
-
}));
|
|
3871
|
-
return true;
|
|
3872
|
-
};
|
|
3873
|
-
|
|
3874
|
-
/**
|
|
3875
|
-
A small keymap with Markdown-specific bindings. Binds Enter to
|
|
3876
|
-
[`insertNewlineContinueMarkup`](https://codemirror.net/6/docs/ref/#lang-markdown.insertNewlineContinueMarkup)
|
|
3877
|
-
and Backspace to
|
|
3878
|
-
[`deleteMarkupBackward`](https://codemirror.net/6/docs/ref/#lang-markdown.deleteMarkupBackward).
|
|
3879
|
-
*/
|
|
3880
|
-
const markdownKeymap = [{
|
|
3881
|
-
key: "Enter",
|
|
3882
|
-
run: insertNewlineContinueMarkup
|
|
3883
|
-
}, {
|
|
3884
|
-
key: "Backspace",
|
|
3885
|
-
run: deleteMarkupBackward
|
|
3886
|
-
}];
|
|
3887
|
-
const htmlNoMatch = /*@__PURE__*/html({
|
|
3888
|
-
matchClosingTags: false
|
|
3889
|
-
});
|
|
3890
|
-
/**
|
|
3891
|
-
Markdown language support.
|
|
3892
|
-
*/
|
|
3893
|
-
function markdown() {
|
|
3894
|
-
let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3895
|
-
let {
|
|
3896
|
-
codeLanguages,
|
|
3897
|
-
defaultCodeLanguage,
|
|
3898
|
-
addKeymap = true,
|
|
3899
|
-
base: {
|
|
3900
|
-
parser
|
|
3901
|
-
} = commonmarkLanguage
|
|
3902
|
-
} = config;
|
|
3903
|
-
if (!(parser instanceof MarkdownParser)) throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
|
|
3904
|
-
let extensions = config.extensions ? [config.extensions] : [];
|
|
3905
|
-
let support = [htmlNoMatch.support],
|
|
3906
|
-
defaultCode;
|
|
3907
|
-
if (defaultCodeLanguage instanceof LanguageSupport) {
|
|
3908
|
-
support.push(defaultCodeLanguage.support);
|
|
3909
|
-
defaultCode = defaultCodeLanguage.language;
|
|
3910
|
-
} else if (defaultCodeLanguage) {
|
|
3911
|
-
defaultCode = defaultCodeLanguage;
|
|
3912
|
-
}
|
|
3913
|
-
let codeParser = codeLanguages || defaultCode ? getCodeParser(codeLanguages, defaultCode) : undefined;
|
|
3914
|
-
extensions.push(parseCode({
|
|
3915
|
-
codeParser,
|
|
3916
|
-
htmlParser: htmlNoMatch.language.parser
|
|
3917
|
-
}));
|
|
3918
|
-
if (addKeymap) support.push(Prec.high(keymap.of(markdownKeymap)));
|
|
3919
|
-
return new LanguageSupport(mkLang(parser.configure(extensions)), support);
|
|
3920
|
-
}
|
|
3921
|
-
|
|
3922
|
-
const JS = javascript({
|
|
3923
|
-
typescript: false
|
|
3924
|
-
});
|
|
3925
|
-
const TS = javascript({
|
|
3926
|
-
typescript: true
|
|
3927
|
-
});
|
|
3928
|
-
const CSS = css();
|
|
3929
|
-
const HTML = html();
|
|
3930
|
-
const JSON$1 = json();
|
|
3931
|
-
const MD = markdown();
|
|
3932
|
-
var languages = {
|
|
3933
|
-
[OrCodeLanguages.JS]: JS,
|
|
3934
|
-
[OrCodeLanguages.TS]: TS,
|
|
3935
|
-
[OrCodeLanguages.CSS]: CSS,
|
|
3936
|
-
[OrCodeLanguages.HTML]: HTML,
|
|
3937
|
-
[OrCodeLanguages.JSON]: JSON$1,
|
|
3938
|
-
[OrCodeLanguages.MD]: MD
|
|
3939
|
-
};
|
|
3940
|
-
|
|
3941
|
-
export { CSS, HTML, JS, JSON$1 as JSON, MD, TS, languages as default };
|
|
1
|
+
export { C as CSS, H as HTML, J as JS, e as JSON, M as MD, T as TS, l as default } from '../../lang-0fb8f78b.js';
|
|
2
|
+
import './constants.js';
|
|
3
|
+
import '../../index-cf2c3c27.js';
|