@onereach/ui-components 4.5.0 → 4.6.0-beta.2747.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 +6 -3792
- package/dist/bundled/v2/components/OrCode/index.js +6 -2
- package/dist/bundled/v2/components/OrCode/lang.js +3941 -3
- package/dist/bundled/v2/components/OrCode/theme.js +2 -1
- package/dist/bundled/v2/components/OrConfirm/OrConfirm.js +2 -1
- package/dist/bundled/v2/components/OrConfirm/index.js +2 -1
- 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/OrModal/OrModal.js +3 -1346
- package/dist/bundled/v2/components/OrModal/index.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +2200 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +220 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.d.ts +2 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +70 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/props.d.ts +4 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/props.js +7 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +6 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +38 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +46 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +5 -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 +1 -0
- package/dist/bundled/v2/components/index.js +17 -3
- package/dist/bundled/{v3/index-cf2c3c27.js → v2/index-0d224ae5.js} +3 -115
- package/dist/bundled/v2/index-418d5c0d.js +9633 -0
- package/dist/bundled/v2/index-85c2efe8.js +7122 -0
- package/dist/bundled/{v3/OrCode.vue_vue_type_script_lang-74060519.js → v2/index-d92d0b48.js} +14 -235
- package/dist/bundled/{v3/lang-0fb8f78b.js → v2/index-e9f6b2d8.js} +73 -4009
- package/dist/bundled/v2/index.es-3f39f316.js +115 -0
- package/dist/bundled/v2/index.js +20 -6
- package/dist/bundled/v2/markdown-7c7c4ca6.js +17980 -0
- package/dist/bundled/{v3/OrModal.vue_vue_type_script_lang-ae842e5b.js → v2/useFocusTrap-48767a70.js} +3 -106
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-7e29b3d0.js +237 -0
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-e1390930.js → OrConfirm.vue_vue_type_script_lang-13397889.js} +1 -1
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-e5a8f92a.js → OrConfirm.vue_vue_type_script_lang-4eaa8470.js} +2 -2
- package/dist/bundled/v3/OrModal.vue_vue_type_script_lang-2c009ee0.js +108 -0
- package/dist/bundled/v3/OrRichTextEditor.vue_vue_type_script_lang-fd3f9c45.js +1890 -0
- package/dist/bundled/v3/components/OrAvatar/OrAvatar.vue.d.ts +26 -11
- package/dist/bundled/v3/components/OrAvatarV3/OrAvatar.vue.d.ts +24 -8
- package/dist/bundled/v3/components/OrBottomSheetV3/OrBottomSheet.vue.d.ts +33 -20
- package/dist/bundled/v3/components/OrButton/OrButton.vue.d.ts +51 -16
- package/dist/bundled/v3/components/OrButtonV2/OrButton.vue.d.ts +57 -20
- package/dist/bundled/v3/components/OrButtonV3/OrButton.vue.d.ts +35 -15
- package/dist/bundled/v3/components/OrCard/OrCard.vue.d.ts +15 -7
- package/dist/bundled/v3/components/OrCardCollection/OrCardCollection.vue.d.ts +47 -21
- package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.vue.d.ts +70 -22
- package/dist/bundled/v3/components/OrCardV3/OrCard.vue.d.ts +7 -4
- package/dist/bundled/v3/components/OrCarousel/OrCarousel.vue.d.ts +676 -126
- package/dist/bundled/v3/components/OrCarouselItem/OrCarouselItem.vue.d.ts +1 -1
- package/dist/bundled/v3/components/OrCheckbox/OrCheckbox.vue.d.ts +35 -15
- package/dist/bundled/v3/components/OrCheckboxGroupV3/OrCheckboxGroup.vue.d.ts +24 -6
- package/dist/bundled/v3/components/OrCheckboxTreeV3/OrCheckboxTree.vue.d.ts +43 -17
- package/dist/bundled/v3/components/OrCheckboxV3/OrCheckbox.vue.d.ts +53 -23
- package/dist/bundled/v3/components/OrChip/OrChip.vue.d.ts +25 -9
- package/dist/bundled/v3/components/OrChips/OrChips.vue.d.ts +51 -24
- package/dist/bundled/v3/components/OrCode/OrCode.js +10 -6
- package/dist/bundled/v3/components/OrCode/OrCode.vue.d.ts +69 -24
- package/dist/bundled/v3/components/OrCode/index.js +8 -4
- package/dist/bundled/v3/components/OrCode/lang.js +3941 -3
- package/dist/bundled/v3/components/OrCode/theme.js +2 -1
- package/dist/bundled/v3/components/OrCollapse/OrCollapse.vue.d.ts +39 -17
- package/dist/bundled/v3/components/OrColorPicker/OrColorPicker.vue.d.ts +31 -13
- package/dist/bundled/v3/components/OrCombinedInputV3/OrCombinedInput.vue.d.ts +30 -8
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.js +5 -4
- package/dist/bundled/v3/components/OrConfirm/OrConfirm.vue.d.ts +84 -23
- package/dist/bundled/v3/components/OrConfirm/index.js +4 -3
- package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +3 -3
- package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.vue.d.ts +91 -29
- package/dist/bundled/v3/components/OrConfirmV3/index.js +2 -2
- package/dist/bundled/v3/components/OrDatePickerV3/OrDatePicker.vue.d.ts +81 -25
- package/dist/bundled/v3/components/OrDateTimePicker/OrDateTimePicker.vue.d.ts +177 -68
- package/dist/bundled/v3/components/OrDateTimePickerV3/OrDateTimePicker.vue.d.ts +105 -31
- package/dist/bundled/v3/components/OrEmptyStateV3/OrEmptyState.vue.d.ts +28 -11
- package/dist/bundled/v3/components/OrError/OrError.vue.d.ts +8 -4
- package/dist/bundled/v3/components/OrErrorTagV3/OrErrorTag.vue.d.ts +7 -4
- package/dist/bundled/v3/components/OrErrorV3/OrError.vue.d.ts +18 -9
- package/dist/bundled/v3/components/OrExpansionPanelV3/OrExpansionPanel.vue.d.ts +35 -14
- package/dist/bundled/v3/components/OrFabV3/OrFab.vue.d.ts +20 -8
- package/dist/bundled/v3/components/OrFloating/OrFloating.vue.d.ts +46 -15
- package/dist/bundled/v3/components/OrFormGroupV3/OrFormGroup.vue.d.ts +30 -10
- package/dist/bundled/v3/components/OrHint/OrHint.vue.d.ts +8 -4
- package/dist/bundled/v3/components/OrHintV3/OrHint.vue.d.ts +18 -9
- package/dist/bundled/v3/components/OrIcon/OrIcon.vue.d.ts +44 -16
- package/dist/bundled/v3/components/OrIconButtonV2/OrIconButton.vue.d.ts +43 -13
- package/dist/bundled/v3/components/OrIconButtonV3/OrIconButton.vue.d.ts +52 -16
- package/dist/bundled/v3/components/OrIconV3/OrIcon.vue.d.ts +18 -7
- package/dist/bundled/v3/components/OrInlineInputBoxV3/OrInlineInputBox.vue.d.ts +16 -7
- package/dist/bundled/v3/components/OrInlineInputV3/OrInlineInput.vue.d.ts +83 -39
- package/dist/bundled/v3/components/OrInlineTextEdit/OrInlineTextEdit.vue.d.ts +95 -43
- package/dist/bundled/v3/components/OrInlineTextareaV3/OrInlineTextarea.vue.d.ts +79 -39
- package/dist/bundled/v3/components/OrInput/OrInput.vue.d.ts +87 -36
- package/dist/bundled/v3/components/OrInputBoxV3/OrInputBox.vue.d.ts +22 -7
- package/dist/bundled/v3/components/OrInputV3/OrInput.vue.d.ts +85 -34
- package/dist/bundled/v3/components/OrLabel/OrLabel.vue.d.ts +20 -9
- package/dist/bundled/v3/components/OrLabelV3/OrLabel.vue.d.ts +24 -9
- package/dist/bundled/v3/components/OrLinkV3/OrLink.vue.d.ts +24 -7
- package/dist/bundled/v3/components/OrList/OrList.vue.d.ts +47 -21
- package/dist/bundled/v3/components/OrListOfInputs/OrListOfInputs.vue.d.ts +27 -11
- package/dist/bundled/v3/components/OrLoader/OrLoader.vue.d.ts +26 -10
- package/dist/bundled/v3/components/OrLoaderV3/OrLoader.vue.d.ts +34 -13
- package/dist/bundled/v3/components/OrMenuItemV3/OrMenuItem.vue.d.ts +34 -13
- package/dist/bundled/v3/components/OrMenuV3/OrMenu.vue.d.ts +43 -16
- package/dist/bundled/v3/components/OrModal/OrModal.js +3 -2
- package/dist/bundled/v3/components/OrModal/OrModal.vue.d.ts +38 -14
- package/dist/bundled/v3/components/OrModal/index.js +2 -1
- package/dist/bundled/v3/components/OrModalV3/OrModal.vue.d.ts +31 -15
- package/dist/bundled/v3/components/OrNotification/OrNotification.vue.d.ts +27 -9
- package/dist/bundled/v3/components/OrNotificationV3/OrNotification.vue.d.ts +20 -9
- package/dist/bundled/v3/components/OrNumberInput/OrNumberInput.vue.d.ts +70 -24
- package/dist/bundled/v3/components/OrOverflowMenu/OrOverflowMenu.vue.d.ts +31 -13
- package/dist/bundled/v3/components/OrOverlay/OrOverlay.vue.d.ts +16 -6
- package/dist/bundled/v3/components/OrOverlayV3/OrOverlay.vue.d.ts +14 -7
- package/dist/bundled/v3/components/OrPaginationV3/OrPagination.vue.d.ts +75 -27
- package/dist/bundled/v3/components/OrPassword/OrPassword.vue.d.ts +63 -22
- package/dist/bundled/v3/components/OrPopoverV3/OrPopover.vue.d.ts +76 -28
- package/dist/bundled/v3/components/OrProgress/OrProgress.vue.d.ts +56 -20
- package/dist/bundled/v3/components/OrProgressV3/OrProgress.vue.d.ts +62 -25
- package/dist/bundled/v3/components/OrRadio/OrRadio.vue.d.ts +35 -13
- package/dist/bundled/v3/components/OrRadioGroup/OrRadioGroup.vue.d.ts +26 -9
- package/dist/bundled/v3/components/OrRadioGroupV3/OrRadioGroup.vue.d.ts +32 -6
- package/dist/bundled/v3/components/OrRadioV3/OrRadio.vue.d.ts +49 -21
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +284 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +220 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.d.ts +2 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +86 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/props.d.ts +4 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +7 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +6 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +38 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +46 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +184 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +5 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.d.ts +24 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +190 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/types.js +1 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +3 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +5 -0
- package/dist/bundled/v3/components/OrSearch/OrSearch.vue.d.ts +65 -23
- package/dist/bundled/v3/components/OrSearchV3/OrSearch.vue.d.ts +41 -17
- package/dist/bundled/v3/components/OrSegmentedControlV3/OrSegmentedControl.vue.d.ts +25 -9
- package/dist/bundled/v3/components/OrSelect/OrSelect.vue.d.ts +77 -28
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +115 -37
- package/dist/bundled/v3/components/OrSidebar/OrSidebar.vue.d.ts +33 -14
- package/dist/bundled/v3/components/OrSidebarV3/OrSidebar.vue.d.ts +63 -28
- package/dist/bundled/v3/components/OrSkeletonCircle/OrSkeletonCircle.vue.d.ts +20 -9
- package/dist/bundled/v3/components/OrSkeletonCircleV3/OrSkeletonCircle.vue.d.ts +28 -13
- package/dist/bundled/v3/components/OrSkeletonRect/OrSkeletonRect.vue.d.ts +22 -9
- package/dist/bundled/v3/components/OrSkeletonRectV3/OrSkeletonRect.vue.d.ts +26 -11
- package/dist/bundled/v3/components/OrSkeletonText/OrSkeletonText.vue.d.ts +26 -10
- package/dist/bundled/v3/components/OrSkeletonTextV3/OrSkeletonText.vue.d.ts +40 -16
- package/dist/bundled/v3/components/OrSlider/OrSlider.vue.d.ts +91 -35
- package/dist/bundled/v3/components/OrSortHeaderV3/OrSortHeader.vue.d.ts +25 -13
- package/dist/bundled/v3/components/OrStepper/OrStepper.vue.d.ts +43 -16
- package/dist/bundled/v3/components/OrSwitch/OrSwitch.vue.d.ts +33 -12
- package/dist/bundled/v3/components/OrSwitchV3/OrSwitch.vue.d.ts +53 -22
- package/dist/bundled/v3/components/OrTab/OrTab.vue.d.ts +22 -9
- package/dist/bundled/v3/components/OrTabHeaderItem/OrTabHeaderItem.vue.d.ts +29 -13
- package/dist/bundled/v3/components/OrTabV3/OrTab.vue.d.ts +17 -10
- package/dist/bundled/v3/components/OrTabs/OrTabs.vue.d.ts +17 -4
- package/dist/bundled/v3/components/OrTabsV3/OrTabs.vue.d.ts +71 -25
- package/dist/bundled/v3/components/OrTag/OrTag.vue.d.ts +27 -10
- package/dist/bundled/v3/components/OrTagV3/OrTag.vue.d.ts +23 -12
- package/dist/bundled/v3/components/OrTagsV3/OrTags.vue.d.ts +63 -19
- package/dist/bundled/v3/components/OrTeleport/OrTeleport.vue3.vue.d.ts +10 -4
- package/dist/bundled/v3/components/OrTeleportV3/OrTeleport.vue3.vue.d.ts +10 -4
- package/dist/bundled/v3/components/OrTextV3/OrText.vue.d.ts +24 -11
- package/dist/bundled/v3/components/OrTextarea/OrTextarea.vue.d.ts +85 -37
- package/dist/bundled/v3/components/OrTextareaV3/OrTextarea.vue.d.ts +73 -32
- package/dist/bundled/v3/components/OrTextbox/OrTextbox.vue.d.ts +137 -55
- package/dist/bundled/v3/components/OrTimePickerV3/OrTimePicker.vue.d.ts +79 -25
- package/dist/bundled/v3/components/OrToast/OrToast.vue.d.ts +31 -11
- package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.vue.d.ts +55 -25
- package/dist/bundled/v3/components/OrToastContainerV3/OrToastContainer.vue.d.ts +54 -24
- package/dist/bundled/v3/components/OrToastV3/OrToast.vue.d.ts +38 -16
- package/dist/bundled/v3/components/OrTooltip/OrTooltip.vue.d.ts +33 -14
- package/dist/bundled/v3/components/OrTooltipContent/OrTooltipContent.vue.d.ts +10 -4
- package/dist/bundled/v3/components/OrTooltipV3/OrTooltip.vue.d.ts +37 -13
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +22 -7
- package/dist/bundled/v3/directives/dropdown-close.d.ts +1 -3
- package/dist/bundled/v3/directives/dropdown-open.d.ts +1 -3
- package/dist/bundled/v3/hooks/useResponsive/useResponsive.d.ts +2 -2
- package/dist/bundled/{v2/index-cf2c3c27.js → v3/index-0d224ae5.js} +3 -115
- package/dist/bundled/v3/index-418d5c0d.js +9633 -0
- package/dist/bundled/v3/index-85c2efe8.js +7122 -0
- package/dist/bundled/v3/index-d92d0b48.js +3805 -0
- package/dist/bundled/{v2/lang-0fb8f78b.js → v3/index-e9f6b2d8.js} +73 -4009
- package/dist/bundled/v3/index.es-3f39f316.js +115 -0
- package/dist/bundled/v3/index.js +26 -11
- package/dist/bundled/v3/markdown-7c7c4ca6.js +17980 -0
- package/dist/bundled/v3/useFocusTrap-48767a70.js +1348 -0
- package/dist/esm/v2/OrRichTextEditor-e31b0fb4.js +923 -0
- package/dist/esm/v2/codemirrorView-be2c7423.js +353 -0
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +24 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +220 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +59 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/props.d.ts +4 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -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 +24 -0
- package/dist/esm/v3/OrRichTextEditor-bdb2040e.js +856 -0
- package/dist/esm/v3/codemirrorView-be2c7423.js +353 -0
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +24 -0
- package/dist/esm/v3/components/or-avatar/OrAvatar.vue.d.ts +26 -11
- package/dist/esm/v3/components/or-avatar-v3/OrAvatar.vue.d.ts +24 -8
- package/dist/esm/v3/components/or-bottom-sheet-v3/OrBottomSheet.vue.d.ts +33 -20
- package/dist/esm/v3/components/or-button/OrButton.vue.d.ts +51 -16
- package/dist/esm/v3/components/or-button-v2/OrButton.vue.d.ts +57 -20
- package/dist/esm/v3/components/or-button-v3/OrButton.vue.d.ts +35 -15
- package/dist/esm/v3/components/or-card/OrCard.vue.d.ts +15 -7
- package/dist/esm/v3/components/or-card-collection/OrCardCollection.vue.d.ts +47 -21
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +70 -22
- package/dist/esm/v3/components/or-card-collection-v3/partials/OrCardCollectionView.vue3.vue.d.ts +14 -6
- package/dist/esm/v3/components/or-card-v3/OrCard.vue.d.ts +7 -4
- package/dist/esm/v3/components/or-carousel/OrCarousel.vue.d.ts +676 -126
- 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 +35 -15
- package/dist/esm/v3/components/or-checkbox-group-v3/OrCheckboxGroup.vue.d.ts +24 -6
- package/dist/esm/v3/components/or-checkbox-tree-v3/OrCheckboxTree.vue.d.ts +43 -17
- package/dist/esm/v3/components/or-checkbox-v3/OrCheckbox.vue.d.ts +53 -23
- package/dist/esm/v3/components/or-chips/OrChips.vue.d.ts +51 -24
- package/dist/esm/v3/components/or-chips/or-chip/OrChip.vue.d.ts +25 -9
- package/dist/esm/v3/components/or-chips/partials/OrChipsInput.vue.d.ts +37 -17
- package/dist/esm/v3/components/or-code/OrCode.vue.d.ts +69 -24
- package/dist/esm/v3/components/or-collapse/OrCollapse.vue.d.ts +39 -17
- package/dist/esm/v3/components/or-color-picker/OrColorPicker.vue.d.ts +31 -13
- package/dist/esm/v3/components/or-combined-input-v3/OrCombinedInput.vue.d.ts +30 -8
- package/dist/esm/v3/components/or-confirm/OrConfirm.vue.d.ts +84 -23
- package/dist/esm/v3/components/or-confirm-v3/OrConfirm.vue.d.ts +91 -29
- package/dist/esm/v3/components/or-date-picker-v3/OrDatePicker.vue.d.ts +81 -25
- package/dist/esm/v3/components/or-date-time-picker/OrDateTimePicker.vue.d.ts +177 -68
- package/dist/esm/v3/components/or-date-time-picker/partials/OrDateTimePickerCalendarItem.vue.d.ts +33 -12
- package/dist/esm/v3/components/or-date-time-picker-v3/OrDateTimePicker.vue.d.ts +105 -31
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-date-control/OrDateTimePickerDateControl.vue.d.ts +28 -11
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-date-select/OrDateTimePickerDateSelect.vue.d.ts +39 -17
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-mobile-control/OrDateTimePickerMobileControl.vue.d.ts +15 -7
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-month-select/OrDateTimePickerMonthSelect.vue.d.ts +85 -23
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-popover-footer/OrDateTimePickerPopoverFooter.vue.d.ts +11 -7
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-popover-header/OrDateTimePickerPopoverHeader.vue.d.ts +7 -4
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-time-control/OrDateTimePickerTimeControl.vue.d.ts +28 -11
- package/dist/esm/v3/components/or-date-time-picker-v3/partials/or-date-time-picker-time-select/OrDateTimePickerTimeSelect.vue.d.ts +37 -15
- package/dist/esm/v3/components/or-empty-state-v3/OrEmptyState.vue.d.ts +28 -11
- package/dist/esm/v3/components/or-error/OrError.vue.d.ts +8 -4
- package/dist/esm/v3/components/or-error-tag-v3/OrErrorTag.vue.d.ts +7 -4
- package/dist/esm/v3/components/or-error-v3/OrError.vue.d.ts +18 -9
- package/dist/esm/v3/components/or-expansion-panel-v3/OrExpansionPanel.vue.d.ts +35 -14
- package/dist/esm/v3/components/or-fab-v3/OrFab.vue.d.ts +20 -8
- package/dist/esm/v3/components/or-floating/OrFloating.vue.d.ts +46 -15
- package/dist/esm/v3/components/or-form-group-v3/OrFormGroup.vue.d.ts +30 -10
- package/dist/esm/v3/components/or-hint/OrHint.vue.d.ts +8 -4
- package/dist/esm/v3/components/or-hint-v3/OrHint.vue.d.ts +18 -9
- package/dist/esm/v3/components/or-icon/OrIcon.vue.d.ts +44 -16
- package/dist/esm/v3/components/or-icon-button-v2/OrIconButton.vue.d.ts +43 -13
- package/dist/esm/v3/components/or-icon-button-v2/partials/OrTooltipWrapper.vue.d.ts +10 -8
- package/dist/esm/v3/components/or-icon-button-v3/OrIconButton.vue.d.ts +52 -16
- package/dist/esm/v3/components/or-icon-v3/OrIcon.vue.d.ts +18 -7
- package/dist/esm/v3/components/or-inline-input-box-v3/OrInlineInputBox.vue.d.ts +16 -7
- package/dist/esm/v3/components/or-inline-input-v3/OrInlineInput.vue.d.ts +83 -39
- package/dist/esm/v3/components/or-inline-text-edit/OrInlineTextEdit.vue.d.ts +95 -43
- package/dist/esm/v3/components/or-inline-textarea-v3/OrInlineTextarea.vue.d.ts +79 -39
- package/dist/esm/v3/components/or-input/OrInput.vue.d.ts +87 -36
- package/dist/esm/v3/components/or-input-box-v3/OrInputBox.vue.d.ts +22 -7
- package/dist/esm/v3/components/or-input-v3/OrInput.vue.d.ts +85 -34
- package/dist/esm/v3/components/or-label/OrLabel.vue.d.ts +20 -9
- package/dist/esm/v3/components/or-label-v3/OrLabel.vue.d.ts +24 -9
- package/dist/esm/v3/components/or-link-v3/OrLink.vue.d.ts +24 -7
- package/dist/esm/v3/components/or-list/OrList.vue.d.ts +47 -21
- package/dist/esm/v3/components/or-list-of-inputs/OrListOfInputs.vue.d.ts +27 -11
- package/dist/esm/v3/components/or-loader/OrLoader.vue.d.ts +26 -10
- package/dist/esm/v3/components/or-loader-v3/OrLoader.vue.d.ts +34 -13
- package/dist/esm/v3/components/or-menu-item-v3/OrMenuItem.vue.d.ts +34 -13
- package/dist/esm/v3/components/or-menu-v3/OrMenu.vue.d.ts +43 -16
- package/dist/esm/v3/components/or-modal/OrModal.vue.d.ts +38 -14
- package/dist/esm/v3/components/or-modal-v3/OrModal.vue.d.ts +31 -15
- package/dist/esm/v3/components/or-notification/OrNotification.vue.d.ts +27 -9
- package/dist/esm/v3/components/or-notification-v3/OrNotification.vue.d.ts +20 -9
- package/dist/esm/v3/components/or-number-input/OrNumberInput.vue.d.ts +70 -24
- package/dist/esm/v3/components/or-overflow-menu/OrOverflowMenu.vue.d.ts +31 -13
- package/dist/esm/v3/components/or-overflow-menu/partials/OrOverflowMenuItem.vue.d.ts +23 -7
- package/dist/esm/v3/components/or-overlay/OrOverlay.vue.d.ts +16 -6
- package/dist/esm/v3/components/or-overlay-v3/OrOverlay.vue.d.ts +14 -7
- package/dist/esm/v3/components/or-pagination-v3/OrPagination.vue.d.ts +75 -27
- package/dist/esm/v3/components/or-password/OrPassword.vue.d.ts +63 -22
- package/dist/esm/v3/components/or-popover-v3/OrPopover.vue.d.ts +76 -28
- package/dist/esm/v3/components/or-progress/OrProgress.vue.d.ts +56 -20
- package/dist/esm/v3/components/or-progress-v3/OrProgress.vue.d.ts +62 -25
- package/dist/esm/v3/components/or-radio/OrRadio.vue.d.ts +35 -13
- package/dist/esm/v3/components/or-radio-group/OrRadioGroup.vue.d.ts +26 -9
- package/dist/esm/v3/components/or-radio-group-v3/OrRadioGroup.vue.d.ts +32 -6
- package/dist/esm/v3/components/or-radio-v3/OrRadio.vue.d.ts +49 -21
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +220 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +57 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/props.d.ts +4 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +6 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +27 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +7 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/theme.d.ts +24 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +3 -0
- package/dist/esm/v3/components/or-search/OrSearch.vue.d.ts +65 -23
- package/dist/esm/v3/components/or-search-v3/OrSearch.vue.d.ts +41 -17
- package/dist/esm/v3/components/or-segmented-control-v3/OrSegmentedControl.vue.d.ts +25 -9
- package/dist/esm/v3/components/or-segmented-control-v3/partials/or-segmented-control-item/OrSegmentedControlItem.vue.d.ts +20 -8
- package/dist/esm/v3/components/or-select/OrSelect.vue.d.ts +77 -28
- package/dist/esm/v3/components/or-select/partials/OrSelectContent.vue.d.ts +49 -18
- package/dist/esm/v3/components/or-select/partials/OrSelectContentEmpty.vue.d.ts +16 -4
- package/dist/esm/v3/components/or-select/partials/OrSelectContentOptions.vue.d.ts +67 -13
- package/dist/esm/v3/components/or-select/partials/OrSelectInput.vue.d.ts +41 -16
- package/dist/esm/v3/components/or-select/partials/OrSelectInputValue.vue.d.ts +35 -16
- package/dist/esm/v3/components/or-select/partials/OrSelectMain.vue.d.ts +71 -24
- package/dist/esm/v3/components/or-select/partials/OrSelectOption.vue.d.ts +19 -7
- package/dist/esm/v3/components/or-select/partials/OrSelectSearchOptions.vue.d.ts +24 -11
- package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +115 -37
- package/dist/esm/v3/components/or-sidebar/OrSidebar.vue.d.ts +33 -14
- package/dist/esm/v3/components/or-sidebar-v3/OrSidebar.vue.d.ts +63 -28
- package/dist/esm/v3/components/or-sidebar-v3/partials/or-sidebar-collapse-button/OrSidebarCollapseButton.vue.d.ts +23 -10
- package/dist/esm/v3/components/or-skeleton/or-skeleton-circle/OrSkeletonCircle.vue.d.ts +20 -9
- package/dist/esm/v3/components/or-skeleton/or-skeleton-rect/OrSkeletonRect.vue.d.ts +22 -9
- package/dist/esm/v3/components/or-skeleton/or-skeleton-text/OrSkeletonText.vue.d.ts +26 -10
- package/dist/esm/v3/components/or-skeleton-v3/or-skeleton-circle-v3/OrSkeletonCircle.vue.d.ts +28 -13
- package/dist/esm/v3/components/or-skeleton-v3/or-skeleton-rect-v3/OrSkeletonRect.vue.d.ts +26 -11
- package/dist/esm/v3/components/or-skeleton-v3/or-skeleton-text-v3/OrSkeletonText.vue.d.ts +40 -16
- package/dist/esm/v3/components/or-slider/OrSlider.vue.d.ts +91 -35
- package/dist/esm/v3/components/or-sort-header-v3/OrSortHeader.vue.d.ts +25 -13
- package/dist/esm/v3/components/or-stepper/OrStepper.vue.d.ts +43 -16
- package/dist/esm/v3/components/or-stepper/partials/OrStepperButtonOptions.vue.d.ts +20 -4
- package/dist/esm/v3/components/or-stepper/partials/OrStepperOptionHorizontal.vue.d.ts +26 -4
- package/dist/esm/v3/components/or-stepper/partials/OrStepperOptionVertical.vue.d.ts +26 -4
- package/dist/esm/v3/components/or-stepper/partials/OrStepperTitle.vue.d.ts +22 -6
- package/dist/esm/v3/components/or-stepper/partials/StatusIcon.vue.d.ts +12 -6
- package/dist/esm/v3/components/or-switch/OrSwitch.vue.d.ts +33 -12
- package/dist/esm/v3/components/or-switch-v3/OrSwitch.vue.d.ts +53 -22
- package/dist/esm/v3/components/or-tab/OrTab.vue.d.ts +22 -9
- package/dist/esm/v3/components/or-tab-header-item/OrTabHeaderItem.vue.d.ts +29 -13
- package/dist/esm/v3/components/or-tab-v3/OrTab.vue.d.ts +17 -10
- package/dist/esm/v3/components/or-tabs/OrTabs.vue.d.ts +17 -4
- package/dist/esm/v3/components/or-tabs-v3/OrTabs.vue.d.ts +71 -25
- package/dist/esm/v3/components/or-tag/OrTag.vue.d.ts +27 -10
- package/dist/esm/v3/components/or-tag-v3/OrTag.vue.d.ts +23 -12
- package/dist/esm/v3/components/or-tags-v3/OrTags.vue.d.ts +63 -19
- package/dist/esm/v3/components/or-teleport/OrTeleport.vue3.vue.d.ts +10 -4
- package/dist/esm/v3/components/or-teleport-v3/OrTeleport.vue3.vue.d.ts +10 -4
- package/dist/esm/v3/components/or-text-v3/OrText.vue.d.ts +24 -11
- package/dist/esm/v3/components/or-textarea/OrTextarea.vue.d.ts +85 -37
- package/dist/esm/v3/components/or-textarea-v3/OrTextarea.vue.d.ts +73 -32
- package/dist/esm/v3/components/or-textbox/OrTextbox.vue.d.ts +137 -55
- package/dist/esm/v3/components/or-time-picker-v3/OrTimePicker.vue.d.ts +79 -25
- package/dist/esm/v3/components/or-toast/OrToast.vue.d.ts +31 -11
- package/dist/esm/v3/components/or-toast/or-toast-container/OrToastContainer.vue.d.ts +55 -25
- package/dist/esm/v3/components/or-toast-v3/OrToast.vue.d.ts +38 -16
- package/dist/esm/v3/components/or-toast-v3/or-toast-container-v3/OrToastContainer.vue.d.ts +54 -24
- package/dist/esm/v3/components/or-tooltip/OrTooltip.vue.d.ts +33 -14
- package/dist/esm/v3/components/or-tooltip/or-tooltip-content/OrTooltipContent.vue.d.ts +10 -4
- package/dist/esm/v3/components/or-tooltip-v3/OrTooltip.vue.d.ts +37 -13
- package/dist/esm/v3/directives/dropdown-close.d.ts +1 -3
- package/dist/esm/v3/directives/dropdown-open.d.ts +1 -3
- package/dist/esm/v3/hooks/useResponsive/useResponsive.d.ts +2 -2
- package/dist/esm/v3/index.js +24 -0
- package/package.json +24 -4
- package/src/components/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +766 -0
- package/src/components/or-rich-text-editor-v3/index.ts +2 -0
- package/src/components/or-rich-text-editor-v3/props.ts +4 -0
- package/src/components/or-rich-text-editor-v3/styles.ts +54 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +40 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +254 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/theme.ts +213 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +22 -0
- package/src/components/or-rich-text-editor-v3/utils/markdown.ts +120 -0
- /package/dist/bundled/v2/{index-968c331a.js → index-f6664cb1.js} +0 -0
- /package/dist/bundled/v3/{index-968c331a.js → index-f6664cb1.js} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export const EditorContainer: string[] = [
|
|
2
|
+
// Colors
|
|
3
|
+
'border-outline',
|
|
4
|
+
'focus-within:theme-border-1-primary',
|
|
5
|
+
'focus-within:bg-primary-opacity-0-08',
|
|
6
|
+
'focus-within:theme-outline-primary',
|
|
7
|
+
|
|
8
|
+
// Sizing
|
|
9
|
+
'border-1',
|
|
10
|
+
'rounded-md',
|
|
11
|
+
'w-full',
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export const ToolbarContainer: string[] = [
|
|
15
|
+
// Layout
|
|
16
|
+
'flex',
|
|
17
|
+
//Spacing
|
|
18
|
+
'py-sm',
|
|
19
|
+
//Sizing
|
|
20
|
+
'border-b-1',
|
|
21
|
+
//Colors
|
|
22
|
+
'border-b-outline',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export const Toolbar: string[] = [
|
|
26
|
+
// Layout
|
|
27
|
+
'flex',
|
|
28
|
+
// Spacing
|
|
29
|
+
'px-sm',
|
|
30
|
+
'gap-md',
|
|
31
|
+
// Sizing
|
|
32
|
+
'border-l-1',
|
|
33
|
+
//Colors
|
|
34
|
+
'border-r-disabled',
|
|
35
|
+
// Last child
|
|
36
|
+
'first-of-type:border-none',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
export const ToolbarButton: string[] = [
|
|
40
|
+
// Typography
|
|
41
|
+
'text-on-disabled',
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export const ToolbarButtonFocused: string[] = [
|
|
45
|
+
// Typography
|
|
46
|
+
'text-outline',
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
export const EditorInput: string[] = [
|
|
50
|
+
// Typography
|
|
51
|
+
'typography-body-2-regular',
|
|
52
|
+
// Sizing
|
|
53
|
+
'min-h-[88px]',
|
|
54
|
+
];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import CodeBlockView from './codemirrorView';
|
|
3
|
+
import { minimalSetup } from 'codemirror';
|
|
4
|
+
import { javascript } from '@codemirror/lang-javascript';
|
|
5
|
+
|
|
6
|
+
export default Node.create({
|
|
7
|
+
name: 'codeBlock',
|
|
8
|
+
content: 'text*',
|
|
9
|
+
marks: '',
|
|
10
|
+
group: 'block',
|
|
11
|
+
code: true,
|
|
12
|
+
defining: true,
|
|
13
|
+
isolating: true,
|
|
14
|
+
|
|
15
|
+
parseHTML() {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
tag: 'pre',
|
|
19
|
+
preserveWhitespace: 'full',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
renderHTML() {
|
|
25
|
+
return ['pre', ['code', 0]];
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
addNodeView() {
|
|
29
|
+
return ({ node, editor, getPos }) => {
|
|
30
|
+
return new CodeBlockView({
|
|
31
|
+
node,
|
|
32
|
+
view: editor.view,
|
|
33
|
+
getPos: getPos as () => number,
|
|
34
|
+
cmOptions: {
|
|
35
|
+
extensions: [minimalSetup, javascript()],
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { Selection, TextSelection } from 'prosemirror-state';
|
|
2
|
+
import { EditorView, NodeView } from 'prosemirror-view';
|
|
3
|
+
import { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
4
|
+
import { exitCode } from 'prosemirror-commands';
|
|
5
|
+
import { EditorState as CMState, Transaction as CMTransaction } from '@codemirror/state';
|
|
6
|
+
import {
|
|
7
|
+
Command,
|
|
8
|
+
EditorView as CMView,
|
|
9
|
+
keymap,
|
|
10
|
+
highlightActiveLine,
|
|
11
|
+
highlightActiveLineGutter,
|
|
12
|
+
lineNumbers,
|
|
13
|
+
} from '@codemirror/view';
|
|
14
|
+
import orCodeTheme from './theme';
|
|
15
|
+
|
|
16
|
+
import { ComputeChange, CodeMirrorViewOptions } from './types';
|
|
17
|
+
|
|
18
|
+
const computeChange = (oldVal: string, newVal: string): ComputeChange | null => {
|
|
19
|
+
if (oldVal === newVal) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let start = 0;
|
|
24
|
+
let oldEnd = oldVal.length;
|
|
25
|
+
let newEnd = newVal.length;
|
|
26
|
+
|
|
27
|
+
while (start < oldEnd && oldVal.charCodeAt(start) === newVal.charCodeAt(start)) {
|
|
28
|
+
start += 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
while (oldEnd > start && newEnd > start && oldVal.charCodeAt(oldEnd - 1) === newVal.charCodeAt(newEnd - 1)) {
|
|
32
|
+
oldEnd -= 1;
|
|
33
|
+
newEnd -= 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
from: start,
|
|
38
|
+
to: oldEnd,
|
|
39
|
+
text: newVal.slice(start, newEnd),
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
class CodeMirrorView implements NodeView {
|
|
44
|
+
name: string;
|
|
45
|
+
|
|
46
|
+
node: ProsemirrorNode;
|
|
47
|
+
|
|
48
|
+
view: EditorView;
|
|
49
|
+
|
|
50
|
+
dom: HTMLElement;
|
|
51
|
+
|
|
52
|
+
cm: CMView;
|
|
53
|
+
|
|
54
|
+
getPos: () => number;
|
|
55
|
+
|
|
56
|
+
updating = false;
|
|
57
|
+
|
|
58
|
+
constructor(options: CodeMirrorViewOptions) {
|
|
59
|
+
// Store for later
|
|
60
|
+
this.node = options.node;
|
|
61
|
+
this.view = options.view;
|
|
62
|
+
const cmExtensions = options.cmOptions?.extensions || [];
|
|
63
|
+
this.name = 'codeBlock',
|
|
64
|
+
|
|
65
|
+
this.getPos = options.getPos as () => number;
|
|
66
|
+
|
|
67
|
+
const changeFilter = CMState.changeFilter.of((tr) => {
|
|
68
|
+
if (!tr.docChanged && !this.updating) {
|
|
69
|
+
this.forwardSelection();
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Create a CodeMirror instancew
|
|
75
|
+
this.cm = new CMView({
|
|
76
|
+
dispatch: this.dispatch.bind(this),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// The editor's outer node is our DOM representation
|
|
80
|
+
this.dom = this.cm.dom;
|
|
81
|
+
|
|
82
|
+
const cmState = CMState.create({
|
|
83
|
+
doc: this.node.textContent,
|
|
84
|
+
extensions: [
|
|
85
|
+
orCodeTheme,
|
|
86
|
+
changeFilter,
|
|
87
|
+
highlightActiveLine(),
|
|
88
|
+
highlightActiveLineGutter(),
|
|
89
|
+
lineNumbers(),
|
|
90
|
+
keymap.of([
|
|
91
|
+
{
|
|
92
|
+
key: 'ArrowUp',
|
|
93
|
+
run: this.mayBeEscape('line', -1),
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
key: 'ArrowLeft',
|
|
97
|
+
run: this.mayBeEscape('char', -1),
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
key: 'ArrowDown',
|
|
101
|
+
run: this.mayBeEscape('line', 1),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
key: 'ArrowRight',
|
|
105
|
+
run: this.mayBeEscape('char', 1),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: 'Ctrl-Enter',
|
|
109
|
+
run: () => {
|
|
110
|
+
if (exitCode(this.view.state, this.view.dispatch)) {
|
|
111
|
+
this.view.focus();
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
]),
|
|
118
|
+
cmExtensions,
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
this.cm.setState(cmState);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
forwardSelection() {
|
|
126
|
+
if (!this.cm.hasFocus) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const { state } = this.view;
|
|
131
|
+
const selection = this.asProseMirrorSelection(state.doc);
|
|
132
|
+
|
|
133
|
+
if (!selection.eq(state.selection)) {
|
|
134
|
+
this.view.dispatch(state.tr.setSelection(selection));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
asProseMirrorSelection(doc: ProsemirrorNode) {
|
|
139
|
+
const offset = this.getPos() + 1;
|
|
140
|
+
const { anchor, head } = this.cm.state.selection.main;
|
|
141
|
+
return TextSelection.create(doc, anchor + offset, head + offset);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
dispatch(cmTr: CMTransaction) {
|
|
145
|
+
this.cm.setState(cmTr.state);
|
|
146
|
+
|
|
147
|
+
if (cmTr.docChanged && !this.updating) {
|
|
148
|
+
const start = this.getPos() + 1;
|
|
149
|
+
|
|
150
|
+
const cmValue = cmTr.state.doc.toString();
|
|
151
|
+
const change = computeChange(this.node.textContent, cmValue);
|
|
152
|
+
|
|
153
|
+
if (!change) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const content = change.text ? this.view.state.schema.text(change.text) : null;
|
|
158
|
+
|
|
159
|
+
const tr = this.view.state.tr.replaceWith(change.from + start, change.to + start, content as ProsemirrorNode);
|
|
160
|
+
this.view.dispatch(tr);
|
|
161
|
+
this.forwardSelection();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
mayBeEscape(unit: 'char' | 'line', dir: -1 | 1): Command {
|
|
166
|
+
return (view) => {
|
|
167
|
+
const { state } = view;
|
|
168
|
+
const { selection } = state;
|
|
169
|
+
|
|
170
|
+
const offsetToPos = () => {
|
|
171
|
+
const offset = selection.main.from;
|
|
172
|
+
const line = state.doc.lineAt(offset);
|
|
173
|
+
return {
|
|
174
|
+
line: line.number,
|
|
175
|
+
ch: offset - line.from,
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const pos = offsetToPos();
|
|
180
|
+
const hasSelection = state.selection.ranges.some((r) => !r.empty);
|
|
181
|
+
|
|
182
|
+
const firstLine = 1;
|
|
183
|
+
const lastLine = state.doc.lineAt(state.doc.length).number;
|
|
184
|
+
|
|
185
|
+
if (
|
|
186
|
+
hasSelection
|
|
187
|
+
|| pos.line !== (dir < 0 ? firstLine : lastLine)
|
|
188
|
+
|| (unit === 'char' && pos.ch !== (dir < 0 ? 0 : state.doc.line(pos.line).length))
|
|
189
|
+
) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const targetPos = this.getPos() + (dir < 0 ? 0 : this.node.nodeSize);
|
|
194
|
+
const pmSelection = Selection.near(this.view.state.doc.resolve(targetPos), dir);
|
|
195
|
+
this.view.dispatch(this.view.state.tr.setSelection(pmSelection).scrollIntoView());
|
|
196
|
+
this.view.focus();
|
|
197
|
+
return true;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
update(node: ProsemirrorNode) {
|
|
202
|
+
if (node.type !== this.node.type) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
this.node = node;
|
|
207
|
+
const change = computeChange(this.cm.state.doc.toString(), node.textContent);
|
|
208
|
+
|
|
209
|
+
if (change) {
|
|
210
|
+
this.updating = true;
|
|
211
|
+
this.cm.dispatch({
|
|
212
|
+
changes: {
|
|
213
|
+
from: change.from,
|
|
214
|
+
to: change.to,
|
|
215
|
+
insert: change.text,
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
this.updating = false;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
setSelection(anchor: number, head: number): void {
|
|
225
|
+
this.focus();
|
|
226
|
+
this.updating = true;
|
|
227
|
+
this.cm.dispatch({
|
|
228
|
+
selection: {
|
|
229
|
+
anchor,
|
|
230
|
+
head,
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
this.updating = false;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
focus() {
|
|
237
|
+
this.cm.focus();
|
|
238
|
+
this.forwardSelection();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
selectNode() {
|
|
242
|
+
this.focus();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
stopEvent() {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
destroy() {
|
|
250
|
+
this.cm.destroy();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export default CodeMirrorView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CodeMirrorView } from './codemirrorView';
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { EditorView } from '@codemirror/view';
|
|
2
|
+
import { Extension } from '@codemirror/state';
|
|
3
|
+
import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
4
|
+
import { tags as t } from '@lezer/highlight';
|
|
5
|
+
|
|
6
|
+
// Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
|
|
7
|
+
|
|
8
|
+
const chalky = 'var(--c-warning-darken-20)',
|
|
9
|
+
coral = 'var(--c-error)',
|
|
10
|
+
cyan = '#56b6c2',
|
|
11
|
+
invalid = 'var(--c-white)',
|
|
12
|
+
ivory = 'var(--c-neutral-6)',
|
|
13
|
+
stone = 'var(--c-neutral-5)', // Brightened compared to original to increase contrast
|
|
14
|
+
malibu = '#61afef',
|
|
15
|
+
sage = 'var(--c-success)',
|
|
16
|
+
whiskey = 'var(--c-warning-darken-5)',
|
|
17
|
+
violet = '#c678dd',
|
|
18
|
+
darkBackground = 'var(--c-neutral-1)',
|
|
19
|
+
highlightBackground = 'var(--c-neutral-2)',
|
|
20
|
+
background = 'var(--c-neutral-1)',
|
|
21
|
+
tooltipBackground = 'var(--c-neutral-2)',
|
|
22
|
+
selection = 'var(--c-neutral-3)',
|
|
23
|
+
cursor = 'var(--c-primary)';
|
|
24
|
+
|
|
25
|
+
/// The colors used in the theme, as CSS color strings.
|
|
26
|
+
export const color = {
|
|
27
|
+
chalky,
|
|
28
|
+
coral,
|
|
29
|
+
cyan,
|
|
30
|
+
invalid,
|
|
31
|
+
ivory,
|
|
32
|
+
stone,
|
|
33
|
+
malibu,
|
|
34
|
+
sage,
|
|
35
|
+
whiskey,
|
|
36
|
+
violet,
|
|
37
|
+
darkBackground,
|
|
38
|
+
highlightBackground,
|
|
39
|
+
background,
|
|
40
|
+
tooltipBackground,
|
|
41
|
+
selection,
|
|
42
|
+
cursor,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/// The editor theme styles for One Dark.
|
|
46
|
+
export const orCodeTheme = EditorView.theme({
|
|
47
|
+
'&': {
|
|
48
|
+
color: ivory,
|
|
49
|
+
backgroundColor: background,
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
'.cm-content': {
|
|
53
|
+
caretColor: cursor,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
'.cm-button': {
|
|
57
|
+
background: highlightBackground,
|
|
58
|
+
color: 'var(--c-neutral-6)',
|
|
59
|
+
border: 0,
|
|
60
|
+
borderRadius: 'var(--s-2)',
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
'.cm-panel.cm-search input[type=checkbox]': {
|
|
64
|
+
display: 'inline-block',
|
|
65
|
+
verticalAlign: 'middle',
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
'.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },
|
|
69
|
+
'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
|
|
70
|
+
backgroundColor: selection,
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
'.cm-panels': {
|
|
74
|
+
backgroundColor: darkBackground,
|
|
75
|
+
color: ivory,
|
|
76
|
+
},
|
|
77
|
+
'.cm-panels.cm-panels-top': { borderBottom: '2px solid var(--c-neutral-2)' },
|
|
78
|
+
'.cm-panels.cm-panels-bottom': { borderTop: '2px solid var(--c-neutral-2)' },
|
|
79
|
+
|
|
80
|
+
'.cm-searchMatch': {
|
|
81
|
+
backgroundColor: 'var(--c-neutral-1)',
|
|
82
|
+
outline: '1px solid var(--c-neutral-2)',
|
|
83
|
+
},
|
|
84
|
+
'.cm-searchMatch.cm-searchMatch-selected': {
|
|
85
|
+
backgroundColor: '#6199ff2f',
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
'.cm-activeLine': { backgroundColor: '#6699ff0b' },
|
|
89
|
+
'.cm-selectionMatch': { backgroundColor: '#aafe661a' },
|
|
90
|
+
|
|
91
|
+
'&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
|
|
92
|
+
backgroundColor: '#bad0f847',
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
'.cm-gutters': {
|
|
96
|
+
backgroundColor: background,
|
|
97
|
+
color: stone,
|
|
98
|
+
border: 'none',
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
'.cm-activeLineGutter': {
|
|
102
|
+
backgroundColor: highlightBackground,
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
'.cm-foldPlaceholder': {
|
|
106
|
+
backgroundColor: 'transparent',
|
|
107
|
+
border: 'none',
|
|
108
|
+
color: '#ddd',
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
'.cm-tooltip': {
|
|
112
|
+
border: 'none',
|
|
113
|
+
backgroundColor: tooltipBackground,
|
|
114
|
+
},
|
|
115
|
+
'.cm-tooltip .cm-tooltip-arrow:before': {
|
|
116
|
+
borderTopColor: 'transparent',
|
|
117
|
+
borderBottomColor: 'transparent',
|
|
118
|
+
},
|
|
119
|
+
'.cm-tooltip .cm-tooltip-arrow:after': {
|
|
120
|
+
borderTopColor: tooltipBackground,
|
|
121
|
+
borderBottomColor: tooltipBackground,
|
|
122
|
+
},
|
|
123
|
+
'.cm-tooltip-autocomplete': {
|
|
124
|
+
'& > ul > li[aria-selected]': {
|
|
125
|
+
backgroundColor: highlightBackground,
|
|
126
|
+
color: ivory,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
'.cm-textfield': {
|
|
130
|
+
outline: 'none',
|
|
131
|
+
background: background,
|
|
132
|
+
color: 'var(--c-neutral-6)',
|
|
133
|
+
backgroundColor: 'var(--c-neutral-1)',
|
|
134
|
+
border: '1px solid var(--c-neutral-2)',
|
|
135
|
+
borderRadius: 'var(--s-2)',
|
|
136
|
+
},
|
|
137
|
+
}, { dark: true });
|
|
138
|
+
|
|
139
|
+
/// The highlighting style for code in the One Dark theme.
|
|
140
|
+
export const orCodeHighlightStyle = HighlightStyle.define([
|
|
141
|
+
{
|
|
142
|
+
tag: t.keyword,
|
|
143
|
+
color: violet,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],
|
|
147
|
+
color: coral,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
tag: [t.function(t.variableName), t.labelName],
|
|
151
|
+
color: malibu,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
tag: [t.color, t.constant(t.name), t.standard(t.name)],
|
|
155
|
+
color: whiskey,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
tag: [t.definition(t.name), t.separator],
|
|
159
|
+
color: ivory,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
tag: [t.typeName, t.className, t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
|
|
163
|
+
color: chalky,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
tag: [t.operator, t.operatorKeyword, t.url, t.escape, t.regexp, t.link, t.special(t.string)],
|
|
167
|
+
color: cyan,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
tag: [t.meta, t.comment],
|
|
171
|
+
color: stone,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
tag: t.strong,
|
|
175
|
+
fontWeight: 'bold',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
tag: t.emphasis,
|
|
179
|
+
fontStyle: 'italic',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
tag: t.strikethrough,
|
|
183
|
+
textDecoration: 'line-through',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
tag: t.link,
|
|
187
|
+
color: stone,
|
|
188
|
+
textDecoration: 'underline',
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
tag: t.heading,
|
|
192
|
+
fontWeight: 'bold',
|
|
193
|
+
color: coral,
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
tag: [t.atom, t.bool, t.special(t.variableName)],
|
|
197
|
+
color: whiskey,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
tag: [t.processingInstruction, t.string, t.inserted],
|
|
201
|
+
color: sage,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
tag: t.invalid,
|
|
205
|
+
color: invalid,
|
|
206
|
+
},
|
|
207
|
+
]);
|
|
208
|
+
|
|
209
|
+
/// Extension to enable the One Dark theme (both the editor theme and
|
|
210
|
+
/// the highlight style).
|
|
211
|
+
const theme: Extension = [orCodeTheme, syntaxHighlighting(orCodeHighlightStyle)];
|
|
212
|
+
|
|
213
|
+
export default theme;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EditorView } from 'prosemirror-view';
|
|
2
|
+
import type { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
3
|
+
import type { Extension } from '@codemirror/state';
|
|
4
|
+
|
|
5
|
+
export interface ComputeChange {
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface CMOptions {
|
|
12
|
+
extensions: Extension;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type GetPos = () => number | undefined;
|
|
16
|
+
|
|
17
|
+
export interface CodeMirrorViewOptions {
|
|
18
|
+
node: ProsemirrorNode;
|
|
19
|
+
view: EditorView;
|
|
20
|
+
getPos: GetPos;
|
|
21
|
+
cmOptions?: CMOptions;
|
|
22
|
+
}
|