@expressivecss/expressive 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (609) hide show
  1. package/CHANGELOG.md +1807 -1
  2. package/README.md +9 -8
  3. package/dist/css/expressive.css +19176 -11958
  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-26VUH75M.mjs +102 -0
  64. package/dist/js/chunks/chunk-26VUH75M.mjs.map +7 -0
  65. package/dist/js/chunks/chunk-2LFCOGC3.mjs +233 -0
  66. package/dist/js/chunks/chunk-2LFCOGC3.mjs.map +7 -0
  67. package/dist/js/chunks/{chunk-DXGRXYYL.mjs → chunk-36GELQGX.mjs} +29 -46
  68. package/dist/js/chunks/chunk-36GELQGX.mjs.map +7 -0
  69. package/dist/js/chunks/{chunk-74MXKKLN.mjs → chunk-3FKWIRHW.mjs} +15 -29
  70. package/dist/js/chunks/chunk-3FKWIRHW.mjs.map +7 -0
  71. package/dist/js/chunks/chunk-3KF65KGL.mjs +209 -0
  72. package/dist/js/chunks/chunk-3KF65KGL.mjs.map +7 -0
  73. package/dist/js/chunks/{chunk-KVJAVDBC.mjs → chunk-3KLZRQZI.mjs} +88 -116
  74. package/dist/js/chunks/chunk-3KLZRQZI.mjs.map +7 -0
  75. package/dist/js/chunks/{chunk-CK2XCICY.mjs → chunk-3XORNED5.mjs} +3 -11
  76. package/dist/js/chunks/chunk-3XORNED5.mjs.map +7 -0
  77. package/dist/js/chunks/chunk-4WBGAQN3.mjs +113 -0
  78. package/dist/js/chunks/chunk-4WBGAQN3.mjs.map +7 -0
  79. package/dist/js/chunks/{chunk-FM5CZOUB.mjs → chunk-5F4URJHL.mjs} +19 -30
  80. package/dist/js/chunks/chunk-5F4URJHL.mjs.map +7 -0
  81. package/dist/js/chunks/chunk-67UNY7RH.mjs +299 -0
  82. package/dist/js/chunks/chunk-67UNY7RH.mjs.map +7 -0
  83. package/dist/js/chunks/chunk-7CXNATJS.mjs +97 -0
  84. package/dist/js/chunks/chunk-7CXNATJS.mjs.map +7 -0
  85. package/dist/js/chunks/{chunk-UETTGDLI.mjs → chunk-7X44MKEQ.mjs} +43 -48
  86. package/dist/js/chunks/chunk-7X44MKEQ.mjs.map +7 -0
  87. package/dist/js/chunks/chunk-7ZAMOMGY.mjs +440 -0
  88. package/dist/js/chunks/chunk-7ZAMOMGY.mjs.map +7 -0
  89. package/dist/js/chunks/chunk-AEG6LOAJ.mjs +54 -0
  90. package/dist/js/chunks/chunk-AEG6LOAJ.mjs.map +7 -0
  91. package/dist/js/chunks/chunk-AQNFCJJ5.mjs +135 -0
  92. package/dist/js/chunks/chunk-AQNFCJJ5.mjs.map +7 -0
  93. package/dist/js/chunks/chunk-B55LWKBM.mjs +75 -0
  94. package/dist/js/chunks/chunk-B55LWKBM.mjs.map +7 -0
  95. package/dist/js/chunks/chunk-BB5VXYXT.mjs +28 -0
  96. package/dist/js/chunks/chunk-BB5VXYXT.mjs.map +7 -0
  97. package/dist/js/chunks/chunk-BDATLH3H.mjs +108 -0
  98. package/dist/js/chunks/chunk-BDATLH3H.mjs.map +7 -0
  99. package/dist/js/chunks/chunk-CWMQOT4O.mjs +232 -0
  100. package/dist/js/chunks/chunk-CWMQOT4O.mjs.map +7 -0
  101. package/dist/js/chunks/chunk-CY2CTOVM.mjs +81 -0
  102. package/dist/js/chunks/chunk-CY2CTOVM.mjs.map +7 -0
  103. package/dist/js/chunks/{chunk-NUHMOAOY.mjs → chunk-DWA5UYLJ.mjs} +363 -218
  104. package/dist/js/chunks/chunk-DWA5UYLJ.mjs.map +7 -0
  105. package/dist/js/chunks/chunk-EB2V4OKL.mjs +79 -0
  106. package/dist/js/chunks/chunk-EB2V4OKL.mjs.map +7 -0
  107. package/dist/js/chunks/chunk-EWO662ZC.mjs +188 -0
  108. package/dist/js/chunks/chunk-EWO662ZC.mjs.map +7 -0
  109. package/dist/js/chunks/{chunk-ZX6M7SWO.mjs → chunk-F7LAKFMX.mjs} +320 -141
  110. package/dist/js/chunks/chunk-F7LAKFMX.mjs.map +7 -0
  111. package/dist/js/chunks/{chunk-L27Q6ZMI.mjs → chunk-FNIIH2LU.mjs} +20 -33
  112. package/dist/js/chunks/chunk-FNIIH2LU.mjs.map +7 -0
  113. package/dist/js/chunks/chunk-GE3YMFS6.mjs +15 -0
  114. package/dist/js/chunks/chunk-GE3YMFS6.mjs.map +7 -0
  115. package/dist/js/chunks/chunk-GFWYMWYN.mjs +125 -0
  116. package/dist/js/chunks/chunk-GFWYMWYN.mjs.map +7 -0
  117. package/dist/js/chunks/chunk-GNRSYMVH.mjs +1 -0
  118. package/dist/js/chunks/chunk-H5ISU45X.mjs +87 -0
  119. package/dist/js/chunks/chunk-H5ISU45X.mjs.map +7 -0
  120. package/dist/js/chunks/{chunk-GJL6GCIU.mjs → chunk-H6YIKFAQ.mjs} +311 -186
  121. package/dist/js/chunks/chunk-H6YIKFAQ.mjs.map +7 -0
  122. package/dist/js/chunks/{chunk-BGZLF6JZ.mjs → chunk-HEH7E3KO.mjs} +155 -35
  123. package/dist/js/chunks/chunk-HEH7E3KO.mjs.map +7 -0
  124. package/dist/js/chunks/chunk-HQRLBTNM.mjs +152 -0
  125. package/dist/js/chunks/chunk-HQRLBTNM.mjs.map +7 -0
  126. package/dist/js/chunks/chunk-I2F7MLUU.mjs +137 -0
  127. package/dist/js/chunks/chunk-I2F7MLUU.mjs.map +7 -0
  128. package/dist/js/chunks/chunk-IQOTGGHX.mjs +797 -0
  129. package/dist/js/chunks/chunk-IQOTGGHX.mjs.map +7 -0
  130. package/dist/js/chunks/chunk-JH3YWKA6.mjs +225 -0
  131. package/dist/js/chunks/chunk-JH3YWKA6.mjs.map +7 -0
  132. package/dist/js/chunks/chunk-JOLJAYIJ.mjs +7 -0
  133. package/dist/js/chunks/chunk-JOLJAYIJ.mjs.map +7 -0
  134. package/dist/js/chunks/{chunk-VGNYF6FB.mjs → chunk-KOTGMCMI.mjs} +116 -24
  135. package/dist/js/chunks/chunk-KOTGMCMI.mjs.map +7 -0
  136. package/dist/js/chunks/{chunk-LQWUDNHZ.mjs → chunk-LC4O5LFS.mjs} +21 -45
  137. package/dist/js/chunks/chunk-LC4O5LFS.mjs.map +7 -0
  138. package/dist/js/chunks/chunk-LEF33SCP.mjs +127 -0
  139. package/dist/js/chunks/chunk-LEF33SCP.mjs.map +7 -0
  140. package/dist/js/chunks/{chunk-PDG64UHF.mjs → chunk-LFORZRPH.mjs} +21 -23
  141. package/dist/js/chunks/chunk-LFORZRPH.mjs.map +7 -0
  142. package/dist/js/chunks/chunk-LWLNV5EC.mjs +451 -0
  143. package/dist/js/chunks/chunk-LWLNV5EC.mjs.map +7 -0
  144. package/dist/js/chunks/chunk-LXRHUQAX.mjs +491 -0
  145. package/dist/js/chunks/chunk-LXRHUQAX.mjs.map +7 -0
  146. package/dist/js/chunks/{chunk-SFI2U4YW.mjs → chunk-MA2SZZFB.mjs} +82 -111
  147. package/dist/js/chunks/chunk-MA2SZZFB.mjs.map +7 -0
  148. package/dist/js/chunks/chunk-MDBZAMIV.mjs +121 -0
  149. package/dist/js/chunks/chunk-MDBZAMIV.mjs.map +7 -0
  150. package/dist/js/chunks/chunk-NODZ5VAD.mjs +75 -0
  151. package/dist/js/chunks/chunk-NODZ5VAD.mjs.map +7 -0
  152. package/dist/js/chunks/chunk-O2WJB6TH.mjs +365 -0
  153. package/dist/js/chunks/chunk-O2WJB6TH.mjs.map +7 -0
  154. package/dist/js/chunks/chunk-PCABY5BN.mjs +35 -0
  155. package/dist/js/chunks/chunk-PCABY5BN.mjs.map +7 -0
  156. package/dist/js/chunks/chunk-PWKYVMND.mjs +120 -0
  157. package/dist/js/chunks/chunk-PWKYVMND.mjs.map +7 -0
  158. package/dist/js/chunks/{chunk-SMY7GJSS.mjs → chunk-QHZZT7YO.mjs} +66 -38
  159. package/dist/js/chunks/chunk-QHZZT7YO.mjs.map +7 -0
  160. package/dist/js/chunks/chunk-QND56EW2.mjs +439 -0
  161. package/dist/js/chunks/chunk-QND56EW2.mjs.map +7 -0
  162. package/dist/js/chunks/chunk-QNODAANY.mjs +376 -0
  163. package/dist/js/chunks/chunk-QNODAANY.mjs.map +7 -0
  164. package/dist/js/chunks/{chunk-KHXZ2A4K.mjs → chunk-QRO5FV3I.mjs} +156 -73
  165. package/dist/js/chunks/chunk-QRO5FV3I.mjs.map +7 -0
  166. package/dist/js/chunks/chunk-R7A7JRC5.mjs +440 -0
  167. package/dist/js/chunks/chunk-R7A7JRC5.mjs.map +7 -0
  168. package/dist/js/chunks/chunk-RKG2CBFE.mjs +74 -0
  169. package/dist/js/chunks/chunk-RKG2CBFE.mjs.map +7 -0
  170. package/dist/js/chunks/{chunk-XAEAEHIX.mjs → chunk-RSNS5OYS.mjs} +38 -25
  171. package/dist/js/chunks/chunk-RSNS5OYS.mjs.map +7 -0
  172. package/dist/js/chunks/{chunk-X4ISMKE2.mjs → chunk-RUDYMEJ3.mjs} +7 -6
  173. package/dist/js/chunks/chunk-RUDYMEJ3.mjs.map +7 -0
  174. package/dist/js/chunks/chunk-STJR62SU.mjs +161 -0
  175. package/dist/js/chunks/chunk-STJR62SU.mjs.map +7 -0
  176. package/dist/js/chunks/chunk-SUSD4UTN.mjs +220 -0
  177. package/dist/js/chunks/chunk-SUSD4UTN.mjs.map +7 -0
  178. package/dist/js/chunks/{chunk-5CEAOLUA.mjs → chunk-SYBOA5HC.mjs} +26 -48
  179. package/dist/js/chunks/chunk-SYBOA5HC.mjs.map +7 -0
  180. package/dist/js/chunks/chunk-T4MOBP3J.mjs +108 -0
  181. package/dist/js/chunks/chunk-T4MOBP3J.mjs.map +7 -0
  182. package/dist/js/chunks/chunk-TM7HPGTV.mjs +342 -0
  183. package/dist/js/chunks/chunk-TM7HPGTV.mjs.map +7 -0
  184. package/dist/js/chunks/{chunk-C6CHEWYP.mjs → chunk-TMQDZSDC.mjs} +71 -35
  185. package/dist/js/chunks/chunk-TMQDZSDC.mjs.map +7 -0
  186. package/dist/js/chunks/chunk-TVSX5YA2.mjs +48 -0
  187. package/dist/js/chunks/chunk-TVSX5YA2.mjs.map +7 -0
  188. package/dist/js/chunks/chunk-UHO5CV6K.mjs +80 -0
  189. package/dist/js/chunks/chunk-UHO5CV6K.mjs.map +7 -0
  190. package/dist/js/chunks/chunk-UKCNELUN.mjs +223 -0
  191. package/dist/js/chunks/chunk-UKCNELUN.mjs.map +7 -0
  192. package/dist/js/chunks/chunk-UKQK5GWR.mjs +167 -0
  193. package/dist/js/chunks/chunk-UKQK5GWR.mjs.map +7 -0
  194. package/dist/js/chunks/{chunk-TSZYSW7F.mjs → chunk-UTSLYQ65.mjs} +21 -48
  195. package/dist/js/chunks/chunk-UTSLYQ65.mjs.map +7 -0
  196. package/dist/js/chunks/chunk-VS5OJBOD.mjs +108 -0
  197. package/dist/js/chunks/chunk-VS5OJBOD.mjs.map +7 -0
  198. package/dist/js/chunks/chunk-VZMROW5A.mjs +759 -0
  199. package/dist/js/chunks/chunk-VZMROW5A.mjs.map +7 -0
  200. package/dist/js/chunks/chunk-W6FAL3TI.mjs +38 -0
  201. package/dist/js/chunks/chunk-W6FAL3TI.mjs.map +7 -0
  202. package/dist/js/chunks/chunk-XB6Y7P5W.mjs +69 -0
  203. package/dist/js/chunks/chunk-XB6Y7P5W.mjs.map +7 -0
  204. package/dist/js/chunks/chunk-XDAMOMVD.mjs +226 -0
  205. package/dist/js/chunks/chunk-XDAMOMVD.mjs.map +7 -0
  206. package/dist/js/chunks/{chunk-WDK4T63U.mjs → chunk-XJPMW5SP.mjs} +247 -172
  207. package/dist/js/chunks/chunk-XJPMW5SP.mjs.map +7 -0
  208. package/dist/js/chunks/{chunk-KUFHW3DS.mjs → chunk-YKANQILZ.mjs} +16 -21
  209. package/dist/js/chunks/chunk-YKANQILZ.mjs.map +7 -0
  210. package/dist/js/chunks/chunk-YLZOJLDI.mjs +175 -0
  211. package/dist/js/chunks/chunk-YLZOJLDI.mjs.map +7 -0
  212. package/dist/js/chunks/chunk-ZK7YY322.mjs +514 -0
  213. package/dist/js/chunks/chunk-ZK7YY322.mjs.map +7 -0
  214. package/dist/js/expressive.cjs +10266 -3628
  215. package/dist/js/expressive.cjs.map +4 -4
  216. package/dist/js/expressive.js +10266 -3628
  217. package/dist/js/expressive.js.map +4 -4
  218. package/dist/js/expressive.min.js +23 -22
  219. package/dist/js/expressive.min.js.map +4 -4
  220. package/dist/js/expressive.mjs +181 -69
  221. package/dist/js/expressive.mjs.map +2 -2
  222. package/dist/js/internal/behaviors/bottomSheets.mjs +4 -3
  223. package/dist/js/internal/behaviors/copy.mjs +9 -0
  224. package/dist/js/internal/behaviors/copy.mjs.map +7 -0
  225. package/dist/js/internal/behaviors/dataTables.mjs +8 -0
  226. package/dist/js/internal/behaviors/dataTables.mjs.map +7 -0
  227. package/dist/js/internal/behaviors/dialogs.mjs +2 -2
  228. package/dist/js/internal/behaviors/forms.mjs +2 -2
  229. package/dist/js/internal/behaviors/imageCompare.mjs +8 -0
  230. package/dist/js/internal/behaviors/imageCompare.mjs.map +7 -0
  231. package/dist/js/internal/behaviors/lists.mjs +8 -0
  232. package/dist/js/internal/behaviors/lists.mjs.map +7 -0
  233. package/dist/js/internal/behaviors/paneResize.mjs +8 -0
  234. package/dist/js/internal/behaviors/paneResize.mjs.map +7 -0
  235. package/dist/js/internal/behaviors/sheetDrag.mjs +7 -2
  236. package/dist/js/internal/behaviors/sideSheets.mjs +4 -3
  237. package/dist/js/internal/behaviors/sortable.mjs +8 -0
  238. package/dist/js/internal/behaviors/sortable.mjs.map +7 -0
  239. package/dist/js/internal/behaviors/theme.mjs +8 -0
  240. package/dist/js/internal/behaviors/theme.mjs.map +7 -0
  241. package/dist/js/internal/behaviors/tour.mjs +8 -0
  242. package/dist/js/internal/behaviors/tour.mjs.map +7 -0
  243. package/dist/js/internal/behaviors/transferList.mjs +8 -0
  244. package/dist/js/internal/behaviors/transferList.mjs.map +7 -0
  245. package/dist/js/internal/components/appBar.mjs +3 -2
  246. package/dist/js/internal/components/autocomplete.mjs +5 -4
  247. package/dist/js/internal/components/backToTop.mjs +9 -0
  248. package/dist/js/internal/components/backToTop.mjs.map +7 -0
  249. package/dist/js/internal/components/barChart.mjs +5 -4
  250. package/dist/js/internal/components/buttonGroup.mjs +3 -2
  251. package/dist/js/internal/components/buttons.mjs +3 -3
  252. package/dist/js/internal/components/cards.mjs +3 -3
  253. package/dist/js/internal/components/carousel.mjs +3 -3
  254. package/dist/js/internal/components/cascader.mjs +10 -0
  255. package/dist/js/internal/components/cascader.mjs.map +7 -0
  256. package/dist/js/internal/components/characterCounter.mjs +3 -2
  257. package/dist/js/internal/components/chips.mjs +7 -5
  258. package/dist/js/internal/components/colorPicker.mjs +9 -0
  259. package/dist/js/internal/components/colorPicker.mjs.map +7 -0
  260. package/dist/js/internal/components/columnChart.mjs +4 -3
  261. package/dist/js/internal/components/commandPalette.mjs +3 -3
  262. package/dist/js/internal/components/confetti.mjs +3 -2
  263. package/dist/js/internal/components/currencyInput.mjs +9 -0
  264. package/dist/js/internal/components/currencyInput.mjs.map +7 -0
  265. package/dist/js/internal/components/datepicker.mjs +12 -8
  266. package/dist/js/internal/components/expandingCard.mjs +3 -3
  267. package/dist/js/internal/components/funnelChart.mjs +10 -0
  268. package/dist/js/internal/components/funnelChart.mjs.map +7 -0
  269. package/dist/js/internal/components/heatmapChart.mjs +4 -3
  270. package/dist/js/internal/components/hoverCard.mjs +9 -0
  271. package/dist/js/internal/components/hoverCard.mjs.map +7 -0
  272. package/dist/js/internal/components/index.mjs +131 -65
  273. package/dist/js/internal/components/inputMask.mjs +9 -0
  274. package/dist/js/internal/components/inputMask.mjs.map +7 -0
  275. package/dist/js/internal/components/keypad.mjs +3 -3
  276. package/dist/js/internal/components/lightbox.mjs +3 -3
  277. package/dist/js/internal/components/lineChart.mjs +41 -4
  278. package/dist/js/internal/components/loadingOverlay.mjs +9 -0
  279. package/dist/js/internal/components/loadingOverlay.mjs.map +7 -0
  280. package/dist/js/internal/components/mapView.mjs +3 -3
  281. package/dist/js/internal/components/menu.mjs +3 -3
  282. package/dist/js/internal/components/menubar.mjs +10 -0
  283. package/dist/js/internal/components/menubar.mjs.map +7 -0
  284. package/dist/js/internal/components/messageScroller.mjs +3 -3
  285. package/dist/js/internal/components/mixedChart.mjs +5 -4
  286. package/dist/js/internal/components/navigationRail.mjs +3 -2
  287. package/dist/js/internal/components/particles.mjs +3 -2
  288. package/dist/js/internal/components/pieChart.mjs +4 -3
  289. package/dist/js/internal/components/pullToRefresh.mjs +9 -0
  290. package/dist/js/internal/components/pullToRefresh.mjs.map +7 -0
  291. package/dist/js/internal/components/questionnaire.mjs +3 -3
  292. package/dist/js/internal/components/radarChart.mjs +4 -3
  293. package/dist/js/internal/components/radialChart.mjs +4 -3
  294. package/dist/js/internal/components/registry.mjs +60 -41
  295. package/dist/js/internal/components/richTextEditor.mjs +3 -3
  296. package/dist/js/internal/components/sankeyChart.mjs +10 -0
  297. package/dist/js/internal/components/sankeyChart.mjs.map +7 -0
  298. package/dist/js/internal/components/scatterChart.mjs +10 -0
  299. package/dist/js/internal/components/scatterChart.mjs.map +7 -0
  300. package/dist/js/internal/components/scrollspy.mjs +3 -2
  301. package/dist/js/internal/components/select.mjs +5 -4
  302. package/dist/js/internal/components/showMore.mjs +9 -0
  303. package/dist/js/internal/components/showMore.mjs.map +7 -0
  304. package/dist/js/internal/components/slider.mjs +3 -3
  305. package/dist/js/internal/components/snackbar.mjs +2 -2
  306. package/dist/js/internal/components/swipeActions.mjs +9 -0
  307. package/dist/js/internal/components/swipeActions.mjs.map +7 -0
  308. package/dist/js/internal/components/tabs.mjs +3 -4
  309. package/dist/js/internal/components/timepicker.mjs +5 -4
  310. package/dist/js/internal/components/tooltip.mjs +3 -3
  311. package/dist/js/internal/components/treeSelect.mjs +14 -0
  312. package/dist/js/internal/components/treeSelect.mjs.map +7 -0
  313. package/dist/js/internal/components/treemapChart.mjs +10 -0
  314. package/dist/js/internal/components/treemapChart.mjs.map +7 -0
  315. package/dist/js/internal/core/component.mjs +6 -3
  316. package/dist/js/internal/core/formControl.mjs +12 -0
  317. package/dist/js/internal/core/formControl.mjs.map +7 -0
  318. package/dist/js/internal/core/imageURL.mjs +7 -0
  319. package/dist/js/internal/core/imageURL.mjs.map +7 -0
  320. package/dist/js/internal/core/spring.mjs +11 -0
  321. package/dist/js/internal/core/spring.mjs.map +7 -0
  322. package/dist/js/internal/core/utils.mjs +21 -3
  323. package/dist/js/internal/plugins/dockedDisplayPlugin.mjs +2 -2
  324. package/dist/js/internal/plugins/modalDisplayPlugin.mjs +13 -0
  325. package/dist/js/internal/plugins/modalDisplayPlugin.mjs.map +7 -0
  326. package/dist/js/modular.mjs +172 -69
  327. package/dist/types/behaviors/bottomSheets.d.ts +23 -5
  328. package/dist/types/behaviors/copy.d.ts +18 -0
  329. package/dist/types/behaviors/dataTables.d.ts +125 -0
  330. package/dist/types/behaviors/dialogs.d.ts +27 -1
  331. package/dist/types/behaviors/forms.d.ts +70 -4
  332. package/dist/types/behaviors/imageCompare.d.ts +13 -0
  333. package/dist/types/behaviors/lists.d.ts +12 -0
  334. package/dist/types/behaviors/paneResize.d.ts +29 -0
  335. package/dist/types/behaviors/sheetDrag.d.ts +18 -0
  336. package/dist/types/behaviors/sideSheets.d.ts +1 -1
  337. package/dist/types/behaviors/sortable.d.ts +28 -0
  338. package/dist/types/behaviors/theme.d.ts +22 -0
  339. package/dist/types/behaviors/tour.d.ts +36 -0
  340. package/dist/types/behaviors/transferList.d.ts +53 -0
  341. package/dist/types/components/appBar.d.ts +5 -6
  342. package/dist/types/components/autocomplete.d.ts +105 -20
  343. package/dist/types/components/backToTop.d.ts +36 -0
  344. package/dist/types/components/barChart.d.ts +3 -6
  345. package/dist/types/components/buttonGroup.d.ts +2 -4
  346. package/dist/types/components/buttons.d.ts +5 -5
  347. package/dist/types/components/cards.d.ts +3 -16
  348. package/dist/types/components/carousel.d.ts +16 -15
  349. package/dist/types/components/cascader.d.ts +130 -0
  350. package/dist/types/components/characterCounter.d.ts +2 -15
  351. package/dist/types/components/chips.d.ts +80 -19
  352. package/dist/types/components/colorPicker.d.ts +56 -0
  353. package/dist/types/components/columnChart.d.ts +23 -10
  354. package/dist/types/components/commandPalette.d.ts +11 -16
  355. package/dist/types/components/confetti.d.ts +2 -4
  356. package/dist/types/components/currencyInput.d.ts +60 -0
  357. package/dist/types/components/datepicker.d.ts +107 -56
  358. package/dist/types/components/expandingCard.d.ts +4 -6
  359. package/dist/types/components/funnelChart.d.ts +35 -0
  360. package/dist/types/components/heatmapChart.d.ts +42 -8
  361. package/dist/types/components/hoverCard.d.ts +59 -0
  362. package/dist/types/components/index.d.ts +16 -1
  363. package/dist/types/components/inputMask.d.ts +28 -0
  364. package/dist/types/components/keypad.d.ts +38 -6
  365. package/dist/types/components/lightbox.d.ts +14 -20
  366. package/dist/types/components/lineChart.d.ts +212 -12
  367. package/dist/types/components/loadingOverlay.d.ts +42 -0
  368. package/dist/types/components/mapView.d.ts +138 -27
  369. package/dist/types/components/menu.d.ts +74 -22
  370. package/dist/types/components/menubar.d.ts +37 -0
  371. package/dist/types/components/messageScroller.d.ts +2 -14
  372. package/dist/types/components/mixedChart.d.ts +15 -6
  373. package/dist/types/components/navigationRail.d.ts +16 -5
  374. package/dist/types/components/particles.d.ts +22 -5
  375. package/dist/types/components/pieChart.d.ts +33 -9
  376. package/dist/types/components/pullToRefresh.d.ts +80 -0
  377. package/dist/types/components/questionnaire.d.ts +58 -16
  378. package/dist/types/components/radarChart.d.ts +10 -6
  379. package/dist/types/components/radialChart.d.ts +58 -7
  380. package/dist/types/components/registry.d.ts +73 -3
  381. package/dist/types/components/richTextEditor.d.ts +45 -22
  382. package/dist/types/components/sankeyChart.d.ts +72 -0
  383. package/dist/types/components/scatterChart.d.ts +102 -0
  384. package/dist/types/components/scrollspy.d.ts +3 -5
  385. package/dist/types/components/select.d.ts +44 -33
  386. package/dist/types/components/showMore.d.ts +53 -0
  387. package/dist/types/components/slider.d.ts +2 -15
  388. package/dist/types/components/snackbar.d.ts +68 -1
  389. package/dist/types/components/swipeActions.d.ts +81 -0
  390. package/dist/types/components/tabs.d.ts +92 -30
  391. package/dist/types/components/timepicker.d.ts +128 -27
  392. package/dist/types/components/tooltip.d.ts +57 -21
  393. package/dist/types/components/treeSelect.d.ts +106 -0
  394. package/dist/types/components/treemapChart.d.ts +56 -0
  395. package/dist/types/core/component.d.ts +49 -25
  396. package/dist/types/core/formControl.d.ts +21 -0
  397. package/dist/types/core/imageURL.d.ts +2 -0
  398. package/dist/types/core/spring.d.ts +20 -0
  399. package/dist/types/core/utils.d.ts +123 -72
  400. package/dist/types/modular.d.ts +33 -1
  401. package/dist/types/plugins/dockedDisplayPlugin.d.ts +10 -8
  402. package/dist/types/plugins/modalDisplayPlugin.d.ts +39 -0
  403. package/package.json +17 -13
  404. package/src/sass/README.md +27 -18
  405. package/src/sass/abstracts/_elevation.scss +13 -7
  406. package/src/sass/abstracts/_index.scss +1 -0
  407. package/src/sass/abstracts/_mixins.scss +864 -78
  408. package/src/sass/abstracts/_spring.scss +63 -0
  409. package/src/sass/abstracts/_variables.scss +64 -21
  410. package/src/sass/base/_fonts.scss +61 -48
  411. package/src/sass/base/_global.scss +104 -24
  412. package/src/sass/base/_index.scss +2 -0
  413. package/src/sass/base/_normalize.scss +59 -114
  414. package/src/sass/base/_print.scss +21 -0
  415. package/src/sass/base/_prose.scss +68 -0
  416. package/src/sass/base/_typography.scss +9 -5
  417. package/src/sass/components/_accordion.scss +10 -19
  418. package/src/sass/components/_alert.scss +102 -0
  419. package/src/sass/components/_aura.scss +9 -3
  420. package/src/sass/components/_avatar.scss +3 -3
  421. package/src/sass/components/_back-to-top.scss +38 -0
  422. package/src/sass/components/_badges.scss +6 -5
  423. package/src/sass/components/_bar-chart.scss +31 -90
  424. package/src/sass/components/_bottom-sheet.scss +51 -16
  425. package/src/sass/components/_breadcrumb.scss +8 -7
  426. package/src/sass/components/_button-groups.scss +30 -63
  427. package/src/sass/components/_buttons.scss +137 -94
  428. package/src/sass/components/_calendar.scss +244 -0
  429. package/src/sass/components/_cards.scss +36 -44
  430. package/src/sass/components/_carousel.scss +37 -113
  431. package/src/sass/components/_cascader.scss +131 -0
  432. package/src/sass/components/_chips.scss +36 -46
  433. package/src/sass/components/_column-chart.scss +15 -26
  434. package/src/sass/components/_command-palette.scss +4 -7
  435. package/src/sass/components/_confetti.scss +1 -4
  436. package/src/sass/components/_countdown.scss +1 -1
  437. package/src/sass/components/_data-table.scss +172 -25
  438. package/src/sass/components/_datepicker.scss +54 -40
  439. package/src/sass/components/_description-list.scss +85 -0
  440. package/src/sass/components/_dialog.scss +48 -55
  441. package/src/sass/components/_docked-display.scss +1 -3
  442. package/src/sass/components/_drag-handle.scss +16 -20
  443. package/src/sass/components/_expanding-card.scss +21 -14
  444. package/src/sass/components/_fab-menu.scss +43 -39
  445. package/src/sass/components/_funnel-chart.scss +63 -0
  446. package/src/sass/components/_heatmap-chart.scss +114 -29
  447. package/src/sass/components/_icon-buttons.scss +8 -11
  448. package/src/sass/components/_icons-material-design.scss +2 -2
  449. package/src/sass/components/_image-compare.scss +108 -0
  450. package/src/sass/components/_index.scss +20 -0
  451. package/src/sass/components/_keypad.scss +39 -19
  452. package/src/sass/components/_kpi.scss +6 -11
  453. package/src/sass/components/_lightbox.scss +24 -13
  454. package/src/sass/components/_line-chart.scss +9 -63
  455. package/src/sass/components/_list.scss +59 -14
  456. package/src/sass/components/_loading-indicator.scss +1 -0
  457. package/src/sass/components/_loading-overlay.scss +105 -0
  458. package/src/sass/components/_map.scss +37 -11
  459. package/src/sass/components/_marquee.scss +4 -3
  460. package/src/sass/components/_mega-menu.scss +128 -0
  461. package/src/sass/components/_menu.scss +146 -127
  462. package/src/sass/components/_menubar.scss +47 -0
  463. package/src/sass/components/_message-scroller.scss +2 -2
  464. package/src/sass/components/_message.scss +3 -3
  465. package/src/sass/components/_mixed-chart.scss +27 -35
  466. package/src/sass/components/_modal-display.scss +21 -0
  467. package/src/sass/components/_navbar.scss +45 -36
  468. package/src/sass/components/_navigation-bar.scss +12 -77
  469. package/src/sass/components/_navigation-rail.scss +161 -92
  470. package/src/sass/components/_org-chart.scss +192 -0
  471. package/src/sass/components/_page-footer.scss +2 -4
  472. package/src/sass/components/_pagination.scss +9 -27
  473. package/src/sass/components/_panes.scss +35 -42
  474. package/src/sass/components/_particles.scss +1 -4
  475. package/src/sass/components/_pie-chart.scss +86 -68
  476. package/src/sass/components/_popover.scss +18 -5
  477. package/src/sass/components/_progress.scss +183 -44
  478. package/src/sass/components/_pull-to-refresh.scss +90 -0
  479. package/src/sass/components/_questionnaire.scss +74 -3
  480. package/src/sass/components/_radar-chart.scss +40 -42
  481. package/src/sass/components/_radial-chart.scss +108 -46
  482. package/src/sass/components/_rich-text-editor.scss +2 -2
  483. package/src/sass/components/_sankey-chart.scss +91 -0
  484. package/src/sass/components/_scatter-chart.scss +144 -0
  485. package/src/sass/components/_scrim.scss +0 -2
  486. package/src/sass/components/_scrollspy.scss +0 -2
  487. package/src/sass/components/_search.scss +27 -26
  488. package/src/sass/components/_show-more.scss +8 -0
  489. package/src/sass/components/_side-sheet.scss +32 -51
  490. package/src/sass/components/_skeleton.scss +26 -19
  491. package/src/sass/components/_snackbar.scss +25 -21
  492. package/src/sass/components/_split-button.scss +5 -5
  493. package/src/sass/components/_stat.scss +3 -8
  494. package/src/sass/components/_stepper.scss +1 -1
  495. package/src/sass/components/_swipe-actions.scss +71 -0
  496. package/src/sass/components/_table_of_contents.scss +1 -3
  497. package/src/sass/components/_tabs.scss +49 -46
  498. package/src/sass/components/_timeline.scss +12 -12
  499. package/src/sass/components/_timepicker.scss +111 -79
  500. package/src/sass/components/_toolbar.scss +36 -47
  501. package/src/sass/components/_tooltip.scss +25 -12
  502. package/src/sass/components/_tour.scss +89 -0
  503. package/src/sass/components/_transfer-list.scss +73 -0
  504. package/src/sass/components/_transitions.scss +4 -4
  505. package/src/sass/components/_tree.scss +7 -32
  506. package/src/sass/components/_treemap-chart.scss +98 -0
  507. package/src/sass/components/forms/_checkboxes.scss +107 -44
  508. package/src/sass/components/forms/_color-picker.scss +135 -0
  509. package/src/sass/components/forms/_color-swatches.scss +85 -0
  510. package/src/sass/components/forms/_drop-zone.scss +16 -13
  511. package/src/sass/components/forms/_fieldset.scss +4 -7
  512. package/src/sass/components/forms/_file-input.scss +12 -8
  513. package/src/sass/components/forms/_index.scss +3 -1
  514. package/src/sass/components/forms/_input-fields.scss +271 -90
  515. package/src/sass/components/forms/_radio-buttons.scss +34 -117
  516. package/src/sass/components/forms/_rating.scss +2 -32
  517. package/src/sass/components/forms/_select.scss +198 -20
  518. package/src/sass/components/forms/_slider.scss +92 -98
  519. package/src/sass/components/forms/_switches.scss +62 -180
  520. package/src/sass/custom.scss +10 -1
  521. package/src/sass/expressive.scss +3 -63
  522. package/src/sass/tokens/_contrast.scss +94 -0
  523. package/src/sass/tokens/_elevation.scss +16 -0
  524. package/src/sass/tokens/_index.scss +5 -0
  525. package/src/sass/tokens/_motion.scss +109 -0
  526. package/src/sass/tokens/_reference.scss +72 -141
  527. package/src/sass/tokens/_shape.scss +38 -0
  528. package/src/sass/tokens/_stacking.scss +27 -0
  529. package/src/sass/tokens/_state.scss +0 -2
  530. package/src/sass/tokens/_theme.scss +10 -1
  531. package/src/sass/tokens/_vibrant.scss +2 -5
  532. package/src/sass/utilities/_defer-render.scss +17 -0
  533. package/src/sass/utilities/_helpers.scss +184 -27
  534. package/src/sass/utilities/_index.scss +1 -0
  535. package/src/sass/utilities/_scroll-area.scss +0 -2
  536. package/src/sass/utilities/_spacing.scss +52 -34
  537. package/src/sass/utilities/_typescale.scss +8 -1
  538. package/src/sass/utilities/_visibility.scss +46 -77
  539. package/src/sass/utilities/_z-depth.scss +7 -4
  540. package/dist/js/chunks/chunk-33QVDDGR.mjs +0 -270
  541. package/dist/js/chunks/chunk-33QVDDGR.mjs.map +0 -7
  542. package/dist/js/chunks/chunk-45FER6RI.mjs +0 -59
  543. package/dist/js/chunks/chunk-45FER6RI.mjs.map +0 -7
  544. package/dist/js/chunks/chunk-5CEAOLUA.mjs.map +0 -7
  545. package/dist/js/chunks/chunk-6VATUZC6.mjs +0 -295
  546. package/dist/js/chunks/chunk-6VATUZC6.mjs.map +0 -7
  547. package/dist/js/chunks/chunk-74MXKKLN.mjs.map +0 -7
  548. package/dist/js/chunks/chunk-AIURVCG6.mjs +0 -55
  549. package/dist/js/chunks/chunk-AIURVCG6.mjs.map +0 -7
  550. package/dist/js/chunks/chunk-BGZLF6JZ.mjs.map +0 -7
  551. package/dist/js/chunks/chunk-C6CHEWYP.mjs.map +0 -7
  552. package/dist/js/chunks/chunk-CK2XCICY.mjs.map +0 -7
  553. package/dist/js/chunks/chunk-CXXM2L4F.mjs +0 -344
  554. package/dist/js/chunks/chunk-CXXM2L4F.mjs.map +0 -7
  555. package/dist/js/chunks/chunk-DXGRXYYL.mjs.map +0 -7
  556. package/dist/js/chunks/chunk-FM5CZOUB.mjs.map +0 -7
  557. package/dist/js/chunks/chunk-GJL6GCIU.mjs.map +0 -7
  558. package/dist/js/chunks/chunk-K3HZMFMD.mjs +0 -135
  559. package/dist/js/chunks/chunk-K3HZMFMD.mjs.map +0 -7
  560. package/dist/js/chunks/chunk-KHXZ2A4K.mjs.map +0 -7
  561. package/dist/js/chunks/chunk-KQACNQ22.mjs +0 -7
  562. package/dist/js/chunks/chunk-KQACNQ22.mjs.map +0 -7
  563. package/dist/js/chunks/chunk-KUFHW3DS.mjs.map +0 -7
  564. package/dist/js/chunks/chunk-KVJAVDBC.mjs.map +0 -7
  565. package/dist/js/chunks/chunk-L27Q6ZMI.mjs.map +0 -7
  566. package/dist/js/chunks/chunk-LQWUDNHZ.mjs.map +0 -7
  567. package/dist/js/chunks/chunk-M372EDXD.mjs +0 -322
  568. package/dist/js/chunks/chunk-M372EDXD.mjs.map +0 -7
  569. package/dist/js/chunks/chunk-M3MURWMB.mjs +0 -82
  570. package/dist/js/chunks/chunk-M3MURWMB.mjs.map +0 -7
  571. package/dist/js/chunks/chunk-NUHMOAOY.mjs.map +0 -7
  572. package/dist/js/chunks/chunk-OWG3LMUL.mjs +0 -169
  573. package/dist/js/chunks/chunk-OWG3LMUL.mjs.map +0 -7
  574. package/dist/js/chunks/chunk-PD6HYHAE.mjs +0 -48
  575. package/dist/js/chunks/chunk-PD6HYHAE.mjs.map +0 -7
  576. package/dist/js/chunks/chunk-PDG64UHF.mjs.map +0 -7
  577. package/dist/js/chunks/chunk-PO3AXVR3.mjs +0 -546
  578. package/dist/js/chunks/chunk-PO3AXVR3.mjs.map +0 -7
  579. package/dist/js/chunks/chunk-QYGK36OG.mjs +0 -181
  580. package/dist/js/chunks/chunk-QYGK36OG.mjs.map +0 -7
  581. package/dist/js/chunks/chunk-SFI2U4YW.mjs.map +0 -7
  582. package/dist/js/chunks/chunk-SMY7GJSS.mjs.map +0 -7
  583. package/dist/js/chunks/chunk-TCCA2HDG.mjs +0 -414
  584. package/dist/js/chunks/chunk-TCCA2HDG.mjs.map +0 -7
  585. package/dist/js/chunks/chunk-TSZYSW7F.mjs.map +0 -7
  586. package/dist/js/chunks/chunk-UAZSDUVP.mjs +0 -90
  587. package/dist/js/chunks/chunk-UAZSDUVP.mjs.map +0 -7
  588. package/dist/js/chunks/chunk-UBRZZWRA.mjs +0 -127
  589. package/dist/js/chunks/chunk-UBRZZWRA.mjs.map +0 -7
  590. package/dist/js/chunks/chunk-UCOE7ZDL.mjs +0 -287
  591. package/dist/js/chunks/chunk-UCOE7ZDL.mjs.map +0 -7
  592. package/dist/js/chunks/chunk-UETTGDLI.mjs.map +0 -7
  593. package/dist/js/chunks/chunk-UNCRDLP6.mjs +0 -136
  594. package/dist/js/chunks/chunk-UNCRDLP6.mjs.map +0 -7
  595. package/dist/js/chunks/chunk-VGNYF6FB.mjs.map +0 -7
  596. package/dist/js/chunks/chunk-VGPGBNGL.mjs +0 -68
  597. package/dist/js/chunks/chunk-VGPGBNGL.mjs.map +0 -7
  598. package/dist/js/chunks/chunk-VKAUVTQY.mjs +0 -1
  599. package/dist/js/chunks/chunk-VM4FTS7L.mjs +0 -48
  600. package/dist/js/chunks/chunk-VM4FTS7L.mjs.map +0 -7
  601. package/dist/js/chunks/chunk-WDK4T63U.mjs.map +0 -7
  602. package/dist/js/chunks/chunk-WOCCTVUF.mjs +0 -185
  603. package/dist/js/chunks/chunk-WOCCTVUF.mjs.map +0 -7
  604. package/dist/js/chunks/chunk-WQYN5L4E.mjs +0 -107
  605. package/dist/js/chunks/chunk-WQYN5L4E.mjs.map +0 -7
  606. package/dist/js/chunks/chunk-X4ISMKE2.mjs.map +0 -7
  607. package/dist/js/chunks/chunk-XAEAEHIX.mjs.map +0 -7
  608. package/dist/js/chunks/chunk-ZX6M7SWO.mjs.map +0 -7
  609. /package/dist/js/chunks/{chunk-VKAUVTQY.mjs.map → chunk-GNRSYMVH.mjs.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/components/treeSelect.ts"],
4
+ "sourcesContent": ["import { Utils } from '../core/utils';\nimport { FormSelect, FormSelectOptions } from './select';\n\n// Tree select. A native <select data-tree> whose options name their parent's\n// value in data-parent. The native select still owns the form value, reset,\n// validity and disabled state; this builds a role=\"tree\" popup over it, where\n// only a leaf can be chosen.\n\n/** An option and the options that name it as their parent. */\nexport interface OptionNode {\n option: HTMLOptionElement;\n children: OptionNode[];\n}\n\n/**\n * Turns flat options into a tree. An option sits under the first option whose\n * value its `data-parent` names. It is a root when that is empty, names no\n * option, or starts a chain of parents that comes back to the option itself;\n * its own children stay under it. Siblings keep document order.\n */\nexport function optionTree(options: HTMLOptionElement[]): OptionNode[] {\n const byValue = new Map<string, HTMLOptionElement>();\n options.forEach((option) => { if (!byValue.has(option.value)) byValue.set(option.value, option); });\n const parentOf = (option: HTMLOptionElement) => byValue.get(option.dataset.parent || undefined);\n // ponytail: walks each option's whole chain, fine for a select's few hundred options.\n const loops = (option: HTMLOptionElement) => {\n let parent = parentOf(option);\n for (let steps = 0; parent && parent !== option && steps < options.length; steps++) parent = parentOf(parent);\n return parent === option;\n };\n const nodes = new Map(options.map((option) => [option, { option, children: [] as OptionNode[] }]));\n const roots: OptionNode[] = [];\n options.forEach((option) => {\n const parent = loops(option) ? undefined : parentOf(option);\n (parent ? nodes.get(parent).children : roots).push(nodes.get(option));\n });\n return roots;\n}\n\ntype TreeKey = (tree: TreeSelect, row: HTMLElement, e: KeyboardEvent) => void;\n\n/** Up and Down move a visible row; Home and End go to the ends. */\nconst STEPS = { ArrowUp: -1, ArrowDown: 1 };\nconst move: TreeKey = (tree, _row, e) => tree._focusRow(Utils.focusTarget(tree._visibleRows(), e, STEPS));\nconst activate: TreeKey = (tree, row) => tree._activate(row);\n\n/** What each key does to the focused row, with the arrows as in a left-to-right tree. */\nconst TREE_KEYS: Record<string, TreeKey> = {\n ArrowDown: move,\n ArrowUp: move,\n Home: move,\n End: move,\n ArrowRight: (tree, row) => tree._openOrEnter(row),\n ArrowLeft: (tree, row) => tree._closeOrLeave(row),\n '*': (tree, row) => tree._openSiblings(row),\n Enter: activate,\n ' ': activate\n};\n\n/** Any other single character searches the rows' text. */\nconst typeahead: TreeKey = (tree, row, e) => tree._typeahead(row, e.key);\n\n/** In a right-to-left tree the arrows that open and close swap. */\nconst MIRRORED: Record<string, string> = { ArrowLeft: 'ArrowRight', ArrowRight: 'ArrowLeft' };\n\nexport class TreeSelect extends FormSelect {\n /**\n * The role=\"tree\" list inside the Menu surface. Menu styles the rows of its\n * <menu> directly, so the tree keeps its rows one list further down.\n */\n tree: HTMLUListElement;\n /** Each branch row and the option it stands for. */\n private _branches: Map<HTMLElement, HTMLOptionElement>;\n /** Branch options this disabled, so the form never submits one. */\n private _disabledBranches: Set<HTMLOptionElement>;\n /** While refresh() rebuilds the rows, the values of the branches left open. */\n private _keepOpen: Set<string> | undefined;\n /** Expansion before the first nonempty query, retained across query edits. */\n private _searchOpen: Set<string> | undefined;\n /** What typeahead has read so far, and the timer that clears it. */\n private _typed = '';\n private _typedTimer: ReturnType<typeof setTimeout>;\n\n constructor(el: HTMLSelectElement, options: Partial<FormSelectOptions>) {\n super(el, options as FormSelectOptions);\n // A browser-default select stays native.\n if (!this.menuEl) return;\n const { signal } = this._events;\n if (!this._searchInput) {\n this.menuEl.setAttribute('role', 'presentation');\n this.input.setAttribute('aria-haspopup', 'tree');\n this.input.setAttribute('aria-controls', this.tree.id);\n }\n this.menuEl.removeAttribute('aria-multiselectable');\n this._nameTree();\n this._leaveImplicitBranch();\n this._handleSelectChange();\n // Capture, so the tree's keys and clicks are handled before Menu's own\n // listeners on the same element.\n if (!this._searchInput) this.menuEl.addEventListener('keydown', this._handleTreeKeydown, { signal, capture: true });\n this.menuEl.addEventListener('click', this._handleTreeClick, { signal, capture: true });\n }\n\n static key = 'Expressive_TreeSelect';\n\n _setValueToInput() {\n // Branches are navigation controls, not multiple-select values.\n if (this.isMultiple) this._branches.forEach(option => { option.selected = false; });\n super._setValueToInput();\n }\n\n protected _canSearch() {\n return this.options.searchable;\n }\n\n protected _searchList() { return this.tree; }\n\n protected _searchRows() { return this._enabledRows(); }\n\n protected _filterSearch(query: string) {\n const matches = this._matchingRows(query);\n this.tree.querySelectorAll<HTMLElement>('li[role=\"treeitem\"]').forEach(row => { row.hidden = !matches.has(row); });\n this._searchExpansion(query);\n }\n\n private _matchingRows(query: string) {\n const matches = new Set<HTMLElement>();\n this._values.filter(({ el }) => el.textContent.trim().toLowerCase().includes(query)).forEach(({ optionEl }) => {\n for (let row = optionEl; row; row = this._parentRow(row)) matches.add(row);\n });\n return matches;\n }\n\n private _searchExpansion(query: string) {\n if (query) {\n this._searchOpen ??= this._openValues();\n this._branches.forEach((_option, row) => { if (!row.hidden) this._setExpanded(row, true); });\n return;\n }\n const saved = this._searchOpen;\n this._searchOpen = undefined;\n if (saved) this._branches.forEach((option, row) => this._setExpanded(row, saved.has(option.value)));\n }\n\n protected _searchNavigate(e: KeyboardEvent) {\n if (e.target === this._searchInput) super._searchNavigate(e);\n else this._handleTreeKeydown(e);\n }\n\n destroy() {\n clearTimeout(this._typedTimer);\n this._restoreBranches();\n super.destroy();\n }\n\n /**\n * Rebuilds the tree from the native options, keeping open each branch whose\n * value is still there and, while the popup is open, focus on the same row.\n */\n refresh() {\n const focused = this._focusedOption();\n this._keepOpen = this._searchOpen ?? this._openValues();\n super.refresh();\n this._keepOpen = undefined;\n this._restoreOpenFocus(focused);\n }\n\n private _restoreOpenFocus(option: HTMLOptionElement) {\n if (option && this.menu?.isOpen) this._restoreFocus(option);\n }\n\n /** The option whose row has focus, if one does. */\n private _focusedOption() {\n const root = this.menuEl?.getRootNode() as Document | ShadowRoot | undefined;\n return this._optionOf(root?.activeElement?.closest<HTMLElement>('li[role=\"treeitem\"]'));\n }\n\n /** The values of the open branches. */\n private _openValues() {\n return new Set(Array.from(this._branches ?? [], ([li, option]) => (li.ariaExpanded === 'true' ? option.value : null)));\n }\n\n /** Focuses the row for `option` again, or the first enabled row once it is gone or disabled, or the field. */\n private _restoreFocus(option: HTMLOptionElement) {\n const row = this._rowOf(option);\n this._expandTo(row);\n const rows = this._enabledRows();\n const target = rows.includes(row) ? row : rows[0];\n if (target) this._focusRow(target);\n else (this._searchInput ?? this.input).focus();\n }\n\n /** Names the tree as the field is named: aria-labelledby, then aria-label, then its labels. */\n private _nameTree() {\n const { input } = this;\n if (input.hasAttribute('aria-labelledby')) this.tree.setAttribute('aria-labelledby', input.getAttribute('aria-labelledby'));\n else if (input.ariaLabel) this.tree.ariaLabel = input.ariaLabel;\n else this._labelTree();\n }\n\n private _labelTree() {\n const ids = Array.from(this.input.labels ?? [], (label, index) => (label.id ||= `${this.input.id}-label-${index}`));\n if (ids.length) this.tree.setAttribute('aria-labelledby', ids.join(' '));\n }\n\n // The tree takes its keys and clicks on the menu itself.\n protected _setupOptionHandlers() {}\n\n protected _buildOptions() {\n this._restoreBranches();\n this._branches = new Map();\n this.selectOptions = this._nativeOptions();\n this._values = [];\n const options = this.selectOptions.filter((option): option is HTMLOptionElement => option.tagName === 'OPTION');\n // One list for the instance's life, so its name survives refresh().\n if (!this.tree) {\n this.tree = document.createElement('ul');\n this.tree.id = 'select-tree-' + Utils.guid();\n this.tree.setAttribute('role', 'tree');\n }\n this.tree.ariaMultiSelectable = String(this.isMultiple);\n this.tree.replaceChildren(...optionTree(options).map((node) => this._row(node)));\n this.menuEl.append(this.tree);\n }\n\n /**\n * A select with no selected option picks its first one, which is often a\n * branch, and disabling the branch does not move the selection. Unless the\n * markup selected it, move to the option a form reset would pick now that\n * branches are disabled: the first enabled leaf, or none. Only on start:\n * after that a selected branch is one a script chose.\n */\n private _leaveImplicitBranch() {\n if (this.isMultiple || !this._browserPickedBranch()) return;\n const leaf = Array.from(this.el.options).find((option) => !option.disabled);\n if (leaf) leaf.selected = true;\n else this.el.selectedIndex = -1;\n }\n\n /** Whether the selection is a branch this disabled, which the markup did not select. */\n private _browserPickedBranch() {\n const chosen = this.el.selectedOptions[0];\n return !!chosen && !chosen.defaultSelected && this._disabledBranches.has(chosen);\n }\n\n private _row(node: OptionNode): HTMLLIElement {\n const li = document.createElement('li');\n li.id = 'select-option-' + Utils.guid();\n li.setAttribute('role', 'treeitem');\n li.tabIndex = -1;\n const label = document.createElement('span');\n label.textContent = node.option.textContent;\n li.append(label);\n if (node.children.length) this._branch(li, node);\n else this._leaf(li, node.option);\n return li;\n }\n\n private _branch(li: HTMLLIElement, node: OptionNode) {\n const group = document.createElement('ul');\n group.setAttribute('role', 'group');\n group.append(...node.children.map((child) => this._row(child)));\n li.append(group);\n this._setExpanded(li, !!this._keepOpen?.has(node.option.value));\n this._branches.set(li, node.option);\n if (node.option.disabled) return;\n node.option.disabled = true;\n this._disabledBranches.add(node.option);\n }\n\n private _leaf(li: HTMLLIElement, option: HTMLOptionElement) {\n if (this.el.matches(':disabled') || option.disabled) {\n li.classList.add('disabled');\n li.ariaDisabled = 'true';\n }\n this._values.push({ el: option, optionEl: li });\n }\n\n private _restoreBranches() {\n this._disabledBranches?.forEach((option) => { option.disabled = false; });\n this._disabledBranches = new Set();\n }\n\n private _setExpanded(li: HTMLElement, open: boolean) {\n li.ariaExpanded = String(open);\n li.querySelector<HTMLElement>(':scope > ul').hidden = !open;\n }\n\n /** The rows not inside a closed branch, in document order. */\n _visibleRows(): HTMLElement[] {\n return Array.from(this.tree.querySelectorAll<HTMLElement>('li[role=\"treeitem\"]')).filter((li) => !li.closest('[hidden]'));\n }\n\n private _enabledRows() {\n return this._visibleRows().filter((row) => !row.matches('.disabled'));\n }\n\n _focusRow(row: HTMLElement | null | undefined) {\n row?.focus({ preventScroll: true });\n row?.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n\n /** Opens the chosen leaf's branches and focuses it, or the first row a person can choose or open. */\n protected _focusSelected() {\n // Opening may finish after the user has already focused a tree row.\n if (!this.menu.options.autoFocus || Utils.focusIsIn(this.menuEl)) return;\n const chosen = this._values.find(({ el, optionEl }) => el.selected && !optionEl.matches('.disabled'));\n this._restoreFocus(chosen?.el);\n }\n\n /** Opens every branch around `row`. */\n private _expandTo(row: HTMLElement | undefined) {\n for (let branch = this._parentRow(row); branch; branch = this._parentRow(branch)) this._setExpanded(branch, true);\n }\n\n /** The branch row holding `row`, never an element outside the tree. */\n private _parentRow(row: HTMLElement | null | undefined) {\n const parent = row?.parentElement.closest<HTMLElement>('li[role=\"treeitem\"]');\n return this._branches.has(parent) ? parent : null;\n }\n\n private _optionOf(row: HTMLElement | null | undefined) {\n return this._branches?.get(row) ?? this._values?.find(({ optionEl }) => optionEl === row)?.el;\n }\n\n private _rowOf(option: HTMLOptionElement | undefined) {\n const branch = Array.from(this._branches).find(([, branchOption]) => branchOption === option)?.[0];\n return branch ?? this._values.find(({ el }) => el === option)?.optionEl;\n }\n\n /** Chooses a leaf, or opens or closes a branch. */\n _activate(row: HTMLElement) {\n if (row.closest('[hidden]')) return;\n if (this._branches.has(row)) this._toggle(row, row.ariaExpanded !== 'true');\n else this._selectOptionElement(row);\n }\n\n /** Opens a closed branch, or moves into an open one. */\n _openOrEnter(row: HTMLElement) {\n if (!this._branches.has(row)) return;\n if (row.ariaExpanded !== 'true') this._toggle(row, true);\n else this._focusRow(row.querySelector<HTMLElement>(':scope > ul > li:not(.disabled, [hidden])'));\n }\n\n /** Closes an open branch, or moves to the parent row. */\n _closeOrLeave(row: HTMLElement) {\n if (row.ariaExpanded === 'true') this._toggle(row, false);\n else this._focusRow(this._parentRow(row));\n }\n\n /** Opens every branch beside `row`. */\n _openSiblings(row: HTMLElement) {\n Array.from(row.parentElement.children).forEach((sibling) => {\n if (this._branches.has(sibling as HTMLElement) && !sibling.hasAttribute('hidden')) this._toggle(sibling as HTMLElement, true);\n });\n }\n\n /**\n * Moves to the next row whose text starts with the characters typed in the\n * last second, as Menu's typeahead does. A repeated search starts on the\n * focused row, so typing more of its text keeps it.\n */\n _typeahead(row: HTMLElement, key: string) {\n clearTimeout(this._typedTimer);\n this._typed += key.toLowerCase();\n this._typedTimer = setTimeout(() => { this._typed = ''; }, 1000);\n const rows = this._enabledRows();\n const from = rows.indexOf(row) + (this._typed.length === 1 ? 1 : 0);\n const match = [...rows.slice(from), ...rows.slice(0, from)]\n .find((candidate) => candidate.firstChild.textContent.trim().toLowerCase().startsWith(this._typed));\n this._focusRow(match);\n }\n\n private _toggle(row: HTMLElement, open: boolean) {\n this._setExpanded(row, open);\n if (this.menu?.isOpen) this.menu.recalculateDimensions();\n }\n\n private _keyFor(e: KeyboardEvent): TreeKey | undefined {\n if (!Utils.plainKey(e)) return undefined;\n return TREE_KEYS[this._logicalKey(e.key)] ?? (e.key.length === 1 ? typeahead : undefined);\n }\n\n /** The key as in a left-to-right tree. */\n private _logicalKey(key: string) {\n const rtl = getComputedStyle(this.tree).direction === 'rtl';\n return (rtl && MIRRORED[key]) || key;\n }\n\n private _handleTreeKeydown = Utils.ignoringComposition((e: KeyboardEvent) => {\n const row = Utils.eventTarget(e)?.closest<HTMLElement>('li[role=\"treeitem\"]');\n const action = row && this._keyFor(e);\n if (!action) return;\n e.preventDefault();\n e.stopPropagation();\n action(this, row, e);\n });\n\n // Only a row's label acts. A disabled row passes clicks through to its\n // group, which must not toggle the branch around it.\n private _handleTreeClick = (e: MouseEvent) => {\n const target = Utils.eventTarget(e);\n if (!this.tree.contains(target)) return;\n const label = target.closest('li[role=\"treeitem\"] > span');\n e.preventDefault();\n e.stopPropagation();\n if (label) this._activate(label.parentElement);\n };\n}\n"],
5
+ "mappings": ";;;;;;;;AAoBO,SAAS,WAAW,SAA4C;AACrE,QAAM,UAAU,oBAAI,IAA+B;AACnD,UAAQ,QAAQ,CAAC,WAAW;AAAE,QAAI,CAAC,QAAQ,IAAI,OAAO,KAAK,EAAG,SAAQ,IAAI,OAAO,OAAO,MAAM;AAAA,EAAG,CAAC;AAClG,QAAM,WAAW,CAAC,WAA8B,QAAQ,IAAI,OAAO,QAAQ,UAAU,MAAS;AAE9F,QAAM,QAAQ,CAAC,WAA8B;AAC3C,QAAI,SAAS,SAAS,MAAM;AAC5B,aAAS,QAAQ,GAAG,UAAU,WAAW,UAAU,QAAQ,QAAQ,QAAQ,QAAS,UAAS,SAAS,MAAM;AAC5G,WAAO,WAAW;AAAA,EACpB;AACA,QAAM,QAAQ,IAAI,IAAI,QAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,UAAU,CAAC,EAAkB,CAAC,CAAC,CAAC;AACjG,QAAM,QAAsB,CAAC;AAC7B,UAAQ,QAAQ,CAAC,WAAW;AAC1B,UAAM,SAAS,MAAM,MAAM,IAAI,SAAY,SAAS,MAAM;AAC1D,KAAC,SAAS,MAAM,IAAI,MAAM,EAAE,WAAW,OAAO,KAAK,MAAM,IAAI,MAAM,CAAC;AAAA,EACtE,CAAC;AACD,SAAO;AACT;AAKA,IAAM,QAAQ,EAAE,SAAS,IAAI,WAAW,EAAE;AAC1C,IAAM,OAAgB,CAAC,MAAM,MAAM,MAAM,KAAK,UAAU,MAAM,YAAY,KAAK,aAAa,GAAG,GAAG,KAAK,CAAC;AACxG,IAAM,WAAoB,CAAC,MAAM,QAAQ,KAAK,UAAU,GAAG;AAG3D,IAAM,YAAq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Component
3
- } from "./chunk-PD6HYHAE.mjs";
3
+ } from "./chunk-EB2V4OKL.mjs";
4
4
 
