@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
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LineChart,
|
|
3
|
+
affix,
|
|
4
|
+
cellValue,
|
|
5
|
+
morph,
|
|
6
|
+
numberFormat,
|
|
7
|
+
pace,
|
|
8
|
+
tickText
|
|
9
|
+
} from "./chunk-ZM3XBHWV.mjs";
|
|
10
|
+
import {
|
|
11
|
+
svgNode
|
|
12
|
+
} from "./chunk-ZVLOUDIJ.mjs";
|
|
13
|
+
|
|
14
|
+
// src/ts/components/scatterChart.ts
|
|
15
|
+
var dots = (marks) => marks.map(({ x, y }) => `M${x},${y}h0`).join("");
|
|
16
|
+
var place = ({ row, series }) => `${row} ${series.column}`;
|
|
17
|
+
var span = (text) => Object.assign(document.createElement("span"), { textContent: text });
|
|
18
|
+
var ms = (time) => parseFloat(time) * (time.trim().endsWith("ms") ? 1 : 1e3);
|
|
19
|
+
function sized(path, size, was, timing) {
|
|
20
|
+
path.style.setProperty("--scatter-chart-size", `${size}`);
|
|
21
|
+
if (!timing || !was || was.size === size) return;
|
|
22
|
+
path.animate({ "--scatter-chart-size": [`${was.size}`, `${size}`] }, { duration: ms(timing.dur), easing: `cubic-bezier(${timing.keySplines})` });
|
|
23
|
+
}
|
|
24
|
+
var ScatterChart = class extends LineChart {
|
|
25
|
+
get _type() {
|
|
26
|
+
return "scatter-chart";
|
|
27
|
+
}
|
|
28
|
+
get _seriesFrom() {
|
|
29
|
+
return 2;
|
|
30
|
+
}
|
|
31
|
+
get _seriesTo() {
|
|
32
|
+
return this._bubble ? -1 : void 0;
|
|
33
|
+
}
|
|
34
|
+
get _bubble() {
|
|
35
|
+
return this.el.classList.contains("bubble");
|
|
36
|
+
}
|
|
37
|
+
static get defaults() {
|
|
38
|
+
return { ...LineChart.defaults, xMin: null, xMax: null };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Reads each row's x value into `_xs` and its size into `_sizes`, which
|
|
42
|
+
* the scales and the points use, and leaves out the values of rows
|
|
43
|
+
* without either, so they neither draw nor stretch a scale. Nothing stacks.
|
|
44
|
+
*/
|
|
45
|
+
_arrange(series) {
|
|
46
|
+
const xs = this._xs = this._rows.map((row) => cellValue(row.cells[1]));
|
|
47
|
+
const sizes = this._sizes = this._rows.map((row) => this._size(row));
|
|
48
|
+
for (const each of series) {
|
|
49
|
+
each.values = each.tops = each.values.map((value, row) => xs[row] === null || sizes[row] === null ? null : value);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** A row's size: 1 without .bubble, or its last cell's value, null unless positive. */
|
|
53
|
+
_size(row) {
|
|
54
|
+
if (!this._bubble) return 1;
|
|
55
|
+
const size = cellValue(row.cells[this._header.length - 1]) ?? 0;
|
|
56
|
+
return size > 0 ? size : null;
|
|
57
|
+
}
|
|
58
|
+
get _count() {
|
|
59
|
+
return this._marks?.length ?? 0;
|
|
60
|
+
}
|
|
61
|
+
/** Highlights one point, numbered as `_marks` lists them. Pass -1 to hide the tooltip. */
|
|
62
|
+
show(index) {
|
|
63
|
+
if (!this._tooltip || index === this.activeIndex) return;
|
|
64
|
+
this.activeIndex = index;
|
|
65
|
+
const mark = this._marks[index];
|
|
66
|
+
this._cursor.hidden = this._tooltip.hidden = !mark;
|
|
67
|
+
if (mark) this._fill(mark);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Puts the marker on a point, at a bubble's size, and fills the tooltip
|
|
71
|
+
* beside it: the row, its x header and text, the series and its text, and
|
|
72
|
+
* with .bubble the size header and text, as the author wrote them. Past
|
|
73
|
+
* the middle the tooltip opens back over the plot.
|
|
74
|
+
*/
|
|
75
|
+
_fill({ row, series, x, y, size }) {
|
|
76
|
+
this._cursor.dataset.series = series.color;
|
|
77
|
+
this._cursor.style.setProperty("--scatter-chart-size", `${size}`);
|
|
78
|
+
for (const part of [this._cursor, this._tooltip]) Object.assign(part.style, { left: `${x}%`, top: `${y}%` });
|
|
79
|
+
this._tooltip.classList.toggle("end", x > 50);
|
|
80
|
+
const [title, name] = [document.createElement("strong"), span(series.name)];
|
|
81
|
+
title.textContent = this.labels[row];
|
|
82
|
+
name.dataset.series = series.color;
|
|
83
|
+
const sizeText = this._bubble ? this._cellText(row, this._header.length - 1) : [];
|
|
84
|
+
this._tooltip.replaceChildren(title, ...this._cellText(row, 1), name, span(series.text[row]), ...sizeText);
|
|
85
|
+
}
|
|
86
|
+
/** A column's header, without a swatch since it names no series, and the row's text in it. */
|
|
87
|
+
_cellText(row, column) {
|
|
88
|
+
const header = span(this._header[column].textContent.trim());
|
|
89
|
+
header.className = "x";
|
|
90
|
+
return [header, span(this._rows[row].cells[column]?.textContent.trim() ?? "")];
|
|
91
|
+
}
|
|
92
|
+
/** The point nearest the pointer, or -1 with none. */
|
|
93
|
+
_indexAt(e) {
|
|
94
|
+
const [plot, box] = [this._plot, this._plot.getBoundingClientRect()];
|
|
95
|
+
const away = ({ x, y }) => Math.hypot(
|
|
96
|
+
box.left + plot.clientLeft + x / 100 * plot.clientWidth - e.clientX,
|
|
97
|
+
box.top + plot.clientTop + y / 100 * plot.clientHeight - e.clientY
|
|
98
|
+
);
|
|
99
|
+
return this._marks.reduce((nearest, mark, i) => nearest < 0 || away(mark) < away(this._marks[nearest]) ? i : nearest, -1);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Steps through the points in table order. The arrows keep their meaning
|
|
103
|
+
* in a right-to-left chart, since table order is no direction on screen.
|
|
104
|
+
*/
|
|
105
|
+
_keyTarget(key) {
|
|
106
|
+
if (key === "Escape") return this.activeIndex < 0 ? void 0 : -1;
|
|
107
|
+
const last = this._marks.length - 1;
|
|
108
|
+
const step = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }[key];
|
|
109
|
+
if (step) return Math.min(last, Math.max(0, this.activeIndex + step));
|
|
110
|
+
return { Home: 0, End: last }[key];
|
|
111
|
+
}
|
|
112
|
+
_read() {
|
|
113
|
+
[this._drawn, this._marks] = [this._marks ?? [], []];
|
|
114
|
+
super._read();
|
|
115
|
+
if (!this.series.length) return;
|
|
116
|
+
this._xFit = this._xScale();
|
|
117
|
+
this._xAffix = affix(this._rows.map((row) => row.cells[1]));
|
|
118
|
+
}
|
|
119
|
+
/** The x scale over the rows with a point, between `xMin` and `xMax` where they are set. */
|
|
120
|
+
_xScale() {
|
|
121
|
+
const [low, high] = this._xRange();
|
|
122
|
+
const [min, max] = [this._xEnd("xMin"), this._xEnd("xMax")];
|
|
123
|
+
return this._fit(min ?? low, max ?? high, [min !== null, max !== null]);
|
|
124
|
+
}
|
|
125
|
+
/** The x values of the rows with a point, with 10% of their span to spare each side. */
|
|
126
|
+
_xRange() {
|
|
127
|
+
const xs = this._xs.filter((_, row) => this._hasPoint(row));
|
|
128
|
+
if (!xs.length) return [-1, 1];
|
|
129
|
+
const [low, high] = [xs.reduce((a, b) => Math.min(a, b)), xs.reduce((a, b) => Math.max(a, b))];
|
|
130
|
+
const pad = (high - low) * 0.1 || 1;
|
|
131
|
+
return [low - pad, high + pad];
|
|
132
|
+
}
|
|
133
|
+
/** An x scale end from its data attribute or option, or null. */
|
|
134
|
+
_xEnd(name) {
|
|
135
|
+
return this._number(name) ?? this.options[name] ?? null;
|
|
136
|
+
}
|
|
137
|
+
/** A value's distance across the plot from its inline start, in percent. */
|
|
138
|
+
_xAt(value) {
|
|
139
|
+
const { min, max } = this._xFit;
|
|
140
|
+
const x = (value - min) / (max - min || 1) * 100;
|
|
141
|
+
return this._reversed ? 100 - x : x;
|
|
142
|
+
}
|
|
143
|
+
/** Whether any series shown draws a point in a row. */
|
|
144
|
+
_hasPoint(row) {
|
|
145
|
+
return this.series.some((series) => series.values[row] !== null);
|
|
146
|
+
}
|
|
147
|
+
/** The points, each diameter the square root of its row's share of the largest size drawn, so areas follow sizes. */
|
|
148
|
+
_layout() {
|
|
149
|
+
const largest = this._sizes.reduce((most, size, row) => this._hasPoint(row) ? Math.max(most, size) : most, 0);
|
|
150
|
+
return this.labels.flatMap((_, row) => this.series.filter((series) => series.values[row] !== null).map((series) => ({
|
|
151
|
+
row,
|
|
152
|
+
series,
|
|
153
|
+
x: this._xAt(this._xs[row]),
|
|
154
|
+
y: series.y(series.values[row]),
|
|
155
|
+
size: Math.sqrt(this._sizes[row] / largest)
|
|
156
|
+
})));
|
|
157
|
+
}
|
|
158
|
+
/** One group per series, its points round caps on zero-length lines, so CSS sizes them in pixels. */
|
|
159
|
+
_draw() {
|
|
160
|
+
this._marks = this._layout();
|
|
161
|
+
const svg = svgNode("svg", {
|
|
162
|
+
viewBox: "0 0 100 100",
|
|
163
|
+
preserveAspectRatio: "none",
|
|
164
|
+
"aria-hidden": "true",
|
|
165
|
+
focusable: "false"
|
|
166
|
+
});
|
|
167
|
+
const timing = this._before.length ? pace(this.el) : null;
|
|
168
|
+
const was = new Map(this._drawn.map((old) => [place(old), old]));
|
|
169
|
+
svg.append(...this.series.map((series) => this._group(series, timing, was)));
|
|
170
|
+
return svg;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* A series' points, in one path, or with .bubble one path each, largest
|
|
174
|
+
* first so smaller bubbles stay on top.
|
|
175
|
+
*/
|
|
176
|
+
_group(series, timing, was) {
|
|
177
|
+
const group = svgNode("g", {
|
|
178
|
+
class: `scatter-chart-series ${series.className}`.trim(),
|
|
179
|
+
"data-series": series.color
|
|
180
|
+
});
|
|
181
|
+
const marks = this._marks.filter((mark) => mark.series === series);
|
|
182
|
+
const sets = this._bubble ? marks.sort((a, b) => b.size - a.size).map((mark) => [mark]) : [marks];
|
|
183
|
+
group.append(...sets.map((set) => this._pointPath(set, timing, was)));
|
|
184
|
+
return group;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* A path of points. After update() each moves from where its row's point
|
|
188
|
+
* in the same column was drawn, or appears where it is.
|
|
189
|
+
*/
|
|
190
|
+
_pointPath(marks, timing, was) {
|
|
191
|
+
const path = svgNode("path", { class: "scatter-chart-points", d: dots(marks) });
|
|
192
|
+
if (timing) morph(path, dots(marks.map((mark) => was.get(place(mark)) ?? mark)), timing);
|
|
193
|
+
if (this._bubble) sized(path, marks[0].size, was.get(place(marks[0])), timing);
|
|
194
|
+
return path;
|
|
195
|
+
}
|
|
196
|
+
/** With .axis, the y scale's labels, and the x scale's below the plot with a grid line at each. */
|
|
197
|
+
_axes() {
|
|
198
|
+
return this._axis ? [...super._axes(), this._xAxis()] : [];
|
|
199
|
+
}
|
|
200
|
+
_xAxis() {
|
|
201
|
+
const axis = document.createElement("ol");
|
|
202
|
+
axis.className = "scatter-chart-axis x";
|
|
203
|
+
axis.setAttribute("aria-hidden", "true");
|
|
204
|
+
const number = numberFormat(this.el, { notation: "compact", maximumSignificantDigits: 3 });
|
|
205
|
+
for (const tick of this._xFit.ticks) {
|
|
206
|
+
const li = document.createElement("li");
|
|
207
|
+
const label = document.createElement("span");
|
|
208
|
+
label.textContent = tickText(number, tick, this._xAffix);
|
|
209
|
+
li.style.setProperty("--at", `${this._xAt(tick)}%`);
|
|
210
|
+
li.append(label);
|
|
211
|
+
axis.append(li);
|
|
212
|
+
}
|
|
213
|
+
return axis;
|
|
214
|
+
}
|
|
215
|
+
/** The legend only: the rows have no labels along an axis. */
|
|
216
|
+
_guides() {
|
|
217
|
+
return this._legend();
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
ScatterChart.key = "Expressive_ScatterChart";
|
|
221
|
+
|
|
222
|
+
export {
|
|
223
|
+
ScatterChart
|
|
224
|
+
};
|
|
225
|
+
//# sourceMappingURL=chunk-752ADW4M.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/scatterChart.ts"],
|
|
4
|
+
"sourcesContent": ["import { svgNode } from '../core/utils';\nimport { LineChart, LineChartOptions, ChartScale, Series, affix, cellValue, morph, numberFormat, pace, tickText } from './lineChart';\n\nexport interface ScatterChartOptions extends LineChartOptions {\n /**\n * Lowest value on the x axis. Defaults to the data minimum less 10% of\n * the range. Overridden by `data-x-min` on the chart.\n */\n xMin: number | null;\n /**\n * Highest value on the x axis. Defaults to the data maximum plus 10% of\n * the range. Overridden by `data-x-max` on the chart.\n */\n xMax: number | null;\n}\n\n/**\n * A drawn point: its row and series, where it sits in the plot, in percent,\n * and its diameter as a share of the largest bubble's.\n */\ninterface Mark {\n row: number;\n series: Series;\n x: number;\n y: number;\n size: number;\n}\n\n/** Points as path data: round caps on zero-length lines. */\nconst dots = (marks: Mark[]) => marks.map(({ x, y }) => `M${x},${y}h0`).join('');\n\n/** A point's row and series column, which update() matches old and new points by. */\nconst place = ({ row, series }: Mark) => `${row} ${series.column}`;\n\n/** A tooltip line part. */\nconst span = (text: string) => Object.assign(document.createElement('span'), { textContent: text });\n\n/** A CSS time, such as 400ms or 0.4s, in milliseconds. */\nconst ms = (time: string) => parseFloat(time) * (time.trim().endsWith('ms') ? 1 : 1000);\n\n/**\n * Sizes a bubble, and with motion timing grows or shrinks it from its old\n * point's size. The Web Animations API, since SVG animation cannot reach a\n * size that CSS computes from a token.\n */\nfunction sized(path: SVGElement, size: number, was: Mark | undefined, timing: ReturnType<typeof pace>) {\n path.style.setProperty('--scatter-chart-size', `${size}`);\n if (!timing || !was || was.size === size) return;\n path.animate({ '--scatter-chart-size': [`${was.size}`, `${size}`] }, { duration: ms(timing.dur), easing: `cubic-bezier(${timing.keySplines})` });\n}\n\n/**\n * Scatter chart. It reads its <table> like LineChart, but the first value\n * column is the x axis: each row draws one point per later column, at the\n * row's x value and that column's y value. A row without an x value, or a\n * cell without a y value, draws no point.\n *\n * With `.bubble`, the last column sizes each row's points, so their areas\n * follow its values, and a row without a positive size draws no point.\n *\n * Call `update()` after changing the table, or start it with `watch` or\n * `data-watch`.\n */\nexport class ScatterChart extends LineChart {\n // No initializers: LineChart's constructor draws before they would run.\n /** Each row's x value, or null. */\n private _xs: (number | null)[];\n /** Each row's size: 1 without .bubble, or the last cell's value, null unless positive. */\n private _sizes: (number | null)[];\n /** The x scale. */\n private _xFit: ChartScale;\n /** The signs around the x column's numbers, which its axis labels repeat. */\n private _xAffix: [string, string];\n /** The drawn points, row by row and within a row by series. */\n private _marks: Mark[];\n /** During update(), the points drawn before it, which the new ones move from. */\n private _drawn: Mark[];\n\n protected get _type() {\n return 'scatter-chart';\n }\n\n protected get _seriesFrom() {\n return 2;\n }\n\n protected get _seriesTo() {\n return this._bubble ? -1 : undefined;\n }\n\n private get _bubble() {\n return this.el.classList.contains('bubble');\n }\n\n static get defaults(): ScatterChartOptions {\n return { ...LineChart.defaults, xMin: null, xMax: null };\n }\n\n static key = 'Expressive_ScatterChart';\n\n /**\n * Reads each row's x value into `_xs` and its size into `_sizes`, which\n * the scales and the points use, and leaves out the values of rows\n * without either, so they neither draw nor stretch a scale. Nothing stacks.\n */\n protected _arrange(series: Series[]) {\n const xs = (this._xs = this._rows.map((row) => cellValue(row.cells[1])));\n const sizes = (this._sizes = this._rows.map((row) => this._size(row)));\n for (const each of series) {\n each.values = each.tops = each.values.map((value, row) => (xs[row] === null || sizes[row] === null ? null : value));\n }\n }\n\n /** A row's size: 1 without .bubble, or its last cell's value, null unless positive. */\n private _size(row: HTMLTableRowElement) {\n if (!this._bubble) return 1;\n const size = cellValue(row.cells[this._header.length - 1]) ?? 0;\n return size > 0 ? size : null;\n }\n\n protected get _count() {\n return this._marks?.length ?? 0;\n }\n\n /** Highlights one point, numbered as `_marks` lists them. Pass -1 to hide the tooltip. */\n show(index: number) {\n if (!this._tooltip || index === this.activeIndex) return;\n this.activeIndex = index;\n const mark = this._marks[index];\n this._cursor.hidden = this._tooltip.hidden = !mark;\n if (mark) this._fill(mark);\n }\n\n /**\n * Puts the marker on a point, at a bubble's size, and fills the tooltip\n * beside it: the row, its x header and text, the series and its text, and\n * with .bubble the size header and text, as the author wrote them. Past\n * the middle the tooltip opens back over the plot.\n */\n private _fill({ row, series, x, y, size }: Mark) {\n this._cursor.dataset.series = series.color;\n this._cursor.style.setProperty('--scatter-chart-size', `${size}`);\n for (const part of [this._cursor, this._tooltip]) Object.assign(part.style, { left: `${x}%`, top: `${y}%` });\n this._tooltip.classList.toggle('end', x > 50);\n const [title, name] = [document.createElement('strong'), span(series.name)];\n title.textContent = this.labels[row];\n name.dataset.series = series.color;\n const sizeText = this._bubble ? this._cellText(row, this._header.length - 1) : [];\n this._tooltip.replaceChildren(title, ...this._cellText(row, 1), name, span(series.text[row]), ...sizeText);\n }\n\n /** A column's header, without a swatch since it names no series, and the row's text in it. */\n private _cellText(row: number, column: number) {\n const header = span(this._header[column].textContent.trim());\n header.className = 'x';\n return [header, span(this._rows[row].cells[column]?.textContent.trim() ?? '')];\n }\n\n /** The point nearest the pointer, or -1 with none. */\n protected _indexAt(e: PointerEvent) {\n const [plot, box] = [this._plot, this._plot.getBoundingClientRect()];\n const away = ({ x, y }: Mark) => Math.hypot(\n box.left + plot.clientLeft + (x / 100) * plot.clientWidth - e.clientX,\n box.top + plot.clientTop + (y / 100) * plot.clientHeight - e.clientY);\n return this._marks.reduce((nearest, mark, i) => (nearest < 0 || away(mark) < away(this._marks[nearest]) ? i : nearest), -1);\n }\n\n /**\n * Steps through the points in table order. The arrows keep their meaning\n * in a right-to-left chart, since table order is no direction on screen.\n */\n protected _keyTarget(key: string): number | undefined {\n // With nothing shown, Escape is left to a dialog or sheet around the chart.\n if (key === 'Escape') return this.activeIndex < 0 ? undefined : -1;\n const last = this._marks.length - 1;\n const step = ({ ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 } as Record<string, number>)[key];\n if (step) return Math.min(last, Math.max(0, this.activeIndex + step));\n return ({ Home: 0, End: last } as Record<string, number>)[key];\n }\n\n protected _read() {\n [this._drawn, this._marks] = [this._marks ?? [], []];\n super._read();\n if (!this.series.length) return;\n this._xFit = this._xScale();\n this._xAffix = affix(this._rows.map((row) => row.cells[1]));\n }\n\n /** The x scale over the rows with a point, between `xMin` and `xMax` where they are set. */\n private _xScale(): ChartScale {\n const [low, high] = this._xRange();\n const [min, max] = [this._xEnd('xMin'), this._xEnd('xMax')];\n return this._fit(min ?? low, max ?? high, [min !== null, max !== null]);\n }\n\n /** The x values of the rows with a point, with 10% of their span to spare each side. */\n private _xRange(): [number, number] {\n const xs = this._xs.filter((_, row) => this._hasPoint(row)) as number[];\n if (!xs.length) return [-1, 1];\n const [low, high] = [xs.reduce((a, b) => Math.min(a, b)), xs.reduce((a, b) => Math.max(a, b))];\n const pad = (high - low) * 0.1 || 1;\n return [low - pad, high + pad];\n }\n\n /** An x scale end from its data attribute or option, or null. */\n private _xEnd(name: 'xMin' | 'xMax') {\n return this._number(name) ?? (this.options as Partial<ScatterChartOptions>)[name] ?? null;\n }\n\n /** A value's distance across the plot from its inline start, in percent. */\n private _xAt(value: number) {\n const { min, max } = this._xFit;\n const x = ((value - min) / (max - min || 1)) * 100;\n return this._reversed ? 100 - x : x;\n }\n\n /** Whether any series shown draws a point in a row. */\n private _hasPoint(row: number) {\n return this.series.some((series) => series.values[row] !== null);\n }\n\n /** The points, each diameter the square root of its row's share of the largest size drawn, so areas follow sizes. */\n private _layout(): Mark[] {\n const largest = this._sizes.reduce<number>((most, size, row) => (this._hasPoint(row) ? Math.max(most, size!) : most), 0);\n return this.labels.flatMap((_, row) => this.series\n .filter((series) => series.values[row] !== null)\n .map((series) => ({\n row,\n series,\n x: this._xAt(this._xs[row]!),\n y: series.y(series.values[row]!),\n size: Math.sqrt(this._sizes[row]! / largest)\n })));\n }\n\n /** One group per series, its points round caps on zero-length lines, so CSS sizes them in pixels. */\n protected _draw(): Element {\n this._marks = this._layout();\n const svg = svgNode('svg', {\n viewBox: '0 0 100 100',\n preserveAspectRatio: 'none',\n 'aria-hidden': 'true',\n focusable: 'false'\n });\n const timing = this._before.length ? pace(this.el) : null;\n const was = new Map(this._drawn.map((old) => [place(old), old]));\n svg.append(...this.series.map((series) => this._group(series, timing, was)));\n return svg;\n }\n\n /**\n * A series' points, in one path, or with .bubble one path each, largest\n * first so smaller bubbles stay on top.\n */\n private _group(series: Series, timing: ReturnType<typeof pace>, was: Map<string, Mark>) {\n const group = svgNode('g', {\n class: `scatter-chart-series ${series.className}`.trim(),\n 'data-series': series.color\n });\n const marks = this._marks.filter((mark) => mark.series === series);\n const sets = this._bubble ? marks.sort((a, b) => b.size - a.size).map((mark) => [mark]) : [marks];\n group.append(...sets.map((set) => this._pointPath(set, timing, was)));\n return group;\n }\n\n /**\n * A path of points. After update() each moves from where its row's point\n * in the same column was drawn, or appears where it is.\n */\n private _pointPath(marks: Mark[], timing: ReturnType<typeof pace>, was: Map<string, Mark>) {\n const path = svgNode('path', { class: 'scatter-chart-points', d: dots(marks) });\n if (timing) morph(path, dots(marks.map((mark) => was.get(place(mark)) ?? mark)), timing);\n if (this._bubble) sized(path, marks[0].size, was.get(place(marks[0])), timing);\n return path;\n }\n\n /** With .axis, the y scale's labels, and the x scale's below the plot with a grid line at each. */\n protected _axes(): Element[] {\n return this._axis ? [...super._axes(), this._xAxis()] : [];\n }\n\n private _xAxis() {\n const axis = document.createElement('ol');\n axis.className = 'scatter-chart-axis x';\n axis.setAttribute('aria-hidden', 'true');\n const number = numberFormat(this.el, { notation: 'compact', maximumSignificantDigits: 3 });\n for (const tick of this._xFit.ticks) {\n const li = document.createElement('li');\n const label = document.createElement('span');\n label.textContent = tickText(number, tick, this._xAffix);\n li.style.setProperty('--at', `${this._xAt(tick)}%`);\n li.append(label);\n axis.append(li);\n }\n return axis;\n }\n\n /** The legend only: the rows have no labels along an axis. */\n protected _guides(): Element[] {\n return this._legend();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AA6BA,IAAM,OAAO,CAAC,UAAkB,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;AAG/E,IAAM,QAAQ,CAAC,EAAE,KAAK,OAAO,MAAY,GAAG,GAAG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,cAAc,SAAS,QAAQ,MAAM,KAAK,OAAO;AACvD,SAAG,MAAM,YAAY,QAAQ,GAAG,KAAK,KAAK,IAAI,CAAC,GAAG;AAClD,SAAG,OAAO,KAAK;AACf,WAAK,OAAO,EAAE;AAAA,IAChB;AACA,WAAO;AAAA,EACT;AAAA;AAAA,EAGU,UAAqB;AAC7B,WAAO,KAAK,QAAQ;AAAA,EACtB;AACF;AA9Oa,aAmCJ,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ColumnChart
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PA7NU5AK.mjs";
|
|
4
4
|
|
|
5
5
|
// src/ts/components/barChart.ts
|
|
6
6
|
var BarChart = class extends ColumnChart {
|
|
7
7
|
get _type() {
|
|
8
8
|
return "bar-chart";
|
|
9
9
|
}
|
|
10
|
-
get _key() {
|
|
11
|
-
return "Expressive_BarChart";
|
|
12
|
-
}
|
|
13
10
|
get _horizontal() {
|
|
14
11
|
return true;
|
|
15
12
|
}
|
|
16
|
-
static init(els, options = {}) {
|
|
17
|
-
return super.init(els, options);
|
|
18
|
-
}
|
|
19
|
-
static getInstance(el) {
|
|
20
|
-
return el["Expressive_BarChart"];
|
|
21
|
-
}
|
|
22
13
|
/**
|
|
23
14
|
* The column chart's spans; CSS reads their --top and --bottom across the
|
|
24
15
|
* plot. With .values, a copy of the bars without their clipping holds each
|
|
@@ -40,8 +31,9 @@ var BarChart = class extends ColumnChart {
|
|
|
40
31
|
return layers;
|
|
41
32
|
}
|
|
42
33
|
};
|
|
34
|
+
BarChart.key = "Expressive_BarChart";
|
|
43
35
|
|
|
44
36
|
export {
|
|
45
37
|
BarChart
|
|
46
38
|
};
|
|
47
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-75E5EDJF.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/barChart.ts"],
|
|
4
|
+
"sourcesContent": ["import { ColumnChart, ColumnChartOptions } from './columnChart';\n\nexport type BarChartOptions = ColumnChartOptions;\n\n/**\n * Bar chart. A column chart turned on its side: each row of the <table> is\n * a band of bars that grow from zero along the inline axis, with its label\n * beside it. The up and down arrows move the tooltip between rows.\n *\n * Call `update()` after changing the table, or start it with `watch` or\n * `data-watch`.\n */\nexport class BarChart extends ColumnChart {\n protected get _type() {\n return 'bar-chart';\n }\n\n protected get _horizontal() {\n return true;\n }\n\n static key = 'Expressive_BarChart';\n\n /**\n * The column chart's spans; CSS reads their --top and --bottom across the\n * plot. With .values, a copy of the bars without their clipping holds each\n * cell's text, so text longer than a short bar can run past its end.\n */\n protected _draw(): Element {\n const bars = super._draw() as HTMLElement;\n bars.className = 'bar-chart-bars';\n // Read here rather than with :dir(), which misses CSS `direction`.\n bars.classList.toggle('rtl', getComputedStyle(this.el).direction === 'rtl');\n if (!this.el.classList.contains('values')) return bars;\n\n const values = bars.cloneNode(true) as HTMLElement;\n values.classList.replace('bar-chart-bars', 'bar-chart-values');\n values.querySelectorAll<HTMLElement>('span[data-text]').forEach((span) => {\n span.textContent = span.dataset.text;\n });\n const layers = document.createElement('div');\n layers.className = 'bar-chart-layers';\n layers.append(bars, values);\n return layers;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAYO,IAAM,WAAN,cAAuB,YAAY;AAAA,EACxC,IAAc,QAAQ;AACpB,WAAO;AAAA,EACT;AAAA,EAEA,IAAc,cAAc;AAC1B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASU,QAAiB;AACzB,UAAM,OAAO,MAAM,MAAM;AACzB,SAAK,YAAY;AAEjB,SAAK,UAAU,OAAO,OAAO,iBAAiB,KAAK,EAAE,EAAE,cAAc,KAAK;AAC1E,QAAI,CAAC,KAAK,GAAG,UAAU,SAAS,QAAQ,EAAG,QAAO;AAElD,UAAM,SAAS,KAAK,UAAU,IAAI;AAClC,WAAO,UAAU,QAAQ,kBAAkB,kBAAkB;AAC7D,WAAO,iBAA8B,iBAAiB,EAAE,QAAQ,CAAC,SAAS;AACxE,WAAK,cAAc,KAAK,QAAQ;AAAA,IAClC,CAAC;AACD,UAAM,SAAS,SAAS,cAAc,KAAK;AAC3C,WAAO,YAAY;AACnB,WAAO,OAAO,MAAM,MAAM;AAC1B,WAAO;AAAA,EACT;AACF;AAjCa,SASJ,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -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/mapView.ts
|
|
9
9
|
var OPENFREEMAP = "https://tiles.openfreemap.org/styles/";
|
|
@@ -14,7 +14,14 @@ var _defaults = {
|
|
|
14
14
|
zoom: 1,
|
|
15
15
|
mapOptions: {}
|
|
16
16
|
};
|
|
17
|
-
var
|
|
17
|
+
var isLngLat = (value) => value.length === 2 && value.every(Number.isFinite) && Math.abs(value[1]) <= 90;
|
|
18
|
+
var lngLat = (el) => {
|
|
19
|
+
const value = el.dataset.lngLat.split(",").map((part) => part.trim() ? Number(part) : NaN);
|
|
20
|
+
if (isLngLat(value)) return value;
|
|
21
|
+
console.warn(`MapView skipped data-lng-lat="${el.dataset.lngLat}": expected "longitude,latitude".`, el);
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
var positioned = (elements) => elements.map((el) => [el, lngLat(el)]).filter((pair) => pair[1] !== null);
|
|
18
25
|
function arc([x0, y0], [x2, y2], steps = 32) {
|
|
19
26
|
const bow = x2 >= x0 ? 0.25 : -0.25;
|
|
20
27
|
const x1 = (x0 + x2) / 2 - (y2 - y0) * bow;
|
|
@@ -24,9 +31,11 @@ function arc([x0, y0], [x2, y2], steps = 32) {
|
|
|
24
31
|
return [u * u * x0 + 2 * u * t * x1 + t * t * x2, u * u * y0 + 2 * u * t * y1 + t * t * y2];
|
|
25
32
|
});
|
|
26
33
|
}
|
|
27
|
-
var
|
|
34
|
+
var ARROWS = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] };
|
|
35
|
+
var plainArrow = (e) => Utils.plainKey(e) ? ARROWS[e.key] : void 0;
|
|
36
|
+
var MapView = class extends Component {
|
|
28
37
|
constructor(el, options) {
|
|
29
|
-
super(el, options
|
|
38
|
+
super(el, options);
|
|
30
39
|
/** The MapLibre map. */
|
|
31
40
|
this.map = null;
|
|
32
41
|
/** The MapLibre markers made from `.map-marker` children, in order. */
|
|
@@ -38,11 +47,27 @@ var MapView = class _MapView extends Component {
|
|
|
38
47
|
this._styleReady = false;
|
|
39
48
|
this._dark = false;
|
|
40
49
|
this._location = null;
|
|
41
|
-
this._media = null;
|
|
42
50
|
this._observer = null;
|
|
43
51
|
// Looked up once: `move` fires every frame of a pan or zoom.
|
|
44
52
|
this._zoomIn = [];
|
|
45
53
|
this._zoomOut = [];
|
|
54
|
+
// The draggable marker a tap picked up, waiting for the tap that drops it.
|
|
55
|
+
this._picked = null;
|
|
56
|
+
// The marker whose drag just ended, so the click that follows does not pick it up.
|
|
57
|
+
this._dragged = null;
|
|
58
|
+
// Undoes what the map added to the page's markup, for destroy().
|
|
59
|
+
this._restore = [];
|
|
60
|
+
this._actions = {
|
|
61
|
+
"zoom-in": () => this.map.zoomIn(),
|
|
62
|
+
"zoom-out": () => this.map.zoomOut(),
|
|
63
|
+
compass: () => this.map.resetNorthPitch(),
|
|
64
|
+
locate: (button) => this._locate(button),
|
|
65
|
+
fullscreen: () => this._toggleFullscreen(),
|
|
66
|
+
"pan-up": () => this._pan(0, -1),
|
|
67
|
+
"pan-down": () => this._pan(0, 1),
|
|
68
|
+
"pan-left": () => this._pan(-1, 0),
|
|
69
|
+
"pan-right": () => this._pan(1, 0)
|
|
70
|
+
};
|
|
46
71
|
this._handleStyleLoad = () => {
|
|
47
72
|
this._styleReady = true;
|
|
48
73
|
for (const overlay of this._overlays.values()) overlay.draw();
|
|
@@ -68,39 +93,19 @@ var MapView = class _MapView extends Component {
|
|
|
68
93
|
this._handleClick = (e) => {
|
|
69
94
|
const target = e.target;
|
|
70
95
|
const button = target.closest(".map-controls [data-action]");
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
else if (action === "zoom-out") this.map.zoomOut();
|
|
74
|
-
else if (action === "compass") this.map.resetNorthPitch();
|
|
75
|
-
else if (action === "locate") this._locate(button);
|
|
76
|
-
else if (action === "fullscreen") {
|
|
77
|
-
if (document.fullscreenElement === this.el) document.exitFullscreen();
|
|
78
|
-
else this.el.requestFullscreen();
|
|
79
|
-
} else {
|
|
80
|
-
const marker = target.closest(".map-marker");
|
|
81
|
-
if (this._markerPopups.has(marker)) this._toggle(marker);
|
|
82
|
-
}
|
|
96
|
+
if (button) this._actions[button.dataset.action]?.(button);
|
|
97
|
+
else this._tapMarker(target.closest(".map-marker"));
|
|
83
98
|
};
|
|
84
99
|
// A click on the map closes marker popups, but not the one being toggled.
|
|
85
100
|
this._handleMapClick = (e) => {
|
|
86
101
|
const target = e.originalEvent.target;
|
|
102
|
+
this._drop(target, e.lngLat);
|
|
87
103
|
for (const [marker, popup] of this._markerPopups) {
|
|
88
104
|
if (!marker.contains(target) && !popup.getElement()?.contains(target)) popup.remove();
|
|
89
105
|
}
|
|
90
106
|
};
|
|
91
107
|
this._handleKeydown = (e) => {
|
|
92
|
-
if (e.key
|
|
93
|
-
for (const popup of this._popups) {
|
|
94
|
-
if (popup.getElement()?.contains(e.target)) {
|
|
95
|
-
e.preventDefault();
|
|
96
|
-
popup.remove();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
this.el["Expressive_MapView"] = this;
|
|
101
|
-
this.options = {
|
|
102
|
-
..._MapView.defaults,
|
|
103
|
-
...options
|
|
108
|
+
if (e.key === "Escape") this._escape(e);
|
|
104
109
|
};
|
|
105
110
|
const lib = this.options.maplibregl;
|
|
106
111
|
if (!lib) {
|
|
@@ -123,48 +128,34 @@ var MapView = class _MapView extends Component {
|
|
|
123
128
|
this.map.on("click", this._handleMapClick);
|
|
124
129
|
const children = this._children.filter((child) => child instanceof HTMLElement);
|
|
125
130
|
const claimed = /* @__PURE__ */ new Set();
|
|
126
|
-
for (const marker of children.filter((child) => child.matches(".map-marker[data-lng-lat]"))) {
|
|
131
|
+
for (const [marker, at] of positioned(children.filter((child) => child.matches(".map-marker[data-lng-lat]")))) {
|
|
127
132
|
const target = marker.hasAttribute("aria-controls") ? Utils.getElementById(marker, marker.getAttribute("aria-controls")) : null;
|
|
128
133
|
const popup = target?.parentElement === el && target.matches(".map-popup") ? target : null;
|
|
129
134
|
if (popup) claimed.add(popup);
|
|
130
|
-
this._addMarker(marker, popup);
|
|
135
|
+
this._addMarker(marker, popup, at);
|
|
131
136
|
}
|
|
132
|
-
for (const popup of children.filter((child) => child.matches(".map-popup[data-lng-lat]") && !claimed.has(child))) {
|
|
133
|
-
this._popup(popup, 0).setLngLat(
|
|
137
|
+
for (const [popup, at] of positioned(children.filter((child) => child.matches(".map-popup[data-lng-lat]") && !claimed.has(child)))) {
|
|
138
|
+
this._popup(popup, 0).setLngLat(at).addTo(this.map);
|
|
134
139
|
}
|
|
140
|
+
const { signal } = this._events;
|
|
135
141
|
if (this._themed()) {
|
|
136
|
-
|
|
137
|
-
this._media.addEventListener("change", this._handleScheme);
|
|
142
|
+
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", this._handleScheme, { signal });
|
|
138
143
|
this._observer = new MutationObserver(this._handleScheme);
|
|
139
144
|
this._observer.observe(document.documentElement, { attributes: true, attributeFilter: ["theme"], subtree: true });
|
|
140
145
|
}
|
|
141
146
|
for (const button of this._buttons("fullscreen")) button.hidden = !document.fullscreenEnabled;
|
|
142
|
-
document.addEventListener("fullscreenchange", this._handleFullscreen);
|
|
143
|
-
el.addEventListener("click", this._handleClick);
|
|
144
|
-
el.addEventListener("keydown", this._handleKeydown);
|
|
147
|
+
document.addEventListener("fullscreenchange", this._handleFullscreen, { signal });
|
|
148
|
+
el.addEventListener("click", this._handleClick, { signal });
|
|
149
|
+
el.addEventListener("keydown", this._handleKeydown, { signal });
|
|
145
150
|
this._sync();
|
|
146
151
|
}
|
|
147
152
|
static get defaults() {
|
|
148
153
|
return _defaults;
|
|
149
154
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Initializes instances of MapView.
|
|
152
|
-
* @param els HTML elements.
|
|
153
|
-
* @param options Component options.
|
|
154
|
-
*/
|
|
155
|
-
static init(els, options = {}) {
|
|
156
|
-
return super.init(els, options, _MapView);
|
|
157
|
-
}
|
|
158
|
-
static getInstance(el) {
|
|
159
|
-
return el["Expressive_MapView"];
|
|
160
|
-
}
|
|
161
155
|
destroy() {
|
|
162
|
-
|
|
156
|
+
super.destroy();
|
|
163
157
|
if (!this.map) return;
|
|
164
|
-
this.
|
|
165
|
-
this.el.removeEventListener("keydown", this._handleKeydown);
|
|
166
|
-
document.removeEventListener("fullscreenchange", this._handleFullscreen);
|
|
167
|
-
this._media?.removeEventListener("change", this._handleScheme);
|
|
158
|
+
this._releaseMarkers();
|
|
168
159
|
this._observer?.disconnect();
|
|
169
160
|
for (const overlay of this._overlays.values()) overlay.off?.();
|
|
170
161
|
for (const popup of this._popups) popup.remove();
|
|
@@ -210,7 +201,7 @@ var MapView = class _MapView extends Component {
|
|
|
210
201
|
const zoomIn = async (e) => {
|
|
211
202
|
const [feature] = e.features;
|
|
212
203
|
const zoom = await this.map.getSource(id).getClusterExpansionZoom(feature.properties.cluster_id);
|
|
213
|
-
this.map
|
|
204
|
+
this.map?.easeTo({ center: feature.geometry.coordinates, zoom });
|
|
214
205
|
};
|
|
215
206
|
const pointer = () => {
|
|
216
207
|
this.map.getCanvas().style.cursor = "pointer";
|
|
@@ -218,6 +209,13 @@ var MapView = class _MapView extends Component {
|
|
|
218
209
|
const reset = () => {
|
|
219
210
|
this.map.getCanvas().style.cursor = "";
|
|
220
211
|
};
|
|
212
|
+
const listen = (method) => {
|
|
213
|
+
this.map[method]("click", clusters, zoomIn);
|
|
214
|
+
for (const layer of [clusters, points]) {
|
|
215
|
+
this.map[method]("mouseenter", layer, pointer);
|
|
216
|
+
this.map[method]("mouseleave", layer, reset);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
221
219
|
this._draw(id, {
|
|
222
220
|
draw: () => {
|
|
223
221
|
const color = options.color ?? this._color("var(--md-comp-map-cluster-color)");
|
|
@@ -262,19 +260,9 @@ var MapView = class _MapView extends Component {
|
|
|
262
260
|
paint: { "circle-color": color, "circle-radius": 6, "circle-stroke-width": 2, "circle-stroke-color": surface }
|
|
263
261
|
});
|
|
264
262
|
},
|
|
265
|
-
off: () =>
|
|
266
|
-
this.map.off("click", clusters, zoomIn);
|
|
267
|
-
for (const layer of [clusters, points]) {
|
|
268
|
-
this.map.off("mouseenter", layer, pointer);
|
|
269
|
-
this.map.off("mouseleave", layer, reset);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
263
|
+
off: () => listen("off")
|
|
272
264
|
});
|
|
273
|
-
|
|
274
|
-
for (const layer of [clusters, points]) {
|
|
275
|
-
this.map.on("mouseenter", layer, pointer);
|
|
276
|
-
this.map.on("mouseleave", layer, reset);
|
|
277
|
-
}
|
|
265
|
+
listen("on");
|
|
278
266
|
}
|
|
279
267
|
/** Removes a route, arcs or clusters added with this id. */
|
|
280
268
|
removeOverlay(id) {
|
|
@@ -312,16 +300,13 @@ var MapView = class _MapView extends Component {
|
|
|
312
300
|
this._overlays.set(id, overlay);
|
|
313
301
|
if (this._styleReady) overlay.draw();
|
|
314
302
|
}
|
|
315
|
-
_addMarker(element, content) {
|
|
303
|
+
_addMarker(element, content, at) {
|
|
316
304
|
const marker = new this.options.maplibregl.Marker({
|
|
317
305
|
element,
|
|
318
306
|
draggable: element.hasAttribute("data-draggable")
|
|
319
|
-
}).setLngLat(
|
|
320
|
-
marker.on("dragend", () =>
|
|
321
|
-
|
|
322
|
-
element.dataset.lngLat = `${lng},${lat}`;
|
|
323
|
-
element.dispatchEvent(new Event("change", { bubbles: true }));
|
|
324
|
-
});
|
|
307
|
+
}).setLngLat(at).addTo(this.map);
|
|
308
|
+
marker.on("dragend", () => this._moved(marker));
|
|
309
|
+
if (element.hasAttribute("data-draggable")) this._makeMovable(element, marker);
|
|
325
310
|
this.markers.push(marker);
|
|
326
311
|
if (!content) return;
|
|
327
312
|
element.setAttribute("aria-expanded", "false");
|
|
@@ -333,6 +318,68 @@ var MapView = class _MapView extends Component {
|
|
|
333
318
|
});
|
|
334
319
|
this._markerPopups.set(element, popup);
|
|
335
320
|
}
|
|
321
|
+
/** A marker moved: its `data-lng-lat` holds the new place, and it fires `change`. */
|
|
322
|
+
_moved(marker) {
|
|
323
|
+
const element = marker.getElement();
|
|
324
|
+
const { lng, lat } = marker.getLngLat();
|
|
325
|
+
element.dataset.lngLat = `${lng},${lat}`;
|
|
326
|
+
element.dispatchEvent(new Event("change", { bubbles: true }));
|
|
327
|
+
}
|
|
328
|
+
// A drag is not the only way to move it (WCAG 2.5.7): a tap picks it up,
|
|
329
|
+
// and the arrow keys nudge it. A button is already a control; anything
|
|
330
|
+
// else becomes one, and destroy() takes that back off.
|
|
331
|
+
_makeMovable(element, marker) {
|
|
332
|
+
const added = element instanceof HTMLButtonElement ? [] : ["role", "tabindex"].filter((name) => !element.hasAttribute(name));
|
|
333
|
+
if (added.includes("role")) element.setAttribute("role", "button");
|
|
334
|
+
if (added.includes("tabindex")) element.tabIndex = 0;
|
|
335
|
+
element.setAttribute("aria-pressed", "false");
|
|
336
|
+
this._restore.push(() => ["aria-pressed", ...added].forEach((name) => element.removeAttribute(name)));
|
|
337
|
+
element.addEventListener("keydown", (e) => this._nudge(e, marker), { signal: this._events.signal });
|
|
338
|
+
marker.on("dragstart", () => this._dragged = element);
|
|
339
|
+
marker.on("dragend", () => setTimeout(() => this._dragged = null));
|
|
340
|
+
}
|
|
341
|
+
/** Takes back the attributes `_makeMovable()` added. Destroy removes its listeners. */
|
|
342
|
+
_releaseMarkers() {
|
|
343
|
+
this._restore.splice(0).forEach((undo) => undo());
|
|
344
|
+
this._picked = null;
|
|
345
|
+
}
|
|
346
|
+
/** The arrow keys move a focused draggable marker 10px, and the map stays put. */
|
|
347
|
+
_nudge(e, marker) {
|
|
348
|
+
const step = plainArrow(e);
|
|
349
|
+
if (!step) return;
|
|
350
|
+
e.preventDefault();
|
|
351
|
+
e.stopPropagation();
|
|
352
|
+
const at = this.map.project(marker.getLngLat());
|
|
353
|
+
marker.setLngLat(this.map.unproject([at.x + step[0] * 10, at.y + step[1] * 10]));
|
|
354
|
+
this._moved(marker);
|
|
355
|
+
}
|
|
356
|
+
/** Picks a marker up, or puts down the one already picked up. */
|
|
357
|
+
_pick(element) {
|
|
358
|
+
this._picked?.setAttribute("aria-pressed", "false");
|
|
359
|
+
this._picked = element;
|
|
360
|
+
element?.setAttribute("aria-pressed", "true");
|
|
361
|
+
}
|
|
362
|
+
// A tap on a draggable marker picks it up, or puts it back down; the click
|
|
363
|
+
// that ends a drag does neither.
|
|
364
|
+
_tapMarker(element) {
|
|
365
|
+
if (element?.hasAttribute("data-draggable")) this._tapMovable(element);
|
|
366
|
+
else if (this._markerPopups.has(element)) this._toggle(element);
|
|
367
|
+
}
|
|
368
|
+
_tapMovable(element) {
|
|
369
|
+
if (this._dragged !== element) this._pick(this._picked === element ? null : element);
|
|
370
|
+
}
|
|
371
|
+
/** A third of the map's width or height in a direction. */
|
|
372
|
+
_pan(x, y) {
|
|
373
|
+
const { width, height } = this.el.getBoundingClientRect();
|
|
374
|
+
this.map.panBy([x * width / 3, y * height / 3]);
|
|
375
|
+
}
|
|
376
|
+
// Either can be refused (an iframe without allowfullscreen, say). The
|
|
377
|
+
// button state follows fullscreenchange, so there is nothing to undo.
|
|
378
|
+
_toggleFullscreen() {
|
|
379
|
+
const request = document.fullscreenElement === this.el ? document.exitFullscreen() : this.el.requestFullscreen();
|
|
380
|
+
request.catch(() => {
|
|
381
|
+
});
|
|
382
|
+
}
|
|
336
383
|
_popup(content, offset) {
|
|
337
384
|
const popup = new this.options.maplibregl.Popup({ closeOnClick: false, maxWidth: "none", offset }).setDOMContent(content);
|
|
338
385
|
this._popups.push(popup);
|
|
@@ -390,9 +437,32 @@ var MapView = class _MapView extends Component {
|
|
|
390
437
|
_style() {
|
|
391
438
|
return this._themed() ? this.options.style[this._dark ? "dark" : "light"] : this.options.style;
|
|
392
439
|
}
|
|
440
|
+
// A tap on the map, not on a marker, puts a picked-up marker there.
|
|
441
|
+
_drop(target, at) {
|
|
442
|
+
if (!this._picked || target.closest?.(".map-marker")) return;
|
|
443
|
+
const marker = this.markers.find((m) => m.getElement() === this._picked);
|
|
444
|
+
marker.setLngLat(at);
|
|
445
|
+
this._moved(marker);
|
|
446
|
+
this._pick(null);
|
|
447
|
+
}
|
|
448
|
+
// Escape puts down a picked-up marker first, then closes a popup.
|
|
449
|
+
_escape(e) {
|
|
450
|
+
if (this._picked) {
|
|
451
|
+
e.preventDefault();
|
|
452
|
+
this._pick(null);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
for (const popup of this._popups) {
|
|
456
|
+
if (popup.getElement()?.contains(e.target)) {
|
|
457
|
+
e.preventDefault();
|
|
458
|
+
popup.remove();
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
393
462
|
};
|
|
463
|
+
MapView.key = "Expressive_MapView";
|
|
394
464
|
|
|
395
465
|
export {
|
|
396
466
|
MapView
|
|
397
467
|
};
|
|
398
|
-
//# sourceMappingURL=chunk-
|
|
468
|
+
//# sourceMappingURL=chunk-7NLUI3RR.mjs.map
|