@mhmo91/schmancy 0.10.29 → 0.10.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{mixins-BfazlmLD.js → SchmancyElement-BQ4DFufc.js} +166 -493
- package/dist/SchmancyElement-BQ4DFufc.js.map +1 -0
- package/dist/{mixins-CxGRIPYQ.cjs → SchmancyElement-DhSiMp6Y.cjs} +2 -242
- package/dist/SchmancyElement-DhSiMp6Y.cjs.map +1 -0
- package/dist/agent/{flow-3RrZM-e7.js.map → flow-CvG1fLW5.js.map} +1 -1
- package/dist/agent/schmancy.agent.js +8487 -2979
- package/dist/agent/schmancy.agent.js.map +1 -1
- package/dist/agent/{vendor-material-color-33Mj762T.js.map → vendor-material-color-DcL7ZPxx.js.map} +1 -1
- package/dist/animation-CCOIW4wJ.cjs.map +1 -1
- package/dist/animation-DCznELuT.js.map +1 -1
- package/dist/{area-D5wIy4Fn.js → area-BjpUWvzE.js} +7 -7
- package/dist/{area-D5wIy4Fn.js.map → area-BjpUWvzE.js.map} +1 -1
- package/dist/area-CgTzkxah.cjs +21 -0
- package/dist/{area-HXuLLQnN.cjs.map → area-CgTzkxah.cjs.map} +1 -1
- package/dist/area.cjs +1 -1
- package/dist/area.js +1 -1
- package/dist/{audio-CxO5a2HL.js → audio-CwBJntnB.js} +1 -1
- package/dist/{audio-CxO5a2HL.js.map → audio-CwBJntnB.js.map} +1 -1
- package/dist/{audio-Cvmemu84.cjs → audio-DISBFOaR.cjs} +1 -1
- package/dist/{audio-Cvmemu84.cjs.map → audio-DISBFOaR.cjs.map} +1 -1
- package/dist/audio.cjs +1 -1
- package/dist/audio.js +2 -2
- package/dist/{autocomplete-hj2AQyEF.cjs → autocomplete-DbCUOgWU.cjs} +2 -2
- package/dist/{autocomplete-hj2AQyEF.cjs.map → autocomplete-DbCUOgWU.cjs.map} +1 -1
- package/dist/{autocomplete-DCkkdDON.js → autocomplete-Dy708jem.js} +7 -7
- package/dist/{autocomplete-DCkkdDON.js.map → autocomplete-Dy708jem.js.map} +1 -1
- package/dist/autocomplete.cjs +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/avatar.cjs +3 -3
- package/dist/avatar.cjs.map +1 -1
- package/dist/avatar.js +5 -5
- package/dist/avatar.js.map +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{boat-B_5F_rFr.cjs → boat-BzZN_iwp.cjs} +11 -11
- package/dist/{boat-B_5F_rFr.cjs.map → boat-BzZN_iwp.cjs.map} +1 -1
- package/dist/{boat-BfgbRnhA.js → boat-Z4Lzl3ai.js} +8 -8
- package/dist/{boat-BfgbRnhA.js.map → boat-Z4Lzl3ai.js.map} +1 -1
- package/dist/boat.cjs +1 -1
- package/dist/boat.js +1 -1
- package/dist/breadcrumb.cjs +4 -4
- package/dist/breadcrumb.cjs.map +1 -1
- package/dist/breadcrumb.js +7 -7
- package/dist/breadcrumb.js.map +1 -1
- package/dist/{busy-D6tAS-kW.js → busy-CRFGPkcP.js} +7 -7
- package/dist/{busy-D6tAS-kW.js.map → busy-CRFGPkcP.js.map} +1 -1
- package/dist/{busy-zIt9bTZn.cjs → busy-Cu-47DfN.cjs} +8 -8
- package/dist/{busy-zIt9bTZn.cjs.map → busy-Cu-47DfN.cjs.map} +1 -1
- package/dist/busy.cjs +1 -1
- package/dist/busy.js +1 -1
- package/dist/{button-8oMffyiO.cjs → button-CN_JTjRd.cjs} +15 -15
- package/dist/{button-8oMffyiO.cjs.map → button-CN_JTjRd.cjs.map} +1 -1
- package/dist/{button-D7AejvfK.js → button-D_USF3tt.js} +10 -10
- package/dist/{button-D7AejvfK.js.map → button-D_USF3tt.js.map} +1 -1
- package/dist/button.cjs +19 -19
- package/dist/button.cjs.map +1 -1
- package/dist/button.js +9 -9
- package/dist/button.js.map +1 -1
- package/dist/{card-CTucMMgp.cjs → card-D4P5_gg9.cjs} +10 -10
- package/dist/{card-CTucMMgp.cjs.map → card-D4P5_gg9.cjs.map} +1 -1
- package/dist/{card-CUt9fm_4.js → card-DpN5KIYc.js} +15 -15
- package/dist/{card-CUt9fm_4.js.map → card-DpN5KIYc.js.map} +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{checkbox-DMmqe2OO.js → checkbox-C8ChypKf.js} +5 -5
- package/dist/{checkbox-DMmqe2OO.js.map → checkbox-C8ChypKf.js.map} +1 -1
- package/dist/{checkbox-DrKsfzC4.cjs → checkbox-hhXVXDV1.cjs} +3 -3
- package/dist/{checkbox-DrKsfzC4.cjs.map → checkbox-hhXVXDV1.cjs.map} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{chips-DRGsqDMA.js → chips-B8R9q4yl.js} +27 -27
- package/dist/{chips-DRGsqDMA.js.map → chips-B8R9q4yl.js.map} +1 -1
- package/dist/{chips-B1yQgLyW.cjs → chips-BTLlO_Ow.cjs} +18 -18
- package/dist/{chips-B1yQgLyW.cjs.map → chips-BTLlO_Ow.cjs.map} +1 -1
- package/dist/chips.cjs +1 -1
- package/dist/chips.js +2 -2
- package/dist/connectivity.cjs +7 -7
- package/dist/connectivity.cjs.map +1 -1
- package/dist/connectivity.js +5 -5
- package/dist/connectivity.js.map +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/cursor-glow-Ah7VXSj7.js.map +1 -1
- package/dist/cursor-glow-Bulq-38P.cjs.map +1 -1
- package/dist/{date-range-BeF0dW1W.cjs → date-range-9h6ZSkZb.cjs} +3 -3
- package/dist/{date-range-BeF0dW1W.cjs.map → date-range-9h6ZSkZb.cjs.map} +1 -1
- package/dist/{date-range-TDF-f0ss.js → date-range-CS96dWMh.js} +7 -7
- package/dist/{date-range-TDF-f0ss.js.map → date-range-CS96dWMh.js.map} +1 -1
- package/dist/date-range-inline-CAxnHA-l.cjs +43 -0
- package/dist/{date-range-inline-BnhQZTK0.cjs.map → date-range-inline-CAxnHA-l.cjs.map} +1 -1
- package/dist/{date-range-inline-JLsmcle2.js → date-range-inline-DCXdGeRv.js} +5 -5
- package/dist/{date-range-inline-JLsmcle2.js.map → date-range-inline-DCXdGeRv.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 +4 -4
- package/dist/delay.cjs.map +1 -1
- package/dist/delay.js +6 -6
- package/dist/delay.js.map +1 -1
- package/dist/{details-T75tUASO.cjs → details-BC0IObBd.cjs} +2 -2
- package/dist/{details-T75tUASO.cjs.map → details-BC0IObBd.cjs.map} +1 -1
- package/dist/{details-ChMhQpcY.js → details-Pgd0slKn.js} +11 -11
- package/dist/{details-ChMhQpcY.js.map → details-Pgd0slKn.js.map} +1 -1
- package/dist/details.cjs +1 -1
- package/dist/details.js +1 -1
- package/dist/{directives-DgPbz0lQ.js → directives-B-RT9R2u.js} +3 -3
- package/dist/{directives-DgPbz0lQ.js.map → directives-B-RT9R2u.js.map} +1 -1
- package/dist/{directives-BkSqmLBV.cjs → directives-CFWacnWU.cjs} +1 -1
- package/dist/{directives-BkSqmLBV.cjs.map → directives-CFWacnWU.cjs.map} +1 -1
- package/dist/directives.cjs +1 -1
- package/dist/directives.js +2 -2
- package/dist/discovery.service-CIa3Eeuk.cjs.map +1 -1
- package/dist/discovery.service-DZFxtRwW.js.map +1 -1
- package/dist/{divider-D69bhEUY.js → divider-BMzm0lOz.js} +5 -5
- package/dist/{divider-D69bhEUY.js.map → divider-BMzm0lOz.js.map} +1 -1
- package/dist/{divider-DopO0yKi.cjs → divider-D1OzaRAQ.cjs} +3 -3
- package/dist/{divider-DopO0yKi.cjs.map → divider-D1OzaRAQ.cjs.map} +1 -1
- package/dist/divider.cjs +1 -1
- package/dist/divider.js +1 -1
- package/dist/dropdown.cjs +4 -4
- package/dist/dropdown.cjs.map +1 -1
- package/dist/dropdown.js +8 -8
- package/dist/dropdown.js.map +1 -1
- package/dist/{expand-KLSx5dea.js → expand-C0Uqxfv0.js} +10 -10
- package/dist/{expand-KLSx5dea.js.map → expand-C0Uqxfv0.js.map} +1 -1
- package/dist/{expand-C386rVT8.cjs → expand-CiQkzth9.cjs} +3 -3
- package/dist/{expand-C386rVT8.cjs.map → expand-CiQkzth9.cjs.map} +1 -1
- package/dist/expand.cjs +1 -1
- package/dist/expand.js +1 -1
- package/dist/float-Bu_IfKRd.cjs +1 -0
- package/dist/{float-DyaPI0qO.cjs.map → float-Bu_IfKRd.cjs.map} +1 -1
- package/dist/{float-BoPLNysg.js → float-DwBMXhek.js} +2 -2
- package/dist/{float-BoPLNysg.js.map → float-DwBMXhek.js.map} +1 -1
- package/dist/float.cjs +1 -1
- package/dist/float.js +1 -1
- package/dist/{form-CYeMWHmy.js → form-B9Je2W_m.js} +7 -7
- package/dist/{form-CYeMWHmy.js.map → form-B9Je2W_m.js.map} +1 -1
- package/dist/{form-CGIJlQyP.cjs → form-BnbAVZyf.cjs} +3 -3
- package/dist/{form-CGIJlQyP.cjs.map → form-BnbAVZyf.cjs.map} +1 -1
- package/dist/form.cjs +6 -6
- package/dist/form.cjs.map +1 -1
- package/dist/form.js +12 -12
- package/dist/form.js.map +1 -1
- package/dist/gravity-6pL6CfIr.cjs.map +1 -1
- package/dist/gravity-sVK3zGBF.js.map +1 -1
- package/dist/handover/agent-runtime-followups.md +1 -1
- package/dist/handover/agent-runtime-v1.md +3 -3
- package/dist/hashContent-BqU6v1Xr.js.map +1 -1
- package/dist/hashContent-iRZJJWtE.cjs.map +1 -1
- package/dist/{icons-CJUA5bfI.cjs → icons-BfWQl5k5.cjs} +6 -6
- package/dist/{icons-CJUA5bfI.cjs.map → icons-BfWQl5k5.cjs.map} +1 -1
- package/dist/{icons-BUQNMhjw.js → icons-DJHPXKgR.js} +4 -4
- package/dist/{icons-BUQNMhjw.js.map → icons-DJHPXKgR.js.map} +1 -1
- package/dist/icons.cjs +1 -1
- package/dist/icons.js +1 -1
- package/dist/{iframe-CbL0jCo1.js → iframe-DLz8ll0s.js} +5 -5
- package/dist/{iframe-CbL0jCo1.js.map → iframe-DLz8ll0s.js.map} +1 -1
- package/dist/{iframe-pn7MIeH8.cjs → iframe-UtczJypj.cjs} +5 -5
- package/dist/{iframe-pn7MIeH8.cjs.map → iframe-UtczJypj.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 +69 -70
- package/dist/{input-C1h5lLiJ.js → input-AQbBEj2f.js} +15 -15
- package/dist/{input-C1h5lLiJ.js.map → input-AQbBEj2f.js.map} +1 -1
- package/dist/{input-Cmc0IoUP.cjs → input-Pp6A1m3s.cjs} +2 -2
- package/dist/{input-Cmc0IoUP.cjs.map → input-Pp6A1m3s.cjs.map} +1 -1
- package/dist/{input-chip-B0X_CodJ.cjs → input-chip-B5vYNuEm.cjs} +9 -9
- package/dist/{input-chip-B0X_CodJ.cjs.map → input-chip-B5vYNuEm.cjs.map} +1 -1
- package/dist/{input-chip-DqAR4nPD.js → input-chip-Bbs_gXOB.js} +10 -10
- package/dist/{input-chip-DqAR4nPD.js.map → input-chip-Bbs_gXOB.js.map} +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/json.cjs +3 -3
- package/dist/json.cjs.map +1 -1
- package/dist/json.js +5 -5
- package/dist/json.js.map +1 -1
- package/dist/kbd.cjs +2 -2
- package/dist/kbd.cjs.map +1 -1
- package/dist/kbd.js +5 -5
- package/dist/kbd.js.map +1 -1
- package/dist/{layout-DSAjo92m.js → layout-9K1zxhZn.js} +1 -1
- package/dist/{layout-DSAjo92m.js.map → layout-9K1zxhZn.js.map} +1 -1
- package/dist/{layout-eXb9wjDh.cjs → layout-B0dct--7.cjs} +1 -1
- package/dist/{layout-eXb9wjDh.cjs.map → layout-B0dct--7.cjs.map} +1 -1
- package/dist/layout.cjs +2 -2
- package/dist/layout.cjs.map +1 -1
- package/dist/layout.js +7 -7
- package/dist/layout.js.map +1 -1
- package/dist/lazy-CayEFyC3.cjs.map +1 -1
- package/dist/lazy-D-bO2r4m.js.map +1 -1
- package/dist/{lightbox-BiNK_plj.cjs → lightbox-D_EizrG3.cjs} +21 -21
- package/dist/{lightbox-BiNK_plj.cjs.map → lightbox-D_EizrG3.cjs.map} +1 -1
- package/dist/{lightbox-C3zomJ-r.js → lightbox-DmJTs2My.js} +9 -9
- package/dist/{lightbox-C3zomJ-r.js.map → lightbox-DmJTs2My.js.map} +1 -1
- package/dist/lightbox.cjs +1 -1
- package/dist/lightbox.js +1 -1
- package/dist/{list-CbM9w9OM.cjs → list-BSn8czyO.cjs} +5 -5
- package/dist/{list-CbM9w9OM.cjs.map → list-BSn8czyO.cjs.map} +1 -1
- package/dist/{list-Bbmp1uMa.js → list-DjSSRZxF.js} +12 -12
- package/dist/{list-Bbmp1uMa.js.map → list-DjSSRZxF.js.map} +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/magnetic-B2VKNfDu.js.map +1 -1
- package/dist/magnetic-MQ3HMHJi.cjs.map +1 -1
- package/dist/{menu-Ph2hboJd.js → menu-CCVEde6u.js} +7 -7
- package/dist/{menu-Ph2hboJd.js.map → menu-CCVEde6u.js.map} +1 -1
- package/dist/menu-DTNnq7j_.cjs +23 -0
- package/dist/{menu-Bfay8vF8.cjs.map → menu-DTNnq7j_.cjs.map} +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/mixins-BYfSDvbP.js +412 -0
- package/dist/mixins-BYfSDvbP.js.map +1 -0
- package/dist/mixins-YQI9JogS.cjs +245 -0
- package/dist/mixins-YQI9JogS.cjs.map +1 -0
- package/dist/mixins.cjs +1 -1
- package/dist/mixins.js +3 -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 +10 -10
- package/dist/navigation-rail.cjs.map +1 -1
- package/dist/navigation-rail.js +15 -15
- package/dist/navigation-rail.js.map +1 -1
- package/dist/{notification-Du5FRbYp.js → notification-BNEuu3Q2.js} +7 -7
- package/dist/{notification-Du5FRbYp.js.map → notification-BNEuu3Q2.js.map} +1 -1
- package/dist/notification-RhaYvA1I.cjs +24 -0
- package/dist/{notification-DT_cAi8U.cjs.map → notification-RhaYvA1I.cjs.map} +1 -1
- package/dist/notification.cjs +1 -1
- package/dist/notification.js +1 -1
- package/dist/{option-B7y4FhOn.js → option-BLMYRy5C.js} +6 -6
- package/dist/{option-B7y4FhOn.js.map → option-BLMYRy5C.js.map} +1 -1
- package/dist/{option-Cl5Q987d.cjs → option-Dk7UFFlr.cjs} +5 -5
- package/dist/{option-Cl5Q987d.cjs.map → option-Dk7UFFlr.cjs.map} +1 -1
- package/dist/option.cjs +1 -1
- package/dist/option.js +1 -1
- package/dist/overlay-BbntqsVm.cjs +43 -0
- package/dist/{overlay-CRwfhbyi.cjs.map → overlay-BbntqsVm.cjs.map} +1 -1
- package/dist/{overlay-B79m-KXf.js → overlay-CujzmLxg.js} +11 -11
- package/dist/{overlay-B79m-KXf.js.map → overlay-CujzmLxg.js.map} +1 -1
- package/dist/overlay-stack-Bdr9lOqi.cjs.map +1 -1
- package/dist/overlay-stack-D2rgxQLh.js.map +1 -1
- package/dist/overlay.cjs +1 -1
- package/dist/overlay.confirm-body-CMge0LP5.cjs +70 -0
- package/dist/{overlay.confirm-body-CxOomuN6.cjs.map → overlay.confirm-body-CMge0LP5.cjs.map} +1 -1
- package/dist/{overlay.confirm-body-CW_spktW.js → overlay.confirm-body-CRk4MvKh.js} +13 -13
- package/dist/{overlay.confirm-body-CW_spktW.js.map → overlay.confirm-body-CRk4MvKh.js.map} +1 -1
- package/dist/overlay.js +3 -3
- package/dist/{overlay.service-DsBb_UwG.js → overlay.service-DnT4SBlJ.js} +2 -2
- package/dist/{overlay.service-DsBb_UwG.js.map → overlay.service-DnT4SBlJ.js.map} +1 -1
- package/dist/{overlay.service-fb3KaMiP.cjs → overlay.service-Dq5XtSEL.cjs} +1 -1
- package/dist/{overlay.service-fb3KaMiP.cjs.map → overlay.service-Dq5XtSEL.cjs.map} +1 -1
- package/dist/{progress-fnGrmHpm.cjs → progress-Bqd4DdOQ.cjs} +7 -7
- package/dist/{progress-fnGrmHpm.cjs.map → progress-Bqd4DdOQ.cjs.map} +1 -1
- package/dist/{progress-CMwUEDB1.js → progress-Cu_wh6Sl.js} +10 -10
- package/dist/{progress-CMwUEDB1.js.map → progress-Cu_wh6Sl.js.map} +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.js +1 -1
- package/dist/radio-group-C8rUbYL6.cjs +19 -0
- package/dist/{radio-group-DQRJGMgS.cjs.map → radio-group-C8rUbYL6.cjs.map} +1 -1
- package/dist/{radio-group-Zb0fies1.js → radio-group-Duzgx17I.js} +7 -7
- package/dist/{radio-group-Zb0fies1.js.map → radio-group-Duzgx17I.js.map} +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/range.cjs +2 -2
- package/dist/range.cjs.map +1 -1
- package/dist/range.js +5 -5
- package/dist/range.js.map +1 -1
- package/dist/reduced-motion-D-L12p7G.js.map +1 -1
- package/dist/reduced-motion-Ds-HjMzn.cjs.map +1 -1
- package/dist/rxjs-utils-Csnks202.cjs.map +1 -1
- package/dist/rxjs-utils-d-ivVN84.js.map +1 -1
- package/dist/search-DPKoC-dT.cjs.map +1 -1
- package/dist/search-MvIBA93K.js.map +1 -1
- package/dist/{select-BJJKYtEi.js → select-CzCv1f1c.js} +6 -6
- package/dist/{select-BJJKYtEi.js.map → select-CzCv1f1c.js.map} +1 -1
- package/dist/{select-C-acFFtV.cjs → select-DdqEsfnG.cjs} +2 -2
- package/dist/{select-C-acFFtV.cjs.map → select-DdqEsfnG.cjs.map} +1 -1
- 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 +5 -5
- package/dist/skeleton.js.map +1 -1
- package/dist/skills/form.md +34 -0
- package/dist/skills/schmancy/form.md +34 -0
- package/dist/slider.cjs +7 -7
- package/dist/slider.cjs.map +1 -1
- package/dist/slider.js +6 -6
- package/dist/slider.js.map +1 -1
- package/dist/{sound.service-v_jqCkos.js → sound.service-BOWTBG16.js} +1 -1
- package/dist/{sound.service-v_jqCkos.js.map → sound.service-BOWTBG16.js.map} +1 -1
- package/dist/{sound.service-DVJZb9ox.cjs → sound.service-BwIzAFQx.cjs} +1 -1
- package/dist/{sound.service-DVJZb9ox.cjs.map → sound.service-BwIzAFQx.cjs.map} +1 -1
- package/dist/{splash-screen-CCDpzGg_.js → splash-screen-Dj-zuGuB.js} +6 -6
- package/dist/{splash-screen-CCDpzGg_.js.map → splash-screen-Dj-zuGuB.js.map} +1 -1
- package/dist/splash-screen-_KhxgneW.cjs +41 -0
- package/dist/{splash-screen-CGnhHDB_.cjs.map → splash-screen-_KhxgneW.cjs.map} +1 -1
- package/dist/splash-screen.cjs +1 -1
- package/dist/splash-screen.js +1 -1
- package/dist/src-BSjgxN07.cjs +263 -0
- package/dist/{src-C0MzzF_S.cjs.map → src-BSjgxN07.cjs.map} +1 -1
- package/dist/{src-CUcUMK0M.js → src-Curgs4Yp.js} +82 -82
- package/dist/{src-CUcUMK0M.js.map → src-Curgs4Yp.js.map} +1 -1
- package/dist/state-BthYuA3T.cjs +1 -0
- package/dist/state-BthYuA3T.cjs.map +1 -0
- package/dist/{state-CHbIt2Dw.js → state-E0bVrZ7q.js} +293 -279
- package/dist/state-E0bVrZ7q.js.map +1 -0
- package/dist/state.cjs +1 -1
- package/dist/state.js +3 -3
- package/dist/steps.cjs +10 -10
- package/dist/steps.cjs.map +1 -1
- package/dist/steps.js +9 -9
- package/dist/steps.js.map +1 -1
- package/dist/{surface-CLcc26d2.js → surface-C2TIedTq.js} +4 -4
- package/dist/{surface-CLcc26d2.js.map → surface-C2TIedTq.js.map} +1 -1
- package/dist/surface-D-GqzyLn.cjs +7 -0
- package/dist/{surface-DPzlMMYX.cjs.map → surface-D-GqzyLn.cjs.map} +1 -1
- package/dist/surface.cjs +1 -1
- package/dist/surface.js +1 -1
- package/dist/switch.cjs +2 -2
- package/dist/switch.cjs.map +1 -1
- package/dist/switch.js +6 -6
- package/dist/switch.js.map +1 -1
- package/dist/table.cjs +11 -11
- package/dist/table.cjs.map +1 -1
- package/dist/table.js +10 -10
- package/dist/table.js.map +1 -1
- package/dist/{tabs-BvEal6oS.js → tabs-CLRVe23a.js} +11 -11
- package/dist/{tabs-BvEal6oS.js.map → tabs-CLRVe23a.js.map} +1 -1
- package/dist/{tabs-DEKOKYrn.cjs → tabs-C_493iod.cjs} +4 -4
- package/dist/{tabs-DEKOKYrn.cjs.map → tabs-C_493iod.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-CH62STRD.js → textarea-BWEyOtPy.js} +9 -9
- package/dist/{textarea-CH62STRD.js.map → textarea-BWEyOtPy.js.map} +1 -1
- package/dist/textarea-CICgd2oP.cjs +43 -0
- package/dist/{textarea-Cjlsy3y9.cjs.map → textarea-CICgd2oP.cjs.map} +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{theme-z82BIRuw.js → theme-Bfg_H2AF.js} +12 -12
- package/dist/{theme-z82BIRuw.js.map → theme-Bfg_H2AF.js.map} +1 -1
- package/dist/theme-D7zOJiyg.cjs +181 -0
- package/dist/{theme-CG3Gpne7.cjs.map → theme-D7zOJiyg.cjs.map} +1 -1
- package/dist/{theme-button-oWeOoeSw.js → theme-button-C53GdQER.js} +4 -4
- package/dist/{theme-button-oWeOoeSw.js.map → theme-button-C53GdQER.js.map} +1 -1
- package/dist/theme-button-DgeBcqFm.cjs +8 -0
- package/dist/{theme-button-CEc_Kl54.cjs.map → theme-button-DgeBcqFm.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-CSt7JUBD.cjs.map +1 -1
- package/dist/theme.interface-odQEpZZH.js.map +1 -1
- package/dist/theme.js +3 -3
- package/dist/{theme.service-Bh08uOSJ.js → theme.service-BqDuioYc.js} +1 -1
- package/dist/{theme.service-Bh08uOSJ.js.map → theme.service-BqDuioYc.js.map} +1 -1
- package/dist/{theme.service-Y-e8b331.cjs → theme.service-C3PoISGd.cjs} +1 -1
- package/dist/{theme.service-Y-e8b331.cjs.map → theme.service-C3PoISGd.cjs.map} +1 -1
- package/dist/tooltip.cjs.map +1 -1
- package/dist/tooltip.js.map +1 -1
- package/dist/tree.cjs +3 -3
- package/dist/tree.cjs.map +1 -1
- package/dist/tree.js +4 -4
- package/dist/tree.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/typewriter.cjs.map +1 -1
- package/dist/typewriter.js.map +1 -1
- package/dist/{typography-CjAvaB88.cjs → typography-B19fJ5YT.cjs} +4 -4
- package/dist/{typography-CjAvaB88.cjs.map → typography-B19fJ5YT.cjs.map} +1 -1
- package/dist/{typography-DP82e3GJ.js → typography-CzbQv-X0.js} +10 -10
- package/dist/{typography-DP82e3GJ.js.map → typography-CzbQv-X0.js.map} +1 -1
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +1 -1
- package/dist/utils-DTa3QHxk.cjs.map +1 -1
- package/dist/utils-H8wNknWC.js.map +1 -1
- package/dist/visually-hidden.cjs +2 -2
- package/dist/visually-hidden.cjs.map +1 -1
- package/dist/visually-hidden.js +4 -4
- package/dist/visually-hidden.js.map +1 -1
- package/dist/window-DXB53PuA.cjs +59 -0
- package/dist/{window-aVXgfw__.cjs.map → window-DXB53PuA.cjs.map} +1 -1
- package/dist/{window-BkPXY-8m.js → window-DpctMXiy.js} +9 -9
- package/dist/{window-BkPXY-8m.js.map → window-DpctMXiy.js.map} +1 -1
- package/dist/window.cjs +1 -1
- package/dist/window.js +1 -1
- package/package.json +1 -1
- package/skills/schmancy/form.md +34 -0
- package/src/state/active-host.ts +50 -1
- package/src/state/index.ts +50 -11
- package/src/state/schmancy-context.ts +97 -88
- package/src/surface/surface.styles.ts +14 -10
- package/types/src/state/active-host.d.ts +3 -0
- package/types/src/state/index.d.ts +16 -2
- package/types/src/state/schmancy-context.d.ts +2 -2
- package/dist/active-host-BP0zy_Y9.js +0 -63
- package/dist/active-host-BP0zy_Y9.js.map +0 -1
- package/dist/active-host-jH3iloCR.cjs +0 -1
- package/dist/active-host-jH3iloCR.cjs.map +0 -1
- package/dist/agent/overlay.confirm-body-BFYWMa45.js +0 -5518
- package/dist/agent/overlay.confirm-body-BFYWMa45.js.map +0 -1
- package/dist/area-HXuLLQnN.cjs +0 -21
- package/dist/date-range-inline-BnhQZTK0.cjs +0 -43
- package/dist/float-DyaPI0qO.cjs +0 -1
- package/dist/menu-Bfay8vF8.cjs +0 -23
- package/dist/mixins-BfazlmLD.js.map +0 -1
- package/dist/mixins-CxGRIPYQ.cjs.map +0 -1
- package/dist/notification-DT_cAi8U.cjs +0 -24
- package/dist/overlay-CRwfhbyi.cjs +0 -43
- package/dist/overlay.confirm-body-CxOomuN6.cjs +0 -70
- package/dist/radio-group-DQRJGMgS.cjs +0 -19
- package/dist/splash-screen-CGnhHDB_.cjs +0 -41
- package/dist/src-C0MzzF_S.cjs +0 -263
- package/dist/state-CHbIt2Dw.js.map +0 -1
- package/dist/state-DcGj-pJJ.cjs +0 -1
- package/dist/state-DcGj-pJJ.cjs.map +0 -1
- package/dist/surface-DPzlMMYX.cjs +0 -7
- package/dist/textarea-Cjlsy3y9.cjs +0 -43
- package/dist/theme-CG3Gpne7.cjs +0 -181
- package/dist/theme-button-CEc_Kl54.cjs +0 -8
- package/dist/window-aVXgfw__.cjs +0 -59
- /package/dist/agent/{flow-3RrZM-e7.js → flow-CvG1fLW5.js} +0 -0
- /package/dist/agent/{vendor-material-color-33Mj762T.js → vendor-material-color-DcL7ZPxx.js} +0 -0
package/src/state/active-host.ts
CHANGED
|
@@ -177,10 +177,59 @@ export function resolveActiveHost(): HTMLElement | undefined {
|
|
|
177
177
|
return document.activeElement
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
// 4. undefined — caller falls back to module-scoped.
|
|
180
|
+
// 4. undefined — caller falls back to module-scoped (or ambient tier 5).
|
|
181
181
|
return undefined
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
185
|
+
// Tier 5 — Ambient provider registry.
|
|
186
|
+
//
|
|
187
|
+
// When exactly one <schmancy-context> provides a namespace and no active host
|
|
188
|
+
// is on the stack, state writes from async callbacks (Firestore onSnapshot,
|
|
189
|
+
// setTimeout, WebSocket handlers, etc.) automatically route to that isolated
|
|
190
|
+
// copy. No consumer-side _activeHost.run() boilerplate required.
|
|
191
|
+
//
|
|
192
|
+
// Ambiguity rule: if two or more contexts simultaneously provide the same
|
|
193
|
+
// namespace the entry is marked AMBIGUOUS and getAmbientProvider returns
|
|
194
|
+
// undefined — we fall through to the global rather than guess. Safe
|
|
195
|
+
// degradation: never silently write to the wrong isolated copy.
|
|
196
|
+
//
|
|
197
|
+
// Singleton across module copies via Symbol.for so source + dist share one map.
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
const AMBIENT_KEY = Symbol.for('schmancy.state.activeHost.ambientProviders')
|
|
200
|
+
type AmbientEntry = { instance: unknown; count: number }
|
|
201
|
+
const _ambientMap: Map<string, AmbientEntry> =
|
|
202
|
+
((globalThis as { [AMBIENT_KEY]?: Map<string, AmbientEntry> })[AMBIENT_KEY] ??= new Map())
|
|
203
|
+
|
|
204
|
+
const AMBIGUOUS: unique symbol = Symbol('ambiguous')
|
|
205
|
+
|
|
206
|
+
export function registerAmbientProvider(namespace: string, instance: unknown): void {
|
|
207
|
+
const e = _ambientMap.get(namespace)
|
|
208
|
+
if (e) {
|
|
209
|
+
e.count++
|
|
210
|
+
e.instance = AMBIGUOUS
|
|
211
|
+
} else {
|
|
212
|
+
_ambientMap.set(namespace, { instance, count: 1 })
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function deregisterAmbientProvider(namespace: string): void {
|
|
217
|
+
const e = _ambientMap.get(namespace)
|
|
218
|
+
if (!e) return
|
|
219
|
+
if (e.count <= 1) {
|
|
220
|
+
_ambientMap.delete(namespace)
|
|
221
|
+
} else {
|
|
222
|
+
e.count--
|
|
223
|
+
// Once ambiguous, stays ambiguous until fully deregistered — we've lost
|
|
224
|
+
// the individual instance references so can't safely restore one.
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function getAmbientProvider(namespace: string): unknown | undefined {
|
|
229
|
+
const e = _ambientMap.get(namespace)
|
|
230
|
+
return e && e.instance !== AMBIGUOUS ? e.instance : undefined
|
|
231
|
+
}
|
|
232
|
+
|
|
184
233
|
/** Stable context key for a state namespace. `Symbol.for(...)` so the same
|
|
185
234
|
* namespace string yields the same symbol across module boundaries — the
|
|
186
235
|
* ContextProvider on `<schmancy-context>` and the ContextRequestEvent
|
package/src/state/index.ts
CHANGED
|
@@ -19,11 +19,11 @@ import { Signal } from '@lit-labs/signals'
|
|
|
19
19
|
// `@lit/context` re-exports `ContextRequestEvent` as `ContextEvent` from
|
|
20
20
|
// its public entry. Same class, just a shorter public name.
|
|
21
21
|
import { ContextEvent as ContextRequestEvent, createContext } from '@lit/context'
|
|
22
|
-
import { Observable } from 'rxjs'
|
|
22
|
+
import { Observable, type MonoTypeOperatorFunction } from 'rxjs'
|
|
23
23
|
import { produce, type Draft } from 'immer'
|
|
24
24
|
|
|
25
25
|
import { createAdapter, type StorageAdapter, type StorageBackend } from './persist'
|
|
26
|
-
import { resolveActiveHost, stateContextKey } from './active-host'
|
|
26
|
+
import { _activeHost, getAmbientProvider, resolveActiveHost, stateContextKey } from './active-host'
|
|
27
27
|
// Side-effect import: registers the `<schmancy-context>` element so users
|
|
28
28
|
// only need to import from `@mhmo91/schmancy/state` to get both the factory
|
|
29
29
|
// and the scoping primitive.
|
|
@@ -31,7 +31,7 @@ import './schmancy-context'
|
|
|
31
31
|
|
|
32
32
|
export type { StorageBackend } from './persist'
|
|
33
33
|
export { Signal } from '@lit-labs/signals'
|
|
34
|
-
export { _activeHost } from './active-host'
|
|
34
|
+
export { _activeHost, registerAmbientProvider, deregisterAmbientProvider, getAmbientProvider } from './active-host'
|
|
35
35
|
export { SchmancyContext } from './schmancy-context'
|
|
36
36
|
|
|
37
37
|
// ---------------------------------------------------------------------------
|
|
@@ -253,7 +253,10 @@ const hostResolverCache = __cacheSlot[CACHE_KEY]!
|
|
|
253
253
|
|
|
254
254
|
function resolveContextual(namespace: string, fallback: unknown): unknown {
|
|
255
255
|
const host = resolveActiveHost()
|
|
256
|
-
if (host === undefined)
|
|
256
|
+
if (host === undefined) {
|
|
257
|
+
const ambient = getAmbientProvider(namespace)
|
|
258
|
+
return ambient !== undefined ? ambient : fallback
|
|
259
|
+
}
|
|
257
260
|
|
|
258
261
|
const cached = hostResolverCache.get(host)?.get(namespace)
|
|
259
262
|
if (cached !== undefined) return cached
|
|
@@ -266,14 +269,25 @@ function resolveContextual(namespace: string, fallback: unknown): unknown {
|
|
|
266
269
|
}),
|
|
267
270
|
)
|
|
268
271
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
perHost =
|
|
273
|
-
|
|
272
|
+
if (resolved !== undefined) {
|
|
273
|
+
// Real provider in the host's ancestor chain — safe to cache against
|
|
274
|
+
// the host: the binding lives as long as the host is connected.
|
|
275
|
+
let perHost = hostResolverCache.get(host)
|
|
276
|
+
if (!perHost) {
|
|
277
|
+
perHost = new Map<string, unknown>()
|
|
278
|
+
hostResolverCache.set(host, perHost)
|
|
279
|
+
}
|
|
280
|
+
perHost.set(namespace, resolved)
|
|
281
|
+
return resolved
|
|
274
282
|
}
|
|
275
|
-
|
|
276
|
-
|
|
283
|
+
|
|
284
|
+
// Host exists (tier 1/2/3 found one) but it's not inside a schmancy-context
|
|
285
|
+
// for this namespace. Try the ambient registry before falling through to
|
|
286
|
+
// the global. Don't cache: the ambient provider can be unmounted while
|
|
287
|
+
// this host remains connected, which would leave a stale isolated copy
|
|
288
|
+
// pinned in the cache.
|
|
289
|
+
const ambient = getAmbientProvider(namespace)
|
|
290
|
+
return ambient !== undefined ? ambient : fallback
|
|
277
291
|
}
|
|
278
292
|
|
|
279
293
|
interface InternalState {
|
|
@@ -897,3 +911,28 @@ export function observe<T>(source: ObservableState<T>) {
|
|
|
897
911
|
})
|
|
898
912
|
}
|
|
899
913
|
}
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* RxJS operator that restores `host` as the active schmancy context for every
|
|
918
|
+
* emission. Drop this into any pipeline whose subscriber calls state mutators
|
|
919
|
+
* from an async scheduler that bypasses the Promise.then patch (Firestore
|
|
920
|
+
* onSnapshot, WebSockets, native timers, etc.).
|
|
921
|
+
*
|
|
922
|
+
* ```ts
|
|
923
|
+
* snapshotDoc$(ref).pipe(
|
|
924
|
+
* schmancyContext(this),
|
|
925
|
+
* takeUntil(this.disconnecting),
|
|
926
|
+
* ).subscribe(snap => { ws.legalEntity.set(parse(snap)) })
|
|
927
|
+
* ```
|
|
928
|
+
*/
|
|
929
|
+
export function schmancyContext<T>(host: HTMLElement): MonoTypeOperatorFunction<T> {
|
|
930
|
+
return (source) =>
|
|
931
|
+
new Observable<T>((subscriber) =>
|
|
932
|
+
source.subscribe({
|
|
933
|
+
next: (v) => _activeHost.run(host, () => subscriber.next(v)),
|
|
934
|
+
error: (e) => subscriber.error(e),
|
|
935
|
+
complete: () => subscriber.complete(),
|
|
936
|
+
}),
|
|
937
|
+
)
|
|
938
|
+
}
|
|
@@ -11,10 +11,16 @@
|
|
|
11
11
|
// connected. `disconnectedCallback` destroys all isolated copies; their
|
|
12
12
|
// pending writes flush, their adapters close.
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
14
|
+
import { type Context, ContextProvider, createContext } from '@lit/context';
|
|
15
|
+
import { SchmancyElement } from '@mixins/SchmancyElement';
|
|
16
|
+
import { html } from 'lit';
|
|
17
|
+
import { property } from 'lit/decorators.js';
|
|
18
|
+
import {
|
|
19
|
+
_publishEventHost,
|
|
20
|
+
deregisterAmbientProvider,
|
|
21
|
+
registerAmbientProvider,
|
|
22
|
+
stateContextKey,
|
|
23
|
+
} from './active-host';
|
|
18
24
|
|
|
19
25
|
// Curated set of DOM event types that descendants are likely to bind state-
|
|
20
26
|
// mutating handlers to. The capture-phase listener publishes `this` as the
|
|
@@ -22,109 +28,112 @@ import { _publishEventHost, stateContextKey } from './active-host'
|
|
|
22
28
|
// inline handlers (or any code reached during the synchronous chain) call a
|
|
23
29
|
// state mutator can resolve back to the isolated copy this context provides.
|
|
24
30
|
const EVENT_TYPES = [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
] as const
|
|
31
|
+
'click',
|
|
32
|
+
'dblclick',
|
|
33
|
+
'submit',
|
|
34
|
+
'change',
|
|
35
|
+
'input',
|
|
36
|
+
'keydown',
|
|
37
|
+
'keyup',
|
|
38
|
+
'keypress',
|
|
39
|
+
'pointerdown',
|
|
40
|
+
'pointerup',
|
|
41
|
+
'mousedown',
|
|
42
|
+
'mouseup',
|
|
43
|
+
'focus',
|
|
44
|
+
'blur',
|
|
45
|
+
'paste',
|
|
46
|
+
'drop',
|
|
47
|
+
] as const;
|
|
42
48
|
|
|
43
49
|
/** Duck-typed view of what the `state()` factory hands out, restricted to the
|
|
44
50
|
* bits `<schmancy-context>` needs. Kept internal — consumers see the full
|
|
45
51
|
* `State<>` type and never refer to this. */
|
|
46
52
|
export interface StateTemplate {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
readonly namespace: string;
|
|
54
|
+
readonly value: unknown;
|
|
55
|
+
/** Internal hook the factory adds to every state instance. Builds a fresh
|
|
56
|
+
* per-context copy seeded with the current value, sharing nothing with the
|
|
57
|
+
* global instance. The returned object exposes `destroy()` so the context
|
|
58
|
+
* element can flush + close on disconnect. */
|
|
59
|
+
_isolatedInstance(): { destroy(): void } & Record<string | symbol, unknown>;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
export class SchmancyContext extends
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
export class SchmancyContext extends SchmancyElement {
|
|
63
|
+
/** States to isolate under this subtree. Pass the same instances you import
|
|
64
|
+
* at module scope (e.g. `provides={[cart, menu]}`). Outside this element
|
|
65
|
+
* they continue to behave as module-scoped globals; descendants of this
|
|
66
|
+
* element see a per-element isolated copy. */
|
|
67
|
+
@property({ attribute: false }) provides: readonly StateTemplate[] = [];
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
// Per-mount records. Keep both the provider (so we can release it on
|
|
70
|
+
// disconnect) and the isolated instance (so we can destroy it).
|
|
71
|
+
private _scoped: Array<{
|
|
72
|
+
namespace: string;
|
|
73
|
+
isolated: { destroy(): void };
|
|
74
|
+
provider: ContextProvider<Context<unknown, unknown>>;
|
|
75
|
+
}> = [];
|
|
69
76
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
private _publishEventTargetAsHost = (e: Event): void => {
|
|
78
|
+
// Publish the deepest event target (across shadow boundaries) rather
|
|
79
|
+
// than `this`. The downstream `ContextRequestEvent` will be dispatched
|
|
80
|
+
// from this host and must bubble up through `<schmancy-context>` to
|
|
81
|
+
// reach our `ContextProvider`. `@lit/context` skips self-registration
|
|
82
|
+
// (`consumerHost === this.host` ⇒ no-op), so dispatching from
|
|
83
|
+
// schmancy-context itself would silently fall back to the global.
|
|
84
|
+
const path = e.composedPath();
|
|
85
|
+
for (const node of path) {
|
|
86
|
+
if (node instanceof HTMLElement) {
|
|
87
|
+
_publishEventHost(node);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
85
92
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
override connectedCallback(): void {
|
|
94
|
+
super.connectedCallback();
|
|
95
|
+
for (const tmpl of this.provides) {
|
|
96
|
+
const isolated = tmpl._isolatedInstance();
|
|
97
|
+
const ctx = createContext<unknown>(stateContextKey(tmpl.namespace));
|
|
98
|
+
// ContextProvider auto-wires via the host's ReactiveControllerHost
|
|
99
|
+
// interface (LitElement satisfies it). It listens for
|
|
100
|
+
// `context-request` events and responds with `isolated` for any
|
|
101
|
+
// requester whose `event.context === ctx`.
|
|
102
|
+
const provider = new ContextProvider(this, { context: ctx, initialValue: isolated });
|
|
103
|
+
registerAmbientProvider(tmpl.namespace, isolated);
|
|
104
|
+
this._scoped.push({ namespace: tmpl.namespace, isolated, provider });
|
|
105
|
+
}
|
|
106
|
+
for (const type of EVENT_TYPES) {
|
|
107
|
+
this.addEventListener(type, this._publishEventTargetAsHost, { capture: true });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
102
110
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
override disconnectedCallback(): void {
|
|
112
|
+
for (const type of EVENT_TYPES) {
|
|
113
|
+
this.removeEventListener(type, this._publishEventTargetAsHost, { capture: true });
|
|
114
|
+
}
|
|
115
|
+
for (const entry of this._scoped) {
|
|
116
|
+
deregisterAmbientProvider(entry.namespace);
|
|
117
|
+
entry.isolated.destroy();
|
|
118
|
+
}
|
|
119
|
+
this._scoped = [];
|
|
120
|
+
super.disconnectedCallback();
|
|
121
|
+
}
|
|
113
122
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
123
|
+
override render() {
|
|
124
|
+
return html`<slot></slot>`;
|
|
125
|
+
}
|
|
117
126
|
}
|
|
118
127
|
|
|
119
128
|
// Imperative define so a second load (source + dist) is a no-op rather than
|
|
120
129
|
// a throw — the registry is process-global; whichever class wins serves the
|
|
121
130
|
// element identity for the page.
|
|
122
131
|
if (!customElements.get('schmancy-context')) {
|
|
123
|
-
|
|
132
|
+
customElements.define('schmancy-context', SchmancyContext);
|
|
124
133
|
}
|
|
125
134
|
|
|
126
135
|
declare global {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
136
|
+
interface HTMLElementTagNameMap {
|
|
137
|
+
'schmancy-context': SchmancyContext;
|
|
138
|
+
}
|
|
130
139
|
}
|
|
@@ -25,13 +25,15 @@ export const surfaceTypeStyles = css`
|
|
|
25
25
|
color: var(--schmancy-sys-color-surface-on);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
/* Subtle —
|
|
28
|
+
/* Subtle — bright vibrant glass: near-white tint, saturated blur, top-edge highlight */
|
|
29
29
|
:host([type='subtle']) {
|
|
30
|
-
--glass-base: var(--schmancy-sys-color-surface-
|
|
30
|
+
--glass-base: var(--schmancy-sys-color-surface-lowest);
|
|
31
31
|
--glass-tint: var(--schmancy-sys-color-surface-on);
|
|
32
|
-
background: color-mix(in srgb, var(--glass-base)
|
|
33
|
-
backdrop-filter: blur(
|
|
34
|
-
-webkit-backdrop-filter: blur(
|
|
32
|
+
background: color-mix(in srgb, var(--glass-base) 30%, transparent);
|
|
33
|
+
backdrop-filter: blur(12px) saturate(160%);
|
|
34
|
+
-webkit-backdrop-filter: blur(12px) saturate(160%);
|
|
35
|
+
border: 1px solid color-mix(in srgb, var(--schmancy-sys-color-outlineVariant) 60%, transparent);
|
|
36
|
+
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--schmancy-sys-color-surface-on) 8%, transparent);
|
|
35
37
|
color: var(--schmancy-sys-color-surface-on);
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -147,14 +149,16 @@ export const surfaceTypeStyles = css`
|
|
|
147
149
|
color: var(--schmancy-sys-color-surface-on);
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
/* subtle aliases —
|
|
152
|
+
/* subtle aliases — bright vibrant glass */
|
|
151
153
|
:host([type='containerLow']),
|
|
152
154
|
:host([type='container']) {
|
|
153
|
-
--glass-base: var(--schmancy-sys-color-surface-
|
|
155
|
+
--glass-base: var(--schmancy-sys-color-surface-lowest);
|
|
154
156
|
--glass-tint: var(--schmancy-sys-color-surface-on);
|
|
155
|
-
background: color-mix(in srgb, var(--glass-base)
|
|
156
|
-
backdrop-filter: blur(
|
|
157
|
-
-webkit-backdrop-filter: blur(
|
|
157
|
+
background: color-mix(in srgb, var(--glass-base) 30%, transparent);
|
|
158
|
+
backdrop-filter: blur(12px) saturate(160%);
|
|
159
|
+
-webkit-backdrop-filter: blur(12px) saturate(160%);
|
|
160
|
+
border: 1px solid color-mix(in srgb, var(--schmancy-sys-color-outlineVariant) 60%, transparent);
|
|
161
|
+
box-shadow: inset 0 1px 0 color-mix(in srgb, var(--schmancy-sys-color-surface-on) 8%, transparent);
|
|
158
162
|
color: var(--schmancy-sys-color-surface-on);
|
|
159
163
|
}
|
|
160
164
|
|
|
@@ -16,6 +16,9 @@ export declare const _activeHost: {
|
|
|
16
16
|
* later, unrelated microtask sees a stale value. */
|
|
17
17
|
export declare function _publishEventHost(host: HTMLElement): void;
|
|
18
18
|
export declare function resolveActiveHost(): HTMLElement | undefined;
|
|
19
|
+
export declare function registerAmbientProvider(namespace: string, instance: unknown): void;
|
|
20
|
+
export declare function deregisterAmbientProvider(namespace: string): void;
|
|
21
|
+
export declare function getAmbientProvider(namespace: string): unknown | undefined;
|
|
19
22
|
/** Stable context key for a state namespace. `Symbol.for(...)` so the same
|
|
20
23
|
* namespace string yields the same symbol across module boundaries — the
|
|
21
24
|
* ContextProvider on `<schmancy-context>` and the ContextRequestEvent
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Signal } from '@lit-labs/signals';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
2
|
+
import { Observable, type MonoTypeOperatorFunction } from 'rxjs';
|
|
3
3
|
import { type Draft } from 'immer';
|
|
4
4
|
import { type StorageBackend } from './persist';
|
|
5
5
|
import './schmancy-context';
|
|
6
6
|
export type { StorageBackend } from './persist';
|
|
7
7
|
export { Signal } from '@lit-labs/signals';
|
|
8
|
-
export { _activeHost } from './active-host';
|
|
8
|
+
export { _activeHost, registerAmbientProvider, deregisterAmbientProvider, getAmbientProvider } from './active-host';
|
|
9
9
|
export { SchmancyContext } from './schmancy-context';
|
|
10
10
|
declare const stateBrand: unique symbol;
|
|
11
11
|
declare const namespaceBrand: unique symbol;
|
|
@@ -143,3 +143,17 @@ export interface BoundState<T> {
|
|
|
143
143
|
}
|
|
144
144
|
export declare function bindState<T>(host: ReactiveControllerHost, source: ObservableState<T>): BoundState<T>;
|
|
145
145
|
export declare function observe<T>(source: ObservableState<T>): (proto: object, propertyKey: string | symbol) => void;
|
|
146
|
+
/**
|
|
147
|
+
* RxJS operator that restores `host` as the active schmancy context for every
|
|
148
|
+
* emission. Drop this into any pipeline whose subscriber calls state mutators
|
|
149
|
+
* from an async scheduler that bypasses the Promise.then patch (Firestore
|
|
150
|
+
* onSnapshot, WebSockets, native timers, etc.).
|
|
151
|
+
*
|
|
152
|
+
* ```ts
|
|
153
|
+
* snapshotDoc$(ref).pipe(
|
|
154
|
+
* schmancyContext(this),
|
|
155
|
+
* takeUntil(this.disconnecting),
|
|
156
|
+
* ).subscribe(snap => { ws.legalEntity.set(parse(snap)) })
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export declare function schmancyContext<T>(host: HTMLElement): MonoTypeOperatorFunction<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SchmancyElement } from '@mixins/SchmancyElement';
|
|
2
2
|
/** Duck-typed view of what the `state()` factory hands out, restricted to the
|
|
3
3
|
* bits `<schmancy-context>` needs. Kept internal — consumers see the full
|
|
4
4
|
* `State<>` type and never refer to this. */
|
|
@@ -13,7 +13,7 @@ export interface StateTemplate {
|
|
|
13
13
|
destroy(): void;
|
|
14
14
|
} & Record<string | symbol, unknown>;
|
|
15
15
|
}
|
|
16
|
-
export declare class SchmancyContext extends
|
|
16
|
+
export declare class SchmancyContext extends SchmancyElement {
|
|
17
17
|
/** States to isolate under this subtree. Pass the same instances you import
|
|
18
18
|
* at module scope (e.g. `provides={[cart, menu]}`). Outside this element
|
|
19
19
|
* they continue to behave as module-scoped globals; descendants of this
|
|
@@ -1,63 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,IAAM,IAAS,EAAG,GAAW;AAgB7B,IAAuB,OAAZ,UAAY,OAAZ,EAA6B,OAAiC,QAAQ,YAAY;CAC5F,OAAO,eAAe,QAAQ,WAAW,KAA+B;EACvE,OAAA,CAAO;EACP,cAAA,CAAc;EACd,YAAA,CAAY;EACZ,UAAA,CAAU;EAAA,CAAA;CAEX,IAAM,IAAY,QAAQ,UAAU;CAKpC,QAAQ,UAAU,OAAO,SAExB,GACA,GAAA;EAEA,IAAM,IAAW,EAAO,EAAO,SAAS,IAClC,IAAgB,OAClB,MAAA;GACD,EAAO,KAAK,EAAA;GACZ,IAAA;IACC,OAAO,EAAY,EAAA;aAAA;IAEnB,EAAO,KAAA;;MAIL,IAAe,OACjB,MAAA;GACD,EAAO,KAAK,EAAA;GACZ,IAAA;IACC,OAAO,EAAW,EAAA;aAAA;IAElB,EAAO,KAAA;;;EAIX,OAAO,EAAU,KAAK,MAAM,GAAe,EAAA;;;AAK7C,IAAa,IAAc;CAG1B,IAAO,GAA+B,GAAA;EACrC,EAAO,KAAK,EAAA;EACZ,IAAA;GACC,OAAO,GAAA;YAAA;GAEP,EAAO,KAAA;;;CAIT,WACQ,EAAO,EAAO,SAAS;CAAA,EAa1B,IAAiB,OAAO,IAAI,sCAAA,EAE5B,IACJ,WAAqD,OAAoB;CACzE,MAAA,KAAM;CACN,WAAA,CAAW;CAAA;AAOb,SAAgB,EAAkB,GAAA;CACjC,EAAe,OAAO,GAClB,EAAe,cACnB,EAAe,YAAA,CAAY,GAC3B,qBAAA;EACC,EAAe,YAAA,CAAY,GAC3B,EAAe,OAAA,KAAO;GAAA;;AAIxB,SAAgB,IAAA;CAEf,IAAM,IAAY,EAAY,KAAA;CAC9B,OAAI,MAAJ,KAAkB,IAGd,EAAe,SAHiB,KAGR,IAGJ,OAAb,WAAa,OAAe,SAAS,yBAAyB,cACjE,SAAS,gBAAA,KADjB,IAH8C,EAAe,OAHzB;;AAkBrC,SAAgB,EAAgB,GAAA;CAC/B,OAAO,OAAO,IAAI,kBAAkB,IAAA;;AAAA,SAAA,KAAA,GAAA,KAAA,GAAA,KAAA,GAAA,QAAA,KAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,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,SAAA,CAAU,EAAA,CAAA,CAEX,IAAM,EAAY,QAAQ,UAAU,KAKpC,QAAQ,UAAU,KAAO,SAExB,EACA,EAAA,CAEA,IAAM,EAAW,EAAO,EAAO,OAAS,GAClC,EAAgB,IAClB,GAAA,CACD,EAAO,KAAK,EAAA,CACZ,GAAA,CACC,OAAO,EAAY,EAAA,QAAA,CAEnB,EAAO,KAAA,IAIL,EAAe,IACjB,GAAA,CACD,EAAO,KAAK,EAAA,CACZ,GAAA,CACC,OAAO,EAAW,EAAA,QAAA,CAElB,EAAO,KAAA,IAIX,OAAO,EAAU,KAAK,KAAM,EAAe,EAAA,EAK7C,IAAa,EAAc,CAG1B,IAAO,EAA+B,EAAA,CACrC,EAAO,KAAK,EAAA,CACZ,GAAA,CACC,OAAO,GAAA,QAAA,CAEP,EAAO,KAAA,GAIT,QACQ,EAAO,EAAO,OAAS,GAAA,CAa1B,EAAiB,OAAO,IAAI,sCAAA,CAE5B,EACJ,WAAqD,KAAoB,CACzE,KAAA,IAAM,GACN,UAAA,CAAW,EAAA,CAOb,SAAgB,EAAkB,EAAA,CACjC,EAAe,KAAO,EAClB,EAAe,YACnB,EAAe,UAAA,CAAY,EAC3B,mBAAA,CACC,EAAe,UAAA,CAAY,EAC3B,EAAe,KAAA,IAAO,IAAA,EAIxB,SAAgB,GAAA,CAEf,IAAM,EAAY,EAAY,KAAA,CAC9B,OAAI,IAAJ,IAAkB,GAGd,EAAe,OAHiB,IAGR,GAGJ,OAAb,SAAa,KAAe,SAAS,yBAAyB,YACjE,SAAS,cAAA,IADjB,GAH8C,EAAe,KAHzB,EAkBrC,SAAgB,EAAgB,EAAA,CAC/B,OAAO,OAAO,IAAI,kBAAkB,IAAA,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,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,CAAA,OAAA,eAAA,QAAA,IAAA,CAAA,WAAA,CAAA,EAAA,IAAA,UAAA,CAAA,OAAA,GAAA,CAAA"}
|