5
5
  // src/ts/components/particles.ts
6
6
  var _defaults = {
@@ -12,64 +12,80 @@ var _defaults = {
12
12
  vx: 0,
13
13
  vy: 0
14
14
  };
15
- var Particles = class _Particles extends Component {
15
+ var Particles = class extends Component {
16
16
  constructor(el, options) {
17
- super(el, options, _Particles);
17
+ super(el, options);
18
18
  this._particles = [];
19
19
  this._width = 0;
20
20
  this._height = 0;
21
+ /** The device pixel ratio the buffer was sized for, which painting scales by. */
22
+ this._dpr = 1;
21
23
  this._frame = 0;
22
24
  this._last = 0;
23
25
  // Pointer offset from the canvas center, kept from its last move inside.
24
26
  this._mouse = { x: 0, y: 0 };
25
27
  this._still = false;
28
+ this._visible = true;
29
+ this._motion = null;
30
+ this._theme = null;
26
31
  this._resizeObserver = null;
27
32
  this._visibility = null;
33
+ this._onMotion = () => {
34
+ this._still = this._motion.matches;
35
+ if (this._still) {
36
+ for (const p of this._particles) p.alpha = p.targetAlpha;
37
+ this._paint();
38
+ }
39
+ this._animate();
40
+ };
41
+ this._repaint = () => {
42
+ if (this._still) this._paint();
43
+ };
28
44
  this._onPointerMove = (e) => {
29
45
  const r = this.el.getBoundingClientRect();
30
46
  const x = e.clientX - r.left - r.width / 2;
31
47
  const y = e.clientY - r.top - r.height / 2;
32
48
  if (Math.abs(x) < r.width / 2 && Math.abs(y) < r.height / 2) this._mouse = { x, y };
33
49
  };
34
- this.el["Expressive_Particles"] = this;
35
- this.options = { ..._Particles.defaults, ...options };
36
50
  this._ctx = this.el.getContext("2d");
37
51
  if (!this._ctx) return;
38
52
  this._style = getComputedStyle(this.el);
39
- this._still = typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
40
- this._reset();
41
- if (typeof ResizeObserver !== "undefined") {
42
- this._resizeObserver = new ResizeObserver(() => {
43
- if (this.el.clientWidth !== this._width || this.el.clientHeight !== this._height) this._reset();
44
- });
45
- this._resizeObserver.observe(this.el);
46
- }
47
- if (this._still) return;
48
- if (typeof IntersectionObserver === "undefined") {
49
- this._start();
50
- return;
51
- }
52
- this._visibility = new IntersectionObserver(([entry]) => entry.isIntersecting ? this._start() : this._stop());
53
+ this._motion = matchMedia("(prefers-reduced-motion: reduce)");
54
+ const { signal } = this._events;
55
+ this._motion.addEventListener("change", this._onMotion, { signal });
56
+ matchMedia("(prefers-color-scheme: dark)").addEventListener("change", this._repaint, { signal });
57
+ this._theme = new MutationObserver(this._repaint);
58
+ this._theme.observe(document.documentElement, { attributes: true, attributeFilter: ["theme"], subtree: true });
59
+ this._still = this._motion.matches;
60
+ this._fit();
61
+ this._scatter();
62
+ this._resizeObserver = new ResizeObserver(() => {
63
+ if (this.el.clientWidth !== this._width || this.el.clientHeight !== this._height) this._resize();
64
+ });
65
+ this._resizeObserver.observe(this.el);
66
+ this._visibility = new IntersectionObserver((entries) => {
67
+ this._visible = entries[entries.length - 1].isIntersecting;
68
+ this._animate();
69
+ });
53
70
  this._visibility.observe(this.el);
54
71
  }
55
72
  static get defaults() {
56
73
  return _defaults;
57
74
  }
58
- static init(els, options = {}) {
59
- return super.init(els, options, _Particles);
60
- }
61
- static getInstance(el) {
62
- return el["Expressive_Particles"];
63
- }
64
75
  destroy() {
65
76
  this._stop();
77
+ this._theme?.disconnect();
66
78
  this._resizeObserver?.disconnect();
67
79
  this._visibility?.disconnect();
68
80
  if (this._ctx) {
69
81
  this._ctx.setTransform(1, 0, 0, 1, 0, 0);
70
82
  this._ctx.clearRect(0, 0, this.el.width, this.el.height);
71
83
  }
72
- this.el["Expressive_Particles"] = void 0;
84
+ super.destroy();
85
+ }
86
+ _animate() {
87
+ if (this._visible && !this._still) this._start();
88
+ else this._stop();
73
89
  }
74
90
  _start() {
75
91
  if (this._frame) return;
@@ -84,17 +100,36 @@ var Particles = class _Particles extends Component {
84
100
  this._frame = 0;
85
101
  window.removeEventListener("pointermove", this._onPointerMove);
86
102
  }
87
- // Matches the pixel buffer to the canvas box and scatters a new set.
88
- _reset() {
103
+ /** Matches the pixel buffer to the canvas box, which clears it. */
104
+ _fit() {
89
105
  this._width = this.el.clientWidth;
90
106
  this._height = this.el.clientHeight;
91
- this.el.width = Math.round(this._width * devicePixelRatio);
92
- this.el.height = Math.round(this._height * devicePixelRatio);
107
+ this._dpr = devicePixelRatio;
108
+ this.el.width = Math.round(this._width * this._dpr);
109
+ this.el.height = Math.round(this._height * this._dpr);
110
+ }
111
+ /** Scatters a new set of particles. */
112
+ _scatter() {
93
113
  this._particles = Array.from({ length: this.options.quantity }, () => this._particle());
94
- if (this._still) {
95
- for (const p of this._particles) p.alpha = p.targetAlpha;
96
- this._paint();
114
+ if (this._still) for (const p of this._particles) p.alpha = p.targetAlpha;
115
+ this._repaint();
116
+ }
117
+ /**
118
+ * Refits the buffer and moves each particle with the box, so a drag that
119
+ * resizes the canvas every frame keeps the same dots. It used to scatter a
120
+ * new set each time. A box that had no size has no positions to keep.
121
+ * Refitting clears the buffer, and the observer runs after this frame's
122
+ * draw, so a moving canvas is painted here too or it shows blank.
123
+ */
124
+ _resize() {
125
+ const [width, height] = [this._width, this._height];
126
+ this._fit();
127
+ if (!width || !height) return this._scatter();
128
+ for (const p of this._particles) {
129
+ p.x *= this._width / width;
130
+ p.y *= this._height / height;
97
131
  }
132
+ this._paint();
98
133
  }
99
134
  _particle() {
100
135
  return {
@@ -132,7 +167,7 @@ var Particles = class _Particles extends Component {
132
167
  }
133
168
  _paint() {
134
169
  const ctx = this._ctx;
135
- const dpr = devicePixelRatio;
170
+ const dpr = this._dpr;
136
171
  ctx.setTransform(1, 0, 0, 1, 0, 0);
137
172
  ctx.clearRect(0, 0, this.el.width, this.el.height);
138
173
  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
@@ -147,8 +182,9 @@ var Particles = class _Particles extends Component {
147
182
  ctx.globalAlpha = 1;
148
183
  }
149
184
  };
185
+ Particles.key = "Expressive_Particles";
150
186
 
151
187
  export {
152
188
  Particles
153
189
  };
154
- //# sourceMappingURL=chunk-C6CHEWYP.mjs.map
190
+ //# sourceMappingURL=chunk-TMQDZSDC.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/components/particles.ts"],
4
+ "sourcesContent": ["import { Component, BaseOptions } from '../core/component';\n\nexport interface ParticlesOptions extends BaseOptions {\n /**\n * Number of particles.\n * @default 100\n */\n quantity: number;\n /**\n * How firmly particles hold their place against the pointer. Lower\n * follows the pointer further.\n * @default 50\n */\n staticity: number;\n /**\n * Frames a particle takes to catch up with the pointer. Higher is slower.\n * @default 50\n */\n ease: number;\n /**\n * Base radius in pixels. Each particle adds 0 or 1 to it.\n * @default 0.4\n */\n size: number;\n /**\n * A CSS color. Empty uses the canvas's CSS `color`, which defaults to the\n * theme's on-surface color.\n * @default ''\n */\n color: string;\n /**\n * Horizontal drift in pixels per frame. Negative drifts left.\n * @default 0\n */\n vx: number;\n /**\n * Vertical drift in pixels per frame. Negative drifts up.\n * @default 0\n */\n vy: number;\n}\n\nconst _defaults: ParticlesOptions = {\n quantity: 100,\n staticity: 50,\n ease: 50,\n size: 0.4,\n color: '',\n vx: 0,\n vy: 0\n};\n\ninterface Particle {\n x: number;\n y: number;\n translateX: number;\n translateY: number;\n size: number;\n alpha: number;\n targetAlpha: number;\n dx: number;\n dy: number;\n magnetism: number;\n}\n\n/**\n * Particles. A `<canvas class=\"particles\">` covers its nearest positioned\n * ancestor with slowly drifting dots that lean toward the pointer. Under\n * reduced motion the dots are drawn once and stay still.\n */\nexport class Particles extends Component<ParticlesOptions> {\n declare el: HTMLCanvasElement;\n private _ctx: CanvasRenderingContext2D | null;\n private _style: CSSStyleDeclaration;\n private _particles: Particle[] = [];\n private _width = 0;\n private _height = 0;\n /** The device pixel ratio the buffer was sized for, which painting scales by. */\n private _dpr = 1;\n private _frame = 0;\n private _last = 0;\n // Pointer offset from the canvas center, kept from its last move inside.\n private _mouse = { x: 0, y: 0 };\n private _still = false;\n private _visible = true;\n private _motion: MediaQueryList | null = null;\n private _theme: MutationObserver | null = null;\n private _resizeObserver: ResizeObserver | null = null;\n private _visibility: IntersectionObserver | null = null;\n\n constructor(el: HTMLElement, options: Partial<ParticlesOptions>) {\n super(el, options);\n this._ctx = this.el.getContext('2d');\n if (!this._ctx) return;\n this._style = getComputedStyle(this.el);\n this._motion = matchMedia('(prefers-reduced-motion: reduce)');\n const { signal } = this._events;\n this._motion.addEventListener('change', this._onMotion, { signal });\n // Still dots are painted once, so a theme or color-scheme change\n // repaints them. Moving ones read the color every frame anyway.\n matchMedia('(prefers-color-scheme: dark)').addEventListener('change', this._repaint, { signal });\n this._theme = new MutationObserver(this._repaint);\n this._theme.observe(document.documentElement, { attributes: true, attributeFilter: ['theme'], subtree: true });\n this._still = this._motion.matches;\n this._fit();\n this._scatter();\n this._resizeObserver = new ResizeObserver(() => {\n if (this.el.clientWidth !== this._width || this.el.clientHeight !== this._height) this._resize();\n });\n this._resizeObserver.observe(this.el);\n // Animates only while on screen. A canvas scrolled away, hidden or\n // removed without destroy() stops drawing and following the pointer.\n // Entries arrive oldest first, so the last one is the current state.\n this._visibility = new IntersectionObserver((entries) => {\n this._visible = entries[entries.length - 1].isIntersecting;\n this._animate();\n });\n this._visibility.observe(this.el);\n }\n\n static get defaults(): ParticlesOptions {\n return _defaults;\n }\n\n static key = 'Expressive_Particles';\n\n destroy() {\n this._stop();\n this._theme?.disconnect();\n this._resizeObserver?.disconnect();\n this._visibility?.disconnect();\n if (this._ctx) {\n this._ctx.setTransform(1, 0, 0, 1, 0, 0);\n this._ctx.clearRect(0, 0, this.el.width, this.el.height);\n }\n super.destroy();\n }\n\n private _animate() {\n if (this._visible && !this._still) this._start();\n else this._stop();\n }\n\n private _onMotion = () => {\n this._still = this._motion.matches;\n if (this._still) {\n for (const p of this._particles) p.alpha = p.targetAlpha;\n this._paint();\n }\n this._animate();\n };\n\n private _repaint = () => {\n if (this._still) this._paint();\n };\n\n private _start() {\n if (this._frame) return;\n window.addEventListener('pointermove', this._onPointerMove, { passive: true });\n this._frame = requestAnimationFrame((now) => { this._last = now; this._draw(now); });\n }\n\n private _stop() {\n cancelAnimationFrame(this._frame);\n this._frame = 0;\n window.removeEventListener('pointermove', this._onPointerMove);\n }\n\n private _onPointerMove = (e: PointerEvent) => {\n const r = this.el.getBoundingClientRect();\n const x = e.clientX - r.left - r.width / 2;\n const y = e.clientY - r.top - r.height / 2;\n if (Math.abs(x) < r.width / 2 && Math.abs(y) < r.height / 2) this._mouse = { x, y };\n };\n\n /** Matches the pixel buffer to the canvas box, which clears it. */\n private _fit() {\n this._width = this.el.clientWidth;\n this._height = this.el.clientHeight;\n this._dpr = devicePixelRatio;\n this.el.width = Math.round(this._width * this._dpr);\n this.el.height = Math.round(this._height * this._dpr);\n }\n\n /** Scatters a new set of particles. */\n private _scatter() {\n this._particles = Array.from({ length: this.options.quantity }, () => this._particle());\n if (this._still) for (const p of this._particles) p.alpha = p.targetAlpha;\n this._repaint();\n }\n\n /**\n * Refits the buffer and moves each particle with the box, so a drag that\n * resizes the canvas every frame keeps the same dots. It used to scatter a\n * new set each time. A box that had no size has no positions to keep.\n * Refitting clears the buffer, and the observer runs after this frame's\n * draw, so a moving canvas is painted here too or it shows blank.\n */\n private _resize() {\n const [width, height] = [this._width, this._height];\n this._fit();\n if (!width || !height) return this._scatter();\n for (const p of this._particles) {\n p.x *= this._width / width;\n p.y *= this._height / height;\n }\n this._paint();\n }\n\n private _particle(): Particle {\n return {\n x: Math.floor(Math.random() * this._width),\n y: Math.floor(Math.random() * this._height),\n translateX: 0,\n translateY: 0,\n size: Math.floor(Math.random() * 2) + this.options.size,\n alpha: 0,\n targetAlpha: Math.round((Math.random() * 0.6 + 0.1) * 10) / 10,\n dx: (Math.random() - 0.5) * 0.1,\n dy: (Math.random() - 0.5) * 0.1,\n magnetism: 0.1 + Math.random() * 4\n };\n }\n\n private _draw(now: number) {\n // Frames are counted at 60 per second whatever the display rate.\n const step = Math.min((now - this._last) / (1000 / 60), 4);\n this._last = now;\n const { staticity, ease, vx, vy } = this.options;\n const follow = Math.min(step / ease, 1);\n this._particles = this._particles.map((p) => {\n p.x += (p.dx + vx) * step;\n p.y += (p.dy + vy) * step;\n p.translateX += (this._mouse.x / (staticity / p.magnetism) - p.translateX) * follow;\n p.translateY += (this._mouse.y / (staticity / p.magnetism) - p.translateY) * follow;\n // Fades in, and fades out within 20px of an edge.\n const x = p.x + p.translateX;\n const y = p.y + p.translateY;\n const edge = Math.min(x - p.size, this._width - x - p.size, y - p.size, this._height - y - p.size) / 20;\n p.alpha = edge > 1 ? Math.min(p.alpha + 0.02 * step, p.targetAlpha) : p.targetAlpha * edge;\n const gone = p.x < -p.size || p.x > this._width + p.size || p.y < -p.size || p.y > this._height + p.size;\n return gone ? this._particle() : p;\n });\n this._paint();\n this._frame = requestAnimationFrame((t) => this._draw(t));\n }\n\n private _paint() {\n const ctx = this._ctx!;\n // The ratio the buffer has, not the current one: after the page moves to\n // a screen with another ratio, painting at the new one drew every dot\n // scaled and offset in the old buffer.\n // ponytail: the buffer keeps the old ratio until the next resize; a\n // resolution media query listener if a sharp redraw matters.\n const dpr = this._dpr;\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.clearRect(0, 0, this.el.width, this.el.height);\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n // Read every frame, so a theme or color-scheme change applies at once.\n ctx.fillStyle = this.options.color || this._style.color;\n for (const p of this._particles) {\n if (p.alpha <= 0) continue;\n ctx.globalAlpha = p.alpha;\n ctx.beginPath();\n ctx.arc(p.x + p.translateX, p.y + p.translateY, p.size, 0, 2 * Math.PI);\n ctx.fill();\n }\n ctx.globalAlpha = 1;\n }\n}\n"],
5
+ "mappings": ";;;;;AA0CA,IAAM,YAA8B;AAAA,EAClC,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,IAAI;AACN;AAoBO,IAAM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,UAAU,IAAI;AAAA,IACnC,CAAC;AACD,SAAK,OAAO;AACZ,SAAK,SAAS,sBAAsB,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;AAAA,EAC1D;AAAA,EAEQ,SAAS;AACf,UAAM,MAAM,KAAK;AAMjB,UAAM,MAAM,KAAK;AACjB,QAAI,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AACjC,QAAI,UAAU,GAAG,GAAG,KAAK,GAAG,OAAO,KAAK,GAAG,MAAM;AACjD,QAAI,aAAa,KAAK,GAAG,GAAG,KAAK,GAAG,CAAC;AAErC,QAAI,YAAY,KAAK,QAAQ,SAAS,KAAK,OAAO;AAClD,eAAW,KAAK,KAAK,YAAY;AAC/B,UAAI,EAAE,SAAS,EAAG;AAClB,UAAI,cAAc,EAAE;AACpB,UAAI,UAAU;AACd,UAAI,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,KAAK,EAAE;AACtE,UAAI,KAAK;AAAA,IACX;AACA,QAAI,cAAc;AAAA,EACpB;AACF;AAvMa,UAsDJ,MAAM;",
6
+ "names": []
7
+ }
@@ -0,0 +1,48 @@
1
+ import {
2
+ Snackbar
3
+ } from "./chunk-HEH7E3KO.mjs";
4
+ import {
5
+ Utils
6
+ } from "./chunk-67UNY7RH.mjs";
7
+
8
+ // src/ts/behaviors/copy.ts
9
+ var _Copy = class _Copy {
10
+ // A second Init adds nothing: addEventListener ignores a listener it has.
11
+ static Init() {
12
+ if (typeof document === "undefined") return;
13
+ document.addEventListener("click", _Copy._onClick);
14
+ }
15
+ /** The text a copy button would write, or null when it names nothing. */
16
+ static textFor(button) {
17
+ if (button.hasAttribute("data-copy")) return button.getAttribute("data-copy");
18
+ const source = Utils.getElementById(button, button.getAttribute("data-copy-for") ?? "");
19
+ if (!source) return null;
20
+ return source instanceof HTMLInputElement || source instanceof HTMLTextAreaElement || source instanceof HTMLSelectElement ? source.value : (source.textContent ?? "").trim();
21
+ }
22
+ static async _onClick(e) {
23
+ const button = Utils.closestInPath(e, "[data-copy], [data-copy-for]");
24
+ if (!button || button.matches(':disabled, [aria-disabled="true"]')) return;
25
+ const text = _Copy.textFor(button);
26
+ if (text === null) return;
27
+ let copied = true;
28
+ try {
29
+ await navigator.clipboard.writeText(text);
30
+ } catch {
31
+ copied = false;
32
+ }
33
+ new Snackbar({
34
+ text: copied ? button.getAttribute("data-copy-message") || _Copy.i18n.copied : button.getAttribute("data-copy-error") || _Copy.i18n.failed,
35
+ root: button,
36
+ // A second copy answers at once rather than waiting behind the first.
37
+ replace: true
38
+ });
39
+ Utils.emit(button, "copy", { text, copied });
40
+ }
41
+ };
42
+ _Copy.i18n = { copied: "Copied", failed: "Couldn't copy" };
43
+ var Copy = _Copy;
44
+
45
+ export {
46
+ Copy
47
+ };
48
+ //# sourceMappingURL=chunk-TVSX5YA2.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/behaviors/copy.ts"],
4
+ "sourcesContent": ["import { Snackbar } from '../components/snackbar';\nimport { Utils } from '../core/utils';\n\n/**\n * Copy buttons. A click on `[data-copy]` writes that attribute's text to the\n * clipboard; a click on `[data-copy-for=\"id\"]` writes the named element's\n * value (fields) or text content (anything else). A snackbar confirms the\n * result, which is also what screen readers announce: it is a polite status.\n * `Copy.i18n` holds its two texts; `data-copy-message` and `data-copy-error`\n * replace them for one button.\n */\nexport class Copy {\n static i18n = { copied: 'Copied', failed: \"Couldn't copy\" };\n // A second Init adds nothing: addEventListener ignores a listener it has.\n static Init() {\n if (typeof document === 'undefined') return;\n document.addEventListener('click', Copy._onClick);\n }\n\n /** The text a copy button would write, or null when it names nothing. */\n static textFor(button: Element): string | null {\n if (button.hasAttribute('data-copy')) return button.getAttribute('data-copy');\n const source = Utils.getElementById(button, button.getAttribute('data-copy-for') ?? '');\n if (!source) return null;\n return source instanceof HTMLInputElement ||\n source instanceof HTMLTextAreaElement ||\n source instanceof HTMLSelectElement\n ? source.value\n : (source.textContent ?? '').trim();\n }\n\n private static async _onClick(e: MouseEvent) {\n const button = Utils.closestInPath(e, '[data-copy], [data-copy-for]');\n if (!button || button.matches(':disabled, [aria-disabled=\"true\"]')) return;\n const text = Copy.textFor(button);\n if (text === null) return;\n let copied = true;\n try {\n await navigator.clipboard.writeText(text);\n } catch {\n // No clipboard API outside a secure context, or permission refused.\n copied = false;\n }\n new Snackbar({\n text: copied\n ? button.getAttribute('data-copy-message') || Copy.i18n.copied\n : button.getAttribute('data-copy-error') || Copy.i18n.failed,\n root: button as HTMLElement,\n // A second copy answers at once rather than waiting behind the first.\n replace: true\n });\n Utils.emit(button, 'copy', { text, copied });\n }\n}\n"],
5
+ "mappings": ";;;;;;;;AAWO,IAAM,QAAN,MAAM,MAAK;AAAA;AAAA,EAGhB,OAAO,OAAO;AACZ,QAAI,OAAO,aAAa,YAAa;AACrC,aAAS,iBAAiB,SAAS,MAAK,QAAQ;AAAA,EAClD;AAAA;AAAA,EAGA,OAAO,QAAQ,QAAgC;AAC7C,QAAI,OAAO,aAAa,WAAW,EAAG,QAAO,OAAO,aAAa,WAAW;AAC5E,UAAM,SAAS,MAAM,eAAe,QAAQ,OAAO,aAAa,eAAe,KAAK,EAAE;AACtF,QAAI,CAAC,OAAQ,QAAO;AACpB,WAAO,kBAAkB,oBACvB,kBAAkB,uBAClB,kBAAkB,oBAChB,OAAO,SACN,OAAO,eAAe,IAAI,KAAK;AAAA,EACtC;AAAA,EAEA,aAAqB,SAAS,GAAe;AAC3C,UAAM,SAAS,MAAM,cAAc,GAAG,8BAA8B;AACpE,QAAI,CAAC,UAAU,OAAO,QAAQ,mCAAmC,EAAG;AACpE,UAAM,OAAO,MAAK,QAAQ,MAAM;AAChC,QAAI,SAAS,KAAM;AACnB,QAAI,SAAS;AACb,QAAI;AACF,YAAM,UAAU,UAAU,UAAU,IAAI;AAAA,IAC1C,QAAQ;AAEN,eAAS;AAAA,IACX;AACA,QAAI,SAAS;AAAA,MACX,MAAM,SACF,OAAO,aAAa,mBAAmB,KAAK,MAAK,KAAK,SACtD,OAAO,aAAa,iBAAiB,KAAK,MAAK,KAAK;AAAA,MACxD,MAAM;AAAA;AAAA,MAEN,SAAS;AAAA,IACX,CAAC;AACD,UAAM,KAAK,QAAQ,QAAQ,EAAE,MAAM,OAAO,CAAC;AAAA,EAC7C;AACF;AA1Ca,MACJ,OAAO,EAAE,QAAQ,UAAU,QAAQ,gBAAgB;AADrD,IAAM,OAAN;",
6
+ "names": []
7
+ }
@@ -0,0 +1,80 @@
1
+ import {
2
+ restoreAttribute
3
+ } from "./chunk-67UNY7RH.mjs";
4
+
5
+ // src/ts/core/formControl.ts
6
+ var formAssociated = () => typeof ElementInternals !== "undefined" && "setFormValue" in ElementInternals.prototype;
7
+ var mirrors = /* @__PURE__ */ new WeakMap();
8
+ function define(tag) {
9
+ var _a;
10
+ if (customElements.get(tag)) return;
11
+ customElements.define(tag, (_a = class extends HTMLElement {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.internals = this.attachInternals();
15
+ this.onFormReset = null;
16
+ }
17
+ formResetCallback() {
18
+ this.onFormReset?.();
19
+ }
20
+ get form() {
21
+ return this.internals.form;
22
+ }
23
+ get name() {
24
+ return this.getAttribute("name") ?? "";
25
+ }
26
+ get labels() {
27
+ return this._input?.labels;
28
+ }
29
+ get validity() {
30
+ return this.internals.validity;
31
+ }
32
+ get validationMessage() {
33
+ return this.internals.validationMessage;
34
+ }
35
+ get willValidate() {
36
+ return this.internals.willValidate;
37
+ }
38
+ checkValidity() {
39
+ return this.internals.checkValidity();
40
+ }
41
+ reportValidity() {
42
+ return this.internals.reportValidity();
43
+ }
44
+ focus(options) {
45
+ this._input?.focus(options);
46
+ }
47
+ get _input() {
48
+ return this.querySelector(":scope > input");
49
+ }
50
+ }, _a.formAssociated = true, _a));
51
+ }
52
+ function copyState(control, input) {
53
+ ["disabled", "form"].forEach((name) => restoreAttribute(control, name, input.getAttribute(name)));
54
+ }
55
+ function wrapInControl(tag, input, onChange) {
56
+ define(tag);
57
+ const control = document.createElement(tag);
58
+ control.style.display = "contents";
59
+ control.setAttribute("name", input.getAttribute("name") ?? "");
60
+ input.removeAttribute("name");
61
+ input.replaceWith(control);
62
+ control.append(input);
63
+ copyState(control, input);
64
+ const mirror = new MutationObserver(() => (copyState(control, input), onChange()));
65
+ mirror.observe(input, { attributeFilter: ["disabled", "readonly", "form"] });
66
+ mirrors.set(control, mirror);
67
+ return control;
68
+ }
69
+ function unwrapControl(control, input) {
70
+ mirrors.get(control)?.disconnect();
71
+ control.replaceWith(...control.childNodes);
72
+ input.setAttribute("name", control.getAttribute("name") ?? "");
73
+ }
74
+
75
+ export {
76
+ formAssociated,
77
+ wrapInControl,
78
+ unwrapControl
79
+ };
80
+ //# sourceMappingURL=chunk-UHO5CV6K.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ts/core/formControl.ts"],
4
+ "sourcesContent": ["import { restoreAttribute } from './utils';\n\n/**\n * A form-associated element that wraps a text input and submits for it, so\n * the browser handles the field's values, reset, validity and disabled state.\n * Chips and Cascader each define one under their own tag.\n */\nexport interface FormControl extends HTMLElement {\n readonly internals: ElementInternals;\n /** Called for a form reset no listener canceled, in the same task. */\n onFormReset: (() => void) | null;\n}\n\n/** Whether the browser has form-associated custom elements. jsdom does not. */\nexport const formAssociated = () => typeof ElementInternals !== 'undefined' && 'setFormValue' in ElementInternals.prototype;\n\n/** Each control's observer of its input's attributes. */\nconst mirrors = new WeakMap<FormControl, MutationObserver>();\n\n/**\n * Defines `tag` on first use, so importing the bundle needs no DOM, and only\n * once, so a second copy of the bundle on the page uses the first one's. The\n * form sees the control, so it answers what a field does; its anchor and\n * focus are the input it wraps.\n */\nfunction define(tag: string) {\n if (customElements.get(tag)) return;\n customElements.define(tag, class extends HTMLElement {\n static formAssociated = true;\n readonly internals = this.attachInternals();\n onFormReset: (() => void) | null = null;\n formResetCallback() { this.onFormReset?.(); }\n get form() { return this.internals.form; }\n get name() { return this.getAttribute('name') ?? ''; }\n get labels() { return this._input?.labels; }\n get validity() { return this.internals.validity; }\n get validationMessage() { return this.internals.validationMessage; }\n get willValidate() { return this.internals.willValidate; }\n checkValidity() { return this.internals.checkValidity(); }\n reportValidity() { return this.internals.reportValidity(); }\n override focus(options?: FocusOptions) { this._input?.focus(options); }\n private get _input() { return this.querySelector<HTMLInputElement>(':scope > input'); }\n });\n}\n\n/** The control is disabled with the input, or with a fieldset by itself, and submits to the input's form. */\nfunction copyState(control: FormControl, input: HTMLInputElement) {\n ['disabled', 'form'].forEach((name) => restoreAttribute(control, name, input.getAttribute(name)));\n}\n\n/**\n * Wraps `input` in a `tag` control that takes its name. `display: contents`\n * lays the input out as a child of the field still. The control follows the\n * input's disabled and form attributes, and `onChange` runs after the input's\n * disabled, readonly or form attribute changes.\n */\nexport function wrapInControl(tag: string, input: HTMLInputElement, onChange: () => void): FormControl {\n define(tag);\n const control = document.createElement(tag) as FormControl;\n control.style.display = 'contents';\n control.setAttribute('name', input.getAttribute('name') ?? '');\n input.removeAttribute('name');\n input.replaceWith(control);\n control.append(input);\n copyState(control, input);\n const mirror = new MutationObserver(() => (copyState(control, input), onChange()));\n mirror.observe(input, { attributeFilter: ['disabled', 'readonly', 'form'] });\n mirrors.set(control, mirror);\n return control;\n}\n\n/** Unwraps the control, with whatever else went in it, and gives `input` its name back. */\nexport function unwrapControl(control: FormControl, input: HTMLInputElement) {\n mirrors.get(control)?.disconnect();\n control.replaceWith(...control.childNodes);\n input.setAttribute('name', control.getAttribute('name') ?? '');\n}\n"],
5
+ "mappings": ";;;;;AAcO,IAAM,iBAAiB,MAAM,OAAO,qBAAqB,eAAe,kBAAkB,iBAAiB;AAGlH,IAAM,UAAU,oBAAI,QAAuC;AAQ3D,SAAS,OAAO,KAAa;AAzB7B;AA0BE,MAAI,eAAe,IAAI,GAAG,EAAG;AAC7B,iBAAe,OAAO,MAAK,mBAAc,YAAY;AAAA,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