@expressivecss/expressive 0.15.0 → 0.17.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 +1807 -1
- package/README.md +9 -8
- package/dist/css/expressive.css +19176 -11958
- 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-26VUH75M.mjs +102 -0
- package/dist/js/chunks/chunk-26VUH75M.mjs.map +7 -0
- package/dist/js/chunks/chunk-2LFCOGC3.mjs +233 -0
- package/dist/js/chunks/chunk-2LFCOGC3.mjs.map +7 -0
- package/dist/js/chunks/{chunk-DXGRXYYL.mjs → chunk-36GELQGX.mjs} +29 -46
- package/dist/js/chunks/chunk-36GELQGX.mjs.map +7 -0
- package/dist/js/chunks/{chunk-74MXKKLN.mjs → chunk-3FKWIRHW.mjs} +15 -29
- package/dist/js/chunks/chunk-3FKWIRHW.mjs.map +7 -0
- package/dist/js/chunks/chunk-3KF65KGL.mjs +209 -0
- package/dist/js/chunks/chunk-3KF65KGL.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KVJAVDBC.mjs → chunk-3KLZRQZI.mjs} +88 -116
- package/dist/js/chunks/chunk-3KLZRQZI.mjs.map +7 -0
- package/dist/js/chunks/{chunk-CK2XCICY.mjs → chunk-3XORNED5.mjs} +3 -11
- package/dist/js/chunks/chunk-3XORNED5.mjs.map +7 -0
- package/dist/js/chunks/chunk-4WBGAQN3.mjs +113 -0
- package/dist/js/chunks/chunk-4WBGAQN3.mjs.map +7 -0
- package/dist/js/chunks/{chunk-FM5CZOUB.mjs → chunk-5F4URJHL.mjs} +19 -30
- package/dist/js/chunks/chunk-5F4URJHL.mjs.map +7 -0
- package/dist/js/chunks/chunk-67UNY7RH.mjs +299 -0
- package/dist/js/chunks/chunk-67UNY7RH.mjs.map +7 -0
- package/dist/js/chunks/chunk-7CXNATJS.mjs +97 -0
- package/dist/js/chunks/chunk-7CXNATJS.mjs.map +7 -0
- package/dist/js/chunks/{chunk-UETTGDLI.mjs → chunk-7X44MKEQ.mjs} +43 -48
- package/dist/js/chunks/chunk-7X44MKEQ.mjs.map +7 -0
- package/dist/js/chunks/chunk-7ZAMOMGY.mjs +440 -0
- package/dist/js/chunks/chunk-7ZAMOMGY.mjs.map +7 -0
- package/dist/js/chunks/chunk-AEG6LOAJ.mjs +54 -0
- package/dist/js/chunks/chunk-AEG6LOAJ.mjs.map +7 -0
- package/dist/js/chunks/chunk-AQNFCJJ5.mjs +135 -0
- package/dist/js/chunks/chunk-AQNFCJJ5.mjs.map +7 -0
- package/dist/js/chunks/chunk-B55LWKBM.mjs +75 -0
- package/dist/js/chunks/chunk-B55LWKBM.mjs.map +7 -0
- package/dist/js/chunks/chunk-BB5VXYXT.mjs +28 -0
- package/dist/js/chunks/chunk-BB5VXYXT.mjs.map +7 -0
- package/dist/js/chunks/chunk-BDATLH3H.mjs +108 -0
- package/dist/js/chunks/chunk-BDATLH3H.mjs.map +7 -0
- package/dist/js/chunks/chunk-CWMQOT4O.mjs +232 -0
- package/dist/js/chunks/chunk-CWMQOT4O.mjs.map +7 -0
- package/dist/js/chunks/chunk-CY2CTOVM.mjs +81 -0
- package/dist/js/chunks/chunk-CY2CTOVM.mjs.map +7 -0
- package/dist/js/chunks/{chunk-NUHMOAOY.mjs → chunk-DWA5UYLJ.mjs} +363 -218
- package/dist/js/chunks/chunk-DWA5UYLJ.mjs.map +7 -0
- package/dist/js/chunks/chunk-EB2V4OKL.mjs +79 -0
- package/dist/js/chunks/chunk-EB2V4OKL.mjs.map +7 -0
- package/dist/js/chunks/chunk-EWO662ZC.mjs +188 -0
- package/dist/js/chunks/chunk-EWO662ZC.mjs.map +7 -0
- package/dist/js/chunks/{chunk-ZX6M7SWO.mjs → chunk-F7LAKFMX.mjs} +320 -141
- package/dist/js/chunks/chunk-F7LAKFMX.mjs.map +7 -0
- package/dist/js/chunks/{chunk-L27Q6ZMI.mjs → chunk-FNIIH2LU.mjs} +20 -33
- package/dist/js/chunks/chunk-FNIIH2LU.mjs.map +7 -0
- package/dist/js/chunks/chunk-GE3YMFS6.mjs +15 -0
- package/dist/js/chunks/chunk-GE3YMFS6.mjs.map +7 -0
- package/dist/js/chunks/chunk-GFWYMWYN.mjs +125 -0
- package/dist/js/chunks/chunk-GFWYMWYN.mjs.map +7 -0
- package/dist/js/chunks/chunk-GNRSYMVH.mjs +1 -0
- package/dist/js/chunks/chunk-H5ISU45X.mjs +87 -0
- package/dist/js/chunks/chunk-H5ISU45X.mjs.map +7 -0
- package/dist/js/chunks/{chunk-GJL6GCIU.mjs → chunk-H6YIKFAQ.mjs} +311 -186
- package/dist/js/chunks/chunk-H6YIKFAQ.mjs.map +7 -0
- package/dist/js/chunks/{chunk-BGZLF6JZ.mjs → chunk-HEH7E3KO.mjs} +155 -35
- package/dist/js/chunks/chunk-HEH7E3KO.mjs.map +7 -0
- package/dist/js/chunks/chunk-HQRLBTNM.mjs +152 -0
- package/dist/js/chunks/chunk-HQRLBTNM.mjs.map +7 -0
- package/dist/js/chunks/chunk-I2F7MLUU.mjs +137 -0
- package/dist/js/chunks/chunk-I2F7MLUU.mjs.map +7 -0
- package/dist/js/chunks/chunk-IQOTGGHX.mjs +797 -0
- package/dist/js/chunks/chunk-IQOTGGHX.mjs.map +7 -0
- package/dist/js/chunks/chunk-JH3YWKA6.mjs +225 -0
- package/dist/js/chunks/chunk-JH3YWKA6.mjs.map +7 -0
- package/dist/js/chunks/chunk-JOLJAYIJ.mjs +7 -0
- package/dist/js/chunks/chunk-JOLJAYIJ.mjs.map +7 -0
- package/dist/js/chunks/{chunk-VGNYF6FB.mjs → chunk-KOTGMCMI.mjs} +116 -24
- package/dist/js/chunks/chunk-KOTGMCMI.mjs.map +7 -0
- package/dist/js/chunks/{chunk-LQWUDNHZ.mjs → chunk-LC4O5LFS.mjs} +21 -45
- package/dist/js/chunks/chunk-LC4O5LFS.mjs.map +7 -0
- package/dist/js/chunks/chunk-LEF33SCP.mjs +127 -0
- package/dist/js/chunks/chunk-LEF33SCP.mjs.map +7 -0
- package/dist/js/chunks/{chunk-PDG64UHF.mjs → chunk-LFORZRPH.mjs} +21 -23
- package/dist/js/chunks/chunk-LFORZRPH.mjs.map +7 -0
- package/dist/js/chunks/chunk-LWLNV5EC.mjs +451 -0
- package/dist/js/chunks/chunk-LWLNV5EC.mjs.map +7 -0
- package/dist/js/chunks/chunk-LXRHUQAX.mjs +491 -0
- package/dist/js/chunks/chunk-LXRHUQAX.mjs.map +7 -0
- package/dist/js/chunks/{chunk-SFI2U4YW.mjs → chunk-MA2SZZFB.mjs} +82 -111
- package/dist/js/chunks/chunk-MA2SZZFB.mjs.map +7 -0
- package/dist/js/chunks/chunk-MDBZAMIV.mjs +121 -0
- package/dist/js/chunks/chunk-MDBZAMIV.mjs.map +7 -0
- package/dist/js/chunks/chunk-NODZ5VAD.mjs +75 -0
- package/dist/js/chunks/chunk-NODZ5VAD.mjs.map +7 -0
- package/dist/js/chunks/chunk-O2WJB6TH.mjs +365 -0
- package/dist/js/chunks/chunk-O2WJB6TH.mjs.map +7 -0
- package/dist/js/chunks/chunk-PCABY5BN.mjs +35 -0
- package/dist/js/chunks/chunk-PCABY5BN.mjs.map +7 -0
- package/dist/js/chunks/chunk-PWKYVMND.mjs +120 -0
- package/dist/js/chunks/chunk-PWKYVMND.mjs.map +7 -0
- package/dist/js/chunks/{chunk-SMY7GJSS.mjs → chunk-QHZZT7YO.mjs} +66 -38
- package/dist/js/chunks/chunk-QHZZT7YO.mjs.map +7 -0
- package/dist/js/chunks/chunk-QND56EW2.mjs +439 -0
- package/dist/js/chunks/chunk-QND56EW2.mjs.map +7 -0
- package/dist/js/chunks/chunk-QNODAANY.mjs +376 -0
- package/dist/js/chunks/chunk-QNODAANY.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KHXZ2A4K.mjs → chunk-QRO5FV3I.mjs} +156 -73
- package/dist/js/chunks/chunk-QRO5FV3I.mjs.map +7 -0
- package/dist/js/chunks/chunk-R7A7JRC5.mjs +440 -0
- package/dist/js/chunks/chunk-R7A7JRC5.mjs.map +7 -0
- package/dist/js/chunks/chunk-RKG2CBFE.mjs +74 -0
- package/dist/js/chunks/chunk-RKG2CBFE.mjs.map +7 -0
- package/dist/js/chunks/{chunk-XAEAEHIX.mjs → chunk-RSNS5OYS.mjs} +38 -25
- package/dist/js/chunks/chunk-RSNS5OYS.mjs.map +7 -0
- package/dist/js/chunks/{chunk-X4ISMKE2.mjs → chunk-RUDYMEJ3.mjs} +7 -6
- package/dist/js/chunks/chunk-RUDYMEJ3.mjs.map +7 -0
- package/dist/js/chunks/chunk-STJR62SU.mjs +161 -0
- package/dist/js/chunks/chunk-STJR62SU.mjs.map +7 -0
- package/dist/js/chunks/chunk-SUSD4UTN.mjs +220 -0
- package/dist/js/chunks/chunk-SUSD4UTN.mjs.map +7 -0
- package/dist/js/chunks/{chunk-5CEAOLUA.mjs → chunk-SYBOA5HC.mjs} +26 -48
- package/dist/js/chunks/chunk-SYBOA5HC.mjs.map +7 -0
- package/dist/js/chunks/chunk-T4MOBP3J.mjs +108 -0
- package/dist/js/chunks/chunk-T4MOBP3J.mjs.map +7 -0
- package/dist/js/chunks/chunk-TM7HPGTV.mjs +342 -0
- package/dist/js/chunks/chunk-TM7HPGTV.mjs.map +7 -0
- package/dist/js/chunks/{chunk-C6CHEWYP.mjs → chunk-TMQDZSDC.mjs} +71 -35
- package/dist/js/chunks/chunk-TMQDZSDC.mjs.map +7 -0
- package/dist/js/chunks/chunk-TVSX5YA2.mjs +48 -0
- package/dist/js/chunks/chunk-TVSX5YA2.mjs.map +7 -0
- package/dist/js/chunks/chunk-UHO5CV6K.mjs +80 -0
- package/dist/js/chunks/chunk-UHO5CV6K.mjs.map +7 -0
- package/dist/js/chunks/chunk-UKCNELUN.mjs +223 -0
- package/dist/js/chunks/chunk-UKCNELUN.mjs.map +7 -0
- package/dist/js/chunks/chunk-UKQK5GWR.mjs +167 -0
- package/dist/js/chunks/chunk-UKQK5GWR.mjs.map +7 -0
- package/dist/js/chunks/{chunk-TSZYSW7F.mjs → chunk-UTSLYQ65.mjs} +21 -48
- package/dist/js/chunks/chunk-UTSLYQ65.mjs.map +7 -0
- package/dist/js/chunks/chunk-VS5OJBOD.mjs +108 -0
- package/dist/js/chunks/chunk-VS5OJBOD.mjs.map +7 -0
- package/dist/js/chunks/chunk-VZMROW5A.mjs +759 -0
- package/dist/js/chunks/chunk-VZMROW5A.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-XB6Y7P5W.mjs +69 -0
- package/dist/js/chunks/chunk-XB6Y7P5W.mjs.map +7 -0
- package/dist/js/chunks/chunk-XDAMOMVD.mjs +226 -0
- package/dist/js/chunks/chunk-XDAMOMVD.mjs.map +7 -0
- package/dist/js/chunks/{chunk-WDK4T63U.mjs → chunk-XJPMW5SP.mjs} +247 -172
- package/dist/js/chunks/chunk-XJPMW5SP.mjs.map +7 -0
- package/dist/js/chunks/{chunk-KUFHW3DS.mjs → chunk-YKANQILZ.mjs} +16 -21
- package/dist/js/chunks/chunk-YKANQILZ.mjs.map +7 -0
- package/dist/js/chunks/chunk-YLZOJLDI.mjs +175 -0
- package/dist/js/chunks/chunk-YLZOJLDI.mjs.map +7 -0
- package/dist/js/chunks/chunk-ZK7YY322.mjs +514 -0
- package/dist/js/chunks/chunk-ZK7YY322.mjs.map +7 -0
- package/dist/js/expressive.cjs +10266 -3628
- package/dist/js/expressive.cjs.map +4 -4
- package/dist/js/expressive.js +10266 -3628
- package/dist/js/expressive.js.map +4 -4
- package/dist/js/expressive.min.js +23 -22
- package/dist/js/expressive.min.js.map +4 -4
- package/dist/js/expressive.mjs +181 -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 +8 -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 +5 -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 +7 -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 +12 -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 +131 -65
- 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 +3 -3
- package/dist/js/internal/components/lightbox.mjs +3 -3
- package/dist/js/internal/components/lineChart.mjs +41 -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 +60 -41
- 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 +5 -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 +14 -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 +6 -3
- package/dist/js/internal/core/formControl.mjs +12 -0
- package/dist/js/internal/core/formControl.mjs.map +7 -0
- package/dist/js/internal/core/imageURL.mjs +7 -0
- package/dist/js/internal/core/imageURL.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 +21 -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 +172 -69
- package/dist/types/behaviors/bottomSheets.d.ts +23 -5
- package/dist/types/behaviors/copy.d.ts +18 -0
- package/dist/types/behaviors/dataTables.d.ts +125 -0
- package/dist/types/behaviors/dialogs.d.ts +27 -1
- package/dist/types/behaviors/forms.d.ts +70 -4
- package/dist/types/behaviors/imageCompare.d.ts +13 -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 +53 -0
- package/dist/types/components/appBar.d.ts +5 -6
- package/dist/types/components/autocomplete.d.ts +105 -20
- 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 +16 -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 +80 -19
- package/dist/types/components/colorPicker.d.ts +56 -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 +60 -0
- package/dist/types/components/datepicker.d.ts +107 -56
- package/dist/types/components/expandingCard.d.ts +4 -6
- package/dist/types/components/funnelChart.d.ts +35 -0
- package/dist/types/components/heatmapChart.d.ts +42 -8
- package/dist/types/components/hoverCard.d.ts +59 -0
- package/dist/types/components/index.d.ts +16 -1
- package/dist/types/components/inputMask.d.ts +28 -0
- package/dist/types/components/keypad.d.ts +38 -6
- package/dist/types/components/lightbox.d.ts +14 -20
- package/dist/types/components/lineChart.d.ts +212 -12
- package/dist/types/components/loadingOverlay.d.ts +42 -0
- package/dist/types/components/mapView.d.ts +138 -27
- package/dist/types/components/menu.d.ts +74 -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 +22 -5
- package/dist/types/components/pieChart.d.ts +33 -9
- 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 -7
- package/dist/types/components/registry.d.ts +73 -3
- package/dist/types/components/richTextEditor.d.ts +45 -22
- 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 +44 -33
- package/dist/types/components/showMore.d.ts +53 -0
- package/dist/types/components/slider.d.ts +2 -15
- package/dist/types/components/snackbar.d.ts +68 -1
- package/dist/types/components/swipeActions.d.ts +81 -0
- package/dist/types/components/tabs.d.ts +92 -30
- package/dist/types/components/timepicker.d.ts +128 -27
- package/dist/types/components/tooltip.d.ts +57 -21
- 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 +49 -25
- package/dist/types/core/formControl.d.ts +21 -0
- package/dist/types/core/imageURL.d.ts +2 -0
- package/dist/types/core/spring.d.ts +20 -0
- package/dist/types/core/utils.d.ts +123 -72
- package/dist/types/modular.d.ts +33 -1
- package/dist/types/plugins/dockedDisplayPlugin.d.ts +10 -8
- package/dist/types/plugins/modalDisplayPlugin.d.ts +39 -0
- package/package.json +17 -13
- package/src/sass/README.md +27 -18
- package/src/sass/abstracts/_elevation.scss +13 -7
- package/src/sass/abstracts/_index.scss +1 -0
- package/src/sass/abstracts/_mixins.scss +864 -78
- package/src/sass/abstracts/_spring.scss +63 -0
- package/src/sass/abstracts/_variables.scss +64 -21
- package/src/sass/base/_fonts.scss +61 -48
- package/src/sass/base/_global.scss +104 -24
- package/src/sass/base/_index.scss +2 -0
- 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 +10 -19
- package/src/sass/components/_alert.scss +102 -0
- package/src/sass/components/_aura.scss +9 -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 +6 -5
- package/src/sass/components/_bar-chart.scss +31 -90
- package/src/sass/components/_bottom-sheet.scss +51 -16
- package/src/sass/components/_breadcrumb.scss +8 -7
- package/src/sass/components/_button-groups.scss +30 -63
- package/src/sass/components/_buttons.scss +137 -94
- package/src/sass/components/_calendar.scss +244 -0
- package/src/sass/components/_cards.scss +36 -44
- package/src/sass/components/_carousel.scss +37 -113
- package/src/sass/components/_cascader.scss +131 -0
- package/src/sass/components/_chips.scss +36 -46
- package/src/sass/components/_column-chart.scss +15 -26
- package/src/sass/components/_command-palette.scss +4 -7
- package/src/sass/components/_confetti.scss +1 -4
- package/src/sass/components/_countdown.scss +1 -1
- package/src/sass/components/_data-table.scss +172 -25
- package/src/sass/components/_datepicker.scss +54 -40
- package/src/sass/components/_description-list.scss +85 -0
- package/src/sass/components/_dialog.scss +48 -55
- 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 +21 -14
- package/src/sass/components/_fab-menu.scss +43 -39
- package/src/sass/components/_funnel-chart.scss +63 -0
- package/src/sass/components/_heatmap-chart.scss +114 -29
- package/src/sass/components/_icon-buttons.scss +8 -11
- 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 +20 -0
- package/src/sass/components/_keypad.scss +39 -19
- package/src/sass/components/_kpi.scss +6 -11
- package/src/sass/components/_lightbox.scss +24 -13
- package/src/sass/components/_line-chart.scss +9 -63
- 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 +37 -11
- package/src/sass/components/_marquee.scss +4 -3
- package/src/sass/components/_mega-menu.scss +128 -0
- package/src/sass/components/_menu.scss +146 -127
- package/src/sass/components/_menubar.scss +47 -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 +27 -35
- package/src/sass/components/_modal-display.scss +21 -0
- package/src/sass/components/_navbar.scss +45 -36
- package/src/sass/components/_navigation-bar.scss +12 -77
- package/src/sass/components/_navigation-rail.scss +161 -92
- package/src/sass/components/_org-chart.scss +192 -0
- package/src/sass/components/_page-footer.scss +2 -4
- package/src/sass/components/_pagination.scss +9 -27
- package/src/sass/components/_panes.scss +35 -42
- package/src/sass/components/_particles.scss +1 -4
- package/src/sass/components/_pie-chart.scss +86 -68
- package/src/sass/components/_popover.scss +18 -5
- package/src/sass/components/_progress.scss +183 -44
- 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 +40 -42
- package/src/sass/components/_radial-chart.scss +108 -46
- package/src/sass/components/_rich-text-editor.scss +2 -2
- package/src/sass/components/_sankey-chart.scss +91 -0
- package/src/sass/components/_scatter-chart.scss +144 -0
- package/src/sass/components/_scrim.scss +0 -2
- package/src/sass/components/_scrollspy.scss +0 -2
- package/src/sass/components/_search.scss +27 -26
- package/src/sass/components/_show-more.scss +8 -0
- package/src/sass/components/_side-sheet.scss +32 -51
- package/src/sass/components/_skeleton.scss +26 -19
- package/src/sass/components/_snackbar.scss +25 -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 -1
- package/src/sass/components/_swipe-actions.scss +71 -0
- package/src/sass/components/_table_of_contents.scss +1 -3
- package/src/sass/components/_tabs.scss +49 -46
- package/src/sass/components/_timeline.scss +12 -12
- package/src/sass/components/_timepicker.scss +111 -79
- package/src/sass/components/_toolbar.scss +36 -47
- package/src/sass/components/_tooltip.scss +25 -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 +7 -32
- package/src/sass/components/_treemap-chart.scss +98 -0
- package/src/sass/components/forms/_checkboxes.scss +107 -44
- 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 +16 -13
- package/src/sass/components/forms/_fieldset.scss +4 -7
- package/src/sass/components/forms/_file-input.scss +12 -8
- package/src/sass/components/forms/_index.scss +3 -1
- package/src/sass/components/forms/_input-fields.scss +271 -90
- package/src/sass/components/forms/_radio-buttons.scss +34 -117
- package/src/sass/components/forms/_rating.scss +2 -32
- package/src/sass/components/forms/_select.scss +198 -20
- package/src/sass/components/forms/_slider.scss +92 -98
- package/src/sass/components/forms/_switches.scss +62 -180
- 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 +0 -2
- package/src/sass/tokens/_theme.scss +10 -1
- package/src/sass/tokens/_vibrant.scss +2 -5
- package/src/sass/utilities/_defer-render.scss +17 -0
- package/src/sass/utilities/_helpers.scss +184 -27
- package/src/sass/utilities/_index.scss +1 -0
- 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 +46 -77
- package/src/sass/utilities/_z-depth.scss +7 -4
- package/dist/js/chunks/chunk-33QVDDGR.mjs +0 -270
- package/dist/js/chunks/chunk-33QVDDGR.mjs.map +0 -7
- package/dist/js/chunks/chunk-45FER6RI.mjs +0 -59
- package/dist/js/chunks/chunk-45FER6RI.mjs.map +0 -7
- package/dist/js/chunks/chunk-5CEAOLUA.mjs.map +0 -7
- package/dist/js/chunks/chunk-6VATUZC6.mjs +0 -295
- package/dist/js/chunks/chunk-6VATUZC6.mjs.map +0 -7
- package/dist/js/chunks/chunk-74MXKKLN.mjs.map +0 -7
- package/dist/js/chunks/chunk-AIURVCG6.mjs +0 -55
- package/dist/js/chunks/chunk-AIURVCG6.mjs.map +0 -7
- package/dist/js/chunks/chunk-BGZLF6JZ.mjs.map +0 -7
- package/dist/js/chunks/chunk-C6CHEWYP.mjs.map +0 -7
- package/dist/js/chunks/chunk-CK2XCICY.mjs.map +0 -7
- package/dist/js/chunks/chunk-CXXM2L4F.mjs +0 -344
- package/dist/js/chunks/chunk-CXXM2L4F.mjs.map +0 -7
- package/dist/js/chunks/chunk-DXGRXYYL.mjs.map +0 -7
- package/dist/js/chunks/chunk-FM5CZOUB.mjs.map +0 -7
- package/dist/js/chunks/chunk-GJL6GCIU.mjs.map +0 -7
- package/dist/js/chunks/chunk-K3HZMFMD.mjs +0 -135
- package/dist/js/chunks/chunk-K3HZMFMD.mjs.map +0 -7
- package/dist/js/chunks/chunk-KHXZ2A4K.mjs.map +0 -7
- package/dist/js/chunks/chunk-KQACNQ22.mjs +0 -7
- package/dist/js/chunks/chunk-KQACNQ22.mjs.map +0 -7
- package/dist/js/chunks/chunk-KUFHW3DS.mjs.map +0 -7
- package/dist/js/chunks/chunk-KVJAVDBC.mjs.map +0 -7
- package/dist/js/chunks/chunk-L27Q6ZMI.mjs.map +0 -7
- package/dist/js/chunks/chunk-LQWUDNHZ.mjs.map +0 -7
- package/dist/js/chunks/chunk-M372EDXD.mjs +0 -322
- package/dist/js/chunks/chunk-M372EDXD.mjs.map +0 -7
- package/dist/js/chunks/chunk-M3MURWMB.mjs +0 -82
- package/dist/js/chunks/chunk-M3MURWMB.mjs.map +0 -7
- package/dist/js/chunks/chunk-NUHMOAOY.mjs.map +0 -7
- package/dist/js/chunks/chunk-OWG3LMUL.mjs +0 -169
- package/dist/js/chunks/chunk-OWG3LMUL.mjs.map +0 -7
- package/dist/js/chunks/chunk-PD6HYHAE.mjs +0 -48
- package/dist/js/chunks/chunk-PD6HYHAE.mjs.map +0 -7
- package/dist/js/chunks/chunk-PDG64UHF.mjs.map +0 -7
- package/dist/js/chunks/chunk-PO3AXVR3.mjs +0 -546
- package/dist/js/chunks/chunk-PO3AXVR3.mjs.map +0 -7
- package/dist/js/chunks/chunk-QYGK36OG.mjs +0 -181
- package/dist/js/chunks/chunk-QYGK36OG.mjs.map +0 -7
- package/dist/js/chunks/chunk-SFI2U4YW.mjs.map +0 -7
- package/dist/js/chunks/chunk-SMY7GJSS.mjs.map +0 -7
- package/dist/js/chunks/chunk-TCCA2HDG.mjs +0 -414
- package/dist/js/chunks/chunk-TCCA2HDG.mjs.map +0 -7
- package/dist/js/chunks/chunk-TSZYSW7F.mjs.map +0 -7
- package/dist/js/chunks/chunk-UAZSDUVP.mjs +0 -90
- package/dist/js/chunks/chunk-UAZSDUVP.mjs.map +0 -7
- package/dist/js/chunks/chunk-UBRZZWRA.mjs +0 -127
- package/dist/js/chunks/chunk-UBRZZWRA.mjs.map +0 -7
- package/dist/js/chunks/chunk-UCOE7ZDL.mjs +0 -287
- package/dist/js/chunks/chunk-UCOE7ZDL.mjs.map +0 -7
- package/dist/js/chunks/chunk-UETTGDLI.mjs.map +0 -7
- package/dist/js/chunks/chunk-UNCRDLP6.mjs +0 -136
- package/dist/js/chunks/chunk-UNCRDLP6.mjs.map +0 -7
- package/dist/js/chunks/chunk-VGNYF6FB.mjs.map +0 -7
- package/dist/js/chunks/chunk-VGPGBNGL.mjs +0 -68
- package/dist/js/chunks/chunk-VGPGBNGL.mjs.map +0 -7
- package/dist/js/chunks/chunk-VKAUVTQY.mjs +0 -1
- package/dist/js/chunks/chunk-VM4FTS7L.mjs +0 -48
- package/dist/js/chunks/chunk-VM4FTS7L.mjs.map +0 -7
- package/dist/js/chunks/chunk-WDK4T63U.mjs.map +0 -7
- package/dist/js/chunks/chunk-WOCCTVUF.mjs +0 -185
- package/dist/js/chunks/chunk-WOCCTVUF.mjs.map +0 -7
- package/dist/js/chunks/chunk-WQYN5L4E.mjs +0 -107
- package/dist/js/chunks/chunk-WQYN5L4E.mjs.map +0 -7
- package/dist/js/chunks/chunk-X4ISMKE2.mjs.map +0 -7
- package/dist/js/chunks/chunk-XAEAEHIX.mjs.map +0 -7
- package/dist/js/chunks/chunk-ZX6M7SWO.mjs.map +0 -7
- /package/dist/js/chunks/{chunk-VKAUVTQY.mjs.map → chunk-GNRSYMVH.mjs.map} +0 -0
|
@@ -1,62 +1,86 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Utils
|
|
3
|
-
} from "./chunk-M372EDXD.mjs";
|
|
4
1
|
import {
|
|
5
2
|
Component
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EB2V4OKL.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Utils,
|
|
6
|
+
afterFormReset
|
|
7
|
+
} from "./chunk-67UNY7RH.mjs";
|
|
7
8
|
|
|
8
9
|
// src/ts/components/richTextEditor.ts
|
|
9
10
|
var _defaults = {
|
|
10
11
|
Editor: null,
|
|
11
12
|
extensions: []
|
|
12
13
|
};
|
|
14
|
+
var command = (commands, name) => Reflect.get(commands, name);
|
|
13
15
|
var NAMING = ["aria-label", "aria-labelledby", "aria-describedby"];
|
|
14
|
-
var RichTextEditor = class
|
|
16
|
+
var RichTextEditor = class extends Component {
|
|
15
17
|
constructor(el, options) {
|
|
16
|
-
super(el, options
|
|
17
|
-
/**
|
|
18
|
+
super(el, options);
|
|
19
|
+
/**
|
|
20
|
+
* The Tiptap editor, with the full type of the `Editor` passed to the
|
|
21
|
+
* constructor; `init()` and `getInstance()` see the `RichTextEditorInstance`
|
|
22
|
+
* subset.
|
|
23
|
+
*/
|
|
18
24
|
this.editor = null;
|
|
19
25
|
/** The element the editor is mounted in. */
|
|
20
26
|
this.content = null;
|
|
21
27
|
this._actions = /* @__PURE__ */ new Map();
|
|
22
28
|
this._label = null;
|
|
29
|
+
this._required = false;
|
|
30
|
+
this._form = null;
|
|
23
31
|
this._handleClick = (e) => {
|
|
24
32
|
const button = e.target.closest("button[data-command]");
|
|
25
33
|
const action = this._actions.get(button);
|
|
26
|
-
if (action && !button.disabled) this.editor.chain().focus()
|
|
34
|
+
if (action && !button.disabled) command(this.editor.chain().focus(), action.command)(action.attributes).run();
|
|
27
35
|
};
|
|
28
36
|
this._handleLabelClick = () => {
|
|
29
37
|
this.editor.chain().focus().run();
|
|
30
38
|
};
|
|
39
|
+
this._handleSubmit = (e) => {
|
|
40
|
+
if (this._skipsValidation(e) || !this.editor.isEditable || !this.editor.isEmpty) return;
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
e.stopImmediatePropagation();
|
|
43
|
+
this.editor.chain().focus().run();
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The form restores the textarea after the reset event, so the editor reads
|
|
47
|
+
* it back a task later. Without this the editor kept the typed text while the
|
|
48
|
+
* form submitted the default. No update is emitted, so a reset fires no input.
|
|
49
|
+
*/
|
|
50
|
+
this._handleReset = () => {
|
|
51
|
+
if (!this.editor) return;
|
|
52
|
+
const commands = this.editor.commands;
|
|
53
|
+
commands.setContent(this.textarea.value, { emitUpdate: false });
|
|
54
|
+
};
|
|
31
55
|
this._handleUpdate = () => {
|
|
32
56
|
this.textarea.value = this.editor.isEmpty ? "" : this.editor.getHTML();
|
|
33
57
|
this.textarea.dispatchEvent(new Event("input", { bubbles: true }));
|
|
34
58
|
};
|
|
35
59
|
this._handleTransaction = () => {
|
|
36
60
|
const can = this.editor.isEditable && this.editor.can();
|
|
37
|
-
for (const [button, { command, attributes, active }] of this._actions) {
|
|
38
|
-
button.disabled = !can || !(
|
|
61
|
+
for (const [button, { command: name, attributes, active }] of this._actions) {
|
|
62
|
+
button.disabled = !can || !(name in this.editor.commands) || !command(can, name)(attributes);
|
|
39
63
|
if (!active) continue;
|
|
40
64
|
const on = this.editor.isActive(active, attributes);
|
|
41
65
|
button.setAttribute("aria-pressed", String(on));
|
|
42
66
|
button.classList.toggle("active", on);
|
|
43
67
|
}
|
|
44
68
|
};
|
|
45
|
-
this.el["Expressive_RichTextEditor"] = this;
|
|
46
|
-
this.options = {
|
|
47
|
-
..._RichTextEditor.defaults,
|
|
48
|
-
...options
|
|
49
|
-
};
|
|
50
69
|
this.textarea = el.querySelector(":scope > textarea");
|
|
51
70
|
if (!this.textarea || !this.options.Editor) {
|
|
52
71
|
console.error("RichTextEditor needs a <textarea> child and the Tiptap Editor class in options.Editor.");
|
|
53
72
|
return;
|
|
54
73
|
}
|
|
55
74
|
for (const button of el.querySelectorAll("button[data-command]")) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
const command2 = button.dataset.command;
|
|
76
|
+
let attributes2;
|
|
77
|
+
try {
|
|
78
|
+
attributes2 = button.dataset.attributes ? JSON.parse(button.dataset.attributes) : void 0;
|
|
79
|
+
} catch {
|
|
80
|
+
console.warn("RichTextEditor ignored invalid JSON in data-attributes:", button.dataset.attributes);
|
|
81
|
+
}
|
|
82
|
+
const active = command2.startsWith("toggle") ? command2[6].toLowerCase() + command2.slice(7) : void 0;
|
|
83
|
+
this._actions.set(button, { command: command2, attributes: attributes2, active });
|
|
60
84
|
}
|
|
61
85
|
const attributes = { role: "textbox", "aria-multiline": "true" };
|
|
62
86
|
for (const name of NAMING) {
|
|
@@ -67,58 +91,62 @@ var RichTextEditor = class _RichTextEditor extends Component {
|
|
|
67
91
|
if (this._label && !attributes["aria-labelledby"]) {
|
|
68
92
|
if (!this._label.id) this._label.id = `rich-text-editor-label-${Utils.guid()}`;
|
|
69
93
|
attributes["aria-labelledby"] = this._label.id;
|
|
70
|
-
this._label.addEventListener("click", this._handleLabelClick);
|
|
94
|
+
this._label.addEventListener("click", this._handleLabelClick, { signal: this._events.signal });
|
|
95
|
+
}
|
|
96
|
+
this._required = this.textarea.required;
|
|
97
|
+
this._form = this.textarea.form;
|
|
98
|
+
if (this._required) {
|
|
99
|
+
attributes["aria-required"] = "true";
|
|
100
|
+
this.textarea.required = false;
|
|
101
|
+
this._form?.addEventListener("submit", this._handleSubmit, { capture: true, signal: this._events.signal });
|
|
71
102
|
}
|
|
103
|
+
afterFormReset(this.textarea, this._handleReset, this._events.signal);
|
|
72
104
|
this.content = document.createElement("div");
|
|
73
105
|
this.content.className = "rich-text-editor-content";
|
|
74
106
|
this.textarea.after(this.content);
|
|
75
107
|
this.textarea.hidden = true;
|
|
76
|
-
|
|
108
|
+
const config = {
|
|
77
109
|
element: this.content,
|
|
78
110
|
extensions: this.options.extensions,
|
|
79
111
|
content: this.textarea.value,
|
|
80
112
|
editable: !(this.textarea.disabled || this.textarea.readOnly),
|
|
81
113
|
editorProps: { attributes }
|
|
82
|
-
}
|
|
114
|
+
};
|
|
115
|
+
this.editor = new this.options.Editor(config);
|
|
83
116
|
this.editor.on("update", this._handleUpdate);
|
|
84
117
|
this.editor.on("transaction", this._handleTransaction);
|
|
85
118
|
this._handleTransaction();
|
|
86
|
-
el.addEventListener("click", this._handleClick);
|
|
87
|
-
}
|
|
88
|
-
static get defaults() {
|
|
89
|
-
return _defaults;
|
|
119
|
+
el.addEventListener("click", this._handleClick, { signal: this._events.signal });
|
|
90
120
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Initializes instances of RichTextEditor.
|
|
93
|
-
* @param els HTML elements.
|
|
94
|
-
* @param options Component options.
|
|
95
|
-
*/
|
|
96
121
|
static init(els, options = {}) {
|
|
97
|
-
return super.init(els, options
|
|
122
|
+
return super.init.call(this, els, options);
|
|
98
123
|
}
|
|
99
|
-
static
|
|
100
|
-
return
|
|
124
|
+
static get defaults() {
|
|
125
|
+
return _defaults;
|
|
101
126
|
}
|
|
102
127
|
destroy() {
|
|
103
|
-
|
|
128
|
+
super.destroy();
|
|
104
129
|
if (!this.editor) return;
|
|
105
|
-
this.el.removeEventListener("click", this._handleClick);
|
|
106
|
-
this._label?.removeEventListener("click", this._handleLabelClick);
|
|
107
130
|
this.editor.off("update", this._handleUpdate);
|
|
108
131
|
this.editor.off("transaction", this._handleTransaction);
|
|
109
132
|
this.editor.destroy();
|
|
110
133
|
this.editor = null;
|
|
111
134
|
this.content.remove();
|
|
112
135
|
this.textarea.hidden = false;
|
|
136
|
+
this.textarea.required = this._required;
|
|
113
137
|
for (const button of this._actions.keys()) {
|
|
114
138
|
button.disabled = false;
|
|
115
139
|
button.classList.remove("active");
|
|
116
140
|
button.removeAttribute("aria-pressed");
|
|
117
141
|
}
|
|
118
142
|
}
|
|
143
|
+
_skipsValidation(e) {
|
|
144
|
+
return this._form.noValidate || !!e.submitter?.formNoValidate;
|
|
145
|
+
}
|
|
119
146
|
};
|
|
147
|
+
RichTextEditor.key = "Expressive_RichTextEditor";
|
|
120
148
|
|
|
121
149
|
export {
|
|
122
150
|
RichTextEditor
|
|
123
151
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
152
|
+
//# sourceMappingURL=chunk-QHZZT7YO.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/ts/components/richTextEditor.ts"],
|
|
4
|
+
"sourcesContent": ["import { Utils, afterFormReset } from '../core/utils';\nimport { Component, BaseOptions, InitElement, InitElements } from '../core/component';\n\n/**\n * The parts of a Tiptap `Editor` this component uses. Declared here so the\n * published types do not depend on Tiptap.\n */\n/** A Tiptap command chain. Commands by name come through `command()`. */\nexport interface RichTextEditorChain {\n focus(): RichTextEditorChain;\n run(): boolean;\n}\n\n/**\n * What `new Editor()` gets. Only these are declared; the extensions and\n * `editorProps` ride along, and Tiptap types them itself.\n */\nexport interface RichTextEditorConfig {\n element: HTMLElement;\n content: string;\n editable: boolean;\n}\n\nexport interface RichTextEditorInstance {\n commands: object;\n isEditable: boolean;\n isEmpty: boolean;\n chain(): RichTextEditorChain;\n /** Each command as a check that reports whether it can run now. */\n can(): object;\n isActive(name: string, attributes?: object): boolean;\n getHTML(): string;\n on(event: string, callback: () => void): unknown;\n off(event: string, callback: () => void): unknown;\n destroy(): void;\n}\n\n/** Tiptap's `Editor` class, or any class with the parts this component uses. */\nexport type RichTextEditorClass = new (options: RichTextEditorConfig) => RichTextEditorInstance;\n\nexport interface RichTextEditorOptions<E extends RichTextEditorClass = RichTextEditorClass> extends BaseOptions {\n /**\n * Tiptap's `Editor` class. ExpressiveCSS does not bundle Tiptap, so the\n * page imports it and passes it in.\n * @default null\n */\n Editor: E | null;\n /**\n * Tiptap extensions, usually `[StarterKit]`.\n * @default []\n */\n extensions: unknown[];\n}\n\nconst _defaults: RichTextEditorOptions = {\n Editor: null,\n extensions: []\n};\n\ntype Action = { command: string; attributes?: object; active?: string };\n\n/**\n * A command by name on a chain or on `can()`. The page's `data-command`\n * names a command an extension registered, which `_handleTransaction`\n * checks against `editor.commands` first.\n */\nconst command = <R>(commands: object, name: string) =>\n Reflect.get(commands, name) as (attributes?: object) => R;\n\n// Copied from the textarea onto the editable element.\nconst NAMING = ['aria-label', 'aria-labelledby', 'aria-describedby'];\n\n/**\n * A rich text editor built on Tiptap: a `.rich-text-editor` holding a\n * `<textarea>` and, usually, a `.toolbar` of `[data-command]` buttons.\n *\n * The textarea's value is the starting HTML. The component hides it, mounts\n * the editor after it and writes the editor's HTML back on every change, so\n * the textarea still submits with its form. A button's `data-command` names a\n * Tiptap command and `data-attributes` holds its JSON argument. Buttons are\n * disabled when their command cannot run, and `toggle*` commands report their\n * state with `aria-pressed` and `.active`.\n */\nexport class RichTextEditor<E extends RichTextEditorClass = RichTextEditorClass> extends Component<RichTextEditorOptions<E>> {\n /**\n * The Tiptap editor, with the full type of the `Editor` passed to the\n * constructor; `init()` and `getInstance()` see the `RichTextEditorInstance`\n * subset.\n */\n editor: InstanceType<E> | null = null;\n /** The form value. */\n textarea: HTMLTextAreaElement | null;\n /** The element the editor is mounted in. */\n content: HTMLElement | null = null;\n private _actions = new Map<HTMLButtonElement, Action>();\n private _label: HTMLLabelElement | null = null;\n private _required = false;\n private _form: HTMLFormElement | null = null;\n\n /** Initializes an editor, typed by the `Editor` passed in. */\n static init<E extends RichTextEditorClass>(this: typeof RichTextEditor, el: HTMLElement, options?: Partial<RichTextEditorOptions<E>>): RichTextEditor<E>;\n /** Initializes an editor on each element, typed by the `Editor` passed in. */\n static init<E extends RichTextEditorClass>(this: typeof RichTextEditor, els: InitElements<InitElement>, options?: Partial<RichTextEditorOptions<E>>): RichTextEditor<E>[];\n static init(els: HTMLElement | InitElements<InitElement>, options: Partial<RichTextEditorOptions> = {}): RichTextEditor | RichTextEditor[] {\n return super.init.call(this, els as InitElements<InitElement>, options);\n }\n\n constructor(el: HTMLElement, options: Partial<RichTextEditorOptions<E>>) {\n super(el, options);\n this.textarea = el.querySelector(':scope > textarea');\n if (!this.textarea || !this.options.Editor) {\n console.error('RichTextEditor needs a <textarea> child and the Tiptap Editor class in options.Editor.');\n return;\n }\n\n for (const button of el.querySelectorAll<HTMLButtonElement>('button[data-command]')) {\n const command = button.dataset.command;\n let attributes: object | undefined;\n try {\n attributes = button.dataset.attributes ? JSON.parse(button.dataset.attributes) : undefined;\n } catch {\n // One bad button must not stop the editor, or later elements, mounting.\n console.warn('RichTextEditor ignored invalid JSON in data-attributes:', button.dataset.attributes);\n }\n // toggleBulletList is active while the selection is in a bulletList.\n const active = command.startsWith('toggle') ? command[6].toLowerCase() + command.slice(7) : undefined;\n this._actions.set(button, { command, attributes, active });\n }\n\n const attributes: Record<string, string> = { role: 'textbox', 'aria-multiline': 'true' };\n for (const name of NAMING) {\n const value = this.textarea.getAttribute(name);\n if (value) attributes[name] = value;\n }\n // A <label for> names the hidden textarea, so it has to name the editor\n // instead, and a click on it has to focus the editor.\n this._label = this.textarea.labels?.[0] ?? null;\n if (this._label && !attributes['aria-labelledby']) {\n if (!this._label.id) this._label.id = `rich-text-editor-label-${Utils.guid()}`;\n attributes['aria-labelledby'] = this._label.id;\n this._label.addEventListener('click', this._handleLabelClick, { signal: this._events.signal });\n }\n // A hidden required textarea blocks submit with no message, because the\n // browser cannot focus it to report. The editor takes over: it carries\n // aria-required, and an empty editor cancels submit and takes focus.\n this._required = this.textarea.required;\n this._form = this.textarea.form;\n if (this._required) {\n attributes['aria-required'] = 'true';\n this.textarea.required = false;\n this._form?.addEventListener('submit', this._handleSubmit, { capture: true, signal: this._events.signal });\n }\n afterFormReset(this.textarea, this._handleReset, this._events.signal);\n\n this.content = document.createElement('div');\n this.content.className = 'rich-text-editor-content';\n this.textarea.after(this.content);\n this.textarea.hidden = true;\n const config = {\n element: this.content,\n extensions: this.options.extensions,\n content: this.textarea.value,\n editable: !(this.textarea.disabled || this.textarea.readOnly),\n editorProps: { attributes }\n };\n // `new` on a generic constructor yields the constraint, not E's instance.\n this.editor = new this.options.Editor(config) as InstanceType<E>;\n this.editor.on('update', this._handleUpdate);\n this.editor.on('transaction', this._handleTransaction);\n this._handleTransaction();\n el.addEventListener('click', this._handleClick, { signal: this._events.signal });\n }\n\n static get defaults(): RichTextEditorOptions {\n return _defaults;\n }\n\n static key = 'Expressive_RichTextEditor';\n\n destroy() {\n super.destroy();\n if (!this.editor) return;\n this.editor.off('update', this._handleUpdate);\n this.editor.off('transaction', this._handleTransaction);\n this.editor.destroy();\n this.editor = null;\n this.content.remove();\n this.textarea.hidden = false;\n this.textarea.required = this._required;\n for (const button of this._actions.keys()) {\n button.disabled = false;\n button.classList.remove('active');\n button.removeAttribute('aria-pressed');\n }\n }\n\n private _handleClick = (e: MouseEvent) => {\n const button = (e.target as Element).closest<HTMLButtonElement>('button[data-command]');\n const action = this._actions.get(button);\n if (action && !button.disabled) command<RichTextEditorChain>(this.editor.chain().focus(), action.command)(action.attributes).run();\n };\n\n private _handleLabelClick = () => {\n this.editor.chain().focus().run();\n };\n\n private _skipsValidation(e: SubmitEvent) {\n return this._form.noValidate || !!(e.submitter as HTMLButtonElement | null)?.formNoValidate;\n }\n\n private _handleSubmit = (e: SubmitEvent) => {\n if (this._skipsValidation(e) || !this.editor.isEditable || !this.editor.isEmpty) return;\n e.preventDefault();\n e.stopImmediatePropagation();\n this.editor.chain().focus().run();\n };\n\n /**\n * The form restores the textarea after the reset event, so the editor reads\n * it back a task later. Without this the editor kept the typed text while the\n * form submitted the default. No update is emitted, so a reset fires no input.\n */\n private _handleReset = () => {\n if (!this.editor) return;\n const commands = this.editor.commands as { setContent: (content: string, options: { emitUpdate: boolean }) => boolean };\n commands.setContent(this.textarea.value, { emitUpdate: false });\n };\n\n private _handleUpdate = () => {\n this.textarea.value = this.editor.isEmpty ? '' : this.editor.getHTML();\n this.textarea.dispatchEvent(new Event('input', { bubbles: true }));\n };\n\n private _handleTransaction = () => {\n const can = this.editor.isEditable && this.editor.can();\n for (const [button, { command: name, attributes, active }] of this._actions) {\n button.disabled = !can || !(name in this.editor.commands) || !command<boolean>(can, name)(attributes);\n if (!active) continue;\n const on = this.editor.isActive(active, attributes);\n button.setAttribute('aria-pressed', String(on));\n button.classList.toggle('active', on);\n }\n };\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["command", "attributes"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component
|
|
3
|
+
} from "./chunk-EB2V4OKL.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Utils,
|
|
6
|
+
restoreAttribute
|
|
7
|
+
} from "./chunk-67UNY7RH.mjs";
|
|
8
|
+
|
|
9
|
+
// src/ts/components/tabs.ts
|
|
10
|
+
var STEPS = { ltr: { ArrowLeft: -1, ArrowRight: 1 }, rtl: { ArrowLeft: 1, ArrowRight: -1 } };
|
|
11
|
+
var _defaults = {
|
|
12
|
+
duration: null,
|
|
13
|
+
onShow: null,
|
|
14
|
+
swipeable: false,
|
|
15
|
+
responsiveThreshold: Infinity
|
|
16
|
+
// breakpoint for swipeable
|
|
17
|
+
};
|
|
18
|
+
var scrollBehavior = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "instant" : "smooth";
|
|
19
|
+
var isDisabled = (a) => a.matches('.disabled, [aria-disabled="true"]');
|
|
20
|
+
var isShown = (a) => a.checkVisibility?.() ?? true;
|
|
21
|
+
var isUsable = (a) => !isDisabled(a) && isShown(a);
|
|
22
|
+
var _Tabs = class _Tabs extends Component {
|
|
23
|
+
constructor(el, options) {
|
|
24
|
+
var _a;
|
|
25
|
+
super(el, options);
|
|
26
|
+
this._panels = [];
|
|
27
|
+
// The panel a programmatic scroll is heading for. Scroll events on the way
|
|
28
|
+
// there pass over other panels and must not select them.
|
|
29
|
+
this._scrollTarget = null;
|
|
30
|
+
this._trackObserver = null;
|
|
31
|
+
this._trackWidth = -1;
|
|
32
|
+
this._originalPanels = /* @__PURE__ */ new Map();
|
|
33
|
+
this._originalLinks = /* @__PURE__ */ new Map();
|
|
34
|
+
/**
|
|
35
|
+
* Whether the page made the strip a tablist. The roles are the author's;
|
|
36
|
+
* in that mode the component keeps aria-selected and a roving tabindex, and
|
|
37
|
+
* the arrow keys select as they move, as the ARIA tabs pattern asks.
|
|
38
|
+
*/
|
|
39
|
+
this._tablist = false;
|
|
40
|
+
/** The bar's own tabindex as the page wrote it, put back on destroy. */
|
|
41
|
+
this._barTabindex = null;
|
|
42
|
+
/** Re-chooses a tablist's Tab stop when the strip is shown, hidden or resized. */
|
|
43
|
+
this._stripObserver = null;
|
|
44
|
+
/**
|
|
45
|
+
* Left and Right move focus to the next tab, wrapping at the ends, and
|
|
46
|
+
* Home and End to the first and last; disabled tabs are skipped. In link
|
|
47
|
+
* tabs focus moves without choosing, and Enter follows the link. In a
|
|
48
|
+
* tablist the tab that takes focus is selected too, the ARIA pattern's
|
|
49
|
+
* automatic activation, since a panel here shows at once.
|
|
50
|
+
*/
|
|
51
|
+
this._handleKeydown = (e) => {
|
|
52
|
+
const steps = STEPS[getComputedStyle(this.el).direction === "rtl" ? "rtl" : "ltr"];
|
|
53
|
+
const target = Utils.focusTarget(Array.from(this._tabLinks).filter(isShown), e, steps, true);
|
|
54
|
+
if (!target) return;
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
target.focus();
|
|
57
|
+
this._followFocus(target);
|
|
58
|
+
};
|
|
59
|
+
this._handleTabClick = (e) => {
|
|
60
|
+
const target = e.target;
|
|
61
|
+
if (!target) return;
|
|
62
|
+
const tabLink = target.closest("a");
|
|
63
|
+
if (!tabLink || !Array.from(this._tabLinks).includes(tabLink)) return;
|
|
64
|
+
const disabled = tabLink.classList.contains("disabled") || tabLink.getAttribute("aria-disabled") === "true";
|
|
65
|
+
if (disabled) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (tabLink.hasAttribute("target")) return;
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
this._select(tabLink);
|
|
72
|
+
};
|
|
73
|
+
this._releaseScrollTarget = () => {
|
|
74
|
+
clearTimeout(this._scrollTimer);
|
|
75
|
+
this._scrollTarget = null;
|
|
76
|
+
};
|
|
77
|
+
this._handleTrackScroll = () => {
|
|
78
|
+
if (this._scrollTarget !== null) {
|
|
79
|
+
if (this._trackAt(this._scrollTarget)) this._releaseScrollTarget();
|
|
80
|
+
else this._waitForScroll();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const panel = this._panels[this._trackIndex()];
|
|
84
|
+
if (!panel || panel === this._content) return;
|
|
85
|
+
this._showPanel(Array.from(this._tabLinks).find((a) => this._panelFor(a) === panel));
|
|
86
|
+
};
|
|
87
|
+
this._tabLinks = this._queryTabLinks();
|
|
88
|
+
if (!this._tabLinks.length) {
|
|
89
|
+
console.error("Tabs: no tab links (an <a> child) to show");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this._setupTablist();
|
|
93
|
+
this._tabLinks.forEach((link) => {
|
|
94
|
+
this._originalLinks.set(link, {
|
|
95
|
+
active: link.classList.contains("active"),
|
|
96
|
+
current: link.getAttribute("aria-current"),
|
|
97
|
+
selected: link.getAttribute("aria-selected"),
|
|
98
|
+
tabindex: link.getAttribute("tabindex")
|
|
99
|
+
});
|
|
100
|
+
const panel = this._panelFor(link);
|
|
101
|
+
if (panel) this._originalPanels.set(panel, {
|
|
102
|
+
display: panel.style.display,
|
|
103
|
+
priority: panel.style.getPropertyPriority("display"),
|
|
104
|
+
active: panel.classList.contains("active"),
|
|
105
|
+
inert: panel.inert
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
(_a = this.options).swipeable && (_a.swipeable = window.innerWidth <= this.options.responsiveThreshold && this._originalPanels.size > 0);
|
|
109
|
+
this._index = 0;
|
|
110
|
+
this._setupActiveTabLink();
|
|
111
|
+
if (this.options.swipeable) {
|
|
112
|
+
this._setupSwipeableTabs();
|
|
113
|
+
} else {
|
|
114
|
+
this._setupNormalTabs();
|
|
115
|
+
}
|
|
116
|
+
this._setTabsAndTabWidth();
|
|
117
|
+
this._createIndicator();
|
|
118
|
+
this._setupEventHandlers();
|
|
119
|
+
document.fonts?.ready.then(() => {
|
|
120
|
+
if (_Tabs.getInstance(this.el) === this) this._remeasure();
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
_setupTablist() {
|
|
124
|
+
this._tablist = this.el.getAttribute("role") === "tablist";
|
|
125
|
+
this._barTabindex = this.el.getAttribute("tabindex");
|
|
126
|
+
if (this._tablist) this.el.tabIndex = -1;
|
|
127
|
+
this._stripObserver = new ResizeObserver(() => {
|
|
128
|
+
if (this._tablist) this._refreshTabStop();
|
|
129
|
+
this._remeasure();
|
|
130
|
+
});
|
|
131
|
+
this._stripObserver.observe(this.el);
|
|
132
|
+
this._tabLinks.forEach((a) => this._stripObserver.observe(a));
|
|
133
|
+
}
|
|
134
|
+
static get defaults() {
|
|
135
|
+
return _defaults;
|
|
136
|
+
}
|
|
137
|
+
destroy() {
|
|
138
|
+
this._stripObserver?.disconnect();
|
|
139
|
+
this._stripObserver = null;
|
|
140
|
+
this._indicator?.remove();
|
|
141
|
+
if (this._track) {
|
|
142
|
+
this._teardownSwipeableTabs();
|
|
143
|
+
}
|
|
144
|
+
this._originalPanels.forEach((original, panel) => {
|
|
145
|
+
panel.style.setProperty("display", original.display, original.priority);
|
|
146
|
+
panel.classList.toggle("active", original.active);
|
|
147
|
+
panel.inert = original.inert;
|
|
148
|
+
if (!panel.className) panel.removeAttribute("class");
|
|
149
|
+
});
|
|
150
|
+
this._originalLinks.forEach((original, link) => {
|
|
151
|
+
link.classList.toggle("active", original.active);
|
|
152
|
+
restoreAttribute(link, "aria-current", original.current);
|
|
153
|
+
restoreAttribute(link, "aria-selected", original.selected);
|
|
154
|
+
restoreAttribute(link, "tabindex", original.tabindex);
|
|
155
|
+
});
|
|
156
|
+
restoreAttribute(this.el, "tabindex", this._barTabindex);
|
|
157
|
+
super.destroy();
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The index of tab that is currently shown.
|
|
161
|
+
*/
|
|
162
|
+
get index() {
|
|
163
|
+
return this._index;
|
|
164
|
+
}
|
|
165
|
+
_setupEventHandlers() {
|
|
166
|
+
this.el.addEventListener("click", this._handleTabClick, { signal: this._events.signal });
|
|
167
|
+
this.el.addEventListener("keydown", this._handleKeydown, { signal: this._events.signal });
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* In a tablist the tab that takes focus is selected; link tabs wait for
|
|
171
|
+
* Enter. The page's focus handlers run inside focus(), and one may have
|
|
172
|
+
* destroyed or replaced the tabs, which then are no longer this instance's.
|
|
173
|
+
*/
|
|
174
|
+
_followFocus(tab) {
|
|
175
|
+
if (this._tablist && tab !== this._activeTabLink && _Tabs.getInstance(this.el) === this) this._select(tab);
|
|
176
|
+
}
|
|
177
|
+
_remeasure() {
|
|
178
|
+
this._setTabsAndTabWidth();
|
|
179
|
+
if (this._tabWidth !== 0 && this._tabsWidth !== 0) this._positionIndicator();
|
|
180
|
+
}
|
|
181
|
+
_queryTabLinks() {
|
|
182
|
+
return this.el.querySelectorAll(":scope > a");
|
|
183
|
+
}
|
|
184
|
+
_select(tabLink) {
|
|
185
|
+
if (this.options.swipeable) this._clickSwipeable(tabLink);
|
|
186
|
+
else this._clickTab(tabLink);
|
|
187
|
+
}
|
|
188
|
+
_clickSwipeable(tabLink) {
|
|
189
|
+
if (!this._panels.includes(this._panelFor(tabLink))) return;
|
|
190
|
+
if (tabLink !== this._activeTabLink && !this._showPanel(tabLink)) return;
|
|
191
|
+
this._scrollToActivePanel(scrollBehavior());
|
|
192
|
+
}
|
|
193
|
+
_clickTab(tabLink) {
|
|
194
|
+
if (tabLink === this._activeTabLink) return;
|
|
195
|
+
const oldContent = this._content;
|
|
196
|
+
this._tabLinks = this._queryTabLinks();
|
|
197
|
+
const prevIndex = this._index;
|
|
198
|
+
this._setActiveTabLink(tabLink);
|
|
199
|
+
if (this._content && !this._swapPanels(oldContent)) return;
|
|
200
|
+
this._setTabsAndTabWidth();
|
|
201
|
+
this._animateIndicator(prevIndex);
|
|
202
|
+
}
|
|
203
|
+
/** Shows the active panel, hides the old one, then reports the change. */
|
|
204
|
+
_swapPanels(oldContent) {
|
|
205
|
+
this._content.style.display = "";
|
|
206
|
+
this._content.classList.add("active");
|
|
207
|
+
if (oldContent && oldContent !== this._content) {
|
|
208
|
+
oldContent.style.display = "none";
|
|
209
|
+
oldContent.classList.remove("active");
|
|
210
|
+
}
|
|
211
|
+
return this._notifyShow();
|
|
212
|
+
}
|
|
213
|
+
_createIndicator() {
|
|
214
|
+
const indicator = document.createElement("span");
|
|
215
|
+
indicator.classList.add("indicator");
|
|
216
|
+
this.el.appendChild(indicator);
|
|
217
|
+
this._indicator = indicator;
|
|
218
|
+
this._positionIndicator();
|
|
219
|
+
}
|
|
220
|
+
/** Reads both positions before writing either. */
|
|
221
|
+
_positionIndicator() {
|
|
222
|
+
const left = this._calcLeftPos(this._activeTabLink);
|
|
223
|
+
const right = this._calcRightPos(this._activeTabLink);
|
|
224
|
+
this._indicator.style.left = left + "px";
|
|
225
|
+
this._indicator.style.right = right + "px";
|
|
226
|
+
}
|
|
227
|
+
/** The panel a link shows, or null for a `target` link or one without a hash. */
|
|
228
|
+
_panelFor(a) {
|
|
229
|
+
if (!a.hash || a.hasAttribute("target")) return null;
|
|
230
|
+
return Utils.getElementById(this.el, _Tabs._decodeHash(a.hash));
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The id a hash names. `a.hash` and `location.hash` come back
|
|
234
|
+
* percent-encoded, so a non-ASCII id would never match without this. A
|
|
235
|
+
* malformed escape throws, and is then taken as written.
|
|
236
|
+
*/
|
|
237
|
+
static _decodeHash(hash) {
|
|
238
|
+
try {
|
|
239
|
+
return decodeURIComponent(hash.slice(1));
|
|
240
|
+
} catch {
|
|
241
|
+
return hash.slice(1);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Which tab is current, for the eye and for assistive technology.
|
|
246
|
+
*
|
|
247
|
+
* The class alone is a colour. Link tabs are navigation, so `aria-current`
|
|
248
|
+
* is the part a screen reader reads. A strip the page made a tablist reads
|
|
249
|
+
* `aria-selected` instead, with the keyboard model rule 2 asks of a
|
|
250
|
+
* composite role. Either value changes as the user picks, which makes
|
|
251
|
+
* keeping it the component's job, not the author's - see CONTEXT.md on
|
|
252
|
+
* static semantics versus dynamic state. Writing it once in the markup and
|
|
253
|
+
* never moving it left the old tab announcing itself as current.
|
|
254
|
+
*/
|
|
255
|
+
_setActiveTabLink(tabLink, behavior = scrollBehavior()) {
|
|
256
|
+
const stop = this._tabStop(tabLink);
|
|
257
|
+
Array.from(this._tabLinks).forEach((a) => this._mark(a, a === tabLink, a === stop));
|
|
258
|
+
this._activeTabLink = tabLink;
|
|
259
|
+
this._index = Array.from(this._tabLinks).indexOf(tabLink);
|
|
260
|
+
this._content = this._panelFor(tabLink);
|
|
261
|
+
this._reveal(tabLink, behavior);
|
|
262
|
+
}
|
|
263
|
+
/** A tablist says selected and keeps one Tab stop; link tabs say current. */
|
|
264
|
+
_mark(a, on, stop) {
|
|
265
|
+
a.classList.toggle("active", on);
|
|
266
|
+
if (this._tablist) {
|
|
267
|
+
a.setAttribute("aria-selected", String(on));
|
|
268
|
+
a.tabIndex = stop ? 0 : -1;
|
|
269
|
+
} else if (on) a.setAttribute("aria-current", "page");
|
|
270
|
+
else a.removeAttribute("aria-current");
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The tablist's one Tab stop: the selected tab, or the first usable one
|
|
274
|
+
* when the selected tab is disabled or hidden. The arrow keys skip both,
|
|
275
|
+
* so a Tab stop on one would leave every other panel out of reach.
|
|
276
|
+
*/
|
|
277
|
+
_tabStop(selected) {
|
|
278
|
+
if (isUsable(selected)) return selected;
|
|
279
|
+
const links = Array.from(this._tabLinks);
|
|
280
|
+
return links.find(isUsable) ?? links.find((a) => !isDisabled(a)) ?? selected;
|
|
281
|
+
}
|
|
282
|
+
/** Showing or hiding the strip or a tab moves the Tab stop to a usable tab. */
|
|
283
|
+
_refreshTabStop() {
|
|
284
|
+
const stop = this._tabStop(this._activeTabLink);
|
|
285
|
+
this._tabLinks.forEach((a) => a.tabIndex = a === stop ? 0 : -1);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Scrolls an overflowing bar, and only the bar, so the tab is in view.
|
|
289
|
+
* Measured as a visual offset, so it holds in a right-to-left bar too.
|
|
290
|
+
*/
|
|
291
|
+
_reveal(tab, behavior) {
|
|
292
|
+
const bar = this.el.getBoundingClientRect();
|
|
293
|
+
const box = tab.getBoundingClientRect();
|
|
294
|
+
const left = Math.min(0, box.left - bar.left) || Math.max(0, box.right - bar.right);
|
|
295
|
+
if (left) this.el.scrollBy({ left, behavior });
|
|
296
|
+
}
|
|
297
|
+
_setupActiveTabLink() {
|
|
298
|
+
const hash = location.hash && _Tabs._decodeHash(location.hash);
|
|
299
|
+
this._activeTabLink = Array.from(this._tabLinks).find((a) => hash && _Tabs._decodeHash(a.getAttribute("href") ?? "") === hash) ?? this.el.querySelector("a.active") ?? this._tabStop(this._tabLinks[0]);
|
|
300
|
+
this._setActiveTabLink(this._activeTabLink, "instant");
|
|
301
|
+
this._originalPanels.forEach((_, panel) => panel.classList.toggle("active", panel === this._content));
|
|
302
|
+
}
|
|
303
|
+
_setupSwipeableTabs() {
|
|
304
|
+
this._panels = [...new Set(Array.from(this._tabLinks, (a) => this._panelFor(a)).filter(Boolean))];
|
|
305
|
+
const track = document.createElement("div");
|
|
306
|
+
track.classList.add("tabs-content");
|
|
307
|
+
this._panels[0].before(track);
|
|
308
|
+
this._panels.forEach((panel) => {
|
|
309
|
+
const marker = document.createComment("");
|
|
310
|
+
panel.before(marker);
|
|
311
|
+
this._originalPanels.get(panel).marker = marker;
|
|
312
|
+
track.appendChild(panel);
|
|
313
|
+
panel.style.display = "";
|
|
314
|
+
});
|
|
315
|
+
this._track = track;
|
|
316
|
+
this._syncPanels();
|
|
317
|
+
const options = { passive: true, signal: this._events.signal };
|
|
318
|
+
track.addEventListener("scroll", this._handleTrackScroll, options);
|
|
319
|
+
track.addEventListener("pointerdown", this._releaseScrollTarget, options);
|
|
320
|
+
track.addEventListener("wheel", this._releaseScrollTarget, options);
|
|
321
|
+
this._trackObserver = new ResizeObserver(() => {
|
|
322
|
+
if (track.clientWidth === this._trackWidth) return;
|
|
323
|
+
this._trackWidth = track.clientWidth;
|
|
324
|
+
this._scrollToActivePanel("instant");
|
|
325
|
+
});
|
|
326
|
+
this._trackObserver.observe(track);
|
|
327
|
+
this._scrollToActivePanel("instant");
|
|
328
|
+
}
|
|
329
|
+
_teardownSwipeableTabs() {
|
|
330
|
+
const track = this._track;
|
|
331
|
+
this._trackObserver?.disconnect();
|
|
332
|
+
this._trackObserver = null;
|
|
333
|
+
this._releaseScrollTarget();
|
|
334
|
+
this._originalPanels.forEach((original, panel) => original.marker?.replaceWith(panel));
|
|
335
|
+
track.remove();
|
|
336
|
+
this._track = void 0;
|
|
337
|
+
}
|
|
338
|
+
/** Only the shown panel is reachable; the others are off to the side. */
|
|
339
|
+
_syncPanels() {
|
|
340
|
+
this._panels.forEach((panel) => {
|
|
341
|
+
panel.classList.toggle("active", panel === this._content);
|
|
342
|
+
panel.inert = panel !== this._content;
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/** The panel the track is mostly showing. Panels are exactly one track wide. */
|
|
346
|
+
_trackIndex() {
|
|
347
|
+
return Math.round(Math.abs(this._track.scrollLeft) / (this._track.clientWidth || 1));
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Whether panel `index` fills the track. Compare positions, not rounded
|
|
351
|
+
* indexes: a scroll still on its way to another panel can already round to
|
|
352
|
+
* this one. Measured rather than computed from clientWidth, which rounds a
|
|
353
|
+
* fractional track width, while the mandatory snap lands on the real edge.
|
|
354
|
+
*/
|
|
355
|
+
_trackAt(index) {
|
|
356
|
+
return Math.abs(this._panels[index].getBoundingClientRect().left - this._track.getBoundingClientRect().left) < 1;
|
|
357
|
+
}
|
|
358
|
+
_scrollToActivePanel(behavior) {
|
|
359
|
+
const index = this._panels.indexOf(this._content);
|
|
360
|
+
if (index < 0 || this._trackAt(index)) return;
|
|
361
|
+
const sign = getComputedStyle(this._track).direction === "rtl" ? -1 : 1;
|
|
362
|
+
const left = sign * index * this._track.clientWidth;
|
|
363
|
+
this._scrollTarget = index;
|
|
364
|
+
this._waitForScroll();
|
|
365
|
+
this._track.scrollTo({ left, behavior });
|
|
366
|
+
}
|
|
367
|
+
// A smooth scroll that something cut short never arrives, and on a busy page
|
|
368
|
+
// one can also take a while to start. Once the track has been still for half
|
|
369
|
+
// a second, jump to the selected panel. The selection stands: a swipe or
|
|
370
|
+
// wheel that took over has already released the target, so the scroll
|
|
371
|
+
// events that follow choose the panel. Every scroll event restarts the wait.
|
|
372
|
+
_waitForScroll() {
|
|
373
|
+
clearTimeout(this._scrollTimer);
|
|
374
|
+
this._scrollTimer = setTimeout(() => {
|
|
375
|
+
this._releaseScrollTarget();
|
|
376
|
+
this._scrollToActivePanel("instant");
|
|
377
|
+
}, 500);
|
|
378
|
+
}
|
|
379
|
+
_showPanel(tabLink) {
|
|
380
|
+
const prevIndex = this._index;
|
|
381
|
+
this._setActiveTabLink(tabLink);
|
|
382
|
+
this._syncPanels();
|
|
383
|
+
this._setTabsAndTabWidth();
|
|
384
|
+
this._animateIndicator(prevIndex);
|
|
385
|
+
return this._notifyShow();
|
|
386
|
+
}
|
|
387
|
+
// After the old panel is hidden, so a listener sees one active panel.
|
|
388
|
+
_notifyShow() {
|
|
389
|
+
const panel = this._content;
|
|
390
|
+
return this._notify("change", this.options.onShow, { args: [panel], detail: { panel }, current: () => this._content === panel });
|
|
391
|
+
}
|
|
392
|
+
_setupNormalTabs() {
|
|
393
|
+
Array.from(this._tabLinks).forEach((a) => {
|
|
394
|
+
if (a === this._activeTabLink) return;
|
|
395
|
+
const currContent = this._panelFor(a);
|
|
396
|
+
if (currContent) currContent.style.display = "none";
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
_setTabsAndTabWidth() {
|
|
400
|
+
this._tabsWidth = this.el.getBoundingClientRect().width;
|
|
401
|
+
this._tabWidth = Math.max(this._tabsWidth, this.el.scrollWidth) / this._tabLinks.length;
|
|
402
|
+
}
|
|
403
|
+
_calcRightPos(el) {
|
|
404
|
+
return Math.ceil(this._tabsWidth - el.offsetLeft - el.getBoundingClientRect().width);
|
|
405
|
+
}
|
|
406
|
+
_calcLeftPos(el) {
|
|
407
|
+
return Math.floor(el.offsetLeft);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Recalculate tab indicator position. This is useful when
|
|
411
|
+
* the indicator position is not correct.
|
|
412
|
+
*/
|
|
413
|
+
updateTabIndicator() {
|
|
414
|
+
this._setTabsAndTabWidth();
|
|
415
|
+
this._animateIndicator(this._index);
|
|
416
|
+
}
|
|
417
|
+
_animateIndicator(prevIndex) {
|
|
418
|
+
const ms = this.options.duration;
|
|
419
|
+
const timing = ms == null ? ["var(--md-comp-tabs-indicator-duration) var(--md-comp-tabs-indicator-easing)", "calc(var(--md-comp-tabs-indicator-duration) * 0.3)"] : [`${ms}ms ease-out`, `${ms * 0.3}ms`];
|
|
420
|
+
const [leftDelay, rightDelay] = this._index - prevIndex >= 0 ? [timing[1], "0s"] : ["0s", timing[1]];
|
|
421
|
+
this._indicator.style.transition = `left ${timing[0]} ${leftDelay}, right ${timing[0]} ${rightDelay}`;
|
|
422
|
+
this._positionIndicator();
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Show tab content that corresponds to the tab with the id.
|
|
426
|
+
* @param tabId The id of the tab that you want to switch to.
|
|
427
|
+
*/
|
|
428
|
+
select(tabId) {
|
|
429
|
+
const tab = Array.from(this._tabLinks).find((a) => a.getAttribute("href") === "#" + tabId);
|
|
430
|
+
if (tab) tab.click();
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
_Tabs.key = "Expressive_Tabs";
|
|
434
|
+
var Tabs = _Tabs;
|
|
435
|
+
|
|
436
|
+
export {
|
|
437
|
+
Tabs
|
|
438
|
+
};
|
|
439
|
+
//# sourceMappingURL=chunk-QND56EW2.mjs.map
|