@mhmo91/schmancy 0.9.13 → 0.9.14
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/custom-elements.json +194 -0
- package/dist/agent/schmancy.agent.js +107 -1
- package/dist/agent/schmancy.agent.js.map +1 -1
- package/dist/agent/schmancy.manifest.json +148 -0
- package/dist/{animation-Bcwh107v.cjs.map → animation-CQRdLgzX.cjs.map} +1 -1
- package/dist/{animation-CXKSuUoE.js.map → animation-hXFClrIn.js.map} +1 -1
- package/dist/{area-CApZWjqs.cjs → area-DBjAhgjP.cjs} +2 -2
- package/dist/area-DBjAhgjP.cjs.map +1 -0
- package/dist/{area-D_p1YBgP.js → area-Dr4I9R2p.js} +23 -35
- package/dist/area-Dr4I9R2p.js.map +1 -0
- package/dist/area.cjs +1 -1
- package/dist/area.js +3 -2
- package/dist/{audio-DUVz7Ars.cjs → audio-Dvr-RBzE.cjs} +1 -1
- package/dist/{audio-DUVz7Ars.cjs.map → audio-Dvr-RBzE.cjs.map} +1 -1
- package/dist/{audio-C7TzWI8M.js → audio-ql6nvY0y.js} +1 -1
- package/dist/{audio-C7TzWI8M.js.map → audio-ql6nvY0y.js.map} +1 -1
- package/dist/audio.cjs +1 -1
- package/dist/audio.js +2 -2
- package/dist/{autocomplete-DAK35swc.js → autocomplete-CgWUCUU-.js} +3 -3
- package/dist/{autocomplete-DAK35swc.js.map → autocomplete-CgWUCUU-.js.map} +1 -1
- package/dist/{autocomplete-DlCqS1gW.cjs → autocomplete-EM0jE7X2.cjs} +1 -1
- package/dist/{autocomplete-DlCqS1gW.cjs.map → autocomplete-EM0jE7X2.cjs.map} +1 -1
- package/dist/autocomplete.cjs +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{boat-C57YTPbb.cjs → boat-BjYJI1HS.cjs} +1 -1
- package/dist/{boat-C57YTPbb.cjs.map → boat-BjYJI1HS.cjs.map} +1 -1
- package/dist/{boat-Dms45k4o.js → boat-Dw8TmOzN.js} +4 -4
- package/dist/{boat-Dms45k4o.js.map → boat-Dw8TmOzN.js.map} +1 -1
- package/dist/boat.cjs +1 -1
- package/dist/boat.js +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/{busy-BfN1p1n8.cjs → busy-BmiumJpB.cjs} +1 -1
- package/dist/{busy-BfN1p1n8.cjs.map → busy-BmiumJpB.cjs.map} +1 -1
- package/dist/{busy-IKS9obYj.js → busy-D2hP3fOy.js} +1 -1
- package/dist/{busy-IKS9obYj.js.map → busy-D2hP3fOy.js.map} +1 -1
- package/dist/busy.cjs +1 -1
- package/dist/busy.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +4 -4
- package/dist/{card-ZObyqkFF.cjs → card-BslSqOsf.cjs} +1 -1
- package/dist/{card-ZObyqkFF.cjs.map → card-BslSqOsf.cjs.map} +1 -1
- package/dist/{card-DQNBal9V.js → card-CEdgK9nb.js} +2 -2
- package/dist/{card-DQNBal9V.js.map → card-CEdgK9nb.js.map} +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +1 -1
- package/dist/{checkbox-COhTJ1x5.js → checkbox-Br84TiCs.js} +2 -2
- package/dist/{checkbox-COhTJ1x5.js.map → checkbox-Br84TiCs.js.map} +1 -1
- package/dist/{checkbox-CiAtIrqB.cjs → checkbox-DtcFMgZL.cjs} +1 -1
- package/dist/{checkbox-CiAtIrqB.cjs.map → checkbox-DtcFMgZL.cjs.map} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{chips-B5o3vNQF.js → chips-BNYOweGm.js} +5 -5
- package/dist/{chips-B5o3vNQF.js.map → chips-BNYOweGm.js.map} +1 -1
- package/dist/{chips-D2xmsC36.cjs → chips-DoCu5YQb.cjs} +1 -1
- package/dist/{chips-D2xmsC36.cjs.map → chips-DoCu5YQb.cjs.map} +1 -1
- package/dist/chips.cjs +1 -1
- package/dist/chips.js +2 -2
- package/dist/{chunk-C_1VqBVD.js → chunk-BM5alsTp.js} +9 -2
- package/dist/chunk-CncqDLb2.cjs +1 -0
- package/dist/{code-highlight-SkMMTkIJ.js → code-highlight-BgExKEto.js} +1 -1
- package/dist/{code-highlight-SkMMTkIJ.js.map → code-highlight-BgExKEto.js.map} +1 -1
- package/dist/{code-highlight-BToHh8T6.cjs → code-highlight-zSYcSfCz.cjs} +1 -1
- package/dist/{code-highlight-BToHh8T6.cjs.map → code-highlight-zSYcSfCz.cjs.map} +1 -1
- package/dist/code-highlight.cjs +1 -1
- package/dist/code-highlight.js +1 -1
- package/dist/{components-Ca7OTgbQ.js → components-DjKNS9R_.js} +1 -1
- package/dist/{components-Ca7OTgbQ.js.map → components-DjKNS9R_.js.map} +1 -1
- package/dist/{components-B-XYvUWn.cjs → components-TJT8-tva.cjs} +1 -1
- package/dist/{components-B-XYvUWn.cjs.map → components-TJT8-tva.cjs.map} +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/connectivity.cjs +1 -1
- package/dist/connectivity.js +2 -2
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/context-CAYQh-mx.cjs +1 -0
- package/dist/{context-C6GwmNJJ.cjs.map → context-CAYQh-mx.cjs.map} +1 -1
- package/dist/context-D8Q66KPe.js +3 -0
- package/dist/{context-oBTPHrbc.js.map → context-D8Q66KPe.js.map} +1 -1
- package/dist/{cursor-glow-C2YRrB8Z.js → cursor-glow-BydlDInj.js} +1 -1
- package/dist/{cursor-glow-C2YRrB8Z.js.map → cursor-glow-BydlDInj.js.map} +1 -1
- package/dist/{cursor-glow-82y5h3E4.cjs → cursor-glow-Duw9jHmh.cjs} +1 -1
- package/dist/{cursor-glow-82y5h3E4.cjs.map → cursor-glow-Duw9jHmh.cjs.map} +1 -1
- package/dist/{date-range-BTA9nKbw.cjs → date-range-CIWYm3eS.cjs} +1 -1
- package/dist/{date-range-BTA9nKbw.cjs.map → date-range-CIWYm3eS.cjs.map} +1 -1
- package/dist/{date-range-inline-LLC3Y0mi.cjs → date-range-inline-B9Dp2z6C.cjs} +1 -1
- package/dist/{date-range-inline-LLC3Y0mi.cjs.map → date-range-inline-B9Dp2z6C.cjs.map} +1 -1
- package/dist/{date-range-inline-B_g1YXu3.js.map → date-range-inline-CpKG6qt2.js.map} +1 -1
- package/dist/date-range-inline.cjs +1 -1
- package/dist/date-range-inline.js +1 -1
- package/dist/{date-range-DUWpF0Qw.js → date-range-sGkC0KF3.js} +4 -4
- package/dist/{date-range-DUWpF0Qw.js.map → date-range-sGkC0KF3.js.map} +1 -1
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/{delay-Co89XWry.cjs → delay-Bu4WMQlV.cjs} +1 -1
- package/dist/{delay-Co89XWry.cjs.map → delay-Bu4WMQlV.cjs.map} +1 -1
- package/dist/{delay-CtDrlf1Q.js → delay-DwX65fSc.js} +4 -4
- package/dist/{delay-CtDrlf1Q.js.map → delay-DwX65fSc.js.map} +1 -1
- package/dist/delay.cjs +1 -1
- package/dist/delay.js +1 -1
- package/dist/{details-CyXyVdb2.cjs → details-B8p62xmR.cjs} +1 -1
- package/dist/{details-CyXyVdb2.cjs.map → details-B8p62xmR.cjs.map} +1 -1
- package/dist/{details-B1Ax7WiP.js → details-CCW52lzz.js} +5 -5
- package/dist/{details-B1Ax7WiP.js.map → details-CCW52lzz.js.map} +1 -1
- package/dist/details.cjs +1 -1
- package/dist/details.js +1 -1
- package/dist/{dialog-service-DXLGSshF.cjs → dialog-service-CzDO08Gy.cjs} +1 -1
- package/dist/{dialog-service-DXLGSshF.cjs.map → dialog-service-CzDO08Gy.cjs.map} +1 -1
- package/dist/{dialog-service-CCFGpU7a.js → dialog-service-DH-tjPuE.js} +2 -2
- package/dist/{dialog-service-CCFGpU7a.js.map → dialog-service-DH-tjPuE.js.map} +1 -1
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +5 -5
- package/dist/directives.cjs +1 -1
- package/dist/directives.js +5 -5
- package/dist/discovery.cjs +1 -1
- package/dist/{divider-DuwCrKQu.js → divider-CbEWg3G_.js} +1 -1
- package/dist/{divider-DuwCrKQu.js.map → divider-CbEWg3G_.js.map} +1 -1
- package/dist/{divider-xcvHqVBc.cjs → divider-JyyFw_3J.cjs} +1 -1
- package/dist/{divider-xcvHqVBc.cjs.map → divider-JyyFw_3J.cjs.map} +1 -1
- package/dist/divider.cjs +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.cjs +1 -1
- package/dist/dropdown.js +2 -2
- package/dist/{expand-DUgOh1af.cjs → expand-BmwIPNjq.cjs} +1 -1
- package/dist/{expand-DUgOh1af.cjs.map → expand-BmwIPNjq.cjs.map} +1 -1
- package/dist/{expand-X0C1W279.js → expand-bFa_qVDT.js} +4 -4
- package/dist/{expand-X0C1W279.js.map → expand-bFa_qVDT.js.map} +1 -1
- package/dist/expand.cjs +1 -1
- package/dist/expand.js +1 -1
- package/dist/{extra-BqfYIC_q.cjs → extra-BUgyMgjl.cjs} +1 -1
- package/dist/{extra-BqfYIC_q.cjs.map → extra-BUgyMgjl.cjs.map} +1 -1
- package/dist/{extra-BTyq-5Z6.js → extra-HwbaUnCD.js} +1 -1
- package/dist/{extra-BTyq-5Z6.js.map → extra-HwbaUnCD.js.map} +1 -1
- package/dist/extra.cjs +1 -1
- package/dist/extra.js +1 -1
- package/dist/float-BQwhfibw.cjs +1 -0
- package/dist/{float-yZoLnUg0.cjs.map → float-BQwhfibw.cjs.map} +1 -1
- package/dist/{float-BgGeLER6.js → float-D5ezUurt.js} +1 -1
- package/dist/{float-BgGeLER6.js.map → float-D5ezUurt.js.map} +1 -1
- package/dist/float.cjs +1 -1
- package/dist/float.js +1 -1
- package/dist/{flow-BPDtbhLe.js.map → flow-BGkHnOnd.js.map} +1 -1
- package/dist/{flow-Dn9AZktE.cjs.map → flow-ClAJ6Qby.cjs.map} +1 -1
- package/dist/{form-C1qS9uvS.js.map → form-rCZqoAoK.js.map} +1 -1
- package/dist/{form-CzD0JLxM.cjs → form-wI58M85H.cjs} +1 -1
- package/dist/{form-CzD0JLxM.cjs.map → form-wI58M85H.cjs.map} +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.js +1 -1
- package/dist/{hashContent-BUqULUiZ.js.map → hashContent-B2IntJQf.js.map} +1 -1
- package/dist/{hashContent-CI39BY-_.cjs.map → hashContent-CahnEuut.cjs.map} +1 -1
- package/dist/{icons-BLFEJFDG.cjs → icons-B6V3nZ4-.cjs} +1 -1
- package/dist/{icons-BLFEJFDG.cjs.map → icons-B6V3nZ4-.cjs.map} +1 -1
- package/dist/{icons-BDcb8dNb.js → icons-C5-DIjet.js} +2 -2
- package/dist/{icons-BDcb8dNb.js.map → icons-C5-DIjet.js.map} +1 -1
- package/dist/icons.cjs +1 -1
- package/dist/icons.js +1 -1
- package/dist/{iframe-qCW0HzwB.js → iframe-BXBsuLwt.js} +1 -1
- package/dist/{iframe-qCW0HzwB.js.map → iframe-BXBsuLwt.js.map} +1 -1
- package/dist/{iframe-CrDpQkhj.cjs → iframe-C7sHg7RC.cjs} +1 -1
- package/dist/{iframe-CrDpQkhj.cjs.map → iframe-C7sHg7RC.cjs.map} +1 -1
- package/dist/iframe.cjs +1 -1
- package/dist/iframe.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +53 -52
- package/dist/{input-C1MIZaKq.cjs → input-BGNZlfL8.cjs} +1 -1
- package/dist/{input-C1MIZaKq.cjs.map → input-BGNZlfL8.cjs.map} +1 -1
- package/dist/{input-Dv-HtkM9.js.map → input-Bc3bVISm.js.map} +1 -1
- package/dist/{input-chip-CyvjhQSw.js → input-chip-CiG61y-N.js} +1 -1
- package/dist/{input-chip-CyvjhQSw.js.map → input-chip-CiG61y-N.js.map} +1 -1
- package/dist/{input-chip-DnfthOSY.cjs → input-chip-p24lkYtY.cjs} +1 -1
- package/dist/{input-chip-DnfthOSY.cjs.map → input-chip-p24lkYtY.cjs.map} +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/{intersection-C0JuW_7U.js.map → intersection-BrXp4YTO.js.map} +1 -1
- package/dist/{intersection-MvbRovUz.cjs → intersection-DqBqnpgh.cjs} +1 -1
- package/dist/{intersection-MvbRovUz.cjs.map → intersection-DqBqnpgh.cjs.map} +1 -1
- package/dist/json.cjs +1 -1
- package/dist/json.js +2 -2
- package/dist/kbd.cjs +1 -1
- package/dist/kbd.js +1 -1
- package/dist/{layout-D0cR3hT1.cjs → layout-B0_IXfov.cjs} +1 -1
- package/dist/{layout-D0cR3hT1.cjs.map → layout-B0_IXfov.cjs.map} +1 -1
- package/dist/{layout-PZCF3kwl.cjs → layout-CTfRXQoz.cjs} +1 -1
- package/dist/{layout-PZCF3kwl.cjs.map → layout-CTfRXQoz.cjs.map} +1 -1
- package/dist/{layout-Y5qo3er8.js → layout-Cqghi_rx.js} +2 -2
- package/dist/{layout-Y5qo3er8.js.map → layout-Cqghi_rx.js.map} +1 -1
- package/dist/{layout-BE2ld1IY.js → layout-fjM1DWlF.js} +1 -1
- package/dist/{layout-BE2ld1IY.js.map → layout-fjM1DWlF.js.map} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +2 -2
- package/dist/lazy-BDNnH_r7.cjs +1 -0
- package/dist/lazy-BDNnH_r7.cjs.map +1 -0
- package/dist/lazy-D6R5N5v4.js +13 -0
- package/dist/lazy-D6R5N5v4.js.map +1 -0
- package/dist/{lightbox-Ce8nMldr.cjs → lightbox-BWKTzA03.cjs} +1 -1
- package/dist/{lightbox-Ce8nMldr.cjs.map → lightbox-BWKTzA03.cjs.map} +1 -1
- package/dist/{lightbox-C_pqYF6q.js → lightbox-CnCTvqSu.js} +3 -3
- package/dist/{lightbox-C_pqYF6q.js.map → lightbox-CnCTvqSu.js.map} +1 -1
- package/dist/lightbox.cjs +1 -1
- package/dist/lightbox.js +1 -1
- package/dist/{list-DcnTGee0.js → list-BpjKUOzM.js} +2 -2
- package/dist/{list-DcnTGee0.js.map → list-BpjKUOzM.js.map} +1 -1
- package/dist/{list-CLc_OQ5k.cjs → list-CMWHu6cV.cjs} +1 -1
- package/dist/{list-CLc_OQ5k.cjs.map → list-CMWHu6cV.cjs.map} +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/{litElement.mixin-Mi8bar6B.js → litElement.mixin-BnNYZ24e.js} +1 -1
- package/dist/{litElement.mixin-Mi8bar6B.js.map → litElement.mixin-BnNYZ24e.js.map} +1 -1
- package/dist/{litElement.mixin-DeT3kAOS.cjs → litElement.mixin-CtQOmwq6.cjs} +1 -1
- package/dist/{litElement.mixin-DeT3kAOS.cjs.map → litElement.mixin-CtQOmwq6.cjs.map} +1 -1
- package/dist/{magnetic-Dj52WplI.js → magnetic-BhXebqF3.js} +2 -2
- package/dist/{magnetic-Dj52WplI.js.map → magnetic-BhXebqF3.js.map} +1 -1
- package/dist/{magnetic-aBBnj_vk.cjs → magnetic-CVXEkYTA.cjs} +1 -1
- package/dist/{magnetic-aBBnj_vk.cjs.map → magnetic-CVXEkYTA.cjs.map} +1 -1
- package/dist/{mailbox-BrLZPj2o.js → mailbox-CHIpxS3W.js} +5 -5
- package/dist/{mailbox-BrLZPj2o.js.map → mailbox-CHIpxS3W.js.map} +1 -1
- package/dist/{mailbox-CE5sTDsQ.cjs → mailbox-Tg1CROVz.cjs} +1 -1
- package/dist/{mailbox-CE5sTDsQ.cjs.map → mailbox-Tg1CROVz.cjs.map} +1 -1
- package/dist/mailbox.cjs +1 -1
- package/dist/mailbox.js +1 -1
- package/dist/{map-SNb-3q5h.js → map-YY1Q4FWO.js} +1 -1
- package/dist/{map-SNb-3q5h.js.map → map-YY1Q4FWO.js.map} +1 -1
- package/dist/{map-CKzhM6uY.cjs → map-Z_dsu-dv.cjs} +1 -1
- package/dist/{map-CKzhM6uY.cjs.map → map-Z_dsu-dv.cjs.map} +1 -1
- package/dist/map.cjs +1 -1
- package/dist/map.js +1 -1
- package/dist/{menu-VErqs9NG.js → menu-BIBUgS1T.js} +2 -2
- package/dist/{menu-VErqs9NG.js.map → menu-BIBUgS1T.js.map} +1 -1
- package/dist/{menu-BnGjBrdD.cjs → menu-DS8Iz4fJ.cjs} +1 -1
- package/dist/{menu-BnGjBrdD.cjs.map → menu-DS8Iz4fJ.cjs.map} +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/mixins.cjs +1 -1
- package/dist/mixins.js +2 -2
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/navigation-bar.cjs +1 -1
- package/dist/navigation-bar.js +1 -1
- package/dist/navigation-rail.cjs +1 -1
- package/dist/navigation-rail.js +1 -1
- package/dist/{notification-B_Fkxv7d.js → notification-ChAvNXf3.js} +3 -3
- package/dist/{notification-B_Fkxv7d.js.map → notification-ChAvNXf3.js.map} +1 -1
- package/dist/{notification-DE5dFf8G.cjs → notification-DPUkuifB.cjs} +1 -1
- package/dist/{notification-DE5dFf8G.cjs.map → notification-DPUkuifB.cjs.map} +1 -1
- package/dist/notification.cjs +1 -1
- package/dist/notification.js +1 -1
- package/dist/{option-DuAlGv27.js → option-Ci7C8xxh.js} +1 -1
- package/dist/{option-DuAlGv27.js.map → option-Ci7C8xxh.js.map} +1 -1
- package/dist/{option-BmbP5ulK.cjs → option-OIp0joyN.cjs} +1 -1
- package/dist/{option-BmbP5ulK.cjs.map → option-OIp0joyN.cjs.map} +1 -1
- package/dist/option.cjs +1 -1
- package/dist/option.js +1 -1
- package/dist/{overlay-stack-J_eJCUTX.cjs.map → overlay-stack-7bs4ZNnh.cjs.map} +1 -1
- package/dist/{overlay-stack-BJt_r6aZ.js.map → overlay-stack-DXPYHPhk.js.map} +1 -1
- package/dist/overlay.cjs +130 -0
- package/dist/overlay.cjs.map +1 -0
- package/dist/overlay.js +570 -0
- package/dist/overlay.js.map +1 -0
- package/dist/page.cjs +1 -1
- package/dist/page.js +4 -4
- package/dist/{progress-Bt9gUiGP.cjs → progress-32Cad1NX.cjs} +1 -1
- package/dist/{progress-Bt9gUiGP.cjs.map → progress-32Cad1NX.cjs.map} +1 -1
- package/dist/{progress-BnXr7aAs.js → progress-DGkwPgDX.js} +1 -1
- package/dist/{progress-BnXr7aAs.js.map → progress-DGkwPgDX.js.map} +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/{provide-Disc6_zz.js → provide-BuzyBLGj.js} +1 -1
- package/dist/{provide-Disc6_zz.js.map → provide-BuzyBLGj.js.map} +1 -1
- package/dist/{provide-CnXCF-UP.cjs → provide-MvHcXKzT.cjs} +1 -1
- package/dist/{provide-CnXCF-UP.cjs.map → provide-MvHcXKzT.cjs.map} +1 -1
- package/dist/qr-scanner.cjs +1 -1
- package/dist/qr-scanner.js +1 -1
- package/dist/{radio-group-BgZgHMoA.js → radio-group-B72sYGnS.js} +1 -1
- package/dist/{radio-group-BgZgHMoA.js.map → radio-group-B72sYGnS.js.map} +1 -1
- package/dist/{radio-group-DkBFgq_3.cjs → radio-group-B7DuNxUq.cjs} +1 -1
- package/dist/{radio-group-DkBFgq_3.cjs.map → radio-group-B7DuNxUq.cjs.map} +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/range.cjs +1 -1
- package/dist/range.js +1 -1
- package/dist/{reduced-motion-DR32yKEO.cjs → reduced-motion-9RjNnhIg.cjs} +1 -1
- package/dist/{reduced-motion-DR32yKEO.cjs.map → reduced-motion-9RjNnhIg.cjs.map} +1 -1
- package/dist/{reduced-motion-B83yZbcO.js.map → reduced-motion-BZTLqAyl.js.map} +1 -1
- package/dist/{rxjs-utils-CN9fv8Xq.js → rxjs-utils-CKTnEKUH.js} +1 -1
- package/dist/{rxjs-utils-CN9fv8Xq.js.map → rxjs-utils-CKTnEKUH.js.map} +1 -1
- package/dist/{rxjs-utils-Vn6DCKgL.cjs → rxjs-utils-DJbZRjp3.cjs} +1 -1
- package/dist/{rxjs-utils-Vn6DCKgL.cjs.map → rxjs-utils-DJbZRjp3.cjs.map} +1 -1
- package/dist/rxjs-utils.cjs +1 -1
- package/dist/rxjs-utils.js +1 -1
- package/dist/{scroll-57rkTHm8.js → scroll-CdmXRXh2.js} +1 -1
- package/dist/{scroll-57rkTHm8.js.map → scroll-CdmXRXh2.js.map} +1 -1
- package/dist/{scroll-hWt0b1gK.cjs → scroll-V1rAZ9fK.cjs} +1 -1
- package/dist/{scroll-hWt0b1gK.cjs.map → scroll-V1rAZ9fK.cjs.map} +1 -1
- package/dist/{search-BlGJ6uJv.js.map → search-CvUZRLF1.js.map} +1 -1
- package/dist/{search-C8eAOzBm.cjs.map → search-CwMav5QB.cjs.map} +1 -1
- package/dist/{select-BDonPD5a.cjs → select-DFxoBgEf.cjs} +1 -1
- package/dist/{select-BDonPD5a.cjs.map → select-DFxoBgEf.cjs.map} +1 -1
- package/dist/{select-CkOAwmxC.js → select-wFDKDLQI.js} +2 -2
- package/dist/{select-CkOAwmxC.js.map → select-wFDKDLQI.js.map} +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/{sheet-Bv2mPHWk.cjs → sheet-DdlZhnDG.cjs} +2 -2
- package/dist/{sheet-Bv2mPHWk.cjs.map → sheet-DdlZhnDG.cjs.map} +1 -1
- package/dist/{sheet-NUgEmozP.js → sheet-LFVo5iN4.js} +4 -4
- package/dist/{sheet-NUgEmozP.js.map → sheet-LFVo5iN4.js.map} +1 -1
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +2 -2
- package/dist/{sheet.service-BKmnlkpZ.cjs → sheet.service-BfNDB0K0.cjs} +1 -1
- package/dist/{sheet.service-BKmnlkpZ.cjs.map → sheet.service-BfNDB0K0.cjs.map} +1 -1
- package/dist/{sheet.service-CanLo8ko.js → sheet.service-DQE7-_wq.js} +3 -3
- package/dist/{sheet.service-CanLo8ko.js.map → sheet.service-DQE7-_wq.js.map} +1 -1
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/skills/INDEX.md +1 -1
- package/dist/skills/overlay.md +200 -0
- package/dist/skills/schmancy/INDEX.md +1 -1
- package/dist/skills/schmancy/overlay.md +200 -0
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -1
- package/dist/{sound.service-BjSoGjmT.cjs → sound.service-BEN6Xjy_.cjs} +1 -1
- package/dist/{sound.service-BjSoGjmT.cjs.map → sound.service-BEN6Xjy_.cjs.map} +1 -1
- package/dist/{sound.service-cdkw3Wkv.js → sound.service-DWZe6swU.js} +1 -1
- package/dist/{sound.service-cdkw3Wkv.js.map → sound.service-DWZe6swU.js.map} +1 -1
- package/dist/{splash-screen-BemqNFNj.cjs → splash-screen-C9HqX2nR.cjs} +1 -1
- package/dist/{splash-screen-BemqNFNj.cjs.map → splash-screen-C9HqX2nR.cjs.map} +1 -1
- package/dist/{splash-screen-B0ppA3f1.js → splash-screen-COg3Z6n8.js} +1 -1
- package/dist/{splash-screen-B0ppA3f1.js.map → splash-screen-COg3Z6n8.js.map} +1 -1
- package/dist/splash-screen.cjs +1 -1
- package/dist/splash-screen.js +1 -1
- package/dist/{src-Cjy9zCiU.js → src-C7niWYur.js} +51 -51
- package/dist/{src-Cjy9zCiU.js.map → src-C7niWYur.js.map} +1 -1
- package/dist/{src-ByGCYD-E.cjs → src-I4M33WK2.cjs} +3 -3
- package/dist/{src-ByGCYD-E.cjs.map → src-I4M33WK2.cjs.map} +1 -1
- package/dist/steps.cjs +1 -1
- package/dist/steps.js +3 -3
- package/dist/{store-CO4nJyGj.cjs → store-CjFHCSDb.cjs} +1 -1
- package/dist/{store-CO4nJyGj.cjs.map → store-CjFHCSDb.cjs.map} +1 -1
- package/dist/{store-Bmj6rvZY.js.map → store-CjzZDQt8.js.map} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.js +1 -1
- package/dist/{surface-CtpWeSGn.js → surface-0XM4DBaT.js} +2 -2
- package/dist/{surface-CtpWeSGn.js.map → surface-0XM4DBaT.js.map} +1 -1
- package/dist/{surface-CoLYICO1.cjs → surface-B6DA01kL.cjs} +1 -1
- package/dist/{surface-CoLYICO1.cjs.map → surface-B6DA01kL.cjs.map} +1 -1
- package/dist/surface.cjs +1 -1
- package/dist/surface.js +1 -1
- package/dist/{surface.mixin-CSKqQH-0.cjs → surface.mixin-DxOi-xo0.cjs} +1 -1
- package/dist/{surface.mixin-CSKqQH-0.cjs.map → surface.mixin-DxOi-xo0.cjs.map} +1 -1
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +1 -1
- package/dist/{table-COQKtlJB.cjs → table-B-DsOqzT.cjs} +2 -2
- package/dist/{table-COQKtlJB.cjs.map → table-B-DsOqzT.cjs.map} +1 -1
- package/dist/{table-bgFb1KYU.js → table-hBEZRxM_.js} +3 -3
- package/dist/{table-bgFb1KYU.js.map → table-hBEZRxM_.js.map} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/{tabs-BicCpU1B.js → tabs-C7r4TqcX.js} +2 -2
- package/dist/{tabs-BicCpU1B.js.map → tabs-C7r4TqcX.js.map} +1 -1
- package/dist/{tabs-CoMJAXDy.cjs → tabs-DZaLZUBy.cjs} +1 -1
- package/dist/{tabs-CoMJAXDy.cjs.map → tabs-DZaLZUBy.cjs.map} +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tailwind.mixin-Bh58QnlW.cjs +2 -0
- package/dist/{tailwind.mixin-BfdVIGgD.cjs.map → tailwind.mixin-Bh58QnlW.cjs.map} +1 -1
- package/dist/tailwind.mixin-H5Pn7vSJ.js +219 -0
- package/dist/{tailwind.mixin-CNdR3zFD.js.map → tailwind.mixin-H5Pn7vSJ.js.map} +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/dist/{textarea-CxTSwn3x.cjs → textarea-B2544vx9.cjs} +1 -1
- package/dist/{textarea-CxTSwn3x.cjs.map → textarea-B2544vx9.cjs.map} +1 -1
- package/dist/{textarea-D7O9Uo15.js → textarea-CS-KdSLz.js} +1 -1
- package/dist/{textarea-D7O9Uo15.js.map → textarea-CS-KdSLz.js.map} +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{theme-DGiyJMTT.js → theme-Cq_c9IO3.js} +7 -7
- package/dist/{theme-DGiyJMTT.js.map → theme-Cq_c9IO3.js.map} +1 -1
- package/dist/{theme-CCez6SRm.cjs → theme-DU5yXaV-.cjs} +1 -1
- package/dist/{theme-CCez6SRm.cjs.map → theme-DU5yXaV-.cjs.map} +1 -1
- package/dist/{theme-button-BV0CxpGn.cjs → theme-button-CPujUbgV.cjs} +1 -1
- package/dist/{theme-button-BV0CxpGn.cjs.map → theme-button-CPujUbgV.cjs.map} +1 -1
- package/dist/{theme-button-s9GfSQL5.js → theme-button-OJl2ma0u.js} +1 -1
- package/dist/{theme-button-s9GfSQL5.js.map → theme-button-OJl2ma0u.js.map} +1 -1
- package/dist/theme-button.cjs +1 -1
- package/dist/theme-button.js +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/{theme.events-EznKK2Y0.cjs.map → theme.events-DakXxZeP.cjs.map} +1 -1
- package/dist/{theme.events-Bw3mYjUA.js.map → theme.events-NuihzD_p.js.map} +1 -1
- package/dist/{theme.interface-Cyqv5XWY.js.map → theme.interface-Buged9Cg.js.map} +1 -1
- package/dist/{theme.interface-CCE3L1ql.cjs.map → theme.interface-DTwkuAKJ.cjs.map} +1 -1
- package/dist/theme.js +5 -5
- package/dist/{theme.service-ETiKUwVy.cjs → theme.service-DxJPUGlu.cjs} +1 -1
- package/dist/{theme.service-ETiKUwVy.cjs.map → theme.service-DxJPUGlu.cjs.map} +1 -1
- package/dist/{theme.service-_qP5WvB9.js → theme.service-cOfPrtfe.js} +2 -2
- package/dist/{theme.service-_qP5WvB9.js.map → theme.service-cOfPrtfe.js.map} +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/{tslib.es6-PMITL0Z3.cjs.map → tslib.es6-Cnt75pb6.cjs.map} +1 -1
- package/dist/{tslib.es6-vJQZBGJO.js.map → tslib.es6-DMzzJKHV.js.map} +1 -1
- package/dist/{typewriter-BTqEQXsX.js → typewriter-DyN7xa0n.js} +5 -5
- package/dist/{typewriter-BTqEQXsX.js.map → typewriter-DyN7xa0n.js.map} +1 -1
- package/dist/{typewriter-DeaL3NfZ.cjs → typewriter-LK0S4NEr.cjs} +1 -1
- package/dist/{typewriter-DeaL3NfZ.cjs.map → typewriter-LK0S4NEr.cjs.map} +1 -1
- package/dist/typewriter.cjs +1 -1
- package/dist/typewriter.js +1 -1
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +1 -1
- package/dist/{utils-C8PD8So2.cjs → utils-2qrmPb78.cjs} +1 -1
- package/dist/{utils-C8PD8So2.cjs.map → utils-2qrmPb78.cjs.map} +1 -1
- package/dist/{utils-DVuCPDfw.js → utils-xBXLvebz.js} +3 -3
- package/dist/{utils-DVuCPDfw.js.map → utils-xBXLvebz.js.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +5 -5
- package/dist/visually-hidden.cjs +1 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/{window-CDHDVOwO.js → window-BWecg8Ih.js} +6 -6
- package/dist/{window-CDHDVOwO.js.map → window-BWecg8Ih.js.map} +1 -1
- package/dist/{window-IGZgxuUC.cjs → window-Cjv2GqSN.cjs} +1 -1
- package/dist/{window-IGZgxuUC.cjs.map → window-Cjv2GqSN.cjs.map} +1 -1
- package/dist/window.cjs +1 -1
- package/dist/window.js +1 -1
- package/package.json +1 -1
- package/skills/schmancy/INDEX.md +1 -1
- package/skills/schmancy/overlay.md +200 -0
- package/src/overlay/index.ts +15 -0
- package/src/overlay/overlay.animations.ts +137 -0
- package/src/overlay/overlay.component.ts +452 -0
- package/src/overlay/overlay.confirm-body.ts +149 -0
- package/src/overlay/overlay.gestures.ts +131 -0
- package/src/overlay/overlay.layout.ts +76 -0
- package/src/overlay/overlay.service.ts +299 -0
- package/src/overlay/overlay.stack.ts +171 -0
- package/src/overlay/overlay.types.ts +146 -0
- package/types/src/overlay/index.d.ts +5 -0
- package/types/src/overlay/overlay.animations.d.ts +26 -0
- package/types/src/overlay/overlay.component.d.ts +48 -0
- package/types/src/overlay/overlay.confirm-body.d.ts +42 -0
- package/types/src/overlay/overlay.gestures.d.ts +39 -0
- package/types/src/overlay/overlay.layout.d.ts +48 -0
- package/types/src/overlay/overlay.service.d.ts +62 -0
- package/types/src/overlay/overlay.stack.d.ts +25 -0
- package/types/src/overlay/overlay.types.d.ts +122 -0
- package/dist/area-CApZWjqs.cjs.map +0 -1
- package/dist/area-D_p1YBgP.js.map +0 -1
- package/dist/chunk-BCfY8kxB.cjs +0 -1
- package/dist/context-C6GwmNJJ.cjs +0 -1
- package/dist/context-oBTPHrbc.js +0 -3
- package/dist/float-yZoLnUg0.cjs +0 -1
- package/dist/tailwind.mixin-BfdVIGgD.cjs +0 -2
- package/dist/tailwind.mixin-CNdR3zFD.js +0 -219
- /package/dist/{animation-Bcwh107v.cjs → animation-CQRdLgzX.cjs} +0 -0
- /package/dist/{animation-CXKSuUoE.js → animation-hXFClrIn.js} +0 -0
- /package/dist/{date-range-inline-B_g1YXu3.js → date-range-inline-CpKG6qt2.js} +0 -0
- /package/dist/{flow-BPDtbhLe.js → flow-BGkHnOnd.js} +0 -0
- /package/dist/{flow-Dn9AZktE.cjs → flow-ClAJ6Qby.cjs} +0 -0
- /package/dist/{form-C1qS9uvS.js → form-rCZqoAoK.js} +0 -0
- /package/dist/{hashContent-BUqULUiZ.js → hashContent-B2IntJQf.js} +0 -0
- /package/dist/{hashContent-CI39BY-_.cjs → hashContent-CahnEuut.cjs} +0 -0
- /package/dist/{input-Dv-HtkM9.js → input-Bc3bVISm.js} +0 -0
- /package/dist/{intersection-C0JuW_7U.js → intersection-BrXp4YTO.js} +0 -0
- /package/dist/{overlay-stack-J_eJCUTX.cjs → overlay-stack-7bs4ZNnh.cjs} +0 -0
- /package/dist/{overlay-stack-BJt_r6aZ.js → overlay-stack-DXPYHPhk.js} +0 -0
- /package/dist/{reduced-motion-B83yZbcO.js → reduced-motion-BZTLqAyl.js} +0 -0
- /package/dist/{search-BlGJ6uJv.js → search-CvUZRLF1.js} +0 -0
- /package/dist/{search-C8eAOzBm.cjs → search-CwMav5QB.cjs} +0 -0
- /package/dist/{store-Bmj6rvZY.js → store-CjzZDQt8.js} +0 -0
- /package/dist/{theme.events-EznKK2Y0.cjs → theme.events-DakXxZeP.cjs} +0 -0
- /package/dist/{theme.events-Bw3mYjUA.js → theme.events-NuihzD_p.js} +0 -0
- /package/dist/{theme.interface-Cyqv5XWY.js → theme.interface-Buged9Cg.js} +0 -0
- /package/dist/{theme.interface-CCE3L1ql.cjs → theme.interface-DTwkuAKJ.cjs} +0 -0
- /package/dist/{tslib.es6-PMITL0Z3.cjs → tslib.es6-Cnt75pb6.cjs} +0 -0
- /package/dist/{tslib.es6-vJQZBGJO.js → tslib.es6-DMzzJKHV.js} +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { filter, fromEvent, merge, Observable, Subject, take, takeUntil, tap } from 'rxjs'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Swipe-to-dismiss gesture for sheet-layout overlays.
|
|
5
|
+
*
|
|
6
|
+
* RxJS-native (rxjs skill principle 3: every async source is an Observable).
|
|
7
|
+
* Returns an Observable that emits `'dismiss'` when the gesture passes the
|
|
8
|
+
* distance/velocity threshold. Caller maps emissions to teardown.
|
|
9
|
+
*
|
|
10
|
+
* Thresholds are policy constants, not magic numbers.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Distance beyond which the gesture dismisses, in px. */
|
|
14
|
+
export const DISMISS_DISTANCE_PX = 80
|
|
15
|
+
/** Distance beyond which the gesture dismisses, as a fraction of sheet height. */
|
|
16
|
+
export const DISMISS_DISTANCE_FRACTION = 0.3
|
|
17
|
+
/** Velocity beyond which the gesture dismisses, in px per ms. */
|
|
18
|
+
export const DISMISS_VELOCITY_PX_PER_MS = 0.5
|
|
19
|
+
/** Drag only starts if touchstart is within this top-px band (unless a drag handle is used). */
|
|
20
|
+
export const DRAG_START_TOP_PX = 40
|
|
21
|
+
/** Snap-back spring duration when gesture doesn't pass threshold. */
|
|
22
|
+
export const SNAP_BACK_MS = 300
|
|
23
|
+
|
|
24
|
+
export interface SwipeInputs {
|
|
25
|
+
/** The surface element to track gestures on. */
|
|
26
|
+
surface: HTMLElement
|
|
27
|
+
/** Optional drag handle. When provided, drag can start from anywhere on
|
|
28
|
+
* the handle; without it, drag must start in the top DRAG_START_TOP_PX band. */
|
|
29
|
+
dragHandle?: HTMLElement | null
|
|
30
|
+
/** Completes the gesture stream (component disconnect / layout change). */
|
|
31
|
+
until$: Observable<unknown>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns an Observable that emits exactly once when the user commits to
|
|
36
|
+
* dismissing the sheet (threshold passed). The gesture is owned by the
|
|
37
|
+
* caller — teardown fires on unsubscribe.
|
|
38
|
+
*
|
|
39
|
+
* During an in-progress drag, the surface's `transform` is updated
|
|
40
|
+
* directly for 1:1 tracking. On release-but-not-dismissed, the surface
|
|
41
|
+
* snaps back via a CSS transition.
|
|
42
|
+
*/
|
|
43
|
+
export function swipeToDismiss$(inputs: SwipeInputs): Observable<'dismiss'> {
|
|
44
|
+
const { surface, dragHandle, until$ } = inputs
|
|
45
|
+
|
|
46
|
+
return new Observable<'dismiss'>((subscriber) => {
|
|
47
|
+
const dragTarget = dragHandle ?? surface
|
|
48
|
+
const stopCurrent$ = new Subject<void>()
|
|
49
|
+
|
|
50
|
+
let dragging = false
|
|
51
|
+
let startY = 0
|
|
52
|
+
let startTime = 0
|
|
53
|
+
let currentDelta = 0
|
|
54
|
+
|
|
55
|
+
const touchStart$ = fromEvent<TouchEvent>(dragTarget, 'touchstart', { passive: true }).pipe(
|
|
56
|
+
// Pinch-zoom guard — only single-finger drags dismiss.
|
|
57
|
+
filter((e) => e.touches.length === 1),
|
|
58
|
+
// If no drag handle, require start within the top band.
|
|
59
|
+
filter((e) => {
|
|
60
|
+
if (dragHandle) return true
|
|
61
|
+
const touch = e.touches[0]
|
|
62
|
+
const rect = surface.getBoundingClientRect()
|
|
63
|
+
return touch.clientY - rect.top <= DRAG_START_TOP_PX
|
|
64
|
+
}),
|
|
65
|
+
tap((e) => {
|
|
66
|
+
dragging = true
|
|
67
|
+
startY = e.touches[0].clientY
|
|
68
|
+
startTime = performance.now()
|
|
69
|
+
currentDelta = 0
|
|
70
|
+
surface.style.transition = 'none'
|
|
71
|
+
surface.style.willChange = 'transform'
|
|
72
|
+
}),
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
const touchMove$ = fromEvent<TouchEvent>(surface, 'touchmove', { passive: false }).pipe(
|
|
76
|
+
filter(() => dragging),
|
|
77
|
+
filter((e) => e.touches.length === 1),
|
|
78
|
+
tap((e) => {
|
|
79
|
+
const deltaY = e.touches[0].clientY - startY
|
|
80
|
+
// Rubber-band on upward drag.
|
|
81
|
+
currentDelta = deltaY < 0 ? deltaY * 0.2 : deltaY
|
|
82
|
+
surface.style.transform = `translateY(${currentDelta}px)`
|
|
83
|
+
e.preventDefault()
|
|
84
|
+
}),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
const touchEnd$ = merge(
|
|
88
|
+
fromEvent<TouchEvent>(surface, 'touchend', { passive: true }),
|
|
89
|
+
fromEvent<TouchEvent>(surface, 'touchcancel', { passive: true }),
|
|
90
|
+
).pipe(
|
|
91
|
+
filter(() => dragging),
|
|
92
|
+
tap(() => {
|
|
93
|
+
dragging = false
|
|
94
|
+
const elapsed = Math.max(1, performance.now() - startTime)
|
|
95
|
+
const velocity = currentDelta / elapsed
|
|
96
|
+
const surfaceHeight = surface.getBoundingClientRect().height
|
|
97
|
+
const distanceThreshold = Math.min(DISMISS_DISTANCE_PX, surfaceHeight * DISMISS_DISTANCE_FRACTION)
|
|
98
|
+
|
|
99
|
+
const shouldDismiss =
|
|
100
|
+
currentDelta > distanceThreshold || (currentDelta > 20 && velocity > DISMISS_VELOCITY_PX_PER_MS)
|
|
101
|
+
|
|
102
|
+
surface.style.willChange = ''
|
|
103
|
+
|
|
104
|
+
if (shouldDismiss) {
|
|
105
|
+
// Finish translate off-screen for visual continuity with the dismiss
|
|
106
|
+
// animation; the caller's teardown will then unmount.
|
|
107
|
+
surface.style.transition = `transform ${SNAP_BACK_MS}ms cubic-bezier(0.16, 1, 0.3, 1)`
|
|
108
|
+
surface.style.transform = 'translateY(100%)'
|
|
109
|
+
subscriber.next('dismiss')
|
|
110
|
+
subscriber.complete()
|
|
111
|
+
} else {
|
|
112
|
+
// Snap back to 0.
|
|
113
|
+
surface.style.transition = `transform ${SNAP_BACK_MS}ms cubic-bezier(0.16, 1, 0.3, 1)`
|
|
114
|
+
surface.style.transform = 'translateY(0)'
|
|
115
|
+
}
|
|
116
|
+
}),
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
merge(touchStart$, touchMove$, touchEnd$)
|
|
120
|
+
.pipe(takeUntil(merge(stopCurrent$, until$)))
|
|
121
|
+
.subscribe()
|
|
122
|
+
|
|
123
|
+
return () => {
|
|
124
|
+
stopCurrent$.next()
|
|
125
|
+
stopCurrent$.complete()
|
|
126
|
+
surface.style.transition = ''
|
|
127
|
+
surface.style.transform = ''
|
|
128
|
+
surface.style.willChange = ''
|
|
129
|
+
}
|
|
130
|
+
}).pipe(take(1))
|
|
131
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Anchor, OverlayLayout } from './overlay.types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Layout dispatch engine — pure function of (anchor, content, viewport).
|
|
5
|
+
* No DOM access, no side effects — testable with synthetic inputs.
|
|
6
|
+
*
|
|
7
|
+
* Thresholds are policy constants, not magic numbers. Changes are visible
|
|
8
|
+
* as named-constant diffs, not hidden in inline literals (state skill:
|
|
9
|
+
* "thresholds ARE the policy").
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Below this viewport width, every overlay becomes a bottom sheet. */
|
|
13
|
+
export const NARROW_VIEWPORT_PX = 640
|
|
14
|
+
|
|
15
|
+
/** Content taller than this fraction of viewport height → sheet. */
|
|
16
|
+
export const TALL_CONTENT_FRACTION = 0.8
|
|
17
|
+
|
|
18
|
+
/** Content wider than this fraction of viewport width → sheet. */
|
|
19
|
+
export const WIDE_CONTENT_FRACTION = 0.9
|
|
20
|
+
|
|
21
|
+
/** Floating UI / CSS anchor-positioning safety padding. */
|
|
22
|
+
export const ANCHOR_FIT_PADDING_PX = 16
|
|
23
|
+
|
|
24
|
+
export interface LayoutInputs {
|
|
25
|
+
anchor?: Anchor
|
|
26
|
+
content: { width: number; height: number }
|
|
27
|
+
viewport: {
|
|
28
|
+
width: number
|
|
29
|
+
height: number
|
|
30
|
+
/** `matchMedia('(pointer: coarse)').matches` at call time. */
|
|
31
|
+
isCoarsePointer: boolean
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Priority order:
|
|
37
|
+
* 1. viewport / content forces sheet
|
|
38
|
+
* 2. anchor provided → anchored (the novel default)
|
|
39
|
+
* 3. fallback → centered
|
|
40
|
+
*
|
|
41
|
+
* Floating UI's `flip` + `shift` + `size` middleware handles "anchor
|
|
42
|
+
* doesn't fit initially" — it returns a fitting position rather than
|
|
43
|
+
* rejecting. So step 2 does NOT branch on "does the anchor fit?";
|
|
44
|
+
* Floating UI's output IS the answer. If content is genuinely too
|
|
45
|
+
* large for any anchored position, step 1 already routed to sheet.
|
|
46
|
+
*/
|
|
47
|
+
export function resolveLayout(inputs: LayoutInputs): OverlayLayout {
|
|
48
|
+
const { anchor, content, viewport } = inputs
|
|
49
|
+
|
|
50
|
+
const isNarrow = viewport.width < NARROW_VIEWPORT_PX
|
|
51
|
+
const isCoarse = viewport.isCoarsePointer
|
|
52
|
+
const contentTall = content.height > viewport.height * TALL_CONTENT_FRACTION
|
|
53
|
+
const contentWide = content.width > viewport.width * WIDE_CONTENT_FRACTION
|
|
54
|
+
|
|
55
|
+
if (isNarrow || isCoarse || contentTall || contentWide) {
|
|
56
|
+
return 'sheet'
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (anchor !== undefined) {
|
|
60
|
+
return 'anchored'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return 'centered'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Read the current viewport + pointer inputs. Separated so tests can
|
|
68
|
+
* substitute synthetic inputs and the `resolveLayout` fn stays pure.
|
|
69
|
+
*/
|
|
70
|
+
export function readViewport(): LayoutInputs['viewport'] {
|
|
71
|
+
return {
|
|
72
|
+
width: window.innerWidth,
|
|
73
|
+
height: window.innerHeight,
|
|
74
|
+
isCoarsePointer: window.matchMedia('(pointer: coarse)').matches,
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defer,
|
|
3
|
+
defaultIfEmpty,
|
|
4
|
+
distinctUntilChanged,
|
|
5
|
+
EMPTY,
|
|
6
|
+
firstValueFrom,
|
|
7
|
+
fromEvent,
|
|
8
|
+
map,
|
|
9
|
+
merge,
|
|
10
|
+
Observable,
|
|
11
|
+
Subject,
|
|
12
|
+
switchMap,
|
|
13
|
+
take,
|
|
14
|
+
takeUntil,
|
|
15
|
+
} from 'rxjs'
|
|
16
|
+
import type { THistoryStrategy } from '../area/router.types'
|
|
17
|
+
import { SchmancyOverlay } from './overlay.component'
|
|
18
|
+
import {
|
|
19
|
+
clearStack,
|
|
20
|
+
currentStack,
|
|
21
|
+
elementsByTag$,
|
|
22
|
+
markModal,
|
|
23
|
+
pushEntry,
|
|
24
|
+
removeEntry,
|
|
25
|
+
stack$ as internalStack$,
|
|
26
|
+
unmarkModal,
|
|
27
|
+
} from './overlay.stack'
|
|
28
|
+
import type {
|
|
29
|
+
CloseReason,
|
|
30
|
+
OverlayConfirmOptions,
|
|
31
|
+
Content,
|
|
32
|
+
OverlayEntry,
|
|
33
|
+
OverlayPromptOptions,
|
|
34
|
+
ShowOptions,
|
|
35
|
+
} from './overlay.types'
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Public read-only stream of the current overlay stack. Subscribe to
|
|
39
|
+
* observe stack changes — e.g. to update a breadcrumb, show a "close
|
|
40
|
+
* all" button, or gate another action while any overlay is open.
|
|
41
|
+
*
|
|
42
|
+
* Emits synchronously with the current snapshot on subscribe. Never
|
|
43
|
+
* completes — the caller owns teardown via `takeUntil(this.disconnecting)`.
|
|
44
|
+
*/
|
|
45
|
+
export const openOverlays$: Observable<readonly OverlayEntry[]> = internalStack$
|
|
46
|
+
|
|
47
|
+
/* ======================================================================= *
|
|
48
|
+
* show *
|
|
49
|
+
* ======================================================================= */
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Open an overlay containing `content`. Returns a cold Observable — the
|
|
53
|
+
* overlay mounts on subscribe and dismisses on unsubscribe. Emits at
|
|
54
|
+
* most one value (the result from content's `close` event) then completes.
|
|
55
|
+
*
|
|
56
|
+
* The subscription IS the overlay lifecycle. `takeUntil(this.disconnecting)`
|
|
57
|
+
* on the caller's side means the overlay auto-dismisses when the caller
|
|
58
|
+
* unmounts — no handles to track, no leaks.
|
|
59
|
+
*
|
|
60
|
+
* **Anchored is the novel default.** When triggered by a user event, pass
|
|
61
|
+
* it as `anchor` — the overlay blooms from the point of attention. Falls
|
|
62
|
+
* back to centered or sheet when the viewport / content makes that the
|
|
63
|
+
* better layout (see overlay.layout.ts).
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* show(MyEditor, { props: { id }, anchor: event })
|
|
67
|
+
* .pipe(takeUntil(this.disconnecting))
|
|
68
|
+
* .subscribe(saved => saved && this.store.persist(saved))
|
|
69
|
+
*/
|
|
70
|
+
export function show<T = void>(
|
|
71
|
+
content: Content,
|
|
72
|
+
options: ShowOptions = {},
|
|
73
|
+
): Observable<T | undefined> {
|
|
74
|
+
return defer(() => {
|
|
75
|
+
return new Observable<T | undefined>((subscriber) => {
|
|
76
|
+
let el: SchmancyOverlay | null = null
|
|
77
|
+
let entry: OverlayEntry | null = null
|
|
78
|
+
let historyPushed = false
|
|
79
|
+
let settled = false
|
|
80
|
+
|
|
81
|
+
const teardown$ = new Subject<void>()
|
|
82
|
+
|
|
83
|
+
const mount = async () => {
|
|
84
|
+
try {
|
|
85
|
+
// Create and append the overlay element.
|
|
86
|
+
el = document.createElement('schmancy-overlay') as SchmancyOverlay
|
|
87
|
+
;(document.body ?? document.documentElement).appendChild(el)
|
|
88
|
+
await el.updateComplete
|
|
89
|
+
|
|
90
|
+
// Open it — mount content, resolve layout, animate in.
|
|
91
|
+
await el.open(content, options)
|
|
92
|
+
|
|
93
|
+
// Register with the stack (post-open so layout is resolved).
|
|
94
|
+
const id = generateId()
|
|
95
|
+
entry = {
|
|
96
|
+
id,
|
|
97
|
+
element: el,
|
|
98
|
+
layout: el.layout,
|
|
99
|
+
}
|
|
100
|
+
pushEntry(entry)
|
|
101
|
+
|
|
102
|
+
// Register modality for the stack-aware inert manager when modal.
|
|
103
|
+
if (el.modal && el.parentElement) {
|
|
104
|
+
markModal(id, el)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// History integration — push a sentinel unless silent.
|
|
108
|
+
const strategy: THistoryStrategy = options.historyStrategy ?? 'push'
|
|
109
|
+
if (strategy === 'push') {
|
|
110
|
+
history.pushState({ __schmancyOverlayId: id }, '', location.href)
|
|
111
|
+
historyPushed = true
|
|
112
|
+
} else if (strategy === 'replace') {
|
|
113
|
+
history.replaceState({ __schmancyOverlayId: id }, '', location.href)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// popstate — close this overlay when the user hits back past us.
|
|
117
|
+
// If another overlay's popstate fires first, that's fine; each overlay
|
|
118
|
+
// handles its own via this listener.
|
|
119
|
+
if (historyPushed) {
|
|
120
|
+
fromEvent<PopStateEvent>(window, 'popstate')
|
|
121
|
+
.pipe(take(1), takeUntil(teardown$))
|
|
122
|
+
.subscribe(() => {
|
|
123
|
+
// Avoid double-pop on teardown — set settled so the
|
|
124
|
+
// teardown fn doesn't call history.back() again.
|
|
125
|
+
settled = true
|
|
126
|
+
void el?.close('popstate')
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Subscribe to the element's internal close$ — the single source of
|
|
131
|
+
// truth for lifecycle completion. Emits reason + optional result.
|
|
132
|
+
el.closed$.pipe(take(1), takeUntil(teardown$)).subscribe(({ result }) => {
|
|
133
|
+
settled = true
|
|
134
|
+
subscriber.next(result as T | undefined)
|
|
135
|
+
subscriber.complete()
|
|
136
|
+
})
|
|
137
|
+
} catch (err) {
|
|
138
|
+
subscriber.error(err)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
void mount()
|
|
143
|
+
|
|
144
|
+
return () => {
|
|
145
|
+
teardown$.next()
|
|
146
|
+
teardown$.complete()
|
|
147
|
+
|
|
148
|
+
// Unsubscribe path — caller cancelled. Tear down the overlay.
|
|
149
|
+
if (el && !settled) {
|
|
150
|
+
void el.close('programmatic')
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Clean up registry entries.
|
|
154
|
+
if (entry) {
|
|
155
|
+
unmarkModal(entry.id)
|
|
156
|
+
removeEntry(entry.id)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Pop history if we pushed one and it's still current.
|
|
160
|
+
if (historyPushed && !settled) {
|
|
161
|
+
// Check before calling — if the user already popped, this is a noop.
|
|
162
|
+
if (history.state?.__schmancyOverlayId === entry?.id) {
|
|
163
|
+
history.back()
|
|
164
|
+
}
|
|
165
|
+
historyPushed = false
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Remove element after exit animation has had a chance to play.
|
|
169
|
+
queueMicrotask(() => {
|
|
170
|
+
el?.remove()
|
|
171
|
+
el = null
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* ======================================================================= *
|
|
179
|
+
* confirm / prompt sugar *
|
|
180
|
+
* ======================================================================= */
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Yes/no confirmation dialog. Returns a Promise that resolves with the
|
|
184
|
+
* user's choice. `variant: 'danger'` flips to destructive styling and
|
|
185
|
+
* `role="alertdialog"`.
|
|
186
|
+
*/
|
|
187
|
+
export async function confirm(options: OverlayConfirmOptions = {}): Promise<boolean> {
|
|
188
|
+
// Lazy-import the confirm body so push-only callers don't ship these
|
|
189
|
+
// deps. The module is small; one-shot import penalty is fine.
|
|
190
|
+
const { SchmancyOverlayPromptBody } = await import('./overlay.confirm-body')
|
|
191
|
+
|
|
192
|
+
const result = await firstValueFrom(
|
|
193
|
+
show<boolean>(SchmancyOverlayPromptBody, {
|
|
194
|
+
anchor: options.anchor,
|
|
195
|
+
signal: options.signal,
|
|
196
|
+
props: {
|
|
197
|
+
mode: 'confirm',
|
|
198
|
+
heading: options.title,
|
|
199
|
+
subtitle: options.subtitle,
|
|
200
|
+
message: options.message,
|
|
201
|
+
confirmText: options.confirmText ?? 'Confirm',
|
|
202
|
+
cancelText: options.cancelText ?? 'Cancel',
|
|
203
|
+
variant: options.variant ?? 'default',
|
|
204
|
+
},
|
|
205
|
+
}).pipe(defaultIfEmpty(false as boolean | undefined)),
|
|
206
|
+
)
|
|
207
|
+
return result === true
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Input prompt dialog. Returns the entered string, or `null` if the user
|
|
212
|
+
* cancels or dismisses.
|
|
213
|
+
*/
|
|
214
|
+
export async function prompt(options: OverlayPromptOptions = {}): Promise<string | null> {
|
|
215
|
+
const { SchmancyOverlayPromptBody } = await import('./overlay.confirm-body')
|
|
216
|
+
|
|
217
|
+
const result = await firstValueFrom(
|
|
218
|
+
show<string | null>(SchmancyOverlayPromptBody, {
|
|
219
|
+
anchor: options.anchor,
|
|
220
|
+
signal: options.signal,
|
|
221
|
+
props: {
|
|
222
|
+
mode: 'prompt',
|
|
223
|
+
heading: options.title,
|
|
224
|
+
subtitle: options.subtitle,
|
|
225
|
+
message: options.message,
|
|
226
|
+
label: options.label,
|
|
227
|
+
defaultValue: options.defaultValue ?? '',
|
|
228
|
+
placeholder: options.placeholder,
|
|
229
|
+
inputType: options.inputType ?? 'text',
|
|
230
|
+
pattern: options.pattern,
|
|
231
|
+
required: options.required ?? false,
|
|
232
|
+
confirmText: options.confirmText ?? 'OK',
|
|
233
|
+
cancelText: options.cancelText ?? 'Cancel',
|
|
234
|
+
},
|
|
235
|
+
}).pipe(defaultIfEmpty(null as string | null | undefined)),
|
|
236
|
+
)
|
|
237
|
+
return typeof result === 'string' ? result : null
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* ======================================================================= *
|
|
241
|
+
* overlayEvents *
|
|
242
|
+
* ======================================================================= */
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Subscribe to custom events emitted from any currently-open overlay
|
|
246
|
+
* whose content matches `tagName`. Inspired by `area.on(name)` — keyed
|
|
247
|
+
* by tag name (stable across HMR / lazy chunks) rather than a uid or
|
|
248
|
+
* class reference.
|
|
249
|
+
*
|
|
250
|
+
* The returned Observable never completes on its own — the caller owns
|
|
251
|
+
* teardown via `takeUntil(this.disconnecting)`. During gaps where no
|
|
252
|
+
* matching overlay is open, no events are emitted; when an instance
|
|
253
|
+
* mounts, events flow.
|
|
254
|
+
*
|
|
255
|
+
* Stacked instances of the same content merge their event streams.
|
|
256
|
+
*/
|
|
257
|
+
export function overlayEvents<E extends Event = CustomEvent>(
|
|
258
|
+
tagName: string,
|
|
259
|
+
eventName: string,
|
|
260
|
+
): Observable<E> {
|
|
261
|
+
return elementsByTag$(tagName).pipe(
|
|
262
|
+
distinctUntilChanged((a, b) => a.length === b.length && a.every((el, i) => el === b[i])),
|
|
263
|
+
switchMap((elements) =>
|
|
264
|
+
elements.length === 0 ? EMPTY : merge(...elements.map((el) => fromEvent<E>(el, eventName))),
|
|
265
|
+
),
|
|
266
|
+
map((e) => e),
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* ======================================================================= *
|
|
271
|
+
* dismissAll *
|
|
272
|
+
* ======================================================================= */
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Close every currently-open overlay. LIFO order. Imperative — use for
|
|
276
|
+
* app-level flows like logout or route reset.
|
|
277
|
+
*/
|
|
278
|
+
export function dismissAll(): void {
|
|
279
|
+
const stack = [...currentStack()]
|
|
280
|
+
// LIFO: close top-of-stack first.
|
|
281
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
282
|
+
const entry = stack[i]
|
|
283
|
+
const overlay = entry.element as SchmancyOverlay
|
|
284
|
+
void overlay.close('programmatic')
|
|
285
|
+
}
|
|
286
|
+
clearStack()
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* ======================================================================= *
|
|
290
|
+
* helpers *
|
|
291
|
+
* ======================================================================= */
|
|
292
|
+
|
|
293
|
+
function generateId(): string {
|
|
294
|
+
// 8-char base36 is enough entropy for session-scoped uniqueness.
|
|
295
|
+
return 'ov_' + Math.random().toString(36).slice(2, 10) + Date.now().toString(36)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Re-export the close reason type for consumers who want to narrow on it.
|
|
299
|
+
export type { CloseReason }
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { BehaviorSubject, distinctUntilChanged, map, Observable } from 'rxjs'
|
|
2
|
+
import type { OverlayEntry } from './overlay.types'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Overlay stack — single source of truth for "what is currently open."
|
|
6
|
+
*
|
|
7
|
+
* A module-scope BehaviorSubject matching the `schmancy` skill's
|
|
8
|
+
* "contexts at module scope; many small contexts beat one monolith"
|
|
9
|
+
* guidance. Reactive pipelines inside the overlay service and public
|
|
10
|
+
* `openOverlays$` observable project off this.
|
|
11
|
+
*
|
|
12
|
+
* Scroll lock and the stack-aware inert manager are both derived from
|
|
13
|
+
* the stack state — no separate mutable counter variables. Honors rxjs
|
|
14
|
+
* SUBSCRIPTION_IS_STATE: the stack IS the state; scroll lock / inert
|
|
15
|
+
* are declarative projections.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const stack$$ = new BehaviorSubject<readonly OverlayEntry[]>([])
|
|
19
|
+
|
|
20
|
+
/** Public read-only stream of the current stack. Emits on every push/pop. */
|
|
21
|
+
export const stack$: Observable<readonly OverlayEntry[]> = stack$$.asObservable()
|
|
22
|
+
|
|
23
|
+
/** Synchronous snapshot. Use only when a component can't subscribe. */
|
|
24
|
+
export function currentStack(): readonly OverlayEntry[] {
|
|
25
|
+
return stack$$.value
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Append an entry (top of stack). */
|
|
29
|
+
export function pushEntry(entry: OverlayEntry): void {
|
|
30
|
+
stack$$.next([...stack$$.value, entry])
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Remove by id. No-op if the id is not in the stack. */
|
|
34
|
+
export function removeEntry(id: string): void {
|
|
35
|
+
const current = stack$$.value
|
|
36
|
+
const next = current.filter((e) => e.id !== id)
|
|
37
|
+
if (next.length !== current.length) {
|
|
38
|
+
stack$$.next(next)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Clear the entire stack. Used by dismissAll(). */
|
|
43
|
+
export function clearStack(): void {
|
|
44
|
+
if (stack$$.value.length > 0) {
|
|
45
|
+
stack$$.next([])
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Top entry (LIFO). Undefined when stack is empty. */
|
|
50
|
+
export function topEntry(): OverlayEntry | undefined {
|
|
51
|
+
const s = stack$$.value
|
|
52
|
+
return s[s.length - 1]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* ---------------- scroll lock -------------------------------------------- */
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Ref-counted body scroll lock, derived from the stack's length.
|
|
59
|
+
* Subscription is idempotent — subscribing multiple times won't stack
|
|
60
|
+
* effects, because it's a distinctUntilChanged boolean projection.
|
|
61
|
+
*
|
|
62
|
+
* Inner overlay close does NOT release the lock while an outer is still
|
|
63
|
+
* open (this was the pre-existing bug in sheet.service.ts).
|
|
64
|
+
*/
|
|
65
|
+
let scrollLockActive = false
|
|
66
|
+
let previousOverflow = ''
|
|
67
|
+
let previousScrollbarGutter = ''
|
|
68
|
+
|
|
69
|
+
stack$$
|
|
70
|
+
.pipe(
|
|
71
|
+
map((s) => s.length > 0),
|
|
72
|
+
distinctUntilChanged(),
|
|
73
|
+
)
|
|
74
|
+
.subscribe((shouldLock) => {
|
|
75
|
+
if (typeof document === 'undefined') return
|
|
76
|
+
|
|
77
|
+
if (shouldLock && !scrollLockActive) {
|
|
78
|
+
previousOverflow = document.documentElement.style.overflow
|
|
79
|
+
previousScrollbarGutter = document.documentElement.style.getPropertyValue('scrollbar-gutter')
|
|
80
|
+
document.documentElement.style.overflow = 'hidden'
|
|
81
|
+
document.documentElement.style.setProperty('scrollbar-gutter', 'stable')
|
|
82
|
+
scrollLockActive = true
|
|
83
|
+
} else if (!shouldLock && scrollLockActive) {
|
|
84
|
+
document.documentElement.style.overflow = previousOverflow
|
|
85
|
+
if (previousScrollbarGutter) {
|
|
86
|
+
document.documentElement.style.setProperty('scrollbar-gutter', previousScrollbarGutter)
|
|
87
|
+
} else {
|
|
88
|
+
document.documentElement.style.removeProperty('scrollbar-gutter')
|
|
89
|
+
}
|
|
90
|
+
previousOverflow = ''
|
|
91
|
+
previousScrollbarGutter = ''
|
|
92
|
+
scrollLockActive = false
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
/* ---------------- stack-aware inert -------------------------------------- */
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* When the first modal overlay opens, mark every sibling outside the
|
|
100
|
+
* overlay host subtree as `inert` so AT and keyboard focus can't reach
|
|
101
|
+
* them. Restored when the last modal overlay closes.
|
|
102
|
+
*
|
|
103
|
+
* Note: native `<dialog>.showModal()` already inerts the rest of the
|
|
104
|
+
* document automatically. We keep this as a safety net for:
|
|
105
|
+
* - anchored (popover) overlays which are non-modal by design but may
|
|
106
|
+
* carry `modal: true` as the escape hatch;
|
|
107
|
+
* - stacked overlays where an inner modal opens above a non-modal —
|
|
108
|
+
* the sibling-inert is a no-op but we still guarantee the invariant.
|
|
109
|
+
*
|
|
110
|
+
* Callers that don't want inert (anchored/menu overlays) skip registration
|
|
111
|
+
* via `markNonModal(id)`.
|
|
112
|
+
*/
|
|
113
|
+
const modalIds = new Set<string>()
|
|
114
|
+
const inertedSiblings = new Set<HTMLElement>()
|
|
115
|
+
|
|
116
|
+
export function markModal(id: string, hostContainer: HTMLElement): void {
|
|
117
|
+
modalIds.add(id)
|
|
118
|
+
if (modalIds.size === 1) {
|
|
119
|
+
applyInert(hostContainer)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function unmarkModal(id: string): void {
|
|
124
|
+
modalIds.delete(id)
|
|
125
|
+
if (modalIds.size === 0) {
|
|
126
|
+
releaseInert()
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function applyInert(hostContainer: HTMLElement): void {
|
|
131
|
+
const parent = hostContainer.parentElement ?? document.body
|
|
132
|
+
for (let i = 0; i < parent.children.length; i++) {
|
|
133
|
+
const child = parent.children[i]
|
|
134
|
+
if (child !== hostContainer && child instanceof HTMLElement && !child.inert) {
|
|
135
|
+
child.inert = true
|
|
136
|
+
inertedSiblings.add(child)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function releaseInert(): void {
|
|
142
|
+
for (const el of inertedSiblings) {
|
|
143
|
+
el.inert = false
|
|
144
|
+
}
|
|
145
|
+
inertedSiblings.clear()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* ---------------- overlayEvents multicast helper ------------------------- */
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Returns an Observable of `tagName` elements currently in the stack.
|
|
152
|
+
* The overlayEvents public helper composes `fromEvent` over this stream
|
|
153
|
+
* via switchMap to tap events without owning the overlay lifecycle.
|
|
154
|
+
*
|
|
155
|
+
* Stays alive across open/close cycles — the caller owns completion via
|
|
156
|
+
* `takeUntil(this.disconnecting)`, matching the house rxjs convention.
|
|
157
|
+
*/
|
|
158
|
+
export function elementsByTag$(tagName: string): Observable<readonly HTMLElement[]> {
|
|
159
|
+
const lower = tagName.toLowerCase()
|
|
160
|
+
return stack$$.pipe(
|
|
161
|
+
map((entries) => {
|
|
162
|
+
const matches: HTMLElement[] = []
|
|
163
|
+
for (const entry of entries) {
|
|
164
|
+
const inner = entry.element.querySelector<HTMLElement>(lower)
|
|
165
|
+
if (inner) matches.push(inner)
|
|
166
|
+
}
|
|
167
|
+
return matches
|
|
168
|
+
}),
|
|
169
|
+
distinctUntilChanged((a, b) => a.length === b.length && a.every((el, i) => el === b[i])),
|
|
170
|
+
)
|
|
171
|
+
}
|