@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.
Files changed (603) hide show
  1. package/CHANGELOG.md +1589 -1
  2. package/README.md +9 -8
  3. package/dist/css/expressive.css +19304 -12021
  4. package/dist/css/expressive.css.map +1 -1
  5. package/dist/css/expressive.min.css +1 -1
  6. package/dist/css/expressive.min.css.map +1 -1
  7. package/dist/fonts/LICENSE-noto-sans-arabic +93 -0
  8. package/dist/fonts/LICENSE-noto-sans-hebrew +93 -0
  9. package/dist/fonts/LICENSE-noto-sans-thai +93 -0
  10. package/dist/fonts/material-symbols-outlined.woff2 +0 -0
  11. package/dist/fonts/material-symbols-rounded.woff2 +0 -0
  12. package/dist/fonts/material-symbols-sharp.woff2 +0 -0
  13. package/dist/fonts/noto-sans-arabic-arabic-400.woff2 +0 -0
  14. package/dist/fonts/noto-sans-arabic-arabic-500.woff2 +0 -0
  15. package/dist/fonts/noto-sans-arabic-arabic-700.woff2 +0 -0
  16. package/dist/fonts/noto-sans-cyrillic-400.woff2 +0 -0
  17. package/dist/fonts/noto-sans-cyrillic-500.woff2 +0 -0
  18. package/dist/fonts/noto-sans-cyrillic-700.woff2 +0 -0
  19. package/dist/fonts/noto-sans-cyrillic-ext-400.woff2 +0 -0
  20. package/dist/fonts/noto-sans-cyrillic-ext-500.woff2 +0 -0
  21. package/dist/fonts/noto-sans-cyrillic-ext-700.woff2 +0 -0
  22. package/dist/fonts/noto-sans-devanagari-400.woff2 +0 -0
  23. package/dist/fonts/noto-sans-devanagari-500.woff2 +0 -0
  24. package/dist/fonts/noto-sans-devanagari-700.woff2 +0 -0
  25. package/dist/fonts/noto-sans-greek-400.woff2 +0 -0
  26. package/dist/fonts/noto-sans-greek-500.woff2 +0 -0
  27. package/dist/fonts/noto-sans-greek-700.woff2 +0 -0
  28. package/dist/fonts/noto-sans-greek-ext-400.woff2 +0 -0
  29. package/dist/fonts/noto-sans-greek-ext-500.woff2 +0 -0
  30. package/dist/fonts/noto-sans-greek-ext-700.woff2 +0 -0
  31. package/dist/fonts/noto-sans-hebrew-hebrew-400.woff2 +0 -0
  32. package/dist/fonts/noto-sans-hebrew-hebrew-500.woff2 +0 -0
  33. package/dist/fonts/noto-sans-hebrew-hebrew-700.woff2 +0 -0
  34. package/dist/fonts/noto-sans-latin-700.woff2 +0 -0
  35. package/dist/fonts/noto-sans-latin-ext-400.woff2 +0 -0
  36. package/dist/fonts/noto-sans-latin-ext-500.woff2 +0 -0
  37. package/dist/fonts/noto-sans-latin-ext-700.woff2 +0 -0
  38. package/dist/fonts/noto-sans-thai-thai-400.woff2 +0 -0
  39. package/dist/fonts/noto-sans-thai-thai-500.woff2 +0 -0
  40. package/dist/fonts/noto-sans-thai-thai-700.woff2 +0 -0
  41. package/dist/fonts/noto-sans-vietnamese-400.woff2 +0 -0
  42. package/dist/fonts/noto-sans-vietnamese-500.woff2 +0 -0
  43. package/dist/fonts/noto-sans-vietnamese-700.woff2 +0 -0
  44. package/dist/fonts/roboto-cyrillic-400.woff2 +0 -0
  45. package/dist/fonts/roboto-cyrillic-500.woff2 +0 -0
  46. package/dist/fonts/roboto-cyrillic-700.woff2 +0 -0
  47. package/dist/fonts/roboto-cyrillic-ext-400.woff2 +0 -0
  48. package/dist/fonts/roboto-cyrillic-ext-500.woff2 +0 -0
  49. package/dist/fonts/roboto-cyrillic-ext-700.woff2 +0 -0
  50. package/dist/fonts/roboto-greek-400.woff2 +0 -0
  51. package/dist/fonts/roboto-greek-500.woff2 +0 -0
  52. package/dist/fonts/roboto-greek-700.woff2 +0 -0
  53. package/dist/fonts/roboto-greek-ext-400.woff2 +0 -0
  54. package/dist/fonts/roboto-greek-ext-500.woff2 +0 -0
  55. package/dist/fonts/roboto-greek-ext-700.woff2 +0 -0
  56. package/dist/fonts/roboto-latin-700.woff2 +0 -0
  57. package/dist/fonts/roboto-latin-ext-400.woff2 +0 -0
  58. package/dist/fonts/roboto-latin-ext-500.woff2 +0 -0
  59. package/dist/fonts/roboto-latin-ext-700.woff2 +0 -0
  60. package/dist/fonts/roboto-vietnamese-400.woff2 +0 -0
  61. package/dist/fonts/roboto-vietnamese-500.woff2 +0 -0
  62. package/dist/fonts/roboto-vietnamese-700.woff2 +0 -0
  63. package/dist/js/chunks/chunk-2CS6TITK.mjs +219 -0
  64. package/dist/js/chunks/chunk-2CS6TITK.mjs.map +7 -0
  65. package/dist/js/chunks/chunk-2RLBDFH4.mjs +108 -0
  66. package/dist/js/chunks/chunk-2RLBDFH4.mjs.map +7 -0
  67. package/dist/js/chunks/chunk-3L3QIYLC.mjs +85 -0
  68. package/dist/js/chunks/chunk-3L3QIYLC.mjs.map +7 -0
  69. package/dist/js/chunks/chunk-4EWGD4V2.mjs +75 -0
  70. package/dist/js/chunks/chunk-4EWGD4V2.mjs.map +7 -0
  71. package/dist/js/chunks/chunk-4IKVPCSU.mjs +7 -0
  72. package/dist/js/chunks/chunk-4IKVPCSU.mjs.map +7 -0
  73. package/dist/js/chunks/chunk-4PIXLDNJ.mjs +127 -0
  74. package/dist/js/chunks/chunk-4PIXLDNJ.mjs.map +7 -0
  75. package/dist/js/chunks/{chunk-A7ALMYUR.mjs → chunk-4QUCNFSD.mjs} +68 -125
  76. package/dist/js/chunks/chunk-4QUCNFSD.mjs.map +7 -0
  77. package/dist/js/chunks/{chunk-4TKTLGEM.mjs → chunk-4TRZ2AER.mjs} +35 -41
  78. package/dist/js/chunks/chunk-4TRZ2AER.mjs.map +7 -0
  79. package/dist/js/chunks/{chunk-BG6ZRB5H.mjs → chunk-5KIHWJI2.mjs} +40 -26
  80. package/dist/js/chunks/chunk-5KIHWJI2.mjs.map +7 -0
  81. package/dist/js/chunks/{chunk-YDCS5S3J.mjs → chunk-67ZPPKXS.mjs} +20 -33
  82. package/dist/js/chunks/chunk-67ZPPKXS.mjs.map +7 -0
  83. package/dist/js/chunks/{chunk-3DHK5CZU.mjs → chunk-6FSEUFVW.mjs} +40 -29
  84. package/dist/js/chunks/chunk-6FSEUFVW.mjs.map +7 -0
  85. package/dist/js/chunks/chunk-752ADW4M.mjs +225 -0
  86. package/dist/js/chunks/chunk-752ADW4M.mjs.map +7 -0
  87. package/dist/js/chunks/{chunk-GVGT6MIU.mjs → chunk-75E5EDJF.mjs} +3 -11
  88. package/dist/js/chunks/chunk-75E5EDJF.mjs.map +7 -0
  89. package/dist/js/chunks/{chunk-TBM3FT7G.mjs → chunk-7NLUI3RR.mjs} +148 -78
  90. package/dist/js/chunks/chunk-7NLUI3RR.mjs.map +7 -0
  91. package/dist/js/chunks/chunk-7W7TV6NY.mjs +108 -0
  92. package/dist/js/chunks/chunk-7W7TV6NY.mjs.map +7 -0
  93. package/dist/js/chunks/chunk-7YQBHTK3.mjs +225 -0
  94. package/dist/js/chunks/chunk-7YQBHTK3.mjs.map +7 -0
  95. package/dist/js/chunks/chunk-7YZ5CN3V.mjs +33 -0
  96. package/dist/js/chunks/chunk-7YZ5CN3V.mjs.map +7 -0
  97. package/dist/js/chunks/chunk-AI73GJKG.mjs +28 -0
  98. package/dist/js/chunks/chunk-AI73GJKG.mjs.map +7 -0
  99. package/dist/js/chunks/{chunk-NS2UMNZV.mjs → chunk-ANKFWNWT.mjs} +21 -45
  100. package/dist/js/chunks/chunk-ANKFWNWT.mjs.map +7 -0
  101. package/dist/js/chunks/{chunk-GIW4K4SE.mjs → chunk-B7DQFHA5.mjs} +37 -53
  102. package/dist/js/chunks/chunk-B7DQFHA5.mjs.map +7 -0
  103. package/dist/js/chunks/chunk-BIGU5RCJ.mjs +153 -0
  104. package/dist/js/chunks/chunk-BIGU5RCJ.mjs.map +7 -0
  105. package/dist/js/chunks/{chunk-GUB3TNO2.mjs → chunk-BPF3I2MN.mjs} +109 -27
  106. package/dist/js/chunks/chunk-BPF3I2MN.mjs.map +7 -0
  107. package/dist/js/chunks/chunk-CMGXGYUC.mjs +74 -0
  108. package/dist/js/chunks/chunk-CMGXGYUC.mjs.map +7 -0
  109. package/dist/js/chunks/{chunk-JIDMQGK6.mjs → chunk-CSYWKEK3.mjs} +322 -223
  110. package/dist/js/chunks/chunk-CSYWKEK3.mjs.map +7 -0
  111. package/dist/js/chunks/chunk-CZSQHXEV.mjs +227 -0
  112. package/dist/js/chunks/chunk-CZSQHXEV.mjs.map +7 -0
  113. package/dist/js/chunks/chunk-DZYVU75J.mjs +121 -0
  114. package/dist/js/chunks/chunk-DZYVU75J.mjs.map +7 -0
  115. package/dist/js/chunks/{chunk-QDAL4IYN.mjs → chunk-EC26RU2D.mjs} +11 -29
  116. package/dist/js/chunks/chunk-EC26RU2D.mjs.map +7 -0
  117. package/dist/js/chunks/{chunk-3GVFZ4XO.mjs → chunk-EVCVFEV3.mjs} +238 -152
  118. package/dist/js/chunks/chunk-EVCVFEV3.mjs.map +7 -0
  119. package/dist/js/chunks/chunk-FCNF4GRJ.mjs +445 -0
  120. package/dist/js/chunks/chunk-FCNF4GRJ.mjs.map +7 -0
  121. package/dist/js/chunks/chunk-GCWWEZKO.mjs +342 -0
  122. package/dist/js/chunks/chunk-GCWWEZKO.mjs.map +7 -0
  123. package/dist/js/chunks/chunk-GNRSYMVH.mjs +1 -0
  124. package/dist/js/chunks/chunk-GVZQH2H5.mjs +54 -0
  125. package/dist/js/chunks/chunk-GVZQH2H5.mjs.map +7 -0
  126. package/dist/js/chunks/chunk-GWZ76SR4.mjs +435 -0
  127. package/dist/js/chunks/chunk-GWZ76SR4.mjs.map +7 -0
  128. package/dist/js/chunks/{chunk-ZAS25YFD.mjs → chunk-ILDRRG7T.mjs} +21 -23
  129. package/dist/js/chunks/chunk-ILDRRG7T.mjs.map +7 -0
  130. package/dist/js/chunks/chunk-INLZWHLY.mjs +80 -0
  131. package/dist/js/chunks/chunk-INLZWHLY.mjs.map +7 -0
  132. package/dist/js/chunks/chunk-JUKBBN6P.mjs +175 -0
  133. package/dist/js/chunks/chunk-JUKBBN6P.mjs.map +7 -0
  134. package/dist/js/chunks/chunk-KYIEG4U3.mjs +730 -0
  135. package/dist/js/chunks/chunk-KYIEG4U3.mjs.map +7 -0
  136. package/dist/js/chunks/{chunk-KHV6DZXX.mjs → chunk-KZPSAXIU.mjs} +156 -46
  137. package/dist/js/chunks/chunk-KZPSAXIU.mjs.map +7 -0
  138. package/dist/js/chunks/chunk-LDXCC2L3.mjs +438 -0
  139. package/dist/js/chunks/chunk-LDXCC2L3.mjs.map +7 -0
  140. package/dist/js/chunks/chunk-NAC72P7R.mjs +137 -0
  141. package/dist/js/chunks/chunk-NAC72P7R.mjs.map +7 -0
  142. package/dist/js/chunks/chunk-NBJAUGPP.mjs +244 -0
  143. package/dist/js/chunks/chunk-NBJAUGPP.mjs.map +7 -0
  144. package/dist/js/chunks/chunk-NNHVANQA.mjs +113 -0
  145. package/dist/js/chunks/chunk-NNHVANQA.mjs.map +7 -0
  146. package/dist/js/chunks/chunk-NVQ5EHCU.mjs +376 -0
  147. package/dist/js/chunks/chunk-NVQ5EHCU.mjs.map +7 -0
  148. package/dist/js/chunks/{chunk-Z2NRKI7R.mjs → chunk-OP43LLIC.mjs} +44 -73
  149. package/dist/js/chunks/chunk-OP43LLIC.mjs.map +7 -0
  150. package/dist/js/chunks/chunk-OUCHKSAW.mjs +63 -0
  151. package/dist/js/chunks/chunk-OUCHKSAW.mjs.map +7 -0
  152. package/dist/js/chunks/{chunk-PM655FXL.mjs → chunk-OYNUDOHR.mjs} +20 -48
  153. package/dist/js/chunks/chunk-OYNUDOHR.mjs.map +7 -0
  154. package/dist/js/chunks/{chunk-UEZUJQ66.mjs → chunk-P6DRQ6KS.mjs} +36 -31
  155. package/dist/js/chunks/chunk-P6DRQ6KS.mjs.map +7 -0
  156. package/dist/js/chunks/chunk-PA7NU5AK.mjs +99 -0
  157. package/dist/js/chunks/chunk-PA7NU5AK.mjs.map +7 -0
  158. package/dist/js/chunks/chunk-QACZ6TUP.mjs +224 -0
  159. package/dist/js/chunks/chunk-QACZ6TUP.mjs.map +7 -0
  160. package/dist/js/chunks/{chunk-5HQSGDZ5.mjs → chunk-QXKWVHBD.mjs} +286 -203
  161. package/dist/js/chunks/chunk-QXKWVHBD.mjs.map +7 -0
  162. package/dist/js/chunks/{chunk-DAIU5SLG.mjs → chunk-ROH2HDB4.mjs} +7 -6
  163. package/dist/js/chunks/chunk-ROH2HDB4.mjs.map +7 -0
  164. package/dist/js/chunks/chunk-S23RJ3XY.mjs +86 -0
  165. package/dist/js/chunks/chunk-S23RJ3XY.mjs.map +7 -0
  166. package/dist/js/chunks/{chunk-FS7XY3HT.mjs → chunk-SPPHF7YZ.mjs} +36 -29
  167. package/dist/js/chunks/chunk-SPPHF7YZ.mjs.map +7 -0
  168. package/dist/js/chunks/chunk-T3BNSRP3.mjs +152 -0
  169. package/dist/js/chunks/chunk-T3BNSRP3.mjs.map +7 -0
  170. package/dist/js/chunks/chunk-TFABTUAZ.mjs +108 -0
  171. package/dist/js/chunks/chunk-TFABTUAZ.mjs.map +7 -0
  172. package/dist/js/chunks/chunk-U4B3VHFS.mjs +507 -0
  173. package/dist/js/chunks/chunk-U4B3VHFS.mjs.map +7 -0
  174. package/dist/js/chunks/chunk-UGJHCHXG.mjs +341 -0
  175. package/dist/js/chunks/chunk-UGJHCHXG.mjs.map +7 -0
  176. package/dist/js/chunks/chunk-VFV75DHF.mjs +70 -0
  177. package/dist/js/chunks/chunk-VFV75DHF.mjs.map +7 -0
  178. package/dist/js/chunks/{chunk-4HZMB7LI.mjs → chunk-VGY4M57S.mjs} +281 -135
  179. package/dist/js/chunks/chunk-VGY4M57S.mjs.map +7 -0
  180. package/dist/js/chunks/chunk-VH4BMAZS.mjs +167 -0
  181. package/dist/js/chunks/chunk-VH4BMAZS.mjs.map +7 -0
  182. package/dist/js/chunks/chunk-VJVQIXHC.mjs +123 -0
  183. package/dist/js/chunks/chunk-VJVQIXHC.mjs.map +7 -0
  184. package/dist/js/chunks/{chunk-S3XDFGSZ.mjs → chunk-VMY55K2X.mjs} +92 -141
  185. package/dist/js/chunks/chunk-VMY55K2X.mjs.map +7 -0
  186. package/dist/js/chunks/{chunk-UEXCIMJZ.mjs → chunk-VR3L2WN5.mjs} +11 -17
  187. package/dist/js/chunks/chunk-VR3L2WN5.mjs.map +7 -0
  188. package/dist/js/chunks/chunk-W6FAL3TI.mjs +38 -0
  189. package/dist/js/chunks/chunk-W6FAL3TI.mjs.map +7 -0
  190. package/dist/js/chunks/chunk-WU7XJ4RR.mjs +450 -0
  191. package/dist/js/chunks/chunk-WU7XJ4RR.mjs.map +7 -0
  192. package/dist/js/chunks/chunk-X7SDA2J5.mjs +116 -0
  193. package/dist/js/chunks/chunk-X7SDA2J5.mjs.map +7 -0
  194. package/dist/js/chunks/chunk-Y6H2X7ZC.mjs +209 -0
  195. package/dist/js/chunks/chunk-Y6H2X7ZC.mjs.map +7 -0
  196. package/dist/js/chunks/chunk-Y6TLRA3U.mjs +129 -0
  197. package/dist/js/chunks/chunk-Y6TLRA3U.mjs.map +7 -0
  198. package/dist/js/chunks/chunk-Z4GICXR2.mjs +190 -0
  199. package/dist/js/chunks/chunk-Z4GICXR2.mjs.map +7 -0
  200. package/dist/js/chunks/chunk-Z4OARDZ7.mjs +442 -0
  201. package/dist/js/chunks/chunk-Z4OARDZ7.mjs.map +7 -0
  202. package/dist/js/chunks/{chunk-MZ6Z24BX.mjs → chunk-ZJNLAGY5.mjs} +19 -34
  203. package/dist/js/chunks/chunk-ZJNLAGY5.mjs.map +7 -0
  204. package/dist/js/chunks/chunk-ZKWUWBUB.mjs +81 -0
  205. package/dist/js/chunks/chunk-ZKWUWBUB.mjs.map +7 -0
  206. package/dist/js/chunks/chunk-ZM3XBHWV.mjs +746 -0
  207. package/dist/js/chunks/chunk-ZM3XBHWV.mjs.map +7 -0
  208. package/dist/js/chunks/chunk-ZO6ZLHFF.mjs +48 -0
  209. package/dist/js/chunks/chunk-ZO6ZLHFF.mjs.map +7 -0
  210. package/dist/js/chunks/chunk-ZVLOUDIJ.mjs +251 -0
  211. package/dist/js/chunks/chunk-ZVLOUDIJ.mjs.map +7 -0
  212. package/dist/js/expressive.cjs +10333 -4070
  213. package/dist/js/expressive.cjs.map +4 -4
  214. package/dist/js/expressive.js +10333 -4070
  215. package/dist/js/expressive.js.map +4 -4
  216. package/dist/js/expressive.min.js +23 -25
  217. package/dist/js/expressive.min.js.map +4 -4
  218. package/dist/js/expressive.mjs +184 -69
  219. package/dist/js/expressive.mjs.map +2 -2
  220. package/dist/js/internal/behaviors/bottomSheets.mjs +4 -3
  221. package/dist/js/internal/behaviors/copy.mjs +9 -0
  222. package/dist/js/internal/behaviors/copy.mjs.map +7 -0
  223. package/dist/js/internal/behaviors/dataTables.mjs +10 -0
  224. package/dist/js/internal/behaviors/dataTables.mjs.map +7 -0
  225. package/dist/js/internal/behaviors/dialogs.mjs +2 -2
  226. package/dist/js/internal/behaviors/forms.mjs +2 -2
  227. package/dist/js/internal/behaviors/imageCompare.mjs +8 -0
  228. package/dist/js/internal/behaviors/imageCompare.mjs.map +7 -0
  229. package/dist/js/internal/behaviors/lists.mjs +8 -0
  230. package/dist/js/internal/behaviors/lists.mjs.map +7 -0
  231. package/dist/js/internal/behaviors/paneResize.mjs +8 -0
  232. package/dist/js/internal/behaviors/paneResize.mjs.map +7 -0
  233. package/dist/js/internal/behaviors/sheetDrag.mjs +7 -2
  234. package/dist/js/internal/behaviors/sideSheets.mjs +4 -3
  235. package/dist/js/internal/behaviors/sortable.mjs +8 -0
  236. package/dist/js/internal/behaviors/sortable.mjs.map +7 -0
  237. package/dist/js/internal/behaviors/theme.mjs +8 -0
  238. package/dist/js/internal/behaviors/theme.mjs.map +7 -0
  239. package/dist/js/internal/behaviors/tour.mjs +8 -0
  240. package/dist/js/internal/behaviors/tour.mjs.map +7 -0
  241. package/dist/js/internal/behaviors/transferList.mjs +8 -0
  242. package/dist/js/internal/behaviors/transferList.mjs.map +7 -0
  243. package/dist/js/internal/components/appBar.mjs +3 -2
  244. package/dist/js/internal/components/autocomplete.mjs +4 -4
  245. package/dist/js/internal/components/backToTop.mjs +9 -0
  246. package/dist/js/internal/components/backToTop.mjs.map +7 -0
  247. package/dist/js/internal/components/barChart.mjs +5 -4
  248. package/dist/js/internal/components/buttonGroup.mjs +3 -2
  249. package/dist/js/internal/components/buttons.mjs +3 -3
  250. package/dist/js/internal/components/cards.mjs +3 -3
  251. package/dist/js/internal/components/carousel.mjs +3 -3
  252. package/dist/js/internal/components/cascader.mjs +10 -0
  253. package/dist/js/internal/components/cascader.mjs.map +7 -0
  254. package/dist/js/internal/components/characterCounter.mjs +3 -2
  255. package/dist/js/internal/components/chips.mjs +6 -5
  256. package/dist/js/internal/components/colorPicker.mjs +9 -0
  257. package/dist/js/internal/components/colorPicker.mjs.map +7 -0
  258. package/dist/js/internal/components/columnChart.mjs +4 -3
  259. package/dist/js/internal/components/commandPalette.mjs +3 -3
  260. package/dist/js/internal/components/confetti.mjs +3 -2
  261. package/dist/js/internal/components/currencyInput.mjs +9 -0
  262. package/dist/js/internal/components/currencyInput.mjs.map +7 -0
  263. package/dist/js/internal/components/datepicker.mjs +11 -8
  264. package/dist/js/internal/components/expandingCard.mjs +3 -3
  265. package/dist/js/internal/components/funnelChart.mjs +10 -0
  266. package/dist/js/internal/components/funnelChart.mjs.map +7 -0
  267. package/dist/js/internal/components/heatmapChart.mjs +4 -3
  268. package/dist/js/internal/components/hoverCard.mjs +9 -0
  269. package/dist/js/internal/components/hoverCard.mjs.map +7 -0
  270. package/dist/js/internal/components/index.mjs +133 -64
  271. package/dist/js/internal/components/inputMask.mjs +9 -0
  272. package/dist/js/internal/components/inputMask.mjs.map +7 -0
  273. package/dist/js/internal/components/keypad.mjs +9 -0
  274. package/dist/js/internal/components/keypad.mjs.map +7 -0
  275. package/dist/js/internal/components/lightbox.mjs +3 -3
  276. package/dist/js/internal/components/lineChart.mjs +29 -4
  277. package/dist/js/internal/components/loadingOverlay.mjs +9 -0
  278. package/dist/js/internal/components/loadingOverlay.mjs.map +7 -0
  279. package/dist/js/internal/components/mapView.mjs +3 -3
  280. package/dist/js/internal/components/menu.mjs +3 -3
  281. package/dist/js/internal/components/menubar.mjs +10 -0
  282. package/dist/js/internal/components/menubar.mjs.map +7 -0
  283. package/dist/js/internal/components/messageScroller.mjs +3 -3
  284. package/dist/js/internal/components/mixedChart.mjs +5 -4
  285. package/dist/js/internal/components/navigationRail.mjs +3 -2
  286. package/dist/js/internal/components/particles.mjs +3 -2
  287. package/dist/js/internal/components/pieChart.mjs +4 -3
  288. package/dist/js/internal/components/pullToRefresh.mjs +9 -0
  289. package/dist/js/internal/components/pullToRefresh.mjs.map +7 -0
  290. package/dist/js/internal/components/questionnaire.mjs +3 -3
  291. package/dist/js/internal/components/radarChart.mjs +4 -3
  292. package/dist/js/internal/components/radialChart.mjs +4 -3
  293. package/dist/js/internal/components/registry.mjs +59 -40
  294. package/dist/js/internal/components/richTextEditor.mjs +3 -3
  295. package/dist/js/internal/components/sankeyChart.mjs +10 -0
  296. package/dist/js/internal/components/sankeyChart.mjs.map +7 -0
  297. package/dist/js/internal/components/scatterChart.mjs +10 -0
  298. package/dist/js/internal/components/scatterChart.mjs.map +7 -0
  299. package/dist/js/internal/components/scrollspy.mjs +3 -2
  300. package/dist/js/internal/components/select.mjs +4 -4
  301. package/dist/js/internal/components/showMore.mjs +9 -0
  302. package/dist/js/internal/components/showMore.mjs.map +7 -0
  303. package/dist/js/internal/components/slider.mjs +3 -3
  304. package/dist/js/internal/components/snackbar.mjs +2 -2
  305. package/dist/js/internal/components/swipeActions.mjs +9 -0
  306. package/dist/js/internal/components/swipeActions.mjs.map +7 -0
  307. package/dist/js/internal/components/tabs.mjs +3 -4
  308. package/dist/js/internal/components/timepicker.mjs +5 -4
  309. package/dist/js/internal/components/tooltip.mjs +3 -3
  310. package/dist/js/internal/components/treeSelect.mjs +13 -0
  311. package/dist/js/internal/components/treeSelect.mjs.map +7 -0
  312. package/dist/js/internal/components/treemapChart.mjs +10 -0
  313. package/dist/js/internal/components/treemapChart.mjs.map +7 -0
  314. package/dist/js/internal/core/component.mjs +2 -1
  315. package/dist/js/internal/core/formControl.mjs +12 -0
  316. package/dist/js/internal/core/formControl.mjs.map +7 -0
  317. package/dist/js/internal/core/spring.mjs +11 -0
  318. package/dist/js/internal/core/spring.mjs.map +7 -0
  319. package/dist/js/internal/core/utils.mjs +11 -3
  320. package/dist/js/internal/plugins/dockedDisplayPlugin.mjs +2 -2
  321. package/dist/js/internal/plugins/modalDisplayPlugin.mjs +13 -0
  322. package/dist/js/internal/plugins/modalDisplayPlugin.mjs.map +7 -0
  323. package/dist/js/modular.mjs +175 -69
  324. package/dist/types/behaviors/bottomSheets.d.ts +19 -3
  325. package/dist/types/behaviors/copy.d.ts +18 -0
  326. package/dist/types/behaviors/dataTables.d.ts +129 -0
  327. package/dist/types/behaviors/dialogs.d.ts +27 -1
  328. package/dist/types/behaviors/forms.d.ts +68 -2
  329. package/dist/types/behaviors/imageCompare.d.ts +12 -0
  330. package/dist/types/behaviors/lists.d.ts +12 -0
  331. package/dist/types/behaviors/paneResize.d.ts +29 -0
  332. package/dist/types/behaviors/sheetDrag.d.ts +18 -0
  333. package/dist/types/behaviors/sideSheets.d.ts +1 -1
  334. package/dist/types/behaviors/sortable.d.ts +28 -0
  335. package/dist/types/behaviors/theme.d.ts +22 -0
  336. package/dist/types/behaviors/tour.d.ts +36 -0
  337. package/dist/types/behaviors/transferList.d.ts +51 -0
  338. package/dist/types/components/appBar.d.ts +5 -6
  339. package/dist/types/components/autocomplete.d.ts +92 -17
  340. package/dist/types/components/backToTop.d.ts +36 -0
  341. package/dist/types/components/barChart.d.ts +3 -6
  342. package/dist/types/components/buttonGroup.d.ts +2 -4
  343. package/dist/types/components/buttons.d.ts +5 -5
  344. package/dist/types/components/cards.d.ts +3 -16
  345. package/dist/types/components/carousel.d.ts +9 -15
  346. package/dist/types/components/cascader.d.ts +130 -0
  347. package/dist/types/components/characterCounter.d.ts +2 -15
  348. package/dist/types/components/chips.d.ts +65 -19
  349. package/dist/types/components/colorPicker.d.ts +42 -0
  350. package/dist/types/components/columnChart.d.ts +23 -10
  351. package/dist/types/components/commandPalette.d.ts +11 -16
  352. package/dist/types/components/confetti.d.ts +2 -4
  353. package/dist/types/components/currencyInput.d.ts +59 -0
  354. package/dist/types/components/datepicker.d.ts +59 -36
  355. package/dist/types/components/expandingCard.d.ts +6 -6
  356. package/dist/types/components/funnelChart.d.ts +38 -0
  357. package/dist/types/components/heatmapChart.d.ts +39 -8
  358. package/dist/types/components/hoverCard.d.ts +58 -0
  359. package/dist/types/components/index.d.ts +17 -1
  360. package/dist/types/components/inputMask.d.ts +30 -0
  361. package/dist/types/components/keypad.d.ts +66 -0
  362. package/dist/types/components/lightbox.d.ts +17 -25
  363. package/dist/types/components/lineChart.d.ts +176 -10
  364. package/dist/types/components/loadingOverlay.d.ts +42 -0
  365. package/dist/types/components/mapView.d.ts +26 -17
  366. package/dist/types/components/menu.d.ts +61 -22
  367. package/dist/types/components/menubar.d.ts +37 -0
  368. package/dist/types/components/messageScroller.d.ts +2 -14
  369. package/dist/types/components/mixedChart.d.ts +15 -6
  370. package/dist/types/components/navigationRail.d.ts +16 -5
  371. package/dist/types/components/particles.d.ts +8 -4
  372. package/dist/types/components/pieChart.d.ts +32 -7
  373. package/dist/types/components/pullToRefresh.d.ts +80 -0
  374. package/dist/types/components/questionnaire.d.ts +58 -16
  375. package/dist/types/components/radarChart.d.ts +10 -6
  376. package/dist/types/components/radialChart.d.ts +58 -8
  377. package/dist/types/components/registry.d.ts +77 -3
  378. package/dist/types/components/richTextEditor.d.ts +6 -14
  379. package/dist/types/components/sankeyChart.d.ts +72 -0
  380. package/dist/types/components/scatterChart.d.ts +102 -0
  381. package/dist/types/components/scrollspy.d.ts +3 -5
  382. package/dist/types/components/select.d.ts +43 -30
  383. package/dist/types/components/showMore.d.ts +51 -0
  384. package/dist/types/components/slider.d.ts +5 -15
  385. package/dist/types/components/snackbar.d.ts +62 -0
  386. package/dist/types/components/swipeActions.d.ts +81 -0
  387. package/dist/types/components/tabs.d.ts +93 -27
  388. package/dist/types/components/timepicker.d.ts +114 -20
  389. package/dist/types/components/tooltip.d.ts +56 -20
  390. package/dist/types/components/treeSelect.d.ts +106 -0
  391. package/dist/types/components/treemapChart.d.ts +56 -0
  392. package/dist/types/core/component.d.ts +43 -25
  393. package/dist/types/core/formControl.d.ts +21 -0
  394. package/dist/types/core/spring.d.ts +20 -0
  395. package/dist/types/core/utils.d.ts +85 -72
  396. package/dist/types/modular.d.ts +33 -1
  397. package/dist/types/plugins/dockedDisplayPlugin.d.ts +10 -7
  398. package/dist/types/plugins/modalDisplayPlugin.d.ts +32 -0
  399. package/package.json +10 -8
  400. package/src/sass/README.md +27 -18
  401. package/src/sass/abstracts/_breakpoints.scss +0 -1
  402. package/src/sass/abstracts/_elevation.scss +13 -7
  403. package/src/sass/abstracts/_index.scss +1 -0
  404. package/src/sass/abstracts/_mixins.scss +438 -92
  405. package/src/sass/abstracts/_spring.scss +63 -0
  406. package/src/sass/abstracts/_variables.scss +43 -15
  407. package/src/sass/base/_fonts.scss +61 -48
  408. package/src/sass/base/_global.scss +105 -34
  409. package/src/sass/base/_index.scss +3 -1
  410. package/src/sass/base/_normalize.scss +59 -114
  411. package/src/sass/base/_print.scss +21 -0
  412. package/src/sass/base/_prose.scss +68 -0
  413. package/src/sass/base/_typography.scss +9 -5
  414. package/src/sass/components/_accordion.scss +9 -16
  415. package/src/sass/components/_alert.scss +102 -0
  416. package/src/sass/components/_aura.scss +8 -3
  417. package/src/sass/components/_avatar.scss +3 -3
  418. package/src/sass/components/_back-to-top.scss +38 -0
  419. package/src/sass/components/_badges.scss +7 -13
  420. package/src/sass/components/_bar-chart.scss +41 -19
  421. package/src/sass/components/_bottom-sheet.scss +44 -16
  422. package/src/sass/components/_breadcrumb.scss +8 -1
  423. package/src/sass/components/_button-groups.scss +44 -89
  424. package/src/sass/components/_buttons.scss +156 -63
  425. package/src/sass/components/_calendar.scss +246 -0
  426. package/src/sass/components/_cards.scss +41 -68
  427. package/src/sass/components/_carousel.scss +43 -158
  428. package/src/sass/components/_cascader.scss +142 -0
  429. package/src/sass/components/_chips.scss +36 -52
  430. package/src/sass/components/_column-chart.scss +19 -12
  431. package/src/sass/components/_command-palette.scss +4 -7
  432. package/src/sass/components/_confetti.scss +0 -2
  433. package/src/sass/components/_countdown.scss +1 -1
  434. package/src/sass/components/_data-table.scss +162 -27
  435. package/src/sass/components/_datepicker.scss +57 -62
  436. package/src/sass/components/_description-list.scss +85 -0
  437. package/src/sass/components/_dialog.scss +42 -44
  438. package/src/sass/components/_docked-display.scss +1 -3
  439. package/src/sass/components/_drag-handle.scss +16 -20
  440. package/src/sass/components/_expanding-card.scss +20 -9
  441. package/src/sass/components/_fab-menu.scss +44 -32
  442. package/src/sass/components/_funnel-chart.scss +124 -0
  443. package/src/sass/components/_heatmap-chart.scss +113 -24
  444. package/src/sass/components/_icon-buttons.scss +7 -8
  445. package/src/sass/components/_icons-material-design.scss +2 -2
  446. package/src/sass/components/_image-compare.scss +108 -0
  447. package/src/sass/components/_index.scss +21 -0
  448. package/src/sass/components/_keypad.scss +182 -0
  449. package/src/sass/components/_kpi.scss +6 -11
  450. package/src/sass/components/_lightbox.scss +26 -20
  451. package/src/sass/components/_line-chart.scss +16 -2
  452. package/src/sass/components/_list.scss +59 -14
  453. package/src/sass/components/_loading-indicator.scss +1 -0
  454. package/src/sass/components/_loading-overlay.scss +105 -0
  455. package/src/sass/components/_map.scss +35 -13
  456. package/src/sass/components/_marquee.scss +3 -2
  457. package/src/sass/components/_mega-menu.scss +137 -0
  458. package/src/sass/components/_menu.scss +159 -182
  459. package/src/sass/components/_menubar.scss +59 -0
  460. package/src/sass/components/_message-scroller.scss +2 -2
  461. package/src/sass/components/_message.scss +3 -3
  462. package/src/sass/components/_mixed-chart.scss +37 -9
  463. package/src/sass/components/_modal-display.scss +21 -0
  464. package/src/sass/components/_navbar.scss +43 -65
  465. package/src/sass/components/_navigation-bar.scss +15 -77
  466. package/src/sass/components/_navigation-rail.scss +171 -121
  467. package/src/sass/components/_org-chart.scss +192 -0
  468. package/src/sass/components/_page-footer.scss +16 -13
  469. package/src/sass/components/_pagination.scss +6 -13
  470. package/src/sass/components/_panes.scss +33 -31
  471. package/src/sass/components/_particles.scss +0 -2
  472. package/src/sass/components/_pie-chart.scss +91 -11
  473. package/src/sass/components/_popover.scss +18 -5
  474. package/src/sass/components/_progress.scss +158 -35
  475. package/src/sass/components/_pull-to-refresh.scss +90 -0
  476. package/src/sass/components/_questionnaire.scss +74 -3
  477. package/src/sass/components/_radar-chart.scss +38 -10
  478. package/src/sass/components/_radial-chart.scss +113 -5
  479. package/src/sass/components/_rich-text-editor.scss +2 -2
  480. package/src/sass/components/_sankey-chart.scss +114 -0
  481. package/src/sass/components/_scatter-chart.scss +153 -0
  482. package/src/sass/components/_scrim.scss +0 -2
  483. package/src/sass/components/_scrollspy.scss +0 -2
  484. package/src/sass/components/_search.scss +26 -22
  485. package/src/sass/components/_show-more.scss +8 -0
  486. package/src/sass/components/_side-sheet.scss +23 -40
  487. package/src/sass/components/_skeleton.scss +2 -4
  488. package/src/sass/components/_snackbar.scss +27 -21
  489. package/src/sass/components/_split-button.scss +5 -5
  490. package/src/sass/components/_stat.scss +3 -8
  491. package/src/sass/components/_stepper.scss +1 -5
  492. package/src/sass/components/_swipe-actions.scss +71 -0
  493. package/src/sass/components/_tabs.scss +51 -32
  494. package/src/sass/components/_timeline.scss +12 -12
  495. package/src/sass/components/_timepicker.scss +111 -112
  496. package/src/sass/components/_toolbar.scss +35 -47
  497. package/src/sass/components/_tooltip.scss +21 -12
  498. package/src/sass/components/_tour.scss +89 -0
  499. package/src/sass/components/_transfer-list.scss +73 -0
  500. package/src/sass/components/_transitions.scss +4 -4
  501. package/src/sass/components/_tree.scss +3 -16
  502. package/src/sass/components/_treemap-chart.scss +122 -0
  503. package/src/sass/components/forms/_checkboxes.scss +140 -86
  504. package/src/sass/components/forms/_color-picker.scss +135 -0
  505. package/src/sass/components/forms/_color-swatches.scss +85 -0
  506. package/src/sass/components/forms/_drop-zone.scss +15 -9
  507. package/src/sass/components/forms/_fieldset.scss +10 -10
  508. package/src/sass/components/forms/_file-input.scss +6 -9
  509. package/src/sass/components/forms/_index.scss +3 -1
  510. package/src/sass/components/forms/_input-fields.scss +254 -90
  511. package/src/sass/components/forms/_radio-buttons.scss +40 -127
  512. package/src/sass/components/forms/_rating.scss +2 -32
  513. package/src/sass/components/forms/_select.scss +199 -23
  514. package/src/sass/components/forms/_slider.scss +140 -330
  515. package/src/sass/components/forms/_switches.scss +53 -164
  516. package/src/sass/custom.scss +10 -1
  517. package/src/sass/expressive.scss +3 -63
  518. package/src/sass/tokens/_contrast.scss +94 -0
  519. package/src/sass/tokens/_elevation.scss +16 -0
  520. package/src/sass/tokens/_index.scss +5 -0
  521. package/src/sass/tokens/_motion.scss +109 -0
  522. package/src/sass/tokens/_reference.scss +72 -141
  523. package/src/sass/tokens/_shape.scss +38 -0
  524. package/src/sass/tokens/_stacking.scss +27 -0
  525. package/src/sass/tokens/_state.scss +2 -4
  526. package/src/sass/tokens/_theme.scss +11 -2
  527. package/src/sass/tokens/_vibrant.scss +2 -5
  528. package/src/sass/utilities/_colors.scss +6 -1
  529. package/src/sass/utilities/_defer-render.scss +17 -0
  530. package/src/sass/utilities/_helpers.scss +183 -26
  531. package/src/sass/utilities/_index.scss +2 -1
  532. package/src/sass/utilities/_scroll-area.scss +0 -2
  533. package/src/sass/utilities/_spacing.scss +52 -34
  534. package/src/sass/utilities/_typescale.scss +8 -1
  535. package/src/sass/utilities/_visibility.scss +47 -76
  536. package/src/sass/utilities/_z-depth.scss +7 -4
  537. package/dist/js/chunks/chunk-3DHK5CZU.mjs.map +0 -7
  538. package/dist/js/chunks/chunk-3GVFZ4XO.mjs.map +0 -7
  539. package/dist/js/chunks/chunk-4HZMB7LI.mjs.map +0 -7
  540. package/dist/js/chunks/chunk-4KMNFIFZ.mjs +0 -270
  541. package/dist/js/chunks/chunk-4KMNFIFZ.mjs.map +0 -7
  542. package/dist/js/chunks/chunk-4TKTLGEM.mjs.map +0 -7
  543. package/dist/js/chunks/chunk-5BKHWHYY.mjs +0 -292
  544. package/dist/js/chunks/chunk-5BKHWHYY.mjs.map +0 -7
  545. package/dist/js/chunks/chunk-5HQSGDZ5.mjs.map +0 -7
  546. package/dist/js/chunks/chunk-6N2XAEFK.mjs +0 -125
  547. package/dist/js/chunks/chunk-6N2XAEFK.mjs.map +0 -7
  548. package/dist/js/chunks/chunk-A7ALMYUR.mjs.map +0 -7
  549. package/dist/js/chunks/chunk-BG6ZRB5H.mjs.map +0 -7
  550. package/dist/js/chunks/chunk-CUQPB25U.mjs +0 -55
  551. package/dist/js/chunks/chunk-CUQPB25U.mjs.map +0 -7
  552. package/dist/js/chunks/chunk-DAIU5SLG.mjs.map +0 -7
  553. package/dist/js/chunks/chunk-FS7XY3HT.mjs.map +0 -7
  554. package/dist/js/chunks/chunk-GIW4K4SE.mjs.map +0 -7
  555. package/dist/js/chunks/chunk-GUB3TNO2.mjs.map +0 -7
  556. package/dist/js/chunks/chunk-GVGT6MIU.mjs.map +0 -7
  557. package/dist/js/chunks/chunk-GZKEFWPM.mjs +0 -181
  558. package/dist/js/chunks/chunk-GZKEFWPM.mjs.map +0 -7
  559. package/dist/js/chunks/chunk-HKT2S7VM.mjs +0 -48
  560. package/dist/js/chunks/chunk-HKT2S7VM.mjs.map +0 -7
  561. package/dist/js/chunks/chunk-ILP3PDTL.mjs +0 -187
  562. package/dist/js/chunks/chunk-ILP3PDTL.mjs.map +0 -7
  563. package/dist/js/chunks/chunk-JIDMQGK6.mjs.map +0 -7
  564. package/dist/js/chunks/chunk-KBNN3QDH.mjs +0 -7
  565. package/dist/js/chunks/chunk-KBNN3QDH.mjs.map +0 -7
  566. package/dist/js/chunks/chunk-KHV6DZXX.mjs.map +0 -7
  567. package/dist/js/chunks/chunk-KY6U46SM.mjs +0 -345
  568. package/dist/js/chunks/chunk-KY6U46SM.mjs.map +0 -7
  569. package/dist/js/chunks/chunk-LRZMJZ3T.mjs +0 -291
  570. package/dist/js/chunks/chunk-LRZMJZ3T.mjs.map +0 -7
  571. package/dist/js/chunks/chunk-LTWPGFBR.mjs +0 -59
  572. package/dist/js/chunks/chunk-LTWPGFBR.mjs.map +0 -7
  573. package/dist/js/chunks/chunk-MNPROCZF.mjs +0 -328
  574. package/dist/js/chunks/chunk-MNPROCZF.mjs.map +0 -7
  575. package/dist/js/chunks/chunk-MZ6Z24BX.mjs.map +0 -7
  576. package/dist/js/chunks/chunk-NS2UMNZV.mjs.map +0 -7
  577. package/dist/js/chunks/chunk-O5XPWXIQ.mjs +0 -406
  578. package/dist/js/chunks/chunk-O5XPWXIQ.mjs.map +0 -7
  579. package/dist/js/chunks/chunk-PM655FXL.mjs.map +0 -7
  580. package/dist/js/chunks/chunk-QDAL4IYN.mjs.map +0 -7
  581. package/dist/js/chunks/chunk-QERLECVU.mjs +0 -572
  582. package/dist/js/chunks/chunk-QERLECVU.mjs.map +0 -7
  583. package/dist/js/chunks/chunk-QJABDLSD.mjs +0 -112
  584. package/dist/js/chunks/chunk-QJABDLSD.mjs.map +0 -7
  585. package/dist/js/chunks/chunk-RHRQKTTX.mjs +0 -139
  586. package/dist/js/chunks/chunk-RHRQKTTX.mjs.map +0 -7
  587. package/dist/js/chunks/chunk-S3XDFGSZ.mjs.map +0 -7
  588. package/dist/js/chunks/chunk-SPETGK25.mjs +0 -59
  589. package/dist/js/chunks/chunk-SPETGK25.mjs.map +0 -7
  590. package/dist/js/chunks/chunk-TBM3FT7G.mjs.map +0 -7
  591. package/dist/js/chunks/chunk-UEXCIMJZ.mjs.map +0 -7
  592. package/dist/js/chunks/chunk-UEZUJQ66.mjs.map +0 -7
  593. package/dist/js/chunks/chunk-VGZSAFTX.mjs +0 -173
  594. package/dist/js/chunks/chunk-VGZSAFTX.mjs.map +0 -7
  595. package/dist/js/chunks/chunk-X7OCHZVF.mjs +0 -76
  596. package/dist/js/chunks/chunk-X7OCHZVF.mjs.map +0 -7
  597. package/dist/js/chunks/chunk-YDCS5S3J.mjs.map +0 -7
  598. package/dist/js/chunks/chunk-YMSXJON6.mjs +0 -79
  599. package/dist/js/chunks/chunk-YMSXJON6.mjs.map +0 -7
  600. package/dist/js/chunks/chunk-Z2NRKI7R.mjs.map +0 -7
  601. package/dist/js/chunks/chunk-ZAS25YFD.mjs.map +0 -7
  602. package/dist/js/chunks/chunk-ZKZKNSLC.mjs +0 -1
  603. /package/dist/js/chunks/{chunk-ZKZKNSLC.mjs.map → chunk-GNRSYMVH.mjs.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/behaviors/tour.ts"],
4
+ "sourcesContent": ["import { Utils } from '../core/utils';\n\ninterface TourState {\n steps: HTMLElement[];\n index: number;\n opener: HTMLElement | null;\n}\n\nconst states = new WeakMap<HTMLElement, TourState>();\nconst anchor = '--tour-target';\n\n/**\n * Product tour. A `.tour` is a `popover=\"manual\"` card holding one `<section>`\n * per step; each section's `data-tour-target` names the id of the element it\n * explains. The card shows one step at a time beside its target, which gets a\n * highlight ring and scrolls into view. Steps whose target is missing or\n * hidden are skipped.\n *\n * `[data-tour-start=\"tour-id\"]` starts a tour; inside it, `[data-tour-back]`,\n * `[data-tour-next]`, `[data-tour-done]` and `[data-tour-close]` move through\n * it or end it, and Escape ends it. Back hides on the first step, Next on the\n * last, Done everywhere else. Ending hides the card (its `toggle` event says\n * so) and returns focus to whatever had it before the tour.\n */\nexport class Tour {\n static i18n = { progress: 'Step {current} of {total}' };\n private static _initialized = false;\n\n static Init() {\n if (Tour._initialized || typeof document === 'undefined') return;\n Tour._initialized = true;\n document.addEventListener('click', Tour._onClick);\n document.addEventListener('keydown', (e) => {\n const tour = Utils.closestInPath(e, '.tour');\n if (e.key === 'Escape' && tour instanceof HTMLElement && states.has(tour)) Tour.end(tour);\n });\n // A page that hides the card itself still gets the target released.\n // `toggle` does not bubble, so this listens in the capture phase.\n document.addEventListener(\n 'toggle',\n (e: ToggleEvent) => {\n const tour = e.target as HTMLElement;\n if (e.newState === 'closed' && states.has(tour)) Tour.end(tour);\n },\n true\n );\n }\n\n /** Opens the tour at a step. Does nothing when no step has a visible target. */\n static start(tour: HTMLElement, index = 0) {\n const steps = [...tour.querySelectorAll<HTMLElement>(':scope > section[data-tour-target]')].filter((step) =>\n Tour._target(step)?.checkVisibility()\n );\n if (!steps.length) return;\n const previous = states.get(tour);\n // Restarting a running tour: let go of the step it was showing, or two\n // targets carry the highlight and the card's anchor name.\n if (previous) Tour._release(previous.steps[previous.index]);\n const state: TourState = { steps, index: 0, opener: Tour._opener(tour, previous) };\n states.set(tour, state);\n Tour._show(tour, !previous);\n // An open listener may have ended or restarted the tour.\n if (states.get(tour) === state) Tour.go(tour, index);\n }\n\n /** Where focus returns at the end: the first start's focus, kept across restarts. */\n private static _opener(tour: HTMLElement, previous: TourState | undefined): HTMLElement | null {\n if (previous?.opener) return previous.opener;\n const active = (tour.getRootNode() as Document | ShadowRoot).activeElement;\n return active instanceof HTMLElement ? active : null;\n }\n\n /** Shows the card, and reports the start of a tour that was not running. */\n private static _show(tour: HTMLElement, opening: boolean) {\n if (!tour.matches(':popover-open')) tour.showPopover();\n if (opening) Utils.emit(tour, 'open');\n }\n\n /** Shows step `index` of a running tour. */\n static go(tour: HTMLElement, index: number) {\n const state = states.get(tour);\n if (!state) return;\n Tour._release(state.steps[state.index]);\n index = Math.min(Math.max(index, 0), state.steps.length - 1);\n // A target removed since start() is passed over in the direction of\n // travel; with none left that way the tour ends.\n const travel = index < state.index ? -1 : 1;\n while (state.steps[index] && !Tour._target(state.steps[index])) index += travel;\n const step = state.steps[index];\n if (!step) {\n Tour.end(tour);\n return;\n }\n state.index = index;\n const last = state.index === state.steps.length - 1;\n tour.querySelectorAll<HTMLElement>(':scope > section[data-tour-target]').forEach((section) => {\n section.hidden = section !== step;\n });\n const heading = step.querySelector<HTMLElement>('h1, h2, h3, h4, h5, h6');\n if (heading) {\n if (!heading.id) heading.id = `tour-${Utils.guid()}`;\n tour.setAttribute('aria-labelledby', heading.id);\n }\n const progress = tour.querySelector('.tour-progress');\n if (progress) {\n progress.textContent = Tour.i18n.progress\n .replace('{current}', String(state.index + 1))\n .replace('{total}', String(state.steps.length));\n }\n const toggle = (selector: string, show: boolean) =>\n tour.querySelectorAll<HTMLElement>(selector).forEach((button) => (button.hidden = !show));\n toggle('[data-tour-back]', state.index > 0);\n toggle('[data-tour-next]', !last);\n toggle('[data-tour-done]', last);\n\n const target = Tour._target(step);\n target.classList.add('tour-target');\n Utils.setAnchorName(target, anchor, true);\n const smooth = !matchMedia('(prefers-reduced-motion: reduce)').matches;\n target.scrollIntoView({ block: 'center', behavior: smooth ? 'smooth' : 'auto' });\n if (!tour.hasAttribute('tabindex')) tour.tabIndex = -1;\n tour.focus({ preventScroll: true });\n Utils.emit(tour, 'change', { step, index: state.index });\n }\n\n /**\n * Ends a running tour and returns focus to where it was. `completed` says\n * the user finished it, as the done button does, rather than dismissed it.\n */\n static end(tour: HTMLElement, completed = false) {\n const state = states.get(tour);\n if (!state) return;\n Tour._release(state.steps[state.index]);\n states.delete(tour);\n if (tour.matches(':popover-open')) tour.hidePopover();\n state.opener?.focus();\n Utils.emit(tour, 'close', { completed });\n }\n\n private static _target(step: HTMLElement): HTMLElement | null {\n return Utils.getElementById(step, step.getAttribute('data-tour-target') ?? '');\n }\n\n private static _release(step: HTMLElement | undefined) {\n const target = step && Tour._target(step);\n target?.classList.remove('tour-target');\n if (target) Utils.setAnchorName(target, anchor, false);\n }\n\n private static _onClick(e: MouseEvent) {\n const control = Utils.closestInPath(\n e,\n '[data-tour-start], [data-tour-back], [data-tour-next], [data-tour-done], [data-tour-close]'\n );\n if (!control) return;\n if (control.hasAttribute('data-tour-start')) {\n const tour = Utils.getElementById(control, control.getAttribute('data-tour-start'));\n if (tour?.matches('.tour')) Tour.start(tour);\n return;\n }\n const tour = control.closest<HTMLElement>('.tour');\n const state = tour && states.get(tour);\n if (!state) return;\n if (control.hasAttribute('data-tour-back')) Tour.go(tour, state.index - 1);\n else if (control.hasAttribute('data-tour-next')) Tour.go(tour, state.index + 1);\n else Tour.end(tour, control.hasAttribute('data-tour-done'));\n }\n}\n"],
5
+ "mappings": ";;;;;AAQA,IAAM,SAAS,oBAAI,QAAgC;AACnD,IAAM,SAAS;AAeR,IAAM,QAAN,MAAM,MAAK;AAAA,EAIhB,OAAO,OAAO;AACZ,QAAI,MAAK,gBAAgB,OAAO,aAAa,YAAa;AAC1D,UAAK,eAAe;AACpB,aAAS,iBAAiB,SAAS,MAAK,QAAQ;AAChD,aAAS,iBAAiB,WAAW,CAAC,MAAM;AAC1C,YAAM,OAAO,MAAM,cAAc,GAAG,OAAO;AAC3C,UAAI,EAAE,QAAQ,YAAY,gBAAgB,eAAe,OAAO,IAAI,IAAI,EAAG,OAAK,IAAI,IAAI;AAAA,IAC1F,CAAC;AAGD,aAAS;AAAA,MACP;AAAA,MACA,CAAC,MAAmB;AAClB,cAAM,OAAO,EAAE;AACf,YAAI,EAAE,aAAa,YAAY,OAAO,IAAI,IAAI,EAAG,OAAK,IAAI,IAAI;AAAA,MAChE;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA,OAAO,MAAM,MAAmB,QAAQ,GAAG;AACzC,UAAM,QAAQ,CAAC,GAAG,KAAK,iBAA8B,oCAAoC,CAAC,EAAE;AAAA,MAAO,CAAC,SAClG,MAAK,QAAQ,IAAI,GAAG,gBAAgB;AAAA,IACtC;AACA,QAAI,CAAC,MAAM,OAAQ;AACnB,UAAM,WAAW,OAAO,IAAI,IAAI;AAGhC,QAAI,SAAU,OAAK,SAAS,SAAS,MAAM,SAAS,KAAK,CAAC;AAC1D,UAAM,QAAmB,EAAE,OAAO,OAAO,GAAG,QAAQ,MAAK,QAAQ,MAAM,QAAQ,EAAE;AACjF,WAAO,IAAI,MAAM,KAAK;AACtB,UAAK,MAAM,MAAM,CAAC,QAAQ;AAE1B,QAAI,OAAO,IAAI,IAAI,MAAM,MAAO,OAAK,GAAG,MAAM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AK,QAAQ,IAAI;AACxC,YAAQ,UAAU,OAAO,aAAa;AACtC,QAAI,OAAQ,OAAM,cAAc,QAAQ,QAAQ,KAAK;AAAA,EACvD;AAAA,EAEA,OAAe,SAAS,GAAe;AACrC,UAAM,UAAU,MAAM;AAAA,MACpB;AAAA,MACA;AAAA,IACF;AACA,QAAI,CAAC,QAAS;AACd,QAAI,QAAQ,aAAa,iBAAiB,GAAG;AAC3C,YAAMA,QAAO,MAAM,eAAe,SAAS,QAAQ,aAAa,iBAAiB,CAAC;AAClF,UAAIA,OAAM,QAAQ,OAAO,EAAG,OAAK,MAAMA,KAAI;AAC3C;AAAA,IACF;AACA,UAAM,OAAO,QAAQ,QAAqB,OAAO;AACjD,UAAM,QAAQ,QAAQ,OAAO,IAAI,IAAI;AACrC,QAAI,CAAC,MAAO;AACZ,QAAI,QAAQ,aAAa,gBAAgB,EAAG,OAAK,GAAG,MAAM,MAAM,QAAQ,CAAC;AAAA,aAChE,QAAQ,aAAa,gBAAgB,EAAG,OAAK,GAAG,MAAM,MAAM,QAAQ,CAAC;AAAA,QACzE,OAAK,IAAI,MAAM,QAAQ,aAAa,gBAAgB,CAAC;AAAA,EAC5D;AACF;AA/Ia,MACJ,OAAO,EAAE,UAAU,4BAA4B;AAD3C,MAEI,eAAe;AAFzB,IAAM,OAAN;",
6
+ "names": ["tour"]
7
+ }
@@ -0,0 +1,244 @@
1
+ import {
2
+ LineChart,
3
+ numberFormat,
4
+ polarPoint,
5
+ rowLegend,
6
+ signs
7
+ } from "./chunk-ZM3XBHWV.mjs";
8
+ import {
9
+ svgNode
10
+ } from "./chunk-ZVLOUDIJ.mjs";
11
+
12
+ // src/ts/components/pieChart.ts
13
+ var COLORS = 6;
14
+ var RADIUS = 46;
15
+ var GROWN = 1.06;
16
+ var LABEL_SHARE = 0.05;
17
+ var _maskId = 0;
18
+ function decimals(text) {
19
+ const [, fraction = "", exponent = "0"] = /(?:\.(\d+))?(?:e([+-]?\d+))?$/i.exec(text.replace(/[^\d.e+-]/gi, ""));
20
+ return Math.max(0, fraction.length - Number(exponent));
21
+ }
22
+ function stack(names, away, anchor) {
23
+ names.sort(([a], [b]) => (a - b) * away);
24
+ const ys = names.map(([y]) => y);
25
+ if (anchor !== void 0) ys.unshift(anchor);
26
+ const first = ys.length - names.length;
27
+ names.forEach(([, name], k) => {
28
+ const tops = ys.slice(0, first + k + 1).map((y, j) => `calc(50cqw + ${y} * var(--pie-chart-name-at) + ${(first + k - j) * away} * var(--pie-chart-name-step))`);
29
+ name.style.setProperty("--pie-chart-name-top", `${away > 0 ? "max" : "min"}(${tops.join(", ")})`);
30
+ });
31
+ }
32
+ var PieChart = class extends LineChart {
33
+ get _type() {
34
+ return "pie-chart";
35
+ }
36
+ /** A pie has no value axis. */
37
+ get _axis() {
38
+ return false;
39
+ }
40
+ get _points() {
41
+ return false;
42
+ }
43
+ get _circular() {
44
+ return true;
45
+ }
46
+ _read() {
47
+ super._read();
48
+ const small = this._small();
49
+ if (!small) return;
50
+ const sum = this.series[0].values.reduce((total, value, i) => total + (small[i] ? Math.max(0, value) : 0), 0);
51
+ const text = this._written(sum, this._rows.filter((_, i) => small[i]).map((row) => row.cells[1]));
52
+ const keep = (list, other) => [...list.filter((_, i) => !small[i]), other];
53
+ this.labels = keep(this.labels, this.el.dataset.otherLabel || "Other");
54
+ this.series = this.series.map((series, i) => {
55
+ const values = keep(series.values, i ? null : sum);
56
+ return { ...series, values, tops: values, text: keep(series.text, i ? "" : text) };
57
+ });
58
+ }
59
+ /**
60
+ * The group's sum written like its cells: with their signs, and to their
61
+ * decimals, or compact when data-value stands behind text such as "$38M".
62
+ */
63
+ _written(sum, cells) {
64
+ const texts = cells.map((cell) => cell.textContent.trim());
65
+ const [prefix, suffix] = signs(texts[0]);
66
+ return `${prefix}${numberFormat(this.el, this._precision(texts, cells)).format(sum)}${suffix}`;
67
+ }
68
+ _precision(texts, cells) {
69
+ if (cells.some((cell) => cell.dataset.value)) return { notation: "compact", maximumSignificantDigits: 3 };
70
+ const digits = Math.max(0, ...texts.map(decimals));
71
+ return digits > 20 ? { maximumSignificantDigits: 3 } : { maximumFractionDigits: digits };
72
+ }
73
+ /**
74
+ * Which rows data-other groups: those with a value under that percentage
75
+ * of the whole. Null when it groups nothing, as one small row is clearer
76
+ * by its own name.
77
+ */
78
+ _small() {
79
+ const percent = this._number("other");
80
+ const values = this.series[0]?.values.map((value) => value === null ? null : Math.max(0, value));
81
+ if (!values || !(percent > 0)) return null;
82
+ const total = values.reduce((sum, value) => sum + (value ?? 0), 0);
83
+ const small = values.map((value) => value !== null && value / total * 100 < percent - 1e-9);
84
+ return small.filter(Boolean).length > 1 ? small : null;
85
+ }
86
+ show(index) {
87
+ if (!this._tooltip || index === this.activeIndex) return;
88
+ super.show(index);
89
+ this._slices.forEach((slice, i) => slice?.classList.toggle("active", i === index));
90
+ if (this._tooltip.hidden) return;
91
+ const color = this._colors[index];
92
+ this._tooltip.querySelectorAll("[data-series]").forEach((span) => {
93
+ if (color) span.dataset.series = color;
94
+ else delete span.dataset.series;
95
+ });
96
+ const share = this._share(index);
97
+ const value = this._tooltip.querySelector("span:nth-of-type(2)");
98
+ if (share && value) value.textContent += ` (${share})`;
99
+ }
100
+ /** CSS places the tooltip on the slice's middle from --turn. */
101
+ _place(index) {
102
+ const middle = (this._turns[index][0] + this._turns[index][1]) / 2;
103
+ this._tooltip.style.setProperty("--turn", String(middle));
104
+ this._tooltip.classList.toggle("end", middle < 0.5);
105
+ }
106
+ /** The row's share of the whole as a percentage, or '' for none. */
107
+ _share(index) {
108
+ var _a;
109
+ const [start, end] = this._turns[index];
110
+ if (end <= start) return "";
111
+ const share = end - start;
112
+ const digits = share < 0.1 ? 1 : 0;
113
+ (_a = this._percents ?? (this._percents = []))[digits] ?? (_a[digits] = this._percent(digits));
114
+ return this._percents[digits].format(share);
115
+ }
116
+ _percent(digits) {
117
+ return numberFormat(this.el, { style: "percent", maximumFractionDigits: digits });
118
+ }
119
+ // ponytail: names only move up or down their side, so many thin slices
120
+ // near the top or bottom run into the caption or legend; group them as "Other".
121
+ /**
122
+ * Each slice's row name outside it, on the slice's middle, with a leader
123
+ * line back to the slice. Names on the right half run rightwards and those
124
+ * on the left run leftwards.
125
+ */
126
+ _names() {
127
+ const names = document.createElement("div");
128
+ names.className = "pie-chart-names";
129
+ const sides = [[], [], [], []];
130
+ this._turns.forEach(([start, end], i) => {
131
+ if (end <= start) return;
132
+ const turn = (start + end) / 2;
133
+ const y = -Math.cos(turn * 2 * Math.PI);
134
+ const name = document.createElement("span");
135
+ name.dataset.series = this._colors[i];
136
+ name.style.setProperty("--turn", String(turn));
137
+ name.classList.toggle("end", turn >= 0.5);
138
+ const text = document.createElement("span");
139
+ text.textContent = this.labels[i];
140
+ name.append(text);
141
+ names.append(name);
142
+ sides[(turn >= 0.5 ? 2 : 0) + Number(y >= 0)].push([y, name]);
143
+ });
144
+ for (const i of [0, 2]) {
145
+ stack(sides[i], -1);
146
+ stack(sides[i + 1], 1, sides[i][0]?.[0]);
147
+ }
148
+ return names;
149
+ }
150
+ /** The legend: every row with its color, its cell and its share. */
151
+ _guides() {
152
+ this._percents = [];
153
+ const text = this.series[0].text;
154
+ return [rowLegend("pie-chart-legend", this._colors, this.labels.map((label, i) => [label, text[i], this._share(i)]))];
155
+ }
156
+ /** The row under the pointer by its angle from the middle, or -1 off the slices. */
157
+ _indexAt(e) {
158
+ const [turn, share] = this._polarAt(e);
159
+ const distance = share * 100;
160
+ const hole = this.el.classList.contains("donut") ? parseFloat(getComputedStyle(this.el).getPropertyValue("--md-comp-pie-chart-hole")) || 0 : 0;
161
+ if (distance < RADIUS * hole) return -1;
162
+ const index = this._turns.findIndex(([start, end]) => start <= turn && turn < end);
163
+ return distance > RADIUS * (index === this.activeIndex ? GROWN : 1) ? -1 : index;
164
+ }
165
+ /**
166
+ * An SVG of slices in a -50 to 50 box, under a mask that cuts the gaps
167
+ * between them and the donut's hole, which CSS sizes. The values and the
168
+ * total are HTML over it.
169
+ */
170
+ _draw() {
171
+ const values = this.series[0].values.map((value) => Math.max(0, value ?? 0));
172
+ const total = values.reduce((sum, value) => sum + value, 0);
173
+ let turn = 0;
174
+ this._turns = values.map((value) => [turn, turn += total ? value / total : 0]);
175
+ const drawn = this._turns.filter(([start, end]) => end > start);
176
+ let slice = 0;
177
+ this._colors = this._turns.map(([start, end]) => {
178
+ if (end <= start) return void 0;
179
+ const index = slice++;
180
+ return String(index === drawn.length - 1 && index > 0 && index % COLORS === 0 ? 2 : index % COLORS + 1);
181
+ });
182
+ const pie = document.createElement("div");
183
+ pie.className = "pie-chart-pie";
184
+ pie.setAttribute("aria-hidden", "true");
185
+ const svg = svgNode("svg", { viewBox: "-50 -50 100 100", focusable: "false" });
186
+ const id = `pie-chart-mask-${++_maskId}`;
187
+ const area = { x: "-50", y: "-50", width: "100", height: "100" };
188
+ const mask = svgNode("mask", { id, maskUnits: "userSpaceOnUse", ...area });
189
+ mask.append(
190
+ svgNode("rect", { ...area, fill: "white" }),
191
+ svgNode("path", {
192
+ class: "pie-chart-gaps",
193
+ stroke: "black",
194
+ d: drawn.length > 1 ? drawn.map(([start]) => `M0,0L${polarPoint(start, 50)}`).join("") : ""
195
+ }),
196
+ svgNode("circle", { class: "pie-chart-hole", r: String(RADIUS), fill: "black" })
197
+ );
198
+ const slices = svgNode("g", { mask: `url(#${id})` });
199
+ const arc = `A${RADIUS},${RADIUS} 0`;
200
+ this._slices = this._turns.map(([start, end], i) => {
201
+ if (end <= start) return null;
202
+ const slice2 = svgNode("path", {
203
+ class: "pie-chart-slice",
204
+ "data-series": this._colors[i],
205
+ // A whole circle is two half arcs; one arc cannot end where it starts.
206
+ d: end - start >= 1 ? `M0,${-RADIUS}${arc} 1 1 0,${RADIUS}${arc} 1 1 0,${-RADIUS}Z` : `M0,0L${polarPoint(start, RADIUS)}${arc} ${end - start > 0.5 ? 1 : 0} 1 ${polarPoint(end, RADIUS)}Z`
207
+ });
208
+ slices.append(slice2);
209
+ return slice2;
210
+ });
211
+ svg.append(mask, slices);
212
+ pie.append(svg, ...this._texts());
213
+ const middle = this._total("pie-chart-total");
214
+ if (middle) pie.append(middle);
215
+ return pie;
216
+ }
217
+ /** The .values shares on the slices and the .labels names outside them. */
218
+ _texts() {
219
+ const texts = [];
220
+ if (this.el.classList.contains("values")) texts.push(this._values());
221
+ if (this.el.classList.contains("labels") && !this.el.classList.contains("sparkline")) texts.push(this._names());
222
+ return texts;
223
+ }
224
+ /** Each slice's share on it, except on slices too thin to hold it. */
225
+ _values() {
226
+ const labels = document.createElement("div");
227
+ labels.className = "pie-chart-values";
228
+ this._turns.forEach(([start, end], i) => {
229
+ if (end - start < LABEL_SHARE) return;
230
+ const label = document.createElement("span");
231
+ label.dataset.series = this._colors[i];
232
+ label.style.setProperty("--turn", String((start + end) / 2));
233
+ label.textContent = this._share(i);
234
+ labels.append(label);
235
+ });
236
+ return labels;
237
+ }
238
+ };
239
+ PieChart.key = "Expressive_PieChart";
240
+
241
+ export {
242
+ PieChart
243
+ };
244
+ //# sourceMappingURL=chunk-NBJAUGPP.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/components/pieChart.ts"],
4
+ "sourcesContent": ["import { LineChart, LineChartOptions, numberFormat, polarPoint as at, rowLegend, signs } from './lineChart';\nimport { svgNode as node } from '../core/utils';\n\nexport type PieChartOptions = LineChartOptions;\n\n// ponytail: rows past six repeat the colors; data-other groups the small ones.\nconst COLORS = 6;\n/** The pie's radius in a 100-unit box, leaving room for the active slice to grow. */\nconst RADIUS = 46;\n/** The active slice's scale, as in _pie-chart.scss. */\nconst GROWN = 1.06;\n/** Slices smaller than this share get no .values label. */\nconst LABEL_SHARE = 0.05;\nlet _maskId = 0;\n\n/** How many decimals a cell's number has, counting an exponent: \"2.5e-3\" has 4. */\nfunction decimals(text: string) {\n // Keeping only the number's characters first keeps the match linear.\n const [, fraction = '', exponent = '0'] = /(?:\\.(\\d+))?(?:e([+-]?\\d+))?$/i.exec(text.replace(/[^\\d.e+-]/gi, ''))!;\n return Math.max(0, fraction.length - Number(exponent));\n}\n\n/**\n * Sets each name's --pie-chart-name-top so neighbours on one side of the pie sit at least\n * --pie-chart-name-step apart, pushed away from the middle line: down below\n * it (`away` 1) and up above it (-1). Each top is the furthest of the natural\n * places of the names before it, plus a step for every name between. An\n * `anchor` is a fixed place before the first name, the unmoved innermost\n * name across the middle line.\n */\nfunction stack(names: [number, HTMLElement][], away: number, anchor?: number) {\n names.sort(([a], [b]) => (a - b) * away);\n const ys = names.map(([y]) => y);\n if (anchor !== undefined) ys.unshift(anchor);\n const first = ys.length - names.length;\n names.forEach(([, name], k) => {\n const tops = ys.slice(0, first + k + 1).map((y, j) =>\n `calc(50cqw + ${y} * var(--pie-chart-name-at) + ${(first + k - j) * away} * var(--pie-chart-name-step))`);\n name.style.setProperty('--pie-chart-name-top', `${away > 0 ? 'max' : 'min'}(${tops.join(', ')})`);\n });\n}\n\n/**\n * Pie chart. It reads its <table> like LineChart, but draws each row of the\n * first value column as a slice of the whole, clockwise from the top, with\n * a legend of every row and its share. With `.donut`, a <tfoot> row is the\n * total in the middle. Further columns show in the tooltip. With\n * `data-other`, rows under that percentage of the whole become one row,\n * last, named by `data-other-label` (\"Other\" by default); the table keeps\n * every row.\n *\n * Call `update()` after changing the table, or start it with `watch` or\n * `data-watch`.\n */\nexport class PieChart extends LineChart {\n // No initializers: LineChart's constructor draws before they would run.\n /** Each row's start and end, as fractions of a turn clockwise from the top. */\n private _turns: [number, number][];\n /** Each row's color, or undefined for a row with no slice. */\n private _colors: (string | undefined)[];\n private _slices: (SVGPathElement | null)[];\n /** Percent formatters by fraction digits, rebuilt once per legend. */\n private _percents: Intl.NumberFormat[];\n\n protected get _type() {\n return 'pie-chart';\n }\n\n /** A pie has no value axis. */\n protected get _axis() {\n return false;\n }\n\n protected get _points() {\n return false;\n }\n\n protected get _circular() {\n return true;\n }\n\n protected _read() {\n super._read();\n const small = this._small();\n if (!small) return;\n const sum = this.series[0].values.reduce<number>((total, value, i) => total + (small[i] ? Math.max(0, value!) : 0), 0);\n const text = this._written(sum, this._rows.filter((_, i) => small[i]).map((row) => row.cells[1]));\n const keep = <T>(list: T[], other: T) => [...list.filter((_, i) => !small[i]), other];\n this.labels = keep(this.labels, this.el.dataset.otherLabel || 'Other');\n // Only the first column adds up; further columns have no value for the group.\n this.series = this.series.map((series, i) => {\n const values = keep(series.values, i ? null : sum);\n return { ...series, values, tops: values, text: keep(series.text, i ? '' : text) };\n });\n }\n\n /**\n * The group's sum written like its cells: with their signs, and to their\n * decimals, or compact when data-value stands behind text such as \"$38M\".\n */\n private _written(sum: number, cells: HTMLTableCellElement[]) {\n const texts = cells.map((cell) => cell.textContent.trim());\n const [prefix, suffix] = signs(texts[0]);\n return `${prefix}${numberFormat(this.el, this._precision(texts, cells)).format(sum)}${suffix}`;\n }\n\n private _precision(texts: string[], cells: HTMLTableCellElement[]): Intl.NumberFormatOptions {\n if (cells.some((cell) => cell.dataset.value)) return { notation: 'compact', maximumSignificantDigits: 3 };\n const digits = Math.max(0, ...texts.map(decimals));\n // Older engines take at most 20 fraction digits; past that, keep the sum's first digits.\n return digits > 20 ? { maximumSignificantDigits: 3 } : { maximumFractionDigits: digits };\n }\n\n /**\n * Which rows data-other groups: those with a value under that percentage\n * of the whole. Null when it groups nothing, as one small row is clearer\n * by its own name.\n */\n private _small() {\n const percent = this._number('other');\n const values = this.series[0]?.values.map((value) => (value === null ? null : Math.max(0, value)));\n if (!values || !(percent! > 0)) return null;\n const total = values.reduce<number>((sum, value) => sum + (value ?? 0), 0);\n // A row exactly at the percentage stays, despite rounding in the division.\n const small = values.map((value) => value !== null && (value / total) * 100 < percent! - 1e-9);\n return small.filter(Boolean).length > 1 ? small : null;\n }\n\n static key = 'Expressive_PieChart';\n\n show(index: number) {\n if (!this._tooltip || index === this.activeIndex) return;\n super.show(index);\n this._slices.forEach((slice, i) => slice?.classList.toggle('active', i === index));\n // LineChart hides the tooltip for -1 and for an index past the last row.\n if (this._tooltip.hidden) return;\n\n const color = this._colors[index];\n this._tooltip.querySelectorAll<HTMLElement>('[data-series]').forEach((span) => {\n if (color) span.dataset.series = color;\n else delete span.dataset.series;\n });\n const share = this._share(index);\n const value = this._tooltip.querySelector('span:nth-of-type(2)');\n if (share && value) value.textContent += ` (${share})`;\n }\n\n /** CSS places the tooltip on the slice's middle from --turn. */\n protected _place(index: number) {\n const middle = (this._turns[index][0] + this._turns[index][1]) / 2;\n this._tooltip.style.setProperty('--turn', String(middle));\n // On the right half it opens leftwards, over the pie.\n this._tooltip.classList.toggle('end', middle < 0.5);\n }\n\n /** The row's share of the whole as a percentage, or '' for none. */\n private _share(index: number) {\n const [start, end] = this._turns[index];\n if (end <= start) return '';\n const share = end - start;\n // Whole percentages, with a tenth below 10% so a small part is not 0%.\n const digits = share < 0.1 ? 1 : 0;\n (this._percents ??= [])[digits] ??= this._percent(digits);\n return this._percents[digits].format(share);\n }\n\n private _percent(digits: number) {\n return numberFormat(this.el, { style: 'percent', maximumFractionDigits: digits });\n }\n\n // ponytail: names only move up or down their side, so many thin slices\n // near the top or bottom run into the caption or legend; group them as \"Other\".\n /**\n * Each slice's row name outside it, on the slice's middle, with a leader\n * line back to the slice. Names on the right half run rightwards and those\n * on the left run leftwards.\n */\n private _names() {\n const names = document.createElement('div');\n names.className = 'pie-chart-names';\n // Right above, right below, left above and left below the middle line.\n const sides: [number, HTMLElement][][] = [[], [], [], []];\n this._turns.forEach(([start, end], i) => {\n if (end <= start) return;\n const turn = (start + end) / 2;\n const y = -Math.cos(turn * 2 * Math.PI);\n const name = document.createElement('span');\n name.dataset.series = this._colors[i];\n name.style.setProperty('--turn', String(turn));\n name.classList.toggle('end', turn >= 0.5);\n // The text is cut short inside the name, which draws the leader line.\n const text = document.createElement('span');\n text.textContent = this.labels[i];\n name.append(text);\n names.append(name);\n sides[(turn >= 0.5 ? 2 : 0) + Number(y >= 0)].push([y, name]);\n });\n // Names below the line start a step under the innermost name above it.\n for (const i of [0, 2]) {\n stack(sides[i], -1);\n stack(sides[i + 1], 1, sides[i][0]?.[0]);\n }\n return names;\n }\n\n /** The legend: every row with its color, its cell and its share. */\n protected _guides(): Element[] {\n // A redraw picks up a changed lang attribute.\n this._percents = [];\n const text = this.series[0].text;\n return [rowLegend('pie-chart-legend', this._colors, this.labels.map((label, i) => [label, text[i], this._share(i)]))];\n }\n\n /** The row under the pointer by its angle from the middle, or -1 off the slices. */\n protected _indexAt(e: PointerEvent) {\n const [turn, share] = this._polarAt(e);\n // The distance in the SVG's 100-unit box.\n const distance = share * 100;\n const hole = this.el.classList.contains('donut')\n ? parseFloat(getComputedStyle(this.el).getPropertyValue('--md-comp-pie-chart-hole')) || 0\n : 0;\n if (distance < RADIUS * hole) return -1;\n const index = this._turns.findIndex(([start, end]) => start <= turn && turn < end);\n // The active slice is drawn larger, so the pointer stays on it to its edge.\n return distance > RADIUS * (index === this.activeIndex ? GROWN : 1) ? -1 : index;\n }\n\n /**\n * An SVG of slices in a -50 to 50 box, under a mask that cuts the gaps\n * between them and the donut's hole, which CSS sizes. The values and the\n * total are HTML over it.\n */\n protected _draw(): Element {\n const values = this.series[0].values.map((value) => Math.max(0, value ?? 0));\n const total = values.reduce((sum, value) => sum + value, 0);\n let turn = 0;\n this._turns = values.map((value) => [turn, (turn += total ? value / total : 0)]);\n // Colors go round the drawn slices; the last skips the first's color beside it.\n const drawn = this._turns.filter(([start, end]) => end > start);\n let slice = 0;\n this._colors = this._turns.map(([start, end]) => {\n if (end <= start) return undefined;\n const index = slice++;\n return String(index === drawn.length - 1 && index > 0 && index % COLORS === 0 ? 2 : (index % COLORS) + 1);\n });\n\n const pie = document.createElement('div');\n pie.className = 'pie-chart-pie';\n pie.setAttribute('aria-hidden', 'true');\n const svg = node('svg', { viewBox: '-50 -50 100 100', focusable: 'false' });\n const id = `pie-chart-mask-${++_maskId}`;\n const area = { x: '-50', y: '-50', width: '100', height: '100' };\n const mask = node('mask', { id, maskUnits: 'userSpaceOnUse', ...area });\n mask.append(\n node('rect', { ...area, fill: 'white' }),\n node('path', {\n class: 'pie-chart-gaps',\n stroke: 'black',\n d: drawn.length > 1 ? drawn.map(([start]) => `M0,0L${at(start, 50)}`).join('') : ''\n }),\n node('circle', { class: 'pie-chart-hole', r: String(RADIUS), fill: 'black' })\n );\n\n const slices = node('g', { mask: `url(#${id})` });\n const arc = `A${RADIUS},${RADIUS} 0`;\n this._slices = this._turns.map(([start, end], i) => {\n if (end <= start) return null;\n const slice = node('path', {\n class: 'pie-chart-slice',\n 'data-series': this._colors[i],\n // A whole circle is two half arcs; one arc cannot end where it starts.\n d: end - start >= 1\n ? `M0,${-RADIUS}${arc} 1 1 0,${RADIUS}${arc} 1 1 0,${-RADIUS}Z`\n : `M0,0L${at(start, RADIUS)}${arc} ${end - start > 0.5 ? 1 : 0} 1 ${at(end, RADIUS)}Z`\n }) as SVGPathElement;\n slices.append(slice);\n return slice;\n });\n svg.append(mask, slices);\n pie.append(svg, ...this._texts());\n\n const middle = this._total('pie-chart-total');\n if (middle) pie.append(middle);\n return pie;\n }\n\n /** The .values shares on the slices and the .labels names outside them. */\n private _texts(): Element[] {\n const texts: Element[] = [];\n if (this.el.classList.contains('values')) texts.push(this._values());\n if (this.el.classList.contains('labels') && !this.el.classList.contains('sparkline')) texts.push(this._names());\n return texts;\n }\n\n /** Each slice's share on it, except on slices too thin to hold it. */\n private _values() {\n const labels = document.createElement('div');\n labels.className = 'pie-chart-values';\n this._turns.forEach(([start, end], i) => {\n if (end - start < LABEL_SHARE) return;\n const label = document.createElement('span');\n label.dataset.series = this._colors[i];\n label.style.setProperty('--turn', String((start + end) / 2));\n label.textContent = this._share(i);\n labels.append(label);\n });\n return labels;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAMA,IAAM,SAAS;AAEf,IAAM,SAAS;AAEf,IAAM,QAAQ;AAEd,IAAM,cAAc;AACpB,IAAI,UAAU;AAGd,SAAS,SAAS,MAAc;AAE9B,QAAM,CAAC,EAAE,WAAW,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J,MAAM;",
6
+ "names": ["slice"]
7
+ }
@@ -0,0 +1,113 @@
1
+ import {
2
+ Component
3
+ } from "./chunk-CMGXGYUC.mjs";
4
+ import {
5
+ Utils,
6
+ controllerFor
7
+ } from "./chunk-ZVLOUDIJ.mjs";
8
+
9
+ // src/ts/components/backToTop.ts
10
+ var _defaults = {
11
+ threshold: "100vh"
12
+ };
13
+ var modified = (e) => e.ctrlKey || e.metaKey || e.shiftKey || e.altKey;
14
+ var BackToTop = class extends Component {
15
+ constructor(el, options) {
16
+ super(el, options);
17
+ this._observer = null;
18
+ this._sentinel = null;
19
+ // The target given tabindex="-1" for one focus move, and its blur listener.
20
+ this._temporary = null;
21
+ this._blur = null;
22
+ // Whether the window is above the threshold, as the observer last said.
23
+ this._above = true;
24
+ // Shown once the sentinel is above the viewport. A sentinel below it, on a
25
+ // page that has not scrolled that far, keeps the link hidden.
26
+ this._onIntersect = (entries) => {
27
+ const entry = entries[entries.length - 1];
28
+ if (!entry) return;
29
+ this._above = entry.isIntersecting || entry.boundingClientRect.top >= 0;
30
+ this._update();
31
+ };
32
+ // A focused link stays until it loses focus, because an inert one would
33
+ // drop focus to the body, as pressing Home on it does.
34
+ this._update = () => {
35
+ this.el.toggleAttribute("inert", this._above && !this.el.matches(":focus"));
36
+ };
37
+ // Focus first, so nothing focus does can interrupt the scroll. Smooth and
38
+ // instant scrolls both end at the top with focus kept (probed 2026-10-25).
39
+ this._onClick = (e) => {
40
+ if (e.defaultPrevented || modified(e)) return;
41
+ e.preventDefault();
42
+ this._focus(this._target());
43
+ const view = this.el.ownerDocument.defaultView;
44
+ const reduce = view.matchMedia("(prefers-reduced-motion: reduce)").matches;
45
+ view.scrollTo({ top: 0, behavior: reduce ? "instant" : "smooth" });
46
+ };
47
+ this._clearTabindex = () => {
48
+ this._blur?.abort();
49
+ this._temporary?.removeAttribute("tabindex");
50
+ this._temporary = this._blur = null;
51
+ };
52
+ this.el.setAttribute("inert", "");
53
+ this._sentinel = this.el.ownerDocument.createElement("span");
54
+ this._sentinel.setAttribute("aria-hidden", "true");
55
+ this._sentinel.style.cssText = "position:absolute;inset-inline-start:0;height:0;pointer-events:none;visibility:hidden";
56
+ this._setThreshold(this.options.threshold);
57
+ this.el.ownerDocument.body.prepend(this._sentinel);
58
+ this._observer = new IntersectionObserver(this._onIntersect);
59
+ this._observer.observe(this._sentinel);
60
+ const { signal } = this._events;
61
+ this.el.addEventListener("click", this._onClick, { signal });
62
+ this.el.addEventListener("blur", this._update, { signal });
63
+ }
64
+ static get defaults() {
65
+ return _defaults;
66
+ }
67
+ destroy() {
68
+ this._observer?.disconnect();
69
+ this._observer = null;
70
+ this._sentinel?.remove();
71
+ this._sentinel = null;
72
+ this._clearTabindex();
73
+ this.el.removeAttribute("inert");
74
+ super.destroy();
75
+ }
76
+ // The style setter drops a value that is not a length, which would leave
77
+ // the sentinel at the top of the body and show the link at once.
78
+ _setThreshold(threshold) {
79
+ this._sentinel.style.top = threshold;
80
+ if (this._sentinel.style.top) return;
81
+ console.warn(`BackToTop ignored threshold "${threshold}": expected a CSS length.`, this.el);
82
+ this._sentinel.style.top = _defaults.threshold;
83
+ }
84
+ // The element the href names; `#`, `#top` or a missing id mean the body.
85
+ _target() {
86
+ const fragment = /^#(.+)/.exec(String(this.el.getAttribute("href")));
87
+ return fragment && Utils.getElementById(this.el, fragment[1]) || this.el.ownerDocument.body;
88
+ }
89
+ // A target that does not take focus gets tabindex="-1" until it loses
90
+ // focus, so its Tab behavior afterwards is the author's.
91
+ _focus(target) {
92
+ target.focus({ preventScroll: true });
93
+ if (this._focused(target)) return;
94
+ this._clearTabindex();
95
+ target.setAttribute("tabindex", "-1");
96
+ target.focus({ preventScroll: true });
97
+ this._temporary = target;
98
+ this._blur = controllerFor(target);
99
+ target.addEventListener("blur", this._clearTabindex, { once: true, signal: this._blur.signal });
100
+ }
101
+ // The body is the active element whenever nothing else is, so it only took
102
+ // focus if it has a tabindex.
103
+ _focused(target) {
104
+ if (target === target.ownerDocument.body) return target.hasAttribute("tabindex");
105
+ return target.getRootNode().activeElement === target;
106
+ }
107
+ };
108
+ BackToTop.key = "Expressive_BackToTop";
109
+
110
+ export {
111
+ BackToTop
112
+ };
113
+ //# sourceMappingURL=chunk-NNHVANQA.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/components/backToTop.ts"],
4
+ "sourcesContent": ["import { Component, BaseOptions } from '../core/component';\nimport { Utils, controllerFor } from '../core/utils';\n\nexport interface BackToTopOptions extends BaseOptions {\n /**\n * How far the window scrolls before the link shows, as a CSS length from\n * the top of the page. Viewport units follow window resizes.\n * @default '100vh'\n */\n threshold: string;\n}\n\nconst _defaults: BackToTopOptions = {\n threshold: '100vh'\n};\n\n// A modified click opens the link the browser's way: Ctrl, Meta or Shift\n// for a new tab or window, Alt to download.\nconst modified = (e: MouseEvent) => e.ctrlKey || e.metaKey || e.shiftKey || e.altKey;\n\n/**\n * Back-to-top link. The link stays inert, so hidden, until the window has\n * scrolled past `threshold`. Activating it scrolls to the top and focuses\n * the element its `href` names, or the body.\n *\n * Observation is IntersectionObserver on a sentinel at the threshold, as in\n * AppBar, so a scroll tick reads no layout.\n */\nexport class BackToTop extends Component<BackToTopOptions> {\n private _observer: IntersectionObserver | null = null;\n private _sentinel: HTMLElement | null = null;\n // The target given tabindex=\"-1\" for one focus move, and its blur listener.\n private _temporary: HTMLElement | null = null;\n private _blur: AbortController | null = null;\n // Whether the window is above the threshold, as the observer last said.\n private _above = true;\n\n constructor(el: HTMLElement, options: Partial<BackToTopOptions>) {\n super(el, options);\n this.el.setAttribute('inert', '');\n // Absolute in the body, so `top` measures from the top of the page. Zero\n // height and no pointer events keep it out of the layout and the way.\n this._sentinel = this.el.ownerDocument.createElement('span');\n this._sentinel.setAttribute('aria-hidden', 'true');\n this._sentinel.style.cssText = 'position:absolute;inset-inline-start:0;height:0;pointer-events:none;visibility:hidden';\n this._setThreshold(this.options.threshold);\n this.el.ownerDocument.body.prepend(this._sentinel);\n this._observer = new IntersectionObserver(this._onIntersect);\n this._observer.observe(this._sentinel);\n const { signal } = this._events;\n this.el.addEventListener('click', this._onClick, { signal });\n this.el.addEventListener('blur', this._update, { signal });\n }\n\n static get defaults(): BackToTopOptions {\n return _defaults;\n }\n\n static key = 'Expressive_BackToTop';\n\n destroy() {\n this._observer?.disconnect();\n this._observer = null;\n this._sentinel?.remove();\n this._sentinel = null;\n this._clearTabindex();\n this.el.removeAttribute('inert');\n super.destroy();\n }\n\n // The style setter drops a value that is not a length, which would leave\n // the sentinel at the top of the body and show the link at once.\n private _setThreshold(threshold: string) {\n this._sentinel.style.top = threshold;\n if (this._sentinel.style.top) return;\n console.warn(`BackToTop ignored threshold \"${threshold}\": expected a CSS length.`, this.el);\n this._sentinel.style.top = _defaults.threshold;\n }\n\n // Shown once the sentinel is above the viewport. A sentinel below it, on a\n // page that has not scrolled that far, keeps the link hidden.\n private _onIntersect = (entries: IntersectionObserverEntry[]) => {\n const entry = entries[entries.length - 1];\n if (!entry) return;\n this._above = entry.isIntersecting || entry.boundingClientRect.top >= 0;\n this._update();\n };\n\n // A focused link stays until it loses focus, because an inert one would\n // drop focus to the body, as pressing Home on it does.\n private _update = () => {\n this.el.toggleAttribute('inert', this._above && !this.el.matches(':focus'));\n };\n\n // Focus first, so nothing focus does can interrupt the scroll. Smooth and\n // instant scrolls both end at the top with focus kept (probed 2026-10-25).\n private _onClick = (e: MouseEvent) => {\n if (e.defaultPrevented || modified(e)) return;\n e.preventDefault();\n this._focus(this._target());\n const view = this.el.ownerDocument.defaultView;\n const reduce = view.matchMedia('(prefers-reduced-motion: reduce)').matches;\n view.scrollTo({ top: 0, behavior: reduce ? 'instant' : 'smooth' });\n };\n\n // The element the href names; `#`, `#top` or a missing id mean the body.\n private _target(): HTMLElement {\n const fragment = /^#(.+)/.exec(String(this.el.getAttribute('href')));\n return (fragment && Utils.getElementById(this.el, fragment[1])) || this.el.ownerDocument.body;\n }\n\n // A target that does not take focus gets tabindex=\"-1\" until it loses\n // focus, so its Tab behavior afterwards is the author's.\n private _focus(target: HTMLElement) {\n target.focus({ preventScroll: true });\n if (this._focused(target)) return;\n this._clearTabindex();\n target.setAttribute('tabindex', '-1');\n target.focus({ preventScroll: true });\n this._temporary = target;\n this._blur = controllerFor(target);\n target.addEventListener('blur', this._clearTabindex, { once: true, signal: this._blur.signal });\n }\n\n // The body is the active element whenever nothing else is, so it only took\n // focus if it has a tabindex.\n private _focused(target: HTMLElement) {\n if (target === target.ownerDocument.body) return target.hasAttribute('tabindex');\n return (target.getRootNode() as Document | ShadowRoot).activeElement === target;\n }\n\n private _clearTabindex = () => {\n this._blur?.abort();\n this._temporary?.removeAttribute('tabindex');\n this._temporary = this._blur = null;\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;AAYA,IAAM,YAA8B;AAAA,EAClC,WAAW;AACb;AAIA,IAAM,WAAW,CAAC,MAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE;AAUvE,IAAM,YAAN,cAAwB,UAA4B;AAAA,EASzD,YAAY,IAAiB,SAAoC;AAC/D,UAAM,IAAI,OAAO;AATnB,SAAQ,YAAyC;AACjD,SAAQ,YAAgC;AAExC;AAAA,SAAQ,aAAiC;AACzC,SAAQ,QAAgC;AAExC;AAAA,SAAQ,SAAS;AA8CjB;AAAA;AAAA,SAAQ,eAAe,CAAC,YAAyC;AAC/D,YAAM,QAAQ,QAAQ,QAAQ,SAAS,CAAC;AACxC,UAAI,CAAC,MAAO;AACZ,WAAK,SAAS,MAAM,kBAAkB,MAAM,mBAAmB,OAAO;AACtE,WAAK,QAAQ;AAAA,IACf;AAIA;AAAA;AAAA,SAAQ,UAAU,MAAM;AACtB,WAAK,GAAG,gBAAgB,SAAS,KAAK,UAAU,CAAC,KAAK,GAAG,QAAQ,QAAQ,CAAC;AAAA,IAC5E;AAIA;AAAA;AAAA,SAAQ,WAAW,CAAC,MAAkB;AACpC,UAAI,EAAE,oBAAoB,SAAS,CAAC,EA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