@milkdown/crepe 7.4.0 → 7.5.1
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/lib/cjs/clsx-dASsG01A.js +6 -0
- package/lib/cjs/clsx-dASsG01A.js.map +1 -0
- package/lib/cjs/{index-5PcT4iSf.js → index--2zEz40J.js} +8 -22
- package/lib/cjs/{index-5PcT4iSf.js.map → index--2zEz40J.js.map} +1 -1
- package/lib/cjs/{index-lrFGGa_l.js → index-5n9R-QCl.js} +5 -19
- package/lib/cjs/{index-lrFGGa_l.js.map → index-5n9R-QCl.js.map} +1 -1
- package/lib/cjs/{index-SxWWV8XD.js → index-HEdBw63r.js} +8 -22
- package/lib/cjs/{index-SxWWV8XD.js.map → index-HEdBw63r.js.map} +1 -1
- package/lib/cjs/{index-vlxA_KJ8.js → index-Hlt9dRH5.js} +5 -19
- package/lib/cjs/{index-vlxA_KJ8.js.map → index-Hlt9dRH5.js.map} +1 -1
- package/lib/cjs/{index-TEjdwq--.js → index-KCW2CzRk.js} +8 -22
- package/lib/{esm/index-DoEghZHy.js.map → cjs/index-KCW2CzRk.js.map} +1 -1
- package/lib/cjs/{index-qRg5-QJH.js → index-KSZhahYb.js} +6 -20
- package/lib/cjs/{index-qRg5-QJH.js.map → index-KSZhahYb.js.map} +1 -1
- package/lib/cjs/index-N1cRxqdw.js +39 -0
- package/lib/cjs/index-N1cRxqdw.js.map +1 -0
- package/lib/cjs/{index-fkT0ywfA.js → index-NNo_VSEA.js} +5 -19
- package/lib/cjs/{index-fkT0ywfA.js.map → index-NNo_VSEA.js.map} +1 -1
- package/lib/cjs/{index-OtaMLv5l.js → index-O1bDbloo.js} +5 -19
- package/lib/cjs/{index-OtaMLv5l.js.map → index-O1bDbloo.js.map} +1 -1
- package/lib/cjs/{index-mJ47ZWO2.js → index-OPh9naof.js} +8 -22
- package/lib/cjs/{index-mJ47ZWO2.js.map → index-OPh9naof.js.map} +1 -1
- package/lib/cjs/{index-OA_u95ey.js → index-PAhfZtcH.js} +5 -19
- package/lib/cjs/{index-OA_u95ey.js.map → index-PAhfZtcH.js.map} +1 -1
- package/lib/cjs/{index-zBr61zy6.js → index-PeRHVz4A.js} +5 -19
- package/lib/{esm/index-6P9Xk934.js.map → cjs/index-PeRHVz4A.js.map} +1 -1
- package/lib/cjs/{index-llNS_EuP.js → index-U7GWrg-w.js} +26 -470
- package/lib/cjs/index-U7GWrg-w.js.map +1 -0
- package/lib/cjs/{index-wXLifZgm.js → index-UTb0Az5e.js} +2 -2
- package/lib/cjs/{index-wXLifZgm.js.map → index-UTb0Az5e.js.map} +1 -1
- package/lib/cjs/{index-t_GA5F26.js → index-UnEAyH8X.js} +5 -19
- package/lib/cjs/{index-t_GA5F26.js.map → index-UnEAyH8X.js.map} +1 -1
- package/lib/cjs/{index-i0_v2uVp.js → index-VCkq0ru1.js} +5 -19
- package/lib/{esm/index-4QzlLVWs.js.map → cjs/index-VCkq0ru1.js.map} +1 -1
- package/lib/cjs/{index-OIQn1x0L.js → index-WQl7Du53.js} +4 -18
- package/lib/cjs/index-WQl7Du53.js.map +1 -0
- package/lib/cjs/{index-GEIgbcVc.js → index-ahL5MvrQ.js} +28 -42
- package/lib/cjs/{index-GEIgbcVc.js.map → index-ahL5MvrQ.js.map} +1 -1
- package/lib/cjs/{index-tbEq3xma.js → index-bpgWLeRY.js} +5 -19
- package/lib/cjs/{index-tbEq3xma.js.map → index-bpgWLeRY.js.map} +1 -1
- package/lib/cjs/index-dEVmN_aj.js +26 -0
- package/lib/cjs/index-dEVmN_aj.js.map +1 -0
- package/lib/cjs/{index-w9buMrFW.js → index-fZupvR_f.js} +8 -22
- package/lib/{esm/index-hQaRWeq1.js.map → cjs/index-fZupvR_f.js.map} +1 -1
- package/lib/cjs/{index-ortUqbAp.js → index-gSM-jgti.js} +5 -19
- package/lib/{esm/index-oMy83ynO.js.map → cjs/index-gSM-jgti.js.map} +1 -1
- package/lib/cjs/{index-LdEYPSZc.js → index-jlPr_A_N.js} +5 -19
- package/lib/cjs/{index-LdEYPSZc.js.map → index-jlPr_A_N.js.map} +1 -1
- package/lib/cjs/index-ocxd4A-M.js +675 -0
- package/lib/cjs/index-ocxd4A-M.js.map +1 -0
- package/lib/cjs/{index-xqKfEyRA.js → index-rFFAL9YA.js} +14 -17
- package/lib/cjs/index-rFFAL9YA.js.map +1 -0
- package/lib/cjs/index-tlx25I_m.js +36 -0
- package/lib/cjs/index-tlx25I_m.js.map +1 -0
- package/lib/cjs/index-tqAbVyds.js +28 -0
- package/lib/cjs/index-tqAbVyds.js.map +1 -0
- package/lib/cjs/index-udZSknd8.js +167 -0
- package/lib/cjs/index-udZSknd8.js.map +1 -0
- package/lib/cjs/index-uleaJDBC.js +19 -0
- package/lib/cjs/index-uleaJDBC.js.map +1 -0
- package/lib/cjs/{index-de3dfsQr.js → index-urB-WDqA.js} +7 -21
- package/lib/cjs/{index-de3dfsQr.js.map → index-urB-WDqA.js.map} +1 -1
- package/lib/cjs/{index-78P4PeZ9.js → index-xWgWtxUR.js} +6 -20
- package/lib/cjs/{index-78P4PeZ9.js.map → index-xWgWtxUR.js.map} +1 -1
- package/lib/cjs/index-z6pe2alg.js.map +1 -1
- package/lib/cjs/index.js +150 -13
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/todoList-YYRQo7wG.js +404 -0
- package/lib/cjs/todoList-YYRQo7wG.js.map +1 -0
- package/lib/esm/clsx-RxCLxYpD.js +4 -0
- package/lib/esm/clsx-RxCLxYpD.js.map +1 -0
- package/lib/esm/{index-a-SAfeeT.js → index-1NetiFdJ.js} +8 -22
- package/lib/esm/{index-a-SAfeeT.js.map → index-1NetiFdJ.js.map} +1 -1
- package/lib/esm/{index-NmjiRA0M.js → index-2I_xbjAZ.js} +28 -42
- package/lib/esm/{index-NmjiRA0M.js.map → index-2I_xbjAZ.js.map} +1 -1
- package/lib/esm/{index-Grquo08f.js → index-2huXYfuJ.js} +8 -22
- package/lib/esm/{index-Grquo08f.js.map → index-2huXYfuJ.js.map} +1 -1
- package/lib/esm/{index-U8q-F7hU.js → index-4x6_TVZv.js} +5 -19
- package/lib/esm/{index-U8q-F7hU.js.map → index-4x6_TVZv.js.map} +1 -1
- package/lib/esm/index-6JoGWH2I.js +17 -0
- package/lib/esm/index-6JoGWH2I.js.map +1 -0
- package/lib/esm/{index-x-zW6gKj.js → index-A-dNwMMf.js} +2 -2
- package/lib/esm/{index-x-zW6gKj.js.map → index-A-dNwMMf.js.map} +1 -1
- package/lib/esm/{index-oMy83ynO.js → index-AV99ipmP.js} +5 -19
- package/lib/{cjs/index-ortUqbAp.js.map → esm/index-AV99ipmP.js.map} +1 -1
- package/lib/esm/{index-VyZguCIt.js → index-CMGDOz11.js} +10 -13
- package/lib/esm/index-CMGDOz11.js.map +1 -0
- package/lib/esm/index-HlPKwzLC.js +34 -0
- package/lib/esm/index-HlPKwzLC.js.map +1 -0
- package/lib/esm/index-Jvxff1vU.js.map +1 -1
- package/lib/esm/{index-vwrMVELn.js → index-PC2bahtq.js} +5 -19
- package/lib/esm/{index-vwrMVELn.js.map → index-PC2bahtq.js.map} +1 -1
- package/lib/esm/{index-UBeneu17.js → index-QBYz82jZ.js} +5 -19
- package/lib/esm/{index-UBeneu17.js.map → index-QBYz82jZ.js.map} +1 -1
- package/lib/esm/{index-bsED907r.js → index-W1pAMr_8.js} +6 -20
- package/lib/esm/{index-bsED907r.js.map → index-W1pAMr_8.js.map} +1 -1
- package/lib/esm/{index-q-qE7-96.js → index-Xzdc2jbA.js} +25 -469
- package/lib/esm/index-Xzdc2jbA.js.map +1 -0
- package/lib/esm/{index-A9zdyi2L.js → index-ZAtZWqJQ.js} +5 -19
- package/lib/esm/{index-A9zdyi2L.js.map → index-ZAtZWqJQ.js.map} +1 -1
- package/lib/esm/index-_A9vu1ED.js +673 -0
- package/lib/esm/index-_A9vu1ED.js.map +1 -0
- package/lib/esm/{index-U71v7KdA.js → index-bnSKBrbD.js} +5 -19
- package/lib/esm/{index-U71v7KdA.js.map → index-bnSKBrbD.js.map} +1 -1
- package/lib/esm/index-fVrfHXda.js +24 -0
- package/lib/esm/index-fVrfHXda.js.map +1 -0
- package/lib/esm/{index-PkBZpDL4.js → index-ftnOhuRS.js} +4 -18
- package/lib/esm/index-ftnOhuRS.js.map +1 -0
- package/lib/esm/{index-4oMdufW4.js → index-iQPB0Rdl.js} +6 -20
- package/lib/esm/{index-4oMdufW4.js.map → index-iQPB0Rdl.js.map} +1 -1
- package/lib/esm/{index-0khVa44f.js → index-kPj3-TKp.js} +5 -19
- package/lib/esm/{index-0khVa44f.js.map → index-kPj3-TKp.js.map} +1 -1
- package/lib/esm/{index-hQaRWeq1.js → index-kgOR7SZ6.js} +8 -22
- package/lib/{cjs/index-w9buMrFW.js.map → esm/index-kgOR7SZ6.js.map} +1 -1
- package/lib/esm/index-lm00PM0y.js +165 -0
- package/lib/esm/index-lm00PM0y.js.map +1 -0
- package/lib/esm/{index-4QzlLVWs.js → index-m49Bj3q7.js} +5 -19
- package/lib/{cjs/index-i0_v2uVp.js.map → esm/index-m49Bj3q7.js.map} +1 -1
- package/lib/esm/index-ohmbt6Ys.js +37 -0
- package/lib/esm/index-ohmbt6Ys.js.map +1 -0
- package/lib/esm/{index-DoEghZHy.js → index-sWVjGw-3.js} +8 -22
- package/lib/esm/index-sWVjGw-3.js.map +1 -0
- package/lib/esm/{index-L7VXk-jT.js → index-twh8lL5o.js} +5 -19
- package/lib/esm/{index-L7VXk-jT.js.map → index-twh8lL5o.js.map} +1 -1
- package/lib/esm/{index-6P9Xk934.js → index-v02MCz4_.js} +5 -19
- package/lib/{cjs/index-zBr61zy6.js.map → esm/index-v02MCz4_.js.map} +1 -1
- package/lib/esm/index-v3rvbocl.js +26 -0
- package/lib/esm/index-v3rvbocl.js.map +1 -0
- package/lib/esm/{index-7BVeXLQZ.js → index-wEXT8mbN.js} +5 -19
- package/lib/esm/{index-7BVeXLQZ.js.map → index-wEXT8mbN.js.map} +1 -1
- package/lib/esm/{index-rwcSpYkt.js → index-wFIac5Kw.js} +7 -21
- package/lib/esm/{index-rwcSpYkt.js.map → index-wFIac5Kw.js.map} +1 -1
- package/lib/esm/{index-bVubJ6Rv.js → index-wg94ewRo.js} +8 -22
- package/lib/esm/{index-bVubJ6Rv.js.map → index-wg94ewRo.js.map} +1 -1
- package/lib/esm/index.js +152 -11
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/todoList-9QsDDcmB.js +368 -0
- package/lib/esm/todoList-9QsDDcmB.js.map +1 -0
- package/lib/theme/_internal/classic-common.css +3 -2
- package/lib/theme/common/block-edit.css +3 -1
- package/lib/theme/common/code-mirror.css +15 -0
- package/lib/theme/common/cursor.css +1 -1
- package/lib/theme/common/image-block.css +2 -0
- package/lib/theme/common/link-tooltip.css +10 -13
- package/lib/theme/common/list-item.css +16 -1
- package/lib/theme/common/prosemirror.css +1 -1
- package/lib/theme/common/style.css +1 -0
- package/lib/theme/common/table.css +217 -0
- package/lib/theme/common/toolbar.css +11 -4
- package/lib/theme/{classic-dark → crepe-dark}/style.css +2 -2
- package/lib/theme/frame/style.css +28 -0
- package/lib/theme/frame-dark/style.css +28 -0
- package/lib/theme/nord/style.css +28 -0
- package/lib/theme/nord-dark/style.css +28 -0
- package/lib/types/core/crepe.d.ts +5 -3
- package/lib/types/core/crepe.d.ts.map +1 -1
- package/lib/types/core/slice.d.ts +2 -2
- package/lib/types/core/slice.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/component.d.ts +3 -0
- package/lib/types/feature/block-edit/handle/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/index.d.ts +5 -4
- package/lib/types/feature/block-edit/handle/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/index.d.ts +43 -2
- package/lib/types/feature/block-edit/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/component.d.ts +3 -1
- package/lib/types/feature/block-edit/menu/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/config.d.ts +3 -12
- package/lib/types/feature/block-edit/menu/config.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/group-builder.d.ts +29 -0
- package/lib/types/feature/block-edit/menu/group-builder.d.ts.map +1 -0
- package/lib/types/feature/block-edit/menu/index.d.ts +5 -4
- package/lib/types/feature/block-edit/menu/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/utils.d.ts +28 -0
- package/lib/types/feature/block-edit/menu/utils.d.ts.map +1 -0
- package/lib/types/feature/code-mirror/index.d.ts +9 -1
- package/lib/types/feature/code-mirror/index.d.ts.map +1 -1
- package/lib/types/feature/cursor/index.d.ts +1 -1
- package/lib/types/feature/cursor/index.d.ts.map +1 -1
- package/lib/types/feature/image-block/index.d.ts +19 -2
- package/lib/types/feature/image-block/index.d.ts.map +1 -1
- package/lib/types/feature/index.d.ts +17 -2
- package/lib/types/feature/index.d.ts.map +1 -1
- package/lib/types/feature/link-tooltip/index.d.ts +12 -2
- package/lib/types/feature/link-tooltip/index.d.ts.map +1 -1
- package/lib/types/feature/list-item/index.d.ts +8 -2
- package/lib/types/feature/list-item/index.d.ts.map +1 -1
- package/lib/types/feature/placeholder/index.d.ts +2 -2
- package/lib/types/feature/placeholder/index.d.ts.map +1 -1
- package/lib/types/feature/shared.d.ts +3 -1
- package/lib/types/feature/shared.d.ts.map +1 -1
- package/lib/types/feature/table/index.d.ts +16 -0
- package/lib/types/feature/table/index.d.ts.map +1 -0
- package/lib/types/feature/toolbar/component.d.ts +3 -1
- package/lib/types/feature/toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/toolbar/index.d.ts +11 -2
- package/lib/types/feature/toolbar/index.d.ts.map +1 -1
- package/lib/types/icons/alignCenter.d.ts +2 -0
- package/lib/types/icons/alignCenter.d.ts.map +1 -0
- package/lib/types/icons/alignLeft.d.ts +2 -0
- package/lib/types/icons/alignLeft.d.ts.map +1 -0
- package/lib/types/icons/alignRight.d.ts +2 -0
- package/lib/types/icons/alignRight.d.ts.map +1 -0
- package/lib/types/icons/bold.d.ts +2 -0
- package/lib/types/icons/bold.d.ts.map +1 -0
- package/lib/types/{feature/list-item/consts.d.ts → icons/bullet.d.ts} +1 -1
- package/lib/types/icons/bullet.d.ts.map +1 -0
- package/lib/types/icons/bulletList.d.ts +2 -0
- package/lib/types/icons/bulletList.d.ts.map +1 -0
- package/lib/types/icons/caption.d.ts +2 -0
- package/lib/types/icons/caption.d.ts.map +1 -0
- package/lib/types/icons/checkBoxChecked.d.ts +2 -0
- package/lib/types/icons/checkBoxChecked.d.ts.map +1 -0
- package/lib/types/icons/checkBoxUnchecked.d.ts +2 -0
- package/lib/types/icons/checkBoxUnchecked.d.ts.map +1 -0
- package/lib/types/icons/chevronDown.d.ts +2 -0
- package/lib/types/icons/chevronDown.d.ts.map +1 -0
- package/lib/types/icons/clear.d.ts +2 -0
- package/lib/types/icons/clear.d.ts.map +1 -0
- package/lib/types/icons/code.d.ts +2 -0
- package/lib/types/icons/code.d.ts.map +1 -0
- package/lib/types/icons/confirm.d.ts +2 -0
- package/lib/types/icons/confirm.d.ts.map +1 -0
- package/lib/types/icons/divider.d.ts +2 -0
- package/lib/types/icons/divider.d.ts.map +1 -0
- package/lib/types/icons/dragHandle.d.ts +2 -0
- package/lib/types/icons/dragHandle.d.ts.map +1 -0
- package/lib/types/icons/edit.d.ts +2 -0
- package/lib/types/icons/edit.d.ts.map +1 -0
- package/lib/types/icons/h1.d.ts +2 -0
- package/lib/types/icons/h1.d.ts.map +1 -0
- package/lib/types/icons/h2.d.ts +2 -0
- package/lib/types/icons/h2.d.ts.map +1 -0
- package/lib/types/icons/h3.d.ts +2 -0
- package/lib/types/icons/h3.d.ts.map +1 -0
- package/lib/types/icons/h4.d.ts +2 -0
- package/lib/types/icons/h4.d.ts.map +1 -0
- package/lib/types/icons/h5.d.ts +2 -0
- package/lib/types/icons/h5.d.ts.map +1 -0
- package/lib/types/icons/h6.d.ts +2 -0
- package/lib/types/icons/h6.d.ts.map +1 -0
- package/lib/types/icons/image.d.ts +2 -0
- package/lib/types/icons/image.d.ts.map +1 -0
- package/lib/types/icons/index.d.ts +36 -0
- package/lib/types/icons/index.d.ts.map +1 -0
- package/lib/types/icons/italic.d.ts +2 -0
- package/lib/types/icons/italic.d.ts.map +1 -0
- package/lib/types/icons/link.d.ts +2 -0
- package/lib/types/icons/link.d.ts.map +1 -0
- package/lib/types/icons/menu.d.ts +2 -0
- package/lib/types/icons/menu.d.ts.map +1 -0
- package/lib/types/icons/orderedList.d.ts +2 -0
- package/lib/types/icons/orderedList.d.ts.map +1 -0
- package/lib/types/icons/plus.d.ts +2 -0
- package/lib/types/icons/plus.d.ts.map +1 -0
- package/lib/types/icons/quote.d.ts +2 -0
- package/lib/types/icons/quote.d.ts.map +1 -0
- package/lib/types/icons/remove.d.ts +2 -0
- package/lib/types/icons/remove.d.ts.map +1 -0
- package/lib/types/icons/search.d.ts +2 -0
- package/lib/types/icons/search.d.ts.map +1 -0
- package/lib/types/icons/strikethrough.d.ts +2 -0
- package/lib/types/icons/strikethrough.d.ts.map +1 -0
- package/lib/types/icons/table.d.ts +2 -0
- package/lib/types/icons/table.d.ts.map +1 -0
- package/lib/types/icons/text.d.ts +2 -0
- package/lib/types/icons/text.d.ts.map +1 -0
- package/lib/types/icons/todoList.d.ts +2 -0
- package/lib/types/icons/todoList.d.ts.map +1 -0
- package/lib/types/utils/index.d.ts +1 -1
- package/lib/types/utils/index.d.ts.map +1 -1
- package/package.json +9 -23
- package/src/core/crepe.ts +15 -9
- package/src/core/slice.ts +2 -2
- package/src/feature/block-edit/handle/component.ts +13 -29
- package/src/feature/block-edit/handle/index.ts +16 -17
- package/src/feature/block-edit/index.ts +50 -5
- package/src/feature/block-edit/menu/component.ts +6 -7
- package/src/feature/block-edit/menu/config.ts +203 -274
- package/src/feature/block-edit/menu/group-builder.ts +50 -0
- package/src/feature/block-edit/menu/index.ts +11 -8
- package/src/feature/block-edit/menu/utils.ts +89 -0
- package/src/feature/code-mirror/index.ts +27 -19
- package/src/feature/cursor/index.ts +3 -4
- package/src/feature/image-block/index.ts +34 -41
- package/src/feature/index.ts +23 -3
- package/src/feature/link-tooltip/index.ts +23 -10
- package/src/feature/list-item/index.ts +21 -9
- package/src/feature/placeholder/index.ts +11 -6
- package/src/feature/shared.ts +4 -1
- package/src/feature/table/index.ts +54 -0
- package/src/feature/toolbar/component.ts +29 -11
- package/src/feature/toolbar/index.ts +21 -9
- package/src/icons/alignCenter.ts +7 -0
- package/src/icons/alignLeft.ts +7 -0
- package/src/icons/alignRight.ts +7 -0
- package/src/icons/bold.ts +7 -0
- package/src/{feature/list-item/consts.ts → icons/bullet.ts} +3 -3
- package/src/icons/bulletList.ts +14 -0
- package/src/icons/caption.ts +7 -0
- package/src/icons/checkBoxChecked.ts +14 -0
- package/src/icons/checkBoxUnchecked.ts +14 -0
- package/src/icons/chevronDown.ts +7 -0
- package/src/icons/clear.ts +14 -0
- package/src/icons/code.ts +14 -0
- package/src/icons/confirm.ts +14 -0
- package/src/icons/divider.ts +14 -0
- package/src/icons/dragHandle.ts +7 -0
- package/src/icons/edit.ts +14 -0
- package/src/icons/h1.ts +14 -0
- package/src/icons/h2.ts +14 -0
- package/src/icons/h3.ts +14 -0
- package/src/icons/h4.ts +14 -0
- package/src/icons/h5.ts +14 -0
- package/src/icons/h6.ts +14 -0
- package/src/icons/image.ts +14 -0
- package/src/icons/index.ts +35 -0
- package/src/icons/italic.ts +7 -0
- package/src/icons/link.ts +7 -0
- package/src/icons/menu.ts +14 -0
- package/src/icons/orderedList.ts +14 -0
- package/src/icons/plus.ts +14 -0
- package/src/icons/quote.ts +14 -0
- package/src/icons/remove.ts +7 -0
- package/src/icons/search.ts +7 -0
- package/src/icons/strikethrough.ts +7 -0
- package/src/icons/table.ts +14 -0
- package/src/icons/text.ts +14 -0
- package/src/icons/todoList.ts +7 -0
- package/src/theme/_internal/classic-common.css +3 -2
- package/src/theme/common/block-edit.css +3 -1
- package/src/theme/common/code-mirror.css +13 -0
- package/src/theme/common/cursor.css +1 -1
- package/src/theme/common/image-block.css +2 -0
- package/src/theme/common/link-tooltip.css +11 -14
- package/src/theme/common/list-item.css +9 -0
- package/src/theme/common/prosemirror.css +1 -1
- package/src/theme/common/style.css +1 -0
- package/src/theme/common/table.css +204 -0
- package/src/theme/common/toolbar.css +14 -4
- package/src/theme/{classic-dark → crepe-dark}/style.css +2 -2
- package/src/theme/frame/style.css +28 -0
- package/src/theme/frame-dark/style.css +28 -0
- package/src/theme/nord/style.css +28 -0
- package/src/theme/nord-dark/style.css +28 -0
- package/src/utils/index.ts +1 -1
- package/lib/cjs/_view-TbSIR42F.js +0 -27
- package/lib/cjs/_view-TbSIR42F.js.map +0 -1
- package/lib/cjs/clsx-7JLENl8W.js +0 -62
- package/lib/cjs/clsx-7JLENl8W.js.map +0 -1
- package/lib/cjs/composed-offset-position.browser.min-FwypoGc1.js +0 -1138
- package/lib/cjs/composed-offset-position.browser.min-FwypoGc1.js.map +0 -1
- package/lib/cjs/helper-OEW-2Vxr.js +0 -9
- package/lib/cjs/helper-OEW-2Vxr.js.map +0 -1
- package/lib/cjs/index-2oxl5Zo4.js +0 -551
- package/lib/cjs/index-2oxl5Zo4.js.map +0 -1
- package/lib/cjs/index-GKolgvC5.js +0 -505
- package/lib/cjs/index-GKolgvC5.js.map +0 -1
- package/lib/cjs/index-JAqL0ybh.js +0 -55
- package/lib/cjs/index-JAqL0ybh.js.map +0 -1
- package/lib/cjs/index-Ne_pk53w.js +0 -178
- package/lib/cjs/index-Ne_pk53w.js.map +0 -1
- package/lib/cjs/index-O3vRXWIP.js +0 -199
- package/lib/cjs/index-O3vRXWIP.js.map +0 -1
- package/lib/cjs/index-OIQn1x0L.js.map +0 -1
- package/lib/cjs/index-PF7s7DOo.js +0 -386
- package/lib/cjs/index-PF7s7DOo.js.map +0 -1
- package/lib/cjs/index-TEjdwq--.js.map +0 -1
- package/lib/cjs/index-kNI3S3lF.js +0 -22477
- package/lib/cjs/index-kNI3S3lF.js.map +0 -1
- package/lib/cjs/index-kvO8ReCY.js +0 -1960
- package/lib/cjs/index-kvO8ReCY.js.map +0 -1
- package/lib/cjs/index-llNS_EuP.js.map +0 -1
- package/lib/cjs/index-xqKfEyRA.js.map +0 -1
- package/lib/cjs/meta-q8q9fHyr.js +0 -14
- package/lib/cjs/meta-q8q9fHyr.js.map +0 -1
- package/lib/cjs/schema-7d3meDfB.js +0 -74
- package/lib/cjs/schema-7d3meDfB.js.map +0 -1
- package/lib/cjs/tooltip-plugin-Mk9fRTxI.js +0 -200
- package/lib/cjs/tooltip-plugin-Mk9fRTxI.js.map +0 -1
- package/lib/esm/_view-JjtfhQ8k.js +0 -25
- package/lib/esm/_view-JjtfhQ8k.js.map +0 -1
- package/lib/esm/clsx-R7WFaNKL.js +0 -52
- package/lib/esm/clsx-R7WFaNKL.js.map +0 -1
- package/lib/esm/composed-offset-position.browser.min-Tnm31e-m.js +0 -1132
- package/lib/esm/composed-offset-position.browser.min-Tnm31e-m.js.map +0 -1
- package/lib/esm/helper-iYEjPbOY.js +0 -7
- package/lib/esm/helper-iYEjPbOY.js.map +0 -1
- package/lib/esm/index-218OjRxG.js +0 -549
- package/lib/esm/index-218OjRxG.js.map +0 -1
- package/lib/esm/index-AHPvVH4H.js +0 -197
- package/lib/esm/index-AHPvVH4H.js.map +0 -1
- package/lib/esm/index-Bg5GFp0g.js +0 -384
- package/lib/esm/index-Bg5GFp0g.js.map +0 -1
- package/lib/esm/index-JkHHp3K-.js +0 -22445
- package/lib/esm/index-JkHHp3K-.js.map +0 -1
- package/lib/esm/index-PkBZpDL4.js.map +0 -1
- package/lib/esm/index-TNMG6UrN.js +0 -53
- package/lib/esm/index-TNMG6UrN.js.map +0 -1
- package/lib/esm/index-VyZguCIt.js.map +0 -1
- package/lib/esm/index-h1arGiXv.js +0 -1958
- package/lib/esm/index-h1arGiXv.js.map +0 -1
- package/lib/esm/index-pHsvfB_I.js +0 -503
- package/lib/esm/index-pHsvfB_I.js.map +0 -1
- package/lib/esm/index-q-qE7-96.js.map +0 -1
- package/lib/esm/index-u8tWJbca.js +0 -176
- package/lib/esm/index-u8tWJbca.js.map +0 -1
- package/lib/esm/meta-3ZYGAGrY.js +0 -12
- package/lib/esm/meta-3ZYGAGrY.js.map +0 -1
- package/lib/esm/schema-hVsy-vme.js +0 -71
- package/lib/esm/schema-hVsy-vme.js.map +0 -1
- package/lib/esm/tooltip-plugin-vZefVSGL.js +0 -194
- package/lib/esm/tooltip-plugin-vZefVSGL.js.map +0 -1
- package/lib/types/feature/block-edit/menu/icons.d.ts +0 -14
- package/lib/types/feature/block-edit/menu/icons.d.ts.map +0 -1
- package/lib/types/feature/link-tooltip/consts.d.ts +0 -5
- package/lib/types/feature/link-tooltip/consts.d.ts.map +0 -1
- package/lib/types/feature/list-item/consts.d.ts.map +0 -1
- package/lib/types/feature/toolbar/consts.d.ts +0 -5
- package/lib/types/feature/toolbar/consts.d.ts.map +0 -1
- package/src/feature/block-edit/menu/icons.ts +0 -170
- package/src/feature/link-tooltip/consts.ts +0 -46
- package/src/feature/toolbar/consts.ts +0 -25
- /package/lib/theme/{classic → crepe}/style.css +0 -0
- /package/src/theme/{classic → crepe}/style.css +0 -0
|
@@ -1,1138 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const oppositeSideMap = {
|
|
4
|
-
left: 'right',
|
|
5
|
-
right: 'left',
|
|
6
|
-
bottom: 'top',
|
|
7
|
-
top: 'bottom'
|
|
8
|
-
};
|
|
9
|
-
const oppositeAlignmentMap = {
|
|
10
|
-
start: 'end',
|
|
11
|
-
end: 'start'
|
|
12
|
-
};
|
|
13
|
-
function evaluate(value, param) {
|
|
14
|
-
return typeof value === 'function' ? value(param) : value;
|
|
15
|
-
}
|
|
16
|
-
function getSide(placement) {
|
|
17
|
-
return placement.split('-')[0];
|
|
18
|
-
}
|
|
19
|
-
function getAlignment(placement) {
|
|
20
|
-
return placement.split('-')[1];
|
|
21
|
-
}
|
|
22
|
-
function getOppositeAxis(axis) {
|
|
23
|
-
return axis === 'x' ? 'y' : 'x';
|
|
24
|
-
}
|
|
25
|
-
function getAxisLength(axis) {
|
|
26
|
-
return axis === 'y' ? 'height' : 'width';
|
|
27
|
-
}
|
|
28
|
-
function getSideAxis(placement) {
|
|
29
|
-
return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
|
|
30
|
-
}
|
|
31
|
-
function getAlignmentAxis(placement) {
|
|
32
|
-
return getOppositeAxis(getSideAxis(placement));
|
|
33
|
-
}
|
|
34
|
-
function getAlignmentSides(placement, rects, rtl) {
|
|
35
|
-
if (rtl === void 0) {
|
|
36
|
-
rtl = false;
|
|
37
|
-
}
|
|
38
|
-
const alignment = getAlignment(placement);
|
|
39
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
40
|
-
const length = getAxisLength(alignmentAxis);
|
|
41
|
-
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
42
|
-
if (rects.reference[length] > rects.floating[length]) {
|
|
43
|
-
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
44
|
-
}
|
|
45
|
-
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
46
|
-
}
|
|
47
|
-
function getExpandedPlacements(placement) {
|
|
48
|
-
const oppositePlacement = getOppositePlacement(placement);
|
|
49
|
-
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
50
|
-
}
|
|
51
|
-
function getOppositeAlignmentPlacement(placement) {
|
|
52
|
-
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
53
|
-
}
|
|
54
|
-
function getSideList(side, isStart, rtl) {
|
|
55
|
-
const lr = ['left', 'right'];
|
|
56
|
-
const rl = ['right', 'left'];
|
|
57
|
-
const tb = ['top', 'bottom'];
|
|
58
|
-
const bt = ['bottom', 'top'];
|
|
59
|
-
switch (side) {
|
|
60
|
-
case 'top':
|
|
61
|
-
case 'bottom':
|
|
62
|
-
if (rtl) return isStart ? rl : lr;
|
|
63
|
-
return isStart ? lr : rl;
|
|
64
|
-
case 'left':
|
|
65
|
-
case 'right':
|
|
66
|
-
return isStart ? tb : bt;
|
|
67
|
-
default:
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
72
|
-
const alignment = getAlignment(placement);
|
|
73
|
-
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
74
|
-
if (alignment) {
|
|
75
|
-
list = list.map(side => side + "-" + alignment);
|
|
76
|
-
if (flipAlignment) {
|
|
77
|
-
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return list;
|
|
81
|
-
}
|
|
82
|
-
function getOppositePlacement(placement) {
|
|
83
|
-
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
84
|
-
}
|
|
85
|
-
function expandPaddingObject(padding) {
|
|
86
|
-
return {
|
|
87
|
-
top: 0,
|
|
88
|
-
right: 0,
|
|
89
|
-
bottom: 0,
|
|
90
|
-
left: 0,
|
|
91
|
-
...padding
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function getPaddingObject(padding) {
|
|
95
|
-
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
96
|
-
top: padding,
|
|
97
|
-
right: padding,
|
|
98
|
-
bottom: padding,
|
|
99
|
-
left: padding
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function rectToClientRect(rect) {
|
|
103
|
-
return {
|
|
104
|
-
...rect,
|
|
105
|
-
top: rect.y,
|
|
106
|
-
left: rect.x,
|
|
107
|
-
right: rect.x + rect.width,
|
|
108
|
-
bottom: rect.y + rect.height
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
113
|
-
let {
|
|
114
|
-
reference,
|
|
115
|
-
floating
|
|
116
|
-
} = _ref;
|
|
117
|
-
const sideAxis = getSideAxis(placement);
|
|
118
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
119
|
-
const alignLength = getAxisLength(alignmentAxis);
|
|
120
|
-
const side = getSide(placement);
|
|
121
|
-
const isVertical = sideAxis === 'y';
|
|
122
|
-
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
123
|
-
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
124
|
-
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
125
|
-
let coords;
|
|
126
|
-
switch (side) {
|
|
127
|
-
case 'top':
|
|
128
|
-
coords = {
|
|
129
|
-
x: commonX,
|
|
130
|
-
y: reference.y - floating.height
|
|
131
|
-
};
|
|
132
|
-
break;
|
|
133
|
-
case 'bottom':
|
|
134
|
-
coords = {
|
|
135
|
-
x: commonX,
|
|
136
|
-
y: reference.y + reference.height
|
|
137
|
-
};
|
|
138
|
-
break;
|
|
139
|
-
case 'right':
|
|
140
|
-
coords = {
|
|
141
|
-
x: reference.x + reference.width,
|
|
142
|
-
y: commonY
|
|
143
|
-
};
|
|
144
|
-
break;
|
|
145
|
-
case 'left':
|
|
146
|
-
coords = {
|
|
147
|
-
x: reference.x - floating.width,
|
|
148
|
-
y: commonY
|
|
149
|
-
};
|
|
150
|
-
break;
|
|
151
|
-
default:
|
|
152
|
-
coords = {
|
|
153
|
-
x: reference.x,
|
|
154
|
-
y: reference.y
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
switch (getAlignment(placement)) {
|
|
158
|
-
case 'start':
|
|
159
|
-
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
160
|
-
break;
|
|
161
|
-
case 'end':
|
|
162
|
-
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
return coords;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Computes the `x` and `y` coordinates that will place the floating element
|
|
170
|
-
* next to a reference element when it is given a certain positioning strategy.
|
|
171
|
-
*
|
|
172
|
-
* This export does not have any `platform` interface logic. You will need to
|
|
173
|
-
* write one for the platform you are using Floating UI with.
|
|
174
|
-
*/
|
|
175
|
-
const computePosition$1 = async (reference, floating, config) => {
|
|
176
|
-
const {
|
|
177
|
-
placement = 'bottom',
|
|
178
|
-
strategy = 'absolute',
|
|
179
|
-
middleware = [],
|
|
180
|
-
platform
|
|
181
|
-
} = config;
|
|
182
|
-
const validMiddleware = middleware.filter(Boolean);
|
|
183
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
184
|
-
let rects = await platform.getElementRects({
|
|
185
|
-
reference,
|
|
186
|
-
floating,
|
|
187
|
-
strategy
|
|
188
|
-
});
|
|
189
|
-
let {
|
|
190
|
-
x,
|
|
191
|
-
y
|
|
192
|
-
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
193
|
-
let statefulPlacement = placement;
|
|
194
|
-
let middlewareData = {};
|
|
195
|
-
let resetCount = 0;
|
|
196
|
-
for (let i = 0; i < validMiddleware.length; i++) {
|
|
197
|
-
const {
|
|
198
|
-
name,
|
|
199
|
-
fn
|
|
200
|
-
} = validMiddleware[i];
|
|
201
|
-
const {
|
|
202
|
-
x: nextX,
|
|
203
|
-
y: nextY,
|
|
204
|
-
data,
|
|
205
|
-
reset
|
|
206
|
-
} = await fn({
|
|
207
|
-
x,
|
|
208
|
-
y,
|
|
209
|
-
initialPlacement: placement,
|
|
210
|
-
placement: statefulPlacement,
|
|
211
|
-
strategy,
|
|
212
|
-
middlewareData,
|
|
213
|
-
rects,
|
|
214
|
-
platform,
|
|
215
|
-
elements: {
|
|
216
|
-
reference,
|
|
217
|
-
floating
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
x = nextX != null ? nextX : x;
|
|
221
|
-
y = nextY != null ? nextY : y;
|
|
222
|
-
middlewareData = {
|
|
223
|
-
...middlewareData,
|
|
224
|
-
[name]: {
|
|
225
|
-
...middlewareData[name],
|
|
226
|
-
...data
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
if (reset && resetCount <= 50) {
|
|
230
|
-
resetCount++;
|
|
231
|
-
if (typeof reset === 'object') {
|
|
232
|
-
if (reset.placement) {
|
|
233
|
-
statefulPlacement = reset.placement;
|
|
234
|
-
}
|
|
235
|
-
if (reset.rects) {
|
|
236
|
-
rects = reset.rects === true ? await platform.getElementRects({
|
|
237
|
-
reference,
|
|
238
|
-
floating,
|
|
239
|
-
strategy
|
|
240
|
-
}) : reset.rects;
|
|
241
|
-
}
|
|
242
|
-
({
|
|
243
|
-
x,
|
|
244
|
-
y
|
|
245
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
246
|
-
}
|
|
247
|
-
i = -1;
|
|
248
|
-
continue;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return {
|
|
252
|
-
x,
|
|
253
|
-
y,
|
|
254
|
-
placement: statefulPlacement,
|
|
255
|
-
strategy,
|
|
256
|
-
middlewareData
|
|
257
|
-
};
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Resolves with an object of overflow side offsets that determine how much the
|
|
262
|
-
* element is overflowing a given clipping boundary on each side.
|
|
263
|
-
* - positive = overflowing the boundary by that number of pixels
|
|
264
|
-
* - negative = how many pixels left before it will overflow
|
|
265
|
-
* - 0 = lies flush with the boundary
|
|
266
|
-
* @see https://floating-ui.com/docs/detectOverflow
|
|
267
|
-
*/
|
|
268
|
-
async function detectOverflow(state, options) {
|
|
269
|
-
var _await$platform$isEle;
|
|
270
|
-
if (options === void 0) {
|
|
271
|
-
options = {};
|
|
272
|
-
}
|
|
273
|
-
const {
|
|
274
|
-
x,
|
|
275
|
-
y,
|
|
276
|
-
platform,
|
|
277
|
-
rects,
|
|
278
|
-
elements,
|
|
279
|
-
strategy
|
|
280
|
-
} = state;
|
|
281
|
-
const {
|
|
282
|
-
boundary = 'clippingAncestors',
|
|
283
|
-
rootBoundary = 'viewport',
|
|
284
|
-
elementContext = 'floating',
|
|
285
|
-
altBoundary = false,
|
|
286
|
-
padding = 0
|
|
287
|
-
} = evaluate(options, state);
|
|
288
|
-
const paddingObject = getPaddingObject(padding);
|
|
289
|
-
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
290
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
291
|
-
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
292
|
-
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))),
|
|
293
|
-
boundary,
|
|
294
|
-
rootBoundary,
|
|
295
|
-
strategy
|
|
296
|
-
}));
|
|
297
|
-
const rect = elementContext === 'floating' ? {
|
|
298
|
-
...rects.floating,
|
|
299
|
-
x,
|
|
300
|
-
y
|
|
301
|
-
} : rects.reference;
|
|
302
|
-
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
303
|
-
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
304
|
-
x: 1,
|
|
305
|
-
y: 1
|
|
306
|
-
} : {
|
|
307
|
-
x: 1,
|
|
308
|
-
y: 1
|
|
309
|
-
};
|
|
310
|
-
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
311
|
-
rect,
|
|
312
|
-
offsetParent,
|
|
313
|
-
strategy
|
|
314
|
-
}) : rect);
|
|
315
|
-
return {
|
|
316
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
317
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
318
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
319
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
325
|
-
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
326
|
-
* clipping boundary. Alternative to `autoPlacement`.
|
|
327
|
-
* @see https://floating-ui.com/docs/flip
|
|
328
|
-
*/
|
|
329
|
-
const flip$1 = function (options) {
|
|
330
|
-
if (options === void 0) {
|
|
331
|
-
options = {};
|
|
332
|
-
}
|
|
333
|
-
return {
|
|
334
|
-
name: 'flip',
|
|
335
|
-
options,
|
|
336
|
-
async fn(state) {
|
|
337
|
-
var _middlewareData$arrow, _middlewareData$flip;
|
|
338
|
-
const {
|
|
339
|
-
placement,
|
|
340
|
-
middlewareData,
|
|
341
|
-
rects,
|
|
342
|
-
initialPlacement,
|
|
343
|
-
platform,
|
|
344
|
-
elements
|
|
345
|
-
} = state;
|
|
346
|
-
const {
|
|
347
|
-
mainAxis: checkMainAxis = true,
|
|
348
|
-
crossAxis: checkCrossAxis = true,
|
|
349
|
-
fallbackPlacements: specifiedFallbackPlacements,
|
|
350
|
-
fallbackStrategy = 'bestFit',
|
|
351
|
-
fallbackAxisSideDirection = 'none',
|
|
352
|
-
flipAlignment = true,
|
|
353
|
-
...detectOverflowOptions
|
|
354
|
-
} = evaluate(options, state);
|
|
355
|
-
|
|
356
|
-
// If a reset by the arrow was caused due to an alignment offset being
|
|
357
|
-
// added, we should skip any logic now since `flip()` has already done its
|
|
358
|
-
// work.
|
|
359
|
-
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
360
|
-
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
361
|
-
return {};
|
|
362
|
-
}
|
|
363
|
-
const side = getSide(placement);
|
|
364
|
-
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
365
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
366
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
367
|
-
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
|
|
368
|
-
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
369
|
-
}
|
|
370
|
-
const placements = [initialPlacement, ...fallbackPlacements];
|
|
371
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
372
|
-
const overflows = [];
|
|
373
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
374
|
-
if (checkMainAxis) {
|
|
375
|
-
overflows.push(overflow[side]);
|
|
376
|
-
}
|
|
377
|
-
if (checkCrossAxis) {
|
|
378
|
-
const sides = getAlignmentSides(placement, rects, rtl);
|
|
379
|
-
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
380
|
-
}
|
|
381
|
-
overflowsData = [...overflowsData, {
|
|
382
|
-
placement,
|
|
383
|
-
overflows
|
|
384
|
-
}];
|
|
385
|
-
|
|
386
|
-
// One or more sides is overflowing.
|
|
387
|
-
if (!overflows.every(side => side <= 0)) {
|
|
388
|
-
var _middlewareData$flip2, _overflowsData$filter;
|
|
389
|
-
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
390
|
-
const nextPlacement = placements[nextIndex];
|
|
391
|
-
if (nextPlacement) {
|
|
392
|
-
// Try next placement and re-run the lifecycle.
|
|
393
|
-
return {
|
|
394
|
-
data: {
|
|
395
|
-
index: nextIndex,
|
|
396
|
-
overflows: overflowsData
|
|
397
|
-
},
|
|
398
|
-
reset: {
|
|
399
|
-
placement: nextPlacement
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
405
|
-
// then find the placement that fits the best on the main crossAxis side.
|
|
406
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
407
|
-
|
|
408
|
-
// Otherwise fallback.
|
|
409
|
-
if (!resetPlacement) {
|
|
410
|
-
switch (fallbackStrategy) {
|
|
411
|
-
case 'bestFit':
|
|
412
|
-
{
|
|
413
|
-
var _overflowsData$map$so;
|
|
414
|
-
const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
|
|
415
|
-
if (placement) {
|
|
416
|
-
resetPlacement = placement;
|
|
417
|
-
}
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
case 'initialPlacement':
|
|
421
|
-
resetPlacement = initialPlacement;
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
if (placement !== resetPlacement) {
|
|
426
|
-
return {
|
|
427
|
-
reset: {
|
|
428
|
-
placement: resetPlacement
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
return {};
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
439
|
-
// Derivable.
|
|
440
|
-
async function convertValueToCoords(state, options) {
|
|
441
|
-
const {
|
|
442
|
-
placement,
|
|
443
|
-
platform,
|
|
444
|
-
elements
|
|
445
|
-
} = state;
|
|
446
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
447
|
-
const side = getSide(placement);
|
|
448
|
-
const alignment = getAlignment(placement);
|
|
449
|
-
const isVertical = getSideAxis(placement) === 'y';
|
|
450
|
-
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
451
|
-
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
452
|
-
const rawValue = evaluate(options, state);
|
|
453
|
-
|
|
454
|
-
// eslint-disable-next-line prefer-const
|
|
455
|
-
let {
|
|
456
|
-
mainAxis,
|
|
457
|
-
crossAxis,
|
|
458
|
-
alignmentAxis
|
|
459
|
-
} = typeof rawValue === 'number' ? {
|
|
460
|
-
mainAxis: rawValue,
|
|
461
|
-
crossAxis: 0,
|
|
462
|
-
alignmentAxis: null
|
|
463
|
-
} : {
|
|
464
|
-
mainAxis: 0,
|
|
465
|
-
crossAxis: 0,
|
|
466
|
-
alignmentAxis: null,
|
|
467
|
-
...rawValue
|
|
468
|
-
};
|
|
469
|
-
if (alignment && typeof alignmentAxis === 'number') {
|
|
470
|
-
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
471
|
-
}
|
|
472
|
-
return isVertical ? {
|
|
473
|
-
x: crossAxis * crossAxisMulti,
|
|
474
|
-
y: mainAxis * mainAxisMulti
|
|
475
|
-
} : {
|
|
476
|
-
x: mainAxis * mainAxisMulti,
|
|
477
|
-
y: crossAxis * crossAxisMulti
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* Modifies the placement by translating the floating element along the
|
|
483
|
-
* specified axes.
|
|
484
|
-
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
485
|
-
* object may be passed.
|
|
486
|
-
* @see https://floating-ui.com/docs/offset
|
|
487
|
-
*/
|
|
488
|
-
const offset = function (options) {
|
|
489
|
-
if (options === void 0) {
|
|
490
|
-
options = 0;
|
|
491
|
-
}
|
|
492
|
-
return {
|
|
493
|
-
name: 'offset',
|
|
494
|
-
options,
|
|
495
|
-
async fn(state) {
|
|
496
|
-
var _middlewareData$offse, _middlewareData$arrow;
|
|
497
|
-
const {
|
|
498
|
-
x,
|
|
499
|
-
y,
|
|
500
|
-
placement,
|
|
501
|
-
middlewareData
|
|
502
|
-
} = state;
|
|
503
|
-
const diffCoords = await convertValueToCoords(state, options);
|
|
504
|
-
|
|
505
|
-
// If the placement is the same and the arrow caused an alignment offset
|
|
506
|
-
// then we don't need to change the positioning coordinates.
|
|
507
|
-
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
508
|
-
return {};
|
|
509
|
-
}
|
|
510
|
-
return {
|
|
511
|
-
x: x + diffCoords.x,
|
|
512
|
-
y: y + diffCoords.y,
|
|
513
|
-
data: {
|
|
514
|
-
...diffCoords,
|
|
515
|
-
placement
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
};
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Custom positioning reference element.
|
|
524
|
-
* @see https://floating-ui.com/docs/virtual-elements
|
|
525
|
-
*/
|
|
526
|
-
|
|
527
|
-
const min = Math.min;
|
|
528
|
-
const max = Math.max;
|
|
529
|
-
const round = Math.round;
|
|
530
|
-
const createCoords = v => ({
|
|
531
|
-
x: v,
|
|
532
|
-
y: v
|
|
533
|
-
});
|
|
534
|
-
|
|
535
|
-
function getNodeName(node) {
|
|
536
|
-
if (isNode(node)) {
|
|
537
|
-
return (node.nodeName || '').toLowerCase();
|
|
538
|
-
}
|
|
539
|
-
// Mocked nodes in testing environments may not be instances of Node. By
|
|
540
|
-
// returning `#document` an infinite loop won't occur.
|
|
541
|
-
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
542
|
-
return '#document';
|
|
543
|
-
}
|
|
544
|
-
function getWindow(node) {
|
|
545
|
-
var _node$ownerDocument;
|
|
546
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
547
|
-
}
|
|
548
|
-
function getDocumentElement(node) {
|
|
549
|
-
var _ref;
|
|
550
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
551
|
-
}
|
|
552
|
-
function isNode(value) {
|
|
553
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
554
|
-
}
|
|
555
|
-
function isElement(value) {
|
|
556
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
557
|
-
}
|
|
558
|
-
function isHTMLElement(value) {
|
|
559
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
560
|
-
}
|
|
561
|
-
function isShadowRoot(value) {
|
|
562
|
-
// Browsers without `ShadowRoot` support.
|
|
563
|
-
if (typeof ShadowRoot === 'undefined') {
|
|
564
|
-
return false;
|
|
565
|
-
}
|
|
566
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
567
|
-
}
|
|
568
|
-
function isOverflowElement(element) {
|
|
569
|
-
const {
|
|
570
|
-
overflow,
|
|
571
|
-
overflowX,
|
|
572
|
-
overflowY,
|
|
573
|
-
display
|
|
574
|
-
} = getComputedStyle$1(element);
|
|
575
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
576
|
-
}
|
|
577
|
-
function isTableElement(element) {
|
|
578
|
-
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
579
|
-
}
|
|
580
|
-
function isContainingBlock(element) {
|
|
581
|
-
const webkit = isWebKit();
|
|
582
|
-
const css = getComputedStyle$1(element);
|
|
583
|
-
|
|
584
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
585
|
-
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
586
|
-
}
|
|
587
|
-
function getContainingBlock(element) {
|
|
588
|
-
let currentNode = getParentNode(element);
|
|
589
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
590
|
-
if (isContainingBlock(currentNode)) {
|
|
591
|
-
return currentNode;
|
|
592
|
-
} else {
|
|
593
|
-
currentNode = getParentNode(currentNode);
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
return null;
|
|
597
|
-
}
|
|
598
|
-
function isWebKit() {
|
|
599
|
-
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
600
|
-
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
601
|
-
}
|
|
602
|
-
function isLastTraversableNode(node) {
|
|
603
|
-
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
604
|
-
}
|
|
605
|
-
function getComputedStyle$1(element) {
|
|
606
|
-
return getWindow(element).getComputedStyle(element);
|
|
607
|
-
}
|
|
608
|
-
function getNodeScroll(element) {
|
|
609
|
-
if (isElement(element)) {
|
|
610
|
-
return {
|
|
611
|
-
scrollLeft: element.scrollLeft,
|
|
612
|
-
scrollTop: element.scrollTop
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
return {
|
|
616
|
-
scrollLeft: element.pageXOffset,
|
|
617
|
-
scrollTop: element.pageYOffset
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
function getParentNode(node) {
|
|
621
|
-
if (getNodeName(node) === 'html') {
|
|
622
|
-
return node;
|
|
623
|
-
}
|
|
624
|
-
const result =
|
|
625
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
626
|
-
node.assignedSlot ||
|
|
627
|
-
// DOM Element detected.
|
|
628
|
-
node.parentNode ||
|
|
629
|
-
// ShadowRoot detected.
|
|
630
|
-
isShadowRoot(node) && node.host ||
|
|
631
|
-
// Fallback.
|
|
632
|
-
getDocumentElement(node);
|
|
633
|
-
return isShadowRoot(result) ? result.host : result;
|
|
634
|
-
}
|
|
635
|
-
function getNearestOverflowAncestor(node) {
|
|
636
|
-
const parentNode = getParentNode(node);
|
|
637
|
-
if (isLastTraversableNode(parentNode)) {
|
|
638
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
639
|
-
}
|
|
640
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
641
|
-
return parentNode;
|
|
642
|
-
}
|
|
643
|
-
return getNearestOverflowAncestor(parentNode);
|
|
644
|
-
}
|
|
645
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
646
|
-
var _node$ownerDocument2;
|
|
647
|
-
if (list === void 0) {
|
|
648
|
-
list = [];
|
|
649
|
-
}
|
|
650
|
-
if (traverseIframes === void 0) {
|
|
651
|
-
traverseIframes = true;
|
|
652
|
-
}
|
|
653
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
654
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
655
|
-
const win = getWindow(scrollableAncestor);
|
|
656
|
-
if (isBody) {
|
|
657
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
|
658
|
-
}
|
|
659
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
function getCssDimensions(element) {
|
|
663
|
-
const css = getComputedStyle$1(element);
|
|
664
|
-
// In testing environments, the `width` and `height` properties are empty
|
|
665
|
-
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
666
|
-
let width = parseFloat(css.width) || 0;
|
|
667
|
-
let height = parseFloat(css.height) || 0;
|
|
668
|
-
const hasOffset = isHTMLElement(element);
|
|
669
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
670
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
671
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
672
|
-
if (shouldFallback) {
|
|
673
|
-
width = offsetWidth;
|
|
674
|
-
height = offsetHeight;
|
|
675
|
-
}
|
|
676
|
-
return {
|
|
677
|
-
width,
|
|
678
|
-
height,
|
|
679
|
-
$: shouldFallback
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
function unwrapElement(element) {
|
|
684
|
-
return !isElement(element) ? element.contextElement : element;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
function getScale(element) {
|
|
688
|
-
const domElement = unwrapElement(element);
|
|
689
|
-
if (!isHTMLElement(domElement)) {
|
|
690
|
-
return createCoords(1);
|
|
691
|
-
}
|
|
692
|
-
const rect = domElement.getBoundingClientRect();
|
|
693
|
-
const {
|
|
694
|
-
width,
|
|
695
|
-
height,
|
|
696
|
-
$
|
|
697
|
-
} = getCssDimensions(domElement);
|
|
698
|
-
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
699
|
-
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
700
|
-
|
|
701
|
-
// 0, NaN, or Infinity should always fallback to 1.
|
|
702
|
-
|
|
703
|
-
if (!x || !Number.isFinite(x)) {
|
|
704
|
-
x = 1;
|
|
705
|
-
}
|
|
706
|
-
if (!y || !Number.isFinite(y)) {
|
|
707
|
-
y = 1;
|
|
708
|
-
}
|
|
709
|
-
return {
|
|
710
|
-
x,
|
|
711
|
-
y
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
716
|
-
function getVisualOffsets(element) {
|
|
717
|
-
const win = getWindow(element);
|
|
718
|
-
if (!isWebKit() || !win.visualViewport) {
|
|
719
|
-
return noOffsets;
|
|
720
|
-
}
|
|
721
|
-
return {
|
|
722
|
-
x: win.visualViewport.offsetLeft,
|
|
723
|
-
y: win.visualViewport.offsetTop
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
727
|
-
if (isFixed === void 0) {
|
|
728
|
-
isFixed = false;
|
|
729
|
-
}
|
|
730
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
731
|
-
return false;
|
|
732
|
-
}
|
|
733
|
-
return isFixed;
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
737
|
-
if (includeScale === void 0) {
|
|
738
|
-
includeScale = false;
|
|
739
|
-
}
|
|
740
|
-
if (isFixedStrategy === void 0) {
|
|
741
|
-
isFixedStrategy = false;
|
|
742
|
-
}
|
|
743
|
-
const clientRect = element.getBoundingClientRect();
|
|
744
|
-
const domElement = unwrapElement(element);
|
|
745
|
-
let scale = createCoords(1);
|
|
746
|
-
if (includeScale) {
|
|
747
|
-
if (offsetParent) {
|
|
748
|
-
if (isElement(offsetParent)) {
|
|
749
|
-
scale = getScale(offsetParent);
|
|
750
|
-
}
|
|
751
|
-
} else {
|
|
752
|
-
scale = getScale(element);
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
756
|
-
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
757
|
-
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
758
|
-
let width = clientRect.width / scale.x;
|
|
759
|
-
let height = clientRect.height / scale.y;
|
|
760
|
-
if (domElement) {
|
|
761
|
-
const win = getWindow(domElement);
|
|
762
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
763
|
-
let currentWin = win;
|
|
764
|
-
let currentIFrame = currentWin.frameElement;
|
|
765
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
766
|
-
const iframeScale = getScale(currentIFrame);
|
|
767
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
768
|
-
const css = getComputedStyle$1(currentIFrame);
|
|
769
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
770
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
771
|
-
x *= iframeScale.x;
|
|
772
|
-
y *= iframeScale.y;
|
|
773
|
-
width *= iframeScale.x;
|
|
774
|
-
height *= iframeScale.y;
|
|
775
|
-
x += left;
|
|
776
|
-
y += top;
|
|
777
|
-
currentWin = getWindow(currentIFrame);
|
|
778
|
-
currentIFrame = currentWin.frameElement;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
return rectToClientRect({
|
|
782
|
-
width,
|
|
783
|
-
height,
|
|
784
|
-
x,
|
|
785
|
-
y
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
const topLayerSelectors = [':popover-open', ':modal'];
|
|
790
|
-
function isTopLayer(floating) {
|
|
791
|
-
return topLayerSelectors.some(selector => {
|
|
792
|
-
try {
|
|
793
|
-
return floating.matches(selector);
|
|
794
|
-
} catch (e) {
|
|
795
|
-
return false;
|
|
796
|
-
}
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
801
|
-
let {
|
|
802
|
-
elements,
|
|
803
|
-
rect,
|
|
804
|
-
offsetParent,
|
|
805
|
-
strategy
|
|
806
|
-
} = _ref;
|
|
807
|
-
const isFixed = strategy === 'fixed';
|
|
808
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
809
|
-
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
810
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
811
|
-
return rect;
|
|
812
|
-
}
|
|
813
|
-
let scroll = {
|
|
814
|
-
scrollLeft: 0,
|
|
815
|
-
scrollTop: 0
|
|
816
|
-
};
|
|
817
|
-
let scale = createCoords(1);
|
|
818
|
-
const offsets = createCoords(0);
|
|
819
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
820
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
821
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
822
|
-
scroll = getNodeScroll(offsetParent);
|
|
823
|
-
}
|
|
824
|
-
if (isHTMLElement(offsetParent)) {
|
|
825
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
|
826
|
-
scale = getScale(offsetParent);
|
|
827
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
828
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
return {
|
|
832
|
-
width: rect.width * scale.x,
|
|
833
|
-
height: rect.height * scale.y,
|
|
834
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
835
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
function getClientRects(element) {
|
|
840
|
-
return Array.from(element.getClientRects());
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
function getWindowScrollBarX(element) {
|
|
844
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
845
|
-
// incorrect for RTL.
|
|
846
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
// Gets the entire size of the scrollable document area, even extending outside
|
|
850
|
-
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
851
|
-
function getDocumentRect(element) {
|
|
852
|
-
const html = getDocumentElement(element);
|
|
853
|
-
const scroll = getNodeScroll(element);
|
|
854
|
-
const body = element.ownerDocument.body;
|
|
855
|
-
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
856
|
-
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
857
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
858
|
-
const y = -scroll.scrollTop;
|
|
859
|
-
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
860
|
-
x += max(html.clientWidth, body.clientWidth) - width;
|
|
861
|
-
}
|
|
862
|
-
return {
|
|
863
|
-
width,
|
|
864
|
-
height,
|
|
865
|
-
x,
|
|
866
|
-
y
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
function getViewportRect(element, strategy) {
|
|
871
|
-
const win = getWindow(element);
|
|
872
|
-
const html = getDocumentElement(element);
|
|
873
|
-
const visualViewport = win.visualViewport;
|
|
874
|
-
let width = html.clientWidth;
|
|
875
|
-
let height = html.clientHeight;
|
|
876
|
-
let x = 0;
|
|
877
|
-
let y = 0;
|
|
878
|
-
if (visualViewport) {
|
|
879
|
-
width = visualViewport.width;
|
|
880
|
-
height = visualViewport.height;
|
|
881
|
-
const visualViewportBased = isWebKit();
|
|
882
|
-
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
883
|
-
x = visualViewport.offsetLeft;
|
|
884
|
-
y = visualViewport.offsetTop;
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
return {
|
|
888
|
-
width,
|
|
889
|
-
height,
|
|
890
|
-
x,
|
|
891
|
-
y
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
// Returns the inner client rect, subtracting scrollbars if present.
|
|
896
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
897
|
-
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
898
|
-
const top = clientRect.top + element.clientTop;
|
|
899
|
-
const left = clientRect.left + element.clientLeft;
|
|
900
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
901
|
-
const width = element.clientWidth * scale.x;
|
|
902
|
-
const height = element.clientHeight * scale.y;
|
|
903
|
-
const x = left * scale.x;
|
|
904
|
-
const y = top * scale.y;
|
|
905
|
-
return {
|
|
906
|
-
width,
|
|
907
|
-
height,
|
|
908
|
-
x,
|
|
909
|
-
y
|
|
910
|
-
};
|
|
911
|
-
}
|
|
912
|
-
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
913
|
-
let rect;
|
|
914
|
-
if (clippingAncestor === 'viewport') {
|
|
915
|
-
rect = getViewportRect(element, strategy);
|
|
916
|
-
} else if (clippingAncestor === 'document') {
|
|
917
|
-
rect = getDocumentRect(getDocumentElement(element));
|
|
918
|
-
} else if (isElement(clippingAncestor)) {
|
|
919
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
920
|
-
} else {
|
|
921
|
-
const visualOffsets = getVisualOffsets(element);
|
|
922
|
-
rect = {
|
|
923
|
-
...clippingAncestor,
|
|
924
|
-
x: clippingAncestor.x - visualOffsets.x,
|
|
925
|
-
y: clippingAncestor.y - visualOffsets.y
|
|
926
|
-
};
|
|
927
|
-
}
|
|
928
|
-
return rectToClientRect(rect);
|
|
929
|
-
}
|
|
930
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
|
931
|
-
const parentNode = getParentNode(element);
|
|
932
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
933
|
-
return false;
|
|
934
|
-
}
|
|
935
|
-
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
939
|
-
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
940
|
-
// of the given element up the tree.
|
|
941
|
-
function getClippingElementAncestors(element, cache) {
|
|
942
|
-
const cachedResult = cache.get(element);
|
|
943
|
-
if (cachedResult) {
|
|
944
|
-
return cachedResult;
|
|
945
|
-
}
|
|
946
|
-
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
947
|
-
let currentContainingBlockComputedStyle = null;
|
|
948
|
-
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
949
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
950
|
-
|
|
951
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
952
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
953
|
-
const computedStyle = getComputedStyle$1(currentNode);
|
|
954
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
955
|
-
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
956
|
-
currentContainingBlockComputedStyle = null;
|
|
957
|
-
}
|
|
958
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
959
|
-
if (shouldDropCurrentNode) {
|
|
960
|
-
// Drop non-containing blocks.
|
|
961
|
-
result = result.filter(ancestor => ancestor !== currentNode);
|
|
962
|
-
} else {
|
|
963
|
-
// Record last containing block for next iteration.
|
|
964
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
965
|
-
}
|
|
966
|
-
currentNode = getParentNode(currentNode);
|
|
967
|
-
}
|
|
968
|
-
cache.set(element, result);
|
|
969
|
-
return result;
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
// Gets the maximum area that the element is visible in due to any number of
|
|
973
|
-
// clipping ancestors.
|
|
974
|
-
function getClippingRect(_ref) {
|
|
975
|
-
let {
|
|
976
|
-
element,
|
|
977
|
-
boundary,
|
|
978
|
-
rootBoundary,
|
|
979
|
-
strategy
|
|
980
|
-
} = _ref;
|
|
981
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
982
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
983
|
-
const firstClippingAncestor = clippingAncestors[0];
|
|
984
|
-
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
985
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
986
|
-
accRect.top = max(rect.top, accRect.top);
|
|
987
|
-
accRect.right = min(rect.right, accRect.right);
|
|
988
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
989
|
-
accRect.left = max(rect.left, accRect.left);
|
|
990
|
-
return accRect;
|
|
991
|
-
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
992
|
-
return {
|
|
993
|
-
width: clippingRect.right - clippingRect.left,
|
|
994
|
-
height: clippingRect.bottom - clippingRect.top,
|
|
995
|
-
x: clippingRect.left,
|
|
996
|
-
y: clippingRect.top
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
function getDimensions(element) {
|
|
1001
|
-
const {
|
|
1002
|
-
width,
|
|
1003
|
-
height
|
|
1004
|
-
} = getCssDimensions(element);
|
|
1005
|
-
return {
|
|
1006
|
-
width,
|
|
1007
|
-
height
|
|
1008
|
-
};
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1012
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1013
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
1014
|
-
const isFixed = strategy === 'fixed';
|
|
1015
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1016
|
-
let scroll = {
|
|
1017
|
-
scrollLeft: 0,
|
|
1018
|
-
scrollTop: 0
|
|
1019
|
-
};
|
|
1020
|
-
const offsets = createCoords(0);
|
|
1021
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1022
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1023
|
-
scroll = getNodeScroll(offsetParent);
|
|
1024
|
-
}
|
|
1025
|
-
if (isOffsetParentAnElement) {
|
|
1026
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1027
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1028
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1029
|
-
} else if (documentElement) {
|
|
1030
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
1034
|
-
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
1035
|
-
return {
|
|
1036
|
-
x,
|
|
1037
|
-
y,
|
|
1038
|
-
width: rect.width,
|
|
1039
|
-
height: rect.height
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
function getTrueOffsetParent(element, polyfill) {
|
|
1044
|
-
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
1045
|
-
return null;
|
|
1046
|
-
}
|
|
1047
|
-
if (polyfill) {
|
|
1048
|
-
return polyfill(element);
|
|
1049
|
-
}
|
|
1050
|
-
return element.offsetParent;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1054
|
-
// such as table ancestors and cross browser bugs.
|
|
1055
|
-
function getOffsetParent(element, polyfill) {
|
|
1056
|
-
const window = getWindow(element);
|
|
1057
|
-
if (!isHTMLElement(element) || isTopLayer(element)) {
|
|
1058
|
-
return window;
|
|
1059
|
-
}
|
|
1060
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1061
|
-
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
|
|
1062
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1063
|
-
}
|
|
1064
|
-
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
|
|
1065
|
-
return window;
|
|
1066
|
-
}
|
|
1067
|
-
return offsetParent || getContainingBlock(element) || window;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
const getElementRects = async function (data) {
|
|
1071
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1072
|
-
const getDimensionsFn = this.getDimensions;
|
|
1073
|
-
return {
|
|
1074
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1075
|
-
floating: {
|
|
1076
|
-
x: 0,
|
|
1077
|
-
y: 0,
|
|
1078
|
-
...(await getDimensionsFn(data.floating))
|
|
1079
|
-
}
|
|
1080
|
-
};
|
|
1081
|
-
};
|
|
1082
|
-
|
|
1083
|
-
function isRTL(element) {
|
|
1084
|
-
return getComputedStyle$1(element).direction === 'rtl';
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
const platform = {
|
|
1088
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1089
|
-
getDocumentElement,
|
|
1090
|
-
getClippingRect,
|
|
1091
|
-
getOffsetParent,
|
|
1092
|
-
getElementRects,
|
|
1093
|
-
getClientRects,
|
|
1094
|
-
getDimensions,
|
|
1095
|
-
getScale,
|
|
1096
|
-
isElement,
|
|
1097
|
-
isRTL
|
|
1098
|
-
};
|
|
1099
|
-
|
|
1100
|
-
/**
|
|
1101
|
-
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
1102
|
-
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
1103
|
-
* clipping boundary. Alternative to `autoPlacement`.
|
|
1104
|
-
* @see https://floating-ui.com/docs/flip
|
|
1105
|
-
*/
|
|
1106
|
-
const flip = flip$1;
|
|
1107
|
-
|
|
1108
|
-
/**
|
|
1109
|
-
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1110
|
-
* next to a given reference element.
|
|
1111
|
-
*/
|
|
1112
|
-
const computePosition = (reference, floating, options) => {
|
|
1113
|
-
// This caches the expensive `getClippingElementAncestors` function so that
|
|
1114
|
-
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
1115
|
-
// single call. If other functions become expensive, we can add them as well.
|
|
1116
|
-
const cache = new Map();
|
|
1117
|
-
const mergedOptions = {
|
|
1118
|
-
platform,
|
|
1119
|
-
...options
|
|
1120
|
-
};
|
|
1121
|
-
const platformWithCache = {
|
|
1122
|
-
...mergedOptions.platform,
|
|
1123
|
-
_c: cache
|
|
1124
|
-
};
|
|
1125
|
-
return computePosition$1(reference, floating, {
|
|
1126
|
-
...mergedOptions,
|
|
1127
|
-
platform: platformWithCache
|
|
1128
|
-
});
|
|
1129
|
-
};
|
|
1130
|
-
|
|
1131
|
-
function t(t){return r(t)}function o(t){return t.assignedSlot?t.assignedSlot:t.parentNode instanceof ShadowRoot?t.parentNode.host:t.parentNode}function r(t){for(let e=t;e;e=o(e))if(e instanceof Element&&"none"===getComputedStyle(e).display)return null;for(let e=o(t);e;e=o(e)){if(!(e instanceof Element))continue;const t=getComputedStyle(e);if("contents"!==t.display){if("static"!==t.position||"none"!==t.filter)return e;if("BODY"===e.tagName)return e}}return null}
|
|
1132
|
-
|
|
1133
|
-
exports.computePosition = computePosition;
|
|
1134
|
-
exports.flip = flip;
|
|
1135
|
-
exports.offset = offset;
|
|
1136
|
-
exports.platform = platform;
|
|
1137
|
-
exports.t = t;
|
|
1138
|
-
//# sourceMappingURL=composed-offset-position.browser.min-FwypoGc1.js.map
|