@mhmo91/schmancy 0.10.14 → 0.10.16
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 +2554 -3086
- package/dist/active-host-BP0zy_Y9.js +63 -0
- package/dist/{active-host-CvNYoprt.js.map → active-host-BP0zy_Y9.js.map} +1 -1
- package/dist/active-host-jH3iloCR.cjs +1 -0
- package/dist/{active-host-CcIa2tmW.cjs.map → active-host-jH3iloCR.cjs.map} +1 -1
- package/dist/agent/schmancy.agent.js +2579 -2385
- package/dist/agent/schmancy.agent.js.map +1 -1
- package/dist/agent/schmancy.manifest.json +971 -1189
- package/dist/{animation-CO_Csq84.cjs.map → animation-CCOIW4wJ.cjs.map} +1 -1
- package/dist/{animation-BK-8BwY8.js.map → animation-DCznELuT.js.map} +1 -1
- package/dist/{area-C_kgZZhN.js → area-ChxsDTu_.js} +2 -2
- package/dist/{area-C_kgZZhN.js.map → area-ChxsDTu_.js.map} +1 -1
- package/dist/{area-DFPtKzWy.cjs → area-Qt6yUnuA.cjs} +3 -3
- package/dist/{area-DFPtKzWy.cjs.map → area-Qt6yUnuA.cjs.map} +1 -1
- package/dist/area.cjs +1 -1
- package/dist/area.js +2 -2
- package/dist/{audio-CluX8Qpq.cjs → audio-D-TZzpXF.cjs} +1 -1
- package/dist/{audio-CluX8Qpq.cjs.map → audio-D-TZzpXF.cjs.map} +1 -1
- package/dist/{audio-DcXphulJ.js → audio-DS43uoRA.js} +1 -1
- package/dist/{audio-DcXphulJ.js.map → audio-DS43uoRA.js.map} +1 -1
- package/dist/audio.cjs +1 -1
- package/dist/audio.js +2 -2
- package/dist/{autocomplete-DWSuwSRS.js → autocomplete-CXvUjMD-.js} +46 -71
- package/dist/autocomplete-CXvUjMD-.js.map +1 -0
- package/dist/autocomplete-Ck2zbdF9.cjs +115 -0
- package/dist/autocomplete-Ck2zbdF9.cjs.map +1 -0
- package/dist/autocomplete.cjs +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/avatar.cjs +2 -2
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.js +3 -3
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{boat-CZma2ojF.js → boat-Bj0wVcZi.js} +5 -5
- package/dist/{boat-CZma2ojF.js.map → boat-Bj0wVcZi.js.map} +1 -1
- package/dist/{boat-Dy6cc3hB.cjs → boat-DpFkILFF.cjs} +2 -2
- package/dist/{boat-Dy6cc3hB.cjs.map → boat-DpFkILFF.cjs.map} +1 -1
- package/dist/boat.cjs +1 -1
- package/dist/boat.js +1 -1
- package/dist/breadcrumb.cjs +3 -3
- package/dist/breadcrumb.cjs.map +1 -1
- package/dist/breadcrumb.js +2 -2
- package/dist/{busy-DCsqryvq.cjs → busy-CtcnclA3.cjs} +3 -3
- package/dist/{busy-DCsqryvq.cjs.map → busy-CtcnclA3.cjs.map} +1 -1
- package/dist/{busy-DeV2ByMw.js → busy-CyZSBnZP.js} +2 -2
- package/dist/{busy-DeV2ByMw.js.map → busy-CyZSBnZP.js.map} +1 -1
- package/dist/busy.cjs +1 -1
- package/dist/busy.js +1 -1
- package/dist/button.cjs +4 -4
- package/dist/button.cjs.map +1 -1
- package/dist/button.js +19 -4
- package/dist/button.js.map +1 -1
- package/dist/{card--GgSX4X5.cjs → card-Cl6jp1yX.cjs} +5 -5
- package/dist/{card--GgSX4X5.cjs.map → card-Cl6jp1yX.cjs.map} +1 -1
- package/dist/{card-BTTsHzJJ.js → card-nYZCKmOO.js} +3 -3
- package/dist/{card-BTTsHzJJ.js.map → card-nYZCKmOO.js.map} +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{checkbox-NNReP9s_.cjs → checkbox-BeNo0ZGt.cjs} +4 -4
- package/dist/{checkbox-Cj5j-ppk.js.map → checkbox-BeNo0ZGt.cjs.map} +1 -1
- package/dist/{checkbox-Cj5j-ppk.js → checkbox-DiUrZiyc.js} +17 -30
- package/dist/checkbox-DiUrZiyc.js.map +1 -0
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{chips-CP-CbfoZ.js → chips-CfPFXv7Z.js} +5 -5
- package/dist/{chips-CP-CbfoZ.js.map → chips-CfPFXv7Z.js.map} +1 -1
- package/dist/{chips-iporOXxK.cjs → chips-DK6m-VCM.cjs} +5 -5
- package/dist/{chips-iporOXxK.cjs.map → chips-DK6m-VCM.cjs.map} +1 -1
- package/dist/chips.cjs +1 -1
- package/dist/chips.js +2 -2
- package/dist/connectivity.cjs +2 -2
- package/dist/connectivity.cjs.map +1 -1
- package/dist/connectivity.js +3 -3
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{context-DJTJnSK4.js.map → context-6oXCZmZN.js.map} +1 -1
- package/dist/{context-BpCETidA.cjs.map → context-CRZeiCqq.cjs.map} +1 -1
- package/dist/{cursor-glow-Bulq-38P.cjs → cursor-glow-C8LgCxpI.cjs} +1 -1
- package/dist/{cursor-glow-Bulq-38P.cjs.map → cursor-glow-C8LgCxpI.cjs.map} +1 -1
- package/dist/{cursor-glow-Ah7VXSj7.js → cursor-glow-Cs2XLDB9.js} +1 -1
- package/dist/{cursor-glow-Ah7VXSj7.js.map → cursor-glow-Cs2XLDB9.js.map} +1 -1
- package/dist/date-range-DA6anfcF.cjs +131 -0
- package/dist/date-range-DA6anfcF.cjs.map +1 -0
- package/dist/{date-range-CgNujP8r.js → date-range-DjlF2u7o.js} +124 -89
- package/dist/date-range-DjlF2u7o.js.map +1 -0
- package/dist/date-range-inline-BfYK795W.cjs +43 -0
- package/dist/{date-range-inline-D4IjOOO0.cjs.map → date-range-inline-BfYK795W.cjs.map} +1 -1
- package/dist/{date-range-inline-C2PXX_GY.js → date-range-inline-n7y_H6PJ.js} +2 -2
- package/dist/{date-range-inline-C2PXX_GY.js.map → date-range-inline-n7y_H6PJ.js.map} +1 -1
- package/dist/date-range-inline.cjs +1 -1
- package/dist/date-range-inline.js +1 -1
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/delay.cjs +2 -2
- package/dist/delay.cjs.map +1 -1
- package/dist/delay.js +3 -3
- package/dist/{details-DT2b3xOn.cjs → details-BdAVsLl-.cjs} +2 -2
- package/dist/{details-DT2b3xOn.cjs.map → details-BdAVsLl-.cjs.map} +1 -1
- package/dist/{details-VjaNwtfd.js → details-CS_ToAOj.js} +6 -6
- package/dist/{details-VjaNwtfd.js.map → details-CS_ToAOj.js.map} +1 -1
- package/dist/details.cjs +1 -1
- package/dist/details.js +1 -1
- package/dist/directives.cjs +1 -1
- package/dist/directives.js +5 -5
- package/dist/{divider-BMO8pzEO.js → divider-COLK0RbT.js} +2 -2
- package/dist/{divider-BMO8pzEO.js.map → divider-COLK0RbT.js.map} +1 -1
- package/dist/{divider-BW33TZ-X.cjs → divider-CvWAnvdO.cjs} +2 -2
- package/dist/{divider-BW33TZ-X.cjs.map → divider-CvWAnvdO.cjs.map} +1 -1
- package/dist/divider.cjs +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.cjs +3 -3
- package/dist/dropdown.cjs.map +1 -1
- package/dist/dropdown.js +2 -2
- package/dist/{expand-DbELKKOt.js → expand-D9LzmpoV.js} +5 -5
- package/dist/{expand-DbELKKOt.js.map → expand-D9LzmpoV.js.map} +1 -1
- package/dist/{expand-_f5EUKWB.cjs → expand-r2sATPUJ.cjs} +3 -3
- package/dist/{expand-_f5EUKWB.cjs.map → expand-r2sATPUJ.cjs.map} +1 -1
- package/dist/expand.cjs +1 -1
- package/dist/expand.js +1 -1
- package/dist/float-2nHYuBx-.cjs +1 -0
- package/dist/{float-CKmd-0-t.cjs.map → float-2nHYuBx-.cjs.map} +1 -1
- package/dist/{float-B6RBb2dN.js → float-BWy39CXr.js} +2 -2
- package/dist/{float-B6RBb2dN.js.map → float-BWy39CXr.js.map} +1 -1
- package/dist/float.cjs +1 -1
- package/dist/float.js +1 -1
- package/dist/form-DhjedCWm.js +258 -0
- package/dist/form-DhjedCWm.js.map +1 -0
- package/dist/form-g5c70rac.cjs +42 -0
- package/dist/form-g5c70rac.cjs.map +1 -0
- package/dist/form.cjs +1 -1
- package/dist/form.js +2 -2
- package/dist/handover/agent-runtime-followups.md +1 -1
- package/dist/handover/agent-runtime-v1.md +3 -3
- package/dist/{hashContent-Bobsobip.cjs.map → hashContent-Ck6laKlk.cjs.map} +1 -1
- package/dist/{hashContent-BU6jl5ih.js.map → hashContent-dJrI-9sc.js.map} +1 -1
- package/dist/{icons-r-S17M8U.cjs → icons-1HIENBco.cjs} +2 -2
- package/dist/{icons-r-S17M8U.cjs.map → icons-1HIENBco.cjs.map} +1 -1
- package/dist/{icons-CoDo95Cu.js → icons-3y0kr1aB.js} +3 -3
- package/dist/{icons-CoDo95Cu.js.map → icons-3y0kr1aB.js.map} +1 -1
- package/dist/icons.cjs +1 -1
- package/dist/icons.js +1 -1
- package/dist/{iframe-P9c_qg1-.cjs → iframe-CjqYuZG5.cjs} +2 -2
- package/dist/{iframe-P9c_qg1-.cjs.map → iframe-CjqYuZG5.cjs.map} +1 -1
- package/dist/{iframe-k4oI-TIj.js → iframe-Z5gTK-gd.js} +2 -2
- package/dist/{iframe-k4oI-TIj.js.map → iframe-Z5gTK-gd.js.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 +60 -60
- package/dist/{input-D95GjINh.js → input-B-fw6f_r.js} +103 -104
- package/dist/input-B-fw6f_r.js.map +1 -0
- package/dist/input-BtcIhu0Q.cjs +52 -0
- package/dist/input-BtcIhu0Q.cjs.map +1 -0
- package/dist/{input-chip-DpC_XEKN.js → input-chip-CtQ0pH5b.js} +2 -2
- package/dist/{input-chip-DpC_XEKN.js.map → input-chip-CtQ0pH5b.js.map} +1 -1
- package/dist/{input-chip-D0ZXqTt5.cjs → input-chip-DZktYohr.cjs} +2 -2
- package/dist/{input-chip-D0ZXqTt5.cjs.map → input-chip-DZktYohr.cjs.map} +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/json.cjs +2 -2
- package/dist/json.cjs.map +1 -1
- package/dist/json.js +3 -3
- package/dist/kbd.cjs +2 -2
- package/dist/kbd.cjs.map +1 -1
- package/dist/kbd.js +2 -2
- package/dist/{layout-CXPNsUIo.js → layout-BH28sKGc.js} +1 -1
- package/dist/{layout-CXPNsUIo.js.map → layout-BH28sKGc.js.map} +1 -1
- package/dist/{layout-Zhe7wSZ_.cjs → layout-Delq-QvR.cjs} +1 -1
- package/dist/{layout-Zhe7wSZ_.cjs.map → layout-Delq-QvR.cjs.map} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +1 -1
- package/dist/{lazy-Dq9mRRjT.cjs.map → lazy-CayEFyC3.cjs.map} +1 -1
- package/dist/{lazy-B0ia54tT.js.map → lazy-D-bO2r4m.js.map} +1 -1
- package/dist/{lightbox-C-yHeoK0.cjs → lightbox-BHTZOn8K.cjs} +3 -3
- package/dist/{lightbox-C-yHeoK0.cjs.map → lightbox-BHTZOn8K.cjs.map} +1 -1
- package/dist/{lightbox-CovQtmyn.js → lightbox-BL3LWp-P.js} +9 -9
- package/dist/{lightbox-CovQtmyn.js.map → lightbox-BL3LWp-P.js.map} +1 -1
- package/dist/lightbox.cjs +1 -1
- package/dist/lightbox.js +1 -1
- package/dist/{list-CAijuky4.cjs → list-CHYa5VGY.cjs} +3 -3
- package/dist/{list-CAijuky4.cjs.map → list-CHYa5VGY.cjs.map} +1 -1
- package/dist/{list-C1pR9vhu.js → list-DLJL1JQj.js} +2 -2
- package/dist/{list-C1pR9vhu.js.map → list-DLJL1JQj.js.map} +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/{magnetic-BJgB1dVi.cjs → magnetic-Bgh7aHHI.cjs} +1 -1
- package/dist/{magnetic-BJgB1dVi.cjs.map → magnetic-Bgh7aHHI.cjs.map} +1 -1
- package/dist/{magnetic-YwCNvtbB.js → magnetic-DxvoEz8_.js} +2 -2
- package/dist/{magnetic-YwCNvtbB.js.map → magnetic-DxvoEz8_.js.map} +1 -1
- package/dist/{menu-B59vZv9n.js → menu-BNq93w6X.js} +3 -3
- package/dist/{menu-B59vZv9n.js.map → menu-BNq93w6X.js.map} +1 -1
- package/dist/{menu-BaHO3Cip.cjs → menu-DAikvkeV.cjs} +3 -3
- package/dist/{menu-BaHO3Cip.cjs.map → menu-DAikvkeV.cjs.map} +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/mixins-BOOu6q2n.cjs +298 -0
- package/dist/mixins-BOOu6q2n.cjs.map +1 -0
- package/dist/mixins-BWb9_e1s.js +680 -0
- package/dist/mixins-BWb9_e1s.js.map +1 -0
- 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 +3 -3
- package/dist/navigation-rail.cjs.map +1 -1
- package/dist/navigation-rail.js +2 -2
- package/dist/{notification-BeLoVa47.js → notification-CUmb9c3Y.js} +4 -4
- package/dist/{notification-BeLoVa47.js.map → notification-CUmb9c3Y.js.map} +1 -1
- package/dist/notification-Dy2azMyt.cjs +23 -0
- package/dist/{notification-BC9nG8Sr.cjs.map → notification-Dy2azMyt.cjs.map} +1 -1
- package/dist/notification.cjs +1 -1
- package/dist/notification.js +1 -1
- package/dist/{option-BWF4GBp-.cjs → option-CDgIKifG.cjs} +2 -2
- package/dist/{option-BWF4GBp-.cjs.map → option-CDgIKifG.cjs.map} +1 -1
- package/dist/{option-UvlSAcC4.js → option-DFvQ551b.js} +2 -2
- package/dist/{option-UvlSAcC4.js.map → option-DFvQ551b.js.map} +1 -1
- package/dist/option.cjs +1 -1
- package/dist/option.js +1 -1
- package/dist/{overlay-stack-DCDS17uj.js.map → overlay-stack-BR4iYivO.js.map} +1 -1
- package/dist/{overlay-stack-DPIe_aYv.cjs.map → overlay-stack-Dk0xETTy.cjs.map} +1 -1
- package/dist/overlay.cjs +2 -2
- package/dist/overlay.cjs.map +1 -1
- package/dist/{overlay.confirm-body-URtE1gI3.cjs → overlay.confirm-body-BkhNvr0c.cjs} +2 -2
- package/dist/{overlay.confirm-body-URtE1gI3.cjs.map → overlay.confirm-body-BkhNvr0c.cjs.map} +1 -1
- package/dist/{overlay.confirm-body-9W0B5QGv.js → overlay.confirm-body-uFp-0Zfh.js} +2 -2
- package/dist/{overlay.confirm-body-9W0B5QGv.js.map → overlay.confirm-body-uFp-0Zfh.js.map} +1 -1
- package/dist/overlay.js +8 -8
- package/dist/{overlay.service-DnZTcKyJ.cjs → overlay.service-1YWfUD2S.cjs} +1 -1
- package/dist/{overlay.service-DnZTcKyJ.cjs.map → overlay.service-1YWfUD2S.cjs.map} +1 -1
- package/dist/{overlay.service-CVqs2Gu1.js → overlay.service-BcF12kGb.js} +2 -2
- package/dist/{overlay.service-CVqs2Gu1.js.map → overlay.service-BcF12kGb.js.map} +1 -1
- package/dist/page.cjs +2 -2
- package/dist/page.cjs.map +1 -1
- package/dist/page.js +5 -5
- package/dist/{progress-CwzwY8Oe.cjs → progress-C02sWkmE.cjs} +2 -2
- package/dist/{progress-CwzwY8Oe.cjs.map → progress-C02sWkmE.cjs.map} +1 -1
- package/dist/{progress-C29Uw-WJ.js → progress-bLbGRuQ1.js} +2 -2
- package/dist/{progress-C29Uw-WJ.js.map → progress-bLbGRuQ1.js.map} +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/radio-group-BA-jRct5.cjs +40 -0
- package/dist/radio-group-BA-jRct5.cjs.map +1 -0
- package/dist/{radio-group-CW8airhZ.js → radio-group-DA4eIGCj.js} +4 -4
- package/dist/radio-group-DA4eIGCj.js.map +1 -0
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/range.cjs +6 -4
- package/dist/range.cjs.map +1 -1
- package/dist/range.js +19 -15
- package/dist/range.js.map +1 -1
- package/dist/{reduced-motion-D-L12p7G.js.map → reduced-motion-D7LqTUMn.js.map} +1 -1
- package/dist/{reduced-motion-Ds-HjMzn.cjs.map → reduced-motion-Dzfp_w5x.cjs.map} +1 -1
- package/dist/{rxjs-utils-CVeJQ9KG.js.map → rxjs-utils-D9U4MW0Q.js.map} +1 -1
- package/dist/{rxjs-utils-DCUHg_Ml.cjs.map → rxjs-utils-kWPShgKu.cjs.map} +1 -1
- package/dist/rxjs-utils.cjs +1 -1
- package/dist/rxjs-utils.js +1 -1
- package/dist/{scroll-BotoGcMU.js → scroll-CG5up5oy.js} +2 -2
- package/dist/{scroll-BotoGcMU.js.map → scroll-CG5up5oy.js.map} +1 -1
- package/dist/{scroll-CmhmUebp.cjs → scroll-D8vBF_gY.cjs} +2 -2
- package/dist/{scroll-CmhmUebp.cjs.map → scroll-D8vBF_gY.cjs.map} +1 -1
- package/dist/{search-BLCRsxIC.cjs.map → search-DPKoC-dT.cjs.map} +1 -1
- package/dist/{search-BTz7-Rev.js.map → search-MvIBA93K.js.map} +1 -1
- package/dist/{select-Dbn-CImU.js → select-BrK1BJoU.js} +52 -73
- package/dist/select-BrK1BJoU.js.map +1 -0
- package/dist/select-Dh2j7Qc-.cjs +56 -0
- package/dist/select-Dh2j7Qc-.cjs.map +1 -0
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/skeleton.cjs +2 -2
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.js +2 -2
- package/dist/skills/autocomplete.md +16 -3
- package/dist/skills/button.md +19 -0
- package/dist/skills/checkbox.md +19 -0
- package/dist/skills/date-range.md +19 -0
- package/dist/skills/form-ux-rules.md +55 -0
- package/dist/skills/form.md +121 -25
- package/dist/skills/input.md +19 -4
- package/dist/skills/range.md +15 -1
- package/dist/skills/schmancy/autocomplete.md +16 -3
- package/dist/skills/schmancy/button.md +19 -0
- package/dist/skills/schmancy/checkbox.md +19 -0
- package/dist/skills/schmancy/date-range.md +19 -0
- package/dist/skills/schmancy/form-ux-rules.md +55 -0
- package/dist/skills/schmancy/form.md +121 -25
- package/dist/skills/schmancy/input.md +19 -4
- package/dist/skills/schmancy/range.md +15 -1
- package/dist/skills/schmancy/select.md +13 -1
- package/dist/skills/schmancy/state.md +5 -0
- package/dist/skills/schmancy/switch.md +21 -2
- package/dist/skills/schmancy/textarea.md +13 -0
- package/dist/skills/select.md +13 -1
- package/dist/skills/state.md +5 -0
- package/dist/skills/switch.md +21 -2
- package/dist/skills/textarea.md +13 -0
- package/dist/slider.cjs +3 -3
- package/dist/slider.cjs.map +1 -1
- package/dist/slider.js +2 -2
- package/dist/{sound.service-kKfsN0m-.js → sound.service-BIN2W7Rv.js} +1 -1
- package/dist/{sound.service-kKfsN0m-.js.map → sound.service-BIN2W7Rv.js.map} +1 -1
- package/dist/{sound.service-BGs6m0Cm.cjs → sound.service-DyY78ukR.cjs} +1 -1
- package/dist/{sound.service-BGs6m0Cm.cjs.map → sound.service-DyY78ukR.cjs.map} +1 -1
- package/dist/{splash-screen-DtkjCJYo.js → splash-screen-BcjjJSlK.js} +2 -2
- package/dist/{splash-screen-DtkjCJYo.js.map → splash-screen-BcjjJSlK.js.map} +1 -1
- package/dist/{splash-screen-DlQUv-kV.cjs → splash-screen-Kr1sPtME.cjs} +2 -2
- package/dist/{splash-screen-DlQUv-kV.cjs.map → splash-screen-Kr1sPtME.cjs.map} +1 -1
- package/dist/splash-screen.cjs +1 -1
- package/dist/splash-screen.js +1 -1
- package/dist/{src-DEUjlTsX.cjs → src-B2-CU8fu.cjs} +11 -11
- package/dist/{src-DEUjlTsX.cjs.map → src-B2-CU8fu.cjs.map} +1 -1
- package/dist/{src-D6e0adHi.js → src-DvywUq7l.js} +38 -38
- package/dist/{src-D6e0adHi.js.map → src-DvywUq7l.js.map} +1 -1
- package/dist/state-avic94Ft.cjs +1 -0
- package/dist/{state-DNdCPITt.cjs.map → state-avic94Ft.cjs.map} +1 -1
- package/dist/{state-BusMG6sM.js → state-nm8yzMPp.js} +1 -2
- package/dist/{state-BusMG6sM.js.map → state-nm8yzMPp.js.map} +1 -1
- package/dist/state.cjs +1 -1
- package/dist/state.js +2 -2
- package/dist/steps.cjs +3 -3
- package/dist/steps.cjs.map +1 -1
- package/dist/steps.js +2 -2
- package/dist/{surface-A82O1kgu.js → surface-BtMMHKol.js} +2 -2
- package/dist/{surface-A82O1kgu.js.map → surface-BtMMHKol.js.map} +1 -1
- package/dist/surface-CgXeKdGL.cjs +7 -0
- package/dist/{surface-BpppoNXN.cjs.map → surface-CgXeKdGL.cjs.map} +1 -1
- package/dist/surface.cjs +1 -1
- package/dist/surface.js +1 -1
- package/dist/switch.cjs +3 -3
- package/dist/switch.cjs.map +1 -1
- package/dist/switch.js +27 -43
- package/dist/switch.js.map +1 -1
- package/dist/table.cjs +3 -3
- package/dist/table.cjs.map +1 -1
- package/dist/table.js +2 -2
- package/dist/{tabs-cVHHd1dY.js → tabs-CikPr7by.js} +2 -2
- package/dist/{tabs-cVHHd1dY.js.map → tabs-CikPr7by.js.map} +1 -1
- package/dist/{tabs-TO3UiBsm.cjs → tabs-CitVls3_.cjs} +2 -2
- package/dist/{tabs-TO3UiBsm.cjs.map → tabs-CitVls3_.cjs.map} +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/dist/textarea-CqV1wvmB.cjs +43 -0
- package/dist/textarea-CqV1wvmB.cjs.map +1 -0
- package/dist/textarea-DVkwQSis.js +186 -0
- package/dist/textarea-DVkwQSis.js.map +1 -0
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{theme-CT408FqH.js → theme-BIWS4TOW.js} +9 -9
- package/dist/{theme-CT408FqH.js.map → theme-BIWS4TOW.js.map} +1 -1
- package/dist/theme-DMgjiKda.cjs +181 -0
- package/dist/{theme-CpuF3D3q.cjs.map → theme-DMgjiKda.cjs.map} +1 -1
- package/dist/{theme-button-pTb5-Wxx.js → theme-button-DC_shZ_7.js} +2 -2
- package/dist/{theme-button-pTb5-Wxx.js.map → theme-button-DC_shZ_7.js.map} +1 -1
- package/dist/theme-button-ENKa3TPT.cjs +8 -0
- package/dist/{theme-button-B6Xf-EiH.cjs.map → theme-button-ENKa3TPT.cjs.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.interface-B9TjbSBF.js.map → theme.interface-C8OHheXg.js.map} +1 -1
- package/dist/{theme.interface-BujperTo.cjs.map → theme.interface-CYo4UpWK.cjs.map} +1 -1
- package/dist/theme.js +4 -4
- package/dist/{theme.service-DIUo1mBP.js → theme.service-BOWIT_5k.js} +1 -1
- package/dist/{theme.service-DIUo1mBP.js.map → theme.service-BOWIT_5k.js.map} +1 -1
- package/dist/{theme.service-Cfk88qHK.cjs → theme.service-DkdH1t60.cjs} +1 -1
- package/dist/{theme.service-Cfk88qHK.cjs.map → theme.service-DkdH1t60.cjs.map} +1 -1
- package/dist/tree.cjs +2 -2
- package/dist/tree.cjs.map +1 -1
- package/dist/tree.js +2 -2
- package/dist/typography.cjs +2 -2
- package/dist/typography.cjs.map +1 -1
- package/dist/typography.js +2 -2
- package/dist/{utils-kND2Z9Xg.js → utils-Cj_nRRyx.js} +2 -2
- package/dist/{utils-kND2Z9Xg.js.map → utils-Cj_nRRyx.js.map} +1 -1
- package/dist/{utils-Dt5PpmaQ.cjs → utils-D2QUu4-g.cjs} +1 -1
- package/dist/{utils-Dt5PpmaQ.cjs.map → utils-D2QUu4-g.cjs.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +4 -4
- package/dist/visually-hidden.cjs +2 -2
- package/dist/visually-hidden.cjs.map +1 -1
- package/dist/visually-hidden.js +2 -2
- package/dist/{window-CuBcOxbc.js → window-BTecgE_U.js} +7 -7
- package/dist/{window-CuBcOxbc.js.map → window-BTecgE_U.js.map} +1 -1
- package/dist/{window-CSKvv4Ts.cjs → window-DGydMS0g.cjs} +2 -2
- package/dist/{window-CSKvv4Ts.cjs.map → window-DGydMS0g.cjs.map} +1 -1
- package/dist/window.cjs +1 -1
- package/dist/window.js +1 -1
- package/package.json +1 -1
- package/skills/schmancy/autocomplete.md +16 -3
- package/skills/schmancy/button.md +19 -0
- package/skills/schmancy/checkbox.md +19 -0
- package/skills/schmancy/date-range.md +19 -0
- package/skills/schmancy/form-ux-rules.md +55 -0
- package/skills/schmancy/form.md +121 -25
- package/skills/schmancy/input.md +19 -4
- package/skills/schmancy/range.md +15 -1
- package/skills/schmancy/select.md +13 -1
- package/skills/schmancy/state.md +5 -0
- package/skills/schmancy/switch.md +21 -2
- package/skills/schmancy/textarea.md +13 -0
- package/src/button/button.test.ts +122 -0
- package/src/button/button.ts +36 -0
- package/src/{autocomplete → form/fields/autocomplete}/autocomplete.ts +48 -75
- package/src/{checkbox → form/fields/checkbox}/checkbox.test.ts +1 -1
- package/src/form/fields/checkbox/checkbox.ts +126 -0
- package/src/form/fields/date-range/date-range.test.ts +102 -0
- package/src/{date-range → form/fields/date-range}/date-range.ts +90 -7
- package/src/form/fields/input/input.test.ts +201 -0
- package/src/{input → form/fields/input}/input.ts +153 -238
- package/src/{radio-group → form/fields/radio-group}/radio-button.ts +1 -1
- package/src/{radio-group → form/fields/radio-group}/radio-group.ts +1 -1
- package/src/form/fields/range/range.test.ts +90 -0
- package/src/{range → form/fields/range}/range.ts +34 -13
- package/src/{select → form/fields/select}/select.ts +77 -108
- package/src/{switch → form/fields/switch}/switch.test.ts +1 -1
- package/src/{switch → form/fields/switch}/switch.ts +71 -51
- package/src/form/fields/textarea/textarea.test.ts +54 -0
- package/src/{textarea → form/fields/textarea}/textarea.ts +33 -72
- package/src/form/form-state.ts +31 -0
- package/src/form/form-summary.test.ts +105 -0
- package/src/form/form-summary.ts +171 -0
- package/src/form/form.test.ts +218 -35
- package/src/form/form.ts +330 -99
- package/src/form/index.ts +2 -0
- package/src/index.ts +9 -9
- package/types/mixins/formField.mixin.d.ts +90 -0
- package/types/src/button/button.d.ts +9 -0
- package/types/src/button/button.test.d.ts +3 -0
- package/types/src/{autocomplete → form/fields/autocomplete}/autocomplete.d.ts +6 -15
- package/types/src/form/fields/checkbox/checkbox.d.ts +47 -0
- package/types/src/{date-range → form/fields/date-range}/date-range.d.ts +22 -4
- package/types/src/form/fields/date-range/date-range.test.d.ts +1 -0
- package/types/src/{input → form/fields/input}/input.d.ts +20 -45
- package/types/src/form/fields/input/input.test.d.ts +1 -0
- package/types/src/{radio-group → form/fields/radio-group}/radio-button.d.ts +1 -1
- package/types/src/{radio-group → form/fields/radio-group}/radio-group.d.ts +1 -1
- package/types/src/form/fields/range/range.d.ts +28 -0
- package/types/src/form/fields/range/range.test.d.ts +1 -0
- package/types/src/{select → form/fields/select}/select.d.ts +23 -24
- package/types/src/form/fields/switch/switch.d.ts +57 -0
- package/types/src/{textarea → form/fields/textarea}/textarea.d.ts +6 -39
- package/types/src/form/fields/textarea/textarea.test.d.ts +1 -0
- package/types/src/form/form-state.d.ts +22 -0
- package/types/src/form/form-summary.d.ts +42 -0
- package/types/src/form/form-summary.test.d.ts +4 -0
- package/types/src/form/form.d.ts +79 -34
- package/types/src/form/form.test.d.ts +2 -2
- package/types/src/form/index.d.ts +2 -0
- package/types/src/index.d.ts +9 -9
- package/dist/active-host-CcIa2tmW.cjs +0 -1
- package/dist/active-host-CvNYoprt.js +0 -57
- package/dist/autocomplete-DWSuwSRS.js.map +0 -1
- package/dist/autocomplete-iCJOia-q.cjs +0 -115
- package/dist/autocomplete-iCJOia-q.cjs.map +0 -1
- package/dist/checkbox-NNReP9s_.cjs.map +0 -1
- package/dist/date-range-CaOxwZDq.cjs +0 -131
- package/dist/date-range-CaOxwZDq.cjs.map +0 -1
- package/dist/date-range-CgNujP8r.js.map +0 -1
- package/dist/date-range-inline-D4IjOOO0.cjs +0 -43
- package/dist/decorate-23nYs4Le.js +0 -7
- package/dist/decorate-DpFmy0nm.cjs +0 -1
- package/dist/float-CKmd-0-t.cjs +0 -1
- package/dist/form-CFvwnfuJ.js +0 -68
- package/dist/form-CFvwnfuJ.js.map +0 -1
- package/dist/form-Ceijw1aA.cjs +0 -1
- package/dist/form-Ceijw1aA.cjs.map +0 -1
- package/dist/input-D95GjINh.js.map +0 -1
- package/dist/input-D9s4jDAb.cjs +0 -51
- package/dist/input-D9s4jDAb.cjs.map +0 -1
- package/dist/mixins-BV0w2yIE.js +0 -627
- package/dist/mixins-BV0w2yIE.js.map +0 -1
- package/dist/mixins-DvAYa-F7.cjs +0 -298
- package/dist/mixins-DvAYa-F7.cjs.map +0 -1
- package/dist/notification-BC9nG8Sr.cjs +0 -23
- package/dist/radio-group-ByMD6Lsj.cjs +0 -40
- package/dist/radio-group-ByMD6Lsj.cjs.map +0 -1
- package/dist/radio-group-CW8airhZ.js.map +0 -1
- package/dist/select-BdBThja4.cjs +0 -56
- package/dist/select-BdBThja4.cjs.map +0 -1
- package/dist/select-Dbn-CImU.js.map +0 -1
- package/dist/state-DNdCPITt.cjs +0 -1
- package/dist/surface-BpppoNXN.cjs +0 -7
- package/dist/textarea-B9dy-yec.js +0 -211
- package/dist/textarea-B9dy-yec.js.map +0 -1
- package/dist/textarea-DFY0Flgv.cjs +0 -39
- package/dist/textarea-DFY0Flgv.cjs.map +0 -1
- package/dist/theme-CpuF3D3q.cjs +0 -181
- package/dist/theme-button-B6Xf-EiH.cjs +0 -8
- package/src/checkbox/checkbox.ts +0 -162
- package/types/src/checkbox/checkbox.d.ts +0 -71
- package/types/src/range/range.d.ts +0 -25
- package/types/src/switch/switch.d.ts +0 -53
- /package/dist/{animation-CO_Csq84.cjs → animation-CCOIW4wJ.cjs} +0 -0
- /package/dist/{animation-BK-8BwY8.js → animation-DCznELuT.js} +0 -0
- /package/dist/{context-DJTJnSK4.js → context-6oXCZmZN.js} +0 -0
- /package/dist/{context-BpCETidA.cjs → context-CRZeiCqq.cjs} +0 -0
- /package/dist/{hashContent-Bobsobip.cjs → hashContent-Ck6laKlk.cjs} +0 -0
- /package/dist/{hashContent-BU6jl5ih.js → hashContent-dJrI-9sc.js} +0 -0
- /package/dist/{lazy-Dq9mRRjT.cjs → lazy-CayEFyC3.cjs} +0 -0
- /package/dist/{lazy-B0ia54tT.js → lazy-D-bO2r4m.js} +0 -0
- /package/dist/{overlay-stack-DCDS17uj.js → overlay-stack-BR4iYivO.js} +0 -0
- /package/dist/{overlay-stack-DPIe_aYv.cjs → overlay-stack-Dk0xETTy.cjs} +0 -0
- /package/dist/{reduced-motion-D-L12p7G.js → reduced-motion-D7LqTUMn.js} +0 -0
- /package/dist/{reduced-motion-Ds-HjMzn.cjs → reduced-motion-Dzfp_w5x.cjs} +0 -0
- /package/dist/{rxjs-utils-CVeJQ9KG.js → rxjs-utils-D9U4MW0Q.js} +0 -0
- /package/dist/{rxjs-utils-DCUHg_Ml.cjs → rxjs-utils-kWPShgKu.cjs} +0 -0
- /package/dist/{search-BLCRsxIC.cjs → search-DPKoC-dT.cjs} +0 -0
- /package/dist/{search-BTz7-Rev.js → search-MvIBA93K.js} +0 -0
- /package/dist/{theme.interface-B9TjbSBF.js → theme.interface-C8OHheXg.js} +0 -0
- /package/dist/{theme.interface-BujperTo.cjs → theme.interface-CYo4UpWK.cjs} +0 -0
- /package/src/{autocomplete → form/fields/autocomplete}/autocomplete.scss +0 -0
- /package/src/{autocomplete → form/fields/autocomplete}/index.ts +0 -0
- /package/src/{checkbox → form/fields/checkbox}/index.ts +0 -0
- /package/src/{date-range → form/fields/date-range}/date-range-dialog.ts +0 -0
- /package/src/{date-range → form/fields/date-range}/date-range-helpers.ts +0 -0
- /package/src/{date-range → form/fields/date-range}/date-range-presets.ts +0 -0
- /package/src/{date-range → form/fields/date-range}/date-utils.ts +0 -0
- /package/src/{date-range → form/fields/date-range}/index.ts +0 -0
- /package/src/{input → form/fields/input}/index.ts +0 -0
- /package/src/{input → form/fields/input}/input.scss +0 -0
- /package/src/{radio-group → form/fields/radio-group}/index.ts +0 -0
- /package/src/{radio-group → form/fields/radio-group}/radio-group.scss +0 -0
- /package/src/{range → form/fields/range}/index.ts +0 -0
- /package/src/{select → form/fields/select}/index.ts +0 -0
- /package/src/{switch → form/fields/switch}/index.ts +0 -0
- /package/src/{textarea → form/fields/textarea}/index.ts +0 -0
- /package/src/{textarea → form/fields/textarea}/textarea.scss +0 -0
- /package/types/src/{autocomplete → form/fields/autocomplete}/index.d.ts +0 -0
- /package/types/src/{checkbox → form/fields/checkbox}/checkbox.test.d.ts +0 -0
- /package/types/src/{checkbox → form/fields/checkbox}/index.d.ts +0 -0
- /package/types/src/{date-range → form/fields/date-range}/date-range-dialog.d.ts +0 -0
- /package/types/src/{date-range → form/fields/date-range}/date-range-helpers.d.ts +0 -0
- /package/types/src/{date-range → form/fields/date-range}/date-range-presets.d.ts +0 -0
- /package/types/src/{date-range → form/fields/date-range}/date-utils.d.ts +0 -0
- /package/types/src/{date-range → form/fields/date-range}/index.d.ts +0 -0
- /package/types/src/{input → form/fields/input}/index.d.ts +0 -0
- /package/types/src/{radio-group → form/fields/radio-group}/index.d.ts +0 -0
- /package/types/src/{range → form/fields/range}/index.d.ts +0 -0
- /package/types/src/{select → form/fields/select}/index.d.ts +0 -0
- /package/types/src/{switch → form/fields/switch}/index.d.ts +0 -0
- /package/types/src/{switch → form/fields/switch}/switch.test.d.ts +0 -0
- /package/types/src/{textarea → form/fields/textarea}/index.d.ts +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function e(e, t, n, r) {
|
|
2
|
+
var i, a = arguments.length, o = a < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r;
|
|
3
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") o = Reflect.decorate(e, t, n, r);
|
|
4
|
+
else for (var s = e.length - 1; s >= 0; s--) (i = e[s]) && (o = (a < 3 ? i(o) : a > 3 ? i(t, n, o) : i(t, n)) || o);
|
|
5
|
+
return a > 3 && o && Object.defineProperty(t, n, o), o;
|
|
6
|
+
}
|
|
7
|
+
var t = Symbol.for("schmancy.state.activeHost.stack"), n = globalThis;
|
|
8
|
+
n[t] ??= { stack: [void 0] };
|
|
9
|
+
var r = n[t].stack;
|
|
10
|
+
if (typeof Promise < "u" && !("t" in Promise.prototype)) {
|
|
11
|
+
Object.defineProperty(Promise.prototype, "t", {
|
|
12
|
+
value: !0,
|
|
13
|
+
configurable: !1,
|
|
14
|
+
enumerable: !1,
|
|
15
|
+
writable: !1
|
|
16
|
+
});
|
|
17
|
+
let e = Promise.prototype.then;
|
|
18
|
+
Promise.prototype.then = function(t, n) {
|
|
19
|
+
let i = r[r.length - 1], a = t && ((e) => {
|
|
20
|
+
r.push(i);
|
|
21
|
+
try {
|
|
22
|
+
return t(e);
|
|
23
|
+
} finally {
|
|
24
|
+
r.pop();
|
|
25
|
+
}
|
|
26
|
+
}), o = n && ((e) => {
|
|
27
|
+
r.push(i);
|
|
28
|
+
try {
|
|
29
|
+
return n(e);
|
|
30
|
+
} finally {
|
|
31
|
+
r.pop();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return e.call(this, a, o);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
var i = {
|
|
38
|
+
run(e, t) {
|
|
39
|
+
r.push(e);
|
|
40
|
+
try {
|
|
41
|
+
return t();
|
|
42
|
+
} finally {
|
|
43
|
+
r.pop();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
get: () => r[r.length - 1]
|
|
47
|
+
}, a = Symbol.for("schmancy.state.activeHost.eventHost"), o = globalThis[a] ??= {
|
|
48
|
+
host: void 0,
|
|
49
|
+
scheduled: !1
|
|
50
|
+
};
|
|
51
|
+
function s(e) {
|
|
52
|
+
o.host = e, o.scheduled || (o.scheduled = !0, queueMicrotask(() => {
|
|
53
|
+
o.scheduled = !1, o.host = void 0;
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
function c() {
|
|
57
|
+
let e = i.get();
|
|
58
|
+
return e === void 0 ? o.host === void 0 ? typeof document < "u" && document.activeElement instanceof HTMLElement ? document.activeElement : void 0 : o.host : e;
|
|
59
|
+
}
|
|
60
|
+
function l(e) {
|
|
61
|
+
return Symbol.for(`schmancy.state:${e}`);
|
|
62
|
+
}
|
|
63
|
+
export { e as a, l as i, s as n, c as r, i as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-host-CvNYoprt.js","names":[],"sources":["../src/state/active-host.ts"],"sourcesContent":["// `_`-prefixed identifiers below are an intentional naming convention for\n// module-private infrastructure. `_activeHost` is exported only so the\n// $LitElement mixin can wrap render/lifecycle in `_activeHost.run`; the\n// underscore signals \"not part of the public state API.\"\n/* oxlint-disable no-underscore-dangle */\n\n// Active-host tracker for context-aware state resolution.\n//\n// Polyfills the TC39 `AsyncContext.Variable` propagation primitive using a\n// stack + a one-time `Promise.prototype.then` patch. The stack value carries\n// across `await`, `queueMicrotask`, RxJS subscription callbacks, and any\n// other code path that ultimately routes through `Promise.then`. This is the\n// same capture-and-restore technique zone.js, async-hooks, and the various\n// AsyncContext userland polyfills use.\n//\n// Why we own this:\n// - The TC39 proposal is at stage 2; no official polyfill ships from TC39.\n// - The `async-context@1.0.0` package on npm is unrelated (a 2014 Node\n// callback helper), and the available userland polyfills either depend\n// on zone.js (~50 KB) or are Node-only / hobby quality.\n// - The patch surface is ~30 lines, idempotent, preserves Promise\n// semantics (delegates to the original `then`, so `Symbol.species` and\n// subclassing work unchanged), and decommissions cleanly the day a real\n// polyfill or native AsyncContext lands (drop the file, swap the\n// `_activeHost` export for the standard primitive).\n//\n// Known limitation — native await on a native Promise: V8's await\n// optimization (since 7.x) skips the spec-prescribed\n// `Promise.resolve(x).then(continuation)` step, so userland `then`\n// patches don't intercept the resumption. Class methods that mutate\n// state across an `await` boundary will fall back to the\n// module-scoped global, not the active-host's isolated copy. To\n// preserve the host across awaits, either keep the mutation in the\n// synchronous prelude before the first `await`, or explicitly chain\n// with `.then()` (which still routes through the patched method).\n// A real fix requires either a build-time async-function transform\n// or native AsyncContext.Variable in the runtime.\n//\n// resolveActiveHost() fallback chain:\n// 1. Stack value set by `_activeHost.run(host, fn)` — covers render(),\n// Lit lifecycle methods, and class-method handlers (all wrapped by\n// SchmancyElement's prototype-chain wrap).\n// 2. The closest `<schmancy-context>` whose subtree currently has an\n// in-flight DOM event. The element installs capture-phase listeners\n// that publish itself as the event-host while the synchronous\n// handler chain runs; the slot clears via microtask. Covers\n// template-bound inline arrow handlers attached to descendants.\n// 3. document.activeElement — keyboard handlers in focus.\n// 4. undefined → caller falls back to the module-scoped global instance.\n\n// Singleton across any number of schmancy module copies (source + dist, ESM\n// + CJS, hoisted vs. nested node_modules) via the runtime-global symbol\n// registry. The first copy to load creates the slot; later copies reuse it.\n// Without this, two stacks → mixins push to one, state reads from the other,\n// and active-host context is lost across the boundary.\nconst STACK_KEY = Symbol.for('schmancy.state.activeHost.stack')\ntype StackSlot = { stack: Array<HTMLElement | undefined> }\nconst _g = globalThis as { [STACK_KEY]?: StackSlot }\n_g[STACK_KEY] ??= { stack: [undefined] }\nconst _stack = _g[STACK_KEY].stack\n\n// One-time Promise.prototype.then patch at module init. Each .then() call\n// captures the stack head at chain time; firing the callback restores that\n// captured value for the duration of the callback. The guard property\n// prevents double-patching across HMR / duplicate module loads.\ndeclare global {\n\tinterface Promise<T> {\n\t\t// Marker symbol so we can detect (and skip) re-patching.\n\t\treadonly __schmancyActiveHostPatched?: true\n\t}\n}\n\n// Patching Promise.prototype is the entire mechanism this module exists to\n// provide — the lint rules below intentionally do not apply.\n/* oxlint-disable no-extend-native, unicorn/no-thenable */\nif (typeof Promise !== 'undefined' && !('__schmancyActiveHostPatched' in Promise.prototype)) {\n\tObject.defineProperty(Promise.prototype, '__schmancyActiveHostPatched', {\n\t\tvalue: true,\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\twritable: false,\n\t})\n\tconst _origThen = Promise.prototype.then\n\t// Replace with our wrapper. We delegate to the original `then` via\n\t// `_origThen.call(this, …)` so Promise subclassing / Symbol.species behave\n\t// exactly as before — the only added work is the stack push/pop around\n\t// each user callback.\n\tPromise.prototype.then = function schmancyThen<T, R1, R2>(\n\t\tthis: Promise<T>,\n\t\tonfulfilled?: ((value: T) => R1 | PromiseLike<R1>) | null,\n\t\tonrejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n\t): Promise<R1 | R2> {\n\t\tconst captured = _stack[_stack.length - 1]\n\t\tconst wrapFulfilled = onfulfilled\n\t\t\t? (v: T): R1 | PromiseLike<R1> => {\n\t\t\t\t\t_stack.push(captured)\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn onfulfilled(v)\n\t\t\t\t\t} finally {\n\t\t\t\t\t\t_stack.pop()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: onfulfilled\n\t\tconst wrapRejected = onrejected\n\t\t\t? (r: unknown): R2 | PromiseLike<R2> => {\n\t\t\t\t\t_stack.push(captured)\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn onrejected(r)\n\t\t\t\t\t} finally {\n\t\t\t\t\t\t_stack.pop()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: onrejected\n\t\treturn _origThen.call(this, wrapFulfilled, wrapRejected) as Promise<R1 | R2>\n\t}\n}\n/* oxlint-enable no-extend-native, unicorn/no-thenable */\n\nexport const _activeHost = {\n\t/** Run `fn` with `host` as the active host for the duration of `fn` and\n\t * any awaits / microtasks / Promise chains that descend from it. */\n\trun<R>(host: HTMLElement | undefined, fn: () => R): R {\n\t\t_stack.push(host)\n\t\ttry {\n\t\t\treturn fn()\n\t\t} finally {\n\t\t\t_stack.pop()\n\t\t}\n\t},\n\t/** The current active host, or undefined if no `run()` is on the stack. */\n\tget(): HTMLElement | undefined {\n\t\treturn _stack[_stack.length - 1]\n\t},\n}\n\n// Tier 2 of the resolveActiveHost() fallback chain. A `<schmancy-context>`\n// publishes itself here from a capture-phase event listener attached to\n// itself; the slot clears in the next microtask, after the synchronous\n// event-handler chain has run. `window.event` is unreliable across both\n// engines and time (it can outlive its event — a stale `message` event\n// from postMessage can leak BODY for arbitrary later resolution calls), so\n// we own this slot rather than read the legacy global.\n//\n// Singleton across module copies for the same reason as `_stack` above.\nconst EVENT_HOST_KEY = Symbol.for('schmancy.state.activeHost.eventHost')\ntype EventHostSlot = { host: HTMLElement | undefined; scheduled: boolean }\nconst _eventHostSlot: EventHostSlot =\n\t((globalThis as { [EVENT_HOST_KEY]?: EventHostSlot })[EVENT_HOST_KEY] ??= {\n\t\thost: undefined,\n\t\tscheduled: false,\n\t})\n\n/** Publish `host` as the active event-host. The slot self-clears at the\n * end of the current microtask checkpoint — long enough for the entire\n * synchronous event-handler chain to read it, short enough that no\n * later, unrelated microtask sees a stale value. */\nexport function _publishEventHost(host: HTMLElement): void {\n\t_eventHostSlot.host = host\n\tif (_eventHostSlot.scheduled) return\n\t_eventHostSlot.scheduled = true\n\tqueueMicrotask(() => {\n\t\t_eventHostSlot.scheduled = false\n\t\t_eventHostSlot.host = undefined\n\t})\n}\n\nexport function resolveActiveHost(): HTMLElement | undefined {\n\t// 1. Stack (set by _activeHost.run).\n\tconst fromStack = _activeHost.get()\n\tif (fromStack !== undefined) return fromStack\n\n\t// 2. Closest <schmancy-context> with an in-flight event in its subtree.\n\tif (_eventHostSlot.host !== undefined) return _eventHostSlot.host\n\n\t// 3. document.activeElement — keyboard / focus handlers.\n\tif (typeof document !== 'undefined' && document.activeElement instanceof HTMLElement) {\n\t\treturn document.activeElement\n\t}\n\n\t// 4. undefined — caller falls back to module-scoped.\n\treturn undefined\n}\n\n/** Stable context key for a state namespace. `Symbol.for(...)` so the same\n * namespace string yields the same symbol across module boundaries — the\n * ContextProvider on `<schmancy-context>` and the ContextRequestEvent\n * dispatched by a state read must agree on identity. */\nexport function stateContextKey(namespace: string): symbol {\n\treturn Symbol.for(`schmancy.state:${namespace}`)\n}\n"],"mappings":"AAuDA,IAAM,IAAY,OAAO,IAAI,kC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AAA,KADjB,IAH8C,EAAe,OAHzB;;AAkBrC,SAAgB,EAAgB,GAAA;AAC/B,QAAO,OAAO,IAAI,kBAAkB,IAAA;;AAAA,SAAA,KAAA,GAAA,KAAA,GAAA,KAAA,GAAA,KAAA"}
|
|
1
|
+
{"version":3,"file":"active-host-BP0zy_Y9.js","names":[],"sources":["../src/state/active-host.ts"],"sourcesContent":["// `_`-prefixed identifiers below are an intentional naming convention for\n// module-private infrastructure. `_activeHost` is exported only so the\n// $LitElement mixin can wrap render/lifecycle in `_activeHost.run`; the\n// underscore signals \"not part of the public state API.\"\n/* oxlint-disable no-underscore-dangle */\n\n// Active-host tracker for context-aware state resolution.\n//\n// Polyfills the TC39 `AsyncContext.Variable` propagation primitive using a\n// stack + a one-time `Promise.prototype.then` patch. The stack value carries\n// across `await`, `queueMicrotask`, RxJS subscription callbacks, and any\n// other code path that ultimately routes through `Promise.then`. This is the\n// same capture-and-restore technique zone.js, async-hooks, and the various\n// AsyncContext userland polyfills use.\n//\n// Why we own this:\n// - The TC39 proposal is at stage 2; no official polyfill ships from TC39.\n// - The `async-context@1.0.0` package on npm is unrelated (a 2014 Node\n// callback helper), and the available userland polyfills either depend\n// on zone.js (~50 KB) or are Node-only / hobby quality.\n// - The patch surface is ~30 lines, idempotent, preserves Promise\n// semantics (delegates to the original `then`, so `Symbol.species` and\n// subclassing work unchanged), and decommissions cleanly the day a real\n// polyfill or native AsyncContext lands (drop the file, swap the\n// `_activeHost` export for the standard primitive).\n//\n// Known limitation — native await on a native Promise: V8's await\n// optimization (since 7.x) skips the spec-prescribed\n// `Promise.resolve(x).then(continuation)` step, so userland `then`\n// patches don't intercept the resumption. Class methods that mutate\n// state across an `await` boundary will fall back to the\n// module-scoped global, not the active-host's isolated copy. To\n// preserve the host across awaits, either keep the mutation in the\n// synchronous prelude before the first `await`, or explicitly chain\n// with `.then()` (which still routes through the patched method).\n// A real fix requires either a build-time async-function transform\n// or native AsyncContext.Variable in the runtime.\n//\n// resolveActiveHost() fallback chain:\n// 1. Stack value set by `_activeHost.run(host, fn)` — covers render(),\n// Lit lifecycle methods, and class-method handlers (all wrapped by\n// SchmancyElement's prototype-chain wrap).\n// 2. The closest `<schmancy-context>` whose subtree currently has an\n// in-flight DOM event. The element installs capture-phase listeners\n// that publish itself as the event-host while the synchronous\n// handler chain runs; the slot clears via microtask. Covers\n// template-bound inline arrow handlers attached to descendants.\n// 3. document.activeElement — keyboard handlers in focus.\n// 4. undefined → caller falls back to the module-scoped global instance.\n\n// Singleton across any number of schmancy module copies (source + dist, ESM\n// + CJS, hoisted vs. nested node_modules) via the runtime-global symbol\n// registry. The first copy to load creates the slot; later copies reuse it.\n// Without this, two stacks → mixins push to one, state reads from the other,\n// and active-host context is lost across the boundary.\nconst STACK_KEY = Symbol.for('schmancy.state.activeHost.stack')\ntype StackSlot = { stack: Array<HTMLElement | undefined> }\nconst _g = globalThis as { [STACK_KEY]?: StackSlot }\n_g[STACK_KEY] ??= { stack: [undefined] }\nconst _stack = _g[STACK_KEY].stack\n\n// One-time Promise.prototype.then patch at module init. Each .then() call\n// captures the stack head at chain time; firing the callback restores that\n// captured value for the duration of the callback. The guard property\n// prevents double-patching across HMR / duplicate module loads.\ndeclare global {\n\tinterface Promise<T> {\n\t\t// Marker symbol so we can detect (and skip) re-patching.\n\t\treadonly __schmancyActiveHostPatched?: true\n\t}\n}\n\n// Patching Promise.prototype is the entire mechanism this module exists to\n// provide — the lint rules below intentionally do not apply.\n/* oxlint-disable no-extend-native, unicorn/no-thenable */\nif (typeof Promise !== 'undefined' && !('__schmancyActiveHostPatched' in Promise.prototype)) {\n\tObject.defineProperty(Promise.prototype, '__schmancyActiveHostPatched', {\n\t\tvalue: true,\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\twritable: false,\n\t})\n\tconst _origThen = Promise.prototype.then\n\t// Replace with our wrapper. We delegate to the original `then` via\n\t// `_origThen.call(this, …)` so Promise subclassing / Symbol.species behave\n\t// exactly as before — the only added work is the stack push/pop around\n\t// each user callback.\n\tPromise.prototype.then = function schmancyThen<T, R1, R2>(\n\t\tthis: Promise<T>,\n\t\tonfulfilled?: ((value: T) => R1 | PromiseLike<R1>) | null,\n\t\tonrejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n\t): Promise<R1 | R2> {\n\t\tconst captured = _stack[_stack.length - 1]\n\t\tconst wrapFulfilled = onfulfilled\n\t\t\t? (v: T): R1 | PromiseLike<R1> => {\n\t\t\t\t\t_stack.push(captured)\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn onfulfilled(v)\n\t\t\t\t\t} finally {\n\t\t\t\t\t\t_stack.pop()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: onfulfilled\n\t\tconst wrapRejected = onrejected\n\t\t\t? (r: unknown): R2 | PromiseLike<R2> => {\n\t\t\t\t\t_stack.push(captured)\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn onrejected(r)\n\t\t\t\t\t} finally {\n\t\t\t\t\t\t_stack.pop()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: onrejected\n\t\treturn _origThen.call(this, wrapFulfilled, wrapRejected) as Promise<R1 | R2>\n\t}\n}\n/* oxlint-enable no-extend-native, unicorn/no-thenable */\n\nexport const _activeHost = {\n\t/** Run `fn` with `host` as the active host for the duration of `fn` and\n\t * any awaits / microtasks / Promise chains that descend from it. */\n\trun<R>(host: HTMLElement | undefined, fn: () => R): R {\n\t\t_stack.push(host)\n\t\ttry {\n\t\t\treturn fn()\n\t\t} finally {\n\t\t\t_stack.pop()\n\t\t}\n\t},\n\t/** The current active host, or undefined if no `run()` is on the stack. */\n\tget(): HTMLElement | undefined {\n\t\treturn _stack[_stack.length - 1]\n\t},\n}\n\n// Tier 2 of the resolveActiveHost() fallback chain. A `<schmancy-context>`\n// publishes itself here from a capture-phase event listener attached to\n// itself; the slot clears in the next microtask, after the synchronous\n// event-handler chain has run. `window.event` is unreliable across both\n// engines and time (it can outlive its event — a stale `message` event\n// from postMessage can leak BODY for arbitrary later resolution calls), so\n// we own this slot rather than read the legacy global.\n//\n// Singleton across module copies for the same reason as `_stack` above.\nconst EVENT_HOST_KEY = Symbol.for('schmancy.state.activeHost.eventHost')\ntype EventHostSlot = { host: HTMLElement | undefined; scheduled: boolean }\nconst _eventHostSlot: EventHostSlot =\n\t((globalThis as { [EVENT_HOST_KEY]?: EventHostSlot })[EVENT_HOST_KEY] ??= {\n\t\thost: undefined,\n\t\tscheduled: false,\n\t})\n\n/** Publish `host` as the active event-host. The slot self-clears at the\n * end of the current microtask checkpoint — long enough for the entire\n * synchronous event-handler chain to read it, short enough that no\n * later, unrelated microtask sees a stale value. */\nexport function _publishEventHost(host: HTMLElement): void {\n\t_eventHostSlot.host = host\n\tif (_eventHostSlot.scheduled) return\n\t_eventHostSlot.scheduled = true\n\tqueueMicrotask(() => {\n\t\t_eventHostSlot.scheduled = false\n\t\t_eventHostSlot.host = undefined\n\t})\n}\n\nexport function resolveActiveHost(): HTMLElement | undefined {\n\t// 1. Stack (set by _activeHost.run).\n\tconst fromStack = _activeHost.get()\n\tif (fromStack !== undefined) return fromStack\n\n\t// 2. Closest <schmancy-context> with an in-flight event in its subtree.\n\tif (_eventHostSlot.host !== undefined) return _eventHostSlot.host\n\n\t// 3. document.activeElement — keyboard / focus handlers.\n\tif (typeof document !== 'undefined' && document.activeElement instanceof HTMLElement) {\n\t\treturn document.activeElement\n\t}\n\n\t// 4. undefined — caller falls back to module-scoped.\n\treturn undefined\n}\n\n/** Stable context key for a state namespace. `Symbol.for(...)` so the same\n * namespace string yields the same symbol across module boundaries — the\n * ContextProvider on `<schmancy-context>` and the ContextRequestEvent\n * dispatched by a state read must agree on identity. */\nexport function stateContextKey(namespace: string): symbol {\n\treturn Symbol.for(`schmancy.state:${namespace}`)\n}\n"],"mappings":";;;;;;AAuDA,IAAM,IAAY,OAAO,IAAI,kCAAA,EAEvB,IAAK;AACX,EAAG,OAAe,EAAE,OAAO,CAAA,KAAC,EAAA,EAAA;AAC5B,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O,IAAI,kBAAkB,IAAA;;AAAA,SAAA,KAAA,GAAA,KAAA,GAAA,KAAA,GAAA,QAAA,KAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}var t=Symbol.for(`schmancy.state.activeHost.stack`),n=globalThis;n[t]??={stack:[void 0]};var r=n[t].stack;if(typeof Promise<`u`&&!(`o`in Promise.prototype)){Object.defineProperty(Promise.prototype,`o`,{value:!0,configurable:!1,enumerable:!1,writable:!1});let e=Promise.prototype.then;Promise.prototype.then=function(t,n){let i=r[r.length-1],a=t&&(e=>{r.push(i);try{return t(e)}finally{r.pop()}}),o=n&&(e=>{r.push(i);try{return n(e)}finally{r.pop()}});return e.call(this,a,o)}}var i={run(e,t){r.push(e);try{return t()}finally{r.pop()}},get:()=>r[r.length-1]},a=Symbol.for(`schmancy.state.activeHost.eventHost`),o=globalThis[a]??={host:void 0,scheduled:!1};function s(e){o.host=e,o.scheduled||(o.scheduled=!0,queueMicrotask(()=>{o.scheduled=!1,o.host=void 0}))}function c(){let e=i.get();return e===void 0?o.host===void 0?typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:void 0:o.host:e}function l(e){return Symbol.for(`schmancy.state:${e}`)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-host-CcIa2tmW.cjs","names":[],"sources":["../src/state/active-host.ts"],"sourcesContent":["// `_`-prefixed identifiers below are an intentional naming convention for\n// module-private infrastructure. `_activeHost` is exported only so the\n// $LitElement mixin can wrap render/lifecycle in `_activeHost.run`; the\n// underscore signals \"not part of the public state API.\"\n/* oxlint-disable no-underscore-dangle */\n\n// Active-host tracker for context-aware state resolution.\n//\n// Polyfills the TC39 `AsyncContext.Variable` propagation primitive using a\n// stack + a one-time `Promise.prototype.then` patch. The stack value carries\n// across `await`, `queueMicrotask`, RxJS subscription callbacks, and any\n// other code path that ultimately routes through `Promise.then`. This is the\n// same capture-and-restore technique zone.js, async-hooks, and the various\n// AsyncContext userland polyfills use.\n//\n// Why we own this:\n// - The TC39 proposal is at stage 2; no official polyfill ships from TC39.\n// - The `async-context@1.0.0` package on npm is unrelated (a 2014 Node\n// callback helper), and the available userland polyfills either depend\n// on zone.js (~50 KB) or are Node-only / hobby quality.\n// - The patch surface is ~30 lines, idempotent, preserves Promise\n// semantics (delegates to the original `then`, so `Symbol.species` and\n// subclassing work unchanged), and decommissions cleanly the day a real\n// polyfill or native AsyncContext lands (drop the file, swap the\n// `_activeHost` export for the standard primitive).\n//\n// Known limitation — native await on a native Promise: V8's await\n// optimization (since 7.x) skips the spec-prescribed\n// `Promise.resolve(x).then(continuation)` step, so userland `then`\n// patches don't intercept the resumption. Class methods that mutate\n// state across an `await` boundary will fall back to the\n// module-scoped global, not the active-host's isolated copy. To\n// preserve the host across awaits, either keep the mutation in the\n// synchronous prelude before the first `await`, or explicitly chain\n// with `.then()` (which still routes through the patched method).\n// A real fix requires either a build-time async-function transform\n// or native AsyncContext.Variable in the runtime.\n//\n// resolveActiveHost() fallback chain:\n// 1. Stack value set by `_activeHost.run(host, fn)` — covers render(),\n// Lit lifecycle methods, and class-method handlers (all wrapped by\n// SchmancyElement's prototype-chain wrap).\n// 2. The closest `<schmancy-context>` whose subtree currently has an\n// in-flight DOM event. The element installs capture-phase listeners\n// that publish itself as the event-host while the synchronous\n// handler chain runs; the slot clears via microtask. Covers\n// template-bound inline arrow handlers attached to descendants.\n// 3. document.activeElement — keyboard handlers in focus.\n// 4. undefined → caller falls back to the module-scoped global instance.\n\n// Singleton across any number of schmancy module copies (source + dist, ESM\n// + CJS, hoisted vs. nested node_modules) via the runtime-global symbol\n// registry. The first copy to load creates the slot; later copies reuse it.\n// Without this, two stacks → mixins push to one, state reads from the other,\n// and active-host context is lost across the boundary.\nconst STACK_KEY = Symbol.for('schmancy.state.activeHost.stack')\ntype StackSlot = { stack: Array<HTMLElement | undefined> }\nconst _g = globalThis as { [STACK_KEY]?: StackSlot }\n_g[STACK_KEY] ??= { stack: [undefined] }\nconst _stack = _g[STACK_KEY].stack\n\n// One-time Promise.prototype.then patch at module init. Each .then() call\n// captures the stack head at chain time; firing the callback restores that\n// captured value for the duration of the callback. The guard property\n// prevents double-patching across HMR / duplicate module loads.\ndeclare global {\n\tinterface Promise<T> {\n\t\t// Marker symbol so we can detect (and skip) re-patching.\n\t\treadonly __schmancyActiveHostPatched?: true\n\t}\n}\n\n// Patching Promise.prototype is the entire mechanism this module exists to\n// provide — the lint rules below intentionally do not apply.\n/* oxlint-disable no-extend-native, unicorn/no-thenable */\nif (typeof Promise !== 'undefined' && !('__schmancyActiveHostPatched' in Promise.prototype)) {\n\tObject.defineProperty(Promise.prototype, '__schmancyActiveHostPatched', {\n\t\tvalue: true,\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\twritable: false,\n\t})\n\tconst _origThen = Promise.prototype.then\n\t// Replace with our wrapper. We delegate to the original `then` via\n\t// `_origThen.call(this, …)` so Promise subclassing / Symbol.species behave\n\t// exactly as before — the only added work is the stack push/pop around\n\t// each user callback.\n\tPromise.prototype.then = function schmancyThen<T, R1, R2>(\n\t\tthis: Promise<T>,\n\t\tonfulfilled?: ((value: T) => R1 | PromiseLike<R1>) | null,\n\t\tonrejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n\t): Promise<R1 | R2> {\n\t\tconst captured = _stack[_stack.length - 1]\n\t\tconst wrapFulfilled = onfulfilled\n\t\t\t? (v: T): R1 | PromiseLike<R1> => {\n\t\t\t\t\t_stack.push(captured)\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn onfulfilled(v)\n\t\t\t\t\t} finally {\n\t\t\t\t\t\t_stack.pop()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: onfulfilled\n\t\tconst wrapRejected = onrejected\n\t\t\t? (r: unknown): R2 | PromiseLike<R2> => {\n\t\t\t\t\t_stack.push(captured)\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn onrejected(r)\n\t\t\t\t\t} finally {\n\t\t\t\t\t\t_stack.pop()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: onrejected\n\t\treturn _origThen.call(this, wrapFulfilled, wrapRejected) as Promise<R1 | R2>\n\t}\n}\n/* oxlint-enable no-extend-native, unicorn/no-thenable */\n\nexport const _activeHost = {\n\t/** Run `fn` with `host` as the active host for the duration of `fn` and\n\t * any awaits / microtasks / Promise chains that descend from it. */\n\trun<R>(host: HTMLElement | undefined, fn: () => R): R {\n\t\t_stack.push(host)\n\t\ttry {\n\t\t\treturn fn()\n\t\t} finally {\n\t\t\t_stack.pop()\n\t\t}\n\t},\n\t/** The current active host, or undefined if no `run()` is on the stack. */\n\tget(): HTMLElement | undefined {\n\t\treturn _stack[_stack.length - 1]\n\t},\n}\n\n// Tier 2 of the resolveActiveHost() fallback chain. A `<schmancy-context>`\n// publishes itself here from a capture-phase event listener attached to\n// itself; the slot clears in the next microtask, after the synchronous\n// event-handler chain has run. `window.event` is unreliable across both\n// engines and time (it can outlive its event — a stale `message` event\n// from postMessage can leak BODY for arbitrary later resolution calls), so\n// we own this slot rather than read the legacy global.\n//\n// Singleton across module copies for the same reason as `_stack` above.\nconst EVENT_HOST_KEY = Symbol.for('schmancy.state.activeHost.eventHost')\ntype EventHostSlot = { host: HTMLElement | undefined; scheduled: boolean }\nconst _eventHostSlot: EventHostSlot =\n\t((globalThis as { [EVENT_HOST_KEY]?: EventHostSlot })[EVENT_HOST_KEY] ??= {\n\t\thost: undefined,\n\t\tscheduled: false,\n\t})\n\n/** Publish `host` as the active event-host. The slot self-clears at the\n * end of the current microtask checkpoint — long enough for the entire\n * synchronous event-handler chain to read it, short enough that no\n * later, unrelated microtask sees a stale value. */\nexport function _publishEventHost(host: HTMLElement): void {\n\t_eventHostSlot.host = host\n\tif (_eventHostSlot.scheduled) return\n\t_eventHostSlot.scheduled = true\n\tqueueMicrotask(() => {\n\t\t_eventHostSlot.scheduled = false\n\t\t_eventHostSlot.host = undefined\n\t})\n}\n\nexport function resolveActiveHost(): HTMLElement | undefined {\n\t// 1. Stack (set by _activeHost.run).\n\tconst fromStack = _activeHost.get()\n\tif (fromStack !== undefined) return fromStack\n\n\t// 2. Closest <schmancy-context> with an in-flight event in its subtree.\n\tif (_eventHostSlot.host !== undefined) return _eventHostSlot.host\n\n\t// 3. document.activeElement — keyboard / focus handlers.\n\tif (typeof document !== 'undefined' && document.activeElement instanceof HTMLElement) {\n\t\treturn document.activeElement\n\t}\n\n\t// 4. undefined — caller falls back to module-scoped.\n\treturn undefined\n}\n\n/** Stable context key for a state namespace. `Symbol.for(...)` so the same\n * namespace string yields the same symbol across module boundaries — the\n * ContextProvider on `<schmancy-context>` and the ContextRequestEvent\n * dispatched by a state read must agree on identity. */\nexport function stateContextKey(namespace: string): symbol {\n\treturn Symbol.for(`schmancy.state:${namespace}`)\n}\n"],"mappings":"AAuDA,IAAM,EAAY,OAAO,IAAI,kCAAA,CAEvB,EAAK,WACX,EAAG,KAAe,CAAE,MAAO,CAAA,IAAC,GAAA,CAAA,CAC5B,IAAM,EAAS,EAAG,GAAW,MAgB7B,GAAuB,OAAZ,QAAY,KAAZ,EAA6B,MAAiC,QAAQ,WAAY,CAC5F,OAAO,eAAe,QAAQ,UAAW,IAA+B,CACvE,MAAA,CAAO,EACP,aAAA,CAAc,EACd,WAAA,CAAY,EACZ,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CAAA,CAAA,OAAA,eAAA,QAAA,IAAA,CAAA,WAAA,CAAA,EAAA,IAAA,UAAA,CAAA,OAAA,GAAA,CAAA,CAAA,OAAA,eAAA,QAAA,IAAA,CAAA,WAAA,CAAA,EAAA,IAAA,UAAA,CAAA,OAAA,GAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"active-host-jH3iloCR.cjs","names":[],"sources":["../src/state/active-host.ts"],"sourcesContent":["// `_`-prefixed identifiers below are an intentional naming convention for\n// module-private infrastructure. `_activeHost` is exported only so the\n// $LitElement mixin can wrap render/lifecycle in `_activeHost.run`; the\n// underscore signals \"not part of the public state API.\"\n/* oxlint-disable no-underscore-dangle */\n\n// Active-host tracker for context-aware state resolution.\n//\n// Polyfills the TC39 `AsyncContext.Variable` propagation primitive using a\n// stack + a one-time `Promise.prototype.then` patch. The stack value carries\n// across `await`, `queueMicrotask`, RxJS subscription callbacks, and any\n// other code path that ultimately routes through `Promise.then`. This is the\n// same capture-and-restore technique zone.js, async-hooks, and the various\n// AsyncContext userland polyfills use.\n//\n// Why we own this:\n// - The TC39 proposal is at stage 2; no official polyfill ships from TC39.\n// - The `async-context@1.0.0` package on npm is unrelated (a 2014 Node\n// callback helper), and the available userland polyfills either depend\n// on zone.js (~50 KB) or are Node-only / hobby quality.\n// - The patch surface is ~30 lines, idempotent, preserves Promise\n// semantics (delegates to the original `then`, so `Symbol.species` and\n// subclassing work unchanged), and decommissions cleanly the day a real\n// polyfill or native AsyncContext lands (drop the file, swap the\n// `_activeHost` export for the standard primitive).\n//\n// Known limitation — native await on a native Promise: V8's await\n// optimization (since 7.x) skips the spec-prescribed\n// `Promise.resolve(x).then(continuation)` step, so userland `then`\n// patches don't intercept the resumption. Class methods that mutate\n// state across an `await` boundary will fall back to the\n// module-scoped global, not the active-host's isolated copy. To\n// preserve the host across awaits, either keep the mutation in the\n// synchronous prelude before the first `await`, or explicitly chain\n// with `.then()` (which still routes through the patched method).\n// A real fix requires either a build-time async-function transform\n// or native AsyncContext.Variable in the runtime.\n//\n// resolveActiveHost() fallback chain:\n// 1. Stack value set by `_activeHost.run(host, fn)` — covers render(),\n// Lit lifecycle methods, and class-method handlers (all wrapped by\n// SchmancyElement's prototype-chain wrap).\n// 2. The closest `<schmancy-context>` whose subtree currently has an\n// in-flight DOM event. The element installs capture-phase listeners\n// that publish itself as the event-host while the synchronous\n// handler chain runs; the slot clears via microtask. Covers\n// template-bound inline arrow handlers attached to descendants.\n// 3. document.activeElement — keyboard handlers in focus.\n// 4. undefined → caller falls back to the module-scoped global instance.\n\n// Singleton across any number of schmancy module copies (source + dist, ESM\n// + CJS, hoisted vs. nested node_modules) via the runtime-global symbol\n// registry. The first copy to load creates the slot; later copies reuse it.\n// Without this, two stacks → mixins push to one, state reads from the other,\n// and active-host context is lost across the boundary.\nconst STACK_KEY = Symbol.for('schmancy.state.activeHost.stack')\ntype StackSlot = { stack: Array<HTMLElement | undefined> }\nconst _g = globalThis as { [STACK_KEY]?: StackSlot }\n_g[STACK_KEY] ??= { stack: [undefined] }\nconst _stack = _g[STACK_KEY].stack\n\n// One-time Promise.prototype.then patch at module init. Each .then() call\n// captures the stack head at chain time; firing the callback restores that\n// captured value for the duration of the callback. The guard property\n// prevents double-patching across HMR / duplicate module loads.\ndeclare global {\n\tinterface Promise<T> {\n\t\t// Marker symbol so we can detect (and skip) re-patching.\n\t\treadonly __schmancyActiveHostPatched?: true\n\t}\n}\n\n// Patching Promise.prototype is the entire mechanism this module exists to\n// provide — the lint rules below intentionally do not apply.\n/* oxlint-disable no-extend-native, unicorn/no-thenable */\nif (typeof Promise !== 'undefined' && !('__schmancyActiveHostPatched' in Promise.prototype)) {\n\tObject.defineProperty(Promise.prototype, '__schmancyActiveHostPatched', {\n\t\tvalue: true,\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\twritable: false,\n\t})\n\tconst _origThen = Promise.prototype.then\n\t// Replace with our wrapper. We delegate to the original `then` via\n\t// `_origThen.call(this, …)` so Promise subclassing / Symbol.species behave\n\t// exactly as before — the only added work is the stack push/pop around\n\t// each user callback.\n\tPromise.prototype.then = function schmancyThen<T, R1, R2>(\n\t\tthis: Promise<T>,\n\t\tonfulfilled?: ((value: T) => R1 | PromiseLike<R1>) | null,\n\t\tonrejected?: ((reason: unknown) => R2 | PromiseLike<R2>) | null,\n\t): Promise<R1 | R2> {\n\t\tconst captured = _stack[_stack.length - 1]\n\t\tconst wrapFulfilled = onfulfilled\n\t\t\t? (v: T): R1 | PromiseLike<R1> => {\n\t\t\t\t\t_stack.push(captured)\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn onfulfilled(v)\n\t\t\t\t\t} finally {\n\t\t\t\t\t\t_stack.pop()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: onfulfilled\n\t\tconst wrapRejected = onrejected\n\t\t\t? (r: unknown): R2 | PromiseLike<R2> => {\n\t\t\t\t\t_stack.push(captured)\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn onrejected(r)\n\t\t\t\t\t} finally {\n\t\t\t\t\t\t_stack.pop()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: onrejected\n\t\treturn _origThen.call(this, wrapFulfilled, wrapRejected) as Promise<R1 | R2>\n\t}\n}\n/* oxlint-enable no-extend-native, unicorn/no-thenable */\n\nexport const _activeHost = {\n\t/** Run `fn` with `host` as the active host for the duration of `fn` and\n\t * any awaits / microtasks / Promise chains that descend from it. */\n\trun<R>(host: HTMLElement | undefined, fn: () => R): R {\n\t\t_stack.push(host)\n\t\ttry {\n\t\t\treturn fn()\n\t\t} finally {\n\t\t\t_stack.pop()\n\t\t}\n\t},\n\t/** The current active host, or undefined if no `run()` is on the stack. */\n\tget(): HTMLElement | undefined {\n\t\treturn _stack[_stack.length - 1]\n\t},\n}\n\n// Tier 2 of the resolveActiveHost() fallback chain. A `<schmancy-context>`\n// publishes itself here from a capture-phase event listener attached to\n// itself; the slot clears in the next microtask, after the synchronous\n// event-handler chain has run. `window.event` is unreliable across both\n// engines and time (it can outlive its event — a stale `message` event\n// from postMessage can leak BODY for arbitrary later resolution calls), so\n// we own this slot rather than read the legacy global.\n//\n// Singleton across module copies for the same reason as `_stack` above.\nconst EVENT_HOST_KEY = Symbol.for('schmancy.state.activeHost.eventHost')\ntype EventHostSlot = { host: HTMLElement | undefined; scheduled: boolean }\nconst _eventHostSlot: EventHostSlot =\n\t((globalThis as { [EVENT_HOST_KEY]?: EventHostSlot })[EVENT_HOST_KEY] ??= {\n\t\thost: undefined,\n\t\tscheduled: false,\n\t})\n\n/** Publish `host` as the active event-host. The slot self-clears at the\n * end of the current microtask checkpoint — long enough for the entire\n * synchronous event-handler chain to read it, short enough that no\n * later, unrelated microtask sees a stale value. */\nexport function _publishEventHost(host: HTMLElement): void {\n\t_eventHostSlot.host = host\n\tif (_eventHostSlot.scheduled) return\n\t_eventHostSlot.scheduled = true\n\tqueueMicrotask(() => {\n\t\t_eventHostSlot.scheduled = false\n\t\t_eventHostSlot.host = undefined\n\t})\n}\n\nexport function resolveActiveHost(): HTMLElement | undefined {\n\t// 1. Stack (set by _activeHost.run).\n\tconst fromStack = _activeHost.get()\n\tif (fromStack !== undefined) return fromStack\n\n\t// 2. Closest <schmancy-context> with an in-flight event in its subtree.\n\tif (_eventHostSlot.host !== undefined) return _eventHostSlot.host\n\n\t// 3. document.activeElement — keyboard / focus handlers.\n\tif (typeof document !== 'undefined' && document.activeElement instanceof HTMLElement) {\n\t\treturn document.activeElement\n\t}\n\n\t// 4. undefined — caller falls back to module-scoped.\n\treturn undefined\n}\n\n/** Stable context key for a state namespace. `Symbol.for(...)` so the same\n * namespace string yields the same symbol across module boundaries — the\n * ContextProvider on `<schmancy-context>` and the ContextRequestEvent\n * dispatched by a state read must agree on identity. */\nexport function stateContextKey(namespace: string): symbol {\n\treturn Symbol.for(`schmancy.state:${namespace}`)\n}\n"],"mappings":"qUAuDA,IAAM,EAAY,OAAO,IAAI,kCAAA,CAEvB,EAAK,WACX,EAAG,KAAe,CAAE,MAAO,CAAA,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