@expressivecss/expressive 0.14.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1589 -1
- package/README.md +9 -8
- package/dist/css/expressive.css +19304 -12021
- package/dist/css/expressive.css.map +1 -1
- package/dist/css/expressive.min.css +1 -1
- package/dist/css/expressive.min.css.map +1 -1
- package/dist/fonts/LICENSE-noto-sans-arabic +93 -0
- package/dist/fonts/LICENSE-noto-sans-hebrew +93 -0
- package/dist/fonts/LICENSE-noto-sans-thai +93 -0
- package/dist/fonts/material-symbols-outlined.woff2 +0 -0
- package/dist/fonts/material-symbols-rounded.woff2 +0 -0
- package/dist/fonts/material-symbols-sharp.woff2 +0 -0
- package/dist/fonts/noto-sans-arabic-arabic-400.woff2 +0 -0
- package/dist/fonts/noto-sans-arabic-arabic-500.woff2 +0 -0
- package/dist/fonts/noto-sans-arabic-arabic-700.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-400.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-500.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-700.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-ext-400.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-ext-500.woff2 +0 -0
- package/dist/fonts/noto-sans-cyrillic-ext-700.woff2 +0 -0
- package/dist/fonts/noto-sans-devanagari-400.woff2 +0 -0
- package/dist/fonts/noto-sans-devanagari-500.woff2 +0 -0
- package/dist/fonts/noto-sans-devanagari-700.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-400.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-500.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-700.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-ext-400.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-ext-500.woff2 +0 -0
- package/dist/fonts/noto-sans-greek-ext-700.woff2 +0 -0
- package/dist/fonts/noto-sans-hebrew-hebrew-400.woff2 +0 -0
- package/dist/fonts/noto-sans-hebrew-hebrew-500.woff2 +0 -0
- package/dist/fonts/noto-sans-hebrew-hebrew-700.woff2 +0 -0
- package/dist/fonts/noto-sans-latin-700.woff2 +0 -0
- package/dist/fonts/noto-sans-latin-ext-400.woff2 +0 -0
- package/dist/fonts/noto-sans-latin-ext-500.woff2 +0 -0
- package/dist/fonts/noto-sans-latin-ext-700.woff2 +0 -0
- package/dist/fonts/noto-sans-thai-thai-400.woff2 +0 -0
- package/dist/fonts/noto-sans-thai-thai-500.woff2 +0 -0
- package/dist/fonts/noto-sans-thai-thai-700.woff2 +0 -0
- package/dist/fonts/noto-sans-vietnamese-400.woff2 +0 -0
- package/dist/fonts/noto-sans-vietnamese-500.woff2 +0 -0
- package/dist/fonts/noto-sans-vietnamese-700.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-400.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-500.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-700.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-ext-400.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-ext-500.woff2 +0 -0
- package/dist/fonts/roboto-cyrillic-ext-700.woff2 +0 -0
- package/dist/fonts/roboto-greek-400.woff2 +0 -0
- package/dist/fonts/roboto-greek-500.woff2 +0 -0
- package/dist/fonts/roboto-greek-700.woff2 +0 -0
- package/dist/fonts/roboto-greek-ext-400.woff2 +0 -0
- package/dist/fonts/roboto-greek-ext-500.woff2 +0 -0
- package/dist/fonts/roboto-greek-ext-700.woff2 +0 -0
- package/dist/fonts/roboto-latin-700.woff2 +0 -0
- package/dist/fonts/roboto-latin-ext-400.woff2 +0 -0
- package/dist/fonts/roboto-latin-ext-500.woff2 +0 -0
- package/dist/fonts/roboto-latin-ext-700.woff2 +0 -0
- package/dist/fonts/roboto-vietnamese-400.woff2 +0 -0
- package/dist/fonts/roboto-vietnamese-500.woff2 +0 -0
- package/dist/fonts/roboto-vietnamese-700.woff2 +0 -0
- package/dist/js/chunks/chunk-2CS6TITK.mjs +219 -0
- package/dist/js/chunks/chunk-2CS6TITK.mjs.map +7 -0
- package/dist/js/chunks/chunk-2RLBDFH4.mjs +108 -0
- package/dist/js/chunks/chunk-2RLBDFH4.mjs.map +7 -0
- package/dist/js/chunks/chunk-3L3QIYLC.mjs +85 -0
- package/dist/js/chunks/chunk-3L3QIYLC.mjs.map +7 -0
- package/dist/js/chunks/chunk-4EWGD4V2.mjs +75 -0
- package/dist/js/chunks/chunk-4EWGD4V2.mjs.map +7 -0
- package/dist/js/chunks/chunk-4IKVPCSU.mjs +7 -0
- package/dist/js/chunks/chunk-4IKVPCSU.mjs.map +7 -0
- package/dist/js/chunks/chunk-4PIXLDNJ.mjs +127 -0
- package/dist/js/chunks/chunk-4PIXLDNJ.mjs.map +7 -0
- package/dist/js/chunks/{chunk-A7ALMYUR.mjs → chunk-4QUCNFSD.mjs} +68 -125
- package/dist/js/chunks/chunk-4QUCNFSD.mjs.map +7 -0
- package/dist/js/chunks/{chunk-4TKTLGEM.mjs → chunk-4TRZ2AER.mjs} +35 -41
- package/dist/js/chunks/chunk-4TRZ2AER.mjs.map +7 -0
- package/dist/js/chunks/{chunk-BG6ZRB5H.mjs → chunk-5KIHWJI2.mjs} +40 -26
- package/dist/js/chunks/chunk-5KIHWJI2.mjs.map +7 -0
- package/dist/js/chunks/{chunk-YDCS5S3J.mjs → chunk-67ZPPKXS.mjs} +20 -33
- package/dist/js/chunks/chunk-67ZPPKXS.mjs.map +7 -0
- package/dist/js/chunks/{chunk-3DHK5CZU.mjs → chunk-6FSEUFVW.mjs} +40 -29
- package/dist/js/chunks/chunk-6FSEUFVW.mjs.map +7 -0
- package/dist/js/chunks/chunk-752ADW4M.mjs +225 -0
- package/dist/js/chunks/chunk-752ADW4M.mjs.map +7 -0
- package/dist/js/chunks/{chunk-GVGT6MIU.mjs → chunk-75E5EDJF.mjs} +3 -11
- package/dist/js/chunks/chunk-75E5EDJF.mjs.map +7 -0
- package/dist/js/chunks/{chunk-TBM3FT7G.mjs → chunk-7NLUI3RR.mjs} +148 -78
- package/dist/js/chunks/chunk-7NLUI3RR.mjs.map +7 -0
- package/dist/js/chunks/chunk-7W7TV6NY.mjs +108 -0
- package/dist/js/chunks/chunk-7W7TV6NY.mjs.map +7 -0
- package/dist/js/chunks/chunk-7YQBHTK3.mjs +225 -0
- package/dist/js/chunks/chunk-7YQBHTK3.mjs.map +7 -0
- package/dist/js/chunks/chunk-7YZ5CN3V.mjs +33 -0
- package/dist/js/chunks/chunk-7YZ5CN3V.mjs.map +7 -0
- package/dist/js/chunks/chunk-AI73GJKG.mjs +28 -0
- package/dist/js/chunks/chunk-AI73GJKG.mjs.map +7 -0
- package/dist/js/chunks/{chunk-NS2UMNZV.mjs → chunk-ANKFWNWT.mjs} +21 -45
- package/dist/js/chunks/chunk-ANKFWNWT.mjs.map +7 -0
- package/dist/js/chunks/{chunk-GIW4K4SE.mjs → chunk-B7DQFHA5.mjs} +37 -53
- package/dist/js/chunks/chunk-B7DQFHA5.mjs.map +7 -0
- package/dist/js/chunks/chunk-BIGU5RCJ.mjs +153 -0
- package/dist/js/chunks/chunk-BIGU5RCJ.mjs.map +7 -0
- package/dist/js/chunks/{chunk-GUB3TNO2.mjs → chunk-BPF3I2MN.mjs} +109 -27
- package/dist/js/chunks/chunk-BPF3I2MN.mjs.map +7 -0
- package/dist/js/chunks/chunk-CMGXGYUC.mjs +74 -0
- package/dist/js/chunks/chunk-CMGXGYUC.mjs.map +7 -0
- package/dist/js/chunks/{chunk-JIDMQGK6.mjs → chunk-CSYWKEK3.mjs} +322 -223
- package/dist/js/chunks/chunk-CSYWKEK3.mjs.map +7 -0
- package/dist/js/chunks/chunk-CZSQHXEV.mjs +227 -0
- package/dist/js/chunks/chunk-CZSQHXEV.mjs.map +7 -0
- package/dist/js/chunks/chunk-DZYVU75J.mjs +121 -0
- package/dist/js/chunks/chunk-DZYVU75J.mjs.map +7 -0
- package/dist/js/chunks/{chunk-QDAL4IYN.mjs → chunk-EC26RU2D.mjs} +11 -29
- package/dist/js/chunks/chunk-EC26RU2D.mjs.map +7 -0
- package/dist/js/chunks/{chunk-3GVFZ4XO.mjs → chunk-EVCVFEV3.mjs} +238 -152
- package/dist/js/chunks/chunk-EVCVFEV3.mjs.map +7 -0
- package/dist/js/chunks/chunk-FCNF4GRJ.mjs +445 -0
- package/dist/js/chunks/chunk-FCNF4GRJ.mjs.map +7 -0
- package/dist/js/chunks/chunk-GCWWEZKO.mjs +342 -0
- package/dist/js/chunks/chunk-GCWWEZKO.mjs.map +7 -0
- package/dist/js/chunks/chunk-GNRSYMVH.mjs +1 -0
- package/dist/js/chunks/chunk-GVZQH2H5.mjs +54 -0
- package/dist/js/chunks/chunk-GVZQH2H5.mjs.map +7 -0
- package/dist/js/chunks/chunk-GWZ76SR4.mjs +435 -0
- package/dist/js/chunks/chunk-GWZ76SR4.mjs.map +7 -0
- package/dist/js/chunks/{chunk-ZAS25YFD.mjs → chunk-ILDRRG7T.mjs} +21 -23
- package/dist/js/chunks/chunk-ILDRRG7T.mjs.map +7 -0
- package/dist/js/chunks/chunk-INLZWHLY.mjs +80 -0
- package/dist/js/chunks/chunk-INLZWHLY.mjs.map +7 -0
- package/dist/js/chunks/chunk-JUKBBN6P.mjs +175 -0
- package/dist/js/chunks/chunk-JUKBBN6P.mjs.map +7 -0
- package/dist/js/chunks/chunk-KYIEG4U3.mjs +730 -0
- package/dist/js/chunks/chunk-KYIEG4U3.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KHV6DZXX.mjs → chunk-KZPSAXIU.mjs} +156 -46
- package/dist/js/chunks/chunk-KZPSAXIU.mjs.map +7 -0
- package/dist/js/chunks/chunk-LDXCC2L3.mjs +438 -0
- package/dist/js/chunks/chunk-LDXCC2L3.mjs.map +7 -0
- package/dist/js/chunks/chunk-NAC72P7R.mjs +137 -0
- package/dist/js/chunks/chunk-NAC72P7R.mjs.map +7 -0
- package/dist/js/chunks/chunk-NBJAUGPP.mjs +244 -0
- package/dist/js/chunks/chunk-NBJAUGPP.mjs.map +7 -0
- package/dist/js/chunks/chunk-NNHVANQA.mjs +113 -0
- package/dist/js/chunks/chunk-NNHVANQA.mjs.map +7 -0
- package/dist/js/chunks/chunk-NVQ5EHCU.mjs +376 -0
- package/dist/js/chunks/chunk-NVQ5EHCU.mjs.map +7 -0
- package/dist/js/chunks/{chunk-Z2NRKI7R.mjs → chunk-OP43LLIC.mjs} +44 -73
- package/dist/js/chunks/chunk-OP43LLIC.mjs.map +7 -0
- package/dist/js/chunks/chunk-OUCHKSAW.mjs +63 -0
- package/dist/js/chunks/chunk-OUCHKSAW.mjs.map +7 -0
- package/dist/js/chunks/{chunk-PM655FXL.mjs → chunk-OYNUDOHR.mjs} +20 -48
- package/dist/js/chunks/chunk-OYNUDOHR.mjs.map +7 -0
- package/dist/js/chunks/{chunk-UEZUJQ66.mjs → chunk-P6DRQ6KS.mjs} +36 -31
- package/dist/js/chunks/chunk-P6DRQ6KS.mjs.map +7 -0
- package/dist/js/chunks/chunk-PA7NU5AK.mjs +99 -0
- package/dist/js/chunks/chunk-PA7NU5AK.mjs.map +7 -0
- package/dist/js/chunks/chunk-QACZ6TUP.mjs +224 -0
- package/dist/js/chunks/chunk-QACZ6TUP.mjs.map +7 -0
- package/dist/js/chunks/{chunk-5HQSGDZ5.mjs → chunk-QXKWVHBD.mjs} +286 -203
- package/dist/js/chunks/chunk-QXKWVHBD.mjs.map +7 -0
- package/dist/js/chunks/{chunk-DAIU5SLG.mjs → chunk-ROH2HDB4.mjs} +7 -6
- package/dist/js/chunks/chunk-ROH2HDB4.mjs.map +7 -0
- package/dist/js/chunks/chunk-S23RJ3XY.mjs +86 -0
- package/dist/js/chunks/chunk-S23RJ3XY.mjs.map +7 -0
- package/dist/js/chunks/{chunk-FS7XY3HT.mjs → chunk-SPPHF7YZ.mjs} +36 -29
- package/dist/js/chunks/chunk-SPPHF7YZ.mjs.map +7 -0
- package/dist/js/chunks/chunk-T3BNSRP3.mjs +152 -0
- package/dist/js/chunks/chunk-T3BNSRP3.mjs.map +7 -0
- package/dist/js/chunks/chunk-TFABTUAZ.mjs +108 -0
- package/dist/js/chunks/chunk-TFABTUAZ.mjs.map +7 -0
- package/dist/js/chunks/chunk-U4B3VHFS.mjs +507 -0
- package/dist/js/chunks/chunk-U4B3VHFS.mjs.map +7 -0
- package/dist/js/chunks/chunk-UGJHCHXG.mjs +341 -0
- package/dist/js/chunks/chunk-UGJHCHXG.mjs.map +7 -0
- package/dist/js/chunks/chunk-VFV75DHF.mjs +70 -0
- package/dist/js/chunks/chunk-VFV75DHF.mjs.map +7 -0
- package/dist/js/chunks/{chunk-4HZMB7LI.mjs → chunk-VGY4M57S.mjs} +281 -135
- package/dist/js/chunks/chunk-VGY4M57S.mjs.map +7 -0
- package/dist/js/chunks/chunk-VH4BMAZS.mjs +167 -0
- package/dist/js/chunks/chunk-VH4BMAZS.mjs.map +7 -0
- package/dist/js/chunks/chunk-VJVQIXHC.mjs +123 -0
- package/dist/js/chunks/chunk-VJVQIXHC.mjs.map +7 -0
- package/dist/js/chunks/{chunk-S3XDFGSZ.mjs → chunk-VMY55K2X.mjs} +92 -141
- package/dist/js/chunks/chunk-VMY55K2X.mjs.map +7 -0
- package/dist/js/chunks/{chunk-UEXCIMJZ.mjs → chunk-VR3L2WN5.mjs} +11 -17
- package/dist/js/chunks/chunk-VR3L2WN5.mjs.map +7 -0
- package/dist/js/chunks/chunk-W6FAL3TI.mjs +38 -0
- package/dist/js/chunks/chunk-W6FAL3TI.mjs.map +7 -0
- package/dist/js/chunks/chunk-WU7XJ4RR.mjs +450 -0
- package/dist/js/chunks/chunk-WU7XJ4RR.mjs.map +7 -0
- package/dist/js/chunks/chunk-X7SDA2J5.mjs +116 -0
- package/dist/js/chunks/chunk-X7SDA2J5.mjs.map +7 -0
- package/dist/js/chunks/chunk-Y6H2X7ZC.mjs +209 -0
- package/dist/js/chunks/chunk-Y6H2X7ZC.mjs.map +7 -0
- package/dist/js/chunks/chunk-Y6TLRA3U.mjs +129 -0
- package/dist/js/chunks/chunk-Y6TLRA3U.mjs.map +7 -0
- package/dist/js/chunks/chunk-Z4GICXR2.mjs +190 -0
- package/dist/js/chunks/chunk-Z4GICXR2.mjs.map +7 -0
- package/dist/js/chunks/chunk-Z4OARDZ7.mjs +442 -0
- package/dist/js/chunks/chunk-Z4OARDZ7.mjs.map +7 -0
- package/dist/js/chunks/{chunk-MZ6Z24BX.mjs → chunk-ZJNLAGY5.mjs} +19 -34
- package/dist/js/chunks/chunk-ZJNLAGY5.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZKWUWBUB.mjs +81 -0
- package/dist/js/chunks/chunk-ZKWUWBUB.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZM3XBHWV.mjs +746 -0
- package/dist/js/chunks/chunk-ZM3XBHWV.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZO6ZLHFF.mjs +48 -0
- package/dist/js/chunks/chunk-ZO6ZLHFF.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZVLOUDIJ.mjs +251 -0
- package/dist/js/chunks/chunk-ZVLOUDIJ.mjs.map +7 -0
- package/dist/js/expressive.cjs +10333 -4070
- package/dist/js/expressive.cjs.map +4 -4
- package/dist/js/expressive.js +10333 -4070
- package/dist/js/expressive.js.map +4 -4
- package/dist/js/expressive.min.js +23 -25
- package/dist/js/expressive.min.js.map +4 -4
- package/dist/js/expressive.mjs +184 -69
- package/dist/js/expressive.mjs.map +2 -2
- package/dist/js/internal/behaviors/bottomSheets.mjs +4 -3
- package/dist/js/internal/behaviors/copy.mjs +9 -0
- package/dist/js/internal/behaviors/copy.mjs.map +7 -0
- package/dist/js/internal/behaviors/dataTables.mjs +10 -0
- package/dist/js/internal/behaviors/dataTables.mjs.map +7 -0
- package/dist/js/internal/behaviors/dialogs.mjs +2 -2
- package/dist/js/internal/behaviors/forms.mjs +2 -2
- package/dist/js/internal/behaviors/imageCompare.mjs +8 -0
- package/dist/js/internal/behaviors/imageCompare.mjs.map +7 -0
- package/dist/js/internal/behaviors/lists.mjs +8 -0
- package/dist/js/internal/behaviors/lists.mjs.map +7 -0
- package/dist/js/internal/behaviors/paneResize.mjs +8 -0
- package/dist/js/internal/behaviors/paneResize.mjs.map +7 -0
- package/dist/js/internal/behaviors/sheetDrag.mjs +7 -2
- package/dist/js/internal/behaviors/sideSheets.mjs +4 -3
- package/dist/js/internal/behaviors/sortable.mjs +8 -0
- package/dist/js/internal/behaviors/sortable.mjs.map +7 -0
- package/dist/js/internal/behaviors/theme.mjs +8 -0
- package/dist/js/internal/behaviors/theme.mjs.map +7 -0
- package/dist/js/internal/behaviors/tour.mjs +8 -0
- package/dist/js/internal/behaviors/tour.mjs.map +7 -0
- package/dist/js/internal/behaviors/transferList.mjs +8 -0
- package/dist/js/internal/behaviors/transferList.mjs.map +7 -0
- package/dist/js/internal/components/appBar.mjs +3 -2
- package/dist/js/internal/components/autocomplete.mjs +4 -4
- package/dist/js/internal/components/backToTop.mjs +9 -0
- package/dist/js/internal/components/backToTop.mjs.map +7 -0
- package/dist/js/internal/components/barChart.mjs +5 -4
- package/dist/js/internal/components/buttonGroup.mjs +3 -2
- package/dist/js/internal/components/buttons.mjs +3 -3
- package/dist/js/internal/components/cards.mjs +3 -3
- package/dist/js/internal/components/carousel.mjs +3 -3
- package/dist/js/internal/components/cascader.mjs +10 -0
- package/dist/js/internal/components/cascader.mjs.map +7 -0
- package/dist/js/internal/components/characterCounter.mjs +3 -2
- package/dist/js/internal/components/chips.mjs +6 -5
- package/dist/js/internal/components/colorPicker.mjs +9 -0
- package/dist/js/internal/components/colorPicker.mjs.map +7 -0
- package/dist/js/internal/components/columnChart.mjs +4 -3
- package/dist/js/internal/components/commandPalette.mjs +3 -3
- package/dist/js/internal/components/confetti.mjs +3 -2
- package/dist/js/internal/components/currencyInput.mjs +9 -0
- package/dist/js/internal/components/currencyInput.mjs.map +7 -0
- package/dist/js/internal/components/datepicker.mjs +11 -8
- package/dist/js/internal/components/expandingCard.mjs +3 -3
- package/dist/js/internal/components/funnelChart.mjs +10 -0
- package/dist/js/internal/components/funnelChart.mjs.map +7 -0
- package/dist/js/internal/components/heatmapChart.mjs +4 -3
- package/dist/js/internal/components/hoverCard.mjs +9 -0
- package/dist/js/internal/components/hoverCard.mjs.map +7 -0
- package/dist/js/internal/components/index.mjs +133 -64
- package/dist/js/internal/components/inputMask.mjs +9 -0
- package/dist/js/internal/components/inputMask.mjs.map +7 -0
- package/dist/js/internal/components/keypad.mjs +9 -0
- package/dist/js/internal/components/keypad.mjs.map +7 -0
- package/dist/js/internal/components/lightbox.mjs +3 -3
- package/dist/js/internal/components/lineChart.mjs +29 -4
- package/dist/js/internal/components/loadingOverlay.mjs +9 -0
- package/dist/js/internal/components/loadingOverlay.mjs.map +7 -0
- package/dist/js/internal/components/mapView.mjs +3 -3
- package/dist/js/internal/components/menu.mjs +3 -3
- package/dist/js/internal/components/menubar.mjs +10 -0
- package/dist/js/internal/components/menubar.mjs.map +7 -0
- package/dist/js/internal/components/messageScroller.mjs +3 -3
- package/dist/js/internal/components/mixedChart.mjs +5 -4
- package/dist/js/internal/components/navigationRail.mjs +3 -2
- package/dist/js/internal/components/particles.mjs +3 -2
- package/dist/js/internal/components/pieChart.mjs +4 -3
- package/dist/js/internal/components/pullToRefresh.mjs +9 -0
- package/dist/js/internal/components/pullToRefresh.mjs.map +7 -0
- package/dist/js/internal/components/questionnaire.mjs +3 -3
- package/dist/js/internal/components/radarChart.mjs +4 -3
- package/dist/js/internal/components/radialChart.mjs +4 -3
- package/dist/js/internal/components/registry.mjs +59 -40
- package/dist/js/internal/components/richTextEditor.mjs +3 -3
- package/dist/js/internal/components/sankeyChart.mjs +10 -0
- package/dist/js/internal/components/sankeyChart.mjs.map +7 -0
- package/dist/js/internal/components/scatterChart.mjs +10 -0
- package/dist/js/internal/components/scatterChart.mjs.map +7 -0
- package/dist/js/internal/components/scrollspy.mjs +3 -2
- package/dist/js/internal/components/select.mjs +4 -4
- package/dist/js/internal/components/showMore.mjs +9 -0
- package/dist/js/internal/components/showMore.mjs.map +7 -0
- package/dist/js/internal/components/slider.mjs +3 -3
- package/dist/js/internal/components/snackbar.mjs +2 -2
- package/dist/js/internal/components/swipeActions.mjs +9 -0
- package/dist/js/internal/components/swipeActions.mjs.map +7 -0
- package/dist/js/internal/components/tabs.mjs +3 -4
- package/dist/js/internal/components/timepicker.mjs +5 -4
- package/dist/js/internal/components/tooltip.mjs +3 -3
- package/dist/js/internal/components/treeSelect.mjs +13 -0
- package/dist/js/internal/components/treeSelect.mjs.map +7 -0
- package/dist/js/internal/components/treemapChart.mjs +10 -0
- package/dist/js/internal/components/treemapChart.mjs.map +7 -0
- package/dist/js/internal/core/component.mjs +2 -1
- package/dist/js/internal/core/formControl.mjs +12 -0
- package/dist/js/internal/core/formControl.mjs.map +7 -0
- package/dist/js/internal/core/spring.mjs +11 -0
- package/dist/js/internal/core/spring.mjs.map +7 -0
- package/dist/js/internal/core/utils.mjs +11 -3
- package/dist/js/internal/plugins/dockedDisplayPlugin.mjs +2 -2
- package/dist/js/internal/plugins/modalDisplayPlugin.mjs +13 -0
- package/dist/js/internal/plugins/modalDisplayPlugin.mjs.map +7 -0
- package/dist/js/modular.mjs +175 -69
- package/dist/types/behaviors/bottomSheets.d.ts +19 -3
- package/dist/types/behaviors/copy.d.ts +18 -0
- package/dist/types/behaviors/dataTables.d.ts +129 -0
- package/dist/types/behaviors/dialogs.d.ts +27 -1
- package/dist/types/behaviors/forms.d.ts +68 -2
- package/dist/types/behaviors/imageCompare.d.ts +12 -0
- package/dist/types/behaviors/lists.d.ts +12 -0
- package/dist/types/behaviors/paneResize.d.ts +29 -0
- package/dist/types/behaviors/sheetDrag.d.ts +18 -0
- package/dist/types/behaviors/sideSheets.d.ts +1 -1
- package/dist/types/behaviors/sortable.d.ts +28 -0
- package/dist/types/behaviors/theme.d.ts +22 -0
- package/dist/types/behaviors/tour.d.ts +36 -0
- package/dist/types/behaviors/transferList.d.ts +51 -0
- package/dist/types/components/appBar.d.ts +5 -6
- package/dist/types/components/autocomplete.d.ts +92 -17
- package/dist/types/components/backToTop.d.ts +36 -0
- package/dist/types/components/barChart.d.ts +3 -6
- package/dist/types/components/buttonGroup.d.ts +2 -4
- package/dist/types/components/buttons.d.ts +5 -5
- package/dist/types/components/cards.d.ts +3 -16
- package/dist/types/components/carousel.d.ts +9 -15
- package/dist/types/components/cascader.d.ts +130 -0
- package/dist/types/components/characterCounter.d.ts +2 -15
- package/dist/types/components/chips.d.ts +65 -19
- package/dist/types/components/colorPicker.d.ts +42 -0
- package/dist/types/components/columnChart.d.ts +23 -10
- package/dist/types/components/commandPalette.d.ts +11 -16
- package/dist/types/components/confetti.d.ts +2 -4
- package/dist/types/components/currencyInput.d.ts +59 -0
- package/dist/types/components/datepicker.d.ts +59 -36
- package/dist/types/components/expandingCard.d.ts +6 -6
- package/dist/types/components/funnelChart.d.ts +38 -0
- package/dist/types/components/heatmapChart.d.ts +39 -8
- package/dist/types/components/hoverCard.d.ts +58 -0
- package/dist/types/components/index.d.ts +17 -1
- package/dist/types/components/inputMask.d.ts +30 -0
- package/dist/types/components/keypad.d.ts +66 -0
- package/dist/types/components/lightbox.d.ts +17 -25
- package/dist/types/components/lineChart.d.ts +176 -10
- package/dist/types/components/loadingOverlay.d.ts +42 -0
- package/dist/types/components/mapView.d.ts +26 -17
- package/dist/types/components/menu.d.ts +61 -22
- package/dist/types/components/menubar.d.ts +37 -0
- package/dist/types/components/messageScroller.d.ts +2 -14
- package/dist/types/components/mixedChart.d.ts +15 -6
- package/dist/types/components/navigationRail.d.ts +16 -5
- package/dist/types/components/particles.d.ts +8 -4
- package/dist/types/components/pieChart.d.ts +32 -7
- package/dist/types/components/pullToRefresh.d.ts +80 -0
- package/dist/types/components/questionnaire.d.ts +58 -16
- package/dist/types/components/radarChart.d.ts +10 -6
- package/dist/types/components/radialChart.d.ts +58 -8
- package/dist/types/components/registry.d.ts +77 -3
- package/dist/types/components/richTextEditor.d.ts +6 -14
- package/dist/types/components/sankeyChart.d.ts +72 -0
- package/dist/types/components/scatterChart.d.ts +102 -0
- package/dist/types/components/scrollspy.d.ts +3 -5
- package/dist/types/components/select.d.ts +43 -30
- package/dist/types/components/showMore.d.ts +51 -0
- package/dist/types/components/slider.d.ts +5 -15
- package/dist/types/components/snackbar.d.ts +62 -0
- package/dist/types/components/swipeActions.d.ts +81 -0
- package/dist/types/components/tabs.d.ts +93 -27
- package/dist/types/components/timepicker.d.ts +114 -20
- package/dist/types/components/tooltip.d.ts +56 -20
- package/dist/types/components/treeSelect.d.ts +106 -0
- package/dist/types/components/treemapChart.d.ts +56 -0
- package/dist/types/core/component.d.ts +43 -25
- package/dist/types/core/formControl.d.ts +21 -0
- package/dist/types/core/spring.d.ts +20 -0
- package/dist/types/core/utils.d.ts +85 -72
- package/dist/types/modular.d.ts +33 -1
- package/dist/types/plugins/dockedDisplayPlugin.d.ts +10 -7
- package/dist/types/plugins/modalDisplayPlugin.d.ts +32 -0
- package/package.json +10 -8
- package/src/sass/README.md +27 -18
- package/src/sass/abstracts/_breakpoints.scss +0 -1
- package/src/sass/abstracts/_elevation.scss +13 -7
- package/src/sass/abstracts/_index.scss +1 -0
- package/src/sass/abstracts/_mixins.scss +438 -92
- package/src/sass/abstracts/_spring.scss +63 -0
- package/src/sass/abstracts/_variables.scss +43 -15
- package/src/sass/base/_fonts.scss +61 -48
- package/src/sass/base/_global.scss +105 -34
- package/src/sass/base/_index.scss +3 -1
- package/src/sass/base/_normalize.scss +59 -114
- package/src/sass/base/_print.scss +21 -0
- package/src/sass/base/_prose.scss +68 -0
- package/src/sass/base/_typography.scss +9 -5
- package/src/sass/components/_accordion.scss +9 -16
- package/src/sass/components/_alert.scss +102 -0
- package/src/sass/components/_aura.scss +8 -3
- package/src/sass/components/_avatar.scss +3 -3
- package/src/sass/components/_back-to-top.scss +38 -0
- package/src/sass/components/_badges.scss +7 -13
- package/src/sass/components/_bar-chart.scss +41 -19
- package/src/sass/components/_bottom-sheet.scss +44 -16
- package/src/sass/components/_breadcrumb.scss +8 -1
- package/src/sass/components/_button-groups.scss +44 -89
- package/src/sass/components/_buttons.scss +156 -63
- package/src/sass/components/_calendar.scss +246 -0
- package/src/sass/components/_cards.scss +41 -68
- package/src/sass/components/_carousel.scss +43 -158
- package/src/sass/components/_cascader.scss +142 -0
- package/src/sass/components/_chips.scss +36 -52
- package/src/sass/components/_column-chart.scss +19 -12
- package/src/sass/components/_command-palette.scss +4 -7
- package/src/sass/components/_confetti.scss +0 -2
- package/src/sass/components/_countdown.scss +1 -1
- package/src/sass/components/_data-table.scss +162 -27
- package/src/sass/components/_datepicker.scss +57 -62
- package/src/sass/components/_description-list.scss +85 -0
- package/src/sass/components/_dialog.scss +42 -44
- package/src/sass/components/_docked-display.scss +1 -3
- package/src/sass/components/_drag-handle.scss +16 -20
- package/src/sass/components/_expanding-card.scss +20 -9
- package/src/sass/components/_fab-menu.scss +44 -32
- package/src/sass/components/_funnel-chart.scss +124 -0
- package/src/sass/components/_heatmap-chart.scss +113 -24
- package/src/sass/components/_icon-buttons.scss +7 -8
- package/src/sass/components/_icons-material-design.scss +2 -2
- package/src/sass/components/_image-compare.scss +108 -0
- package/src/sass/components/_index.scss +21 -0
- package/src/sass/components/_keypad.scss +182 -0
- package/src/sass/components/_kpi.scss +6 -11
- package/src/sass/components/_lightbox.scss +26 -20
- package/src/sass/components/_line-chart.scss +16 -2
- package/src/sass/components/_list.scss +59 -14
- package/src/sass/components/_loading-indicator.scss +1 -0
- package/src/sass/components/_loading-overlay.scss +105 -0
- package/src/sass/components/_map.scss +35 -13
- package/src/sass/components/_marquee.scss +3 -2
- package/src/sass/components/_mega-menu.scss +137 -0
- package/src/sass/components/_menu.scss +159 -182
- package/src/sass/components/_menubar.scss +59 -0
- package/src/sass/components/_message-scroller.scss +2 -2
- package/src/sass/components/_message.scss +3 -3
- package/src/sass/components/_mixed-chart.scss +37 -9
- package/src/sass/components/_modal-display.scss +21 -0
- package/src/sass/components/_navbar.scss +43 -65
- package/src/sass/components/_navigation-bar.scss +15 -77
- package/src/sass/components/_navigation-rail.scss +171 -121
- package/src/sass/components/_org-chart.scss +192 -0
- package/src/sass/components/_page-footer.scss +16 -13
- package/src/sass/components/_pagination.scss +6 -13
- package/src/sass/components/_panes.scss +33 -31
- package/src/sass/components/_particles.scss +0 -2
- package/src/sass/components/_pie-chart.scss +91 -11
- package/src/sass/components/_popover.scss +18 -5
- package/src/sass/components/_progress.scss +158 -35
- package/src/sass/components/_pull-to-refresh.scss +90 -0
- package/src/sass/components/_questionnaire.scss +74 -3
- package/src/sass/components/_radar-chart.scss +38 -10
- package/src/sass/components/_radial-chart.scss +113 -5
- package/src/sass/components/_rich-text-editor.scss +2 -2
- package/src/sass/components/_sankey-chart.scss +114 -0
- package/src/sass/components/_scatter-chart.scss +153 -0
- package/src/sass/components/_scrim.scss +0 -2
- package/src/sass/components/_scrollspy.scss +0 -2
- package/src/sass/components/_search.scss +26 -22
- package/src/sass/components/_show-more.scss +8 -0
- package/src/sass/components/_side-sheet.scss +23 -40
- package/src/sass/components/_skeleton.scss +2 -4
- package/src/sass/components/_snackbar.scss +27 -21
- package/src/sass/components/_split-button.scss +5 -5
- package/src/sass/components/_stat.scss +3 -8
- package/src/sass/components/_stepper.scss +1 -5
- package/src/sass/components/_swipe-actions.scss +71 -0
- package/src/sass/components/_tabs.scss +51 -32
- package/src/sass/components/_timeline.scss +12 -12
- package/src/sass/components/_timepicker.scss +111 -112
- package/src/sass/components/_toolbar.scss +35 -47
- package/src/sass/components/_tooltip.scss +21 -12
- package/src/sass/components/_tour.scss +89 -0
- package/src/sass/components/_transfer-list.scss +73 -0
- package/src/sass/components/_transitions.scss +4 -4
- package/src/sass/components/_tree.scss +3 -16
- package/src/sass/components/_treemap-chart.scss +122 -0
- package/src/sass/components/forms/_checkboxes.scss +140 -86
- package/src/sass/components/forms/_color-picker.scss +135 -0
- package/src/sass/components/forms/_color-swatches.scss +85 -0
- package/src/sass/components/forms/_drop-zone.scss +15 -9
- package/src/sass/components/forms/_fieldset.scss +10 -10
- package/src/sass/components/forms/_file-input.scss +6 -9
- package/src/sass/components/forms/_index.scss +3 -1
- package/src/sass/components/forms/_input-fields.scss +254 -90
- package/src/sass/components/forms/_radio-buttons.scss +40 -127
- package/src/sass/components/forms/_rating.scss +2 -32
- package/src/sass/components/forms/_select.scss +199 -23
- package/src/sass/components/forms/_slider.scss +140 -330
- package/src/sass/components/forms/_switches.scss +53 -164
- package/src/sass/custom.scss +10 -1
- package/src/sass/expressive.scss +3 -63
- package/src/sass/tokens/_contrast.scss +94 -0
- package/src/sass/tokens/_elevation.scss +16 -0
- package/src/sass/tokens/_index.scss +5 -0
- package/src/sass/tokens/_motion.scss +109 -0
- package/src/sass/tokens/_reference.scss +72 -141
- package/src/sass/tokens/_shape.scss +38 -0
- package/src/sass/tokens/_stacking.scss +27 -0
- package/src/sass/tokens/_state.scss +2 -4
- package/src/sass/tokens/_theme.scss +11 -2
- package/src/sass/tokens/_vibrant.scss +2 -5
- package/src/sass/utilities/_colors.scss +6 -1
- package/src/sass/utilities/_defer-render.scss +17 -0
- package/src/sass/utilities/_helpers.scss +183 -26
- package/src/sass/utilities/_index.scss +2 -1
- package/src/sass/utilities/_scroll-area.scss +0 -2
- package/src/sass/utilities/_spacing.scss +52 -34
- package/src/sass/utilities/_typescale.scss +8 -1
- package/src/sass/utilities/_visibility.scss +47 -76
- package/src/sass/utilities/_z-depth.scss +7 -4
- package/dist/js/chunks/chunk-3DHK5CZU.mjs.map +0 -7
- package/dist/js/chunks/chunk-3GVFZ4XO.mjs.map +0 -7
- package/dist/js/chunks/chunk-4HZMB7LI.mjs.map +0 -7
- package/dist/js/chunks/chunk-4KMNFIFZ.mjs +0 -270
- package/dist/js/chunks/chunk-4KMNFIFZ.mjs.map +0 -7
- package/dist/js/chunks/chunk-4TKTLGEM.mjs.map +0 -7
- package/dist/js/chunks/chunk-5BKHWHYY.mjs +0 -292
- package/dist/js/chunks/chunk-5BKHWHYY.mjs.map +0 -7
- package/dist/js/chunks/chunk-5HQSGDZ5.mjs.map +0 -7
- package/dist/js/chunks/chunk-6N2XAEFK.mjs +0 -125
- package/dist/js/chunks/chunk-6N2XAEFK.mjs.map +0 -7
- package/dist/js/chunks/chunk-A7ALMYUR.mjs.map +0 -7
- package/dist/js/chunks/chunk-BG6ZRB5H.mjs.map +0 -7
- package/dist/js/chunks/chunk-CUQPB25U.mjs +0 -55
- package/dist/js/chunks/chunk-CUQPB25U.mjs.map +0 -7
- package/dist/js/chunks/chunk-DAIU5SLG.mjs.map +0 -7
- package/dist/js/chunks/chunk-FS7XY3HT.mjs.map +0 -7
- package/dist/js/chunks/chunk-GIW4K4SE.mjs.map +0 -7
- package/dist/js/chunks/chunk-GUB3TNO2.mjs.map +0 -7
- package/dist/js/chunks/chunk-GVGT6MIU.mjs.map +0 -7
- package/dist/js/chunks/chunk-GZKEFWPM.mjs +0 -181
- package/dist/js/chunks/chunk-GZKEFWPM.mjs.map +0 -7
- package/dist/js/chunks/chunk-HKT2S7VM.mjs +0 -48
- package/dist/js/chunks/chunk-HKT2S7VM.mjs.map +0 -7
- package/dist/js/chunks/chunk-ILP3PDTL.mjs +0 -187
- package/dist/js/chunks/chunk-ILP3PDTL.mjs.map +0 -7
- package/dist/js/chunks/chunk-JIDMQGK6.mjs.map +0 -7
- package/dist/js/chunks/chunk-KBNN3QDH.mjs +0 -7
- package/dist/js/chunks/chunk-KBNN3QDH.mjs.map +0 -7
- package/dist/js/chunks/chunk-KHV6DZXX.mjs.map +0 -7
- package/dist/js/chunks/chunk-KY6U46SM.mjs +0 -345
- package/dist/js/chunks/chunk-KY6U46SM.mjs.map +0 -7
- package/dist/js/chunks/chunk-LRZMJZ3T.mjs +0 -291
- package/dist/js/chunks/chunk-LRZMJZ3T.mjs.map +0 -7
- package/dist/js/chunks/chunk-LTWPGFBR.mjs +0 -59
- package/dist/js/chunks/chunk-LTWPGFBR.mjs.map +0 -7
- package/dist/js/chunks/chunk-MNPROCZF.mjs +0 -328
- package/dist/js/chunks/chunk-MNPROCZF.mjs.map +0 -7
- package/dist/js/chunks/chunk-MZ6Z24BX.mjs.map +0 -7
- package/dist/js/chunks/chunk-NS2UMNZV.mjs.map +0 -7
- package/dist/js/chunks/chunk-O5XPWXIQ.mjs +0 -406
- package/dist/js/chunks/chunk-O5XPWXIQ.mjs.map +0 -7
- package/dist/js/chunks/chunk-PM655FXL.mjs.map +0 -7
- package/dist/js/chunks/chunk-QDAL4IYN.mjs.map +0 -7
- package/dist/js/chunks/chunk-QERLECVU.mjs +0 -572
- package/dist/js/chunks/chunk-QERLECVU.mjs.map +0 -7
- package/dist/js/chunks/chunk-QJABDLSD.mjs +0 -112
- package/dist/js/chunks/chunk-QJABDLSD.mjs.map +0 -7
- package/dist/js/chunks/chunk-RHRQKTTX.mjs +0 -139
- package/dist/js/chunks/chunk-RHRQKTTX.mjs.map +0 -7
- package/dist/js/chunks/chunk-S3XDFGSZ.mjs.map +0 -7
- package/dist/js/chunks/chunk-SPETGK25.mjs +0 -59
- package/dist/js/chunks/chunk-SPETGK25.mjs.map +0 -7
- package/dist/js/chunks/chunk-TBM3FT7G.mjs.map +0 -7
- package/dist/js/chunks/chunk-UEXCIMJZ.mjs.map +0 -7
- package/dist/js/chunks/chunk-UEZUJQ66.mjs.map +0 -7
- package/dist/js/chunks/chunk-VGZSAFTX.mjs +0 -173
- package/dist/js/chunks/chunk-VGZSAFTX.mjs.map +0 -7
- package/dist/js/chunks/chunk-X7OCHZVF.mjs +0 -76
- package/dist/js/chunks/chunk-X7OCHZVF.mjs.map +0 -7
- package/dist/js/chunks/chunk-YDCS5S3J.mjs.map +0 -7
- package/dist/js/chunks/chunk-YMSXJON6.mjs +0 -79
- package/dist/js/chunks/chunk-YMSXJON6.mjs.map +0 -7
- package/dist/js/chunks/chunk-Z2NRKI7R.mjs.map +0 -7
- package/dist/js/chunks/chunk-ZAS25YFD.mjs.map +0 -7
- package/dist/js/chunks/chunk-ZKZKNSLC.mjs +0 -1
- /package/dist/js/chunks/{chunk-ZKZKNSLC.mjs.map → chunk-GNRSYMVH.mjs.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Utils
|
|
3
|
-
} from "./chunk-MNPROCZF.mjs";
|
|
4
1
|
import {
|
|
5
2
|
Component
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CMGXGYUC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Utils
|
|
6
|
+
} from "./chunk-ZVLOUDIJ.mjs";
|
|
7
7
|
|
|
8
8
|
// src/ts/components/messageScroller.ts
|
|
9
9
|
var _defaults = {
|
|
@@ -14,9 +14,9 @@ var _defaults = {
|
|
|
14
14
|
var EDGE = 2;
|
|
15
15
|
var UP_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "PageUp", "Home"]);
|
|
16
16
|
var RELEASE_EVENTS = ["pointerup", "pointercancel", "touchend", "touchcancel"];
|
|
17
|
-
var MessageScroller = class
|
|
17
|
+
var MessageScroller = class extends Component {
|
|
18
18
|
constructor(el, options) {
|
|
19
|
-
super(el, options
|
|
19
|
+
super(el, options);
|
|
20
20
|
this._opened = false;
|
|
21
21
|
this._following = false;
|
|
22
22
|
/** A press is down: it may be a tap or a scrollbar drag. */
|
|
@@ -65,10 +65,10 @@ var MessageScroller = class _MessageScroller extends Component {
|
|
|
65
65
|
this._handleMutations = (records) => {
|
|
66
66
|
for (const record of records) {
|
|
67
67
|
record.addedNodes.forEach((node) => {
|
|
68
|
-
if (node instanceof Element) this._resizeObserver
|
|
68
|
+
if (node instanceof Element) this._resizeObserver.observe(node);
|
|
69
69
|
});
|
|
70
70
|
record.removedNodes.forEach((node) => {
|
|
71
|
-
if (node instanceof Element) this._resizeObserver
|
|
71
|
+
if (node instanceof Element) this._resizeObserver.unobserve(node);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
const previous = this._last;
|
|
@@ -101,11 +101,6 @@ var MessageScroller = class _MessageScroller extends Component {
|
|
|
101
101
|
}
|
|
102
102
|
this._sync();
|
|
103
103
|
};
|
|
104
|
-
this.el["Expressive_MessageScroller"] = this;
|
|
105
|
-
this.options = {
|
|
106
|
-
..._MessageScroller.defaults,
|
|
107
|
-
...options
|
|
108
|
-
};
|
|
109
104
|
this.viewport = el.querySelector(":scope > .message-scroller-viewport");
|
|
110
105
|
this.button = el.querySelector(":scope > .message-scroller-button");
|
|
111
106
|
if (!this.viewport) {
|
|
@@ -114,49 +109,29 @@ var MessageScroller = class _MessageScroller extends Component {
|
|
|
114
109
|
}
|
|
115
110
|
this._last = this.viewport.lastElementChild;
|
|
116
111
|
if (this.viewport.clientHeight > 0) this._open();
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
for (const item of Array.from(this.viewport.children)) this._resizeObserver.observe(item);
|
|
121
|
-
}
|
|
112
|
+
this._resizeObserver = new ResizeObserver(this._handleResize);
|
|
113
|
+
this._resizeObserver.observe(this.viewport, { box: "border-box" });
|
|
114
|
+
for (const item of Array.from(this.viewport.children)) this._resizeObserver.observe(item);
|
|
122
115
|
this._mutationObserver = new MutationObserver(this._handleMutations);
|
|
123
116
|
this._mutationObserver.observe(this.viewport, { childList: true });
|
|
124
|
-
|
|
117
|
+
const { signal } = this._events;
|
|
118
|
+
this.viewport.addEventListener("scroll", this._handleScroll, { passive: true, signal });
|
|
125
119
|
for (const type of ["wheel", "touchstart", "pointerdown", "keydown"]) {
|
|
126
|
-
this.viewport.addEventListener(type, this._handleUserScroll, { passive: true });
|
|
120
|
+
this.viewport.addEventListener(type, this._handleUserScroll, { passive: true, signal });
|
|
127
121
|
}
|
|
128
|
-
for (const type of RELEASE_EVENTS) document.addEventListener(type, this._handleRelease);
|
|
129
|
-
this.button?.addEventListener("click", this._handleButtonClick);
|
|
122
|
+
for (const type of RELEASE_EVENTS) document.addEventListener(type, this._handleRelease, { signal });
|
|
123
|
+
this.button?.addEventListener("click", this._handleButtonClick, { signal });
|
|
130
124
|
}
|
|
131
125
|
static get defaults() {
|
|
132
126
|
return _defaults;
|
|
133
127
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Initializes instances of MessageScroller.
|
|
136
|
-
* @param els HTML elements.
|
|
137
|
-
* @param options Component options.
|
|
138
|
-
*/
|
|
139
|
-
static init(els, options = {}) {
|
|
140
|
-
return super.init(els, options, _MessageScroller);
|
|
141
|
-
}
|
|
142
|
-
static getInstance(el) {
|
|
143
|
-
return el["Expressive_MessageScroller"];
|
|
144
|
-
}
|
|
145
128
|
destroy() {
|
|
146
|
-
|
|
129
|
+
super.destroy();
|
|
147
130
|
if (!this.viewport) return;
|
|
148
131
|
this._resizeObserver?.disconnect();
|
|
149
132
|
this._mutationObserver?.disconnect();
|
|
150
|
-
this.viewport.removeEventListener("scroll", this._handleScroll);
|
|
151
|
-
for (const type of ["wheel", "touchstart", "pointerdown", "keydown"]) {
|
|
152
|
-
this.viewport.removeEventListener(type, this._handleUserScroll);
|
|
153
|
-
}
|
|
154
|
-
for (const type of RELEASE_EVENTS) document.removeEventListener(type, this._handleRelease);
|
|
155
133
|
this.viewport.style.removeProperty("--md-comp-message-scroller-spacer");
|
|
156
|
-
if (this.button)
|
|
157
|
-
this.button.removeEventListener("click", this._handleButtonClick);
|
|
158
|
-
this.button.inert = false;
|
|
159
|
-
}
|
|
134
|
+
if (this.button) this.button.inert = false;
|
|
160
135
|
}
|
|
161
136
|
/** Scrolls to the latest message and resumes following. */
|
|
162
137
|
scrollToEnd() {
|
|
@@ -214,7 +189,7 @@ var MessageScroller = class _MessageScroller extends Component {
|
|
|
214
189
|
}
|
|
215
190
|
this._target = target;
|
|
216
191
|
this._distance = Infinity;
|
|
217
|
-
const reduce =
|
|
192
|
+
const reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
218
193
|
v.scrollTo({
|
|
219
194
|
top: target === "end" ? v.scrollHeight : target,
|
|
220
195
|
behavior: reduce ? "auto" : "smooth"
|
|
@@ -285,8 +260,9 @@ var MessageScroller = class _MessageScroller extends Component {
|
|
|
285
260
|
this.button.inert = idle;
|
|
286
261
|
}
|
|
287
262
|
};
|
|
263
|
+
MessageScroller.key = "Expressive_MessageScroller";
|
|
288
264
|
|
|
289
265
|
export {
|
|
290
266
|
MessageScroller
|
|
291
267
|
};
|
|
292
|
-
//# sourceMappingURL=chunk-
|
|
268
|
+
//# sourceMappingURL=chunk-ANKFWNWT.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/messageScroller.ts"],
|
|
4
|
+
"sourcesContent": ["import { Utils } from '../core/utils';\nimport { Component, BaseOptions } from '../core/component';\n\nexport interface MessageScrollerOptions extends BaseOptions {\n /**\n * If true, the viewport follows new content while the reader is at the\n * end, and a newly appended scroll anchor is brought to the top.\n * @default true\n */\n autoScroll: boolean;\n /**\n * Where the transcript opens: `'end'`, `'start'`, or `'last-anchor'`, the\n * start of the last anchored turn. `'last-anchor'` opens at the end when\n * that turn already fits in the viewport.\n * @default 'end'\n */\n defaultScrollPosition: 'start' | 'end' | 'last-anchor';\n /**\n * Pixels of the previous message left visible above an anchored turn or a\n * message reached with `scrollToMessage()`.\n * @default 64\n */\n peek: number;\n}\n\nconst _defaults: MessageScrollerOptions = {\n autoScroll: true,\n defaultScrollPosition: 'end',\n peek: 64\n};\n\n// Distance from a scroll target, in px, that still counts as reaching it.\n// Fractional layouts rarely land on the exact pixel.\nconst EDGE = 2;\n\n// Keys that scroll toward the start. They release following at once, before\n// the next streamed chunk can pull the viewport back to the end.\nconst UP_KEYS = new Set(['ArrowUp', 'PageUp', 'Home']);\n\n// Listened on the document: a scrollbar drag can end outside the viewport.\nconst RELEASE_EVENTS = ['pointerup', 'pointercancel', 'touchend', 'touchcancel'];\n\ntype Target = number | 'end';\n\n/**\n * A chat scroll container: a `.message-scroller` frame holding a scrolling\n * `.message-scroller-viewport` of messages and an optional\n * `.message-scroller-button`. Every child of the viewport is one message.\n *\n * While the reader is at the end, the viewport follows streamed output.\n * Scrolling toward the start releases it; reaching the end again, or the\n * button, resumes it. An appended message marked `data-scroll-anchor` starts a\n * turn and is scrolled to the top, with blank space below it until the reply\n * fills the viewport. Messages added above keep the reader's place.\n */\nexport class MessageScroller extends Component<MessageScrollerOptions> {\n /** The scrolling element. */\n viewport: HTMLElement;\n /** The scroll-to-latest button, if present. */\n button: HTMLButtonElement | null;\n private _opened = false;\n private _following = false;\n /** A press is down: it may be a tap or a scrollbar drag. */\n private _holding = false;\n private _lastTop = 0;\n /** Where a programmatic scroll is heading; null when none is running. */\n private _target: Target | null = null;\n /** Distance left to the target at the last scroll event. */\n private _distance = Infinity;\n /** The first visible message and its offset from the viewport top. */\n private _ref: Element | null = null;\n private _refOffset = 0;\n /** The latest anchored turn, which the spacer lets reach the top. */\n private _anchor: Element | null = null;\n private _spacer = 0;\n private _last: Element | null = null;\n private _resizeObserver: ResizeObserver | null = null;\n private _mutationObserver: MutationObserver | null = null;\n\n constructor(el: HTMLElement, options: Partial<MessageScrollerOptions>) {\n super(el, options);\n this.viewport = el.querySelector(':scope > .message-scroller-viewport');\n this.button = el.querySelector(':scope > .message-scroller-button');\n if (!this.viewport) {\n console.error('MessageScroller needs a .message-scroller-viewport child.');\n return;\n }\n this._last = this.viewport.lastElementChild;\n // A viewport that is not rendered yet (a closed dialog, a hidden tab)\n // has no size to position against; it opens on its first resize.\n if (this.viewport.clientHeight > 0) this._open();\n this._resizeObserver = new ResizeObserver(this._handleResize);\n // Border box: the spacer changes the padding, which must not count.\n this._resizeObserver.observe(this.viewport, { box: 'border-box' });\n for (const item of Array.from(this.viewport.children)) this._resizeObserver.observe(item);\n this._mutationObserver = new MutationObserver(this._handleMutations);\n this._mutationObserver.observe(this.viewport, { childList: true });\n const { signal } = this._events;\n this.viewport.addEventListener('scroll', this._handleScroll, { passive: true, signal });\n for (const type of ['wheel', 'touchstart', 'pointerdown', 'keydown']) {\n this.viewport.addEventListener(type, this._handleUserScroll, { passive: true, signal });\n }\n for (const type of RELEASE_EVENTS) document.addEventListener(type, this._handleRelease, { signal });\n this.button?.addEventListener('click', this._handleButtonClick, { signal });\n }\n\n static get defaults(): MessageScrollerOptions {\n return _defaults;\n }\n\n static key = 'Expressive_MessageScroller';\n\n destroy() {\n super.destroy();\n if (!this.viewport) return;\n this._resizeObserver?.disconnect();\n this._mutationObserver?.disconnect();\n this.viewport.style.removeProperty('--md-comp-message-scroller-spacer');\n if (this.button) this.button.inert = false;\n }\n\n /** Scrolls to the latest message and resumes following. */\n scrollToEnd() {\n // Set now: output streaming faster than the scroll can end it early.\n this._following = this.options.autoScroll;\n this._scrollTo('end');\n }\n\n /** Scrolls to the first message. */\n scrollToStart() {\n this._following = false;\n this._scrollTo(0);\n }\n\n /**\n * Scrolls the element with this id to the top of the viewport, below the\n * peek, and stops following.\n * @returns false when no such element is inside the viewport.\n */\n scrollToMessage(id: string): boolean {\n const target = Utils.getElementById(this.viewport, id);\n if (!target || !this.viewport.contains(target)) return false;\n this._following = false;\n this._scrollTo(this._top(target) - this.options.peek);\n return true;\n }\n\n private _open() {\n this._opened = true;\n const v = this.viewport;\n const position = this.options.defaultScrollPosition;\n const anchors = v.querySelectorAll(':scope > [data-scroll-anchor]');\n const anchor = position === 'last-anchor' ? anchors[anchors.length - 1] : null;\n if (position === 'start') v.scrollTop = 0;\n else if (anchor && this._contentEnd() - this._top(anchor) + this.options.peek > v.clientHeight) {\n v.scrollTop = this._top(anchor) - this.options.peek;\n } else v.scrollTop = v.scrollHeight;\n this._settle();\n }\n\n /**\n * Records where the reader is once no programmatic scroll is running.\n * Content can grow between a scroll and the resize that re-pins the end,\n * so only moving toward the start releases following.\n */\n private _settle() {\n const top = this.viewport.scrollTop;\n const kept = this._following && top >= this._lastTop - EDGE;\n this._following = this.options.autoScroll && (kept || this._atEnd());\n this._lastTop = top;\n this._capture();\n this._sync();\n }\n\n // A programmatic scroll ends when it arrives, or when a scroll moves away\n // from its target because something else took over.\n private _handleScroll = () => {\n if (this._target !== null) {\n const distance = Math.abs(this.viewport.scrollTop - this._resolve(this._target));\n if (distance > EDGE && distance < this._distance) {\n this._distance = distance;\n return;\n }\n this._target = null;\n }\n this._settle();\n };\n\n private _handleUserScroll = (e: Event) => {\n if (e.type === 'wheel' && (e as WheelEvent).deltaY >= 0) return;\n if (e.type === 'keydown' && !UP_KEYS.has((e as KeyboardEvent).key)) return;\n this._target = null;\n // A press may be a tap on a message or the start of a drag. Hold the end\n // until it is released; a scroll toward the start releases following.\n if (e.type === 'pointerdown' || e.type === 'touchstart') this._holding = true;\n else this._following = false;\n };\n\n private _handleRelease = () => {\n if (!this._holding) return;\n this._holding = false;\n if (this._following) this.viewport.scrollTop = this.viewport.scrollHeight;\n this._sync();\n };\n\n private _handleButtonClick = () => this.scrollToEnd();\n\n private _handleMutations = (records: MutationRecord[]) => {\n for (const record of records) {\n record.addedNodes.forEach((node) => {\n if (node instanceof Element) this._resizeObserver.observe(node);\n });\n record.removedNodes.forEach((node) => {\n if (node instanceof Element) this._resizeObserver.unobserve(node);\n });\n }\n const previous = this._last;\n this._last = this.viewport.lastElementChild;\n if (!this._opened) return;\n // Restore here, not only on resize: this runs before any scroll event\n // that could record the shifted position as the reader's place.\n if (!this._following && this._target === null) this._restore();\n if (!this.options.autoScroll) return;\n // Only messages appended after the previous last one start a new turn;\n // anchors in prepended history do not. If the last one was removed, the\n // list was replaced and nothing counts as appended.\n if (previous && previous.parentElement !== this.viewport) return;\n for (let item = this._last; item && item !== previous; item = item.previousElementSibling) {\n if (item.hasAttribute('data-scroll-anchor')) {\n this._anchor = item;\n this._updateSpacer();\n // Follow the reply once the turn reaches the top, unless the reader\n // scrolls away first. _settle keeps it because the scroll went down.\n this._following = true;\n this._scrollTo(this._top(item) - this.options.peek);\n return;\n }\n }\n };\n\n private _handleResize = () => {\n if (!this._opened) {\n if (this.viewport.clientHeight > 0) this._open();\n return;\n }\n this._updateSpacer();\n const v = this.viewport;\n if (this._target === 'end') this._scrollTo('end');\n else if (this._target === null) {\n if (this._following && !this._holding) v.scrollTop = v.scrollHeight;\n else this._restore();\n }\n this._sync();\n };\n\n private _scrollTo(target: Target) {\n const v = this.viewport;\n if (Math.abs(v.scrollTop - this._resolve(target)) <= EDGE) {\n this._target = null;\n this._settle();\n return;\n }\n this._target = target;\n this._distance = Infinity;\n const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;\n v.scrollTo({\n top: target === 'end' ? v.scrollHeight : target,\n behavior: reduce ? 'auto' : 'smooth'\n });\n }\n\n private _resolve(target: Target) {\n const max = this.viewport.scrollHeight - this.viewport.clientHeight;\n return target === 'end' ? max : Math.max(0, Math.min(target, max));\n }\n\n private _atEnd() {\n const v = this.viewport;\n return v.scrollHeight - v.scrollTop - v.clientHeight <= EDGE;\n }\n\n /** Offset of an element from the top of the scrolled content. */\n private _top(el: Element) {\n const v = this.viewport;\n return el.getBoundingClientRect().top - v.getBoundingClientRect().top - v.clientTop + v.scrollTop;\n }\n\n /** Bottom of the content without the spacer, padding included. */\n private _contentEnd() {\n const last = this.viewport.lastElementChild;\n if (!last) return 0;\n const padding = parseFloat(getComputedStyle(this.viewport).paddingBlockEnd) - this._spacer;\n return this._top(last) + last.getBoundingClientRect().height + padding;\n }\n\n /** Remembers the first visible message so prepends can keep it in place. */\n private _capture() {\n const items = this.viewport.children;\n const top = this.viewport.getBoundingClientRect().top + this.viewport.clientTop;\n let low = 0;\n let high = items.length - 1;\n while (low < high) {\n const mid = (low + high) >> 1;\n if (items[mid].getBoundingClientRect().bottom > top) high = mid;\n else low = mid + 1;\n }\n this._ref = items[low] ?? null;\n this._refOffset = this._ref ? this._ref.getBoundingClientRect().top - top : 0;\n }\n\n /** Moves the remembered message back to where the reader last saw it. */\n private _restore() {\n if (this._ref?.parentElement !== this.viewport) {\n this._capture();\n return;\n }\n const top = this.viewport.getBoundingClientRect().top + this.viewport.clientTop;\n const delta = this._ref.getBoundingClientRect().top - top - this._refOffset;\n if (Math.abs(delta) >= 1) this.viewport.scrollTop += delta;\n }\n\n /** Sizes the blank space that lets the latest anchored turn reach the top. */\n private _updateSpacer() {\n let space = 0;\n if (this._anchor?.parentElement === this.viewport) {\n const room = this._top(this._anchor) - this.options.peek + this.viewport.clientHeight;\n space = Math.max(0, Math.ceil(room - this._contentEnd()));\n } else this._anchor = null;\n if (space === this._spacer) return;\n this._spacer = space;\n if (space) this.viewport.style.setProperty('--md-comp-message-scroller-spacer', `${space}px`);\n else this.viewport.style.removeProperty('--md-comp-message-scroller-spacer');\n }\n\n /** The button is inert while there is nothing below. */\n private _sync() {\n if (!this.button) return;\n const idle = this._atEnd();\n // The button's own root: inside a shadow root, document.activeElement is the host.\n const root = this.button.getRootNode() as Document | ShadowRoot;\n if (idle && root.activeElement === this.button) this.viewport.focus({ preventScroll: true });\n this.button.inert = idle;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAyBA,IAAM,YAAoC;AAAA,EACxC,YAAY;AAAA,EACZ,uBAAuB;AAAA,EACvB,MAAM;AACR;AAIA,IAAM,OAAO;AAIb,IAAM,UAAU,oBAAI,IAAI,CAAC,WAAW,UAAU,MAAM,CAAC;AAGrD,IAAM,iBAAiB,CAAC,aAAa,iBAAiB,YAAY,aAAa;AAexE,IAAM,kBAAN,cAA8B,UAAkC;AAAA,EAwBrE,YAAY,IAAiB,SAA0C;AACrE,UAAM,IAAI,OAAO;AApBnB,SAAQ,UAAU;AAClB,SAAQ,aAAa;AAErB;AAAA,SAAQ,WAAW;AACnB,SAAQ,WAAW;AAEnB;AAAA,SAAQ,UAAyB;AAEjC;AAAA,SAAQ,YAAY;AAEpB;AAAA,SAAQ,OAAuB;AAC/B,SAAQ,aAAa;AAErB;AAAA,SAAQ,UAA0B;AAClC,SAAQ,UAAU;AAClB,SAAQ,QAAwB;AAChC,SAAQ,kBAAyC;AACjD,SAAQ,oBAA6C;AAmGrD;AAAA;AAAA,SAAQ,gBAAgB,MAAM;AAC5B,UAAI,KAAK,YAAY,MAAM;AACzB,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,KAAK,KAAK,OAAO,KAAK,YAAY,CAAC,CAAC;AAAA,IAC1D,MAAO,MAAK,UAAU;AACtB,QAAI,UAAU,KAAK,QAAS;AAC5B,SAAK,UAAU;AACf,QAAI,MAAO,MAAK,SAAS,MAAM,YAAY,qCAAqC,GAAG,KAAK,IAAI;AAAA,QACvF,MAAK,SAAS,MAAM,eAAe,mCAAmC;AAAA,EAC7E;AAAA;AAAA,EAGQ,QAAQ;AACd,QAAI,CAAC,KAAK,OAAQ;AAClB,UAAM,OAAO,KAAK,OAAO;AAEzB,UAAM,OAAO,KAAK,OAAO,YAAY;AACrC,QAAI,QAAQ,KAAK,kBAAkB,KAAK,OAAQ,MAAK,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;AAC3F,SAAK,OAAO,QAAQ;AAAA,EACtB;AACF;AAhSa,gBAuDJ,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Utils
|
|
3
|
-
} from "./chunk-MNPROCZF.mjs";
|
|
4
1
|
import {
|
|
5
2
|
Component
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CMGXGYUC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Utils
|
|
6
|
+
} from "./chunk-ZVLOUDIJ.mjs";
|
|
7
7
|
|
|
8
8
|
// src/ts/components/slider.ts
|
|
9
9
|
var _defaults = {};
|
|
10
10
|
var _authored = /* @__PURE__ */ new WeakMap();
|
|
11
|
-
var
|
|
11
|
+
var _Slider = class _Slider extends Component {
|
|
12
12
|
constructor(el, options) {
|
|
13
|
-
super(el, options
|
|
13
|
+
super(el, options);
|
|
14
14
|
this._resizeObserver = null;
|
|
15
|
+
// The reset event fires before the browser restores the values.
|
|
16
|
+
this._handleFormReset = () => {
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
if (_Slider.getInstance(this.el) === this) this._sync();
|
|
19
|
+
});
|
|
20
|
+
};
|
|
15
21
|
this._handleRangeChange = () => {
|
|
16
22
|
this._clampDual();
|
|
17
23
|
this._sync();
|
|
@@ -41,39 +47,21 @@ var Slider = class _Slider extends Component {
|
|
|
41
47
|
this.thumb.classList.remove("active");
|
|
42
48
|
}
|
|
43
49
|
};
|
|
44
|
-
this.el["Expressive_Slider"] = this;
|
|
45
|
-
this.options = {
|
|
46
|
-
..._Slider.defaults,
|
|
47
|
-
...options
|
|
48
|
-
};
|
|
49
50
|
this._pointerDown = false;
|
|
50
51
|
this._setupThumb();
|
|
51
52
|
this._sync();
|
|
52
53
|
this._setupEventHandlers();
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
54
|
+
this._resizeObserver = new ResizeObserver(() => this._sync());
|
|
55
|
+
this._resizeObserver.observe(this.el);
|
|
56
|
+
if (this.el.parentElement) this._resizeObserver.observe(this.el.parentElement);
|
|
57
57
|
}
|
|
58
58
|
static get defaults() {
|
|
59
59
|
return _defaults;
|
|
60
60
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Initializes instances of Slider.
|
|
63
|
-
* @param els HTML elements.
|
|
64
|
-
* @param options Component options.
|
|
65
|
-
*/
|
|
66
|
-
static init(els, options = {}) {
|
|
67
|
-
return super.init(els, options, _Slider);
|
|
68
|
-
}
|
|
69
|
-
static getInstance(el) {
|
|
70
|
-
return el["Expressive_Slider"];
|
|
71
|
-
}
|
|
72
61
|
destroy() {
|
|
73
62
|
this._resizeObserver?.disconnect();
|
|
74
|
-
this._removeEventHandlers();
|
|
75
63
|
this._removeThumb();
|
|
76
|
-
|
|
64
|
+
super.destroy();
|
|
77
65
|
const host = this._host();
|
|
78
66
|
for (const el of [this.el, host]) {
|
|
79
67
|
for (const name in _authored.get(el)) el.style.setProperty(name, _authored.get(el)[name]);
|
|
@@ -91,22 +79,15 @@ var Slider = class _Slider extends Component {
|
|
|
91
79
|
// twice - once for mouse, once for touch. One of the touch spellings,
|
|
92
80
|
// `touchleave`, was never implemented by any browser at all.
|
|
93
81
|
_setupEventHandlers() {
|
|
94
|
-
|
|
95
|
-
this.el.addEventListener("
|
|
96
|
-
this.el.addEventListener("
|
|
97
|
-
this.el.addEventListener("
|
|
98
|
-
this.el.addEventListener("
|
|
99
|
-
this.el.addEventListener("
|
|
100
|
-
this.el.addEventListener("
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.el.removeEventListener("change", this._handleRangeChange);
|
|
104
|
-
this.el.removeEventListener("pointerdown", this._handleRangePointerDown);
|
|
105
|
-
this.el.removeEventListener("input", this._handleRangeInput);
|
|
106
|
-
this.el.removeEventListener("pointerup", this._handleRangePointerUp);
|
|
107
|
-
this.el.removeEventListener("pointercancel", this._handleRangePointerUp);
|
|
108
|
-
this.el.removeEventListener("blur", this._handleRangeRelease);
|
|
109
|
-
this.el.removeEventListener("mouseout", this._handleRangeRelease);
|
|
82
|
+
const { signal } = this._events;
|
|
83
|
+
this.el.addEventListener("change", this._handleRangeChange, { signal });
|
|
84
|
+
this.el.addEventListener("pointerdown", this._handleRangePointerDown, { signal });
|
|
85
|
+
this.el.addEventListener("input", this._handleRangeInput, { signal });
|
|
86
|
+
this.el.addEventListener("pointerup", this._handleRangePointerUp, { signal });
|
|
87
|
+
this.el.addEventListener("pointercancel", this._handleRangePointerUp, { signal });
|
|
88
|
+
this.el.addEventListener("blur", this._handleRangeRelease, { signal });
|
|
89
|
+
this.el.addEventListener("mouseout", this._handleRangeRelease, { signal });
|
|
90
|
+
this.el.form?.addEventListener("reset", this._handleFormReset, { signal });
|
|
110
91
|
}
|
|
111
92
|
_setupThumb() {
|
|
112
93
|
this.thumb = document.createElement("span");
|
|
@@ -123,7 +104,7 @@ var Slider = class _Slider extends Component {
|
|
|
123
104
|
return !!this.el.closest(".vertical");
|
|
124
105
|
}
|
|
125
106
|
_host() {
|
|
126
|
-
return this.el.closest(".slider,
|
|
107
|
+
return this.el.closest(".slider, label");
|
|
127
108
|
}
|
|
128
109
|
_clampDual() {
|
|
129
110
|
const host = this._host();
|
|
@@ -134,10 +115,13 @@ var Slider = class _Slider extends Component {
|
|
|
134
115
|
if (this.el === start && +start.value > +end.value) start.value = end.value;
|
|
135
116
|
if (this.el === end && +end.value < +start.value) end.value = start.value;
|
|
136
117
|
}
|
|
137
|
-
|
|
118
|
+
/** The input's range, defaulting like the browser does: 0 to 100. */
|
|
119
|
+
_bounds(el) {
|
|
138
120
|
const parsedMax = parseFloat(el.max);
|
|
139
|
-
|
|
140
|
-
|
|
121
|
+
return { max: Number.isNaN(parsedMax) ? 100 : parsedMax, min: parseFloat(el.min) || 0 };
|
|
122
|
+
}
|
|
123
|
+
_fraction(el) {
|
|
124
|
+
const { max, min } = this._bounds(el);
|
|
141
125
|
const val = parseFloat(el.value) || 0;
|
|
142
126
|
return max === min ? 0 : (val - min) / (max - min);
|
|
143
127
|
}
|
|
@@ -166,9 +150,7 @@ var Slider = class _Slider extends Component {
|
|
|
166
150
|
this._set(host, "--md-comp-slider-end-position", `${handle / 2 + Math.max(...nums) * (length - handle)}px`);
|
|
167
151
|
}
|
|
168
152
|
if (host?.classList.contains("stops")) {
|
|
169
|
-
const
|
|
170
|
-
const max = Number.isNaN(parsedMax) ? 100 : parsedMax;
|
|
171
|
-
const min = parseFloat(this.el.min) || 0;
|
|
153
|
+
const { max, min } = this._bounds(this.el);
|
|
172
154
|
const step = parseFloat(this.el.step);
|
|
173
155
|
const stops = step > 0 && Number.isFinite(step) && max > min;
|
|
174
156
|
this._set(host, "--md-comp-slider-stop-count", stops ? String(Math.floor((max - min) / step + 1e-9) + 1) : "");
|
|
@@ -192,12 +174,14 @@ var Slider = class _Slider extends Component {
|
|
|
192
174
|
*/
|
|
193
175
|
static Init() {
|
|
194
176
|
Utils.onDocumentReady(() => {
|
|
195
|
-
_Slider.init(document.querySelectorAll("input[type=range]
|
|
177
|
+
_Slider.init(document.querySelectorAll("input[type=range]:not(.image-compare > input, .color-picker-hue)"));
|
|
196
178
|
});
|
|
197
179
|
}
|
|
198
180
|
};
|
|
181
|
+
_Slider.key = "Expressive_Slider";
|
|
182
|
+
var Slider = _Slider;
|
|
199
183
|
|
|
200
184
|
export {
|
|
201
185
|
Slider
|
|
202
186
|
};
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-B7DQFHA5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/slider.ts"],
|
|
4
|
+
"sourcesContent": ["import { Component, BaseOptions } from '../core/component';\nimport { Utils } from '../core/utils';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface SliderOptions extends BaseOptions {}\n\nconst _defaults: SliderOptions = {};\n\n// Inline values _set() replaced, per element, so destroy() can put back what\n// an author wrote. Per element, not per instance: both handles of a range\n// write the same host properties.\nconst _authored = new WeakMap<HTMLElement, Record<string, string>>();\n\nexport class Slider extends Component<SliderOptions> {\n declare el: HTMLInputElement;\n private _pointerDown: boolean;\n private _resizeObserver: ResizeObserver | null = null;\n value: HTMLElement;\n thumb: HTMLElement;\n\n constructor(el: HTMLInputElement, options: Partial<SliderOptions>) {\n super(el, options);\n\n this._pointerDown = false;\n this._setupThumb();\n this._sync();\n this._setupEventHandlers();\n this._resizeObserver = new ResizeObserver(() => this._sync());\n this._resizeObserver.observe(this.el);\n // The bubble and stop row are placed from the input's offsets, which\n // move when the host resizes around an input that keeps its size.\n if (this.el.parentElement) this._resizeObserver.observe(this.el.parentElement);\n }\n\n static get defaults(): SliderOptions {\n return _defaults;\n }\n\n static key = 'Expressive_Slider';\n\n destroy() {\n this._resizeObserver?.disconnect();\n this._removeThumb();\n super.destroy();\n const host = this._host();\n for (const el of [this.el, host]) {\n for (const name in _authored.get(el)) el.style.setProperty(name, _authored.get(el)[name]);\n _authored.delete(el);\n }\n // The other handle of a range writes the shared host properties again.\n host?.querySelectorAll('input[type=\"range\"]').forEach((el) => el['Expressive_Slider']?._sync());\n }\n\n _set(el: HTMLElement, name: string, value: string) {\n const authored = _authored.get(el) ?? {};\n _authored.set(el, authored);\n authored[name] ??= el.style.getPropertyValue(name);\n el.style.setProperty(name, value);\n }\n\n // Eleven listeners used to cover four stages, because each one was written\n // twice - once for mouse, once for touch. One of the touch spellings,\n // `touchleave`, was never implemented by any browser at all.\n _setupEventHandlers() {\n const { signal } = this._events;\n this.el.addEventListener('change', this._handleRangeChange, { signal });\n this.el.addEventListener('pointerdown', this._handleRangePointerDown, { signal });\n // `input` alone tracks a drag. A `pointermove` sync used to run as well,\n // twice per frame, and before the browser had moved the value.\n this.el.addEventListener('input', this._handleRangeInput, { signal });\n this.el.addEventListener('pointerup', this._handleRangePointerUp, { signal });\n this.el.addEventListener('pointercancel', this._handleRangePointerUp, { signal });\n this.el.addEventListener('blur', this._handleRangeRelease, { signal });\n // `mouseout`, not `pointerout`: this used to be a `mouseout`/`touchleave`\n // pair, and `touchleave` was never implemented by any browser, so the\n // handler has only ever run for a mouse. `pointerout` also fires when a\n // touch lifts, which would clear the thumb's active state at a moment\n // nothing cleared it before.\n this.el.addEventListener('mouseout', this._handleRangeRelease, { signal });\n // A form reset restores the value without an input event.\n this.el.form?.addEventListener('reset', this._handleFormReset, { signal });\n }\n\n // The reset event fires before the browser restores the values.\n _handleFormReset = () => {\n setTimeout(() => {\n if (Slider.getInstance(this.el) === this) this._sync();\n });\n };\n\n _handleRangeChange = () => {\n this._clampDual();\n this._sync();\n this.thumb.classList.add('active');\n };\n\n _handleRangePointerDown = (e: PointerEvent) => {\n if (!e.isPrimary) return;\n if (e.pointerType === 'mouse' && e.button !== 0) return;\n this._pointerDown = true;\n this.el.classList.add('active');\n this._clampDual();\n this._sync();\n // An `e.type !== 'input'` guard used to sit here. This handler is only ever\n // bound to a press, so it was never anything but true.\n this.thumb.classList.add('active');\n };\n\n _handleRangeInput = () => {\n this._clampDual();\n this._sync();\n this.thumb.classList.add('active');\n };\n\n _handleRangePointerUp = (e: PointerEvent) => {\n if (!e.isPrimary) return;\n this._pointerDown = false;\n this.el.classList.remove('active');\n };\n\n _handleRangeRelease = () => {\n if (!this._pointerDown) {\n this.thumb.classList.remove('active');\n }\n };\n\n _setupThumb() {\n this.thumb = document.createElement('span');\n this.value = document.createElement('span');\n this.thumb.classList.add('thumb');\n this.value.classList.add('value');\n this.thumb.append(this.value);\n this.el.after(this.thumb);\n }\n\n _removeThumb() {\n this.thumb.remove();\n }\n\n _isVertical(): boolean {\n return !!this.el.closest('.vertical');\n }\n\n _host(): HTMLElement | null {\n // `.slider` is the documented host now; without it here a dual-handle\n // control could not find its wrapper, so the handles never clamped and the\n // shared start/end fractions never tracked the interval.\n return this.el.closest('.slider, label');\n }\n\n _clampDual() {\n const host = this._host();\n const peers = host?.querySelectorAll('input[type=\"range\"]');\n if (!peers || peers.length !== 2) return;\n const start = peers[0] as HTMLInputElement;\n const end = peers[1] as HTMLInputElement;\n if (this.el === start && +start.value > +end.value) start.value = end.value;\n if (this.el === end && +end.value < +start.value) end.value = start.value;\n }\n\n /** The input's range, defaulting like the browser does: 0 to 100. */\n private _bounds(el: HTMLInputElement) {\n const parsedMax = parseFloat(el.max);\n return { max: Number.isNaN(parsedMax) ? 100 : parsedMax, min: parseFloat(el.min) || 0 };\n }\n\n _fraction(el: HTMLInputElement): number {\n const { max, min } = this._bounds(el);\n const val = parseFloat(el.value) || 0;\n return max === min ? 0 : (val - min) / (max - min);\n }\n\n _sync() {\n const percent = this._fraction(this.el);\n const fraction = `${percent * 100}%`;\n\n // Read before writing. This runs on every pointer move during a drag, and\n // setting the custom property first made each of the four offset reads\n // below flush a fresh layout.\n const left = this.el.offsetLeft;\n const top = this.el.offsetTop;\n const width = this.el.offsetWidth;\n const height = this.el.offsetHeight;\n const style = getComputedStyle(this.el);\n const rtl = style.direction === 'rtl';\n const vertical = this._isVertical();\n const handle = parseFloat(style.getPropertyValue('--md-comp-slider-handle-width')) || 4;\n const length = vertical ? height : width;\n const position = handle / 2 + percent * (length - handle);\n\n this._set(this.el, '--md-comp-slider-active-fraction', fraction);\n this._set(this.el, '--md-comp-slider-active-position', `${position}px`);\n\n const host = this._host();\n const peers = host?.querySelectorAll('input[type=\"range\"]');\n if (host && peers && peers.length === 2) {\n const nums = Array.from(peers).map((el) => this._fraction(el as HTMLInputElement));\n this._set(host, '--md-comp-slider-start-fraction', `${Math.min(...nums) * 100}%`);\n this._set(host, '--md-comp-slider-end-fraction', `${Math.max(...nums) * 100}%`);\n this._set(host, '--md-comp-slider-start-position', `${handle / 2 + Math.min(...nums) * (length - handle)}px`);\n this._set(host, '--md-comp-slider-end-position', `${handle / 2 + Math.max(...nums) * (length - handle)}px`);\n }\n if (host?.classList.contains('stops')) {\n const { max, min } = this._bounds(this.el);\n const step = parseFloat(this.el.step);\n // Stops sit at min + k * step up to max, so a step that does not divide\n // the range ends short of max. No step, `any`, zero or a negative step\n // clears the spacing, and the host paints no dots.\n const stops = step > 0 && Number.isFinite(step) && max > min;\n this._set(host, '--md-comp-slider-stop-count', stops ? String(Math.floor((max - min) / step + 1e-9) + 1) : '');\n this._set(host, '--md-comp-slider-stop-spacing', stops ? `${((length - handle) * step) / (max - min)}px` : '');\n // The tick row is the host's ::after, which cannot read the input's\n // properties. A dual host has no single position.\n if (peers?.length === 1) {\n this._set(host, '--md-comp-slider-active-position', `${position}px`);\n this._set(host, '--md-comp-slider-track-center', `${top + height / 2}px`);\n }\n }\n\n this.value.textContent = this.el.value;\n if (vertical) {\n this.thumb.style.left = `${left + width / 2}px`;\n this.thumb.style.top = `${top + height - position}px`;\n } else {\n this.thumb.style.left = `${left + (rtl ? width - position : position)}px`;\n this.thumb.style.top = `${top}px`;\n }\n }\n\n /**\n * Initializes every range input in the current document.\n */\n static Init() {\n // Deferred like every other Init(): this ran at import time, so a bundle\n // loaded in <head> found no inputs at all.\n Utils.onDocumentReady(() => {\n // An image compare's range is invisible and drawn by its container; a\n // color picker's hue range paints its own track.\n Slider.init(document.querySelectorAll<HTMLInputElement>('input[type=range]:not(.image-compare > input, .color-picker-hue)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5
|
+
Utils
|
|
6
|
+
} from "./chunk-ZVLOUDIJ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/ts/components/hoverCard.ts
|
|
9
|
+
var _defaults = {
|
|
10
|
+
enterDelay: 500,
|
|
11
|
+
exitDelay: 300
|
|
12
|
+
};
|
|
13
|
+
var owners = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
var HoverCard = class extends Component {
|
|
15
|
+
constructor(el, options) {
|
|
16
|
+
super(el, options);
|
|
17
|
+
/** Whether the instance has the card showing. */
|
|
18
|
+
this._shown = false;
|
|
19
|
+
/** What keeps the card wanted: the pointer, keyboard focus, or both. */
|
|
20
|
+
this._holds = /* @__PURE__ */ new Set();
|
|
21
|
+
/** The anchor name the card is placed against while this link shows it. */
|
|
22
|
+
this._anchorName = `--hover-card-${Utils.guid()}`;
|
|
23
|
+
/**
|
|
24
|
+
* Show the card now, without enterDelay.
|
|
25
|
+
*/
|
|
26
|
+
this.open = () => {
|
|
27
|
+
clearTimeout(this._timeout);
|
|
28
|
+
if (!this.cardEl || this._shown) return;
|
|
29
|
+
owners.get(this.cardEl)?.close();
|
|
30
|
+
this.cardEl.showPopover.call(this.cardEl, { source: this.el });
|
|
31
|
+
owners.set(this.cardEl, this);
|
|
32
|
+
this._shown = true;
|
|
33
|
+
this._listenForEscape(true);
|
|
34
|
+
this._anchor(true);
|
|
35
|
+
this._notify("open");
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Hide the card now, without exitDelay.
|
|
39
|
+
*/
|
|
40
|
+
this.close = () => {
|
|
41
|
+
clearTimeout(this._timeout);
|
|
42
|
+
if (!this._shown) return;
|
|
43
|
+
this.cardEl.hidePopover();
|
|
44
|
+
this._hidden();
|
|
45
|
+
this._notify("close");
|
|
46
|
+
};
|
|
47
|
+
// A touch is a tap that follows the link, never a hover; pointer events
|
|
48
|
+
// say so, and the mouse events a tap sends afterwards are not listened to.
|
|
49
|
+
this._handlePointerEnter = (e) => {
|
|
50
|
+
if (e.pointerType !== "touch") this._hold("pointer");
|
|
51
|
+
};
|
|
52
|
+
this._handlePointerLeave = (e) => {
|
|
53
|
+
if (e.pointerType !== "touch") this._release("pointer");
|
|
54
|
+
};
|
|
55
|
+
// A pointer press also focuses the link, and the hover already covers it,
|
|
56
|
+
// so only keyboard focus holds the card from the link.
|
|
57
|
+
this._handleLinkFocus = () => {
|
|
58
|
+
if (this.el.matches(":focus-visible")) this._hold("focus");
|
|
59
|
+
};
|
|
60
|
+
this._handleCardFocus = () => this._hold("focus");
|
|
61
|
+
this._handleFocusOut = (e) => {
|
|
62
|
+
const next = e.relatedTarget;
|
|
63
|
+
if (!next || !(this.el.contains(next) || this.cardEl.contains(next))) this._release("focus");
|
|
64
|
+
};
|
|
65
|
+
// Escape always hides the card, but it is only the card's key when focus is
|
|
66
|
+
// on the link or in the card; otherwise it still reaches the dialog or menu
|
|
67
|
+
// that has focus. An engine that does not know popover="hint" treats the
|
|
68
|
+
// card as manual, which Escape would not close.
|
|
69
|
+
this._handleKeydown = (e) => {
|
|
70
|
+
if (e.key !== "Escape" || Utils.isComposing(e)) return;
|
|
71
|
+
if (Utils.focusIsIn(this.el, this.cardEl)) this._takeEscape(e);
|
|
72
|
+
this.close();
|
|
73
|
+
};
|
|
74
|
+
this._handleToggle = (e) => {
|
|
75
|
+
if (e.newState !== "closed" || !this._shown) return;
|
|
76
|
+
this._hidden();
|
|
77
|
+
this._notify("close");
|
|
78
|
+
};
|
|
79
|
+
this.cardEl = Utils.getElementById(el, el.getAttribute("aria-details") ?? "");
|
|
80
|
+
if (!this.cardEl) {
|
|
81
|
+
console.error(`HoverCard: aria-details names no element; the link shows no card.`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const { signal } = this._events;
|
|
85
|
+
this.cardEl.addEventListener("toggle", this._handleToggle, { signal });
|
|
86
|
+
for (const target of [this.el, this.cardEl]) {
|
|
87
|
+
target.addEventListener("pointerenter", this._handlePointerEnter, { signal });
|
|
88
|
+
target.addEventListener("pointerleave", this._handlePointerLeave, { signal });
|
|
89
|
+
target.addEventListener("focusout", this._handleFocusOut, { signal });
|
|
90
|
+
}
|
|
91
|
+
this.el.addEventListener("focus", this._handleLinkFocus, { signal });
|
|
92
|
+
this.cardEl.addEventListener("focusin", this._handleCardFocus, { signal });
|
|
93
|
+
}
|
|
94
|
+
static get defaults() {
|
|
95
|
+
return _defaults;
|
|
96
|
+
}
|
|
97
|
+
destroy() {
|
|
98
|
+
clearTimeout(this._timeout);
|
|
99
|
+
if (this._shown) {
|
|
100
|
+
this.cardEl.hidePopover();
|
|
101
|
+
this._hidden();
|
|
102
|
+
}
|
|
103
|
+
super.destroy();
|
|
104
|
+
}
|
|
105
|
+
_hidden() {
|
|
106
|
+
this._shown = false;
|
|
107
|
+
this._listenForEscape(false);
|
|
108
|
+
this._anchor(false);
|
|
109
|
+
}
|
|
110
|
+
// `source` anchors the card too, but Firefox keeps the first source's
|
|
111
|
+
// anchor for good, so a card two links share would stay at the first. A
|
|
112
|
+
// named anchor, set only while the card shows, follows the link that shows it.
|
|
113
|
+
_anchor(on) {
|
|
114
|
+
Utils.setAnchorName(this.el, this._anchorName, on);
|
|
115
|
+
if (on) this.cardEl.style.setProperty("position-anchor", this._anchorName);
|
|
116
|
+
else this.cardEl.style.removeProperty("position-anchor");
|
|
117
|
+
for (const el of [this.el, this.cardEl]) if (!el.getAttribute("style")) el.removeAttribute("style");
|
|
118
|
+
}
|
|
119
|
+
/** Wanted cards show after enterDelay; once nothing holds the card, it hides after exitDelay. */
|
|
120
|
+
_schedule() {
|
|
121
|
+
clearTimeout(this._timeout);
|
|
122
|
+
const wanted = this._holds.size > 0;
|
|
123
|
+
if (wanted === this._shown) return;
|
|
124
|
+
const [change, delay] = wanted ? [this.open, this.options.enterDelay] : [this.close, this.options.exitDelay];
|
|
125
|
+
this._timeout = setTimeout(change, delay);
|
|
126
|
+
}
|
|
127
|
+
_hold(by) {
|
|
128
|
+
this._holds.add(by);
|
|
129
|
+
this._schedule();
|
|
130
|
+
}
|
|
131
|
+
_release(by) {
|
|
132
|
+
this._holds.delete(by);
|
|
133
|
+
this._schedule();
|
|
134
|
+
}
|
|
135
|
+
/** Escape is listened for only while the card shows. close() removes it, and destroy() through the signal. */
|
|
136
|
+
_listenForEscape(on) {
|
|
137
|
+
const doc = this.el.ownerDocument;
|
|
138
|
+
if (on) doc.addEventListener("keydown", this._handleKeydown, { capture: true, signal: this._events.signal });
|
|
139
|
+
else doc.removeEventListener("keydown", this._handleKeydown, true);
|
|
140
|
+
}
|
|
141
|
+
/** Keeps Escape from the page and, when focus is in the card, takes it back to the link before the card hides. */
|
|
142
|
+
_takeEscape(e) {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
e.stopPropagation();
|
|
145
|
+
if (Utils.focusIsIn(this.cardEl)) this.el.focus();
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
HoverCard.key = "Expressive_HoverCard";
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
HoverCard
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=chunk-BIGU5RCJ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/hoverCard.ts"],
|
|
4
|
+
"sourcesContent": ["import { Utils } from '../core/utils';\nimport { Component, BaseOptions } from '../core/component';\n\nexport interface HoverCardOptions extends BaseOptions {\n /**\n * How long the pointer or keyboard focus rests on the link before the card shows.\n * @default 500\n */\n enterDelay: number;\n /**\n * How long the card stays after the pointer and focus leave the link and the card.\n * @default 300\n */\n exitDelay: number;\n}\n\nconst _defaults: HoverCardOptions = {\n enterDelay: 500,\n exitDelay: 300\n};\n\n// Links can share one card, such as a name mentioned twice; the link that\n// last showed it owns it, and the next one takes it over.\nconst owners = new WeakMap<HTMLElement, HoverCard>();\n\n/**\n * Hover card. A `.hover-card-trigger` link names its card, a `.popover` with\n * `popover=\"hint\"`, in `aria-details`. The card shows against the link after\n * `enterDelay` and stays while the pointer or focus is on either.\n */\nexport class HoverCard extends Component<HoverCardOptions> {\n /** The card the link's `aria-details` names, or null when it names none. */\n cardEl: HTMLElement | null;\n /** Whether the instance has the card showing. */\n private _shown = false;\n /** What keeps the card wanted: the pointer, keyboard focus, or both. */\n private _holds = new Set<'pointer' | 'focus'>();\n private _timeout: ReturnType<typeof setTimeout>;\n /** The anchor name the card is placed against while this link shows it. */\n private _anchorName = `--hover-card-${Utils.guid()}`;\n\n constructor(el: HTMLElement, options: Partial<HoverCardOptions>) {\n super(el, options);\n this.cardEl = Utils.getElementById(el, el.getAttribute('aria-details') ?? '');\n if (!this.cardEl) {\n console.error(`HoverCard: aria-details names no element; the link shows no card.`);\n return;\n }\n // The browser hides a hint card itself on a click elsewhere, on Escape\n // and when another hint opens.\n const { signal } = this._events;\n this.cardEl.addEventListener('toggle', this._handleToggle, { signal });\n for (const target of [this.el, this.cardEl]) {\n target.addEventListener('pointerenter', this._handlePointerEnter, { signal });\n target.addEventListener('pointerleave', this._handlePointerLeave, { signal });\n target.addEventListener('focusout', this._handleFocusOut, { signal });\n }\n this.el.addEventListener('focus', this._handleLinkFocus, { signal });\n this.cardEl.addEventListener('focusin', this._handleCardFocus, { signal });\n }\n\n static get defaults(): HoverCardOptions {\n return _defaults;\n }\n\n static key = 'Expressive_HoverCard';\n\n destroy() {\n clearTimeout(this._timeout);\n if (this._shown) {\n this.cardEl.hidePopover();\n this._hidden();\n }\n super.destroy();\n }\n\n /**\n * Show the card now, without enterDelay.\n */\n open = () => {\n clearTimeout(this._timeout);\n if (!this.cardEl || this._shown) return;\n owners.get(this.cardEl)?.close();\n // `source` makes the link the card's anchor and invoker, so Tab moves from\n // the link into the card. It throws for a card without the popover\n // attribute, before any state changes.\n (this.cardEl.showPopover as (options?: { source?: Element }) => void).call(this.cardEl, { source: this.el });\n owners.set(this.cardEl, this);\n this._shown = true;\n this._listenForEscape(true);\n this._anchor(true);\n this._notify('open');\n };\n\n /**\n * Hide the card now, without exitDelay.\n */\n close = () => {\n clearTimeout(this._timeout);\n if (!this._shown) return;\n this.cardEl.hidePopover();\n this._hidden();\n this._notify('close');\n };\n\n private _hidden() {\n this._shown = false;\n this._listenForEscape(false);\n this._anchor(false);\n }\n\n // `source` anchors the card too, but Firefox keeps the first source's\n // anchor for good, so a card two links share would stay at the first. A\n // named anchor, set only while the card shows, follows the link that shows it.\n private _anchor(on: boolean) {\n Utils.setAnchorName(this.el, this._anchorName, on);\n if (on) this.cardEl.style.setProperty('position-anchor', this._anchorName);\n else this.cardEl.style.removeProperty('position-anchor');\n for (const el of [this.el, this.cardEl]) if (!el.getAttribute('style')) el.removeAttribute('style');\n }\n\n /** Wanted cards show after enterDelay; once nothing holds the card, it hides after exitDelay. */\n private _schedule() {\n clearTimeout(this._timeout);\n const wanted = this._holds.size > 0;\n if (wanted === this._shown) return;\n const [change, delay] = wanted ? [this.open, this.options.enterDelay] as const : [this.close, this.options.exitDelay] as const;\n this._timeout = setTimeout(change, delay);\n }\n\n private _hold(by: 'pointer' | 'focus') {\n this._holds.add(by);\n this._schedule();\n }\n\n private _release(by: 'pointer' | 'focus') {\n this._holds.delete(by);\n this._schedule();\n }\n\n // A touch is a tap that follows the link, never a hover; pointer events\n // say so, and the mouse events a tap sends afterwards are not listened to.\n private _handlePointerEnter = (e: PointerEvent) => {\n if (e.pointerType !== 'touch') this._hold('pointer');\n };\n\n private _handlePointerLeave = (e: PointerEvent) => {\n if (e.pointerType !== 'touch') this._release('pointer');\n };\n\n // A pointer press also focuses the link, and the hover already covers it,\n // so only keyboard focus holds the card from the link.\n private _handleLinkFocus = () => {\n if (this.el.matches(':focus-visible')) this._hold('focus');\n };\n\n private _handleCardFocus = () => this._hold('focus');\n\n private _handleFocusOut = (e: FocusEvent) => {\n const next = e.relatedTarget as Node | null;\n if (!next || !(this.el.contains(next) || this.cardEl.contains(next))) this._release('focus');\n };\n\n /** Escape is listened for only while the card shows. close() removes it, and destroy() through the signal. */\n private _listenForEscape(on: boolean) {\n const doc = this.el.ownerDocument;\n if (on) doc.addEventListener('keydown', this._handleKeydown, { capture: true, signal: this._events.signal });\n else doc.removeEventListener('keydown', this._handleKeydown, true);\n }\n\n // Escape always hides the card, but it is only the card's key when focus is\n // on the link or in the card; otherwise it still reaches the dialog or menu\n // that has focus. An engine that does not know popover=\"hint\" treats the\n // card as manual, which Escape would not close.\n private _handleKeydown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape' || Utils.isComposing(e)) return;\n if (Utils.focusIsIn(this.el, this.cardEl)) this._takeEscape(e);\n this.close();\n };\n\n /** Keeps Escape from the page and, when focus is in the card, takes it back to the link before the card hides. */\n private _takeEscape(e: KeyboardEvent) {\n e.preventDefault();\n e.stopPropagation();\n if (Utils.focusIsIn(this.cardEl)) this.el.focus();\n }\n\n private _handleToggle = (e: Event) => {\n if ((e as ToggleEvent).newState !== 'closed' || !this._shown) return;\n this._hidden();\n this._notify('close');\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAgBA,IAAM,YAA8B;AAAA,EAClC,YAAY;AAAA,EACZ,WAAW;AACb;AAIA,IAAM,SAAS,oBAAI,QAAgC;AAO5C,IAAM,YAAN,cAAwB,UAA4B;AAAA,EAWzD,YAAY,IAAiB,SAAoC;AAC/D,UAAM,IAAI,OAAO;AARnB;AAAA,SAAQ,SAAS;AAEjB;AAAA,SAAQ,SAAS,oBAAI,IAAyB;AAG9C;AAAA,SAAQ,cAAc,gBAAgB,MAAM,KAAK,CAAC;AAwClD;AAAA;AAAA;AAAA,gBAAO,MAAM;AACX,mBAAa,KAAK,QAAQ;AAC1B,UAAI,CAAC,KAAK,UAAU,KAAK,OAAQ;AACjC,aAAO,IAAI,KAAK,MAAM,GAAG,MAAM;AAI/B,MAAC,KAAK,OAAO,YAAyD,KAAK,KAAK,QAAQ,EAAE,QAAQ,KAAK,GAAG,CAAC;AAC3G,aAAO,IAAI,KAAK,QAAQ,IAAI;AAC5B,WAAK,SAAS;AACd,WAAK,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