@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
@@ -1,9 +1,11 @@
1
- import {
2
- Utils
3
- } from "./chunk-MNPROCZF.mjs";
4
1
  import {
5
2
  Component
6
- } from "./chunk-LTWPGFBR.mjs";
3
+ } from "./chunk-CMGXGYUC.mjs";
4
+ import {
5
+ Utils,
6
+ controllerFor,
7
+ restoreAttribute
8
+ } from "./chunk-ZVLOUDIJ.mjs";
7
9
 
8
10
  // src/ts/components/lightbox.ts
9
11
  var _defaults = {
@@ -14,16 +16,17 @@ var _defaults = {
14
16
  onCloseStart: null,
15
17
  onCloseEnd: null
16
18
  };
17
- var _Lightbox = class _Lightbox extends Component {
19
+ var Lightbox = class extends Component {
18
20
  constructor(el, options) {
19
- super(el, options, _Lightbox);
20
- /** Ancestors forced to `overflow: visible`, with the inline value to put back. */
21
- this._changedAncestorList = [];
21
+ super(el, options);
22
22
  this._timers = /* @__PURE__ */ new Map();
23
23
  this._motion = window.matchMedia("(prefers-reduced-motion: reduce)");
24
24
  this._isOpen = false;
25
25
  this._destroyed = false;
26
26
  this._revision = 0;
27
+ // Counts opens and closes only. _revision also moves when reduced motion
28
+ // flushes a transition, which must still report its end.
29
+ this._phase = 0;
27
30
  this._handleMotionChange = () => {
28
31
  if (!this._motion.matches) return;
29
32
  const callbacks = [...this._timers.values()];
@@ -36,11 +39,8 @@ var _Lightbox = class _Lightbox extends Component {
36
39
  for (const el of [this.el, this._overlay, this._photoCaption]) if (el) el.style.transition = "none";
37
40
  }
38
41
  };
39
- this._handleLightboxClick = () => {
40
- this._handleLightboxToggle();
41
- };
42
42
  this._handleLightboxKeypress = (e) => {
43
- if (this._trigger === this.el && (e.key === Utils.keys.ENTER || e.key === " ")) {
43
+ if (this._trigger === this.el && (e.key === "Enter" || e.key === " ")) {
44
44
  e.preventDefault();
45
45
  this._handleLightboxToggle();
46
46
  }
@@ -49,42 +49,42 @@ var _Lightbox = class _Lightbox extends Component {
49
49
  if (this._isOpen) this.close();
50
50
  else this.open();
51
51
  };
52
- this._handleWindowScroll = () => {
53
- if (this.overlayActive) this.close();
54
- };
55
- this._handleWindowResize = () => {
52
+ this._handleWindowChange = () => {
56
53
  if (this.overlayActive) this.close();
57
54
  };
58
55
  this._handleWindowEscape = (e) => {
59
- if (e.key === Utils.keys.ESC) this.close();
56
+ if (e.key === "Escape") this.close();
57
+ };
58
+ // The image zooms in place, not in a modal, so Tab would reach the page
59
+ // behind the overlay. Tab closes it instead, then moves focus as usual.
60
+ this._handleWindowTab = (e) => {
61
+ if (e.key === "Tab") this.close();
60
62
  };
61
63
  /**
62
64
  * Open lightbox.
63
65
  */
64
66
  this.open = () => {
65
67
  if (this._destroyed || this._isOpen) return;
68
+ this._phase++;
66
69
  const revision = this._cancel();
67
70
  if (this.overlayActive) this._reset();
68
- this._isOpen = true;
69
71
  this._updateVars();
70
72
  const originRect = this.el.getBoundingClientRect();
71
73
  const placeholderRect = this.placeholder.getBoundingClientRect();
74
+ if (!originRect.width || !originRect.height) return;
75
+ this._isOpen = true;
72
76
  this.originalWidth = originRect.width;
73
77
  this.originalHeight = originRect.height;
74
78
  this.doneAnimating = false;
75
79
  this.el.classList.add("active");
76
80
  this.overlayActive = true;
77
- if (typeof this.options.onOpenStart === "function")
78
- this.options.onOpenStart.call(this, this.el);
79
- if (revision !== this._revision) return;
81
+ if (!this._notify("open", this.options.onOpenStart, { current: () => revision === this._revision })) return;
80
82
  this.placeholder.style.width = placeholderRect.width + "px";
81
83
  this.placeholder.style.height = placeholderRect.height + "px";
82
- this.placeholder.style.position = "relative";
83
- this.placeholder.style.top = "0";
84
- this.placeholder.style.left = "0";
85
- this._makeAncestorsOverflowVisible();
86
84
  this.el.style.position = "absolute";
87
- this.el.style.zIndex = "1000";
85
+ this.el.style.inset = "auto";
86
+ this.el.style.left = placeholderRect.left + window.scrollX + "px";
87
+ this.el.style.top = placeholderRect.top + window.scrollY + "px";
88
88
  this.el.style.willChange = "left, top, width, height";
89
89
  this.attrWidth = this.el.getAttribute("width");
90
90
  this.attrHeight = this.el.getAttribute("height");
@@ -97,11 +97,10 @@ var _Lightbox = class _Lightbox extends Component {
97
97
  this.el.removeAttribute("height");
98
98
  }
99
99
  this._addOverlay();
100
+ this._showOnTop(this.el);
100
101
  if (this.caption !== "") this._addCaption();
101
102
  const widthPercent = this.originalWidth / this.windowWidth;
102
103
  const heightPercent = this.originalHeight / this.windowHeight;
103
- this.newWidth = 0;
104
- this.newHeight = 0;
105
104
  if (widthPercent > heightPercent) {
106
105
  const ratio = this.originalHeight / this.originalWidth;
107
106
  this.newWidth = this.windowWidth * 0.9;
@@ -111,9 +110,13 @@ var _Lightbox = class _Lightbox extends Component {
111
110
  this.newWidth = this.windowHeight * 0.9 * ratio;
112
111
  this.newHeight = this.windowHeight * 0.9;
113
112
  }
114
- window.addEventListener("scroll", this._handleWindowScroll, { passive: true });
115
- window.addEventListener("resize", this._handleWindowResize, { passive: true });
116
- window.addEventListener("keyup", this._handleWindowEscape);
113
+ this._windowEvents?.abort();
114
+ this._windowEvents = controllerFor(this.el);
115
+ const { signal } = this._windowEvents;
116
+ window.addEventListener("scroll", this._handleWindowChange, { passive: true, signal });
117
+ window.addEventListener("resize", this._handleWindowChange, { passive: true, signal });
118
+ window.addEventListener("keyup", this._handleWindowEscape, { signal });
119
+ window.addEventListener("keydown", this._handleWindowTab, { signal });
117
120
  this._animateImageIn();
118
121
  };
119
122
  /**
@@ -121,24 +124,17 @@ var _Lightbox = class _Lightbox extends Component {
121
124
  */
122
125
  this.close = () => {
123
126
  if (this._destroyed || !this._isOpen) return;
127
+ this._phase++;
124
128
  const revision = this._cancel();
125
129
  this._isOpen = false;
126
130
  this.doneAnimating = false;
127
- if (typeof this.options.onCloseStart === "function")
128
- this.options.onCloseStart.call(this, this.el);
129
- if (revision !== this._revision) return;
130
- window.removeEventListener("scroll", this._handleWindowScroll);
131
- window.removeEventListener("resize", this._handleWindowResize);
132
- window.removeEventListener("keyup", this._handleWindowEscape);
133
- if (this._overlay) this._removeOverlay();
134
- if (this._photoCaption) this._removeCaption();
131
+ if (!this._notify("close", this.options.onCloseStart, { current: () => revision === this._revision })) return;
132
+ this._windowEvents?.abort();
133
+ this._restoreFocus();
134
+ if (this._overlay) this._fadeOut(this._overlay);
135
+ if (this._photoCaption) this._fadeOut(this._photoCaption);
135
136
  this._animateImageOut();
136
137
  };
137
- this.el["Expressive_Lightbox"] = this;
138
- this.options = {
139
- ..._Lightbox.defaults,
140
- ...options
141
- };
142
138
  this.overlayActive = false;
143
139
  this.doneAnimating = true;
144
140
  this.placeholder = document.createElement("div");
@@ -157,53 +153,35 @@ var _Lightbox = class _Lightbox extends Component {
157
153
  static get defaults() {
158
154
  return _defaults;
159
155
  }
160
- /**
161
- * Initializes instances of Lightbox.
162
- * @param els HTML elements.
163
- * @param options Component options.
164
- */
165
- static init(els, options = {}) {
166
- return super.init(els, options, _Lightbox);
167
- }
168
- static getInstance(el) {
169
- return el["Expressive_Lightbox"];
170
- }
171
156
  destroy() {
172
157
  if (this._destroyed) return;
173
158
  this._destroyed = true;
174
- const root = this.el.getRootNode();
175
- const focused = root.activeElement === this.el;
176
- this._removeEventHandlers();
159
+ const focused = this.el.getRootNode().activeElement === this.el;
177
160
  this._cancel();
178
161
  this._reset();
179
162
  this.placeholder.replaceWith(this.el);
163
+ if (focused) this._restoreFocus();
164
+ restoreAttribute(this.el, "tabindex", this._tabindex);
165
+ super.destroy();
166
+ }
167
+ // Back to the trigger when focus fell to the body (or the shadow host), as
168
+ // a click on the overlay, which cannot take focus, leaves it.
169
+ _restoreFocus() {
170
+ const root = this.el.getRootNode();
180
171
  let active = document.activeElement;
181
172
  while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
182
- if (focused && (active === document.body || active === root.host)) this._trigger.focus();
183
- if (this._tabindex === null) this.el.removeAttribute("tabindex");
184
- else this.el.setAttribute("tabindex", this._tabindex);
185
- this.el["Expressive_Lightbox"] = void 0;
173
+ if ([document.body, root.host].includes(active)) this._trigger.focus({ preventScroll: true });
186
174
  }
187
175
  _reset() {
188
- window.removeEventListener("scroll", this._handleWindowScroll);
189
- window.removeEventListener("resize", this._handleWindowResize);
190
- window.removeEventListener("keyup", this._handleWindowEscape);
176
+ this._windowEvents?.abort();
191
177
  this._overlay?.remove();
192
178
  this._photoCaption?.remove();
193
- for (const ancestor of this._changedAncestorList) {
194
- const saved = _Lightbox._overflow.get(ancestor);
195
- if (--saved.count === 0) {
196
- ancestor.style.setProperty("overflow", saved.value, saved.priority);
197
- _Lightbox._overflow.delete(ancestor);
198
- }
199
- }
200
- this._changedAncestorList = [];
201
- if (this.attrWidth !== null && this.attrWidth !== void 0) this.el.setAttribute("width", this.attrWidth);
202
- if (this.attrHeight !== null && this.attrHeight !== void 0) this.el.setAttribute("height", this.attrHeight);
179
+ this.el.removeAttribute("popover");
180
+ if (this.attrWidth != null) this.el.setAttribute("width", this.attrWidth);
181
+ if (this.attrHeight != null) this.el.setAttribute("height", this.attrHeight);
203
182
  this.el.classList.remove("active");
204
183
  this.placeholder.removeAttribute("style");
205
- if (this.originInlineStyles === null) this.el.removeAttribute("style");
206
- else this.el.setAttribute("style", this.originInlineStyles);
184
+ restoreAttribute(this.el, "style", this.originInlineStyles);
207
185
  this.overlayActive = false;
208
186
  this._isOpen = false;
209
187
  this.doneAnimating = true;
@@ -225,37 +203,23 @@ var _Lightbox = class _Lightbox extends Component {
225
203
  this._timers.set(timer, callback);
226
204
  }
227
205
  _setupEventHandlers() {
228
- this._motion.addEventListener("change", this._handleMotionChange);
229
- this._trigger.addEventListener("click", this._handleLightboxClick);
230
- this.el.addEventListener("keydown", this._handleLightboxKeypress);
206
+ const { signal } = this._events;
207
+ this._motion.addEventListener("change", this._handleMotionChange, { signal });
208
+ this._trigger.addEventListener("click", this._handleLightboxToggle, { signal });
209
+ this.el.addEventListener("keydown", this._handleLightboxKeypress, { signal });
231
210
  }
232
- _removeEventHandlers() {
233
- this._motion.removeEventListener("change", this._handleMotionChange);
234
- this._trigger.removeEventListener("click", this._handleLightboxClick);
235
- this.el.removeEventListener("keydown", this._handleLightboxKeypress);
211
+ /**
212
+ * Shows `el` as a manual popover, so it is in the top layer: no ancestor
213
+ * clips or covers it, and it stacks above what was shown before it.
214
+ */
215
+ _showOnTop(el) {
216
+ el.setAttribute("popover", "manual");
217
+ el.showPopover();
236
218
  }
237
- _makeAncestorsOverflowVisible() {
238
- this._changedAncestorList = [];
239
- let ancestor = this.placeholder.parentNode;
240
- while (ancestor !== null && ancestor !== void 0 && ancestor !== document) {
241
- const curr = ancestor;
242
- if (curr.style && (curr.style.overflow !== "visible" || _Lightbox._overflow.has(curr))) {
243
- const saved = _Lightbox._overflow.get(curr) ?? { count: 0, value: curr.style.overflow, priority: curr.style.getPropertyPriority("overflow") };
244
- saved.count++;
245
- _Lightbox._overflow.set(curr, saved);
246
- this._changedAncestorList.push(curr);
247
- curr.style.overflow = "visible";
248
- }
249
- ancestor = ancestor.parentNode ?? ancestor.host;
250
- }
251
- }
252
- _offset(el) {
253
- const box = el.getBoundingClientRect();
254
- const docElem = document.documentElement;
255
- return {
256
- top: box.top + window.scrollY - docElem.clientTop,
257
- left: box.left + window.scrollX - docElem.clientLeft
258
- };
219
+ /** The placeholder's document position, where the image rests. */
220
+ _restingPlace() {
221
+ const box = this.placeholder.getBoundingClientRect();
222
+ return { left: box.left + window.scrollX + "px", top: box.top + window.scrollY + "px" };
259
223
  }
260
224
  _updateVars() {
261
225
  this.windowWidth = window.innerWidth;
@@ -264,6 +228,7 @@ var _Lightbox = class _Lightbox extends Component {
264
228
  }
265
229
  // Image
266
230
  _animateImageIn() {
231
+ const phase = this._phase;
267
232
  this.el.style.maxHeight = this.newHeight.toString() + "px";
268
233
  this.el.style.maxWidth = this.newWidth.toString() + "px";
269
234
  const duration = this._motion.matches ? 0 : this.options.inDuration;
@@ -271,7 +236,6 @@ var _Lightbox = class _Lightbox extends Component {
271
236
  this.el.style.height = this.originalHeight + "px";
272
237
  this.el.style.width = this.originalWidth + "px";
273
238
  this._schedule(() => {
274
- const placeholderOffset = this._offset(this.placeholder);
275
239
  this.el.style.transition = `height ${duration}ms ease,
276
240
  width ${duration}ms ease,
277
241
  left ${duration}ms ease,
@@ -279,15 +243,16 @@ var _Lightbox = class _Lightbox extends Component {
279
243
  `;
280
244
  this.el.style.height = this.newHeight + "px";
281
245
  this.el.style.width = this.newWidth + "px";
282
- this.el.style.left = Utils.getDocumentScrollLeft() + this.windowWidth / 2 - placeholderOffset.left - this.newWidth / 2 + "px";
283
- this.el.style.top = Utils.getDocumentScrollTop() + this.windowHeight / 2 - placeholderOffset.top - this.newHeight / 2 + "px";
246
+ this.el.style.left = window.scrollX + (this.windowWidth - this.newWidth) / 2 + "px";
247
+ this.el.style.top = window.scrollY + (this.windowHeight - this.newHeight) / 2 + "px";
284
248
  }, 1);
285
249
  this._schedule(() => {
286
250
  this.doneAnimating = true;
287
- if (typeof this.options.onOpenEnd === "function") this.options.onOpenEnd.call(this, this.el);
251
+ this._notify("opened", this.options.onOpenEnd, { current: () => phase === this._phase });
288
252
  }, duration);
289
253
  }
290
254
  _animateImageOut() {
255
+ const phase = this._phase;
291
256
  const duration = this._motion.matches ? 0 : this.options.outDuration;
292
257
  this.el.style.transition = `height ${duration}ms ease,
293
258
  width ${duration}ms ease,
@@ -296,12 +261,10 @@ var _Lightbox = class _Lightbox extends Component {
296
261
  `;
297
262
  this.el.style.height = this.originalHeight + "px";
298
263
  this.el.style.width = this.originalWidth + "px";
299
- this.el.style.left = "0";
300
- this.el.style.top = "0";
264
+ Object.assign(this.el.style, this._restingPlace());
301
265
  this._schedule(() => {
302
266
  this._reset();
303
- if (typeof this.options.onCloseEnd === "function")
304
- this.options.onCloseEnd.call(this, this.el);
267
+ this._notify("closed", this.options.onCloseEnd, { current: () => phase === this._phase });
305
268
  }, duration);
306
269
  }
307
270
  // Caption
@@ -311,18 +274,8 @@ var _Lightbox = class _Lightbox extends Component {
311
274
  this._photoCaption.innerText = this.caption;
312
275
  Utils.portalRoot(this.el).append(this._photoCaption);
313
276
  this._photoCaption.style.display = "inline";
314
- this._photoCaption.style.transition = "none";
315
- this._photoCaption.style.opacity = "0";
316
- const duration = this._motion.matches ? 0 : this.options.inDuration;
317
- this._schedule(() => {
318
- this._photoCaption.style.transition = `opacity ${duration}ms ease`;
319
- this._photoCaption.style.opacity = "1";
320
- }, 1);
321
- }
322
- _removeCaption() {
323
- const duration = this._motion.matches ? 0 : this.options.outDuration;
324
- this._photoCaption.style.transition = `opacity ${duration}ms ease`;
325
- this._photoCaption.style.opacity = "0";
277
+ this._showOnTop(this._photoCaption);
278
+ this._fadeIn(this._photoCaption);
326
279
  }
327
280
  // Overlay
328
281
  _addOverlay() {
@@ -337,29 +290,27 @@ var _Lightbox = class _Lightbox extends Component {
337
290
  { once: true }
338
291
  );
339
292
  this.el.before(this._overlay);
340
- const overlayOffset = this._overlay.getBoundingClientRect();
341
- this._overlay.style.width = this.windowWidth + "px";
342
- this._overlay.style.height = this.windowHeight + "px";
343
- this._overlay.style.left = -1 * overlayOffset.left + "px";
344
- this._overlay.style.top = -1 * overlayOffset.top + "px";
345
- this._overlay.style.transition = "none";
346
- this._overlay.style.opacity = "0";
293
+ this._showOnTop(this._overlay);
294
+ this._fadeIn(this._overlay);
295
+ }
296
+ _fadeIn(el) {
297
+ el.style.transition = "none";
298
+ el.style.opacity = "0";
347
299
  const duration = this._motion.matches ? 0 : this.options.inDuration;
348
300
  this._schedule(() => {
349
- this._overlay.style.transition = `opacity ${duration}ms ease`;
350
- this._overlay.style.opacity = "1";
301
+ el.style.transition = `opacity ${duration}ms ease`;
302
+ el.style.opacity = "1";
351
303
  }, 1);
352
304
  }
353
- _removeOverlay() {
305
+ _fadeOut(el) {
354
306
  const duration = this._motion.matches ? 0 : this.options.outDuration;
355
- this._overlay.style.transition = `opacity ${duration}ms ease`;
356
- this._overlay.style.opacity = "0";
307
+ el.style.transition = `opacity ${duration}ms ease`;
308
+ el.style.opacity = "0";
357
309
  }
358
310
  };
359
- _Lightbox._overflow = /* @__PURE__ */ new WeakMap();
360
- var Lightbox = _Lightbox;
311
+ Lightbox.key = "Expressive_Lightbox";
361
312
 
362
313
  export {
363
314
  Lightbox
364
315
  };
365
- //# sourceMappingURL=chunk-S3XDFGSZ.mjs.map
316
+ //# sourceMappingURL=chunk-VMY55K2X.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/components/lightbox.ts"],
4
+ "sourcesContent": ["import { Utils, controllerFor, restoreAttribute } from '../core/utils';\nimport { BaseOptions, Component } from '../core/component';\n\nexport interface LightboxOptions extends BaseOptions {\n /**\n * Transition in duration in milliseconds.\n * @default 275\n */\n inDuration: number;\n /**\n * Transition out duration in milliseconds.\n * @default 200\n */\n outDuration: number;\n /**\n * Callback function called before lightbox is opened.\n * @default null\n */\n onOpenStart: (el: Element) => void;\n /**\n * Callback function called after lightbox is opened.\n * @default null\n */\n onOpenEnd: (el: Element) => void;\n /**\n * Callback function called before lightbox is closed.\n * @default null\n */\n onCloseStart: (el: Element) => void;\n /**\n * Callback function called after lightbox is closed.\n * @default null\n */\n onCloseEnd: (el: Element) => void;\n}\n\nconst _defaults: LightboxOptions = {\n inDuration: 275,\n outDuration: 200,\n onOpenStart: null,\n onOpenEnd: null,\n onCloseStart: null,\n onCloseEnd: null\n};\n\nexport class Lightbox extends Component<LightboxOptions> {\n /** If the lightbox overlay is showing. */\n overlayActive: boolean;\n /** If the lightbox is no longer being animated. */\n doneAnimating: boolean;\n /** Caption, if specified. */\n caption: string;\n /** Original width of image. */\n originalWidth: number;\n /** Original height of image. */\n originalHeight: number;\n private originInlineStyles: string;\n private placeholder: HTMLElement;\n private newHeight: number;\n private newWidth: number;\n private windowWidth: number;\n private windowHeight: number;\n private attrWidth: string;\n private attrHeight: string;\n private _overlay: HTMLElement;\n private _photoCaption: HTMLElement;\n private _trigger: HTMLElement;\n private _tabindex: string | null;\n private _timers = new Map<ReturnType<typeof setTimeout>, () => void>();\n private _motion = window.matchMedia('(prefers-reduced-motion: reduce)');\n private _isOpen = false;\n private _destroyed = false;\n /** Removes the listeners that close an open lightbox. */\n private _windowEvents: AbortController | undefined;\n private _revision = 0;\n // Counts opens and closes only. _revision also moves when reduced motion\n // flushes a transition, which must still report its end.\n private _phase = 0;\n\n constructor(el: HTMLElement, options: Partial<LightboxOptions>) {\n super(el, options);\n\n this.overlayActive = false;\n this.doneAnimating = true;\n this.placeholder = document.createElement('div');\n this.placeholder.classList.add('material-placeholder');\n this.originalWidth = 0;\n this.originalHeight = 0;\n this.originInlineStyles = this.el.getAttribute('style');\n this.caption = this.el.getAttribute('data-caption') || '';\n this._tabindex = this.el.getAttribute('tabindex');\n this._trigger = this.el.closest('button') ?? this.el;\n this.el.tabIndex = this._trigger === this.el ? 0 : -1;\n // Wrap\n this.el.before(this.placeholder);\n this.placeholder.append(this.el);\n this._setupEventHandlers();\n }\n\n static get defaults(): LightboxOptions {\n return _defaults;\n }\n\n static key = 'Expressive_Lightbox';\n\n destroy() {\n if (this._destroyed) return;\n this._destroyed = true;\n const focused = (this.el.getRootNode() as Document | ShadowRoot).activeElement === this.el;\n this._cancel();\n this._reset();\n this.placeholder.replaceWith(this.el);\n if (focused) this._restoreFocus();\n restoreAttribute(this.el, 'tabindex', this._tabindex);\n super.destroy();\n }\n\n // Back to the trigger when focus fell to the body (or the shadow host), as\n // a click on the overlay, which cannot take focus, leaves it.\n private _restoreFocus() {\n const root = this.el.getRootNode() as Document | ShadowRoot;\n let active = document.activeElement;\n while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;\n if ([document.body, (root as ShadowRoot).host].includes(active)) this._trigger.focus({ preventScroll: true });\n }\n\n private _reset() {\n this._windowEvents?.abort();\n // Removing a popover, or its attribute, takes it out of the top layer.\n this._overlay?.remove();\n this._photoCaption?.remove();\n this.el.removeAttribute('popover');\n if (this.attrWidth != null) this.el.setAttribute('width', this.attrWidth);\n if (this.attrHeight != null) this.el.setAttribute('height', this.attrHeight);\n this.el.classList.remove('active');\n this.placeholder.removeAttribute('style');\n restoreAttribute(this.el, 'style', this.originInlineStyles);\n this.overlayActive = false;\n this._isOpen = false;\n this.doneAnimating = true;\n }\n\n private _cancel() {\n for (const timer of this._timers.keys()) clearTimeout(timer);\n this._timers.clear();\n return ++this._revision;\n }\n\n private _schedule(callback: () => void, delay: number) {\n if (this._motion.matches) { callback(); return; }\n const timer = setTimeout(() => { this._timers.delete(timer); callback(); }, delay);\n this._timers.set(timer, callback);\n }\n\n private _handleMotionChange = () => {\n if (!this._motion.matches) return;\n const callbacks = [...this._timers.values()];\n const revision = this._cancel();\n for (const callback of callbacks) {\n if (revision !== this._revision) break;\n callback();\n }\n if (this.overlayActive) {\n for (const el of [this.el, this._overlay, this._photoCaption]) if (el) el.style.transition = 'none';\n }\n };\n\n private _setupEventHandlers() {\n const { signal } = this._events;\n this._motion.addEventListener('change', this._handleMotionChange, { signal });\n this._trigger.addEventListener('click', this._handleLightboxToggle, { signal });\n this.el.addEventListener('keydown', this._handleLightboxKeypress, { signal });\n }\n\n private _handleLightboxKeypress = (e: KeyboardEvent) => {\n if (this._trigger === this.el && (e.key === 'Enter' || e.key === ' ')) {\n e.preventDefault();\n this._handleLightboxToggle();\n }\n };\n\n private _handleLightboxToggle = () => {\n // If already modal, return to original\n if (this._isOpen) this.close();\n else this.open();\n };\n\n private _handleWindowChange = () => {\n if (this.overlayActive) this.close();\n };\n\n private _handleWindowEscape = (e: KeyboardEvent) => {\n if (e.key === 'Escape') this.close();\n };\n\n // The image zooms in place, not in a modal, so Tab would reach the page\n // behind the overlay. Tab closes it instead, then moves focus as usual.\n private _handleWindowTab = (e: KeyboardEvent) => {\n if (e.key === 'Tab') this.close();\n };\n\n /**\n * Shows `el` as a manual popover, so it is in the top layer: no ancestor\n * clips or covers it, and it stacks above what was shown before it.\n */\n private _showOnTop(el: HTMLElement) {\n el.setAttribute('popover', 'manual');\n el.showPopover();\n }\n\n /** The placeholder's document position, where the image rests. */\n private _restingPlace() {\n const box = this.placeholder.getBoundingClientRect();\n return { left: box.left + window.scrollX + 'px', top: box.top + window.scrollY + 'px' };\n }\n\n private _updateVars(): void {\n this.windowWidth = window.innerWidth;\n this.windowHeight = window.innerHeight;\n this.caption = this.el.getAttribute('data-caption') || '';\n }\n\n // Image\n private _animateImageIn(): void {\n const phase = this._phase;\n this.el.style.maxHeight = this.newHeight.toString() + 'px';\n this.el.style.maxWidth = this.newWidth.toString() + 'px';\n const duration = this._motion.matches ? 0 : this.options.inDuration;\n // from\n this.el.style.transition = 'none';\n this.el.style.height = this.originalHeight + 'px';\n this.el.style.width = this.originalWidth + 'px';\n this._schedule(() => {\n // easeOutQuad\n this.el.style.transition = `height ${duration}ms ease,\n width ${duration}ms ease,\n left ${duration}ms ease,\n top ${duration}ms ease\n `;\n // to\n this.el.style.height = this.newHeight + 'px';\n this.el.style.width = this.newWidth + 'px';\n this.el.style.left = window.scrollX + (this.windowWidth - this.newWidth) / 2 + 'px';\n this.el.style.top = window.scrollY + (this.windowHeight - this.newHeight) / 2 + 'px';\n }, 1);\n\n this._schedule(() => {\n this.doneAnimating = true;\n this._notify('opened', this.options.onOpenEnd, { current: () => phase === this._phase });\n }, duration);\n\n }\n private _animateImageOut(): void {\n const phase = this._phase;\n const duration = this._motion.matches ? 0 : this.options.outDuration;\n // easeOutQuad\n this.el.style.transition = `height ${duration}ms ease,\n width ${duration}ms ease,\n left ${duration}ms ease,\n top ${duration}ms ease\n `;\n // to\n this.el.style.height = this.originalHeight + 'px'; // was originalWidth\n this.el.style.width = this.originalWidth + 'px';\n Object.assign(this.el.style, this._restingPlace());\n this._schedule(() => {\n this._reset();\n // onCloseEnd callback\n this._notify('closed', this.options.onCloseEnd, { current: () => phase === this._phase });\n }, duration);\n }\n\n // Caption\n private _addCaption(): void {\n this._photoCaption = document.createElement('div');\n this._photoCaption.classList.add('lightbox-caption');\n this._photoCaption.innerText = this.caption;\n Utils.portalRoot(this.el).append(this._photoCaption);\n this._photoCaption.style.display = 'inline';\n this._showOnTop(this._photoCaption);\n this._fadeIn(this._photoCaption);\n }\n\n // Overlay\n private _addOverlay(): void {\n this._overlay = document.createElement('div');\n this._overlay.id = 'lightbox-overlay';\n this._overlay.addEventListener(\n 'click',\n (event) => {\n event.stopPropagation();\n this.close();\n },\n { once: true }\n );\n\n this.el.before(this._overlay);\n this._showOnTop(this._overlay);\n this._fadeIn(this._overlay);\n }\n\n private _fadeIn(el: HTMLElement): void {\n el.style.transition = 'none';\n el.style.opacity = '0';\n const duration = this._motion.matches ? 0 : this.options.inDuration;\n this._schedule(() => {\n el.style.transition = `opacity ${duration}ms ease`;\n el.style.opacity = '1';\n }, 1);\n }\n\n private _fadeOut(el: HTMLElement): void {\n const duration = this._motion.matches ? 0 : this.options.outDuration;\n el.style.transition = `opacity ${duration}ms ease`;\n el.style.opacity = '0';\n }\n\n /**\n * Open lightbox.\n */\n open = () => {\n if (this._destroyed || this._isOpen) return;\n this._phase++;\n const revision = this._cancel();\n if (this.overlayActive) this._reset();\n this._updateVars();\n // Both rects are read up front: measuring the placeholder after writing\n // its width forced a second layout for the height.\n const originRect = this.el.getBoundingClientRect();\n const placeholderRect = this.placeholder.getBoundingClientRect();\n // An image not yet loaded, or hidden, has no size to zoom from; the\n // ratios below would be 0 / 0.\n if (!originRect.width || !originRect.height) return;\n this._isOpen = true;\n this.originalWidth = originRect.width;\n this.originalHeight = originRect.height;\n // Set states\n this.doneAnimating = false;\n this.el.classList.add('active');\n this.overlayActive = true;\n // onOpenStart callback\n if (!this._notify('open', this.options.onOpenStart, { current: () => revision === this._revision })) return;\n // Set positioning for placeholder\n this.placeholder.style.width = placeholderRect.width + 'px';\n this.placeholder.style.height = placeholderRect.height + 'px';\n // In the top layer the image is positioned in the document, starting\n // where the placeholder holds its place.\n this.el.style.position = 'absolute';\n this.el.style.inset = 'auto';\n this.el.style.left = placeholderRect.left + window.scrollX + 'px';\n this.el.style.top = placeholderRect.top + window.scrollY + 'px';\n this.el.style.willChange = 'left, top, width, height';\n // Change from width or height attribute to css\n this.attrWidth = this.el.getAttribute('width');\n this.attrHeight = this.el.getAttribute('height');\n if (this.attrWidth) {\n this.el.style.width = this.attrWidth + 'px';\n this.el.removeAttribute('width');\n }\n if (this.attrHeight) {\n this.el.style.height = this.attrHeight + 'px'; // was width, from the height attribute\n this.el.removeAttribute('height');\n }\n // The overlay, the image and the caption go into the top layer in that\n // order, so each stacks above the one before.\n this._addOverlay();\n this._showOnTop(this.el);\n if (this.caption !== '') this._addCaption();\n // Resize Image\n const widthPercent = this.originalWidth / this.windowWidth;\n const heightPercent = this.originalHeight / this.windowHeight;\n if (widthPercent > heightPercent) {\n // Width first\n const ratio = this.originalHeight / this.originalWidth;\n this.newWidth = this.windowWidth * 0.9;\n this.newHeight = this.windowWidth * 0.9 * ratio;\n } else {\n // Height first\n const ratio = this.originalWidth / this.originalHeight;\n this.newWidth = this.windowHeight * 0.9 * ratio;\n this.newHeight = this.windowHeight * 0.9;\n }\n // Handle Exit triggers\n this._windowEvents?.abort();\n this._windowEvents = controllerFor(this.el);\n const { signal } = this._windowEvents;\n window.addEventListener('scroll', this._handleWindowChange, { passive: true, signal });\n window.addEventListener('resize', this._handleWindowChange, { passive: true, signal });\n window.addEventListener('keyup', this._handleWindowEscape, { signal });\n window.addEventListener('keydown', this._handleWindowTab, { signal });\n this._animateImageIn();\n };\n\n /**\n * Close lightbox.\n */\n close = () => {\n if (this._destroyed || !this._isOpen) return;\n this._phase++;\n const revision = this._cancel();\n this._isOpen = false;\n this.doneAnimating = false;\n // onCloseStart callback\n if (!this._notify('close', this.options.onCloseStart, { current: () => revision === this._revision })) return;\n // disable exit handlers\n this._windowEvents?.abort();\n this._restoreFocus();\n if (this._overlay) this._fadeOut(this._overlay);\n if (this._photoCaption) this._fadeOut(this._photoCaption);\n this._animateImageOut();\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;AAoCA,IAAM,YAA6B;AAAA,EACjC,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,aAAa;AAAA,EACb,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AACd;AAEO,IAAM,WAAN,cAAuB,UAA2B;AAAA,EAkCvD,YAAY,IAAiB,SAAmC;AAC9D,UAAM,IAAI,OAAO;AAZnB,SAAQ,UAAU,oBAAI,IAA+C;AACrE,SAAQ,UAAU,OAAO,WAAW,kCAAkC;AACtE,SAAQ,UAAU;AAClB,SAAQ,aAAa;AAGrB,SAAQ,YAAY;AAGpB;AAAA;AAAA,SAAQ,SAAS;AA6EjB,SAAQ,sBAAsB,MAAM;AAClC,UAAI,CAAC,KAAK,QAAQ,QAAS;AAC3B,YAAM,YAAY,CAAC,GAAG,KAAK,QAAQ,OAAO,CAAC;AAC3C,YAAM,WAAW,KAAK,QAAQ;AAC9B,iBAAW,YAAY,WAAW;AAChC,YAAI,aAAa,KAAK,UAAW;AACjC,iBAAS;AAAA,MACX;AACA,UAAI,KAAK,eAAe;AACtB,mBAAW,MAAM,CAAC,KAAK,IAAI,KAAK,UAAU,KAAK,aAAa,EAAG,KAAI,GAAI,IAAG,MAAM,aAAa;AAAA,MAC/F;AAAA,IACF;AASA,SAAQ,0BAA0B,CAAC,MAAqB;AACtD,UAAI,KAAK,aAAa,KAAK,OAAO,EAAE,QAAQ,WAAW,EAAE,QAAQ,MAAM;AACrE,UAAE,eAAe;AACjB,aAAK,sBAAsB;AAAA,MAC7B;AAAA,IACF;AAEA,SAAQ,wBAAwB,MAAM;AAEpC,UAAI,KAAK,QAAS,MAAK,MAAM;AAAA,UACxB,MAAK,KAAK;AAAA,IACjB;AAE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QAAQ;AAAA,EAC5B;AAAA,EAEQ,QAAQ,IAAuB;AACrC,OAAG,MAAM,aAAa;AACtB,OAAG,MAAM,UAAU;AACnB,UAAM,WAAW,KAAK,QAAQ,UAAU,IAAI,KAAK,QAAQ;AACzD,SAAK,UAAU,MAAM;AACnB,SAAG,MAAM,aAAa,WAAW,QAAQ;AACzC,SAAG,MAAM,UAAU;AAAA,IACrB,GAAG,CAAC;AAAA,EACN;AAAA,EAEQ,SAAS,IAAuB;AACtC,UAAM,WAAW,KAAK,QAAQ,UAAU,IAAI,KAAK,QAAQ;AACzD,OAAG,MAAM,aAAa,WAAW,QAAQ;AACzC,OAAG,MAAM,UAAU;AAAA,EACrB;AAgGF;AA9Wa,SA0DJ,MAAM;",
6
+ "names": []
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Component
3
- } from "./chunk-LTWPGFBR.mjs";
3
+ } from "./chunk-CMGXGYUC.mjs";
4
4
 
5
5
  // src/ts/components/confetti.ts
6
6
  var _defaults = {
@@ -23,26 +23,18 @@ var FALLBACK_COLORS = ["#26ccff", "#a25afd", "#ff5e7e", "#88ff5a", "#fcff42", "#
23
23
  var RAD = Math.PI / 180;
24
24
  var scenes = /* @__PURE__ */ new Map();
25
25
  var overlay = null;
26
- var Confetti = class _Confetti extends Component {
26
+ var _Confetti = class _Confetti extends Component {
27
27
  constructor(el, options) {
28
- super(el, options, _Confetti);
28
+ super(el, options);
29
29
  this._onClick = () => {
30
30
  this.fire();
31
31
  };
32
- this.el["Expressive_Confetti"] = this;
33
- this.options = { ..._Confetti.defaults, ...options };
34
- if (!(el instanceof HTMLCanvasElement)) el.addEventListener("click", this._onClick);
32
+ if (!(el instanceof HTMLCanvasElement)) el.addEventListener("click", this._onClick, { signal: this._events.signal });
35
33
  else if (!this.options.manualStart) this.fire();
36
34
  }
37
35
  static get defaults() {
38
36
  return _defaults;
39
37
  }
40
- static init(els, options = {}) {
41
- return super.init(els, options, _Confetti);
42
- }
43
- static getInstance(el) {
44
- return el["Expressive_Confetti"];
45
- }
46
38
  /**
47
39
  * Bursts over the whole viewport. Resolves when the last piece is gone.
48
40
  */
@@ -64,13 +56,14 @@ var Confetti = class _Confetti extends Component {
64
56
  return burst(viewportCanvas, this.el.parentElement ?? document.body, merged);
65
57
  }
66
58
  destroy() {
67
- this.el.removeEventListener("click", this._onClick);
68
59
  if (this.el instanceof HTMLCanvasElement) stop(this.el);
69
- this.el["Expressive_Confetti"] = void 0;
60
+ super.destroy();
70
61
  }
71
62
  };
63
+ _Confetti.key = "Expressive_Confetti";
64
+ var Confetti = _Confetti;
72
65
  function burst(getCanvas, themed, o) {
73
- if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) return Promise.resolve();
66
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches) return Promise.resolve();
74
67
  const canvas = getCanvas();
75
68
  let scene = scenes.get(canvas);
76
69
  if (!scene) {
@@ -183,10 +176,11 @@ function viewportCanvas() {
183
176
  height: "100%",
184
177
  margin: "0",
185
178
  padding: "0",
179
+ // The fallback keeps the order where the sheet, and so the token, is absent.
186
180
  border: "0",
187
181
  background: "transparent",
188
182
  pointerEvents: "none",
189
- zIndex: "10001"
183
+ zIndex: "var(--expressive-z-confetti, 10001)"
190
184
  });
191
185
  document.body.append(overlay);
192
186
  if (typeof overlay.showPopover === "function") {
@@ -211,4 +205,4 @@ function themeColors(themed) {
211
205
  export {
212
206
  Confetti
213
207
  };
214
- //# sourceMappingURL=chunk-UEXCIMJZ.mjs.map
208
+ //# sourceMappingURL=chunk-VR3L2WN5.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/components/confetti.ts"],
4
+ "sourcesContent": ["import { Component, BaseOptions } from '../core/component';\n\nexport type ConfettiShape = 'square' | 'circle' | 'star';\n\nexport interface ConfettiOptions extends BaseOptions {\n /**\n * Pieces per burst.\n * @default 50\n */\n particleCount: number;\n /**\n * Launch direction in degrees. 90 is straight up, 0 is right.\n * @default 90\n */\n angle: number;\n /**\n * How far the pieces fan out from the angle, in degrees.\n * @default 45\n */\n spread: number;\n /**\n * Launch speed in pixels per frame.\n * @default 45\n */\n startVelocity: number;\n /**\n * Share of its speed a piece keeps each frame.\n * @default 0.9\n */\n decay: number;\n /**\n * Pull toward the bottom. 0 floats, 1 is normal.\n * @default 1\n */\n gravity: number;\n /**\n * Sideways push per frame. Negative drifts left.\n * @default 0\n */\n drift: number;\n /**\n * Frames a piece lives while it fades out.\n * @default 200\n */\n ticks: number;\n /**\n * Launch point as fractions of the canvas, 0 to 1. A missing side is\n * 0.5. A trigger element ignores it and launches from its own center.\n * @default { x: 0.5, y: 0.5 }\n */\n origin: { x?: number; y?: number };\n /**\n * CSS colors. Empty uses the theme's primary, secondary and tertiary\n * colors and their containers.\n * @default []\n */\n colors: string[];\n /**\n * @default ['square', 'circle']\n */\n shapes: ConfettiShape[];\n /**\n * Piece size multiplier.\n * @default 1\n */\n scalar: number;\n /**\n * On a canvas, wait for `fire()` instead of bursting once at init.\n * @default false\n */\n manualStart: boolean;\n}\n\nconst _defaults: ConfettiOptions = {\n particleCount: 50,\n angle: 90,\n spread: 45,\n startVelocity: 45,\n decay: 0.9,\n gravity: 1,\n drift: 0,\n ticks: 200,\n origin: { x: 0.5, y: 0.5 },\n colors: [],\n shapes: ['square', 'circle'],\n scalar: 1,\n manualStart: false\n};\n\nconst THEME_COLORS = ['primary', 'secondary', 'tertiary', 'primary-container', 'secondary-container', 'tertiary-container'];\n// Used when the page has no theme tokens.\nconst FALLBACK_COLORS = ['#26ccff', '#a25afd', '#ff5e7e', '#88ff5a', '#fcff42', '#ffa62d', '#ff36ff'];\nconst RAD = Math.PI / 180;\n\ninterface Piece {\n x: number;\n y: number;\n velocity: number;\n angle: number;\n wobble: number;\n wobbleSpeed: number;\n tilt: number;\n tick: number;\n color: string;\n shape: ConfettiShape;\n options: ConfettiOptions;\n}\n\ninterface Scene {\n ctx: CanvasRenderingContext2D;\n pieces: Piece[];\n frame: number;\n last: number;\n done: (() => void)[];\n overlay: boolean;\n}\n\nconst scenes = new Map<HTMLCanvasElement, Scene>();\nlet overlay: HTMLCanvasElement | null = null;\n\n/**\n * Confetti. Bursts of theme-colored pieces drawn on a canvas.\n *\n * - `Confetti.fire(options)` bursts over the whole viewport.\n * - Any other `.confetti` element bursts from its center when clicked.\n * - A `<canvas class=\"confetti\">` bursts inside its own box, once at init\n * unless `manualStart`, and again on each `fire()`.\n *\n * The viewport canvas is a manual popover, so it draws above an open modal\n * dialog, and it ignores the pointer. Nothing is drawn when the reader\n * prefers reduced motion.\n */\nexport class Confetti extends Component<ConfettiOptions> {\n private _onClick = () => { this.fire(); };\n\n constructor(el: HTMLElement, options: Partial<ConfettiOptions>) {\n super(el, options);\n if (!(el instanceof HTMLCanvasElement)) el.addEventListener('click', this._onClick, { signal: this._events.signal });\n else if (!this.options.manualStart) this.fire();\n }\n\n static get defaults(): ConfettiOptions {\n return _defaults;\n }\n\n static key = 'Expressive_Confetti';\n\n /**\n * Bursts over the whole viewport. Resolves when the last piece is gone.\n */\n static fire(options: Partial<ConfettiOptions> = {}): Promise<void> {\n return burst(viewportCanvas, document.body, { ...Confetti.defaults, ...options });\n }\n\n /**\n * Bursts on this canvas, or from this element's center over the viewport.\n * Resolves when the last piece is gone.\n */\n fire(options: Partial<ConfettiOptions> = {}): Promise<void> {\n const merged = { ...this.options, ...options };\n if (this.el instanceof HTMLCanvasElement) {\n const canvas = this.el;\n return burst(() => canvas, canvas.parentElement ?? document.body, merged);\n }\n const r = this.el.getBoundingClientRect();\n merged.origin = { x: (r.left + r.width / 2) / innerWidth, y: (r.top + r.height / 2) / innerHeight };\n return burst(viewportCanvas, this.el.parentElement ?? document.body, merged);\n }\n\n destroy() {\n if (this.el instanceof HTMLCanvasElement) stop(this.el);\n super.destroy();\n }\n}\n\n// `themed` is where the theme colors are read, so a scoped theme applies.\nfunction burst(getCanvas: () => HTMLCanvasElement, themed: Element, o: ConfettiOptions): Promise<void> {\n if (matchMedia('(prefers-reduced-motion: reduce)').matches) return Promise.resolve();\n const canvas = getCanvas();\n let scene = scenes.get(canvas);\n if (!scene) {\n const ctx = canvas.getContext('2d');\n if (!ctx) return Promise.resolve();\n scene = { ctx, pieces: [], frame: 0, last: 0, done: [], overlay: canvas === overlay };\n scenes.set(canvas, scene);\n }\n const { width, height } = fit(canvas);\n const colors = o.colors.length ? o.colors : themeColors(themed);\n const x = (o.origin.x ?? 0.5) * width;\n const y = (o.origin.y ?? 0.5) * height;\n for (let i = 0; i < o.particleCount; i++) {\n scene.pieces.push({\n x, y,\n velocity: o.startVelocity * (0.5 + Math.random()),\n angle: -o.angle * RAD + (0.5 - Math.random()) * o.spread * RAD,\n wobble: Math.random() * 10,\n wobbleSpeed: 0.05 + Math.random() * 0.05,\n tilt: (0.25 + Math.random() / 2) * Math.PI,\n tick: 0,\n color: colors[i % colors.length],\n shape: o.shapes[Math.floor(Math.random() * o.shapes.length)] ?? 'square',\n options: o\n });\n }\n const s = scene;\n if (!s.frame) s.frame = requestAnimationFrame((now) => { s.last = now; draw(canvas, s, now); });\n return new Promise((resolve) => s.done.push(resolve));\n}\n\nfunction draw(canvas: HTMLCanvasElement, scene: Scene, now: number) {\n // Frames are counted at 60 per second whatever the display rate.\n const step = Math.min((now - scene.last) / (1000 / 60), 4);\n scene.last = now;\n const { width, height } = fit(canvas);\n const { ctx } = scene;\n const dpr = canvas.width / (width || 1);\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n scene.pieces = scene.pieces.filter((p) => {\n const o = p.options;\n p.x += (Math.cos(p.angle) * p.velocity + o.drift) * step;\n p.y += (Math.sin(p.angle) * p.velocity + o.gravity * 3) * step;\n p.velocity *= o.decay ** step;\n p.wobble += p.wobbleSpeed * step;\n p.tilt += 0.1 * step;\n p.tick += step;\n if (p.tick >= o.ticks) return false;\n const size = 8 * o.scalar;\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n ctx.translate(p.x + 10 * o.scalar * Math.cos(p.wobble), p.y + 10 * o.scalar * Math.sin(p.wobble));\n ctx.rotate(p.tilt);\n ctx.scale(1, Math.cos(p.wobble));\n ctx.globalAlpha = 1 - p.tick / o.ticks;\n ctx.fillStyle = p.color;\n ctx.beginPath();\n if (p.shape === 'circle') ctx.arc(0, 0, size / 2, 0, 2 * Math.PI);\n else if (p.shape === 'star') star(ctx, size * 0.75);\n else ctx.rect(-size / 2, -size / 2, size, size);\n ctx.fill();\n return true;\n });\n if (scene.pieces.length) scene.frame = requestAnimationFrame((t) => draw(canvas, scene, t));\n else stop(canvas);\n}\n\nfunction stop(canvas: HTMLCanvasElement) {\n const scene = scenes.get(canvas);\n if (!scene) return;\n cancelAnimationFrame(scene.frame);\n scenes.delete(canvas);\n scene.ctx.setTransform(1, 0, 0, 1, 0, 0);\n scene.ctx.clearRect(0, 0, canvas.width, canvas.height);\n if (scene.overlay) {\n canvas.remove();\n overlay = null;\n }\n for (const resolve of scene.done) resolve();\n}\n\nfunction star(ctx: CanvasRenderingContext2D, r: number) {\n for (let i = 0; i < 10; i++) {\n const a = (i * Math.PI) / 5 - Math.PI / 2;\n const d = i % 2 ? r / 2 : r;\n ctx.lineTo(Math.cos(a) * d, Math.sin(a) * d);\n }\n ctx.closePath();\n}\n\n// Matches the canvas's pixel buffer to its box and the screen's pixel ratio.\nfunction fit(canvas: HTMLCanvasElement) {\n const width = canvas.clientWidth;\n const height = canvas.clientHeight;\n const w = Math.round(width * devicePixelRatio);\n const h = Math.round(height * devicePixelRatio);\n if (canvas.width !== w || canvas.height !== h) {\n canvas.width = w;\n canvas.height = h;\n }\n return { width, height };\n}\n\nfunction viewportCanvas(): HTMLCanvasElement {\n if (overlay?.isConnected) return overlay;\n overlay = document.createElement('canvas');\n overlay.className = 'confetti-overlay';\n overlay.setAttribute('aria-hidden', 'true');\n // Inline, so the overlay works even where the stylesheet does not reach.\n Object.assign(overlay.style, {\n position: 'fixed', inset: '0', width: '100%', height: '100%', margin: '0', padding: '0',\n // The fallback keeps the order where the sheet, and so the token, is absent.\n border: '0', background: 'transparent', pointerEvents: 'none', zIndex: 'var(--expressive-z-confetti, 10001)'\n });\n document.body.append(overlay);\n if (typeof overlay.showPopover === 'function') {\n overlay.popover = 'manual';\n overlay.showPopover();\n }\n return overlay;\n}\n\n// Resolves each theme color token through `color`, so light-dark() and\n// relative colors reach the canvas as plain colors.\nfunction themeColors(themed: Element): string[] {\n const probe = document.createElement('span');\n probe.hidden = true;\n themed.append(probe);\n const style = getComputedStyle(probe);\n const colors = THEME_COLORS.filter((role) => style.getPropertyValue(`--md-sys-color-${role}`).trim()).map((role) => {\n probe.style.color = `var(--md-sys-color-${role})`;\n return getComputedStyle(probe).color;\n });\n probe.remove();\n return colors.length ? colors : FALLBACK_COLORS;\n}\n"],
5
+ "mappings": ";;;;;AAyEA,IAAM,YAA6B;AAAA,EACjC,eAAe;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ,EAAE,GAAG,KAAK,GAAG,IAAI;AAAA,EACzB,QAAQ,CAAC;AAAA,EACT,QAAQ,CAAC,UAAU,QAAQ;AAAA,EAC3B,QAAQ;AAAA,EACR,aAAa;AACf;AAEA,IAAM,eAAe,CAAC,WAAW,aAAa,YAAY,qBAAqB,uBAAuB,oBAAoB;AAE1H,IAAM,kBAAkB,CAAC,WAAW,WAAW,WAAW,WAAW,WAAW,WAAW,SAAS;AACpG,IAAM,MAAM,KAAK,KAAK;AAyBtB,IAAM,SAAS,oBAAI,IAA8B;AACjD,IAAI,UAAoC;AAcjC,IAAM,YAAN,MAAM,kBAAiB,UAA2B;AAAA,EAGvD,YAAY,IAAiB,SAAmC;AAC9D,UAAM,IAAI,OAAO;AAHnB,SAAQ,WAAW,MAAM;AAAE,WAAK,KAAK;AAAA,IAAG;AAItC,QAAI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,UAAQ,aAAa,eAAe,MAAM;AAE1C,SAAO,OAAO,QAAQ,OAAO;AAAA,IAC3B,UAAU;AAAA,IAAS,OAAO;AAAA,IAAK,OAAO;AAAA,IAAQ,QAAQ;AAAA,IAAQ,QAAQ;AAAA,IAAK,SAAS;AAAA;AAAA,IAEpF,QAAQ;AAAA,IAAK,YAAY;AAAA,IAAe,eAAe;AAAA,IAAQ,QAAQ;AAAA,EACzE,CAAC;AACD,WAAS,KAAK,OAAO,OAAO;AAC5B,MAAI,OAAO,QAAQ,gBAAgB,YAAY;AAC7C,YAAQ,UAAU;AAClB,YAAQ,YAAY;AAAA,EACtB;AACA,SAAO;AACT;AAIA,SAAS,YAAY,QAA2B;AAC9C,QAAM,QAAQ,SAAS,cAAc,MAAM;AAC3C,QAAM,SAAS;AACf,SAAO,OAAO,KAAK;AACnB,QAAM,QAAQ,iBAAiB,KAAK;AACpC,QAAM,SAAS,aAAa,OAAO,CAAC,SAAS,MAAM,iBAAiB,kBAAkB,IAAI,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,SAAS;AAClH,UAAM,MAAM,QAAQ,sBAAsB,IAAI;AAC9C,WAAO,iBAAiB,KAAK,EAAE;AAAA,EACjC,CAAC;AACD,QAAM,OAAO;AACb,SAAO,OAAO,SAAS,SAAS;AAClC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,38 @@
1
+ // src/ts/core/spring.ts
2
+ var FPS = 60;
3
+ var REST = 0.5;
4
+ var LONGEST = 5;
5
+ function displacement(x0, v0, { damping, stiffness }, t) {
6
+ const w = Math.sqrt(stiffness);
7
+ if (damping >= 1) return Math.exp(-w * t) * (x0 + (v0 + w * x0) * t);
8
+ const wd = w * Math.sqrt(1 - damping * damping);
9
+ return Math.exp(-damping * w * t) * (x0 * Math.cos(wd * t) + (v0 + damping * w * x0) / wd * Math.sin(wd * t));
10
+ }
11
+ function springPath(from, to, velocity, spring) {
12
+ const path = [from];
13
+ const [x0, v0] = [from - to, velocity * 1e3];
14
+ for (let frame = 1; frame < LONGEST * FPS; frame++) {
15
+ const x = displacement(x0, v0, spring, frame / FPS);
16
+ path.push(to + x);
17
+ if (Math.abs(x) < REST && Math.abs(to + x - path[frame - 1]) < REST) break;
18
+ }
19
+ path.push(to);
20
+ return path;
21
+ }
22
+ function springToken(el, name) {
23
+ const style = getComputedStyle(el);
24
+ const read = (part) => parseFloat(style.getPropertyValue(`--md-sys-motion-spring-${name}-${part}`));
25
+ const [damping, stiffness] = [read("damping"), read("stiffness")];
26
+ return damping > 0 && stiffness > 0 ? { damping, stiffness } : null;
27
+ }
28
+ function animatePath(el, property, path, write) {
29
+ const frames = path.map((value) => ({ [property]: write(value) }));
30
+ return el.animate(frames, { duration: (path.length - 1) * 1e3 / FPS, easing: "linear" });
31
+ }
32
+
33
+ export {
34
+ springPath,
35
+ springToken,
36
+ animatePath
37
+ };
38
+ //# sourceMappingURL=chunk-W6FAL3TI.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/core/spring.ts"],
4
+ "sourcesContent": ["/**\n * Springs solved at run time. The CSS springs are sampled at build time\n * into linear() easings that always start from rest, so motion that is\n * interrupted restarts. A spring solved here starts from where something\n * is, at the speed it has, as M3's springs do: mass 1, a damping ratio and\n * a stiffness.\n */\nexport interface Spring {\n damping: number;\n stiffness: number;\n}\n\n/** Frames per second the path is sampled at. */\nconst FPS = 60;\n/** Settled once within this distance of the target and moving less than this a frame. */\nconst REST = 0.5;\n/** No spring runs longer than this, in seconds. */\nconst LONGEST = 5;\n\n/**\n * How far from the target a spring is at `t` seconds, released `x0` away\n * at speed `v0`: underdamped springs oscillate as they decay, and M3's\n * critically damped ones do not.\n */\nfunction displacement(x0: number, v0: number, { damping, stiffness }: Spring, t: number) {\n const w = Math.sqrt(stiffness);\n if (damping >= 1) return Math.exp(-w * t) * (x0 + (v0 + w * x0) * t);\n const wd = w * Math.sqrt(1 - damping * damping);\n return Math.exp(-damping * w * t) * (x0 * Math.cos(wd * t) + ((v0 + damping * w * x0) / wd) * Math.sin(wd * t));\n}\n\n/**\n * The spring's path from `from` to `to`, released at `velocity` in units\n * per millisecond, as one value a frame until it settles on `to`.\n */\nexport function springPath(from: number, to: number, velocity: number, spring: Spring): number[] {\n const path = [from];\n const [x0, v0] = [from - to, velocity * 1000];\n for (let frame = 1; frame < LONGEST * FPS; frame++) {\n const x = displacement(x0, v0, spring, frame / FPS);\n path.push(to + x);\n if (Math.abs(x) < REST && Math.abs(to + x - path[frame - 1]) < REST) break;\n }\n path.push(to);\n return path;\n}\n\n/** The spring a CSS token names, from its -damping and -stiffness tokens, or null without them. */\nexport function springToken(el: Element, name: string): Spring | null {\n const style = getComputedStyle(el);\n const read = (part: string) => parseFloat(style.getPropertyValue(`--md-sys-motion-spring-${name}-${part}`));\n const [damping, stiffness] = [read('damping'), read('stiffness')];\n return damping > 0 && stiffness > 0 ? { damping, stiffness } : null;\n}\n\n/** Plays a path on one property, `write` turning each value into CSS. */\nexport function animatePath(el: Element, property: string, path: number[], write: (value: number) => string): Animation {\n const frames = path.map((value) => ({ [property]: write(value) }));\n return el.animate(frames, { duration: ((path.length - 1) * 1000) / FPS, easing: 'linear' });\n}\n"],
5
+ "mappings": ";AAaA,IAAM,MAAM;AAEZ,IAAM,OAAO;AAEb,IAAM,UAAU;AAOhB,SAAS,aAAa,IAAY,IAAY,EAAE,SAAS,UAAU,GAAW,GAAW;AACvF,QAAM,IAAI,KAAK,KAAK,SAAS;AAC7B,MAAI,WAAW,EAAG,QAAO,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,MAAM,KAAK,IAAI,MAAM;AAClE,QAAM,KAAK,IAAI,KAAK,KAAK,IAAI,UAAU,OAAO;AAC9C,SAAO,KAAK,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,CAAC,KAAM,KAAK,UAAU,IAAI,MAAM,KAAM,KAAK,IAAI,KAAK,CAAC;AAC/G;AAMO,SAAS,WA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