@servicetitan/anvil2 3.5.0 → 3.6.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/CHANGELOG.md +20 -0
- package/dist/{AiMark-D3nw58ho.js → AiMark-voHPSerQ.js} +26 -11
- package/dist/{AiMark-D3nw58ho.js.map → AiMark-voHPSerQ.js.map} +1 -1
- package/dist/AiMark.js +1 -1
- package/dist/{Alert-CSV4hRBD.js → Alert-CPe0yh6A.js} +3 -3
- package/dist/{Alert-CSV4hRBD.js.map → Alert-CPe0yh6A.js.map} +1 -1
- package/dist/Alert.js +1 -1
- package/dist/{Announcement-4w6XjLcB.js → Announcement-DU0J4111.js} +3 -3
- package/dist/{Announcement-4w6XjLcB.js.map → Announcement-DU0J4111.js.map} +1 -1
- package/dist/Announcement.js +1 -1
- package/dist/{Breadcrumbs-BkZVA_ux.js → Breadcrumbs-VzOM2nBU.js} +4 -4
- package/dist/{Breadcrumbs-BkZVA_ux.js.map → Breadcrumbs-VzOM2nBU.js.map} +1 -1
- package/dist/Breadcrumbs.js +1 -1
- package/dist/{Button-CjeF1Agb.js → Button-BNzCI47m.js} +2 -2
- package/dist/{Button-CjeF1Agb.js.map → Button-BNzCI47m.js.map} +1 -1
- package/dist/Button.js +1 -1
- package/dist/{ButtonLink-BSReBbc3.js → ButtonLink-PlW08u41.js} +2 -2
- package/dist/{ButtonLink-BSReBbc3.js.map → ButtonLink-PlW08u41.js.map} +1 -1
- package/dist/ButtonLink.js +1 -1
- package/dist/{ButtonToggle-CnOsM7-u.js → ButtonToggle-DBGc7dIn.js} +2 -2
- package/dist/{ButtonToggle-CnOsM7-u.js.map → ButtonToggle-DBGc7dIn.js.map} +1 -1
- package/dist/ButtonToggle.js +1 -1
- package/dist/{Calendar-Cw2UKiof.js → Calendar-CekTYzdT.js} +3 -3
- package/dist/{Calendar-Cw2UKiof.js.map → Calendar-CekTYzdT.js.map} +1 -1
- package/dist/{Calendar-CJaZFWmO.js → Calendar-MRUB0XU7.js} +2 -2
- package/dist/Calendar-MRUB0XU7.js.map +1 -0
- package/dist/Calendar.js +2 -2
- package/dist/{Checkbox-7KubQWJc.js → Checkbox-C3rtd-Xe.js} +4 -4
- package/dist/{Checkbox-7KubQWJc.js.map → Checkbox-C3rtd-Xe.js.map} +1 -1
- package/dist/{Checkbox-Bq2EfltF.js → Checkbox-zz9TyZWn.js} +2 -2
- package/dist/{Checkbox-Bq2EfltF.js.map → Checkbox-zz9TyZWn.js.map} +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/{Chip-yyEbwLdG.js → Chip-CxgryK86.js} +3 -3
- package/dist/{Chip-yyEbwLdG.js.map → Chip-CxgryK86.js.map} +1 -1
- package/dist/Chip.js +1 -1
- package/dist/Combobox.js +1 -1
- package/dist/{DataTable-BgD9Sh-7.js → DataTable-BpqLvU92.js} +11 -9
- package/dist/{DataTable-BgD9Sh-7.js.map → DataTable-BpqLvU92.js.map} +1 -1
- package/dist/{DateFieldRange-OlkU5oeu.js → DateFieldRange-CP7QgS6P.js} +5 -5
- package/dist/{DateFieldRange-OlkU5oeu.js.map → DateFieldRange-CP7QgS6P.js.map} +1 -1
- package/dist/DateFieldRange.js +1 -1
- package/dist/{DateFieldSingle-BGGlLAID.js → DateFieldSingle-CgMPTi1v.js} +5 -5
- package/dist/{DateFieldSingle-BGGlLAID.js.map → DateFieldSingle-CgMPTi1v.js.map} +1 -1
- package/dist/DateFieldSingle.js +1 -1
- package/dist/{DateFieldYearless-X9_F3VFM.js → DateFieldYearless-DYjvqxRb.js} +4 -4
- package/dist/{DateFieldYearless-X9_F3VFM.js.map → DateFieldYearless-DYjvqxRb.js.map} +1 -1
- package/dist/DateFieldYearless.js +1 -1
- package/dist/{DateFieldYearlessRange-CWdTbFDF.js → DateFieldYearlessRange-lQdJGOaS.js} +4 -4
- package/dist/DateFieldYearlessRange-lQdJGOaS.js.map +1 -0
- package/dist/DateFieldYearlessRange.js +1 -1
- package/dist/{DaysOfTheWeek-DfNYEwbg.js → DaysOfTheWeek-Ci-SKebP.js} +3 -3
- package/dist/{DaysOfTheWeek-DfNYEwbg.js.map → DaysOfTheWeek-Ci-SKebP.js.map} +1 -1
- package/dist/DaysOfTheWeek.js +1 -1
- package/dist/{Details-Xb49PJ-r.js → Details-DkteVZbk.js} +2 -2
- package/dist/{Details-Xb49PJ-r.js.map → Details-DkteVZbk.js.map} +1 -1
- package/dist/Details.js +1 -1
- package/dist/{Dialog-BpS3KScw.js → Dialog-BxulNN8n.js} +21 -21
- package/dist/{Dialog-BpS3KScw.js.map → Dialog-BxulNN8n.js.map} +1 -1
- package/dist/Dialog.css +32 -31
- package/dist/Dialog.js +1 -1
- package/dist/{DialogCancelButton-CIGGMaOE.js → DialogCancelButton-DmSUPuCR.js} +2 -2
- package/dist/{DialogCancelButton-CIGGMaOE.js.map → DialogCancelButton-DmSUPuCR.js.map} +1 -1
- package/dist/Dnd.js +2 -2
- package/dist/{DndHandleButton-B_Geiaeb.js → DndHandleButton-Ck5nc8w2.js} +2 -2
- package/dist/{DndHandleButton-B_Geiaeb.js.map → DndHandleButton-Ck5nc8w2.js.map} +1 -1
- package/dist/DndSort.js +2 -2
- package/dist/{Drawer-CxVIDCIB.js → Drawer-_spmOgwH.js} +4 -4
- package/dist/{Drawer-CxVIDCIB.js.map → Drawer-_spmOgwH.js.map} +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/DrillDown.js +1 -1
- package/dist/{EditCard-T5mbl573.js → EditCard-ZpF032WP.js} +4 -4
- package/dist/{EditCard-T5mbl573.js.map → EditCard-ZpF032WP.js.map} +1 -1
- package/dist/EditCard.js +1 -1
- package/dist/{FieldLabel-Dfg4wEra.js → FieldLabel-Cm5A1Jcx.js} +3 -3
- package/dist/{FieldLabel-Dfg4wEra.js.map → FieldLabel-Cm5A1Jcx.js.map} +1 -1
- package/dist/FieldLabel.js +1 -1
- package/dist/{FilterBar-CA4MDEF-.js → FilterBar-CvyMubuw.js} +7 -7
- package/dist/{FilterBar-CA4MDEF-.js.map → FilterBar-CvyMubuw.js.map} +1 -1
- package/dist/FilterBar.js +1 -1
- package/dist/Icon-B4uCvMU9.js +107 -0
- package/dist/Icon-B4uCvMU9.js.map +1 -0
- package/dist/Icon.js +1 -1
- package/dist/{InputMask-C8ZAwqFi.js → InputMask-CX6XiOOm.js} +3 -3
- package/dist/{InputMask-C8ZAwqFi.js.map → InputMask-CX6XiOOm.js.map} +1 -1
- package/dist/InputMask.js +1 -1
- package/dist/{Link-DI4eVVdI.js → Link-C7dtI5K6.js} +2 -2
- package/dist/{Link-DI4eVVdI.js.map → Link-C7dtI5K6.js.map} +1 -1
- package/dist/Link.js +1 -1
- package/dist/LinkButton-C0wps8r1.js.map +1 -1
- package/dist/{ListView-BMo04Epa.js → ListView-DpveXOsN.js} +2 -2
- package/dist/{ListView-BMo04Epa.js.map → ListView-DpveXOsN.js.map} +1 -1
- package/dist/ListView.js +1 -1
- package/dist/{Listbox-BQRMsA0L.js → Listbox-Cdwaofd2.js} +21 -21
- package/dist/Listbox-Cdwaofd2.js.map +1 -0
- package/dist/Listbox.js +1 -1
- package/dist/{Menu-BAya9Qnd.js → Menu-DmEXQLXt.js} +3 -3
- package/dist/{Menu-BAya9Qnd.js.map → Menu-DmEXQLXt.js.map} +1 -1
- package/dist/Menu.js +1 -1
- package/dist/{MenuFooter-BZTsAaOz.js → MenuFooter-Ck9L599M.js} +2 -2
- package/dist/{MenuFooter-BZTsAaOz.js.map → MenuFooter-Ck9L599M.js.map} +1 -1
- package/dist/MultiSelectField.js +1 -1
- package/dist/{MultiSelectFieldSync-Cn3tNZcf.js → MultiSelectFieldSync-BHST0FEe.js} +7 -7
- package/dist/{MultiSelectFieldSync-Cn3tNZcf.js.map → MultiSelectFieldSync-BHST0FEe.js.map} +1 -1
- package/dist/MultiSelectMenu.js +1 -1
- package/dist/{MultiSelectMenuSync-FH_hXlIa.js → MultiSelectMenuSync-BaKxbMLu.js} +6 -6
- package/dist/{MultiSelectMenuSync-FH_hXlIa.js.map → MultiSelectMenuSync-BaKxbMLu.js.map} +1 -1
- package/dist/{NumberField-DdaBRyCJ.js → NumberField-CjC6KHKl.js} +5 -5
- package/dist/NumberField-CjC6KHKl.js.map +1 -0
- package/dist/NumberField.js +1 -1
- package/dist/Overflow.js.map +1 -1
- package/dist/{Page-DpUv1L7T.js → Page-BreBQ3pG.js} +11 -11
- package/dist/{Page-DpUv1L7T.js.map → Page-BreBQ3pG.js.map} +1 -1
- package/dist/Page.js +1 -1
- package/dist/{Pagination-Dm10ZvKj.js → Pagination-CmqAut6y.js} +5 -5
- package/dist/{Pagination-Dm10ZvKj.js.map → Pagination-CmqAut6y.js.map} +1 -1
- package/dist/Pagination.js +1 -1
- package/dist/{Popover-C-pv_ah6.js → Popover-CdRuNv3C.js} +2 -2
- package/dist/{Popover-C-pv_ah6.js.map → Popover-CdRuNv3C.js.map} +1 -1
- package/dist/Popover.js +1 -1
- package/dist/{ProgressBar-fwE4FkQt.js → ProgressBar-065vjsQ0.js} +3 -3
- package/dist/{ProgressBar-fwE4FkQt.js.map → ProgressBar-065vjsQ0.js.map} +1 -1
- package/dist/ProgressBar.js +1 -1
- package/dist/{Radio-DUKkDky9.js → Radio-D9w_-JYw.js} +2 -2
- package/dist/{Radio-DUKkDky9.js.map → Radio-D9w_-JYw.js.map} +1 -1
- package/dist/{Radio-BuzABI6-.js → Radio-dyLcVmUw.js} +4 -4
- package/dist/{Radio-BuzABI6-.js.map → Radio-dyLcVmUw.js.map} +1 -1
- package/dist/Radio.js +1 -1
- package/dist/{RichTextEditor-x0anoUnS.js → RichTextEditor-byoMZaJy.js} +14172 -7454
- package/dist/RichTextEditor-byoMZaJy.js.map +1 -0
- package/dist/RichTextEditor.css +42 -40
- package/dist/RichTextEditor.js +1 -1
- package/dist/{SavedFiltersButton-DgP-7upC.js → SavedFiltersButton-DlzfvW03.js} +10 -10
- package/dist/{SavedFiltersButton-DgP-7upC.js.map → SavedFiltersButton-DlzfvW03.js.map} +1 -1
- package/dist/SavedFiltersButton.js +1 -1
- package/dist/{SearchField-GMJ6vfV9.js → SearchField-B7fIOJf-.js} +2 -2
- package/dist/{SearchField-GMJ6vfV9.js.map → SearchField-B7fIOJf-.js.map} +1 -1
- package/dist/{SearchField-hjWzcHZF.js → SearchField-X4B7f23E.js} +2 -2
- package/dist/{SearchField-hjWzcHZF.js.map → SearchField-X4B7f23E.js.map} +1 -1
- package/dist/SearchField.js +1 -1
- package/dist/{SegmentedControl-fBjqazBR.js → SegmentedControl-Be6jCglV.js} +2 -2
- package/dist/{SegmentedControl-fBjqazBR.js.map → SegmentedControl-Be6jCglV.js.map} +1 -1
- package/dist/SegmentedControl.js +1 -1
- package/dist/{SelectCard-CKlBGGSW.js → SelectCard-CMSG_ba1.js} +4 -4
- package/dist/{SelectCard-CKlBGGSW.js.map → SelectCard-CMSG_ba1.js.map} +1 -1
- package/dist/SelectCard.js +1 -1
- package/dist/SelectField.js +1 -1
- package/dist/{SelectFieldLabel-_LjbBRaT.js → SelectFieldLabel-dKVBaki2.js} +2 -2
- package/dist/{SelectFieldLabel-_LjbBRaT.js.map → SelectFieldLabel-dKVBaki2.js.map} +1 -1
- package/dist/{SelectFieldSync-DUwFm6OH.js → SelectFieldSync-BqL3zlbZ.js} +6 -6
- package/dist/{SelectFieldSync-DUwFm6OH.js.map → SelectFieldSync-BqL3zlbZ.js.map} +1 -1
- package/dist/SelectMenu.js +1 -1
- package/dist/{SelectMenuSync-BZ3iXj3n.js → SelectMenuSync-BRvi9YTw.js} +6 -6
- package/dist/{SelectMenuSync-BZ3iXj3n.js.map → SelectMenuSync-BRvi9YTw.js.map} +1 -1
- package/dist/{SelectOptions-DDindDgw.js → SelectOptions-LUHWLYgJ.js} +2 -2
- package/dist/{SelectOptions-DDindDgw.js.map → SelectOptions-LUHWLYgJ.js.map} +1 -1
- package/dist/{SelectTrigger-DZ33_p3P.js → SelectTrigger-APxYfL3V.js} +3 -3
- package/dist/SelectTrigger-APxYfL3V.js.map +1 -0
- package/dist/SelectTrigger.js +1 -1
- package/dist/{SelectTriggerBase-DcP0Fsia.js → SelectTriggerBase-lYieONTb.js} +4 -4
- package/dist/{SelectTriggerBase-DcP0Fsia.js.map → SelectTriggerBase-lYieONTb.js.map} +1 -1
- package/dist/{SideNav-BNMwTm1u.js → SideNav-DoxX8Vi-.js} +2 -2
- package/dist/{SideNav-BNMwTm1u.js.map → SideNav-DoxX8Vi-.js.map} +1 -1
- package/dist/SideNav.js +1 -1
- package/dist/{Stepper-Bp5XkY2q.js → Stepper-CvaR7OoT.js} +3 -3
- package/dist/{Stepper-Bp5XkY2q.js.map → Stepper-CvaR7OoT.js.map} +1 -1
- package/dist/Stepper.js +1 -1
- package/dist/{Switch-DEDfnLGU.js → Switch-Bm3qqjd6.js} +3 -3
- package/dist/{Switch-DEDfnLGU.js.map → Switch-Bm3qqjd6.js.map} +1 -1
- package/dist/Switch.js +1 -1
- package/dist/{Tab-FOIali7o.js → Tab-Cy4G562A.js} +2 -2
- package/dist/{Tab-FOIali7o.js.map → Tab-Cy4G562A.js.map} +1 -1
- package/dist/Tab.js +1 -1
- package/dist/Table.js +1 -1
- package/dist/{Text-Dp-1foEc.js → Text-mDcQHC2U.js} +2 -2
- package/dist/{Text-Dp-1foEc.js.map → Text-mDcQHC2U.js.map} +1 -1
- package/dist/Text.js +1 -1
- package/dist/{TextField-B0iTBGho.js → TextField-CUVsDfWo.js} +3 -3
- package/dist/{TextField-B0iTBGho.js.map → TextField-CUVsDfWo.js.map} +1 -1
- package/dist/{TextField-CwJliCi7.js → TextField-WQTlqKso.js} +2 -2
- package/dist/TextField-WQTlqKso.js.map +1 -0
- package/dist/TextField.js +1 -1
- package/dist/{Textarea-CU3j_Yo0.js → Textarea-CW3KGuB9.js} +3 -3
- package/dist/{Textarea-CU3j_Yo0.js.map → Textarea-CW3KGuB9.js.map} +1 -1
- package/dist/Textarea.js +1 -1
- package/dist/{TimeField-CpMwgKDi.js → TimeField-JA3gXyS7.js} +5 -5
- package/dist/{TimeField-CpMwgKDi.js.map → TimeField-JA3gXyS7.js.map} +1 -1
- package/dist/TimeField.js +1 -1
- package/dist/Toast.js +2 -2
- package/dist/{Toaster-Djn0LfKr.js → Toaster-DMZng3Im.js} +4 -4
- package/dist/{Toaster-Djn0LfKr.js.map → Toaster-DMZng3Im.js.map} +1 -1
- package/dist/{Toaster-D75ZXkU1.js → Toaster-fPcgIF7Q.js} +2 -2
- package/dist/{Toaster-D75ZXkU1.js.map → Toaster-fPcgIF7Q.js.map} +1 -1
- package/dist/{Toolbar-DjkQ2_cV.js → Toolbar-BfGcDXgC.js} +8 -8
- package/dist/{Toolbar-DjkQ2_cV.js.map → Toolbar-BfGcDXgC.js.map} +1 -1
- package/dist/{Toolbar--psHvtjP.js → Toolbar-Dlu39v69.js} +6 -6
- package/dist/{Toolbar--psHvtjP.js.map → Toolbar-Dlu39v69.js.map} +1 -1
- package/dist/Toolbar.js +2 -2
- package/dist/{ToolbarButtonToggle-D62XxVp0.js → ToolbarButtonToggle-3xbnm1Qr.js} +2 -2
- package/dist/{ToolbarButtonToggle-D62XxVp0.js.map → ToolbarButtonToggle-3xbnm1Qr.js.map} +1 -1
- package/dist/TreeSelectField.js +1 -1
- package/dist/{TreeSelectFieldSync-DR0Tzn2b.js → TreeSelectFieldSync-CdtC8d3Q.js} +6 -6
- package/dist/{TreeSelectFieldSync-DR0Tzn2b.js.map → TreeSelectFieldSync-CdtC8d3Q.js.map} +1 -1
- package/dist/TreeSelectMenu.js +1 -1
- package/dist/{TreeSelectMenuSync-B8GmAstR.js → TreeSelectMenuSync-CPuQWUNU.js} +5 -5
- package/dist/{TreeSelectMenuSync-B8GmAstR.js.map → TreeSelectMenuSync-CPuQWUNU.js.map} +1 -1
- package/dist/{TypeaheadTextField-N_6q6ojK.js → TypeaheadTextField-BkLECKZY.js} +3 -3
- package/dist/TypeaheadTextField-BkLECKZY.js.map +1 -0
- package/dist/TypeaheadTextField.js +1 -1
- package/dist/{YearlessDateInputWithPicker-w3VGYELR.js → YearlessDateInputWithPicker-Bd8JnTaZ.js} +3 -3
- package/dist/{YearlessDateInputWithPicker-w3VGYELR.js.map → YearlessDateInputWithPicker-Bd8JnTaZ.js.map} +1 -1
- package/dist/beta.js +16 -16
- package/dist/{bulkActionTypes-wU7Cby5y.js → bulkActionTypes-DPC382hi.js} +2 -2
- package/dist/{bulkActionTypes-wU7Cby5y.js.map → bulkActionTypes-DPC382hi.js.map} +1 -1
- package/dist/{filter-state-CSA3wjAR.js → filter-state-BdfBSXYO.js} +23 -23
- package/dist/{filter-state-CSA3wjAR.js.map → filter-state-BdfBSXYO.js.map} +1 -1
- package/dist/{index-BN9SK9L3.js → index-B7BIlotN.js} +289 -1074
- package/dist/index-B7BIlotN.js.map +1 -0
- package/dist/{index-Bg9IAYMO.js → index-SZMmvI3D.js} +2 -2
- package/dist/{index-Bg9IAYMO.js.map → index-SZMmvI3D.js.map} +1 -1
- package/dist/index.js +54 -54
- package/dist/src/beta/components/Calendar/Calendar.d.ts +19 -0
- package/dist/src/beta/components/RichTextEditor/RichTextEditor.d.ts +4 -2
- package/dist/src/beta/components/RichTextEditor/internal/RichTextEditorProvider.d.ts +1 -1
- package/dist/src/beta/components/RichTextEditor/internal/extensions/SafeImageExtension.d.ts +13 -0
- package/dist/src/beta/components/RichTextEditor/internal/useRichTextEditor.d.ts +2 -2
- package/dist/src/beta/components/RichTextEditor/types.d.ts +42 -1
- package/dist/src/beta/components/TypeaheadTextField/TypeaheadTextField.d.ts +19 -0
- package/dist/src/components/DateFieldRange/DateFieldRange.d.ts +21 -0
- package/dist/src/components/DateFieldSingle/DateFieldSingle.d.ts +20 -0
- package/dist/src/components/DateFieldYearlessRange/DateFieldYearlessRange.d.ts +19 -0
- package/dist/src/components/FieldLabel/FieldLabel.d.ts +36 -0
- package/dist/src/components/LinkButton/LinkButton.d.ts +13 -0
- package/dist/src/components/Listbox/Listbox.d.ts +3 -3
- package/dist/src/components/NumberField/NumberField.d.ts +21 -0
- package/dist/src/components/Overflow/Overflow.d.ts +22 -0
- package/dist/src/components/SelectTrigger/SelectTrigger.d.ts +19 -0
- package/dist/src/components/TextField/TextField.d.ts +14 -0
- package/dist/src/internal/components/Popover/internal/PopoverContext.d.ts +4 -0
- package/dist/src/internal/utils/index.d.ts +1 -0
- package/dist/src/internal/utils/uniquifySvgDomIds.d.ts +12 -0
- package/dist/{stripInlineMarkdown-_rZx_gXG.js → stripInlineMarkdown-BZzgG-Zm.js} +2 -2
- package/dist/{stripInlineMarkdown-_rZx_gXG.js.map → stripInlineMarkdown-BZzgG-Zm.js.map} +1 -1
- package/dist/{syncFilterUtils-CpDXQtFA.js → syncFilterUtils-Cec5y3hY.js} +5 -5
- package/dist/{syncFilterUtils-CpDXQtFA.js.map → syncFilterUtils-Cec5y3hY.js.map} +1 -1
- package/dist/{treeSync-Dcq1ntVm.js → treeSync-oC-VZpP0.js} +4 -4
- package/dist/{treeSync-Dcq1ntVm.js.map → treeSync-oC-VZpP0.js.map} +1 -1
- package/dist/{useAdaptiveView-B8-BkcBX.js → useAdaptiveView-AvsDkChF.js} +5 -5
- package/dist/{useAdaptiveView-B8-BkcBX.js.map → useAdaptiveView-AvsDkChF.js.map} +1 -1
- package/dist/{useDrilldown-DmILG6sb.js → useDrilldown-PmrZ4BXn.js} +3 -3
- package/dist/{useDrilldown-DmILG6sb.js.map → useDrilldown-PmrZ4BXn.js.map} +1 -1
- package/dist/{useInfiniteCombobox-BfM3muPW.js → useInfiniteCombobox-C78WQZx4.js} +5 -5
- package/dist/{useInfiniteCombobox-BfM3muPW.js.map → useInfiniteCombobox-C78WQZx4.js.map} +1 -1
- package/package.json +17 -16
- package/dist/Calendar-CJaZFWmO.js.map +0 -1
- package/dist/DateFieldYearlessRange-CWdTbFDF.js.map +0 -1
- package/dist/Icon-BEwHECSM.js +0 -56
- package/dist/Icon-BEwHECSM.js.map +0 -1
- package/dist/Listbox-BQRMsA0L.js.map +0 -1
- package/dist/NumberField-DdaBRyCJ.js.map +0 -1
- package/dist/RichTextEditor-x0anoUnS.js.map +0 -1
- package/dist/SelectTrigger-DZ33_p3P.js.map +0 -1
- package/dist/TextField-CwJliCi7.js.map +0 -1
- package/dist/TypeaheadTextField-N_6q6ojK.js.map +0 -1
- package/dist/index-BN9SK9L3.js.map +0 -1
|
@@ -1,982 +1,6 @@
|
|
|
1
|
-
import { P as PluginKey, a as Plugin, S as Slice, F as Fragment, T as TextSelection, A as AllSelection, N as NodeSelection, E as Extension, g as getUpdatedPosition$1, M as MappablePosition, b as NodeRange, c as SelectionRange, d as Selection, D as DecorationSet, e as Decoration, i as isFirefox } from './RichTextEditor-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Custom positioning reference element.
|
|
7
|
-
* @see https://floating-ui.com/docs/virtual-elements
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const min$1 = Math.min;
|
|
11
|
-
const max$1 = Math.max;
|
|
12
|
-
const round = Math.round;
|
|
13
|
-
const createCoords = v => ({
|
|
14
|
-
x: v,
|
|
15
|
-
y: v
|
|
16
|
-
});
|
|
17
|
-
function evaluate(value, param) {
|
|
18
|
-
return typeof value === 'function' ? value(param) : value;
|
|
19
|
-
}
|
|
20
|
-
function getSide(placement) {
|
|
21
|
-
return placement.split('-')[0];
|
|
22
|
-
}
|
|
23
|
-
function getAlignment(placement) {
|
|
24
|
-
return placement.split('-')[1];
|
|
25
|
-
}
|
|
26
|
-
function getOppositeAxis(axis) {
|
|
27
|
-
return axis === 'x' ? 'y' : 'x';
|
|
28
|
-
}
|
|
29
|
-
function getAxisLength(axis) {
|
|
30
|
-
return axis === 'y' ? 'height' : 'width';
|
|
31
|
-
}
|
|
32
|
-
function getSideAxis(placement) {
|
|
33
|
-
const firstChar = placement[0];
|
|
34
|
-
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
|
35
|
-
}
|
|
36
|
-
function getAlignmentAxis(placement) {
|
|
37
|
-
return getOppositeAxis(getSideAxis(placement));
|
|
38
|
-
}
|
|
39
|
-
function expandPaddingObject(padding) {
|
|
40
|
-
return {
|
|
41
|
-
top: 0,
|
|
42
|
-
right: 0,
|
|
43
|
-
bottom: 0,
|
|
44
|
-
left: 0,
|
|
45
|
-
...padding
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function getPaddingObject(padding) {
|
|
49
|
-
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
50
|
-
top: padding,
|
|
51
|
-
right: padding,
|
|
52
|
-
bottom: padding,
|
|
53
|
-
left: padding
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function rectToClientRect(rect) {
|
|
57
|
-
const {
|
|
58
|
-
x,
|
|
59
|
-
y,
|
|
60
|
-
width,
|
|
61
|
-
height
|
|
62
|
-
} = rect;
|
|
63
|
-
return {
|
|
64
|
-
width,
|
|
65
|
-
height,
|
|
66
|
-
top: y,
|
|
67
|
-
left: x,
|
|
68
|
-
right: x + width,
|
|
69
|
-
bottom: y + height,
|
|
70
|
-
x,
|
|
71
|
-
y
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
76
|
-
let {
|
|
77
|
-
reference,
|
|
78
|
-
floating
|
|
79
|
-
} = _ref;
|
|
80
|
-
const sideAxis = getSideAxis(placement);
|
|
81
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
82
|
-
const alignLength = getAxisLength(alignmentAxis);
|
|
83
|
-
const side = getSide(placement);
|
|
84
|
-
const isVertical = sideAxis === 'y';
|
|
85
|
-
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
86
|
-
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
87
|
-
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
88
|
-
let coords;
|
|
89
|
-
switch (side) {
|
|
90
|
-
case 'top':
|
|
91
|
-
coords = {
|
|
92
|
-
x: commonX,
|
|
93
|
-
y: reference.y - floating.height
|
|
94
|
-
};
|
|
95
|
-
break;
|
|
96
|
-
case 'bottom':
|
|
97
|
-
coords = {
|
|
98
|
-
x: commonX,
|
|
99
|
-
y: reference.y + reference.height
|
|
100
|
-
};
|
|
101
|
-
break;
|
|
102
|
-
case 'right':
|
|
103
|
-
coords = {
|
|
104
|
-
x: reference.x + reference.width,
|
|
105
|
-
y: commonY
|
|
106
|
-
};
|
|
107
|
-
break;
|
|
108
|
-
case 'left':
|
|
109
|
-
coords = {
|
|
110
|
-
x: reference.x - floating.width,
|
|
111
|
-
y: commonY
|
|
112
|
-
};
|
|
113
|
-
break;
|
|
114
|
-
default:
|
|
115
|
-
coords = {
|
|
116
|
-
x: reference.x,
|
|
117
|
-
y: reference.y
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
switch (getAlignment(placement)) {
|
|
121
|
-
case 'start':
|
|
122
|
-
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
123
|
-
break;
|
|
124
|
-
case 'end':
|
|
125
|
-
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
return coords;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Resolves with an object of overflow side offsets that determine how much the
|
|
133
|
-
* element is overflowing a given clipping boundary on each side.
|
|
134
|
-
* - positive = overflowing the boundary by that number of pixels
|
|
135
|
-
* - negative = how many pixels left before it will overflow
|
|
136
|
-
* - 0 = lies flush with the boundary
|
|
137
|
-
* @see https://floating-ui.com/docs/detectOverflow
|
|
138
|
-
*/
|
|
139
|
-
async function detectOverflow(state, options) {
|
|
140
|
-
var _await$platform$isEle;
|
|
141
|
-
if (options === void 0) {
|
|
142
|
-
options = {};
|
|
143
|
-
}
|
|
144
|
-
const {
|
|
145
|
-
x,
|
|
146
|
-
y,
|
|
147
|
-
platform,
|
|
148
|
-
rects,
|
|
149
|
-
elements,
|
|
150
|
-
strategy
|
|
151
|
-
} = state;
|
|
152
|
-
const {
|
|
153
|
-
boundary = 'clippingAncestors',
|
|
154
|
-
rootBoundary = 'viewport',
|
|
155
|
-
elementContext = 'floating',
|
|
156
|
-
altBoundary = false,
|
|
157
|
-
padding = 0
|
|
158
|
-
} = evaluate(options, state);
|
|
159
|
-
const paddingObject = getPaddingObject(padding);
|
|
160
|
-
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
161
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
162
|
-
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
163
|
-
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
164
|
-
boundary,
|
|
165
|
-
rootBoundary,
|
|
166
|
-
strategy
|
|
167
|
-
}));
|
|
168
|
-
const rect = elementContext === 'floating' ? {
|
|
169
|
-
x,
|
|
170
|
-
y,
|
|
171
|
-
width: rects.floating.width,
|
|
172
|
-
height: rects.floating.height
|
|
173
|
-
} : rects.reference;
|
|
174
|
-
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
175
|
-
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
176
|
-
x: 1,
|
|
177
|
-
y: 1
|
|
178
|
-
} : {
|
|
179
|
-
x: 1,
|
|
180
|
-
y: 1
|
|
181
|
-
};
|
|
182
|
-
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
183
|
-
elements,
|
|
184
|
-
rect,
|
|
185
|
-
offsetParent,
|
|
186
|
-
strategy
|
|
187
|
-
}) : rect);
|
|
188
|
-
return {
|
|
189
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
190
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
191
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
192
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Maximum number of resets that can occur before bailing to avoid infinite reset loops.
|
|
197
|
-
const MAX_RESET_COUNT = 50;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Computes the `x` and `y` coordinates that will place the floating element
|
|
201
|
-
* next to a given reference element.
|
|
202
|
-
*
|
|
203
|
-
* This export does not have any `platform` interface logic. You will need to
|
|
204
|
-
* write one for the platform you are using Floating UI with.
|
|
205
|
-
*/
|
|
206
|
-
const computePosition$1 = async (reference, floating, config) => {
|
|
207
|
-
const {
|
|
208
|
-
placement = 'bottom',
|
|
209
|
-
strategy = 'absolute',
|
|
210
|
-
middleware = [],
|
|
211
|
-
platform
|
|
212
|
-
} = config;
|
|
213
|
-
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
214
|
-
...platform,
|
|
215
|
-
detectOverflow
|
|
216
|
-
};
|
|
217
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
218
|
-
let rects = await platform.getElementRects({
|
|
219
|
-
reference,
|
|
220
|
-
floating,
|
|
221
|
-
strategy
|
|
222
|
-
});
|
|
223
|
-
let {
|
|
224
|
-
x,
|
|
225
|
-
y
|
|
226
|
-
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
227
|
-
let statefulPlacement = placement;
|
|
228
|
-
let resetCount = 0;
|
|
229
|
-
const middlewareData = {};
|
|
230
|
-
for (let i = 0; i < middleware.length; i++) {
|
|
231
|
-
const currentMiddleware = middleware[i];
|
|
232
|
-
if (!currentMiddleware) {
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
const {
|
|
236
|
-
name,
|
|
237
|
-
fn
|
|
238
|
-
} = currentMiddleware;
|
|
239
|
-
const {
|
|
240
|
-
x: nextX,
|
|
241
|
-
y: nextY,
|
|
242
|
-
data,
|
|
243
|
-
reset
|
|
244
|
-
} = await fn({
|
|
245
|
-
x,
|
|
246
|
-
y,
|
|
247
|
-
initialPlacement: placement,
|
|
248
|
-
placement: statefulPlacement,
|
|
249
|
-
strategy,
|
|
250
|
-
middlewareData,
|
|
251
|
-
rects,
|
|
252
|
-
platform: platformWithDetectOverflow,
|
|
253
|
-
elements: {
|
|
254
|
-
reference,
|
|
255
|
-
floating
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
x = nextX != null ? nextX : x;
|
|
259
|
-
y = nextY != null ? nextY : y;
|
|
260
|
-
middlewareData[name] = {
|
|
261
|
-
...middlewareData[name],
|
|
262
|
-
...data
|
|
263
|
-
};
|
|
264
|
-
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
265
|
-
resetCount++;
|
|
266
|
-
if (typeof reset === 'object') {
|
|
267
|
-
if (reset.placement) {
|
|
268
|
-
statefulPlacement = reset.placement;
|
|
269
|
-
}
|
|
270
|
-
if (reset.rects) {
|
|
271
|
-
rects = reset.rects === true ? await platform.getElementRects({
|
|
272
|
-
reference,
|
|
273
|
-
floating,
|
|
274
|
-
strategy
|
|
275
|
-
}) : reset.rects;
|
|
276
|
-
}
|
|
277
|
-
({
|
|
278
|
-
x,
|
|
279
|
-
y
|
|
280
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
281
|
-
}
|
|
282
|
-
i = -1;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return {
|
|
286
|
-
x,
|
|
287
|
-
y,
|
|
288
|
-
placement: statefulPlacement,
|
|
289
|
-
strategy,
|
|
290
|
-
middlewareData
|
|
291
|
-
};
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
function hasWindow() {
|
|
295
|
-
return typeof window !== 'undefined';
|
|
296
|
-
}
|
|
297
|
-
function getNodeName(node) {
|
|
298
|
-
if (isNode$1(node)) {
|
|
299
|
-
return (node.nodeName || '').toLowerCase();
|
|
300
|
-
}
|
|
301
|
-
// Mocked nodes in testing environments may not be instances of Node. By
|
|
302
|
-
// returning `#document` an infinite loop won't occur.
|
|
303
|
-
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
304
|
-
return '#document';
|
|
305
|
-
}
|
|
306
|
-
function getWindow(node) {
|
|
307
|
-
var _node$ownerDocument;
|
|
308
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
309
|
-
}
|
|
310
|
-
function getDocumentElement(node) {
|
|
311
|
-
var _ref;
|
|
312
|
-
return (_ref = (isNode$1(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
313
|
-
}
|
|
314
|
-
function isNode$1(value) {
|
|
315
|
-
if (!hasWindow()) {
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
319
|
-
}
|
|
320
|
-
function isElement(value) {
|
|
321
|
-
if (!hasWindow()) {
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
325
|
-
}
|
|
326
|
-
function isHTMLElement(value) {
|
|
327
|
-
if (!hasWindow()) {
|
|
328
|
-
return false;
|
|
329
|
-
}
|
|
330
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
331
|
-
}
|
|
332
|
-
function isShadowRoot(value) {
|
|
333
|
-
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
334
|
-
return false;
|
|
335
|
-
}
|
|
336
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
337
|
-
}
|
|
338
|
-
function isOverflowElement(element) {
|
|
339
|
-
const {
|
|
340
|
-
overflow,
|
|
341
|
-
overflowX,
|
|
342
|
-
overflowY,
|
|
343
|
-
display
|
|
344
|
-
} = getComputedStyle$1(element);
|
|
345
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
|
346
|
-
}
|
|
347
|
-
function isTableElement(element) {
|
|
348
|
-
return /^(table|td|th)$/.test(getNodeName(element));
|
|
349
|
-
}
|
|
350
|
-
function isTopLayer(element) {
|
|
351
|
-
try {
|
|
352
|
-
if (element.matches(':popover-open')) {
|
|
353
|
-
return true;
|
|
354
|
-
}
|
|
355
|
-
} catch (_e) {
|
|
356
|
-
// no-op
|
|
357
|
-
}
|
|
358
|
-
try {
|
|
359
|
-
return element.matches(':modal');
|
|
360
|
-
} catch (_e) {
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
365
|
-
const containRe = /paint|layout|strict|content/;
|
|
366
|
-
const isNotNone = value => !!value && value !== 'none';
|
|
367
|
-
let isWebKitValue;
|
|
368
|
-
function isContainingBlock(elementOrCss) {
|
|
369
|
-
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
370
|
-
|
|
371
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
372
|
-
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
373
|
-
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
|
374
|
-
}
|
|
375
|
-
function getContainingBlock(element) {
|
|
376
|
-
let currentNode = getParentNode(element);
|
|
377
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
378
|
-
if (isContainingBlock(currentNode)) {
|
|
379
|
-
return currentNode;
|
|
380
|
-
} else if (isTopLayer(currentNode)) {
|
|
381
|
-
return null;
|
|
382
|
-
}
|
|
383
|
-
currentNode = getParentNode(currentNode);
|
|
384
|
-
}
|
|
385
|
-
return null;
|
|
386
|
-
}
|
|
387
|
-
function isWebKit() {
|
|
388
|
-
if (isWebKitValue == null) {
|
|
389
|
-
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
|
390
|
-
}
|
|
391
|
-
return isWebKitValue;
|
|
392
|
-
}
|
|
393
|
-
function isLastTraversableNode(node) {
|
|
394
|
-
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
395
|
-
}
|
|
396
|
-
function getComputedStyle$1(element) {
|
|
397
|
-
return getWindow(element).getComputedStyle(element);
|
|
398
|
-
}
|
|
399
|
-
function getNodeScroll(element) {
|
|
400
|
-
if (isElement(element)) {
|
|
401
|
-
return {
|
|
402
|
-
scrollLeft: element.scrollLeft,
|
|
403
|
-
scrollTop: element.scrollTop
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
return {
|
|
407
|
-
scrollLeft: element.scrollX,
|
|
408
|
-
scrollTop: element.scrollY
|
|
409
|
-
};
|
|
410
|
-
}
|
|
411
|
-
function getParentNode(node) {
|
|
412
|
-
if (getNodeName(node) === 'html') {
|
|
413
|
-
return node;
|
|
414
|
-
}
|
|
415
|
-
const result =
|
|
416
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
417
|
-
node.assignedSlot ||
|
|
418
|
-
// DOM Element detected.
|
|
419
|
-
node.parentNode ||
|
|
420
|
-
// ShadowRoot detected.
|
|
421
|
-
isShadowRoot(node) && node.host ||
|
|
422
|
-
// Fallback.
|
|
423
|
-
getDocumentElement(node);
|
|
424
|
-
return isShadowRoot(result) ? result.host : result;
|
|
425
|
-
}
|
|
426
|
-
function getNearestOverflowAncestor(node) {
|
|
427
|
-
const parentNode = getParentNode(node);
|
|
428
|
-
if (isLastTraversableNode(parentNode)) {
|
|
429
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
430
|
-
}
|
|
431
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
432
|
-
return parentNode;
|
|
433
|
-
}
|
|
434
|
-
return getNearestOverflowAncestor(parentNode);
|
|
435
|
-
}
|
|
436
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
437
|
-
var _node$ownerDocument2;
|
|
438
|
-
if (list === void 0) {
|
|
439
|
-
list = [];
|
|
440
|
-
}
|
|
441
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
442
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
443
|
-
const win = getWindow(scrollableAncestor);
|
|
444
|
-
if (isBody) {
|
|
445
|
-
getFrameElement(win);
|
|
446
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], []);
|
|
447
|
-
} else {
|
|
448
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, []));
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
function getFrameElement(win) {
|
|
452
|
-
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
function getCssDimensions(element) {
|
|
456
|
-
const css = getComputedStyle$1(element);
|
|
457
|
-
// In testing environments, the `width` and `height` properties are empty
|
|
458
|
-
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
459
|
-
let width = parseFloat(css.width) || 0;
|
|
460
|
-
let height = parseFloat(css.height) || 0;
|
|
461
|
-
const hasOffset = isHTMLElement(element);
|
|
462
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
463
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
464
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
465
|
-
if (shouldFallback) {
|
|
466
|
-
width = offsetWidth;
|
|
467
|
-
height = offsetHeight;
|
|
468
|
-
}
|
|
469
|
-
return {
|
|
470
|
-
width,
|
|
471
|
-
height,
|
|
472
|
-
$: shouldFallback
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
function unwrapElement(element) {
|
|
477
|
-
return !isElement(element) ? element.contextElement : element;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
function getScale(element) {
|
|
481
|
-
const domElement = unwrapElement(element);
|
|
482
|
-
if (!isHTMLElement(domElement)) {
|
|
483
|
-
return createCoords(1);
|
|
484
|
-
}
|
|
485
|
-
const rect = domElement.getBoundingClientRect();
|
|
486
|
-
const {
|
|
487
|
-
width,
|
|
488
|
-
height,
|
|
489
|
-
$
|
|
490
|
-
} = getCssDimensions(domElement);
|
|
491
|
-
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
492
|
-
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
493
|
-
|
|
494
|
-
// 0, NaN, or Infinity should always fallback to 1.
|
|
495
|
-
|
|
496
|
-
if (!x || !Number.isFinite(x)) {
|
|
497
|
-
x = 1;
|
|
498
|
-
}
|
|
499
|
-
if (!y || !Number.isFinite(y)) {
|
|
500
|
-
y = 1;
|
|
501
|
-
}
|
|
502
|
-
return {
|
|
503
|
-
x,
|
|
504
|
-
y
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
509
|
-
function getVisualOffsets(element) {
|
|
510
|
-
const win = getWindow(element);
|
|
511
|
-
if (!isWebKit() || !win.visualViewport) {
|
|
512
|
-
return noOffsets;
|
|
513
|
-
}
|
|
514
|
-
return {
|
|
515
|
-
x: win.visualViewport.offsetLeft,
|
|
516
|
-
y: win.visualViewport.offsetTop
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
520
|
-
if (isFixed === void 0) {
|
|
521
|
-
isFixed = false;
|
|
522
|
-
}
|
|
523
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
524
|
-
return false;
|
|
525
|
-
}
|
|
526
|
-
return isFixed;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
530
|
-
if (includeScale === void 0) {
|
|
531
|
-
includeScale = false;
|
|
532
|
-
}
|
|
533
|
-
if (isFixedStrategy === void 0) {
|
|
534
|
-
isFixedStrategy = false;
|
|
535
|
-
}
|
|
536
|
-
const clientRect = element.getBoundingClientRect();
|
|
537
|
-
const domElement = unwrapElement(element);
|
|
538
|
-
let scale = createCoords(1);
|
|
539
|
-
if (includeScale) {
|
|
540
|
-
if (offsetParent) {
|
|
541
|
-
if (isElement(offsetParent)) {
|
|
542
|
-
scale = getScale(offsetParent);
|
|
543
|
-
}
|
|
544
|
-
} else {
|
|
545
|
-
scale = getScale(element);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
549
|
-
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
550
|
-
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
551
|
-
let width = clientRect.width / scale.x;
|
|
552
|
-
let height = clientRect.height / scale.y;
|
|
553
|
-
if (domElement) {
|
|
554
|
-
const win = getWindow(domElement);
|
|
555
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
556
|
-
let currentWin = win;
|
|
557
|
-
let currentIFrame = getFrameElement(currentWin);
|
|
558
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
559
|
-
const iframeScale = getScale(currentIFrame);
|
|
560
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
561
|
-
const css = getComputedStyle$1(currentIFrame);
|
|
562
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
563
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
564
|
-
x *= iframeScale.x;
|
|
565
|
-
y *= iframeScale.y;
|
|
566
|
-
width *= iframeScale.x;
|
|
567
|
-
height *= iframeScale.y;
|
|
568
|
-
x += left;
|
|
569
|
-
y += top;
|
|
570
|
-
currentWin = getWindow(currentIFrame);
|
|
571
|
-
currentIFrame = getFrameElement(currentWin);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
return rectToClientRect({
|
|
575
|
-
width,
|
|
576
|
-
height,
|
|
577
|
-
x,
|
|
578
|
-
y
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
583
|
-
// incorrect for RTL.
|
|
584
|
-
function getWindowScrollBarX(element, rect) {
|
|
585
|
-
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
586
|
-
if (!rect) {
|
|
587
|
-
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
588
|
-
}
|
|
589
|
-
return rect.left + leftScroll;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
function getHTMLOffset(documentElement, scroll) {
|
|
593
|
-
const htmlRect = documentElement.getBoundingClientRect();
|
|
594
|
-
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
595
|
-
const y = htmlRect.top + scroll.scrollTop;
|
|
596
|
-
return {
|
|
597
|
-
x,
|
|
598
|
-
y
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
603
|
-
let {
|
|
604
|
-
elements,
|
|
605
|
-
rect,
|
|
606
|
-
offsetParent,
|
|
607
|
-
strategy
|
|
608
|
-
} = _ref;
|
|
609
|
-
const isFixed = strategy === 'fixed';
|
|
610
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
611
|
-
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
612
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
613
|
-
return rect;
|
|
614
|
-
}
|
|
615
|
-
let scroll = {
|
|
616
|
-
scrollLeft: 0,
|
|
617
|
-
scrollTop: 0
|
|
618
|
-
};
|
|
619
|
-
let scale = createCoords(1);
|
|
620
|
-
const offsets = createCoords(0);
|
|
621
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
622
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
623
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
624
|
-
scroll = getNodeScroll(offsetParent);
|
|
625
|
-
}
|
|
626
|
-
if (isOffsetParentAnElement) {
|
|
627
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
|
628
|
-
scale = getScale(offsetParent);
|
|
629
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
630
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
634
|
-
return {
|
|
635
|
-
width: rect.width * scale.x,
|
|
636
|
-
height: rect.height * scale.y,
|
|
637
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
638
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
function getClientRects(element) {
|
|
643
|
-
return Array.from(element.getClientRects());
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
// Gets the entire size of the scrollable document area, even extending outside
|
|
647
|
-
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
648
|
-
function getDocumentRect(element) {
|
|
649
|
-
const html = getDocumentElement(element);
|
|
650
|
-
const scroll = getNodeScroll(element);
|
|
651
|
-
const body = element.ownerDocument.body;
|
|
652
|
-
const width = max$1(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
653
|
-
const height = max$1(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
654
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
655
|
-
const y = -scroll.scrollTop;
|
|
656
|
-
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
657
|
-
x += max$1(html.clientWidth, body.clientWidth) - width;
|
|
658
|
-
}
|
|
659
|
-
return {
|
|
660
|
-
width,
|
|
661
|
-
height,
|
|
662
|
-
x,
|
|
663
|
-
y
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
668
|
-
// calculation is affected by unusual styles.
|
|
669
|
-
// Most scrollbars leave 15-18px of space.
|
|
670
|
-
const SCROLLBAR_MAX = 25;
|
|
671
|
-
function getViewportRect(element, strategy) {
|
|
672
|
-
const win = getWindow(element);
|
|
673
|
-
const html = getDocumentElement(element);
|
|
674
|
-
const visualViewport = win.visualViewport;
|
|
675
|
-
let width = html.clientWidth;
|
|
676
|
-
let height = html.clientHeight;
|
|
677
|
-
let x = 0;
|
|
678
|
-
let y = 0;
|
|
679
|
-
if (visualViewport) {
|
|
680
|
-
width = visualViewport.width;
|
|
681
|
-
height = visualViewport.height;
|
|
682
|
-
const visualViewportBased = isWebKit();
|
|
683
|
-
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
684
|
-
x = visualViewport.offsetLeft;
|
|
685
|
-
y = visualViewport.offsetTop;
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
const windowScrollbarX = getWindowScrollBarX(html);
|
|
689
|
-
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
690
|
-
// visual width of the <html> but this is not considered in the size
|
|
691
|
-
// of `html.clientWidth`.
|
|
692
|
-
if (windowScrollbarX <= 0) {
|
|
693
|
-
const doc = html.ownerDocument;
|
|
694
|
-
const body = doc.body;
|
|
695
|
-
const bodyStyles = getComputedStyle(body);
|
|
696
|
-
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
697
|
-
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
698
|
-
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
699
|
-
width -= clippingStableScrollbarWidth;
|
|
700
|
-
}
|
|
701
|
-
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
702
|
-
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
703
|
-
// by the scrollbar amount so there isn't extra space on the right.
|
|
704
|
-
width += windowScrollbarX;
|
|
705
|
-
}
|
|
706
|
-
return {
|
|
707
|
-
width,
|
|
708
|
-
height,
|
|
709
|
-
x,
|
|
710
|
-
y
|
|
711
|
-
};
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
// Returns the inner client rect, subtracting scrollbars if present.
|
|
715
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
716
|
-
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
717
|
-
const top = clientRect.top + element.clientTop;
|
|
718
|
-
const left = clientRect.left + element.clientLeft;
|
|
719
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
720
|
-
const width = element.clientWidth * scale.x;
|
|
721
|
-
const height = element.clientHeight * scale.y;
|
|
722
|
-
const x = left * scale.x;
|
|
723
|
-
const y = top * scale.y;
|
|
724
|
-
return {
|
|
725
|
-
width,
|
|
726
|
-
height,
|
|
727
|
-
x,
|
|
728
|
-
y
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
732
|
-
let rect;
|
|
733
|
-
if (clippingAncestor === 'viewport') {
|
|
734
|
-
rect = getViewportRect(element, strategy);
|
|
735
|
-
} else if (clippingAncestor === 'document') {
|
|
736
|
-
rect = getDocumentRect(getDocumentElement(element));
|
|
737
|
-
} else if (isElement(clippingAncestor)) {
|
|
738
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
739
|
-
} else {
|
|
740
|
-
const visualOffsets = getVisualOffsets(element);
|
|
741
|
-
rect = {
|
|
742
|
-
x: clippingAncestor.x - visualOffsets.x,
|
|
743
|
-
y: clippingAncestor.y - visualOffsets.y,
|
|
744
|
-
width: clippingAncestor.width,
|
|
745
|
-
height: clippingAncestor.height
|
|
746
|
-
};
|
|
747
|
-
}
|
|
748
|
-
return rectToClientRect(rect);
|
|
749
|
-
}
|
|
750
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
|
751
|
-
const parentNode = getParentNode(element);
|
|
752
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
753
|
-
return false;
|
|
754
|
-
}
|
|
755
|
-
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
759
|
-
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
760
|
-
// of the given element up the tree.
|
|
761
|
-
function getClippingElementAncestors(element, cache) {
|
|
762
|
-
const cachedResult = cache.get(element);
|
|
763
|
-
if (cachedResult) {
|
|
764
|
-
return cachedResult;
|
|
765
|
-
}
|
|
766
|
-
let result = getOverflowAncestors(element, []).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
767
|
-
let currentContainingBlockComputedStyle = null;
|
|
768
|
-
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
769
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
770
|
-
|
|
771
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
772
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
773
|
-
const computedStyle = getComputedStyle$1(currentNode);
|
|
774
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
775
|
-
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
776
|
-
currentContainingBlockComputedStyle = null;
|
|
777
|
-
}
|
|
778
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
779
|
-
if (shouldDropCurrentNode) {
|
|
780
|
-
// Drop non-containing blocks.
|
|
781
|
-
result = result.filter(ancestor => ancestor !== currentNode);
|
|
782
|
-
} else {
|
|
783
|
-
// Record last containing block for next iteration.
|
|
784
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
785
|
-
}
|
|
786
|
-
currentNode = getParentNode(currentNode);
|
|
787
|
-
}
|
|
788
|
-
cache.set(element, result);
|
|
789
|
-
return result;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
// Gets the maximum area that the element is visible in due to any number of
|
|
793
|
-
// clipping ancestors.
|
|
794
|
-
function getClippingRect(_ref) {
|
|
795
|
-
let {
|
|
796
|
-
element,
|
|
797
|
-
boundary,
|
|
798
|
-
rootBoundary,
|
|
799
|
-
strategy
|
|
800
|
-
} = _ref;
|
|
801
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
802
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
803
|
-
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
804
|
-
let top = firstRect.top;
|
|
805
|
-
let right = firstRect.right;
|
|
806
|
-
let bottom = firstRect.bottom;
|
|
807
|
-
let left = firstRect.left;
|
|
808
|
-
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
809
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
810
|
-
top = max$1(rect.top, top);
|
|
811
|
-
right = min$1(rect.right, right);
|
|
812
|
-
bottom = min$1(rect.bottom, bottom);
|
|
813
|
-
left = max$1(rect.left, left);
|
|
814
|
-
}
|
|
815
|
-
return {
|
|
816
|
-
width: right - left,
|
|
817
|
-
height: bottom - top,
|
|
818
|
-
x: left,
|
|
819
|
-
y: top
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
function getDimensions(element) {
|
|
824
|
-
const {
|
|
825
|
-
width,
|
|
826
|
-
height
|
|
827
|
-
} = getCssDimensions(element);
|
|
828
|
-
return {
|
|
829
|
-
width,
|
|
830
|
-
height
|
|
831
|
-
};
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
835
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
836
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
837
|
-
const isFixed = strategy === 'fixed';
|
|
838
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
839
|
-
let scroll = {
|
|
840
|
-
scrollLeft: 0,
|
|
841
|
-
scrollTop: 0
|
|
842
|
-
};
|
|
843
|
-
const offsets = createCoords(0);
|
|
844
|
-
|
|
845
|
-
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
846
|
-
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
847
|
-
function setLeftRTLScrollbarOffset() {
|
|
848
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
849
|
-
}
|
|
850
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
851
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
852
|
-
scroll = getNodeScroll(offsetParent);
|
|
853
|
-
}
|
|
854
|
-
if (isOffsetParentAnElement) {
|
|
855
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
856
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
857
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
858
|
-
} else if (documentElement) {
|
|
859
|
-
setLeftRTLScrollbarOffset();
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
863
|
-
setLeftRTLScrollbarOffset();
|
|
864
|
-
}
|
|
865
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
866
|
-
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
867
|
-
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
868
|
-
return {
|
|
869
|
-
x,
|
|
870
|
-
y,
|
|
871
|
-
width: rect.width,
|
|
872
|
-
height: rect.height
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
function isStaticPositioned(element) {
|
|
877
|
-
return getComputedStyle$1(element).position === 'static';
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
function getTrueOffsetParent(element, polyfill) {
|
|
881
|
-
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
882
|
-
return null;
|
|
883
|
-
}
|
|
884
|
-
if (polyfill) {
|
|
885
|
-
return polyfill(element);
|
|
886
|
-
}
|
|
887
|
-
let rawOffsetParent = element.offsetParent;
|
|
888
|
-
|
|
889
|
-
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
890
|
-
// while Chrome and Safari return the <body> element. The <body> element must
|
|
891
|
-
// be used to perform the correct calculations even if the <html> element is
|
|
892
|
-
// non-static.
|
|
893
|
-
if (getDocumentElement(element) === rawOffsetParent) {
|
|
894
|
-
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
895
|
-
}
|
|
896
|
-
return rawOffsetParent;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
900
|
-
// such as table ancestors and cross browser bugs.
|
|
901
|
-
function getOffsetParent(element, polyfill) {
|
|
902
|
-
const win = getWindow(element);
|
|
903
|
-
if (isTopLayer(element)) {
|
|
904
|
-
return win;
|
|
905
|
-
}
|
|
906
|
-
if (!isHTMLElement(element)) {
|
|
907
|
-
let svgOffsetParent = getParentNode(element);
|
|
908
|
-
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
909
|
-
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
910
|
-
return svgOffsetParent;
|
|
911
|
-
}
|
|
912
|
-
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
913
|
-
}
|
|
914
|
-
return win;
|
|
915
|
-
}
|
|
916
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
917
|
-
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
918
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
919
|
-
}
|
|
920
|
-
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
921
|
-
return win;
|
|
922
|
-
}
|
|
923
|
-
return offsetParent || getContainingBlock(element) || win;
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
const getElementRects = async function (data) {
|
|
927
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
928
|
-
const getDimensionsFn = this.getDimensions;
|
|
929
|
-
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
930
|
-
return {
|
|
931
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
932
|
-
floating: {
|
|
933
|
-
x: 0,
|
|
934
|
-
y: 0,
|
|
935
|
-
width: floatingDimensions.width,
|
|
936
|
-
height: floatingDimensions.height
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
};
|
|
940
|
-
|
|
941
|
-
function isRTL(element) {
|
|
942
|
-
return getComputedStyle$1(element).direction === 'rtl';
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
const platform = {
|
|
946
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
947
|
-
getDocumentElement,
|
|
948
|
-
getClippingRect,
|
|
949
|
-
getOffsetParent,
|
|
950
|
-
getElementRects,
|
|
951
|
-
getClientRects,
|
|
952
|
-
getDimensions,
|
|
953
|
-
getScale,
|
|
954
|
-
isElement,
|
|
955
|
-
isRTL
|
|
956
|
-
};
|
|
957
|
-
|
|
958
|
-
/**
|
|
959
|
-
* Computes the `x` and `y` coordinates that will place the floating element
|
|
960
|
-
* next to a given reference element.
|
|
961
|
-
*/
|
|
962
|
-
const computePosition = (reference, floating, options) => {
|
|
963
|
-
// This caches the expensive `getClippingElementAncestors` function so that
|
|
964
|
-
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
965
|
-
// single call. If other functions become expensive, we can add them as well.
|
|
966
|
-
const cache = new Map();
|
|
967
|
-
const mergedOptions = {
|
|
968
|
-
platform,
|
|
969
|
-
...options
|
|
970
|
-
};
|
|
971
|
-
const platformWithCache = {
|
|
972
|
-
...mergedOptions.platform,
|
|
973
|
-
_c: cache
|
|
974
|
-
};
|
|
975
|
-
return computePosition$1(reference, floating, {
|
|
976
|
-
...mergedOptions,
|
|
977
|
-
platform: platformWithCache
|
|
978
|
-
});
|
|
979
|
-
};
|
|
1
|
+
import { P as PluginKey, a as Plugin, S as Slice, F as Fragment, T as TextSelection, A as AllSelection, N as NodeSelection, E as Extension, g as getUpdatedPosition$1, M as MappablePosition, b as NodeRange, c as SelectionRange, d as Selection, D as DecorationSet, e as Decoration, f as computePosition, i as isFirefox } from './RichTextEditor-byoMZaJy.js';
|
|
2
|
+
import { useRef, useMemo, useEffect } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
980
4
|
|
|
981
5
|
/**
|
|
982
6
|
* Utility module to work with key-value stores.
|
|
@@ -15545,7 +14569,12 @@ function isChangeOrigin(transaction) {
|
|
|
15545
14569
|
}
|
|
15546
14570
|
function getYAbsolutePosition(state, relativePos) {
|
|
15547
14571
|
const ystate = ySyncPluginKey.getState(state);
|
|
15548
|
-
return relativePositionToAbsolutePosition(
|
|
14572
|
+
return relativePositionToAbsolutePosition(
|
|
14573
|
+
ystate.doc,
|
|
14574
|
+
ystate.type,
|
|
14575
|
+
relativePos,
|
|
14576
|
+
ystate.binding.mapping
|
|
14577
|
+
) || 0;
|
|
15549
14578
|
}
|
|
15550
14579
|
function getYRelativePosition(state, absolutePos) {
|
|
15551
14580
|
const ystate = ySyncPluginKey.getState(state);
|
|
@@ -15722,7 +14751,7 @@ Extension.create({
|
|
|
15722
14751
|
(_a = fragment.doc) == null ? void 0 : _a.destroy();
|
|
15723
14752
|
}
|
|
15724
14753
|
});
|
|
15725
|
-
return
|
|
14754
|
+
return true;
|
|
15726
14755
|
}
|
|
15727
14756
|
}
|
|
15728
14757
|
})
|
|
@@ -15788,17 +14817,18 @@ function getSelectionRanges($from, $to, depth, options = {}) {
|
|
|
15788
14817
|
|
|
15789
14818
|
// src/helpers/NodeRangeBookmark.ts
|
|
15790
14819
|
var NodeRangeBookmark = class _NodeRangeBookmark {
|
|
15791
|
-
constructor(anchor, head) {
|
|
14820
|
+
constructor(anchor, head, depth) {
|
|
15792
14821
|
this.anchor = anchor;
|
|
15793
14822
|
this.head = head;
|
|
14823
|
+
this.depth = depth != null ? depth : 0;
|
|
15794
14824
|
}
|
|
15795
14825
|
map(mapping) {
|
|
15796
|
-
return new _NodeRangeBookmark(mapping.map(this.anchor), mapping.map(this.head));
|
|
14826
|
+
return new _NodeRangeBookmark(mapping.map(this.anchor), mapping.map(this.head), this.depth);
|
|
15797
14827
|
}
|
|
15798
14828
|
resolve(doc) {
|
|
15799
14829
|
const $anchor = doc.resolve(this.anchor);
|
|
15800
14830
|
const $head = doc.resolve(this.head);
|
|
15801
|
-
return new NodeRangeSelection($anchor, $head);
|
|
14831
|
+
return new NodeRangeSelection($anchor, $head, this.depth);
|
|
15802
14832
|
}
|
|
15803
14833
|
};
|
|
15804
14834
|
|
|
@@ -15810,7 +14840,11 @@ var NodeRangeSelection = class _NodeRangeSelection extends Selection {
|
|
|
15810
14840
|
const isCursorAtEnd = $anchor.pos === doc.content.size && $head.pos === doc.content.size;
|
|
15811
14841
|
const $correctedHead = isCursor && !isCursorAtEnd ? doc.resolve($head.pos + (bias > 0 ? 1 : -1)) : $head;
|
|
15812
14842
|
const $correctedAnchor = isCursor && isCursorAtEnd ? doc.resolve($anchor.pos - (bias > 0 ? 1 : -1)) : $anchor;
|
|
15813
|
-
const ranges = getSelectionRanges(
|
|
14843
|
+
const ranges = getSelectionRanges(
|
|
14844
|
+
$correctedAnchor.min($correctedHead),
|
|
14845
|
+
$correctedAnchor.max($correctedHead),
|
|
14846
|
+
depth
|
|
14847
|
+
);
|
|
15814
14848
|
const $rangeFrom = $correctedHead.pos >= $anchor.pos ? ranges[0].$from : ranges[ranges.length - 1].$to;
|
|
15815
14849
|
const $rangeTo = $correctedHead.pos >= $anchor.pos ? ranges[ranges.length - 1].$to : ranges[0].$from;
|
|
15816
14850
|
super($rangeFrom, $rangeTo, ranges);
|
|
@@ -15827,13 +14861,14 @@ var NodeRangeSelection = class _NodeRangeSelection extends Selection {
|
|
|
15827
14861
|
map(doc, mapping) {
|
|
15828
14862
|
const $anchor = doc.resolve(mapping.map(this.anchor));
|
|
15829
14863
|
const $head = doc.resolve(mapping.map(this.head));
|
|
15830
|
-
return new _NodeRangeSelection($anchor, $head);
|
|
14864
|
+
return new _NodeRangeSelection($anchor, $head, this.depth);
|
|
15831
14865
|
}
|
|
15832
14866
|
toJSON() {
|
|
15833
14867
|
return {
|
|
15834
14868
|
type: "nodeRange",
|
|
15835
14869
|
anchor: this.anchor,
|
|
15836
|
-
head: this.head
|
|
14870
|
+
head: this.head,
|
|
14871
|
+
depth: this.depth
|
|
15837
14872
|
};
|
|
15838
14873
|
}
|
|
15839
14874
|
get isForwards() {
|
|
@@ -15867,16 +14902,20 @@ var NodeRangeSelection = class _NodeRangeSelection extends Selection {
|
|
|
15867
14902
|
return new _NodeRangeSelection(this.$anchor, $to, this.depth);
|
|
15868
14903
|
}
|
|
15869
14904
|
static fromJSON(doc, json) {
|
|
15870
|
-
return new _NodeRangeSelection(doc.resolve(json.anchor), doc.resolve(json.head));
|
|
14905
|
+
return new _NodeRangeSelection(doc.resolve(json.anchor), doc.resolve(json.head), json.depth);
|
|
15871
14906
|
}
|
|
15872
14907
|
static create(doc, anchor, head, depth, bias = 1) {
|
|
15873
14908
|
return new this(doc.resolve(anchor), doc.resolve(head), depth, bias);
|
|
15874
14909
|
}
|
|
15875
14910
|
getBookmark() {
|
|
15876
|
-
return new NodeRangeBookmark(this.anchor, this.head);
|
|
14911
|
+
return new NodeRangeBookmark(this.anchor, this.head, this.depth);
|
|
15877
14912
|
}
|
|
15878
14913
|
};
|
|
15879
14914
|
NodeRangeSelection.prototype.visible = false;
|
|
14915
|
+
try {
|
|
14916
|
+
Selection.jsonID("nodeRange", NodeRangeSelection);
|
|
14917
|
+
} catch {
|
|
14918
|
+
}
|
|
15880
14919
|
|
|
15881
14920
|
// src/helpers/isNodeRangeSelection.ts
|
|
15882
14921
|
function isNodeRangeSelection(value) {
|
|
@@ -15986,7 +15025,12 @@ Extension.create({
|
|
|
15986
15025
|
if ($anchor.sameParent($head)) {
|
|
15987
15026
|
return;
|
|
15988
15027
|
}
|
|
15989
|
-
const nodeRangeSelection = NodeRangeSelection.create(
|
|
15028
|
+
const nodeRangeSelection = NodeRangeSelection.create(
|
|
15029
|
+
doc,
|
|
15030
|
+
$anchor.pos,
|
|
15031
|
+
$head.pos,
|
|
15032
|
+
this.options.depth
|
|
15033
|
+
);
|
|
15990
15034
|
tr.setSelection(nodeRangeSelection);
|
|
15991
15035
|
view.dispatch(tr);
|
|
15992
15036
|
},
|
|
@@ -16028,20 +15072,26 @@ Extension.create({
|
|
|
16028
15072
|
// src/drag-handle.ts
|
|
16029
15073
|
|
|
16030
15074
|
// src/helpers/cloneElement.ts
|
|
16031
|
-
function getCSSText(element) {
|
|
16032
|
-
let value = "";
|
|
15075
|
+
function getCSSText(element, properties) {
|
|
16033
15076
|
const style = getComputedStyle(element);
|
|
15077
|
+
if (properties) {
|
|
15078
|
+
return properties.map((property) => property.trim()).filter((property) => property.length > 0).map((property) => `${property}:${style.getPropertyValue(property)};`).join("");
|
|
15079
|
+
}
|
|
15080
|
+
let value = "";
|
|
16034
15081
|
for (let i = 0; i < style.length; i += 1) {
|
|
16035
15082
|
value += `${style[i]}:${style.getPropertyValue(style[i])};`;
|
|
16036
15083
|
}
|
|
16037
15084
|
return value;
|
|
16038
15085
|
}
|
|
16039
|
-
function cloneElement(node) {
|
|
15086
|
+
function cloneElement(node, properties) {
|
|
16040
15087
|
const clonedNode = node.cloneNode(true);
|
|
16041
15088
|
const sourceElements = [node, ...Array.from(node.getElementsByTagName("*"))];
|
|
16042
|
-
const targetElements = [
|
|
15089
|
+
const targetElements = [
|
|
15090
|
+
clonedNode,
|
|
15091
|
+
...Array.from(clonedNode.getElementsByTagName("*"))
|
|
15092
|
+
];
|
|
16043
15093
|
sourceElements.forEach((sourceElement, index) => {
|
|
16044
|
-
targetElements[index].style.cssText = getCSSText(sourceElement);
|
|
15094
|
+
targetElements[index].style.cssText = getCSSText(sourceElement, properties);
|
|
16045
15095
|
});
|
|
16046
15096
|
return clonedNode;
|
|
16047
15097
|
}
|
|
@@ -16283,28 +15333,41 @@ function findBestDragTarget(view, coords, options) {
|
|
|
16283
15333
|
|
|
16284
15334
|
// src/helpers/findNextElementFromCursor.ts
|
|
16285
15335
|
function findClosestTopLevelBlock(element, view) {
|
|
15336
|
+
var _a;
|
|
16286
15337
|
let current = element;
|
|
16287
15338
|
while ((current == null ? void 0 : current.parentElement) && current.parentElement !== view.dom) {
|
|
16288
15339
|
current = current.parentElement;
|
|
16289
15340
|
}
|
|
16290
|
-
|
|
15341
|
+
if ((current == null ? void 0 : current.parentElement) !== view.dom) {
|
|
15342
|
+
return void 0;
|
|
15343
|
+
}
|
|
15344
|
+
if (!((_a = current.pmViewDesc) == null ? void 0 : _a.node)) {
|
|
15345
|
+
return void 0;
|
|
15346
|
+
}
|
|
15347
|
+
return current;
|
|
16291
15348
|
}
|
|
16292
15349
|
function isValidRect(rect) {
|
|
16293
15350
|
return Number.isFinite(rect.top) && Number.isFinite(rect.bottom) && Number.isFinite(rect.left) && Number.isFinite(rect.right) && rect.width > 0 && rect.height > 0;
|
|
16294
15351
|
}
|
|
15352
|
+
function edgeBlockRect(container, edge) {
|
|
15353
|
+
let current = edge === "first" ? container.firstElementChild : container.lastElementChild;
|
|
15354
|
+
while (current) {
|
|
15355
|
+
const rect = current.getBoundingClientRect();
|
|
15356
|
+
if (isValidRect(rect)) {
|
|
15357
|
+
return rect;
|
|
15358
|
+
}
|
|
15359
|
+
current = edge === "first" ? current.nextElementSibling : current.previousElementSibling;
|
|
15360
|
+
}
|
|
15361
|
+
return null;
|
|
15362
|
+
}
|
|
16295
15363
|
function clampToContent(view, x, y, inset = 5) {
|
|
16296
15364
|
if (!Number.isFinite(x) || !Number.isFinite(y)) {
|
|
16297
15365
|
return null;
|
|
16298
15366
|
}
|
|
16299
15367
|
const container = view.dom;
|
|
16300
|
-
const
|
|
16301
|
-
const
|
|
16302
|
-
if (!
|
|
16303
|
-
return null;
|
|
16304
|
-
}
|
|
16305
|
-
const topRect = firstBlock.getBoundingClientRect();
|
|
16306
|
-
const botRect = lastBlock.getBoundingClientRect();
|
|
16307
|
-
if (!isValidRect(topRect) || !isValidRect(botRect)) {
|
|
15368
|
+
const topRect = edgeBlockRect(container, "first");
|
|
15369
|
+
const botRect = edgeBlockRect(container, "last");
|
|
15370
|
+
if (!topRect || !botRect) {
|
|
16308
15371
|
return null;
|
|
16309
15372
|
}
|
|
16310
15373
|
const clampedY = Math.min(Math.max(topRect.top + inset, y), botRect.bottom - inset);
|
|
@@ -16429,6 +15492,15 @@ function removeNode(node) {
|
|
|
16429
15492
|
function getDragImageOffset(direction, wrapperWidth) {
|
|
16430
15493
|
return direction === "rtl" ? wrapperWidth : 0;
|
|
16431
15494
|
}
|
|
15495
|
+
function shouldResetMargin(dragImageProperties) {
|
|
15496
|
+
if (!dragImageProperties) {
|
|
15497
|
+
return true;
|
|
15498
|
+
}
|
|
15499
|
+
return !dragImageProperties.some((property) => {
|
|
15500
|
+
const p = property.trim().toLowerCase();
|
|
15501
|
+
return p === "margin" || p.startsWith("margin-");
|
|
15502
|
+
});
|
|
15503
|
+
}
|
|
16432
15504
|
function getDragHandleRanges(event, editor, nestedOptions, dragContext) {
|
|
16433
15505
|
const { doc } = editor.view.state;
|
|
16434
15506
|
if ((nestedOptions == null ? void 0 : nestedOptions.enabled) && (dragContext == null ? void 0 : dragContext.node) && dragContext.pos >= 0) {
|
|
@@ -16455,7 +15527,7 @@ function getDragHandleRanges(event, editor, nestedOptions, dragContext) {
|
|
|
16455
15527
|
const $to = doc.resolve(result.pos + result.resultNode.nodeSize + offset);
|
|
16456
15528
|
return getSelectionRanges($from, $to, 0, { extendOnBoundaryOverlap: false });
|
|
16457
15529
|
}
|
|
16458
|
-
function dragHandler(event, editor, nestedOptions, dragContext) {
|
|
15530
|
+
function dragHandler(event, editor, nestedOptions, dragContext, dragImageProperties) {
|
|
16459
15531
|
const { view } = editor;
|
|
16460
15532
|
if (!event.dataTransfer) {
|
|
16461
15533
|
return;
|
|
@@ -16479,22 +15551,26 @@ function dragHandler(event, editor, nestedOptions, dragContext) {
|
|
|
16479
15551
|
const direction = getDraggedBlockDir(view, from);
|
|
16480
15552
|
wrapper.setAttribute("dir", direction);
|
|
16481
15553
|
const isNestedDrag = (nestedOptions == null ? void 0 : nestedOptions.enabled) && (dragContext == null ? void 0 : dragContext.node);
|
|
15554
|
+
const isSingleBlock = ranges.length === 1;
|
|
16482
15555
|
let slice;
|
|
16483
15556
|
let selection;
|
|
16484
|
-
if (isNestedDrag) {
|
|
15557
|
+
if (isNestedDrag && isSingleBlock) {
|
|
16485
15558
|
slice = view.state.doc.slice(from, to);
|
|
16486
15559
|
selection = NodeSelection.create(view.state.doc, from);
|
|
16487
15560
|
} else {
|
|
16488
15561
|
selection = NodeRangeSelection.create(view.state.doc, from, to);
|
|
16489
15562
|
slice = selection.content();
|
|
16490
15563
|
}
|
|
15564
|
+
const resetMargin = shouldResetMargin(dragImageProperties);
|
|
16491
15565
|
ranges.forEach((range) => {
|
|
16492
15566
|
const element = getDraggedBlockElement(view, range.$from.pos);
|
|
16493
15567
|
if (!element) {
|
|
16494
15568
|
return;
|
|
16495
15569
|
}
|
|
16496
|
-
const clonedElement = cloneElement(element);
|
|
16497
|
-
|
|
15570
|
+
const clonedElement = cloneElement(element, dragImageProperties);
|
|
15571
|
+
if (resetMargin) {
|
|
15572
|
+
clonedElement.style.margin = "0";
|
|
15573
|
+
}
|
|
16498
15574
|
wrapper.append(clonedElement);
|
|
16499
15575
|
});
|
|
16500
15576
|
wrapper.style.position = "absolute";
|
|
@@ -16546,6 +15622,74 @@ var getOuterNode = (doc, pos) => {
|
|
|
16546
15622
|
}
|
|
16547
15623
|
return parent;
|
|
16548
15624
|
};
|
|
15625
|
+
function mapPendingRestoreAnchor(pendingRestore, tr, options) {
|
|
15626
|
+
if (!tr.docChanged) {
|
|
15627
|
+
return pendingRestore;
|
|
15628
|
+
}
|
|
15629
|
+
if (options.isChangeOrigin && pendingRestore.relativeAnchorPos != null) {
|
|
15630
|
+
const newPos = options.getAbsolutePos(pendingRestore.relativeAnchorPos);
|
|
15631
|
+
if (!Number.isFinite(newPos) || newPos <= 0) {
|
|
15632
|
+
return null;
|
|
15633
|
+
}
|
|
15634
|
+
return {
|
|
15635
|
+
...pendingRestore,
|
|
15636
|
+
anchorPos: newPos
|
|
15637
|
+
};
|
|
15638
|
+
}
|
|
15639
|
+
const mappedResult = tr.mapping.mapResult(pendingRestore.anchorPos, 1);
|
|
15640
|
+
if (mappedResult.deleted) {
|
|
15641
|
+
return null;
|
|
15642
|
+
}
|
|
15643
|
+
return {
|
|
15644
|
+
...pendingRestore,
|
|
15645
|
+
anchorPos: mappedResult.pos
|
|
15646
|
+
};
|
|
15647
|
+
}
|
|
15648
|
+
function sumNodeSizes(parent, from, to) {
|
|
15649
|
+
let size = 0;
|
|
15650
|
+
for (let i = from; i < to; i += 1) {
|
|
15651
|
+
size += parent.child(i).nodeSize;
|
|
15652
|
+
}
|
|
15653
|
+
return size;
|
|
15654
|
+
}
|
|
15655
|
+
function getActiveDragRange(selection) {
|
|
15656
|
+
var _a;
|
|
15657
|
+
if (!isNodeRangeSelection(selection)) {
|
|
15658
|
+
return null;
|
|
15659
|
+
}
|
|
15660
|
+
return {
|
|
15661
|
+
anchorPos: selection.from,
|
|
15662
|
+
nodeCount: selection.ranges.length,
|
|
15663
|
+
depth: (_a = selection.depth) != null ? _a : 0
|
|
15664
|
+
};
|
|
15665
|
+
}
|
|
15666
|
+
function getDroppedBlockRange(doc, anchorPos, nodeCount, depth) {
|
|
15667
|
+
const $pos = doc.resolve(anchorPos);
|
|
15668
|
+
const parent = $pos.node(depth);
|
|
15669
|
+
let index = $pos.index(depth);
|
|
15670
|
+
if (index >= parent.childCount) {
|
|
15671
|
+
index = Math.max(0, parent.childCount - nodeCount);
|
|
15672
|
+
}
|
|
15673
|
+
const count = Math.min(nodeCount, parent.childCount - index);
|
|
15674
|
+
if (count <= 0) {
|
|
15675
|
+
return null;
|
|
15676
|
+
}
|
|
15677
|
+
const blockStart = $pos.start(depth) + sumNodeSizes(parent, 0, index);
|
|
15678
|
+
const blockEnd = blockStart + sumNodeSizes(parent, index, index + count);
|
|
15679
|
+
return { anchor: blockStart, head: blockEnd, count };
|
|
15680
|
+
}
|
|
15681
|
+
function createDroppedNodeRangeSelection(doc, anchorPos, nodeCount, depth) {
|
|
15682
|
+
try {
|
|
15683
|
+
const range = getDroppedBlockRange(doc, anchorPos, nodeCount, depth);
|
|
15684
|
+
if (!range) {
|
|
15685
|
+
return null;
|
|
15686
|
+
}
|
|
15687
|
+
const selection = NodeRangeSelection.create(doc, range.anchor, range.head, depth);
|
|
15688
|
+
return selection.ranges.length === nodeCount ? selection : null;
|
|
15689
|
+
} catch {
|
|
15690
|
+
return null;
|
|
15691
|
+
}
|
|
15692
|
+
}
|
|
16549
15693
|
|
|
16550
15694
|
// src/drag-handle-plugin.ts
|
|
16551
15695
|
var getRelativePos = (state, absolutePos) => {
|
|
@@ -16560,7 +15704,12 @@ var getAbsolutePos = (state, relativePos) => {
|
|
|
16560
15704
|
if (!ystate) {
|
|
16561
15705
|
return -1;
|
|
16562
15706
|
}
|
|
16563
|
-
return relativePositionToAbsolutePosition(
|
|
15707
|
+
return relativePositionToAbsolutePosition(
|
|
15708
|
+
ystate.doc,
|
|
15709
|
+
ystate.type,
|
|
15710
|
+
relativePos,
|
|
15711
|
+
ystate.binding.mapping
|
|
15712
|
+
) || 0;
|
|
16564
15713
|
};
|
|
16565
15714
|
var getOuterDomNode = (view, domNode) => {
|
|
16566
15715
|
let tmpDomNode = domNode;
|
|
@@ -16582,7 +15731,8 @@ var DragHandlePlugin = ({
|
|
|
16582
15731
|
onNodeChange,
|
|
16583
15732
|
onElementDragStart,
|
|
16584
15733
|
onElementDragEnd,
|
|
16585
|
-
nestedOptions
|
|
15734
|
+
nestedOptions,
|
|
15735
|
+
dragImageProperties
|
|
16586
15736
|
}) => {
|
|
16587
15737
|
const wrapper = document.createElement("div");
|
|
16588
15738
|
let locked = false;
|
|
@@ -16591,6 +15741,39 @@ var DragHandlePlugin = ({
|
|
|
16591
15741
|
let currentNodeRelPos;
|
|
16592
15742
|
let rafId = null;
|
|
16593
15743
|
let pendingMouseCoords = null;
|
|
15744
|
+
let activeDragRange = null;
|
|
15745
|
+
let pendingRestore = null;
|
|
15746
|
+
function clearDragRangeState() {
|
|
15747
|
+
activeDragRange = null;
|
|
15748
|
+
pendingRestore = null;
|
|
15749
|
+
}
|
|
15750
|
+
function remapPendingRestore(tr, state) {
|
|
15751
|
+
if (!pendingRestore) {
|
|
15752
|
+
return;
|
|
15753
|
+
}
|
|
15754
|
+
pendingRestore = mapPendingRestoreAnchor(pendingRestore, tr, {
|
|
15755
|
+
isChangeOrigin: isChangeOrigin(tr),
|
|
15756
|
+
getAbsolutePos: (relativePos) => getAbsolutePos(state, relativePos)
|
|
15757
|
+
});
|
|
15758
|
+
}
|
|
15759
|
+
function buildRestoreTransaction(state) {
|
|
15760
|
+
if (!pendingRestore) {
|
|
15761
|
+
return null;
|
|
15762
|
+
}
|
|
15763
|
+
const nodeRangeSelection = createDroppedNodeRangeSelection(
|
|
15764
|
+
state.doc,
|
|
15765
|
+
pendingRestore.anchorPos,
|
|
15766
|
+
pendingRestore.nodeCount,
|
|
15767
|
+
pendingRestore.depth
|
|
15768
|
+
);
|
|
15769
|
+
if (!nodeRangeSelection) {
|
|
15770
|
+
pendingRestore = null;
|
|
15771
|
+
activeDragRange = null;
|
|
15772
|
+
return null;
|
|
15773
|
+
}
|
|
15774
|
+
clearDragRangeState();
|
|
15775
|
+
return state.tr.setSelection(nodeRangeSelection);
|
|
15776
|
+
}
|
|
16594
15777
|
function hideHandle() {
|
|
16595
15778
|
if (!element) {
|
|
16596
15779
|
return;
|
|
@@ -16623,7 +15806,14 @@ var DragHandlePlugin = ({
|
|
|
16623
15806
|
}
|
|
16624
15807
|
function onDragStart(e) {
|
|
16625
15808
|
onElementDragStart == null ? void 0 : onElementDragStart(e);
|
|
16626
|
-
dragHandler(
|
|
15809
|
+
dragHandler(
|
|
15810
|
+
e,
|
|
15811
|
+
editor,
|
|
15812
|
+
nestedOptions,
|
|
15813
|
+
{ node: currentNode, pos: currentNodePos },
|
|
15814
|
+
dragImageProperties
|
|
15815
|
+
);
|
|
15816
|
+
activeDragRange = getActiveDragRange(editor.state.selection);
|
|
16627
15817
|
if (element) {
|
|
16628
15818
|
element.dataset.dragging = "true";
|
|
16629
15819
|
}
|
|
@@ -16635,13 +15825,17 @@ var DragHandlePlugin = ({
|
|
|
16635
15825
|
}
|
|
16636
15826
|
function onDragEnd(e) {
|
|
16637
15827
|
onElementDragEnd == null ? void 0 : onElementDragEnd(e);
|
|
15828
|
+
activeDragRange = null;
|
|
16638
15829
|
hideHandle();
|
|
16639
15830
|
if (element) {
|
|
16640
15831
|
element.style.pointerEvents = "auto";
|
|
16641
15832
|
element.dataset.dragging = "false";
|
|
16642
15833
|
}
|
|
16643
15834
|
}
|
|
16644
|
-
function onDrop() {
|
|
15835
|
+
function onDrop(e) {
|
|
15836
|
+
if (!e.target || !editor.view.dom.contains(e.target)) {
|
|
15837
|
+
return;
|
|
15838
|
+
}
|
|
16645
15839
|
if (isFirefox()) {
|
|
16646
15840
|
const editorElement = editor.view.dom;
|
|
16647
15841
|
requestAnimationFrame(() => {
|
|
@@ -16651,18 +15845,33 @@ var DragHandlePlugin = ({
|
|
|
16651
15845
|
}
|
|
16652
15846
|
});
|
|
16653
15847
|
}
|
|
15848
|
+
if (!activeDragRange || editor.view.state.selection.empty) {
|
|
15849
|
+
return;
|
|
15850
|
+
}
|
|
15851
|
+
const anchorPos = editor.state.selection.from;
|
|
15852
|
+
const relativeAnchorPos = getRelativePos(editor.state, anchorPos);
|
|
15853
|
+
pendingRestore = {
|
|
15854
|
+
...activeDragRange,
|
|
15855
|
+
anchorPos,
|
|
15856
|
+
relativeAnchorPos: relativeAnchorPos != null ? relativeAnchorPos : void 0
|
|
15857
|
+
};
|
|
15858
|
+
editor.view.dispatch(editor.state.tr.setMeta("addToHistory", false));
|
|
15859
|
+
}
|
|
15860
|
+
function cleanup() {
|
|
15861
|
+
element.removeEventListener("dragstart", onDragStart);
|
|
15862
|
+
element.removeEventListener("dragend", onDragEnd);
|
|
15863
|
+
document.removeEventListener("drop", onDrop);
|
|
15864
|
+
if (rafId) {
|
|
15865
|
+
cancelAnimationFrame(rafId);
|
|
15866
|
+
rafId = null;
|
|
15867
|
+
pendingMouseCoords = null;
|
|
15868
|
+
}
|
|
15869
|
+
clearDragRangeState();
|
|
16654
15870
|
}
|
|
16655
15871
|
wrapper.appendChild(element);
|
|
16656
15872
|
return {
|
|
16657
15873
|
unbind() {
|
|
16658
|
-
|
|
16659
|
-
element.removeEventListener("dragend", onDragEnd);
|
|
16660
|
-
document.removeEventListener("drop", onDrop);
|
|
16661
|
-
if (rafId) {
|
|
16662
|
-
cancelAnimationFrame(rafId);
|
|
16663
|
-
rafId = null;
|
|
16664
|
-
pendingMouseCoords = null;
|
|
16665
|
-
}
|
|
15874
|
+
cleanup();
|
|
16666
15875
|
},
|
|
16667
15876
|
plugin: new Plugin({
|
|
16668
15877
|
key: typeof pluginKey === "string" ? new PluginKey(pluginKey) : pluginKey,
|
|
@@ -16671,6 +15880,7 @@ var DragHandlePlugin = ({
|
|
|
16671
15880
|
return { locked: false };
|
|
16672
15881
|
},
|
|
16673
15882
|
apply(tr, value, _oldState, state) {
|
|
15883
|
+
remapPendingRestore(tr, state);
|
|
16674
15884
|
const isLocked = tr.getMeta("lockDragHandle");
|
|
16675
15885
|
const hideDragHandle = tr.getMeta("hideDragHandle");
|
|
16676
15886
|
if (isLocked !== void 0) {
|
|
@@ -16701,6 +15911,9 @@ var DragHandlePlugin = ({
|
|
|
16701
15911
|
return value;
|
|
16702
15912
|
}
|
|
16703
15913
|
},
|
|
15914
|
+
appendTransaction(_transactions, _oldState, newState) {
|
|
15915
|
+
return buildRestoreTransaction(newState);
|
|
15916
|
+
},
|
|
16704
15917
|
view: (view) => {
|
|
16705
15918
|
var _a;
|
|
16706
15919
|
element.draggable = true;
|
|
@@ -16711,6 +15924,7 @@ var DragHandlePlugin = ({
|
|
|
16711
15924
|
wrapper.style.position = "absolute";
|
|
16712
15925
|
wrapper.style.top = "0";
|
|
16713
15926
|
wrapper.style.left = "0";
|
|
15927
|
+
wrapper.style.zIndex = "10";
|
|
16714
15928
|
element.addEventListener("dragstart", onDragStart);
|
|
16715
15929
|
element.addEventListener("dragend", onDragEnd);
|
|
16716
15930
|
document.addEventListener("drop", onDrop);
|
|
@@ -16750,14 +15964,7 @@ var DragHandlePlugin = ({
|
|
|
16750
15964
|
},
|
|
16751
15965
|
// TODO: Kills even on hot reload
|
|
16752
15966
|
destroy() {
|
|
16753
|
-
|
|
16754
|
-
element.removeEventListener("dragend", onDragEnd);
|
|
16755
|
-
document.removeEventListener("drop", onDrop);
|
|
16756
|
-
if (rafId) {
|
|
16757
|
-
cancelAnimationFrame(rafId);
|
|
16758
|
-
rafId = null;
|
|
16759
|
-
pendingMouseCoords = null;
|
|
16760
|
-
}
|
|
15967
|
+
cleanup();
|
|
16761
15968
|
if (element) {
|
|
16762
15969
|
removeNode(wrapper);
|
|
16763
15970
|
}
|
|
@@ -16898,7 +16105,8 @@ Extension.create({
|
|
|
16898
16105
|
},
|
|
16899
16106
|
onElementDragStart: void 0,
|
|
16900
16107
|
onElementDragEnd: void 0,
|
|
16901
|
-
nested: false
|
|
16108
|
+
nested: false,
|
|
16109
|
+
dragImageProperties: void 0
|
|
16902
16110
|
};
|
|
16903
16111
|
},
|
|
16904
16112
|
addCommands() {
|
|
@@ -16922,14 +16130,18 @@ Extension.create({
|
|
|
16922
16130
|
const nestedOptions = normalizeNestedOptions(this.options.nested);
|
|
16923
16131
|
return [
|
|
16924
16132
|
DragHandlePlugin({
|
|
16925
|
-
computePositionConfig: {
|
|
16133
|
+
computePositionConfig: {
|
|
16134
|
+
...defaultComputePositionConfig,
|
|
16135
|
+
...this.options.computePositionConfig
|
|
16136
|
+
},
|
|
16926
16137
|
getReferencedVirtualElement: this.options.getReferencedVirtualElement,
|
|
16927
16138
|
element,
|
|
16928
16139
|
editor: this.editor,
|
|
16929
16140
|
onNodeChange: this.options.onNodeChange,
|
|
16930
16141
|
onElementDragStart: this.options.onElementDragStart,
|
|
16931
16142
|
onElementDragEnd: this.options.onElementDragEnd,
|
|
16932
|
-
nestedOptions
|
|
16143
|
+
nestedOptions,
|
|
16144
|
+
dragImageProperties: this.options.dragImageProperties
|
|
16933
16145
|
}).plugin
|
|
16934
16146
|
];
|
|
16935
16147
|
}
|
|
@@ -16945,70 +16157,73 @@ var DragHandle = (props) => {
|
|
|
16945
16157
|
onNodeChange,
|
|
16946
16158
|
onElementDragStart,
|
|
16947
16159
|
onElementDragEnd,
|
|
16160
|
+
getReferencedVirtualElement,
|
|
16948
16161
|
computePositionConfig = defaultComputePositionConfig,
|
|
16949
16162
|
nested = false
|
|
16950
16163
|
} = props;
|
|
16951
|
-
const
|
|
16952
|
-
|
|
16164
|
+
const elementRef = useRef(null);
|
|
16165
|
+
if (elementRef.current === null && typeof document !== "undefined") {
|
|
16166
|
+
elementRef.current = document.createElement("div");
|
|
16167
|
+
}
|
|
16953
16168
|
const nestedOptions = useMemo(() => normalizeNestedOptions(nested), [JSON.stringify(nested)]);
|
|
16954
16169
|
useEffect(() => {
|
|
16955
|
-
|
|
16956
|
-
if (!
|
|
16957
|
-
return
|
|
16958
|
-
|
|
16959
|
-
|
|
16170
|
+
const element2 = elementRef.current;
|
|
16171
|
+
if (!element2) {
|
|
16172
|
+
return;
|
|
16173
|
+
}
|
|
16174
|
+
element2.className = className;
|
|
16175
|
+
}, [className]);
|
|
16176
|
+
useEffect(() => {
|
|
16177
|
+
if (typeof document === "undefined") {
|
|
16178
|
+
return;
|
|
16960
16179
|
}
|
|
16961
16180
|
if (editor.isDestroyed) {
|
|
16962
|
-
return
|
|
16963
|
-
plugin.current = null;
|
|
16964
|
-
};
|
|
16181
|
+
return;
|
|
16965
16182
|
}
|
|
16966
|
-
|
|
16967
|
-
|
|
16968
|
-
|
|
16969
|
-
element,
|
|
16970
|
-
pluginKey,
|
|
16971
|
-
computePositionConfig: {
|
|
16972
|
-
...defaultComputePositionConfig,
|
|
16973
|
-
...computePositionConfig
|
|
16974
|
-
},
|
|
16975
|
-
onElementDragStart,
|
|
16976
|
-
onElementDragEnd,
|
|
16977
|
-
onNodeChange,
|
|
16978
|
-
nestedOptions
|
|
16979
|
-
});
|
|
16980
|
-
plugin.current = initPlugin.plugin;
|
|
16981
|
-
editor.registerPlugin(plugin.current);
|
|
16183
|
+
const element2 = elementRef.current;
|
|
16184
|
+
if (!element2) {
|
|
16185
|
+
return;
|
|
16982
16186
|
}
|
|
16187
|
+
element2.style.visibility = "hidden";
|
|
16188
|
+
element2.style.position = "absolute";
|
|
16189
|
+
element2.dataset.dragging = "false";
|
|
16190
|
+
const { plugin, unbind } = DragHandlePlugin({
|
|
16191
|
+
editor,
|
|
16192
|
+
element: element2,
|
|
16193
|
+
pluginKey,
|
|
16194
|
+
computePositionConfig: {
|
|
16195
|
+
...defaultComputePositionConfig,
|
|
16196
|
+
...computePositionConfig
|
|
16197
|
+
},
|
|
16198
|
+
onElementDragStart,
|
|
16199
|
+
onElementDragEnd,
|
|
16200
|
+
onNodeChange,
|
|
16201
|
+
getReferencedVirtualElement,
|
|
16202
|
+
nestedOptions
|
|
16203
|
+
});
|
|
16204
|
+
editor.registerPlugin(plugin);
|
|
16983
16205
|
return () => {
|
|
16984
|
-
editor.
|
|
16985
|
-
|
|
16986
|
-
if (initPlugin) {
|
|
16987
|
-
initPlugin.unbind();
|
|
16988
|
-
initPlugin = null;
|
|
16206
|
+
if (!editor.isDestroyed) {
|
|
16207
|
+
editor.unregisterPlugin(pluginKey);
|
|
16989
16208
|
}
|
|
16209
|
+
unbind();
|
|
16990
16210
|
};
|
|
16991
16211
|
}, [
|
|
16992
|
-
element,
|
|
16993
16212
|
editor,
|
|
16994
16213
|
onNodeChange,
|
|
16214
|
+
getReferencedVirtualElement,
|
|
16995
16215
|
pluginKey,
|
|
16996
16216
|
computePositionConfig,
|
|
16997
16217
|
onElementDragStart,
|
|
16998
16218
|
onElementDragEnd,
|
|
16999
16219
|
nestedOptions
|
|
17000
16220
|
]);
|
|
17001
|
-
|
|
17002
|
-
|
|
17003
|
-
|
|
17004
|
-
|
|
17005
|
-
|
|
17006
|
-
"data-dragging": "false",
|
|
17007
|
-
ref: setElement,
|
|
17008
|
-
children
|
|
17009
|
-
}
|
|
17010
|
-
);
|
|
16221
|
+
const element = elementRef.current;
|
|
16222
|
+
if (!element) {
|
|
16223
|
+
return null;
|
|
16224
|
+
}
|
|
16225
|
+
return createPortal(children, element);
|
|
17011
16226
|
};
|
|
17012
16227
|
|
|
17013
16228
|
export { DragHandle };
|
|
17014
|
-
//# sourceMappingURL=index-
|
|
16229
|
+
//# sourceMappingURL=index-B7BIlotN.js.map
|